@automattic/newspack-blocks 1.0.0-hotfix-cap-count-user-posts-dedup.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +3 -0
- package/.hooks/pre-push +8 -0
- package/.nvmrc +1 -0
- package/.prettierignore +4 -0
- package/.prettierrc.js +5 -0
- package/.stylelintrc.js +3 -0
- package/AGENTS.md +275 -0
- package/CHANGELOG.md +3971 -0
- package/CLAUDE.md +1 -0
- package/README.md +43 -0
- package/babel.config.js +6 -0
- package/bin/install-wp-tests.sh +155 -0
- package/bin/update-translations.sh +13 -0
- package/block-list.json +12 -0
- package/composer.json +46 -0
- package/composer.lock +3632 -0
- package/dist/author-list/view-rtl.css +1 -0
- package/dist/author-list/view.asset.php +1 -0
- package/dist/author-list/view.css +1 -0
- package/dist/author-list/view.js +0 -0
- package/dist/author-profile/view-rtl.css +1 -0
- package/dist/author-profile/view.asset.php +1 -0
- package/dist/author-profile/view.css +1 -0
- package/dist/author-profile/view.js +0 -0
- package/dist/block_styles-rtl.css +2 -0
- package/dist/block_styles.asset.php +1 -0
- package/dist/block_styles.css +2 -0
- package/dist/block_styles.js +0 -0
- package/dist/blocks/author-list/block.json +89 -0
- package/dist/blocks/author-profile/block.json +80 -0
- package/dist/blocks/carousel/block.json +125 -0
- package/dist/blocks/checkout-button/block.json +117 -0
- package/dist/blocks/donate/block.json +103 -0
- package/dist/blocks/homepage-articles/block.json +260 -0
- package/dist/blocks/iframe/block.json +36 -0
- package/dist/carousel/view-rtl.css +2 -0
- package/dist/carousel/view.asset.php +1 -0
- package/dist/carousel/view.css +2 -0
- package/dist/carousel/view.js +3 -0
- package/dist/checkout-button/view-rtl.css +1 -0
- package/dist/checkout-button/view.asset.php +1 -0
- package/dist/checkout-button/view.css +1 -0
- package/dist/checkout-button/view.js +0 -0
- package/dist/donate/view-rtl.css +1 -0
- package/dist/donate/view.asset.php +1 -0
- package/dist/donate/view.css +1 -0
- package/dist/donate/view.js +1 -0
- package/dist/editor-rtl.css +66 -0
- package/dist/editor.asset.php +1 -0
- package/dist/editor.css +66 -0
- package/dist/editor.js +57 -0
- package/dist/frequencyBased-rtl.css +1 -0
- package/dist/frequencyBased.asset.php +1 -0
- package/dist/frequencyBased.css +1 -0
- package/dist/frequencyBased.js +1 -0
- package/dist/homepage-articles/view-rtl.css +1 -0
- package/dist/homepage-articles/view.asset.php +1 -0
- package/dist/homepage-articles/view.css +1 -0
- package/dist/homepage-articles/view.js +1 -0
- package/dist/iframe/view-rtl.css +1 -0
- package/dist/iframe/view.asset.php +1 -0
- package/dist/iframe/view.css +1 -0
- package/dist/iframe/view.js +1 -0
- package/dist/modal-rtl.css +1 -0
- package/dist/modal.asset.php +1 -0
- package/dist/modal.css +1 -0
- package/dist/modal.js +1 -0
- package/dist/modalCheckout-rtl.css +1 -0
- package/dist/modalCheckout.asset.php +1 -0
- package/dist/modalCheckout.css +1 -0
- package/dist/modalCheckout.js +1 -0
- package/dist/placeholder_blocks.asset.php +1 -0
- package/dist/placeholder_blocks.js +4 -0
- package/dist/tiersBased-rtl.css +1 -0
- package/dist/tiersBased.asset.php +1 -0
- package/dist/tiersBased.css +1 -0
- package/dist/tiersBased.js +1 -0
- package/includes/class-modal-checkout.php +2324 -0
- package/includes/class-newspack-blocks-api.php +347 -0
- package/includes/class-newspack-blocks-caching.php +291 -0
- package/includes/class-newspack-blocks-patterns.php +167 -0
- package/includes/class-newspack-blocks.php +1581 -0
- package/includes/modal-checkout/class-change-payment-gateway.php +86 -0
- package/includes/modal-checkout/class-checkout-data.php +406 -0
- package/includes/plugins/class-the-events-calendar.php +84 -0
- package/includes/tracking/class-data-events.php +83 -0
- package/languages/newspack-blocks-de_DE-01a5b44b8bc8d20f62541de420aa61ab.json +1 -0
- package/languages/newspack-blocks-de_DE-0662222bf15e7a1a7b74db2dabb48d6c.json +1 -0
- package/languages/newspack-blocks-de_DE-0c8dad524e2a57cee4f8efb6e35387c1.json +1 -0
- package/languages/newspack-blocks-de_DE-10754bc02d28d4301c103f26dbf519ce.json +1 -0
- package/languages/newspack-blocks-de_DE-2d52b39fdbc5d6c94b3514803f3720b8.json +1 -0
- package/languages/newspack-blocks-de_DE-34e5c64f90b1444f3fc735376442eada.json +1 -0
- package/languages/newspack-blocks-de_DE-351fd022e077061b5796bf7042446bfc.json +1 -0
- package/languages/newspack-blocks-de_DE-37552bb09e2a9fceec1970e3c6d46557.json +1 -0
- package/languages/newspack-blocks-de_DE-4b2ccb4e4dc8b3491228b2feb54872f2.json +1 -0
- package/languages/newspack-blocks-de_DE-4cecf783e091d36284a3e0cdafcd0fd5.json +1 -0
- package/languages/newspack-blocks-de_DE-4f16e21047908d19937bc10ced63acd1.json +1 -0
- package/languages/newspack-blocks-de_DE-4fdea541976076f02d56139fb35e5b42.json +1 -0
- package/languages/newspack-blocks-de_DE-501b38ac90d35730a620fb0d483702fa.json +1 -0
- package/languages/newspack-blocks-de_DE-53e2a1d5945b8d2b1c35e81ae1e532f3.json +1 -0
- package/languages/newspack-blocks-de_DE-5d4055f484eeb00e3ea0f9d8aace0897.json +1 -0
- package/languages/newspack-blocks-de_DE-5f70538e0223bc8a05b922cba67da6fb.json +1 -0
- package/languages/newspack-blocks-de_DE-6c2e53bab28419c30e1eaee70ba599cf.json +1 -0
- package/languages/newspack-blocks-de_DE-6ed95fb4873e6e2b81351177a44995f6.json +1 -0
- package/languages/newspack-blocks-de_DE-727631509ad8eec8e2cbe740c6dad199.json +1 -0
- package/languages/newspack-blocks-de_DE-73c6d3bde805172d1993f75397e9832d.json +1 -0
- package/languages/newspack-blocks-de_DE-78456b164809d080adecb4d2b3895802.json +1 -0
- package/languages/newspack-blocks-de_DE-7b1aa64ce2d962decc04666ab86c53de.json +1 -0
- package/languages/newspack-blocks-de_DE-7c29764d5ef91723f5ce454f66431b9e.json +1 -0
- package/languages/newspack-blocks-de_DE-912a2876091ef0dca9b26f3cfc01fc9c.json +1 -0
- package/languages/newspack-blocks-de_DE-91a7ac8017d6e2159be1c5a3c1e372e4.json +1 -0
- package/languages/newspack-blocks-de_DE-969286d51bb0afe10983b9aec317b5ee.json +1 -0
- package/languages/newspack-blocks-de_DE-9ef9b2c60c897ad79f92951e6e9949a1.json +1 -0
- package/languages/newspack-blocks-de_DE-a822c3d210c89af3cb7da28eaaef929c.json +1 -0
- package/languages/newspack-blocks-de_DE-aa9f9057c77a46b31d7e325a4322f2da.json +1 -0
- package/languages/newspack-blocks-de_DE-b6d3cfc30bb16d88d7bc5384bc775543.json +1 -0
- package/languages/newspack-blocks-de_DE-b712270cd4eb3cae7899b50b57bdd576.json +1 -0
- package/languages/newspack-blocks-de_DE-babcc0ca24e7f0145b1c8f647049f085.json +1 -0
- package/languages/newspack-blocks-de_DE-bb66d96d450663284550bed5a3e9113e.json +1 -0
- package/languages/newspack-blocks-de_DE-c810378e74f20906b8193ea76adb6bc0.json +1 -0
- package/languages/newspack-blocks-de_DE-d3a1c55a07efd1a65e227bf120840752.json +1 -0
- package/languages/newspack-blocks-de_DE-d5f23a52ecbfd492ebf819c14206a9e2.json +1 -0
- package/languages/newspack-blocks-de_DE-d684e5c5ac51934ba20811c2f588e1d5.json +1 -0
- package/languages/newspack-blocks-de_DE-dd56360b115d1b39c48033c1e0749a11.json +1 -0
- package/languages/newspack-blocks-de_DE-e0e4434aee4db01e71268ce3edf1dd97.json +1 -0
- package/languages/newspack-blocks-de_DE-e58126c278611ed6c17684ba8e7459b4.json +1 -0
- package/languages/newspack-blocks-de_DE-ea3e2a660753c7bfa13b5bbd8a46bdd0.json +1 -0
- package/languages/newspack-blocks-de_DE-eccbc51a43c04f59165364eda71e0be7.json +1 -0
- package/languages/newspack-blocks-de_DE-eeb28f99adedd5fad3081d2756d6f4a4.json +1 -0
- package/languages/newspack-blocks-de_DE-f03802d9ac1ae8f3b85caee4347b93a7.json +1 -0
- package/languages/newspack-blocks-de_DE-f32a4d8bd8f1f1e03b6523dfaa4c9f73.json +1 -0
- package/languages/newspack-blocks-de_DE-f5f8db76788e4079ddfa743333708b88.json +1 -0
- package/languages/newspack-blocks-de_DE-f8b1589c450689398f90b179f47e74ee.json +1 -0
- package/languages/newspack-blocks-de_DE-f9d0b05d4d6ddd3273f1f3fb2eb2ca50.json +1 -0
- package/languages/newspack-blocks-de_DE-fbe7f8c598cf05d4603ba49fec909ded.json +1 -0
- package/languages/newspack-blocks-de_DE-fcc93143c1f2b74671f595454b971f44.json +1 -0
- package/languages/newspack-blocks-de_DE.mo +0 -0
- package/languages/newspack-blocks-de_DE.po +2088 -0
- package/languages/newspack-blocks-es_ES-01a5b44b8bc8d20f62541de420aa61ab.json +1 -0
- package/languages/newspack-blocks-es_ES-0662222bf15e7a1a7b74db2dabb48d6c.json +1 -0
- package/languages/newspack-blocks-es_ES-0c8dad524e2a57cee4f8efb6e35387c1.json +1 -0
- package/languages/newspack-blocks-es_ES-10754bc02d28d4301c103f26dbf519ce.json +1 -0
- package/languages/newspack-blocks-es_ES-2d52b39fdbc5d6c94b3514803f3720b8.json +1 -0
- package/languages/newspack-blocks-es_ES-34e5c64f90b1444f3fc735376442eada.json +1 -0
- package/languages/newspack-blocks-es_ES-351fd022e077061b5796bf7042446bfc.json +1 -0
- package/languages/newspack-blocks-es_ES-37552bb09e2a9fceec1970e3c6d46557.json +1 -0
- package/languages/newspack-blocks-es_ES-4b2ccb4e4dc8b3491228b2feb54872f2.json +1 -0
- package/languages/newspack-blocks-es_ES-4cecf783e091d36284a3e0cdafcd0fd5.json +1 -0
- package/languages/newspack-blocks-es_ES-4f16e21047908d19937bc10ced63acd1.json +1 -0
- package/languages/newspack-blocks-es_ES-4fdea541976076f02d56139fb35e5b42.json +1 -0
- package/languages/newspack-blocks-es_ES-501b38ac90d35730a620fb0d483702fa.json +1 -0
- package/languages/newspack-blocks-es_ES-53e2a1d5945b8d2b1c35e81ae1e532f3.json +1 -0
- package/languages/newspack-blocks-es_ES-5d4055f484eeb00e3ea0f9d8aace0897.json +1 -0
- package/languages/newspack-blocks-es_ES-5f70538e0223bc8a05b922cba67da6fb.json +1 -0
- package/languages/newspack-blocks-es_ES-6c2e53bab28419c30e1eaee70ba599cf.json +1 -0
- package/languages/newspack-blocks-es_ES-6ed95fb4873e6e2b81351177a44995f6.json +1 -0
- package/languages/newspack-blocks-es_ES-727631509ad8eec8e2cbe740c6dad199.json +1 -0
- package/languages/newspack-blocks-es_ES-73c6d3bde805172d1993f75397e9832d.json +1 -0
- package/languages/newspack-blocks-es_ES-78456b164809d080adecb4d2b3895802.json +1 -0
- package/languages/newspack-blocks-es_ES-7b1aa64ce2d962decc04666ab86c53de.json +1 -0
- package/languages/newspack-blocks-es_ES-7c29764d5ef91723f5ce454f66431b9e.json +1 -0
- package/languages/newspack-blocks-es_ES-912a2876091ef0dca9b26f3cfc01fc9c.json +1 -0
- package/languages/newspack-blocks-es_ES-91a7ac8017d6e2159be1c5a3c1e372e4.json +1 -0
- package/languages/newspack-blocks-es_ES-969286d51bb0afe10983b9aec317b5ee.json +1 -0
- package/languages/newspack-blocks-es_ES-9ef9b2c60c897ad79f92951e6e9949a1.json +1 -0
- package/languages/newspack-blocks-es_ES-a822c3d210c89af3cb7da28eaaef929c.json +1 -0
- package/languages/newspack-blocks-es_ES-aa9f9057c77a46b31d7e325a4322f2da.json +1 -0
- package/languages/newspack-blocks-es_ES-b6d3cfc30bb16d88d7bc5384bc775543.json +1 -0
- package/languages/newspack-blocks-es_ES-b712270cd4eb3cae7899b50b57bdd576.json +1 -0
- package/languages/newspack-blocks-es_ES-babcc0ca24e7f0145b1c8f647049f085.json +1 -0
- package/languages/newspack-blocks-es_ES-bb66d96d450663284550bed5a3e9113e.json +1 -0
- package/languages/newspack-blocks-es_ES-c810378e74f20906b8193ea76adb6bc0.json +1 -0
- package/languages/newspack-blocks-es_ES-d3a1c55a07efd1a65e227bf120840752.json +1 -0
- package/languages/newspack-blocks-es_ES-d5f23a52ecbfd492ebf819c14206a9e2.json +1 -0
- package/languages/newspack-blocks-es_ES-d684e5c5ac51934ba20811c2f588e1d5.json +1 -0
- package/languages/newspack-blocks-es_ES-dd56360b115d1b39c48033c1e0749a11.json +1 -0
- package/languages/newspack-blocks-es_ES-e0e4434aee4db01e71268ce3edf1dd97.json +1 -0
- package/languages/newspack-blocks-es_ES-e58126c278611ed6c17684ba8e7459b4.json +1 -0
- package/languages/newspack-blocks-es_ES-ea3e2a660753c7bfa13b5bbd8a46bdd0.json +1 -0
- package/languages/newspack-blocks-es_ES-eccbc51a43c04f59165364eda71e0be7.json +1 -0
- package/languages/newspack-blocks-es_ES-eeb28f99adedd5fad3081d2756d6f4a4.json +1 -0
- package/languages/newspack-blocks-es_ES-f03802d9ac1ae8f3b85caee4347b93a7.json +1 -0
- package/languages/newspack-blocks-es_ES-f32a4d8bd8f1f1e03b6523dfaa4c9f73.json +1 -0
- package/languages/newspack-blocks-es_ES-f5f8db76788e4079ddfa743333708b88.json +1 -0
- package/languages/newspack-blocks-es_ES-f8b1589c450689398f90b179f47e74ee.json +1 -0
- package/languages/newspack-blocks-es_ES-f9d0b05d4d6ddd3273f1f3fb2eb2ca50.json +1 -0
- package/languages/newspack-blocks-es_ES-fbe7f8c598cf05d4603ba49fec909ded.json +1 -0
- package/languages/newspack-blocks-es_ES-fcc93143c1f2b74671f595454b971f44.json +1 -0
- package/languages/newspack-blocks-es_ES.mo +0 -0
- package/languages/newspack-blocks-es_ES.po +2080 -0
- package/languages/newspack-blocks-fr_BE-01a5b44b8bc8d20f62541de420aa61ab.json +1 -0
- package/languages/newspack-blocks-fr_BE-0662222bf15e7a1a7b74db2dabb48d6c.json +1 -0
- package/languages/newspack-blocks-fr_BE-0c8dad524e2a57cee4f8efb6e35387c1.json +1 -0
- package/languages/newspack-blocks-fr_BE-10754bc02d28d4301c103f26dbf519ce.json +1 -0
- package/languages/newspack-blocks-fr_BE-2d52b39fdbc5d6c94b3514803f3720b8.json +1 -0
- package/languages/newspack-blocks-fr_BE-34e5c64f90b1444f3fc735376442eada.json +1 -0
- package/languages/newspack-blocks-fr_BE-351fd022e077061b5796bf7042446bfc.json +1 -0
- package/languages/newspack-blocks-fr_BE-37552bb09e2a9fceec1970e3c6d46557.json +1 -0
- package/languages/newspack-blocks-fr_BE-4b2ccb4e4dc8b3491228b2feb54872f2.json +1 -0
- package/languages/newspack-blocks-fr_BE-4cecf783e091d36284a3e0cdafcd0fd5.json +1 -0
- package/languages/newspack-blocks-fr_BE-4f16e21047908d19937bc10ced63acd1.json +1 -0
- package/languages/newspack-blocks-fr_BE-4fdea541976076f02d56139fb35e5b42.json +1 -0
- package/languages/newspack-blocks-fr_BE-501b38ac90d35730a620fb0d483702fa.json +1 -0
- package/languages/newspack-blocks-fr_BE-53e2a1d5945b8d2b1c35e81ae1e532f3.json +1 -0
- package/languages/newspack-blocks-fr_BE-5d4055f484eeb00e3ea0f9d8aace0897.json +1 -0
- package/languages/newspack-blocks-fr_BE-5f70538e0223bc8a05b922cba67da6fb.json +1 -0
- package/languages/newspack-blocks-fr_BE-6c2e53bab28419c30e1eaee70ba599cf.json +1 -0
- package/languages/newspack-blocks-fr_BE-6ed95fb4873e6e2b81351177a44995f6.json +1 -0
- package/languages/newspack-blocks-fr_BE-727631509ad8eec8e2cbe740c6dad199.json +1 -0
- package/languages/newspack-blocks-fr_BE-73c6d3bde805172d1993f75397e9832d.json +1 -0
- package/languages/newspack-blocks-fr_BE-78456b164809d080adecb4d2b3895802.json +1 -0
- package/languages/newspack-blocks-fr_BE-7b1aa64ce2d962decc04666ab86c53de.json +1 -0
- package/languages/newspack-blocks-fr_BE-7c29764d5ef91723f5ce454f66431b9e.json +1 -0
- package/languages/newspack-blocks-fr_BE-912a2876091ef0dca9b26f3cfc01fc9c.json +1 -0
- package/languages/newspack-blocks-fr_BE-91a7ac8017d6e2159be1c5a3c1e372e4.json +1 -0
- package/languages/newspack-blocks-fr_BE-969286d51bb0afe10983b9aec317b5ee.json +1 -0
- package/languages/newspack-blocks-fr_BE-9ef9b2c60c897ad79f92951e6e9949a1.json +1 -0
- package/languages/newspack-blocks-fr_BE-a822c3d210c89af3cb7da28eaaef929c.json +1 -0
- package/languages/newspack-blocks-fr_BE-aa9f9057c77a46b31d7e325a4322f2da.json +1 -0
- package/languages/newspack-blocks-fr_BE-b6d3cfc30bb16d88d7bc5384bc775543.json +1 -0
- package/languages/newspack-blocks-fr_BE-b712270cd4eb3cae7899b50b57bdd576.json +1 -0
- package/languages/newspack-blocks-fr_BE-babcc0ca24e7f0145b1c8f647049f085.json +1 -0
- package/languages/newspack-blocks-fr_BE-bb66d96d450663284550bed5a3e9113e.json +1 -0
- package/languages/newspack-blocks-fr_BE-c810378e74f20906b8193ea76adb6bc0.json +1 -0
- package/languages/newspack-blocks-fr_BE-d3a1c55a07efd1a65e227bf120840752.json +1 -0
- package/languages/newspack-blocks-fr_BE-d5f23a52ecbfd492ebf819c14206a9e2.json +1 -0
- package/languages/newspack-blocks-fr_BE-d684e5c5ac51934ba20811c2f588e1d5.json +1 -0
- package/languages/newspack-blocks-fr_BE-dd56360b115d1b39c48033c1e0749a11.json +1 -0
- package/languages/newspack-blocks-fr_BE-e0e4434aee4db01e71268ce3edf1dd97.json +1 -0
- package/languages/newspack-blocks-fr_BE-e58126c278611ed6c17684ba8e7459b4.json +1 -0
- package/languages/newspack-blocks-fr_BE-ea3e2a660753c7bfa13b5bbd8a46bdd0.json +1 -0
- package/languages/newspack-blocks-fr_BE-eccbc51a43c04f59165364eda71e0be7.json +1 -0
- package/languages/newspack-blocks-fr_BE-eeb28f99adedd5fad3081d2756d6f4a4.json +1 -0
- package/languages/newspack-blocks-fr_BE-f03802d9ac1ae8f3b85caee4347b93a7.json +1 -0
- package/languages/newspack-blocks-fr_BE-f32a4d8bd8f1f1e03b6523dfaa4c9f73.json +1 -0
- package/languages/newspack-blocks-fr_BE-f5f8db76788e4079ddfa743333708b88.json +1 -0
- package/languages/newspack-blocks-fr_BE-f8b1589c450689398f90b179f47e74ee.json +1 -0
- package/languages/newspack-blocks-fr_BE-f9d0b05d4d6ddd3273f1f3fb2eb2ca50.json +1 -0
- package/languages/newspack-blocks-fr_BE-fbe7f8c598cf05d4603ba49fec909ded.json +1 -0
- package/languages/newspack-blocks-fr_BE-fcc93143c1f2b74671f595454b971f44.json +1 -0
- package/languages/newspack-blocks-fr_BE.mo +0 -0
- package/languages/newspack-blocks-fr_BE.po +2079 -0
- package/languages/newspack-blocks-nb_NO-01a5b44b8bc8d20f62541de420aa61ab.json +1 -0
- package/languages/newspack-blocks-nb_NO-0662222bf15e7a1a7b74db2dabb48d6c.json +1 -0
- package/languages/newspack-blocks-nb_NO-0c8dad524e2a57cee4f8efb6e35387c1.json +1 -0
- package/languages/newspack-blocks-nb_NO-10754bc02d28d4301c103f26dbf519ce.json +1 -0
- package/languages/newspack-blocks-nb_NO-2d52b39fdbc5d6c94b3514803f3720b8.json +1 -0
- package/languages/newspack-blocks-nb_NO-34e5c64f90b1444f3fc735376442eada.json +1 -0
- package/languages/newspack-blocks-nb_NO-351fd022e077061b5796bf7042446bfc.json +1 -0
- package/languages/newspack-blocks-nb_NO-37552bb09e2a9fceec1970e3c6d46557.json +1 -0
- package/languages/newspack-blocks-nb_NO-4b2ccb4e4dc8b3491228b2feb54872f2.json +1 -0
- package/languages/newspack-blocks-nb_NO-4cecf783e091d36284a3e0cdafcd0fd5.json +1 -0
- package/languages/newspack-blocks-nb_NO-4f16e21047908d19937bc10ced63acd1.json +1 -0
- package/languages/newspack-blocks-nb_NO-4fdea541976076f02d56139fb35e5b42.json +1 -0
- package/languages/newspack-blocks-nb_NO-501b38ac90d35730a620fb0d483702fa.json +1 -0
- package/languages/newspack-blocks-nb_NO-53e2a1d5945b8d2b1c35e81ae1e532f3.json +1 -0
- package/languages/newspack-blocks-nb_NO-5d4055f484eeb00e3ea0f9d8aace0897.json +1 -0
- package/languages/newspack-blocks-nb_NO-5f70538e0223bc8a05b922cba67da6fb.json +1 -0
- package/languages/newspack-blocks-nb_NO-6c2e53bab28419c30e1eaee70ba599cf.json +1 -0
- package/languages/newspack-blocks-nb_NO-6ed95fb4873e6e2b81351177a44995f6.json +1 -0
- package/languages/newspack-blocks-nb_NO-73c6d3bde805172d1993f75397e9832d.json +1 -0
- package/languages/newspack-blocks-nb_NO-78456b164809d080adecb4d2b3895802.json +1 -0
- package/languages/newspack-blocks-nb_NO-7b1aa64ce2d962decc04666ab86c53de.json +1 -0
- package/languages/newspack-blocks-nb_NO-7c29764d5ef91723f5ce454f66431b9e.json +1 -0
- package/languages/newspack-blocks-nb_NO-912a2876091ef0dca9b26f3cfc01fc9c.json +1 -0
- package/languages/newspack-blocks-nb_NO-91a7ac8017d6e2159be1c5a3c1e372e4.json +1 -0
- package/languages/newspack-blocks-nb_NO-969286d51bb0afe10983b9aec317b5ee.json +1 -0
- package/languages/newspack-blocks-nb_NO-9ef9b2c60c897ad79f92951e6e9949a1.json +1 -0
- package/languages/newspack-blocks-nb_NO-a822c3d210c89af3cb7da28eaaef929c.json +1 -0
- package/languages/newspack-blocks-nb_NO-aa9f9057c77a46b31d7e325a4322f2da.json +1 -0
- package/languages/newspack-blocks-nb_NO-b6d3cfc30bb16d88d7bc5384bc775543.json +1 -0
- package/languages/newspack-blocks-nb_NO-b712270cd4eb3cae7899b50b57bdd576.json +1 -0
- package/languages/newspack-blocks-nb_NO-babcc0ca24e7f0145b1c8f647049f085.json +1 -0
- package/languages/newspack-blocks-nb_NO-bb66d96d450663284550bed5a3e9113e.json +1 -0
- package/languages/newspack-blocks-nb_NO-c810378e74f20906b8193ea76adb6bc0.json +1 -0
- package/languages/newspack-blocks-nb_NO-d3a1c55a07efd1a65e227bf120840752.json +1 -0
- package/languages/newspack-blocks-nb_NO-d5f23a52ecbfd492ebf819c14206a9e2.json +1 -0
- package/languages/newspack-blocks-nb_NO-d684e5c5ac51934ba20811c2f588e1d5.json +1 -0
- package/languages/newspack-blocks-nb_NO-dd56360b115d1b39c48033c1e0749a11.json +1 -0
- package/languages/newspack-blocks-nb_NO-e0e4434aee4db01e71268ce3edf1dd97.json +1 -0
- package/languages/newspack-blocks-nb_NO-e58126c278611ed6c17684ba8e7459b4.json +1 -0
- package/languages/newspack-blocks-nb_NO-ea3e2a660753c7bfa13b5bbd8a46bdd0.json +1 -0
- package/languages/newspack-blocks-nb_NO-eccbc51a43c04f59165364eda71e0be7.json +1 -0
- package/languages/newspack-blocks-nb_NO-eeb28f99adedd5fad3081d2756d6f4a4.json +1 -0
- package/languages/newspack-blocks-nb_NO-f03802d9ac1ae8f3b85caee4347b93a7.json +1 -0
- package/languages/newspack-blocks-nb_NO-f32a4d8bd8f1f1e03b6523dfaa4c9f73.json +1 -0
- package/languages/newspack-blocks-nb_NO-f5f8db76788e4079ddfa743333708b88.json +1 -0
- package/languages/newspack-blocks-nb_NO-f8b1589c450689398f90b179f47e74ee.json +1 -0
- package/languages/newspack-blocks-nb_NO-f9d0b05d4d6ddd3273f1f3fb2eb2ca50.json +1 -0
- package/languages/newspack-blocks-nb_NO-fbe7f8c598cf05d4603ba49fec909ded.json +1 -0
- package/languages/newspack-blocks-nb_NO-fcc93143c1f2b74671f595454b971f44.json +1 -0
- package/languages/newspack-blocks-nb_NO.mo +0 -0
- package/languages/newspack-blocks-nb_NO.po +2078 -0
- package/languages/newspack-blocks-pt_PT-01a5b44b8bc8d20f62541de420aa61ab.json +1 -0
- package/languages/newspack-blocks-pt_PT-0662222bf15e7a1a7b74db2dabb48d6c.json +1 -0
- package/languages/newspack-blocks-pt_PT-0c8dad524e2a57cee4f8efb6e35387c1.json +1 -0
- package/languages/newspack-blocks-pt_PT-10754bc02d28d4301c103f26dbf519ce.json +1 -0
- package/languages/newspack-blocks-pt_PT-2d52b39fdbc5d6c94b3514803f3720b8.json +1 -0
- package/languages/newspack-blocks-pt_PT-34e5c64f90b1444f3fc735376442eada.json +1 -0
- package/languages/newspack-blocks-pt_PT-351fd022e077061b5796bf7042446bfc.json +1 -0
- package/languages/newspack-blocks-pt_PT-37552bb09e2a9fceec1970e3c6d46557.json +1 -0
- package/languages/newspack-blocks-pt_PT-4b2ccb4e4dc8b3491228b2feb54872f2.json +1 -0
- package/languages/newspack-blocks-pt_PT-4cecf783e091d36284a3e0cdafcd0fd5.json +1 -0
- package/languages/newspack-blocks-pt_PT-4f16e21047908d19937bc10ced63acd1.json +1 -0
- package/languages/newspack-blocks-pt_PT-4fdea541976076f02d56139fb35e5b42.json +1 -0
- package/languages/newspack-blocks-pt_PT-501b38ac90d35730a620fb0d483702fa.json +1 -0
- package/languages/newspack-blocks-pt_PT-53e2a1d5945b8d2b1c35e81ae1e532f3.json +1 -0
- package/languages/newspack-blocks-pt_PT-5d4055f484eeb00e3ea0f9d8aace0897.json +1 -0
- package/languages/newspack-blocks-pt_PT-5f70538e0223bc8a05b922cba67da6fb.json +1 -0
- package/languages/newspack-blocks-pt_PT-6c2e53bab28419c30e1eaee70ba599cf.json +1 -0
- package/languages/newspack-blocks-pt_PT-6ed95fb4873e6e2b81351177a44995f6.json +1 -0
- package/languages/newspack-blocks-pt_PT-727631509ad8eec8e2cbe740c6dad199.json +1 -0
- package/languages/newspack-blocks-pt_PT-73c6d3bde805172d1993f75397e9832d.json +1 -0
- package/languages/newspack-blocks-pt_PT-78456b164809d080adecb4d2b3895802.json +1 -0
- package/languages/newspack-blocks-pt_PT-7b1aa64ce2d962decc04666ab86c53de.json +1 -0
- package/languages/newspack-blocks-pt_PT-7c29764d5ef91723f5ce454f66431b9e.json +1 -0
- package/languages/newspack-blocks-pt_PT-912a2876091ef0dca9b26f3cfc01fc9c.json +1 -0
- package/languages/newspack-blocks-pt_PT-91a7ac8017d6e2159be1c5a3c1e372e4.json +1 -0
- package/languages/newspack-blocks-pt_PT-969286d51bb0afe10983b9aec317b5ee.json +1 -0
- package/languages/newspack-blocks-pt_PT-9ef9b2c60c897ad79f92951e6e9949a1.json +1 -0
- package/languages/newspack-blocks-pt_PT-a822c3d210c89af3cb7da28eaaef929c.json +1 -0
- package/languages/newspack-blocks-pt_PT-aa9f9057c77a46b31d7e325a4322f2da.json +1 -0
- package/languages/newspack-blocks-pt_PT-b6d3cfc30bb16d88d7bc5384bc775543.json +1 -0
- package/languages/newspack-blocks-pt_PT-b712270cd4eb3cae7899b50b57bdd576.json +1 -0
- package/languages/newspack-blocks-pt_PT-babcc0ca24e7f0145b1c8f647049f085.json +1 -0
- package/languages/newspack-blocks-pt_PT-bb66d96d450663284550bed5a3e9113e.json +1 -0
- package/languages/newspack-blocks-pt_PT-c810378e74f20906b8193ea76adb6bc0.json +1 -0
- package/languages/newspack-blocks-pt_PT-d3a1c55a07efd1a65e227bf120840752.json +1 -0
- package/languages/newspack-blocks-pt_PT-d5f23a52ecbfd492ebf819c14206a9e2.json +1 -0
- package/languages/newspack-blocks-pt_PT-d684e5c5ac51934ba20811c2f588e1d5.json +1 -0
- package/languages/newspack-blocks-pt_PT-dd56360b115d1b39c48033c1e0749a11.json +1 -0
- package/languages/newspack-blocks-pt_PT-e0e4434aee4db01e71268ce3edf1dd97.json +1 -0
- package/languages/newspack-blocks-pt_PT-e58126c278611ed6c17684ba8e7459b4.json +1 -0
- package/languages/newspack-blocks-pt_PT-ea3e2a660753c7bfa13b5bbd8a46bdd0.json +1 -0
- package/languages/newspack-blocks-pt_PT-eccbc51a43c04f59165364eda71e0be7.json +1 -0
- package/languages/newspack-blocks-pt_PT-eeb28f99adedd5fad3081d2756d6f4a4.json +1 -0
- package/languages/newspack-blocks-pt_PT-f03802d9ac1ae8f3b85caee4347b93a7.json +1 -0
- package/languages/newspack-blocks-pt_PT-f32a4d8bd8f1f1e03b6523dfaa4c9f73.json +1 -0
- package/languages/newspack-blocks-pt_PT-f5f8db76788e4079ddfa743333708b88.json +1 -0
- package/languages/newspack-blocks-pt_PT-f8b1589c450689398f90b179f47e74ee.json +1 -0
- package/languages/newspack-blocks-pt_PT-f9d0b05d4d6ddd3273f1f3fb2eb2ca50.json +1 -0
- package/languages/newspack-blocks-pt_PT-fbe7f8c598cf05d4603ba49fec909ded.json +1 -0
- package/languages/newspack-blocks-pt_PT-fcc93143c1f2b74671f595454b971f44.json +1 -0
- package/languages/newspack-blocks-pt_PT.mo +0 -0
- package/languages/newspack-blocks-pt_PT.po +2078 -0
- package/languages/newspack-blocks.pot +2370 -0
- package/newspack-blocks.php +96 -0
- package/package.json +64 -0
- package/phpcs.xml +38 -0
- package/release.config.js +1 -0
- package/src/assets/placeholder-1024x536.jpg +0 -0
- package/src/assets/placeholder-600x800.jpg +0 -0
- package/src/assets/placeholder-800x600.jpg +0 -0
- package/src/assets/placeholder-800x800.jpg +0 -0
- package/src/assets/placeholder-donations-cover.jpg +0 -0
- package/src/assets/placeholder-donations-image.jpg +0 -0
- package/src/assets/placeholder-subscribe-cover.jpg +0 -0
- package/src/assets/placeholder-subscribe-image.jpg +0 -0
- package/src/block-patterns/donations-1.php +13 -0
- package/src/block-patterns/donations-2.php +13 -0
- package/src/block-patterns/donations-3.php +13 -0
- package/src/block-patterns/donations-4.php +13 -0
- package/src/block-patterns/donations-5.php +13 -0
- package/src/block-patterns/homepage-posts-1.php +13 -0
- package/src/block-patterns/homepage-posts-10.php +13 -0
- package/src/block-patterns/homepage-posts-11.php +13 -0
- package/src/block-patterns/homepage-posts-12.php +13 -0
- package/src/block-patterns/homepage-posts-13.php +13 -0
- package/src/block-patterns/homepage-posts-14.php +13 -0
- package/src/block-patterns/homepage-posts-15.php +13 -0
- package/src/block-patterns/homepage-posts-16.php +13 -0
- package/src/block-patterns/homepage-posts-17.php +13 -0
- package/src/block-patterns/homepage-posts-18.php +13 -0
- package/src/block-patterns/homepage-posts-19.php +13 -0
- package/src/block-patterns/homepage-posts-2.php +13 -0
- package/src/block-patterns/homepage-posts-20.php +13 -0
- package/src/block-patterns/homepage-posts-21.php +13 -0
- package/src/block-patterns/homepage-posts-22.php +13 -0
- package/src/block-patterns/homepage-posts-23.php +13 -0
- package/src/block-patterns/homepage-posts-24.php +13 -0
- package/src/block-patterns/homepage-posts-25.php +13 -0
- package/src/block-patterns/homepage-posts-26.php +13 -0
- package/src/block-patterns/homepage-posts-27.php +13 -0
- package/src/block-patterns/homepage-posts-28.php +13 -0
- package/src/block-patterns/homepage-posts-29.php +13 -0
- package/src/block-patterns/homepage-posts-3.php +13 -0
- package/src/block-patterns/homepage-posts-30.php +13 -0
- package/src/block-patterns/homepage-posts-31.php +13 -0
- package/src/block-patterns/homepage-posts-4.php +13 -0
- package/src/block-patterns/homepage-posts-5.php +13 -0
- package/src/block-patterns/homepage-posts-6.php +13 -0
- package/src/block-patterns/homepage-posts-7.php +13 -0
- package/src/block-patterns/homepage-posts-8.php +13 -0
- package/src/block-patterns/homepage-posts-9.php +13 -0
- package/src/block-patterns/subscribe-1.php +13 -0
- package/src/block-patterns/subscribe-2.php +13 -0
- package/src/block-patterns/subscribe-3.php +13 -0
- package/src/block-patterns/subscribe-4.php +13 -0
- package/src/block-patterns/subscribe-5.php +13 -0
- package/src/block-patterns/subscribe-6.php +13 -0
- package/src/block-patterns/subscribe-7.php +13 -0
- package/src/block-styles/core/columns/editor.scss +90 -0
- package/src/block-styles/core/columns/index.js +20 -0
- package/src/block-styles/core/columns/view.scss +131 -0
- package/src/block-styles/core/group/editor.scss +24 -0
- package/src/block-styles/core/group/index.js +25 -0
- package/src/block-styles/core/group/view.scss +13 -0
- package/src/block-styles/view.js +5 -0
- package/src/blocks/author-list/block.json +84 -0
- package/src/blocks/author-list/class-wp-rest-newspack-author-list-controller.php +381 -0
- package/src/blocks/author-list/edit.js +456 -0
- package/src/blocks/author-list/editor.js +7 -0
- package/src/blocks/author-list/editor.scss +1 -0
- package/src/blocks/author-list/index.js +60 -0
- package/src/blocks/author-list/view.js +5 -0
- package/src/blocks/author-list/view.php +180 -0
- package/src/blocks/author-list/view.scss +46 -0
- package/src/blocks/author-profile/README.md +105 -0
- package/src/blocks/author-profile/block.json +77 -0
- package/src/blocks/author-profile/class-wp-rest-newspack-authors-controller.php +618 -0
- package/src/blocks/author-profile/context.js +26 -0
- package/src/blocks/author-profile/edit.js +1031 -0
- package/src/blocks/author-profile/editor.js +7 -0
- package/src/blocks/author-profile/editor.scss +61 -0
- package/src/blocks/author-profile/index.js +66 -0
- package/src/blocks/author-profile/single-author.js +106 -0
- package/src/blocks/author-profile/templates.js +263 -0
- package/src/blocks/author-profile/variations.js +86 -0
- package/src/blocks/author-profile/view.js +5 -0
- package/src/blocks/author-profile/view.php +501 -0
- package/src/blocks/author-profile/view.scss +159 -0
- package/src/blocks/carousel/block.json +121 -0
- package/src/blocks/carousel/create-swiper.js +230 -0
- package/src/blocks/carousel/edit.js +469 -0
- package/src/blocks/carousel/editor.js +7 -0
- package/src/blocks/carousel/editor.scss +54 -0
- package/src/blocks/carousel/index.js +55 -0
- package/src/blocks/carousel/view.js +49 -0
- package/src/blocks/carousel/view.php +417 -0
- package/src/blocks/carousel/view.scss +397 -0
- package/src/blocks/checkout-button/block.json +117 -0
- package/src/blocks/checkout-button/deprecated.js +81 -0
- package/src/blocks/checkout-button/edit.js +385 -0
- package/src/blocks/checkout-button/edit.scss +67 -0
- package/src/blocks/checkout-button/editor.js +19 -0
- package/src/blocks/checkout-button/index.js +32 -0
- package/src/blocks/checkout-button/view.js +4 -0
- package/src/blocks/checkout-button/view.php +178 -0
- package/src/blocks/checkout-button/view.scss +39 -0
- package/src/blocks/donate/block.json +103 -0
- package/src/blocks/donate/consts.ts +25 -0
- package/src/blocks/donate/edit/FrequencyBasedLayout.tsx +255 -0
- package/src/blocks/donate/edit/TierBasedLayout.tsx +133 -0
- package/src/blocks/donate/edit/components/AmountValueInput.tsx +62 -0
- package/src/blocks/donate/edit/components/index.tsx +1 -0
- package/src/blocks/donate/edit/index.tsx +445 -0
- package/src/blocks/donate/editor.js +7 -0
- package/src/blocks/donate/frequency-based/index.ts +135 -0
- package/src/blocks/donate/frequency-based/style.scss +245 -0
- package/src/blocks/donate/frontend/class-newspack-blocks-donate-renderer-base.php +225 -0
- package/src/blocks/donate/frontend/class-newspack-blocks-donate-renderer-frequency-based.php +341 -0
- package/src/blocks/donate/frontend/class-newspack-blocks-donate-renderer-tiers-based.php +184 -0
- package/src/blocks/donate/frontend/class-newspack-blocks-donate-renderer.php +117 -0
- package/src/blocks/donate/index.js +72 -0
- package/src/blocks/donate/styles/editor.scss +230 -0
- package/src/blocks/donate/styles/style-variations.scss +792 -0
- package/src/blocks/donate/styles/view.scss +45 -0
- package/src/blocks/donate/tiers-based/index.ts +36 -0
- package/src/blocks/donate/tiers-based/slider.ts +64 -0
- package/src/blocks/donate/tiers-based/style.scss +185 -0
- package/src/blocks/donate/tiers-based/types.ts +3 -0
- package/src/blocks/donate/tiers-based/utils.test.js +38 -0
- package/src/blocks/donate/tiers-based/utils.ts +21 -0
- package/src/blocks/donate/tiers-based/view.ts +132 -0
- package/src/blocks/donate/types.ts +96 -0
- package/src/blocks/donate/utils.ts +108 -0
- package/src/blocks/donate/view.php +29 -0
- package/src/blocks/donate/view.ts +44 -0
- package/src/blocks/homepage-articles/block.json +260 -0
- package/src/blocks/homepage-articles/class-wp-rest-newspack-articles-controller.php +231 -0
- package/src/blocks/homepage-articles/edit.tsx +730 -0
- package/src/blocks/homepage-articles/editor.js +16 -0
- package/src/blocks/homepage-articles/editor.scss +226 -0
- package/src/blocks/homepage-articles/index.js +102 -0
- package/src/blocks/homepage-articles/store.js +193 -0
- package/src/blocks/homepage-articles/templates/article.php +290 -0
- package/src/blocks/homepage-articles/templates/articles-list.php +21 -0
- package/src/blocks/homepage-articles/templates/articles-loop.php +35 -0
- package/src/blocks/homepage-articles/utils.ts +270 -0
- package/src/blocks/homepage-articles/view.js +242 -0
- package/src/blocks/homepage-articles/view.php +561 -0
- package/src/blocks/homepage-articles/view.scss +784 -0
- package/src/blocks/iframe/block.json +36 -0
- package/src/blocks/iframe/class-wp-rest-newspack-iframe-controller.php +586 -0
- package/src/blocks/iframe/edit.js +232 -0
- package/src/blocks/iframe/editor.js +7 -0
- package/src/blocks/iframe/editor.scss +84 -0
- package/src/blocks/iframe/iframe-placeholder.js +166 -0
- package/src/blocks/iframe/index.js +54 -0
- package/src/blocks/iframe/view.js +49 -0
- package/src/blocks/iframe/view.php +116 -0
- package/src/blocks/iframe/view.scss +9 -0
- package/src/blocks/shared/author.js +47 -0
- package/src/blocks/video-playlist/edit.js +222 -0
- package/src/blocks/video-playlist/editor.js +7 -0
- package/src/blocks/video-playlist/editor.scss +23 -0
- package/src/blocks/video-playlist/index.js +54 -0
- package/src/blocks/video-playlist/view.php +188 -0
- package/src/components/autocomplete-tokenfield.js +189 -0
- package/src/components/autocomplete-tokenfield.scss +27 -0
- package/src/components/editor-panels.js +90 -0
- package/src/components/query-controls.js +450 -0
- package/src/components/redirect-after-success.tsx +50 -0
- package/src/modal-checkout/accessibility.js +73 -0
- package/src/modal-checkout/analytics/ga4/README.md +45 -0
- package/src/modal-checkout/analytics/ga4/checkout-attempt.js +18 -0
- package/src/modal-checkout/analytics/ga4/checkout-success.js +17 -0
- package/src/modal-checkout/analytics/ga4/dismissed.js +17 -0
- package/src/modal-checkout/analytics/ga4/loaded.js +17 -0
- package/src/modal-checkout/analytics/ga4/opened.js +37 -0
- package/src/modal-checkout/analytics/ga4/pagination.js +59 -0
- package/src/modal-checkout/analytics/ga4/utils/index.js +64 -0
- package/src/modal-checkout/analytics/index.js +6 -0
- package/src/modal-checkout/checkout.scss +1064 -0
- package/src/modal-checkout/index.js +929 -0
- package/src/modal-checkout/modal.js +983 -0
- package/src/modal-checkout/modal.scss +265 -0
- package/src/modal-checkout/templates/empty-html-add-recipient.php +15 -0
- package/src/modal-checkout/templates/empty-order-details.php +16 -0
- package/src/modal-checkout/templates/form-change-payment-method.php +99 -0
- package/src/modal-checkout/templates/form-checkout.php +74 -0
- package/src/modal-checkout/templates/form-coupon.php +22 -0
- package/src/modal-checkout/templates/form-gift-subscription.php +34 -0
- package/src/modal-checkout/templates/payment-method.php +29 -0
- package/src/modal-checkout/templates/thankyou.php +94 -0
- package/src/modal-checkout/utils.js +309 -0
- package/src/setup/block-styles.js +2 -0
- package/src/setup/category.js +18 -0
- package/src/setup/editor.js +7 -0
- package/src/setup/editor.scss +56 -0
- package/src/setup/newspack-logo.js +26 -0
- package/src/setup/placeholder-blocks.js +84 -0
- package/src/setup/unregister-blocks.js +14 -0
- package/src/shared/authors.php +63 -0
- package/src/shared/js/newspack-icon.js +31 -0
- package/src/shared/js/utils.js +50 -0
- package/src/shared/sass/_mixins.scss +42 -0
- package/src/shared/sass/_placeholder.scss +5 -0
- package/src/shared/sass/_preview.scss +12 -0
- package/src/shared/sass/_variables.scss +24 -0
- package/src/templates/author-profile-card.php +145 -0
- package/src/types/@wordpress/block-editor.d.ts +1 -0
- package/src/types/@wordpress/components.d.ts +1 -0
- package/src/types/index.d.ts +170 -0
- package/src/types/newspack-components.d.ts +7 -0
- package/tsconfig.json +7 -0
- package/vendor/autoload.php +22 -0
- package/vendor/composer/ClassLoader.php +579 -0
- package/vendor/composer/InstalledVersions.php +396 -0
- package/vendor/composer/LICENSE +21 -0
- package/vendor/composer/autoload_classmap.php +10 -0
- package/vendor/composer/autoload_namespaces.php +9 -0
- package/vendor/composer/autoload_psr4.php +9 -0
- package/vendor/composer/autoload_real.php +36 -0
- package/vendor/composer/autoload_static.php +20 -0
- package/vendor/composer/installed.json +5 -0
- package/vendor/composer/installed.php +23 -0
- package/webpack.config.js +82 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.wp-block-newspack-blocks-checkout-button {
|
|
2
|
+
&.alignwide,
|
|
3
|
+
&.alignfull {
|
|
4
|
+
button {
|
|
5
|
+
width: 100%;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
&.aligncenter {
|
|
9
|
+
form {
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
}
|
|
12
|
+
button {
|
|
13
|
+
margin-left: auto;
|
|
14
|
+
margin-right: auto;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&.wp-block-button__width-25 button {
|
|
19
|
+
width: 25%;
|
|
20
|
+
}
|
|
21
|
+
&.wp-block-button__width-50 button {
|
|
22
|
+
width: 50%;
|
|
23
|
+
}
|
|
24
|
+
&.wp-block-button__width-75 button {
|
|
25
|
+
width: 75%;
|
|
26
|
+
}
|
|
27
|
+
&.wp-block-button__width-100 button {
|
|
28
|
+
width: 100%;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
form {
|
|
32
|
+
display: flex;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.wp-block-button__link {
|
|
36
|
+
display: inline-block;
|
|
37
|
+
width: auto;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
|
+
"apiVersion": 3,
|
|
4
|
+
"name": "donate",
|
|
5
|
+
"category": "newspack",
|
|
6
|
+
"attributes": {
|
|
7
|
+
"className": {
|
|
8
|
+
"type": "string"
|
|
9
|
+
},
|
|
10
|
+
"manual": {
|
|
11
|
+
"type": "boolean"
|
|
12
|
+
},
|
|
13
|
+
"tiered": {
|
|
14
|
+
"type": "boolean",
|
|
15
|
+
"default": true
|
|
16
|
+
},
|
|
17
|
+
"amounts": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"default": {}
|
|
20
|
+
},
|
|
21
|
+
"disabledFrequencies": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"default": {}
|
|
24
|
+
},
|
|
25
|
+
"thanksText": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"default": "Your contribution is appreciated."
|
|
28
|
+
},
|
|
29
|
+
"buttonText": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"default": "Donate Now"
|
|
32
|
+
},
|
|
33
|
+
"defaultFrequency": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"default": "month"
|
|
36
|
+
},
|
|
37
|
+
"campaign": {
|
|
38
|
+
"type": "string"
|
|
39
|
+
},
|
|
40
|
+
"buttonColor": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"default": "#dd3333"
|
|
43
|
+
},
|
|
44
|
+
"suggestedAmounts": {
|
|
45
|
+
"type": "array"
|
|
46
|
+
},
|
|
47
|
+
"suggestedAmountUntiered": {
|
|
48
|
+
"type": "number"
|
|
49
|
+
},
|
|
50
|
+
"minimumDonation": {
|
|
51
|
+
"type": "number"
|
|
52
|
+
},
|
|
53
|
+
"layoutOption": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"default": "frequency"
|
|
56
|
+
},
|
|
57
|
+
"tierStyle": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"default": "grid"
|
|
60
|
+
},
|
|
61
|
+
"useModalCheckout": {
|
|
62
|
+
"type": "boolean",
|
|
63
|
+
"default": true
|
|
64
|
+
},
|
|
65
|
+
"tiersBasedOptions": {
|
|
66
|
+
"type": "array",
|
|
67
|
+
"default": [
|
|
68
|
+
{
|
|
69
|
+
"heading": "Small",
|
|
70
|
+
"description": "",
|
|
71
|
+
"buttonText": "Select",
|
|
72
|
+
"recommendLabel": ""
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"heading": "Medium",
|
|
76
|
+
"description": "",
|
|
77
|
+
"buttonText": "Select",
|
|
78
|
+
"recommendLabel": "BEST VALUE"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"heading": "Large",
|
|
82
|
+
"description": "",
|
|
83
|
+
"buttonText": "Select",
|
|
84
|
+
"recommendLabel": ""
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
"afterSuccessBehavior": {
|
|
89
|
+
"type": "string"
|
|
90
|
+
},
|
|
91
|
+
"afterSuccessButtonLabel": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"default": "Continue"
|
|
94
|
+
},
|
|
95
|
+
"afterSuccessURL": {
|
|
96
|
+
"type": "string"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"supports": {
|
|
100
|
+
"html": false,
|
|
101
|
+
"align": false
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import type { DonationFrequencySlug, DonateBlockAttributes } from './types';
|
|
10
|
+
|
|
11
|
+
export const FREQUENCIES: Record< DonationFrequencySlug, string > = {
|
|
12
|
+
once: __( 'One-time', 'newspack-blocks' ),
|
|
13
|
+
month: __( 'Monthly', 'newspack-blocks' ),
|
|
14
|
+
year: __( 'Annually', 'newspack-blocks' ),
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const FREQUENCY_SLUGS: DonationFrequencySlug[] = Object.keys( FREQUENCIES ) as DonationFrequencySlug[];
|
|
18
|
+
|
|
19
|
+
export const LAYOUT_OPTIONS: { label: string; key: DonateBlockAttributes[ 'layoutOption' ] }[] = [
|
|
20
|
+
{ label: __( 'Frequency', 'newspack-blocks' ), key: 'frequency' },
|
|
21
|
+
{ label: __( 'Tiers', 'newspack-blocks' ), key: 'tiers' },
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
// The item at fourth position is the "other" value, it is not a tier.
|
|
25
|
+
export const DISABLED_IN_TIERS_BASED_LAYOUT_TIER_INDEX = 3;
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { __ } from '@wordpress/i18n';
|
|
10
|
+
import { useMemo, useEffect, useRef, useState } from '@wordpress/element';
|
|
11
|
+
import { RichText } from '@wordpress/block-editor';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
import { AmountValueInput } from './components';
|
|
17
|
+
import { getColorForContrast, getFrequencyLabel, getFormattedAmount, getFrequencyLabelWithAmount } from '../utils';
|
|
18
|
+
import { FREQUENCIES } from '../consts';
|
|
19
|
+
import type { ComponentProps, DonationFrequencySlug } from '../types';
|
|
20
|
+
import { updateBlockClassName, getFormData } from '../view';
|
|
21
|
+
|
|
22
|
+
const FrequencyBasedLayout = ( props: { canUseNameYourPrice: boolean; isTiered: boolean } & ComponentProps ) => {
|
|
23
|
+
// Unique identifier to prevent collisions with other Donate blocks' labels.
|
|
24
|
+
const uid = useMemo( () => Math.random().toString( 16 ).slice( 2 ), [] );
|
|
25
|
+
|
|
26
|
+
const { attributes, settings, amounts, availableFrequencies, setAttributes, canUseNameYourPrice } = props;
|
|
27
|
+
|
|
28
|
+
const formRef = useRef< HTMLFormElement >( null );
|
|
29
|
+
|
|
30
|
+
// Add event listeners to the form.
|
|
31
|
+
useEffect( () => {
|
|
32
|
+
if ( formRef.current !== null ) {
|
|
33
|
+
const parentElement = formRef.current.closest( '.wpbnbd' );
|
|
34
|
+
if ( parentElement ) {
|
|
35
|
+
updateBlockClassName( parentElement, getFormData( formRef.current ) );
|
|
36
|
+
}
|
|
37
|
+
formRef.current.addEventListener( 'change', () => {
|
|
38
|
+
if ( formRef.current !== null && parentElement ) {
|
|
39
|
+
updateBlockClassName( parentElement, getFormData( formRef.current ) );
|
|
40
|
+
}
|
|
41
|
+
} );
|
|
42
|
+
}
|
|
43
|
+
}, [] );
|
|
44
|
+
|
|
45
|
+
// Update selected frequency when available frequencies change.
|
|
46
|
+
useEffect( () => {
|
|
47
|
+
if ( formRef.current ) {
|
|
48
|
+
const formValues = getFormData( formRef.current );
|
|
49
|
+
if ( ! formValues.donation_frequency && formRef.current.elements ) {
|
|
50
|
+
const frequencyRadioInput = formRef.current.elements[ 0 ];
|
|
51
|
+
if ( frequencyRadioInput instanceof HTMLInputElement ) {
|
|
52
|
+
frequencyRadioInput.click();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if ( availableFrequencies.indexOf( attributes.defaultFrequency ) === -1 ) {
|
|
57
|
+
setAttributes( { defaultFrequency: availableFrequencies[ 0 ] } );
|
|
58
|
+
}
|
|
59
|
+
}, [ attributes.disabledFrequencies ] );
|
|
60
|
+
|
|
61
|
+
// Update selected frequency when the default frequency attribute is updated.
|
|
62
|
+
useEffect( () => {
|
|
63
|
+
setSelectedFrequency( attributes.defaultFrequency );
|
|
64
|
+
}, [ attributes.defaultFrequency ] );
|
|
65
|
+
|
|
66
|
+
const [ selectedFrequency, setSelectedFrequency ] = useState( attributes.defaultFrequency );
|
|
67
|
+
const renderFrequencySelect = ( frequencySlug: DonationFrequencySlug ) => (
|
|
68
|
+
<>
|
|
69
|
+
<input
|
|
70
|
+
type="radio"
|
|
71
|
+
value={ frequencySlug }
|
|
72
|
+
id={ `newspack-donate-${ frequencySlug }-${ uid }` }
|
|
73
|
+
name="donation_frequency"
|
|
74
|
+
checked={ frequencySlug === selectedFrequency }
|
|
75
|
+
onChange={ evt => setSelectedFrequency( evt.target.value as 'once' | 'month' | 'year' ) }
|
|
76
|
+
/>
|
|
77
|
+
<label htmlFor={ 'newspack-donate-' + frequencySlug + '-' + uid }>{ FREQUENCIES[ frequencySlug ] }</label>
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const renderTab = ( frequencySlug: DonationFrequencySlug ) => (
|
|
82
|
+
<button
|
|
83
|
+
key={ frequencySlug }
|
|
84
|
+
role="tab"
|
|
85
|
+
className={ classNames( 'wpbnbd__button freq-label', {
|
|
86
|
+
'wpbnbd__button--active': frequencySlug === selectedFrequency,
|
|
87
|
+
} ) }
|
|
88
|
+
id={ `tab-newspack-donate-${ frequencySlug }-${ uid }` }
|
|
89
|
+
onClick={ evt => {
|
|
90
|
+
evt.preventDefault();
|
|
91
|
+
setSelectedFrequency( frequencySlug );
|
|
92
|
+
} }
|
|
93
|
+
>
|
|
94
|
+
{ FREQUENCIES[ frequencySlug ] }
|
|
95
|
+
</button>
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const renderFormHeader = () => {
|
|
99
|
+
return ! rendersSingleFrequency && <div className="tab-container">{ availableFrequencies.map( renderTab ) }</div>;
|
|
100
|
+
};
|
|
101
|
+
const rendersSingleFrequency = availableFrequencies.length === 1;
|
|
102
|
+
|
|
103
|
+
const renderUntieredForm = () => (
|
|
104
|
+
<div className="wp-block-newspack-blocks-donate__options">
|
|
105
|
+
<div className="wp-block-newspack-blocks-donate__frequencies frequencies">
|
|
106
|
+
{ renderFormHeader() }
|
|
107
|
+
{ availableFrequencies.map( frequencySlug => {
|
|
108
|
+
const untieredAmount = amounts[ frequencySlug ][ 3 ];
|
|
109
|
+
return (
|
|
110
|
+
<div className="wp-block-newspack-blocks-donate__frequency frequency" key={ frequencySlug }>
|
|
111
|
+
{ renderFrequencySelect( frequencySlug ) }
|
|
112
|
+
<div className="input-container">
|
|
113
|
+
{ canUseNameYourPrice ? (
|
|
114
|
+
<>
|
|
115
|
+
<label className="donate-label" htmlFor={ 'newspack-' + frequencySlug + '-' + uid + '-untiered-input' }>
|
|
116
|
+
{ __( 'Donation amount', 'newspack-blocks' ) }
|
|
117
|
+
{ getFrequencyLabel( frequencySlug, true ) }
|
|
118
|
+
</label>
|
|
119
|
+
<div className="wp-block-newspack-blocks-donate__money-input money-input">
|
|
120
|
+
<span className="currency">{ settings.currencySymbol }</span>
|
|
121
|
+
<AmountValueInput
|
|
122
|
+
{ ...props }
|
|
123
|
+
frequencySlug={ frequencySlug }
|
|
124
|
+
tierIndex={ 3 }
|
|
125
|
+
id={ `newspack-${ frequencySlug }-${ uid }-untiered-input` }
|
|
126
|
+
/>
|
|
127
|
+
</div>
|
|
128
|
+
</>
|
|
129
|
+
) : (
|
|
130
|
+
<>
|
|
131
|
+
<input
|
|
132
|
+
type="radio"
|
|
133
|
+
value={ untieredAmount }
|
|
134
|
+
className={ 'frequency-input' }
|
|
135
|
+
id={ `newspack-${ frequencySlug }-${ uid }-untiered-input` }
|
|
136
|
+
name={ `donation_value_${ frequencySlug }` }
|
|
137
|
+
defaultChecked={ true }
|
|
138
|
+
/>
|
|
139
|
+
{ /* eslint-disable jsx-a11y/label-has-associated-control */ }
|
|
140
|
+
<label
|
|
141
|
+
className="tier-select-label tier-label"
|
|
142
|
+
htmlFor={ `newspack-${ frequencySlug }-${ uid }-untiered-input` }
|
|
143
|
+
>
|
|
144
|
+
<div
|
|
145
|
+
dangerouslySetInnerHTML={ {
|
|
146
|
+
__html: getFrequencyLabelWithAmount( untieredAmount, frequencySlug ),
|
|
147
|
+
} }
|
|
148
|
+
/>
|
|
149
|
+
</label>
|
|
150
|
+
</>
|
|
151
|
+
) }
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
);
|
|
155
|
+
} ) }
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
const renderTieredForm = () => (
|
|
161
|
+
<div className="wp-block-newspack-blocks-donate__options">
|
|
162
|
+
<div className="wp-block-newspack-blocks-donate__frequencies frequencies">
|
|
163
|
+
{ renderFormHeader() }
|
|
164
|
+
{ availableFrequencies.map( frequencySlug => (
|
|
165
|
+
<div className="wp-block-newspack-blocks-donate__frequency frequency" key={ frequencySlug }>
|
|
166
|
+
{ renderFrequencySelect( frequencySlug ) }
|
|
167
|
+
|
|
168
|
+
<div className="wp-block-newspack-blocks-donate__tiers tiers">
|
|
169
|
+
{ amounts[ frequencySlug ].map( ( suggestedAmount, index: number ) => {
|
|
170
|
+
const isOtherTier = index === 3;
|
|
171
|
+
const id = `newspack-tier-${ frequencySlug }-${ uid }-${ isOtherTier ? 'other' : index }`;
|
|
172
|
+
const tierLabel = isOtherTier ? __( 'Other', 'newspack-blocks' ) : getFormattedAmount( suggestedAmount, true );
|
|
173
|
+
return (
|
|
174
|
+
<div
|
|
175
|
+
className={ classNames(
|
|
176
|
+
'wp-block-newspack-blocks-donate__tier',
|
|
177
|
+
`wp-block-newspack-blocks-donate__tier--${ isOtherTier ? 'other' : 'frequency' }`
|
|
178
|
+
) }
|
|
179
|
+
key={ index }
|
|
180
|
+
>
|
|
181
|
+
<input
|
|
182
|
+
type="radio"
|
|
183
|
+
value={ isOtherTier ? 'other' : suggestedAmount }
|
|
184
|
+
className={ isOtherTier ? 'other-input' : 'frequency-input' }
|
|
185
|
+
id={ id }
|
|
186
|
+
name={ `donation_value_${ frequencySlug }` }
|
|
187
|
+
defaultChecked={ index === 1 }
|
|
188
|
+
/>
|
|
189
|
+
<label className="tier-select-label tier-label" htmlFor={ id }>
|
|
190
|
+
{ tierLabel }
|
|
191
|
+
</label>
|
|
192
|
+
{ isOtherTier ? (
|
|
193
|
+
<>
|
|
194
|
+
<label className="odl" htmlFor={ id + '-other-input' }>
|
|
195
|
+
{ __( 'Donation amount', 'newspack-blocks' ) }
|
|
196
|
+
{ getFrequencyLabel( frequencySlug, true ) }
|
|
197
|
+
</label>
|
|
198
|
+
<div className="wp-block-newspack-blocks-donate__money-input money-input">
|
|
199
|
+
<span className="currency">{ settings.currencySymbol }</span>
|
|
200
|
+
<input type="number" readOnly />
|
|
201
|
+
</div>
|
|
202
|
+
</>
|
|
203
|
+
) : null }
|
|
204
|
+
</div>
|
|
205
|
+
);
|
|
206
|
+
} ) }
|
|
207
|
+
{ rendersSingleFrequency ? (
|
|
208
|
+
<div className="wp-block-newspack-blocks-donate__frequency-label">{ getFrequencyLabel( frequencySlug, true ) }</div>
|
|
209
|
+
) : null }
|
|
210
|
+
</div>
|
|
211
|
+
</div>
|
|
212
|
+
) ) }
|
|
213
|
+
</div>
|
|
214
|
+
</div>
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
const renderButton = () => (
|
|
218
|
+
<div
|
|
219
|
+
className="submit-button"
|
|
220
|
+
style={ {
|
|
221
|
+
backgroundColor: attributes.buttonColor,
|
|
222
|
+
color: getColorForContrast( attributes.buttonColor ),
|
|
223
|
+
} }
|
|
224
|
+
>
|
|
225
|
+
<RichText
|
|
226
|
+
onChange={ ( value: string ) => setAttributes( { buttonText: value } ) }
|
|
227
|
+
placeholder={ __( 'Button text…', 'newspack-blocks' ) }
|
|
228
|
+
value={ attributes.buttonText }
|
|
229
|
+
tagName="span"
|
|
230
|
+
/>
|
|
231
|
+
</div>
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
const renderFooter = () => (
|
|
235
|
+
<>
|
|
236
|
+
<p className="wp-block-newspack-blocks-donate__thanks thanks">
|
|
237
|
+
<RichText
|
|
238
|
+
onChange={ ( value: string ) => setAttributes( { thanksText: value } ) }
|
|
239
|
+
placeholder={ __( 'Thank you text…', 'newspack-blocks' ) }
|
|
240
|
+
value={ attributes.thanksText }
|
|
241
|
+
tagName="span"
|
|
242
|
+
/>
|
|
243
|
+
</p>
|
|
244
|
+
{ renderButton() }
|
|
245
|
+
</>
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
return (
|
|
249
|
+
<form ref={ formRef }>
|
|
250
|
+
{ props.isTiered ? renderTieredForm() : renderUntieredForm() }
|
|
251
|
+
{ renderFooter() }
|
|
252
|
+
</form>
|
|
253
|
+
);
|
|
254
|
+
};
|
|
255
|
+
export default FrequencyBasedLayout;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { useState, useEffect } from '@wordpress/element';
|
|
6
|
+
import { RichText } from '@wordpress/block-editor';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import type { ComponentProps, DonateBlockAttributes, TierBasedOptionValue } from '../types';
|
|
13
|
+
import { getColorForContrast, getFrequencyLabelWithAmount } from '../utils';
|
|
14
|
+
import { FREQUENCIES, DISABLED_IN_TIERS_BASED_LAYOUT_TIER_INDEX } from '../consts';
|
|
15
|
+
|
|
16
|
+
const TierBasedLayout = ( props: ComponentProps ) => {
|
|
17
|
+
const { amounts, availableFrequencies, attributes } = props;
|
|
18
|
+
const [ currentFrequency, setCurrencyFrequency ] = useState( attributes.defaultFrequency || availableFrequencies[ 0 ] );
|
|
19
|
+
|
|
20
|
+
const displayedAmounts = amounts[ currentFrequency ].slice( 0, DISABLED_IN_TIERS_BASED_LAYOUT_TIER_INDEX );
|
|
21
|
+
|
|
22
|
+
useEffect( () => {
|
|
23
|
+
setCurrencyFrequency( attributes.defaultFrequency || availableFrequencies[ 0 ] );
|
|
24
|
+
}, [ availableFrequencies.length, attributes.defaultFrequency ] );
|
|
25
|
+
|
|
26
|
+
const handleTierOptionChange = ( tierIndex: number, optionKey: keyof TierBasedOptionValue ) => ( value: string ) => {
|
|
27
|
+
const tiersBasedOptions: DonateBlockAttributes[ 'tiersBasedOptions' ] = [
|
|
28
|
+
...attributes.tiersBasedOptions, // The value has to be copied in order for the block editor to pick up the change.
|
|
29
|
+
];
|
|
30
|
+
tiersBasedOptions[ tierIndex ] = {
|
|
31
|
+
...tiersBasedOptions[ tierIndex ],
|
|
32
|
+
[ optionKey ]: value,
|
|
33
|
+
};
|
|
34
|
+
props.setAttributes( { tiersBasedOptions } );
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const isAnyRecommended = attributes.tiersBasedOptions.some( tier => Boolean( tier.recommendLabel ) );
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<form className="wpbnbd__tiers" onSubmit={ e => e.preventDefault() }>
|
|
41
|
+
{ availableFrequencies.length > 1 && (
|
|
42
|
+
<div className="wpbnbd__tiers__selection">
|
|
43
|
+
{ availableFrequencies.map( frequencySlug => {
|
|
44
|
+
const isActive = currentFrequency === frequencySlug;
|
|
45
|
+
return (
|
|
46
|
+
<button
|
|
47
|
+
key={ frequencySlug }
|
|
48
|
+
className={ classNames( 'wpbnbd__button', {
|
|
49
|
+
'wpbnbd__button--active': isActive,
|
|
50
|
+
} ) }
|
|
51
|
+
onClick={ () => setCurrencyFrequency( frequencySlug ) }
|
|
52
|
+
>
|
|
53
|
+
{ FREQUENCIES[ frequencySlug ] }
|
|
54
|
+
</button>
|
|
55
|
+
);
|
|
56
|
+
} ) }
|
|
57
|
+
</div>
|
|
58
|
+
) }
|
|
59
|
+
<div className="wpbnbd__tiers__options">
|
|
60
|
+
{ displayedAmounts.map( ( amount, index ) => {
|
|
61
|
+
const recommendLabel = attributes.tiersBasedOptions[ index ].recommendLabel || '';
|
|
62
|
+
return (
|
|
63
|
+
<div
|
|
64
|
+
key={ index }
|
|
65
|
+
className={ classNames( 'wpbnbd__tiers__tier', {
|
|
66
|
+
'wpbnbd__tiers__tier--recommended': recommendLabel.length,
|
|
67
|
+
} ) }
|
|
68
|
+
>
|
|
69
|
+
<div className="wpbnbd__tiers__top">
|
|
70
|
+
<h2 className="wpbnbd__tiers__heading">
|
|
71
|
+
<RichText
|
|
72
|
+
onChange={ handleTierOptionChange( index, 'heading' ) }
|
|
73
|
+
placeholder={ __( 'Heading…', 'newspack-blocks' ) }
|
|
74
|
+
value={ attributes.tiersBasedOptions[ index ].heading }
|
|
75
|
+
tagName="span"
|
|
76
|
+
/>
|
|
77
|
+
</h2>
|
|
78
|
+
<h3 className="wpbnbd__tiers__recommend-label" style={ { opacity: recommendLabel ? 1 : 0.5 } }>
|
|
79
|
+
<RichText
|
|
80
|
+
onChange={ handleTierOptionChange( index, 'recommendLabel' ) }
|
|
81
|
+
placeholder={ __( '…', 'newspack-blocks' ) }
|
|
82
|
+
value={ recommendLabel }
|
|
83
|
+
tagName="span"
|
|
84
|
+
/>
|
|
85
|
+
</h3>
|
|
86
|
+
</div>
|
|
87
|
+
<div className="wpbnbd__tiers__amount">
|
|
88
|
+
<div
|
|
89
|
+
dangerouslySetInnerHTML={ {
|
|
90
|
+
__html: getFrequencyLabelWithAmount( amount, currentFrequency ),
|
|
91
|
+
} }
|
|
92
|
+
/>
|
|
93
|
+
</div>
|
|
94
|
+
<div
|
|
95
|
+
className="submit-button"
|
|
96
|
+
style={ {
|
|
97
|
+
appearance: 'button',
|
|
98
|
+
borderColor: attributes.buttonColor,
|
|
99
|
+
...( isAnyRecommended && ! recommendLabel
|
|
100
|
+
? {
|
|
101
|
+
backgroundColor: 'transparent',
|
|
102
|
+
color: attributes.buttonColor,
|
|
103
|
+
}
|
|
104
|
+
: {
|
|
105
|
+
backgroundColor: attributes.buttonColor,
|
|
106
|
+
color: getColorForContrast( attributes.buttonColor ),
|
|
107
|
+
} ),
|
|
108
|
+
} }
|
|
109
|
+
>
|
|
110
|
+
<RichText
|
|
111
|
+
onChange={ handleTierOptionChange( index, 'buttonText' ) }
|
|
112
|
+
placeholder={ __( 'Button text…', 'newspack-blocks' ) }
|
|
113
|
+
value={ attributes.tiersBasedOptions[ index ].buttonText }
|
|
114
|
+
tagName="span"
|
|
115
|
+
/>
|
|
116
|
+
</div>
|
|
117
|
+
<div className="wpbnbd__tiers__description">
|
|
118
|
+
<RichText
|
|
119
|
+
onChange={ handleTierOptionChange( index, 'description' ) }
|
|
120
|
+
placeholder={ __( 'Description…', 'newspack-blocks' ) }
|
|
121
|
+
value={ attributes.tiersBasedOptions[ index ].description }
|
|
122
|
+
tagName="span"
|
|
123
|
+
/>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
} ) }
|
|
128
|
+
</div>
|
|
129
|
+
</form>
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export default TierBasedLayout;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { DonateBlockAttributes, ComponentProps, DonationFrequencySlug } from '../../types';
|
|
2
|
+
|
|
3
|
+
const AmountValueInput = ( {
|
|
4
|
+
frequencySlug,
|
|
5
|
+
tierIndex,
|
|
6
|
+
id,
|
|
7
|
+
label,
|
|
8
|
+
attributes,
|
|
9
|
+
settings,
|
|
10
|
+
amounts,
|
|
11
|
+
setAttributes,
|
|
12
|
+
setSettings,
|
|
13
|
+
disabled,
|
|
14
|
+
ignoreMinimumAmount,
|
|
15
|
+
}: ComponentProps & {
|
|
16
|
+
frequencySlug: DonationFrequencySlug;
|
|
17
|
+
tierIndex: number;
|
|
18
|
+
id: string;
|
|
19
|
+
label?: string;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
ignoreMinimumAmount?: boolean;
|
|
22
|
+
} ) => {
|
|
23
|
+
const onChange = ( { value, frequency }: { value: string; frequency: DonationFrequencySlug } ) => {
|
|
24
|
+
const subject = attributes.manual ? attributes : settings;
|
|
25
|
+
subject.amounts[ frequency ][ tierIndex ] = parseFloat( value );
|
|
26
|
+
const update: Partial< DonateBlockAttributes > = {
|
|
27
|
+
amounts: {
|
|
28
|
+
[ frequency ]: subject.amounts[ frequency ],
|
|
29
|
+
...subject.amounts,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
if ( attributes.manual ) {
|
|
34
|
+
setAttributes( update );
|
|
35
|
+
} else {
|
|
36
|
+
setSettings( update );
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const amount = amounts[ frequencySlug ][ tierIndex ];
|
|
40
|
+
const value = settings.minimumDonation && ! ignoreMinimumAmount ? Math.max( amount, settings.minimumDonation ) : amount;
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<span key={ `${ frequencySlug }-${ tierIndex }` }>
|
|
44
|
+
{ label && <label htmlFor={ id }>{ label }</label> }
|
|
45
|
+
<input
|
|
46
|
+
type="number"
|
|
47
|
+
min={ ignoreMinimumAmount ? undefined : attributes.minimumDonation }
|
|
48
|
+
onChange={ evt =>
|
|
49
|
+
onChange( {
|
|
50
|
+
value: evt.target.value,
|
|
51
|
+
frequency: frequencySlug,
|
|
52
|
+
} )
|
|
53
|
+
}
|
|
54
|
+
value={ value }
|
|
55
|
+
id={ id }
|
|
56
|
+
disabled={ disabled }
|
|
57
|
+
/>
|
|
58
|
+
</span>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default AmountValueInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as AmountValueInput } from './AmountValueInput';
|