@paydock/client-sdk 1.140.1 → 1.141.0-beta

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/README.md CHANGED
@@ -1977,6 +1977,7 @@ Class ZipmoneyCheckoutButton is wrapper of CheckoutButton transform usual button
1977
1977
  * [new ZipmoneyCheckoutButton(selector, publicKey, [gatewayId], [gatewayId])](#user-content-cb_new_ZipmoneyCheckoutButton_new)
1978
1978
  * [.setSuspendedRedirectUri(string)](#user-content-cb_ZipmoneyCheckoutButton+setSuspendedRedirectUri)
1979
1979
  * [.setRedirectUrl(string)](#user-content-cb_ZipmoneyCheckoutButton+setRedirectUrl)
1980
+ * [.onClick(handler)](#user-content-cb_ZipmoneyCheckoutButton+onClick)
1980
1981
  * [.on(eventName, cb)](#user-content-cb_CheckoutButton+on)
1981
1982
  * [.close()](#user-content-cb_CheckoutButton+close)
1982
1983
  * [.onFinishInsert(selector, dataType)](#user-content-cb_CheckoutButton+onFinishInsert)
@@ -2035,6 +2036,27 @@ The merchant's customer would be automatically redirected to this URL after the
2035
2036
  | --- | --- | --- |
2036
2037
  | string | <code>url</code> | URL for redirect |
2037
2038
 
2039
+ <a name="cb_ZipmoneyCheckoutButton+onClick" id="cb_ZipmoneyCheckoutButton+onClick" href="#user-content-cb_ZipmoneyCheckoutButton+onClick">&nbsp;</a>
2040
+
2041
+ ### zipmoneyCheckoutButton.onClick(handler)
2042
+ Subscribe to the click event with an async handler.
2043
+ The checkout flow will wait for the async handler to complete before proceeding.
2044
+ If the handler resolves to `false`, the checkout flow will be cancelled.
2045
+
2046
+ **Kind**: instance method of [<code>ZipmoneyCheckoutButton</code>](#user-content-cb_ZipmoneyCheckoutButton)
2047
+
2048
+ | Param | Description |
2049
+ | --- | --- |
2050
+ | handler | Async function to be called when the button is clicked |
2051
+
2052
+ **Example**
2053
+
2054
+ ```javascript
2055
+ button.onClick(async () => {
2056
+ const isValid = await fetchDataFromServer();
2057
+ return isValid; // return false to stop checkout
2058
+ });
2059
+ ```
2038
2060
  <a name="cb_CheckoutButton+on" id="cb_CheckoutButton+on" href="#user-content-cb_CheckoutButton+on">&nbsp;</a>
2039
2061
 
2040
2062
  ### zipmoneyCheckoutButton.on(eventName, cb)