Skip to content

Commit 66d39cb

Browse files
committed
feat: add ENTERPRISE tier label mapping
Adds ENTERPRISE to the workspace tier-label lookup so an enterprise subscription renders its display name instead of a blank string (tierKeyMap is a loose Record<string, string> that silently returns '' for unmapped keys, so this gap wasn't caught by types). - src/platform/workspace/composables/useWorkspaceTierLabel.ts: add ENTERPRISE -> enterprise mapping - src/locales/en/main.json: add subscription.tiers.enterprise.name - useWorkspaceTierLabel.test.ts: cover the new mapping directly and via the plan-slug fallback; the prior "unknown tier" fallback test used ENTERPRISE_CUSTOM as its example, which now matches, so it was swapped for an example that stays unmapped
1 parent 4c5afc8 commit 66d39cb

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

src/locales/en/main.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2878,6 +2878,9 @@
28782878
"pro": {
28792879
"name": "Pro",
28802880
"feature1": "Longer workflow runtime (up to 1 hr)"
2881+
},
2882+
"enterprise": {
2883+
"name": "Enterprise"
28812884
}
28822885
},
28832886
"required": {

src/platform/workspace/composables/useWorkspaceTierLabel.test.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ vi.mock('vue-i18n', () => ({
1212
'subscription.tiers.standard.name': 'Standard',
1313
'subscription.tiers.creator.name': 'Creator',
1414
'subscription.tiers.pro.name': 'Pro',
15-
'subscription.tiers.founder.name': "Founder's Edition"
15+
'subscription.tiers.founder.name': "Founder's Edition",
16+
'subscription.tiers.enterprise.name': 'Enterprise'
1617
}
1718
return tierNames[key] ?? key
1819
})
@@ -52,6 +53,10 @@ describe('useWorkspaceTierLabel', () => {
5253
)
5354
})
5455

56+
it('maps ENTERPRISE to enterprise label', () => {
57+
expect(formatTierName('ENTERPRISE', false)).toBe('Enterprise')
58+
})
59+
5560
it('falls back to standard for unknown tier', () => {
5661
expect(formatTierName('UNKNOWN_TIER', false)).toBe('')
5762
})
@@ -106,12 +111,21 @@ describe('useWorkspaceTierLabel', () => {
106111
it('returns null when plan slug does not match any known tier', () => {
107112
const result = getTierLabel({
108113
isSubscribed: true,
109-
subscriptionPlan: 'ENTERPRISE_CUSTOM',
114+
subscriptionPlan: 'UNKNOWN_CUSTOM',
110115
subscriptionTier: null
111116
})
112117
expect(result).toBeNull()
113118
})
114119

120+
it('parses ENTERPRISE from plan slug fallback', () => {
121+
const result = getTierLabel({
122+
isSubscribed: true,
123+
subscriptionPlan: 'ENTERPRISE_MONTHLY',
124+
subscriptionTier: null
125+
})
126+
expect(result).toBe('Enterprise')
127+
})
128+
115129
it('handles FOUNDERS_EDITION tier', () => {
116130
const result = getTierLabel({
117131
isSubscribed: true,

src/platform/workspace/composables/useWorkspaceTierLabel.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ const tierKeyMap: Record<string, string> = {
88
CREATOR: 'creator',
99
PRO: 'pro',
1010
FOUNDER: 'founder',
11-
FOUNDERS_EDITION: 'founder'
11+
FOUNDERS_EDITION: 'founder',
12+
ENTERPRISE: 'enterprise'
1213
}
1314

1415
interface WorkspaceSubscriptionInfo {

0 commit comments

Comments
 (0)