@automattic/newspack-blocks 1.37.0 → 1.48.0

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.
Files changed (292) hide show
  1. package/.cache/babel/00255e6096be9e31ec354db849dfefaa.json.gz +0 -0
  2. package/.cache/babel/0265bee20d709ac92f56456637727f4b.json.gz +0 -0
  3. package/.cache/babel/02986ba19dc461a152ea1c45f3f36a27.json.gz +0 -0
  4. package/.cache/babel/06a1700c1a4a989fc7886c86bf6223f7.json.gz +0 -0
  5. package/.cache/babel/07169c73863508b392f15022920bd0b6.json.gz +0 -0
  6. package/.cache/babel/0a5083e561829e3884cb5c71388adc3f.json.gz +0 -0
  7. package/.cache/babel/0a713997b6e4f45849ed6a4bff79cca5.json.gz +0 -0
  8. package/.cache/babel/0a9506bf649ffbe854e75459cf6b8972.json.gz +0 -0
  9. package/.cache/babel/0c12c4398bbbf2d771b13dd1d0e64097.json.gz +0 -0
  10. package/.cache/babel/0f8c18da204f4cc2777ca3191f10c309.json.gz +0 -0
  11. package/.cache/babel/0fced15ed787cc4239bb53c1d12892e6.json.gz +0 -0
  12. package/.cache/babel/10faf7c74a89e9aa4d8b9528a654913e.json.gz +0 -0
  13. package/.cache/babel/1353b411b65a123b5dc35012db11aa1d.json.gz +0 -0
  14. package/.cache/babel/1729336f326db1cf54b9c1671dc5e36c.json.gz +0 -0
  15. package/.cache/babel/17a433ab631a32d0712f3f75cf85ea99.json.gz +0 -0
  16. package/.cache/babel/1948e72d907f681ff771881ad6800ee1.json.gz +0 -0
  17. package/.cache/babel/1ab4bf44aa14d2eb7e6911900a3b2c12.json.gz +0 -0
  18. package/.cache/babel/1decfd137cac87a75bd83ffbd39c9106.json.gz +0 -0
  19. package/.cache/babel/2143ceff6d186bc13bc902e0f1f33dbf.json.gz +0 -0
  20. package/.cache/babel/23c63332718e167968a7c2a8a5f730eb.json.gz +0 -0
  21. package/.cache/babel/24bf53676e12293cbf88d01e649fd167.json.gz +0 -0
  22. package/.cache/babel/26ba0bb46844575022e54a8819fbf405.json.gz +0 -0
  23. package/.cache/babel/281ca171ce8947f87f574df11059e00b.json.gz +0 -0
  24. package/.cache/babel/28700b83434e4dbfb9a20d7ec0a7e7a4.json.gz +0 -0
  25. package/.cache/babel/29cf8eeea8630ade027e34459f2e49ee.json.gz +0 -0
  26. package/.cache/babel/2b0dd254a46223a93e6259d2b797a7e7.json.gz +0 -0
  27. package/.cache/babel/2da6786ede3ddda4c86eeac524a6a796.json.gz +0 -0
  28. package/.cache/babel/2e7ce10fdee94274b48d528f94c32b34.json.gz +0 -0
  29. package/.cache/babel/2f93fed1706a40d82122281cc3677074.json.gz +0 -0
  30. package/.cache/babel/3a59b710e9745ef93148d6d74ee7d16f.json.gz +0 -0
  31. package/.cache/babel/3b2c440027c793c8f7978d7622cbfca0.json.gz +0 -0
  32. package/.cache/babel/3ca939ace4af88e266942d93837ab37a.json.gz +0 -0
  33. package/.cache/babel/3e671670c4d395cd1804ef4be31955e4.json.gz +0 -0
  34. package/.cache/babel/3e69fe002d9973c0030152a51da9477a.json.gz +0 -0
  35. package/.cache/babel/3f5f8ea603fd57850c6683c750fe53d8.json.gz +0 -0
  36. package/.cache/babel/41abaaadb68b0657a95fa0c356873def.json.gz +0 -0
  37. package/.cache/babel/421ac952d6b472ba18e1cb95ef65f42a.json.gz +0 -0
  38. package/.cache/babel/424185dd50e91d8dee5fdae43086010e.json.gz +0 -0
  39. package/.cache/babel/427a6423ebde76bcb488747127e47351.json.gz +0 -0
  40. package/.cache/babel/43e800659f23430a181fb4fc328eb6ef.json.gz +0 -0
  41. package/.cache/babel/469651017a2b6f3b9f63fda034974b3a.json.gz +0 -0
  42. package/.cache/babel/480d26447b7ee019a37e4e18422403e9.json.gz +0 -0
  43. package/.cache/babel/4b58fad313d90a4c1577a2766e6c924c.json.gz +0 -0
  44. package/.cache/babel/4d2d42fea63650192d1a3a5648b621c5.json.gz +0 -0
  45. package/.cache/babel/4d8c26a76e77fa64d01f30a5f2d62f85.json.gz +0 -0
  46. package/.cache/babel/4f606ce6656565507a74aaac8dc21eea.json.gz +0 -0
  47. package/.cache/babel/505f37592f4c601ccdc1581ca89d9009.json.gz +0 -0
  48. package/.cache/babel/50aaf34aa54b2cd3058518e42850bb62.json.gz +0 -0
  49. package/.cache/babel/51fbf389462feb111228ba7ec64c631d.json.gz +0 -0
  50. package/.cache/babel/51fc90ae5fe129a095172032f304dc2c.json.gz +0 -0
  51. package/.cache/babel/53dbf5484c5601528c2fd8d7fe728b78.json.gz +0 -0
  52. package/.cache/babel/58e4535574062eb2d8fa56d002e7190d.json.gz +0 -0
  53. package/.cache/babel/5aa5e8d1492938c62999de022c4b220e.json.gz +0 -0
  54. package/.cache/babel/5d64e475284e52c104df17e26066b17b.json.gz +0 -0
  55. package/.cache/babel/6333c664d69f13036f42bcf575c8e65d.json.gz +0 -0
  56. package/.cache/babel/635c439786b8522888342779b28ee9ee.json.gz +0 -0
  57. package/.cache/babel/648cffdd5ec4a2446f8935a17b98080b.json.gz +0 -0
  58. package/.cache/babel/64b0dd478e6f2dd51de5ee20e311aee7.json.gz +0 -0
  59. package/.cache/babel/6531721abbc0b3906b28b268ed7914af.json.gz +0 -0
  60. package/.cache/babel/66bf5585c7901a76c7d4014fa9ffed40.json.gz +0 -0
  61. package/.cache/babel/6ef313cb6d3a59f73a6b78e1a729fb13.json.gz +0 -0
  62. package/.cache/babel/6f14eed506421f15710d3dfafe3dcd93.json.gz +0 -0
  63. package/.cache/babel/70f6c01d8c6bc3efc41c97eaf49f7617.json.gz +0 -0
  64. package/.cache/babel/72321dde68f0bb9c334d90d6f4584be8.json.gz +0 -0
  65. package/.cache/babel/76c815fab58595f57e01af6591791d57.json.gz +0 -0
  66. package/.cache/babel/7c10f4d554daa8efe1e0a4457fb6d27b.json.gz +0 -0
  67. package/.cache/babel/7dffccddd9780ab37fb79f809947c2cd.json.gz +0 -0
  68. package/.cache/babel/7e5162e3319cd5d6fca6c0db0516aaeb.json.gz +0 -0
  69. package/.cache/babel/803192c922f7d419648bab7e1201b22e.json.gz +0 -0
  70. package/.cache/babel/81f3f0f896d29cdf88f8543dedb77787.json.gz +0 -0
  71. package/.cache/babel/84c019d3d643195fb37d08110f15f8c9.json.gz +0 -0
  72. package/.cache/babel/853c31db7c4351f2f36d1021c667224d.json.gz +0 -0
  73. package/.cache/babel/88ec99735ea4f314937736f04360ff8c.json.gz +0 -0
  74. package/.cache/babel/8959ab8fcfa783cb56e9418b99c0951c.json.gz +0 -0
  75. package/.cache/babel/8b9624d721f8706682e33fe1853c8287.json.gz +0 -0
  76. package/.cache/babel/8de5c373bbc4b6fbeec373d582935887.json.gz +0 -0
  77. package/.cache/babel/8f24517cff634d2e91c19e51be8816cc.json.gz +0 -0
  78. package/.cache/babel/901e1bb823eca196b594baa35a35a81c.json.gz +0 -0
  79. package/.cache/babel/90dbc666ff9fa3b88f305fe90a9917bf.json.gz +0 -0
  80. package/.cache/babel/91b62dfd9475df7a39dc08fbd43847f9.json.gz +0 -0
  81. package/.cache/babel/956daf27323e3b87bf8bf9bbf58881ed.json.gz +0 -0
  82. package/.cache/babel/959e9b81103c539a9d85ac60955451b9.json.gz +0 -0
  83. package/.cache/babel/963b1e44be998c4dcc6845745c377369.json.gz +0 -0
  84. package/.cache/babel/966b41ac1317b3e03ca1e59f7eb57e8c.json.gz +0 -0
  85. package/.cache/babel/969d5992cc682e3b43761ef02c10b851.json.gz +0 -0
  86. package/.cache/babel/99df128bb528d0f95a56b311801d14c1.json.gz +0 -0
  87. package/.cache/babel/9b33e7d21f3fc4955a536a033cced71b.json.gz +0 -0
  88. package/.cache/babel/9c5ec84f77314a621c01ad77da7ccb58.json.gz +0 -0
  89. package/.cache/babel/9d325af12a88623602a5f8c2fce04847.json.gz +0 -0
  90. package/.cache/babel/a413e4d325543836d0800684bb26ed04.json.gz +0 -0
  91. package/.cache/babel/a5405f86b8d1485e62a125275507e60f.json.gz +0 -0
  92. package/.cache/babel/a7f7461321ca6fd4360df04bb894c106.json.gz +0 -0
  93. package/.cache/babel/a8a6812e1c7b65cc6d0bdebe2a35c8ca.json.gz +0 -0
  94. package/.cache/babel/aa89cfc4c88fcc465b8d74af824e7f6b.json.gz +0 -0
  95. package/.cache/babel/adbaeb5ddf5612b3dcd233a3f6f17bf2.json.gz +0 -0
  96. package/.cache/babel/ae18cd6ec42a3366c73435b62a9f5f70.json.gz +0 -0
  97. package/.cache/babel/aea149ee1ec6fa3ca7839c63f5edd78d.json.gz +0 -0
  98. package/.cache/babel/af1b34067a69854e109c0b0e45d90e43.json.gz +0 -0
  99. package/.cache/babel/b3a335ab950f502914013810b43b0ad5.json.gz +0 -0
  100. package/.cache/babel/b6cfba15cda3404d4b1041df448ed2b2.json.gz +0 -0
  101. package/.cache/babel/ba711530bd319618a0510d8361bebb45.json.gz +0 -0
  102. package/.cache/babel/ba77e682225df6126b636458055601d9.json.gz +0 -0
  103. package/.cache/babel/bab8189a74eee8d72702d1510b52b3b3.json.gz +0 -0
  104. package/.cache/babel/bd8741020db56bb5d999252812d1d717.json.gz +0 -0
  105. package/.cache/babel/beaa874c5e01203d9dbe23cb89405276.json.gz +0 -0
  106. package/.cache/babel/c196c9b8c21953c474acdaa9029b3cbf.json.gz +0 -0
  107. package/.cache/babel/c1e31e6c217023eb3d3fd5d3de486ac3.json.gz +0 -0
  108. package/.cache/babel/c3aa996443e7f377aa423bcc03ffc617.json.gz +0 -0
  109. package/.cache/babel/c481eae84d69b65405a44af442dbfea7.json.gz +0 -0
  110. package/.cache/babel/c4a817d6c4bf6eb3687ffccc5c2df801.json.gz +0 -0
  111. package/.cache/babel/c8b10cf6f706fb669d6dd7564385768d.json.gz +0 -0
  112. package/.cache/babel/caa2f98ba4af6eba0605543f690693c6.json.gz +0 -0
  113. package/.cache/babel/cada4b2cecb2c1fcc48b7a7ecda54907.json.gz +0 -0
  114. package/.cache/babel/d1bed5404789c427c32965ac6ecad0d9.json.gz +0 -0
  115. package/.cache/babel/d395e8c0a9c63680f2dcf90ca0e91d4a.json.gz +0 -0
  116. package/.cache/babel/d4672090e0dd9a73bfb00bd770b23643.json.gz +0 -0
  117. package/.cache/babel/d4c81f65fe6d78cdbdcf1ef901b7ba1b.json.gz +0 -0
  118. package/.cache/babel/d515ddc0797ea256ff7271507737e9ce.json.gz +0 -0
  119. package/.cache/babel/d742848d263503f79168f1a6b8a52097.json.gz +0 -0
  120. package/.cache/babel/d834b41d7028519ecd0cbc8c65d33dde.json.gz +0 -0
  121. package/.cache/babel/d9060b9162e7caf974db0b90b6134727.json.gz +0 -0
  122. package/.cache/babel/d946975b9beac51a39f600461e84b1b6.json.gz +0 -0
  123. package/.cache/babel/daf0af780cff2270b1ae0e4b97a5a4ab.json.gz +0 -0
  124. package/.cache/babel/db5215643b0737dc5245972a5c25f736.json.gz +0 -0
  125. package/.cache/babel/dd57b8d31664b147b9f1e3f5cd18cc2a.json.gz +0 -0
  126. package/.cache/babel/e0c78bdaae19f15e2dd4a773e842422b.json.gz +0 -0
  127. package/.cache/babel/e1a2c7e4fc3afe9cc6e03d60f4e4a23d.json.gz +0 -0
  128. package/.cache/babel/e210ff9aa99df972b8d81c4bda70f642.json.gz +0 -0
  129. package/.cache/babel/e259a73f84d5b92b94e6d094719264c3.json.gz +0 -0
  130. package/.cache/babel/e6ce03a9908c9c4dc2c723531f1073f6.json.gz +0 -0
  131. package/.cache/babel/e8a1501dd8e4b3389ecdc8f722622359.json.gz +0 -0
  132. package/.cache/babel/eb3bb371036da362c42db50248d0b180.json.gz +0 -0
  133. package/.cache/babel/eb854e03c810bdb969497b2a36119bfa.json.gz +0 -0
  134. package/.cache/babel/ec25bb53826070b7f301e64f02355b8c.json.gz +0 -0
  135. package/.cache/babel/edbaca20e4a65f850c3d8321c1945718.json.gz +0 -0
  136. package/.cache/babel/f059f1ca9e49d5c3e655d20339860dce.json.gz +0 -0
  137. package/.cache/babel/f24c559fb42ef906405966598baf5f80.json.gz +0 -0
  138. package/.cache/babel/f2f333c3c546ad711d722d782decd450.json.gz +0 -0
  139. package/.cache/babel/f42c854ce8f1dc1a6e6fe7c510b033a5.json.gz +0 -0
  140. package/.cache/babel/f5211608f22c2e12594eafdbc4e66aa5.json.gz +0 -0
  141. package/.cache/babel/f645b8c88a49718cd778e3595212d4eb.json.gz +0 -0
  142. package/.cache/babel/f66dda5c4e4e9d04eb6b7411fcb12a65.json.gz +0 -0
  143. package/.cache/babel/f9d5b6f3f5438342dba75c2ce6143eef.json.gz +0 -0
  144. package/.cache/babel/fc9c60ee1d2e8783ba4c08db5cf97d40.json.gz +0 -0
  145. package/.cache/babel/fd558798cea72d04fb826468a89d72aa.json.gz +0 -0
  146. package/.cache/babel/fe735cbd0f6e131e28d8b6eb1f39141b.json.gz +0 -0
  147. package/.eslintrc.js +3 -26
  148. package/.nvmrc +1 -0
  149. package/CHANGELOG.md +422 -0
  150. package/babel.config.js +6 -0
  151. package/block-list.json +1 -1
  152. package/composer.json +2 -2
  153. package/composer.lock +446 -161
  154. package/dist/author-list/view.asset.php +1 -0
  155. package/dist/author-list/view.css +1 -0
  156. package/dist/author-list/view.js +1 -0
  157. package/dist/author-list/view.rtl.css +1 -0
  158. package/dist/author-profile/view.asset.php +1 -0
  159. package/dist/author-profile/view.css +1 -0
  160. package/dist/author-profile/view.js +1 -0
  161. package/dist/author-profile/view.rtl.css +1 -0
  162. package/dist/block_styles.asset.php +1 -0
  163. package/dist/block_styles.css +1 -0
  164. package/dist/block_styles.js +1 -0
  165. package/dist/block_styles.rtl.css +1 -0
  166. package/dist/carousel/view.asset.php +1 -0
  167. package/dist/carousel/view.css +1 -0
  168. package/dist/carousel/view.js +1 -0
  169. package/dist/carousel/view.rtl.css +1 -0
  170. package/dist/donate/view.asset.php +1 -0
  171. package/dist/donate/view.css +1 -0
  172. package/dist/donate/view.js +1 -0
  173. package/dist/donate/view.rtl.css +1 -0
  174. package/dist/donateStreamlined.asset.php +1 -0
  175. package/dist/donateStreamlined.css +1 -0
  176. package/dist/donateStreamlined.js +1 -0
  177. package/dist/donateStreamlined.rtl.css +1 -0
  178. package/dist/editor.asset.php +1 -0
  179. package/dist/editor.css +1 -0
  180. package/dist/editor.js +41 -0
  181. package/dist/editor.rtl.css +1 -0
  182. package/dist/homepage-articles/view.asset.php +1 -0
  183. package/dist/homepage-articles/view.css +1 -0
  184. package/dist/homepage-articles/view.js +1 -0
  185. package/dist/homepage-articles/view.rtl.css +1 -0
  186. package/dist/iframe/view.asset.php +1 -0
  187. package/dist/iframe/view.css +1 -0
  188. package/dist/iframe/view.js +1 -0
  189. package/dist/iframe/view.rtl.css +1 -0
  190. package/includes/class-newspack-blocks-api.php +14 -69
  191. package/includes/class-newspack-blocks-patterns.php +4 -1
  192. package/includes/class-newspack-blocks.php +421 -95
  193. package/newspack-blocks.php +26 -2
  194. package/package.json +31 -129
  195. package/postcss.config.js +11 -0
  196. package/src/block-patterns/subscribe-2.php +1 -1
  197. package/src/block-patterns/subscribe-3.php +1 -1
  198. package/src/block-patterns/subscribe-7.php +12 -0
  199. package/src/block-patterns/subscribe-8.php +12 -0
  200. package/src/block-patterns/subscribe-9.php +12 -0
  201. package/src/block-styles/core/columns/editor.scss +5 -8
  202. package/src/block-styles/core/columns/view.scss +83 -42
  203. package/src/blocks/author-list/block.json +82 -0
  204. package/src/blocks/author-list/class-wp-rest-newspack-author-list-controller.php +387 -0
  205. package/src/blocks/author-list/edit.js +527 -0
  206. package/src/blocks/author-list/editor.js +7 -0
  207. package/src/blocks/author-list/editor.scss +1 -0
  208. package/src/blocks/author-list/index.js +45 -0
  209. package/src/blocks/author-list/view.js +5 -0
  210. package/src/blocks/author-list/view.php +175 -0
  211. package/src/blocks/author-list/view.scss +46 -0
  212. package/src/blocks/author-profile/block.json +8 -0
  213. package/src/blocks/author-profile/class-wp-rest-newspack-authors-controller.php +69 -14
  214. package/src/blocks/author-profile/edit.js +212 -189
  215. package/src/blocks/author-profile/editor.scss +1 -1
  216. package/src/blocks/author-profile/single-author.js +100 -0
  217. package/src/blocks/author-profile/view.php +38 -92
  218. package/src/blocks/author-profile/view.scss +120 -1
  219. package/src/blocks/carousel/create-swiper.js +14 -5
  220. package/src/blocks/carousel/edit.js +4 -2
  221. package/src/blocks/carousel/editor.scss +3 -12
  222. package/src/blocks/carousel/view.js +1 -1
  223. package/src/blocks/carousel/view.php +9 -5
  224. package/src/blocks/carousel/view.scss +29 -3
  225. package/src/blocks/donate/class-wp-rest-newspack-donate-controller.php +22 -24
  226. package/src/blocks/donate/edit.js +49 -42
  227. package/src/blocks/donate/editor.scss +27 -3
  228. package/src/blocks/donate/index.js +31 -4
  229. package/src/blocks/donate/streamlined/index.js +248 -0
  230. package/src/blocks/donate/streamlined/index.test.js +125 -0
  231. package/src/blocks/donate/streamlined/style.scss +324 -0
  232. package/src/blocks/donate/streamlined/utils.js +174 -0
  233. package/src/blocks/donate/streamlined/utils.test.js +18 -0
  234. package/src/blocks/donate/view.php +77 -36
  235. package/src/blocks/donate/view.scss +291 -0
  236. package/src/blocks/homepage-articles/block.json +8 -0
  237. package/src/blocks/homepage-articles/class-wp-rest-newspack-articles-controller.php +24 -78
  238. package/src/blocks/homepage-articles/edit.js +26 -0
  239. package/src/blocks/homepage-articles/store.js +11 -1
  240. package/src/blocks/homepage-articles/templates/article.php +31 -3
  241. package/src/blocks/homepage-articles/templates/articles-loop.php +6 -5
  242. package/src/blocks/homepage-articles/utils.js +11 -10
  243. package/src/blocks/homepage-articles/view.php +4 -1
  244. package/src/blocks/homepage-articles/view.scss +69 -24
  245. package/src/blocks/iframe/block.json +34 -0
  246. package/src/blocks/iframe/class-wp-rest-newspack-iframe-controller.php +345 -0
  247. package/src/blocks/iframe/edit.js +252 -0
  248. package/src/blocks/iframe/editor.js +7 -0
  249. package/src/blocks/iframe/editor.scss +84 -0
  250. package/src/blocks/iframe/icons.js +10 -0
  251. package/src/blocks/iframe/iframe-placeholder.js +180 -0
  252. package/src/blocks/iframe/index.js +48 -0
  253. package/src/blocks/iframe/view.js +5 -0
  254. package/src/blocks/iframe/view.php +130 -0
  255. package/src/blocks/iframe/view.scss +9 -0
  256. package/src/blocks/video-playlist/view.php +4 -3
  257. package/src/components/query-controls.js +5 -4
  258. package/src/setup/editor.js +0 -1
  259. package/src/shared/js/utils.js +1 -1
  260. package/src/templates/author-profile-card.php +99 -0
  261. package/vendor/autoload.php +7 -0
  262. package/vendor/composer/ClassLoader.php +572 -0
  263. package/vendor/composer/InstalledVersions.php +350 -0
  264. package/vendor/composer/LICENSE +21 -0
  265. package/vendor/composer/autoload_classmap.php +10 -0
  266. package/vendor/composer/autoload_namespaces.php +9 -0
  267. package/vendor/composer/autoload_psr4.php +9 -0
  268. package/vendor/composer/autoload_real.php +55 -0
  269. package/vendor/composer/autoload_static.php +20 -0
  270. package/vendor/composer/installed.json +5 -0
  271. package/vendor/composer/installed.php +23 -0
  272. package/webpack.config.js +2 -3
  273. package/.circleci/config.yml +0 -96
  274. package/.distignore +0 -36
  275. package/.editorconfig +0 -22
  276. package/.github/ISSUE_TEMPLATE/Bug_report.md +0 -21
  277. package/.github/ISSUE_TEMPLATE/Enhancement.md +0 -17
  278. package/.github/ISSUE_TEMPLATE/Feature_request.md +0 -17
  279. package/.github/PULL_REQUEST_TEMPLATE.md +0 -29
  280. package/.github/workflows/main.yml +0 -15
  281. package/.phpcs.xml.dist +0 -55
  282. package/.prettierrc +0 -10
  283. package/.stylelintrc +0 -21
  284. package/.travis.yml +0 -67
  285. package/phpunit.xml.dist +0 -16
  286. package/src/blocks/author-profile/shared.scss +0 -95
  287. package/src/blocks/donate/streamlined.js +0 -180
  288. package/src/blocks/donate/streamlined.scss +0 -124
  289. package/src/setup/public-path.js +0 -13
  290. package/src/setup/view.js +0 -4
  291. package/tests/bootstrap.php +0 -31
  292. package/tests/test-sample.php +0 -20
