@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.
@@ -69,5 +69,5 @@ import "./translation-adapter-EudqQegu.mjs";
69
69
  import "./sidebar-DrDSWytS.mjs";
70
70
  import "./ScreenHeaderContext-D7jhJX8j.mjs";
71
71
  import "./use-portal-card-add-3ds-flow-reLzYVCQ.mjs";
72
- import { n as subscriptionsScreenPropertySchema, t as SubscriptionsScreen } from "./SubscriptionsScreen-DCwEV2E4.mjs";
72
+ import { n as subscriptionsScreenPropertySchema, t as SubscriptionsScreen } from "./SubscriptionsScreen-Ca9nZeeW.mjs";
73
73
  export { SubscriptionsScreen, subscriptionsScreenPropertySchema };
@@ -70,6 +70,6 @@ require("./translation-adapter-bY6tOgw0.cjs");
70
70
  require("./sidebar-Cp2413-F.cjs");
71
71
  require("./ScreenHeaderContext-fJKG4BUl.cjs");
72
72
  require("./use-portal-card-add-3ds-flow-B8K4bvJU.cjs");
73
- const require_SubscriptionsScreen = require("./SubscriptionsScreen-7mgzdeQI.cjs");
73
+ const require_SubscriptionsScreen = require("./SubscriptionsScreen-D5O09qiy.cjs");
74
74
  exports.SubscriptionsScreen = require_SubscriptionsScreen.SubscriptionsScreen;
75
75
  exports.subscriptionsScreenPropertySchema = require_SubscriptionsScreen.subscriptionsScreenPropertySchema;
@@ -10,6 +10,7 @@ import { At as subscriptionsUpdate, Ct as subscriptionsReactivate, Dt as subscri
10
10
  import { t as MobileBottomSheet } from "./MobileBottomSheet-DoMq_1zZ.mjs";
11
11
  import { a as useActiveLocale, r as useDomainDict } from "./translations-DOkF8DDQ.mjs";
12
12
  import { t as createTranslationContext } from "./translation-api-context-factory-CqaWGIeb.mjs";
13
+ import { i as usePointsLabel } from "./PointsWidget-6YdBaoXD.mjs";
13
14
  import { t as MobileActionSheet } from "./MobileActionSheet-I6R0vvJ-.mjs";
14
15
  import { t as ResponsiveDialog } from "./ResponsiveDialog-h7BokaTp.mjs";
15
16
  import { n as useAppNavigation } from "./AppNavigationContext-BnYj4Pjp.mjs";
@@ -3626,7 +3627,10 @@ function mapListItem(bff) {
3626
3627
  currency: portalCurrency(bff.currency)
3627
3628
  })),
3628
3629
  currency: portalCurrency(bff.currency),
3629
- blackout_days: parseBlackoutDays(bff.blackout_days)
3630
+ blackout_days: parseBlackoutDays(bff.blackout_days),
3631
+ auto_apply_points: bff.auto_apply_points,
3632
+ points_enabled: bff.points_enabled,
3633
+ auto_apply_points_available: bff.auto_apply_points_available
3630
3634
  };
3631
3635
  }
