@managesome/eposmatic-toolkit 0.2.342-beta.0 → 0.2.343
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.
- package/lib/constants/ENUMS.d.ts +0 -35
- package/lib/constants/ENUMS.js +3 -48
- package/lib/helpers/store/cart-actions.d.ts +24 -0
- package/lib/helpers/store/cart-actions.js +48 -5
- package/lib/helpers/store/common-purchase-order-actions.d.ts +2 -2
- package/lib/helpers/store/purchase-orders-cart-actions.d.ts +6 -7
- package/lib/helpers/utils/index.d.ts +1 -0
- package/lib/helpers/utils/index.js +1 -0
- package/lib/helpers/utils/offer-apply-helpers.d.ts +63 -1
- package/lib/helpers/utils/offer-apply-helpers.js +61 -3
- package/lib/helpers/utils/offers-helpers.d.ts +23 -4
- package/lib/helpers/utils/offers-helpers.js +260 -101
- package/lib/schemas/models/index.d.ts +0 -3
- package/lib/schemas/models/index.js +0 -3
- package/lib/schemas/models/purchase_orders.d.ts +0 -3
- package/lib/schemas/models/purchase_orders.js +1 -10
- package/lib/schemas/models/void_purchase_order_items.js +1 -2
- package/lib/schemas/models/warehouse.d.ts +1 -7
- package/lib/schemas/models/warehouse.js +0 -9
- package/lib/schemas/models/warehouse_items.d.ts +0 -19
- package/lib/schemas/models/warehouse_items.js +0 -29
- package/lib/schemas/models/warehouse_vendors.d.ts +3 -3
- package/lib/schemas/types/index.d.ts +0 -4
- package/lib/schemas/types/index.js +0 -4
- package/lib/schemas/types/purchase_orders.d.ts +43 -7
- package/lib/schemas/types/warehouse.d.ts +1 -3
- package/lib/schemas/types/warehouse_items.d.ts +1 -7
- package/package.json +2 -2
package/lib/constants/ENUMS.d.ts
CHANGED
|
@@ -788,19 +788,6 @@ export declare enum GST_TYPE_ENUM {
|
|
|
788
788
|
CASH = "CASH"
|
|
789
789
|
}
|
|
790
790
|
export declare const ALL_GST_TYPES: GST_TYPE_ENUM[];
|
|
791
|
-
export declare enum TRACKING_MODE_ENUM {
|
|
792
|
-
NONE = "NONE",
|
|
793
|
-
LOT = "LOT",
|
|
794
|
-
SERIAL = "SERIAL"
|
|
795
|
-
}
|
|
796
|
-
export declare const ALL_TRACKING_MODES: TRACKING_MODE_ENUM[];
|
|
797
|
-
export declare enum REMOVAL_STRATEGY_ENUM {
|
|
798
|
-
NONE = "NONE",
|
|
799
|
-
FIFO = "FIFO",
|
|
800
|
-
LIFO = "LIFO",
|
|
801
|
-
FEFO = "FEFO"
|
|
802
|
-
}
|
|
803
|
-
export declare const ALL_REMOVAL_STRATEGY_TYPES: REMOVAL_STRATEGY_ENUM[];
|
|
804
791
|
export declare enum INVENTORY_TRANSACTION_TYPE_ENUM {
|
|
805
792
|
INBOUND = "INBOUND",
|
|
806
793
|
OUTBOUND = "OUTBOUND"
|
|
@@ -890,28 +877,6 @@ export declare enum PURCHASE_ORDER_STATUS_ENUM {
|
|
|
890
877
|
CANCELLED = "CANCELLED"
|
|
891
878
|
}
|
|
892
879
|
export declare const ALL_PURCHASE_ORDER_STATUS_NAMES: PURCHASE_ORDER_STATUS_ENUM[];
|
|
893
|
-
export declare enum PURCHASE_ORDER_RFQ_STATUS_ENUM {
|
|
894
|
-
DRAFT = "DRAFT",
|
|
895
|
-
SENT = "SENT",
|
|
896
|
-
CONFIRMED = "CONFIRMED",
|
|
897
|
-
CANCELLED = "CANCELLED"
|
|
898
|
-
}
|
|
899
|
-
export declare const ALL_PURCHASE_ORDER_RFQ_STATUS_NAMES: PURCHASE_ORDER_RFQ_STATUS_ENUM[];
|
|
900
|
-
export declare enum PURCHASE_ORDER_RECEIPT_STATUS_ENUM {
|
|
901
|
-
DRAFT = "DRAFT",
|
|
902
|
-
VALIDATED = "VALIDATED",
|
|
903
|
-
CANCELLED = "CANCELLED"
|
|
904
|
-
}
|
|
905
|
-
export declare const ALL_PURCHASE_ORDER_RECEIPT_STATUS_NAMES: PURCHASE_ORDER_RECEIPT_STATUS_ENUM[];
|
|
906
|
-
export declare enum PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM {
|
|
907
|
-
CREATED = "CREATED",
|
|
908
|
-
APPROVED = "APPROVED",
|
|
909
|
-
DISPATCHED = "DISPATCHED",
|
|
910
|
-
VENDOR_CONFIRMED = "VENDOR_CONFIRMED",
|
|
911
|
-
COMPLETED = "COMPLETED",
|
|
912
|
-
CANCELLED = "CANCELLED"
|
|
913
|
-
}
|
|
914
|
-
export declare const ALL_PURCHASE_ORDER_VENDOR_RETURN_STATUS_NAMES: PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM[];
|
|
915
880
|
export declare enum WAREHOUSE_INVOICE_STATUS_ENUM {
|
|
916
881
|
PENDING = "PENDING",
|
|
917
882
|
COMPLETED = "COMPLETED",
|
package/lib/constants/ENUMS.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ALL_CATEGORY_DISPLAY_TYPES = exports.CATEGORY_DISPLAY_TYPE_ENUM = exports.ALL_PAYMENT_METHOD_EXPECTED = exports.PAYMENT_METHOD_EXPECTED_ENUM = exports.ALL_WEB_UNPAID_PAYMENT_TYPES = exports.WEB_UNPAID_PAYMENT_TYPE_ENUM = exports.ALL_COUNTRY_FLAG_TYPES = exports.COUNTRY_FLAG_ENUM = exports.ALL_COUNTRY_NAME_TYPES = exports.COUNTRY_NAME_ENUM = exports.ALL_COUNTRY_ALPHA_3_TYPES = exports.COUNTRY_ALPHA_3_ENUM = exports.ALL_COUNTRY_ALPHA_2_TYPES = exports.COUNTRY_ALPHA_2_ENUM = exports.ALL_COUNTRY_CODES = exports.COUNTRY_CODE_ENUM = exports.ALL_CURRENCY_SYMBOLS = exports.CURRENCY_SYMBOL_ENUM = exports.ALL_CURRENCY_NAMES = exports.CURRENCY_NAME_ENUM = exports.ALL_CURRENCY_CODES = exports.CURRENCY_CODE_ENUM = exports.ALL_DAY_INDEX = exports.DAY_INDEX_ENUM = exports.ALL_INVENTORY_UNIT_TYPES = exports.INVENTORY_ITEM_UNIT_ENUM = exports.ALL_DIETARY_PREFERENCES = exports.ITEM_DIETARY_PREFERENCE_ENUM = exports.ALL_CAVEATS = exports.ITEM_CAVEATS_ENUM = exports.ALL_PAYMENT_STATUS = exports.PAYMENT_STATUS_ENUM = exports.ALL_ORDER_STATUS_NAMES = exports.ORDER_STATUS_ENUM = exports.ALL_PAYMENT_TYPE_NAMES = exports.PaymentTypeDescriptions = exports.PAYMENT_TYPE_ENUM = exports.ALL_API_STATUS_NAMES = exports.API_STATUS_ENUM = exports.ALL_INTEGRATIONS = exports.INTEGRATIONS_ENUM = exports.PLATFORM_NAMES = exports.PLATFORMS_BY_ORDER_FROM = exports.PLATFORMS_BY_ORDER_TYPE = exports.ALL_PLATFORMS = exports.PLATFORMS_ENUM = exports.ALL_ORDER_TYPE_NAMES = exports.ORDER_TYPE_ENUM = exports.ALL_ORDER_FROM_NAMES = exports.ORDER_FROM_ENUM = void 0;
|
|
4
4
|
exports.MARKETING_RECEIPIENT_ENUM = exports.ALL_MARKETING_TYPES = exports.MARKETING_TYPE_ENUM = exports.ALL_TOKEN_TYPES = exports.TOKEN_TYPE_ENUM = exports.ALL_EMAIL_PROCESSING_PROVIDERS = exports.EMAIL_PROCESSING_PROVIDERS_ENUM = exports.ALL_SMS_PROCESSING_PROVIDERS = exports.SMS_PROCESSING_PROVIDERS_ENUM = exports.ALL_TERMINAL_TYPES = exports.TERMINAL_TYPE_ENUM = exports.ALL_TERMINAL_PROCESSING_PROVIDERS = exports.TERMINAL_PROCESSING_PROVIDERS_ENUM = exports.TRANSACTION_TYPE_ENUM = exports.ALL_CARD_PROCESSING_PROVIDERS = exports.CARD_PROCESSING_PROVIDERS_ENUM = exports.ALL_PAYMENT_PROVIDERS = exports.PAYMENT_PROVIDERS_ENUM = exports.ALL_SUPPORT_SPECIALIST_PERMISSIONS = exports.ALL_MODERATOR_PERMISSIONS = exports.ALL_USER_PERMISSIONS = exports.USER_PERMISSIONS_ENUM = exports.ALL_REWARDS_USAGE_REF_TYPES = exports.REWARDS_USAGE_REF_TYPE_ENUM = exports.ALL_PATHWAY_TO_UNLOCK_TYPE_ORDERS_SCOPES = exports.PATHWAY_TO_UNLOCK_TYPE_ORDERS_SCOPE_ENUM = exports.ALL_PATHWAY_TO_UNLOCK_TYPES = exports.PATHWAY_TO_UNLOCK_TYPE_ENUM = exports.ALL_MYSTERY_GIFT_POPUP_TYPES = exports.MYSTERY_GIFT_POPUP_TYPE_ENUM = exports.ALL_MYSTERY_GIFT_TYPES = exports.MYSTERY_GIFT_TYPE_ENUM = exports.ALL_GIFT_CARD_REWARD_TYPES = exports.GIFT_CARD_REWARD_TYPE_ENUM = exports.ALL_CUSTOMER_REDEMPTION_TYPES = exports.CUSTOMER_REDEMPTION_TYPE_ENUM = exports.ALL_CUSTOMER_REDEMPTION_SOURCE_TYPES = exports.CUSTOMER_REDEMPTION_SOURCE_ENUM = exports.ALL_OFFER_REWARD_TYPES = exports.OFFER_REWARD_TYPE_ENUM = exports.ALL_USER_ROLES = exports.USER_ROLES_ENUM = exports.ALL_PLATFORM_TYPES = exports.PLATFORM_TYPE_ENUM = exports.ALL_ORDER_NUMBER_GROUPING_TYPES = exports.ORDER_NUMBER_GROUPING_TYPE_ENUM = exports.ALL_TRACK_ORDER_NUMBER_TYPES = exports.TRACK_ORDER_NUMBER_ENUM = exports.ALL_TABLE_TYPES = exports.TABLE_TYPE_ENUM = void 0;
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.ALL_CUSTOMER_TARGET_MODES = exports.CUSTOMER_TARGET_MODE_ENUM = exports.ALL_WALLET_ASSIGNMENT_BEHAVIORS = exports.WALLET_ASSIGNMENT_BEHAVIOR_ENUM = exports.ALL_WALLET_ASSET_TYPES = exports.WALLET_ASSET_TYPE_ENUM = exports.ALL_RECEIPT_QR_CODE_TYPES = exports.RECEIPT_QR_CODE_TYPE_ENUM = exports.ALL_INTERNAL_LEAD_STATUS = exports.INTERNAL_LEAD_STATUS_ENUM = exports.ALL_INTERNAL_LEAD_SOURCES = exports.INTERNAL_LEAD_SOURCE_ENUM = exports.ALL_CASH_DRAWER_STATUS = exports.CASH_DRAWER_STATUS_ENUM = exports.ALL_CASH_IN_HAND_TRANSACTION_CATEGORIES = exports.CASH_IN_HAND_TRANSACTION_CATEGORY_ENUM = exports.ALL_CASH_IN_HAND_TRANSACTION_TYPES = exports.CASH_IN_HAND_TRANSACTION_TYPE_ENUM = exports.ALL_CASH_IN_OUT_TYPES = exports.CASH_IN_OUT_TYPE_ENUM = exports.ALL_POS_SHIFT_STATUS = exports.POS_SHIFT_STATUS_ENUM = exports.ALL_POS_DAY_STATUS = exports.POS_DAY_STATUS_ENUM = exports.ALL_MODIFIER_OPTION_REF_TYPES = exports.MODIFIER_OPTION_REF_TYPE_ENUM = exports.ALL_WAREHOUSE_CLIENT_TYPES = exports.WAREHOUSE_CLIENT_TYPE_ENUM = exports.ALL_ONLINE_ORDERING_DESIGN_TYPES = exports.ONLINE_ORDERING_DESIGN_TYPE_ENUM =
|
|
5
|
+
exports.ALL_INVENTORY_TRANSACTION_CATEGORIES = exports.INVENTORY_TRANSACTION_CATEGORY_ENUM = exports.ALL_INVENTORY_TRANSACTION_TYPES = exports.INVENTORY_TRANSACTION_TYPE_ENUM = exports.ALL_GST_TYPES = exports.GST_TYPE_ENUM = exports.ALL_EXPENSE_REACCURING_TYPES = exports.EXPENSE_REACCURING_TYPE_ENUM = exports.PAYMENT_EXTENSION_ENUM = exports.ALL_PRINTER_INTERFACES = exports.PRINTER_INTERFACE_ENUM = exports.RECEIPT_WIDTHS = exports.ALL_NUM_OF_COLUMNS = exports.NUM_OF_COLUMNS_ENUM = exports.SPLIT_SYNC_SOURCE_ENUM = exports.ALL_SPLIT_BILL_TYPES = exports.SPLIT_BILL_TYPE_ENUM = exports.ALL_RIDER_FEE_TYPES = exports.RIDER_FEE_TYPE_ENUM = exports.ALL_DELIVERY_AREAS_SEARCH_TYPES = exports.DELIVERY_AREAS_SEARCH_TYPE_ENUM = exports.ALL_WEB_AUTH_TYPES = exports.WEB_AUTH_TYPE_ENUM = exports.KITCHEN_RECEIPT_TYPE_ENUM = exports.PRINTER_EVENT_TYPE_ENUM = exports.SORT_TYPE_ENUM = exports.BLACKLISTED_SMS_COUNTRY_CODES = exports.ALL_OTP_TYPES = exports.OTP_TYPE_ENUM = exports.ALL_TAX_INVOICE_PROVIDERS = exports.TAX_INVOICE_PROVIDER_ENUM = exports.ALL_RESERVATION_STATUS_TYPES = exports.RESERVATION_STATUS_ENUM = exports.TENANT_AMOUNT_DUE_TYPE_ENUM = exports.ALL_KITCHEN_DOCKET_FONT_TYPES = exports.KITCHEN_DOCKET_FONT_TYPE_ENUM = exports.ALL_SORT_ORDER_BY_TYPES = exports.SORT_ORDER_BY_ENUM = exports.RECEIPT_IMAGE_TYPE_ENUM = exports.ALL_RECEIPT_TYPES = exports.RECEIPT_TYPE_ENUM = exports.ALL_PRINTING_PREFERENCES = exports.PRINTING_PREFERENCE_ENUM = exports.ALL_PRINTER_BRAND_TYPES = exports.PRINTER_BRAND_TYPE_ENUM = exports.ALL_ORDER_ITEM_TYPES = exports.ORDER_ITEM_TYPE_ENUM = exports.ALL_PLATFORM_PROVIDER_IDS = exports.PLATFORM_PROVIDER_IDS_ENUM = exports.ALL_MARKETING_RECEIPIENT_TYPES = void 0;
|
|
6
|
+
exports.ALL_NOTIFICATION_PROVIDERS = exports.NOTIFICATION_PROVIDER_ENUM = exports.ALL_ORDER_COMPLETION_TYPES = exports.ORDER_COMPLETION_TYPE_ENUM = exports.ITEM_COMPARISON_FIELD_ENUM = exports.VOID_ITEM_STAFF_REPORT_ENUM = exports.ALL_DISCOUNT_APPLICABILITY_TYPES = exports.DISCOUNT_APPLICABILITY_ENUM = exports.ALL_DISCOUNT_TYPES = exports.DISCOUNT_TYPE_ENUM = exports.EMAIL_TEMPLATES_TYPE_ENUM = exports.ALL_ALERT_NOTIFICATIONS_TYPES = exports.ALERT_NOTIFICATIONS_TYPE_ENUM = exports.ALL_WALLET_TRANSACTION_STATUS = exports.WALLET_TRANSACTION_STATUS_ENUM = exports.ALL_WALLET_TRANSACTION_CATEGORIES = exports.WALLET_TRANSACTION_CATEGORY_ENUM = exports.ALL_WALLET_TRANSACTION_TYPES = exports.WALLET_TRANSACTION_TYPE_ENUM = exports.ALL_WAREHOUSE_SUPPORT_SPECIALIST_PERMISSIONS = exports.ALL_WAREHOUSE_MODERATOR_PERMISSIONS = exports.ALL_WAREHOUSE_USER_PERMISSIONS = exports.WAREHOUSE_USER_PERMISSIONS_ENUM = exports.ALL_WAREHOUSE_INVOICE_STATUS_NAMES = exports.WAREHOUSE_INVOICE_STATUS_ENUM = exports.ALL_PURCHASE_ORDER_STATUS_NAMES = exports.PURCHASE_ORDER_STATUS_ENUM = exports.ALL_DELIVERY_STATUS = exports.DELIVERY_STATUS_ENUM = exports.ALL_INVENTORY_ITEM_TYPES = exports.INVENTORY_ITEM_TYPE_ENUM = exports.ALL_RATING_TYPES = exports.RATING_TYPE_ENUM = exports.ALL_SUBSCRIPTION_STATUS = exports.SUBSCRIPTION_STATUS_ENUM = exports.ALL_VOID_WAREHOUSE_INVOICE_ITEM_TYPES = exports.VOID_WAREHOUSE_INVOICE_ITEM_TYPE_ENUM = exports.ALL_VOID_PURCHASE_ORDER_ITEM_TYPES = exports.VOID_PURCHASE_ORDER_ITEM_TYPE_ENUM = exports.ALL_VOID_ORDER_ITEM_TYPES = exports.VOID_ORDER_ITEM_TYPE_ENUM = exports.COMPARISON_REPORT_TYPE_ENUM = exports.ALL_MULTI_TENANT_WEBSITE_TYPES = exports.MULTI_TENANT_WEBSITE_TYPE_ENUM = exports.ALL_TIME_RANGE_ENUMS = exports.TIME_RANGE_ENUM = exports.ALL_ITEM_TRANSACTION_TYPES = exports.ITEM_TRANSACTION_TYPE_ENUM = exports.INVENTORY_OUTBOUND_TRANSACTIONS = exports.INVENTORY_INBOUND_TRANSACTIONS = void 0;
|
|
7
|
+
exports.ALL_CUSTOMER_TARGET_MODES = exports.CUSTOMER_TARGET_MODE_ENUM = exports.ALL_WALLET_ASSIGNMENT_BEHAVIORS = exports.WALLET_ASSIGNMENT_BEHAVIOR_ENUM = exports.ALL_WALLET_ASSET_TYPES = exports.WALLET_ASSET_TYPE_ENUM = exports.ALL_RECEIPT_QR_CODE_TYPES = exports.RECEIPT_QR_CODE_TYPE_ENUM = exports.ALL_INTERNAL_LEAD_STATUS = exports.INTERNAL_LEAD_STATUS_ENUM = exports.ALL_INTERNAL_LEAD_SOURCES = exports.INTERNAL_LEAD_SOURCE_ENUM = exports.ALL_CASH_DRAWER_STATUS = exports.CASH_DRAWER_STATUS_ENUM = exports.ALL_CASH_IN_HAND_TRANSACTION_CATEGORIES = exports.CASH_IN_HAND_TRANSACTION_CATEGORY_ENUM = exports.ALL_CASH_IN_HAND_TRANSACTION_TYPES = exports.CASH_IN_HAND_TRANSACTION_TYPE_ENUM = exports.ALL_CASH_IN_OUT_TYPES = exports.CASH_IN_OUT_TYPE_ENUM = exports.ALL_POS_SHIFT_STATUS = exports.POS_SHIFT_STATUS_ENUM = exports.ALL_POS_DAY_STATUS = exports.POS_DAY_STATUS_ENUM = exports.ALL_MODIFIER_OPTION_REF_TYPES = exports.MODIFIER_OPTION_REF_TYPE_ENUM = exports.ALL_WAREHOUSE_CLIENT_TYPES = exports.WAREHOUSE_CLIENT_TYPE_ENUM = exports.ALL_ONLINE_ORDERING_DESIGN_TYPES = exports.ONLINE_ORDERING_DESIGN_TYPE_ENUM = void 0;
|
|
8
8
|
var ORDER_FROM_ENUM;
|
|
9
9
|
(function (ORDER_FROM_ENUM) {
|
|
10
10
|
ORDER_FROM_ENUM["WEB"] = "WEB";
|
|
@@ -1368,23 +1368,6 @@ var GST_TYPE_ENUM;
|
|
|
1368
1368
|
})(GST_TYPE_ENUM || (exports.GST_TYPE_ENUM = GST_TYPE_ENUM = {}));
|
|
1369
1369
|
exports.ALL_GST_TYPES = Object.values(GST_TYPE_ENUM);
|
|
1370
1370
|
// ======================>> <<====================== //
|
|
1371
|
-
var TRACKING_MODE_ENUM;
|
|
1372
|
-
(function (TRACKING_MODE_ENUM) {
|
|
1373
|
-
TRACKING_MODE_ENUM["NONE"] = "NONE";
|
|
1374
|
-
TRACKING_MODE_ENUM["LOT"] = "LOT";
|
|
1375
|
-
TRACKING_MODE_ENUM["SERIAL"] = "SERIAL";
|
|
1376
|
-
})(TRACKING_MODE_ENUM || (exports.TRACKING_MODE_ENUM = TRACKING_MODE_ENUM = {}));
|
|
1377
|
-
exports.ALL_TRACKING_MODES = Object.values(TRACKING_MODE_ENUM);
|
|
1378
|
-
// ======================>> <<====================== //
|
|
1379
|
-
var REMOVAL_STRATEGY_ENUM;
|
|
1380
|
-
(function (REMOVAL_STRATEGY_ENUM) {
|
|
1381
|
-
REMOVAL_STRATEGY_ENUM["NONE"] = "NONE";
|
|
1382
|
-
REMOVAL_STRATEGY_ENUM["FIFO"] = "FIFO";
|
|
1383
|
-
REMOVAL_STRATEGY_ENUM["LIFO"] = "LIFO";
|
|
1384
|
-
REMOVAL_STRATEGY_ENUM["FEFO"] = "FEFO";
|
|
1385
|
-
})(REMOVAL_STRATEGY_ENUM || (exports.REMOVAL_STRATEGY_ENUM = REMOVAL_STRATEGY_ENUM = {}));
|
|
1386
|
-
exports.ALL_REMOVAL_STRATEGY_TYPES = Object.values(REMOVAL_STRATEGY_ENUM);
|
|
1387
|
-
// ======================>> <<====================== //
|
|
1388
1371
|
var INVENTORY_TRANSACTION_TYPE_ENUM;
|
|
1389
1372
|
(function (INVENTORY_TRANSACTION_TYPE_ENUM) {
|
|
1390
1373
|
INVENTORY_TRANSACTION_TYPE_ENUM["INBOUND"] = "INBOUND";
|
|
@@ -1510,34 +1493,6 @@ var PURCHASE_ORDER_STATUS_ENUM;
|
|
|
1510
1493
|
})(PURCHASE_ORDER_STATUS_ENUM || (exports.PURCHASE_ORDER_STATUS_ENUM = PURCHASE_ORDER_STATUS_ENUM = {}));
|
|
1511
1494
|
exports.ALL_PURCHASE_ORDER_STATUS_NAMES = Object.values(PURCHASE_ORDER_STATUS_ENUM);
|
|
1512
1495
|
// ======================>> <<====================== //
|
|
1513
|
-
var PURCHASE_ORDER_RFQ_STATUS_ENUM;
|
|
1514
|
-
(function (PURCHASE_ORDER_RFQ_STATUS_ENUM) {
|
|
1515
|
-
PURCHASE_ORDER_RFQ_STATUS_ENUM["DRAFT"] = "DRAFT";
|
|
1516
|
-
PURCHASE_ORDER_RFQ_STATUS_ENUM["SENT"] = "SENT";
|
|
1517
|
-
PURCHASE_ORDER_RFQ_STATUS_ENUM["CONFIRMED"] = "CONFIRMED";
|
|
1518
|
-
PURCHASE_ORDER_RFQ_STATUS_ENUM["CANCELLED"] = "CANCELLED";
|
|
1519
|
-
})(PURCHASE_ORDER_RFQ_STATUS_ENUM || (exports.PURCHASE_ORDER_RFQ_STATUS_ENUM = PURCHASE_ORDER_RFQ_STATUS_ENUM = {}));
|
|
1520
|
-
exports.ALL_PURCHASE_ORDER_RFQ_STATUS_NAMES = Object.values(PURCHASE_ORDER_RFQ_STATUS_ENUM);
|
|
1521
|
-
// ======================>> <<====================== //
|
|
1522
|
-
var PURCHASE_ORDER_RECEIPT_STATUS_ENUM;
|
|
1523
|
-
(function (PURCHASE_ORDER_RECEIPT_STATUS_ENUM) {
|
|
1524
|
-
PURCHASE_ORDER_RECEIPT_STATUS_ENUM["DRAFT"] = "DRAFT";
|
|
1525
|
-
PURCHASE_ORDER_RECEIPT_STATUS_ENUM["VALIDATED"] = "VALIDATED";
|
|
1526
|
-
PURCHASE_ORDER_RECEIPT_STATUS_ENUM["CANCELLED"] = "CANCELLED";
|
|
1527
|
-
})(PURCHASE_ORDER_RECEIPT_STATUS_ENUM || (exports.PURCHASE_ORDER_RECEIPT_STATUS_ENUM = PURCHASE_ORDER_RECEIPT_STATUS_ENUM = {}));
|
|
1528
|
-
exports.ALL_PURCHASE_ORDER_RECEIPT_STATUS_NAMES = Object.values(PURCHASE_ORDER_RECEIPT_STATUS_ENUM);
|
|
1529
|
-
// ======================>> <<====================== //
|
|
1530
|
-
var PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM;
|
|
1531
|
-
(function (PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM) {
|
|
1532
|
-
PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM["CREATED"] = "CREATED";
|
|
1533
|
-
PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM["APPROVED"] = "APPROVED";
|
|
1534
|
-
PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM["DISPATCHED"] = "DISPATCHED";
|
|
1535
|
-
PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM["VENDOR_CONFIRMED"] = "VENDOR_CONFIRMED";
|
|
1536
|
-
PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM["COMPLETED"] = "COMPLETED";
|
|
1537
|
-
PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM["CANCELLED"] = "CANCELLED";
|
|
1538
|
-
})(PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM || (exports.PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM = PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM = {}));
|
|
1539
|
-
exports.ALL_PURCHASE_ORDER_VENDOR_RETURN_STATUS_NAMES = Object.values(PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM);
|
|
1540
|
-
// ======================>> <<====================== //
|
|
1541
1496
|
var WAREHOUSE_INVOICE_STATUS_ENUM;
|
|
1542
1497
|
(function (WAREHOUSE_INVOICE_STATUS_ENUM) {
|
|
1543
1498
|
WAREHOUSE_INVOICE_STATUS_ENUM["PENDING"] = "PENDING";
|
|
@@ -77,6 +77,15 @@ export declare function getRemoveItemFromCartData(data: Partial<IOrder>, payload
|
|
|
77
77
|
void_reason?: string;
|
|
78
78
|
}, courses: ICourse[], listnerSettings: ICartListnerSettings): Partial<IOrder>;
|
|
79
79
|
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>;
|
|
80
|
+
/**
|
|
81
|
+
* Drop entries from `redeemed_offers` (and any related discount/wallet state)
|
|
82
|
+
* for offers whose `included_platforms` does not contain the supplied platform.
|
|
83
|
+
*
|
|
84
|
+
* Use this when the platform changes outside of `getUpdatedCartInfoOnInit` (for
|
|
85
|
+
* example, on platform switch in a long POS cashier session) to keep
|
|
86
|
+
* platform-incompatible rewards from being silently preserved.
|
|
87
|
+
*/
|
|
88
|
+
export declare function pruneInvalidRedeemedOffersForPlatform(data: Partial<IOrder>, courses: ICourse[], listnerSettings: ICartListnerSettings, offers: IOffer[] | undefined, platform: PLATFORMS_ENUM | undefined): Partial<IOrder>;
|
|
80
89
|
export declare function getChangeCourseForItemData(data: Partial<IOrder>, itemId: string, new_course_id: string, courses: ICourse[], listnerSettings: ICartListnerSettings): Partial<IOrder>;
|
|
81
90
|
export declare function getChangeCourseStatusData(data: Partial<IOrder>, course_id: string, called: boolean, courses: ICourse[], listnerSettings: ICartListnerSettings): {
|
|
82
91
|
dinein_details: {
|
|
@@ -166,6 +175,21 @@ export declare function getCartItemsObj({ currentIterationCategories, currentDin
|
|
|
166
175
|
export declare function getRemoveOfferFromCartData(data: Partial<IOrder>, offer_id: string, courses: ICourse[], listnerSettings: ICartListnerSettings): Partial<IOrder>;
|
|
167
176
|
export declare function getRemoveAllOffersFromCartData(data: Partial<IOrder>, courses: ICourse[], listnerSettings: ICartListnerSettings, offerIds: string[] | undefined): Partial<IOrder>;
|
|
168
177
|
export declare function getClearVoucherCodeAndOffersFromCartData(data: Partial<IOrder>, courses: ICourse[], listnerSettings: ICartListnerSettings, offerIds: string[] | undefined): Partial<IOrder>;
|
|
178
|
+
/**
|
|
179
|
+
* Wipe all reward metadata (`redeemed_offers`, `wallet_redemptions`) and any
|
|
180
|
+
* loyalty/voucher fields on `order_discount_details`, then resync the cart.
|
|
181
|
+
*
|
|
182
|
+
* Use this on hard reward-session boundaries — for example, in a POS cashier
|
|
183
|
+
* session when the customer phone changes — where every reward applied for the
|
|
184
|
+
* previous customer must be dropped before the next customer's eligibility is
|
|
185
|
+
* evaluated. Items in the cart are preserved.
|
|
186
|
+
*
|
|
187
|
+
* Unlike `getClearVoucherCodeAndOffersFromCartData`, this also clears
|
|
188
|
+
* `wallet_redemptions.gift_cards` and `wallet_redemptions.cashback_amount`,
|
|
189
|
+
* along with any wallet-cashback `loyalty_discount_*` mirror on
|
|
190
|
+
* `order_discount_details`.
|
|
191
|
+
*/
|
|
192
|
+
export declare function getResetRewardStateForNewCustomer(data: Partial<IOrder>, courses: ICourse[], listnerSettings: ICartListnerSettings): Partial<IOrder>;
|
|
169
193
|
/**
|
|
170
194
|
* Calculate the eligible subtotal by excluding items/categories in excluded_refs
|
|
171
195
|
*/
|
|
@@ -22,12 +22,14 @@ exports.getUpdateItemsInCartData = getUpdateItemsInCartData;
|
|
|
22
22
|
exports.getUpdateCartInfoData = getUpdateCartInfoData;
|
|
23
23
|
exports.getRemoveItemFromCartData = getRemoveItemFromCartData;
|
|
24
24
|
exports.getUpdatedCartInfoOnInit = getUpdatedCartInfoOnInit;
|
|
25
|
+
exports.pruneInvalidRedeemedOffersForPlatform = pruneInvalidRedeemedOffersForPlatform;
|
|
25
26
|
exports.getChangeCourseForItemData = getChangeCourseForItemData;
|
|
26
27
|
exports.getChangeCourseStatusData = getChangeCourseStatusData;
|
|
27
28
|
exports.getCartItemsObj = getCartItemsObj;
|
|
28
29
|
exports.getRemoveOfferFromCartData = getRemoveOfferFromCartData;
|
|
29
30
|
exports.getRemoveAllOffersFromCartData = getRemoveAllOffersFromCartData;
|
|
30
31
|
exports.getClearVoucherCodeAndOffersFromCartData = getClearVoucherCodeAndOffersFromCartData;
|
|
32
|
+
exports.getResetRewardStateForNewCustomer = getResetRewardStateForNewCustomer;
|
|
31
33
|
exports.calculateEligibleOfferDiscountDetails = calculateEligibleOfferDiscountDetails;
|
|
32
34
|
const bson_objectid_1 = __importDefault(require("bson-objectid"));
|
|
33
35
|
const lodash_1 = require("lodash");
|
|
@@ -2308,9 +2310,24 @@ function getUpdatedCartInfoOnInit(data, order, courses, platform, categories, ma
|
|
|
2308
2310
|
if (platform == null || data.platform === order.platform || offers == null || offers.length === 0) {
|
|
2309
2311
|
return orderData;
|
|
2310
2312
|
}
|
|
2311
|
-
|
|
2313
|
+
return pruneInvalidRedeemedOffersForPlatform(orderData, courses, listnerSettings, offers, platform);
|
|
2314
|
+
}
|
|
2315
|
+
/* =================================><================================= */
|
|
2316
|
+
/**
|
|
2317
|
+
* Drop entries from `redeemed_offers` (and any related discount/wallet state)
|
|
2318
|
+
* for offers whose `included_platforms` does not contain the supplied platform.
|
|
2319
|
+
*
|
|
2320
|
+
* Use this when the platform changes outside of `getUpdatedCartInfoOnInit` (for
|
|
2321
|
+
* example, on platform switch in a long POS cashier session) to keep
|
|
2322
|
+
* platform-incompatible rewards from being silently preserved.
|
|
2323
|
+
*/
|
|
2324
|
+
function pruneInvalidRedeemedOffersForPlatform(data, courses, listnerSettings, offers, platform) {
|
|
2325
|
+
if (platform == null || offers == null || offers.length === 0) {
|
|
2326
|
+
return data;
|
|
2327
|
+
}
|
|
2328
|
+
const redeemedOfferIds = Object.keys(data.redeemed_offers ?? {});
|
|
2312
2329
|
if (redeemedOfferIds.length === 0) {
|
|
2313
|
-
return
|
|
2330
|
+
return data;
|
|
2314
2331
|
}
|
|
2315
2332
|
const offersMap = new Map();
|
|
2316
2333
|
for (let i = 0; i < offers.length; i++) {
|
|
@@ -2325,11 +2342,10 @@ function getUpdatedCartInfoOnInit(data, order, courses, platform, categories, ma
|
|
|
2325
2342
|
}
|
|
2326
2343
|
}
|
|
2327
2344
|
if (invalidRedeemedOfferIds.length === 0) {
|
|
2328
|
-
return
|
|
2345
|
+
return data;
|
|
2329
2346
|
}
|
|
2330
|
-
return getRemoveAllOffersFromCartData(
|
|
2347
|
+
return getRemoveAllOffersFromCartData(data, courses, listnerSettings, invalidRedeemedOfferIds);
|
|
2331
2348
|
}
|
|
2332
|
-
/* =================================><================================= */
|
|
2333
2349
|
function getChangeCourseForItemData(data, itemId, new_course_id, courses, listnerSettings) {
|
|
2334
2350
|
if (data.dinein_details == null)
|
|
2335
2351
|
return data;
|
|
@@ -3095,6 +3111,33 @@ function getClearVoucherCodeAndOffersFromCartData(data, courses, listnerSettings
|
|
|
3095
3111
|
}, courses, listnerSettings);
|
|
3096
3112
|
}
|
|
3097
3113
|
// ================================><================================= //
|
|
3114
|
+
/**
|
|
3115
|
+
* Wipe all reward metadata (`redeemed_offers`, `wallet_redemptions`) and any
|
|
3116
|
+
* loyalty/voucher fields on `order_discount_details`, then resync the cart.
|
|
3117
|
+
*
|
|
3118
|
+
* Use this on hard reward-session boundaries — for example, in a POS cashier
|
|
3119
|
+
* session when the customer phone changes — where every reward applied for the
|
|
3120
|
+
* previous customer must be dropped before the next customer's eligibility is
|
|
3121
|
+
* evaluated. Items in the cart are preserved.
|
|
3122
|
+
*
|
|
3123
|
+
* Unlike `getClearVoucherCodeAndOffersFromCartData`, this also clears
|
|
3124
|
+
* `wallet_redemptions.gift_cards` and `wallet_redemptions.cashback_amount`,
|
|
3125
|
+
* along with any wallet-cashback `loyalty_discount_*` mirror on
|
|
3126
|
+
* `order_discount_details`.
|
|
3127
|
+
*/
|
|
3128
|
+
function getResetRewardStateForNewCustomer(data, courses, listnerSettings) {
|
|
3129
|
+
const orderWithoutOffers = getRemoveAllOffersFromCartData(data, courses, listnerSettings, undefined);
|
|
3130
|
+
const orderDiscountDetailsWithoutVoucher = (0, offers_helpers_1.buildClearVoucherDiscountDetails)(orderWithoutOffers.order_discount_details);
|
|
3131
|
+
const orderDiscountDetails = orderDiscountDetailsWithoutVoucher != null &&
|
|
3132
|
+
orderDiscountDetailsWithoutVoucher.loyalty_discount_id === constants_1.WALLET_CASHBACK_LOYALTY_DISCOUNT_ID
|
|
3133
|
+
? clearLoyaltyDiscountFields(orderDiscountDetailsWithoutVoucher)
|
|
3134
|
+
: orderDiscountDetailsWithoutVoucher;
|
|
3135
|
+
return getUpdateCartInfoData(orderWithoutOffers, {
|
|
3136
|
+
order_discount_details: orderDiscountDetails,
|
|
3137
|
+
wallet_redemptions: null,
|
|
3138
|
+
}, courses, listnerSettings);
|
|
3139
|
+
}
|
|
3140
|
+
// ================================><================================= //
|
|
3098
3141
|
/**
|
|
3099
3142
|
* Calculate the eligible subtotal by excluding items/categories in excluded_refs
|
|
3100
3143
|
*/
|
|
@@ -24,8 +24,8 @@ interface IGetVoidItemsWithReasonPurchaseOrder {
|
|
|
24
24
|
previousCategories: IPurchaseOrderCategory[];
|
|
25
25
|
}
|
|
26
26
|
export declare function getVoidItemsWithReasonPurchaseOrder({ currentCategories, iterationsFromFrontend, previousCategories, }: IGetVoidItemsWithReasonPurchaseOrder): {
|
|
27
|
-
newIterationCategories:
|
|
28
|
-
voidOrderItems:
|
|
27
|
+
newIterationCategories: IPurchaseOrderCategory[];
|
|
28
|
+
voidOrderItems: IPurchaseOrderItem[];
|
|
29
29
|
hasNewItems: boolean;
|
|
30
30
|
};
|
|
31
31
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PURCHASE_ORDER_STATUS_ENUM } from '../../constants';
|
|
2
|
-
import { IPurchaseOrder, IPurchaseOrderItem, IPurchaseOrderIteration } from '../../schemas';
|
|
2
|
+
import { IPurchaseOrder, IPurchaseOrderCategory, IPurchaseOrderItem, IPurchaseOrderIteration } from '../../schemas';
|
|
3
3
|
export declare function calculateCartPurchaseOrderInfoAndSyncData<T extends IPurchaseOrder | Partial<IPurchaseOrder>>(data: T, calculateItemMetadata?: boolean): T;
|
|
4
4
|
export declare const getPurchaseOrderItemComaparableData: (item: IPurchaseOrderItem) => Partial<IPurchaseOrderItem>;
|
|
5
5
|
export declare function getUpdatedPurchaseOrderCartInfoOnInit(data: Partial<IPurchaseOrder>, order: Partial<IPurchaseOrder>): {
|
|
@@ -7,7 +7,6 @@ export declare function getUpdatedPurchaseOrderCartInfoOnInit(data: Partial<IPur
|
|
|
7
7
|
warehouse_id?: string | undefined;
|
|
8
8
|
vendor_id?: string | undefined;
|
|
9
9
|
vendor_name?: string | undefined;
|
|
10
|
-
rfq_id?: string | null;
|
|
11
10
|
iterations?: IPurchaseOrderIteration[] | undefined;
|
|
12
11
|
amount_collected?: number | undefined;
|
|
13
12
|
order_number?: number | null | undefined;
|
|
@@ -21,18 +20,18 @@ export declare function getUpdatedPurchaseOrderCartInfoOnInit(data: Partial<IPur
|
|
|
21
20
|
order_settled_at_mins?: number | undefined;
|
|
22
21
|
createdAt_mins?: number | undefined;
|
|
23
22
|
createdAt?: Date | undefined;
|
|
23
|
+
categories?: IPurchaseOrderCategory[] | undefined;
|
|
24
24
|
payments?: import("../../schemas").IOrderPayment[] | undefined;
|
|
25
|
-
tax_number?: string | undefined;
|
|
26
|
-
categories?: import("../../schemas").IPurchaseOrderCommonCategoryByCategoryId[] | undefined;
|
|
27
25
|
staff_details?: import("../../schemas").IStaffDetails | undefined;
|
|
28
26
|
is_gst_inclusive?: boolean;
|
|
29
|
-
gst?: number
|
|
30
|
-
gst_amount?: number
|
|
27
|
+
gst?: number;
|
|
28
|
+
gst_amount?: number;
|
|
31
29
|
special_instructions?: string | undefined;
|
|
30
|
+
order_status?: PURCHASE_ORDER_STATUS_ENUM | undefined;
|
|
32
31
|
price?: number | undefined;
|
|
33
32
|
amount_earned?: number | undefined;
|
|
34
33
|
grand_total?: number | undefined;
|
|
35
|
-
|
|
34
|
+
tax_number?: string | undefined;
|
|
36
35
|
updatedAt?: Date | undefined;
|
|
37
36
|
};
|
|
38
37
|
export declare function getRemoveItemFromPurchaseOrderCartData(data: Partial<IPurchaseOrder>, payload: {
|
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./cart-helpers"), exports);
|
|
18
18
|
__exportStar(require("./cash_in_hand_transactions"), exports);
|
|
19
19
|
__exportStar(require("./catalog-conversion"), exports);
|
|
20
|
+
__exportStar(require("./code-redemption-helpers"), exports);
|
|
20
21
|
__exportStar(require("./color-helpers"), exports);
|
|
21
22
|
__exportStar(require("./common"), exports);
|
|
22
23
|
__exportStar(require("./crypt"), exports);
|
|
@@ -34,5 +34,67 @@ export declare function buildVoucherDiscountUpdate({ code, orderDiscountDetails,
|
|
|
34
34
|
orderDiscountDetails: IDiscountDetails | null | undefined;
|
|
35
35
|
}): IDiscountDetails;
|
|
36
36
|
export declare function getSyncOffersWithCartData(data: Partial<IOrder>, courses: ICourse[], listnerSettings: ICartListnerSettings, unlockedOffersApplicableTimes: Record<string, number>, // Record<offer_id, times can be applied>
|
|
37
|
-
offers: IOffer[]):
|
|
37
|
+
offers: IOffer[]): {
|
|
38
|
+
order_discount_details: IDiscountDetails | null | undefined;
|
|
39
|
+
redeemed_offers: Record<string, number> | null | undefined;
|
|
40
|
+
wallet_redemptions: import("../../schemas").IWalletRedemptions | null | undefined;
|
|
41
|
+
_id?: string | undefined;
|
|
42
|
+
tenant_id?: string | undefined;
|
|
43
|
+
consumer?: import("../../schemas").IConsumer | undefined;
|
|
44
|
+
platform?: import("../../constants").PLATFORMS_ENUM | undefined;
|
|
45
|
+
tip_amount?: number | undefined;
|
|
46
|
+
categories?: IOrderCategory[] | undefined;
|
|
47
|
+
iterations?: import("../../schemas").IOrderIteration[] | undefined;
|
|
48
|
+
special_instructions?: string | undefined;
|
|
49
|
+
payments?: import("../../schemas").IOrderPayment[] | undefined;
|
|
50
|
+
split_parent_id?: string | null | undefined;
|
|
51
|
+
split_child_ids?: string[] | null | undefined;
|
|
52
|
+
split_type?: (import("../../constants").SPLIT_BILL_TYPE_ENUM | null) | undefined;
|
|
53
|
+
order_status?: import("../../constants").ORDER_STATUS_ENUM | undefined;
|
|
54
|
+
tax_number?: string | undefined;
|
|
55
|
+
tax_amount?: number | undefined;
|
|
56
|
+
price?: number | undefined;
|
|
57
|
+
amount_collected?: number | undefined;
|
|
58
|
+
amount_earned?: number | undefined;
|
|
59
|
+
grand_total?: number | undefined;
|
|
60
|
+
order_number?: number | null | undefined;
|
|
61
|
+
delete_reason?: string | null | undefined;
|
|
62
|
+
cancel_reason?: string | null | undefined;
|
|
63
|
+
tax_invoice_id?: string | null | undefined;
|
|
64
|
+
is_deleted?: boolean | undefined;
|
|
65
|
+
order_status_updated_at?: Date | undefined;
|
|
66
|
+
rating?: number | null | undefined;
|
|
67
|
+
review?: string | null | undefined;
|
|
68
|
+
is_reopened?: boolean | undefined;
|
|
69
|
+
deferred_settlement?: boolean | undefined;
|
|
70
|
+
payment_method_expected?: import("../../constants").PAYMENT_METHOD_EXPECTED_ENUM | undefined;
|
|
71
|
+
order_taker_details?: (import("../../schemas").IStaffDetails | null) | undefined;
|
|
72
|
+
order_settled_at?: Date | undefined;
|
|
73
|
+
order_settled_at_mins?: number | undefined;
|
|
74
|
+
createdAt_mins?: number | undefined;
|
|
75
|
+
createdAt?: Date | undefined;
|
|
76
|
+
updatedAt?: Date | undefined;
|
|
77
|
+
delivery_details?: (import("../../schemas").IOrderDeliveryDetails | null) | undefined;
|
|
78
|
+
dinein_details?: (import("../../schemas").IOrderDineInDetails | null) | undefined;
|
|
79
|
+
takeaway_details?: (import("../../schemas").IOrderTakeawayDetails | null) | undefined;
|
|
80
|
+
staff_details?: (import("../../schemas").IStaffDetails | null) | undefined;
|
|
81
|
+
total_discount_applied?: number | undefined;
|
|
82
|
+
is_surcharge_percentage?: boolean | undefined;
|
|
83
|
+
is_surcharge_taxable?: boolean | undefined;
|
|
84
|
+
is_service_fee_percentage?: boolean | undefined;
|
|
85
|
+
is_service_fee_taxable?: boolean | undefined;
|
|
86
|
+
exclude_discount_from_gst?: boolean | undefined;
|
|
87
|
+
apply_service_fee_on_original_price?: boolean | undefined;
|
|
88
|
+
is_gst_inclusive?: boolean | undefined;
|
|
89
|
+
surcharge?: number | undefined;
|
|
90
|
+
surcharge_amount?: number | undefined;
|
|
91
|
+
service_fee?: number | undefined;
|
|
92
|
+
service_fee_amount?: number | undefined;
|
|
93
|
+
gst?: number | undefined;
|
|
94
|
+
gst_amount?: number | undefined;
|
|
95
|
+
packaging_charges?: number | undefined;
|
|
96
|
+
adjustment_amount?: number | null | undefined;
|
|
97
|
+
adjustment_reason?: string | null | undefined;
|
|
98
|
+
tax_invoice_provider_charges?: number | undefined;
|
|
99
|
+
};
|
|
38
100
|
export {};
|
|
@@ -519,8 +519,13 @@ function getNormalizedWalletRedemptionsMap(walletRedemptions) {
|
|
|
519
519
|
if (Number.isFinite(cashbackAmount) && cashbackAmount > 0) {
|
|
520
520
|
normalized.cashback_amount = cashbackAmount;
|
|
521
521
|
}
|
|
522
|
-
const
|
|
523
|
-
|
|
522
|
+
const rawGiftCardRedemptions = walletRedemptions.gift_cards;
|
|
523
|
+
const giftCardRedemptions = rawGiftCardRedemptions == null
|
|
524
|
+
? []
|
|
525
|
+
: Array.isArray(rawGiftCardRedemptions)
|
|
526
|
+
? rawGiftCardRedemptions
|
|
527
|
+
: [rawGiftCardRedemptions];
|
|
528
|
+
if (giftCardRedemptions.length > 0) {
|
|
524
529
|
const normalizedGiftCardRedemptionsMap = {};
|
|
525
530
|
for (let i = 0; i < giftCardRedemptions.length; i++) {
|
|
526
531
|
const giftCardRedemption = giftCardRedemptions[i];
|
|
@@ -553,8 +558,61 @@ function getWalletRedemptionsMap(existingWalletRedemptions) {
|
|
|
553
558
|
}
|
|
554
559
|
function getSyncOffersWithCartData(data, courses, listnerSettings, unlockedOffersApplicableTimes, // Record<offer_id, times can be applied>
|
|
555
560
|
offers) {
|
|
556
|
-
|
|
561
|
+
const syncedOrderData = (0, cart_actions_1.calculateCartOrderInfoAndSyncData)(data, courses, listnerSettings, undefined, {
|
|
557
562
|
unlockedOffersApplicableTimes,
|
|
558
563
|
offers,
|
|
559
564
|
});
|
|
565
|
+
const removedOfferIds = new Set();
|
|
566
|
+
const currentOrderDiscountDetails = data.order_discount_details;
|
|
567
|
+
const syncedOrderDiscountDetails = syncedOrderData.order_discount_details;
|
|
568
|
+
const currentLoyaltyDiscountId = getNormalizedOfferId(currentOrderDiscountDetails?.loyalty_discount_id);
|
|
569
|
+
const syncedLoyaltyDiscountId = getNormalizedOfferId(syncedOrderDiscountDetails?.loyalty_discount_id);
|
|
570
|
+
if (currentLoyaltyDiscountId != null && currentLoyaltyDiscountId !== syncedLoyaltyDiscountId) {
|
|
571
|
+
removedOfferIds.add(currentLoyaltyDiscountId);
|
|
572
|
+
}
|
|
573
|
+
const currentVoucherDiscountId = getNormalizedOfferId(currentOrderDiscountDetails?.voucher_discount_id);
|
|
574
|
+
const syncedVoucherDiscountId = getNormalizedOfferId(syncedOrderDiscountDetails?.voucher_discount_id);
|
|
575
|
+
if (currentVoucherDiscountId != null && currentVoucherDiscountId !== syncedVoucherDiscountId) {
|
|
576
|
+
removedOfferIds.add(currentVoucherDiscountId);
|
|
577
|
+
}
|
|
578
|
+
const syncedCategories = syncedOrderData.categories ?? [];
|
|
579
|
+
const hasCartItems = syncedCategories.some((category) => category.items.length > 0);
|
|
580
|
+
const nextRedeemedOffers = hasCartItems
|
|
581
|
+
? getReconciledRedeemedOffersMap({
|
|
582
|
+
existingRedeemedOffers: data.redeemed_offers,
|
|
583
|
+
categories: syncedCategories,
|
|
584
|
+
offers,
|
|
585
|
+
removedOfferIds,
|
|
586
|
+
unlockedOffersApplicableTimes,
|
|
587
|
+
})
|
|
588
|
+
: null;
|
|
589
|
+
const normalizedSyncedWalletRedemptions = getWalletRedemptionsMap(syncedOrderData.wallet_redemptions);
|
|
590
|
+
const normalizedCurrentWalletRedemptions = getWalletRedemptionsMap(data.wallet_redemptions);
|
|
591
|
+
const shouldSyncWalletCashbackDiscount = isWalletCashbackLoyaltyDiscount(syncedOrderDiscountDetails) ||
|
|
592
|
+
isWalletCashbackLoyaltyDiscount(currentOrderDiscountDetails);
|
|
593
|
+
const nextWalletRedemptions = getWalletRedemptionsMap({
|
|
594
|
+
...(normalizedCurrentWalletRedemptions ?? {}),
|
|
595
|
+
...(normalizedSyncedWalletRedemptions ?? {}),
|
|
596
|
+
cashback_amount: shouldSyncWalletCashbackDiscount
|
|
597
|
+
? (normalizedSyncedWalletRedemptions?.cashback_amount ?? normalizedCurrentWalletRedemptions?.cashback_amount)
|
|
598
|
+
: undefined,
|
|
599
|
+
gift_cards: hasCartItems
|
|
600
|
+
? (normalizedSyncedWalletRedemptions?.gift_cards ?? normalizedCurrentWalletRedemptions?.gift_cards)
|
|
601
|
+
: undefined,
|
|
602
|
+
});
|
|
603
|
+
const nextOrderDiscountDetails = shouldSyncWalletCashbackDiscount
|
|
604
|
+
? getSyncedWalletCashbackOrderDiscountDetails({
|
|
605
|
+
orderDiscountDetails: syncedOrderDiscountDetails ?? currentOrderDiscountDetails,
|
|
606
|
+
walletCashbackAmount: getWalletCashbackAmountFromOrderData({
|
|
607
|
+
orderDiscountDetails: syncedOrderDiscountDetails ?? currentOrderDiscountDetails,
|
|
608
|
+
walletRedemptions: nextWalletRedemptions,
|
|
609
|
+
}),
|
|
610
|
+
})
|
|
611
|
+
: syncedOrderDiscountDetails;
|
|
612
|
+
return {
|
|
613
|
+
...syncedOrderData,
|
|
614
|
+
order_discount_details: nextOrderDiscountDetails,
|
|
615
|
+
redeemed_offers: nextRedeemedOffers,
|
|
616
|
+
wallet_redemptions: nextWalletRedemptions,
|
|
617
|
+
};
|
|
560
618
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GIFT_CARD_REWARD_TYPE_ENUM, OFFER_REWARD_TYPE_ENUM, PLATFORMS_ENUM } from '../../constants';
|
|
2
2
|
import { ICustomer, IDiscountDetails, IGiftCard, IOffer, IOrder, IOrderCategory, ITenant, IVoucher } from '../../schemas';
|
|
3
|
+
import { ICustomerRedemptionCount } from '../types';
|
|
3
4
|
import { TWalletGiftCardRedemptionsCompatInput } from './wallet-redemption-helpers';
|
|
4
5
|
export declare function getOfferWithPrice<T extends Partial<IOffer> | IOffer>(offer: T, writeable?: boolean): T;
|
|
5
6
|
export declare function convertOffersToWorkableOffers(offers: IOffer[], platform: PLATFORMS_ENUM): IOffer[];
|
|
@@ -20,6 +21,18 @@ interface ICalculateCustomerSpendableVoucherCodes {
|
|
|
20
21
|
offers: IOffer[];
|
|
21
22
|
vouchers: IVoucher[] | undefined;
|
|
22
23
|
}
|
|
24
|
+
interface IGetVoucherPathwayCartContext {
|
|
25
|
+
offers: IOffer[];
|
|
26
|
+
vouchers: IVoucher[] | undefined;
|
|
27
|
+
redeemedOffers?: IOrder['redeemed_offers'] | null | undefined;
|
|
28
|
+
orderDiscountDetails: IDiscountDetails | null | undefined;
|
|
29
|
+
}
|
|
30
|
+
export interface IVoucherPathwayCartContext {
|
|
31
|
+
activeVoucherCode: string | null;
|
|
32
|
+
consumedVoucherCodes: Set<string>;
|
|
33
|
+
consumedVoucherIds: Set<string>;
|
|
34
|
+
redeemedOfferIds: Set<string>;
|
|
35
|
+
}
|
|
23
36
|
interface ICalculateCustomerSpendableGiftCardCodes {
|
|
24
37
|
customerGiftCardCodes: ICustomer['gift_cards'] | null | undefined;
|
|
25
38
|
loyaltyReferenceNumber: string | null | undefined;
|
|
@@ -27,6 +40,11 @@ interface ICalculateCustomerSpendableGiftCardCodes {
|
|
|
27
40
|
walletGiftCardRedemptions: TWalletGiftCardRedemptionsCompatInput;
|
|
28
41
|
giftCards: IGiftCard[] | undefined;
|
|
29
42
|
}
|
|
43
|
+
export declare function getVoucherPathwayCartContext({ offers, vouchers, redeemedOffers, orderDiscountDetails, }: IGetVoucherPathwayCartContext): IVoucherPathwayCartContext;
|
|
44
|
+
export declare function isVoucherPathwayOfferBlockedByCartContext({ offer, cartContext, }: {
|
|
45
|
+
offer: IOffer;
|
|
46
|
+
cartContext: IVoucherPathwayCartContext;
|
|
47
|
+
}): boolean;
|
|
30
48
|
/**
|
|
31
49
|
* Determines whether a voucher-type offer should show "already claimed"
|
|
32
50
|
* instead of the toolkit's generic "not eligible" message.
|
|
@@ -36,7 +54,7 @@ interface ICalculateCustomerSpendableGiftCardCodes {
|
|
|
36
54
|
*/
|
|
37
55
|
export declare function isExhaustedVoucherOffer({ offer, customerOfferRedemptionCounts, redeemedOffers, isRedeemed, }: {
|
|
38
56
|
offer: IOffer | null | undefined;
|
|
39
|
-
customerOfferRedemptionCounts:
|
|
57
|
+
customerOfferRedemptionCounts: ICustomerRedemptionCount | null | undefined;
|
|
40
58
|
redeemedOffers: IOrder['redeemed_offers'] | null | undefined;
|
|
41
59
|
isRedeemed: boolean;
|
|
42
60
|
}): boolean;
|
|
@@ -114,17 +132,18 @@ export declare function getOfferUsageLimitMeta(offer: IOffer | null | undefined)
|
|
|
114
132
|
export declare function getOfferConsumedUses({ offer, usageLimit, customerOfferRedemptionCounts, }: {
|
|
115
133
|
offer: IOffer | null | undefined;
|
|
116
134
|
usageLimit: IOfferUsageLimitMeta | null;
|
|
117
|
-
customerOfferRedemptionCounts:
|
|
135
|
+
customerOfferRedemptionCounts: ICustomerRedemptionCount | null | undefined;
|
|
118
136
|
}): number | null;
|
|
119
137
|
export declare function isOfferFullyConsumedForCustomer({ offer, usageLimit, customerOfferRedemptionCounts, }: {
|
|
120
138
|
offer: IOffer | null | undefined;
|
|
121
139
|
usageLimit: IOfferUsageLimitMeta | null;
|
|
122
|
-
customerOfferRedemptionCounts:
|
|
140
|
+
customerOfferRedemptionCounts: ICustomerRedemptionCount | null | undefined;
|
|
123
141
|
}): boolean;
|
|
124
142
|
export declare function getOfferClaimIncrementFromStats({ stats, fallbackClaims, }: {
|
|
125
143
|
stats: Pick<IOfferStats, 'applicable_quantity' | 'redeemed_times'> | null | undefined;
|
|
126
144
|
fallbackClaims?: number;
|
|
127
145
|
}): number;
|
|
146
|
+
export declare function getOffersIdsHashKey(offerIds: (string | null | undefined)[] | null | undefined): string;
|
|
128
147
|
export declare function getSuppressedOfferIdsHashKey(suppressedOfferIds: Record<string, true> | null | undefined): string;
|
|
129
148
|
export declare function getAutoApplyOfferCandidates({ offersWithStats, suppressedOfferIds, }: {
|
|
130
149
|
offersWithStats: IOfferWithStats[] | null | undefined;
|
|
@@ -191,7 +210,7 @@ interface IGetOffersWithStats {
|
|
|
191
210
|
customer: Partial<ICustomer> | null;
|
|
192
211
|
vouchers: IVoucher[] | undefined;
|
|
193
212
|
giftCards: IGiftCard[] | undefined;
|
|
194
|
-
customerOfferRedemptionCounts:
|
|
213
|
+
customerOfferRedemptionCounts: ICustomerRedemptionCount | null | undefined;
|
|
195
214
|
redeemed_offers: IOrder['redeemed_offers'] | null | undefined;
|
|
196
215
|
platform: PLATFORMS_ENUM | undefined;
|
|
197
216
|
currency_symbol: ITenant['currency_symbol'] | undefined;
|