@financial-times/n-conversion-forms 27.3.2 → 27.4.1

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.
@@ -10,6 +10,8 @@ exports[`DeliveryAddressType renders with all props 1`] = `
10
10
  <span class="o-forms-title__main">
11
11
  Address type
12
12
  </span>
13
+ <span class="o-forms-title__prompt">
14
+ </span>
13
15
  </span>
14
16
  <div class="o-forms-input o-forms-input--inline o-forms-input--radio-round">
15
17
  <label for="home"
@@ -72,6 +74,8 @@ exports[`DeliveryAddressType renders with default props 1`] = `
72
74
  <span class="o-forms-title__main">
73
75
  Address type
74
76
  </span>
77
+ <span class="o-forms-title__prompt">
78
+ </span>
75
79
  </span>
76
80
  <div class="o-forms-input o-forms-input--inline o-forms-input--radio-round">
77
81
  <label for="home"
@@ -22,7 +22,6 @@ export function AcceptTerms ({
22
22
  isPrintProduct = false,
23
23
  specialTerms = null,
24
24
  isSingleTerm = false,
25
- isNewDigitalBuyFlowConsent = false,
26
25
  hideConfirmTermsAndConditions = false,
27
26
  }) {
28
27
  const divProps = {
@@ -52,15 +51,7 @@ export function AcceptTerms ({
52
51
 
53
52
  const authFirstStepTerms = (
54
53
  <>
55
- {
56
- // TODO: clean up the code in https://financialtimes.atlassian.net/browse/ACQ-1593
57
- // isNewDigitalBuyFlowConsent flag for new A/B testing of consents auth first buy flow
58
- // after the test it will be one of the conditions for the below flow
59
- }
60
- {isNewDigitalBuyFlowConsent && (
61
- <hr className=" ncf ncf__divider-horizontal" />
62
- )}
63
- {!isNewDigitalBuyFlowConsent && (
54
+ {(
64
55
  <ul className="o-typography-list ncf__accept-terms-list">
65
56
  <li>
66
57
  <span className="terms-auth-first-step">
@@ -410,6 +401,5 @@ AcceptTerms.propTypes = {
410
401
  isPrintProduct: PropTypes.bool,
411
402
  specialTerms: PropTypes.string,
412
403
  isSingleTerm: PropTypes.bool,
413
- isNewDigitalBuyFlowConsent: PropTypes.bool,
414
404
  hideConfirmTermsAndConditions: PropTypes.bool,
415
405
  };
@@ -13,6 +13,7 @@ export function DeliveryAddressType ({
13
13
  inputName = 'deliveryAddressType',
14
14
  options = ['home', 'company', 'pobox'],
15
15
  editMode = false,
16
+ titlePrompt = ''
16
17
  }) {
17
18
  return (
18
19
  <div
@@ -23,6 +24,7 @@ export function DeliveryAddressType ({
23
24
  >
24
25
  <span className="o-forms-title">
25
26
  <span className="o-forms-title__main">Address type</span>
27
+ <span className="o-forms-title__prompt">{titlePrompt}</span>
26
28
  </span>
27
29
 
28
30
  <div className="o-forms-input o-forms-input--inline o-forms-input--radio-round">
@@ -59,4 +61,5 @@ DeliveryAddressType.propTypes = {
59
61
  inputName: PropTypes.string,
60
62
  value: PropTypes.oneOf(['home', 'company', 'pobox']),
61
63
  options: PropTypes.arrayOf(PropTypes.oneOf(['home', 'company', 'pobox'])),
64
+ titlePrompt:PropTypes.string,
62
65
  };
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
- import { countriesSupportedISO } from '../helpers/supportedCountries';
4
+ import { countriesSupportedISO, identifyFTShippingZone } from '../helpers/supportedCountries';
5
5
 
6
6
 
7
7
  export function DeliveryCity ({
@@ -22,8 +22,14 @@ export function DeliveryCity ({
22
22
  CAN: 'e.g. Montreal',
23
23
  ARE: 'e.g. Dubai'
24
24
  };
25
+ const FTShippingZone = identifyFTShippingZone(country);
25
26
 
26
- const inputLabel = country === 'ARE'? 'Emirate or City':'City';
27
+ const labelMapping = {
28
+ ARE: 'Emirate or City',
29
+ APAC: 'City/Prefecture',
30
+ DEFAULT: 'City',
31
+ };
32
+ const inputLabel = labelMapping[FTShippingZone] ? labelMapping[FTShippingZone] : labelMapping['DEFAULT'];
27
33
 
28
34
  return (
29
35
  <label
@@ -103,12 +103,18 @@ export function DeliveryInstructions ({
103
103
  'o-forms-input--textarea',
104
104
  { 'o-forms-input--invalid': hasError },
105
105
  ]);
106
-
106
+ const FTShippingZone = identifyFTShippingZone(country);
107
107
  const extraInstruction =
108
108
  country === 'GBR'
109
109
  ? ''
110
110
  : '\u000a- Special handling, e.g. place in plastic bag, 24/7 security on reception';
111
111
  const defaultPlaceholder = {
112
+ CEMEA_V1: `Enter instructions ${
113
+ maxlength && `(Max. ${maxlength} characters)`
114
+ }:\u000a- Door colour, letterbox location\u000a- Door entry codes, etc.`,
115
+ CEMEA_V2: `Enter instructions ${
116
+ maxlength && `(Max. ${maxlength} characters)`
117
+ }:\u000a- Door colour, letterbox location\u000a- Door entry codes, etc.`,
112
118
  GBR: `Enter instructions ${
113
119
  maxlength && `(Max. ${maxlength} characters)`
114
120
  }:\u000a- Door colour, letterbox location\u000a- Placement i.e. letterbox delivery${extraInstruction}`,
@@ -126,7 +132,7 @@ export function DeliveryInstructions ({
126
132
  ...(maxlength && { maxLength: maxlength }),
127
133
  ...(rows && { rows }),
128
134
  'data-trackable': 'field-deliveryInstructions',
129
- placeholder: placeholder ? placeholder : defaultPlaceholder[country],
135
+ placeholder: placeholder ? placeholder : defaultPlaceholder[FTShippingZone],
130
136
  disabled: isDisabled,
131
137
  defaultValue: value,
132
138
  };
@@ -135,7 +141,7 @@ export function DeliveryInstructions ({
135
141
  Special characters including punctuation cannot be used in the delivery instructions.
136
142
  </span>
137
143
  );
138
- const FTShippingZone = identifyFTShippingZone(country);
144
+
139
145
  return (
140
146
  <label
141
147
  id={fieldId}
@@ -56,8 +56,6 @@ function AcceptTerms(_ref) {
56
56
  specialTerms = _ref$specialTerms === void 0 ? null : _ref$specialTerms,
57
57
  _ref$isSingleTerm = _ref.isSingleTerm,
58
58
  isSingleTerm = _ref$isSingleTerm === void 0 ? false : _ref$isSingleTerm,
59
- _ref$isNewDigitalBuyF = _ref.isNewDigitalBuyFlowConsent,
60
- isNewDigitalBuyFlowConsent = _ref$isNewDigitalBuyF === void 0 ? false : _ref$isNewDigitalBuyF,
61
59
  _ref$hideConfirmTerms = _ref.hideConfirmTermsAndConditions,
62
60
  hideConfirmTermsAndConditions = _ref$hideConfirmTerms === void 0 ? false : _ref$hideConfirmTerms;
63
61
 
@@ -87,9 +85,7 @@ function AcceptTerms(_ref) {
87
85
  defaultChecked: true
88
86
  });
89
87
 
90
- var authFirstStepTerms = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, isNewDigitalBuyFlowConsent && /*#__PURE__*/_react["default"].createElement("hr", {
91
- className: " ncf ncf__divider-horizontal"
92
- }), !isNewDigitalBuyFlowConsent && /*#__PURE__*/_react["default"].createElement("ul", {
88
+ var authFirstStepTerms = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("ul", {
93
89
  className: "o-typography-list ncf__accept-terms-list"
94
90
  }, /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
95
91
  className: "terms-auth-first-step"
@@ -250,6 +246,5 @@ AcceptTerms.propTypes = {
250
246
  isPrintProduct: _propTypes["default"].bool,
251
247
  specialTerms: _propTypes["default"].string,
252
248
  isSingleTerm: _propTypes["default"].bool,
253
- isNewDigitalBuyFlowConsent: _propTypes["default"].bool,
254
249
  hideConfirmTermsAndConditions: _propTypes["default"].bool
255
250
  };
@@ -32,7 +32,9 @@ function DeliveryAddressType(_ref) {
32
32
  _ref$options = _ref.options,
33
33
  options = _ref$options === void 0 ? ['home', 'company', 'pobox'] : _ref$options,
34
34
  _ref$editMode = _ref.editMode,
35
- editMode = _ref$editMode === void 0 ? false : _ref$editMode;
35
+ editMode = _ref$editMode === void 0 ? false : _ref$editMode,
36
+ _ref$titlePrompt = _ref.titlePrompt,
37
+ titlePrompt = _ref$titlePrompt === void 0 ? '' : _ref$titlePrompt;
36
38
  return /*#__PURE__*/_react["default"].createElement("div", {
37
39
  id: fieldId,
38
40
  className: "o-forms-field ncf__delivery-address-type",
@@ -42,7 +44,9 @@ function DeliveryAddressType(_ref) {
42
44
  className: "o-forms-title"
43
45
  }, /*#__PURE__*/_react["default"].createElement("span", {
44
46
  className: "o-forms-title__main"
45
- }, "Address type")), /*#__PURE__*/_react["default"].createElement("div", {
47
+ }, "Address type"), /*#__PURE__*/_react["default"].createElement("span", {
48
+ className: "o-forms-title__prompt"
49
+ }, titlePrompt)), /*#__PURE__*/_react["default"].createElement("div", {
46
50
  className: "o-forms-input o-forms-input--inline o-forms-input--radio-round"
47
51
  }, options.map(function (option) {
48
52
  var type = addressTypes.find(function (item) {
@@ -71,5 +75,6 @@ DeliveryAddressType.propTypes = {
71
75
  fieldId: _propTypes["default"].string,
72
76
  inputName: _propTypes["default"].string,
73
77
  value: _propTypes["default"].oneOf(['home', 'company', 'pobox']),
74
- options: _propTypes["default"].arrayOf(_propTypes["default"].oneOf(['home', 'company', 'pobox']))
78
+ options: _propTypes["default"].arrayOf(_propTypes["default"].oneOf(['home', 'company', 'pobox'])),
79
+ titlePrompt: _propTypes["default"].string
75
80
  };
@@ -33,7 +33,13 @@ function DeliveryCity(_ref) {
33
33
  CAN: 'e.g. Montreal',
34
34
  ARE: 'e.g. Dubai'
35
35
  };
36
- var inputLabel = country === 'ARE' ? 'Emirate or City' : 'City';
36
+ var FTShippingZone = (0, _supportedCountries.identifyFTShippingZone)(country);
37
+ var labelMapping = {
38
+ ARE: 'Emirate or City',
39
+ APAC: 'City/Prefecture',
40
+ DEFAULT: 'City'
41
+ };
42
+ var inputLabel = labelMapping[FTShippingZone] ? labelMapping[FTShippingZone] : labelMapping['DEFAULT'];
37
43
  return /*#__PURE__*/_react["default"].createElement("label", {
38
44
  id: "deliveryCityField",
39
45
  className: "o-forms-field ncf__validation-error",
@@ -85,8 +85,11 @@ function DeliveryInstructions(_ref) {
85
85
  var textAreaWrapperClassNames = (0, _classnames["default"])(['o-forms-input', 'o-forms-input--textarea', {
86
86
  'o-forms-input--invalid': hasError
87
87
  }]);
88
+ var FTShippingZone = (0, _supportedCountries.identifyFTShippingZone)(country);
88
89
  var extraInstruction = country === 'GBR' ? '' : "\n- Special handling, e.g. place in plastic bag, 24/7 security on reception";
89
90
  var defaultPlaceholder = {
91
+ CEMEA_V1: "Enter instructions ".concat(maxlength && "(Max. ".concat(maxlength, " characters)"), ":\n- Door colour, letterbox location\n- Door entry codes, etc."),
92
+ CEMEA_V2: "Enter instructions ".concat(maxlength && "(Max. ".concat(maxlength, " characters)"), ":\n- Door colour, letterbox location\n- Door entry codes, etc."),
90
93
  GBR: "Enter instructions ".concat(maxlength && "(Max. ".concat(maxlength, " characters)"), ":\n- Door colour, letterbox location\n- Placement i.e. letterbox delivery").concat(extraInstruction),
91
94
  USA: "Enter instructions ".concat(maxlength && "(Max. ".concat(maxlength, " characters)"), ":\n- Door colour, driveway signage\n- Cross street").concat(extraInstruction),
92
95
  CAN: "Enter instructions ".concat(maxlength && "(Max. ".concat(maxlength, " characters)"), ":\n- Door colour, driveway signage\n- Cross street").concat(extraInstruction)
@@ -101,7 +104,7 @@ function DeliveryInstructions(_ref) {
101
104
  rows: rows
102
105
  }), {}, {
103
106
  'data-trackable': 'field-deliveryInstructions',
104
- placeholder: placeholder ? placeholder : defaultPlaceholder[country],
107
+ placeholder: placeholder ? placeholder : defaultPlaceholder[FTShippingZone],
105
108
  disabled: isDisabled,
106
109
  defaultValue: value
107
110
  });
@@ -110,7 +113,6 @@ function DeliveryInstructions(_ref) {
110
113
  className: "o-forms-title__prompt"
111
114
  }, "Special characters including punctuation cannot be used in the delivery instructions.");
112
115
 
113
- var FTShippingZone = (0, _supportedCountries.identifyFTShippingZone)(country);
114
116
  return /*#__PURE__*/_react["default"].createElement("label", {
115
117
  id: fieldId,
116
118
  className: "o-forms-field o-forms-field--optional",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/n-conversion-forms",
3
- "version": "27.3.2",
3
+ "version": "27.4.1",
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": {
@@ -115,6 +115,18 @@ class PaymentType {
115
115
  }
116
116
  }
117
117
  }
118
+ /**
119
+ * Hide the payment types panel
120
+ */
121
+ hidePanel () {
122
+ const content = this.$paymentType.querySelectorAll(
123
+ '.ncf__payment-type-panel'
124
+ );
125
+ for (let i = 0; i < content.length; i++) {
126
+ const element = content[i];
127
+ element.classList.add('ncf__hidden');
128
+ }
129
+ }
118
130
 
119
131
  static get CREDITCARD () {
120
132
  return 'creditcard';