Skip to content

Commit 9ad0a81

Browse files
authored
Merge pull request #864 from Codeinwp/feat/sub-api-keys
feat: adapt for sub-api keys [ref Codeinwp/optimole-service#1136]
2 parents 36f4f64 + 0266467 commit 9ad0a81

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

assets/src/dashboard/parts/connected/settings/CloudLibrary.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,18 @@ export default function CloudLibrary( props ) {
1717
} = props;
1818

1919
const storeData = useSelect( select => {
20-
const { isLoading } = select( 'optimole' );
20+
const { isLoading, isSubApiKey } = select( 'optimole' );
2121
return {
22-
isLoading: isLoading()
22+
isLoading: isLoading(),
23+
isSubApiKey: isSubApiKey()
2324
};
2425
}, []);
2526

26-
const { isLoading } = storeData;
27+
const { isLoading, isSubApiKey } = storeData;
2728

2829

2930
const isCloudLibraryEnabled = 'disabled' !== settings[ 'cloud_images' ];
31+
const showSiteSelector = ! isSubApiKey && isCloudLibraryEnabled;
3032
const whitelistedDomains = user_data.whitelist || [];
3133

3234

@@ -81,7 +83,7 @@ export default function CloudLibrary( props ) {
8183

8284
<hr className="my-8 border-grayish-blue"/>
8385

84-
{isCloudLibraryEnabled && (
86+
{showSiteSelector && (
8587
<BaseControl
8688
label={options_strings.cloud_site_title}
8789
help={options_strings.cloud_site_desc}

assets/src/dashboard/store/selectors.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ const selectors = {
9393
}
9494

9595
return state.logs;
96+
},
97+
isSubApiKey( state ) {
98+
return state.apiKey && state.apiKey.startsWith( 'optml-s' );
9699
}
97100
};
98101

0 commit comments

Comments
 (0)