Edit file File name : stripePaymentElementFormBuilder.js Content :(()=>{"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)})();Save