@managesome/eposmatic-toolkit 0.3.10 → 0.3.11

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.
Files changed (94) hide show
  1. package/esm/constants/ENUMS.js +17 -1988
  2. package/esm/constants/enums/cash.js +45 -0
  3. package/esm/constants/enums/communications.js +329 -0
  4. package/esm/constants/enums/delivery.js +35 -0
  5. package/esm/constants/enums/geo.js +150 -0
  6. package/esm/constants/enums/hr.js +130 -0
  7. package/esm/constants/enums/internal.js +132 -0
  8. package/esm/constants/enums/items.js +126 -0
  9. package/esm/constants/enums/misc.js +35 -0
  10. package/esm/constants/enums/offers.js +102 -0
  11. package/esm/constants/enums/order.js +135 -0
  12. package/esm/constants/enums/payments.js +186 -0
  13. package/esm/constants/enums/platform.js +215 -0
  14. package/esm/constants/enums/printing.js +107 -0
  15. package/esm/constants/enums/users.js +245 -0
  16. package/esm/constants/enums/wallet.js +32 -0
  17. package/esm/helpers/store/cart-actions.js +1 -1
  18. package/esm/helpers/store/common-tenant-purchase-order-actions.js +7 -7
  19. package/esm/helpers/store/common-warehouse-purchase-order-actions.js +1 -1
  20. package/esm/helpers/store/common-warehouse-purchase-order-rfq-actions.js +1 -1
  21. package/esm/helpers/store/common-warehouse-sale-order-actions.js +1 -1
  22. package/esm/helpers/store/common-warehouse-sale-order-rfq-actions.js +1 -1
  23. package/esm/helpers/store/offline-ordering.js +1 -1
  24. package/esm/helpers/store/tenant-purchase-orders-cart-actions.js +1 -1
  25. package/esm/helpers/store/warehouse-purchase-order-rfq-cart-actions.js +1 -1
  26. package/esm/helpers/store/warehouse-purchase-orders-cart-actions.js +1 -1
  27. package/esm/helpers/store/warehouse-sale-order-rfq-cart-actions.js +1 -1
  28. package/esm/helpers/store/warehouse-sale-orders-cart-actions.js +1 -1
  29. package/esm/helpers/utils/cancellation-helpers.js +7 -0
  30. package/esm/helpers/utils/common.js +0 -46
  31. package/esm/helpers/utils/getFormFieldsDiff.js +1 -1
  32. package/esm/helpers/utils/index.js +2 -0
  33. package/esm/helpers/utils/phone-helpers.js +40 -0
  34. package/esm/helpers/utils/receipt-engine.js +3 -1
  35. package/esm/helpers/utils/specials-helpers.js +1 -1
  36. package/esm/helpers/utils/void-items-report-helpers.js +2 -1
  37. package/lib/constants/ENUMS.d.ts +15 -1275
  38. package/lib/constants/ENUMS.js +31 -1994
  39. package/lib/constants/enums/cash.d.ts +35 -0
  40. package/lib/constants/enums/cash.js +48 -0
  41. package/lib/constants/enums/communications.d.ts +79 -0
  42. package/lib/constants/enums/communications.js +332 -0
  43. package/lib/constants/enums/delivery.d.ts +26 -0
  44. package/lib/constants/enums/delivery.js +38 -0
  45. package/lib/constants/enums/geo.d.ts +133 -0
  46. package/lib/constants/enums/geo.js +153 -0
  47. package/lib/constants/enums/hr.d.ts +105 -0
  48. package/lib/constants/enums/hr.js +133 -0
  49. package/lib/constants/enums/internal.d.ts +104 -0
  50. package/lib/constants/enums/internal.js +135 -0
  51. package/lib/constants/enums/items.d.ts +94 -0
  52. package/lib/constants/enums/items.js +129 -0
  53. package/lib/constants/enums/misc.d.ts +25 -0
  54. package/lib/constants/enums/misc.js +38 -0
  55. package/lib/constants/enums/offers.d.ts +80 -0
  56. package/lib/constants/enums/offers.js +105 -0
  57. package/lib/constants/enums/order.d.ts +108 -0
  58. package/lib/constants/enums/order.js +138 -0
  59. package/lib/constants/enums/payments.d.ts +129 -0
  60. package/lib/constants/enums/payments.js +189 -0
  61. package/lib/constants/enums/platform.d.ts +100 -0
  62. package/lib/constants/enums/platform.js +218 -0
  63. package/lib/constants/enums/printing.d.ts +89 -0
  64. package/lib/constants/enums/printing.js +110 -0
  65. package/lib/constants/enums/users.d.ts +142 -0
  66. package/lib/constants/enums/users.js +248 -0
  67. package/lib/constants/enums/wallet.d.ts +26 -0
  68. package/lib/constants/enums/wallet.js +35 -0
  69. package/lib/helpers/store/cart-actions.js +6 -6
  70. package/lib/helpers/store/common-tenant-purchase-order-actions.d.ts +2 -2
  71. package/lib/helpers/store/common-tenant-purchase-order-actions.js +10 -10
  72. package/lib/helpers/store/common-warehouse-purchase-order-actions.js +4 -4
  73. package/lib/helpers/store/common-warehouse-purchase-order-rfq-actions.js +4 -4
  74. package/lib/helpers/store/common-warehouse-sale-order-actions.js +4 -4
  75. package/lib/helpers/store/common-warehouse-sale-order-rfq-actions.js +4 -4
  76. package/lib/helpers/store/offline-ordering.js +2 -2
  77. package/lib/helpers/store/tenant-purchase-orders-cart-actions.js +2 -2
  78. package/lib/helpers/store/warehouse-purchase-order-rfq-cart-actions.js +2 -2
  79. package/lib/helpers/store/warehouse-purchase-orders-cart-actions.js +2 -2
  80. package/lib/helpers/store/warehouse-sale-order-rfq-cart-actions.js +2 -2
  81. package/lib/helpers/store/warehouse-sale-orders-cart-actions.js +2 -2
  82. package/lib/helpers/utils/cancellation-helpers.d.ts +1 -0
  83. package/lib/helpers/utils/cancellation-helpers.js +13 -0
  84. package/lib/helpers/utils/common.d.ts +0 -6
  85. package/lib/helpers/utils/common.js +1 -54
  86. package/lib/helpers/utils/getFormFieldsDiff.js +5 -2
  87. package/lib/helpers/utils/index.d.ts +2 -0
  88. package/lib/helpers/utils/index.js +2 -0
  89. package/lib/helpers/utils/phone-helpers.d.ts +5 -0
  90. package/lib/helpers/utils/phone-helpers.js +46 -0
  91. package/lib/helpers/utils/receipt-engine.js +4 -2
  92. package/lib/helpers/utils/specials-helpers.js +2 -2
  93. package/lib/helpers/utils/void-items-report-helpers.js +3 -2
  94. package/package.json +1 -1
