From 71b5941ead08108f310b6d7d4cd6fb4a74c4a87f Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 12 Nov 2026 04:56:23 -0800 Subject: [PATCH] fix(cloud-setup): no 'contact us' in the capability body when [Contact us] is hidden (CAP-GATE-DESKTOP) --- .../cloud-setup-page-copy.test.ts | 28 +++++++++++++++++++ .../orca-cloud-setup/cloud-setup-page-copy.ts | 16 +++++++---- src/renderer/src/i18n/locales/en.json | 3 +- 3 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 src/renderer/src/components/orca-cloud-setup/cloud-setup-page-copy.test.ts diff --git a/src/renderer/src/components/orca-cloud-setup/cloud-setup-page-copy.test.ts b/src/renderer/src/components/orca-cloud-setup/cloud-setup-page-copy.test.ts new file mode 100644 index 00000000000..0893ae147f5 --- /dev/null +++ b/src/renderer/src/components/orca-cloud-setup/cloud-setup-page-copy.test.ts @@ -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) + }) +}) diff --git a/src/renderer/src/components/orca-cloud-setup/cloud-setup-page-copy.ts b/src/renderer/src/components/orca-cloud-setup/cloud-setup-page-copy.ts index 4bf530e463f..3b187516306 100644 --- a/src/renderer/src/components/orca-cloud-setup/cloud-setup-page-copy.ts +++ b/src/renderer/src/components/orca-cloud-setup/cloud-setup-page-copy.ts @@ -34,7 +34,7 @@ function trialHours(step: CloudSetupStep): string | null { } export function currentStepCopy( - flow: Pick, + flow: Pick & { 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 { diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json index 60d0093c49f..95aef8a190c 100644 --- a/src/renderer/src/i18n/locales/en.json +++ b/src/renderer/src/i18n/locales/en.json @@ -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": {