1const { createElement } = window.wp.element; 2const { registerPaymentMethod } = window.wc.wcBlocksRegistry; 3 4// Get the plugin URL from WordPress 5const pluginUrl = window.katapultPluginUrl || '/wp-content/plugins/katapult/'; 6 7// Create the logo element 8const katapultLogo = createElement('img', { 9 src: pluginUrl + 'assets/images/icon.png', 10 alt: 'Katapult', 11 style: { 12 marginRight: '8px', 13 verticalAlign: 'middle' 14 } 15}); 16 17// Create the label with logo and text 18const katapultLabel = createElement('span', { 19 style: { 20 display: 'flex', 21 alignItems: 'center' 22 } 23}, [ 24 createElement('span', { style: { marginRight: '4px' } }, 'Katapult'), 25 katapultLogo 26]); 27 28// Create the payment method content with logo and text 29const paymentContent = createElement('div', { 30 style: { 31 display: 'flex', 32 alignItems: 'center' 33 } 34}, [ 35 'Buy now. Pay over time with Katapult' 36]); 37 38registerPaymentMethod({ 39 name: 'katapult', 40 label: katapultLabel, // Use the label with logo 41 content: paymentContent, 42 edit: paymentContent, 43 canMakePayment: () => true, 44 ariaLabel: 'Katapult', 45 supports: { 46 features: [ 'products', 'refunds' ], 47 }, 48 paymentMethodId: 'katapult', 49 async onPaymentProcessing({ orderId }) { 50 console.log('onPaymentProcessing - orderId: ' + orderId); 51 }, 52});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.