Line data Source code
1 : import { computed } from 'vue'
2 :
3 : import { useBillingBanner } from '@/platform/billing/composables/useBillingBanner'
4 :
5 : interface PausedBannerCopy {
6 : muted: boolean
7 : titleKey: string
8 : bodyKey: string
9 : action: 'updatePayment' | null
10 : }
11 :
12 6 : const OWNER_COPY: PausedBannerCopy = {
13 : muted: false,
14 : titleKey: 'subscription.paymentRecovery.title',
15 : bodyKey: 'workspacePanel.billingStatus.paused.body',
16 : action: 'updatePayment'
17 : }
18 :
19 6 : const MEMBER_COPY: PausedBannerCopy = {
20 : muted: true,
21 : titleKey: 'subscription.paymentRecovery.title',
22 : bodyKey: 'subscription.paymentRecovery.memberDescription',
23 : action: null
24 : }
25 :
26 : /** The Subscription paused copy every billing surface renders for `can_manage_billing` as received. */
27 0 : export function pausedBannerCopy(canManageBilling: boolean): PausedBannerCopy {
28 0 : return canManageBilling ? OWNER_COPY : MEMBER_COPY
29 : }
30 :
31 : /** Whether the served billing status puts the Subscription paused banner on every billing surface. */
32 13 : export function usePausedBanner() {
33 13 : const { kind } = useBillingBanner()
34 13 : return { isPaused: computed(() => kind.value === 'paused') }
35 : }
|