mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
♻️ Improve SDK loading in PreviewButtonManager
This commit is contained in:
parent
1f5caac2f1
commit
aa9c02a786
3 changed files with 37 additions and 36 deletions
|
@ -1,5 +1,4 @@
|
|||
import ApplepayButton from "./ApplepayButton";
|
||||
import widgetBuilder from "../../../ppcp-button/resources/js/modules/Renderer/WidgetBuilder";
|
||||
import PreviewButton from "../../../ppcp-button/resources/js/modules/Renderer/PreviewButton";
|
||||
import PreviewButtonManager from "../../../ppcp-button/resources/js/modules/Renderer/PreviewButtonManager";
|
||||
|
||||
|
@ -22,8 +21,7 @@ class ApplePayPreviewButtonManager extends PreviewButtonManager {
|
|||
constructor() {
|
||||
const args = {
|
||||
methodName: 'ApplePay',
|
||||
buttonConfig: window.wc_ppcp_applepay_admin,
|
||||
widgetBuilder,
|
||||
buttonConfig: window.wc_ppcp_applepay_admin
|
||||
};
|
||||
|
||||
super(args);
|
||||
|
@ -33,10 +31,11 @@ class ApplePayPreviewButtonManager extends PreviewButtonManager {
|
|||
* Responsible for fetching and returning the PayPal configuration object for this payment
|
||||
* method.
|
||||
*
|
||||
* @param {{}} payPal - The PayPal SDK object provided by WidgetBuilder.
|
||||
* @return {Promise<{}>}
|
||||
*/
|
||||
async fetchConfig() {
|
||||
const apiMethod = this.widgetBuilder?.paypal?.Applepay()?.config
|
||||
async fetchConfig(payPal) {
|
||||
const apiMethod = payPal?.Applepay()?.config
|
||||
|
||||
if (!apiMethod) {
|
||||
this.error('configuration object cannot be retrieved from PayPal');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue