1(function (wp) { 2 const { __ } = wp.i18n; 3 const { registerBlockType } = wp.blocks; 4 const el = wp.element.createElement; 5 6 registerBlockType('sender-net-automated-emails/subscribe-newsletter-block', { 7 title: __('Subscribe newsletter'), 8 icon: 'sender-block-icon', 9 category: 'widgets', 10 parent: ["woocommerce/checkout-contact-information-block"], 11 supports: { multiple: false }, 12 13 edit: function () { 14 const initialChecked = window.senderNewsletter.checkboxActive === '1' || false; 15 const label = window.senderNewsletter.senderCheckbox || 'Subscribe to our newsletter'; 16 17 return el( 18 'div', 19 { className: 'wc-block-components-checkbox wc-block-checkout__create-account' }, 20 el( 21 'label', 22 { htmlFor: 'sender-newsletter-checkbox-subscribe' }, 23 el('input', { 24 type: 'checkbox', 25 id: 'sender-newsletter-checkbox-subscribe', 26 className: 'wc-block-components-checkbox__input', 27 checked: initialChecked, 28 }), 29 el('span', { className: 'wc-block-components-checkbox__label' }, label) 30 ) 31 ); 32 }, 33 34 save: function () { 35 const senderNewsletterCheckbox = window.senderNewsletter.senderCheckbox || 'Subscribe to our newsletter'; 36 const initialChecked = window.senderNewsletter.checkboxActive === '1' || false; 37 38 return ( 39 el('div', { className: 'wc-block-components-checkbox wc-block-checkout__create-account' }, 40 el('label', { htmlFor: 'sender-newsletter-checkbox-subscribe' }, 41 el('input', { 42 type: 'checkbox', 43 id: 'sender-newsletter-checkbox-subscribe', 44 name: 'sender-newsletter-checkbox-subscribe', 45 className: 'wc-block-components-checkbox__input', 46 checked: initialChecked, 47 }), 48 el('svg', { 49 className: 'wc-block-components-checkbox__mark', 50 ariaHidden: 'true', 51 xmlns: 'http://www.w3.org/2000/svg',
52 viewBox: '0 0 24 20' 53 }, 54 el('path', { d: 'M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z' }) 55 ), 56 el('span', { className: 'wc-block-components-checkbox__label' }, senderNewsletterCheckbox) 57 ) 58 ) 59 ); 60 }, 61 }); 62 63})(window.wp);
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.