@aptos-scp/scp-component-store-selling-features-domain-model 2.1.1 → 2.2.1

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.
@@ -161,6 +161,7 @@ export declare class StoreItem implements ISourceIndication, IStoreItemDescripto
161
161
  private static temporaryPriceExpirationDateTime;
162
162
  private static calculateFullPrice;
163
163
  private static calculateFullPriceAtLevel;
164
+ private static calculateTreatmentRules;
164
165
  private static createItemLookupKeysFromJsonObject;
165
166
  private static getStringFromJsonObject;
166
167
  private static getPriceFromStoreItemPrice;
@@ -428,11 +428,9 @@ class StoreItem {
428
428
  if (item.externalIds) {
429
429
  storeItem.externalIds = item.externalIds;
430
430
  }
431
- const TREATMENT_RULE_DEFAULTS = {
432
- eligibleForSendSale: true,
433
- };
434
- if (item.treatmentRules) {
435
- storeItem.treatmentRules = Object.assign(Object.assign({}, TREATMENT_RULE_DEFAULTS), item.treatmentRules);
431
+ const treatmentRules = StoreItem.calculateTreatmentRules(item, storeGroupItem, retailStoreItem);
432
+ if (treatmentRules) {
433
+ storeItem.treatmentRules = treatmentRules;
436
434
  }
437
435
  if (!storeItem.price || !storeItem.price.amount) {
438
436
  const units = storeItem.price ? storeItem.price.units : undefined;
@@ -635,6 +633,21 @@ class StoreItem {
635
633
  }
636
634
  return undefined;
637
635
  }
636
+ static calculateTreatmentRules(item, storeGroupItem, retailStoreItem) {
637
+ var _a, _b;
638
+ const TREATMENT_RULE_DEFAULTS = {
639
+ eligibleForSendSale: true,
640
+ };
641
+ if ((_a = retailStoreItem) === null || _a === void 0 ? void 0 : _a.treatmentRules) {
642
+ return Object.assign(Object.assign({}, TREATMENT_RULE_DEFAULTS), retailStoreItem.treatmentRules);
643
+ }
644
+ else if ((_b = storeGroupItem) === null || _b === void 0 ? void 0 : _b.treatmentRules) {
645
+ return Object.assign(Object.assign({}, TREATMENT_RULE_DEFAULTS), storeGroupItem.treatmentRules);
646
+ }
647
+ else if (item.treatmentRules) {
648
+ return Object.assign(Object.assign({}, TREATMENT_RULE_DEFAULTS), item.treatmentRules);
649
+ }
650
+ }
638
651
  static createItemLookupKeysFromJsonObject(itemLookupKeysFromJson) {
639
652
  const itemLookupKeys = [];
640
653
  if (itemLookupKeysFromJson) {
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.1.1",
3
+ "version": "2.2.1",
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",
@@ -55,7 +55,7 @@
55
55
  "@aptos-scp/scp-component-business-core": "^1.12.7",
56
56
  "@aptos-scp/scp-component-logging": "^2.1.16",
57
57
  "@aptos-scp/scp-component-pricing": "^7.62.0",
58
- "@aptos-scp/scp-component-store-items": "^1.20.0",
58
+ "@aptos-scp/scp-component-store-items": "^1.21.0",
59
59
  "@aptos-scp/scp-component-store-selling-core": "^18.9.3",
60
60
  "@aptos-scp/scp-component-taxation": "^5.28.0",
61
61
  "@aptos-scp/scp-component-user": "^1.4.0",
@@ -78,7 +78,7 @@
78
78
  "@aptos-scp/scp-component-logging": "^2.1.16",
79
79
  "@aptos-scp/scp-component-pricing": "^7.62.0",
80
80
  "@aptos-scp/scp-component-rn-circuit-breaker": "^1.0.15",
81
- "@aptos-scp/scp-component-store-items": "^1.20.0",
81
+ "@aptos-scp/scp-component-store-items": "^1.21.0",
82
82
  "@aptos-scp/scp-component-store-selling-core": "^18.9.3",
83
83
  "@aptos-scp/scp-component-taxation": "^5.28.0",
84
84
  "@aptos-scp/scp-component-user": "^1.4.0",