fix(codebuddy-cn): show bonus packs as one-time, not monthly-replenishing

CodeBuddy CN bonus packs ("Bonus Pack N") are one-shot credits whose
CycleEndTime equals DeductionEndTime — they expire for good and never
replenish. The dashboard rendered their resetAt as "Reset in Xd",
implying a monthly refill.

Tag bonus packs recurring:false (refill packs recurring:true) in the
usage handler, forward the flag through parseQuotaData, and word the
quota table / progress bar as "Expires in" / "Expires at" for
one-shot packs.
This commit is contained in:
whale9820
2026-06-29 15:22:47 +07:00
committed by decolua
parent eff81b1242
commit 95bfc64f06
7 changed files with 73 additions and 6 deletions
@@ -433,6 +433,24 @@ export function parseQuotaData(provider, data) {
}
break;
case "codebuddy-cn":
// CodeBuddy CN mixes recurring refill packs ("Monthly"/"Weekly"/...)
// with one-shot bonus packs ("Bonus Pack N"). Forward `recurring`
// so the UI can show "Expires in" for bonus packs (whose resetAt is
// a hard expiry, not a refresh) instead of "Reset in".
if (data.quotas) {
Object.entries(data.quotas).forEach(([name, quota]) => {
normalizedQuotas.push({
name,
used: quota.used || 0,
total: quota.total || 0,
resetAt: quota.resetAt || null,
recurring: quota.recurring !== false,
});
});
}
break;
default:
// Generic fallback for unknown providers
if (data.quotas) {