editor.js
1 lines
| 1 | (()=>{"use strict";const e=window.React,{TextControl:t}=wp.components,{useContext:n}=wp.element,{CurrentActionEditContext:o,ActionFieldsMapContext:r,CurrentPropertyMapContext:l}=JetFBComponents,i=function(){const{FieldSelect:i,property:a}=n(l),{setMapField:s,getMapField:c}=n(o),{name:d,index:m}=n(r);return"user_meta"===a?(0,e.createElement)("div",{className:"components-base-control jet-margin-bottom-wrapper"},i,(0,e.createElement)(t,{key:d+m+"_text",value:c({name:d}),onChange:e=>s({nameField:d,value:e}),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})):i},a=window.jfb.blocksToActions,s=window.jfb.actions,c=window.wp.components,d=window.wp.i18n,m=window.jfb.components,{ActionFieldsMap:p,WrapperRequiredControl:u,DynamicPropertySelect:w}=JetFBComponents,_=window.wp.primitives,f=(0,e.createElement)(_.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(_.Path,{fillRule:"evenodd",d:"M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z",clipRule:"evenodd"})),E={type:"update_user",label:(0,d.__)("Update User","jet-form-builder"),edit:function(t){const n=(0,s.convertListToFieldsMap)((0,a.useFields)({withInner:!1})),{settings:o,onChangeSetting:r,source:l,label:_}=t;(0,a.useSanitizeFieldsMap)();const{hasError:f}=(0,s.useActionValidatorProvider)({isSupported:e=>"field_id"===e?.property});return(0,e.createElement)(c.Flex,{direction:"column"},(0,e.createElement)(p,{label:_("fields_map"),fields:n,customHelp:()=>f&&(0,e.createElement)(m.IconText,null,(0,d.__)("Please select a field for User ID","jet-form-builder"))},(0,e.createElement)(u,null,(0,e.createElement)(w,{dynamic:["user_meta"]},(0,e.createElement)(i,null)))),(0,e.createElement)(m.WideLine,null),(0,e.createElement)(m.RowControl,null,(({id:t})=>(0,e.createElement)(e.Fragment,null,(0,e.createElement)(m.Label,{htmlFor:t},(0,d.__)("User role","jet-form-builder")),(0,e.createElement)(c.SelectControl,{id:t,value:o.user_role,options:l.userRoles,onChange:e=>r(e,"user_role"),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})))),(0,e.createElement)(m.WideLine,null),(0,e.createElement)(s.ActionMessages,{...t}))},icon:f,docHref:"https://jetformbuilder.com/features/update-user/",category:"user",validators:[({settings:e})=>{var t;return!Object.values(null!==(t=e?.fields_map)&&void 0!==t?t:{}).some((e=>"ID"===e))&&{type:"empty",property:"field_id"}}]};(0,s.registerAction)(E)})(); |