Changeset 2455824
- Timestamp:
- 01/13/2021 06:26:10 PM (5 years ago)
- Location:
- actblue-contributions
- Files:
-
- 48 added
- 10 edited
-
tags/1.4.0 (added)
-
tags/1.4.0/actblue-contributions.php (added)
-
tags/1.4.0/admin (added)
-
tags/1.4.0/admin/class-actblue-admin.php (added)
-
tags/1.4.0/admin/templates (added)
-
tags/1.4.0/admin/templates/actblue-settings-page.php (added)
-
tags/1.4.0/blocks (added)
-
tags/1.4.0/blocks/class-actblue-blocks.php (added)
-
tags/1.4.0/blocks/custom (added)
-
tags/1.4.0/blocks/custom/actblue-button (added)
-
tags/1.4.0/blocks/custom/actblue-button/edit.js (added)
-
tags/1.4.0/blocks/custom/actblue-button/editor.scss (added)
-
tags/1.4.0/blocks/custom/actblue-button/index.js (added)
-
tags/1.4.0/blocks/custom/actblue-button/save.js (added)
-
tags/1.4.0/blocks/custom/actblue-buttons (added)
-
tags/1.4.0/blocks/custom/actblue-buttons/edit.js (added)
-
tags/1.4.0/blocks/custom/actblue-buttons/index.js (added)
-
tags/1.4.0/blocks/custom/actblue-buttons/save.js (added)
-
tags/1.4.0/blocks/custom/actblue-buttons/transforms.js (added)
-
tags/1.4.0/blocks/custom/actblue-embed (added)
-
tags/1.4.0/blocks/custom/actblue-embed/edit.js (added)
-
tags/1.4.0/blocks/custom/actblue-embed/embed-controls.js (added)
-
tags/1.4.0/blocks/custom/actblue-embed/embed-loading.js (added)
-
tags/1.4.0/blocks/custom/actblue-embed/embed-placeholder.js (added)
-
tags/1.4.0/blocks/custom/actblue-embed/embed-preview.js (added)
-
tags/1.4.0/blocks/custom/actblue-embed/index.js (added)
-
tags/1.4.0/blocks/custom/actblue-embed/save.js (added)
-
tags/1.4.0/blocks/custom/actblue-embed/transforms.js (added)
-
tags/1.4.0/blocks/custom/actblue-embed/urlWithQueryConfiguration.js (added)
-
tags/1.4.0/blocks/editor.scss (added)
-
tags/1.4.0/blocks/icons (added)
-
tags/1.4.0/blocks/icons/actblue.js (added)
-
tags/1.4.0/blocks/index.js (added)
-
tags/1.4.0/build (added)
-
tags/1.4.0/build/actblue-contributions.asset.php (added)
-
tags/1.4.0/build/actblue-contributions.js (added)
-
tags/1.4.0/build/blocks.asset.php (added)
-
tags/1.4.0/build/blocks.js (added)
-
tags/1.4.0/build/editor.asset.php (added)
-
tags/1.4.0/build/editor.css (added)
-
tags/1.4.0/build/editor.js (added)
-
tags/1.4.0/includes (added)
-
tags/1.4.0/includes/class-actblue.php (added)
-
tags/1.4.0/public (added)
-
tags/1.4.0/public/class-actblue-public.php (added)
-
tags/1.4.0/public/js (added)
-
tags/1.4.0/public/js/actblue-contributions.js (added)
-
tags/1.4.0/readme.txt (added)
-
trunk/actblue-contributions.php (modified) (2 diffs)
-
trunk/blocks/custom/actblue-button/edit.js (modified) (2 diffs)
-
trunk/blocks/custom/actblue-button/index.js (modified) (1 diff)
-
trunk/blocks/custom/actblue-button/save.js (modified) (2 diffs)
-
trunk/build/actblue-contributions.asset.php (modified) (1 diff)
-
trunk/build/actblue-contributions.js (modified) (1 diff)
-
trunk/build/blocks.asset.php (modified) (1 diff)
-
trunk/build/blocks.js (modified) (1 diff)
-
trunk/public/js/actblue-contributions.js (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
actblue-contributions/trunk/actblue-contributions.php
r2441023 r2455824 15 15 * Text Domain: actblue 16 16 * Domain Path: /languages 17 * Version: 1. 3.017 * Version: 1.4.0 18 18 */ 19 19 … … 26 26 * Current plugin version. 27 27 */ 28 define( 'ACTBLUE_PLUGIN_VERSION', '1. 3.0' );28 define( 'ACTBLUE_PLUGIN_VERSION', '1.4.0' ); 29 29 30 30 /** -
actblue-contributions/trunk/blocks/custom/actblue-button/edit.js
r2441023 r2455824 87 87 className, 88 88 }) { 89 const { borderRadius, placeholder, text, endpoint, refcode } = attributes; 89 const { 90 borderRadius, 91 placeholder, 92 text, 93 endpoint, 94 refcode, 95 amount, 96 } = attributes; 90 97 91 98 const [isFetching, setIsFetching] = useState(false); … … 212 219 /> 213 220 214 {/* 215 We can add a field for an `Amount` with another text control. We can grab the 216 `amount` variable from the attributes passed to this edit function. 217 */} 218 219 {/* <TextControl 221 <TextControl 220 222 type="number" 221 223 label="Amount" 222 value={amount} 223 onChange={(value) => setAttributes({ amount: value })} 224 /> */} 224 value={amount ? amount / 100 : ""} 225 onChange={(value) => 226 setAttributes({ 227 amount: value ? value * 100 : undefined, 228 }) 229 } 230 help="Set the amount of the contribution in dollars, leave blank to let the donor choose an amount." 231 /> 225 232 </PanelBody> 226 233 <PanelColorGradientSettings -
actblue-contributions/trunk/blocks/custom/actblue-button/index.js
r2441023 r2455824 66 66 }, 67 67 68 /** 69 * Uncommend the following attribute to enable a user to attach a specific donation 70 * amount to a button. You can then access this `amount` variable in the attributes 71 * parameter passed to the edit.js and save.js functions. This is required so that 72 * the amount value gets saved to the block. 73 */ 74 // amount: { 75 // type: "string", 76 // }, 68 amount: { 69 type: "number", 70 }, 77 71 }; 78 72 -
actblue-contributions/trunk/blocks/custom/actblue-button/save.js
r2441023 r2455824 15 15 const ActBlueButtonSave = ({ attributes }) => { 16 16 const { 17 amount, 17 18 backgroundColor, 18 19 borderRadius, … … 73 74 data-token={token} 74 75 data-refcode={refcode} 76 data-amount={amount} 75 77 rel="noopener noreferrer" 76 78 /> -
actblue-contributions/trunk/build/actblue-contributions.asset.php
r2441023 r2455824 1 <?php return array('dependencies' => array('wp-polyfill'), 'version' => '8 1adb5d48706fc97a4c865fd08ad91ad');1 <?php return array('dependencies' => array('wp-polyfill'), 'version' => '80922398069bacf48d7c36355be5f6f1'); -
actblue-contributions/trunk/build/actblue-contributions.js
r2441023 r2455824 1 !function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=29)}({14:function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},29:function(e,t,n){"use strict";n.r(t);var o,r=n(14),u=n.n(r),i=function(e){var t=e.currentTarget .dataset,n=t.token,o=t.refcode;n?(window.actblue.requestContribution({token:n,refcodes:{refcode:o}}),e.preventDefault()):console.warn("Warning: the ActBlue token for this button is invalid. Please be sure to add the URL to a valid ActBlue embeddable form in the editor.")};o=function(){"object"===u()(window.actblue)&&"function"==typeof window.actblue.requestContribution?document.querySelectorAll(".js-actblue-donation-button").forEach((function(e){e.addEventListener("click",i)})):console.warn("The actblue.js script is not loaded, but is required.")},"loading"!==document.readyState?o():document.addEventListener("DOMContentLoaded",o,{once:!0})}});1 !function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=29)}({14:function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},29:function(e,t,n){"use strict";n.r(t);var o,r=n(14),u=n.n(r),i=function(e){var t=e.currentTarget,n=t.dataset,o=n.token,r=n.refcode,u=n.amount;o?(window.actblue.requestContribution({token:o,amount:u,refcodes:{refcode:r},onLanded:function(){t.classList.remove("is-style-outline")}}),t.classList.add("is-style-outline"),e.preventDefault()):console.warn("Warning: the ActBlue token for this button is invalid. Please be sure to add the URL to a valid ActBlue embeddable form in the editor.")};o=function(){var e=window.actblue;"object"===u()(e)&&"function"==typeof e.requestContribution?document.querySelectorAll(".js-actblue-donation-button").forEach((function(e){e.addEventListener("click",i)})):console.warn("The actblue.js script is not loaded, but is required.")},"loading"!==document.readyState?o():document.addEventListener("DOMContentLoaded",o,{once:!0})}}); -
actblue-contributions/trunk/build/blocks.asset.php
r2441023 r2455824 1 <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives'), 'version' => ' af60d1a9019c5dfcbb50c7f4114911df');1 <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives'), 'version' => '07a645bab2255b723cf9763d5ca8fd58'); -
actblue-contributions/trunk/build/blocks.js
r2441023 r2455824 1 !function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=30)}([function(e,t){ !function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t){!function(){e.exports=this.wp.components}()},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var c=typeof r;if("string"===c||"number"===c)e.push(r);else if(Array.isArray(r)&&r.length){var a=o.apply(null,r);a&&e.push(a)}else if("object"===c)for(var i in r)n.call(r,i)&&r[i]&&e.push(i)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t){!function(){e.exports=this.wp.primitives}()},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e,t,n){var r=n(21);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t,n){var r=n(23),o=n(24),c=n(25),a=n(27);e.exports=function(e,t){return r(e)||o(e,t)||c(e,t)||a()}},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t,n){var r=n(14),o=n(6);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?o(e):t}},function(e,t,n){var r;!function(){"use strict";var n=function(){function e(){}function t(e,t){for(var n=t.length,r=0;r<n;++r)o(e,t[r])}e.prototype=Object.create(null);var n={}.hasOwnProperty;var r=/\s+/;function o(e,o){if(o){var c=typeof o;"string"===c?function(e,t){for(var n=t.split(r),o=n.length,c=0;c<o;++c)e[n[c]]=!0}(e,o):Array.isArray(o)?t(e,o):"object"===c?function(e,t){for(var r in t)n.call(t,r)&&(e[r]=!!t[r])}(e,o):"number"===c&&function(e,t){e[t]=!0}(e,o)}}return function(){for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];var c=new e;t(c,r);var a=[];for(var i in c)c[i]&&a.push(i);return a.join(" ")}}();e.exports?(n.default=n,e.exports=n):void 0===(r=function(){return n}.apply(t,[]))||(e.exports=r)}()},function(e,t){!function(){e.exports=this.wp.compose}()},function(e,t){!function(){e.exports=this.wp.data}()},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n.apply(this,arguments)}e.exports=n},function(e,t,n){var r=n(22);e.exports=function(e,t){if(null==e)return{};var n,o,c=r(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,o={},c=Object.keys(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,c=void 0;try{for(var a,i=e[Symbol.iterator]();!(r=(a=i.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,c=e}finally{try{r||null==i.return||i.return()}finally{if(o)throw c}}return n}}},function(e,t,n){var r=n(26);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},,,function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"icon",(function(){return J})),n.d(r,"title",(function(){return K})),n.d(r,"name",(function(){return Q})),n.d(r,"settings",(function(){return X}));var o={};n.r(o),n.d(o,"name",(function(){return ae})),n.d(o,"settings",(function(){return ie}));var c={};n.r(c),n.d(c,"name",(function(){return he})),n.d(c,"settings",(function(){return ye}));var a=n(5),i=n(1),l=n(19),u=n.n(l),s=n(10),b=n.n(s),p=n(11),f=n.n(p),d=n(6),m=n.n(d),v=n(12),h=n.n(v),y=n(15),g=n.n(y),O=n(8),j=n.n(O),_=n(0),k=n(3),w=n(2),x=n(9),E=Object(_.createElement)(x.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(_.createElement)(x.Path,{d:"M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"})),C=function(e){var t=e.showEditButton,n=e.switchBackToURLInput;return Object(_.createElement)(_.Fragment,null,Object(_.createElement)(w.BlockControls,null,Object(_.createElement)(k.ToolbarGroup,null,t&&Object(_.createElement)(k.Button,{className:"components-toolbar__control",label:Object(i.__)("Edit URL"),icon:E,onClick:n}))))},S=function(){return Object(_.createElement)("div",{className:"wp-block-embed is-loading"},Object(_.createElement)(k.Spinner,null),Object(_.createElement)("p",null,Object(i.__)("Embedding…")))},B=function(e){var t=e.icon,n=e.label,r=e.value,o=e.onSubmit,c=e.onChange,a=e.cannotEmbed,l=e.fallback,u=e.tryAgain;return Object(_.createElement)(k.Placeholder,{icon:Object(_.createElement)(w.BlockIcon,{icon:t,showColors:!0}),label:n,className:"wp-block-embed",instructions:Object(i.__)("Paste a link to the content you want to display on your site.")},Object(_.createElement)("form",{onSubmit:o},Object(_.createElement)("input",{type:"url",value:r||"",className:"components-placeholder__input","aria-label":n,placeholder:Object(i.__)("Enter URL to embed here…"),onChange:c}),Object(_.createElement)(k.Button,{isSecondary:!0,type:"submit"},Object(i._x)("Embed","button label"))),Object(_.createElement)("div",{className:"components-placeholder__learn-more"},Object(_.createElement)(k.ExternalLink,{href:Object(i.__)("https://wordpress.org/support/article/embeds/")},Object(i.__)("Learn more about embeds"))),a&&Object(_.createElement)("div",{className:"components-placeholder__error"},Object(_.createElement)("div",{className:"components-placeholder__instructions"},Object(i.__)("Sorry, this content could not be embedded.")),Object(_.createElement)(k.Button,{isSecondary:!0,onClick:u},Object(i._x)("Try again","button label"))," ",Object(_.createElement)(k.Button,{isSecondary:!0,onClick:l},Object(i._x)("Convert to link","button label"))))},A=n(16),R=n.n(A);function P(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=j()(e);if(t){var o=j()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return g()(this,n)}}var T=function(e){h()(n,e);var t=P(n);function n(){var e;return b()(this,n),(e=t.apply(this,arguments)).hideOverlay=e.hideOverlay.bind(m()(e)),e.state={interactive:!1},e}return f()(n,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"render",value:function(){var e=this.props,t=e.preview,n=(e.url,e.type),r=e.caption,o=e.onCaptionChange,c=e.isSelected,a=e.className,l=(e.icon,e.label,this.state.interactive),u=t.html,s=Object(_.createElement)("div",{className:"wp-block-embed__wrapper"},Object(_.createElement)("div",{dangerouslySetInnerHTML:{__html:u}}),!l&&Object(_.createElement)("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}));return Object(_.createElement)("figure",{className:R()(a,"wp-block-embed",{"is-type-video":"video"===n})},s,(!w.RichText.isEmpty(r)||c)&&Object(_.createElement)(w.RichText,{tagName:"figcaption",placeholder:Object(i.__)("Write caption…"),value:r,onChange:o,inlineToolbar:!0}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),n}(_.Component),N=n(7),U=n.n(N),L=n(17),I=n(18),M=n(20),D=n.n(M),G=function(e){var t=e.url,n=D()(e,["url"]),r=[];Object.keys(n).map((function(e){n[e]&&r.push("".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(n[e])))}));var o=!!r.length&&r.join("&");return t&&o?"".concat(t,"?").concat(o):t};function H(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=j()(e);if(t){var o=j()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return g()(this,n)}}var F=function(e){h()(n,e);var t=H(n);function n(){var e;return b()(this,n),(e=t.apply(this,arguments)).switchBackToURLInput=e.switchBackToURLInput.bind(m()(e)),e.setUrl=e.setUrl.bind(m()(e)),e.handleIncomingPreview=e.handleIncomingPreview.bind(m()(e)),e.state={editingURL:!1,url:e.props.attributes.url},e.props.preview&&e.handleIncomingPreview(),e}return f()(n,[{key:"handleIncomingPreview",value:function(){(0,this.props.setAttributes)(this.props.attributes)}},{key:"componentDidUpdate",value:function(e){var t=void 0!==this.props.preview,n=void 0!==e.preview,r=e.preview&&this.props.preview&&this.props.preview.html!==e.preview.html||t&&!n,o=this.props.attributes.url!==e.attributes.url;if(r||o){if(this.props.cannotEmbed)return void(this.props.fetching||this.resubmitWithoutTrailingSlash());this.handleIncomingPreview()}}},{key:"resubmitWithoutTrailingSlash",value:function(){this.setState((function(e){return{url:e.url.replace(/\/$/,"")}}),this.setUrl)}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;0===t.indexOf("https://secure.actblue.com")?(this.setState({editingURL:!1}),n({url:t})):console.error("Can not use ActBlue Embed block to embed non-ActBlue urls")}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0}),this.props.clearActBlueSettings()}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,o=this.props,c=o.fetching,i=o.setAttributes,l=o.isSelected,u=o.preview,s=o.cannotEmbed,b=o.tryAgain;if(c)return Object(_.createElement)(S,null);if(!u||s||r)return Object(_.createElement)(B,{icon:J,label:"ActBlue URL",onSubmit:this.setUrl,value:n,cannotEmbed:s,onChange:function(t){return e.setState({url:t.target.value})},fallback:function(){return function(e,t){var n=Object(_.createElement)("a",{href:e},e);t(Object(a.createBlock)("core/paragraph",{content:Object(_.renderToString)(n)}))}(n,e.props.onReplace)},tryAgain:b});var p=this.props.attributes,f=p.caption,d=p.type,m=U()(this.props.attributes.className,this.props.className);return Object(_.createElement)(_.Fragment,null,Object(_.createElement)(C,{showEditButton:u&&!s,switchBackToURLInput:this.switchBackToURLInput}),Object(_.createElement)(T,{preview:u,className:m,url:n,type:d,caption:f,onCaptionChange:function(e){return i({caption:e})},isSelected:l,icon:J,label:"ActBlue URL"}))}}]),n}(_.Component),V=function(e){h()(n,e);var t=H(n);function n(){var e;return b()(this,n),(e=t.apply(this,arguments)).clearActBlueSettings=e.clearActBlueSettings.bind(m()(e)),e}return f()(n,[{key:"clearActBlueSettings",value:function(){this.props.setAttributes({refcode:""})}},{key:"render",value:function(){var e=this;return Object(_.createElement)(_.Fragment,null,Object(_.createElement)(F,u()({},this.props,{clearActBlueSettings:this.clearActBlueSettings})),Object(_.createElement)(w.InspectorControls,null,Object(_.createElement)(k.PanelBody,{title:Object(i.__)("ActBlue Settings"),className:"actblue-embed-settings__panel"},Object(_.createElement)(k.TextControl,{label:"Refcode",value:this.props.attributes.refcode,onChange:function(t){return e.props.setAttributes({refcode:t})},help:"Add a refcode to this embed form."}))))}}]),n}(_.Component),W=Object(L.compose)(Object(I.withSelect)((function(e,t){var n=t.attributes.url,r=G({url:n,preview:"true"}),o=e("core"),c=o.getEmbedPreview,a=o.isPreviewEmbedFallback,i=o.isRequestingEmbedPreview,l=void 0!==r&&c(r),u=void 0!==r&&a(r),s=void 0!==r&&i(r),b=!!l&&void 0===l.type&&!1===l.html,p=!!l&&l.data&&404===l.data.status,f=!!l&&!b&&!p;return{preview:f?l:void 0,fetching:s,cannotEmbed:void 0!==r&&(!f||u)}})),Object(I.withDispatch)((function(e,t){var n=t.attributes.url,r=e("core/data");return{tryAgain:function(){r.invalidateResolution("core","getEmbedPreview",[n])}}})))(V),Z=n(4),z=n.n(Z),$=function(e){var t=e.attributes,n=t.url,r=t.caption,o=t.type,c=t.refcode;if(!n)return null;var a=R()("wp-block-embed","is-provider-actblue",z()({},"is-type-".concat(o),o));return Object(_.createElement)("figure",{className:a},Object(_.createElement)("div",{className:"wp-block-embed__wrapper"},"\n".concat(G({url:n,refcode:c}),"\n")),!w.RichText.isEmpty(r)&&Object(_.createElement)(w.RichText.Content,{tagName:"figcaption",value:r}))},q={from:[{type:"raw",isMatch:function(e){return"P"===e.nodeName&&/^\s*(https?:\/\/secure\.actblue\.com\S+)\s*$/i.test(e.textContent)},transform:function(e){return Object(a.createBlock)(Q,{url:e.textContent.trim()})}}]},J=function(){return Object(_.createElement)(x.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 46.32 27.69"},Object(_.createElement)(x.Path,{d:"M23.33,27.69l-2.56-6H9.14L6.58,27.62H0L11.91,0h5.95L29.77,27.62H23.33ZM15,8.24l-3.46,8h6.92Zm29.91,7.41A6.26,6.26,0,0,1,46.31,20a7.45,7.45,0,0,1-2,5.12c-1.52,1.73-4.15,2.56-8,2.56h-4.5L24.3,10.11V0H35a16.79,16.79,0,0,1,4.84.69,6.89,6.89,0,0,1,3.05,1.8,7.23,7.23,0,0,1,1.87,4.85,5.61,5.61,0,0,1-2.08,4.84,6.52,6.52,0,0,1-1,.7,4.42,4.42,0,0,1-1,.48A7.09,7.09,0,0,1,44.86,15.65ZM30.46,5.26v6h3a10.15,10.15,0,0,0,3.8-.55,2.41,2.41,0,0,0,1.25-2.42,2.5,2.5,0,0,0-1.18-2.43,8.8,8.8,0,0,0-3.87-.62ZM38.7,21.81A2.68,2.68,0,0,0,40,19.24a2.44,2.44,0,0,0-1.38-2.56,12.08,12.08,0,0,0-4.5-.62H30.46v6.37h4.29A9.89,9.89,0,0,0,38.7,21.81Z",fill:"#00a9e0"}))},K=Object(i.__)("ActBlue Embed"),Q="actblue/embed",X={title:K,icon:J,description:Object(i.__)("Embed an ActBlue contribution form."),category:"embed",responsive:!1,keywords:[],supports:{align:!0},transforms:q,attributes:{url:{type:"string"},caption:{type:"string",source:"html",selector:"figcaption"},type:{type:"string"},allowResponsive:{type:"boolean",default:!0},refcode:{type:"string"}},edit:W,save:$},Y=["actblue/button"],ee=[["actblue/button"]],te={hasSelectedUI:!1},ne={isEmbedButton:!0};var re=function(e){var t=e.className;return Object(_.createElement)("div",{className:"".concat(t," wp-block-buttons")},Object(_.createElement)(w.__experimentalAlignmentHookSettingsProvider,{value:ne},Object(_.createElement)(w.InnerBlocks,{allowedBlocks:Y,template:ee,__experimentalUIParts:te,__experimentalMoverDirection:"horizontal"})))},oe=function(){return Object(_.createElement)("div",{className:"wp-block-buttons"},Object(_.createElement)(w.InnerBlocks.Content,null))},ce={from:[{type:"block",blocks:["core/buttons"],transform:function(e,t){var n=t.map((function(e){return Object(a.createBlock)("actblue/button",e.attributes)}));return Object(a.createBlock)(ae,{},n)}}],to:[{type:"block",blocks:["core/buttons"],transform:function(e,t){var n=t.map((function(e){return Object(a.createBlock)("core/button",e.attributes)}));return Object(a.createBlock)("core/buttons",e,n)}}]},ae="actblue/buttons",ie={title:Object(i.__)("ActBlue Buttons"),description:Object(i.__)("Prompt visitors to take action with a group of ActBlue donation buttons."),category:"layout",icon:J,keywords:[Object(i.__)("link")],supports:{align:!0,alignWide:!1},edit:re,save:oe,transforms:ce},le=n(13),ue=n.n(le);function se(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function be(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?se(Object(n),!0).forEach((function(t){z()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):se(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var pe=window.getComputedStyle,fe=Object(k.withFallbackStyles)((function(e,t){var n=t.textColor,r=t.backgroundColor,o=r&&r.color,c=n&&n.color,a=!c&&e?e.querySelector('[contenteditable="true"]'):null;return{fallbackBackgroundColor:o||!e?void 0:pe(e).backgroundColor,fallbackTextColor:c||!a?void 0:pe(a).color}}));function de(e){var t=e.borderRadius,n=void 0===t?"":t,r=e.setAttributes,o=Object(_.useCallback)((function(e){r({borderRadius:e})}),[r]);return Object(_.createElement)(k.PanelBody,{title:Object(i.__)("Border settings")},Object(_.createElement)(k.RangeControl,{value:n,label:Object(i.__)("Border radius"),min:0,max:50,initialPosition:5,allowReset:!0,onChange:o}))}var me=Object(L.compose)([Object(w.withColors)("backgroundColor",{textColor:"color"}),fe])((function(e){var t,n=e.attributes,r=e.backgroundColor,o=e.textColor,c=e.setBackgroundColor,a=e.setTextColor,l=e.fallbackBackgroundColor,u=e.fallbackTextColor,s=e.setAttributes,b=e.className,p=n.borderRadius,f=n.placeholder,d=n.text,m=n.endpoint,v=n.refcode,h=Object(_.useState)(!1),y=ue()(h,2),g=y[0],O=y[1],j=Object(_.useState)(""),x=ue()(j,2),E=x[0],C=x[1],S=Object(_.useState)("Connect"),B=ue()(S,2),A=B[0],R=B[1],P=Object(_.useState)(!1),T=ue()(P,2),N=T[0],L=T[1],I=Object(w.__experimentalUseGradient)(),M=I.gradientClass,D=I.gradientValue,G=I.setGradient;return Object(_.createElement)("div",{className:b},Object(_.createElement)(w.RichText,{placeholder:f||Object(i.__)("Add text…"),value:d,onChange:function(e){return s({text:e})},withoutInteractiveFormatting:!0,className:U()("wp-block-button__link",(t={"has-background":r.color||D},z()(t,r.class,!D&&r.class),z()(t,"has-text-color",o.color),z()(t,o.class,o.class),z()(t,M,M),z()(t,"no-border-radius",0===p),t)),style:be(be({},!r.color&&D?{background:D}:{backgroundColor:r.color}),{},{color:o.color,borderRadius:p?p+"px":void 0})}),Object(_.createElement)(w.InspectorControls,null,Object(_.createElement)(k.PanelBody,{title:Object(i.__)("ActBlue Settings"),className:"actblue-button-settings__panel"},Object(_.createElement)(k.TextControl,{label:"Embed URL",value:m,onChange:function(e){return s({endpoint:e})},help:"Use an ActBlue embedded form URL to connect this button."}),Object(_.createElement)(k.Button,{isSecondary:!0,isBusy:g,onClick:function(){if(m){O(!0),C("");var e="https://secure.actblue.com/cf/oembed?url=".concat(m,"&format=json");fetch(e).then((function(e){if(404===e.status)throw new Error("Error: could not find an ActBlue embeddable form at that URL.");return e.json()})).then((function(e){s({token:e.token}),setTimeout((function(){return L(!1)}),2e3),L(!0)})).catch((function(e){console.error(e),s({token:""}),C(e.message)})).finally((function(){R("Connect"),O(!1)}))}},disabled:g||!m},A),Object(_.createElement)("span",{className:U()("actblue-button-settings__success-message",{"actblue-button-settings__success-message--visible":N})},"Success!"),E&&Object(_.createElement)("p",{className:"actblue-button-settings__fetch-message"},E),Object(_.createElement)(k.HorizontalRule,null),Object(_.createElement)(k.TextControl,{label:"Refcode",value:v,onChange:function(e){return s({refcode:e})},help:"Associate contributions made through this button with a refcode."})),Object(_.createElement)(w.__experimentalPanelColorGradientSettings,{title:Object(i.__)("Background & Text Color"),settings:[{colorValue:o.color,onColorChange:a,label:Object(i.__)("Text color")},{colorValue:r.color,onColorChange:c,gradientValue:D,onGradientChange:G,label:Object(i.__)("Background")}]},Object(_.createElement)(w.ContrastChecker,{isLargeText:!1,textColor:o.color,backgroundColor:r.color,fallbackBackgroundColor:l,fallbackTextColor:u})),Object(_.createElement)(de,{borderRadius:p,setAttributes:s})))})),ve=function(e){var t,n=e.attributes,r=n.backgroundColor,o=n.borderRadius,c=n.customBackgroundColor,a=n.customGradient,i=n.customTextColor,l=n.endpoint,u=n.gradient,s=n.refcode,b=n.text,p=n.textColor,f=n.title,d=n.token,m=Object(w.getColorClassName)("color",p),v=!a&&Object(w.getColorClassName)("background-color",r),h=Object(w.__experimentalGetGradientClass)(u),y=U()("wp-block-button__link",(t={"has-text-color":p||i},z()(t,m,m),z()(t,"has-background",r||c||a||u),z()(t,v,v),z()(t,"no-border-radius",0===o),z()(t,h,h),t)),g={background:a||void 0,backgroundColor:v||a||u?void 0:c,color:m?void 0:i,borderRadius:o?o+"px":void 0};return Object(_.createElement)("div",{className:"wp-block-button"},Object(_.createElement)(w.RichText.Content,{tagName:"a",className:"".concat(y," js-actblue-donation-button"),href:l,title:f,style:g,value:b,target:"_blank","data-token":d,"data-refcode":s,rel:"noopener noreferrer"}))},he="actblue/button",ye={name:he,icon:J,title:"ActBlue Button",description:"Add a button for an ActBlue contribution.",category:"layout",keywords:[Object(i.__)("link")],example:{attributes:{className:"is-style-fill",backgroundColor:"vivid-green-cyan",text:Object(i.__)("Call to Action")}},supports:{align:!1,alignWide:!1},styles:[{name:"fill",label:Object(i.__)("Fill"),isDefault:!0},{name:"outline",label:Object(i.__)("Outline")}],parent:["actblue/buttons"],attributes:{title:{type:"string",source:"attribute",selector:"a",attribute:"title"},text:{type:"string",source:"html",selector:"a"},backgroundColor:{type:"string"},textColor:{type:"string"},customBackgroundColor:{type:"string"},customTextColor:{type:"string"},placeholder:{type:"string"},borderRadius:{type:"number"},gradient:{type:"string"},customGradient:{type:"string"},token:{type:"string"},endpoint:{type:"string"},refcode:{type:"string"}},edit:me,save:ve};[r,o,c].forEach((function(e){var t=e.name,n=e.settings;Object(a.registerBlockType)(t,n)}))}]);1 !function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=30)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.blockEditor},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){e.exports=window.wp.blocks},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var c=typeof r;if("string"===c||"number"===c)e.push(r);else if(Array.isArray(r)&&r.length){var a=o.apply(null,r);a&&e.push(a)}else if("object"===c)for(var i in r)n.call(r,i)&&r[i]&&e.push(i)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t){e.exports=window.wp.primitives},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e,t,n){var r=n(21);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t,n){var r=n(23),o=n(24),c=n(25),a=n(27);e.exports=function(e,t){return r(e)||o(e,t)||c(e,t)||a()}},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t,n){var r=n(14),o=n(6);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?o(e):t}},function(e,t,n){var r;!function(){"use strict";var n=function(){function e(){}function t(e,t){for(var n=t.length,r=0;r<n;++r)o(e,t[r])}e.prototype=Object.create(null);var n={}.hasOwnProperty;var r=/\s+/;function o(e,o){if(o){var c=typeof o;"string"===c?function(e,t){for(var n=t.split(r),o=n.length,c=0;c<o;++c)e[n[c]]=!0}(e,o):Array.isArray(o)?t(e,o):"object"===c?function(e,t){for(var r in t)n.call(t,r)&&(e[r]=!!t[r])}(e,o):"number"===c&&function(e,t){e[t]=!0}(e,o)}}return function(){for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];var c=new e;t(c,r);var a=[];for(var i in c)c[i]&&a.push(i);return a.join(" ")}}();e.exports?(n.default=n,e.exports=n):void 0===(r=function(){return n}.apply(t,[]))||(e.exports=r)}()},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.data},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n.apply(this,arguments)}e.exports=n},function(e,t,n){var r=n(22);e.exports=function(e,t){if(null==e)return{};var n,o,c=r(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,o={},c=Object.keys(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,c=void 0;try{for(var a,i=e[Symbol.iterator]();!(r=(a=i.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,c=e}finally{try{r||null==i.return||i.return()}finally{if(o)throw c}}return n}}},function(e,t,n){var r=n(26);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},,,function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"icon",(function(){return J})),n.d(r,"title",(function(){return K})),n.d(r,"name",(function(){return Q})),n.d(r,"settings",(function(){return X}));var o={};n.r(o),n.d(o,"name",(function(){return ae})),n.d(o,"settings",(function(){return ie}));var c={};n.r(c),n.d(c,"name",(function(){return he})),n.d(c,"settings",(function(){return ye}));var a=n(5),i=n(1),l=n(19),u=n.n(l),s=n(10),b=n.n(s),p=n(11),f=n.n(p),d=n(6),m=n.n(d),v=n(12),h=n.n(v),y=n(15),g=n.n(y),O=n(8),j=n.n(O),w=n(0),_=n(3),k=n(2),x=n(9),E=Object(w.createElement)(x.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(w.createElement)(x.Path,{d:"M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"})),C=function(e){var t=e.showEditButton,n=e.switchBackToURLInput;return Object(w.createElement)(w.Fragment,null,Object(w.createElement)(k.BlockControls,null,Object(w.createElement)(_.ToolbarGroup,null,t&&Object(w.createElement)(_.Button,{className:"components-toolbar__control",label:Object(i.__)("Edit URL"),icon:E,onClick:n}))))},S=function(){return Object(w.createElement)("div",{className:"wp-block-embed is-loading"},Object(w.createElement)(_.Spinner,null),Object(w.createElement)("p",null,Object(i.__)("Embedding…")))},B=function(e){var t=e.icon,n=e.label,r=e.value,o=e.onSubmit,c=e.onChange,a=e.cannotEmbed,l=e.fallback,u=e.tryAgain;return Object(w.createElement)(_.Placeholder,{icon:Object(w.createElement)(k.BlockIcon,{icon:t,showColors:!0}),label:n,className:"wp-block-embed",instructions:Object(i.__)("Paste a link to the content you want to display on your site.")},Object(w.createElement)("form",{onSubmit:o},Object(w.createElement)("input",{type:"url",value:r||"",className:"components-placeholder__input","aria-label":n,placeholder:Object(i.__)("Enter URL to embed here…"),onChange:c}),Object(w.createElement)(_.Button,{isSecondary:!0,type:"submit"},Object(i._x)("Embed","button label"))),Object(w.createElement)("div",{className:"components-placeholder__learn-more"},Object(w.createElement)(_.ExternalLink,{href:Object(i.__)("https://wordpress.org/support/article/embeds/")},Object(i.__)("Learn more about embeds"))),a&&Object(w.createElement)("div",{className:"components-placeholder__error"},Object(w.createElement)("div",{className:"components-placeholder__instructions"},Object(i.__)("Sorry, this content could not be embedded.")),Object(w.createElement)(_.Button,{isSecondary:!0,onClick:u},Object(i._x)("Try again","button label"))," ",Object(w.createElement)(_.Button,{isSecondary:!0,onClick:l},Object(i._x)("Convert to link","button label"))))},A=n(16),R=n.n(A);function P(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=j()(e);if(t){var o=j()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return g()(this,n)}}var T=function(e){h()(n,e);var t=P(n);function n(){var e;return b()(this,n),(e=t.apply(this,arguments)).hideOverlay=e.hideOverlay.bind(m()(e)),e.state={interactive:!1},e}return f()(n,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"render",value:function(){var e=this.props,t=e.preview,n=(e.url,e.type),r=e.caption,o=e.onCaptionChange,c=e.isSelected,a=e.className,l=(e.icon,e.label,this.state.interactive),u=t.html,s=Object(w.createElement)("div",{className:"wp-block-embed__wrapper"},Object(w.createElement)("div",{dangerouslySetInnerHTML:{__html:u}}),!l&&Object(w.createElement)("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}));return Object(w.createElement)("figure",{className:R()(a,"wp-block-embed",{"is-type-video":"video"===n})},s,(!k.RichText.isEmpty(r)||c)&&Object(w.createElement)(k.RichText,{tagName:"figcaption",placeholder:Object(i.__)("Write caption…"),value:r,onChange:o,inlineToolbar:!0}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),n}(w.Component),N=n(7),U=n.n(N),L=n(17),I=n(18),M=n(20),D=n.n(M),G=function(e){var t=e.url,n=D()(e,["url"]),r=[];Object.keys(n).map((function(e){n[e]&&r.push("".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(n[e])))}));var o=!!r.length&&r.join("&");return t&&o?"".concat(t,"?").concat(o):t};function H(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=j()(e);if(t){var o=j()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return g()(this,n)}}var F=function(e){h()(n,e);var t=H(n);function n(){var e;return b()(this,n),(e=t.apply(this,arguments)).switchBackToURLInput=e.switchBackToURLInput.bind(m()(e)),e.setUrl=e.setUrl.bind(m()(e)),e.handleIncomingPreview=e.handleIncomingPreview.bind(m()(e)),e.state={editingURL:!1,url:e.props.attributes.url},e.props.preview&&e.handleIncomingPreview(),e}return f()(n,[{key:"handleIncomingPreview",value:function(){(0,this.props.setAttributes)(this.props.attributes)}},{key:"componentDidUpdate",value:function(e){var t=void 0!==this.props.preview,n=void 0!==e.preview,r=e.preview&&this.props.preview&&this.props.preview.html!==e.preview.html||t&&!n,o=this.props.attributes.url!==e.attributes.url;if(r||o){if(this.props.cannotEmbed)return void(this.props.fetching||this.resubmitWithoutTrailingSlash());this.handleIncomingPreview()}}},{key:"resubmitWithoutTrailingSlash",value:function(){this.setState((function(e){return{url:e.url.replace(/\/$/,"")}}),this.setUrl)}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;0===t.indexOf("https://secure.actblue.com")?(this.setState({editingURL:!1}),n({url:t})):console.error("Can not use ActBlue Embed block to embed non-ActBlue urls")}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0}),this.props.clearActBlueSettings()}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,o=this.props,c=o.fetching,i=o.setAttributes,l=o.isSelected,u=o.preview,s=o.cannotEmbed,b=o.tryAgain;if(c)return Object(w.createElement)(S,null);if(!u||s||r)return Object(w.createElement)(B,{icon:J,label:"ActBlue URL",onSubmit:this.setUrl,value:n,cannotEmbed:s,onChange:function(t){return e.setState({url:t.target.value})},fallback:function(){return function(e,t){var n=Object(w.createElement)("a",{href:e},e);t(Object(a.createBlock)("core/paragraph",{content:Object(w.renderToString)(n)}))}(n,e.props.onReplace)},tryAgain:b});var p=this.props.attributes,f=p.caption,d=p.type,m=U()(this.props.attributes.className,this.props.className);return Object(w.createElement)(w.Fragment,null,Object(w.createElement)(C,{showEditButton:u&&!s,switchBackToURLInput:this.switchBackToURLInput}),Object(w.createElement)(T,{preview:u,className:m,url:n,type:d,caption:f,onCaptionChange:function(e){return i({caption:e})},isSelected:l,icon:J,label:"ActBlue URL"}))}}]),n}(w.Component),V=function(e){h()(n,e);var t=H(n);function n(){var e;return b()(this,n),(e=t.apply(this,arguments)).clearActBlueSettings=e.clearActBlueSettings.bind(m()(e)),e}return f()(n,[{key:"clearActBlueSettings",value:function(){this.props.setAttributes({refcode:""})}},{key:"render",value:function(){var e=this;return Object(w.createElement)(w.Fragment,null,Object(w.createElement)(F,u()({},this.props,{clearActBlueSettings:this.clearActBlueSettings})),Object(w.createElement)(k.InspectorControls,null,Object(w.createElement)(_.PanelBody,{title:Object(i.__)("ActBlue Settings"),className:"actblue-embed-settings__panel"},Object(w.createElement)(_.TextControl,{label:"Refcode",value:this.props.attributes.refcode,onChange:function(t){return e.props.setAttributes({refcode:t})},help:"Add a refcode to this embed form."}))))}}]),n}(w.Component),W=Object(L.compose)(Object(I.withSelect)((function(e,t){var n=t.attributes.url,r=G({url:n,preview:"true"}),o=e("core"),c=o.getEmbedPreview,a=o.isPreviewEmbedFallback,i=o.isRequestingEmbedPreview,l=void 0!==r&&c(r),u=void 0!==r&&a(r),s=void 0!==r&&i(r),b=!!l&&void 0===l.type&&!1===l.html,p=!!l&&l.data&&404===l.data.status,f=!!l&&!b&&!p;return{preview:f?l:void 0,fetching:s,cannotEmbed:void 0!==r&&(!f||u)}})),Object(I.withDispatch)((function(e,t){var n=t.attributes.url,r=e("core/data");return{tryAgain:function(){r.invalidateResolution("core","getEmbedPreview",[n])}}})))(V),Z=n(4),z=n.n(Z),$=function(e){var t=e.attributes,n=t.url,r=t.caption,o=t.type,c=t.refcode;if(!n)return null;var a=R()("wp-block-embed","is-provider-actblue",z()({},"is-type-".concat(o),o));return Object(w.createElement)("figure",{className:a},Object(w.createElement)("div",{className:"wp-block-embed__wrapper"},"\n".concat(G({url:n,refcode:c}),"\n")),!k.RichText.isEmpty(r)&&Object(w.createElement)(k.RichText.Content,{tagName:"figcaption",value:r}))},q={from:[{type:"raw",isMatch:function(e){return"P"===e.nodeName&&/^\s*(https?:\/\/secure\.actblue\.com\S+)\s*$/i.test(e.textContent)},transform:function(e){return Object(a.createBlock)(Q,{url:e.textContent.trim()})}}]},J=function(){return Object(w.createElement)(x.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 46.32 27.69"},Object(w.createElement)(x.Path,{d:"M23.33,27.69l-2.56-6H9.14L6.58,27.62H0L11.91,0h5.95L29.77,27.62H23.33ZM15,8.24l-3.46,8h6.92Zm29.91,7.41A6.26,6.26,0,0,1,46.31,20a7.45,7.45,0,0,1-2,5.12c-1.52,1.73-4.15,2.56-8,2.56h-4.5L24.3,10.11V0H35a16.79,16.79,0,0,1,4.84.69,6.89,6.89,0,0,1,3.05,1.8,7.23,7.23,0,0,1,1.87,4.85,5.61,5.61,0,0,1-2.08,4.84,6.52,6.52,0,0,1-1,.7,4.42,4.42,0,0,1-1,.48A7.09,7.09,0,0,1,44.86,15.65ZM30.46,5.26v6h3a10.15,10.15,0,0,0,3.8-.55,2.41,2.41,0,0,0,1.25-2.42,2.5,2.5,0,0,0-1.18-2.43,8.8,8.8,0,0,0-3.87-.62ZM38.7,21.81A2.68,2.68,0,0,0,40,19.24a2.44,2.44,0,0,0-1.38-2.56,12.08,12.08,0,0,0-4.5-.62H30.46v6.37h4.29A9.89,9.89,0,0,0,38.7,21.81Z",fill:"#00a9e0"}))},K=Object(i.__)("ActBlue Embed"),Q="actblue/embed",X={title:K,icon:J,description:Object(i.__)("Embed an ActBlue contribution form."),category:"embed",responsive:!1,keywords:[],supports:{align:!0},transforms:q,attributes:{url:{type:"string"},caption:{type:"string",source:"html",selector:"figcaption"},type:{type:"string"},allowResponsive:{type:"boolean",default:!0},refcode:{type:"string"}},edit:W,save:$},Y=["actblue/button"],ee=[["actblue/button"]],te={hasSelectedUI:!1},ne={isEmbedButton:!0};var re=function(e){var t=e.className;return Object(w.createElement)("div",{className:"".concat(t," wp-block-buttons")},Object(w.createElement)(k.__experimentalAlignmentHookSettingsProvider,{value:ne},Object(w.createElement)(k.InnerBlocks,{allowedBlocks:Y,template:ee,__experimentalUIParts:te,__experimentalMoverDirection:"horizontal"})))},oe=function(){return Object(w.createElement)("div",{className:"wp-block-buttons"},Object(w.createElement)(k.InnerBlocks.Content,null))},ce={from:[{type:"block",blocks:["core/buttons"],transform:function(e,t){var n=t.map((function(e){return Object(a.createBlock)("actblue/button",e.attributes)}));return Object(a.createBlock)(ae,{},n)}}],to:[{type:"block",blocks:["core/buttons"],transform:function(e,t){var n=t.map((function(e){return Object(a.createBlock)("core/button",e.attributes)}));return Object(a.createBlock)("core/buttons",e,n)}}]},ae="actblue/buttons",ie={title:Object(i.__)("ActBlue Buttons"),description:Object(i.__)("Prompt visitors to take action with a group of ActBlue donation buttons."),category:"layout",icon:J,keywords:[Object(i.__)("link")],supports:{align:!0,alignWide:!1},edit:re,save:oe,transforms:ce},le=n(13),ue=n.n(le);function se(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function be(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?se(Object(n),!0).forEach((function(t){z()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):se(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var pe=window.getComputedStyle,fe=Object(_.withFallbackStyles)((function(e,t){var n=t.textColor,r=t.backgroundColor,o=r&&r.color,c=n&&n.color,a=!c&&e?e.querySelector('[contenteditable="true"]'):null;return{fallbackBackgroundColor:o||!e?void 0:pe(e).backgroundColor,fallbackTextColor:c||!a?void 0:pe(a).color}}));function de(e){var t=e.borderRadius,n=void 0===t?"":t,r=e.setAttributes,o=Object(w.useCallback)((function(e){r({borderRadius:e})}),[r]);return Object(w.createElement)(_.PanelBody,{title:Object(i.__)("Border settings")},Object(w.createElement)(_.RangeControl,{value:n,label:Object(i.__)("Border radius"),min:0,max:50,initialPosition:5,allowReset:!0,onChange:o}))}var me=Object(L.compose)([Object(k.withColors)("backgroundColor",{textColor:"color"}),fe])((function(e){var t,n=e.attributes,r=e.backgroundColor,o=e.textColor,c=e.setBackgroundColor,a=e.setTextColor,l=e.fallbackBackgroundColor,u=e.fallbackTextColor,s=e.setAttributes,b=e.className,p=n.borderRadius,f=n.placeholder,d=n.text,m=n.endpoint,v=n.refcode,h=n.amount,y=Object(w.useState)(!1),g=ue()(y,2),O=g[0],j=g[1],x=Object(w.useState)(""),E=ue()(x,2),C=E[0],S=E[1],B=Object(w.useState)("Connect"),A=ue()(B,2),R=A[0],P=A[1],T=Object(w.useState)(!1),N=ue()(T,2),L=N[0],I=N[1],M=Object(k.__experimentalUseGradient)(),D=M.gradientClass,G=M.gradientValue,H=M.setGradient;return Object(w.createElement)("div",{className:b},Object(w.createElement)(k.RichText,{placeholder:f||Object(i.__)("Add text…"),value:d,onChange:function(e){return s({text:e})},withoutInteractiveFormatting:!0,className:U()("wp-block-button__link",(t={"has-background":r.color||G},z()(t,r.class,!G&&r.class),z()(t,"has-text-color",o.color),z()(t,o.class,o.class),z()(t,D,D),z()(t,"no-border-radius",0===p),t)),style:be(be({},!r.color&&G?{background:G}:{backgroundColor:r.color}),{},{color:o.color,borderRadius:p?p+"px":void 0})}),Object(w.createElement)(k.InspectorControls,null,Object(w.createElement)(_.PanelBody,{title:Object(i.__)("ActBlue Settings"),className:"actblue-button-settings__panel"},Object(w.createElement)(_.TextControl,{label:"Embed URL",value:m,onChange:function(e){return s({endpoint:e})},help:"Use an ActBlue embedded form URL to connect this button."}),Object(w.createElement)(_.Button,{isSecondary:!0,isBusy:O,onClick:function(){if(m){j(!0),S("");var e="https://secure.actblue.com/cf/oembed?url=".concat(m,"&format=json");fetch(e).then((function(e){if(404===e.status)throw new Error("Error: could not find an ActBlue embeddable form at that URL.");return e.json()})).then((function(e){s({token:e.token}),setTimeout((function(){return I(!1)}),2e3),I(!0)})).catch((function(e){console.error(e),s({token:""}),S(e.message)})).finally((function(){P("Connect"),j(!1)}))}},disabled:O||!m},R),Object(w.createElement)("span",{className:U()("actblue-button-settings__success-message",{"actblue-button-settings__success-message--visible":L})},"Success!"),C&&Object(w.createElement)("p",{className:"actblue-button-settings__fetch-message"},C),Object(w.createElement)(_.HorizontalRule,null),Object(w.createElement)(_.TextControl,{label:"Refcode",value:v,onChange:function(e){return s({refcode:e})},help:"Associate contributions made through this button with a refcode."}),Object(w.createElement)(_.TextControl,{type:"number",label:"Amount",value:h?h/100:"",onChange:function(e){return s({amount:e?100*e:void 0})},help:"Set the amount of the contribution in dollars, leave blank to let the donor choose an amount."})),Object(w.createElement)(k.__experimentalPanelColorGradientSettings,{title:Object(i.__)("Background & Text Color"),settings:[{colorValue:o.color,onColorChange:a,label:Object(i.__)("Text color")},{colorValue:r.color,onColorChange:c,gradientValue:G,onGradientChange:H,label:Object(i.__)("Background")}]},Object(w.createElement)(k.ContrastChecker,{isLargeText:!1,textColor:o.color,backgroundColor:r.color,fallbackBackgroundColor:l,fallbackTextColor:u})),Object(w.createElement)(de,{borderRadius:p,setAttributes:s})))})),ve=function(e){var t,n=e.attributes,r=n.amount,o=n.backgroundColor,c=n.borderRadius,a=n.customBackgroundColor,i=n.customGradient,l=n.customTextColor,u=n.endpoint,s=n.gradient,b=n.refcode,p=n.text,f=n.textColor,d=n.title,m=n.token,v=Object(k.getColorClassName)("color",f),h=!i&&Object(k.getColorClassName)("background-color",o),y=Object(k.__experimentalGetGradientClass)(s),g=U()("wp-block-button__link",(t={"has-text-color":f||l},z()(t,v,v),z()(t,"has-background",o||a||i||s),z()(t,h,h),z()(t,"no-border-radius",0===c),z()(t,y,y),t)),O={background:i||void 0,backgroundColor:h||i||s?void 0:a,color:v?void 0:l,borderRadius:c?c+"px":void 0};return Object(w.createElement)("div",{className:"wp-block-button"},Object(w.createElement)(k.RichText.Content,{tagName:"a",className:"".concat(g," js-actblue-donation-button"),href:u,title:d,style:O,value:p,target:"_blank","data-token":m,"data-refcode":b,"data-amount":r,rel:"noopener noreferrer"}))},he="actblue/button",ye={name:he,icon:J,title:"ActBlue Button",description:"Add a button for an ActBlue contribution.",category:"layout",keywords:[Object(i.__)("link")],example:{attributes:{className:"is-style-fill",backgroundColor:"vivid-green-cyan",text:Object(i.__)("Call to Action")}},supports:{align:!1,alignWide:!1},styles:[{name:"fill",label:Object(i.__)("Fill"),isDefault:!0},{name:"outline",label:Object(i.__)("Outline")}],parent:["actblue/buttons"],attributes:{title:{type:"string",source:"attribute",selector:"a",attribute:"title"},text:{type:"string",source:"html",selector:"a"},backgroundColor:{type:"string"},textColor:{type:"string"},customBackgroundColor:{type:"string"},customTextColor:{type:"string"},placeholder:{type:"string"},borderRadius:{type:"number"},gradient:{type:"string"},customGradient:{type:"string"},token:{type:"string"},endpoint:{type:"string"},refcode:{type:"string"},amount:{type:"number"}},edit:me,save:ve};[r,o,c].forEach((function(e){var t=e.name,n=e.settings;Object(a.registerBlockType)(t,n)}))}]); -
actblue-contributions/trunk/public/js/actblue-contributions.js
r2441023 r2455824 25 25 */ 26 26 const handleButtonClick = (event) => { 27 const { token, refcode } = event.currentTarget.dataset; 27 const { currentTarget } = event; 28 const { token, refcode, amount } = currentTarget.dataset; 28 29 29 30 if (!token) { … … 34 35 } 35 36 36 window.actblue.requestContribution({ token, refcodes: { refcode } }); 37 window.actblue.requestContribution({ 38 token, 39 amount, 40 refcodes: { refcode }, 41 onLanded: () => { 42 currentTarget.classList.remove("is-style-outline"); 43 }, 44 }); 45 currentTarget.classList.add("is-style-outline"); 37 46 event.preventDefault(); 38 47 }; … … 44 53 */ 45 54 const actblueInit = () => { 55 const { actblue } = window; 46 56 if ( 47 typeof window.actblue !== "object" ||48 typeof window.actblue.requestContribution !== "function"57 typeof actblue !== "object" || 58 typeof actblue.requestContribution !== "function" 49 59 ) { 50 60 console.warn("The actblue.js script is not loaded, but is required."); -
actblue-contributions/trunk/readme.txt
r2441023 r2455824 6 6 Tested up to: 5.6 7 7 Requires PHP: 5.6 8 Stable tag: 1. 3.08 Stable tag: 1.4.0 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 102 102 == Changelog == 103 103 104 = 1.4.0 = 105 * ActBlue buttons can pre-select an amount in the form modal that opens 106 * ActBlue buttons changes style on click, to demonstrate that a form modal is loading 107 104 108 = 1.3.0 = 105 109 * Adds refcode support for buttons and embeddable forms
Note: See TracChangeset
for help on using the changeset viewer.