diff --git a/.changeset/seven-trees-double.md b/.changeset/seven-trees-double.md new file mode 100644 index 00000000000..373d59848d6 --- /dev/null +++ b/.changeset/seven-trees-double.md @@ -0,0 +1,6 @@ +--- +'@clerk/clerk-js': minor +'@clerk/types': minor +--- + +[Billing Beta] Drop top level billing flags from environment. Instead, use the payer specific flags. diff --git a/packages/clerk-js/src/core/resources/CommerceSettings.ts b/packages/clerk-js/src/core/resources/CommerceSettings.ts index 26909c9b756..4a543ec9ea3 100644 --- a/packages/clerk-js/src/core/resources/CommerceSettings.ts +++ b/packages/clerk-js/src/core/resources/CommerceSettings.ts @@ -8,9 +8,6 @@ import { BaseResource } from './internal'; export class CommerceSettings extends BaseResource implements CommerceSettingsResource { billing: CommerceSettingsResource['billing'] = { stripePublishableKey: '', - enabled: false, - hasPaidUserPlans: false, - hasPaidOrgPlans: false, organization: { enabled: false, hasPaidPlans: false, @@ -32,9 +29,6 @@ export class CommerceSettings extends BaseResource implements CommerceSettingsRe } this.billing.stripePublishableKey = data.billing.stripe_publishable_key || ''; - this.billing.enabled = data.billing.enabled || false; - this.billing.hasPaidUserPlans = data.billing.has_paid_user_plans || false; - this.billing.hasPaidOrgPlans = data.billing.has_paid_org_plans || false; this.billing.organization.enabled = data.billing.organization.enabled || false; this.billing.organization.hasPaidPlans = data.billing.organization.has_paid_plans || false; this.billing.user.enabled = data.billing.user.enabled || false; @@ -47,9 +41,6 @@ export class CommerceSettings extends BaseResource implements CommerceSettingsRe return { billing: { stripe_publishable_key: this.billing.stripePublishableKey, - enabled: this.billing.enabled, - has_paid_user_plans: this.billing.hasPaidUserPlans, - has_paid_org_plans: this.billing.hasPaidOrgPlans, organization: { enabled: this.billing.organization.enabled, has_paid_plans: this.billing.organization.hasPaidPlans, diff --git a/packages/clerk-js/src/ui/utils/test/fixtureHelpers.ts b/packages/clerk-js/src/ui/utils/test/fixtureHelpers.ts index b0991810ca1..a39ee6ec76a 100644 --- a/packages/clerk-js/src/ui/utils/test/fixtureHelpers.ts +++ b/packages/clerk-js/src/ui/utils/test/fixtureHelpers.ts @@ -353,13 +353,10 @@ const createOrganizationSettingsFixtureHelpers = (environment: EnvironmentJSON) const createBillingSettingsFixtureHelpers = (environment: EnvironmentJSON) => { const os = environment.commerce_settings.billing; const withBilling = () => { - os.enabled = true; os.user.enabled = true; os.user.has_paid_plans = true; os.organization.enabled = true; os.organization.has_paid_plans = true; - os.has_paid_org_plans = true; - os.has_paid_user_plans = true; }; return { withBilling }; diff --git a/packages/clerk-js/src/ui/utils/test/fixtures.ts b/packages/clerk-js/src/ui/utils/test/fixtures.ts index 9e606c4181d..d8d262c10a3 100644 --- a/packages/clerk-js/src/ui/utils/test/fixtures.ts +++ b/packages/clerk-js/src/ui/utils/test/fixtures.ts @@ -213,7 +213,6 @@ const createBaseCommerceSettings = (): CommerceSettingsJSON => { object: 'commerce_settings', id: 'commerce_settings_1', billing: { - enabled: false, user: { enabled: false, has_paid_plans: false, @@ -222,8 +221,6 @@ const createBaseCommerceSettings = (): CommerceSettingsJSON => { enabled: false, has_paid_plans: false, }, - has_paid_org_plans: false, - has_paid_user_plans: false, stripe_publishable_key: '', }, }; diff --git a/packages/types/src/commerceSettings.ts b/packages/types/src/commerceSettings.ts index f14c61b03e4..7e3617bf58f 100644 --- a/packages/types/src/commerceSettings.ts +++ b/packages/types/src/commerceSettings.ts @@ -4,10 +4,7 @@ import type { CommerceSettingsJSONSnapshot } from './snapshots'; export interface CommerceSettingsJSON extends ClerkResourceJSON { billing: { - enabled: boolean; stripe_publishable_key: string; - has_paid_user_plans: boolean; - has_paid_org_plans: boolean; organization: { enabled: boolean; has_paid_plans: boolean; @@ -21,10 +18,7 @@ export interface CommerceSettingsJSON extends ClerkResourceJSON { export interface CommerceSettingsResource extends ClerkResource { billing: { - enabled: boolean; stripePublishableKey: string; - hasPaidUserPlans: boolean; - hasPaidOrgPlans: boolean; organization: { enabled: boolean; hasPaidPlans: boolean;