@@ -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 lodash_1 = require("lodash");
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, lodash_1.isEqual)(getUpdatedPurchaseOrderRfqItem(itm), updatedItem)) {
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 lodash_1 = require("lodash");
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, lodash_1.isEqual)(getUpdatedPurchaseOrderItem(itm), updatedItem)) {
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 lodash_1 = require("lodash");
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, lodash_1.isEqual)(getUpdatedSaleOrderRfqItem(itm), updatedItem)) {
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 lodash_1 = require("lodash");
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, lodash_1.isEqual)(getUpdatedSaleOrderItem(itm), updatedItem)) {
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 = exports.phoneUtil = void 0;
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 lodash_1 = require("lodash");
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, lodash_1.isEqual)(payload[key], defaultValues[key])) {
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
+ }
@@ -17,7 +17,9 @@ const moment_1 = __importDefault(require("moment"));
17
17
  const constants_1 = require("../../constants");
18
18
  const store_1 = require("../store");
19
19
  const cart_helpers_1 = require("./cart-helpers");
20
+ const cancellation_helpers_1 = require("./cancellation-helpers");
20
21
  const common_1 = require("./common");
22
+ const phone_helpers_1 = require("./phone-helpers");
21
23
  const payment_helpers_1 = require("./payment-helpers");
22
24
  // =========================><=========================
