@aptos-scp/scp-component-store-selling-features-domain-model 2.10.1 → 2.10.3

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.
@@ -1067,6 +1067,7 @@ export declare enum AssignCustomerForReturnAction {
1067
1067
  Skip = "Skip"
1068
1068
  }
1069
1069
  export declare const DELIVERY_CONTACT_UPDATED_EVENT: string;
1070
+ export declare const DELIVERY_ITEM_UPDATED_EVENT: string;
1070
1071
  export declare const PAYMENT_ACCOUNT_LOOKUP_EVENT: string;
1071
1072
  export interface IPaymentAccountLookupEventData {
1072
1073
  deviceId: string;
@@ -1072,6 +1072,7 @@ var AssignCustomerForReturnAction;
1072
1072
  AssignCustomerForReturnAction["Skip"] = "Skip";
1073
1073
  })(AssignCustomerForReturnAction = exports.AssignCustomerForReturnAction || (exports.AssignCustomerForReturnAction = {}));
1074
1074
  exports.DELIVERY_CONTACT_UPDATED_EVENT = "Delivery.ContactUpdated";
1075
+ exports.DELIVERY_ITEM_UPDATED_EVENT = "Delivery.ItemUpdated";
1075
1076
  exports.PAYMENT_ACCOUNT_LOOKUP_EVENT = "PaymentAccount.Lookup";
1076
1077
  exports.CANCEL_PAYMENT_FUNCTION_EVENT = "Cancel.PaymentFunction";
1077
1078
  exports.DELIVERY_SHIPPING_FEE_UPDATED_EVENT = "Delivery.ShippingFeeUpdated";
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  function isVoidableLine(transactionLine) {
4
- return (transactionLine.voided !== undefined &&
5
- transactionLine.preventsTransactionVoid !== undefined);
4
+ /**
5
+ * Using "in" to check for the existence of these properties is faster than comparing
6
+ * to undefined since it is not evaluating the getter method and avoids the extra
7
+ * calculations on deeply nested decorators.
8
+ */
9
+ return "voided" in transactionLine && "preventsTransactionVoid" in transactionLine;
6
10
  }
7
11
  exports.isVoidableLine = isVoidableLine;
8
12
  function lineCanBeVoided(transactionLine) {
@@ -112,10 +112,18 @@ class ItemLinePromotionDecorator extends ItemLineBaseDiscountDecorator_1.ItemLin
112
112
  : this.decoratedTransactionLine.itemSelectedUnitPrice;
113
113
  }
114
114
  get extendedAmountExcludingTransactionDiscounts() {
115
- const resultAmount = this.decoratedTransactionLine.extendedAmountExcludingTransactionDiscounts
115
+ /**
116
+ * Creating this constant so that the extendedAmountExcludingTransactionDiscounts
117
+ * getter on the decorated line is only accessed once.
118
+ * Accessing the property multiple times causes the calculations on decorated
119
+ * decorators to be performed multiple times that can be a performance issue on
120
+ * deeply nested decorators.
121
+ */
122
+ const decoratedExtendedAmountExcludingTransactionDiscounts = this.decoratedTransactionLine.extendedAmountExcludingTransactionDiscounts;
123
+ const resultAmount = decoratedExtendedAmountExcludingTransactionDiscounts
116
124
  .abs()
117
125
  .minus(this.adjustmentAmount.abs());
118
- return this.decoratedTransactionLine.extendedAmountExcludingTransactionDiscounts.isNegative()
126
+ return decoratedExtendedAmountExcludingTransactionDiscounts.isNegative()
119
127
  ? resultAmount.times(-1) // return to negative value for returns.
120
128
  : resultAmount;
121
129
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aptos-scp/scp-component-store-selling-features-domain-model",
3
- "version": "2.10.1",
3
+ "version": "2.10.3",
4
4
  "description": "This component library provides the common components to handle the coordination of processing the business events from the UI.",
5
5
  "private": false,
6
6
  "license": "SEE LICENSE IN LICENSE.md",