kcommons 5.22.6 → 5.23.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.
@@ -0,0 +1,14 @@
1
+ import { ICompanyVendor } from "../typings/companyVendors.typings";
2
+ import { IItem } from "../typings/item.typings";
3
+ import { SOCKET_EVENT } from "./socket.constants";
4
+ export interface IITEM_CSV_UPLOAD_PROGRESS_PAYLOAD {
5
+ event: SOCKET_EVENT.COMPANY_ITEM_UPLOAD_PROGRESS;
6
+ progress: number;
7
+ entity?: IItem;
8
+ }
9
+ export interface IVENDOR_CSV_UPLOAD_PROGRESS_PAYLOAD {
10
+ event: SOCKET_EVENT.COMPANY_VENDOR_UPLOAD_PROGRESS;
11
+ progress: number;
12
+ entity?: ICompanyVendor;
13
+ }
14
+ export type TCSVUploadProgressPayload = IVENDOR_CSV_UPLOAD_PROGRESS_PAYLOAD | IITEM_CSV_UPLOAD_PROGRESS_PAYLOAD;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export declare enum SOCKET_EVENT {
2
+ NOTIFICATION = "notification",
3
+ COMPANY_ITEM_UPLOAD_PROGRESS = "company_item_upload_progress",
4
+ COMPANY_VENDOR_UPLOAD_PROGRESS = "company_vendor_upload_progress"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SOCKET_EVENT = void 0;
4
+ var SOCKET_EVENT;
5
+ (function (SOCKET_EVENT) {
6
+ SOCKET_EVENT["NOTIFICATION"] = "notification";
7
+ SOCKET_EVENT["COMPANY_ITEM_UPLOAD_PROGRESS"] = "company_item_upload_progress";
8
+ SOCKET_EVENT["COMPANY_VENDOR_UPLOAD_PROGRESS"] = "company_vendor_upload_progress";
9
+ })(SOCKET_EVENT || (exports.SOCKET_EVENT = SOCKET_EVENT = {}));
package/build/index.d.ts CHANGED
@@ -41,8 +41,11 @@ export * from "./constants/form.constants";
41
41
  export * from "./constants/upload.constants";
42
42
  export * from "./constants/companyRoutes.constants";
43
43
  export * from "./constants/vendorRoutes.constants";
44
+ export * from "./constants/socket.constants";
45
+ export * from "./constants/csvUpload.constants";
44
46
  export * from "./classes/asnWrapper.class";
45
47
  export * from "./utils/permission.utils";
48
+ export * from "./utils/taxes.util";
46
49
  export * from "./templates/notifications/rfq.notifications";
47
50
  export * from "./templates/notifications/po.notifications";
48
51
  export * from "./templates/notifications/quote.notifications";
package/build/index.js CHANGED
@@ -59,10 +59,13 @@ __exportStar(require("./constants/form.constants"), exports);
59
59
  __exportStar(require("./constants/upload.constants"), exports);
60
60
  __exportStar(require("./constants/companyRoutes.constants"), exports);
61
61
  __exportStar(require("./constants/vendorRoutes.constants"), exports);
62
+ __exportStar(require("./constants/socket.constants"), exports);
63
+ __exportStar(require("./constants/csvUpload.constants"), exports);
62
64
  // Classes
63
65
  __exportStar(require("./classes/asnWrapper.class"), exports);
64
66
  // Utils
65
67
  __exportStar(require("./utils/permission.utils"), exports);
68
+ __exportStar(require("./utils/taxes.util"), exports);
66
69
  // Templates
67
70
  __exportStar(require("./templates/notifications/rfq.notifications"), exports);
68
71
  __exportStar(require("./templates/notifications/po.notifications"), exports);
@@ -0,0 +1,2 @@
1
+ import { ITaxRelatedItemInputs } from "../typings/docItems.typings";
2
+ export declare function getDiscountedPerUnitRate(item: ITaxRelatedItemInputs): number | null | undefined;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDiscountedPerUnitRate = getDiscountedPerUnitRate;
4
+ const documentTaxes_typings_1 = require("../typings/documentTaxes.typings");
5
+ function getDiscountedPerUnitRate(item) {
6
+ if (!item.per_unit_rate)
7
+ return item.per_unit_rate;
8
+ if (item.discount_value && item.discount_type) {
9
+ if (item.discount_type === documentTaxes_typings_1.TAX_TYPE.FIXED) {
10
+ return item.per_unit_rate - item.discount_value;
11
+ }
12
+ else if (item.discount_type === documentTaxes_typings_1.TAX_TYPE.PERCENTAGE) {
13
+ return item.per_unit_rate * (1 - item.discount_value / 100);
14
+ }
15
+ }
16
+ else {
17
+ return item.per_unit_rate;
18
+ }
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kcommons",
3
- "version": "5.22.6",
3
+ "version": "5.23.0",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.js",