mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 04:22:32 +10:00
fix: add regular plan to price type enum (#1184)
Adds the regular plan to our current plan type enum so we can use it for user limit calculations.
This commit is contained in:
@ -19,7 +19,7 @@ export default async function AdminManageUsers({ searchParams = {} }: AdminManag
|
|||||||
|
|
||||||
const [{ users, totalPages }, individualPrices] = await Promise.all([
|
const [{ users, totalPages }, individualPrices] = await Promise.all([
|
||||||
search(searchString, page, perPage),
|
search(searchString, page, perPage),
|
||||||
getPricesByPlan(STRIPE_PLAN_TYPE.COMMUNITY).catch(() => []),
|
getPricesByPlan([STRIPE_PLAN_TYPE.REGULAR, STRIPE_PLAN_TYPE.COMMUNITY]).catch(() => []),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const individualPriceIds = individualPrices.map((price) => price.id);
|
const individualPriceIds = individualPrices.map((price) => price.id);
|
||||||
|
|||||||
@ -39,7 +39,7 @@ export default async function BillingSettingsPage() {
|
|||||||
|
|
||||||
const [subscriptions, prices, primaryAccountPlanPrices] = await Promise.all([
|
const [subscriptions, prices, primaryAccountPlanPrices] = await Promise.all([
|
||||||
getSubscriptionsByUserId({ userId: user.id }),
|
getSubscriptionsByUserId({ userId: user.id }),
|
||||||
getPricesByInterval({ plan: STRIPE_PLAN_TYPE.COMMUNITY }),
|
getPricesByInterval({ plan: STRIPE_PLAN_TYPE.REGULAR }),
|
||||||
getPrimaryAccountPlanPrices(),
|
getPrimaryAccountPlanPrices(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@ -6,5 +6,5 @@ import { getPricesByPlan } from './get-prices-by-plan';
|
|||||||
* Returns the Stripe prices of items that affect the amount of documents a user can create.
|
* Returns the Stripe prices of items that affect the amount of documents a user can create.
|
||||||
*/
|
*/
|
||||||
export const getDocumentRelatedPrices = async () => {
|
export const getDocumentRelatedPrices = async () => {
|
||||||
return await getPricesByPlan([STRIPE_PLAN_TYPE.COMMUNITY, STRIPE_PLAN_TYPE.ENTERPRISE]);
|
return await getPricesByPlan([STRIPE_PLAN_TYPE.REGULAR, STRIPE_PLAN_TYPE.COMMUNITY, STRIPE_PLAN_TYPE.ENTERPRISE]);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import type Stripe from 'stripe';
|
import type Stripe from 'stripe';
|
||||||
|
|
||||||
import { stripe } from '@documenso/lib/server-only/stripe';
|
import { stripe } from '@documenso/lib/server-only/stripe';
|
||||||
|
import type { STRIPE_PLAN_TYPE } from '@documenso/lib/constants/billing';
|
||||||
|
|
||||||
// Utility type to handle usage of the `expand` option.
|
// Utility type to handle usage of the `expand` option.
|
||||||
type PriceWithProduct = Stripe.Price & { product: Stripe.Product };
|
type PriceWithProduct = Stripe.Price & { product: Stripe.Product };
|
||||||
@ -11,7 +12,7 @@ export type GetPricesByIntervalOptions = {
|
|||||||
/**
|
/**
|
||||||
* Filter products by their meta 'plan' attribute.
|
* Filter products by their meta 'plan' attribute.
|
||||||
*/
|
*/
|
||||||
plan?: 'community';
|
plan?: STRIPE_PLAN_TYPE.COMMUNITY | STRIPE_PLAN_TYPE.REGULAR;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getPricesByInterval = async ({ plan }: GetPricesByIntervalOptions = {}) => {
|
export const getPricesByInterval = async ({ plan }: GetPricesByIntervalOptions = {}) => {
|
||||||
|
|||||||
@ -6,5 +6,5 @@ import { getPricesByPlan } from './get-prices-by-plan';
|
|||||||
* Returns the prices of items that count as the account's primary plan.
|
* Returns the prices of items that count as the account's primary plan.
|
||||||
*/
|
*/
|
||||||
export const getPrimaryAccountPlanPrices = async () => {
|
export const getPrimaryAccountPlanPrices = async () => {
|
||||||
return await getPricesByPlan([STRIPE_PLAN_TYPE.COMMUNITY, STRIPE_PLAN_TYPE.ENTERPRISE]);
|
return await getPricesByPlan([STRIPE_PLAN_TYPE.REGULAR, STRIPE_PLAN_TYPE.COMMUNITY, STRIPE_PLAN_TYPE.ENTERPRISE]);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -4,6 +4,7 @@ export enum STRIPE_CUSTOMER_TYPE {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export enum STRIPE_PLAN_TYPE {
|
export enum STRIPE_PLAN_TYPE {
|
||||||
|
REGULAR = 'regular',
|
||||||
TEAM = 'team',
|
TEAM = 'team',
|
||||||
COMMUNITY = 'community',
|
COMMUNITY = 'community',
|
||||||
ENTERPRISE = 'enterprise',
|
ENTERPRISE = 'enterprise',
|
||||||
|
|||||||
Reference in New Issue
Block a user