@financial-times/n-conversion-forms 28.3.0 → 28.4.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.
@@ -6,7 +6,7 @@ references:
6
6
  container_config_node: &container_config_node
7
7
  working_directory: ~/project/build
8
8
  docker:
9
- - image: cimg/node:16.17-browsers
9
+ - image: cimg/node:16.19-browsers
10
10
  workspace_root: &workspace_root
11
11
  ~/project
12
12
 
@@ -53,9 +53,6 @@ references:
53
53
 
54
54
  version: 2.1
55
55
 
56
- orbs:
57
- node: circleci/node@4.9.0
58
-
59
56
  jobs:
60
57
 
61
58
  build:
@@ -66,8 +63,9 @@ jobs:
66
63
  name: Checkout next-ci-shared-helpers
67
64
  command: git clone --depth 1 git@github.com:Financial-Times/next-ci-shared-helpers.git .circleci/shared-helpers
68
65
  - *restore_npm_cache
69
- - node/install-npm:
70
- version: "^7"
66
+ - run:
67
+ name: Install npm v7
68
+ command: npm install -g npm@7
71
69
  - run:
72
70
  name: Install project dependencies
73
71
  command: make install
@@ -24133,7 +24133,7 @@
24133
24133
  "node_modules/puppeteer": {
24134
24134
  "version": "1.19.0",
24135
24135
  "integrity": "sha512-2S6E6ygpoqcECaagDbBopoSOPDv0pAZvTbnBgUY+6hq0/XDFDOLEMNlHF/SKJlzcaZ9ckiKjKDuueWI3FN/WXw==",
24136
- "deprecated": "< 19.2.0 is no longer supported",
24136
+ "deprecated": "< 19.4.0 is no longer supported",
24137
24137
  "dev": true,
24138
24138
  "hasInstallScript": true,
24139
24139
  "dependencies": {
@@ -3,6 +3,7 @@
3
3
  exports[`PaymentTerm When using custom options renders when not using an option in nameMap but provides a custom props instead 1`] = `
4
4
  <div id="paymentTermField"
5
5
  class="o-forms__group ncf__payment-term"
6
+ data-country-code
6
7
  >
7
8
  <div class="ncf__payment-term__options-grid">
8
9
  <div class="ncf__payment-term__item o-forms-input--radio-round ncf__payment-term__item--discount">
@@ -68,6 +69,7 @@ exports[`PaymentTerm When using custom options renders when not using an option
68
69
  exports[`PaymentTerm annual option render option 1`] = `
69
70
  <div id="paymentTermField"
70
71
  class="o-forms__group ncf__payment-term"
72
+ data-country-code
71
73
  >
72
74
  <div class>
73
75
  <div class="ncf__payment-term__item o-forms-input--radio-round">
@@ -119,6 +121,7 @@ exports[`PaymentTerm annual option render option 1`] = `
119
121
  exports[`PaymentTerm annual option render option with discount 1`] = `
120
122
  <div id="paymentTermField"
121
123
  class="o-forms__group ncf__payment-term"
124
+ data-country-code
122
125
  >
123
126
  <div class>
124
127
  <div class="ncf__payment-term__item o-forms-input--radio-round ncf__payment-term__item--discount">
@@ -173,6 +176,7 @@ exports[`PaymentTerm annual option render option with discount 1`] = `
173
176
  exports[`PaymentTerm annual option render option with isTrial 1`] = `
174
177
  <div id="paymentTermField"
175
178
  class="o-forms__group ncf__payment-term"
179
+ data-country-code
176
180
  >
177
181
  <div class>
178
182
  <div class="ncf__payment-term__item o-forms-input--radio-round">
@@ -225,6 +229,7 @@ exports[`PaymentTerm annual option render option with isTrial 1`] = `
225
229
  exports[`PaymentTerm annual option render option with monthlyPrice 1`] = `
226
230
  <div id="paymentTermField"
227
231
  class="o-forms__group ncf__payment-term"
232
+ data-country-code
228
233
  >
229
234
  <div class>
230
235
  <div class="ncf__payment-term__item o-forms-input--radio-round">
@@ -283,6 +288,7 @@ exports[`PaymentTerm annual option render option with monthlyPrice 1`] = `
283
288
  exports[`PaymentTerm annual option render option with selected 1`] = `
284
289
  <div id="paymentTermField"
285
290
  class="o-forms__group ncf__payment-term"
291
+ data-country-code
286
292
  >
287
293
  <div class>
288
294
  <div class="ncf__payment-term__item o-forms-input--radio-round">
@@ -335,6 +341,7 @@ exports[`PaymentTerm annual option render option with selected 1`] = `
335
341
  exports[`PaymentTerm annual option render option with trial 1`] = `
336
342
  <div id="paymentTermField"
337
343
  class="o-forms__group ncf__payment-term"
344
+ data-country-code
338
345
  >
339
346
  <div class>
340
347
  <div class="ncf__payment-term__item o-forms-input--radio-round">
@@ -388,6 +395,7 @@ exports[`PaymentTerm annual option render option with trial 1`] = `
388
395
  exports[`PaymentTerm monthly option render option 1`] = `
389
396
  <div id="paymentTermField"
390
397
  class="o-forms__group ncf__payment-term"
398
+ data-country-code
391
399
  >
392
400
  <div class>
393
401
  <div class="ncf__payment-term__item o-forms-input--radio-round">
@@ -438,6 +446,7 @@ exports[`PaymentTerm monthly option render option 1`] = `
438
446
  exports[`PaymentTerm monthly option render option with discount 1`] = `
439
447
  <div id="paymentTermField"
440
448
  class="o-forms__group ncf__payment-term"
449
+ data-country-code
441
450
  >
442
451
  <div class>
443
452
  <div class="ncf__payment-term__item o-forms-input--radio-round ncf__payment-term__item--discount">
@@ -491,6 +500,7 @@ exports[`PaymentTerm monthly option render option with discount 1`] = `
491
500
  exports[`PaymentTerm monthly option render option with isTrial 1`] = `
492
501
  <div id="paymentTermField"
493
502
  class="o-forms__group ncf__payment-term"
503
+ data-country-code
494
504
  >
495
505
  <div class>
496
506
  <div class="ncf__payment-term__item o-forms-input--radio-round">
@@ -543,6 +553,7 @@ exports[`PaymentTerm monthly option render option with isTrial 1`] = `
543
553
  exports[`PaymentTerm monthly option render option with monthlyPrice 1`] = `
544
554
  <div id="paymentTermField"
545
555
  class="o-forms__group ncf__payment-term"
556
+ data-country-code
546
557
  >
547
558
  <div class>
548
559
  <div class="ncf__payment-term__item o-forms-input--radio-round">
@@ -593,6 +604,7 @@ exports[`PaymentTerm monthly option render option with monthlyPrice 1`] = `
593
604
  exports[`PaymentTerm monthly option render option with selected 1`] = `
594
605
  <div id="paymentTermField"
595
606
  class="o-forms__group ncf__payment-term"
607
+ data-country-code
596
608
  >
597
609
  <div class>
598
610
  <div class="ncf__payment-term__item o-forms-input--radio-round">
@@ -644,6 +656,7 @@ exports[`PaymentTerm monthly option render option with selected 1`] = `
644
656
  exports[`PaymentTerm monthly option render option with trial 1`] = `
645
657
  <div id="paymentTermField"
646
658
  class="o-forms__group ncf__payment-term"
659
+ data-country-code
647
660
  >
648
661
  <div class>
649
662
  <div class="ncf__payment-term__item o-forms-input--radio-round">
@@ -697,6 +710,7 @@ exports[`PaymentTerm monthly option render option with trial 1`] = `
697
710
  exports[`PaymentTerm quarterly option render option 1`] = `
698
711
  <div id="paymentTermField"
699
712
  class="o-forms__group ncf__payment-term"
713
+ data-country-code
700
714
  >
701
715
  <div class>
702
716
  <div class="ncf__payment-term__item o-forms-input--radio-round">
@@ -747,6 +761,7 @@ exports[`PaymentTerm quarterly option render option 1`] = `
747
761
  exports[`PaymentTerm quarterly option render option with discount 1`] = `
748
762
  <div id="paymentTermField"
749
763
  class="o-forms__group ncf__payment-term"
764
+ data-country-code
750
765
  >
751
766
  <div class>
752
767
  <div class="ncf__payment-term__item o-forms-input--radio-round ncf__payment-term__item--discount">
@@ -800,6 +815,7 @@ exports[`PaymentTerm quarterly option render option with discount 1`] = `
800
815
  exports[`PaymentTerm quarterly option render option with isTrial 1`] = `
801
816
  <div id="paymentTermField"
802
817
  class="o-forms__group ncf__payment-term"
818
+ data-country-code
803
819
  >
804
820
  <div class>
805
821
  <div class="ncf__payment-term__item o-forms-input--radio-round">
@@ -852,6 +868,7 @@ exports[`PaymentTerm quarterly option render option with isTrial 1`] = `
852
868
  exports[`PaymentTerm quarterly option render option with monthlyPrice 1`] = `
853
869
  <div id="paymentTermField"
854
870
  class="o-forms__group ncf__payment-term"
871
+ data-country-code
855
872
  >
856
873
  <div class>
857
874
  <div class="ncf__payment-term__item o-forms-input--radio-round">
@@ -902,6 +919,7 @@ exports[`PaymentTerm quarterly option render option with monthlyPrice 1`] = `
902
919
  exports[`PaymentTerm quarterly option render option with selected 1`] = `
903
920
  <div id="paymentTermField"
904
921
  class="o-forms__group ncf__payment-term"
922
+ data-country-code
905
923
  >
906
924
  <div class>
907
925
  <div class="ncf__payment-term__item o-forms-input--radio-round">
@@ -953,6 +971,7 @@ exports[`PaymentTerm quarterly option render option with selected 1`] = `
953
971
  exports[`PaymentTerm quarterly option render option with trial 1`] = `
954
972
  <div id="paymentTermField"
955
973
  class="o-forms__group ncf__payment-term"
974
+ data-country-code
956
975
  >
957
976
  <div class>
958
977
  <div class="ncf__payment-term__item o-forms-input--radio-round">
@@ -1006,6 +1025,7 @@ exports[`PaymentTerm quarterly option render option with trial 1`] = `
1006
1025
  exports[`PaymentTerm render with defaults 1`] = `
1007
1026
  <div id="paymentTermField"
1008
1027
  class="o-forms__group ncf__payment-term"
1028
+ data-country-code
1009
1029
  >
1010
1030
  <div class>
1011
1031
  </div>
@@ -1032,6 +1052,7 @@ exports[`PaymentTerm render with defaults 1`] = `
1032
1052
  exports[`PaymentTerm render with isPrintOrBundle 1`] = `
1033
1053
  <div id="paymentTermField"
1034
1054
  class="o-forms__group ncf__payment-term"
1055
+ data-country-code
1035
1056
  >
1036
1057
  <div class>
1037
1058
  </div>
@@ -14,6 +14,7 @@ export function PaymentTerm({
14
14
  showLegal = true,
15
15
  largePrice = false,
16
16
  optionsInARow = false,
17
+ billingCountry = '',
17
18
  }) {
18
19
  /**
19
20
  * Compute monthly price for given term name
@@ -326,7 +327,11 @@ export function PaymentTerm({
326
327
  };
327
328
 
328
329
  return (
329
- <div id={fieldId} className="o-forms__group ncf__payment-term">
330
+ <div
331
+ id={fieldId}
332
+ className="o-forms__group ncf__payment-term"
333
+ data-country-code={billingCountry}
334
+ >
330
335
  <div className={optionsInARow ? 'ncf__payment-term__options-grid' : ''}>
331
336
  {options.map((option) => createPaymentTerm(option))}
332
337
  </div>
@@ -408,4 +413,5 @@ PaymentTerm.propTypes = {
408
413
  showLegal: PropTypes.bool,
409
414
  largePrice: PropTypes.bool,
410
415
  optionsInARow: PropTypes.bool,
416
+ billingCountry: PropTypes.string,
411
417
  };
@@ -31,7 +31,9 @@ function PaymentTerm(_ref) {
31
31
  _ref$largePrice = _ref.largePrice,
32
32
  largePrice = _ref$largePrice === void 0 ? false : _ref$largePrice,
33
33
  _ref$optionsInARow = _ref.optionsInARow,
34
- optionsInARow = _ref$optionsInARow === void 0 ? false : _ref$optionsInARow;
34
+ optionsInARow = _ref$optionsInARow === void 0 ? false : _ref$optionsInARow,
35
+ _ref$billingCountry = _ref.billingCountry,
36
+ billingCountry = _ref$billingCountry === void 0 ? '' : _ref$billingCountry;
35
37
  /**
36
38
  * Compute monthly price for given term name
37
39
  * @param {number} amount price in number format
@@ -242,7 +244,8 @@ function PaymentTerm(_ref) {
242
244
  };
243
245
  return /*#__PURE__*/_react["default"].createElement("div", {
244
246
  id: fieldId,
245
- className: "o-forms__group ncf__payment-term"
247
+ className: "o-forms__group ncf__payment-term",
248
+ "data-country-code": billingCountry
246
249
  }, /*#__PURE__*/_react["default"].createElement("div", {
247
250
  className: optionsInARow ? 'ncf__payment-term__options-grid' : ''
248
251
  }, options.map(function (option) {
@@ -291,5 +294,6 @@ PaymentTerm.propTypes = {
291
294
  offerDisplayName: _propTypes["default"].string,
292
295
  showLegal: _propTypes["default"].bool,
293
296
  largePrice: _propTypes["default"].bool,
294
- optionsInARow: _propTypes["default"].bool
297
+ optionsInARow: _propTypes["default"].bool,
298
+ billingCountry: _propTypes["default"].string
295
299
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/n-conversion-forms",
3
- "version": "28.3.0",
3
+ "version": "28.4.0",
4
4
  "description": "Containing jsx components and styles for forms included on Accounts and Acqusition apps (next-signup, next-profile, next-retention, etc).",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -56,6 +56,22 @@ class PaymentTerm {
56
56
  return checked.getAttribute('value');
57
57
  }
58
58
 
59
+ /**
60
+ * Returns country code
61
+ * @return {string}
62
+ */
63
+ getCountryCode() {
64
+ return this.$paymentTerm.dataset.countryCode;
65
+ }
66
+
67
+ /**
68
+ * Update country code
69
+ * @return {string}
70
+ */
71
+ updateCountryCode(countryCode) {
72
+ this.$paymentTerm.dataset.countryCode = countryCode;
73
+ }
74
+
59
75
  /**
60
76
  * Returns the base amount for the selected payment term
61
77
  * @return {Number}
@@ -68,7 +84,6 @@ class PaymentTerm {
68
84
  }
69
85
  return checked.dataset.baseAmount;
70
86
  }
71
-
72
87
  /**
73
88
  * Register on change an event listener
74
89
  * @param {Function} callback Called with event when changed
@@ -19,6 +19,7 @@ describe('PaymentTerm', () => {
19
19
  value: 'test',
20
20
  dataset: {
21
21
  baseAmount: 100,
22
+ countryCode: 'GBP',
22
23
  },
23
24
  };
24
25
  documentStub = {
@@ -193,6 +194,13 @@ describe('PaymentTerm', () => {
193
194
  expect(returnedAmount).toBe(99);
194
195
  });
195
196
  });
197
+
198
+ describe('getCountryCode', () => {
199
+ it('returns countryCode of the selected term', () => {
200
+ const countryCode = paymentTerm.getCountryCode();
201
+ expect(countryCode).toBe('GBP');
202
+ });
203
+ });
196
204
  });
197
205
  });
198
206
  });