Skip to content

v3.2.0

Latest

Choose a tag to compare

@Molunerfinn Molunerfinn released this 19 Oct 12:33
9193ec0

Features

Stacked plan terms in the PicGo Cloud billing overview

PicGo Cloud now lets redemption codes stack: several vouchers are consumed one after another, from the highest plan to the lowest. A fixed-term membership (a redeemed voucher, an admin grant or a one-time purchase) can also run alongside a subscription. picgo.cloud.getBillingOverview() now exposes this, so clients can show which plan is in use right now, what comes next and when each term ends (#205).

New fields on CloudBillingOverview:

  • fixedTerms: one entry per fixed-term source that is effective now (redemption, admin or purchase), with the plan it currently grants, its end date and the days remaining. For stacked redemptions, the end date covers the whole stacked timeline.
  • redemptionQueue: the redemption segments that start after the current one, in the order they will be consumed, each with its plan, start and end.
  • pendingSubscription: the plan of a paid subscription whose renewal details have not been synced yet, or null.
  • subscription.standing (live, ending, ended or none) and plan.subscription (the plan of the subscription itself), so a client can tell a renewing subscription from one that has ended without parsing the raw provider status.

How to use — Core API:

import { PicGo } from 'picgo'

const picgo = new PicGo()
const overview = await picgo.cloud.getBillingOverview()

// e.g. Max until 2026-10-20, then Pro, then Starter
for (const term of overview?.fixedTerms ?? []) {
  console.log(term.source, term.plan, term.endsAt, term.daysRemaining)
}
for (const segment of overview?.redemptionQueue ?? []) {
  console.log('then', segment.plan, segment.startsAt, '→', segment.endsAt)
}

When connected to an older PicGo Cloud server that does not send these fields, fixedTerms and redemptionQueue are empty arrays and pendingSubscription is null; existing fields are unchanged. The new types (CloudFixedTerm, CloudRedemptionSegment, CloudFixedTermSource, CloudSubscriptionStanding) are exported from picgo.

For client developers

PICGO_MOCK_LIFECYCLE gains scenarios for these cases, so you can preview them without a real account: redemption-stacked, redemption-stacked-long, subscription-with-redemption, subscription-ended-with-redemption and subscription-pending. Mock usage and user info now follow each scenario's plan instead of always reporting Pro.

Full changelog: v3.1.0...v3.2.0