Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Move (wip checkpoint)

Manav Rathi8f3de6b6fbf7
diff --git a/web/apps/photos/src/components/Sidebar/SubscriptionCard.tsx b/web/apps/photos/src/components/Sidebar/SubscriptionCard.tsx
index 090b4c949f..db64b45375 100644
--- a/web/apps/photos/src/components/Sidebar/SubscriptionCard.tsx
+++ b/web/apps/photos/src/components/Sidebar/SubscriptionCard.tsx
@@ -1,5 +1,6 @@
import { Overlay } from "@/base/components/mui/Container";
import type { ButtonishProps } from "@/new/photos/components/mui";
+import type { UserDetails } from "@/new/photos/services/user";
import {
hasNonAdminFamilyMembers,
isPartOfFamily,
@@ -20,7 +21,6 @@ import {
import { t } from "i18next";
import type React from "react";
import { useMemo } from "react";
-import type { UserDetails } from "types/user";
interface SubscriptionCardProps {
userDetails: UserDetails;
diff --git a/web/apps/photos/src/components/Sidebar/index.tsx b/web/apps/photos/src/components/Sidebar/index.tsx
index 91d23cf600..515b4c7245 100644
--- a/web/apps/photos/src/components/Sidebar/index.tsx
+++ b/web/apps/photos/src/components/Sidebar/index.tsx
@@ -17,7 +17,19 @@ import {
TRASH_SECTION,
} from "@/new/photos/services/collection";
import type { CollectionSummaries } from "@/new/photos/services/collection/ui";
+import {
+ hasAddOnBonus,
+ hasExceededStorageQuota,
+ isSubscriptionActive,
+ isSubscriptionActiveFree,
+ isSubscriptionActivePaid,
+ isSubscriptionCancelled,
+ isSubscriptionPastDue,
+ isSubscriptionStripe,
+ redirectToCustomerPortal,
+} from "@/new/photos/services/plan";
import { isInternalUser } from "@/new/photos/services/settings";
+import type { UserDetails } from "@/new/photos/services/user";
import { isFamilyAdmin, isPartOfFamily } from "@/new/photos/services/user";
import { AppContext, useAppContext } from "@/new/photos/types/context";
import { initiateEmail, openURL } from "@/new/photos/utils/web";
@@ -65,19 +77,7 @@ import React, {
import { Trans } from "react-i18next";
import { getUncategorizedCollection } from "services/collectionService";
import exportService from "services/export";
-import {
- hasAddOnBonus,
- hasExceededStorageQuota,
- isSubscriptionActive,
- isSubscriptionActiveFree,
- isSubscriptionActivePaid,
- isSubscriptionCancelled,
- isSubscriptionPastDue,
- isSubscriptionStripe,
- redirectToCustomerPortal,
-} from "services/plan";
import { getUserDetailsV2 } from "services/userService";
-import { UserDetails } from "types/user";
import { testUpload } from "../../../tests/upload.test";
import { MemberSubscriptionManage } from "../MemberSubscriptionManage";
import { Preferences } from "./Preferences";
diff --git a/web/apps/photos/src/components/pages/gallery/PlanSelector.tsx b/web/apps/photos/src/components/pages/gallery/PlanSelector.tsx
index d96e422d0b..fe67b9c2c6 100644
--- a/web/apps/photos/src/components/pages/gallery/PlanSelector.tsx
+++ b/web/apps/photos/src/components/pages/gallery/PlanSelector.tsx
@@ -1,8 +1,27 @@
import { genericRetriableErrorDialogAttributes } from "@/base/components/utils/dialog";
import log from "@/base/log";
+import type {
+ Plan,
+ PlanPeriod,
+ PlansData,
+ Subscription,
+} from "@/new/photos/services/plan";
+import billingService, {
+ getPlansData,
+ hasAddOnBonus,
+ isSubscriptionActive,
+ isSubscriptionActiveFree,
+ isSubscriptionActivePaid,
+ isSubscriptionCancelled,
+ isSubscriptionStripe,
+ redirectToCustomerPortal,
+ redirectToPaymentsApp,
+} from "@/new/photos/services/plan";
import {
+ BonusData,
getTotalFamilyUsage,
isPartOfFamily,
+ UserDetails,
} from "@/new/photos/services/user";
import { AppContext } from "@/new/photos/types/context";
import { bytesInGB, formattedStorageByteSize } from "@/new/photos/utils/units";
@@ -35,21 +54,8 @@ import Typography from "@mui/material/Typography";
import { t } from "i18next";
import { useContext, useEffect, useMemo, useState } from "react";
import { Trans } from "react-i18next";
-import type { Plan, PlanPeriod, PlansData, Subscription } from "services/plan";
-import billingService, {
- getPlansData,
- hasAddOnBonus,
- isSubscriptionActive,
- isSubscriptionActiveFree,
- isSubscriptionActivePaid,
- isSubscriptionCancelled,
- isSubscriptionStripe,
- redirectToCustomerPortal,
- redirectToPaymentsApp,
-} from "services/plan";
import { getFamilyPortalRedirectURL } from "services/userService";
import { SetLoading } from "types/gallery";
-import { BonusData, UserDetails } from "types/user";
interface PlanSelectorProps {
modalView: boolean;
diff --git a/web/apps/photos/src/services/userService.ts b/web/apps/photos/src/services/userService.ts
index 98d6c84e74..6b001270f7 100644
--- a/web/apps/photos/src/services/userService.ts
+++ b/web/apps/photos/src/services/userService.ts
@@ -1,13 +1,13 @@
import { putAttributes } from "@/accounts/api/user";
import log from "@/base/log";
import { apiURL, familyAppOrigin } from "@/base/origins";
+import type { UserDetails } from "@/new/photos/services/user";
import { getLocalFamilyData, isPartOfFamily } from "@/new/photos/services/user";
import { ApiError } from "@ente/shared/error";
import HTTPService from "@ente/shared/network/HTTPService";
import { LS_KEYS, getData } from "@ente/shared/storage/localStorage";
import { getToken } from "@ente/shared/storage/localStorage/helpers";
import { HttpStatusCode } from "axios";
-import { UserDetails } from "types/user";
const HAS_SET_KEYS = "hasSetKeys";
diff --git a/web/apps/photos/src/types/user/index.ts b/web/apps/photos/src/types/user/index.ts
deleted file mode 100644
index 2eb7121f99..0000000000
--- a/web/apps/photos/src/types/user/index.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import type { FamilyData } from "@/new/photos/services/user";
-import { Subscription } from "services/plan";
-
-export interface Bonus {
- storage: number;
- type: string;
- validTill: number;
- isRevoked: boolean;
-}
-
-export interface BonusData {
- storageBonuses: Bonus[];
-}
-
-export interface UserDetails {
- email: string;
- usage: number;
- fileCount: number;
- sharedCollectionCount: number;
- subscription: Subscription;
- familyData?: FamilyData;
- storageBonus?: number;
- bonusData?: BonusData;
-}
diff --git a/web/apps/photos/src/services/plan.ts b/web/packages/new/photos/services/plan.ts
similarity index 99%
rename from web/apps/photos/src/services/plan.ts
rename to web/packages/new/photos/services/plan.ts
index 2dcdfb906d..e94f247818 100644
--- a/web/apps/photos/src/services/plan.ts
+++ b/web/packages/new/photos/services/plan.ts
@@ -14,7 +14,7 @@ import {
} from "@ente/shared/storage/localStorage";
import { getToken } from "@ente/shared/storage/localStorage/helpers";
import isElectron from "is-electron";
-import { BonusData, UserDetails } from "types/user";
+import type { BonusData, UserDetails } from "./user";
import { z } from "zod";
const PlanPeriod = z.enum(["month", "year"]);
diff --git a/web/packages/new/photos/services/user.ts b/web/packages/new/photos/services/user.ts
index 5c20573cab..6f43ba0bfc 100644
--- a/web/packages/new/photos/services/user.ts
+++ b/web/packages/new/photos/services/user.ts
@@ -4,6 +4,29 @@ import { apiURL } from "@/base/origins";
import { LS_KEYS, getData } from "@ente/shared/storage/localStorage";
import type { User } from "@ente/shared/user/types";
import { z } from "zod";
+import type { Subscription } from "./plan";
+
+export interface Bonus {
+ storage: number;
+ type: string;
+ validTill: number;
+ isRevoked: boolean;
+}
+
+export interface BonusData {
+ storageBonuses: Bonus[];
+}
+
+export interface UserDetails {
+ email: string;
+ usage: number;
+ fileCount: number;
+ sharedCollectionCount: number;
+ subscription: Subscription;
+ familyData?: FamilyData;
+ storageBonus?: number;
+ bonusData?: BonusData;
+}
export interface FamilyMember {
email: string;