@financial-times/n-conversion-forms 20.3.5 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/utils/zuora.js +11 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/n-conversion-forms",
3
- "version": "20.3.5",
3
+ "version": "20.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": {
package/utils/zuora.js CHANGED
@@ -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
  /**