PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.2.1
JetFormBuilder — Dynamic Blocks Form Builder v3.6.2.1
3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / modules / gateways / assets / build / editor.js
jetformbuilder / modules / gateways / assets / build Last commit date
admin 3 months ago editor.asset.php 3 months ago editor.js 3 months ago
editor.js
1 lines
1 (()=>{"use strict";const e=window.React,{compose:t}=wp.compose,{withSelect:a,withDispatch:n}=wp.data,{__:l}=wp.i18n,{TextControl:o,SelectControl:s,withNotices:i}=wp.components,{useEffect:r}=wp.element,{renderGateway:c}=JetFBActions,{withSelectGateways:m,withDispatchGateways:u}=JetFBHooks,{ToggleControl:w}=JetFBComponents,d=t(a(m),n(u),i)(function({setGatewayRequest:t,gatewaySpecific:a,setGatewaySpecific:n,gatewayScenario:i,setGatewayScenario:m,getSpecificOrGlobal:u,additionalSourceGateway:d,specificGatewayLabel:y,noticeOperations:p,noticeUI:g}){const{id:_="PAY_NOW"}=i;return r(()=>{t({id:_})},[_]),r(()=>{t({id:_})},[]),(0,e.createElement)(e.Fragment,null,g,(0,e.createElement)(w,{checked:a.use_global,onChange:e=>n({use_global:e})},l("Use","jet-form-builder")+" ",(0,e.createElement)("a",{href:JetFormEditorData.global_settings_url+"#payments-gateways__paypal"},l("Global Settings","jet-form-builder"))),(0,e.createElement)(o,{label:y("client_id"),key:"paypal_client_id_setting",value:u("client_id"),onChange:e=>n({client_id:e}),disabled:a.use_global}),(0,e.createElement)(o,{label:y("secret"),key:"paypal_secret_setting",value:u("secret"),onChange:e=>n({secret:e}),disabled:a.use_global}),(0,e.createElement)(s,{labelPosition:"side",label:y("gateway_type"),value:_,onChange:e=>{m({id:e})},options:d.scenarios}),c("paypal",{noticeOperations:p},_))}),{compose:y}=wp.compose,{withSelect:p,withDispatch:g}=wp.data,{TextControl:_,SelectControl:f,BaseControl:b,RadioControl:h}=wp.components,{withSelectFormFields:E,withSelectGateways:v,withDispatchGateways:S,withSelectActionsByType:G}=JetFBHooks,{GatewayFetchButton:C}=JetFBComponents,k=y(p((...e)=>({...E([],"--")(...e),...v(...e)})),g((...e)=>({...S(...e)})))(function({gatewayGeneral:t,gatewaySpecific:a,setGateway:n,setGatewaySpecific:l,formFields:o,getSpecificOrGlobal:s,loadingGateway:i,scenarioSource:r,noticeOperations:c,scenarioLabel:m,globalGatewayLabel:u}){return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(b,{label:m("fetch_button_label")},(0,e.createElement)("div",{className:"jet-user-fields-map__list"},!i.success&&!i.loading&&(0,e.createElement)("span",{className:"description-controls"},m("fetch_button_help")),(0,e.createElement)(C,{initialLabel:m("fetch_button"),label:m("fetch_button_retry"),apiArgs:{...r.fetch,data:{client_id:s("client_id"),secret:s("secret")}},onFail:e=>{c.removeNotice(t.gateway),c.createNotice({status:"error",content:e.message,id:t.gateway})}}))),i.success&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(_,{label:m("currency"),key:"paypal_currency_code_setting",value:a.currency,onChange:e=>l({currency:e})}),(0,e.createElement)(f,{label:u("price_field"),key:"form_fields_price_field",value:t.price_field,labelPosition:"side",onChange:e=>{n({price_field:e})},options:o})))}),{gatewayAttr:j,renderGateway:F,renderGatewayWithPlaceholder:N}=JetFBActions,{__:B}=wp.i18n,{TextareaControl:A,BaseControl:J}=wp.components,{withSelect:D,withDispatch:x}=wp.data,{compose:O}=wp.compose,{withSelectGateways:R,withDispatchGateways:T}=JetFBHooks,I=j(),L=j("labels"),H=O(D((...e)=>({...R(...e)})),x(T))(function({gatewayGeneral:t,setGatewayInner:a,loadingGateway:n,gatewayRequest:l,CURRENT_SCENARIO:o,currentScenario:s}){const i=(e,t,n)=>{a({key:e,value:{[t]:n}})},r=(e,a,n=!1)=>t[e]&&t[e][a]?t[e][a]:n,c=(e,t)=>{i("messages",e,t)},m=e=>r("messages",e,I.messages[e]),u=(0,e.createElement)(e.Fragment,null,N(t.gateway,{gatewayGeneral:t,CURRENT_SCENARIO:o,currentScenario:s},"macrosList",(0,e.createElement)(J,{key:"payment_result_macros_base_control"},(0,e.createElement)("h4",null,B("Available macros list: ","jet-form-builder"),(0,e.createElement)("br",null),B("%gateway_amount% - payment amount returned from gateway template;","jet-form-builder"),(0,e.createElement)("br",null),B("%gateway_status% - payment status returned from payment gateway;","jet-form-builder"),(0,e.createElement)("br",null),B('%field_name% - replace "field_name" with any field name from the form;',"jet-form-builder"),(0,e.createElement)("br",null)))),(0,e.createElement)(A,{key:"payment_result_message_success",label:L("message_success"),value:m("success"),onChange:e=>c("success",e)}),(0,e.createElement)(A,{key:"payment_result_message_failed",label:L("message_failed"),value:m("failed"),onChange:e=>c("failed",e)}));return(0,e.createElement)(e.Fragment,null,F(t.gateway,{setValueInObject:i,getNotifications:r}),(-1===l.id||n.success||!l.id.includes(t.gateway))&&u)}),{Button:M,ToggleControl:P,Notice:U,__experimentalItemGroup:q,__experimentalItem:W}=wp.components,{withDispatch:z,withSelect:V,useSelect:Y,dispatch:$}=wp.data,{useState:K,useEffect:Q}=wp.element,{__:X}=wp.i18n,{compose:Z}=wp.compose,{createBlock:ee}=wp.blocks,{ActionModal:te}=JetFBComponents,{withDispatchGateways:ae,withSelectGateways:ne,useMetaState:le}=JetFBHooks,oe=window.JetFormEditorData.gateways,se="manual",ie="jet-forms/multi-gateway",re=(e,t)=>{for(const a of e){if(a.name===t)return!0;if(a.innerBlocks?.length&&re(a.innerBlocks,t))return!0}return!1},ce=Z(z(ae),V(ne))(function(t){var a;const{setGateway:n,setGatewayScenario:l,clearGateway:o,clearScenario:s,gatewayGeneral:i,gatewayScenario:r}=t,[c,m]=le("_jf_gateways"),[u,w]=K(!1),[d,y]=K(null!==(a=c?.gateway)&&void 0!==a?a:"none"),[p,g]=K(null),_=c?.mode===se,f=Y(e=>{const t=e("core/block-editor");return!!t?.getBlocks&&re(t.getBlocks(),ie)},[]),b=()=>{$("core/block-editor").insertBlocks(ee(ie))};Q(()=>{var e;y(_?se:null!==(e=c?.gateway)&&void 0!==e?e:"none")},[c?.gateway,c?.mode]),Q(()=>{if(!u)return o(),void s();const e=p||c?.gateway;e&&"none"!==e&&(_&&!p||(n({...c,gateway:e}),l(c?.[e]?.scenario)))},[u,p]);const h=(e=!1)=>{!1!==e&&m(e),w(!1),g(null)},E=[{label:"None",value:"none"},...oe.list,{label:"Manual",value:se}],v={row:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},item:{display:"flex",minHeight:"50px",flexDirection:"column",justifyContent:"center"},toggle:{paddingTop:"10px",paddingLeft:"20px",flexDirection:"column"},notice:{marginTop:"10px"},notice__btn:{marginLeft:"0"}};return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(q,{className:"jfb-gateways",isBordered:!0,isSeparated:!0},E.map(t=>{const a=d===t.value,n="none"!==t.value&&t.value!==se&&(_||a),l=_&&"none"!==t.value&&t.value!==se;return(0,e.createElement)(W,{key:t.value,className:"jfb-gateways__item",style:v.item},(0,e.createElement)("div",{className:"jfb-gateways__row",style:v.row},(0,e.createElement)("label",{className:"jfb-gateways__option"},(0,e.createElement)("input",{type:"radio",name:"jfb_gateway",value:t.value,checked:a,onChange:()=>{y(t.value),t.value!==se?m({...c,mode:"single",gateway:t.value}):m({...c,mode:se})}}),(0,e.createElement)("span",{className:"jfb-gateways__label"},t.label)),(0,e.createElement)("div",{className:"jfb-gateways__actions"},n?(0,e.createElement)(M,{onClick:()=>{g(t.value),w(!0)},icon:"admin-tools",isSecondary:!0,size:"small"},X("Edit","jet-form-builder")):(0,e.createElement)("span",{className:"jfb-gateways__edit-spacer","aria-hidden":"true"}))),l&&(0,e.createElement)("div",{className:"jfb-gateways__toggle",style:v.toggle},(0,e.createElement)(P,{label:X("Show on frontend","jet-form-builder"),checked:!!c?.[t.value]?.show_on_front,onChange:e=>{m({...c,[t.value]:{...c?.[t.value]||{},show_on_front:e}})}})),t.value===se&&_&&!f&&(0,e.createElement)("div",{className:"jfb-gateways__notice",style:v.notice},(0,e.createElement)(U,{status:"warning",isDismissible:!1},(0,e.createElement)("div",null,X("To display gateways on the frontend in Manual mode, add the Multi Gateway block to the form.","jet-form-builder")),(0,e.createElement)(M,{isSecondary:!0,onClick:b,size:"small",style:v.notice__btn},X("Add block","jet-form-builder")))))})),u&&(0,e.createElement)(te,{classNames:["width-60"],onRequestClose:()=>h(),onCancelClick:()=>h(),onUpdateClick:()=>h({...i,[i.gateway]:{...i[i.gateway]||{},scenario:r}}),title:`Edit ${S=p||c?.gateway,oe.list.find(e=>e.value===S)?.label||S} Settings`},(0,e.createElement)(H,null)));var S}),{__:me}=wp.i18n,ue={base:{name:"jf-gateways-panel",title:me("Gateways Settings","jet-form-builder")},settings:{render:ce,icon:"money-alt"}},{registerGateway:we}=JetFBActions,{addFilter:de,applyFilters:ye}=wp.hooks,pe="paypal";function ge(){return window?.JetFormEditorData?.gateways?.validation||{}}JetFBActions.isGatewayValid=function(e,t){if("string"==typeof t)try{t=JSON.parse(t||"{}")}catch(e){t={}}const a=ge()?.required_map||{},n=a?.[e];if(!Array.isArray(n)||!n.length)return!1;const l=t?.[e]||{};if(l.use_global){const t=ge()?.global_valid||{};return!!t?.[e]}return n.every(e=>{const t=l?.[e];return"string"==typeof t?""!==t.trim():!!t})},we(pe,d),we(pe,k,"PAY_NOW"),de("jet.fb.register.plugin.jf-validation-panel.after","jet-form-builder/gateways",function(e){return e.push(ue),e})})();