@managesome/eposmatic-toolkit 0.3.10 → 0.4.0
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/esm/constants/ENUMS.js +17 -1988
- package/esm/constants/MATERIALIZED_REPORTS.js +105 -0
- package/esm/constants/enums/cash.js +45 -0
- package/esm/constants/enums/communications.js +329 -0
- package/esm/constants/enums/delivery.js +35 -0
- package/esm/constants/enums/geo.js +150 -0
- package/esm/constants/enums/hr.js +130 -0
- package/esm/constants/enums/internal.js +132 -0
- package/esm/constants/enums/items.js +126 -0
- package/esm/constants/enums/misc.js +35 -0
- package/esm/constants/enums/offers.js +102 -0
- package/esm/constants/enums/order.js +135 -0
- package/esm/constants/enums/payments.js +186 -0
- package/esm/constants/enums/platform.js +215 -0
- package/esm/constants/enums/printing.js +107 -0
- package/esm/constants/enums/users.js +245 -0
- package/esm/constants/enums/wallet.js +32 -0
- package/esm/helpers/materialized-reports/index.js +5 -0
- package/esm/helpers/materialized-reports/key-helpers.js +59 -0
- package/esm/helpers/materialized-reports/materialized-tenant-reports-iterations-helpers.js +60 -0
- package/esm/helpers/materialized-reports/scope-helpers.js +107 -0
- package/esm/helpers/materialized-reports/tenant-sales-overview-close-day-helpers.js +251 -0
- package/esm/helpers/materialized-reports/tenant-sales-overview-helpers.js +860 -0
- package/esm/helpers/store/cart-actions.js +1 -1
- package/esm/helpers/store/common-tenant-purchase-order-actions.js +7 -7
- package/esm/helpers/store/common-warehouse-purchase-order-actions.js +1 -1
- package/esm/helpers/store/common-warehouse-purchase-order-rfq-actions.js +1 -1
- package/esm/helpers/store/common-warehouse-sale-order-actions.js +1 -1
- package/esm/helpers/store/common-warehouse-sale-order-rfq-actions.js +1 -1
- package/esm/helpers/store/offline-ordering.js +1 -1
- package/esm/helpers/store/tenant-purchase-orders-cart-actions.js +1 -1
- package/esm/helpers/store/warehouse-purchase-order-rfq-cart-actions.js +1 -1
- package/esm/helpers/store/warehouse-purchase-orders-cart-actions.js +1 -1
- package/esm/helpers/store/warehouse-sale-order-rfq-cart-actions.js +1 -1
- package/esm/helpers/store/warehouse-sale-orders-cart-actions.js +1 -1
- package/esm/helpers/utils/cancellation-helpers.js +7 -0
- package/esm/helpers/utils/common.js +0 -46
- package/esm/helpers/utils/getFormFieldsDiff.js +1 -1
- package/esm/helpers/utils/index.js +2 -0
- package/esm/helpers/utils/phone-helpers.js +40 -0
- package/esm/helpers/utils/receipt-engine.js +3 -1
- package/esm/helpers/utils/specials-helpers.js +1 -1
- package/esm/helpers/utils/void-items-report-helpers.js +2 -1
- package/esm/schemas/models/materialized_tenant_reports_iterations.js +82 -0
- package/esm/schemas/models/materialized_tenant_sales_overview_reports.js +399 -0
- package/esm/schemas/types/materialized_tenant_reports_iterations.js +1 -0
- package/esm/schemas/types/materialized_tenant_sales_overview_reports.js +1 -0
- package/lib/constants/ENUMS.d.ts +15 -1275
- package/lib/constants/ENUMS.js +31 -1994
- package/lib/constants/MATERIALIZED_REPORTS.d.ts +96 -0
- package/lib/constants/MATERIALIZED_REPORTS.js +108 -0
- package/lib/constants/enums/cash.d.ts +35 -0
- package/lib/constants/enums/cash.js +48 -0
- package/lib/constants/enums/communications.d.ts +79 -0
- package/lib/constants/enums/communications.js +332 -0
- package/lib/constants/enums/delivery.d.ts +26 -0
- package/lib/constants/enums/delivery.js +38 -0
- package/lib/constants/enums/geo.d.ts +133 -0
- package/lib/constants/enums/geo.js +153 -0
- package/lib/constants/enums/hr.d.ts +105 -0
- package/lib/constants/enums/hr.js +133 -0
- package/lib/constants/enums/internal.d.ts +104 -0
- package/lib/constants/enums/internal.js +135 -0
- package/lib/constants/enums/items.d.ts +94 -0
- package/lib/constants/enums/items.js +129 -0
- package/lib/constants/enums/misc.d.ts +25 -0
- package/lib/constants/enums/misc.js +38 -0
- package/lib/constants/enums/offers.d.ts +80 -0
- package/lib/constants/enums/offers.js +105 -0
- package/lib/constants/enums/order.d.ts +108 -0
- package/lib/constants/enums/order.js +138 -0
- package/lib/constants/enums/payments.d.ts +129 -0
- package/lib/constants/enums/payments.js +189 -0
- package/lib/constants/enums/platform.d.ts +100 -0
- package/lib/constants/enums/platform.js +218 -0
- package/lib/constants/enums/printing.d.ts +89 -0
- package/lib/constants/enums/printing.js +110 -0
- package/lib/constants/enums/users.d.ts +142 -0
- package/lib/constants/enums/users.js +248 -0
- package/lib/constants/enums/wallet.d.ts +26 -0
- package/lib/constants/enums/wallet.js +35 -0
- package/lib/helpers/materialized-reports/index.d.ts +5 -0
- package/lib/helpers/materialized-reports/index.js +21 -0
- package/lib/helpers/materialized-reports/key-helpers.d.ts +35 -0
- package/lib/helpers/materialized-reports/key-helpers.js +64 -0
- package/lib/helpers/materialized-reports/materialized-tenant-reports-iterations-helpers.d.ts +66 -0
- package/lib/helpers/materialized-reports/materialized-tenant-reports-iterations-helpers.js +63 -0
- package/lib/helpers/materialized-reports/scope-helpers.d.ts +57 -0
- package/lib/helpers/materialized-reports/scope-helpers.js +114 -0
- package/lib/helpers/materialized-reports/tenant-sales-overview-close-day-helpers.d.ts +125 -0
- package/lib/helpers/materialized-reports/tenant-sales-overview-close-day-helpers.js +256 -0
- package/lib/helpers/materialized-reports/tenant-sales-overview-helpers.d.ts +223 -0
- package/lib/helpers/materialized-reports/tenant-sales-overview-helpers.js +875 -0
- package/lib/helpers/store/cart-actions.js +6 -6
- package/lib/helpers/store/common-tenant-purchase-order-actions.d.ts +2 -2
- package/lib/helpers/store/common-tenant-purchase-order-actions.js +10 -10
- package/lib/helpers/store/common-warehouse-purchase-order-actions.js +4 -4
- package/lib/helpers/store/common-warehouse-purchase-order-rfq-actions.js +4 -4
- package/lib/helpers/store/common-warehouse-sale-order-actions.js +4 -4
- package/lib/helpers/store/common-warehouse-sale-order-rfq-actions.js +4 -4
- package/lib/helpers/store/offline-ordering.js +2 -2
- package/lib/helpers/store/tenant-purchase-orders-cart-actions.js +2 -2
- package/lib/helpers/store/warehouse-purchase-order-rfq-cart-actions.js +2 -2
- package/lib/helpers/store/warehouse-purchase-orders-cart-actions.js +2 -2
- package/lib/helpers/store/warehouse-sale-order-rfq-cart-actions.js +2 -2
- package/lib/helpers/store/warehouse-sale-orders-cart-actions.js +2 -2
- package/lib/helpers/utils/cancellation-helpers.d.ts +1 -0
- package/lib/helpers/utils/cancellation-helpers.js +13 -0
- package/lib/helpers/utils/common.d.ts +0 -6
- package/lib/helpers/utils/common.js +1 -54
- package/lib/helpers/utils/getFormFieldsDiff.js +5 -2
- package/lib/helpers/utils/index.d.ts +2 -0
- package/lib/helpers/utils/index.js +2 -0
- package/lib/helpers/utils/phone-helpers.d.ts +5 -0
- package/lib/helpers/utils/phone-helpers.js +46 -0
- package/lib/helpers/utils/receipt-engine.js +4 -2
- package/lib/helpers/utils/specials-helpers.js +2 -2
- package/lib/helpers/utils/void-items-report-helpers.js +3 -2
- package/lib/schemas/models/materialized_tenant_reports_iterations.d.ts +80 -0
- package/lib/schemas/models/materialized_tenant_reports_iterations.js +85 -0
- package/lib/schemas/models/materialized_tenant_sales_overview_reports.d.ts +569 -0
- package/lib/schemas/models/materialized_tenant_sales_overview_reports.js +402 -0
- package/lib/schemas/types/materialized_tenant_reports_iterations.d.ts +62 -0
- package/lib/schemas/types/materialized_tenant_reports_iterations.js +2 -0
- package/lib/schemas/types/materialized_tenant_sales_overview_reports.d.ts +242 -0
- package/lib/schemas/types/materialized_tenant_sales_overview_reports.js +3 -0
- package/lib/tests/materialized-reports/fixtures.d.ts +81 -0
- package/lib/tests/materialized-reports/fixtures.js +87 -0
- package/lib/tests/materialized-reports/fixtures.test.d.ts +1 -0
- package/lib/tests/materialized-reports/fixtures.test.js +123 -0
- package/lib/tests/materialized-reports/materialized-tenant-reports-iterations-helpers.test.d.ts +1 -0
- package/lib/tests/materialized-reports/materialized-tenant-reports-iterations-helpers.test.js +75 -0
- package/lib/tests/materialized-reports/materialized-tenant-reports-iterations-schema.test.d.ts +1 -0
- package/lib/tests/materialized-reports/materialized-tenant-reports-iterations-schema.test.js +73 -0
- package/lib/tests/materialized-reports/materialized-tenant-sales-overview-reports-schema.test.d.ts +1 -0
- package/lib/tests/materialized-reports/materialized-tenant-sales-overview-reports-schema.test.js +207 -0
- package/lib/tests/materialized-reports/sales-overview-baseline.test.d.ts +1 -0
- package/lib/tests/materialized-reports/sales-overview-baseline.test.js +326 -0
- package/lib/tests/materialized-reports/sales-overview-reference.d.ts +63 -0
- package/lib/tests/materialized-reports/sales-overview-reference.js +131 -0
- package/lib/tests/materialized-reports/tenant-sales-overview-close-day-helpers.test.d.ts +1 -0
- package/lib/tests/materialized-reports/tenant-sales-overview-close-day-helpers.test.js +335 -0
- package/lib/tests/materialized-reports/tenant-sales-overview-helpers.test.d.ts +1 -0
- package/lib/tests/materialized-reports/tenant-sales-overview-helpers.test.js +885 -0
- package/package.json +5 -2
|
@@ -33,7 +33,7 @@ exports.getRemoveAllOffersFromCartData = getRemoveAllOffersFromCartData;
|
|
|
33
33
|
exports.getClearVoucherCodeAndOffersFromCartData = getClearVoucherCodeAndOffersFromCartData;
|
|
34
34
|
exports.getResetRewardStateForNewCustomer = getResetRewardStateForNewCustomer;
|
|
35
35
|
const bson_objectid_1 = __importDefault(require("bson-objectid"));
|
|
36
|
-
const
|
|
36
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
37
37
|
const constants_1 = require("../../constants");
|
|
38
38
|
const utils_1 = require("../utils");
|
|
39
39
|
const offers_helpers_1 = require("../utils/offers-helpers");
|
|
@@ -1945,7 +1945,7 @@ function getOrderDataWithSyncedGiftCardRewardClaim({ data, rewardClaim, }) {
|
|
|
1945
1945
|
...(normalizedWalletRedemptions ?? {}),
|
|
1946
1946
|
gift_cards: nextGiftCardRedemptions,
|
|
1947
1947
|
});
|
|
1948
|
-
if ((0,
|
|
1948
|
+
if ((0, isEqual_1.default)(nextWalletRedemptions, normalizedWalletRedemptions)) {
|
|
1949
1949
|
return data;
|
|
1950
1950
|
}
|
|
1951
1951
|
return {
|
|
@@ -2075,7 +2075,7 @@ function getAddItemToCartData(data, payload, courses, listnerSettings, appliedCu
|
|
|
2075
2075
|
// We make sure that the item does not have loyalty_discount_id and voucher_discount_id
|
|
2076
2076
|
itm.item_discount_details?.loyalty_discount_id == null &&
|
|
2077
2077
|
itm.item_discount_details?.voucher_discount_id == null &&
|
|
2078
|
-
(0,
|
|
2078
|
+
(0, isEqual_1.default)(getComparableOrderItem(itm), comparableItem)) {
|
|
2079
2079
|
mainItemId = replace_id ?? itm._id;
|
|
2080
2080
|
const newQuantity = itemWithValidatedRewardClaim.quantity + itm.quantity;
|
|
2081
2081
|
allItems[j] = {
|
|
@@ -2995,7 +2995,7 @@ function getCartItemsObj({ currentIterationCategories, currentDineinCourses, pre
|
|
|
2995
2995
|
removedItems.push(prevItem);
|
|
2996
2996
|
}
|
|
2997
2997
|
// Step 2: Get the items that are same in the current iteration
|
|
2998
|
-
else if ((0,
|
|
2998
|
+
else if ((0, isEqual_1.default)((0, exports.getOrderItemComaparableData)(currentItem), (0, exports.getOrderItemComaparableData)(prevItem))) {
|
|
2999
2999
|
unChangedItems.push(prevItem);
|
|
3000
3000
|
}
|
|
3001
3001
|
// Step 3: Get the items that are present in the previous iteration but
|
|
@@ -3070,7 +3070,7 @@ function getCartItemsObj({ currentIterationCategories, currentDineinCourses, pre
|
|
|
3070
3070
|
// item_discount_details: prevItem.item_discount_details,
|
|
3071
3071
|
modifiers: prevItem.modifiers,
|
|
3072
3072
|
};
|
|
3073
|
-
const isBothEqual = (0,
|
|
3073
|
+
const isBothEqual = (0, isEqual_1.default)(curr, prev);
|
|
3074
3074
|
if (isBothEqual) {
|
|
3075
3075
|
unChangedItems.push(currentItem);
|
|
3076
3076
|
}
|
|
@@ -3138,7 +3138,7 @@ function getCartItemsObj({ currentIterationCategories, currentDineinCourses, pre
|
|
|
3138
3138
|
// item_discount_details: removedItem.item_discount_details,
|
|
3139
3139
|
modifiers: removedItem.modifiers,
|
|
3140
3140
|
};
|
|
3141
|
-
if ((0,
|
|
3141
|
+
if ((0, isEqual_1.default)(newI, removedI)) {
|
|
3142
3142
|
if (newItem.quantity === removedItem.quantity) {
|
|
3143
3143
|
newItemsMap[removedItem.item_id] = newItemsForItem.filter((item) => item._id !== newItem._id);
|
|
3144
3144
|
if (newItemsMap[removedItem.item_id].length === 0) {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { IOrderPayment, ITenantPurchaseOrder, ITenantPurchaseOrderCategory, ITenantPurchaseOrderItem, ITenantPurchaseOrderIteration } from '../../schemas';
|
|
2
|
+
import { SORT_TYPE_ENUM } from '../../constants';
|
|
3
|
+
import { ITenantGeneralPurchaseOrderItem, ITenantPurchaseOrderCartItemsObj } from '../types/tenant-purchase-order-cart-actions';
|
|
2
4
|
export declare function getTenantPurchaseOrderIterationsWithPrice(iterations?: ITenantPurchaseOrderIteration[] | undefined, writeable?: boolean): ITenantPurchaseOrderIteration[];
|
|
3
5
|
export declare function getTenantPurchaseOrderPaymentsWithPrice(payments: IOrderPayment[] | undefined, convertToPrice: (price: number) => number): IOrderPayment[];
|
|
4
6
|
export declare function getTenantPurchaseOrderItemsWithPrice(items: ITenantPurchaseOrderItem[] | undefined, convertToPrice: (price: number) => number): ITenantPurchaseOrderItem[];
|
|
@@ -7,8 +9,6 @@ export declare function getTenantPurchaseOrderWithPrice<T extends Partial<ITenan
|
|
|
7
9
|
export declare function syncTenantPurchaseOrderData(order: ITenantPurchaseOrder): ITenantPurchaseOrder;
|
|
8
10
|
export declare function skipItemMetadataFromTenantPurchaseOrderCategories(categories: ITenantPurchaseOrder['categories'], previousCategories?: ITenantPurchaseOrder['categories']): ITenantPurchaseOrder['categories'];
|
|
9
11
|
export declare function getTenantPurchaseOrderWithAllFields<T extends ITenantPurchaseOrder | Partial<ITenantPurchaseOrder>>(order: T, skipItemMetadata?: boolean): T;
|
|
10
|
-
import { SORT_TYPE_ENUM } from '../../constants';
|
|
11
|
-
import { ITenantGeneralPurchaseOrderItem, ITenantPurchaseOrderCartItemsObj } from '../types/tenant-purchase-order-cart-actions';
|
|
12
12
|
interface IGetTenantPurchaseOrderCartItemsObjPayload {
|
|
13
13
|
currentIterationCategories: ITenantPurchaseOrderCategory[] | undefined;
|
|
14
14
|
previousIterationCategories: ITenantPurchaseOrderCategory[] | undefined;
|
|
@@ -16,6 +16,13 @@ exports.getVoidItemsWithReasonTenantPurchaseOrder = getVoidItemsWithReasonTenant
|
|
|
16
16
|
const utils_1 = require("../utils");
|
|
17
17
|
const common_order_actions_1 = require("./common-order-actions");
|
|
18
18
|
const tenant_purchase_orders_cart_actions_1 = require("./tenant-purchase-orders-cart-actions");
|
|
19
|
+
// ══════════════════════════════════════════════════════════════════════
|
|
20
|
+
// Cart Items Obj (moved from admin-panel utils)
|
|
21
|
+
// ══════════════════════════════════════════════════════════════════════
|
|
22
|
+
const bson_objectid_1 = __importDefault(require("bson-objectid"));
|
|
23
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
24
|
+
const constants_1 = require("../../constants");
|
|
25
|
+
const tenant_purchase_orders_cart_actions_2 = require("./tenant-purchase-orders-cart-actions");
|
|
19
26
|
function getTenantPurchaseOrderIterationsWithPrice(iterations, writeable) {
|
|
20
27
|
if (!iterations)
|
|
21
28
|
return [];
|
|
@@ -139,13 +146,6 @@ function getTenantPurchaseOrderWithAllFields(order, skipItemMetadata) {
|
|
|
139
146
|
cancel_reason: order['cancel_reason'] ?? null,
|
|
140
147
|
};
|
|
141
148
|
}
|
|
142
|
-
// ══════════════════════════════════════════════════════════════════════
|
|
143
|
-
// Cart Items Obj (moved from admin-panel utils)
|
|
144
|
-
// ══════════════════════════════════════════════════════════════════════
|
|
145
|
-
const bson_objectid_1 = __importDefault(require("bson-objectid"));
|
|
146
|
-
const lodash_1 = require("lodash");
|
|
147
|
-
const constants_1 = require("../../constants");
|
|
148
|
-
const tenant_purchase_orders_cart_actions_2 = require("./tenant-purchase-orders-cart-actions");
|
|
149
149
|
function getTenantPurchaseOrderCartItemsObj({ currentIterationCategories, previousIterationCategories, mappedItems, shouldSortItemsViaId = true, isAnEdit, sortType, }) {
|
|
150
150
|
const newMappedItems = { ...mappedItems };
|
|
151
151
|
if (Object.keys(newMappedItems).length === 0) {
|
|
@@ -242,7 +242,7 @@ function getTenantPurchaseOrderCartItemsObj({ currentIterationCategories, previo
|
|
|
242
242
|
if (currentItemsMap[prevItem._id] == null) {
|
|
243
243
|
removedItems.push(prevItem);
|
|
244
244
|
}
|
|
245
|
-
else if ((0,
|
|
245
|
+
else if ((0, isEqual_1.default)((0, tenant_purchase_orders_cart_actions_2.getTenantPurchaseOrderItemComparableData)(currentItem), (0, tenant_purchase_orders_cart_actions_2.getTenantPurchaseOrderItemComparableData)(prevItem))) {
|
|
246
246
|
unChangedItems.push(prevItem);
|
|
247
247
|
}
|
|
248
248
|
else {
|
|
@@ -291,7 +291,7 @@ function getTenantPurchaseOrderCartItemsObj({ currentIterationCategories, previo
|
|
|
291
291
|
name: prevItem.name,
|
|
292
292
|
special_instructions: prevItem.special_instructions,
|
|
293
293
|
};
|
|
294
|
-
if ((0,
|
|
294
|
+
if ((0, isEqual_1.default)(curr, prev)) {
|
|
295
295
|
unChangedItems.push(currentItem);
|
|
296
296
|
}
|
|
297
297
|
else {
|
|
@@ -330,7 +330,7 @@ function getTenantPurchaseOrderCartItemsObj({ currentIterationCategories, previo
|
|
|
330
330
|
price: removedItem.price,
|
|
331
331
|
special_instructions: removedItem.special_instructions,
|
|
332
332
|
};
|
|
333
|
-
if ((0,
|
|
333
|
+
if ((0, isEqual_1.default)(newI, removedI)) {
|
|
334
334
|
if (newItem.quantity === removedItem.quantity) {
|
|
335
335
|
newItemsMap[removedItem.item_id] = newItemsForItem.filter((item) => item._id !== newItem._id);
|
|
336
336
|
if (newItemsMap[removedItem.item_id].length === 0) {
|
|
@@ -14,7 +14,7 @@ exports.getWarehousePurchaseOrderWithAllFields = getWarehousePurchaseOrderWithAl
|
|
|
14
14
|
exports.getWarehousePurchaseOrderCartItemsObj = getWarehousePurchaseOrderCartItemsObj;
|
|
15
15
|
exports.getVoidItemsWithReasonWarehousePurchaseOrder = getVoidItemsWithReasonWarehousePurchaseOrder;
|
|
16
16
|
const bson_objectid_1 = __importDefault(require("bson-objectid"));
|
|
17
|
-
const
|
|
17
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
18
18
|
const constants_1 = require("../../constants");
|
|
19
19
|
const utils_1 = require("../utils");
|
|
20
20
|
const common_order_actions_1 = require("./common-order-actions");
|
|
@@ -268,7 +268,7 @@ function getWarehousePurchaseOrderCartItemsObj({ currentIterationCategories, pre
|
|
|
268
268
|
removedItems.push(prevItem);
|
|
269
269
|
}
|
|
270
270
|
// Step 2: Get the items that are same in the current iteration
|
|
271
|
-
else if ((0,
|
|
271
|
+
else if ((0, isEqual_1.default)((0, warehouse_purchase_orders_cart_actions_1.getWarehousePurchaseOrderItemComaparableData)(currentItem), (0, warehouse_purchase_orders_cart_actions_1.getWarehousePurchaseOrderItemComaparableData)(prevItem))) {
|
|
272
272
|
unChangedItems.push(prevItem);
|
|
273
273
|
}
|
|
274
274
|
// Step 3: Get the items that are present in the previous iteration but
|
|
@@ -335,7 +335,7 @@ function getWarehousePurchaseOrderCartItemsObj({ currentIterationCategories, pre
|
|
|
335
335
|
// quantity: number;
|
|
336
336
|
special_instructions: prevItem.special_instructions,
|
|
337
337
|
};
|
|
338
|
-
const isBothEqual = (0,
|
|
338
|
+
const isBothEqual = (0, isEqual_1.default)(curr, prev);
|
|
339
339
|
if (isBothEqual) {
|
|
340
340
|
unChangedItems.push(currentItem);
|
|
341
341
|
}
|
|
@@ -393,7 +393,7 @@ function getWarehousePurchaseOrderCartItemsObj({ currentIterationCategories, pre
|
|
|
393
393
|
// quantity: removedItem.quantity,
|
|
394
394
|
special_instructions: removedItem.special_instructions,
|
|
395
395
|
};
|
|
396
|
-
if ((0,
|
|
396
|
+
if ((0, isEqual_1.default)(newI, removedI)) {
|
|
397
397
|
if (newItem.quantity === removedItem.quantity) {
|
|
398
398
|
newItemsMap[removedItem.item_id] = newItemsForItem.filter((item) => item._id !== newItem._id);
|
|
399
399
|
if (newItemsMap[removedItem.item_id].length === 0) {
|
|
@@ -13,7 +13,7 @@ exports.getWarehousePurchaseOrderRfqWithAllFields = getWarehousePurchaseOrderRfq
|
|
|
13
13
|
exports.getWarehousePurchaseOrderRfqCartItemsObj = getWarehousePurchaseOrderRfqCartItemsObj;
|
|
14
14
|
exports.getVoidItemsWithReasonWarehousePurchaseOrderRfq = getVoidItemsWithReasonWarehousePurchaseOrderRfq;
|
|
15
15
|
const bson_objectid_1 = __importDefault(require("bson-objectid"));
|
|
16
|
-
const
|
|
16
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
17
17
|
const constants_1 = require("../../constants");
|
|
18
18
|
const utils_1 = require("../utils");
|
|
19
19
|
const warehouse_purchase_order_rfq_cart_actions_1 = require("./warehouse-purchase-order-rfq-cart-actions");
|
|
@@ -268,7 +268,7 @@ function getWarehousePurchaseOrderRfqCartItemsObj({ currentIterationCategories,
|
|
|
268
268
|
removedItems.push(prevItem);
|
|
269
269
|
}
|
|
270
270
|
// Step 2: Get the items that are same in the current iteration
|
|
271
|
-
else if ((0,
|
|
271
|
+
else if ((0, isEqual_1.default)(getRfqItemComparableData(currentItem), getRfqItemComparableData(prevItem))) {
|
|
272
272
|
unChangedItems.push(prevItem);
|
|
273
273
|
}
|
|
274
274
|
// Step 3: Get the items that are present in the previous iteration but
|
|
@@ -327,7 +327,7 @@ function getWarehousePurchaseOrderRfqCartItemsObj({ currentIterationCategories,
|
|
|
327
327
|
name: prevItem.name,
|
|
328
328
|
special_instructions: prevItem.special_instructions,
|
|
329
329
|
};
|
|
330
|
-
const isBothEqual = (0,
|
|
330
|
+
const isBothEqual = (0, isEqual_1.default)(curr, prev);
|
|
331
331
|
if (isBothEqual) {
|
|
332
332
|
unChangedItems.push(currentItem);
|
|
333
333
|
}
|
|
@@ -385,7 +385,7 @@ function getWarehousePurchaseOrderRfqCartItemsObj({ currentIterationCategories,
|
|
|
385
385
|
// quantity: removedItem.quantity,
|
|
386
386
|
special_instructions: removedItem.special_instructions,
|
|
387
387
|
};
|
|
388
|
-
if ((0,
|
|
388
|
+
if ((0, isEqual_1.default)(newI, removedI)) {
|
|
389
389
|
if (newItem.quantity === removedItem.quantity) {
|
|
390
390
|
newItemsMap[removedItem.item_id] = newItemsForItem.filter((item) => item._id !== newItem._id);
|
|
391
391
|
if (newItemsMap[removedItem.item_id].length === 0) {
|
|
@@ -14,7 +14,7 @@ exports.getWarehouseSaleOrderWithAllFields = getWarehouseSaleOrderWithAllFields;
|
|
|
14
14
|
exports.getWarehouseSaleOrderCartItemsObj = getWarehouseSaleOrderCartItemsObj;
|
|
15
15
|
exports.getVoidItemsWithReasonWarehouseSaleOrder = getVoidItemsWithReasonWarehouseSaleOrder;
|
|
16
16
|
const bson_objectid_1 = __importDefault(require("bson-objectid"));
|
|
17
|
-
const
|
|
17
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
18
18
|
const constants_1 = require("../../constants");
|
|
19
19
|
const utils_1 = require("../utils");
|
|
20
20
|
const common_order_actions_1 = require("./common-order-actions");
|
|
@@ -249,7 +249,7 @@ function getWarehouseSaleOrderCartItemsObj({ currentIterationCategories, previou
|
|
|
249
249
|
if (currentItemsMap[prevItem._id] == null) {
|
|
250
250
|
removedItems.push(prevItem);
|
|
251
251
|
}
|
|
252
|
-
else if ((0,
|
|
252
|
+
else if ((0, isEqual_1.default)((0, warehouse_sale_orders_cart_actions_1.getWarehouseSaleOrderItemComparableData)(currentItem), (0, warehouse_sale_orders_cart_actions_1.getWarehouseSaleOrderItemComparableData)(prevItem))) {
|
|
253
253
|
unChangedItems.push(prevItem);
|
|
254
254
|
}
|
|
255
255
|
else {
|
|
@@ -300,7 +300,7 @@ function getWarehouseSaleOrderCartItemsObj({ currentIterationCategories, previou
|
|
|
300
300
|
name: prevItem.name,
|
|
301
301
|
special_instructions: prevItem.special_instructions,
|
|
302
302
|
};
|
|
303
|
-
const isBothEqual = (0,
|
|
303
|
+
const isBothEqual = (0, isEqual_1.default)(curr, prev);
|
|
304
304
|
if (isBothEqual) {
|
|
305
305
|
unChangedItems.push(currentItem);
|
|
306
306
|
}
|
|
@@ -345,7 +345,7 @@ function getWarehouseSaleOrderCartItemsObj({ currentIterationCategories, previou
|
|
|
345
345
|
price: removedItem.price,
|
|
346
346
|
special_instructions: removedItem.special_instructions,
|
|
347
347
|
};
|
|
348
|
-
if ((0,
|
|
348
|
+
if ((0, isEqual_1.default)(newI, removedI)) {
|
|
349
349
|
if (newItem.quantity === removedItem.quantity) {
|
|
350
350
|
newItemsMap[removedItem.item_id] = newItemsForItem.filter((item) => item._id !== newItem._id);
|
|
351
351
|
if (newItemsMap[removedItem.item_id].length === 0) {
|
|
@@ -13,7 +13,7 @@ exports.getWarehouseSaleOrderRfqWithAllFields = getWarehouseSaleOrderRfqWithAllF
|
|
|
13
13
|
exports.getWarehouseSaleOrderRfqCartItemsObj = getWarehouseSaleOrderRfqCartItemsObj;
|
|
14
14
|
exports.getVoidItemsWithReasonWarehouseSaleOrderRfq = getVoidItemsWithReasonWarehouseSaleOrderRfq;
|
|
15
15
|
const bson_objectid_1 = __importDefault(require("bson-objectid"));
|
|
16
|
-
const
|
|
16
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
17
17
|
const constants_1 = require("../../constants");
|
|
18
18
|
const utils_1 = require("../utils");
|
|
19
19
|
const warehouse_sale_order_rfq_cart_actions_1 = require("./warehouse-sale-order-rfq-cart-actions");
|
|
@@ -268,7 +268,7 @@ function getWarehouseSaleOrderRfqCartItemsObj({ currentIterationCategories, prev
|
|
|
268
268
|
removedItems.push(prevItem);
|
|
269
269
|
}
|
|
270
270
|
// Step 2: Get the items that are same in the current iteration
|
|
271
|
-
else if ((0,
|
|
271
|
+
else if ((0, isEqual_1.default)(getSaleRfqItemComparableData(currentItem), getSaleRfqItemComparableData(prevItem))) {
|
|
272
272
|
unChangedItems.push(prevItem);
|
|
273
273
|
}
|
|
274
274
|
// Step 3: Get the items that are present in the previous iteration but
|
|
@@ -327,7 +327,7 @@ function getWarehouseSaleOrderRfqCartItemsObj({ currentIterationCategories, prev
|
|
|
327
327
|
name: prevItem.name,
|
|
328
328
|
special_instructions: prevItem.special_instructions,
|
|
329
329
|
};
|
|
330
|
-
const isBothEqual = (0,
|
|
330
|
+
const isBothEqual = (0, isEqual_1.default)(curr, prev);
|
|
331
331
|
if (isBothEqual) {
|
|
332
332
|
unChangedItems.push(currentItem);
|
|
333
333
|
}
|
|
@@ -385,7 +385,7 @@ function getWarehouseSaleOrderRfqCartItemsObj({ currentIterationCategories, prev
|
|
|
385
385
|
// quantity: removedItem.quantity,
|
|
386
386
|
special_instructions: removedItem.special_instructions,
|
|
387
387
|
};
|
|
388
|
-
if ((0,
|
|
388
|
+
if ((0, isEqual_1.default)(newI, removedI)) {
|
|
389
389
|
if (newItem.quantity === removedItem.quantity) {
|
|
390
390
|
newItemsMap[removedItem.item_id] = newItemsForItem.filter((item) => item._id !== newItem._id);
|
|
391
391
|
if (newItemsMap[removedItem.item_id].length === 0) {
|
|
@@ -7,7 +7,7 @@ exports.processPaymentsForOrder = processPaymentsForOrder;
|
|
|
7
7
|
exports.getMergedPayments = getMergedPayments;
|
|
8
8
|
exports.renderPostOfflineOrder = renderPostOfflineOrder;
|
|
9
9
|
exports.renderUpdateOfflineOrder = renderUpdateOfflineOrder;
|
|
10
|
-
const
|
|
10
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
11
11
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
12
12
|
const constants_1 = require("../../constants");
|
|
13
13
|
const utils_1 = require("../utils");
|
|
@@ -200,7 +200,7 @@ function renderUpdateOfflineOrder(body, prev) {
|
|
|
200
200
|
// or the dinein_details.courses has changed
|
|
201
201
|
coursesExist ||
|
|
202
202
|
// or the staff_details has changed
|
|
203
|
-
(staffDetailsExist && !(0,
|
|
203
|
+
(staffDetailsExist && !(0, isEqual_1.default)(copiedBody.staff_details, prevOrder.staff_details));
|
|
204
204
|
if (iterationNeedToBeAdded) {
|
|
205
205
|
const { newIterationCategories, voidOrderItems, hasNewItems } = (0, common_order_actions_1.getVoidItemsWithReason)({
|
|
206
206
|
currentCategories: copiedBody.categories ?? [],
|
|
@@ -14,7 +14,7 @@ exports.getUpdateItemsInTenantPurchaseOrderCartData = getUpdateItemsInTenantPurc
|
|
|
14
14
|
exports.getSplitTenantPurchaseOrderCartItemToTwo = getSplitTenantPurchaseOrderCartItemToTwo;
|
|
15
15
|
exports.getAddItemsToTenantPurchaseOrderCartData = getAddItemsToTenantPurchaseOrderCartData;
|
|
16
16
|
const bson_objectid_1 = __importDefault(require("bson-objectid"));
|
|
17
|
-
const
|
|
17
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
18
18
|
const constants_1 = require("../../constants");
|
|
19
19
|
const utils_1 = require("../utils");
|
|
20
20
|
function calculateCartTenantPurchaseOrderInfoAndSyncData(data, calculateItemMetadata) {
|
|
@@ -219,7 +219,7 @@ function getAddItemToTenantPurchaseOrderCartData(data, payload) {
|
|
|
219
219
|
for (let j = 0; j < allItems.length; j++) {
|
|
220
220
|
const itm = allItems[j];
|
|
221
221
|
if (itm.item_id === item.item_id &&
|
|
222
|
-
(0,
|
|
222
|
+
(0, isEqual_1.default)(getUpdatedTenantPurchaseOrderItem(itm), updatedItem)) {
|
|
223
223
|
allItems[j] = {
|
|
224
224
|
...item,
|
|
225
225
|
_id: replace_id ?? itm._id,
|
|
@@ -12,7 +12,7 @@ exports.getUpdateItemsInWarehousePurchaseOrderRfqCartData = getUpdateItemsInWare
|
|
|
12
12
|
exports.getSplitWarehousePurchaseOrderRfqCartItemToTwo = getSplitWarehousePurchaseOrderRfqCartItemToTwo;
|
|
13
13
|
exports.getAddItemsToWarehousePurchaseOrderRfqCartData = getAddItemsToWarehousePurchaseOrderRfqCartData;
|
|
14
14
|
const bson_objectid_1 = __importDefault(require("bson-objectid"));
|
|
15
|
-
const
|
|
15
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
16
16
|
const constants_1 = require("../../constants");
|
|
17
17
|
const utils_1 = require("../utils");
|
|
18
18
|
/* =================================================================
|
|
@@ -202,7 +202,7 @@ function getAddItemToWarehousePurchaseOrderRfqCartData(data, payload) {
|
|
|
202
202
|
if (!didFindItem && itemExists) {
|
|
203
203
|
for (let j = 0; j < allItems.length; j++) {
|
|
204
204
|
const itm = allItems[j];
|
|
205
|
-
if (itm.item_id === item.item_id && (0,
|
|
205
|
+
if (itm.item_id === item.item_id && (0, isEqual_1.default)(getUpdatedPurchaseOrderRfqItem(itm), updatedItem)) {
|
|
206
206
|
mainItemId = replace_id ?? itm._id;
|
|
207
207
|
allItems[j] = {
|
|
208
208
|
...item,
|
|
@@ -14,7 +14,7 @@ exports.getUpdateItemsInWarehousePurchaseOrderCartData = getUpdateItemsInWarehou
|
|
|
14
14
|
exports.getSplitWarehousePurchaseOrderCartItemToTwo = getSplitWarehousePurchaseOrderCartItemToTwo;
|
|
15
15
|
exports.getAddItemsToWarehousePurchaseOrderCartData = getAddItemsToWarehousePurchaseOrderCartData;
|
|
16
16
|
const bson_objectid_1 = __importDefault(require("bson-objectid"));
|
|
17
|
-
const
|
|
17
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
18
18
|
const constants_1 = require("../../constants");
|
|
19
19
|
const utils_1 = require("../utils");
|
|
20
20
|
function calculateCartWarehousePurchaseOrderInfoAndSyncData(data, calculateItemMetadata) {
|
|
@@ -258,7 +258,7 @@ function getAddItemToWarehousePurchaseOrderCartData(data, payload) {
|
|
|
258
258
|
if (!didFindItem && itemExists) {
|
|
259
259
|
for (let j = 0; j < totalItems; j++) {
|
|
260
260
|
const itm = allItems[j];
|
|
261
|
-
if (itm.item_id === item.item_id && (0,
|
|
261
|
+
if (itm.item_id === item.item_id && (0, isEqual_1.default)(getUpdatedPurchaseOrderItem(itm), updatedItem)) {
|
|
262
262
|
mainItemId = replace_id ?? itm._id;
|
|
263
263
|
allItems[j] = {
|
|
264
264
|
...item,
|
|
@@ -12,7 +12,7 @@ exports.getUpdateItemsInWarehouseSaleOrderRfqCartData = getUpdateItemsInWarehous
|
|
|
12
12
|
exports.getSplitWarehouseSaleOrderRfqCartItemToTwo = getSplitWarehouseSaleOrderRfqCartItemToTwo;
|
|
13
13
|
exports.getAddItemsToWarehouseSaleOrderRfqCartData = getAddItemsToWarehouseSaleOrderRfqCartData;
|
|
14
14
|
const bson_objectid_1 = __importDefault(require("bson-objectid"));
|
|
15
|
-
const
|
|
15
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
16
16
|
const constants_1 = require("../../constants");
|
|
17
17
|
const utils_1 = require("../utils");
|
|
18
18
|
/* =================================================================
|
|
@@ -201,7 +201,7 @@ function getAddItemToWarehouseSaleOrderRfqCartData(data, payload) {
|
|
|
201
201
|
if (!didFindItem && itemExists) {
|
|
202
202
|
for (let j = 0; j < allItems.length; j++) {
|
|
203
203
|
const itm = allItems[j];
|
|
204
|
-
if (itm.item_id === item.item_id && (0,
|
|
204
|
+
if (itm.item_id === item.item_id && (0, isEqual_1.default)(getUpdatedSaleOrderRfqItem(itm), updatedItem)) {
|
|
205
205
|
mainItemId = replace_id ?? itm._id;
|
|
206
206
|
allItems[j] = {
|
|
207
207
|
...item,
|
|
@@ -14,7 +14,7 @@ exports.getUpdateItemsInWarehouseSaleOrderCartData = getUpdateItemsInWarehouseSa
|
|
|
14
14
|
exports.getSplitWarehouseSaleOrderCartItemToTwo = getSplitWarehouseSaleOrderCartItemToTwo;
|
|
15
15
|
exports.getAddItemsToWarehouseSaleOrderCartData = getAddItemsToWarehouseSaleOrderCartData;
|
|
16
16
|
const bson_objectid_1 = __importDefault(require("bson-objectid"));
|
|
17
|
-
const
|
|
17
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
18
18
|
const constants_1 = require("../../constants");
|
|
19
19
|
const utils_1 = require("../utils");
|
|
20
20
|
function calculateCartWarehouseSaleOrderInfoAndSyncData(data, calculateItemMetadata) {
|
|
@@ -247,7 +247,7 @@ function getAddItemToWarehouseSaleOrderCartData(data, payload) {
|
|
|
247
247
|
if (!didFindItem && itemExists) {
|
|
248
248
|
for (let j = 0; j < totalItems; j++) {
|
|
249
249
|
const itm = allItems[j];
|
|
250
|
-
if (itm.item_id === item.item_id && (0,
|
|
250
|
+
if (itm.item_id === item.item_id && (0, isEqual_1.default)(getUpdatedSaleOrderItem(itm), updatedItem)) {
|
|
251
251
|
mainItemId = replace_id ?? itm._id;
|
|
252
252
|
allItems[j] = {
|
|
253
253
|
...item,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getFormattedCancellationReason(reason: string | null | undefined): string | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getFormattedCancellationReason = getFormattedCancellationReason;
|
|
7
|
+
const moment_1 = __importDefault(require("moment"));
|
|
8
|
+
// ==============================>><<==============================
|
|
9
|
+
function getFormattedCancellationReason(reason) {
|
|
10
|
+
if (!reason)
|
|
11
|
+
return;
|
|
12
|
+
return reason.replace(/(Cancelled at )(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z)/, (_, prefix, date) => `${prefix}${(0, moment_1.default)(date).format('lll')}`);
|
|
13
|
+
}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import { PhoneNumberUtil } from 'google-libphonenumber';
|
|
2
1
|
import { COUNTRY_ALPHA_2_ENUM, CURRENCY_SYMBOL_ENUM, SUBSCRIPTION_STATUS_ENUM, TAX_INVOICE_PROVIDER_ENUM } from '../../constants';
|
|
3
2
|
import { IOrderCategory } from '../../schemas';
|
|
4
|
-
export declare const phoneUtil: PhoneNumberUtil;
|
|
5
|
-
export declare function getNationalNumberFromPhone(phoneNumber: string, region?: string): string | null | undefined;
|
|
6
|
-
export declare function getIntNumberFromPhone(phoneNumber: string, region?: string): string | null;
|
|
7
|
-
export declare function getCountryCodeFromPhone(phoneNumber: string): number | null | undefined;
|
|
8
3
|
export declare function strToNum(str: string): number;
|
|
9
4
|
export declare function convertHoursToMilli(hours: number): number;
|
|
10
5
|
export declare function convertMinutesToMilli(minutes: number): number;
|
|
@@ -29,7 +24,6 @@ export declare const getOfflineOrderNumber: () => number;
|
|
|
29
24
|
export declare function sanitizeText(input: string): string;
|
|
30
25
|
export declare function getGSTName(country_alpha_2: COUNTRY_ALPHA_2_ENUM | undefined, tax_invoice_provider?: TAX_INVOICE_PROVIDER_ENUM | undefined): string;
|
|
31
26
|
export declare function getTaxNumberTitle(country_alpha_2: COUNTRY_ALPHA_2_ENUM | undefined, tax_invoice_provider: TAX_INVOICE_PROVIDER_ENUM | undefined): string;
|
|
32
|
-
export declare function getFormattedCancellationReason(reason: string | null | undefined): string | undefined;
|
|
33
27
|
export declare const formatAmount: (currencySymbol: CURRENCY_SYMBOL_ENUM | undefined, amount: number) => string;
|
|
34
28
|
export declare const getSubscriptionStatus: (subscription_expiry: Date | null | undefined) => SUBSCRIPTION_STATUS_ENUM;
|
|
35
29
|
export declare function formattedStoreName(name: string): string;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.formatFieldName = exports.getSubscriptionStatus = exports.formatAmount = exports.getOfflineOrderNumber = exports.isValidNumber =
|
|
7
|
-
exports.getNationalNumberFromPhone = getNationalNumberFromPhone;
|
|
8
|
-
exports.getIntNumberFromPhone = getIntNumberFromPhone;
|
|
9
|
-
exports.getCountryCodeFromPhone = getCountryCodeFromPhone;
|
|
3
|
+
exports.formatFieldName = exports.getSubscriptionStatus = exports.formatAmount = exports.getOfflineOrderNumber = exports.isValidNumber = void 0;
|
|
10
4
|
exports.strToNum = strToNum;
|
|
11
5
|
exports.convertHoursToMilli = convertHoursToMilli;
|
|
12
6
|
exports.convertMinutesToMilli = convertMinutesToMilli;
|
|
@@ -25,56 +19,14 @@ exports.localeAmount = localeAmount;
|
|
|
25
19
|
exports.sanitizeText = sanitizeText;
|
|
26
20
|
exports.getGSTName = getGSTName;
|
|
27
21
|
exports.getTaxNumberTitle = getTaxNumberTitle;
|
|
28
|
-
exports.getFormattedCancellationReason = getFormattedCancellationReason;
|
|
29
22
|
exports.formattedStoreName = formattedStoreName;
|
|
30
23
|
exports.getPercentage = getPercentage;
|
|
31
24
|
exports.getPercentageAmount = getPercentageAmount;
|
|
32
25
|
exports.getCappedOfferDiscountAmount = getCappedOfferDiscountAmount;
|
|
33
26
|
exports.calculateEligibleOfferDiscountDetails = calculateEligibleOfferDiscountDetails;
|
|
34
|
-
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
35
|
-
const moment_1 = __importDefault(require("moment"));
|
|
36
27
|
const constants_1 = require("../../constants");
|
|
37
28
|
const price_conversion_1 = require("./price-conversion");
|
|
38
29
|
const time_helpers_1 = require("./time-helpers");
|
|
39
|
-
exports.phoneUtil = google_libphonenumber_1.PhoneNumberUtil.getInstance();
|
|
40
|
-
function getNationalNumberFromPhone(phoneNumber, region) {
|
|
41
|
-
let phone = null;
|
|
42
|
-
try {
|
|
43
|
-
phone = exports.phoneUtil.parse(phoneNumber, region).getNationalNumber();
|
|
44
|
-
if (phone != null) {
|
|
45
|
-
phone = `0${phone.toString()}`;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
catch (e) {
|
|
49
|
-
phone = null;
|
|
50
|
-
}
|
|
51
|
-
return phone;
|
|
52
|
-
}
|
|
53
|
-
function getIntNumberFromPhone(phoneNumber, region) {
|
|
54
|
-
let phone = null;
|
|
55
|
-
try {
|
|
56
|
-
const parsedPhone = exports.phoneUtil.parse(phoneNumber, region);
|
|
57
|
-
phone = `${parsedPhone.getCountryCode() ?? ''}${parsedPhone.getNationalNumber() ?? ''}`;
|
|
58
|
-
if (phone) {
|
|
59
|
-
phone = `+${phone}`;
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
phone = null;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
catch (e) {
|
|
66
|
-
phone = null;
|
|
67
|
-
}
|
|
68
|
-
return phone;
|
|
69
|
-
}
|
|
70
|
-
function getCountryCodeFromPhone(phoneNumber) {
|
|
71
|
-
try {
|
|
72
|
-
return exports.phoneUtil.parse(phoneNumber).getCountryCode();
|
|
73
|
-
}
|
|
74
|
-
catch (e) {
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
30
|
// ==============================>><<==============================
|
|
79
31
|
function strToNum(str) {
|
|
80
32
|
const numStr = str.replace(/[^\d.-]/g, '');
|
|
@@ -299,11 +251,6 @@ function getTaxNumberTitle(country_alpha_2, tax_invoice_provider) {
|
|
|
299
251
|
return title;
|
|
300
252
|
}
|
|
301
253
|
// ==============================>><<==============================
|
|
302
|
-
function getFormattedCancellationReason(reason) {
|
|
303
|
-
if (!reason)
|
|
304
|
-
return;
|
|
305
|
-
return reason.replace(/(Cancelled at )(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z)/, (_, prefix, date) => `${prefix}${(0, moment_1.default)(date).format('lll')}`);
|
|
306
|
-
}
|
|
307
254
|
const formatAmount = (currencySymbol, amount) => localeAmount(currencySymbol, (0, price_conversion_1.convertPriceFromCents)(amount));
|
|
308
255
|
exports.formatAmount = formatAmount;
|
|
309
256
|
const getSubscriptionStatus = (subscription_expiry) => {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.getFormFieldsDiff = getFormFieldsDiff;
|
|
4
|
-
const
|
|
7
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
5
8
|
function getFormFieldsDiff(payload, defaultValues, blackList) {
|
|
6
9
|
const editedFormFields = {};
|
|
7
10
|
if (defaultValues) {
|
|
@@ -9,7 +12,7 @@ function getFormFieldsDiff(payload, defaultValues, blackList) {
|
|
|
9
12
|
if (blackList != null && blackList.includes(key)) {
|
|
10
13
|
continue;
|
|
11
14
|
}
|
|
12
|
-
if (!(0,
|
|
15
|
+
if (!(0, isEqual_1.default)(payload[key], defaultValues[key])) {
|
|
13
16
|
editedFormFields[key] = payload[key];
|
|
14
17
|
}
|
|
15
18
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './asaanbill-identifier-helpers';
|
|
2
2
|
export * from './business-day-helpers';
|
|
3
|
+
export * from './cancellation-helpers';
|
|
3
4
|
export * from './cart-helpers';
|
|
4
5
|
export * from './catalog-conversion';
|
|
5
6
|
export * from './code-redemption-helpers';
|
|
@@ -42,6 +43,7 @@ export * from './order-history';
|
|
|
42
43
|
export * from './payment-comparison-report-helpers';
|
|
43
44
|
export * from './payment-helpers';
|
|
44
45
|
export * from './pdf-generator';
|
|
46
|
+
export * from './phone-helpers';
|
|
45
47
|
export * from './platform-catalog';
|
|
46
48
|
export * from './platform-num';
|
|
47
49
|
export * from './platform-specific-tenant-shifts';
|
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./asaanbill-identifier-helpers"), exports);
|
|
18
18
|
__exportStar(require("./business-day-helpers"), exports);
|
|
19
|
+
__exportStar(require("./cancellation-helpers"), exports);
|
|
19
20
|
__exportStar(require("./cart-helpers"), exports);
|
|
20
21
|
__exportStar(require("./catalog-conversion"), exports);
|
|
21
22
|
__exportStar(require("./code-redemption-helpers"), exports);
|
|
@@ -58,6 +59,7 @@ __exportStar(require("./order-history"), exports);
|
|
|
58
59
|
__exportStar(require("./payment-comparison-report-helpers"), exports);
|
|
59
60
|
__exportStar(require("./payment-helpers"), exports);
|
|
60
61
|
__exportStar(require("./pdf-generator"), exports);
|
|
62
|
+
__exportStar(require("./phone-helpers"), exports);
|
|
61
63
|
__exportStar(require("./platform-catalog"), exports);
|
|
62
64
|
__exportStar(require("./platform-num"), exports);
|
|
63
65
|
__exportStar(require("./platform-specific-tenant-shifts"), exports);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PhoneNumberUtil } from 'google-libphonenumber';
|
|
2
|
+
export declare const phoneUtil: PhoneNumberUtil;
|
|
3
|
+
export declare function getNationalNumberFromPhone(phoneNumber: string, region?: string): string | null | undefined;
|
|
4
|
+
export declare function getIntNumberFromPhone(phoneNumber: string, region?: string): string | null;
|
|
5
|
+
export declare function getCountryCodeFromPhone(phoneNumber: string): number | null | undefined;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.phoneUtil = void 0;
|
|
4
|
+
exports.getNationalNumberFromPhone = getNationalNumberFromPhone;
|
|
5
|
+
exports.getIntNumberFromPhone = getIntNumberFromPhone;
|
|
6
|
+
exports.getCountryCodeFromPhone = getCountryCodeFromPhone;
|
|
7
|
+
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
8
|
+
exports.phoneUtil = google_libphonenumber_1.PhoneNumberUtil.getInstance();
|
|
9
|
+
function getNationalNumberFromPhone(phoneNumber, region) {
|
|
10
|
+
let phone = null;
|
|
11
|
+
try {
|
|
12
|
+
phone = exports.phoneUtil.parse(phoneNumber, region).getNationalNumber();
|
|
13
|
+
if (phone != null) {
|
|
14
|
+
phone = `0${phone.toString()}`;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
phone = null;
|
|
19
|
+
}
|
|
20
|
+
return phone;
|
|
21
|
+
}
|
|
22
|
+
function getIntNumberFromPhone(phoneNumber, region) {
|
|
23
|
+
let phone = null;
|
|
24
|
+
try {
|
|
25
|
+
const parsedPhone = exports.phoneUtil.parse(phoneNumber, region);
|
|
26
|
+
phone = `${parsedPhone.getCountryCode() ?? ''}${parsedPhone.getNationalNumber() ?? ''}`;
|
|
27
|
+
if (phone) {
|
|
28
|
+
phone = `+${phone}`;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
phone = null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
phone = null;
|
|
36
|
+
}
|
|
37
|
+
return phone;
|
|
38
|
+
}
|
|
39
|
+
function getCountryCodeFromPhone(phoneNumber) {
|
|
40
|
+
try {
|
|
41
|
+
return exports.phoneUtil.parse(phoneNumber).getCountryCode();
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|