@financial-times/n-conversion-forms 28.1.0 → 28.1.2

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.
@@ -29267,23 +29267,6 @@
29267
29267
  "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
29268
29268
  "dev": true
29269
29269
  },
29270
- "node_modules/snyk/node_modules/esprima": {
29271
- "version": "4.0.1",
29272
- "extraneous": true,
29273
- "license": "BSD-2-Clause",
29274
- "bin": {
29275
- "esparse": "bin/esparse.js",
29276
- "esvalidate": "bin/esvalidate.js"
29277
- },
29278
- "engines": {
29279
- "node": ">=4"
29280
- }
29281
- },
29282
- "node_modules/snyk/node_modules/inherits": {
29283
- "version": "2.0.4",
29284
- "extraneous": true,
29285
- "license": "ISC"
29286
- },
29287
29270
  "node_modules/snyk/node_modules/is-fullwidth-code-point": {
29288
29271
  "version": "2.0.0",
29289
29272
  "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
@@ -29307,13 +29290,6 @@
29307
29290
  "dev": true,
29308
29291
  "license": "MIT"
29309
29292
  },
29310
- "node_modules/snyk/node_modules/prelude-ls": {
29311
- "version": "1.1.2",
29312
- "extraneous": true,
29313
- "engines": {
29314
- "node": ">= 0.8.0"
29315
- }
29316
- },
29317
29293
  "node_modules/snyk/node_modules/proxy-agent": {
29318
29294
  "version": "3.1.0",
29319
29295
  "bundleDependencies": [
@@ -29949,17 +29925,6 @@
29949
29925
  "node": ">=6"
29950
29926
  }
29951
29927
  },
29952
- "node_modules/snyk/node_modules/type-check": {
29953
- "version": "0.3.2",
29954
- "extraneous": true,
29955
- "license": "MIT",
29956
- "dependencies": {
29957
- "prelude-ls": "~1.1.2"
29958
- },
29959
- "engines": {
29960
- "node": ">= 0.8.0"
29961
- }
29962
- },
29963
29928
  "node_modules/snyk/node_modules/uuid": {
29964
29929
  "version": "3.4.0",
29965
29930
  "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
@@ -55210,14 +55175,6 @@
55210
55175
  "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
55211
55176
  "dev": true
55212
55177
  },
55213
- "esprima": {
55214
- "version": "4.0.1",
55215
- "extraneous": true
55216
- },
55217
- "inherits": {
55218
- "version": "2.0.4",
55219
- "extraneous": true
55220
- },
55221
55178
  "is-fullwidth-code-point": {
55222
55179
  "version": "2.0.0",
55223
55180
  "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
@@ -55236,10 +55193,6 @@
55236
55193
  "version": "2.1.2",
55237
55194
  "dev": true
55238
55195
  },
55239
- "prelude-ls": {
55240
- "version": "1.1.2",
55241
- "extraneous": true
55242
- },
55243
55196
  "proxy-agent": {
55244
55197
  "version": "3.1.0",
55245
55198
  "bundled": true,
@@ -55711,13 +55664,6 @@
55711
55664
  "ansi-regex": "^4.1.0"
55712
55665
  }
55713
55666
  },
