Skip to content

Commit 52a2409

Browse files
committed
update nullable totals
1 parent 38b1d42 commit 52a2409

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/clerk-js/src/utils/billing.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@ export const billingTotalsFromJSON = <T extends BillingStatementTotalsJSON | Bil
2525
taxTotal: billingMoneyAmountFromJSON(data.tax_total),
2626
};
2727

28-
if ('total_due_now' in data) {
28+
if ('total_due_now' in data && data.total_due_now) {
2929
totals.totalDueNow = billingMoneyAmountFromJSON(data.total_due_now);
3030
}
31-
if ('credit' in data) {
31+
if ('credit' in data && data.credit) {
3232
totals.credit = billingMoneyAmountFromJSON(data.credit);
3333
}
34-
if ('past_due' in data) {
34+
if ('past_due' in data && data.past_due) {
3535
totals.pastDue = billingMoneyAmountFromJSON(data.past_due);
3636
}
3737

38+
// WHY `total_due_after_free_trial` and why `proration`
39+
3840
return totals as T extends { total_due_now: BillingMoneyAmountJSON } ? BillingCheckoutTotals : BillingStatementTotals;
3941
};

0 commit comments

Comments
 (0)