Skip to content

Commit

Permalink
Add Ons: Migrate useAddOnFeatureSlugs to data store (#83677)
Browse files Browse the repository at this point in the history
* Migrate useAddOnFeatureSlugs to data store

* Switch to named export

---------

Co-authored-by: James Tien <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Jan 12, 2024
1 parent 0918bd4 commit 311d9b3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions client/my-sites/add-ons/hooks/use-add-ons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
PRODUCT_1GB_SPACE,
WPCOM_FEATURES_AI_ASSISTANT,
} from '@automattic/calypso-products';
import { useAddOnCheckoutLink } from '@automattic/data-stores';
import { useAddOnCheckoutLink, useAddOnFeatureSlugs } from '@automattic/data-stores';
import { useMemo } from '@wordpress/element';
import { useTranslate } from 'i18n-calypso';
import useMediaStorageQuery from 'calypso/data/media-storage/use-media-storage-query';
Expand All @@ -29,7 +29,6 @@ import spaceUpgradeIcon from '../icons/space-upgrade';
import unlimitedThemesIcon from '../icons/unlimited-themes';
import isStorageAddonEnabled from '../is-storage-addon-enabled';
import useAddOnDisplayCost from './use-add-on-display-cost';
import useAddOnFeatureSlugs from './use-add-on-feature-slugs';
import useAddOnPrices from './use-add-on-prices';
import type { AddOnMeta, SiteDetails } from '@automattic/data-stores';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useMemo } from '@wordpress/element';
* Returns any relevant feature slugs for a given add-on.
* Add-ons are currently uniquely identified by their product slugs.
*/
const useAddOnFeatureSlugs = ( addOnProductSlug: string, quantity?: number ) => {
export const useAddOnFeatureSlugs = ( addOnProductSlug: string, quantity?: number ) => {
return useMemo( () => {
switch ( addOnProductSlug ) {
case PRODUCT_WPCOM_UNLIMITED_THEMES:
Expand All @@ -35,5 +35,3 @@ const useAddOnFeatureSlugs = ( addOnProductSlug: string, quantity?: number ) =>
}
}, [ addOnProductSlug, quantity ] ); // add dependencies
};

export default useAddOnFeatureSlugs;
1 change: 1 addition & 0 deletions packages/data-stores/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export * from './theme';
export * from './user/types';
export * from './wpcom-plans-ui/types';
export * from './add-ons/use-add-on-checkout-link';
export * from './add-ons/use-add-on-feature-slugs';
export * from './queries/use-launchpad';
export * from './queries/use-launchpad-navigator';
export * from './queries/use-all-domains-query';
Expand Down

0 comments on commit 311d9b3

Please sign in to comment.