Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+3
-2
@@ -9,7 +9,7 @@ describe("currencies", () => {
|
||||
name: "United States Dollar",
|
||||
value: "usd",
|
||||
symbol: "$",
|
||||
default: true,
|
||||
default: false,
|
||||
disabled: false,
|
||||
parities: [{ from: "usd", parity: 1 }],
|
||||
symbolRight: false,
|
||||
@@ -20,7 +20,8 @@ describe("currencies", () => {
|
||||
name: "Euro",
|
||||
value: "eur",
|
||||
symbol: "€",
|
||||
disabled: true,
|
||||
default: true,
|
||||
disabled: false,
|
||||
parities: [{ from: "usd", parity: 1 }],
|
||||
symbolRight: true,
|
||||
thousandSeparator: ".",
|
||||
|
||||
+3
-2
@@ -5,7 +5,7 @@ const currencies: CurrencyDto[] = [
|
||||
name: "United States Dollar",
|
||||
value: "usd",
|
||||
symbol: "$",
|
||||
default: true,
|
||||
default: false,
|
||||
disabled: false,
|
||||
parities: [{ from: "usd", parity: 1 }],
|
||||
symbolRight: false,
|
||||
@@ -16,7 +16,8 @@ const currencies: CurrencyDto[] = [
|
||||
name: "Euro",
|
||||
value: "eur",
|
||||
symbol: "€",
|
||||
disabled: true,
|
||||
default: true,
|
||||
disabled: false,
|
||||
parities: [{ from: "usd", parity: 1 }],
|
||||
symbolRight: true,
|
||||
thousandSeparator: ".",
|
||||
|
||||
+7
-13
@@ -16,7 +16,7 @@ const UNIT_API_CALL = {
|
||||
|
||||
function generatePrice(currency: string, price: number, billingPeriod: SubscriptionBillingPeriod): SubscriptionPriceDto {
|
||||
return {
|
||||
stripeId: "",
|
||||
billingProviderId: "",
|
||||
subscriptionProductId: "",
|
||||
type: billingPeriod === SubscriptionBillingPeriod.ONCE ? SubscriptionPriceType.ONE_TIME : SubscriptionPriceType.RECURRING,
|
||||
billingPeriod,
|
||||
@@ -56,7 +56,7 @@ function generateUsageBasedPrice(
|
||||
});
|
||||
return {
|
||||
id: "",
|
||||
stripeId: "",
|
||||
billingProviderId: "",
|
||||
subscriptionProductId: "",
|
||||
billingPeriod: SubscriptionBillingPeriod.MONTHLY,
|
||||
currency,
|
||||
@@ -74,7 +74,7 @@ function generateUsageBasedPrice(
|
||||
function generateCommonPlan(order: number, model: PricingModel) {
|
||||
if (order === 1) {
|
||||
return {
|
||||
stripeId: "",
|
||||
billingProviderId: "",
|
||||
order,
|
||||
title: "pricing.products.plan1.title",
|
||||
description: "pricing.products.plan1.description",
|
||||
@@ -112,7 +112,7 @@ function generateCommonPlan(order: number, model: PricingModel) {
|
||||
};
|
||||
} else if (order === 2) {
|
||||
return {
|
||||
stripeId: "",
|
||||
billingProviderId: "",
|
||||
order,
|
||||
title: "pricing.products.plan2.title",
|
||||
description: "pricing.products.plan2.description",
|
||||
@@ -149,7 +149,7 @@ function generateCommonPlan(order: number, model: PricingModel) {
|
||||
};
|
||||
} else if (order === 3) {
|
||||
return {
|
||||
stripeId: "",
|
||||
billingProviderId: "",
|
||||
order,
|
||||
title: "pricing.products.plan3.title",
|
||||
description: "pricing.products.plan3.description",
|
||||
@@ -187,7 +187,7 @@ function generateCommonPlan(order: number, model: PricingModel) {
|
||||
}
|
||||
|
||||
return {
|
||||
stripeId: "",
|
||||
billingProviderId: "",
|
||||
order,
|
||||
title: "pricing.products.plan1.title",
|
||||
description: "pricing.products.plan1.description",
|
||||
@@ -241,12 +241,6 @@ const FLAT_RATE_PRICES: SubscriptionProductDto[] = [
|
||||
},
|
||||
];
|
||||
|
||||
const PER_SEAT_PRICES: SubscriptionProductDto[] = [
|
||||
...FLAT_RATE_PRICES.map((item) => {
|
||||
return { ...item, model: PricingModel.PER_SEAT };
|
||||
}),
|
||||
];
|
||||
|
||||
const USAGE_BASED_PRICES: SubscriptionProductDto[] = [
|
||||
{
|
||||
...generateCommonPlan(1, PricingModel.USAGE_BASED),
|
||||
@@ -327,5 +321,5 @@ const ONE_TIME_PRICES: SubscriptionProductDto[] = [
|
||||
},
|
||||
];
|
||||
|
||||
const plans = [...FLAT_RATE_PRICES, ...PER_SEAT_PRICES, ...USAGE_BASED_PRICES, ...FLAT_RATE_PLUS_USAGE_BASED_PRICES, ...ONE_TIME_PRICES];
|
||||
const plans = [...FLAT_RATE_PRICES, ...USAGE_BASED_PRICES, ...FLAT_RATE_PLUS_USAGE_BASED_PRICES, ...ONE_TIME_PRICES];
|
||||
export default plans;
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import plans from "~/application/pricing/plans.server";
|
||||
import { PricingModel } from "~/application/enums/subscriptions/PricingModel";
|
||||
import { HIVEGRID_SUBSCRIPTION_PRICING_MODELS, isHiveGridSubscriptionPricingModel } from "./pricingModelPolicy";
|
||||
|
||||
describe("HiveGrid subscription pricing model policy", () => {
|
||||
it("does not allow seat-type pricing models", () => {
|
||||
expect(HIVEGRID_SUBSCRIPTION_PRICING_MODELS).not.toContain(PricingModel.PER_SEAT);
|
||||
expect(isHiveGridSubscriptionPricingModel(PricingModel.PER_SEAT)).toBe(false);
|
||||
});
|
||||
|
||||
it("keeps generated admin pricing seeds free of seat-type plans", () => {
|
||||
expect(plans).not.toHaveLength(0);
|
||||
expect(plans.map((plan) => plan.model)).not.toContain(PricingModel.PER_SEAT);
|
||||
});
|
||||
});
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
import { PricingModel } from "~/application/enums/subscriptions/PricingModel";
|
||||
|
||||
export const HIVEGRID_SUBSCRIPTION_PRICING_MODELS = [
|
||||
PricingModel.FLAT_RATE,
|
||||
PricingModel.USAGE_BASED,
|
||||
PricingModel.FLAT_RATE_USAGE_BASED,
|
||||
PricingModel.ONCE,
|
||||
] as const;
|
||||
|
||||
export function isHiveGridSubscriptionPricingModel(model: PricingModel) {
|
||||
return HIVEGRID_SUBSCRIPTION_PRICING_MODELS.includes(model as (typeof HIVEGRID_SUBSCRIPTION_PRICING_MODELS)[number]);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user