@bunnyapp/components 1.8.0-beta.10 → 1.8.0-beta.12

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/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.8.0-beta.9';
1286
+ const PACKAGE_VERSION = '1.8.0-beta.11';
1287
1287
  const createRequestHeaders = (token) => {
1288
1288
  const headers = createClientDevHeaders({ token });
1289
1289
  // Add the components version header
@@ -21474,11 +21474,9 @@ function PaymentFormRoot({ currencyId: accountCurrencyId, invoice: maskedInvoice
21474
21474
  }
21475
21475
  // Default layout that uses PaymentFormRoot under the hood when no children are provided.
21476
21476
  function PaymentFormDefault(props) {
21477
- console.log('PaymentFormDefault', props);
21478
21477
  return jsxRuntime.jsx(PaymentFormRoot, { ...props, children: ({ hasPaymentMethods, isPaymentMethodDetailsOpen, isPayableAvailable, amountDue }) => {
21479
21478
  const showPayButton = amountDue !== undefined && amountDue > 0 && !isPaymentMethodDetailsOpen && hasPaymentMethods;
21480
21479
  const checkoutNoPaymentButton = amountDue !== undefined && amountDue === 0;
21481
- console.log('props.disablePayButton', props.disablePayButton);
21482
21480
  if (checkoutNoPaymentButton) {
21483
21481
  return jsxRuntime.jsx(PaymentForm.CheckoutNoPayment, { className: "bunny-px-4", disabled: props.disablePayButton });
21484
21482
  }
@@ -24388,11 +24386,11 @@ function useQuantityEditableCharges({ upgradingSubscription: maskedUpgradingSubs
24388
24386
  // 2. Get all quote charges
24389
24387
  // We cannot edit adjustment charges so filter them out.
24390
24388
  const nonAdjustmentQuoteChanges = (_d = quote === null || quote === void 0 ? void 0 : quote.quoteChanges) === null || _d === void 0 ? void 0 : _d.filter(qc => qc.kind !== 'ADJUSTMENT');
24391
- const allQuoteCharges = (_e = nonAdjustmentQuoteChanges === null || nonAdjustmentQuoteChanges === void 0 ? void 0 : nonAdjustmentQuoteChanges.flatMap(qc => qc.charges.flatMap(charge => charge === null || charge === void 0 ? void 0 : charge.priceListCharge)).filter(c => c !== null)) !== null && _e !== void 0 ? _e : [];
24392
- // 3. Filter out quote charges that are already in the subscription
24389
+ const allCharges = (_e = nonAdjustmentQuoteChanges === null || nonAdjustmentQuoteChanges === void 0 ? void 0 : nonAdjustmentQuoteChanges.flatMap(qc => qc.charges.flatMap(charge => charge === null || charge === void 0 ? void 0 : charge.priceListCharge)).filter(c => c !== null)) !== null && _e !== void 0 ? _e : [];
24390
+ // 3. Filter out charges that are already in the subscription (duplicates)
24393
24391
  const allSubscriptionChargeIds = new Set(allSubscriptionCharges === null || allSubscriptionCharges === void 0 ? void 0 : allSubscriptionCharges.map(c => c === null || c === void 0 ? void 0 : c.id));
24394
- const filteredQuoteCharges = allQuoteCharges === null || allQuoteCharges === void 0 ? void 0 : allQuoteCharges.filter(charge => !allSubscriptionChargeIds.has(charge === null || charge === void 0 ? void 0 : charge.id));
24395
- return [...allSubscriptionCharges, ...filteredQuoteCharges];
24392
+ const filteredCharges = allCharges === null || allCharges === void 0 ? void 0 : allCharges.filter(charge => !allSubscriptionChargeIds.has(charge === null || charge === void 0 ? void 0 : charge.id));
24393
+ return [...allSubscriptionCharges, ...filteredCharges];
24396
24394
  }, [upgradingSubscription, quote, pricelistId]);
24397
24395
  /**
24398
24396
  * Rules for when pricelist charges can be edited:
@@ -24425,7 +24423,7 @@ function useQuantityEditableCharges({ upgradingSubscription: maskedUpgradingSubs
24425
24423
  return true;
24426
24424
  });
24427
24425
  return thirdPassCharges !== null && thirdPassCharges !== void 0 ? thirdPassCharges : [];
24428
- }, [selectedPriceListQuoteChange]);
24426
+ }, [selectedPriceListQuoteChange, priceListCharges]);
24429
24427
  /**
24430
24428
  * Find a subscription charge by price list charge ID
24431
24429
  * @param priceListChargeId - The ID of the price list charge to find
@@ -27485,6 +27483,9 @@ const AddonPlans_PlanFragment = t(`
27485
27483
  id
27486
27484
  name
27487
27485
  periodMonths
27486
+ plan {
27487
+ selfServiceBuy
27488
+ }
27488
27489
  ...AddonPlanModal_PriceListFragment
27489
27490
  ...AddonPlanRow_PriceListFragment
27490
27491
  }
@@ -27536,7 +27537,7 @@ const AddonPlans = ({ selectedPriceList, subscriptions, selectedBillingPeriod, c
27536
27537
  const addonPlans = maskedAddonPlans === null || maskedAddonPlans === void 0 ? void 0 : maskedAddonPlans.map(maskedAddonPlan => readFragment(AddonPlans_PlanFragment, maskedAddonPlan));
27537
27538
  // Derived state
27538
27539
  const addonPriceLists = addonPlans
27539
- ? getAddonsForBillingPeriod(selectedBillingPeriod, addonPlans)
27540
+ ? getAddonsForBillingPeriod(selectedBillingPeriod, addonPlans).filter(priceList => { var _a; return (_a = priceList.plan) === null || _a === void 0 ? void 0 : _a.selfServiceBuy; })
27540
27541
  : [];
27541
27542
  const selectedAddonPriceList = addonPriceLists.find(priceList => priceList.id === selectedAddonPriceListId);
27542
27543
  function isAddonPriceListPurchased(priceList) {
@@ -29559,7 +29560,7 @@ const PlanPickerCheckoutBar = ({ selectedPriceList, handlePortalErrors, onChecko
29559
29560
  const isFeatureAddon = charge === null || charge === void 0 ? void 0 : charge.featureAddon;
29560
29561
  const quantity = ((_a = charge === null || charge === void 0 ? void 0 : charge.feature) === null || _a === void 0 ? void 0 : _a.id) ? getFeatureQuantity((_b = charge === null || charge === void 0 ? void 0 : charge.feature) === null || _b === void 0 ? void 0 : _b.id, charge.id) : undefined;
29561
29562
  const maybeIsChargeLoading = isFeatureAddon && isFeatureAddonsLoading;
29562
- const isDisabled = Boolean(!quote || maybeIsChargeLoading || !quantity);
29563
+ const isDisabled = Boolean(!quote || maybeIsChargeLoading || quantity === undefined);
29563
29564
  return (jsxRuntime.jsx(CheckoutBarInput, { disabled: isDisabled, priceListCharge: charge, quantity: quantity, onQuantityChanged: quantity => {
29564
29565
  if (isInPreviewMode)
29565
29566
  return;
@@ -5,6 +5,9 @@ export declare const AddonPlans_PlanFragment: import("gql.tada").TadaDocumentNod
5
5
  id: string;
6
6
  name: string;
7
7
  periodMonths: number | null;
8
+ plan: {
9
+ selfServiceBuy: boolean | null;
10
+ } | null;
8
11
  [$tada.fragmentRefs]: {
9
12
  AddonPlanModal_PriceListFragment: "PriceList";
10
13
  } & {
package/dist/esm/index.js CHANGED
@@ -1281,7 +1281,7 @@ const DEFAULT_CONFIG = {
1281
1281
  };
1282
1282
 
1283
1283
  // This will be replaced at build time by rollup-plugin-replace
1284
- const PACKAGE_VERSION = '1.8.0-beta.9';
1284
+ const PACKAGE_VERSION = '1.8.0-beta.11';
1285
1285
  const createRequestHeaders = (token) => {
1286
1286
  const headers = createClientDevHeaders({ token });
1287
1287
  // Add the components version header
@@ -21472,11 +21472,9 @@ function PaymentFormRoot({ currencyId: accountCurrencyId, invoice: maskedInvoice
21472
21472
  }
21473
21473
  // Default layout that uses PaymentFormRoot under the hood when no children are provided.
21474
21474
  function PaymentFormDefault(props) {
21475
- console.log('PaymentFormDefault', props);
21476
21475
  return jsx(PaymentFormRoot, { ...props, children: ({ hasPaymentMethods, isPaymentMethodDetailsOpen, isPayableAvailable, amountDue }) => {
21477
21476
  const showPayButton = amountDue !== undefined && amountDue > 0 && !isPaymentMethodDetailsOpen && hasPaymentMethods;
21478
21477
  const checkoutNoPaymentButton = amountDue !== undefined && amountDue === 0;
21479
- console.log('props.disablePayButton', props.disablePayButton);
21480
21478
  if (checkoutNoPaymentButton) {
21481
21479
  return jsx(PaymentForm.CheckoutNoPayment, { className: "bunny-px-4", disabled: props.disablePayButton });
21482
21480
  }
@@ -24386,11 +24384,11 @@ function useQuantityEditableCharges({ upgradingSubscription: maskedUpgradingSubs
24386
24384
  // 2. Get all quote charges
24387
24385
  // We cannot edit adjustment charges so filter them out.
24388
24386
  const nonAdjustmentQuoteChanges = (_d = quote === null || quote === void 0 ? void 0 : quote.quoteChanges) === null || _d === void 0 ? void 0 : _d.filter(qc => qc.kind !== 'ADJUSTMENT');
24389
- const allQuoteCharges = (_e = nonAdjustmentQuoteChanges === null || nonAdjustmentQuoteChanges === void 0 ? void 0 : nonAdjustmentQuoteChanges.flatMap(qc => qc.charges.flatMap(charge => charge === null || charge === void 0 ? void 0 : charge.priceListCharge)).filter(c => c !== null)) !== null && _e !== void 0 ? _e : [];
24390
- // 3. Filter out quote charges that are already in the subscription
24387
+ const allCharges = (_e = nonAdjustmentQuoteChanges === null || nonAdjustmentQuoteChanges === void 0 ? void 0 : nonAdjustmentQuoteChanges.flatMap(qc => qc.charges.flatMap(charge => charge === null || charge === void 0 ? void 0 : charge.priceListCharge)).filter(c => c !== null)) !== null && _e !== void 0 ? _e : [];
24388
+ // 3. Filter out charges that are already in the subscription (duplicates)
24391
24389
  const allSubscriptionChargeIds = new Set(allSubscriptionCharges === null || allSubscriptionCharges === void 0 ? void 0 : allSubscriptionCharges.map(c => c === null || c === void 0 ? void 0 : c.id));
24392
- const filteredQuoteCharges = allQuoteCharges === null || allQuoteCharges === void 0 ? void 0 : allQuoteCharges.filter(charge => !allSubscriptionChargeIds.has(charge === null || charge === void 0 ? void 0 : charge.id));
24393
- return [...allSubscriptionCharges, ...filteredQuoteCharges];
24390
+ const filteredCharges = allCharges === null || allCharges === void 0 ? void 0 : allCharges.filter(charge => !allSubscriptionChargeIds.has(charge === null || charge === void 0 ? void 0 : charge.id));
24391
+ return [...allSubscriptionCharges, ...filteredCharges];
24394
24392
  }, [upgradingSubscription, quote, pricelistId]);
24395
24393
  /**
24396
24394
  * Rules for when pricelist charges can be edited:
@@ -24423,7 +24421,7 @@ function useQuantityEditableCharges({ upgradingSubscription: maskedUpgradingSubs
24423
24421
  return true;
24424
24422
  });
24425
24423
  return thirdPassCharges !== null && thirdPassCharges !== void 0 ? thirdPassCharges : [];
24426
- }, [selectedPriceListQuoteChange]);
24424
+ }, [selectedPriceListQuoteChange, priceListCharges]);
24427
24425
  /**
24428
24426
  * Find a subscription charge by price list charge ID
24429
24427
  * @param priceListChargeId - The ID of the price list charge to find
@@ -27483,6 +27481,9 @@ const AddonPlans_PlanFragment = t(`
27483
27481
  id
27484
27482
  name
27485
27483
  periodMonths
27484
+ plan {
27485
+ selfServiceBuy
27486
+ }
27486
27487
  ...AddonPlanModal_PriceListFragment
27487
27488
  ...AddonPlanRow_PriceListFragment
27488
27489
  }
@@ -27534,7 +27535,7 @@ const AddonPlans = ({ selectedPriceList, subscriptions, selectedBillingPeriod, c
27534
27535
  const addonPlans = maskedAddonPlans === null || maskedAddonPlans === void 0 ? void 0 : maskedAddonPlans.map(maskedAddonPlan => readFragment(AddonPlans_PlanFragment, maskedAddonPlan));
27535
27536
  // Derived state
27536
27537
  const addonPriceLists = addonPlans
27537
- ? getAddonsForBillingPeriod(selectedBillingPeriod, addonPlans)
27538
+ ? getAddonsForBillingPeriod(selectedBillingPeriod, addonPlans).filter(priceList => { var _a; return (_a = priceList.plan) === null || _a === void 0 ? void 0 : _a.selfServiceBuy; })
27538
27539
  : [];
27539
27540
  const selectedAddonPriceList = addonPriceLists.find(priceList => priceList.id === selectedAddonPriceListId);
27540
27541
  function isAddonPriceListPurchased(priceList) {
@@ -29557,7 +29558,7 @@ const PlanPickerCheckoutBar = ({ selectedPriceList, handlePortalErrors, onChecko
29557
29558
  const isFeatureAddon = charge === null || charge === void 0 ? void 0 : charge.featureAddon;
29558
29559
  const quantity = ((_a = charge === null || charge === void 0 ? void 0 : charge.feature) === null || _a === void 0 ? void 0 : _a.id) ? getFeatureQuantity((_b = charge === null || charge === void 0 ? void 0 : charge.feature) === null || _b === void 0 ? void 0 : _b.id, charge.id) : undefined;
29559
29560
  const maybeIsChargeLoading = isFeatureAddon && isFeatureAddonsLoading;
29560
- const isDisabled = Boolean(!quote || maybeIsChargeLoading || !quantity);
29561
+ const isDisabled = Boolean(!quote || maybeIsChargeLoading || quantity === undefined);
29561
29562
  return (jsx(CheckoutBarInput, { disabled: isDisabled, priceListCharge: charge, quantity: quantity, onQuantityChanged: quantity => {
29562
29563
  if (isInPreviewMode)
29563
29564
  return;
@@ -5,6 +5,9 @@ export declare const AddonPlans_PlanFragment: import("gql.tada").TadaDocumentNod
5
5
  id: string;
6
6
  name: string;
7
7
  periodMonths: number | null;
8
+ plan: {
9
+ selfServiceBuy: boolean | null;
10
+ } | null;
8
11
  [$tada.fragmentRefs]: {
9
12
  AddonPlanModal_PriceListFragment: "PriceList";
10
13
  } & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.8.0-beta.10",
3
+ "version": "1.8.0-beta.12",
4
4
  "description": "Components from the Bunny portal to embed Bunny UI functionality into your application.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",