@fluid-app/portal-sdk 0.1.1458 → 0.1.1459

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.
@@ -10,6 +10,7 @@ const require_prop_types = require("./prop-types-Cu-YVBvI.cjs");
10
10
  const require_MobileBottomSheet = require("./MobileBottomSheet-kWs3YKWf.cjs");
11
11
  const require_translations = require("./translations-C_AYi7Z8.cjs");
12
12
  const require_translation_api_context_factory = require("./translation-api-context-factory-CTqevEr-.cjs");
13
+ const require_PointsWidget = require("./PointsWidget-BRNcMWE5.cjs");
13
14
  const require_src = require("./src-DNw9lnvp.cjs");
14
15
  const require_MobileActionSheet = require("./MobileActionSheet-11kK2Miu.cjs");
15
16
  const require_ResponsiveDialog = require("./ResponsiveDialog-CynCNInj.cjs");
@@ -3627,7 +3628,10 @@ function mapListItem(bff) {
3627
3628
  currency: portalCurrency(bff.currency)
3628
3629
  })),
3629
3630
  currency: portalCurrency(bff.currency),
3630
- blackout_days: parseBlackoutDays(bff.blackout_days)
3631
+ blackout_days: parseBlackoutDays(bff.blackout_days),
3632
+ auto_apply_points: bff.auto_apply_points,
3633
+ points_enabled: bff.points_enabled,
3634
+ auto_apply_points_available: bff.auto_apply_points_available
3631
3635
  };
3632
3636
  }
3633
3637
  function mapSubscriptionList(response) {
@@ -4887,6 +4891,15 @@ function friendlyDaysAhead(end, t, now = Date.now()) {
4887
4891
  if (days === 1) return t("list_bills_tomorrow");
4888
4892
  return t("list_bills_in_n_days", { n: String(days) });
4889
4893
  }
4894
+ /**
4895
+ * Whether a subscription card says its renewals spend the customer's points
4896
+ * (ENG-3901). The same rule as the detail screen's switch: the company runs
4897
+ * points, the customer opted in, and the product is not excluded. A product
4898
+ * the payload does not report on keeps the opt-in, as the switch does.
4899
+ */
4900
+ function autoAppliesPoints(sub) {
4901
+ return sub.points_enabled === true && sub.auto_apply_points === true && sub.auto_apply_points_available !== false;
4902
+ }
4890
4903
  //#endregion
4891
4904
  //#region src/screens/subscriptions/PortalSubscriptionsList.tsx
4892
4905
  const UNIT_KEYS = {
@@ -4910,6 +4923,7 @@ const UNIT_KEYS = {
4910
4923
  const EMPTY_BUNDLES = [];
4911
4924
  function PortalSubscriptionsList({ customerId, isLoadingCustomer, onSubscriptionClick, onResume, onBundleClick, bundles = EMPTY_BUNDLES }) {
4912
4925
  const { t } = useSubscriptionsTranslation();
4926
+ const { plural: pointsLabel } = require_PointsWidget.usePointsLabel();
4913
4927
  const [filter, setFilter] = (0, react.useState)("all");
4914
4928
  const listEnabled = !!customerId && !isLoadingCustomer;
4915
4929
  const { data: unfilteredData } = useInfiniteSubscriptions({
@@ -4990,11 +5004,13 @@ function PortalSubscriptionsList({ customerId, isLoadingCustomer, onSubscription
4990
5004
  children: [showBundleSection && relevantBundles.map((bundle, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BundleCard, {
4991
5005
  bundle,
4992
5006
  onSubscriptionClick,
5007
+ pointsLabel,
4993
5008
  t
4994
5009
  }, `bundle-${i}-${bundle.next_bill_date}`)), activeSubs.map((sub) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SubscriptionCard, {
4995
5010
  sub,
4996
5011
  onClick: () => onSubscriptionClick(sub.subscription_token),
4997
5012
  onResume: onResume ? () => onResume(sub) : void 0,
5013
+ pointsLabel,
4998
5014
  t
4999
5015
  }, sub.id))]
5000
5016
  }), inactiveSubs.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -5067,7 +5083,7 @@ function FilterPills({ active, counts, onChange, onBundleClick, t }) {
5067
5083
  });
5068
5084
  }
5069
5085
  const BUNDLE_INLINE_LIMIT = 2;
5070
- function BundleCard({ bundle, onSubscriptionClick, t }) {
5086
+ function BundleCard({ bundle, onSubscriptionClick, pointsLabel, t }) {
5071
5087
  const [popoverOpen, setPopoverOpen] = (0, react.useState)(false);
5072
5088
  const { isMobile } = require_sidebar.useSidebar();
5073
5089
  const nextBillLong = bundle.next_bill_date ? formatLongDate(bundle.next_bill_date) : null;
@@ -5098,6 +5114,7 @@ function BundleCard({ bundle, onSubscriptionClick, t }) {
5098
5114
  children: [inlineMembers.map((sub) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BundleMemberRow, {
5099
5115
  sub,
5100
5116
  onClick: () => handleMemberClick(sub.subscription_token),
5117
+ pointsLabel,
5101
5118
  t
5102
5119
  }, sub.subscription_token)), overflowCount > 0 && (isMobile ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5103
5120
  type: "button",
@@ -5113,6 +5130,7 @@ function BundleCard({ bundle, onSubscriptionClick, t }) {
5113
5130
  children: bundle.subscriptions.map((sub) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BundleMemberRow, {
5114
5131
  sub,
5115
5132
  onClick: () => handleMemberClick(sub.subscription_token),
5133
+ pointsLabel,
5116
5134
  t
5117
5135
  }, sub.subscription_token))
5118
5136
  })
@@ -5137,6 +5155,7 @@ function BundleCard({ bundle, onSubscriptionClick, t }) {
5137
5155
  children: bundle.subscriptions.map((sub) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BundleMemberRow, {
5138
5156
  sub,
5139
5157
  onClick: () => handleMemberClick(sub.subscription_token),
5158
+ pointsLabel,
5140
5159
  t
5141
5160
  }, sub.subscription_token))
5142
5161
  })]
@@ -5174,7 +5193,7 @@ function BundleCard({ bundle, onSubscriptionClick, t }) {
5174
5193
  ]
5175
5194
  });
