@usethrottle/auth 0.9.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.
|
@@ -3803,6 +3803,21 @@ function formatDate(value, locale) {
|
|
|
3803
3803
|
return date.toISOString().slice(0, 10);
|
|
3804
3804
|
}
|
|
3805
3805
|
}
|
|
3806
|
+
function scheduleDueLabel(row, locale) {
|
|
3807
|
+
if (row.intervalUnit !== "hour") return formatDate(row.dueAt, locale);
|
|
3808
|
+
const date = new Date(row.dueAt);
|
|
3809
|
+
if (Number.isNaN(date.getTime())) return "";
|
|
3810
|
+
const opts = {
|
|
3811
|
+
dateStyle: "medium",
|
|
3812
|
+
timeStyle: "short",
|
|
3813
|
+
timeZone: "UTC"
|
|
3814
|
+
};
|
|
3815
|
+
try {
|
|
3816
|
+
return `${new Intl.DateTimeFormat(locale, opts).format(date)} UTC`;
|
|
3817
|
+
} catch {
|
|
3818
|
+
return `${new Intl.DateTimeFormat("en-US", opts).format(date)} UTC`;
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3806
3821
|
|
|
3807
3822
|
// src/react/components/account/OrderStatus.tsx
|
|
3808
3823
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
@@ -4496,12 +4511,15 @@ function SubscriptionsPanel(props) {
|
|
|
4496
4511
|
const nextPaymentLabel = (sub) => {
|
|
4497
4512
|
if (!isVariedSchedule(sub.paymentSchedule) || !sub.paymentSchedule || sub.nextPaymentAmount == null) return null;
|
|
4498
4513
|
const upcoming = sub.paymentSchedule.find((r) => r.status !== "paid");
|
|
4499
|
-
return t.subscriptions.installmentNext.replace("{amount}", formatMoney(sub.nextPaymentAmount, sub.currency, locale)).replace(
|
|
4514
|
+
return t.subscriptions.installmentNext.replace("{amount}", formatMoney(sub.nextPaymentAmount, sub.currency, locale)).replace(
|
|
4515
|
+
"{date}",
|
|
4516
|
+
upcoming?.dueAt ? scheduleDueLabel({ dueAt: upcoming.dueAt, intervalUnit: upcoming.intervalUnit }, locale) : formatDate(sub.currentPeriodEnd, locale)
|
|
4517
|
+
);
|
|
4500
4518
|
};
|
|
4501
4519
|
const upcomingList = (sub) => {
|
|
4502
4520
|
const upcoming = upcomingSchedulePayments(sub.paymentSchedule);
|
|
4503
4521
|
if (upcoming.length === 0) return null;
|
|
4504
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("ul", { className: "throttle-muted", "aria-label": t.subscriptions.upcomingPayments, children: upcoming.map((r) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("li", { children: t.subscriptions.upcomingPayment.replace("{amount}", formatMoney(r.net, sub.currency, locale)).replace("{date}",
|
|
4522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("ul", { className: "throttle-muted", "aria-label": t.subscriptions.upcomingPayments, children: upcoming.map((r) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("li", { children: t.subscriptions.upcomingPayment.replace("{amount}", formatMoney(r.net, sub.currency, locale)).replace("{date}", scheduleDueLabel(r, locale)) }, r.dueAt)) });
|
|
4505
4523
|
};
|
|
4506
4524
|
const renewsLabel = (sub) => formatDate(
|
|
4507
4525
|
sub.status === "completed" ? sub.completedAt ?? sub.currentPeriodEnd : sub.status === "cancelled" ? sub.cancelledAt ?? sub.currentPeriodEnd : sub.currentPeriodEnd,
|