@financial-times/n-conversion-forms 20.3.2 → 20.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.
- 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 +47022 -9009
- package/components/__snapshots__/accept-terms.spec.js.snap +94 -6
- package/components/__snapshots__/delivery-address.spec.js.snap +2 -2
- package/components/__snapshots__/graduation-date.spec.js.snap +3 -3
- 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 +5 -5
- 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 +42 -7
- package/dist/b2c-partnership-confirmation.js +1 -1
- package/dist/confirmation.js +2 -2
- package/dist/continue-reading.js +2 -2
- package/dist/decision-maker.js +2 -2
- package/dist/delivery-address.js +4 -4
- package/dist/delivery-instructions.js +2 -2
- package/dist/delivery-security-instructions.js +2 -2
- package/dist/delivery-start-date.js +2 -2
- package/dist/fieldset.js +2 -2
- package/dist/licence-confirmation.js +2 -2
- package/dist/loader.js +2 -2
- package/dist/message.spec.js +2 -2
- package/dist/payment-term.js +2 -2
- package/dist/payment-type.js +3 -3
- package/package.json +10 -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 +22 -12
package/utils/zuora.js
CHANGED
|
@@ -19,7 +19,7 @@ const PaymentType = require('./payment-type');
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
class Zuora {
|
|
22
|
-
constructor(window) {
|
|
22
|
+
constructor (window) {
|
|
23
23
|
this.Z = window.Z;
|
|
24
24
|
|
|
25
25
|
this.iframe = new FormElement(window.document, '.ncf__zuora-payment');
|
|
@@ -43,7 +43,7 @@ class Zuora {
|
|
|
43
43
|
* @param {Object} prePopulatedFields Parameters with field ids and values to be pre-populated on the form
|
|
44
44
|
* @param {Function} renderCallback A function that gets called after the form is rendered.
|
|
45
45
|
*/
|
|
46
|
-
render({ params, prePopulatedFields = {}, renderCallback = () => {} }) {
|
|
46
|
+
render ({ params, prePopulatedFields = {}, renderCallback = () => {}, captchaCallback = () => {} }) {
|
|
47
47
|
// Using an undocumented Zuora method to attach a render callback for the iframe.
|
|
48
48
|
// This method is called once when the iframe is rendered but gets removed for subsequent renderings.
|
|
49
49
|
// In the Zuora code https://static.zuora.com/Resources/libs/hosted/1.3.1/zuora.js
|
|
@@ -71,6 +71,16 @@ class Zuora {
|
|
|
71
71
|
this.Z.sendErrorMessageToHpm(key, errorMessage);
|
|
72
72
|
}
|
|
73
73
|
);
|
|
74
|
+
|
|
75
|
+
// if we have RECAPTCHA enabled for a given app id this allows the application
|
|
76
|
+
// to hide/show the loader so it is not in the way of completing the challenge
|
|
77
|
+
// docs: https://knowledgecenter.zuora.com/Billing/Billing_and_Payments/LA_Hosted_Payment_Pages/B_Payment_Pages_2.0/Configure_Advanced_Security_Checks_for_Payment_Pages_2.0
|
|
78
|
+
/**
|
|
79
|
+
* Z.setEventHandler - Zuora 3rd party method
|
|
80
|
+
* @param {string} event name
|
|
81
|
+
* @param {Function} anonymous - expects a single argument - event
|
|
82
|
+
*/
|
|
83
|
+
this.Z.setEventHandler('onCaptchaStateChange', captchaCallback);
|
|
74
84
|
}
|
|
75
85
|
|
|
76
86
|
/**
|
|
@@ -79,7 +89,7 @@ class Zuora {
|
|
|
79
89
|
* @param {String} paymentType Type of payment being used
|
|
80
90
|
* @returns {Promise} Resolves when the submission has occurred, rejects if there was an error.
|
|
81
91
|
*/
|
|
82
|
-
submit(paymentType) {
|
|
92
|
+
submit (paymentType) {
|
|
83
93
|
return new Promise((resolve, reject) => {
|
|
84
94
|
// Only handle credit card and direct debit payments
|
|
85
95
|
if (
|
|
@@ -119,7 +129,7 @@ class Zuora {
|
|
|
119
129
|
* agreement checkbox changing (inside the 3rd party Zuora iframe).
|
|
120
130
|
* @param {Function} callback - the callback to fire upon change
|
|
121
131
|
*/
|
|
122
|
-
onAgreementCheckboxChange(callback) {
|
|
132
|
+
onAgreementCheckboxChange (callback) {
|
|
123
133
|
// Zuora 3rd party method, returns response to callback
|
|
124
134
|
this.Z.setEventHandler('agreement_checked', () => {
|
|
125
135
|
callback(true);
|
|
@@ -134,7 +144,7 @@ class Zuora {
|
|
|
134
144
|
* of the direct debit mandate (inside the 3rd party Zuora iframe).
|
|
135
145
|
* @param {Function} callback - the callback to fire upon confirmation.
|
|
136
146
|
*/
|
|
137
|
-
onDirectDebitConfirmation(callback) {
|
|
147
|
+
onDirectDebitConfirmation (callback) {
|
|
138
148
|
// Zuora 3rd party method, returns response to callback
|
|
139
149
|
this.Z.setEventHandler('mandate_confirmed', () => {
|
|
140
150
|
callback(true);
|
|
@@ -149,7 +159,7 @@ class Zuora {
|
|
|
149
159
|
* Zuora doc: https://knowledgecenter.zuora.com/Billing/Billing_and_Payments/LA_Hosted_Payment_Pages/B_Payment_Pages_2.0/H_Integrate_Payment_Pages_2.0#Add_a_Checkbox_for_Stored_Credential_Consent
|
|
150
160
|
* @returns {boolean}
|
|
151
161
|
*/
|
|
152
|
-
setAgreement() {
|
|
162
|
+
setAgreement () {
|
|
153
163
|
const mitConsentAgreementSrc = 'External';
|
|
154
164
|
const mitProfileType = 'Recurring';
|
|
155
165
|
const agreementSupportedBrands = 'Visa,Mastercard';
|
|
@@ -166,21 +176,21 @@ class Zuora {
|
|
|
166
176
|
/**
|
|
167
177
|
* Expose ZuoraErrorValidation
|
|
168
178
|
*/
|
|
169
|
-
static get ZuoraErrorValidation() {
|
|
179
|
+
static get ZuoraErrorValidation () {
|
|
170
180
|
return ZuoraErrorValidation;
|
|
171
181
|
}
|
|
172
182
|
|
|
173
183
|
/**
|
|
174
184
|
* Expose ZuoraErrorMandateCancel
|
|
175
185
|
*/
|
|
176
|
-
static get ZuoraErrorMandateCancel() {
|
|
186
|
+
static get ZuoraErrorMandateCancel () {
|
|
177
187
|
return ZuoraErrorMandateCancel;
|
|
178
188
|
}
|
|
179
189
|
|
|
180
190
|
/**
|
|
181
191
|
* Expose ZuoraErrorInvalidPaymentType
|
|
182
192
|
*/
|
|
183
|
-
static get ZuoraErrorInvalidPaymentType() {
|
|
193
|
+
static get ZuoraErrorInvalidPaymentType () {
|
|
184
194
|
return ZuoraErrorInvalidPaymentType;
|
|
185
195
|
}
|
|
186
196
|
}
|
|
@@ -189,19 +199,19 @@ class Zuora {
|
|
|
189
199
|
* Error classes
|
|
190
200
|
*/
|
|
191
201
|
class ZuoraErrorValidation extends Error {
|
|
192
|
-
constructor(message) {
|
|
202
|
+
constructor (message) {
|
|
193
203
|
super(message);
|
|
194
204
|
Object.setPrototypeOf(this, ZuoraErrorValidation.prototype);
|
|
195
205
|
}
|
|
196
206
|
}
|
|
197
207
|
class ZuoraErrorMandateCancel extends Error {
|
|
198
|
-
constructor(message) {
|
|
208
|
+
constructor (message) {
|
|
199
209
|
super(message);
|
|
200
210
|
Object.setPrototypeOf(this, ZuoraErrorMandateCancel.prototype);
|
|
201
211
|
}
|
|
202
212
|
}
|
|
203
213
|
class ZuoraErrorInvalidPaymentType extends Error {
|
|
204
|
-
constructor(message) {
|
|
214
|
+
constructor (message) {
|
|
205
215
|
super(message);
|
|
206
216
|
Object.setPrototypeOf(this, ZuoraErrorInvalidPaymentType.prototype);
|
|
207
217
|
}
|