Skip to content

Commit 6a40902

Browse files
authored
Merge branch 'main' into glary/fix-browser-test-billing-types
2 parents 62ac721 + b1861ab commit 6a40902

43 files changed

Lines changed: 731 additions & 264 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

browser_tests/fixtures/data/cloudWorkspace.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ const TEAM_MAX_SEATS = 30
7474

7575
export const TEAM_BILLING_STATUS = {
7676
is_active: true,
77+
max_seats: 30,
78+
occupied_seats: DEFAULT_TEAM_MEMBERS.length,
7779
subscription_status: 'active',
7880
subscription_tier: 'PRO',
7981
subscription_duration: 'MONTHLY',
@@ -91,6 +93,8 @@ export const ENDED_STANDARD_BILLING_STATUS = {
9193
billing_status: 'inactive',
9294
has_funds: true,
9395
is_active: false,
96+
max_seats: 30,
97+
occupied_seats: DEFAULT_TEAM_MEMBERS.length,
9498
plan_slug: 'standard-monthly',
9599
subscription_duration: 'MONTHLY',
96100
subscription_status: 'ended',

browser_tests/tests/billingFacadeConsumers.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ const toWorkspaceStatus = (
4141
s: CloudSubscriptionStatusResponse
4242
): BillingStatusResponse => ({
4343
is_active: s.is_active ?? false,
44+
max_seats: 1,
45+
occupied_seats: 1,
4446
subscription_tier: s.subscription_tier ?? undefined,
4547
subscription_duration: s.subscription_duration ?? undefined,
4648
renewal_date: s.renewal_date ?? undefined,

browser_tests/tests/currentUserPopoverCredits.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ const mockSubscriptionStatus: CloudSubscriptionStatusResponse = {
6060
// visible (free tier would swap it for "Upgrade to add credits").
6161
const mockBillingStatus: BillingStatusResponse = {
6262
is_active: true,
63+
max_seats: 1,
64+
occupied_seats: 1,
6365
subscription_status: 'canceled',
6466
subscription_tier: 'PRO',
6567
subscription_duration: 'MONTHLY',

browser_tests/tests/dialogs/creditsTile.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ const DEFAULT_BALANCE = { amount: 6000, monthly: 5000, prepaid: 1000 }
6262

6363
const mockBillingStatus: BillingStatusResponse = {
6464
is_active: true,
65+
max_seats: 1,
66+
occupied_seats: 1,
6567
subscription_tier: 'PRO',
6668
subscription_duration: 'MONTHLY',
6769
renewal_date: '2099-02-20T12:00:00Z',

browser_tests/tests/dialogs/pricingTableDeepLink.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ const STANDARD_ANNUAL_PLAN = {
8888

8989
const ACTIVE_TEAM_STATUS = {
9090
is_active: true,
91+
max_seats: 50,
92+
occupied_seats: 1,
9193
subscription_status: 'active',
9294
subscription_tier: 'TEAM',
9395
subscription_duration: 'ANNUAL',
@@ -106,6 +108,8 @@ const ACTIVE_TEAM_STATUS = {
106108

107109
const ACTIVE_STANDARD_STATUS = {
108110
is_active: true,
111+
max_seats: 1,
112+
occupied_seats: 1,
109113
subscription_status: 'active',
110114
subscription_tier: 'STANDARD',
111115
subscription_duration: 'ANNUAL',

browser_tests/tests/subgraph/subgraphPromotionDom.spec.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,5 +165,29 @@ test.describe(
165165
})
166166
}
167167
)
168+
169+
test('Can add DOMWidget directly onto node', async ({ comfyPage }) => {
170+
const ksampler = await comfyPage.vueNodes.getFixtureByTitle('KSampler')
171+
await comfyPage.contextMenu.openForVueNode(ksampler.header)
172+
await comfyPage.contextMenu.clickMenuItem('Convert to Subgraph')
173+
174+
expect(
175+
await comfyPage.page.evaluate(() => {
176+
const subgraphNode = graph?.nodes.find(
177+
(n) => n.title === 'New Subgraph'
178+
)
179+
if (!subgraphNode) throw new Error('Failed to find subgraph node')
180+
181+
const el = document.createElement('div')
182+
el.dataset.testid = 'custom-node-widget'
183+
subgraphNode.addDOMWidget('testwidget', 'testwidget', el)
184+
return !!subgraphNode.widgets?.find((w) => w.type === 'testwidget')
185+
}),
186+
'widget exists on node'
187+
).toBeTruthy()
188+
await expect(
189+
comfyPage.page.getByTestId('custom-node-widget')
190+
).toBeAttached()
191+
})
168192
}
169193
)

src/composables/billing/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ export interface BillingState {
9595
teamCreditStops: ComputedRef<TeamCreditStops | null>
9696
/** The team's currently-subscribed credit stop; null for personal/legacy. */
9797
currentTeamCreditStop: ComputedRef<CurrentTeamCreditStop | null>
98+
/** Effective member limit for the current workspace; zero is unlimited. */
99+
maxSeats: ComputedRef<number | null>
100+
/** Seats occupied in the current workspace. */
101+
occupiedSeats: ComputedRef<number | null>
98102
isLoading: Ref<boolean>
99103
error: Ref<string | null>
100104
canAccessSubscriptionFeatures: ComputedRef<boolean>

src/composables/billing/useBillingContext.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import { useBillingContext } from './useBillingContext'
1313

1414
const DEFAULT_BILLING_STATUS: BillingStatusResponse = {
1515
is_active: true,
16+
max_seats: 73,
17+
occupied_seats: 72,
1618
has_funds: true,
1719
subscription_tier: 'PRO',
1820
subscription_duration: 'MONTHLY'
@@ -51,7 +53,7 @@ const {
5153
has_funds: true,
5254
subscription_tier: 'PRO',
5355
subscription_duration: 'MONTHLY'
54-
} as BillingStatusResponse
56+
} as Partial<BillingStatusResponse>
5557
}
5658
}))
5759

@@ -177,7 +179,9 @@ vi.mock('@/platform/cloud/subscription/composables/useBillingPlans', () => ({
177179

178180
vi.mock('@/platform/workspace/api/workspaceApi', () => ({
179181
workspaceApi: {
180-
getBillingStatus: vi.fn(() => Promise.resolve(mockBillingStatus.value)),
182+
getBillingStatus: vi.fn(() =>
183+
Promise.resolve({ ...DEFAULT_BILLING_STATUS, ...mockBillingStatus.value })
184+
),
181185
getBillingBalance: vi.fn().mockResolvedValue({
182186
amount_micros: 10000000,
183187
currency: 'usd'

src/composables/billing/useBillingContext.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ function useBillingContextInternal(): BillingContext {
138138
toValue(activeContext.value.currentTeamCreditStop)
139139
)
140140

141+
const maxSeats = computed(() => toValue(activeContext.value.maxSeats))
142+
const occupiedSeats = computed(() =>
143+
toValue(activeContext.value.occupiedSeats)
144+
)
145+
141146
const canAccessSubscriptionFeatures = computed(() =>
142147
toValue(activeContext.value.canAccessSubscriptionFeatures)
143148
)
@@ -343,6 +348,8 @@ function useBillingContextInternal(): BillingContext {
343348
currentPlanSlug,
344349
teamCreditStops,
345350
currentTeamCreditStop,
351+
maxSeats,
352+
occupiedSeats,
346353
isLoading,
347354
error,
348355
isActiveSubscription,

src/composables/billing/useLegacyBilling.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ export function useLegacyBilling(): BillingState & BillingActions {
4949
() => legacyCanAccessSubscriptionFeatures.value
5050
)
5151
const isFreeTier = computed(() => subscriptionTier.value === 'FREE')
52+
const maxSeats = computed(() => null)
53+
const occupiedSeats = computed(() => null)
5254

5355
const subscription = computed<SubscriptionInfo | null>(() => {
5456
if (!legacyCanAccessSubscriptionFeatures.value && !subscriptionTier.value) {
@@ -209,6 +211,8 @@ export function useLegacyBilling(): BillingState & BillingActions {
209211
currentPlanSlug,
210212
teamCreditStops,
211213
currentTeamCreditStop,
214+
maxSeats,
215+
occupiedSeats,
212216
isLoading,
213217
error,
214218
canAccessSubscriptionFeatures,

0 commit comments

Comments
 (0)