From 044c82eacca1d5811f6c11c14d1a78964e5d91fc Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Wed, 6 Nov 2024 12:46:00 +0530 Subject: [PATCH] Move --- .../src/components/pages/gallery/PlanSelector.tsx | 11 +++++++++-- web/apps/photos/src/services/billingService.ts | 3 --- web/apps/photos/src/utils/billing/index.ts | 12 ------------ 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/web/apps/photos/src/components/pages/gallery/PlanSelector.tsx b/web/apps/photos/src/components/pages/gallery/PlanSelector.tsx index 5a009be8ac..81191504f5 100644 --- a/web/apps/photos/src/components/pages/gallery/PlanSelector.tsx +++ b/web/apps/photos/src/components/pages/gallery/PlanSelector.tsx @@ -57,7 +57,6 @@ import { isSubscriptionActive, isSubscriptionCancelled, isUserSubscribedPlan, - planForSubscription, planSelectionOutcome, updatePaymentMethod, } from "utils/billing"; @@ -152,7 +151,15 @@ function PlanSelectorCard(props: PlanSelectorCardProps) { !isOnFreePlan(subscription) && planNotListed ) { - plans.push(planForSubscription(subscription)); + plans.push({ + id: subscription.productID, + storage: subscription.storage, + price: subscription.price, + period: subscription.period, + stripeID: subscription.productID, + iosID: subscription.productID, + androidID: subscription.productID, + }); } } setPlansResponse(response); diff --git a/web/apps/photos/src/services/billingService.ts b/web/apps/photos/src/services/billingService.ts index 63b274316e..d7c1fe5566 100644 --- a/web/apps/photos/src/services/billingService.ts +++ b/web/apps/photos/src/services/billingService.ts @@ -20,11 +20,8 @@ const PlanPeriod = z.enum(["month", "year"]); export type PlanPeriod = z.infer; export interface Subscription { - id: number; - userID: number; productID: string; storage: number; - originalTransactionID: string; expiryTime: number; paymentProvider: string; attributes: { diff --git a/web/apps/photos/src/utils/billing/index.ts b/web/apps/photos/src/utils/billing/index.ts index fd316a058d..5925068816 100644 --- a/web/apps/photos/src/utils/billing/index.ts +++ b/web/apps/photos/src/utils/billing/index.ts @@ -319,15 +319,3 @@ function handleFailureReason( }); } } - -export function planForSubscription(subscription: Subscription): Plan { - return { - id: subscription.productID, - storage: subscription.storage, - price: subscription.price, - period: subscription.period, - stripeID: subscription.productID, - iosID: subscription.productID, - androidID: subscription.productID, - }; -}