@bunnyapp/components 1.7.0-beta.43 → 1.7.0-beta.45

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.
Files changed (37) hide show
  1. package/dist/cjs/index.js +214 -190
  2. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/featureAddons/FeatureAddonRow.d.ts +0 -3
  3. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/priceListCardDesktop/PriceListCardDesktop.d.ts +1 -17
  4. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerMobile/PriceListCardMobile.d.ts +1 -3
  5. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceDescription/BillingPeriodDescription.d.ts +12 -0
  6. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceDescription/PriceListCardPriceDescription.d.ts +13 -6
  7. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceListCard.d.ts +1 -1
  8. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/priceListCardUtils.d.ts +0 -4
  9. package/dist/cjs/types/src/components/priceListPricing/PricingTooltip.d.ts +6 -5
  10. package/dist/cjs/types/src/components/priceListPricing/components/ChargePriceTiers.d.ts +2 -1
  11. package/dist/cjs/types/src/components/priceListPricing/components/PriceTierPrice.d.ts +10 -3
  12. package/dist/cjs/types/src/utils/priceListChargeUtils/priceListChargePriceDescription.d.ts +13 -0
  13. package/dist/cjs/types/src/utils/priceListUtils/getActiveCharges.d.ts +10 -0
  14. package/dist/cjs/types/src/utils/priceListUtils/getPrice.d.ts +9 -0
  15. package/dist/cjs/types/src/utils/priceListUtils/getPricingUnit.d.ts +16 -0
  16. package/dist/cjs/types/src/utils/priceListUtils/priceDescription.d.ts +11 -4
  17. package/dist/esm/index.js +214 -190
  18. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/featureAddons/FeatureAddonRow.d.ts +0 -3
  19. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/priceListCardDesktop/PriceListCardDesktop.d.ts +1 -17
  20. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerMobile/PriceListCardMobile.d.ts +1 -3
  21. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceDescription/BillingPeriodDescription.d.ts +12 -0
  22. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceDescription/PriceListCardPriceDescription.d.ts +13 -6
  23. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceListCard.d.ts +1 -1
  24. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/priceListCardUtils.d.ts +0 -4
  25. package/dist/esm/types/src/components/priceListPricing/PricingTooltip.d.ts +6 -5
  26. package/dist/esm/types/src/components/priceListPricing/components/ChargePriceTiers.d.ts +2 -1
  27. package/dist/esm/types/src/components/priceListPricing/components/PriceTierPrice.d.ts +10 -3
  28. package/dist/esm/types/src/utils/priceListChargeUtils/priceListChargePriceDescription.d.ts +13 -0
  29. package/dist/esm/types/src/utils/priceListUtils/getActiveCharges.d.ts +10 -0
  30. package/dist/esm/types/src/utils/priceListUtils/getPrice.d.ts +9 -0
  31. package/dist/esm/types/src/utils/priceListUtils/getPricingUnit.d.ts +16 -0
  32. package/dist/esm/types/src/utils/priceListUtils/priceDescription.d.ts +11 -4
  33. package/package.json +1 -1
  34. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceDescription/utils/hasMultipleRecurringCharges.d.ts +0 -12
  35. package/dist/cjs/types/src/utils/priceListUtils/doesPriceListHaveFlatFeeCharges.d.ts +0 -12
  36. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceDescription/utils/hasMultipleRecurringCharges.d.ts +0 -12
  37. package/dist/esm/types/src/utils/priceListUtils/doesPriceListHaveFlatFeeCharges.d.ts +0 -12
package/dist/cjs/index.js CHANGED
@@ -1283,7 +1283,7 @@ const DEFAULT_CONFIG = {
1283
1283
  };
1284
1284
 
1285
1285
  // This will be replaced at build time by rollup-plugin-replace
1286
- const PACKAGE_VERSION = '1.7.0-beta.42';
1286
+ const PACKAGE_VERSION = '1.7.0-beta.44';
1287
1287
  const createRequestHeaders = (token) => {
1288
1288
  const headers = createClientDevHeaders({ token });
1289
1289
  // Add the components version header
@@ -26496,6 +26496,36 @@ const everythingInPlusString = ({ priceList }) => {
26496
26496
  return `Everything in ${priceList.plan.name}, plus`;
26497
26497
  };
26498
26498
 
26499
+ const ChargeHasPriceTiers_PriceListChargeFragment = t(`
26500
+ fragment ChargeHasPriceTiers_PriceListChargeFragment on PriceListCharge {
26501
+ priceListChargeTiers {
26502
+ starts
26503
+ price
26504
+ }
26505
+ }
26506
+ `);
26507
+ function chargeHasPriceTiers(maskedCharge) {
26508
+ var _a;
26509
+ // Read fragments
26510
+ const charge = readFragment(ChargeHasPriceTiers_PriceListChargeFragment, maskedCharge);
26511
+ return ((_a = charge.priceListChargeTiers) === null || _a === void 0 ? void 0 : _a.length) && charge.priceListChargeTiers.length > 1;
26512
+ }
26513
+
26514
+ const PriceListHasPriceTiers_PriceListFragment = t(`
26515
+ fragment PriceListHasPriceTiers_PriceListFragment on PriceList {
26516
+ charges {
26517
+ ...ChargeHasPriceTiers_PriceListChargeFragment
26518
+ }
26519
+ }
26520
+ `, [ChargeHasPriceTiers_PriceListChargeFragment]);
26521
+ // a pricelist has price tiers if any of its charges have > 1 price tier
26522
+ const priceListHasPriceTiers = (maskedPriceList) => {
26523
+ var _a;
26524
+ // Read fragments
26525
+ const priceList = readFragment(PriceListHasPriceTiers_PriceListFragment, maskedPriceList);
26526
+ return (_a = priceList.charges) === null || _a === void 0 ? void 0 : _a.some(chargeHasPriceTiers);
26527
+ };
26528
+
26499
26529
  const TOOLTIP_BG_COLOR = '#2F353B';
26500
26530
 
26501
26531
  function Tooltip(props) {
@@ -26509,53 +26539,97 @@ function Tooltip(props) {
26509
26539
  } }));
26510
26540
  }
26511
26541
 
