Skip to content

Commit fbaffb2

Browse files
committed
remove fields and add comments
1 parent 2554a2f commit fbaffb2

File tree

1 file changed

+21
-35
lines changed

1 file changed

+21
-35
lines changed

packages/backend/src/api/resources/CommercePlan.ts

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import { Feature } from './Feature';
22
import type { CommercePlanJSON } from './JSON';
33

4-
/**
5-
* The Backend `Organization` object is similar to the [`Organization`](https://clerk.com/docs/references/javascript/organization) object as it holds information about an organization, as well as methods for managing it. However, the Backend `Organization` object is different in that it is used in the [Backend API](https://clerk.com/docs/reference/backend-api/tag/Organizations#operation/ListOrganizations){{ target: '_blank' }} and is not directly accessible from the Frontend API.
6-
*/
7-
8-
type CommerceAmount = {
4+
type CommerceFee = {
95
amount: number;
106
amountFormatted: string;
117
currency: string;
@@ -15,65 +11,60 @@ type CommerceAmount = {
1511
export class CommercePlan {
1612
constructor(
1713
/**
18-
* The unique identifier for the organization.
14+
* The unique identifier for the plan.
1915
*/
2016
readonly id: string,
2117
/**
22-
* The name of the organization.
18+
* The id of the product the plan belongs to.
2319
*/
2420
readonly productId: string,
2521
/**
26-
* The URL-friendly identifier of the user's active organization. If supplied, it must be unique for the instance.
22+
* The name of the plan.
2723
*/
2824
readonly name: string,
2925
/**
30-
* Holds the organization's logo. Compatible with Clerk's [Image Optimization](https://clerk.com/docs/guides/image-optimization).
26+
* The URL-friendly identifier of the plan.
3127
*/
3228
readonly slug: string,
3329
/**
34-
* Whether the organization has an image.
30+
* The description of the plan.
3531
*/
3632
readonly description: string | undefined,
3733
/**
38-
* The date when the organization was first created.
34+
* Whether the plan is the default plan.
3935
*/
4036
readonly isDefault: boolean,
4137
/**
42-
* The date when the organization was last updated.
38+
* Whether the plan is recurring.
4339
*/
4440
readonly isRecurring: boolean,
4541
/**
46-
* Metadata that can be read from the Frontend API and [Backend API](https://clerk.com/docs/reference/backend-api){{ target: '_blank' }} and can be set only from the Backend API.
42+
* Whether the plan has a base fee.
4743
*/
48-
readonly amount: number,
44+
readonly hasBaseFee: boolean,
4945
/**
50-
* Metadata that can be read and set only from the [Backend API](https://clerk.com/docs/reference/backend-api){{ target: '_blank' }}.
46+
* Whether the plan is displayed in the `<PriceTable/>` component.
5147
*/
52-
readonly period: 'month' | 'annual',
48+
readonly publiclyVisible: boolean,
5349
/**
54-
* The maximum number of memberships allowed in the organization.
50+
* The monthly fee of the plan.
5551
*/
56-
readonly interval: number,
52+
readonly fee: CommerceFee,
5753
/**
58-
* Whether the organization allows admins to delete users.
54+
* The annual fee of the plan.
5955
*/
60-
readonly hasBaseFee: boolean,
56+
readonly annualFee: CommerceFee,
6157
/**
62-
* The number of members in the organization.
58+
* The annual fee of the plan on a monthly basis.
6359
*/
64-
readonly currency: string,
60+
readonly annualMonthlyFee: CommerceFee,
6561
/**
66-
* The ID of the user who created the organization.
62+
* The type of payer for the plan.
6763
*/
68-
readonly annualMonthlyAmount: number,
64+
readonly forPayerType: 'org' | 'user',
6965
/**
70-
* Whether the organization allows admins to delete users.
66+
* The features the plan offers.
7167
*/
72-
readonly publiclyVisible: boolean,
73-
readonly fee: CommerceAmount,
74-
readonly annualFee: CommerceAmount,
75-
readonly annualMonthlyFee: CommerceAmount,
76-
readonly forPayerType: 'org' | 'user',
7768
readonly features: Feature[],
7869
) {}
7970

@@ -94,12 +85,7 @@ export class CommercePlan {
9485
data.description,
9586
data.is_default,
9687
data.is_recurring,
97-
data.amount,
98-
data.period,
99-
data.interval,
10088
data.has_base_fee,
101-
data.currency,
102-
data.annual_monthly_amount,
10389
data.publicly_visible,
10490
formatAmountJSON(data.fee),
10591
formatAmountJSON(data.annual_fee),

0 commit comments

Comments
 (0)