Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(billing): remove feature flag for one time addons TASK-1479 #5449

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 12 additions & 24 deletions jsapp/js/account/accountSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ function AccountNavLink(props: AccountNavLinkProps) {
// by the org being single-user.
function renderSingleUserOrgSidebar(
isStripeEnabled: boolean,
showAddOnsLink: boolean,
isOwner: boolean
) {
return (
Expand Down Expand Up @@ -77,14 +76,12 @@ function renderSingleUserOrgSidebar(
name={t('Plans')}
to={ACCOUNT_ROUTES.PLAN}
/>
{showAddOnsLink && (
<AccountNavLink
iconName='plus'
name={t('Add-ons')}
to={ACCOUNT_ROUTES.ADD_ONS}
isNew
/>
)}
<AccountNavLink
iconName='plus'
name={t('Add-ons')}
to={ACCOUNT_ROUTES.ADD_ONS}
isNew
/>
</>
)}
</>
Expand All @@ -97,7 +94,6 @@ function renderSingleUserOrgSidebar(
function renderMmoSidebar(
userRole: OrganizationUserRole,
isStripeEnabled: boolean,
showAddOnsLink: boolean,
mmoLabel: string
) {
const showBillingRoutes =
Expand Down Expand Up @@ -143,14 +139,12 @@ function renderMmoSidebar(
name={t('Plans')}
to={ACCOUNT_ROUTES.PLAN}
/>
{showAddOnsLink && (
<AccountNavLink
iconName='plus'
name={t('Add-ons')}
to={ACCOUNT_ROUTES.ADD_ONS}
isNew
/>
)}
<AccountNavLink
iconName='plus'
name={t('Add-ons')}
to={ACCOUNT_ROUTES.ADD_ONS}
isNew
/>
</>
)}
{hasAdminPrivileges && (
Expand All @@ -176,10 +170,6 @@ function AccountSidebar() {
setIsStripeEnabled(true);
}, [subscriptionStore.isInitialised]);

const showAddOnsLink = useMemo(() => {
return !subscriptionStore.planResponse.length;
}, [subscriptionStore.isInitialised]);

const mmoLabel = getSimpleMMOLabel(
envStore.data,
subscriptionStore.activeSubscriptions[0]
Expand All @@ -193,14 +183,12 @@ function AccountSidebar() {
return renderMmoSidebar(
orgQuery.data?.request_user_role,
isStripeEnabled,
showAddOnsLink,
mmoLabel
);
}

return renderSingleUserOrgSidebar(
isStripeEnabled,
showAddOnsLink,
orgQuery.data.is_owner
);
}
Expand Down
5 changes: 1 addition & 4 deletions jsapp/js/account/addOns/addOnList.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import type {BadgeColor} from 'jsapp/js/components/common/badge';
import Badge from 'jsapp/js/components/common/badge';
import {formatDate} from 'js/utils';
import {OneTimeAddOnsContext} from 'jsapp/js/account/useOneTimeAddonList.hook';
import {FeatureFlag, useFeatureFlag} from 'jsapp/js/featureFlags';
import type {Organization} from 'js/account/organization/organizationQuery';

/**
Expand All @@ -38,7 +37,6 @@ const AddOnList = (props: {
>([]);
const [addOnProducts, setAddOnProducts] = useState<Product[]>([]);
const oneTimeAddOnsContext = useContext(OneTimeAddOnsContext);
const areOneTimeAddonsEnabled = useFeatureFlag(FeatureFlag.oneTimeAddonsEnabled);
const oneTimeAddOnSubscriptions = oneTimeAddOnsContext.oneTimeAddOns;
const oneTimeAddOnProducts = addOnProducts.filter(
(product) => product.metadata.product_type === 'addon_onetime'
Expand All @@ -47,7 +45,6 @@ const AddOnList = (props: {
(product) => product.metadata.product_type === 'addon'
);
const showRecurringAddons = !subscribedPlans.length && !!recurringAddOnProducts.length;
const showOneTimeAddons = areOneTimeAddonsEnabled && !!oneTimeAddOnProducts.length;

/**
* Extract the add-on products and prices from the list of all products
Expand Down Expand Up @@ -194,7 +191,7 @@ const AddOnList = (props: {
organization={props.organization}
/>
)}
{showOneTimeAddons && (
{!!oneTimeAddOnProducts.length && (
<OneTimeAddOnRow
key={oneTimeAddOnProducts.map((product) => product.id).join('-')}
products={oneTimeAddOnProducts}
Expand Down
2 changes: 1 addition & 1 deletion jsapp/js/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For our sanity, use camel case and match key with value.
*/
export enum FeatureFlag {
oneTimeAddonsEnabled = 'oneTimeAddonsEnabled',
exampleFeatureEnabled = 'exampleFeatureEnabled', //Comment out when we have active FFs
}

/**
Expand Down
Loading