3632
3636
  function mapSubscriptionList(response) {
@@ -4886,6 +4890,15 @@ function friendlyDaysAhead(end, t, now = Date.now()) {
4886
4890
  if (days === 1) return t("list_bills_tomorrow");
4887
4891
  return t("list_bills_in_n_days", { n: String(days) });
4888
4892
  }
4893
+ /**
4894
+ * Whether a subscription card says its renewals spend the customer's points
4895
+ * (ENG-3901). The same rule as the detail screen's switch: the company runs
4896
+ * points, the customer opted in, and the product is not excluded. A product
4897
+ * the payload does not report on keeps the opt-in, as the switch does.
4898
+ */
4899
+ function autoAppliesPoints(sub) {
4900
+ return sub.points_enabled === true && sub.auto_apply_points === true && sub.auto_apply_points_available !== false;
4901
+ }
4889
4902
  //#endregion
4890
4903
  //#region src/screens/subscriptions/PortalSubscriptionsList.tsx
4891
4904
  const UNIT_KEYS = {
@@ -4909,6 +4922,7 @@ const UNIT_KEYS = {
4909
4922
  const EMPTY_BUNDLES = [];
4910
4923
  function PortalSubscriptionsList({ customerId, isLoadingCustomer, onSubscriptionClick, onResume, onBundleClick, bundles = EMPTY_BUNDLES }) {
4911
4924
  const { t } = useSubscriptionsTranslation();
4925
+ const { plural: pointsLabel } = usePointsLabel();
4912
4926
  const [filter, setFilter] = useState("all");
4913
4927
  const listEnabled = !!customerId && !isLoadingCustomer;
4914
4928
  const { data: unfilteredData } = useInfiniteSubscriptions({
@@ -4989,11 +5003,13 @@ function PortalSubscriptionsList({ customerId, isLoadingCustomer, onSubscription
4989
5003
  children: [showBundleSection && relevantBundles.map((bundle, i) => /* @__PURE__ */ jsx(BundleCard, {
4990
5004
  bundle,
4991
5005
  onSubscriptionClick,
5006
+ pointsLabel,
4992
5007
  t
4993
5008
  }, `bundle-${i}-${bundle.next_bill_date}`)), activeSubs.map((sub) => /* @__PURE__ */ jsx(SubscriptionCard, {
4994
5009
  sub,
4995
5010
  onClick: () => onSubscriptionClick(sub.subscription_token),
4996
5011
  onResume: onResume ? () => onResume(sub) : void 0,
5012
+ pointsLabel,
4997
5013
  t
4998
5014
  }, sub.id))]
4999
5015
  }), inactiveSubs.length > 0 && /* @__PURE__ */ jsxs("div", {
@@ -5066,7 +5082,7 @@ function FilterPills({ active, counts, onChange, onBundleClick, t }) {
5066
5082
  });
5067
5083
  }
5068
5084
  const BUNDLE_INLINE_LIMIT = 2;
5069
- function BundleCard({ bundle, onSubscriptionClick, t }) {
5085
+ function BundleCard({ bundle, onSubscriptionClick, pointsLabel, t }) {
5070
5086
  const [popoverOpen, setPopoverOpen] = useState(false);
5071
5087
  const { isMobile } = useSidebar();
5072
5088
  const nextBillLong = bundle.next_bill_date ? formatLongDate(bundle.next_bill_date) : null;
@@ -5097,6 +5113,7 @@ function BundleCard({ bundle, onSubscriptionClick, t }) {
5097
5113
  children: [inlineMembers.map((sub) => /* @__PURE__ */ jsx(BundleMemberRow, {
5098
5114
  sub,
5099
5115
  onClick: () => handleMemberClick(sub.subscription_token),
5116
+ pointsLabel,
5100
5117
  t
5101
5118
  }, sub.subscription_token)), overflowCount > 0 && (isMobile ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("button", {
5102
5119
  type: "button",
@@ -5112,6 +5129,7 @@ function BundleCard({ bundle, onSubscriptionClick, t }) {
5112
5129
  children: bundle.subscriptions.map((sub) => /* @__PURE__ */ jsx(BundleMemberRow, {
5113
5130
  sub,
5114
5131
  onClick: () => handleMemberClick(sub.subscription_token),
5132
+ pointsLabel,
5115
5133
  t
5116
5134
  }, sub.subscription_token))
5117
5135
  })
@@ -5136,6 +5154,7 @@ function BundleCard({ bundle, onSubscriptionClick, t }) {
5136
5154
  children: bundle.subscriptions.map((sub) => /* @__PURE__ */ jsx(BundleMemberRow, {
5137
5155
  sub,
5138
5156
  onClick: () => handleMemberClick(sub.subscription_token),
5157
+ pointsLabel,
5139
5158
  t
5140
5159
  }, sub.subscription_token))
5141
5160
  })]
@@ -5173,7 +5192,7 @@ function BundleCard({ bundle, onSubscriptionClick, t }) {
5173
5192
  ]
5174
5193
  });
5175
5194
  }
5176
- function BundleMemberRow({ sub, onClick, t }) {
5195
+ function BundleMemberRow({ sub, onClick, pointsLabel, t }) {
5177
5196
  const discountLine = detailDiscountLine(sub, t);
5178
5197
  const variant = variantLabel(sub.variant);
5179
5198
  const quantity = sub.quantity ?? 1;
@@ -5210,6 +5229,10 @@ function BundleMemberRow({ sub, onClick, t }) {
5210
5229
  /* @__PURE__ */ jsx("div", {
5211
5230
  className: "text-muted-foreground truncate text-xs",
5212
5231
  children: bundleMemberCadence(sub.subscription_plan, t)
5232
+ }),
5233
+ autoAppliesPoints(sub) && /* @__PURE__ */ jsx("div", {
5234
+ className: "text-muted-foreground truncate text-xs",
5235
+ children: t("auto_apply_points_each_renewal", { label: pointsLabel })
5213
5236
  })
5214
5237
  ]
5215
5238
  }),
@@ -5264,7 +5287,7 @@ function bundleMemberCadence(plan, t) {
5264
5287
  const keys = UNIT_KEYS[unit.toLowerCase()];
5265
5288
  return t("list_cadence_every_unit", { unit: keys ? t(keys.singular) : unit });
5266
5289
  }
5267
- function SubscriptionCard({ sub, onClick, onResume, t }) {
5290
+ function SubscriptionCard({ sub, onClick, onResume, pointsLabel, t }) {
5268
5291
  const status = mapStatus(sub.status, t);
5269
5292
  const variant = variantLabel(sub.variant);
5270
5293
  const quantity = sub.quantity ?? 1;
@@ -5305,6 +5328,10 @@ function SubscriptionCard({ sub, onClick, onResume, t }) {
5305
5328
  className: "text-muted-foreground mt-0.5 text-sm",
5306
5329
  children: cadence
5307
5330
  }),
5331
+ autoAppliesPoints(sub) && /* @__PURE__ */ jsx("div", {
5332
+ className: "text-muted-foreground mt-0.5 text-xs",
5333
+ children: t("auto_apply_points_each_renewal", { label: pointsLabel })
5334
+ }),
5308
5335
  (isPaused || isCancelled || isPastDue) && /* @__PURE__ */ jsxs("div", {
5309
5336
  className: `mt-2 inline-flex items-center gap-1.5 text-xs font-semibold ${isPastDue ? "text-destructive" : "text-muted-foreground/75"}`,
5310
5337
  children: [/* @__PURE__ */ jsx("span", { className: `size-1.5 rounded-full ${isCancelled || isPastDue ? "bg-destructive" : "bg-muted-foreground"}` }), status.label]
@@ -12614,4 +12641,4 @@ const subscriptionsScreenPropertySchema = {
12614
12641
  //#endregion
12615
12642
  export { subscriptionsScreenPropertySchema as n, SubscriptionsScreen as t };
12616
12643
 
12617
- //# sourceMappingURL=SubscriptionsScreen-DCwEV2E4.mjs.map
12644
+ //# sourceMappingURL=SubscriptionsScreen-Ca9nZeeW.mjs.map