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
10 changes: 10 additions & 0 deletions src/workbench/extensions/agent/AgentPanelRoot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1588,6 +1588,16 @@ describe('AgentPanelRoot standing credits-exhausted paywall', () => {
expect(telemetry.trackAgentPaywallShown).not.toHaveBeenCalled()
})

it('stays hidden before Agent consent is accepted', async () => {
Object.assign(useAgentConsentStore(), { accepted: false })
paywallHasFunds.value = false
render(AgentPanelRoot, { global: { plugins: [i18n] } })
await screen.findByRole('textbox')

expect(screen.queryByTestId(STANDING)).not.toBeInTheDocument()
expect(telemetry.trackAgentPaywallShown).not.toHaveBeenCalled()
})

it('stays hidden on the legacy rail whose unloaded balance reads as false', async () => {
paywallHasFunds.value = false
paywallBilling.type = 'legacy'
Expand Down
3 changes: 2 additions & 1 deletion src/workbench/extensions/agent/AgentPanelRoot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ const {
fetchStatus: refreshBillingStatus
} = useBillingContext()
const conversationStore = useAgentConversationStore()
const { accepted: consentAccepted } = storeToRefs(useAgentConsentStore())
watch(
subscription,
(currentSubscription) => {
Expand Down Expand Up @@ -263,6 +264,7 @@ watch(
*/
const agentHasFunds = computed(() => subscription.value?.agentHasFunds)
const creditsExhausted = computed(() => {
if (!consentAccepted.value) return false
if (billingType.value !== 'workspace') return false
// Same gate as the impression report above: an unsettled read cannot say
// which presentation is right, and a card naming the wrong remediation is
Expand Down Expand Up @@ -460,7 +462,6 @@ onBeforeUnmount(() =>
}
})
)
const { accepted: consentAccepted } = storeToRefs(useAgentConsentStore())
const { withConsent } = useAgentConsent()
const workspaceStore = useTeamWorkspaceStore()
const onboardingKey = computed(() =>
Expand Down
Loading