@managesome/eposmatic-toolkit 0.2.374 → 0.2.375

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.
@@ -83,7 +83,7 @@ export declare function getUpdateCartInfoData(data: Partial<IOrder>, payload: Pa
83
83
  export declare function getRemoveItemFromCartData(data: Partial<IOrder>, payload: {
84
84
  _id: string;
85
85
  void_reason?: string;
86
- }, courses: ICourse[], listnerSettings: ICartListnerSettings): Partial<IOrder>;
86
+ }, courses: ICourse[], listnerSettings: ICartListnerSettings, appliedCustomDiscounts?: IAppliedCustomDiscount[]): Partial<IOrder>;
87
87
  export declare function getUpdatedCartInfoOnInit(data: Partial<IOrder>, order: Partial<IOrder>, courses: ICourse[], platform: PLATFORMS_ENUM | undefined, categories: IOrderCategory[] | undefined, mappedItems: Record<string, IItem>, tenantId: string | undefined, listnerSettings: ICartListnerSettings, offers: IOffer[] | undefined): Partial<IOrder>;
88
88
  /**
89
89
  * Drop entries from `redeemed_offers` (and any related discount/wallet state)
@@ -2290,7 +2290,7 @@ function getUpdateCartInfoData(data, payload, courses, listnerSettings, syncCont
2290
2290
  };
2291
2291
  }
2292
2292
  /* ======================><====================== */
2293
- function getRemoveItemFromCartData(data, payload, courses, listnerSettings) {
2293
+ function getRemoveItemFromCartData(data, payload, courses, listnerSettings, appliedCustomDiscounts) {
2294
2294
  const orderItemIdsMap = {};
2295
2295
  let categories;
2296
2296
  if (data.categories != null) {
@@ -2361,8 +2361,18 @@ function getRemoveItemFromCartData(data, payload, courses, listnerSettings) {
2361
2361
  iterations.push(firstIterationData);
2362
2362
  iterations.push(...restIterations);
2363
2363
  }
2364
+ // Re-evaluate order-wide custom discount cap after item removal
2365
+ const syncedOrderDiscountDetails = appliedCustomDiscounts && appliedCustomDiscounts.length > 0
2366
+ ? getSyncedOrderDiscountDetailsWithCaps({
2367
+ orderDiscountDetails: data.order_discount_details,
2368
+ appliedCustomDiscounts,
2369
+ categories,
2370
+ platform: data.platform,
2371
+ })
2372
+ : data.order_discount_details;
2364
2373
  const order = {
2365
2374
  ...data,
2375
+ order_discount_details: syncedOrderDiscountDetails,
2366
2376
  ...(iterations.length > 0 && { iterations }),
2367
2377
  categories,
2368
2378
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.2.374",
3
+ "version": "0.2.375",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",