55714
- "type-check": {
55715
- "version": "0.3.2",
55716
- "extraneous": true,
55717
- "requires": {
55718
- "prelude-ls": "~1.1.2"
55719
- }
55720
- },
55721
55667
  "uuid": {
55722
55668
  "version": "3.4.0",
55723
55669
  "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
@@ -5,58 +5,56 @@ exports[`AcceptTerms renders appropriately if a isAuthFirstAccount 1`] = `
5
5
  class="o-forms-field o-layout-typography ncf__validation-error"
6
6
  data-validate="required,checked"
7
7
  >
8
- <ul class="o-typography-list ncf__accept-terms-list">
9
- <li>
10
- <span class="terms-auth-first-step">
11
- For more information about how we use your data, please refer to our
12
- <a class="ncf__link--external"
13
- href="https://help.ft.com/legal-privacy/privacy-policy/"
14
- target="_blank"
15
- rel="noopener noreferrer"
16
- data-trackable="privacy-policy-info"
17
- >
18
- privacy
19
- </a>
20
- and 
21
- <a class="ncf__link--external"
22
- href="https://help.ft.com/legal-privacy/cookies/"
23
- target="_blank"
24
- rel="noopener noreferrer"
25
- data-trackable="cookies-info"
26
- >
27
- cookie
28
- </a>
29
- policies.
30
- </span>
31
- </li>
32
- </ul>
33
- <label class="o-forms-input o-forms-input--checkbox"
34
- for="termsAcceptance"
35
- >
36
- <input type="checkbox"
37
- id="termsAcceptance"
38
- name="termsAcceptance"
39
- value="true"
40
- data-trackable="field-terms"
41
- aria-required="true"
42
- required
43
- >
44
- <span class="o-forms-input__label terms-auth-first-step">
45
- I confirm that I am 16 years or older and agree to the full
8
+ <div class="auth-first-step-terms">
9
+ <span class="consent-text--top">
10
+ For more information about how we use your data, please refer to our
46
11
  <a class="ncf__link--external"
47
- href="http://help.ft.com/help/legal-privacy/terms-conditions/"
12
+ href="https://help.ft.com/legal-privacy/privacy-policy/"
48
13
  target="_blank"
49
14
  rel="noopener noreferrer"
50
- data-trackable="terms-and-conditions"
15
+ data-trackable="privacy-policy-info"
51
16
  >
52
- Terms &amp; Conditions
17
+ privacy
53
18
  </a>
54
- .
19
+ and 
20
+ <a class="ncf__link--external"
21
+ href="https://help.ft.com/legal-privacy/cookies/"
22
+ target="_blank"
23
+ rel="noopener noreferrer"
24
+ data-trackable="cookies-info"
25
+ >
26
+ cookie
27
+ </a>
28
+ policies.
55
29
  </span>
56
- <p class="o-forms-input__error">
57
- Please accept our terms &amp; conditions
58
- </p>
59
- </label>
30
+ <label class="o-forms-input o-forms-input--checkbox"
31
+ for="termsAcceptance"
32
+ >
33
+ <input type="checkbox"
34
+ id="termsAcceptance"
35
+ name="termsAcceptance"
36
+ value="true"
37
+ data-trackable="field-terms"
38
+ aria-required="true"
39
+ required
40
+ >
41
+ <span class="o-forms-input__label">
42
+ I confirm that I am 16 years or older and agree to the full
43
+ <a class="ncf__link--external"
44
+ href="http://help.ft.com/help/legal-privacy/terms-conditions/"
45
+ target="_blank"
46
+ rel="noopener noreferrer"
47
+ data-trackable="terms-and-conditions"
48
+ >
49
+ Terms &amp; Conditions
50
+ </a>
51
+ .
52
+ </span>
53
+ <p class="o-forms-input__error">
54
+ Please accept our terms &amp; conditions
55
+ </p>
56
+ </label>
57
+ </div>
60
58
  </div>
61
59
  `;
62
60
 
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
4
 
5
5
  const DEFAULT_AGE_RESTRICTION = '16';
6
+ const DEFAULT_PRIVACY_POLICIES_POSITION = 'top';
6
7
 
7
8
  export function AcceptTerms({
8
9
  isAuthFirstAccount = false,
@@ -24,6 +25,8 @@ export function AcceptTerms({
24
25
  isSingleTerm = false,
25
26
  isDeferredBilling = false,
26
27
  hideConfirmTermsAndConditions = false,
28
+ children,
29
+ privacyPoliciesPosition = DEFAULT_PRIVACY_POLICIES_POSITION,
27
30
  }) {
28
31
  const divProps = {
29
32
  id: 'acceptTermsField',
@@ -36,7 +39,9 @@ export function AcceptTerms({
36
39
  const labelClassName = classNames([
37
40
  'o-forms-input',
38
41
  'o-forms-input--checkbox',
39
- { 'o-forms-input--invalid': hasError },
42
+ {
43
+ 'o-forms-input--invalid': hasError,
44
+ },
40
45
  ]);
41
46
 
42
47
  const inputProps = {
@@ -51,41 +56,34 @@ export function AcceptTerms({
51
56
  };
52
57
 
53
58
  const authFirstStepTerms = (
54
- <>
55
- {
56
- <ul className="o-typography-list ncf__accept-terms-list">
57
- <li>
58
- <span className="terms-auth-first-step">
59
- For more information about how we use your data, please refer to
60
- our{' '}
61
- <a
62
- className="ncf__link--external"
63
- href="https://help.ft.com/legal-privacy/privacy-policy/"
64
- target="_blank"
65
- rel="noopener noreferrer"
66
- data-trackable="privacy-policy-info"
67
- >
68
- privacy
69
- </a>{' '}
70
- and&nbsp;
71
- <a
72
- className="ncf__link--external"
73
- href="https://help.ft.com/legal-privacy/cookies/"
74
- target="_blank"
75
- rel="noopener noreferrer"
76
- data-trackable="cookies-info"
77
- >
78
- cookie
79
- </a>{' '}
80
- policies.
81
- </span>
82
- </li>
83
- </ul>
84
- }
59
+ <div className="auth-first-step-terms">
60
+ <span className={`consent-text--${privacyPoliciesPosition}`}>
61
+ For more information about how we use your data, please refer to our{' '}
62
+ <a
63
+ className="ncf__link--external"
64
+ href="https://help.ft.com/legal-privacy/privacy-policy/"
65
+ target="_blank"
66
+ rel="noopener noreferrer"
67
+ data-trackable="privacy-policy-info"
68
+ >
69
+ privacy
70
+ </a>{' '}
71
+ and&nbsp;
72
+ <a
73
+ className="ncf__link--external"
74
+ href="https://help.ft.com/legal-privacy/cookies/"
75
+ target="_blank"
76
+ rel="noopener noreferrer"
77
+ data-trackable="cookies-info"
78
+ >
79
+ cookie
80
+ </a>{' '}
81
+ policies.
82
+ </span>
85
83
  {!hideConfirmTermsAndConditions && (
86
84
  <label className={labelClassName} htmlFor="termsAcceptance">
87
85
  <input {...inputProps} />
88
- <span className="o-forms-input__label terms-auth-first-step">
86
+ <span className="o-forms-input__label">
89
87
  I confirm that I am {ageRestriction} years or older and agree to the
90
88
  full{' '}
91
89
  <a
@@ -104,7 +102,8 @@ export function AcceptTerms({
104
102
  </p>
105
103
  </label>
106
104
  )}
107
- </>
105
+ {children && <div className="children-container">{children}</div>}
106
+ </div>
108
107
  );
109
108
 
110
109
  const registerTerms = (
@@ -416,4 +415,9 @@ AcceptTerms.propTypes = {
416
415
  isSingleTerm: PropTypes.bool,
417
416
  isDeferredBilling: PropTypes.bool,
418
417
  hideConfirmTermsAndConditions: PropTypes.bool,
418
+ children: PropTypes.oneOfType([
419
+ PropTypes.arrayOf(PropTypes.node),
420
+ PropTypes.node,
421
+ ]),
422
+ privacyPoliciesPosition: PropTypes.oneOf(['top', 'bottom']),
419
423
  };
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { AcceptTerms } from './accept-terms';
3
+ import { Submit } from './submit';
3
4
 
4
5
  export default {
5
6
  title: 'Basic Accept Terms',
@@ -11,7 +12,12 @@ export default {
11
12
  options: ['immediate', 'endOfTerm'],
12
13
  },
13
14
  },
14
- isAuthFirstAccount: { control: 'boolean' },
15
+ isAuthFirstAccount: {
16
+ control: 'boolean',
17
+ table: {
18
+ type: { summary: 'Show new buy flow design' },
19
+ },
20
+ },
15
21
  isAuthFirstPayment: { control: 'boolean' },
16
22
  hasError: { control: 'boolean' },
17
23
  isSignup: { control: 'boolean' },
@@ -28,6 +34,21 @@ export default {
28
34
  isNewDigitalBuyFlowConsent: { control: 'boolean' },
29
35
  hideConfirmTermsAndConditions: { control: 'boolean' },
30
36
  isDeferredBilling: { control: 'boolean' },
37
+ children: {
38
+ control: false,
39
+ table: {
40
+ type: { summary: "Only rendered when 'isAuthFirstAccount' is true" },
41
+ },
42
+ },
43
+ privacyPoliciesPosition: {
44
+ options: ['top', 'bottom'],
45
+ control: {
46
+ type: 'inline-radio',
47
+ },
48
+ table: {
49
+ type: { summary: "Placement of the 'Privacy Policies' text" },
50
+ },
51
+ },
31
52
  },
32
53
  };
33
54
 
@@ -44,3 +65,19 @@ NewBuyFlowEmailVerification.args = {
44
65
  isAuthFirstAccount: true,
45
66
  hideConfirmTermsAndConditions: true,
46
67
  };
68
+
69
+ export const NewBuyFlowWithChildren = (args) => (
70
+ <AcceptTerms {...args}>
71
+ <Submit />
72
+ </AcceptTerms>
73
+ );
74
+ NewBuyFlowWithChildren.args = {
75
+ isAuthFirstAccount: true,
76
+ privacyPoliciesPosition: 'bottom',
77
+ };
78
+ NewBuyFlowWithChildren.parameters = {
79
+ controls: {
80
+ include: ['privacyPoliciesPosition', 'isAuthFirstAccount', 'children'],
81
+ expanded: true,
82
+ },
83
+ };
@@ -12,6 +12,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
12
12
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
13
13
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
14
14
  var DEFAULT_AGE_RESTRICTION = '16';
15
+ var DEFAULT_PRIVACY_POLICIES_POSITION = 'top';
15
16
  function AcceptTerms(_ref) {
16
17
  var _ref$isAuthFirstAccou = _ref.isAuthFirstAccount,
17
18
  isAuthFirstAccount = _ref$isAuthFirstAccou === void 0 ? false : _ref$isAuthFirstAccou,
@@ -50,7 +51,10 @@ function AcceptTerms(_ref) {
50
51
  _ref$isDeferredBillin = _ref.isDeferredBilling,
51
52
  isDeferredBilling = _ref$isDeferredBillin === void 0 ? false : _ref$isDeferredBillin,
52
53
  _ref$hideConfirmTerms = _ref.hideConfirmTermsAndConditions,
53
- hideConfirmTermsAndConditions = _ref$hideConfirmTerms === void 0 ? false : _ref$hideConfirmTerms;
54
+ hideConfirmTermsAndConditions = _ref$hideConfirmTerms === void 0 ? false : _ref$hideConfirmTerms,
55
+ children = _ref.children,
56
+ _ref$privacyPoliciesP = _ref.privacyPoliciesPosition,
57
+ privacyPoliciesPosition = _ref$privacyPoliciesP === void 0 ? DEFAULT_PRIVACY_POLICIES_POSITION : _ref$privacyPoliciesP;
54
58
  var divProps = _objectSpread(_objectSpread({
55
59
  id: 'acceptTermsField',
56
60
  className: 'o-forms-field o-layout-typography ncf__validation-error',
@@ -74,10 +78,10 @@ function AcceptTerms(_ref) {
74
78
  }, isChecked && {
75
79
  defaultChecked: true
76
80
  });
77
- var authFirstStepTerms = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("ul", {
78
- className: "o-typography-list ncf__accept-terms-list"
79
- }, /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
80
- className: "terms-auth-first-step"
81
+ var authFirstStepTerms = /*#__PURE__*/_react["default"].createElement("div", {
82
+ className: "auth-first-step-terms"
83
+ }, /*#__PURE__*/_react["default"].createElement("span", {
84
+ className: "consent-text--".concat(privacyPoliciesPosition)
81
85
  }, "For more information about how we use your data, please refer to our", ' ', /*#__PURE__*/_react["default"].createElement("a", {
82
86
  className: "ncf__link--external",
83
87
  href: "https://help.ft.com/legal-privacy/privacy-policy/",
@@ -90,11 +94,11 @@ function AcceptTerms(_ref) {
90
94
  target: "_blank",
91
95
  rel: "noopener noreferrer",
92
96
  "data-trackable": "cookies-info"
93
- }, "cookie"), ' ', "policies."))), !hideConfirmTermsAndConditions && /*#__PURE__*/_react["default"].createElement("label", {
97
+ }, "cookie"), ' ', "policies."), !hideConfirmTermsAndConditions && /*#__PURE__*/_react["default"].createElement("label", {
94
98
  className: labelClassName,
95
99
  htmlFor: "termsAcceptance"
96
100
  }, /*#__PURE__*/_react["default"].createElement("input", inputProps), /*#__PURE__*/_react["default"].createElement("span", {
97
- className: "o-forms-input__label terms-auth-first-step"
101
+ className: "o-forms-input__label"
98
102
  }, "I confirm that I am ", ageRestriction, " years or older and agree to the full", ' ', /*#__PURE__*/_react["default"].createElement("a", {
99
103
  className: "ncf__link--external",
100
104
  href: "http://help.ft.com/help/legal-privacy/terms-conditions/",
@@ -103,7 +107,9 @@ function AcceptTerms(_ref) {
103
107
  "data-trackable": "terms-and-conditions"
104
108
  }, "Terms & Conditions"), "."), /*#__PURE__*/_react["default"].createElement("p", {
105
109
  className: "o-forms-input__error"
106
- }, "Please accept our terms & conditions")));
110
+ }, "Please accept our terms & conditions")), children && /*#__PURE__*/_react["default"].createElement("div", {
111
+ className: "children-container"
112
+ }, children));
107
113
  var registerTerms = /*#__PURE__*/_react["default"].createElement("label", {
108
114
  className: labelClassName,
109
115
  htmlFor: "termsAcceptance"
@@ -230,5 +236,7 @@ AcceptTerms.propTypes = {
230
236
  specialTerms: _propTypes["default"].string,
231
237
  isSingleTerm: _propTypes["default"].bool,
232
238
  isDeferredBilling: _propTypes["default"].bool,
233
- hideConfirmTermsAndConditions: _propTypes["default"].bool
239
+ hideConfirmTermsAndConditions: _propTypes["default"].bool,
240
+ children: _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_propTypes["default"].node), _propTypes["default"].node]),
241
+ privacyPoliciesPosition: _propTypes["default"].oneOf(['top', 'bottom'])
234
242
  };
@@ -1,3 +1,3 @@
1
- import { billingCountries } from 'n-common-static-data';
1
+ const { billingCountries } = require('n-common-static-data');
2
2
 
3
3
  export { billingCountries };
@@ -1,3 +1,3 @@
1
- import { demographics } from 'n-common-static-data';
1
+ const { demographics } = require('n-common-static-data');
2
2
 
3
3
  export { demographics };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/n-conversion-forms",
3
- "version": "28.1.0",
3
+ "version": "28.1.2",
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": {
@@ -18,3 +18,26 @@
18
18
  }
19
19
  }
20
20
  }
21
+
22
+ .auth-first-step-terms {
23
+ display: flex;
24
+ flex-direction: column;
25
+
26
+ .consent-text {
27
+ &--top {
28
+ order: -1;
29
+ margin-bottom: oSpacingByName('s4');
30
+ }
31
+
32
+ &--bottom {
33
+ margin-top: oSpacingByName('s4');
34
+ order: 99;
35
+ }
36
+ }
37
+
38
+ .children-container {
39
+ display: flex;
40
+ flex-direction: column;
41
+ margin-top: oSpacingByName('s4');
42
+ }
43
+ }