@fluid-app/portal-sdk 0.1.705 → 0.1.707

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.
@@ -1439,6 +1439,18 @@ function findVariantBySelections(variants, selections) {
1439
1439
  return matchingVariants.find((v) => v.is_master !== true) ?? matchingVariants[0];
1440
1440
  }
1441
1441
  /**
1442
+ * Whether some variant carries `valueId` for `optionId` together with every
1443
+ * other current selection. A value that does not combine is dimmed but stays
1444
+ * pickable: where options move together (30 servings in 1 bottle, 90 in 3),
1445
+ * the variant is reached only through a combination that does not exist.
1446
+ */
1447
+ function isOptionValueCombinable(variants, selections, optionId, valueId) {
1448
+ return findVariantBySelections(variants, {
1449
+ ...selections,
1450
+ [optionId]: valueId
1451
+ }) != null;
1452
+ }
1453
+ /**
1442
1454
  * Map BFF flat subscription plans to the legacy ProductSubscriptionPlan shape
1443
1455
  * expected by the PurchaseOptions component.
1444
1456
  */
@@ -1504,8 +1516,8 @@ function ProductDetail({ companyLogoUrl, canShowVolume = false, productId, rende
1504
1516
  ]);
1505
1517
  const selectedVariant = (0, react.useMemo)(() => {
1506
1518
  if (showVariantChoices) return variants.find((v) => v.id === selectedVariantId) ?? masterVariant;
1507
- if (optionGroups.length === 0) return masterVariant;
1508
- return findVariantBySelections(variants, selections) ?? masterVariant;
1519
+ if (optionGroups.length === 0 || Object.keys(selections).length === 0) return masterVariant;
1520
+ return findVariantBySelections(variants, selections);
1509
1521
  }, [
1510
1522
  variants,
1511
1523
  optionGroups,
@@ -1809,6 +1821,7 @@ function ProductDetail({ companyLogoUrl, canShowVolume = false, productId, rende
1809
1821
  className: "max-h-60",
1810
1822
  children: group.values.map((v) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.SelectItem, {
1811
1823
  value: String(v.id),
1824
+ className: isOptionValueCombinable(variants, selections, group.optionId, v.id) ? void 0 : "opacity-50",
1812
1825
  children: v.name
1813
1826
  }, v.id))
1814
1827
  })]
@@ -1993,4 +2006,4 @@ Object.defineProperty(exports, "shopScreenPropertySchema", {
1993
2006
  }
1994
2007
  });
1995
2008
 
1996
- //# sourceMappingURL=ShopScreen-CFiIRrBI.cjs.map
2009
+ //# sourceMappingURL=ShopScreen-Bg11Pzqj.cjs.map