Line data Source code
1 : import type {
2 : AutoTopUpCardCopy,
3 : AutoTopUpMemberBlockCopy
4 : } from '@comfyorg/account-ui/billing'
5 : import { computed } from 'vue'
6 : import { useI18n } from 'vue-i18n'
7 :
8 5 : const k = 'workspacePanel.billingTab.autoTopUp'
9 :
10 : /** The Billing tab auto top-up card strings in the app locale. */
11 5 : export function useAutoTopUpCardCopy() {
12 5 : const { t } = useI18n()
13 5 : return computed<AutoTopUpCardCopy>(() => ({
14 : title: t(`${k}.title`),
15 : unavailable: t(`${k}.unavailable`),
16 : tryAgain: t('workspacePanel.billingTab.tryAgain'),
17 : status: {
18 : failed: t(`${k}.status.failed`),
19 : turnedOff: t(`${k}.status.turnedOff`),
20 : off: t(`${k}.status.off`),
21 : on: t(`${k}.status.on`),
22 : onHold: t(`${k}.status.onHold`),
23 : limitReached: t(`${k}.status.limitReached`),
24 : maximumReached: t(`${k}.status.maximumReached`)
25 : },
26 : actions: {
27 : addPaymentMethod: t(`${k}.actions.addPaymentMethod`),
28 : manage: t(`${k}.actions.manage`),
29 : turnOn: t(`${k}.actions.turnOn`),
30 : updatePayment: t(`${k}.actions.updatePayment`)
31 : },
32 : failed: t(`${k}.failed`),
33 : turnedOff: t(`${k}.turnedOff`),
34 : off: t(`${k}.off`),
35 : noPaymentMethod: t(`${k}.noPaymentMethod`),
36 : noDefaultPaymentMethod: t(`${k}.noDefaultPaymentMethod`),
37 : onHold: t(`${k}.onHold`),
38 : rule: (target, threshold) => t(`${k}.rule`, { target, threshold }),
39 : limit: (spent, limit) => t(`${k}.limit`, { spent, limit }),
40 : limitTooltip: (date) => t(`${k}.limitTooltip`, { date }),
41 : limitTooltipNoDate: t(`${k}.limitTooltipNoDate`),
42 : paused: (date) => t(`${k}.paused`, { date }),
43 : pausedNoDate: t(`${k}.pausedNoDate`),
44 : pausedByRemainder: (date) => t(`${k}.pausedByRemainder`, { date }),
45 : pausedByRemainderNoDate: t(`${k}.pausedByRemainderNoDate`),
46 : maximumReached: (date) => t(`${k}.maximumReached`, { date }),
47 : maximumReachedNoDate: t(`${k}.maximumReachedNoDate`)
48 : }))
49 : }
50 :
51 : /** The Billing tab auto top-up member block strings in the app locale. */
52 5 : export function useAutoTopUpMemberBlockCopy() {
53 5 : const { t } = useI18n()
54 5 : return computed<AutoTopUpMemberBlockCopy>(() => ({
55 : title: t(`${k}.title`),
56 : body: t(`${k}.member`),
57 : status: {
58 : failed: t(`${k}.status.failed`),
59 : turnedOff: t(`${k}.status.turnedOff`),
60 : off: t(`${k}.status.off`),
61 : on: t(`${k}.status.on`),
62 : onHold: t(`${k}.status.onHold`),
63 : limitReached: t(`${k}.status.limitReached`),
64 : maximumReached: t(`${k}.status.maximumReached`)
65 : },
66 : on: (target, threshold) => t(`${k}.memberStatus.on`, { target, threshold }),
67 : limitReached: (date) => t(`${k}.memberStatus.limitReached`, { date }),
68 : limitReachedNoDate: t(`${k}.memberStatus.limitReachedNoDate`),
69 : maximumReached: (date) => t(`${k}.memberStatus.maximumReached`, { date }),
70 : maximumReachedNoDate: t(`${k}.memberStatus.maximumReachedNoDate`),
71 : failed: t(`${k}.memberStatus.failed`),
72 : turnedOff: t(`${k}.memberStatus.turnedOff`),
73 : onHold: t(`${k}.memberStatus.onHold`)
74 : }))
75 : }
|