@financial-times/n-conversion-forms 20.3.3 → 20.3.4
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/.circleci/config.yml +7 -5
- package/.circleci/shared-helpers/helper-npm-install-peer-deps +6 -6
- package/.eslintignore +3 -0
- package/.github/workflows/gh-pages-deploy.yml +2 -1
- package/build-state/npm-shrinkwrap.json +47013 -9010
- package/components/__snapshots__/accept-terms.spec.js.snap +94 -6
- package/components/accept-terms.jsx +67 -9
- package/components/accept-terms.spec.js +12 -0
- package/components/app-banner.jsx +1 -1
- package/components/b2c-partnership-confirmation.jsx +2 -2
- package/components/b2c-partnership-payment-term.jsx +1 -1
- package/components/billing-city.jsx +1 -1
- package/components/billing-country.jsx +1 -1
- package/components/billing-postcode.jsx +1 -1
- package/components/company-name.jsx +1 -1
- package/components/confirmation.jsx +1 -1
- package/components/continue-reading.jsx +1 -1
- package/components/continue-reading.stories.js +1 -1
- package/components/country.jsx +1 -1
- package/components/customer-care.jsx +1 -1
- package/components/debug.jsx +1 -1
- package/components/decision-maker.jsx +1 -1
- package/components/decision-maker.spec.js +1 -1
- package/components/delivery-address-type.jsx +1 -1
- package/components/delivery-address.jsx +2 -2
- package/components/delivery-city.jsx +1 -1
- package/components/delivery-county.jsx +1 -1
- package/components/delivery-instructions.jsx +1 -1
- package/components/delivery-option.jsx +1 -1
- package/components/delivery-po-box.jsx +1 -1
- package/components/delivery-postcode.jsx +1 -1
- package/components/delivery-security-instructions.jsx +1 -1
- package/components/delivery-start-date.jsx +1 -1
- package/components/education-job-title.jsx +1 -1
- package/components/email.jsx +1 -1
- package/components/error-page.jsx +1 -1
- package/components/fieldset.jsx +1 -1
- package/components/first-name.jsx +1 -1
- package/components/form.jsx +1 -1
- package/components/google-sign-in.jsx +1 -1
- package/components/graduation-date.jsx +1 -1
- package/components/industry.jsx +1 -1
- package/components/job-title.jsx +1 -1
- package/components/last-name.jsx +1 -1
- package/components/licence-confirmation.jsx +1 -1
- package/components/licence-header.jsx +2 -2
- package/components/licence-sign-in.jsx +2 -2
- package/components/licence-title.jsx +2 -2
- package/components/lite-sub-confirmation.jsx +1 -1
- package/components/loader.jsx +1 -1
- package/components/message.jsx +1 -1
- package/components/organisation.jsx +1 -1
- package/components/package-change.jsx +1 -1
- package/components/password.jsx +1 -1
- package/components/payment-term.jsx +1 -1
- package/components/payment-type.jsx +2 -2
- package/components/personal-title.jsx +1 -1
- package/components/phone.jsx +1 -1
- package/components/position.jsx +1 -1
- package/components/progress-indicator.jsx +3 -3
- package/components/province.jsx +1 -1
- package/components/registration-confirmation.jsx +1 -1
- package/components/responsibility.jsx +1 -1
- package/components/section.jsx +1 -1
- package/components/state.jsx +1 -1
- package/components/submit.jsx +1 -1
- package/components/trial-banner.jsx +1 -1
- package/dist/accept-terms.js +40 -5
- package/dist/b2c-partnership-confirmation.js +1 -1
- package/dist/payment-type.js +1 -1
- package/package.json +9 -6
- package/test-jest/helpers/expect-to-render-correctly.js +1 -1
- package/utils/app-banner.js +1 -1
- package/utils/apple-pay.js +15 -15
- package/utils/billing-city.js +1 -1
- package/utils/billing-country.js +3 -3
- package/utils/billing-postcode.js +1 -1
- package/utils/company-name.js +1 -1
- package/utils/countries.js +2 -2
- package/utils/country.js +3 -3
- package/utils/delivery-address-type.js +3 -3
- package/utils/delivery-address.js +1 -1
- package/utils/delivery-instructions.js +1 -1
- package/utils/delivery-option-messages.js +11 -11
- package/utils/delivery-option-messages.spec.js +2 -2
- package/utils/delivery-option.js +5 -5
- package/utils/delivery-po-box.js +1 -1
- package/utils/delivery-postcode.js +1 -1
- package/utils/delivery-start-date.js +4 -4
- package/utils/email.js +4 -4
- package/utils/event-notifier.js +1 -1
- package/utils/form-element.js +8 -8
- package/utils/loader.js +10 -10
- package/utils/password.js +2 -2
- package/utils/payment-term.js +5 -5
- package/utils/payment-type.js +12 -12
- package/utils/postcode.js +3 -3
- package/utils/province.js +1 -1
- package/utils/salesforce.js +2 -2
- package/utils/state.js +1 -1
- package/utils/submit.js +5 -5
- package/utils/tracking.js +7 -7
- package/utils/validation.js +10 -10
- package/utils/zuora-error-map.js +5 -5
- package/utils/zuora.js +12 -12
package/components/job-title.jsx
CHANGED
package/components/last-name.jsx
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
|
-
export function LastName({
|
|
5
|
+
export function LastName ({
|
|
6
6
|
dataTrackable = 'field-lastname',
|
|
7
7
|
errorText = 'Please enter your last name',
|
|
8
8
|
fieldId = 'lastNameField',
|
|
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { LicenceSignIn } from './licence-sign-in';
|
|
4
4
|
import { LicenceTitle } from './licence-title';
|
|
5
5
|
|
|
6
|
-
export function LicenceHeader(props) {
|
|
6
|
+
export function LicenceHeader (props) {
|
|
7
7
|
const {
|
|
8
8
|
displayName = '',
|
|
9
9
|
isTrial = false,
|
|
@@ -11,7 +11,7 @@ export function LicenceHeader(props) {
|
|
|
11
11
|
welcomeText = '',
|
|
12
12
|
url = '',
|
|
13
13
|
} = props;
|
|
14
|
-
function createMarkup(text) {
|
|
14
|
+
function createMarkup (text) {
|
|
15
15
|
return { __html: text };
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
|
-
export function LicenceSignIn({ displayName = '', url = '' }) {
|
|
4
|
+
export function LicenceSignIn ({ displayName = '', url = '' }) {
|
|
5
5
|
return (
|
|
6
6
|
<div className="ncf__center">
|
|
7
7
|
{renderSignInTitle(displayName)}
|
|
@@ -19,7 +19,7 @@ export function LicenceSignIn({ displayName = '', url = '' }) {
|
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
function renderSignInTitle(displayName) {
|
|
22
|
+
function renderSignInTitle (displayName) {
|
|
23
23
|
let signInTitle;
|
|
24
24
|
|
|
25
25
|
if (displayName !== '') {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
|
-
export function LicenceTitle({
|
|
4
|
+
export function LicenceTitle ({
|
|
5
5
|
displayName = '',
|
|
6
6
|
isTrial = false,
|
|
7
7
|
isB2cPartnershipLicence = false,
|
|
@@ -21,7 +21,7 @@ export function LicenceTitle({
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
function renderB2BTitle(displayName) {
|
|
24
|
+
function renderB2BTitle (displayName) {
|
|
25
25
|
if (!displayName) {
|
|
26
26
|
return (
|
|
27
27
|
<h1 className="ncf__header ncf__center">Join your FT.com subscription</h1>
|
package/components/loader.jsx
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
|
-
export function Loader({ children, showLoader, title, inElement }) {
|
|
5
|
+
export function Loader ({ children, showLoader, title, inElement }) {
|
|
6
6
|
const label = title ? (
|
|
7
7
|
<div className="ncf__loader__content__title" id="loader-aria-label">
|
|
8
8
|
{title}
|
package/components/message.jsx
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
|
-
export function Organisation({
|
|
5
|
+
export function Organisation ({
|
|
6
6
|
dataTrackable = 'organization',
|
|
7
7
|
errorText = 'Please enter your organisation',
|
|
8
8
|
fieldId = 'organisationField',
|
package/components/password.jsx
CHANGED
|
@@ -13,7 +13,7 @@ const PaypalCustomerCareMessage = () => {
|
|
|
13
13
|
<div className="o-message__container">
|
|
14
14
|
<div className="o-message__content">
|
|
15
15
|
<p className="o-message__content-main">
|
|
16
|
-
If you{
|
|
16
|
+
If you{'\''}d like to change your payment method to Paypal please{' '}
|
|
17
17
|
<a
|
|
18
18
|
className="o-message__actions__secondary"
|
|
19
19
|
href="https://help.ft.com"
|
|
@@ -29,7 +29,7 @@ const PaypalCustomerCareMessage = () => {
|
|
|
29
29
|
);
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
export function PaymentType({
|
|
32
|
+
export function PaymentType ({
|
|
33
33
|
enableApplepay = false,
|
|
34
34
|
enableCreditcard = false,
|
|
35
35
|
enableDirectdebit = false,
|
package/components/phone.jsx
CHANGED
package/components/position.jsx
CHANGED
|
@@ -2,8 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
|
-
export function ProgressIndicator({ items = [], disableLinks = false }) {
|
|
6
|
-
function getElementsForComplete(item) {
|
|
5
|
+
export function ProgressIndicator ({ items = [], disableLinks = false }) {
|
|
6
|
+
function getElementsForComplete (item) {
|
|
7
7
|
return disableLinks ? (
|
|
8
8
|
<span className="o-stepped-progress__step o-stepped-progress__step--complete">
|
|
9
9
|
<span className="o-stepped-progress__label">
|
|
@@ -26,7 +26,7 @@ export function ProgressIndicator({ items = [], disableLinks = false }) {
|
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
function getElementsForNonComplete(item) {
|
|
29
|
+
function getElementsForNonComplete (item) {
|
|
30
30
|
const nonCompleteDivClassName = classNames([
|
|
31
31
|
'o-stepped-progress__step',
|
|
32
32
|
{ 'o-stepped-progress__step--current': item.isCurrent },
|
package/components/province.jsx
CHANGED
|
@@ -4,7 +4,7 @@ import classNames from 'classnames';
|
|
|
4
4
|
import { canadianProvinces } from 'n-common-static-data';
|
|
5
5
|
const defaultProvinces = canadianProvinces.provinces;
|
|
6
6
|
|
|
7
|
-
export function Province({
|
|
7
|
+
export function Province ({
|
|
8
8
|
value,
|
|
9
9
|
fieldId = 'provinceField',
|
|
10
10
|
selectId = 'province',
|
|
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
|
|
4
4
|
const EMAIL_DEFAULT_TEXT = 'your email';
|
|
5
5
|
|
|
6
|
-
export function RegistrationConfirmation({ email = EMAIL_DEFAULT_TEXT }) {
|
|
6
|
+
export function RegistrationConfirmation ({ email = EMAIL_DEFAULT_TEXT }) {
|
|
7
7
|
return (
|
|
8
8
|
<div className="ncf ncf__wrapper">
|
|
9
9
|
<div className="ncf__center">
|
|
@@ -4,7 +4,7 @@ import classNames from 'classnames';
|
|
|
4
4
|
import { demographics } from 'n-common-static-data';
|
|
5
5
|
const defaultOptions = demographics.responsibilities.responsibilities;
|
|
6
6
|
|
|
7
|
-
export function Responsibility({
|
|
7
|
+
export function Responsibility ({
|
|
8
8
|
value,
|
|
9
9
|
isDisabled = false,
|
|
10
10
|
isRequired = true,
|
package/components/section.jsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
|
-
export function Section({ children }) {
|
|
4
|
+
export function Section ({ children }) {
|
|
5
5
|
return (
|
|
6
6
|
<div className="o-forms-section o-forms-section--wide">
|
|
7
7
|
<div className="o-forms-section__message">{children}</div>
|
package/components/state.jsx
CHANGED
package/components/submit.jsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
|
-
export function TrialBanner({ trialDuration = '' }) {
|
|
4
|
+
export function TrialBanner ({ trialDuration = '' }) {
|
|
5
5
|
const durationMessage = trialDuration ? (
|
|
6
6
|
<>
|
|
7
7
|
<span className="ncf__strong">{trialDuration}</span>{' '}
|
package/dist/accept-terms.js
CHANGED
|
@@ -22,7 +22,11 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
22
22
|
var DEFAULT_AGE_RESTRICTION = '16';
|
|
23
23
|
|
|
24
24
|
function AcceptTerms(_ref) {
|
|
25
|
-
var _ref$
|
|
25
|
+
var _ref$isAuthFirstAccou = _ref.isAuthFirstAccount,
|
|
26
|
+
isAuthFirstAccount = _ref$isAuthFirstAccou === void 0 ? false : _ref$isAuthFirstAccou,
|
|
27
|
+
_ref$isAuthFirstPayme = _ref.isAuthFirstPayment,
|
|
28
|
+
isAuthFirstPayment = _ref$isAuthFirstPayme === void 0 ? false : _ref$isAuthFirstPayme,
|
|
29
|
+
_ref$hasError = _ref.hasError,
|
|
26
30
|
hasError = _ref$hasError === void 0 ? false : _ref$hasError,
|
|
27
31
|
_ref$isSignup = _ref.isSignup,
|
|
28
32
|
isSignup = _ref$isSignup === void 0 ? false : _ref$isSignup,
|
|
@@ -79,6 +83,37 @@ function AcceptTerms(_ref) {
|
|
|
79
83
|
defaultChecked: true
|
|
80
84
|
});
|
|
81
85
|
|
|
86
|
+
var authFirstStepTerms = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("ul", {
|
|
87
|
+
className: "o-typography-list ncf__accept-terms-list"
|
|
88
|
+
}, /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
|
|
89
|
+
className: "terms-auth-first-step"
|
|
90
|
+
}, "For more information about how we use your data, please refer to our ", /*#__PURE__*/_react["default"].createElement("a", {
|
|
91
|
+
className: "ncf__link--external",
|
|
92
|
+
href: "http://help.ft.com/help/legal-privacy/terms-conditions/",
|
|
93
|
+
target: "_blank",
|
|
94
|
+
rel: "noopener noreferrer",
|
|
95
|
+
"data-trackable": "terms-and-conditions"
|
|
96
|
+
}, "privacy"), " and\xA0", /*#__PURE__*/_react["default"].createElement("a", {
|
|
97
|
+
className: "ncf__link--external",
|
|
98
|
+
href: "http://help.ft.com/help/legal-privacy/terms-conditions/",
|
|
99
|
+
target: "_blank",
|
|
100
|
+
rel: "noopener noreferrer",
|
|
101
|
+
"data-trackable": "terms-and-conditions"
|
|
102
|
+
}, "cookie"), " policies."))), /*#__PURE__*/_react["default"].createElement("label", {
|
|
103
|
+
className: labelClassName,
|
|
104
|
+
htmlFor: "termsAcceptance"
|
|
105
|
+
}, /*#__PURE__*/_react["default"].createElement("input", inputProps), /*#__PURE__*/_react["default"].createElement("span", {
|
|
106
|
+
className: "o-forms-input__label terms-auth-first-step"
|
|
107
|
+
}, "I confirm that I am ", ageRestriction, " years or older and agree to the full ", ' ', /*#__PURE__*/_react["default"].createElement("a", {
|
|
108
|
+
className: "ncf__link--external",
|
|
109
|
+
href: "http://help.ft.com/help/legal-privacy/terms-conditions/",
|
|
110
|
+
target: isEmbedded ? '_top' : '_blank',
|
|
111
|
+
rel: "noopener noreferrer",
|
|
112
|
+
"data-trackable": "terms-and-conditions"
|
|
113
|
+
}, "Terms & Conditions"), "."), /*#__PURE__*/_react["default"].createElement("p", {
|
|
114
|
+
className: "o-forms-input__error"
|
|
115
|
+
}, "Please accept our terms & conditions")));
|
|
116
|
+
|
|
82
117
|
var registerTerms = /*#__PURE__*/_react["default"].createElement("label", {
|
|
83
118
|
className: labelClassName,
|
|
84
119
|
htmlFor: "termsAcceptance"
|
|
@@ -125,7 +160,7 @@ function AcceptTerms(_ref) {
|
|
|
125
160
|
rel: "noopener noreferrer"
|
|
126
161
|
}, "customer care through chat, phone or email"), ".")), transitionType === 'immediate' ? /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
|
|
127
162
|
className: "terms-transition terms-transition--immediate"
|
|
128
|
-
}, "By placing my order, my subscription will start immediately.
|
|
163
|
+
}, "By placing my order, my subscription will start immediately and I am aware and agree that I will therefore lose my statutory right to cancel my subscription within 14 days of acceptance of my order. Any notice of cancellation that I provide will only take effect at the end of my subscription period and previously paid amounts are non-refundable, except in the event that there is a fault in the provision of the services.")) : /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
|
|
129
164
|
className: "terms-transition terms-transition--other"
|
|
130
165
|
}, "By placing my order, I acknowledge that my subscription will start", isSingleTerm ? ' and the chosen payment method will be charged ' : ' ', "on the date given above. Any cancellation notice received after that date will take effect at the end of my subscription term and previously paid amounts are non-refundable.")), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
|
|
131
166
|
className: "terms-transition"
|
|
@@ -156,7 +191,7 @@ function AcceptTerms(_ref) {
|
|
|
156
191
|
rel: "noopener noreferrer"
|
|
157
192
|
}, "customer care through chat, phone or email"), ".")), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
|
|
158
193
|
className: "terms-signup"
|
|
159
|
-
}, "By placing my order, my subscription will start immediately.
|
|
194
|
+
}, "By placing my order, my subscription will start immediately and I am aware and agree that I will therefore lose my statutory right to cancel my subscription within 14 days of acceptance of my order. Any notice of cancellation that I provide will only take effect at the end of my subscription period and previously paid amounts are non-refundable, except in the event that there is a fault in the provision of the services.")), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
|
|
160
195
|
className: "terms-signup"
|
|
161
196
|
}, "Find out more about our cancellation policy in our", ' ', /*#__PURE__*/_react["default"].createElement("a", {
|
|
162
197
|
className: "ncf__link--external",
|
|
@@ -181,9 +216,9 @@ function AcceptTerms(_ref) {
|
|
|
181
216
|
className: "o-forms-input__error"
|
|
182
217
|
}, "Please accept our terms & conditions"));
|
|
183
218
|
|
|
184
|
-
return /*#__PURE__*/_react["default"].createElement("div", divProps, isB2cPartnership ? b2cPartnershipTerms : isRegister ? registerTerms : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("ul", {
|
|
219
|
+
return /*#__PURE__*/_react["default"].createElement("div", divProps, isB2cPartnership ? b2cPartnershipTerms : isRegister ? registerTerms : isAuthFirstAccount ? authFirstStepTerms : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("ul", {
|
|
185
220
|
className: "o-typography-list ncf__accept-terms-list"
|
|
186
|
-
}, b2bTerms, corpSignupTerms, transitionTerms, signupTerms), /*#__PURE__*/_react["default"].createElement("label", {
|
|
221
|
+
}, !isAuthFirstPayment && b2bTerms, corpSignupTerms, transitionTerms, signupTerms), /*#__PURE__*/_react["default"].createElement("label", {
|
|
187
222
|
className: labelClassName,
|
|
188
223
|
htmlFor: "termsAcceptance"
|
|
189
224
|
}, /*#__PURE__*/_react["default"].createElement("input", inputProps), /*#__PURE__*/_react["default"].createElement("span", {
|
|
@@ -32,7 +32,7 @@ function B2CPartnershipConfirmation(_ref) {
|
|
|
32
32
|
className: "ncf__paragraph"
|
|
33
33
|
}, /*#__PURE__*/_react["default"].createElement("h1", {
|
|
34
34
|
className: "ncf__header ncf__header--confirmation"
|
|
35
|
-
},
|
|
35
|
+
}, 'Welcome to your three months\' Premium access'))), /*#__PURE__*/_react["default"].createElement("p", {
|
|
36
36
|
className: "ncf__paragraph"
|
|
37
37
|
}, "Please check your email to confirm your account and set your password."), /*#__PURE__*/_react["default"].createElement("p", {
|
|
38
38
|
className: "ncf__paragraph"
|
package/dist/payment-type.js
CHANGED
|
@@ -33,7 +33,7 @@ var PaypalCustomerCareMessage = function PaypalCustomerCareMessage() {
|
|
|
33
33
|
className: "o-message__content"
|
|
34
34
|
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
35
35
|
className: "o-message__content-main"
|
|
36
|
-
}, "If you",
|
|
36
|
+
}, "If you", '\'', "d like to change your payment method to Paypal please", ' ', /*#__PURE__*/_react["default"].createElement("a", {
|
|
37
37
|
className: "o-message__actions__secondary",
|
|
38
38
|
href: "https://help.ft.com"
|
|
39
39
|
}, "contact Customer Care"), ".")))));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@financial-times/n-conversion-forms",
|
|
3
|
-
"version": "20.3.
|
|
3
|
+
"version": "20.3.4",
|
|
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": {
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"build-storybook": "build-storybook --docs --output-dir docs",
|
|
12
12
|
"lint": "eslint . --ext .jsx,.js",
|
|
13
13
|
"lint-fix": "eslint . --ext .jsx,.js --fix",
|
|
14
|
-
"prettier": "prettier --write '**/*.{js,jsx,json,scss}'"
|
|
14
|
+
"prettier": "prettier --write '**/*.{js,jsx,json,scss}'",
|
|
15
|
+
"preinstall": "[ \"$INIT_CWD\" != \"$PWD\" ] || npm_config_yes=true npx check-engine"
|
|
15
16
|
},
|
|
16
17
|
"repository": {
|
|
17
18
|
"type": "git",
|
|
@@ -40,11 +41,12 @@
|
|
|
40
41
|
"@financial-times/eslint-config-next": "^3.0.0",
|
|
41
42
|
"@financial-times/n-gage": "^8.2.0",
|
|
42
43
|
"@storybook/addon-a11y": "^6.0.10",
|
|
43
|
-
"@storybook/addon-essentials": "
|
|
44
|
+
"@storybook/addon-essentials": "6.0.10",
|
|
44
45
|
"@storybook/react": "^6.0.10",
|
|
45
46
|
"@sucrase/jest-plugin": "^2.0.0",
|
|
46
47
|
"bower": "^1.8.8",
|
|
47
48
|
"chai": "^4.2.0",
|
|
49
|
+
"check-engines": "^1.5.0",
|
|
48
50
|
"enzyme": "^3.10.0",
|
|
49
51
|
"enzyme-adapter-react-16": "^1.15.1",
|
|
50
52
|
"eslint": "^8.1.0",
|
|
@@ -71,7 +73,8 @@
|
|
|
71
73
|
"snyk": "1.230.7"
|
|
72
74
|
},
|
|
73
75
|
"engines": {
|
|
74
|
-
"node": "12.x"
|
|
76
|
+
"node": "12.x || 14.x",
|
|
77
|
+
"npm": "7.x || 8.x"
|
|
75
78
|
},
|
|
76
79
|
"lint-staged": {
|
|
77
80
|
"**/*.{js,jsx,json,scss}": "prettier --write",
|
|
@@ -80,8 +83,8 @@
|
|
|
80
83
|
"husky": {
|
|
81
84
|
"hooks": {
|
|
82
85
|
"commit-msg": "node_modules/.bin/secret-squirrel-commitmsg",
|
|
83
|
-
"pre-commit": "node_modules/.bin/secret-squirrel && npm run lint
|
|
84
|
-
"pre-push": "
|
|
86
|
+
"pre-commit": "node_modules/.bin/secret-squirrel && npm run lint",
|
|
87
|
+
"pre-push": "make test"
|
|
85
88
|
}
|
|
86
89
|
}
|
|
87
90
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ReactDOMServer from 'react-dom/server';
|
|
2
2
|
|
|
3
3
|
export const expectToRenderCorrectly = {
|
|
4
|
-
toRenderCorrectly(reactComponent, props) {
|
|
4
|
+
toRenderCorrectly (reactComponent, props) {
|
|
5
5
|
// Render the React component with props.
|
|
6
6
|
const ReactComponentRendered = ReactDOMServer.renderToStaticMarkup(
|
|
7
7
|
reactComponent(props)
|
package/utils/app-banner.js
CHANGED
package/utils/apple-pay.js
CHANGED
|
@@ -38,7 +38,7 @@ class ApplePay {
|
|
|
38
38
|
* @param {Object} options PaymentRequest API payment options object
|
|
39
39
|
* @throws If browser doesn't support PaymentRequest API
|
|
40
40
|
*/
|
|
41
|
-
constructor(
|
|
41
|
+
constructor (
|
|
42
42
|
window,
|
|
43
43
|
methods = ApplePay.PAYMENT_METHODS,
|
|
44
44
|
details = ApplePay.PAYMENT_DETAILS,
|
|
@@ -63,7 +63,7 @@ class ApplePay {
|
|
|
63
63
|
* Proxy call through to the request
|
|
64
64
|
* @return {Promise<Boolean>}
|
|
65
65
|
*/
|
|
66
|
-
canMakePayment() {
|
|
66
|
+
canMakePayment () {
|
|
67
67
|
return this.request.canMakePayment();
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -72,7 +72,7 @@ class ApplePay {
|
|
|
72
72
|
* @param {Object} paymentDetails Optional payment details object for update
|
|
73
73
|
* @return {Promise<Object>} Response object from apple pay
|
|
74
74
|
*/
|
|
75
|
-
show(paymentDetails) {
|
|
75
|
+
show (paymentDetails) {
|
|
76
76
|
// Work around to enable the update of payment details for safari
|
|
77
77
|
// browsers as it seems not to be supported, regenerates PaymentRequest
|
|
78
78
|
if (paymentDetails) {
|
|
@@ -92,7 +92,7 @@ class ApplePay {
|
|
|
92
92
|
* Validate ourselves via membership
|
|
93
93
|
* @param {Object} event
|
|
94
94
|
*/
|
|
95
|
-
async handleMerchantValidation(event) {
|
|
95
|
+
async handleMerchantValidation (event) {
|
|
96
96
|
const merchantId = ApplePay.getMerchantId(this.methods);
|
|
97
97
|
const url = ApplePay.getMerchantValidationUrl(merchantId);
|
|
98
98
|
const data = {
|
|
@@ -123,7 +123,7 @@ class ApplePay {
|
|
|
123
123
|
* @param {Array} methods
|
|
124
124
|
* @return {String}
|
|
125
125
|
*/
|
|
126
|
-
static getMerchantId(methods = []) {
|
|
126
|
+
static getMerchantId (methods = []) {
|
|
127
127
|
const method = methods[0] || {};
|
|
128
128
|
return (
|
|
129
129
|
(method.data && method.data.merchantIdentifier) || ApplePay.MERCHANT_ID
|
|
@@ -135,7 +135,7 @@ class ApplePay {
|
|
|
135
135
|
* @param {String} merchantId
|
|
136
136
|
* @return {String}
|
|
137
137
|
*/
|
|
138
|
-
static getMerchantValidationUrl(merchantId) {
|
|
138
|
+
static getMerchantValidationUrl (merchantId) {
|
|
139
139
|
if (merchantId === ApplePay.TEST_MERCHANT_ID) {
|
|
140
140
|
return ApplePay.TEST_MERCHANT_VALIDATION_URL;
|
|
141
141
|
}
|
|
@@ -148,7 +148,7 @@ class ApplePay {
|
|
|
148
148
|
* @param {String} currency ISO 3 digit currency code
|
|
149
149
|
* @param {String} label Product name
|
|
150
150
|
*/
|
|
151
|
-
static getPaymentDetails(value, currency, label) {
|
|
151
|
+
static getPaymentDetails (value, currency, label) {
|
|
152
152
|
const details = ApplePay.PAYMENT_DETAILS;
|
|
153
153
|
details.total.label = label;
|
|
154
154
|
details.total.amount.value = value;
|
|
@@ -160,7 +160,7 @@ class ApplePay {
|
|
|
160
160
|
* Expose the production merchant id
|
|
161
161
|
* @return {String}
|
|
162
162
|
*/
|
|
163
|
-
static get MERCHANT_ID() {
|
|
163
|
+
static get MERCHANT_ID () {
|
|
164
164
|
return 'merchant.com.ft';
|
|
165
165
|
}
|
|
166
166
|
|
|
@@ -168,7 +168,7 @@ class ApplePay {
|
|
|
168
168
|
* Expose the production merchant validation url
|
|
169
169
|
* @return {String}
|
|
170
170
|
*/
|
|
171
|
-
static get MERCHANT_VALIDATION_URL() {
|
|
171
|
+
static get MERCHANT_VALIDATION_URL () {
|
|
172
172
|
return 'https://api.ft.com/idm/v1/apple-merchant-validation/validate';
|
|
173
173
|
}
|
|
174
174
|
|
|
@@ -176,7 +176,7 @@ class ApplePay {
|
|
|
176
176
|
* Expose production payment methods
|
|
177
177
|
* @return {Array}
|
|
178
178
|
*/
|
|
179
|
-
static get PAYMENT_METHODS() {
|
|
179
|
+
static get PAYMENT_METHODS () {
|
|
180
180
|
return [
|
|
181
181
|
{
|
|
182
182
|
supportedMethods: 'https://apple.com/apple-pay',
|
|
@@ -195,7 +195,7 @@ class ApplePay {
|
|
|
195
195
|
* Default payment details
|
|
196
196
|
* @return {Object}
|
|
197
197
|
*/
|
|
198
|
-
static get PAYMENT_DETAILS() {
|
|
198
|
+
static get PAYMENT_DETAILS () {
|
|
199
199
|
return {
|
|
200
200
|
total: {
|
|
201
201
|
label: 'FT.com',
|
|
@@ -211,7 +211,7 @@ class ApplePay {
|
|
|
211
211
|
* Default payment options
|
|
212
212
|
* @return {Object}
|
|
213
213
|
*/
|
|
214
|
-
static get PAYMENT_OPTIONS() {
|
|
214
|
+
static get PAYMENT_OPTIONS () {
|
|
215
215
|
return {
|
|
216
216
|
requestPayerName: false,
|
|
217
217
|
requestPayerEmail: false,
|
|
@@ -224,7 +224,7 @@ class ApplePay {
|
|
|
224
224
|
* Expose the test merchant id
|
|
225
225
|
* @return {String}
|
|
226
226
|
*/
|
|
227
|
-
static get TEST_MERCHANT_ID() {
|
|
227
|
+
static get TEST_MERCHANT_ID () {
|
|
228
228
|
return 'merchant.test.env.apple.pay';
|
|
229
229
|
}
|
|
230
230
|
|
|
@@ -232,7 +232,7 @@ class ApplePay {
|
|
|
232
232
|
* Expose the test merchant validation url
|
|
233
233
|
* @return {String}
|
|
234
234
|
*/
|
|
235
|
-
static get TEST_MERCHANT_VALIDATION_URL() {
|
|
235
|
+
static get TEST_MERCHANT_VALIDATION_URL () {
|
|
236
236
|
return 'https://api-t.ft.com/idm/v1/apple-merchant-validation/validate';
|
|
237
237
|
}
|
|
238
238
|
|
|
@@ -240,7 +240,7 @@ class ApplePay {
|
|
|
240
240
|
* Expose the test payment methods
|
|
241
241
|
* @return {Array}
|
|
242
242
|
*/
|
|
243
|
-
static get TEST_PAYMENT_METHODS() {
|
|
243
|
+
static get TEST_PAYMENT_METHODS () {
|
|
244
244
|
return [
|
|
245
245
|
{
|
|
246
246
|
supportedMethods: 'https://apple.com/apple-pay',
|
package/utils/billing-city.js
CHANGED
package/utils/billing-country.js
CHANGED
|
@@ -15,7 +15,7 @@ class BillingCountry {
|
|
|
15
15
|
* @throws If the document not passed
|
|
16
16
|
* @throws When the country element not found
|
|
17
17
|
*/
|
|
18
|
-
constructor(element) {
|
|
18
|
+
constructor (element) {
|
|
19
19
|
if (!element) {
|
|
20
20
|
throw new Error('Please supply a DOM element');
|
|
21
21
|
}
|
|
@@ -32,7 +32,7 @@ class BillingCountry {
|
|
|
32
32
|
* Register an event listener
|
|
33
33
|
* @param {Function} callback Called with event when changed
|
|
34
34
|
*/
|
|
35
|
-
onChange(callback = () => {}) {
|
|
35
|
+
onChange (callback = () => {}) {
|
|
36
36
|
return this.$billingCountry.addEventListener('change', callback);
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -41,7 +41,7 @@ class BillingCountry {
|
|
|
41
41
|
* @return {String}
|
|
42
42
|
* @throws If nothing has been selected
|
|
43
43
|
*/
|
|
44
|
-
getSelected() {
|
|
44
|
+
getSelected () {
|
|
45
45
|
const selected =
|
|
46
46
|
this.$billingCountry.options[this.$billingCountry.selectedIndex];
|
|
47
47
|
if (!selected) {
|