PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.18.0
GiveWP – Donation Plugin and Fundraising Platform v4.18.0
4.18.0 4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 All 257 releases
give / build / stripePaymentElementFormBuilder.js

stripePaymentElementFormBuilder.js in GiveWP – Donation Plugin and Fundraising Platform 4.18.0, at build/stripePaymentElementFormBuilder.js

1 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (()=>{"use strict";const e=window.React,t=window.wp.compose,l=window.wp.element,n=window.wp.hooks,a=window.wp.i18n,o=window.wp.blockEditor,i=window.wp.components;function s({attributes:t,setAttributes:n}){const s=window.stripePaymentElementGatewaySettings,r=t=>(0,l.createInterpolateElement)(t,{a:(0,e.createElement)("a",{href:s.stripeSettingsUrl})}),c=s.defaultAccount,u=t.stripeAccountId,p=!c&&(t.stripeUseGlobalDefault||!t.stripeUseGlobalDefault&&!u),d=r((0,a.__)("All donations are processed through the default account set in the <a>Global settings</a>.","give")),m=(()=>{const t=(0,a.__)("Select an account you would like to use to process donations for this form.","give");return p?(0,e.createElement)(e.Fragment,null,t):r(t+" "+(0,a.__)("You can also add another account in <a>Global settings</a>.","give"))})(),g=[{label:(0,a.__)("Select","give"),value:""},...Object.keys(s.allAccounts).map((e=>({label:s.allAccounts[e].account_name,value:s.allAccounts[e].account_id})))];return(0,e.createElement)(o.InspectorControls,null,(0,e.createElement)(i.PanelBody,{title:(0,a.__)("Stripe Account","give"),className:"givewp-stripe-payment-element__panel",initialOpen:!0},(0,e.createElement)(i.ToggleControl,{label:(0,a.__)("Use global default","give"),checked:t.stripeUseGlobalDefault,onChange:e=>n({stripeUseGlobalDefault:e}),help:d}),!t.stripeUseGlobalDefault&&(0,e.createElement)(i.SelectControl,{label:(0,a.__)("Choose Account","give"),value:t.stripeAccountId,options:g,onChange:e=>n({stripeAccountId:e}),help:m}),p&&(0,e.createElement)(i.Notice,{isDismissible:!1,status:"warning",actions:[{label:(0,a.__)("Connect a Stripe account","give"),url:s.stripeSettingsUrl,variant:"link"}]},(0,e.createElement)("h4",null,(0,a.__)("No default account set","give")),(0,e.createElement)("p",null,(0,a.__)("All donations are processed through the default Stripe account.","give")))))}(0,n.addFilter)("blocks.registerBlockType","givewp/stripe-payment-element",(function(e,t){return"givewp/payment-gateways"===t&&(e.attributes={...e.attributes,stripeUseGlobalDefault:{type:"boolean",default:!0},stripeAccountId:{type:"string",default:""}}),e}));const r=(0,t.createHigherOrderComponent)((t=>n=>((0,l.useEffect)((()=>{n.attributes.hasOwnProperty("stripeUseGlobalDefault")||n.setAttributes({stripeUseGlobalDefault:!0,stripeAccountId:""})}),[]),"givewp/payment-gateways"===n.name?(0,e.createElement)(e.Fragment,null,(0,e.createElement)(t,{...n}),(0,e.createElement)(s,{...n})):(0,e.createElement)(t,{...n}))),"withInspectorControl");(0,n.addFilter)("editor.BlockEdit","givewp/stripe-payment-element",r)})();