From da3f3fbb57fa13c983b4fc137dfaceda511e7f81 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Thu, 7 Nov 2024 14:07:19 +0530 Subject: [PATCH] fin --- web/apps/photos/src/services/collectionService.ts | 2 +- web/packages/new/photos/components/gallery/reducer.ts | 2 +- web/packages/new/photos/services/plan.ts | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/web/apps/photos/src/services/collectionService.ts b/web/apps/photos/src/services/collectionService.ts index 913a534249..6a7d2c4441 100644 --- a/web/apps/photos/src/services/collectionService.ts +++ b/web/apps/photos/src/services/collectionService.ts @@ -32,7 +32,7 @@ import { import { groupFilesByCollectionID } from "@/new/photos/services/file"; import { getLocalFiles, sortFiles } from "@/new/photos/services/files"; import { updateMagicMetadata } from "@/new/photos/services/magic-metadata"; -import type { FamilyData } from "@/new/photos/services/family"; +import type { FamilyData } from "@/new/photos/services/plan"; import { batch } from "@/utils/array"; import { CustomError } from "@ente/shared/error"; import HTTPService from "@ente/shared/network/HTTPService"; diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.ts index c204f53a53..6156f5fba9 100644 --- a/web/packages/new/photos/components/gallery/reducer.ts +++ b/web/packages/new/photos/components/gallery/reducer.ts @@ -28,7 +28,6 @@ import type { CollectionSummary, CollectionSummaryType, } from "../../services/collection/ui"; -import type { FamilyData } from "../../services/family"; import { createFileCollectionIDs, getLatestVersionFiles, @@ -41,6 +40,7 @@ import { isPinnedCollection, } from "../../services/magic-metadata"; import type { PeopleState, Person } from "../../services/ml/people"; +import type { FamilyData } from "../../services/plan"; /** * Specifies what the bar at the top of the gallery is displaying currently. diff --git a/web/packages/new/photos/services/plan.ts b/web/packages/new/photos/services/plan.ts index 01dfee5d9d..ebc8bcff59 100644 --- a/web/packages/new/photos/services/plan.ts +++ b/web/packages/new/photos/services/plan.ts @@ -1,6 +1,3 @@ -// TODO: -/* eslint-disable @typescript-eslint/prefer-optional-chain */ -/* eslint-disable @typescript-eslint/no-unnecessary-condition */ import { authenticatedRequestHeaders, ensureOk } from "@/base/http"; import { apiURL, familyAppOrigin, paymentsAppOrigin } from "@/base/origins"; import { ensure } from "@/utils/ensure"; @@ -115,7 +112,9 @@ export const BonusData = z.object({ /** * List of bonuses applied for the user. */ - storageBonuses: Bonus.array(), + storageBonuses: Bonus.array() + .nullish() + .transform((v) => v ?? []), }); /** @@ -418,7 +417,7 @@ export const isSubscriptionPastDue = (subscription: Subscription) => { * (represented by the given {@link userDetails}). */ export const userDetailsAddOnBonuses = (userDetails: UserDetails) => - userDetails.bonusData?.storageBonuses?.filter((bonus) => + userDetails.bonusData?.storageBonuses.filter((bonus) => bonus.type.startsWith("ADD_ON"), ) ?? [];