Skip to content

Commit

Permalink
v1.4.0 (#34)
Browse files Browse the repository at this point in the history
Added support for WooCommerce Cart and Checkout Blocks
  • Loading branch information
alexminza authored May 28, 2024
1 parent 692c6bc commit c9e7e76
Show file tree
Hide file tree
Showing 10 changed files with 532 additions and 338 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ WordPress plugin: https://wordpress.org/plugins/wc-moldovaagroindbank/
* Reverse transactions – partial or complete refunds
* Admin order actions – complete authorized transaction
* Close business day scheduled action
* Supports WooCommerce [block-based checkout experience](https://woo.com/checkout-blocks/)
* Free to use – [Open-source GPL-3.0 license on GitHub](https://github.com/alexminza/wc-moldovaagroindbank)

## Getting Started
Expand Down
46 changes: 46 additions & 0 deletions assets/js/blocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const maib_settings = window.wc.wcSettings.getSetting('moldovaagroindbank_data', {});
const maib_title = window.wp.htmlEntities.decodeEntities(maib_settings.title);

const Content = () => {
return window.wp.htmlEntities.decodeEntities(maib_settings.description || '');
};

const Label = () => {
let icon = maib_settings.icon
? window.wp.element.createElement(
'img',
{
alt: maib_title,
title: maib_title,
src: maib_settings.icon,
style: { float: 'right', paddingRight: '1em' }
}
)
: null;

let label = window.wp.element.createElement(
'span',
icon ? { style: { width: '100%' } } : null,
maib_title,
icon
);

return label;
};

const maib_Block_Gateway = {
name: maib_settings.id,
label: Object(window.wp.element.createElement)(Label, null),
//icons: [{id: settings.id, src: settings.icon, alt: label_text}],
icons: ['visa', 'mastercard'],
content: Object(window.wp.element.createElement)(Content, null),
edit: Object(window.wp.element.createElement)(Content, null),
canMakePayment: () => true,
ariaLabel: maib_title,
supports: {
features: maib_settings.supports,
},
};

//console.debug(maib_Block_Gateway);
window.wc.wcBlocksRegistry.registerPaymentMethod(maib_Block_Gateway);
Binary file modified languages/wc-moldovaagroindbank-ro_RO.mo
Binary file not shown.
Loading

0 comments on commit c9e7e76

Please sign in to comment.