@managesome/eposmatic-toolkit 0.2.337 → 0.2.339

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.
@@ -1,4 +1,4 @@
1
- import { DAY_INDEX_ENUM } from '../../constants';
1
+ import { CUSTOMER_REDEMPTION_TYPE_ENUM, DAY_INDEX_ENUM } from '../../constants';
2
2
  export interface IReportChannelData {
3
3
  _id: string;
4
4
  category_id?: string;
@@ -73,3 +73,4 @@ export interface ILocalTimeFields {
73
73
  localTime: string;
74
74
  localDayOfYear: number;
75
75
  }
76
+ export type ICustomerRedemptionCount = Record<CUSTOMER_REDEMPTION_TYPE_ENUM, Record<string, number>>;
@@ -279,3 +279,8 @@ export interface IWorker_UpdateCustomerRedemptionsOnWalletAssignment {
279
279
  code_quantities: Record<string, number>;
280
280
  updated_phone_numbers: string[];
281
281
  }
282
+ export interface IWorker_CleanupRewardsAndAssetsOnSettleOrder {
283
+ order: IOrder;
284
+ brand_id: string;
285
+ phoneNumber: string;
286
+ }
@@ -3,6 +3,7 @@ import { IItem, IItemSpecialHour, IModifier, IModifierOption } from '../../schem
3
3
  import { IPrice } from '../../schemas/types/common';
4
4
  import { ICatalog, ISimplifiedCatalog, ISimplifiedCatalogItem } from '../types';
5
5
  export declare function getPriceEnum(price: IPrice | null | undefined, platform: PLATFORMS_ENUM | null | undefined): number;
6
+ export declare function areAllSchedulesExpired(special_hours: IItemSpecialHour[] | null | undefined): boolean;
6
7
  export declare function findApplicableSchedule(special_hours: IItemSpecialHour[] | null | undefined, platform: PLATFORMS_ENUM): IItemSpecialHour | boolean;
7
8
  export declare function getPlatformModifierOptions(options: IModifierOption[], platform: PLATFORMS_ENUM, excludeIds?: string[]): IModifierOption[];
8
9
  export declare function getPlatformModifiers(modifiers: IModifier[] | null | undefined, platform: PLATFORMS_ENUM | undefined, excludeIds?: string[]): IModifier[] | null;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getPriceEnum = getPriceEnum;
4
+ exports.areAllSchedulesExpired = areAllSchedulesExpired;
4
5
  exports.findApplicableSchedule = findApplicableSchedule;
5
6
  exports.getPlatformModifierOptions = getPlatformModifierOptions;
6
7
  exports.getPlatformModifiers = getPlatformModifiers;
@@ -25,6 +26,21 @@ const DAY_INDEX = {
25
26
  5: constants_1.DAY_INDEX_ENUM.FRI,
26
27
  6: constants_1.DAY_INDEX_ENUM.SAT,
27
28
  };
29
+ function areAllSchedulesExpired(special_hours) {
30
+ if (!special_hours || special_hours.length === 0)
31
+ return false;
32
+ const timeNow = Date.now();
33
+ return special_hours.every((schedule) => {
34
+ if (!schedule.end_date)
35
+ return false;
36
+ const endDate = new Date(schedule.end_date);
37
+ if (Number.isNaN(endDate.getTime()))
38
+ return false;
39
+ endDate.setHours(0, 0, 0, 0);
40
+ const endDateWithTime = endDate.getTime() + schedule.end_time;
41
+ return endDateWithTime <= timeNow;
42
+ });
43
+ }
28
44
  function findApplicableSchedule(special_hours, platform) {
29
45
  // return true means that item is available
30
46
  // return false means that item is not available
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.2.337",
3
+ "version": "0.2.339",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",