mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
37 lines
843 B
JavaScript
37 lines
843 B
JavaScript
|
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;
|