5176
5195
  }
5177
- function BundleMemberRow({ sub, onClick, t }) {
5196
+ function BundleMemberRow({ sub, onClick, pointsLabel, t }) {
5178
5197
  const discountLine = detailDiscountLine(sub, t);
5179
5198
  const variant = variantLabel(sub.variant);
5180
5199
  const quantity = sub.quantity ?? 1;
@@ -5211,6 +5230,10 @@ function BundleMemberRow({ sub, onClick, t }) {
5211
5230
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5212
5231
  className: "text-muted-foreground truncate text-xs",
5213
5232
  children: bundleMemberCadence(sub.subscription_plan, t)
5233
+ }),
5234
+ autoAppliesPoints(sub) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5235
+ className: "text-muted-foreground truncate text-xs",
5236
+ children: t("auto_apply_points_each_renewal", { label: pointsLabel })
5214
5237
  })
5215
5238
  ]
5216
5239
  }),
@@ -5265,7 +5288,7 @@ function bundleMemberCadence(plan, t) {
5265
5288
  const keys = UNIT_KEYS[unit.toLowerCase()];
5266
5289
  return t("list_cadence_every_unit", { unit: keys ? t(keys.singular) : unit });
5267
5290
  }
5268
- function SubscriptionCard({ sub, onClick, onResume, t }) {
5291
+ function SubscriptionCard({ sub, onClick, onResume, pointsLabel, t }) {
5269
5292
  const status = mapStatus(sub.status, t);
5270
5293
  const variant = variantLabel(sub.variant);
5271
5294
  const quantity = sub.quantity ?? 1;
@@ -5306,6 +5329,10 @@ function SubscriptionCard({ sub, onClick, onResume, t }) {
5306
5329
  className: "text-muted-foreground mt-0.5 text-sm",
5307
5330
  children: cadence
5308
5331
  }),
5332
+ autoAppliesPoints(sub) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5333
+ className: "text-muted-foreground mt-0.5 text-xs",
5334
+ children: t("auto_apply_points_each_renewal", { label: pointsLabel })
5335
+ }),
5309
5336
  (isPaused || isCancelled || isPastDue) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5310
5337
  className: `mt-2 inline-flex items-center gap-1.5 text-xs font-semibold ${isPastDue ? "text-destructive" : "text-muted-foreground/75"}`,
5311
5338
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: `size-1.5 rounded-full ${isCancelled || isPastDue ? "bg-destructive" : "bg-muted-foreground"}` }), status.label]
@@ -12626,4 +12653,4 @@ Object.defineProperty(exports, "subscriptionsScreenPropertySchema", {
12626
12653
  }
12627
12654
  });
12628
12655
 
12629
- //# sourceMappingURL=SubscriptionsScreen-7mgzdeQI.cjs.map
12656
+ //# sourceMappingURL=SubscriptionsScreen-D5O09qiy.cjs.map