26512
- const filterDeprecatedCharges_PriceListChargeFragment = t(`
26513
- fragment filterDeprecatedCharges_PriceListChargeFragment on PriceListCharge {
26514
- deprecated
26515
- removeOnRenewal
26542
+ const priceListChargePriceDescription_PriceListChargeFragment = t(`
26543
+ fragment priceListChargePriceDescription_PriceListChargeFragment on PriceListCharge {
26544
+ showPriceAsMonthly
26545
+ billingPeriod
26546
+ feature {
26547
+ unitName
26548
+ }
26516
26549
  }
26517
26550
  `);
26518
- function filterDeprecatedCharges(quoteChangeKind, maskedCharge) {
26519
- const charge = readFragment(filterDeprecatedCharges_PriceListChargeFragment, maskedCharge);
26520
- // If kind are not subscribe, reinstate or renew, then the deprecated charge is grandfathered in and can be displayed
26521
- if (quoteChangeKind &&
26522
- !(quoteChangeKind === t.scalar('QuoteChangeKind', 'SUBSCRIBE') ||
26523
- quoteChangeKind === t.scalar('QuoteChangeKind', 'REINSTATE') ||
26524
- quoteChangeKind === t.scalar('QuoteChangeKind', 'RENEW'))) {
26525
- return true;
26526
- }
26527
- const deprecated = charge.deprecated;
26528
- if (deprecated && quoteChangeKind === t.scalar('QuoteChangeKind', 'RENEW')) {
26529
- return !charge.removeOnRenewal;
26551
+ function priceListChargePriceDescription(maskedPriceListCharge) {
26552
+ var _a;
26553
+ // Read fragments
26554
+ const priceListCharge = readFragment(priceListChargePriceDescription_PriceListChargeFragment, maskedPriceListCharge);
26555
+ const billingPeriod = priceListCharge.billingPeriod;
26556
+ const periodLabel = billingPeriod ? PERIOD_LABELS[billingPeriod] : null;
26557
+ const unitName = (_a = priceListCharge.feature) === null || _a === void 0 ? void 0 : _a.unitName;
26558
+ return `Per ${unitName ? `${unitName} / ` : ''}${priceListCharge.showPriceAsMonthly ? 'month' : periodLabel}`;
26559
+ }
26560
+
26561
+ const GetActiveCharges_PriceListChargeFragment = t(`
26562
+ fragment GetActiveCharges_PriceListChargeFragment on PriceListCharge {
26563
+ deprecated
26564
+ featureAddon
26530
26565
  }
26531
- return !deprecated;
26566
+ `);
26567
+ // Active charges: any charge that is not deprecated and not a feature addon
26568
+ function getActiveCharges(charges) {
26569
+ return charges.filter(maskedCharge => {
26570
+ const charge = readFragment(GetActiveCharges_PriceListChargeFragment, maskedCharge);
26571
+ return !charge.deprecated && !charge.featureAddon;
26572
+ });
26532
26573
  }
26533
26574
 
26534
- const DoesPriceListHaveFlatFeeCharges_PriceListFragment = t(`
26535
- fragment DoesPriceListHaveFlatFeeCharges_PriceListFragment on PriceList {
26575
+ const getPriceListUnitName_PriceListFragment = t(`
26576
+ fragment getPriceListUnitName_PriceListFragment on PriceList {
26536
26577
  charges {
26537
- pricingModel
26538
- basePrice
26578
+ chargeType
26579
+ featureAddon
26580
+ deprecated
26581
+ feature {
26582
+ unitName
26583
+ }
26539
26584
  }
26540
26585
  }
26541
- `);
26542
- function doesPriceListHaveFlatFeeCharges(maskedPriceList) {
26543
- var _a, _b;
26586
+ `, []);
26587
+ function getPriceListUnitName(maskedPriceList) {
26588
+ var _a, _b, _c;
26544
26589
  // Read fragments
26545
- const priceList = readFragment(DoesPriceListHaveFlatFeeCharges_PriceListFragment, maskedPriceList);
26546
- return ((_b = (_a = priceList.charges) === null || _a === void 0 ? void 0 : _a.some(charge => charge.pricingModel === t.scalar('PricingModel', 'FLAT') &&
26547
- charge.basePrice != undefined &&
26548
- charge.basePrice > 0)) !== null && _b !== void 0 ? _b : false);
26590
+ const priceList = readFragment(getPriceListUnitName_PriceListFragment, maskedPriceList);
26591
+ const activeCharges = (_a = priceList.charges) === null || _a === void 0 ? void 0 : _a.filter(charge => !charge.deprecated && !charge.featureAddon);
26592
+ const recurringCharges = activeCharges === null || activeCharges === void 0 ? void 0 : activeCharges.filter(charge => charge.chargeType === 'RECURRING');
26593
+ const usageCharges = activeCharges === null || activeCharges === void 0 ? void 0 : activeCharges.filter(charge => charge.chargeType === 'USAGE');
26594
+ // Strategy 1: If only 1 recurring charge
26595
+ // return that charge.unit
26596
+ if ((recurringCharges === null || recurringCharges === void 0 ? void 0 : recurringCharges.length) === 1) {
26597
+ return (_b = recurringCharges[0].feature) === null || _b === void 0 ? void 0 : _b.unitName;
26598
+ }
26599
+ // Strategy 2: If only 1 usage charge
26600
+ // return that charge.unit
26601
+ if ((usageCharges === null || usageCharges === void 0 ? void 0 : usageCharges.length) === 1) {
26602
+ return (_c = usageCharges[0].feature) === null || _c === void 0 ? void 0 : _c.unitName;
26603
+ }
26604
+ // Stragey 3: Else there are conflicting charges
26605
+ // return null
26606
+ return null;
26549
26607
  }
26550
26608
 
26551
- function priceDescriptionString({ unitName, showPriceAsMonthly, periodMonths, priceListHasFlatFeeCharges, }) {
26552
- const periodMonthsConverted = periodMonthsConverter(periodMonths);
26609
+ const priceDescriptionString_PriceListFragment = t(`
26610
+ fragment priceDescriptionString_PriceListFragment on PriceList {
26611
+ showPriceAsMonthly
26612
+ periodMonths
26613
+ ...getPriceListUnitName_PriceListFragment
26614
+ }
26615
+ `, [getPriceListUnitName_PriceListFragment]);
26616
+ function priceDescriptionString(maskedPriceList) {
26617
+ // Read fragments
26618
+ const priceList = readFragment(priceDescriptionString_PriceListFragment, maskedPriceList);
26619
+ const periodMonthsConverted = periodMonthsConverter(priceList.periodMonths);
26553
26620
  const periodLabel = periodMonthsConverted ? PERIOD_LABELS[periodMonthsConverted] : null;
26554
- return `Per ${unitName && !priceListHasFlatFeeCharges ? `${unitName} / ` : ''}${showPriceAsMonthly ? 'month' : periodLabel}`;
26621
+ const unitName = getPriceListUnitName(priceList);
26622
+ return `Per ${unitName ? `${unitName} / ` : ''}${priceList.showPriceAsMonthly ? 'month' : periodLabel}`;
26555
26623
  }
26556
26624
 
26557
26625
  const { Text: Text$e } = antd.Typography;
26558
- const PriceTierPrice = ({ currencyId, priceDecimals, tier, }) => {
26626
+ const PriceTierPrice_PriceTierFragment = t(`
26627
+ fragment PriceTierPrice_PriceTierFragment on PriceListChargeTier {
26628
+ price
26629
+ }
26630
+ `);
26631
+ const PriceTierPrice = ({ currencyId, priceDecimals, tier: maskedTier, }) => {
26632
+ const tier = readFragment(PriceTierPrice_PriceTierFragment, maskedTier);
26559
26633
  return (jsxRuntime.jsx(Text$e, { className: "bunny-text-white", children: formatCurrency(tier.price, currencyId, priceDecimals) }));
26560
26634
  };
26561
26635
 
@@ -26586,11 +26660,11 @@ const ChargePriceTiers_PriceListChargeFragment = t(`
26586
26660
  priceDecimals
26587
26661
  priceListChargeTiers {
26588
26662
  starts
26589
- price
26590
26663
  ...PriceTierRow_PriceTierFragment
26664
+ ...PriceTierPrice_PriceTierFragment
26591
26665
  }
26592
26666
  }
26593
- `, [PriceTierRow_PriceTierFragment]);
26667
+ `, [PriceTierRow_PriceTierFragment, PriceTierPrice_PriceTierFragment]);
26594
26668
  const ChargePriceTiers = ({ charge: maskedCharge, currencyId, }) => {
26595
26669
  var _a;
26596
26670
  const charge = readFragment(ChargePriceTiers_PriceListChargeFragment, maskedCharge);
@@ -26606,21 +26680,6 @@ const ChargePriceTiers = ({ charge: maskedCharge, currencyId, }) => {
26606
26680
  }) })] }));
