editor.package.js
1 lines
| 1 | (()=>{"use strict";const t=window.React,{createSlotFill:e}=wp.components,{Slot:o,Fill:n}=e("JFBCaptchaOptions");function c({children:e,provider:o=!1}){return(0,t.createElement)(n,null,(({args:t,setArgs:n})=>o&&o!==t.captcha?null:"function"!=typeof e?e:e({args:t,setArgs:n})))}c.Slot=o;const a=c,{createSlotFill:r}=wp.components,{Slot:l,Fill:i}=r("JFBCaptchaBlockEdit");function s({children:e,provider:o}){return(0,t.createElement)(i,null,(({attributes:t,...n})=>o&&o!==t.provider?null:"function"!=typeof e?e:e({attributes:t,...n})))}s.Slot=l;const u=s,{useMetaState:d}=JetFBHooks,p=function(){var t;return null!==(t=window.JetFormEditorData["captcha-tab-config"])&&void 0!==t?t:[]},{useMetaState:f}=JetFBHooks,{__:m}=wp.i18n,{useMemo:h,useCallback:w}=wp.element,{useDispatch:B,useSelect:b}=wp.data,{createBlock:k}=wp.blocks,{Tip:v,Button:F}=wp.components,C="jet-forms/captcha-container";window.JetFBComponents={...window.JetFBComponents,CaptchaOptions:a,CaptchaBlockEdit:u,CaptchaBlockTip:function(){const[e]=f("_jf_recaptcha"),o=h((()=>(t=>{var e;const o=p().find((({value:e})=>e===t));return null!==(e=o?.label)&&void 0!==e?e:m("captcha","jet-form-builder")})(e.captcha)),[e.captcha]),{insertBlock:n}=B("core/block-editor"),c=b((t=>!t("jet-forms/fields").getBlock(C))),a=w((()=>{if(!c)return;const t=k(C,{provider:e.captcha});n(t)}),[c]);return(0,t.createElement)(t.Fragment,null,(0,t.createElement)("div",{style:{marginBottom:"1.5em"}},(0,t.createElement)(v,null,m("By default, the captcha is added before the submit \nbutton of the form. However, you can determine its location \nyourself using the block.","jet-form-builder"))),(0,t.createElement)(F,{variant:"secondary",disabled:!c,onClick:a},m("Add","jet-form-builder")+" ",`${o} `+m("block","jet-form-builder")))}},window.JetFBActions={...window.JetFBActions,getCaptchaProviders:p},window.JetFBHooks={...window.JetFBHooks,useCaptchaProvider:function(){var t;const[e,o]=d("_jf_recaptcha"),{captcha:n}=e;if(!n)return[{},()=>{}];const c=null!==(t=e?.[n])&&void 0!==t?t:{};return[c,(t={})=>{n&&o((e=>({...e,[n]:{...c,...t}})))}]}}})(); |