Skip to content

Commit c9116b2

Browse files
authored
Merge branch 'main' into dr-feat-livepreview
2 parents 0e86b28 + 1522622 commit c9116b2

File tree

5 files changed

+4
-71
lines changed

5 files changed

+4
-71
lines changed

src/locales/en/main.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,7 +1895,6 @@
18951895
"perMonth": "/ month",
18961896
"usdPerMonth": "USD / month",
18971897
"renewsDate": "Renews {date}",
1898-
"refreshesOn": "Refreshes to ${monthlyCreditBonusUsd} on {date}",
18991898
"expiresDate": "Expires {date}",
19001899
"manageSubscription": "Manage subscription",
19011900
"partnerNodesBalance": "\"Partner Nodes\" Credit Balance",
@@ -1908,7 +1907,7 @@
19081907
"monthlyBonusDescription": "Monthly credit bonus",
19091908
"prepaidDescription": "Pre-paid credits",
19101909
"prepaidCreditsInfo": "Pre-paid credits expire after 1 year from purchase date.",
1911-
"creditsRemainingThisMonth": "Credits remaining for this month",
1910+
"creditsRemainingThisMonth": "Credits remaining this month",
19121911
"creditsYouveAdded": "Credits you've added",
19131912
"monthlyCreditsInfo": "These credits refresh monthly and don't roll over",
19141913
"viewMoreDetailsPlans": "View more details about plans & pricing",

src/platform/cloud/subscription/components/SubscriptionPanel.vue

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -138,19 +138,6 @@
138138
>
139139
{{ $t('subscription.creditsRemainingThisMonth') }}
140140
</div>
141-
<Button
142-
v-tooltip="refreshTooltip"
143-
icon="pi pi-question-circle"
144-
text
145-
rounded
146-
size="small"
147-
class="h-4 w-4 shrink-0"
148-
:pt="{
149-
icon: {
150-
class: 'text-text-secondary text-xs'
151-
}
152-
}"
153-
/>
154141
</div>
155142
</div>
156143
<div class="flex items-center gap-4">
@@ -440,7 +427,6 @@ const { totalCredits, monthlyBonusCredits, prepaidCredits, isLoadingBalance } =
440427
441428
const {
442429
isLoadingSupport,
443-
refreshTooltip,
444430
handleAddApiCredits,
445431
handleMessageSupport,
446432
handleRefresh,

src/platform/cloud/subscription/composables/useSubscriptionActions.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { computed, onMounted, ref } from 'vue'
2-
import { useI18n } from 'vue-i18n'
1+
import { onMounted, ref } from 'vue'
32

43
import { useFirebaseAuthActions } from '@/composables/auth/useFirebaseAuthActions'
54
import { useSubscription } from '@/platform/cloud/subscription/composables/useSubscription'
@@ -8,30 +7,18 @@ import { useTelemetry } from '@/platform/telemetry'
87
import { useDialogService } from '@/services/dialogService'
98
import { useCommandStore } from '@/stores/commandStore'
109

11-
const MONTHLY_CREDIT_BONUS_USD = 10
12-
1310
/**
1411
* Composable for handling subscription panel actions and loading states
1512
*/
1613
export function useSubscriptionActions() {
17-
const { t } = useI18n()
1814
const dialogService = useDialogService()
1915
const authActions = useFirebaseAuthActions()
2016
const commandStore = useCommandStore()
2117
const telemetry = useTelemetry()
22-
const { fetchStatus, formattedRenewalDate } = useSubscription()
18+
const { fetchStatus } = useSubscription()
2319

2420
const isLoadingSupport = ref(false)
2521

26-
const refreshTooltip = computed(() => {
27-
const date =
28-
formattedRenewalDate.value || t('subscription.nextBillingCycle')
29-
return t('subscription.refreshesOn', {
30-
monthlyCreditBonusUsd: MONTHLY_CREDIT_BONUS_USD,
31-
date
32-
})
33-
})
34-
3522
onMounted(() => {
3623
void handleRefresh()
3724
})
@@ -72,7 +59,6 @@ export function useSubscriptionActions() {
7259

7360
return {
7461
isLoadingSupport,
75-
refreshTooltip,
7662
handleAddApiCredits,
7763
handleMessageSupport,
7864
handleRefresh,

tests-ui/tests/platform/cloud/subscription/components/SubscriptionPanel.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ const mockCreditsData = {
4242

4343
const mockActionsData = {
4444
isLoadingSupport: false,
45-
refreshTooltip: 'Refreshes on 2024-12-31',
4645
handleAddApiCredits: vi.fn(),
4746
handleMessageSupport: vi.fn(),
4847
handleRefresh: vi.fn(),

tests-ui/tests/platform/cloud/subscription/composables/useSubscriptionActions.test.ts

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,16 @@ const mockFetchBalance = vi.fn()
77
const mockFetchStatus = vi.fn()
88
const mockShowTopUpCreditsDialog = vi.fn()
99
const mockExecute = vi.fn()
10-
const mockT = vi.fn((key: string, values?: any) => {
11-
if (key === 'subscription.nextBillingCycle') return 'next billing cycle'
12-
if (key === 'subscription.refreshesOn') {
13-
return `Refreshes to $${values?.monthlyCreditBonusUsd} on ${values?.date}`
14-
}
15-
return key
16-
})
17-
18-
vi.mock('vue-i18n', async (importOriginal) => {
19-
const actual = await importOriginal<typeof import('vue-i18n')>()
20-
return {
21-
...actual,
22-
useI18n: () => ({
23-
t: mockT
24-
})
25-
}
26-
})
2710

2811
vi.mock('@/composables/auth/useFirebaseAuthActions', () => ({
2912
useFirebaseAuthActions: () => ({
3013
fetchBalance: mockFetchBalance
3114
})
3215
}))
3316

34-
const mockFormattedRenewalDate = { value: '2024-12-31' }
35-
3617
vi.mock('@/platform/cloud/subscription/composables/useSubscription', () => ({
3718
useSubscription: () => ({
38-
fetchStatus: mockFetchStatus,
39-
formattedRenewalDate: mockFormattedRenewalDate
19+
fetchStatus: mockFetchStatus
4020
})
4121
}))
4222

@@ -62,23 +42,6 @@ Object.defineProperty(window, 'open', {
6242
describe('useSubscriptionActions', () => {
6343
beforeEach(() => {
6444
vi.clearAllMocks()
65-
mockFormattedRenewalDate.value = '2024-12-31'
66-
})
67-
68-
describe('refreshTooltip', () => {
69-
it('should format tooltip with renewal date', () => {
70-
const { refreshTooltip } = useSubscriptionActions()
71-
expect(refreshTooltip.value).toBe('Refreshes to $10 on 2024-12-31')
72-
})
73-
74-
it('should use fallback text when no renewal date', () => {
75-
mockFormattedRenewalDate.value = ''
76-
const { refreshTooltip } = useSubscriptionActions()
77-
expect(refreshTooltip.value).toBe(
78-
'Refreshes to $10 on next billing cycle'
79-
)
80-
expect(mockT).toHaveBeenCalledWith('subscription.nextBillingCycle')
81-
})
8245
})
8346

8447
describe('handleAddApiCredits', () => {

0 commit comments

Comments
 (0)