@fluid-app/portal-sdk 0.1.1088 → 0.1.1090
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/{SubscriptionsScreen-DgOkTIyv.mjs → SubscriptionsScreen-Bbk6N0Td.mjs} +40 -10
- package/dist/SubscriptionsScreen-Bbk6N0Td.mjs.map +1 -0
- package/dist/{SubscriptionsScreen-DpTJrnUa.cjs → SubscriptionsScreen-BhGi8s55.cjs} +40 -10
- package/dist/SubscriptionsScreen-BhGi8s55.cjs.map +1 -0
- package/dist/{SubscriptionsScreen-ky3dsFra.mjs → SubscriptionsScreen-CWoqya_G.mjs} +1 -1
- package/dist/{SubscriptionsScreen-CWdIF8nT.cjs → SubscriptionsScreen-DeOdMaN-.cjs} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
- package/dist/SubscriptionsScreen-DgOkTIyv.mjs.map +0 -1
- package/dist/SubscriptionsScreen-DpTJrnUa.cjs.map +0 -1
|
@@ -3791,6 +3791,26 @@ function reconciledBreakdown(subtotalUnit, totalUnit, quantity, currencyCode) {
|
|
|
3791
3791
|
};
|
|
3792
3792
|
}
|
|
3793
3793
|
/**
|
|
3794
|
+
* A subscription's next bill as its summary renders it: the reconciled line,
|
|
3795
|
+
* plus the paid milestone add-ons, with the total taken from the rounded
|
|
3796
|
+
* parts so every row adds up.
|
|
3797
|
+
*
|
|
3798
|
+
* subtotalUnit - Per-unit price before any discount.
|
|
3799
|
+
* totalUnit - Per-unit price after the attached discount.
|
|
3800
|
+
* quantity - Units on the subscription.
|
|
3801
|
+
* addOns - What the next order charges for paid add-ons.
|
|
3802
|
+
* currencyCode - ISO 4217 code, which fixes the minor units.
|
|
3803
|
+
*/
|
|
3804
|
+
function nextBillBreakdown(subtotalUnit, totalUnit, quantity, addOns, currencyCode) {
|
|
3805
|
+
const line = reconciledBreakdown(subtotalUnit, totalUnit, quantity, currencyCode);
|
|
3806
|
+
const roundedAddOns = roundToMinorUnits(addOns, currencyCode);
|
|
3807
|
+
return {
|
|
3808
|
+
...line,
|
|
3809
|
+
addOns: roundedAddOns,
|
|
3810
|
+
total: roundToMinorUnits(line.total + roundedAddOns, currencyCode)
|
|
3811
|
+
};
|
|
3812
|
+
}
|
|
3813
|
+
/**
|
|
3794
3814
|
* Format one amount in a given currency.
|
|
3795
3815
|
*
|
|
3796
3816
|
* `amount` is already denominated in `currencyCode`: it comes from the
|
|
@@ -3827,6 +3847,13 @@ function formatCurrency(amount, currencyCode, locale = "en-US") {
|
|
|
3827
3847
|
const code = currencyCode?.trim().toUpperCase() || FALLBACK_CURRENCY;
|
|
3828
3848
|
return tryFormatCurrency(amount, code, locale.trim().replaceAll("_", "-")) ?? tryFormatCurrency(amount, code, "en-US") ?? tryFormatCurrency(amount, FALLBACK_CURRENCY, "en-US") ?? String(amount);
|
|
3829
3849
|
}
|
|
3850
|
+
/**
|
|
3851
|
+
* A bare figure at the currency's minor units, for callers that print their
|
|
3852
|
+
* own symbol: no grouping, so `1200` stays `1200`.
|
|
3853
|
+
*/
|
|
3854
|
+
function formatAmount(amount, currencyCode) {
|
|
3855
|
+
return roundToMinorUnits(amount, currencyCode).toFixed(currencyMinorUnits(currencyCode));
|
|
3856
|
+
}
|
|
3830
3857
|
/** Returns the formatted amount, or null when Intl rejects the pair. */
|
|
3831
3858
|
function tryFormatCurrency(amount, currency, locale) {
|
|
3832
3859
|
const minorUnits = currencyMinorUnits(currency);
|
|
@@ -4169,11 +4196,15 @@ function formatLongDate(iso) {
|
|
|
4169
4196
|
* hidden until qty>1 surfaced the mismatch with the detail view.
|
|
4170
4197
|
*/
|
|
4171
4198
|
function formatPrice(sub) {
|
|
4172
|
-
return (sub.price * (sub.quantity ?? 1)
|
|
4199
|
+
return formatAmount(sub.price * (sub.quantity ?? 1), sub.currency?.code);
|
|
4173
4200
|
}
|
|
4174
4201
|
/** Detail-shape counterpart for bundle member rows. */
|
|
4175
4202
|
function formatDetailPrice(sub) {
|
|
4176
|
-
return (sub.price * (sub.quantity ?? 1)
|
|
4203
|
+
return formatAmount(sub.price * (sub.quantity ?? 1), sub.currency?.code);
|
|
4204
|
+
}
|
|
4205
|
+
/** Bundle card total: every member's line total, in the bundle's currency. */
|
|
4206
|
+
function formatBundleTotal(subs) {
|
|
4207
|
+
return formatAmount(subs.reduce((sum, s) => sum + s.price * (s.quantity ?? 1), 0), subs[0]?.currency?.code);
|
|
4177
4208
|
}
|
|
4178
4209
|
/**
|
|
4179
4210
|
* Unit price for the "qty × price" line that sits with a row's line total.
|
|
@@ -4182,7 +4213,7 @@ function formatDetailPrice(sub) {
|
|
|
4182
4213
|
* price (CURRENT-3974). Mirrors `formatPrice`'s symbol-less formatting.
|
|
4183
4214
|
*/
|
|
4184
4215
|
function formatUnitPrice(sub) {
|
|
4185
|
-
return sub.price.
|
|
4216
|
+
return formatAmount(sub.price, sub.currency?.code);
|
|
4186
4217
|
}
|
|
4187
4218
|
const PLACEHOLDER_VARIANT_TITLES = new Set([
|
|
4188
4219
|
"default",
|
|
@@ -4217,7 +4248,7 @@ function detailDiscountLine(sub, t) {
|
|
|
4217
4248
|
return {
|
|
4218
4249
|
code: attachment.discount.code,
|
|
4219
4250
|
label: t("discount"),
|
|
4220
|
-
amountLabel: `-${sub.currency?.symbol ?? ""}${amount.
|
|
4251
|
+
amountLabel: `-${sub.currency?.symbol ?? ""}${formatAmount(amount, sub.currency?.code)}`
|
|
4221
4252
|
};
|
|
4222
4253
|
}
|
|
4223
4254
|
/**
|
|
@@ -4433,7 +4464,6 @@ const BUNDLE_INLINE_LIMIT = 2;
|
|
|
4433
4464
|
function BundleCard({ bundle, onSubscriptionClick, t }) {
|
|
4434
4465
|
const [popoverOpen, setPopoverOpen] = (0, react.useState)(false);
|
|
4435
4466
|
const { isMobile } = require_sidebar.useSidebar();
|
|
4436
|
-
const total = bundle.subscriptions.reduce((sum, s) => sum + s.price * (s.quantity ?? 1), 0);
|
|
4437
4467
|
const nextBillLong = bundle.next_bill_date ? formatLongDate(bundle.next_bill_date) : null;
|
|
4438
4468
|
const inlineMembers = bundle.subscriptions.slice(0, BUNDLE_INLINE_LIMIT);
|
|
4439
4469
|
const overflowCount = bundle.subscriptions.length - inlineMembers.length;
|
|
@@ -4530,7 +4560,7 @@ function BundleCard({ bundle, onSubscriptionClick, t }) {
|
|
|
4530
4560
|
children: t("list_bill_amount")
|
|
4531
4561
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4532
4562
|
className: "text-foreground mt-1 text-base font-bold tracking-tight tabular-nums",
|
|
4533
|
-
children:
|
|
4563
|
+
children: formatBundleTotal(bundle.subscriptions)
|
|
4534
4564
|
})]
|
|
4535
4565
|
})]
|
|
4536
4566
|
})]
|
|
@@ -7538,11 +7568,11 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
7538
7568
|
const quantityInputId = `subscription-${subscription.subscription_token}-quantity`;
|
|
7539
7569
|
const pricing = computeSubscriptionPricing(subscription);
|
|
7540
7570
|
const currencyCode = subscription.currency?.code;
|
|
7541
|
-
const amounts =
|
|
7542
|
-
const addOnsAmount =
|
|
7571
|
+
const amounts = nextBillBreakdown(pricing.subtotalUnit, pricing.totalUnit, quantity, subscription.milestones?.paid_total ?? 0, currencyCode);
|
|
7572
|
+
const addOnsAmount = amounts.addOns;
|
|
7543
7573
|
const discountAmount = amounts.discount;
|
|
7544
7574
|
const subtotal = formatCurrency(amounts.subtotal, currencyCode, locale);
|
|
7545
|
-
const totalPrice = formatCurrency(
|
|
7575
|
+
const totalPrice = formatCurrency(amounts.total, currencyCode, locale);
|
|
7546
7576
|
const effectiveNextBillDate = displayNextBillDate ?? subscription.next_bill_date;
|
|
7547
7577
|
const nextOrderTimeOfDay = displayStatus === "completed" ? "" : formatTime(effectiveNextBillDate, subscription.timezone, locale);
|
|
7548
7578
|
const nextBillDisplayLabels = {
|
|
@@ -10377,4 +10407,4 @@ Object.defineProperty(exports, "subscriptionsScreenPropertySchema", {
|
|
|
10377
10407
|
}
|
|
10378
10408
|
});
|
|
10379
10409
|
|
|
10380
|
-
//# sourceMappingURL=SubscriptionsScreen-
|
|
10410
|
+
//# sourceMappingURL=SubscriptionsScreen-BhGi8s55.cjs.map
|