| 1 |
/** |
| 2 |
* Better Payment - Payment Form Block |
| 3 |
* |
| 4 |
* This is the main entry point for the Payment Form Gutenberg block. |
| 5 |
* It registers the block with WordPress and imports all necessary components. |
| 6 |
* |
| 7 |
* @package Better_Payment |
| 8 |
* @since 1.0.0 |
| 9 |
*/ |
| 10 |
|
| 11 |
import { registerBlockType } from '@wordpress/blocks'; |
| 12 |
import { __ } from '@wordpress/i18n'; |
| 13 |
|
| 14 |
// Import block components |
| 15 |
import Edit from './components/edit'; |
| 16 |
import save from './components/save'; |
| 17 |
import attributes from './components/attributes'; |
| 18 |
|
| 19 |
// Import styles |
| 20 |
import './styles/editor.scss'; |
| 21 |
import './styles/style.scss'; |
| 22 |
|
| 23 |
// Import block icon |
| 24 |
import BlockIcon from './components/icon'; |
| 25 |
|
| 26 |
/** |
| 27 |
* Register the Payment Form block. |
| 28 |
* |
| 29 |
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ |
| 30 |
*/ |
| 31 |
registerBlockType('better-payment/payment-form', { |
| 32 |
/** |
| 33 |
* Block title displayed in the inserter. |
| 34 |
*/ |
| 35 |
title: __('Payment Form', 'better-payment'), |
| 36 |
|
| 37 |
/** |
| 38 |
* Block description displayed in the block inspector. |
| 39 |
*/ |
| 40 |
description: __( |
| 41 |
'Seamlessly collect payments with Stripe, PayPal, and Paystack in just a few clicks.', |
| 42 |
'better-payment' |
| 43 |
), |
| 44 |
|
| 45 |
/** |
| 46 |
* Block category - groups blocks in the inserter. |
| 47 |
*/ |
| 48 |
category: 'better-payment', |
| 49 |
|
| 50 |
/** |
| 51 |
* Block icon. |
| 52 |
*/ |
| 53 |
icon: BlockIcon, |
| 54 |
|
| 55 |
/** |
| 56 |
* Keywords for block search. |
| 57 |
*/ |
| 58 |
keywords: [ |
| 59 |
__('payment', 'better-payment'), |
| 60 |
__('stripe', 'better-payment'), |
| 61 |
__('paypal', 'better-payment'), |
| 62 |
__('paystack', 'better-payment'), |
| 63 |
__('donate', 'better-payment'), |
| 64 |
__('better payment', 'better-payment'), |
| 65 |
__('betterpayment', 'better-payment'), |
| 66 |
], |
| 67 |
|
| 68 |
/** |
| 69 |
* Block attributes. |
| 70 |
*/ |
| 71 |
attributes, |
| 72 |
|
| 73 |
/** |
| 74 |
* Block example for preview. |
| 75 |
*/ |
| 76 |
example: { |
| 77 |
attributes: { |
| 78 |
formTitle: __('Payment Form', 'better-payment'), |
| 79 |
formLayout: 'layout-1', |
| 80 |
showTitle: true, |
| 81 |
}, |
| 82 |
}, |
| 83 |
|
| 84 |
/** |
| 85 |
* Edit component - renders in the editor. |
| 86 |
*/ |
| 87 |
edit: Edit, |
| 88 |
|
| 89 |
/** |
| 90 |
* Save component - returns null for dynamic blocks. |
| 91 |
*/ |
| 92 |
save, |
| 93 |
}); |
| 94 |
|