Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ddc22 committed Jan 31, 2025
1 parent f27725f commit d8b8960
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 27 deletions.
6 changes: 4 additions & 2 deletions client/lib/signup/step-actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import config from '@automattic/calypso-config';
import { WPCOM_DIFM_LITE, PRODUCT_1GB_SPACE, isDomainTransfer } from '@automattic/calypso-products';
import { getUrlParts } from '@automattic/calypso-url';
import { Site, AddOns } from '@automattic/data-stores';
import { STORAGE_ADD_ON_DEFINITIONS, STORAGE_ADD_ONS } from '@automattic/data-stores/src/add-ons';
import { STORAGE_ADD_ONS } from '@automattic/data-stores/src/add-ons';
import { getAddOn } from '@automattic/data-stores/src/add-ons/add-ons-list';
import { isBlankCanvasDesign } from '@automattic/design-picker';
import { guessTimezone, getLanguage } from '@automattic/i18n-utils';
import { isOnboardingGuidedFlow } from '@automattic/onboarding';
Expand Down Expand Up @@ -1248,9 +1249,10 @@ export function maybeAddStorageAddonToCart( stepName, defaultDependencies, nextP
const selectedStorage = get( getSignupDependencyStore( state ), 'storage', null );

if ( STORAGE_ADD_ONS.includes( selectedStorage ) ) {
const selectedAddOn = getAddOn( selectedStorage );
cartItem.push( {
product_slug: PRODUCT_1GB_SPACE,
quantity: STORAGE_ADD_ON_DEFINITIONS[ selectedStorage ].quantity,
quantity: selectedAddOn.quantity,
volume: 1,
extra: { feature_slug: AddOns.ADD_ON_50GB_STORAGE },
} );
Expand Down
6 changes: 5 additions & 1 deletion packages/data-stores/src/add-ons/add-ons-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
import customDesignIcon from './icons/custom-design';
import spaceUpgradeIcon from './icons/space-upgrade';
import unlimitedThemesIcon from './icons/unlimited-themes';
import type { AddOnMeta } from './types';
import type { AddOnMeta, AddOnSlug } from './types';

export const getAddOnsList = (): AddOnMeta[] => {
const defaultAddOns: AddOnMeta[] = [
Expand Down Expand Up @@ -110,3 +110,7 @@ export const getAddOnsList = (): AddOnMeta[] => {

return defaultAddOns;
};

export const getAddOn = ( addOnSlug: AddOnSlug ): AddOnMeta | undefined => {
return getAddOnsList().find( ( addOn ) => addOn.addOnSlug === addOnSlug );
};
24 changes: 0 additions & 24 deletions packages/data-stores/src/add-ons/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,3 @@ export const STORAGE_ADD_ONS = < const >[
ADD_ON_300GB_STORAGE,
ADD_ON_350GB_STORAGE,
];

export const STORAGE_ADD_ON_DEFINITIONS = {
[ ADD_ON_50GB_STORAGE ]: {
quantity: 50,
},
[ ADD_ON_100GB_STORAGE ]: {
quantity: 100,
},
[ ADD_ON_150GB_STORAGE ]: {
quantity: 150,
},
[ ADD_ON_200GB_STORAGE ]: {
quantity: 200,
},
[ ADD_ON_250GB_STORAGE ]: {
quantity: 250,
},
[ ADD_ON_300GB_STORAGE ]: {
quantity: 300,
},
[ ADD_ON_350GB_STORAGE ]: {
quantity: 350,
},
};

0 comments on commit d8b8960

Please sign in to comment.