26607
26681
  };
26608
26682
 
26609
- const ChargeHasPriceTiers_PriceListChargeFragment = t(`
26610
- fragment ChargeHasPriceTiers_PriceListChargeFragment on PriceListCharge {
26611
- priceListChargeTiers {
26612
- starts
26613
- price
26614
- }
26615
- }
26616
- `);
26617
- function chargeHasPriceTiers(maskedCharge) {
26618
- var _a;
26619
- // Read fragments
26620
- const charge = readFragment(ChargeHasPriceTiers_PriceListChargeFragment, maskedCharge);
26621
- return ((_a = charge.priceListChargeTiers) === null || _a === void 0 ? void 0 : _a.length) && charge.priceListChargeTiers.length > 1;
26622
- }
26623
-
26624
26683
  const getFirstTierPrice = (charge, currencyId) => {
26625
26684
  var _a, _b, _c;
26626
26685
  const price = (_b = (_a = charge.priceListChargeTiers) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.price;
@@ -26652,75 +26711,41 @@ const PricingTooltip_PriceListChargeFragment = t(`
26652
26711
  priceDecimals
26653
26712
  basePrice
26654
26713
  name
26714
+ ...priceListChargePriceDescription_PriceListChargeFragment
26655
26715
  ...ChargeHasPriceTiers_PriceListChargeFragment
26656
26716
  ...ChargePriceTiers_PriceListChargeFragment
26717
+ ...GetActiveCharges_PriceListChargeFragment
26657
26718
  }
26658
- `, [ChargeHasPriceTiers_PriceListChargeFragment, ChargePriceTiers_PriceListChargeFragment]);
26719
+ `, [
26720
+ ChargeHasPriceTiers_PriceListChargeFragment,
26721
+ ChargePriceTiers_PriceListChargeFragment,
26722
+ GetActiveCharges_PriceListChargeFragment,
26723
+ priceListChargePriceDescription_PriceListChargeFragment
26724
+ ]);
26659
26725
  const PricingTooltip_PriceListFragment = t(`
26660
26726
  fragment PricingTooltip_PriceListFragment on PriceList {
26661
- showPriceAsMonthly
26662
- periodMonths
26663
26727
  currencyId
26664
26728
  monthlyBasePrice
26665
26729
  basePrice
26666
- ...DoesPriceListHaveFlatFeeCharges_PriceListFragment
26730
+ ...priceDescriptionString_PriceListFragment
26667
26731
  }
26668
- `, [DoesPriceListHaveFlatFeeCharges_PriceListFragment]);
26669
- const PricingTooltip = ({ className, priceListCharges: maskedPriceListCharges, currencyId, priceList: maskedPriceList, }) => {
26732
+ `, [priceDescriptionString_PriceListFragment]);
26733
+ const PricingTooltip = ({ className, priceListCharges: maskedPriceListCharges, currencyId, }) => {
26670
26734
  // Read fragments
26671
- const priceList = readFragment(PricingTooltip_PriceListFragment, maskedPriceList);
26672
26735
  const priceListCharges = maskedPriceListCharges.map(charge => readFragment(PricingTooltip_PriceListChargeFragment, charge));
26673
- const filteredPriceListCharges = priceListCharges.filter(charge => filterDeprecatedCharges(undefined, charge));
26736
+ const activeCharges = getActiveCharges(priceListCharges);
26674
26737
  const content = react.useMemo(() => {
26675
- return (jsxRuntime.jsx("div", { className: "bunny-flex bunny-flex-col bunny-gap-3", children: filteredPriceListCharges === null || filteredPriceListCharges === void 0 ? void 0 : filteredPriceListCharges.map((charge, index) => {
26676
- var _a;
26738
+ return (jsxRuntime.jsx("div", { className: "bunny-flex bunny-flex-col bunny-gap-3", children: activeCharges === null || activeCharges === void 0 ? void 0 : activeCharges.map((charge, index) => {
26677
26739
  const hasPriceTiers = chargeHasPriceTiers(charge);
26678
26740
  if (hasPriceTiers) {
26679
26741
  return jsxRuntime.jsx(ChargePriceTiers, { charge: charge, currencyId: currencyId }, index);
26680
26742
  }
26681
- return (jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-1", children: [jsxRuntime.jsx("div", { className: "bunny-text-white bunny-font-bold", children: charge.name }), jsxRuntime.jsxs("div", { className: "bunny-text-gray-400 bunny-text-xs/3", children: [getChargeBasePrice(charge, currencyId), ' ', priceDescriptionString({
26682
- unitName: (_a = charge.feature) === null || _a === void 0 ? void 0 : _a.unitName,
26683
- showPriceAsMonthly: priceList === null || priceList === void 0 ? void 0 : priceList.showPriceAsMonthly,
26684
- periodMonths: priceList === null || priceList === void 0 ? void 0 : priceList.periodMonths,
26685
- priceListHasFlatFeeCharges: doesPriceListHaveFlatFeeCharges(priceList),
26686
- })] })] }, index));
26743
+ return (jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-1", children: [jsxRuntime.jsx("div", { className: "bunny-text-white bunny-font-bold", children: charge.name }), jsxRuntime.jsxs("div", { className: "bunny-text-gray-400 bunny-text-xs/3", children: [getChargeBasePrice(charge, currencyId), ' ', priceListChargePriceDescription(charge)] })] }, index));
26687
26744
  }) }));
26688
- }, [filteredPriceListCharges, currencyId]);
26745
+ }, [activeCharges, currencyId]);
26689
26746
  return (jsxRuntime.jsx(Tooltip, { className: `bunny-text-gray-400 bunny-text-sm ${className}`, title: content, children: jsxRuntime.jsx(icons.InfoCircleOutlined, { className: "bunny-text-gray-400 ", size: 15 }) }));
