Line data Source code
1 : import type {
2 : CreditsBreakdownCopy,
3 : CreditsCardCopy
4 : } from '@comfyorg/account-ui/billing'
5 : import { computed } from 'vue'
6 : import { useI18n } from 'vue-i18n'
7 :
8 2355 : const k = 'workspacePanel.billingTab.credits'
9 :
10 : /** The Billing tab Credits card strings in the app locale. */
11 5 : export function useCreditsCardCopy() {
12 5 : const { t } = useI18n()
13 5 : return computed<CreditsCardCopy>(() => ({
14 : title: t(`${k}.title`),
15 : rateInfo: t(`${k}.tooltipLabel`),
16 : rateTooltip: t(`${k}.tooltip`),
17 : available: t(`${k}.available`),
18 : unavailable: t(`${k}.unavailable`),
19 : tryAgain: t('workspacePanel.billingTab.tryAgain'),
20 : overdrawn: (count, credits) => t(`${k}.overdrawn`, { count }, credits),
21 : plan: t(`${k}.plan`),
22 : planTooltip: t(`${k}.planTooltip`),
23 : planOfPool: t(`${k}.planOfPool`, {
24 : remaining: '{remaining}',
25 : total: '{total}'
26 : }),
27 : planUsed: (percent) => t(`${k}.planUsed`, { percent }),
28 : refills: (date) => t('subscription.refillsDate', { date }),
29 : refillsAfterPayment: t('subscription.refillsAfterPayment'),
30 : availableUntil: (date) => t(`${k}.availableUntil`, { date }),
31 : topUp: t(`${k}.topUp`),
32 : topUpTooltip: t(`${k}.topUpTooltip`),
33 : inUse: t(`${k}.inUse`),
34 : addCredits: t(`${k}.addCredits`),
35 : addCreditsReason: (reasonKey) => t(reasonKey)
36 : }))
37 : }
38 :
39 : /** The credits flyout breakdown strings in the app locale. */
40 4 : export function useCreditsBreakdownCopy() {
41 4 : const { t } = useI18n()
42 4 : return computed<CreditsBreakdownCopy>(() => ({
43 : planCredits: t('profileMenu.planCredits'),
44 : topUpCredits: t('profileMenu.topUpCredits'),
45 : planOfPool: t(`${k}.planOfPool`, {
46 : remaining: '{remaining}',
47 : total: '{total}'
48 : }),
49 : refills: (date) => t('subscription.refillsDate', { date }),
50 : refillsAfterPayment: t('subscription.refillsAfterPayment'),
51 : availableUntil: (date) => t(`${k}.availableUntil`, { date }),
52 : unavailable: t('profileMenu.balanceUnavailable')
53 : }))
54 : }
|