@@ -80,6 +80,13 @@ var require_core_data = __commonJS({
8080 }
8181} ) ;
8282
83+ // package-external:@wordpress/url
84+ var require_url = __commonJS ( {
85+ "package-external:@wordpress/url" ( exports , module ) {
86+ module . exports = window . wp . url ;
87+ }
88+ } ) ;
89+
8390// node_modules/clsx/dist/clsx.mjs
8491function r ( e ) {
8592 var t , f , n = "" ;
@@ -662,10 +669,10 @@ import {
662669} from "@wordpress/connectors" ;
663670
664671// routes/connectors-home/style.scss
665- if ( typeof document !== "undefined" && ! document . head . querySelector ( "style[data-wp-hash='eb296b7e99 ']" ) ) {
672+ if ( typeof document !== "undefined" && ! document . head . querySelector ( "style[data-wp-hash='1b00f16b8d ']" ) ) {
666673 const style = document . createElement ( "style" ) ;
667- style . setAttribute ( "data-wp-hash" , "eb296b7e99 " ) ;
668- style . appendChild ( document . createTextNode ( ".connectors-page{box-sizing:border-box;margin:0 auto;max-width:680px;padding:24px;width:100%}.connectors-page .components-item{background:#fff;border:1px solid #ddd;border-radius:8px;overflow:hidden;padding:20px;scroll-margin-top:120px}.connectors-page .connector-settings__error{color:#cc1818}.connectors-page .connector-settings .components-text-control__input{font-family:monospace;scroll-margin-top:120px}.connectors-page--empty{align-items:center;display:flex;flex-direction:column;flex-grow:1;gap:32px;justify-content:center;text-align:center}.connectors-page .ai-plugin-callout{background:linear-gradient(90deg,#fff9,#fff9),linear-gradient(90deg,#89dcdc,#c7eb5c 46.15%,#a920c1);border-radius:8px;overflow:hidden;padding:24px;padding-inline-end:220px;position:relative}[dir=rtl] .connectors-page .ai-plugin-callout{background:linear-gradient(270deg,#fff9,#fff9),linear-gradient(270deg,#89dcdc,#c7eb5c 46.15%,#a920c1)}.connectors-page .ai-plugin-callout__content{display:flex;flex-direction:column;gap:12px;padding-top:2px}.connectors-page .ai-plugin-callout__content p{font-size:13px;line-height:20px;margin:0}.connectors-page .ai-plugin-callout__actions{align-items:center;display:flex;gap:12px}.connectors-page .ai-plugin-callout__decoration{height:248px;inset-inline-end:8px;position:absolute;top:-15px;width:248px}.connectors-page>p{color:#949494;text-align:center}@media (max-width:680px){.connectors-page .ai-plugin-callout{padding:12px;padding-inline-end:84px}.connectors-page .ai-plugin-callout__decoration{height:134px;inset-inline-end:4px;top:-8px;width:134px}}@media (max-width:480px){.connectors-page{padding:8px}.connectors-page .components-item{padding:12px}.connectors-page .components-item>.components-v-stack>.components-h-stack:first-child svg{height:32px;width:32px}.connectors-page .components-item>.components-v-stack>.components-h-stack:first-child>.components-h-stack:last-child{align-items:flex-end;flex-direction:column}}" ) ) ;
674+ style . setAttribute ( "data-wp-hash" , "1b00f16b8d " ) ;
675+ style . appendChild ( document . createTextNode ( ".connectors-page{box-sizing:border-box;margin:0 auto;max-width:680px;padding:24px;width:100%}.connectors-page .components-item{background:#fff;border:1px solid #ddd;border-radius:8px;overflow:hidden;padding:20px;scroll-margin-top:120px}.connectors-page .connector-settings__error{color:#cc1818}.connectors-page .connector-settings .components-text-control__input{font-family:monospace;scroll-margin-top:120px}.connectors-page--empty{align-items:center;display:flex;flex-direction:column;flex-grow:1;gap:32px;justify-content:center;text-align:center}.connectors-page .ai-plugin-callout{background:linear-gradient(90deg,#fff9,#fff9),linear-gradient(90deg,#89dcdc,#c7eb5c 46.15%,#a920c1);border-radius:8px;overflow:hidden;padding:24px;padding-inline-end:220px;position:relative}[dir=rtl] .connectors-page .ai-plugin-callout{background:linear-gradient(270deg,#fff9,#fff9),linear-gradient(270deg,#89dcdc,#c7eb5c 46.15%,#a920c1)}.connectors-page .ai-plugin-callout__content{align-items:flex-start;display:flex;flex-direction:column;gap:12px;padding-top:2px}.connectors-page .ai-plugin-callout__content p{font-size:13px;line-height:20px;margin:0}.connectors-page .ai-plugin-callout__decoration{height:248px;inset-inline-end:8px;position:absolute;top:-15px;width:248px}.connectors-page>p{color:#949494;text-align:center}@media (max-width:680px){.connectors-page .ai-plugin-callout{padding:12px;padding-inline-end:84px}.connectors-page .ai-plugin-callout__decoration{height:134px;inset-inline-end:4px;top:-8px;width:134px}}@media (max-width:480px){.connectors-page{padding:8px}.connectors-page .components-item{padding:12px}.connectors-page .components-item>.components-v-stack>.components-h-stack:first-child svg{height:32px;width:32px}.connectors-page .components-item>.components-v-stack>.components-h-stack:first-child>.components-h-stack:last-child{align-items:flex-end;flex-direction:column}}" ) ) ;
669676 document . head . appendChild ( style ) ;
670677}
671678
@@ -675,6 +682,7 @@ var import_core_data2 = __toESM(require_core_data());
675682var import_data2 = __toESM ( require_data ( ) ) ;
676683var import_element6 = __toESM ( require_element ( ) ) ;
677684var import_i18n3 = __toESM ( require_i18n ( ) ) ;
685+ var import_url = __toESM ( require_url ( ) ) ;
678686import { speak as speak2 } from "@wordpress/a11y" ;
679687
680688// routes/connectors-home/default-connectors.tsx
@@ -1144,17 +1152,16 @@ var ConnectedBadge = () => /* @__PURE__ */ React.createElement(
11441152) ;
11451153var UnavailableActionBadge = ( ) => /* @__PURE__ */ React . createElement ( Badge , null , ( 0 , import_i18n2 . __ ) ( "Not available" ) ) ;
11461154function ApiKeyConnector ( {
1147- label ,
1155+ name ,
11481156 description,
1149- pluginSlug,
1150- settingName,
1151- helpUrl,
1152- icon,
1153- isInstalled,
1154- isActivated,
1155- keySource : initialKeySource ,
1156- initialIsConnected
1157+ logo,
1158+ authentication,
1159+ plugin
11571160} ) {
1161+ const auth = authentication ?. method === "api_key" ? authentication : void 0 ;
1162+ const settingName = auth ?. settingName ?? "" ;
1163+ const helpUrl = auth ?. credentialsUrl ?? void 0 ;
1164+ const pluginSlug = plugin ?. slug ;
11581165 let helpLabel ;
11591166 try {
11601167 if ( helpUrl ) {
@@ -1179,11 +1186,11 @@ function ApiKeyConnector({
11791186 } = useConnectorPlugin ( {
11801187 pluginSlug,
11811188 settingName,
1182- connectorName : label ,
1183- isInstalled,
1184- isActivated,
1185- keySource : initialKeySource ,
1186- initialIsConnected
1189+ connectorName : name ,
1190+ isInstalled : plugin ?. isInstalled ,
1191+ isActivated : plugin ?. isActivated ,
1192+ keySource : auth ?. keySource ,
1193+ initialIsConnected : auth ?. isConnected
11871194 } ) ;
11881195 const isExternallyConfigured = keySource === "env" || keySource === "constant" ;
11891196 const showUnavailableBadge = pluginStatus === "not-installed" && canInstallPlugins === false || pluginStatus === "inactive" && canActivatePlugins === false ;
@@ -1206,8 +1213,8 @@ function ApiKeyConnector({
12061213 ConnectorItem ,
12071214 {
12081215 className : pluginSlug ? `connector-item--${ pluginSlug } ` : void 0 ,
1209- icon ,
1210- name : label ,
1216+ logo ,
1217+ name,
12111218 description,
12121219 actionArea : /* @__PURE__ */ React . createElement ( import_components2 . __experimentalHStack , { spacing : 3 , expanded : false } , isConnected && /* @__PURE__ */ React . createElement ( ConnectedBadge , null ) , showUnavailableBadge && /* @__PURE__ */ React . createElement ( UnavailableActionBadge , null ) , showActionButton && /* @__PURE__ */ React . createElement (
12131220 import_components2 . Button ,
@@ -1250,33 +1257,21 @@ function ApiKeyConnector({
12501257}
12511258function registerDefaultConnectors ( ) {
12521259 const connectors = getConnectorData ( ) ;
1253- const sanitize = ( s ) => s . replace ( / [ ^ a - z 0 - 9 - ] / gi, "-" ) ;
1260+ const sanitize = ( s ) => s . replace ( / [ ^ a - z 0 - 9 - _ ] / gi, "-" ) ;
12541261 for ( const [ connectorId , data ] of Object . entries ( connectors ) ) {
12551262 const { authentication } = data ;
1256- if ( data . type !== "ai_provider" || authentication . method !== "api_key" ) {
1257- continue ;
1258- }
1259- const connectorName = `${ sanitize ( data . type ) } /${ sanitize (
1260- connectorId
1261- ) } `;
1262- registerConnector ( connectorName , {
1263- label : data . name ,
1263+ const connectorName = sanitize ( connectorId ) ;
1264+ const args = {
1265+ name : data . name ,
12641266 description : data . description ,
1265- icon : getConnectorLogo ( connectorId , data . logoUrl ) ,
1266- render : ( props ) => /* @__PURE__ */ React . createElement (
1267- ApiKeyConnector ,
1268- {
1269- ...props ,
1270- pluginSlug : data . plugin ?. slug ,
1271- settingName : authentication . settingName ,
1272- helpUrl : authentication . credentialsUrl ?? void 0 ,
1273- isInstalled : data . plugin ?. isInstalled ,
1274- isActivated : data . plugin ?. isActivated ,
1275- keySource : authentication . keySource ,
1276- initialIsConnected : authentication . isConnected
1277- }
1278- )
1279- } ) ;
1267+ logo : getConnectorLogo ( connectorId , data . logoUrl ) ,
1268+ authentication,
1269+ plugin : data . plugin
1270+ } ;
1271+ if ( data . type === "ai_provider" && authentication . method === "api_key" ) {
1272+ args . render = ApiKeyConnector ;
1273+ }
1274+ registerConnector ( connectorName , args ) ;
12801275 }
12811276}
12821277
@@ -1453,38 +1448,39 @@ function AiPluginCallout() {
14531448 const getMessage = ( ) => {
14541449 if ( isJustConnected ) {
14551450 return ( 0 , import_i18n3 . __ ) (
1456- "The <strong>AI plugin</strong> is ready to use. You can use it to generate featured images, alt text, titles, excerpts and more."
1451+ "The <strong>AI plugin</strong> is ready to use. You can use it to generate featured images, alt text, titles, excerpts and more. <a>Learn more</a> "
14571452 ) ;
14581453 }
14591454 if ( isActiveNoProvider ) {
14601455 return ( 0 , import_i18n3 . __ ) (
1461- "The <strong>AI plugin</strong> is installed. Connect a provider below to generate featured images, alt text, titles, excerpts, and more."
1456+ "The <strong>AI plugin</strong> is installed. Connect a provider below to generate featured images, alt text, titles, excerpts, and more. <a>Learn more</a> "
14621457 ) ;
14631458 }
14641459 return ( 0 , import_i18n3 . __ ) (
1465- "The <strong>AI plugin</strong> can use your connectors to generate featured images, alt text, titles, excerpts and more."
1460+ "The <strong>AI plugin</strong> can use your connectors to generate featured images, alt text, titles, excerpts and more. <a>Learn more</a> "
14661461 ) ;
14671462 } ;
14681463 const getPrimaryButtonProps = ( ) => {
14691464 if ( pluginStatus === "not-installed" ) {
14701465 return {
1471- label : isBusy ? ( 0 , import_i18n3 . __ ) ( "Installing\u2026" ) : ( 0 , import_i18n3 . __ ) ( "Install AI Experiments " ) ,
1466+ label : isBusy ? ( 0 , import_i18n3 . __ ) ( "Installing\u2026" ) : ( 0 , import_i18n3 . __ ) ( "Install the AI plugin " ) ,
14721467 disabled : isBusy ,
14731468 onClick : isBusy ? void 0 : installPlugin
14741469 } ;
14751470 }
14761471 return {
1477- label : isBusy ? ( 0 , import_i18n3 . __ ) ( "Activating\u2026" ) : ( 0 , import_i18n3 . __ ) ( "Activate AI Experiments " ) ,
1472+ label : isBusy ? ( 0 , import_i18n3 . __ ) ( "Activating\u2026" ) : ( 0 , import_i18n3 . __ ) ( "Activate the AI plugin " ) ,
14781473 disabled : isBusy ,
14791474 onClick : isBusy ? void 0 : activatePlugin
14801475 } ;
14811476 } ;
14821477 return /* @__PURE__ */ React . createElement ( "div" , { className : "ai-plugin-callout" } , /* @__PURE__ */ React . createElement ( "div" , { className : "ai-plugin-callout__content" } , /* @__PURE__ */ React . createElement ( "p" , null , ( 0 , import_element6 . createInterpolateElement ) ( getMessage ( ) , {
1483- strong : /* @__PURE__ */ React . createElement ( "strong" , null )
1484- } ) ) , /* @__PURE__ */ React . createElement ( "div" , { className : "ai-plugin-callout__actions" } , showInstallActivate ? /* @__PURE__ */ React . createElement (
1478+ strong : /* @__PURE__ */ React . createElement ( "strong" , null ) ,
1479+ // @ts -ignore children are injected by createInterpolateElement at runtime.
1480+ a : /* @__PURE__ */ React . createElement ( import_components3 . ExternalLink , { href : AI_PLUGIN_URL } )
1481+ } ) ) , showInstallActivate ? /* @__PURE__ */ React . createElement (
14851482 import_components3 . Button ,
14861483 {
1487- ref : actionButtonRef ,
14881484 variant : "primary" ,
14891485 size : "compact" ,
14901486 isBusy,
@@ -1493,17 +1489,18 @@ function AiPluginCallout() {
14931489 onClick : getPrimaryButtonProps ( ) . onClick
14941490 } ,
14951491 getPrimaryButtonProps ( ) . label
1496- ) : justActivated && /* @__PURE__ */ React . createElement (
1492+ ) : /* @__PURE__ */ React . createElement (
14971493 import_components3 . Button ,
14981494 {
14991495 ref : actionButtonRef ,
15001496 variant : "secondary" ,
15011497 size : "compact" ,
1502- disabled : true ,
1503- accessibleWhenDisabled : true
1498+ href : ( 0 , import_url . addQueryArgs ) ( "options-general.php" , {
1499+ page : AI_PLUGIN_SLUG
1500+ } )
15041501 } ,
1505- ( 0 , import_i18n3 . __ ) ( "AI Experiments enabled " )
1506- ) , /* @__PURE__ */ React . createElement ( import_components3 . ExternalLink , { href : AI_PLUGIN_URL } , ( 0 , import_i18n3 . __ ) ( "Learn more" ) ) ) ) , /* @__PURE__ */ React . createElement ( WpLogoDecoration , null ) ) ;
1502+ ( 0 , import_i18n3 . __ ) ( "Control features in the AI plugin " )
1503+ ) ) , /* @__PURE__ */ React . createElement ( WpLogoDecoration , null ) ) ;
15071504}
15081505
15091506// routes/lock-unlock.ts
@@ -1527,7 +1524,10 @@ function ConnectorsPage() {
15271524 } ) ,
15281525 [ ]
15291526 ) ;
1530- const isEmpty = connectors . length === 0 ;
1527+ const renderableConnectors = connectors . filter (
1528+ ( connector ) => connector . render
1529+ ) ;
1530+ const isEmpty = renderableConnectors . length === 0 ;
15311531 return /* @__PURE__ */ React . createElement (
15321532 page_default ,
15331533 {
@@ -1560,9 +1560,11 @@ function ConnectorsPage() {
15601560 {
15611561 key : connector . slug ,
15621562 slug : connector . slug ,
1563- label : connector . label ,
1563+ name : connector . name ,
15641564 description : connector . description ,
1565- icon : connector . icon
1565+ logo : connector . logo ,
1566+ authentication : connector . authentication ,
1567+ plugin : connector . plugin
15661568 }
15671569 ) ;
15681570 }
0 commit comments