@@ -702,7 +702,7 @@ var import_element4 = __toESM(require_element());
702702var import_i18n = __toESM ( require_i18n ( ) ) ;
703703import { speak } from "@wordpress/a11y" ;
704704function useConnectorPlugin ( {
705- pluginSlug ,
705+ file : pluginFileFromServer ,
706706 settingName,
707707 connectorName,
708708 isInstalled,
@@ -714,6 +714,8 @@ function useConnectorPlugin({
714714 const [ isBusy , setIsBusy ] = ( 0 , import_element4 . useState ) ( false ) ;
715715 const [ connectedState , setConnectedState ] = ( 0 , import_element4 . useState ) ( initialIsConnected ) ;
716716 const [ pluginStatusOverride , setPluginStatusOverride ] = ( 0 , import_element4 . useState ) ( null ) ;
717+ const pluginBasename = pluginFileFromServer ?. replace ( / \. p h p $ / , "" ) ;
718+ const pluginSlug = pluginBasename ?. includes ( "/" ) ? pluginBasename . split ( "/" ) [ 0 ] : pluginBasename ;
717719 const {
718720 derivedPluginStatus,
719721 canManagePlugins,
@@ -728,7 +730,7 @@ function useConnectorPlugin({
728730 kind : "root" ,
729731 name : "plugin"
730732 } ) ;
731- if ( ! pluginSlug ) {
733+ if ( ! pluginFileFromServer ) {
732734 const hasLoaded = store2 . hasFinishedResolution (
733735 "getEntityRecord" ,
734736 [ "root" , "site" ]
@@ -740,15 +742,14 @@ function useConnectorPlugin({
740742 canInstallPlugins : canCreate
741743 } ;
742744 }
743- const pluginId = `${ pluginSlug } /plugin` ;
744745 const plugin = store2 . getEntityRecord (
745746 "root" ,
746747 "plugin" ,
747- pluginId
748+ pluginBasename
748749 ) ;
749750 const hasFinished = store2 . hasFinishedResolution (
750751 "getEntityRecord" ,
751- [ "root" , "plugin" , pluginId ]
752+ [ "root" , "plugin" , pluginBasename ]
752753 ) ;
753754 if ( ! hasFinished ) {
754755 return {
@@ -779,7 +780,7 @@ function useConnectorPlugin({
779780 canInstallPlugins : canCreate
780781 } ;
781782 } ,
782- [ pluginSlug , settingName , isInstalled , isActivated ]
783+ [ pluginBasename , settingName , isInstalled , isActivated ]
783784 ) ;
784785 const pluginStatus = pluginStatusOverride ?? derivedPluginStatus ;
785786 const canActivatePlugins = canManagePlugins ;
@@ -823,15 +824,18 @@ function useConnectorPlugin({
823824 }
824825 } ;
825826 const activatePlugin = async ( ) => {
826- if ( ! pluginSlug ) {
827+ if ( ! pluginFileFromServer ) {
827828 return ;
828829 }
829830 setIsBusy ( true ) ;
830831 try {
831832 await saveEntityRecord (
832833 "root" ,
833834 "plugin" ,
834- { plugin : `${ pluginSlug } /plugin` , status : "active" } ,
835+ {
836+ plugin : pluginBasename ,
837+ status : "active"
838+ } ,
835839 { throwOnError : true }
836840 ) ;
837841 setPluginStatusOverride ( "active" ) ;
@@ -1030,6 +1034,27 @@ var DefaultConnectorLogo = () => /* @__PURE__ */ React.createElement(
10301034 }
10311035 )
10321036) ;
1037+ var AkismetLogo = ( ) => /* @__PURE__ */ React . createElement (
1038+ "svg" ,
1039+ {
1040+ width : "40" ,
1041+ height : "40" ,
1042+ viewBox : "0 0 44 44" ,
1043+ fill : "none" ,
1044+ xmlns : "http://www.w3.org/2000/svg" ,
1045+ "aria-hidden" : "true"
1046+ } ,
1047+ /* @__PURE__ */ React . createElement ( "rect" , { width : "44" , height : "44" , fill : "#357B49" , rx : "6" } ) ,
1048+ /* @__PURE__ */ React . createElement (
1049+ "path" ,
1050+ {
1051+ fill : "#fff" ,
1052+ fillRule : "evenodd" ,
1053+ d : "m29.746 28.31-6.392-16.797c-.152-.397-.305-.672-.789-.675-.673 0-1.408.611-1.746 1.316l-7.378 16.154c-.072.16-.143.311-.214.454-.5.995-1.045 1.546-2.357 1.626a.399.399 0 0 0-.16.033l-.01.004a.399.399 0 0 0-.23.392v.01c0 .054.01.106.03.155l.004.01a.416.416 0 0 0 .394.252h6.212a.417.417 0 0 0 .307-.12.416.416 0 0 0 .124-.305.398.398 0 0 0-.105-.302.399.399 0 0 0-.294-.127c-.757 0-2.197-.062-2.197-1.164.02-.318.103-.63.245-.916l1.399-3.152c.52-1.163 1.654-1.163 2.572-1.163h5.843c.023 0 .044 0 .062.003.13.014.16.081.214.242l1.534 4.07a2.857 2.857 0 0 1 .216 1.04c0 .054-.003.104-.01.153-.09.726-.831.887-1.49.887a.4.4 0 0 0-.294.127l-.007.008-.007.008a.401.401 0 0 0-.092.286v.01c0 .054.01.106.03.155l.005.01a.42.42 0 0 0 .395.252h7.011a.413.413 0 0 0 .279-.13.412.412 0 0 0 .11-.297.387.387 0 0 0-.09-.294.388.388 0 0 0-.277-.135c-1.448-.122-2.295-.643-2.847-2.08Zm-11.985-5.844 2.847-6.304c.361-.728.659-1.486.889-2.265 0-.06.03-.092.06-.092s.061.032.061.091c.02.122.045.247.073.374.197.888.584 1.878.914 2.723l.176.453 1.684 4.529a.927.927 0 0 1 .092.4.473.473 0 0 1-.009.094c-.041.202-.228.272-.602.272h-6.063c-.122 0-.184-.03-.184-.092a.36.36 0 0 1 .062-.183Zm17.107-.721c0 .786-.446 1.231-1.25 1.231-.806 0-1.125-.409-1.125-1.034 0-.786.465-1.231 1.25-1.231.785 0 1.125.427 1.125 1.034ZM9.629 23.002c.803 0 1.25-.447 1.25-1.231 0-.607-.343-1.036-1.128-1.036-.785 0-1.25.447-1.25 1.231 0 .625.325 1.036 1.128 1.036Z" ,
1054+ clipRule : "evenodd"
1055+ }
1056+ )
1057+ ) ;
10331058var GeminiLogo = ( ) => /* @__PURE__ */ React . createElement (
10341059 "svg" ,
10351060 {
@@ -1123,7 +1148,8 @@ function getConnectorData() {
11231148var CONNECTOR_LOGOS = {
11241149 google : GeminiLogo ,
11251150 openai : OpenAILogo ,
1126- anthropic : ClaudeLogo
1151+ anthropic : ClaudeLogo ,
1152+ akismet : AkismetLogo
11271153} ;
11281154function getConnectorLogo ( connectorId , logoUrl ) {
11291155 if ( logoUrl ) {
@@ -1161,7 +1187,8 @@ function ApiKeyConnector({
11611187 const auth = authentication ?. method === "api_key" ? authentication : void 0 ;
11621188 const settingName = auth ?. settingName ?? "" ;
11631189 const helpUrl = auth ?. credentialsUrl ?? void 0 ;
1164- const pluginSlug = plugin ?. slug ;
1190+ const pluginFile = plugin ?. file ?. replace ( / \. p h p $ / , "" ) ;
1191+ const pluginSlug = pluginFile ?. includes ( "/" ) ? pluginFile . split ( "/" ) [ 0 ] : pluginFile ;
11651192 let helpLabel ;
11661193 try {
11671194 if ( helpUrl ) {
@@ -1184,7 +1211,7 @@ function ApiKeyConnector({
11841211 saveApiKey,
11851212 removeApiKey
11861213 } = useConnectorPlugin ( {
1187- pluginSlug ,
1214+ file : plugin ?. file ,
11881215 settingName,
11891216 connectorName : name ,
11901217 isInstalled : plugin ?. isInstalled ,
@@ -1259,16 +1286,20 @@ function registerDefaultConnectors() {
12591286 const connectors = getConnectorData ( ) ;
12601287 const sanitize = ( s ) => s . replace ( / [ ^ a - z 0 - 9 - _ ] / gi, "-" ) ;
12611288 for ( const [ connectorId , data ] of Object . entries ( connectors ) ) {
1289+ if ( connectorId === "akismet" && ! data . plugin ?. isInstalled ) {
1290+ continue ;
1291+ }
12621292 const { authentication } = data ;
12631293 const connectorName = sanitize ( connectorId ) ;
12641294 const args = {
12651295 name : data . name ,
12661296 description : data . description ,
1297+ type : data . type ,
12671298 logo : getConnectorLogo ( connectorId , data . logoUrl ) ,
12681299 authentication,
12691300 plugin : data . plugin
12701301 } ;
1271- if ( data . type === "ai_provider" && authentication . method === "api_key" ) {
1302+ if ( authentication . method === "api_key" ) {
12721303 args . render = ApiKeyConnector ;
12731304 }
12741305 registerConnector ( connectorName , args ) ;
@@ -1562,6 +1593,7 @@ function ConnectorsPage() {
15621593 slug : connector . slug ,
15631594 name : connector . name ,
15641595 description : connector . description ,
1596+ type : connector . type ,
15651597 logo : connector . logo ,
15661598 authentication : connector . authentication ,
15671599 plugin : connector . plugin
0 commit comments