PluginProbe
Gutenberg / 23.2.2
Gutenberg v23.2.2
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.2.2, at build/modules/connectors/index.min.js

3 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var V=Object.create;var y=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var f=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var Q=(e,r,i,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let c of U(r))!q.call(e,c)&&c!==i&&y(e,c,{get:()=>r[c],enumerable:!(s=J(r,c))||s.enumerable});return e};var m=(e,r,i)=>(i=e!=null?V(X(e)):{},Q(r||!e||!e.__esModule?y(i,"default",{value:e,enumerable:!0}):i,e));var C=f((ce,T)=>{T.exports=window.wp.data});var A=f((ae,R)=>{R.exports=window.wp.privateApis});var O=f((ge,P)=>{P.exports=window.wp.components});var j=f((xe,D)=>{D.exports=window.wp.element});var L=f((_e,G)=>{G.exports=window.wp.i18n});var B=f((he,z)=>{z.exports=window.ReactJSXRuntime});var E=m(C(),1);var g=m(C(),1);var b=m(A(),1),{lock:N,unlock:d}=(0,b.__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 w="core/connectors",Z={connectors:{}},$={registerConnector(e,r){return{type:"REGISTER_CONNECTOR",slug:e,config:r}},unregisterConnector(e){return{type:"UNREGISTER_CONNECTOR",slug:e}}};function ee(e=Z,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,...s}=e.connectors;return{...e,connectors:s}}default:return e}}var re={getConnectors:(0,g.createSelector)(e=>Object.values(e.connectors),e=>[e.connectors]),getConnector(e,r){return e.connectors[r]}},l=(0,g.createReduxStore)(w,{reducer:ee});(0,g.register)(l);d(l).registerPrivateActions($);d(l).registerPrivateSelectors(re);function te(e,r){d((0,E.dispatch)(l)).registerConnector(e,r)}function ne(e){d((0,E.dispatch)(l)).unregisterConnector(e)}var t=m(O(),1),a=m(j(),1),o=m(L(),1),n=m(B(),1);function oe({className:e,logo:r,name:i,description:s,actionArea:c,children:p}){let u=(0,a.useId)();return(0,n.jsx)(t.__experimentalItem,{className:e,children:(0,n.jsxs)(t.__experimentalVStack,{spacing:4,role:"group","aria-labelledby":u,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:600,size:15,id:u,as:"h2",children:i}),(0,n.jsx)(t.__experimentalText,{variant:"muted",size:12,children:s})]})}),c]}),p]})})}function se({onSave:e,onRemove:r,initialValue:i="",helpUrl:s,helpLabel:c,readOnly:p=!1,keySource:u}){let[_,H]=(0,a.useState)(i),[h,I]=(0,a.useState)(!1),[k,v]=(0,a.useState)(null),S=c||s?.replace(/^https?:\/\//,""),K=s?(0,a.createInterpolateElement)((0,o.sprintf)((0,o.__)("Get your API key at %s"),"<a></a>"),{a:(0,n.jsx)(t.ExternalLink,{href:s,children:S})}):void 0,M=u==="env"||u==="constant",W=()=>{if(M){if(u==="env")return(0,o.__)("This API key is configured using an environment variable.");if(u==="constant")return(0,o.__)("This API key is configured as a constant.")}return p?s?(0,a.createInterpolateElement)((0,o.sprintf)((0,o.__)("Your API key is stored securely. You can manage it at %s"),"<a></a>"),{a:(0,n.jsx)(t.ExternalLink,{href:s,children:S})}):(0,o.__)("Your API key is stored securely."):k?(0,n.jsx)("span",{role:"alert",className:"connector-settings__error",children:k}):K},Y=async()=>{v(null),I(!0);try{await e?.(_)}catch(x){v(x instanceof Error?x.message:(0,o.__)("It was not possible to connect to the provider using this key."))}finally{I(!1)}};return(0,n.jsxs)(t.__experimentalVStack,{spacing:4,className:"connector-settings",style:p?{"--wp-components-color-background":"#f0f0f0"}:void 0,children:[(0,n.jsx)(t.TextControl,{__next40pxDefaultSize:!0,label:(0,o.__)("API Key"),value:_,onChange:x=>{p||(v(null),H(x))},placeholder:(0,o.__)("Enter your API key"),disabled:p||h,help:W()}),p?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")})}):(0,n.jsx)(t.__experimentalHStack,{justify:"flex-start",children:(0,n.jsx)(t.Button,{__next40pxDefaultSize:!0,variant:"primary",disabled:!_||h,accessibleWhenDisabled:!0,isBusy:h,onClick:Y,children:(0,o.__)("Save")})})]})}var F={};N(F,{store:l,STORE_NAME:w});export{oe as __experimentalConnectorItem,se as __experimentalDefaultConnectorSettings,te as __experimentalRegisterConnector,ne as __experimentalUnregisterConnector,F as privateApis};
2 //# sourceMappingURL=index.min.js.map
3