@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
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
useOrders,
|
|
9
9
|
useSavedCards,
|
|
10
10
|
useSubscriptions
|
|
11
|
-
} from "../../chunk-
|
|
11
|
+
} from "../../chunk-ZYYWXVX5.js";
|
|
12
12
|
import {
|
|
13
13
|
messageForError
|
|
14
14
|
} from "../../chunk-K7RCWADI.js";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
memoryStorage,
|
|
22
22
|
useAuth,
|
|
23
23
|
useAuthContext
|
|
24
|
-
} from "../../chunk-
|
|
24
|
+
} from "../../chunk-X4DGZ4JU.js";
|
|
25
25
|
|
|
26
26
|
// src/react/components/provider.tsx
|
|
27
27
|
import { createContext as createContext6, useCallback as useCallback4, useContext as useContext6, useMemo as useMemo4, useRef as useRef9, useState as useState21 } from "react";
|
|
@@ -3126,6 +3126,21 @@ function formatDate(value, locale) {
|
|
|
3126
3126
|
return date.toISOString().slice(0, 10);
|
|
3127
3127
|
}
|
|
3128
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
|
+
}
|
|
3129
3144
|
|
|
3130
3145
|
// src/react/components/account/OrderStatus.tsx
|
|
3131
3146
|
import { Fragment as Fragment7, jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
@@ -3819,12 +3834,15 @@ function SubscriptionsPanel(props) {
|
|
|
3819
3834
|
const nextPaymentLabel = (sub) => {
|
|
3820
3835
|
if (!isVariedSchedule(sub.paymentSchedule) || !sub.paymentSchedule || sub.nextPaymentAmount == null) return null;
|
|
3821
3836
|
const upcoming = sub.paymentSchedule.find((r) => r.status !== "paid");
|
|
3822
|
-
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
|
+
);
|
|
3823
3841
|
};
|
|
3824
3842
|
const upcomingList = (sub) => {
|
|
3825
3843
|
const upcoming = upcomingSchedulePayments(sub.paymentSchedule);
|
|
3826
3844
|
if (upcoming.length === 0) return null;
|
|
3827
|
-
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)) });
|
|
3828
3846
|
};
|
|
3829
3847
|
const renewsLabel = (sub) => formatDate(
|
|
3830
3848
|
sub.status === "completed" ? sub.completedAt ?? sub.currentPeriodEnd : sub.status === "cancelled" ? sub.cancelledAt ?? sub.currentPeriodEnd : sub.currentPeriodEnd,
|