26690
26747
  };
26691
26748
 
26692
- const PriceListHasPriceTiers_PriceListFragment = t(`
26693
- fragment PriceListHasPriceTiers_PriceListFragment on PriceList {
26694
- charges {
26695
- ...ChargeHasPriceTiers_PriceListChargeFragment
26696
- }
26697
- }
26698
- `, [ChargeHasPriceTiers_PriceListChargeFragment]);
26699
- // a pricelist has price tiers if any of its charges have > 1 price tier
26700
- const priceListHasPriceTiers = (maskedPriceList) => {
26701
- var _a;
26702
- // Read fragments
26703
- const priceList = readFragment(PriceListHasPriceTiers_PriceListFragment, maskedPriceList);
26704
- return (_a = priceList.charges) === null || _a === void 0 ? void 0 : _a.some(chargeHasPriceTiers);
26705
- };
26706
-
26707
- const HasMultipleRecurringCharges_PriceListFragment = t(`
26708
- fragment HasMultipleRecurringCharges_PriceListFragment on PriceList {
26709
- charges {
26710
- chargeType
26711
- featureAddon
26712
- }
26713
- }
26714
- `);
26715
- // Exclude add-on charges because they may not be present in the quote/subscription
26716
- // Exclude usage charges because their price depends on the usage (we don't know what the usage will be)
26717
- const hasMultipleRecurringCharges = (maskedPriceList) => {
26718
- var _a, _b;
26719
- // Read fragments
26720
- const priceList = readFragment(HasMultipleRecurringCharges_PriceListFragment, maskedPriceList);
26721
- return (((_b = (_a = priceList.charges) === null || _a === void 0 ? void 0 : _a.filter(charge => charge.chargeType !== t.scalar('ChargeType', 'USAGE') && charge.featureAddon !== true).length) !== null && _b !== void 0 ? _b : 0) > 1);
26722
- };
26723
-
26724
26749
  /**
26725
26750
  * It is possible for html based descriptions to return something like '<p></p>'
26726
26751
  * In which case a null check or character length count doesn't work.
@@ -26731,6 +26756,22 @@ function isEmptyHTML(html) {
26731
26756
  return /^<[^>]*>(\s*)<\/[^>]*>$/.test(html);
26732
26757
  }
26733
26758
 
26759
+ const BillingPeriodDescription_PriceListFragment = t(`
26760
+ fragment BillingPeriodDescription_PriceListFragment on PriceList {
26761
+ periodMonths
26762
+ }
26763
+ `);
26764
+ const BillingPeriodDescription = ({ priceList: maskedPriceList, }) => {
26765
+ // Read fragments
26766
+ const priceList = readFragment(BillingPeriodDescription_PriceListFragment, maskedPriceList);
26767
+ const periodMonthsConverted = periodMonthsConverter(priceList.periodMonths);
26768
+ const billingPeriodText = periodMonthsConverted
26769
+ ? BillingPeriodConverter$1[periodMonthsConverted]
26770
+ : 'undefined';
26771
+ const showDescription = priceList.periodMonths && priceList.periodMonths > 1;
26772
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: showDescription && (jsxRuntime.jsxs("div", { children: ["Billed ", billingPeriodText] })) }));
26773
+ };
26774
+
26734
26775
  const { Text: Text$b } = antd.Typography;
26735
26776
  const MarkupWrapper = defaultStyled.div `
26736
26777
  padding: 0 !important;
@@ -26747,28 +26788,32 @@ const PriceListCardPriceDescription_PriceListFragment = t(`
26747
26788
  plan {
26748
26789
  pricingDescription
26749
26790
  }
26750
- showPriceAsMonthly
26791
+ charges {
26792
+ ...GetActiveCharges_PriceListChargeFragment
26793
+ ...PricingTooltip_PriceListChargeFragment
26794
+ }
26795
+ currencyId
26751
26796
  periodMonths
26752
- ...DoesPriceListHaveFlatFeeCharges_PriceListFragment
26753
- ...HasMultipleRecurringCharges_PriceListFragment
26797
+ ...priceDescriptionString_PriceListFragment
26798
+ ...BillingPeriodDescription_PriceListFragment
26799
+ ...PriceListHasPriceTiers_PriceListFragment
26754
26800
  }
26755
- `, [DoesPriceListHaveFlatFeeCharges_PriceListFragment, HasMultipleRecurringCharges_PriceListFragment]);
26756
- const PriceListCardPriceDescription = ({ feature, priceList: maskedPriceList, }) => {
26757
- var _a;
26801
+ `, [
26802
+ priceDescriptionString_PriceListFragment,
26803
+ BillingPeriodDescription_PriceListFragment,
26804
+ PriceListHasPriceTiers_PriceListFragment,
26805
+ GetActiveCharges_PriceListChargeFragment,
26806
+ PricingTooltip_PriceListChargeFragment
26807
+ ]);
26808
+ const PriceListCardPriceDescription = ({ priceList: maskedPriceList, }) => {
26809
+ var _a, _b;
26758
26810
  // Read fragments
26759
26811
  const priceList = readFragment(PriceListCardPriceDescription_PriceListFragment, maskedPriceList);
26812
+ const activeCharges = getActiveCharges((_a = priceList.charges) !== null && _a !== void 0 ? _a : []);
26813
+ const showPricingTooltip = priceListHasPriceTiers(priceList) || activeCharges.length > 1;
26760
26814
  if (priceList.periodMonths && priceList.periodMonths <= 0)
26761
26815
  return null;
26762
- const periodMonthsConverted = periodMonthsConverter(priceList.periodMonths);
26763
- const billingPeriodText = periodMonthsConverted
26764
- ? BillingPeriodConverter$1[periodMonthsConverted]
26765
- : 'undefined';
26766
- return (jsxRuntime.jsxs(Text$b, { className: "bunny-text-start bunny-text-gray-400 bunny-text-sm", children: [jsxRuntime.jsx("div", { children: ((_a = priceList.plan) === null || _a === void 0 ? void 0 : _a.pricingDescription) && !isEmptyHTML(priceList.plan.pricingDescription) ? (jsxRuntime.jsx(MarkupWrapper, { children: jsxRuntime.jsx(interweave.Markup, { content: priceList.plan.pricingDescription }) })) : (priceDescriptionString({
26767
- unitName: hasMultipleRecurringCharges(priceList) ? undefined : feature === null || feature === void 0 ? void 0 : feature.unitName,
26768
- showPriceAsMonthly: priceList.showPriceAsMonthly,
26769
- periodMonths: priceList.periodMonths,
26770
- priceListHasFlatFeeCharges: doesPriceListHaveFlatFeeCharges(priceList),
26771
- })) }), priceList.periodMonths && priceList.periodMonths > 1 && (jsxRuntime.jsxs("div", { children: ["Billed ", billingPeriodText] }))] }));
26816
+ return (jsxRuntime.jsxs(Text$b, { className: "bunny-text-start bunny-text-gray-400 bunny-text-sm", children: [jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center", children: [jsxRuntime.jsx("div", { children: ((_b = priceList.plan) === null || _b === void 0 ? void 0 : _b.pricingDescription) && !isEmptyHTML(priceList.plan.pricingDescription) ? (jsxRuntime.jsx(MarkupWrapper, { children: jsxRuntime.jsx(interweave.Markup, { content: priceList.plan.pricingDescription }) })) : (priceDescriptionString(priceList)) }), showPricingTooltip && (jsxRuntime.jsx(PricingTooltip, { priceListCharges: activeCharges, currencyId: priceList.currencyId }))] }), jsxRuntime.jsx(BillingPeriodDescription, { priceList: priceList })] }));
26772
26817
  };
26773
26818
 
26774
26819
  /**
@@ -26805,16 +26850,52 @@ const PriceListCardDescription = ({ description, className }) => {
26805
26850
  return jsxRuntime.jsx(TruncatedText, { className: `bunny-text-gray-400 bunny-text-sm ${className !== null && className !== void 0 ? className : ''}`, text: description });
26806
26851
  };
26807
26852
 
26853
+ const filterDeprecatedCharges_PriceListChargeFragment = t(`
26854
+ fragment filterDeprecatedCharges_PriceListChargeFragment on PriceListCharge {
26855
+ deprecated
26856
+ removeOnRenewal
26857
+ }
26858
+ `);
26859
+ function filterDeprecatedCharges(quoteChangeKind, maskedCharge) {
26860
+ const charge = readFragment(filterDeprecatedCharges_PriceListChargeFragment, maskedCharge);
26861
+ // If kind are not subscribe, reinstate or renew, then the deprecated charge is grandfathered in and can be displayed
26862
+ if (quoteChangeKind &&
26863
+ !(quoteChangeKind === t.scalar('QuoteChangeKind', 'SUBSCRIBE') ||
26864
+ quoteChangeKind === t.scalar('QuoteChangeKind', 'REINSTATE') ||
26865
+ quoteChangeKind === t.scalar('QuoteChangeKind', 'RENEW'))) {
26866
+ return true;
26867
+ }
26868
+ const deprecated = charge.deprecated;
26869
+ if (deprecated && quoteChangeKind === t.scalar('QuoteChangeKind', 'RENEW')) {
26870
+ return !charge.removeOnRenewal;
26871
+ }
26872
+ return !deprecated;
26873
+ }
26874
+
26808
26875
  const GetPrice_PriceListFragment = t(`
26809
26876
  fragment GetPrice_PriceListFragment on PriceList {
26810
26877
  showPriceAsMonthly
26811
26878
  monthlyBasePrice
26812
26879
  basePrice
26880
+ charges {
26881
+ basePrice
26882
+ chargeType
26883
+ ...filterDeprecatedCharges_PriceListChargeFragment
26884
+ ...GetActiveCharges_PriceListChargeFragment
26885
+ }
26813
26886
  }
26814
- `);
26887
+ `, [filterDeprecatedCharges_PriceListChargeFragment, GetActiveCharges_PriceListChargeFragment]);
26815
26888
  function getPrice(maskedPriceList) {
26889
+ var _a;
26816
26890
  // Read fragments
26817
26891
  const priceList = readFragment(GetPrice_PriceListFragment, maskedPriceList);
26892
+ const activeCharges = getActiveCharges((_a = priceList.charges) !== null && _a !== void 0 ? _a : []);
26893
+ const onlyUsageChargesExist = activeCharges === null || activeCharges === void 0 ? void 0 : activeCharges.every(charge => charge.chargeType === 'USAGE');
26894
+ // HACK: If there are ONLY usage charges, sum their basePrice
26895
+ if (onlyUsageChargesExist) {
26896
+ return activeCharges === null || activeCharges === void 0 ? void 0 : activeCharges.reduce((sum, charge) => sum + charge.basePrice, 0);
26897
+ }
26898
+ // Otherwise, return the priceList basePrice or monthlyBasePrice
26818
26899
  if (priceList.showPriceAsMonthly) {
26819
26900
  return priceList.monthlyBasePrice;
26820
26901
  }
@@ -26850,10 +26931,11 @@ function priceListPriceText({ priceList: maskedPriceList, }) {
26850
26931
  }
26851
26932
  return 0;
26852
26933
  };
26934
+ const basePrice = getPrice(priceList);
26853
26935
  const priceDecimals = calculatePriceDecimals();
26854
26936
  const price = !((_a = priceList.plan) === null || _a === void 0 ? void 0 : _a.pricingStyle) ||
26855
26937
  ((_b = priceList.plan) === null || _b === void 0 ? void 0 : _b.pricingStyle) === t.scalar('PlanPricingStyles', 'PRICED')
26856
- ? formatCurrency(getPrice(priceList), priceList.currencyId, priceDecimals)
26938
+ ? formatCurrency(basePrice, priceList.currencyId, priceDecimals)
26857
26939
  : ((_c = priceList.plan) === null || _c === void 0 ? void 0 : _c.pricingStyle) === t.scalar('PlanPricingStyles', 'CONTACT_US')
26858
26940
  ? 'Custom'
26859
26941
  : 'Free';
@@ -26901,32 +26983,19 @@ const PriceListCardDesktop_PriceListFragment = t(`
26901
26983
  contactUsUrl
26902
26984
  name
26903
26985
  }
26904
- charges {
26905
- id
26906
- featureAddon
26907
- priceListChargeTiers {
26908
- starts
26909
- price
26910
- }
26911
- ...PricingTooltip_PriceListChargeFragment
26912
- }
26913
- currencyId
26914
26986
  ...PriceListCardButton_PriceListFragment
26915
26987
  ...PriceListHasPriceTiers_PriceListFragment
26916
- ...PricingTooltip_PriceListFragment
26917
26988
  ...PriceListCardPrice_PriceListFragment
26918
26989
  ...PriceListCardPriceDescription_PriceListFragment
26919
26990
  }
26920
26991
  `, [
26921
26992
  PriceListCardButton_PriceListFragment,
26922
- PricingTooltip_PriceListChargeFragment,
26923
26993
  PriceListHasPriceTiers_PriceListFragment,
26924
- PricingTooltip_PriceListFragment,
26925
26994
  PriceListCardPrice_PriceListFragment,
26926
26995
  PriceListCardPriceDescription_PriceListFragment,
26927
26996
  ]);
26928
- const PriceListCardDesktop = ({ hideButton, description, disableSelectCurrentPlan, feature, isPriceListCurrentSubscription, isSelected, priceList: maskedPriceList, subscriptionPlan, trialRemainingDays, noBorder, onClickPriceListCard, }) => {
26929
- var _a, _b, _c, _d;
26997
+ const PriceListCardDesktop = ({ hideButton, description, disableSelectCurrentPlan, isPriceListCurrentSubscription, isSelected, priceList: maskedPriceList, subscriptionPlan, trialRemainingDays, noBorder, onClickPriceListCard, }) => {
26998
+ var _a, _b;
26930
26999
  // Read fragments
26931
27000
  const priceList = readFragment(PriceListCardDesktop_PriceListFragment, maskedPriceList);
26932
27001
  return (jsxRuntime.jsx(PlanPickerGridCell, { noBorder: noBorder, children: jsxRuntime.jsxs("div", { className: `bunny-flex bunny-flex-col bunny-items-start bunny-justify-between bunny-w-full bunny-rounded-md bunny-gap-4 bunny-pt-4 bunny-px-4 ${disableSelectCurrentPlan ? '' : 'cursor-pointer'} bunny-box-border`, onClick: () => {
@@ -26945,7 +27014,7 @@ const PriceListCardDesktop = ({ hideButton, description, disableSelectCurrentPla
26945
27014
  display: 'grid',
26946
27015
  gridTemplateRows: 'auto minmax(40px, auto)',
26947
27016
  alignItems: 'start',
26948
- }, children: [jsxRuntime.jsx(PriceListCardPrice, { priceList: priceList }), jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center", children: [jsxRuntime.jsx(PriceListCardPriceDescription, { feature: feature, priceList: priceList }), priceListHasPriceTiers(priceList) && (jsxRuntime.jsx(PricingTooltip, { priceListCharges: (_d = (_c = priceList.charges) === null || _c === void 0 ? void 0 : _c.filter(charge => charge.featureAddon !== true)) !== null && _d !== void 0 ? _d : [], currencyId: priceList.currencyId, priceList: priceList }))] })] })] }), !hideButton && (jsxRuntime.jsx(PriceListCardButton, { disableSelectCurrentPlan: disableSelectCurrentPlan, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, priceList: priceList, subscriptionPlan: subscriptionPlan }))] }) }));
27017
+ }, children: [jsxRuntime.jsx(PriceListCardPrice, { priceList: priceList }), jsxRuntime.jsx("div", { className: "bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center", children: jsxRuntime.jsx(PriceListCardPriceDescription, { priceList: priceList }) })] })] }), !hideButton && (jsxRuntime.jsx(PriceListCardButton, { disableSelectCurrentPlan: disableSelectCurrentPlan, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, priceList: priceList, subscriptionPlan: subscriptionPlan }))] }) }));
26949
27018
  };
26950
27019
 
26951
27020
  const CheckIcon = ({ backgroundColor, size, }) => {
@@ -26968,7 +27037,7 @@ const PriceListCardMobile_PriceListFragment = t(`
26968
27037
  PriceListCardPrice_PriceListFragment,
26969
27038
  PriceListCardButton_PriceListFragment,
26970
27039
  ]);
26971
- const PriceListCardMobile = ({ description, feature, isPriceListCurrentSubscription, isSelected, priceList: maskedPriceList, subscriptionPlan, trialRemainingDays, disableOnClickPriceListCard, onClickPriceListCard, }) => {
27040
+ const PriceListCardMobile = ({ description, isPriceListCurrentSubscription, isSelected, priceList: maskedPriceList, subscriptionPlan, trialRemainingDays, disableOnClickPriceListCard, onClickPriceListCard, }) => {
26972
27041
  var _a, _b;
26973
27042
  // Context
26974
27043
  const { brandColor } = useBrand();
@@ -26983,7 +27052,7 @@ const PriceListCardMobile = ({ description, feature, isPriceListCurrentSubscript
26983
27052
  }, children: [isSelected && (jsxRuntime.jsx("div", { className: "bunny-absolute", style: {
26984
27053
  top: '10px',
26985
27054
  right: '10px',
26986
- }, children: jsxRuntime.jsx(CheckIcon, { backgroundColor: brandColor, size: "20px" }) })), jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-items-center bunny-grow bunny-gap-2", children: [jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-2", children: [jsxRuntime.jsx(PriceListCardTitle, { isPriceListCurrentSubscription: isPriceListCurrentSubscription, planName: (_b = (_a = priceList.plan) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : 'undefined', trialRemainingDays: trialRemainingDays }), jsxRuntime.jsx(PriceListCardDescription, { description: description })] }), jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-2", children: [jsxRuntime.jsx(PriceListCardPrice, { priceList: priceList }), jsxRuntime.jsx(PriceListCardPriceDescription, { feature: feature, priceList: priceList })] }), jsxRuntime.jsx(PriceListCardButton, { disableSelectCurrentPlan: disableOnClickPriceListCard, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, priceList: priceList, subscriptionPlan: subscriptionPlan })] })] }));
27055
+ }, children: jsxRuntime.jsx(CheckIcon, { backgroundColor: brandColor, size: "20px" }) })), jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-items-center bunny-grow bunny-gap-2", children: [jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-2", children: [jsxRuntime.jsx(PriceListCardTitle, { isPriceListCurrentSubscription: isPriceListCurrentSubscription, planName: (_b = (_a = priceList.plan) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : 'undefined', trialRemainingDays: trialRemainingDays }), jsxRuntime.jsx(PriceListCardDescription, { description: description })] }), jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-2", children: [jsxRuntime.jsx(PriceListCardPrice, { priceList: priceList }), jsxRuntime.jsx(PriceListCardPriceDescription, { priceList: priceList })] }), jsxRuntime.jsx(PriceListCardButton, { disableSelectCurrentPlan: disableOnClickPriceListCard, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, priceList: priceList, subscriptionPlan: subscriptionPlan })] })] }));
26987
27056
  };
26988
27057
 
26989
27058
  function getAddonsForBillingPeriod(billingPeriod, addonPlans) {
@@ -27017,43 +27086,6 @@ const removeHTMLTagsRegex = /<br>(?=(?:\s*<[^>]*>)*$)|(<br>)|<[^>]*>/gi;
27017
27086
  const createPlanDescription = (planDescription) => {
27018
27087
  return (planDescription || '').replace(removeHTMLTagsRegex, (_, y) => (y ? ' & ' : ''));
27019
27088
  };
27020
- const getActivePlanPriceData = (priceList, selectedPriceList) => {
27021
- if (!priceList) {
27022
- return;
27023
- }
27024
- // If a period option is selected, return the charge that matches the selected period option
27025
- let activeBillingPLCharge;
27026
- // Default to first price list charge
27027
- let lowestPLCharge;
27028
- // Find the lowest price list charge with a billing period that matches the selected period option
27029
- if (priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id)) {
27030
- activeBillingPLCharge = priceList.charges[0];
27031
- }
27032
- for (let j = 0; j < priceList.charges.length; j++) {
27033
- const charge = priceList.charges[j];
27034
- if (charge.chargeType === ChargeType$1.USAGE || charge.featureAddon === true)
27035
- continue;
27036
- if (activeBillingPLCharge) {
27037
- // If we already found a charge with the same billing period check if this charge is lower
27038
- if (charge.basePrice < activeBillingPLCharge.basePrice &&
27039
- charge.billingPeriod === (activeBillingPLCharge === null || activeBillingPLCharge === void 0 ? void 0 : activeBillingPLCharge.billingPeriod)) {
27040
- activeBillingPLCharge = charge;
27041
- }
27042
- }
27043
- // If a period option is selected, only return the charge if it matches the selected period option
27044
- else if (selectedPriceList &&
27045
- charge.billingPeriod === periodMonthsConverter(selectedPriceList.periodMonths)) {
27046
- activeBillingPLCharge = charge;
27047
- }
27048
- // Otherwise, return the lowest price list charge
27049
- else if (charge.basePrice < ((lowestPLCharge === null || lowestPLCharge === void 0 ? void 0 : lowestPLCharge.basePrice) || -1)) {
27050
- lowestPLCharge = charge;
27051
- }
27052
- }
27053
- return {
27054
- activeCharge: activeBillingPLCharge || lowestPLCharge,
27055
- };
27056
- };
27057
27089
 
27058
27090
  const PriceListCard_PriceListFragment = t(`
27059
27091
  fragment PriceListCard_PriceListFragment on PriceList {
@@ -27067,17 +27099,15 @@ const PriceListCard_PriceListFragment = t(`
27067
27099
  }
27068
27100
  `, [PriceListCardDesktop_PriceListFragment, PriceListCardMobile_PriceListFragment]);
27069
27101
  const PriceListCard = ({ hideButton, isSelected, priceList: maskedPriceList, subscriptions, trialRemainingDays, noBorder, onClickPriceListCard, disableCurrentPlan = false, }) => {
27070
- var _a, _b, _c, _d;
27102
+ var _a, _b, _c;
27071
27103
  const isMobile = useIsMobile();
27072
27104
  const upgradingSubscription = useUpgradingSubscription();
27073
27105
  // Read fragments
27074
27106
  const priceList = readFragment(PriceListCard_PriceListFragment, maskedPriceList);
27075
27107
  // Derived state
27076
27108
  const description = createPlanDescription((_b = (_a = priceList.plan) === null || _a === void 0 ? void 0 : _a.description) !== null && _b !== void 0 ? _b : '');
27077
- // Get the active price list charge for this plan
27078
- const activeCharge = (_c = getActivePlanPriceData(priceList, priceList)) === null || _c === void 0 ? void 0 : _c.activeCharge;
27079
27109
  // Is the price list the current price list for the upgradingSubscription
27080
- const isPriceListCurrentSubscription = ((_d = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList) === null || _d === void 0 ? void 0 : _d.id) === priceList.id;
27110
+ const isPriceListCurrentSubscription = ((_c = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList) === null || _c === void 0 ? void 0 : _c.id) === priceList.id;
27081
27111
  const disableSelectCurrentPlan = disableCurrentPlan;
27082
27112
  // We now support updating quantities by clicking the current plan. Therefore we shouldn't disable current plan
27083
27113
  // disableCurrentPlan ??
@@ -27092,13 +27122,9 @@ const PriceListCard = ({ hideButton, isSelected, priceList: maskedPriceList, sub
27092
27122
  subscription.state !== t.scalar('SubscriptionState', 'EXPIRED') &&
27093
27123
  ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === t.scalar('SubscriptionState', 'TRIAL_EXPIRED');
27094
27124
  });
27095
- if (!activeCharge) {
27096
- return null;
27097
- }
27098
- const { feature } = activeCharge;
27099
- return isMobile ? (jsxRuntime.jsx(PriceListCardMobile, { description: description, feature: feature, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, priceList: priceList, trialRemainingDays: trialRemainingDays, subscriptionPlan: subscriptionPlan,
27125
+ return isMobile ? (jsxRuntime.jsx(PriceListCardMobile, { description: description, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, priceList: priceList, trialRemainingDays: trialRemainingDays, subscriptionPlan: subscriptionPlan,
27100
27126
  // TODO: naming mismatch disableOnClickPriceListCard vs disableSelectCurrentPlan, maybe also functionality mismatch? (ignore for now, mobile won't ever show this currently)
27101
- disableOnClickPriceListCard: disableSelectCurrentPlan, onClickPriceListCard: onClickPriceListCard })) : (jsxRuntime.jsx(PriceListCardDesktop, { hideButton: hideButton, description: description, disableSelectCurrentPlan: disableSelectCurrentPlan, feature: feature, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, priceList: priceList, trialRemainingDays: trialRemainingDays, subscriptionPlan: subscriptionPlan, noBorder: noBorder, onClickPriceListCard: onClickPriceListCard }));
27127
+ disableOnClickPriceListCard: disableSelectCurrentPlan, onClickPriceListCard: onClickPriceListCard })) : (jsxRuntime.jsx(PriceListCardDesktop, { hideButton: hideButton, description: description, disableSelectCurrentPlan: disableSelectCurrentPlan, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, priceList: priceList, trialRemainingDays: trialRemainingDays, subscriptionPlan: subscriptionPlan, noBorder: noBorder, onClickPriceListCard: onClickPriceListCard }));
27102
27128
  };
27103
27129
 
27104
27130
  const mutation$a = t(`
@@ -27264,9 +27290,8 @@ const FeatureAddonRow_PriceListFragment = t(`
27264
27290
  id
27265
27291
  name
27266
27292
  }
27267
- ...PricingTooltip_PriceListFragment
27268
27293
  }
27269
- `, [PricingTooltip_PriceListFragment]);
27294
+ `);
27270
27295
  const FeatureAddonRow_PriceListChargeFragment = t(`
27271
27296
  fragment FeatureAddonRow_PriceListChargeFragment on PriceListCharge {
27272
27297
  id
@@ -27287,7 +27312,7 @@ function FeatureAddonRow({ featureAddon: maskedFeatureAddon, priceList: maskedPr
27287
27312
  const isPurchased = isAddonPurchased(featureAddon, upgradingSubscription);
27288
27313
  const isDisabled = !isPriceListSelected || isPurchased;
27289
27314
  const checked = isChecked || isPurchased;
27290
- return (jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-row bunny-flex-wrap bunny-items-center bunny-justify-between bunny-gap-1", children: [jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-row bunny-gap-1", children: [jsxRuntime.jsx(Text$7, { className: "bunny-flex bunny-text-sm bunny-items-center bunny-gap-1 bunny-text-gray-600", children: featureAddon.name }), jsxRuntime.jsx(PricingTooltip, { priceListCharges: [featureAddon], currencyId: priceList.currencyId, priceList: priceList })] }), jsxRuntime.jsx(antd.Switch, { id: featureAddonSwitchTestId(featureAddon.name), size: "small", loading: isPending, disabled: isDisabled || !quote, checked: checked, onChange: checked => {
27315
+ return (jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-row bunny-flex-wrap bunny-items-center bunny-justify-between bunny-gap-1", children: [jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-row bunny-gap-1", children: [jsxRuntime.jsx(Text$7, { className: "bunny-flex bunny-text-sm bunny-items-center bunny-gap-1 bunny-text-gray-600", children: featureAddon.name }), jsxRuntime.jsx(PricingTooltip, { priceListCharges: [featureAddon], currencyId: priceList.currencyId })] }), jsxRuntime.jsx(antd.Switch, { id: featureAddonSwitchTestId(featureAddon.name), size: "small", loading: isPending, disabled: isDisabled || !quote, checked: checked, onChange: checked => {
27291
27316
  if (checked) {
27292
27317
  handleAddFeatureAddon();
27293
27318
  }
@@ -27663,20 +27688,19 @@ const AddonPlanRow_PriceListFragment = t(`
27663
27688
  PriceListCardPriceDescription_PriceListFragment,
27664
27689
  ]);
27665
27690
  function AddonPlanRow({ addonPriceList: maskedAddonPriceList, selectedPriceList, onClickSelect, isPurchased, }) {
27666
- var _a, _b, _c, _d, _e, _f, _g;
27691
+ var _a, _b, _c, _d, _e, _f;
27667
27692
  // Read fragments
27668
27693
  const addonPriceList = readFragment(AddonPlanRow_PriceListFragment, maskedAddonPriceList);
27669
27694
  const { quote: maskedQuote, setIsAddonPlanLoading } = react.useContext(QuoteContext);
27670
27695
  const quote = readFragment(AddonPlanRow_QuoteFragment, maskedQuote);
27671
27696
  const { shadow, isInPreviewMode } = useSubscriptionProps();
27672
27697
  const { isPending, addedQuoteChange, addAddonQuoteChange, deleteQuoteChange } = useToggleAddonPlan(quote, addonPriceList.id, selectedPriceList, setIsAddonPlanLoading);
27673
- const activeCharge = (_a = getActivePlanPriceData(addonPriceList, selectedPriceList)) === null || _a === void 0 ? void 0 : _a.activeCharge;
27674
27698
  // Derived state
27675
27699
  const switchDisabled = isInPreviewMode || isPurchased;
27676
- const hasCustomPrice = !isEmptyHTML((_b = addonPriceList.plan) === null || _b === void 0 ? void 0 : _b.pricingDescription);
27677
- return (jsxRuntime.jsxs("div", { className: `bunny-flex bunny-flex-row bunny-gap-2 bunny-justify-between bunny-items-center bunny-p-4 bunny-rounded-md bunny-bg-white ${shadow ? `shadow-${shadow}` : ''} bunny-mb-2`, children: [jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center bunny-min-w-0 bunny-flex-1", children: [jsxRuntime.jsx(Shrink0Wrapper, { className: "bunny-font-medium bunny-text-center bunny-text-orange-600", children: (_c = addonPriceList.plan) === null || _c === void 0 ? void 0 : _c.name }), jsxRuntime.jsx("div", { className: "bunny-min-w-0 bunny-flex-1", children: jsxRuntime.jsx(PriceListCardDescription, { description: (_e = (_d = addonPriceList.plan) === null || _d === void 0 ? void 0 : _d.description) !== null && _e !== void 0 ? _e : '', className: "bunny-whitespace-nowrap" }) })] }), jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center bunny-shrink-0", children: [!hasCustomPrice && (jsxRuntime.jsx(Shrink0Wrapper, { children: jsxRuntime.jsx(PriceListCardPrice, { priceList: addonPriceList, className: "bunny-whitespace-nowrap bunny-text-sm bunny-font-medium bunny-text-gray-900" }) })), jsxRuntime.jsx(Shrink0Wrapper, { children: jsxRuntime.jsx(PriceListCardPriceDescription, { feature: activeCharge === null || activeCharge === void 0 ? void 0 : activeCharge.feature, priceList: addonPriceList }) }), jsxRuntime.jsx(Shrink0Wrapper, { children: jsxRuntime.jsx(antd.Button, { type: "link", onClick: () => {
27700
+ const hasCustomPrice = !isEmptyHTML((_a = addonPriceList.plan) === null || _a === void 0 ? void 0 : _a.pricingDescription);
27701
+ return (jsxRuntime.jsxs("div", { className: `bunny-flex bunny-flex-row bunny-gap-2 bunny-justify-between bunny-items-center bunny-p-4 bunny-rounded-md bunny-bg-white ${shadow ? `shadow-${shadow}` : ''} bunny-mb-2`, children: [jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center bunny-min-w-0 bunny-flex-1", children: [jsxRuntime.jsx(Shrink0Wrapper, { className: "bunny-font-medium bunny-text-center bunny-text-orange-600", children: (_b = addonPriceList.plan) === null || _b === void 0 ? void 0 : _b.name }), jsxRuntime.jsx("div", { className: "bunny-min-w-0 bunny-flex-1", children: jsxRuntime.jsx(PriceListCardDescription, { description: (_d = (_c = addonPriceList.plan) === null || _c === void 0 ? void 0 : _c.description) !== null && _d !== void 0 ? _d : '', className: "bunny-whitespace-nowrap" }) })] }), jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center bunny-shrink-0", children: [!hasCustomPrice && (jsxRuntime.jsx(Shrink0Wrapper, { children: jsxRuntime.jsx(PriceListCardPrice, { priceList: addonPriceList, className: "bunny-whitespace-nowrap bunny-text-sm bunny-font-medium bunny-text-gray-900" }) })), jsxRuntime.jsx(Shrink0Wrapper, { children: jsxRuntime.jsx(PriceListCardPriceDescription, { priceList: addonPriceList }) }), jsxRuntime.jsx(Shrink0Wrapper, { children: jsxRuntime.jsx(antd.Button, { type: "link", onClick: () => {
27678
27702
  onClickSelect();
27679
- }, children: jsxRuntime.jsx(icons.InfoCircleOutlined, {}) }) }), jsxRuntime.jsx(antd.Switch, { id: addonPlanSwitchTestId((_g = (_f = addonPriceList.plan) === null || _f === void 0 ? void 0 : _f.name) !== null && _g !== void 0 ? _g : ''), loading: isPending && !switchDisabled, checked: addedQuoteChange || isPurchased, onChange: (checked) => {
27703
+ }, children: jsxRuntime.jsx(icons.InfoCircleOutlined, {}) }) }), jsxRuntime.jsx(antd.Switch, { id: addonPlanSwitchTestId((_f = (_e = addonPriceList.plan) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : ''), loading: isPending && !switchDisabled, checked: addedQuoteChange || isPurchased, onChange: (checked) => {
27680
27704
  if (checked) {
27681
27705
  addAddonQuoteChange();
27682
27706
  }