@managesome/eposmatic-toolkit 0.2.286 → 0.2.288

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.
@@ -136,6 +136,7 @@ function getEditItemProps({ item, orderItemCategoryId, orderItem, offers, isLoya
136
136
  excludedDiscountRefs = offerExcludedDiscountRefs;
137
137
  }
138
138
  // TODO: We need to add use case for HalfHalf and Specials
139
+ const isRewardItem = isLoyaltyDiscountApplied || isVoucherDiscountApplied;
139
140
  const props = {
140
141
  catalogItem: item,
141
142
  orderItemId: orderItem._id,
@@ -145,6 +146,7 @@ function getEditItemProps({ item, orderItemCategoryId, orderItem, offers, isLoya
145
146
  excludeRefs,
146
147
  excludedDiscountRefs,
147
148
  zeroPriceRefs,
149
+ ...(isRewardItem && { maxQuantity: orderItem.quantity }),
148
150
  };
149
151
  return props;
150
152
  }
@@ -256,10 +256,8 @@ function calculatePointsRedeemedForOffer(redeemedOffer, totalOrderPrice, categor
256
256
  if (redeemedOffer.pathway_to_unlock_type_orders != null) {
257
257
  const { total_amount } = redeemedOffer.pathway_to_unlock_type_orders;
258
258
  if (totalOrderPrice >= total_amount) {
259
- const timesForAmount = Math.floor(totalOrderPrice / (total_amount || 1));
260
- if (timesForAmount > 1) {
261
- times = timesForAmount;
262
- }
259
+ // ORDERS pathway does not define max_claims, so it can be redeemed only once per order.
260
+ times = 1;
263
261
  }
264
262
  }
265
263
  }
@@ -807,21 +805,6 @@ function getOffersWithStats({ offers, customer, vouchers, giftCards, customerOff
807
805
  action_hint: null,
808
806
  auto_apply: offer.auto_apply ?? false,
809
807
  };
810
- // Lifetime per-customer max_claims check (from pathway items/points).
811
- const pathwayMaxClaims = offer.pathway_to_unlock_type === constants_1.PATHWAY_TO_UNLOCK_TYPE_ENUM.ITEMS
812
- ? offer.pathway_to_unlock_type_items?.max_claims
813
- : offer.pathway_to_unlock_type === constants_1.PATHWAY_TO_UNLOCK_TYPE_ENUM.POINTS
814
- ? offer.pathway_to_unlock_type_points?.max_claims
815
- : undefined;
816
- if (pathwayMaxClaims != null && customerOfferRedemptionCounts != null) {
817
- const lifetimeRedemptions = customerOfferRedemptionCounts[offer._id] ?? 0;
818
- if (lifetimeRedemptions >= pathwayMaxClaims) {
819
- stats.progress = 0;
820
- stats.message = `⛔️ You have reached the maximum redemptions for this offer ⛔️`;
821
- offersWithStats.push({ offer, stats });
822
- continue;
823
- }
824
- }
825
808
  if (offer.pathway_to_unlock_type === constants_1.PATHWAY_TO_UNLOCK_TYPE_ENUM.ORDERS) {
826
809
  if (offer.pathway_to_unlock_type_orders == null) {
827
810
  stats.invalid_offer = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.2.286",
3
+ "version": "0.2.288",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",