@usethrottle/auth 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/react/components/index.cjs +34 -3
- package/dist/react/components/index.cjs.map +1 -1
- package/dist/react/components/index.d.cts +6 -0
- package/dist/react/components/index.d.ts +6 -0
- package/dist/react/components/index.js +34 -3
- package/dist/react/components/index.js.map +1 -1
- package/dist/react/index.d.cts +12 -0
- package/dist/react/index.d.ts +12 -0
- package/package.json +1 -1
|
@@ -303,6 +303,12 @@ declare const enUS: {
|
|
|
303
303
|
viewSubscription: string;
|
|
304
304
|
payButton: string;
|
|
305
305
|
billedTo: string;
|
|
306
|
+
/** Shown when an invoice bills less than the order, matching the PDF. */
|
|
307
|
+
orderTotal: string;
|
|
308
|
+
amountPaid: string;
|
|
309
|
+
waived: string;
|
|
310
|
+
amountDue: string;
|
|
311
|
+
balanceDue: string;
|
|
306
312
|
/** Display copy for `invoice.status` — the wire values are paid|open|void. */
|
|
307
313
|
statusLabels: {
|
|
308
314
|
paid: string;
|
|
@@ -303,6 +303,12 @@ declare const enUS: {
|
|
|
303
303
|
viewSubscription: string;
|
|
304
304
|
payButton: string;
|
|
305
305
|
billedTo: string;
|
|
306
|
+
/** Shown when an invoice bills less than the order, matching the PDF. */
|
|
307
|
+
orderTotal: string;
|
|
308
|
+
amountPaid: string;
|
|
309
|
+
waived: string;
|
|
310
|
+
amountDue: string;
|
|
311
|
+
balanceDue: string;
|
|
306
312
|
/** Display copy for `invoice.status` — the wire values are paid|open|void. */
|
|
307
313
|
statusLabels: {
|
|
308
314
|
paid: string;
|
|
@@ -655,6 +655,12 @@ var enUS = {
|
|
|
655
655
|
viewSubscription: "View subscription",
|
|
656
656
|
payButton: "Pay this invoice",
|
|
657
657
|
billedTo: "Billed to",
|
|
658
|
+
/** Shown when an invoice bills less than the order, matching the PDF. */
|
|
659
|
+
orderTotal: "Order total",
|
|
660
|
+
amountPaid: "Amount paid",
|
|
661
|
+
waived: "Waived",
|
|
662
|
+
amountDue: "Amount due",
|
|
663
|
+
balanceDue: "Balance due",
|
|
658
664
|
/** Display copy for `invoice.status` — the wire values are paid|open|void. */
|
|
659
665
|
statusLabels: { paid: "Paid", open: "Open", void: "Void" },
|
|
660
666
|
downloadUnavailable: "This invoice is not available to download right now."
|
|
@@ -3120,6 +3126,21 @@ function formatDate(value, locale) {
|
|
|
3120
3126
|
return date.toISOString().slice(0, 10);
|
|
3121
3127
|
}
|
|
3122
3128
|
}
|
|
3129
|
+
function scheduleDueLabel(row, locale) {
|
|
3130
|
+
if (row.intervalUnit !== "hour") return formatDate(row.dueAt, locale);
|
|
3131
|
+
const date = new Date(row.dueAt);
|
|
3132
|
+
if (Number.isNaN(date.getTime())) return "";
|
|
3133
|
+
const opts = {
|
|
3134
|
+
dateStyle: "medium",
|
|
3135
|
+
timeStyle: "short",
|
|
3136
|
+
timeZone: "UTC"
|
|
3137
|
+
};
|
|
3138
|
+
try {
|
|
3139
|
+
return `${new Intl.DateTimeFormat(locale, opts).format(date)} UTC`;
|
|
3140
|
+
} catch {
|
|
3141
|
+
return `${new Intl.DateTimeFormat("en-US", opts).format(date)} UTC`;
|
|
3142
|
+
}
|
|
3143
|
+
}
|
|
3123
3144
|
|
|
3124
3145
|
// src/react/components/account/OrderStatus.tsx
|
|
3125
3146
|
import { Fragment as Fragment7, jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
@@ -3547,6 +3568,9 @@ function InvoiceDetail(props) {
|
|
|
3547
3568
|
/* @__PURE__ */ jsx40(PanelState, { resource, isEmpty: (i) => i === null, emptyTitle: t.invoices.empty, skeletonRows: 4, children: (invoice) => {
|
|
3548
3569
|
const money = (v) => formatMoney(v, invoice.currency, locale);
|
|
3549
3570
|
const lines = invoice.lineItems ?? [];
|
|
3571
|
+
const partOfOrder = invoice.orderTotal != null;
|
|
3572
|
+
const isDepositReceipt = partOfOrder && invoice.balanceDue != null;
|
|
3573
|
+
const headlineLabel = !partOfOrder ? t.invoices.total : isDepositReceipt ? t.invoices.amountPaid : t.invoices.amountDue;
|
|
3550
3574
|
return /* @__PURE__ */ jsxs30("div", { ...a.el("invoiceDetail.layout", "throttle-detail"), children: [
|
|
3551
3575
|
/* @__PURE__ */ jsxs30("div", { ...a.el("invoiceDetail.main", "throttle-detail__main"), children: [
|
|
3552
3576
|
/* @__PURE__ */ jsxs30("div", { className: "throttle-detail__section", children: [
|
|
@@ -3580,10 +3604,14 @@ function InvoiceDetail(props) {
|
|
|
3580
3604
|
] }),
|
|
3581
3605
|
/* @__PURE__ */ jsxs30("aside", { ...a.el("invoiceDetail.rail", "throttle-detail__rail"), children: [
|
|
3582
3606
|
/* @__PURE__ */ jsxs30("div", { className: "throttle-detail__section", children: [
|
|
3583
|
-
/* @__PURE__ */ jsx40("span", { className: "throttle-detail__label", children:
|
|
3607
|
+
/* @__PURE__ */ jsx40("span", { className: "throttle-detail__label", children: headlineLabel }),
|
|
3584
3608
|
/* @__PURE__ */ jsx40("span", { className: "throttle-detail__headline", children: money(invoice.total) })
|
|
3585
3609
|
] }),
|
|
3586
3610
|
/* @__PURE__ */ jsxs30("div", { ...a.el("invoiceDetail.totals", "throttle-totals"), children: [
|
|
3611
|
+
partOfOrder ? /* @__PURE__ */ jsx40(Line2, { label: t.invoices.orderTotal, value: money(invoice.orderTotal) }) : null,
|
|
3612
|
+
partOfOrder && invoice.amountPaid ? /* @__PURE__ */ jsx40(Line2, { label: t.invoices.amountPaid, value: `-${money(invoice.amountPaid)}` }) : null,
|
|
3613
|
+
partOfOrder && invoice.compWaived ? /* @__PURE__ */ jsx40(Line2, { label: t.invoices.waived, value: `-${money(invoice.compWaived)}` }) : null,
|
|
3614
|
+
isDepositReceipt && invoice.balanceDue ? /* @__PURE__ */ jsx40(Line2, { label: t.invoices.balanceDue, value: money(invoice.balanceDue) }) : null,
|
|
3587
3615
|
invoice.dueAt ? /* @__PURE__ */ jsx40(Line2, { label: t.invoices.due, value: formatDate(invoice.dueAt, locale) }) : null,
|
|
3588
3616
|
invoice.periodStart && invoice.periodEnd ? /* @__PURE__ */ jsx40(
|
|
3589
3617
|
Line2,
|
|
@@ -3806,12 +3834,15 @@ function SubscriptionsPanel(props) {
|
|
|
3806
3834
|
const nextPaymentLabel = (sub) => {
|
|
3807
3835
|
if (!isVariedSchedule(sub.paymentSchedule) || !sub.paymentSchedule || sub.nextPaymentAmount == null) return null;
|
|
3808
3836
|
const upcoming = sub.paymentSchedule.find((r) => r.status !== "paid");
|
|
3809
|
-
return t.subscriptions.installmentNext.replace("{amount}", formatMoney(sub.nextPaymentAmount, sub.currency, locale)).replace(
|
|
3837
|
+
return t.subscriptions.installmentNext.replace("{amount}", formatMoney(sub.nextPaymentAmount, sub.currency, locale)).replace(
|
|
3838
|
+
"{date}",
|
|
3839
|
+
upcoming?.dueAt ? scheduleDueLabel({ dueAt: upcoming.dueAt, intervalUnit: upcoming.intervalUnit }, locale) : formatDate(sub.currentPeriodEnd, locale)
|
|
3840
|
+
);
|
|
3810
3841
|
};
|
|
3811
3842
|
const upcomingList = (sub) => {
|
|
3812
3843
|
const upcoming = upcomingSchedulePayments(sub.paymentSchedule);
|
|
3813
3844
|
if (upcoming.length === 0) return null;
|
|
3814
|
-
return /* @__PURE__ */ jsx42("ul", { className: "throttle-muted", "aria-label": t.subscriptions.upcomingPayments, children: upcoming.map((r) => /* @__PURE__ */ jsx42("li", { children: t.subscriptions.upcomingPayment.replace("{amount}", formatMoney(r.net, sub.currency, locale)).replace("{date}",
|
|
3845
|
+
return /* @__PURE__ */ jsx42("ul", { className: "throttle-muted", "aria-label": t.subscriptions.upcomingPayments, children: upcoming.map((r) => /* @__PURE__ */ jsx42("li", { children: t.subscriptions.upcomingPayment.replace("{amount}", formatMoney(r.net, sub.currency, locale)).replace("{date}", scheduleDueLabel(r, locale)) }, r.dueAt)) });
|
|
3815
3846
|
};
|
|
3816
3847
|
const renewsLabel = (sub) => formatDate(
|
|
3817
3848
|
sub.status === "completed" ? sub.completedAt ?? sub.currentPeriodEnd : sub.status === "cancelled" ? sub.cancelledAt ?? sub.currentPeriodEnd : sub.currentPeriodEnd,
|