@@ -0,0 +1,324 @@
1
+ @import '../../../shared/sass/colors';
2
+ @import '../../../shared/sass/mixins';
3
+ @import '../../../shared/sass/variables';
4
+
5
+ @keyframes loader {
6
+ 0% {
7
+ background-position: 0% 50%;
8
+ }
9
+ 50% {
10
+ background-position: 100% 50%;
11
+ }
12
+ 100% {
13
+ background-position: 0% 50%;
14
+ }
15
+ }
16
+
17
+ .wp-block-newspack-blocks-donate {
18
+ .stripe-payment {
19
+ // For the initial unravelling animation.
20
+ position: relative;
21
+ &,
22
+ &--transition,
23
+ &::after {
24
+ transition: all 300ms ease-out;
25
+ }
26
+ &::after {
27
+ content: '';
28
+ opacity: 0;
29
+ pointer-events: none;
30
+ position: absolute;
31
+ top: 0;
32
+ left: 0;
33
+ width: 100%;
34
+ height: 100%;
35
+ background: linear-gradient( 318deg, #d5d5d5, #fff );
36
+ background-size: 400% 400%;
37
+ animation: loader 3s ease infinite;
38
+ border-radius: 5px;
39
+ }
40
+
41
+ &__card {
42
+ border: 1px solid $color__border;
43
+ border-radius: 3px;
44
+ padding: 0.34rem 0.66rem;
45
+ min-height: 32px;
46
+ }
47
+ input[type='text'],
48
+ input[type='email'],
49
+ &__checkbox,
50
+ button {
51
+ font-size: 0.7em;
52
+ }
53
+ input[type='text'],
54
+ input[type='email'],
55
+ &__messages {
56
+ width: 100%;
57
+ }
58
+ input[type='text'],
59
+ input[type='email'] {
60
+ border-radius: 3px;
61
+ font-family: sans-serif;
62
+
63
+ @include media( tablet ) {
64
+ font-size: 14px;
65
+ line-height: 1.2;
66
+ }
67
+ }
68
+
69
+ &--invisible {
70
+ > * {
71
+ opacity: 0;
72
+ }
73
+ &::after {
74
+ opacity: 1;
75
+ }
76
+ }
77
+ &--hidden {
78
+ display: none;
79
+ }
80
+
81
+ &__checkbox {
82
+ align-items: center;
83
+ display: inline-flex;
84
+ cursor: pointer;
85
+
86
+ input {
87
+ height: 1em;
88
+ width: 1em;
89
+ margin-right: 0.5em;
90
+ }
91
+ }
92
+
93
+ &__messages {
94
+ > div {
95
+ border: 0 solid $color__info;
96
+ border-left-width: 4px;
97
+ font-size: $font__size-sm;
98
+ margin-top: 0.76rem;
99
+ padding: 0.38rem 0.76rem;
100
+ &:empty {
101
+ border: 0;
102
+ margin: 0;
103
+ padding: 0;
104
+ }
105
+ &.type-error {
106
+ background-color: rgba( $color__error, 0.075 );
107
+ border-color: $color__error;
108
+ }
109
+ &.type-success {
110
+ background-color: rgba( $color__success, 0.075 );
111
+ border-color: $color__success;
112
+ }
113
+ }
114
+ }
115
+
116
+ &--disabled {
117
+ button,
118
+ input {
119
+ pointer-events: none;
120
+ opacity: 0.4;
121
+ }
122
+ }
123
+
124
+ &__element {
125
+ margin-bottom: 0.4rem;
126
+ }
127
+
128
+ &__row {
129
+ margin-bottom: 0.5rem;
130
+ &--small {
131
+ margin-bottom: 5px;
132
+ line-height: 1.2;
133
+ }
134
+ &--flex {
135
+ display: flex;
136
+ align-items: flex-end;
137
+ justify-content: space-between;
138
+ flex-wrap: wrap;
139
+ @include media( tablet ) {
140
+ flex-wrap: nowrap;
141
+ }
142
+ input {
143
+ margin-bottom: 0.5rem;
144
+ @include media( tablet ) {
145
+ margin-bottom: 0;
146
+ width: 50%;
147
+ &:last-child {
148
+ margin-left: 0.5rem;
149
+ }
150
+ }
151
+ }
152
+ }
153
+ }
154
+
155
+ &__info {
156
+ color: $color__text-light;
157
+ font-size: 0.7em;
158
+ font-style: italic;
159
+ padding-left: 1.5em;
160
+ }
161
+
162
+ &__footer {
163
+ align-items: flex-end;
164
+ margin-bottom: 1.32rem;
165
+ margin-left: -10px;
166
+ margin-right: -10px;
167
+ > * {
168
+ padding-left: 10px;
169
+ padding-right: 10px;
170
+ }
171
+ }
172
+ &__branding {
173
+ margin-top: 1em;
174
+ height: 26px;
175
+ display: block;
176
+ text-decoration: none;
177
+
178
+ img {
179
+ display: block;
180
+ }
181
+ }
182
+
183
+ &__methods {
184
+ display: flex;
185
+ flex-wrap: wrap;
186
+ button {
187
+ margin-left: 0;
188
+ margin-right: 0;
189
+ margin-bottom: 0;
190
+ height: 46px;
191
+ }
192
+ > * {
193
+ margin-top: 10px;
194
+ width: 100%;
195
+ @include media( mobile ) {
196
+ width: auto;
197
+ }
198
+ }
199
+ }
200
+
201
+ &__request-button {
202
+ min-width: 190px;
203
+ @include media( mobile ) {
204
+ margin-right: 1em;
205
+ }
206
+ &--invisible {
207
+ opacity: 0;
208
+ }
209
+ }
210
+ }
211
+
212
+ &__stripe {
213
+ margin: 0.38rem 0.76rem 0.76rem;
214
+
215
+ @include media( tablet ) {
216
+ margin-left: 1.5rem;
217
+ margin-right: 1.5rem;
218
+ }
219
+ &--editor {
220
+ input:first-child {
221
+ margin-top: 0;
222
+ }
223
+ }
224
+ }
225
+ }
226
+
227
+ #stripe-fees-amount {
228
+ padding-left: 3px;
229
+ }
230
+
231
+ /* Alternate Style */
232
+
233
+ .wpbnbd.is-style-alternate {
234
+ .wp-block-newspack-blocks-donate__stripe {
235
+ margin: 1.12rem 1.12rem 0;
236
+ }
237
+
238
+ .stripe-payment {
239
+ &__row {
240
+ margin-bottom: 0.56rem;
241
+ }
242
+
243
+ &__methods {
244
+ display: grid;
245
+ grid-gap: 0.56rem;
246
+
247
+ > * {
248
+ margin-top: 0;
249
+ }
250
+ }
251
+
252
+ &__footer {
253
+ margin: 1.12rem 0;
254
+
255
+ > * {
256
+ padding: 0;
257
+ }
258
+
259
+ button {
260
+ border-top-left-radius: 5px;
261
+ border-top-right-radius: 5px;
262
+ margin: 0;
263
+ width: auto;
264
+ }
265
+ }
266
+
267
+ &__request-button {
268
+ margin: 0;
269
+ }
270
+
271
+ &__branding {
272
+ margin-top: 1.12rem;
273
+ }
274
+ }
275
+ }
276
+
277
+ /* Minimal Style */
278
+
279
+ .wpbnbd.is-style-minimal {
280
+ .wp-block-newspack-blocks-donate__stripe {
281
+ margin: 0;
282
+ text-align: left;
283
+ }
284
+
285
+ .stripe-payment {
286
+ &__row {
287
+ margin-bottom: 0.56rem;
288
+ }
289
+
290
+ &__inputs {
291
+ margin-bottom: 1.12rem;
292
+ }
293
+
294
+ &__methods {
295
+ display: grid;
296
+ grid-gap: 0.28rem;
297
+
298
+ > * {
299
+ margin-top: 0;
300
+ }
301
+ }
302
+
303
+ &__footer {
304
+ margin: 1.12rem 0 0;
305
+
306
+ > * {
307
+ padding: 0;
308
+ }
309
+
310
+ button {
311
+ margin: 0;
312
+ min-width: auto;
313
+ }
314
+ }
315
+
316
+ &__request-button {
317
+ margin: 0;
318
+ }
319
+
320
+ &__branding {
321
+ margin-top: 1.12rem;
322
+ }
323
+ }
324
+ }
@@ -0,0 +1,174 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __, sprintf } from '@wordpress/i18n';
5
+
6
+ const isValidEmail = string => /\S+@\S+/.test( string );
7
+ export const validateFormData = values => {
8
+ const errors = {};
9
+ if ( ! isValidEmail( values.email ) ) {
10
+ errors.email = __( 'Email address is invalid.', 'newspack-blocks' );
11
+ }
12
+ if ( values.amount <= 0 ) {
13
+ errors.amount = __( 'Amount must be greater than zero.', 'newspack-blocks' );
14
+ }
15
+ if ( values.full_name.length === 0 ) {
16
+ errors.amount = __( 'Full name should be provided.', 'newspack-blocks' );
17
+ }
18
+ return errors;
19
+ };
20
+
21
+ /**
22
+ * Renders UI messages in a given DOM element.
23
+ */
24
+ export const renderMessages = ( messages, el, type = 'error' ) => {
25
+ el.innerHTML = '';
26
+ messages.forEach( message => {
27
+ const messageEl = document.createElement( 'div' );
28
+ messageEl.classList.add( `type-${ type }` );
29
+ messageEl.innerHTML = message;
30
+ el.appendChild( messageEl );
31
+ } );
32
+ };
33
+
34
+ const getCookies = () =>
35
+ document.cookie.split( '; ' ).reduce( ( acc, cookieStr ) => {
36
+ const cookie = cookieStr.split( '=' );
37
+ acc[ cookie[ 0 ] ] = cookie[ 1 ];
38
+ return acc;
39
+ }, {} );
40
+
41
+ /**
42
+ * Retrieves donation settings passed via a `data-settings` HTML attribute
43
+ * on a `form` element.
44
+ */
45
+ export const getSettings = formElement => {
46
+ const [
47
+ currency,
48
+ currencySymbol,
49
+ siteName,
50
+ isCurrencyZeroDecimal,
51
+ countryCode,
52
+ frequencies,
53
+ feeMultiplier,
54
+ feeStatic,
55
+ stripePublishableKey,
56
+ ] = JSON.parse( formElement.getAttribute( 'data-settings' ) );
57
+ return {
58
+ currency: currency.toLowerCase(),
59
+ currencySymbol,
60
+ siteName,
61
+ isCurrencyZeroDecimal,
62
+ countryCode,
63
+ frequencies,
64
+ feeMultiplier: parseFloat( feeMultiplier ),
65
+ feeStatic: parseFloat( feeStatic ),
66
+ stripePublishableKey,
67
+ };
68
+ };
69
+
70
+ /**
71
+ * Retrieves form values from the donation form HTML element.
72
+ */
73
+ export const getFormValues = formElement => {
74
+ const formValues = Object.fromEntries( new FormData( formElement ) );
75
+ const valueKey = `donation_value_${ formValues.donation_frequency }`;
76
+ formValues.amount = formValues[ valueKey ];
77
+ if ( formValues.amount === 'other' ) {
78
+ formValues.amount = formValues[ `${ valueKey }_other` ];
79
+ }
80
+ if ( ! formValues.amount ) {
81
+ formValues.amount = formValues[ `${ valueKey }_untiered` ];
82
+ }
83
+ if ( formValues.cid && formValues.cid.indexOf( 'CLIENT_ID' ) === 0 ) {
84
+ // In non-AMP environment, the value will not be dynamically substituted by AMP runtime.
85
+ formValues.cid = getCookies()[ 'newspack-cid' ];
86
+ }
87
+ return formValues;
88
+ };
89
+
90
+ /**
91
+ * Computes the total amount of the donation, taking into account if the
92
+ * donor has opted to cover the processing fee.
93
+ */
94
+ export const getTotalAmount = (
95
+ formElement,
96
+ // For the payment request button (Apple/Google Pay), the amount has to be
97
+ // delivered in subunits.
98
+ { convertToSubunit } = { convertToSubunit: false }
99
+ ) => {
100
+ const settings = getSettings( formElement );
101
+ let { amount, agree_to_pay_fees: paysFees } = getFormValues( formElement );
102
+
103
+ const processAmount = amountToProcess =>
104
+ parseFloat(
105
+ convertToSubunit
106
+ ? amountToProcess * ( settings.isCurrencyZeroDecimal ? 1 : 100 )
107
+ : amountToProcess
108
+ );
109
+
110
+ amount = processAmount( amount );
111
+ if ( paysFees ) {
112
+ const feesAmount = processAmount( getFeeAmount( formElement ) );
113
+ amount = amount + feesAmount;
114
+ }
115
+ return amount;
116
+ };
117
+
118
+ /**
119
+ * Creates a `total` value for Stripe's `paymentRequest` creation and updating.
120
+ */
121
+ export const getPaymentRequestTotal = formElement => {
122
+ const settings = getSettings( formElement );
123
+ const { donation_frequency: frequency } = getFormValues( formElement );
124
+ const frequencyLabel = settings.frequencies[ frequency ];
125
+ return {
126
+ label: `${ settings.siteName } (${ frequencyLabel })`,
127
+ amount: getTotalAmount( formElement, { convertToSubunit: true } ),
128
+ };
129
+ };
130
+
131
+ /**
132
+ * Computes the fee amount.
133
+ */
134
+ export const computeFeeAmount = ( amount, feeMultiplier, feeStatic ) => {
135
+ return parseFloat(
136
+ ( ( ( amount + feeStatic ) / ( 100 - feeMultiplier ) ) * 100 - amount ).toFixed( 2 )
137
+ );
138
+ };
139
+
140
+ /**
141
+ * Given the donation form HTML element, computes the fee amount.
142
+ */
143
+ export const getFeeAmount = formElement => {
144
+ const { amount } = getFormValues( formElement );
145
+ const { feeMultiplier, feeStatic } = getSettings( formElement );
146
+ return computeFeeAmount( parseFloat( amount ), feeMultiplier, feeStatic );
147
+ };
148
+
149
+ export const sendAPIRequest = async ( endpoint, data, method = 'POST' ) =>
150
+ fetch( `/wp-json/newspack-blocks/v1${ endpoint }`, {
151
+ method,
152
+ headers: {
153
+ 'Content-Type': 'application/json',
154
+ },
155
+ body: JSON.stringify( data ),
156
+ } ).then( async res => {
157
+ const responseData = await res.json();
158
+ if ( res.ok ) {
159
+ return responseData;
160
+ }
161
+ return { error: responseData };
162
+ } );
163
+
164
+ export const renderSuccessMessageWithEmail = ( emailAddress, messagesEl ) => {
165
+ const successMessge = sprintf(
166
+ /* Translators: %s is the email address of the current user. */
167
+ __(
168
+ 'Your payment has been processed. Thank you for your contribution! You will receive a confirmation email at %s.',
169
+ 'newspack-blocks'
170
+ ),
171
+ emailAddress
172
+ );
173
+ renderMessages( [ successMessge ], messagesEl, 'success' );
174
+ };
@@ -0,0 +1,18 @@
1
+ import 'regenerator-runtime';
2
+
3
+ import { computeFeeAmount } from './utils';
4
+
5
+ describe( 'Fee computation', () => {
6
+ it( 'computes fee with default values', () => {
7
+ expect( computeFeeAmount( 1, 2.9, 0.3 ) ).toBe( 0.34 );
8
+ expect( computeFeeAmount( 15, 2.9, 0.3 ) ).toBe( 0.76 );
9
+ expect( computeFeeAmount( 100, 2.9, 0.3 ) ).toBe( 3.3 );
10
+ } );
11
+ it( 'computes fee with other values', () => {
12
+ expect( computeFeeAmount( 15, 0, 0 ) ).toBe( 0 );
13
+ expect( computeFeeAmount( 15, 2.3, 0.3 ) ).toBe( 0.66 );
14
+ expect( computeFeeAmount( 15, 2.3, 0 ) ).toBe( 0.35 );
15
+ expect( computeFeeAmount( 15, 50, 0 ) ).toBe( 15 );
16
+ expect( computeFeeAmount( 15, 50, 10 ) ).toBe( 35 );
17
+ } );
18
+ } );
@@ -15,16 +15,18 @@
15
15
  function newspack_blocks_render_block_donate_footer( $attributes ) {
16
16
  $is_streamlined = Newspack_Blocks::is_rendering_streamlined_block();
17
17
  $is_rendering_newsletter_list_opt_in = false;
18
+ $is_rendering_fee_checkbox = false;
19
+
18
20
  if ( $is_streamlined ) {
19
- $payment_data = WP_REST_Newspack_Donate_Controller::get_payment_data();
21
+ $stripe_data = \Newspack\Stripe_Connection::get_stripe_data();
22
+ $is_rendering_fee_checkbox = 0 < (float) $stripe_data['fee_multiplier'] + (float) $stripe_data['fee_static'];
20
23
  if ( class_exists( 'Newspack_Newsletters' ) ) {
21
- $is_rendering_newsletter_list_opt_in = isset( $payment_data['newsletter_list_id'] ) && ! empty( $payment_data['newsletter_list_id'] );
24
+ $is_rendering_newsletter_list_opt_in = isset( $stripe_data['newsletter_list_id'] ) && ! empty( $stripe_data['newsletter_list_id'] );
22
25
  }
23
26
  }
24
- $thanks_text = $attributes['thanksText'];
25
- $button_text = $attributes['buttonText'];
26
- $campaign = $attributes['campaign'] ?? false;
27
- $client_id = '';
27
+
28
+ $campaign = $attributes['campaign'] ?? false;
29
+ $client_id = '';
28
30
  if ( class_exists( 'Newspack_Popups_Segmentation' ) ) {
29
31
  $client_id = Newspack_Popups_Segmentation::NEWSPACK_SEGMENTATION_CID_NAME;
30
32
  }
@@ -33,36 +35,48 @@ function newspack_blocks_render_block_donate_footer( $attributes ) {
33
35
 
34
36
  ?>
35
37
  <p class='wp-block-newspack-blocks-donate__thanks thanks'>
36
- <?php echo wp_kses_post( $thanks_text ); ?>
38
+ <?php echo wp_kses_post( $attributes['thanksText'] ); ?>
37
39
  </p>
38
40
 
39
41
  <?php if ( $is_streamlined ) : ?>
40
- <div class="wp-block-newspack-blocks-donate__stripe stripe-payment stripe-payment--disabled" data-stripe-pub-key="<?php echo esc_attr( $payment_data['usedPublishableKey'] ); ?>">
41
- <div class="stripe-payment__inputs stripe-payment__inputs--hidden">
42
+ <div class="wp-block-newspack-blocks-donate__stripe stripe-payment stripe-payment--invisible stripe-payment--disabled">
43
+ <div class="stripe-payment__inputs stripe-payment--hidden">
42
44
  <div class="stripe-payment__row">
43
- <div class="stripe-payment__card"></div>
45
+ <div class="stripe-payment__element stripe-payment__card"></div>
44
46
  </div>
45
47
  <div class="stripe-payment__row stripe-payment__row--flex">
46
48
  <input required placeholder="<?php echo esc_html__( 'Email', 'newspack-blocks' ); ?>" type="email" name="email" value="">
47
49
  <input required placeholder="<?php echo esc_html__( 'Full Name', 'newspack-blocks' ); ?>" type="text" name="full_name" value="">
48
50
  </div>
49
- <?php if ( $is_rendering_newsletter_list_opt_in ) : ?>
50
- <div class="stripe-payment__row">
51
- <label class="stripe-payment__checkbox">
52
- <input type="checkbox" name="newsletter_opt_in" checked value="true"><?php echo esc_html__( 'Sign up for our newsletter', 'newspack-blocks' ); ?>
53
- </label>
54
- </div>
55
- <?php endif; ?>
56
- <div class="stripe-payment__messages">
57
- <div class="type-error"></div>
58
- <div class="type-success"></div>
59
- <div class="type-info"></div>
51
+ </div>
52
+ <?php if ( $is_rendering_fee_checkbox ) : ?>
53
+ <div class="stripe-payment__row stripe-payment__row--small">
54
+ <label class="stripe-payment__checkbox">
55
+ <input type="checkbox" name="agree_to_pay_fees" checked value="true"><?php echo esc_html__( 'Agree to pay fees?', 'newspack-blocks' ); ?>
56
+ <span id="stripe-fees-amount">($0)</span>
57
+ </label>
58
+ <div class="stripe-payment__info"><?php echo esc_html__( 'Paying the transaction fee is not required, but it directs more money in support of our mission.', 'newspack-blocks' ); ?></div>
59
+ </div>
60
+ <?php endif; ?>
61
+ <?php if ( $is_rendering_newsletter_list_opt_in ) : ?>
62
+ <div class="stripe-payment__row stripe-payment__row--small">
63
+ <label class="stripe-payment__checkbox">
64
+ <input type="checkbox" name="newsletter_opt_in" checked value="true"><?php echo esc_html__( 'Sign up for our newsletter', 'newspack-blocks' ); ?>
65
+ </label>
60
66
  </div>
67
+ <?php endif; ?>
68
+ <div class="stripe-payment__messages">
69
+ <div class="type-error"></div>
70
+ <div class="type-success"></div>
71
+ <div class="type-info"></div>
61
72
  </div>
62
73
  <div class="stripe-payment__row stripe-payment__row--flex stripe-payment__footer">
63
- <button type='submit' style="margin-left: 0; margin-top: 1em;">
64
- <?php echo wp_kses_post( $button_text ); ?>
65
- </button>
74
+ <div class="stripe-payment__methods">
75
+ <div class="stripe-payment__request-button stripe-payment--hidden stripe-payment__request-button--invisible stripe-payment--transition"></div>
76
+ <button type='submit'>
77
+ <?php echo esc_html__( 'Donate with card', 'newspack-blocks' ); ?>
78
+ </button>
79
+ </div>
66
80
  <a target="_blank" rel="noreferrer" class="stripe-payment__branding" href="https://stripe.com">
67
81
  <img width="111" height="26" src="<?php echo esc_attr( Newspack_Blocks::streamlined_block_stripe_badge() ); ?>" alt="Stripe">
68
82
  </a>
@@ -70,18 +84,20 @@ function newspack_blocks_render_block_donate_footer( $attributes ) {
70
84
  </div>
71
85
  <?php else : ?>
72
86
  <button type='submit'>
73
- <?php echo wp_kses_post( $button_text ); ?>
87
+ <?php echo wp_kses_post( $attributes['buttonText'] ); ?>
74
88
  </button>
75
89
  <?php endif; ?>
76
90
  <?php if ( $campaign ) : ?>
77
91
  <input type='hidden' name='campaign' value='<?php echo esc_attr( $campaign ); ?>' />
78
92
  <?php endif; ?>
79
- <input
80
- name="cid"
81
- type="hidden"
82
- value="CLIENT_ID(<?php echo esc_attr( $client_id ); ?>)"
83
- data-amp-replace="CLIENT_ID"
84
- />
93
+ <?php if ( $client_id ) : ?>
94
+ <input
95
+ name="cid"
96
+ type="hidden"
97
+ value="CLIENT_ID(<?php echo esc_attr( $client_id ); ?>)"
98
+ data-amp-replace="CLIENT_ID"
99
+ />
100
+ <?php endif; ?>
85
101
  <?php
86
102
 
87
103
  return ob_get_clean();
@@ -133,6 +149,13 @@ function newspack_blocks_render_block_donate( $attributes ) {
133
149
  return '';
134
150
  }
135
151
 
152
+ /* If block has additional CSS class(es) */
153
+ if ( isset( $attributes['className'] ) ) {
154
+ $classname = $attributes['className'];
155
+ } else {
156
+ $classname = 'is-style-default';
157
+ }
158
+
136
159
  /* If block is in "manual" mode, override certain state properties with values stored in attributes */
137
160
  if ( $attributes['manual'] ?? false ) {
138
161
  $settings = array_merge( $settings, $attributes );
@@ -151,6 +174,24 @@ function newspack_blocks_render_block_donate( $attributes ) {
151
174
 
152
175
  $form_footer = newspack_blocks_render_block_donate_footer( $attributes );
153
176
 
177
+ if ( Newspack_Blocks::is_rendering_streamlined_block() ) {
178
+ $stripe_data = \Newspack\Stripe_Connection::get_stripe_data();
179
+ $currency = $stripe_data['currency'];
180
+ $settings_for_frontend = [
181
+ $currency,
182
+ $settings['currencySymbol'],
183
+ get_bloginfo( 'name' ),
184
+ Newspack\Stripe_Connection::is_currency_zero_decimal( $currency ),
185
+ $stripe_data['location_code'],
186
+ $frequencies,
187
+ $stripe_data['fee_multiplier'],
188
+ $stripe_data['fee_static'],
189
+ $stripe_data['usedPublishableKey'],
190
+ ];
191
+ } else {
192
+ $settings_for_frontend = [];
193
+ }
194
+
154
195
  ob_start();
155
196
 
156
197
  /**
@@ -161,8 +202,8 @@ function newspack_blocks_render_block_donate( $attributes ) {
161
202
  if ( ! $settings['tiered'] ) :
162
203
 
163
204
  ?>
164
- <div class='wp-block-newspack-blocks-donate wpbnbd untiered'>
165
- <form>
205
+ <div class="wp-block-newspack-blocks-donate wpbnbd untiered <?php echo esc_html( $classname ); ?>">
206
+ <form data-settings="<?php echo esc_html( htmlspecialchars( wp_json_encode( $settings_for_frontend ), ENT_QUOTES, 'UTF-8' ) ); ?>">
166
207
  <input type='hidden' name='newspack_donate' value='1' />
167
208
  <div class='wp-block-newspack-blocks-donate__options'>
168
209
  <?php foreach ( $frequencies as $frequency_slug => $frequency_name ) : ?>
@@ -214,8 +255,8 @@ function newspack_blocks_render_block_donate( $attributes ) {
214
255
  else :
215
256
 
216
257
  ?>
217
- <div class='wp-block-newspack-blocks-donate wpbnbd tiered'>
218
- <form>
258
+ <div class="wp-block-newspack-blocks-donate wpbnbd tiered <?php echo esc_html( $classname ); ?>">
259
+ <form data-settings="<?php echo esc_html( htmlspecialchars( wp_json_encode( $settings_for_frontend ), ENT_QUOTES, 'UTF-8' ) ); ?>">
219
260
  <input type='hidden' name='newspack_donate' value='1' />
220
261
  <div class='wp-block-newspack-blocks-donate__options'>
221
262
  <div class='wp-block-newspack-blocks-donate__frequencies frequencies'>
@@ -344,7 +385,7 @@ function newspack_blocks_register_donate() {
344
385
  ],
345
386
  'buttonText' => [
346
387
  'type' => 'string',
347
- 'default' => __( 'Donate now!', 'newspack-blocks' ),
388
+ 'default' => __( 'Donate Now', 'newspack-blocks' ),
348
389
  ],
349
390
  'defaultFrequency' => [
350
391
  'type' => 'string',