Skip to content

armgit / ente

Public Imported from GitHub
0

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

z

Manav Rathi1d7c807e5f23
diff --git a/web/apps/photos/src/services/billingService.ts b/web/apps/photos/src/services/billingService.ts
index e84ff358e1..166a95d516 100644
--- a/web/apps/photos/src/services/billingService.ts
+++ b/web/apps/photos/src/services/billingService.ts
@@ -1,6 +1,7 @@
import { authenticatedRequestHeaders, ensureOk } from "@/base/http";
import log from "@/base/log";
import { apiURL, paymentsAppOrigin } from "@/base/origins";
+import { nullToUndefined } from "@/utils/transform";
import HTTPService from "@ente/shared/network/HTTPService";
import {
LS_KEYS,
@@ -29,15 +30,23 @@ export interface Subscription {
period: PlanPeriod;
}
-export interface Plan {
- id: string;
- androidID: string;
- iosID: string;
- storage: number;
- price: string;
- period: PlanPeriod;
- stripeID: string;
-}
+/**
+ * Zod schema for an individual plan received in the list of plans.
+ */
+const Plan = z.object({
+ id: z.string(),
+ androidID: z.string().nullable().transform(nullToUndefined),
+ iosID: z.string().nullable().transform(nullToUndefined),
+ stripeID: z.string().nullable().transform(nullToUndefined),
+ storage: z.number(),
+ price: z.string(),
+ period: z.enum(["month", "year"]),
+});
+
+/**
+ * An individual plan received in the list of plans from remote.
+ */
+export type Plan = z.infer<typeof Plan>;
export interface PlansResponse {
freePlan: {