@fluid-app/portal-sdk 0.1.798 → 0.1.799
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/{FluidProvider-DAdZ-Lh8.mjs → FluidProvider-Bd329rjh.mjs} +71 -1
- package/dist/{FluidProvider-DAdZ-Lh8.mjs.map → FluidProvider-Bd329rjh.mjs.map} +1 -1
- package/dist/{FluidProvider-D6XJUmmK.cjs → FluidProvider-BwPBJfjs.cjs} +71 -1
- package/dist/{FluidProvider-D6XJUmmK.cjs.map → FluidProvider-BwPBJfjs.cjs.map} +1 -1
- package/dist/{MessagingScreen-B9Gw6jjz.cjs → MessagingScreen-CuiB8nPo.cjs} +2 -2
- package/dist/{MessagingScreen-CzFuFEqU.mjs → MessagingScreen-DLulZTv7.mjs} +2 -2
- package/dist/{MessagingScreen-CzFuFEqU.mjs.map → MessagingScreen-DLulZTv7.mjs.map} +1 -1
- package/dist/{MessagingScreen-DUJItpLf.cjs → MessagingScreen-Ry8EzZ0D.cjs} +2 -2
- package/dist/{MessagingScreen-DUJItpLf.cjs.map → MessagingScreen-Ry8EzZ0D.cjs.map} +1 -1
- package/dist/{MessagingScreen-yVAOdTnE.mjs → MessagingScreen-Ypz2-nu-.mjs} +2 -2
- package/dist/{OrdersScreen-urfCu-XA.mjs → OrdersScreen-6e2ikl1w.mjs} +2 -2
- package/dist/{OrdersScreen-urfCu-XA.mjs.map → OrdersScreen-6e2ikl1w.mjs.map} +1 -1
- package/dist/{OrdersScreen-C9Pt99gL.cjs → OrdersScreen-Cu6fDSB5.cjs} +2 -2
- package/dist/{OrdersScreen-D2i2EY7A.mjs → OrdersScreen-D0U5Zn1I.mjs} +2 -2
- package/dist/{OrdersScreen-DRUTC3FF.cjs → OrdersScreen-zcTwch78.cjs} +2 -2
- package/dist/{OrdersScreen-DRUTC3FF.cjs.map → OrdersScreen-zcTwch78.cjs.map} +1 -1
- package/dist/{ProfileScreen-yk2c_ICl.mjs → ProfileScreen-BpIPlbd2.mjs} +2 -2
- package/dist/{ProfileScreen-yk2c_ICl.mjs.map → ProfileScreen-BpIPlbd2.mjs.map} +1 -1
- package/dist/{ProfileScreen-DKp6Zvc-.mjs → ProfileScreen-CM3oqiU0.mjs} +3 -3
- package/dist/{ProfileScreen-CbhmsXGu.cjs → ProfileScreen-CY6anL_g.cjs} +2 -2
- package/dist/{ProfileScreen-CbhmsXGu.cjs.map → ProfileScreen-CY6anL_g.cjs.map} +1 -1
- package/dist/{ProfileScreen-JTRkqU7o.cjs → ProfileScreen-ChEvNc_d.cjs} +3 -3
- package/dist/{SubscriptionsScreen-B4lVFytP.mjs → SubscriptionsScreen-6GEqH3WA.mjs} +3 -3
- package/dist/{SubscriptionsScreen-CwiHeAUq.cjs → SubscriptionsScreen-B3Wk53We.cjs} +30 -31
- package/dist/SubscriptionsScreen-B3Wk53We.cjs.map +1 -0
- package/dist/{SubscriptionsScreen-CbPW31HU.cjs → SubscriptionsScreen-CHtDjlJK.cjs} +3 -3
- package/dist/{SubscriptionsScreen-DiRBZN4T.mjs → SubscriptionsScreen-D505K6IM.mjs} +30 -31
- package/dist/SubscriptionsScreen-D505K6IM.mjs.map +1 -0
- package/dist/index.cjs +14 -14
- package/dist/index.mjs +14 -14
- package/dist/{use-portal-card-add-3ds-flow-CsjnX_VV.mjs → use-portal-card-add-3ds-flow-C8LP1_2P.mjs} +2 -2
- package/dist/{use-portal-card-add-3ds-flow-CsjnX_VV.mjs.map → use-portal-card-add-3ds-flow-C8LP1_2P.mjs.map} +1 -1
- package/dist/{use-portal-card-add-3ds-flow-C4h3wg2u.cjs → use-portal-card-add-3ds-flow-D9H4Q46n.cjs} +2 -2
- package/dist/{use-portal-card-add-3ds-flow-C4h3wg2u.cjs.map → use-portal-card-add-3ds-flow-D9H4Q46n.cjs.map} +1 -1
- package/package.json +3 -3
- package/dist/SubscriptionsScreen-CwiHeAUq.cjs.map +0 -1
- package/dist/SubscriptionsScreen-DiRBZN4T.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require("./chunk-9hOWP6kD.cjs");
|
|
2
2
|
require("./build-widget-registry-CR5qbb2G.cjs");
|
|
3
3
|
require("./ContactsTranslationBridge-FyqcnCwN.cjs");
|
|
4
|
-
require("./FluidProvider-
|
|
4
|
+
require("./FluidProvider-BwPBJfjs.cjs");
|
|
5
5
|
require("./ScreenRenderer-CLT0DgZh.cjs");
|
|
6
6
|
require("./account-api-context-BAC-rNdx.cjs");
|
|
7
7
|
require("./use-optional-store-DiiiefyO.cjs");
|
|
@@ -69,7 +69,7 @@ require("./translation-adapter-DFTj_Ydf.cjs");
|
|
|
69
69
|
require("./translation-adapter-BhsWM9YE.cjs");
|
|
70
70
|
require("./sidebar-BnZL8dM6.cjs");
|
|
71
71
|
require("./ScreenHeaderContext-fJKG4BUl.cjs");
|
|
72
|
-
require("./use-portal-card-add-3ds-flow-
|
|
73
|
-
const require_SubscriptionsScreen = require("./SubscriptionsScreen-
|
|
72
|
+
require("./use-portal-card-add-3ds-flow-D9H4Q46n.cjs");
|
|
73
|
+
const require_SubscriptionsScreen = require("./SubscriptionsScreen-B3Wk53We.cjs");
|
|
74
74
|
exports.SubscriptionsScreen = require_SubscriptionsScreen.SubscriptionsScreen;
|
|
75
75
|
exports.subscriptionsScreenPropertySchema = require_SubscriptionsScreen.subscriptionsScreenPropertySchema;
|
|
@@ -2,7 +2,7 @@ import { Bt as BreadcrumbList, C as SheetTitle, D as SelectItem, E as SelectCont
|
|
|
2
2
|
import { B as getPaymentBrandName, Et as usePayApi, F as paymentDescriptorLabel, L as resolvePaymentMethodDisplay, P as normalizePaymentDescriptor, V as normalizeCardBrand, j as isCardPaymentDescriptor } from "./build-widget-registry-mTHeMMXC.mjs";
|
|
3
3
|
import { i as toApiErrorBody, r as isApiError } from "./fetch-client-BRi4Z3Zz.mjs";
|
|
4
4
|
import { i as useFluidContext } from "./ContactsTranslationBridge-D3J4a-56.mjs";
|
|
5
|
-
import { c as createSubscriptionsTranslationAdapter, l as subscriptionsDomain } from "./FluidProvider-
|
|
5
|
+
import { c as createSubscriptionsTranslationAdapter, l as subscriptionsDomain } from "./FluidProvider-Bd329rjh.mjs";
|
|
6
6
|
import { i as useOptionalStore } from "./use-optional-store-D6XsdB-j.mjs";
|
|
7
7
|
import { r as useCountriesApi } from "./Combobox-vfx4KKN_.mjs";
|
|
8
8
|
import { T as usePortalTenantClient, at as subscriptionsList, ct as subscriptionsResume, dt as subscriptionsSkip, et as subscriptionBundlesCreate, ft as subscriptionsUpdate, it as subscriptionsFailedCycleWaiverPreview, lt as subscriptionsRetry, nt as subscriptionsCancel, ot as subscriptionsPause, rt as subscriptionsFailedCycleWaiverCreate, st as subscriptionsReactivate, tt as subscriptionBundlesList, ut as subscriptionsShow } from "./prop-types-BKixw4TR.mjs";
|
|
@@ -16,7 +16,7 @@ import { n as useAppNavigation } from "./AppNavigationContext-BnYj4Pjp.mjs";
|
|
|
16
16
|
import { t as useStore } from "./use-store-jLETls7H.mjs";
|
|
17
17
|
import { p as useSidebar, r as SidebarContext } from "./sidebar-BqTwYEfE.mjs";
|
|
18
18
|
import { n as ScreenHeaderBreadcrumbs } from "./ScreenHeaderContext-D7jhJX8j.mjs";
|
|
19
|
-
import { _ as ProfileTranslationBridge, a as getBrowserInfo, c as EditPaymentMethodDialog, d as getCardDisplayName, f as getCardExpiry, g as EllipsesDropdown, h as ConfirmActionDialog, i as isThreeDsRequiredCreate, l as FluidPayCoreProvider, n as createFluidPayApiAdapter, o as CreditCardFormDialog, p as getPaymentMethodLogoBrand, r as mapToFluidPayPaymentMethod, s as AddressFormDialog, t as usePortalCardAdd3DSFlow, u as PaymentIcon, v as useProfileTranslation } from "./use-portal-card-add-3ds-flow-
|
|
19
|
+
import { _ as ProfileTranslationBridge, a as getBrowserInfo, c as EditPaymentMethodDialog, d as getCardDisplayName, f as getCardExpiry, g as EllipsesDropdown, h as ConfirmActionDialog, i as isThreeDsRequiredCreate, l as FluidPayCoreProvider, n as createFluidPayApiAdapter, o as CreditCardFormDialog, p as getPaymentMethodLogoBrand, r as mapToFluidPayPaymentMethod, s as AddressFormDialog, t as usePortalCardAdd3DSFlow, u as PaymentIcon, v as useProfileTranslation } from "./use-portal-card-add-3ds-flow-C8LP1_2P.mjs";
|
|
20
20
|
import { C as millisecondsInMinute, S as millisecondsInHour, _ as getDefaultOptions$1, a as warnOrThrowProtectedError, b as toDate, c as getWeekYear, g as startOfWeek, h as startOfISOWeek, i as isProtectedWeekYearToken, l as getISOWeek, m as getTimezoneOffsetInMilliseconds, n as format, o as longFormatters, r as isProtectedDayOfYearToken, s as getWeek, t as isAfter, u as enUS, v as addMonths, w as millisecondsInSecond, x as constructFrom, y as addDays } from "./isAfter-D9nJj9TD.mjs";
|
|
21
21
|
import { createContext, use, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
22
22
|
import { useInfiniteQuery, useIsFetching, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
@@ -2987,6 +2987,7 @@ function useAutoApplyPointsApi() {
|
|
|
2987
2987
|
if (!api) throw new Error("useAutoApplyPointsApi must be used within an AutoApplyPointsApiProvider");
|
|
2988
2988
|
return api;
|
|
2989
2989
|
}
|
|
2990
|
+
createContext(null).Provider;
|
|
2990
2991
|
//#endregion
|
|
2991
2992
|
//#region src/adapters/subscriptions-api-adapter.ts
|
|
2992
2993
|
/**
|
|
@@ -3700,7 +3701,7 @@ function countByFilter(list) {
|
|
|
3700
3701
|
cancelled: list.filter((s) => filterPredicate("cancelled", s)).length
|
|
3701
3702
|
};
|
|
3702
3703
|
}
|
|
3703
|
-
function formatCadence(plan, t) {
|
|
3704
|
+
function formatCadence$1(plan, t) {
|
|
3704
3705
|
const interval = plan.billing_interval;
|
|
3705
3706
|
const unit = plan.billing_interval_unit;
|
|
3706
3707
|
if (interval === 1 && unit === "day") return t("list_cadence_daily");
|
|
@@ -4223,7 +4224,7 @@ function SubscriptionCard({ sub, onClick, onResume, t }) {
|
|
|
4223
4224
|
const isPaused = status.kind === "paused";
|
|
4224
4225
|
const isCancelled = status.kind === "cancelled";
|
|
4225
4226
|
const isPastDue = status.kind === "past_due";
|
|
4226
|
-
const cadence = formatCadence(sub.subscription_plan, t);
|
|
4227
|
+
const cadence = formatCadence$1(sub.subscription_plan, t);
|
|
4227
4228
|
const nextBillLong = sub.next_bill_date ? formatLongDate$1(sub.next_bill_date) : null;
|
|
4228
4229
|
const lastBillLong = sub.last_bill_date ? formatLongDate$1(sub.last_bill_date) : null;
|
|
4229
4230
|
const daysOverdue = isPastDue && sub.next_bill_date ? Math.max(0, Math.round((Date.now() - new Date(sub.next_bill_date).getTime()) / (1e3 * 60 * 60 * 24))) : 0;
|
|
@@ -4340,7 +4341,7 @@ function CycleProgress({ cycle }) {
|
|
|
4340
4341
|
}
|
|
4341
4342
|
function InactiveSubscriptionRow({ sub, onClick, t }) {
|
|
4342
4343
|
const status = mapStatus(sub.status, t);
|
|
4343
|
-
const detail = `${formatCadence(sub.subscription_plan, t)} · ${status.label}`;
|
|
4344
|
+
const detail = `${formatCadence$1(sub.subscription_plan, t)} · ${status.label}`;
|
|
4344
4345
|
const variant = variantLabel(sub.variant);
|
|
4345
4346
|
return /* @__PURE__ */ jsxs("button", {
|
|
4346
4347
|
type: "button",
|
|
@@ -4823,7 +4824,7 @@ function DrawerStepSelect({ subscriptions, selectedTokens, onToggle, isLoading,
|
|
|
4823
4824
|
children: [/* @__PURE__ */ jsx(Repeat, {
|
|
4824
4825
|
className: "size-3",
|
|
4825
4826
|
strokeWidth: 2
|
|
4826
|
-
}), formatCadence(sub.subscription_plan, t)]
|
|
4827
|
+
}), formatCadence$1(sub.subscription_plan, t)]
|
|
4827
4828
|
}), /* @__PURE__ */ jsx("p", {
|
|
4828
4829
|
className: "text-muted-foreground/75 mt-1 text-xs",
|
|
4829
4830
|
children: formatBillDate(sub.next_bill_date)
|
|
@@ -5856,6 +5857,23 @@ const UNIT_KEYS = {
|
|
|
5856
5857
|
plural: "unit_years"
|
|
5857
5858
|
}
|
|
5858
5859
|
};
|
|
5860
|
+
const SHORTHAND_CADENCE_KEYS = {
|
|
5861
|
+
day: "list_cadence_daily",
|
|
5862
|
+
week: "list_cadence_weekly",
|
|
5863
|
+
month: "list_cadence_monthly",
|
|
5864
|
+
year: "list_cadence_yearly"
|
|
5865
|
+
};
|
|
5866
|
+
/** "Monthly" for an interval of one, else "Every 2 months". */
|
|
5867
|
+
function formatCadence(interval, unit, t) {
|
|
5868
|
+
const normalized = unit.toLowerCase();
|
|
5869
|
+
if (interval === 1 && Object.hasOwn(SHORTHAND_CADENCE_KEYS, normalized)) return t(SHORTHAND_CADENCE_KEYS[normalized]);
|
|
5870
|
+
const unitKeys = UNIT_KEYS[normalized];
|
|
5871
|
+
if (!unitKeys) return t("list_cadence_every_unit", { unit: startCase(unit) });
|
|
5872
|
+
return t("list_cadence_every_n_units", {
|
|
5873
|
+
n: interval,
|
|
5874
|
+
unit: t(unitKeys.plural)
|
|
5875
|
+
});
|
|
5876
|
+
}
|
|
5859
5877
|
/** Statuses that have a corresponding `list_status_*` translation key. */
|
|
5860
5878
|
const KNOWN_STATUSES = new Set([
|
|
5861
5879
|
"active",
|
|
@@ -6209,7 +6227,7 @@ const SUBSCRIPTION_COLORS = [
|
|
|
6209
6227
|
"#84cc16"
|
|
6210
6228
|
];
|
|
6211
6229
|
const MAX_PROJECTIONS_PER_SUB = 104;
|
|
6212
|
-
function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMessage, currentNextBillDate, billingInterval = 1, billingIntervalUnit = "month", otherSubscriptions, onNavigateToSubscription, presentation = "dialog" }) {
|
|
6230
|
+
function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMessage, currentNextBillDate, billingInterval = 1, billingIntervalUnit = "month", otherSubscriptions, onNavigateToSubscription, presentation = "dialog", title, confirmLabel, description }) {
|
|
6213
6231
|
const { t, locale } = useSubscriptionsTranslation();
|
|
6214
6232
|
const [selectedDate, setSelectedDate] = useState(void 0);
|
|
6215
6233
|
const [calendarOpen, setCalendarOpen] = useState(false);
|
|
@@ -6289,8 +6307,8 @@ function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMes
|
|
|
6289
6307
|
return /* @__PURE__ */ jsxs(ResponsiveDialog, {
|
|
6290
6308
|
open,
|
|
6291
6309
|
onOpenChange: handleDismiss,
|
|
6292
|
-
title: t("edit_bill_date_title"),
|
|
6293
|
-
description: t("edit_bill_date_description"),
|
|
6310
|
+
title: title ?? t("edit_bill_date_title"),
|
|
6311
|
+
description: description ?? t("edit_bill_date_description"),
|
|
6294
6312
|
presentation,
|
|
6295
6313
|
contentOverflow: "visible",
|
|
6296
6314
|
children: [
|
|
@@ -6429,7 +6447,7 @@ function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMes
|
|
|
6429
6447
|
className: "h-10 min-w-[70px] rounded p-3",
|
|
6430
6448
|
onClick: handleConfirm,
|
|
6431
6449
|
disabled: !selectedDate || isLoading,
|
|
6432
|
-
children: isLoading ? /* @__PURE__ */ jsx("div", { className: "border-primary-foreground size-5 animate-spin rounded-full border-4 border-t-4 border-t-transparent" }) : t("edit_bill_date_action")
|
|
6450
|
+
children: isLoading ? /* @__PURE__ */ jsx("div", { className: "border-primary-foreground size-5 animate-spin rounded-full border-4 border-t-4 border-t-transparent" }) : confirmLabel ?? t("edit_bill_date_action")
|
|
6433
6451
|
})]
|
|
6434
6452
|
}) })
|
|
6435
6453
|
]
|
|
@@ -6750,16 +6768,6 @@ function BundledWithCard({ bundledSubscriptions, currentToken, plan, onNavigateT
|
|
|
6750
6768
|
}
|
|
6751
6769
|
//#endregion
|
|
6752
6770
|
//#region ../../subscriptions/ui/src/components/subscription-detail.tsx
|
|
6753
|
-
/** Map a billing_interval_unit to its shorthand cadence key (daily/weekly/…), or null. */
|
|
6754
|
-
function getCadenceKey(unit) {
|
|
6755
|
-
switch (unit.toLowerCase()) {
|
|
6756
|
-
case "day": return "daily";
|
|
6757
|
-
case "week": return "weekly";
|
|
6758
|
-
case "month": return "monthly";
|
|
6759
|
-
case "year": return "yearly";
|
|
6760
|
-
default: return null;
|
|
6761
|
-
}
|
|
6762
|
-
}
|
|
6763
6771
|
function isRecoveryStateChanged(error) {
|
|
6764
6772
|
if (!isRecord(error) || error.status !== 422 || !isRecord(error.body)) return false;
|
|
6765
6773
|
const body = error.body;
|
|
@@ -7176,16 +7184,7 @@ function SubscriptionManagementSection({ subscription, actionPolicy, isMutating,
|
|
|
7176
7184
|
const quantity = subscription.quantity;
|
|
7177
7185
|
const totalPrice = formatCurrency(subscription.price * quantity, subscription.currency?.code, locale);
|
|
7178
7186
|
const displayStatus = getSubscriptionDisplayStatus(subscription);
|
|
7179
|
-
const
|
|
7180
|
-
const interval = plan.billing_interval;
|
|
7181
|
-
const unitKeys = UNIT_KEYS[plan.billing_interval_unit.toLowerCase()];
|
|
7182
|
-
let cadenceLabel;
|
|
7183
|
-
if (interval === 1 && cadenceKey) cadenceLabel = t(`list_cadence_${cadenceKey}`);
|
|
7184
|
-
else if (unitKeys) cadenceLabel = t("list_cadence_every_n_units", {
|
|
7185
|
-
n: String(interval),
|
|
7186
|
-
unit: t(unitKeys.plural)
|
|
7187
|
-
});
|
|
7188
|
-
else cadenceLabel = t("list_cadence_every_unit", { unit: startCase(plan.billing_interval_unit) });
|
|
7187
|
+
const cadenceLabel = formatCadence(plan.billing_interval, plan.billing_interval_unit, t);
|
|
7189
7188
|
const paymentMethod = subscription.payment_method;
|
|
7190
7189
|
const paymentDetails = paymentMethod?.details ?? null;
|
|
7191
7190
|
const paymentDisplay = paymentMethod ? resolveSubscriptionPaymentMethodDisplay(paymentMethod, paymentDetails) : null;
|
|
@@ -9575,4 +9574,4 @@ const subscriptionsScreenPropertySchema = {
|
|
|
9575
9574
|
//#endregion
|
|
9576
9575
|
export { subscriptionsScreenPropertySchema as n, SubscriptionsScreen as t };
|
|
9577
9576
|
|
|
9578
|
-
//# sourceMappingURL=SubscriptionsScreen-
|
|
9577
|
+
//# sourceMappingURL=SubscriptionsScreen-D505K6IM.mjs.map
|