PluginProbe
Gutenberg / 23.6.0
Gutenberg v23.6.0
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / build / modules / connectors / index.min.js

index.min.js in Gutenberg 23.6.0, at build/modules/connectors/index.min.js

3 lines 6.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var X=Object.create;var P=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var C=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var ee=(e,r,i,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let c of Q(r))!$.call(e,c)&&c!==i&&P(e,c,{get:()=>r[c],enumerable:!(a=q(r,c))||a.enumerable});return e};var m=(e,r,i)=>(i=e!=null?X(Z(e)):{},ee(r||!e||!e.__esModule?P(i,"default",{value:e,enumerable:!0}):i,e));var A=C((fe,N)=>{N.exports=window.wp.data});var H=C((de,D)=>{D.exports=window.wp.privateApis});var L=C((Se,G)=>{G.exports=window.wp.components});var z=C((_e,Y)=>{Y.exports=window.wp.element});var K=C((xe,B)=>{B.exports=window.wp.i18n});var W=C((Ee,M)=>{M.exports=window.ReactJSXRuntime});var y=m(A(),1);var w=m(A(),1);var j=m(H(),1),{lock:F,unlock:h}=(0,j.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/connectors");var T="core/connectors",re={connectors:{}},ne={registerConnector(e,r){return{type:"REGISTER_CONNECTOR",slug:e,config:r}},unregisterConnector(e){return{type:"UNREGISTER_CONNECTOR",slug:e}}};function te(e=re,r){switch(r.type){case"REGISTER_CONNECTOR":return{...e,connectors:{...e.connectors,[r.slug]:{...e.connectors[r.slug],slug:r.slug,...r.config}}};case"UNREGISTER_CONNECTOR":{if(!e.connectors[r.slug])return e;let{[r.slug]:i,...a}=e.connectors;return{...e,connectors:a}}default:return e}}var oe={getConnectors:(0,w.createSelector)(e=>Object.values(e.connectors),e=>[e.connectors]),getConnector(e,r){return e.connectors[r]}},f=(0,w.createReduxStore)(T,{reducer:te});(0,w.register)(f);h(f).registerPrivateActions(ne);h(f).registerPrivateSelectors(oe);function se(e,r){h((0,y.dispatch)(f)).registerConnector(e,r)}function ie(e){h((0,y.dispatch)(f)).unregisterConnector(e)}var t=m(L(),1),p=m(z(),1),o=m(K(),1),n=m(W(),1);function ae({className:e,logo:r,name:i,description:a,actionArea:c,children:s}){let l=(0,p.useId)();return(0,n.jsx)(t.__experimentalItem,{className:e,children:(0,n.jsxs)(t.__experimentalVStack,{spacing:4,role:"group","aria-labelledby":l,children:[(0,n.jsxs)(t.__experimentalHStack,{alignment:"center",spacing:4,wrap:!0,children:[r,(0,n.jsx)(t.FlexBlock,{children:(0,n.jsxs)(t.__experimentalVStack,{spacing:0,children:[(0,n.jsx)(t.__experimentalText,{weight:"var(--wpds-typography-font-weight-emphasis, 600)",size:15,id:l,as:"h2",children:i}),(0,n.jsx)(t.__experimentalText,{variant:"muted",size:12,children:a})]})}),c]}),s]})})}function ce(e,r){if(r)return r;if(e)try{return new URL(e).hostname}catch{return e}}function R(e,r,i){if(e)return(0,p.createInterpolateElement)((0,o.sprintf)(i,"<a></a>"),{a:(0,n.jsx)(t.ExternalLink,{href:e,children:ce(e,r)})})}function O(e,r){let[i,a]=(0,p.useState)(!1),[c,s]=(0,p.useState)(null);return{isSaving:i,saveError:c,setSaveError:s,handleSave:async u=>{s(null),a(!0);try{await e?.(u)}catch(g){s(g instanceof Error?g.message:r)}finally{a(!1)}}}}function U({readOnly:e,children:r}){return(0,n.jsx)(t.__experimentalVStack,{spacing:4,className:"connector-settings",style:e?{"--wp-components-color-background":"#f0f0f0"}:void 0,children:r})}function V({readOnly:e,onRemove:r,canSave:i,isSaving:a,onSave:c}){return e?r?(0,n.jsx)(t.__experimentalHStack,{justify:"flex-start",children:(0,n.jsx)(t.Button,{variant:"link",isDestructive:!0,onClick:r,children:(0,o.__)("Remove and replace")})}):null:(0,n.jsx)(t.__experimentalHStack,{justify:"flex-start",children:(0,n.jsx)(t.Button,{__next40pxDefaultSize:!0,variant:"primary",disabled:!i||a,accessibleWhenDisabled:!0,isBusy:a,onClick:c,children:(0,o.__)("Save")})})}function le({onSave:e,onRemove:r,initialValue:i="",helpUrl:a,helpLabel:c,readOnly:s=!1,keySource:l}){let[u,g]=(0,p.useState)(i),{isSaving:v,saveError:_,setSaveError:S,handleSave:x}=O(e,(0,o.__)("It was not possible to connect to the provider using this key.")),E=R(a,c,(0,o.__)("Get your API key at %s")),I=l==="env"||l==="constant",b=()=>{if(I){if(l==="env")return(0,o.__)("This API key is configured using an environment variable.");if(l==="constant")return(0,o.__)("This API key is configured as a constant.")}return s?a?R(a,c,(0,o.__)("Your API key is stored securely. You can manage it at %s")):(0,o.__)("Your API key is stored securely."):_?(0,n.jsx)("span",{role:"alert",className:"connector-settings__error",children:_}):E};return(0,n.jsxs)(U,{readOnly:s,children:[(0,n.jsx)(t.TextControl,{label:(0,o.__)("API Key"),value:u,onChange:d=>{s||(S(null),g(d))},placeholder:(0,o.__)("Enter your API key"),disabled:s||v,autoComplete:"off",help:b()}),(0,n.jsx)(V,{readOnly:s,onRemove:r,canSave:!!u,isSaving:v,onSave:()=>x(u)})]})}function pe({onSave:e,onRemove:r,initialUsername:i="",helpUrl:a,helpLabel:c,readOnly:s=!1,keySource:l}){let[u,g]=(0,p.useState)(i),[v,_]=(0,p.useState)(""),{isSaving:S,saveError:x,setSaveError:E,handleSave:I}=O(e,(0,o.__)("It was not possible to save these credentials.")),d=R(a,c,(0,o.__)("Create an application password at %s"));return l==="env"?d=(0,o.__)("These credentials are configured using an environment variable."):l==="constant"?d=(0,o.__)("These credentials are configured as a constant."):s&&(d=(0,o.__)("Your application password is stored securely.")),x&&(d=(0,n.jsx)("span",{role:"alert",className:"connector-settings__error",children:x})),(0,n.jsxs)(U,{readOnly:s,children:[(0,n.jsx)(t.TextControl,{label:(0,o.__)("Username"),value:u,onChange:k=>{s||(E(null),g(k))},placeholder:(0,o.__)("Enter your username"),disabled:s||S,autoComplete:"username"}),(0,n.jsx)(t.TextControl,{label:(0,o.__)("Application password"),value:s?"••••••••••••••••":v,onChange:k=>{s||(E(null),_(k))},type:"password",placeholder:(0,o.__)("Enter your application password"),disabled:s||S,autoComplete:"new-password",help:d}),(0,n.jsx)(V,{readOnly:s,onRemove:r,canSave:!!u.trim()&&!!v,isSaving:S,onSave:()=>I({username:u.trim(),applicationPassword:v})})]})}var J={};F(J,{store:f,STORE_NAME:T});export{pe as __experimentalApplicationPasswordConnectorSettings,ae as __experimentalConnectorItem,le as __experimentalDefaultConnectorSettings,se as __experimentalRegisterConnector,ie as __experimentalUnregisterConnector,J as privateApis};
2 //# sourceMappingURL=index.min.js.map
3