@usethrottle/auth 0.9.0 → 0.10.1
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/README.md +1 -0
- package/dist/{chunk-HQP5QTHQ.js → chunk-X4DGZ4JU.js} +9 -1
- package/dist/chunk-X4DGZ4JU.js.map +1 -0
- package/dist/{chunk-TKSBAC7W.js → chunk-ZYYWXVX5.js} +2 -2
- package/dist/index.cjs +8 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/react/components/index.cjs +28 -2
- package/dist/react/components/index.cjs.map +1 -1
- package/dist/react/components/index.js +22 -4
- package/dist/react/components/index.js.map +1 -1
- package/dist/react/forms/index.js +1 -1
- package/dist/react/index.cjs +8 -0
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +6 -0
- package/dist/react/index.d.ts +6 -0
- package/dist/react/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-HQP5QTHQ.js.map +0 -1
- /package/dist/{chunk-TKSBAC7W.js.map → chunk-ZYYWXVX5.js.map} +0 -0
|
@@ -381,6 +381,14 @@ function createThrottleAuth(config) {
|
|
|
381
381
|
}
|
|
382
382
|
},
|
|
383
383
|
getSnapshot: () => state.get(),
|
|
384
|
+
async getAccessToken() {
|
|
385
|
+
try {
|
|
386
|
+
return await accessToken();
|
|
387
|
+
} catch (err) {
|
|
388
|
+
if (state.get().status === "unauthenticated") return null;
|
|
389
|
+
throw err;
|
|
390
|
+
}
|
|
391
|
+
},
|
|
384
392
|
subscribe: (fn) => state.subscribe(fn),
|
|
385
393
|
stepUp,
|
|
386
394
|
call,
|
|
@@ -3803,6 +3811,21 @@ function formatDate(value, locale) {
|
|
|
3803
3811
|
return date.toISOString().slice(0, 10);
|
|
3804
3812
|
}
|
|
3805
3813
|
}
|
|
3814
|
+
function scheduleDueLabel(row, locale) {
|
|
3815
|
+
if (row.intervalUnit !== "hour") return formatDate(row.dueAt, locale);
|
|
3816
|
+
const date = new Date(row.dueAt);
|
|
3817
|
+
if (Number.isNaN(date.getTime())) return "";
|
|
3818
|
+
const opts = {
|
|
3819
|
+
dateStyle: "medium",
|
|
3820
|
+
timeStyle: "short",
|
|
3821
|
+
timeZone: "UTC"
|
|
3822
|
+
};
|
|
3823
|
+
try {
|
|
3824
|
+
return `${new Intl.DateTimeFormat(locale, opts).format(date)} UTC`;
|
|
3825
|
+
} catch {
|
|
3826
|
+
return `${new Intl.DateTimeFormat("en-US", opts).format(date)} UTC`;
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3806
3829
|
|
|
3807
3830
|
// src/react/components/account/OrderStatus.tsx
|
|
3808
3831
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
@@ -4496,12 +4519,15 @@ function SubscriptionsPanel(props) {
|
|
|
4496
4519
|
const nextPaymentLabel = (sub) => {
|
|
4497
4520
|
if (!isVariedSchedule(sub.paymentSchedule) || !sub.paymentSchedule || sub.nextPaymentAmount == null) return null;
|
|
4498
4521
|
const upcoming = sub.paymentSchedule.find((r) => r.status !== "paid");
|
|
4499
|
-
return t.subscriptions.installmentNext.replace("{amount}", formatMoney(sub.nextPaymentAmount, sub.currency, locale)).replace(
|
|
4522
|
+
return t.subscriptions.installmentNext.replace("{amount}", formatMoney(sub.nextPaymentAmount, sub.currency, locale)).replace(
|
|
4523
|
+
"{date}",
|
|
4524
|
+
upcoming?.dueAt ? scheduleDueLabel({ dueAt: upcoming.dueAt, intervalUnit: upcoming.intervalUnit }, locale) : formatDate(sub.currentPeriodEnd, locale)
|
|
4525
|
+
);
|
|
4500
4526
|
};
|
|
4501
4527
|
const upcomingList = (sub) => {
|
|
4502
4528
|
const upcoming = upcomingSchedulePayments(sub.paymentSchedule);
|
|
4503
4529
|
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}",
|
|
4530
|
+
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
4531
|
};
|
|
4506
4532
|
const renewsLabel = (sub) => formatDate(
|
|
4507
4533
|
sub.status === "completed" ? sub.completedAt ?? sub.currentPeriodEnd : sub.status === "cancelled" ? sub.cancelledAt ?? sub.currentPeriodEnd : sub.currentPeriodEnd,
|