Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/billing-web/e2e/fixtures/scenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export function capabilitiesWith(
can_edit_workspace: false,
can_invite_members: false,
can_manage_auto_top_up: false,
can_view_auto_top_up: false,
can_view_auto_top_up_member_notice: false,
can_manage_members: false,
can_manage_subscription: true,
can_open_plans: true,
Expand Down
1 change: 1 addition & 0 deletions apps/billing-web/src/checkout/endingScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const REFUSAL_COPY: Readonly<Record<CapabilityDenialReason, RefusalCopy>> = {
membership_managed_by_directory: 'unknown',
personal_workspace_creator: 'unknown',
workspace_creator: 'unknown',
workspace_owner: 'unknown',
only_owner: 'unknown',
billing_state_unknown: 'unknown',
topup_purchases_paused: 'unknown',
Expand Down
2 changes: 2 additions & 0 deletions apps/billing-web/src/test/fakeBillingClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ export function createFakeBillingClient(
can_edit_workspace: false,
can_invite_members: false,
can_manage_auto_top_up: false,
can_view_auto_top_up: false,
can_view_auto_top_up_member_notice: false,
can_manage_members: false,
can_manage_subscription: false,
can_open_plans: false,
Expand Down
3 changes: 3 additions & 0 deletions browser_tests/fixtures/data/billingCapabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export function createBillingCapabilities(
can_view_team_usage: false,
can_edit_workspace: false,
can_manage_auto_top_up: false,
can_view_auto_top_up: false,
can_view_auto_top_up_member_notice: false,
can_manage_subscription: true,
can_open_plans: true,
can_run_workflows: false,
Expand Down Expand Up @@ -77,6 +79,7 @@ export function createWorkspaceBillingCapabilities(
can_reactivate: isOwner,
can_subscribe_self_serve: isOwner,
can_top_up: isOwner,
can_view_auto_top_up_member_notice: !isOwner,
...overrides
})
}
2 changes: 2 additions & 0 deletions packages/account-core/src/core/billing/capabilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ const CAPABILITIES = {
can_revert_scheduled_change: false,
can_edit_workspace: false,
can_manage_auto_top_up: false,
can_view_auto_top_up: false,
can_view_auto_top_up_member_notice: false,
can_manage_subscription: false,
can_open_plans: false,
can_run_workflows: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ const NO_RIGHTS: BillingCapabilities = {
can_invite_members: false,
can_leave_workspace: false,
can_manage_auto_top_up: false,
can_view_auto_top_up: false,
can_view_auto_top_up_member_notice: false,
can_manage_billing: false,
can_manage_members: false,
can_manage_partner_node_access: false,
Expand Down
2 changes: 2 additions & 0 deletions packages/account-core/src/core/billing/capabilityDenials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export type CapabilityDenialReason =
| 'membership_managed_by_directory'
| 'personal_workspace_creator'
| 'workspace_creator'
| 'workspace_owner'
| 'only_owner'
| 'billing_state_unknown'
| 'free_tier_exhausted'
Expand Down Expand Up @@ -95,6 +96,7 @@ const KNOWN_REASONS: Readonly<
membership_managed_by_directory: true,
personal_workspace_creator: true,
workspace_creator: true,
workspace_owner: true,
only_owner: true,
billing_state_unknown: true,
free_tier_exhausted: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ function capabilities(): Capabilities {
can_edit_workspace: true,
can_invite_members: true,
can_manage_auto_top_up: true,
can_view_auto_top_up: true,
can_view_auto_top_up_member_notice: false,
can_manage_members: true,
can_manage_subscription: true,
can_open_plans: true,
Expand Down Expand Up @@ -64,9 +66,11 @@ function capabilitiesBody(
expectTypeOf<keyof CapabilitiesResponse>().toEqualTypeOf<
| 'auto_top_up_enabled'
| 'auto_top_up_setup'
| 'billing_notice_audience'
| 'capabilities'
| 'denied_reason_params'
| 'denied_reasons'
| 'ending_notice_starts_at'
| 'expires_at'
| 'has_parked_billing_operation'
| 'payment_recovery_available'
Expand Down Expand Up @@ -97,6 +101,8 @@ expectTypeOf<Capabilities>().toEqualTypeOf<{
can_subscribe_self_serve: boolean
can_top_up: boolean
can_upgrade: boolean
can_view_auto_top_up: boolean
can_view_auto_top_up_member_notice: boolean
can_view_own_usage?: boolean | undefined
can_view_pending_invites: boolean
can_view_team_usage: boolean
Expand Down
2 changes: 2 additions & 0 deletions packages/account-core/src/core/billing/scopedReader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ function capabilitiesBody(overrides: Record<string, unknown> = {}) {
can_revert_scheduled_change: false,
can_edit_workspace: false,
can_manage_auto_top_up: false,
can_view_auto_top_up: false,
can_view_auto_top_up_member_notice: false,
can_manage_subscription: false,
can_open_plans: false,
can_run_workflows: false,
Expand Down
2 changes: 2 additions & 0 deletions packages/account-core/src/core/billing/topup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ const CAPABILITIES = {
can_revert_scheduled_change: false,
can_edit_workspace: false,
can_manage_auto_top_up: false,
can_view_auto_top_up: false,
can_view_auto_top_up_member_notice: false,
can_manage_subscription: false,
can_open_plans: false,
can_run_workflows: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ export const CAPABILITIES = {
can_revert_scheduled_change: false,
can_edit_workspace: false,
can_manage_auto_top_up: false,
can_view_auto_top_up: false,
can_view_auto_top_up_member_notice: false,
can_manage_subscription: false,
can_open_plans: false,
can_run_workflows: false,
Expand Down
109 changes: 104 additions & 5 deletions packages/ingest-types/src/types.gen.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 31 additions & 4 deletions packages/ingest-types/src/zod.gen.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/platform/auth/webSessionFlagOff.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ const CAPABILITIES = {
can_view_team_usage: false,
can_edit_workspace: false,
can_manage_auto_top_up: false,
can_view_auto_top_up: false,
can_view_auto_top_up_member_notice: false,
can_manage_subscription: false,
can_open_plans: false,
can_run_workflows: false,
Expand Down
2 changes: 2 additions & 0 deletions src/platform/auth/webSessionFlagOn.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,8 @@ function capabilitiesResponse({
can_view_team_usage: false,
can_edit_workspace: false,
can_manage_auto_top_up: false,
can_view_auto_top_up: false,
can_view_auto_top_up_member_notice: false,
can_manage_subscription: false,
can_open_plans: false,
can_run_workflows: false,
Expand Down
2 changes: 2 additions & 0 deletions src/platform/billing/api/__mocks__/billingApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export const billingApi = vi.mockObject<typeof realBillingApi>(
can_view_team_usage: false,
can_edit_workspace: false,
can_manage_auto_top_up: false,
can_view_auto_top_up: false,
can_view_auto_top_up_member_notice: false,
can_manage_subscription: false,
can_open_plans: false,
can_run_workflows: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ function capabilitiesBody(deniedReasons: Record<string, string>) {
can_invite_members: false,
can_leave_workspace: false,
can_manage_auto_top_up: false,
can_view_auto_top_up: false,
can_view_auto_top_up_member_notice: false,
can_manage_billing: true,
can_manage_members: false,
can_manage_partner_node_access: false,
Expand Down
Loading
Loading