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

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.7.0-beta.44';
1286
+ const PACKAGE_VERSION = '1.7.0-beta.45';
1287
1287
  const createRequestHeaders = (token) => {
1288
1288
  const headers = createClientDevHeaders({ token });
1289
1289
  // Add the components version header
@@ -28524,16 +28524,16 @@ const QuantityInput = ({ charge: maskedCharge, subscription: maskedSubscription,
28524
28524
  }
28525
28525
  // Used to disable all other quantity inputs for this subscription
28526
28526
  setUpdatingChargeQuantityId(getUpdatingChargeQuantityId(charge.priceListChargeId, subscription.id));
28527
- const quantityDelta = quantity - ((_a = charge.quantity) !== null && _a !== void 0 ? _a : 0);
28528
- debouncedQuantityUpdate(charge.priceListChargeId, quantityDelta, subscription.id, quote, quoteId);
28527
+ const oldQuantity = (_a = charge.quantity) !== null && _a !== void 0 ? _a : 0;
28528
+ debouncedQuantityUpdate(charge.priceListChargeId, quantity, oldQuantity, subscription.id, quote, quoteId);
28529
28529
  }
28530
28530
  };
28531
28531
  const debouncedDeleteQuote = react.useCallback(lodashExports.debounce((quoteId) => {
28532
28532
  deleteQuote({ id: quoteId, apiHost, token });
28533
28533
  }, DEBOUNCE_TIME), []);
28534
- const debouncedQuantityUpdate = react.useCallback(lodashExports.debounce((priceListChargeId, quantityDelta, subscriptionId, quote, quoteId) => {
28534
+ const debouncedQuantityUpdate = react.useCallback(lodashExports.debounce((priceListChargeId, quantity, oldQuantity, subscriptionId, quote, quoteId) => {
28535
28535
  var _a;
28536
- if (quantityDelta === 0) {
28536
+ if (quantity === oldQuantity) {
28537
28537
  setErrorUpdatingQuantity(true);
28538
28538
  showErrorNotification('New quantity cannot be the same as current');
28539
28539
  return;
@@ -28548,7 +28548,7 @@ const QuantityInput = ({ charge: maskedCharge, subscription: maskedSubscription,
28548
28548
  if (quoteCharge) {
28549
28549
  updateQuoteCharge({
28550
28550
  quoteChargeId: quoteCharge.id,
28551
- quantity: quantityDelta,
28551
+ quantity,
28552
28552
  });
28553
28553
  }
28554
28554
  }
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.7.0-beta.44';
1284
+ const PACKAGE_VERSION = '1.7.0-beta.45';
1285
1285
  const createRequestHeaders = (token) => {
1286
1286
  const headers = createClientDevHeaders({ token });
1287
1287
  // Add the components version header
@@ -28522,16 +28522,16 @@ const QuantityInput = ({ charge: maskedCharge, subscription: maskedSubscription,
28522
28522
  }
28523
28523
  // Used to disable all other quantity inputs for this subscription
28524
28524
  setUpdatingChargeQuantityId(getUpdatingChargeQuantityId(charge.priceListChargeId, subscription.id));
28525
- const quantityDelta = quantity - ((_a = charge.quantity) !== null && _a !== void 0 ? _a : 0);
28526
- debouncedQuantityUpdate(charge.priceListChargeId, quantityDelta, subscription.id, quote, quoteId);
28525
+ const oldQuantity = (_a = charge.quantity) !== null && _a !== void 0 ? _a : 0;
28526
+ debouncedQuantityUpdate(charge.priceListChargeId, quantity, oldQuantity, subscription.id, quote, quoteId);
28527
28527
  }
28528
28528
  };
28529
28529
  const debouncedDeleteQuote = useCallback(lodashExports.debounce((quoteId) => {
28530
28530
  deleteQuote({ id: quoteId, apiHost, token });
28531
28531
  }, DEBOUNCE_TIME), []);
28532
- const debouncedQuantityUpdate = useCallback(lodashExports.debounce((priceListChargeId, quantityDelta, subscriptionId, quote, quoteId) => {
28532
+ const debouncedQuantityUpdate = useCallback(lodashExports.debounce((priceListChargeId, quantity, oldQuantity, subscriptionId, quote, quoteId) => {
28533
28533
  var _a;
28534
- if (quantityDelta === 0) {
28534
+ if (quantity === oldQuantity) {
28535
28535
  setErrorUpdatingQuantity(true);
28536
28536
  showErrorNotification('New quantity cannot be the same as current');
28537
28537
  return;
@@ -28546,7 +28546,7 @@ const QuantityInput = ({ charge: maskedCharge, subscription: maskedSubscription,
28546
28546
  if (quoteCharge) {
28547
28547
  updateQuoteCharge({
28548
28548
  quoteChargeId: quoteCharge.id,
28549
- quantity: quantityDelta,
28549
+ quantity,
28550
28550
  });
28551
28551
  }
28552
28552
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.7.0-beta.45",
3
+ "version": "1.7.0-beta.46",
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",