mirror of
https://github.com/Unleash/unleash.git
synced 2025-11-24 20:06:55 +01:00
chore(AI): trafficBillingDisplay flag cleanup (#10949)
This commit is contained in:
parent
101ed4d3f7
commit
8c56c375c7
@ -8,7 +8,6 @@ import { Alert, Box, styled, Typography } from '@mui/material';
|
|||||||
import { BillingDashboard } from './BillingDashboard/BillingDashboard.tsx';
|
import { BillingDashboard } from './BillingDashboard/BillingDashboard.tsx';
|
||||||
import { BillingHistory } from './BillingHistory/BillingHistory.tsx';
|
import { BillingHistory } from './BillingHistory/BillingHistory.tsx';
|
||||||
import useInvoices from 'hooks/api/getters/useInvoices/useInvoices';
|
import useInvoices from 'hooks/api/getters/useInvoices/useInvoices';
|
||||||
import { useUiFlag } from 'hooks/useUiFlag';
|
|
||||||
import { BillingInvoices } from './BillingInvoices/BillingInvoices.tsx';
|
import { BillingInvoices } from './BillingInvoices/BillingInvoices.tsx';
|
||||||
import { BillingInfo } from './BillingInfo/BillingInfo.tsx';
|
import { BillingInfo } from './BillingInfo/BillingInfo.tsx';
|
||||||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig.ts';
|
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig.ts';
|
||||||
@ -32,7 +31,6 @@ export const Billing = () => {
|
|||||||
const { isBilling, refetchInstanceStatus, refresh, loading } =
|
const { isBilling, refetchInstanceStatus, refresh, loading } =
|
||||||
useInstanceStatus();
|
useInstanceStatus();
|
||||||
const { invoices } = useInvoices();
|
const { invoices } = useInvoices();
|
||||||
const trafficBillingDisplay = useUiFlag('trafficBillingDisplay');
|
|
||||||
const {
|
const {
|
||||||
uiConfig: { billing },
|
uiConfig: { billing },
|
||||||
} = useUiConfig();
|
} = useUiConfig();
|
||||||
@ -48,7 +46,7 @@ export const Billing = () => {
|
|||||||
hardRefresh();
|
hardRefresh();
|
||||||
}, [refetchInstanceStatus, refresh]);
|
}, [refetchInstanceStatus, refresh]);
|
||||||
|
|
||||||
if (trafficBillingDisplay && eligibleForDetailedBilling) {
|
if (eligibleForDetailedBilling) {
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={(theme) => ({
|
sx={(theme) => ({
|
||||||
|
|||||||
@ -1,13 +1,10 @@
|
|||||||
import { Grid } from '@mui/material';
|
import { Grid } from '@mui/material';
|
||||||
import { BillingInformation } from './BillingInformation/BillingInformation.tsx';
|
import { BillingInformation } from './BillingInformation/BillingInformation.tsx';
|
||||||
import { BillingPlan } from './BillingPlan/BillingPlan.tsx';
|
import { BillingPlan } from './BillingPlan/BillingPlan.tsx';
|
||||||
import { useUiFlag } from 'hooks/useUiFlag.ts';
|
|
||||||
|
|
||||||
export const BillingDashboard = () => {
|
export const BillingDashboard = () => {
|
||||||
const trafficBillingDisplay = useUiFlag('trafficBillingDisplay');
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid container spacing={trafficBillingDisplay ? 2 : 4}>
|
<Grid container spacing={2}>
|
||||||
<BillingInformation />
|
<BillingInformation />
|
||||||
<BillingPlan />
|
<BillingPlan />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@ -4,17 +4,6 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/Condit
|
|||||||
import { InstanceState } from 'interfaces/instance';
|
import { InstanceState } from 'interfaces/instance';
|
||||||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
||||||
import { useInstanceStatus } from 'hooks/api/getters/useInstanceStatus/useInstanceStatus';
|
import { useInstanceStatus } from 'hooks/api/getters/useInstanceStatus/useInstanceStatus';
|
||||||
import { useUiFlag } from 'hooks/useUiFlag.ts';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated remove with `trafficBillingDisplay` flag
|
|
||||||
*/
|
|
||||||
const LegacyStyledInfoBox = styled('aside')(({ theme }) => ({
|
|
||||||
padding: theme.spacing(4),
|
|
||||||
height: '100%',
|
|
||||||
borderRadius: theme.shape.borderRadiusLarge,
|
|
||||||
backgroundColor: theme.palette.background.elevation2,
|
|
||||||
}));
|
|
||||||
|
|
||||||
const StyledInfoBox = styled(Paper)(({ theme }) => ({
|
const StyledInfoBox = styled(Paper)(({ theme }) => ({
|
||||||
padding: theme.spacing(4),
|
padding: theme.spacing(4),
|
||||||
@ -47,15 +36,11 @@ export const BillingInformation = () => {
|
|||||||
uiConfig: { billing },
|
uiConfig: { billing },
|
||||||
} = useUiConfig();
|
} = useUiConfig();
|
||||||
const isPAYG = billing === 'pay-as-you-go';
|
const isPAYG = billing === 'pay-as-you-go';
|
||||||
const trafficBillingDisplay = useUiFlag('trafficBillingDisplay');
|
|
||||||
const StyledWrapper = trafficBillingDisplay
|
|
||||||
? StyledInfoBox
|
|
||||||
: LegacyStyledInfoBox;
|
|
||||||
|
|
||||||
if (!instanceStatus)
|
if (!instanceStatus)
|
||||||
return (
|
return (
|
||||||
<Grid item xs={12} md={5}>
|
<Grid item xs={12} md={5}>
|
||||||
<StyledWrapper data-loading sx={{ flex: 1, height: '400px' }} />
|
<StyledInfoBox data-loading sx={{ flex: 1, height: '400px' }} />
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -65,7 +50,7 @@ export const BillingInformation = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid item xs={12} md={5}>
|
<Grid item xs={12} md={5}>
|
||||||
<StyledWrapper>
|
<StyledInfoBox>
|
||||||
<StyledTitle variant='body1'>Billing information</StyledTitle>
|
<StyledTitle variant='body1'>Billing information</StyledTitle>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={Boolean(isCustomBilling)}
|
condition={Boolean(isCustomBilling)}
|
||||||
@ -104,7 +89,7 @@ export const BillingInformation = () => {
|
|||||||
</a>{' '}
|
</a>{' '}
|
||||||
for any clarification
|
for any clarification
|
||||||
</StyledInfoLabel>
|
</StyledInfoLabel>
|
||||||
</StyledWrapper>
|
</StyledInfoBox>
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import { GridCol } from 'component/common/GridCol/GridCol';
|
|||||||
import { Badge } from 'component/common/Badge/Badge';
|
import { Badge } from 'component/common/Badge/Badge';
|
||||||
import { BillingDetails } from './BillingDetails.tsx';
|
import { BillingDetails } from './BillingDetails.tsx';
|
||||||
import { useInstanceStatus } from 'hooks/api/getters/useInstanceStatus/useInstanceStatus';
|
import { useInstanceStatus } from 'hooks/api/getters/useInstanceStatus/useInstanceStatus';
|
||||||
import { useUiFlag } from 'hooks/useUiFlag.ts';
|
|
||||||
|
|
||||||
export const BILLING_PRO_BASE_PRICE = 80;
|
export const BILLING_PRO_BASE_PRICE = 80;
|
||||||
export const BILLING_PRO_SEAT_PRICE = 15;
|
export const BILLING_PRO_SEAT_PRICE = 15;
|
||||||
@ -19,19 +18,6 @@ export const BILLING_PAYG_DEFAULT_MINIMUM_SEATS = 5;
|
|||||||
export const BILLING_PRO_DEFAULT_INCLUDED_SEATS = 5;
|
export const BILLING_PRO_DEFAULT_INCLUDED_SEATS = 5;
|
||||||
export const BILLING_INCLUDED_REQUESTS = 53_000_000;
|
export const BILLING_INCLUDED_REQUESTS = 53_000_000;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated remove with `trafficBillingDisplay` flag
|
|
||||||
*/
|
|
||||||
const LegacyStyledPlanBox = styled('aside')(({ theme }) => ({
|
|
||||||
padding: theme.spacing(2.5),
|
|
||||||
height: '100%',
|
|
||||||
borderRadius: theme.shape.borderRadiusLarge,
|
|
||||||
boxShadow: theme.boxShadows.elevated,
|
|
||||||
[theme.breakpoints.up('md')]: {
|
|
||||||
padding: theme.spacing(6.5),
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
const StyledPlanBox = styled(Paper)(({ theme }) => ({
|
const StyledPlanBox = styled(Paper)(({ theme }) => ({
|
||||||
padding: theme.spacing(4),
|
padding: theme.spacing(4),
|
||||||
height: '100%',
|
height: '100%',
|
||||||
@ -74,7 +60,6 @@ export const BillingPlan = () => {
|
|||||||
const {
|
const {
|
||||||
uiConfig: { billing },
|
uiConfig: { billing },
|
||||||
} = useUiConfig();
|
} = useUiConfig();
|
||||||
const trafficBillingDisplay = useUiFlag('trafficBillingDisplay');
|
|
||||||
const { instanceStatus } = useInstanceStatus();
|
const { instanceStatus } = useInstanceStatus();
|
||||||
|
|
||||||
const isPro =
|
const isPro =
|
||||||
@ -82,14 +67,10 @@ export const BillingPlan = () => {
|
|||||||
const isPAYG = billing === 'pay-as-you-go';
|
const isPAYG = billing === 'pay-as-you-go';
|
||||||
const isEnterpriseConsumption = billing === 'enterprise-consumption';
|
const isEnterpriseConsumption = billing === 'enterprise-consumption';
|
||||||
|
|
||||||
const StyledWrapper = trafficBillingDisplay
|
|
||||||
? StyledPlanBox
|
|
||||||
: LegacyStyledPlanBox;
|
|
||||||
|
|
||||||
if (!instanceStatus)
|
if (!instanceStatus)
|
||||||
return (
|
return (
|
||||||
<Grid item xs={12} md={7}>
|
<Grid item xs={12} md={7}>
|
||||||
<StyledWrapper data-loading sx={{ flex: 1, height: '400px' }} />
|
<StyledPlanBox data-loading sx={{ flex: 1, height: '400px' }} />
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -101,7 +82,7 @@ export const BillingPlan = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid item xs={12} md={7}>
|
<Grid item xs={12} md={7}>
|
||||||
<StyledWrapper>
|
<StyledPlanBox>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={inactive}
|
condition={inactive}
|
||||||
show={
|
show={
|
||||||
@ -177,7 +158,7 @@ export const BillingPlan = () => {
|
|||||||
isPAYG={isPAYG}
|
isPAYG={isPAYG}
|
||||||
isEnterpriseConsumption={isEnterpriseConsumption}
|
isEnterpriseConsumption={isEnterpriseConsumption}
|
||||||
/>
|
/>
|
||||||
</StyledWrapper>
|
</StyledPlanBox>
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -87,7 +87,6 @@ export type UiFlags = {
|
|||||||
impactMetrics?: boolean;
|
impactMetrics?: boolean;
|
||||||
plausibleMetrics?: boolean;
|
plausibleMetrics?: boolean;
|
||||||
globalChangeRequestList?: boolean;
|
globalChangeRequestList?: boolean;
|
||||||
trafficBillingDisplay?: boolean;
|
|
||||||
milestoneProgression?: boolean;
|
milestoneProgression?: boolean;
|
||||||
featureReleasePlans?: boolean;
|
featureReleasePlans?: boolean;
|
||||||
safeguards?: boolean;
|
safeguards?: boolean;
|
||||||
|
|||||||
@ -57,7 +57,6 @@ export type IFlagKey =
|
|||||||
| 'fetchMode'
|
| 'fetchMode'
|
||||||
| 'optimizeLifecycle'
|
| 'optimizeLifecycle'
|
||||||
| 'globalChangeRequestList'
|
| 'globalChangeRequestList'
|
||||||
| 'trafficBillingDisplay'
|
|
||||||
| 'milestoneProgression'
|
| 'milestoneProgression'
|
||||||
| 'featureReleasePlans'
|
| 'featureReleasePlans'
|
||||||
| 'plausibleMetrics'
|
| 'plausibleMetrics'
|
||||||
@ -262,10 +261,6 @@ const flags: IFlags = {
|
|||||||
process.env.UNLEASH_EXPERIMENTAL_GLOBAL_CHANGE_REQUEST_LIST,
|
process.env.UNLEASH_EXPERIMENTAL_GLOBAL_CHANGE_REQUEST_LIST,
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
trafficBillingDisplay: parseEnvVarBoolean(
|
|
||||||
process.env.UNLEASH_EXPERIMENTAL_TRAFFIC_BILLING_DISPLAY,
|
|
||||||
false,
|
|
||||||
),
|
|
||||||
milestoneProgression: parseEnvVarBoolean(
|
milestoneProgression: parseEnvVarBoolean(
|
||||||
process.env.UNLEASH_EXPERIMENTAL_MILESTONE_PROGRESSION,
|
process.env.UNLEASH_EXPERIMENTAL_MILESTONE_PROGRESSION,
|
||||||
false,
|
false,
|
||||||
|
|||||||
@ -52,7 +52,6 @@ process.nextTick(async () => {
|
|||||||
customMetrics: true,
|
customMetrics: true,
|
||||||
impactMetrics: true,
|
impactMetrics: true,
|
||||||
globalChangeRequestList: true,
|
globalChangeRequestList: true,
|
||||||
trafficBillingDisplay: true,
|
|
||||||
milestoneProgression: true,
|
milestoneProgression: true,
|
||||||
featureReleasePlans: true,
|
featureReleasePlans: true,
|
||||||
safeguards: true,
|
safeguards: true,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user