@ohhwells/bridge 0.1.139-next.388 → 0.1.139-next.389

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/index.cjs CHANGED
@@ -6600,6 +6600,21 @@ function pricingCardFeatureCount(tree, index) {
6600
6600
  const target = findPricingCollection(tree)?.children?.[index];
6601
6601
  return target ? pricingFeatureList(target).length : 0;
6602
6602
  }
6603
+ function prevailingFeatureIcon(features) {
6604
+ const counts = /* @__PURE__ */ new Map();
6605
+ for (const row of features) {
6606
+ const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
6607
+ const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
6608
+ entry.count += 1;
6609
+ counts.set(key, entry);
6610
+ }
6611
+ let best = null;
6612
+ for (const entry of counts.values()) {
6613
+ if (!best || entry.count > best.count) best = entry;
6614
+ }
6615
+ if (!best) return {};
6616
+ return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
6617
+ }
6603
6618
  function addPricingCardFeature(tree, index, text) {
6604
6619
  return withPricingCollection(tree, (collection) => {
6605
6620
  const children = collection.children;
@@ -6608,7 +6623,7 @@ function addPricingCardFeature(tree, index, text) {
6608
6623
  const features = pricingFeatureList(target);
6609
6624
  if (features.length >= PRICING_FEATURES_MAX) return false;
6610
6625
  target.slots = target.slots ?? {};
6611
- target.slots.features = [...features, { text }];
6626
+ target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
6612
6627
  return true;
6613
6628
  });
6614
6629
  }