Changeset 2752710
- Timestamp:
- 07/06/2022 05:45:10 PM (4 years ago)
- Location:
- actblue-contributions
- Files:
-
- 53 added
- 6 edited
-
tags/1.5.2 (added)
-
tags/1.5.2/actblue-contributions.php (added)
-
tags/1.5.2/admin (added)
-
tags/1.5.2/admin/class-actblue-admin.php (added)
-
tags/1.5.2/admin/templates (added)
-
tags/1.5.2/admin/templates/actblue-settings-page.php (added)
-
tags/1.5.2/blocks (added)
-
tags/1.5.2/blocks/class-actblue-blocks.php (added)
-
tags/1.5.2/blocks/custom (added)
-
tags/1.5.2/blocks/custom/actblue-button (added)
-
tags/1.5.2/blocks/custom/actblue-button/edit.js (added)
-
tags/1.5.2/blocks/custom/actblue-button/editor.scss (added)
-
tags/1.5.2/blocks/custom/actblue-button/index.js (added)
-
tags/1.5.2/blocks/custom/actblue-button/save.js (added)
-
tags/1.5.2/blocks/custom/actblue-buttons (added)
-
tags/1.5.2/blocks/custom/actblue-buttons/edit.js (added)
-
tags/1.5.2/blocks/custom/actblue-buttons/index.js (added)
-
tags/1.5.2/blocks/custom/actblue-buttons/save.js (added)
-
tags/1.5.2/blocks/custom/actblue-buttons/transforms.js (added)
-
tags/1.5.2/blocks/custom/actblue-embed (added)
-
tags/1.5.2/blocks/custom/actblue-embed/edit.js (added)
-
tags/1.5.2/blocks/custom/actblue-embed/embed-controls.js (added)
-
tags/1.5.2/blocks/custom/actblue-embed/embed-loading.js (added)
-
tags/1.5.2/blocks/custom/actblue-embed/embed-placeholder.js (added)
-
tags/1.5.2/blocks/custom/actblue-embed/embed-preview.js (added)
-
tags/1.5.2/blocks/custom/actblue-embed/index.js (added)
-
tags/1.5.2/blocks/custom/actblue-embed/save.js (added)
-
tags/1.5.2/blocks/custom/actblue-embed/transforms.js (added)
-
tags/1.5.2/blocks/custom/actblue-embed/urlWithQueryConfiguration.js (added)
-
tags/1.5.2/blocks/editor.scss (added)
-
tags/1.5.2/blocks/icons (added)
-
tags/1.5.2/blocks/icons/actblue.js (added)
-
tags/1.5.2/blocks/index.js (added)
-
tags/1.5.2/build (added)
-
tags/1.5.2/build/actblue-contributions.asset.php (added)
-
tags/1.5.2/build/actblue-contributions.js (added)
-
tags/1.5.2/build/blocks.asset.php (added)
-
tags/1.5.2/build/blocks.js (added)
-
tags/1.5.2/build/editor.asset.php (added)
-
tags/1.5.2/build/editor.css (added)
-
tags/1.5.2/build/editor.js (added)
-
tags/1.5.2/e2e-tests (added)
-
tags/1.5.2/e2e-tests/__snapshots__ (added)
-
tags/1.5.2/e2e-tests/__snapshots__/embed-block.spec.js.snap (added)
-
tags/1.5.2/e2e-tests/embed-block.spec.js (added)
-
tags/1.5.2/e2e-tests/helpers.js (added)
-
tags/1.5.2/includes (added)
-
tags/1.5.2/includes/class-actblue.php (added)
-
tags/1.5.2/public (added)
-
tags/1.5.2/public/class-actblue-public.php (added)
-
tags/1.5.2/public/js (added)
-
tags/1.5.2/public/js/actblue-contributions.js (added)
-
tags/1.5.2/readme.txt (added)
-
trunk/actblue-contributions.php (modified) (2 diffs)
-
trunk/build/actblue-contributions.asset.php (modified) (1 diff)
-
trunk/build/blocks.asset.php (modified) (1 diff)
-
trunk/build/blocks.js (modified) (1 diff)
-
trunk/build/editor.asset.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
actblue-contributions/trunk/actblue-contributions.php
r2752221 r2752710 15 15 * Text Domain: actblue 16 16 * Domain Path: /languages 17 * Version: 1.5. 117 * Version: 1.5.2 18 18 */ 19 19 … … 26 26 * Current plugin version. 27 27 */ 28 define( 'ACTBLUE_PLUGIN_VERSION', '1.5. 1' );28 define( 'ACTBLUE_PLUGIN_VERSION', '1.5.2' ); 29 29 30 30 /** -
actblue-contributions/trunk/build/actblue-contributions.asset.php
r2722208 r2752710 1 <?php return array('dependencies' => array( 'wp-polyfill'), 'version' => '7b78fc9ac0014463af19a911e1183a9c');1 <?php return array('dependencies' => array(), 'version' => '7aff61ce7493397d80d5'); -
actblue-contributions/trunk/build/blocks.asset.php
r2752221 r2752710 1 <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-p olyfill', 'wp-primitives'), 'version' => '064c26a0ffffeaaba40bf0156b01606b');1 <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '0ffb57ce6c9f93ba5490'); -
actblue-contributions/trunk/build/blocks.js
r2752221 r2752710 1 (()=>{var e={991:(e,t)=>{var o;!function(){"use strict";var r=function(){function e(){}function t(e,t){for(var o=t.length,r=0;r<o;++r)n(e,t[r])}e.prototype=Object.create(null);var o={}.hasOwnProperty,r=/\s+/;function n(e,n){if(n){var a=typeof n;"string"===a?function(e,t){for(var o=t.split(r),n=o.length,a=0;a<n;++a)e[o[a]]=!0}(e,n):Array.isArray(n)?t(e,n):"object"===a?function(e,t){ for(var r in t)o.call(t,r)&&(e[r]=!!t[r])}(e,n):"number"===a&&function(e,t){e[t]=!0}(e,n)}}return function(){for(var o=arguments.length,r=Array(o),n=0;n<o;n++)r[n]=arguments[n];var a=new e;t(a,r);var l=[];for(var s in a)a[s]&&l.push(s);return l.join(" ")}}();e.exports?(r.default=r,e.exports=r):void 0===(o=function(){return r}.apply(t,[]))||(e.exports=o)}()},184:(e,t)=>{var o;!function(){"use strict";var r={}.hasOwnProperty;function n(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var a=typeof o;if("string"===a||"number"===a)e.push(o);else if(Array.isArray(o)&&o.length){var l=n.apply(null,o);l&&e.push(l)}else if("object"===a)for(var s in o)r.call(o,s)&&o[s]&&e.push(s)}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):void 0===(o=function(){return n}.apply(t,[]))||(e.exports=o)}()}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e={};o.r(e),o.d(e,{icon:()=>A,name:()=>T,settings:()=>N,title:()=>R});var t={};o.r(t),o.d(t,{name:()=>O,settings:()=>j});var r={};o.r(r),o.d(r,{name:()=>H,settings:()=>V});const n=window.wp.blocks,a=window.wp.i18n;function l(){return l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},l.apply(this,arguments)}const s=window.wp.element,i=window.wp.components,c=window.wp.blockEditor,u=window.wp.primitives,d=(0,s.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(u.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"})),p=e=>{const{showEditButton:t,switchBackToURLInput:o}=e;return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(c.BlockControls,null,(0,s.createElement)(i.ToolbarGroup,null,t&&(0,s.createElement)(i.Button,{className:"components-toolbar__control",label:(0,a.__)("Edit URL"),icon:d,onClick:o}))))},m=()=>(0,s.createElement)("div",{className:"wp-block-embed is-loading"},(0,s.createElement)(i.Spinner,null),(0,s.createElement)("p",null,(0,a.__)("Embedding…"))),b=e=>{const{icon:t,label:o,value:r,onSubmit:n,onChange:l,cannotEmbed:u,fallback:d,tryAgain:p}=e;return(0,s.createElement)(i.Placeholder,{icon:(0,s.createElement)(c.BlockIcon,{icon:t,showColors:!0}),label:o,className:"wp-block-embed",instructions:(0,a.__)("Paste a link to the content you want to display on your site.")},(0,s.createElement)("form",{onSubmit:n},(0,s.createElement)("input",{type:"url",value:r||"",className:"components-placeholder__input","aria-label":o,placeholder:(0,a.__)("Enter URL to embed here…"),onChange:l}),(0,s.createElement)(i.Button,{isSecondary:!0,type:"submit"},(0,a._x)("Embed","button label"))),(0,s.createElement)("div",{className:"components-placeholder__learn-more"},(0,s.createElement)(i.ExternalLink,{href:(0,a.__)("https://wordpress.org/support/article/embeds/")},(0,a.__)("Learn more about embeds"))),u&&(0,s.createElement)("div",{className:"components-placeholder__error"},(0,s.createElement)("div",{className:"components-placeholder__instructions"},(0,a.__)("Sorry, this content could not be embedded.")),(0,s.createElement)(i.Button,{isSecondary:!0,onClick:p},(0,a._x)("Try again","button label"))," ",(0,s.createElement)(i.Button,{isSecondary:!0,onClick:d},(0,a._x)("Convert to link","button label"))))};var h=o(991),g=o.n(h);class v extends s.Component{constructor(){super(...arguments),this.hideOverlay=this.hideOverlay.bind(this),this.state={interactive:!1}}static getDerivedStateFromProps(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}hideOverlay(){this.setState({interactive:!0})}render(){const{preview:e,url:t,type:o,caption:r,onCaptionChange:n,isSelected:l,className:i,icon:u,label:d}=this.props,{interactive:p}=this.state,m=e.html,b=(0,s.createElement)("div",{className:"wp-block-embed__wrapper"},(0,s.createElement)("div",{dangerouslySetInnerHTML:{__html:m}}),!p&&(0,s.createElement)("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}));return(0,s.createElement)("figure",{className:g()(i,"wp-block-embed",{"is-type-video":"video"===o})},b,(!c.RichText.isEmpty(r)||l)&&(0,s.createElement)(c.RichText,{tagName:"figcaption",placeholder:(0,a.__)("Write caption…"),value:r,onChange:n,inlineToolbar:!0}))}}const f=v;var y=o(184),w=o.n(y);const _=window.wp.compose,k=window.wp.data,E=e=>{let{url:t,...o}=e;const r=[];Object.keys(o).map((e=>{o[e]&&r.push(`${encodeURIComponent(e)}=${encodeURIComponent(o[e])}`)}));const n=!!r.length&&r.join("&");return t&&n?`${t}?${n}`:t};class C extends s.Component{constructor(){super(...arguments),this.switchBackToURLInput=this.switchBackToURLInput.bind(this),this.setUrl=this.setUrl.bind(this),this.handleIncomingPreview=this.handleIncomingPreview.bind(this),this.state={editingURL:!1,url:this.props.attributes.url},this.props.preview&&this.handleIncomingPreview()}handleIncomingPreview(){const{setAttributes:e}=this.props;e(this.props.attributes)}componentDidUpdate(e){const t=void 0!==this.props.preview,o=void 0!==e.preview,r=e.preview&&this.props.preview&&this.props.preview.html!==e.preview.html||t&&!o,n=this.props.attributes.url!==e.attributes.url;if(r||n){if(this.props.cannotEmbed)return void(this.props.fetching||this.resubmitWithoutTrailingSlash());this.handleIncomingPreview()}}resubmitWithoutTrailingSlash(){this.setState((e=>({url:e.url.replace(/\/$/,"")})),this.setUrl)}setUrl(e){e&&e.preventDefault();const{url:t}=this.state,{setAttributes:o}=this.props;0===t.indexOf("https://secure.actblue.com")?(this.setState({editingURL:!1}),o({url:t})):console.error("Can not use ActBlue Embed block to embed non-ActBlue urls")}switchBackToURLInput(){this.setState({editingURL:!0}),this.props.clearActBlueSettings()}render(){const{url:e,editingURL:t}=this.state,{fetching:o,setAttributes:r,isSelected:a,preview:l,cannotEmbed:i,tryAgain:c}=this.props;if(o)return(0,s.createElement)(m,null);const u="ActBlue URL";if(!l||i||t)return(0,s.createElement)(b,{icon:A,label:u,onSubmit:this.setUrl,value:e,cannotEmbed:i,onChange:e=>this.setState({url:e.target.value}),fallback:()=>function(e,t){const o=(0,s.createElement)("a",{href:e},e);t((0,n.createBlock)("core/paragraph",{content:(0,s.renderToString)(o)}))}(e,this.props.onReplace),tryAgain:c});const{caption:d,type:h}=this.props.attributes,g=w()(this.props.attributes.className,this.props.className);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p,{showEditButton:l&&!i,switchBackToURLInput:this.switchBackToURLInput}),(0,s.createElement)(f,{preview:l,className:g,url:e,type:h,caption:d,onCaptionChange:e=>r({caption:e}),isSelected:a,icon:A,label:u}))}}class x extends s.Component{constructor(){super(...arguments),this.clearActBlueSettings=this.clearActBlueSettings.bind(this)}clearActBlueSettings(){this.props.setAttributes({refcode:""})}render(){return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(C,l({},this.props,{clearActBlueSettings:this.clearActBlueSettings})),(0,s.createElement)(c.InspectorControls,null,(0,s.createElement)(i.PanelBody,{title:(0,a.__)("ActBlue Settings"),className:"actblue-embed-settings__panel"},(0,s.createElement)(i.TextControl,{label:"Refcode",value:this.props.attributes.refcode,onChange:e=>this.props.setAttributes({refcode:e}),help:"Add a refcode to this embed form."}))))}}const B=(0,_.compose)((0,k.withSelect)(((e,t)=>{const{url:o}=t.attributes,r=E({url:o,preview:"true"}),n=e("core"),{getEmbedPreview:a,isPreviewEmbedFallback:l,isRequestingEmbedPreview:s}=n,i=void 0!==r&&a(r),c=void 0!==r&&l(r),u=void 0!==r&&s(r),d=!!i&&void 0===i.type&&!1===i.html,p=!!i&&i.data&&404===i.data.status,m=!!i&&!d&&!p;return{preview:m?i:void 0,fetching:u,cannotEmbed:void 0!==r&&(!m||c)}})),(0,k.withDispatch)(((e,t)=>{const{url:o}=t.attributes,r=e("core/data");return{tryAgain:()=>{r.invalidateResolution("core","getEmbedPreview",[o])}}})))(x),S={from:[{type:"raw",isMatch:e=>"P"===e.nodeName&&/^\s*(https?:\/\/secure\.actblue\.com\S+)\s*$/i.test(e.textContent),transform:e=>(0,n.createBlock)(T,{url:e.textContent.trim()})}]},A=()=>(0,s.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 46.32 27.69"},(0,s.createElement)(u.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"})),R=(0,a.__)("ActBlue Embed"),T="actblue/embed",N={title:R,icon:A,description:(0,a.__)("Embed an ActBlue contribution form."),category:"embed",responsive:!1,keywords:[],supports:{align:!0},transforms:S,attributes:{url:{type:"string"},caption:{type:"string",source:"html",selector:"figcaption"},type:{type:"string"},allowResponsive:{type:"boolean",default:!0},refcode:{type:"string"}},edit:B,save:e=>{let{attributes:t}=e;const{url:o,caption:r,type:n,refcode:a}=t;if(!o)return null;const l=g()("wp-block-embed","is-provider-actblue",{[`is-type-${n}`]:n});return(0,s.createElement)("figure",{className:l},(0,s.createElement)("div",{className:"wp-block-embed__wrapper"},`\n${E({url:o,refcode:a})}\n`),!c.RichText.isEmpty(r)&&(0,s.createElement)(c.RichText.Content,{tagName:"figcaption",value:r}))}},P=["actblue/button"],U=[["actblue/button"]],L={hasSelectedUI:!1},I={from:[{type:"block",blocks:["core/buttons"],transform:(e,t)=>{const o=t.map((e=>(0,n.createBlock)("actblue/button",e.attributes)));return(0,n.createBlock)(O,{},o)}}],to:[{type:"block",blocks:["core/buttons"],transform:(e,t)=>{const o=t.map((e=>(0,n.createBlock)("core/button",e.attributes)));return(0,n.createBlock)("core/buttons",e,o)}}]},O="actblue/buttons",j={title:(0,a.__)("ActBlue Buttons"),description:(0,a.__)("Prompt visitors to take action with a group of ActBlue donation buttons."),category:"layout",icon:A,keywords:[(0,a.__)("link")],supports:{align:!0,alignWide:!1},edit:function(e){let{className:t}=e;return(0,s.createElement)("div",{className:`${t} wp-block-buttons`},(0,s.createElement)(c.InnerBlocks,{allowedBlocks:P,template:U,__experimentalUIParts:L,__experimentalMoverDirection:"horizontal"}))},save:()=>(0,s.createElement)("div",{className:"wp-block-buttons"},(0,s.createElement)(c.InnerBlocks.Content,null)),transforms:I},{getComputedStyle:M}=window,G=(0,i.withFallbackStyles)(((e,t)=>{const{textColor:o,backgroundColor:r}=t,n=r&&r.color,a=o&&o.color,l=!a&&e?e.querySelector('[contenteditable="true"]'):null;return{fallbackBackgroundColor:n||!e?void 0:M(e).backgroundColor,fallbackTextColor:a||!l?void 0:M(l).color}}));function $(e){let{borderRadius:t="",setAttributes:o}=e;const r=(0,s.useCallback)((e=>{o({borderRadius:e})}),[o]);return(0,s.createElement)(i.PanelBody,{title:(0,a.__)("Border settings")},(0,s.createElement)(i.RangeControl,{value:t,label:(0,a.__)("Border radius"),min:0,max:50,initialPosition:5,allowReset:!0,onChange:r}))}const F=(0,_.compose)([(0,c.withColors)("backgroundColor",{textColor:"color"}),G])((function(e){let{attributes:t,backgroundColor:o,textColor:r,setBackgroundColor:n,setTextColor:l,fallbackBackgroundColor:u,fallbackTextColor:d,setAttributes:p,className:m}=e;const{borderRadius:b,placeholder:h,text:g,endpoint:v,refcode:f,amount:y}=t,[_,k]=(0,s.useState)(!1),[E,C]=(0,s.useState)(""),[x,B]=(0,s.useState)("Connect"),[S,A]=(0,s.useState)(!1),{gradientClass:R,gradientValue:T,setGradient:N}=(0,c.__experimentalUseGradient)();return(0,s.createElement)("div",{className:m},(0,s.createElement)(c.RichText,{placeholder:h||(0,a.__)("Add text…"),value:g,onChange:e=>p({text:e}),withoutInteractiveFormatting:!0,className:w()("wp-block-button__link",{"has-background":o.color||T,[o.class]:!T&&o.class,"has-text-color":r.color,[r.class]:r.class,[R]:R,"no-border-radius":0===b}),style:{...!o.color&&T?{background:T}:{backgroundColor:o.color},color:r.color,borderRadius:b?b+"px":void 0}}),(0,s.createElement)(c.InspectorControls,null,(0,s.createElement)(i.PanelBody,{title:(0,a.__)("ActBlue Settings"),className:"actblue-button-settings__panel"},(0,s.createElement)(i.TextControl,{label:"Embed URL",value:v,onChange:e=>p({endpoint:e}),help:"Use an ActBlue embedded form URL to connect this button."}),(0,s.createElement)(i.Button,{isSecondary:!0,isBusy:_,onClick:()=>{v&&(k(!0),C(""),fetch(`https://secure.actblue.com/cf/oembed?url=${v}&format=json`).then((e=>{if(404===e.status)throw new Error("Error: could not find an ActBlue embeddable form at that URL.");return e.json()})).then((e=>{p({token:e.token}),setTimeout((()=>A(!1)),2e3),A(!0)})).catch((e=>{console.error(e),p({token:""}),C(e.message)})).finally((()=>{B("Connect"),k(!1)})))},disabled:_||!v},x),(0,s.createElement)("span",{className:w()("actblue-button-settings__success-message",{"actblue-button-settings__success-message--visible":S})},"Success!"),E&&(0,s.createElement)("p",{className:"actblue-button-settings__fetch-message"},E),(0,s.createElement)(i.HorizontalRule,null),(0,s.createElement)(i.TextControl,{label:"Refcode",value:f,onChange:e=>p({refcode:e}),help:"Associate contributions made through this button with a refcode."}),(0,s.createElement)(i.TextControl,{type:"number",label:"Amount",value:y?y/100:"",onChange:e=>p({amount:e?100*e:void 0}),help:"Set the amount of the contribution in dollars, leave blank to let the donor choose an amount."})),(0,s.createElement)(c.__experimentalPanelColorGradientSettings,{title:(0,a.__)("Background & Text Color"),settings:[{colorValue:r.color,onColorChange:l,label:(0,a.__)("Text color")},{colorValue:o.color,onColorChange:n,gradientValue:T,onGradientChange:N,label:(0,a.__)("Background")}]},(0,s.createElement)(c.ContrastChecker,{isLargeText:!1,textColor:r.color,backgroundColor:o.color,fallbackBackgroundColor:u,fallbackTextColor:d})),(0,s.createElement)($,{borderRadius:b,setAttributes:p})))})),H="actblue/button",V={name:H,icon:A,title:"ActBlue Button",description:"Add a button for an ActBlue contribution.",category:"layout",keywords:[(0,a.__)("link")],example:{attributes:{className:"is-style-fill",backgroundColor:"vivid-green-cyan",text:(0,a.__)("Call to Action")}},supports:{align:!1,alignWide:!1},styles:[{name:"fill",label:(0,a.__)("Fill"),isDefault:!0},{name:"outline",label:(0,a.__)("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:F,save:e=>{let{attributes:t}=e;const{amount:o,backgroundColor:r,borderRadius:n,customBackgroundColor:a,customGradient:l,customTextColor:i,endpoint:u,gradient:d,refcode:p,text:m,textColor:b,title:h,token:g}=t,v=(0,c.getColorClassName)("color",b),f=!l&&(0,c.getColorClassName)("background-color",r),y=(0,c.__experimentalGetGradientClass)(d),_=w()("wp-block-button__link",{"has-text-color":b||i,[v]:v,"has-background":r||a||l||d,[f]:f,"no-border-radius":0===n,[y]:y}),k={background:l||void 0,backgroundColor:f||l||d?void 0:a,color:v?void 0:i,borderRadius:n?n+"px":void 0};return(0,s.createElement)("div",{className:"wp-block-button"},(0,s.createElement)(c.RichText.Content,{tagName:"a",className:`${_} js-actblue-donation-button`,href:u,title:h,style:k,value:m,target:"_blank","data-token":g,"data-refcode":p,"data-amount":o,rel:"noopener noreferrer"}))}};[e,t,r].forEach((e=>{let{name:t,settings:o}=e;(0,n.registerBlockType)(t,o)}))})()})();1 (()=>{var e={991:(e,t)=>{var o;!function(){"use strict";var r=function(){function e(){}function t(e,t){for(var o=t.length,r=0;r<o;++r)n(e,t[r])}e.prototype=Object.create(null);var o={}.hasOwnProperty,r=/\s+/;function n(e,n){if(n){var a=typeof n;"string"===a?function(e,t){for(var o=t.split(r),n=o.length,a=0;a<n;++a)e[o[a]]=!0}(e,n):Array.isArray(n)?t(e,n):"object"===a?function(e,t){if(t.toString===Object.prototype.toString)for(var r in t)o.call(t,r)&&(e[r]=!!t[r]);else e[t.toString()]=!0}(e,n):"number"===a&&function(e,t){e[t]=!0}(e,n)}}return function(){for(var o=arguments.length,r=Array(o),n=0;n<o;n++)r[n]=arguments[n];var a=new e;t(a,r);var l=[];for(var s in a)a[s]&&l.push(s);return l.join(" ")}}();e.exports?(r.default=r,e.exports=r):void 0===(o=function(){return r}.apply(t,[]))||(e.exports=o)}()},184:(e,t)=>{var o;!function(){"use strict";var r={}.hasOwnProperty;function n(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var a=typeof o;if("string"===a||"number"===a)e.push(o);else if(Array.isArray(o)){if(o.length){var l=n.apply(null,o);l&&e.push(l)}}else if("object"===a)if(o.toString===Object.prototype.toString)for(var s in o)r.call(o,s)&&o[s]&&e.push(s);else e.push(o.toString())}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):void 0===(o=function(){return n}.apply(t,[]))||(e.exports=o)}()}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e={};o.r(e),o.d(e,{icon:()=>A,name:()=>T,settings:()=>N,title:()=>R});var t={};o.r(t),o.d(t,{name:()=>O,settings:()=>j});var r={};o.r(r),o.d(r,{name:()=>H,settings:()=>V});const n=window.wp.blocks,a=window.wp.i18n;function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},l.apply(this,arguments)}const s=window.wp.element,i=window.wp.components,c=window.wp.blockEditor,u=window.wp.primitives,d=(0,s.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(u.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"})),p=e=>{const{showEditButton:t,switchBackToURLInput:o}=e;return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(c.BlockControls,null,(0,s.createElement)(i.ToolbarGroup,null,t&&(0,s.createElement)(i.Button,{className:"components-toolbar__control",label:(0,a.__)("Edit URL"),icon:d,onClick:o}))))},m=()=>(0,s.createElement)("div",{className:"wp-block-embed is-loading"},(0,s.createElement)(i.Spinner,null),(0,s.createElement)("p",null,(0,a.__)("Embedding…"))),b=e=>{const{icon:t,label:o,value:r,onSubmit:n,onChange:l,cannotEmbed:u,fallback:d,tryAgain:p}=e;return(0,s.createElement)(i.Placeholder,{icon:(0,s.createElement)(c.BlockIcon,{icon:t,showColors:!0}),label:o,className:"wp-block-embed",instructions:(0,a.__)("Paste a link to the content you want to display on your site.")},(0,s.createElement)("form",{onSubmit:n},(0,s.createElement)("input",{type:"url",value:r||"",className:"components-placeholder__input","aria-label":o,placeholder:(0,a.__)("Enter URL to embed here…"),onChange:l}),(0,s.createElement)(i.Button,{isSecondary:!0,type:"submit"},(0,a._x)("Embed","button label"))),(0,s.createElement)("div",{className:"components-placeholder__learn-more"},(0,s.createElement)(i.ExternalLink,{href:(0,a.__)("https://wordpress.org/support/article/embeds/")},(0,a.__)("Learn more about embeds"))),u&&(0,s.createElement)("div",{className:"components-placeholder__error"},(0,s.createElement)("div",{className:"components-placeholder__instructions"},(0,a.__)("Sorry, this content could not be embedded.")),(0,s.createElement)(i.Button,{isSecondary:!0,onClick:p},(0,a._x)("Try again","button label"))," ",(0,s.createElement)(i.Button,{isSecondary:!0,onClick:d},(0,a._x)("Convert to link","button label"))))};var h=o(991),g=o.n(h);class v extends s.Component{constructor(){super(...arguments),this.hideOverlay=this.hideOverlay.bind(this),this.state={interactive:!1}}static getDerivedStateFromProps(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}hideOverlay(){this.setState({interactive:!0})}render(){const{preview:e,url:t,type:o,caption:r,onCaptionChange:n,isSelected:l,className:i,icon:u,label:d}=this.props,{interactive:p}=this.state,m=e.html,b=(0,s.createElement)("div",{className:"wp-block-embed__wrapper"},(0,s.createElement)("div",{dangerouslySetInnerHTML:{__html:m}}),!p&&(0,s.createElement)("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}));return(0,s.createElement)("figure",{className:g()(i,"wp-block-embed",{"is-type-video":"video"===o})},b,(!c.RichText.isEmpty(r)||l)&&(0,s.createElement)(c.RichText,{tagName:"figcaption",placeholder:(0,a.__)("Write caption…"),value:r,onChange:n,inlineToolbar:!0}))}}const f=v;var y=o(184),w=o.n(y);const _=window.wp.compose,k=window.wp.data,E=e=>{let{url:t,...o}=e;const r=[];Object.keys(o).map((e=>{o[e]&&r.push(`${encodeURIComponent(e)}=${encodeURIComponent(o[e])}`)}));const n=!!r.length&&r.join("&");return t&&n?`${t}?${n}`:t};class C extends s.Component{constructor(){super(...arguments),this.switchBackToURLInput=this.switchBackToURLInput.bind(this),this.setUrl=this.setUrl.bind(this),this.handleIncomingPreview=this.handleIncomingPreview.bind(this),this.state={editingURL:!1,url:this.props.attributes.url},this.props.preview&&this.handleIncomingPreview()}handleIncomingPreview(){const{setAttributes:e}=this.props;e(this.props.attributes)}componentDidUpdate(e){const t=void 0!==this.props.preview,o=void 0!==e.preview,r=e.preview&&this.props.preview&&this.props.preview.html!==e.preview.html||t&&!o,n=this.props.attributes.url!==e.attributes.url;if(r||n){if(this.props.cannotEmbed)return void(this.props.fetching||this.resubmitWithoutTrailingSlash());this.handleIncomingPreview()}}resubmitWithoutTrailingSlash(){this.setState((e=>({url:e.url.replace(/\/$/,"")})),this.setUrl)}setUrl(e){e&&e.preventDefault();const{url:t}=this.state,{setAttributes:o}=this.props;0===t.indexOf("https://secure.actblue.com")?(this.setState({editingURL:!1}),o({url:t})):console.error("Can not use ActBlue Embed block to embed non-ActBlue urls")}switchBackToURLInput(){this.setState({editingURL:!0}),this.props.clearActBlueSettings()}render(){const{url:e,editingURL:t}=this.state,{fetching:o,setAttributes:r,isSelected:a,preview:l,cannotEmbed:i,tryAgain:c}=this.props;if(o)return(0,s.createElement)(m,null);const u="ActBlue URL";if(!l||i||t)return(0,s.createElement)(b,{icon:A,label:u,onSubmit:this.setUrl,value:e,cannotEmbed:i,onChange:e=>this.setState({url:e.target.value}),fallback:()=>function(e,t){const o=(0,s.createElement)("a",{href:e},e);t((0,n.createBlock)("core/paragraph",{content:(0,s.renderToString)(o)}))}(e,this.props.onReplace),tryAgain:c});const{caption:d,type:h}=this.props.attributes,g=w()(this.props.attributes.className,this.props.className);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p,{showEditButton:l&&!i,switchBackToURLInput:this.switchBackToURLInput}),(0,s.createElement)(f,{preview:l,className:g,url:e,type:h,caption:d,onCaptionChange:e=>r({caption:e}),isSelected:a,icon:A,label:u}))}}class x extends s.Component{constructor(){super(...arguments),this.clearActBlueSettings=this.clearActBlueSettings.bind(this)}clearActBlueSettings(){this.props.setAttributes({refcode:""})}render(){return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(C,l({},this.props,{clearActBlueSettings:this.clearActBlueSettings})),(0,s.createElement)(c.InspectorControls,null,(0,s.createElement)(i.PanelBody,{title:(0,a.__)("ActBlue Settings"),className:"actblue-embed-settings__panel"},(0,s.createElement)(i.TextControl,{label:"Refcode",value:this.props.attributes.refcode,onChange:e=>this.props.setAttributes({refcode:e}),help:"Add a refcode to this embed form."}))))}}const B=(0,_.compose)((0,k.withSelect)(((e,t)=>{const{url:o}=t.attributes,r=E({url:o,preview:"true"}),n=e("core"),{getEmbedPreview:a,isPreviewEmbedFallback:l,isRequestingEmbedPreview:s}=n,i=void 0!==r&&a(r),c=void 0!==r&&l(r),u=void 0!==r&&s(r),d=!!i&&void 0===i.type&&!1===i.html,p=!!i&&i.data&&404===i.data.status,m=!!i&&!d&&!p;return{preview:m?i:void 0,fetching:u,cannotEmbed:void 0!==r&&(!m||c)}})),(0,k.withDispatch)(((e,t)=>{const{url:o}=t.attributes,r=e("core/data");return{tryAgain:()=>{r.invalidateResolution("core","getEmbedPreview",[o])}}})))(x),S={from:[{type:"raw",isMatch:e=>"P"===e.nodeName&&/^\s*(https?:\/\/secure\.actblue\.com\S+)\s*$/i.test(e.textContent),transform:e=>(0,n.createBlock)(T,{url:e.textContent.trim()})}]},A=()=>(0,s.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 46.32 27.69"},(0,s.createElement)(u.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"})),R=(0,a.__)("ActBlue Embed"),T="actblue/embed",N={title:R,icon:A,description:(0,a.__)("Embed an ActBlue contribution form."),category:"embed",responsive:!1,keywords:[],supports:{align:!0},transforms:S,attributes:{url:{type:"string"},caption:{type:"string",source:"html",selector:"figcaption"},type:{type:"string"},allowResponsive:{type:"boolean",default:!0},refcode:{type:"string"}},edit:B,save:e=>{let{attributes:t}=e;const{url:o,caption:r,type:n,refcode:a}=t;if(!o)return null;const l=g()("wp-block-embed","is-provider-actblue",{[`is-type-${n}`]:n});return(0,s.createElement)("figure",{className:l},(0,s.createElement)("div",{className:"wp-block-embed__wrapper"},`\n${E({url:o,refcode:a})}\n`),!c.RichText.isEmpty(r)&&(0,s.createElement)(c.RichText.Content,{tagName:"figcaption",value:r}))}},P=["actblue/button"],U=[["actblue/button"]],L={hasSelectedUI:!1},I={from:[{type:"block",blocks:["core/buttons"],transform:(e,t)=>{const o=t.map((e=>(0,n.createBlock)("actblue/button",e.attributes)));return(0,n.createBlock)(O,{},o)}}],to:[{type:"block",blocks:["core/buttons"],transform:(e,t)=>{const o=t.map((e=>(0,n.createBlock)("core/button",e.attributes)));return(0,n.createBlock)("core/buttons",e,o)}}]},O="actblue/buttons",j={title:(0,a.__)("ActBlue Buttons"),description:(0,a.__)("Prompt visitors to take action with a group of ActBlue donation buttons."),category:"layout",icon:A,keywords:[(0,a.__)("link")],supports:{align:!0,alignWide:!1},edit:function(e){let{className:t}=e;return(0,s.createElement)("div",{className:`${t} wp-block-buttons`},(0,s.createElement)(c.InnerBlocks,{allowedBlocks:P,template:U,__experimentalUIParts:L,__experimentalMoverDirection:"horizontal"}))},save:()=>(0,s.createElement)("div",{className:"wp-block-buttons"},(0,s.createElement)(c.InnerBlocks.Content,null)),transforms:I},{getComputedStyle:M}=window,G=(0,i.withFallbackStyles)(((e,t)=>{const{textColor:o,backgroundColor:r}=t,n=r&&r.color,a=o&&o.color,l=!a&&e?e.querySelector('[contenteditable="true"]'):null;return{fallbackBackgroundColor:n||!e?void 0:M(e).backgroundColor,fallbackTextColor:a||!l?void 0:M(l).color}}));function $(e){let{borderRadius:t="",setAttributes:o}=e;const r=(0,s.useCallback)((e=>{o({borderRadius:e})}),[o]);return(0,s.createElement)(i.PanelBody,{title:(0,a.__)("Border settings")},(0,s.createElement)(i.RangeControl,{value:t,label:(0,a.__)("Border radius"),min:0,max:50,initialPosition:5,allowReset:!0,onChange:r}))}const F=(0,_.compose)([(0,c.withColors)("backgroundColor",{textColor:"color"}),G])((function(e){let{attributes:t,backgroundColor:o,textColor:r,setBackgroundColor:n,setTextColor:l,fallbackBackgroundColor:u,fallbackTextColor:d,setAttributes:p,className:m}=e;const{borderRadius:b,placeholder:h,text:g,endpoint:v,refcode:f,amount:y}=t,[_,k]=(0,s.useState)(!1),[E,C]=(0,s.useState)(""),[x,B]=(0,s.useState)("Connect"),[S,A]=(0,s.useState)(!1),{gradientClass:R,gradientValue:T,setGradient:N}=(0,c.__experimentalUseGradient)();return(0,s.createElement)("div",{className:m},(0,s.createElement)(c.RichText,{placeholder:h||(0,a.__)("Add text…"),value:g,onChange:e=>p({text:e}),withoutInteractiveFormatting:!0,className:w()("wp-block-button__link",{"has-background":o.color||T,[o.class]:!T&&o.class,"has-text-color":r.color,[r.class]:r.class,[R]:R,"no-border-radius":0===b}),style:{...!o.color&&T?{background:T}:{backgroundColor:o.color},color:r.color,borderRadius:b?b+"px":void 0}}),(0,s.createElement)(c.InspectorControls,null,(0,s.createElement)(i.PanelBody,{title:(0,a.__)("ActBlue Settings"),className:"actblue-button-settings__panel"},(0,s.createElement)(i.TextControl,{label:"Embed URL",value:v,onChange:e=>p({endpoint:e}),help:"Use an ActBlue embedded form URL to connect this button."}),(0,s.createElement)(i.Button,{isSecondary:!0,isBusy:_,onClick:()=>{v&&(k(!0),C(""),fetch(`https://secure.actblue.com/cf/oembed?url=${v}&format=json`).then((e=>{if(404===e.status)throw new Error("Error: could not find an ActBlue embeddable form at that URL.");return e.json()})).then((e=>{p({token:e.token}),setTimeout((()=>A(!1)),2e3),A(!0)})).catch((e=>{console.error(e),p({token:""}),C(e.message)})).finally((()=>{B("Connect"),k(!1)})))},disabled:_||!v},x),(0,s.createElement)("span",{className:w()("actblue-button-settings__success-message",{"actblue-button-settings__success-message--visible":S})},"Success!"),E&&(0,s.createElement)("p",{className:"actblue-button-settings__fetch-message"},E),(0,s.createElement)(i.HorizontalRule,null),(0,s.createElement)(i.TextControl,{label:"Refcode",value:f,onChange:e=>p({refcode:e}),help:"Associate contributions made through this button with a refcode."}),(0,s.createElement)(i.TextControl,{type:"number",label:"Amount",value:y?y/100:"",onChange:e=>p({amount:e?100*e:void 0}),help:"Set the amount of the contribution in dollars, leave blank to let the donor choose an amount."})),(0,s.createElement)(c.__experimentalPanelColorGradientSettings,{title:(0,a.__)("Background & Text Color"),settings:[{colorValue:r.color,onColorChange:l,label:(0,a.__)("Text color")},{colorValue:o.color,onColorChange:n,gradientValue:T,onGradientChange:N,label:(0,a.__)("Background")}]},(0,s.createElement)(c.ContrastChecker,{isLargeText:!1,textColor:r.color,backgroundColor:o.color,fallbackBackgroundColor:u,fallbackTextColor:d})),(0,s.createElement)($,{borderRadius:b,setAttributes:p})))})),H="actblue/button",V={name:H,icon:A,title:"ActBlue Button",description:"Add a button for an ActBlue contribution.",category:"layout",keywords:[(0,a.__)("link")],example:{attributes:{className:"is-style-fill",backgroundColor:"vivid-green-cyan",text:(0,a.__)("Call to Action")}},supports:{align:!1,alignWide:!1},styles:[{name:"fill",label:(0,a.__)("Fill"),isDefault:!0},{name:"outline",label:(0,a.__)("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:F,save:e=>{let{attributes:t}=e;const{amount:o,backgroundColor:r,borderRadius:n,customBackgroundColor:a,customGradient:l,customTextColor:i,endpoint:u,gradient:d,refcode:p,text:m,textColor:b,title:h,token:g}=t,v=(0,c.getColorClassName)("color",b),f=!l&&(0,c.getColorClassName)("background-color",r),y=(0,c.__experimentalGetGradientClass)(d),_=w()("wp-block-button__link",{"has-text-color":b||i,[v]:v,"has-background":r||a||l||d,[f]:f,"no-border-radius":0===n,[y]:y}),k={background:l||void 0,backgroundColor:f||l||d?void 0:a,color:v?void 0:i,borderRadius:n?n+"px":void 0};return(0,s.createElement)("div",{className:"wp-block-button"},(0,s.createElement)(c.RichText.Content,{tagName:"a",className:`${_} js-actblue-donation-button`,href:u,title:h,style:k,value:m,target:"_blank","data-token":g,"data-refcode":p,"data-amount":o,rel:"noopener noreferrer"}))}};[e,t,r].forEach((e=>{let{name:t,settings:o}=e;(0,n.registerBlockType)(t,o)}))})()})(); -
actblue-contributions/trunk/build/editor.asset.php
r2722208 r2752710 1 <?php return array('dependencies' => array( 'wp-polyfill'), 'version' => 'c1b34ac5b079b34027f12faa66929287');1 <?php return array('dependencies' => array(), 'version' => '27969ead4f3e10c3ca29'); -
actblue-contributions/trunk/readme.txt
r2752221 r2752710 4 4 Tags: donate,donation,fundraising,giving,charity,nonprofit,contribute,contributions 5 5 Requires at least: 4.5 6 Tested up to: 5.86 Tested up to: 6.0 7 7 Requires PHP: 5.6 8 Stable tag: 1.5. 18 Stable tag: 1.5.2 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.5.2 = 105 * Tested up to Wordpress 6.0 106 * Updates dependencies 107 104 108 = 1.5.1 = 105 109 * Tested up to Wordpress 5.8.1
Note: See TracChangeset
for help on using the changeset viewer.