@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.
@@ -8,7 +8,7 @@ import {
8
8
  useOrders,
9
9
  useSavedCards,
10
10
  useSubscriptions
11
- } from "../../chunk-TKSBAC7W.js";
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-HQP5QTHQ.js";
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("{date}", formatDate(upcoming?.dueAt ?? sub.currentPeriodEnd, locale));
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}", formatDate(r.dueAt, locale)) }, r.dueAt)) });
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,