23
25
  function getDiscountLabel(discount_details) {
@@ -876,7 +878,7 @@ function receiptEngine(payload, mappedItems = {}) {
876
878
  let customerPhone = null;
877
879
  if (payload.order.consumer != null &&
878
880
  (payload.order.staff_details == null || payload.order.consumer.phone !== payload.order.staff_details.staff_mobile)) {
879
- const phoneNumber = (0, common_1.getNationalNumberFromPhone)(payload.order.consumer.phone);
881
+ const phoneNumber = (0, phone_helpers_1.getNationalNumberFromPhone)(payload.order.consumer.phone);
880
882
  customerName = `${payload.order.consumer.first_name} ${payload.order.consumer.last_name}`.trim();
881
883
  customerPhone = phoneNumber ?? payload.order.consumer.phone;
882
884
  }
@@ -932,7 +934,7 @@ function receiptEngine(payload, mappedItems = {}) {
932
934
  let delivery_instructions = null;
933
935
  let cancel_reason = null;
934
936
  if (payload.order.order_status === constants_1.ORDER_STATUS_ENUM.CANCELLED) {
935
- cancel_reason = (0, common_1.getFormattedCancellationReason)(payload.order.cancel_reason) ?? null;
937
+ cancel_reason = (0, cancellation_helpers_1.getFormattedCancellationReason)(payload.order.cancel_reason) ?? null;
936
938
  }
937
939
  else if (payload.order.delivery_details != null && payload.printer_settings.print_delivery_details) {
938
940
  delivery_instructions = `${payload.order.delivery_details.street}${payload.order.delivery_details.address_instructions.trim() !== ''
@@ -14,7 +14,7 @@ exports.convertSpecialItemToOrderItem = convertSpecialItemToOrderItem;
14
14
  exports.deStructureSpecialOrderItem = deStructureSpecialOrderItem;
15
15
  exports.convertSpecialToItem = convertSpecialToItem;
16
16
  const bson_objectid_1 = __importDefault(require("bson-objectid"));
17
- const lodash_1 = require("lodash");
17
+ const isEqual_1 = __importDefault(require("lodash/isEqual"));
18
18
  const constants_1 = require("../../constants");
19
19
  const store_1 = require("../store");
20
20
  const halfhalf_setup_helpers_1 = require("./halfhalf-setup-helpers");
@@ -318,7 +318,7 @@ function convertSpecialItemToOrderItem({ specialItem, modifierSpecials, quantity
318
318
  // (a mixed group stays as a free option + a paid option).
319
319
  const mergedEntries = [];
320
320
  for (const entry of entries) {
321
- const existing = mergedEntries.find((candidate) => candidate.option.is_free === entry.option.is_free && (0, lodash_1.isEqual)(candidate.comparable, entry.comparable));
321
+ const existing = mergedEntries.find((candidate) => candidate.option.is_free === entry.option.is_free && (0, isEqual_1.default)(candidate.comparable, entry.comparable));
322
322
  if (existing != null) {
323
323
  existing.option.quantity = (existing.option.quantity || 1) + (entry.option.quantity || 1);
324
324
  continue;
@@ -7,6 +7,7 @@ exports.getVoidItemsReportHtml = getVoidItemsReportHtml;
7
7
  exports.getVoidItemsReportReceiptHtml = getVoidItemsReportReceiptHtml;
8
8
  const moment_1 = __importDefault(require("moment"));
9
9
  const constants_1 = require("../../constants");
10
+ const cancellation_helpers_1 = require("./cancellation-helpers");
10
11
  const common_1 = require("./common");
11
12
  // Generate HTML template for void items report
12
13
  function getVoidItemsReportHtml(props) {
@@ -271,7 +272,7 @@ function getVoidItemsReportHtml(props) {
271
272
  <td>${item.name || 'N/A'}</td>
272
273
  ${hasPartyNameColumn ? `<td>${item.vendor_name || item.client_name || 'N/A'}</td>` : ''}
273
274
  <td class="text-right">${(0, common_1.localeAmount)(currency_symbol, voidAmount)}</td>
274
- <td class="void-reason">${item.void_reason ? (0, common_1.getFormattedCancellationReason)(item.void_reason) : 'N/A'}</td>
275
+ <td class="void-reason">${item.void_reason ? (0, cancellation_helpers_1.getFormattedCancellationReason)(item.void_reason) : 'N/A'}</td>
275
276
  <td>${item.staff_name || 'N/A'}</td>
276
277
  <td class="text-center">${item.quantity || 0}</td>
277
278
  <td class="text-center">${item.total_adjusted_quantity || 0}</td>
@@ -484,7 +485,7 @@ function getVoidItemsReportReceiptHtml(props) {
484
485
  <div class="item-detail reason">
485
486
  <span style='font-weight: bold;'>Reason:</span>
486
487
  <span class="reason-text">${(() => {
487
- const formattedReason = (0, common_1.getFormattedCancellationReason)(item.void_reason) || 'Unknown';
488
+ const formattedReason = (0, cancellation_helpers_1.getFormattedCancellationReason)(item.void_reason) || 'Unknown';
488
489
  return formattedReason.substring(0, 100) + (formattedReason.length > 100 ? '...' : '');
489
490
  })()}</span>
490
491
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "module": "esm/index.js",