Skip to content

Commit

Permalink
fix: hide undefined base plan (#687)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsbh authored Jul 26, 2024
1 parent 2a6b630 commit 4fbc665
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export default function Plans() {
client?.frontierServiceListFeatures()
]);
if (planResp?.data?.plans) {
setPlans([...[basePlan || {}], ...planResp?.data?.plans]);
setPlans([...(basePlan ? [basePlan] : []), ...planResp?.data?.plans]);
}
if (featuresResp?.data?.features) {
setFeatures(featuresResp?.data?.features);
Expand Down
6 changes: 3 additions & 3 deletions sdks/js/packages/core/react/contexts/FrontierContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
DEFAULT_DATE_FORMAT,
DEFAULT_DATE_SHORT_FORMAT
} from '../utils/constants';
import { BasePlan } from '~/src/types';

interface FrontierContextProviderProps {
config: FrontierClientOptions;
client: V1Beta1<unknown> | undefined;
Expand Down Expand Up @@ -93,7 +93,7 @@ interface FrontierContextProviderProps {

paymentMethod: V1Beta1PaymentMethod | undefined;

basePlan?: BasePlan;
basePlan?: V1Beta1Plan;
}

const defaultConfig: FrontierClientOptions = {
Expand Down Expand Up @@ -205,7 +205,7 @@ export const FrontierContextProvider = ({
const [activePlan, setActivePlan] = useState<V1Beta1Plan>();
const [isActivePlanLoading, setIsActivePlanLoading] = useState(false);

const [basePlan, setBasePlan] = useState<BasePlan>();
const [basePlan, setBasePlan] = useState<V1Beta1Plan>();

useEffect(() => {
async function getFrontierInformation() {
Expand Down
2 changes: 1 addition & 1 deletion sdks/js/packages/core/react/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export function getDefaultPaymentMethod(
return defaultMethod ? defaultMethod : paymentMethods[0];
}

export const enrichBasePlan = (plan?: BasePlan): BasePlan | undefined => {
export const enrichBasePlan = (plan?: BasePlan): V1Beta1Plan | undefined => {
const features = Object.entries(plan?.features || {}).map(([key, value]) => {
return {
title: key,
Expand Down

0 comments on commit 4fbc665

Please sign in to comment.