mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
Fix the Apple Pay button in the editor
This commit is contained in:
parent
d1b4d7721e
commit
436fd77587
6 changed files with 112 additions and 28 deletions
|
@ -0,0 +1,36 @@
|
|||
import ApplepayButton from "./ApplepayButton";
|
||||
|
||||
class ApplepayManagerBlockEditor {
|
||||
|
||||
constructor(buttonConfig, ppcpConfig) {
|
||||
this.buttonConfig = buttonConfig;
|
||||
this.ppcpConfig = ppcpConfig;
|
||||
this.applePayConfig = null;
|
||||
}
|
||||
|
||||
init() {
|
||||
(async () => {
|
||||
await this.config();
|
||||
})();
|
||||
}
|
||||
|
||||
async config() {
|
||||
try {
|
||||
this.applePayConfig = await paypal.Applepay().config();
|
||||
|
||||
const button = new ApplepayButton(
|
||||
this.ppcpConfig.context,
|
||||
null,
|
||||
this.buttonConfig,
|
||||
this.ppcpConfig,
|
||||
);
|
||||
|
||||
button.init(this.applePayConfig);
|
||||
|
||||
} catch (error) {
|
||||
console.error('Failed to initialize Apple Pay:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default ApplepayManagerBlockEditor;
|
Loading…
Add table
Add a link
Reference in a new issue