fix(cloud-setup): no 'contact us' in the capability body when [Contact us] is hidden (CAP-GATE-DESKTOP)

This commit is contained in:
Neil
2026-11-12 07:25:35 -08:00
parent 962165869f
commit 71b5941ead
3 changed files with 41 additions and 6 deletions
@@ -0,0 +1,28 @@
import { describe, expect, it } from 'vitest'
import type { Translate } from '@/i18n/use-translate'
import { currentStepCopy } from './cloud-setup-page-copy'
const t: Translate = (_key, fallback) => fallback
describe('CAP-GATE-DESKTOP copy', () => {
const current = { id: 'plan', state: 'needed', need: 'capability' } as const
it('offers "contact us" only when [Contact us] is shown', () => {
const withLink = currentStepCopy(
{ current, action: 'capability-off', contactUrl: 'https://onorca.dev/contact-sales' },
t
)
expect(withLink.title).toBe('Orca Cloud isn’t turned on for your team yet')
expect(withLink.lead).toBe(
'Your team has a plan, but Orca Cloud isn’t turned on for it yet. Try again in a few minutes, or contact us and we’ll turn it on.'
)
})
it('drops "contact us" when the catalog has no contact URL', () => {
const withoutLink = currentStepCopy({ current, action: 'capability-off', contactUrl: null }, t)
expect(withoutLink.lead).toBe(
'Your team has a plan, but Orca Cloud isn’t turned on for it yet. Try again in a few minutes.'
)
expect(withoutLink.lead).not.toMatch(/contact/i)
})
})
@@ -34,7 +34,7 @@ function trialHours(step: CloudSetupStep): string | null {
}
export function currentStepCopy(
flow: Pick<CloudSetupPageModel, 'current' | 'action'>,
flow: Pick<CloudSetupPageModel, 'current' | 'action'> & { contactUrl?: string | null },
t: Translate
): StepCopy {
const step = flow.current
@@ -143,10 +143,16 @@ export function currentStepCopy(
case 'capability-off':
return {
title: t('cloudSetupPage.capability.title', 'Orca Cloud isn’t turned on for your team yet'),
lead: t(
'cloudSetupPage.capability.lead',
'Your team has a plan, but Orca Cloud isn’t turned on for it yet. Try again in a few minutes, or contact us and we’ll turn it on.'
)
// Only offer "contact us" when [Contact us] is shown (a catalog contact URL exists).
lead: flow.contactUrl
? t(
'cloudSetupPage.capability.lead',
'Your team has a plan, but Orca Cloud isn’t turned on for it yet. Try again in a few minutes, or contact us and we’ll turn it on.'
)
: t(
'cloudSetupPage.capability.leadNoContact',
'Your team has a plan, but Orca Cloud isn’t turned on for it yet. Try again in a few minutes.'
)
}
case 'ask-owner':
return {
+2 -1
View File
@@ -28987,7 +28987,8 @@
"tryAgain": "Try again",
"contact": "Contact us",
"title": "Orca Cloud isn’t turned on for your team yet",
"lead": "Your team has a plan, but Orca Cloud isn’t turned on for it yet. Try again in a few minutes, or contact us and we’ll turn it on."
"lead": "Your team has a plan, but Orca Cloud isn’t turned on for it yet. Try again in a few minutes, or contact us and we’ll turn it on.",
"leadNoContact": "Your team has a plan, but Orca Cloud isn’t turned on for it yet. Try again in a few minutes."
}
},
"orcaCloudSignInSheet": {