Inline
This commit is contained in:
@@ -55,10 +55,8 @@ import {
|
||||
hasPaidSubscription,
|
||||
hasStripeSubscription,
|
||||
isOnFreePlan,
|
||||
isPopularPlan,
|
||||
isSubscriptionActive,
|
||||
isSubscriptionCancelled,
|
||||
isUserSubscribedPlan,
|
||||
planSelectionOutcome,
|
||||
} from "utils/billing";
|
||||
|
||||
@@ -508,6 +506,18 @@ const Plans = ({
|
||||
);
|
||||
};
|
||||
|
||||
function isUserSubscribedPlan(plan: Plan, subscription: Subscription) {
|
||||
return (
|
||||
isSubscriptionActive(subscription) &&
|
||||
(plan.stripeID === subscription.productID ||
|
||||
plan.iosID === subscription.productID ||
|
||||
plan.androidID === subscription.productID)
|
||||
);
|
||||
}
|
||||
|
||||
const isPopularPlan = (plan: Plan) =>
|
||||
plan.storage === 100 * 1024 * 1024 * 1024; /* 100 GB */
|
||||
|
||||
interface PlanRowProps {
|
||||
plan: Plan;
|
||||
subscription: Subscription;
|
||||
|
||||
@@ -8,7 +8,6 @@ import { getData, LS_KEYS } from "@ente/shared/storage/localStorage";
|
||||
import { t } from "i18next";
|
||||
import type { NextRouter } from "next/router";
|
||||
import billingService, {
|
||||
Plan,
|
||||
redirectToCustomerPortal,
|
||||
Subscription,
|
||||
} from "services/billingService";
|
||||
@@ -107,14 +106,6 @@ export function getLocalUserSubscription(): Subscription {
|
||||
return getData(LS_KEYS.SUBSCRIPTION);
|
||||
}
|
||||
|
||||
export function isUserSubscribedPlan(plan: Plan, subscription: Subscription) {
|
||||
return (
|
||||
isSubscriptionActive(subscription) &&
|
||||
(plan.stripeID === subscription.productID ||
|
||||
plan.iosID === subscription.productID ||
|
||||
plan.androidID === subscription.productID)
|
||||
);
|
||||
}
|
||||
export function hasStripeSubscription(subscription: Subscription) {
|
||||
return subscription.paymentProvider == "stripe";
|
||||
}
|
||||
@@ -141,9 +132,6 @@ export function isSubscriptionPastDue(subscription: Subscription) {
|
||||
);
|
||||
}
|
||||
|
||||
export const isPopularPlan = (plan: Plan) =>
|
||||
plan.storage === 100 * 1024 * 1024 * 1024; /* 100 GB */
|
||||
|
||||
/**
|
||||
* When the payments app redirects back to us after a plan purchase or update
|
||||
* completes, it sets various query parameters to relay the status of the action
|
||||
|
||||
Reference in New Issue
Block a user