fix: 🐛 imports
This commit is contained in:
@@ -20,16 +20,16 @@ import {
|
||||
UsageModel,
|
||||
type UsagePriceConfig,
|
||||
} from "@autumn/shared";
|
||||
import {
|
||||
itemToBillingInterval,
|
||||
itemToEntInterval,
|
||||
} from "@shared/utils/productV2Utils/productItemUtils/itemIntervalUtils.js";
|
||||
import { pricesAreSame } from "@/internal/products/prices/priceInitUtils.js";
|
||||
import { getBillingType } from "@/internal/products/prices/priceUtils.js";
|
||||
import RecaseError from "@/utils/errorUtils.js";
|
||||
import { generateId, notNullish, nullish } from "@/utils/genUtils.js";
|
||||
import { entsAreSame } from "../../entitlements/entitlementUtils.js";
|
||||
import { shouldProrate } from "../../prices/priceUtils/prorationConfigUtils.js";
|
||||
import {
|
||||
itemToBillingInterval,
|
||||
itemToEntInterval,
|
||||
} from "../itemIntervalUtils.js";
|
||||
import { itemCanBeProrated } from "./classifyItem.js";
|
||||
import {
|
||||
isFeatureItem,
|
||||
|
||||
@@ -11,11 +11,11 @@ import {
|
||||
ProductItemSchema,
|
||||
UsageModel,
|
||||
} from "@autumn/shared";
|
||||
import { itemToEntInterval } from "@shared/utils/productV2Utils/productItemUtils/itemIntervalUtils.js";
|
||||
import { StatusCodes } from "http-status-codes";
|
||||
import RecaseError from "@/utils/errorUtils.js";
|
||||
import { notNullish, nullish } from "@/utils/genUtils.js";
|
||||
import { createFeaturesFromItems } from "./createFeaturesFromItems.js";
|
||||
import { itemToEntInterval } from "./itemIntervalUtils.js";
|
||||
import {
|
||||
isBooleanFeatureItem,
|
||||
isFeatureItem,
|
||||
@@ -362,12 +362,12 @@ export const validateProductItems = ({
|
||||
const hasWeeklyPrice = newItems.some(
|
||||
(item) =>
|
||||
(isPriceItem(item) || isFeaturePriceItem(item)) &&
|
||||
item.interval === ProductItemInterval.Week
|
||||
item.interval === ProductItemInterval.Week,
|
||||
);
|
||||
const hasMonthlyPrice = newItems.some(
|
||||
(item) =>
|
||||
(isPriceItem(item) || isFeaturePriceItem(item)) &&
|
||||
item.interval === ProductItemInterval.Month
|
||||
item.interval === ProductItemInterval.Month,
|
||||
);
|
||||
|
||||
if (hasWeeklyPrice && hasMonthlyPrice) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { TierInfinite } from "@models/productV2Models/productItemModels/productI
|
||||
import {
|
||||
isFeatureItem,
|
||||
isPriceItem,
|
||||
} from "@utils/productDisplayUtils/getItemType.js";
|
||||
} from "@utils/productV2Utils/productItemUtils/getItemType.js";
|
||||
import { notNullish } from "@utils/utils.js";
|
||||
import { z } from "zod/v4";
|
||||
import type { CusProductLegacyData } from "../cusProductLegacyData.js";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { z } from "zod/v4";
|
||||
import { AppEnv } from "../genModels/genEnums.js";
|
||||
import { FreeTrialSchema } from "../productModels/freeTrialModels/freeTrialModels.js";
|
||||
import { ProductItemSchema } from "./productItemModels/productItemModels.js";
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { z } from "zod";
|
||||
import { z } from "zod/v4";
|
||||
import { ApiProductPropertiesSchema } from "../../api/products/apiProduct.js";
|
||||
import { AttachScenario } from "../checkModels/checkPreviewModels.js";
|
||||
import { AppEnv } from "../genModels/genEnums.js";
|
||||
import { ProductItemInterval } from "../productV2Models/productItemModels/productItemModels.js";
|
||||
import { ProductPropertiesSchema } from "../productV2Models/productResponseModels.js";
|
||||
|
||||
export const PlanResponseSchema = z.object({
|
||||
id: z.string(),
|
||||
@@ -30,5 +30,5 @@ export const PlanResponseSchema = z.object({
|
||||
// base_variant_id: z.string().nullable(),
|
||||
|
||||
scenario: z.nativeEnum(AttachScenario).optional(),
|
||||
properties: ProductPropertiesSchema.optional(),
|
||||
properties: ApiProductPropertiesSchema.optional(),
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { ProductItem, ProductV2 } from "../index.js";
|
||||
import {
|
||||
isFeaturePriceItem,
|
||||
isPriceItem,
|
||||
} from "./productDisplayUtils/getItemType.js";
|
||||
} from "./productV2Utils/productItemUtils/getItemType.js";
|
||||
import { nullish } from "./utils.js";
|
||||
|
||||
export const isFreeProductV2 = ({ items }: { items: ProductItem[] }) => {
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import { ApiProductItemSchema } from "@api/products/apiProductItem.js";
|
||||
import { Decimal } from "decimal.js";
|
||||
import type { FeatureOptions } from "../../models/cusProductModels/cusProductModels.js";
|
||||
import type { Feature } from "../../models/featureModels/featureModels.js";
|
||||
import type { FeatureOptions } from "@models/cusProductModels/cusProductModels.js";
|
||||
import type { Feature } from "@models/featureModels/featureModels.js";
|
||||
import {
|
||||
type PriceTier,
|
||||
type ProductItem,
|
||||
UsageModel,
|
||||
} from "../../models/productV2Models/productItemModels/productItemModels.js";
|
||||
import { toApiFeature } from "../featureUtils.js";
|
||||
import { getProductItemDisplay } from "../productDisplayUtils.js";
|
||||
import { notNullish } from "../utils.js";
|
||||
} from "@models/productV2Models/productItemModels/productItemModels.js";
|
||||
import { toApiFeature } from "@utils/featureUtils.js";
|
||||
import { getProductItemDisplay } from "@utils/productDisplayUtils.js";
|
||||
import { notNullish } from "@utils/utils.js";
|
||||
import { getItemType } from "./getItemType.js";
|
||||
|
||||
export const calculateProrationAmount = ({
|
||||
@@ -67,7 +68,7 @@ export const itemToPriceOrTiers = ({
|
||||
if (item.tiers.length > 1) {
|
||||
return {
|
||||
price: undefined,
|
||||
tiers: item.tiers.map((tier) => ({
|
||||
tiers: item.tiers.map((tier: PriceTier) => ({
|
||||
...tier,
|
||||
amount: proration
|
||||
? calculateProrationAmount({
|
||||
|
||||
@@ -12,6 +12,7 @@ import type { Price } from "../../../models/productModels/priceModels/priceModel
|
||||
import { Infinite } from "../../../models/productModels/productEnums.js";
|
||||
import {
|
||||
type ProductItem,
|
||||
type ProductItemConfig,
|
||||
ProductItemFeatureType,
|
||||
TierInfinite,
|
||||
UsageModel,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { z } from "zod";
|
||||
import type { z } from "zod/v4";
|
||||
import type { ProductV2 } from "../../models/productV2Models/productV2Models.js";
|
||||
import type { PlanResponseSchema } from "../../models/productV3Models/productV3Response.js";
|
||||
import { productV2ToBasePrice } from "./productItemUtils/productV3ItemUtils.js";
|
||||
|
||||
Reference in New Issue
Block a user