From dcec6f7f237fafdee11a7078733b7b7d5347208a Mon Sep 17 00:00:00 2001 From: amianthus <49116958+SirTenzin@users.noreply.github.com> Date: Thu, 25 Sep 2025 13:39:42 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20misc=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../products/product-items/validateProductItems.ts | 8 ++++++++ shared/utils/productV3Utils/mapToProductV3.ts | 3 +-- .../plan/components/EditPlanFeatureSheet/BillingType.tsx | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/server/src/internal/products/product-items/validateProductItems.ts b/server/src/internal/products/product-items/validateProductItems.ts index 98e523b6f..500bb641f 100644 --- a/server/src/internal/products/product-items/validateProductItems.ts +++ b/server/src/internal/products/product-items/validateProductItems.ts @@ -138,6 +138,14 @@ const validateProductItem = ({ }); } + if (item.included_usage === Infinite) { + throw new RecaseError({ + message: `Included usage can't be '${Infinite}' for tiered prices`, + code: ErrCode.InvalidInputs, + statusCode: StatusCodes.BAD_REQUEST, + }); + } + if (item.billing_units && item.billing_units <= 0) { throw new RecaseError({ message: `Billing units must be greater than 0`, diff --git a/shared/utils/productV3Utils/mapToProductV3.ts b/shared/utils/productV3Utils/mapToProductV3.ts index e8aca264f..0ec16d9b9 100644 --- a/shared/utils/productV3Utils/mapToProductV3.ts +++ b/shared/utils/productV3Utils/mapToProductV3.ts @@ -16,8 +16,7 @@ export function mapToProductV3({ is_add_on: product.is_add_on, is_default: product.is_default, version: product.version, - description: - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", + description: "", created_at: product.created_at, price: productV2ToBasePrice({ product }) || null, }; diff --git a/vite/src/views/products/plan/components/EditPlanFeatureSheet/BillingType.tsx b/vite/src/views/products/plan/components/EditPlanFeatureSheet/BillingType.tsx index bfd8fe40a..6fb7ee56d 100644 --- a/vite/src/views/products/plan/components/EditPlanFeatureSheet/BillingType.tsx +++ b/vite/src/views/products/plan/components/EditPlanFeatureSheet/BillingType.tsx @@ -15,10 +15,10 @@ export function BillingType() { const setBillingType = (type: "included" | "priced") => { if (type === "included") { // Remove tiers to switch to included - setItem({ ...item, tiers: null }); + setItem({ ...item, tiers: null, billing_units: undefined }); } else { // Add initial tier to switch to priced - setItem({ ...item, tiers: [{ to: 0, amount: 0 }] }); + setItem({ ...item, tiers: [{ to: 0, amount: 0 }], billing_units: 1 }); } };