kcommons 9.50.3 → 9.51.1

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 (29) hide show
  1. package/build/index.d.ts +7 -0
  2. package/build/index.js +10 -0
  3. package/build/typings/kpis/basKPIS.typings.d.ts +1 -1
  4. package/build/typings/kpis/company/item/issuanceVsProcurementRatio.typings.d.ts +2 -2
  5. package/build/typings/kpis/company/item/itemDashboardKPICards.typings.d.ts +2 -2
  6. package/build/typings/kpis/company/item/itemPurchaseTrend.typings.d.ts +2 -2
  7. package/build/typings/kpis/company/item/itempriceTrend.typings.d.ts +8 -8
  8. package/build/typings/kpis/company/item/stockTrend.typings.d.ts +2 -2
  9. package/build/typings/kpis/company/main/purchase/avgVendorResponseRatePerRFQKPI.typings.d.ts +2 -2
  10. package/build/typings/kpis/company/main/purchase/purchaseTrend.typings.d.ts +2 -2
  11. package/build/typings/kpis/company/main/purchase/topProcurementCategories.typings.d.ts +2 -2
  12. package/build/typings/kpis/company/main/purchase/totalSavings.typings.d.ts +2 -2
  13. package/build/typings/kpis/company/main/vendors/topCategoryvendorDistribution.typings.d.ts +2 -2
  14. package/build/typings/kpis/company/vendor/companyVendorPurchaseFlow.typings.d.ts +22 -0
  15. package/build/typings/kpis/company/vendor/companyVendorPurchaseFlow.typings.js +2 -0
  16. package/build/typings/kpis/company/vendor/companyVendornegotiationgain.typings.d.ts +13 -0
  17. package/build/typings/kpis/company/vendor/companyVendornegotiationgain.typings.js +2 -0
  18. package/build/typings/kpis/company/vendor/topCompanyVendorItemCategories.typings.d.ts +11 -0
  19. package/build/typings/kpis/company/vendor/topCompanyVendorItemCategories.typings.js +2 -0
  20. package/build/typings/kpis/company/vendor/topCompanyVendorItems.typings.d.ts +14 -0
  21. package/build/typings/kpis/company/vendor/topCompanyVendorItems.typings.js +2 -0
  22. package/build/typings/kpis/company/vendor/topvendorItems.typings.d.ts +13 -0
  23. package/build/typings/kpis/company/vendor/topvendorItems.typings.js +2 -0
  24. package/build/typings/kpis/company/vendor/totalBusiness.typings.d.ts +14 -0
  25. package/build/typings/kpis/company/vendor/totalBusiness.typings.js +2 -0
  26. package/build/typings/quote.typings.d.ts +2 -0
  27. package/build/utils/convertDurationToreadableFormat.util.d.ts +1 -0
  28. package/build/utils/convertDurationToreadableFormat.util.js +72 -0
  29. package/package.json +2 -1
package/build/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from "date-fns";
1
2
  export * from "./typings/roles.typings";
2
3
  export * from "./typings/companyVendors.typings";
3
4
  export * from "./typings/department.typings";
@@ -75,6 +76,7 @@ export * from "./utils/getMediaName.util";
75
76
  export * from "./utils/removeQueryParamsFromReqStr.util";
76
77
  export * from "./utils/toFixedDecimal.util";
77
78
  export * from "./utils/convertToINS.util";
79
+ export * from "./utils/convertDurationToreadableFormat.util";
78
80
  export * from "./typings/verification_apis/pincode.typings";
79
81
  export * from "./typings/verification_apis/gstVerification.typings";
80
82
  export * from "./typings/verification_apis/udyamVerification.typings";
@@ -88,6 +90,11 @@ export * from "./typings/kpis/company/item/itemDashboardKPICards.typings";
88
90
  export * from "./typings/kpis/company/item/issuanceVsProcurementRatio.typings";
89
91
  export * from "./typings/kpis/company/item/itemPurchaseTrend.typings";
90
92
  export * from "./typings/kpis/company/item/stockTrend.typings";
93
+ export * from "./typings/kpis/company/vendor/totalBusiness.typings";
94
+ export * from "./typings/kpis/company/vendor/companyVendorPurchaseFlow.typings";
95
+ export * from "./typings/kpis/company/vendor/topCompanyVendorItems.typings";
96
+ export * from "./typings/kpis/company/vendor/topCompanyVendorItemCategories.typings";
97
+ export * from "./typings/kpis/company/vendor/companyVendornegotiationgain.typings";
91
98
  export * from "./typings/kpis/company/companyKpisCommons.typings";
92
99
  export * from "./typings/kpis/vendor/vendorKpisCommons.typings";
93
100
  export * from "./typings/kpis/company/testKpi.typings";
package/build/index.js CHANGED
@@ -14,6 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ // Libraries
18
+ __exportStar(require("date-fns"), exports);
17
19
  // Includes
18
20
  __exportStar(require("./typings/roles.typings"), exports);
19
21
  __exportStar(require("./typings/companyVendors.typings"), exports);
@@ -96,6 +98,7 @@ __exportStar(require("./utils/getMediaName.util"), exports);
96
98
  __exportStar(require("./utils/removeQueryParamsFromReqStr.util"), exports);
97
99
  __exportStar(require("./utils/toFixedDecimal.util"), exports);
98
100
  __exportStar(require("./utils/convertToINS.util"), exports);
101
+ __exportStar(require("./utils/convertDurationToreadableFormat.util"), exports);
99
102
  // Templates
100
103
  // Verification APIs
101
104
  __exportStar(require("./typings/verification_apis/pincode.typings"), exports);
@@ -114,9 +117,16 @@ __exportStar(require("./typings/kpis/company/item/itemDashboardKPICards.typings"
114
117
  __exportStar(require("./typings/kpis/company/item/issuanceVsProcurementRatio.typings"), exports);
115
118
  __exportStar(require("./typings/kpis/company/item/itemPurchaseTrend.typings"), exports);
116
119
  __exportStar(require("./typings/kpis/company/item/stockTrend.typings"), exports);
120
+ // Company Vendor Dashboard KPIs
121
+ __exportStar(require("./typings/kpis/company/vendor/totalBusiness.typings"), exports);
122
+ __exportStar(require("./typings/kpis/company/vendor/companyVendorPurchaseFlow.typings"), exports);
123
+ __exportStar(require("./typings/kpis/company/vendor/topCompanyVendorItems.typings"), exports);
124
+ __exportStar(require("./typings/kpis/company/vendor/topCompanyVendorItemCategories.typings"), exports);
125
+ __exportStar(require("./typings/kpis/company/vendor/companyVendornegotiationgain.typings"), exports);
117
126
  // Common KPIs
118
127
  __exportStar(require("./typings/kpis/company/companyKpisCommons.typings"), exports);
119
128
  __exportStar(require("./typings/kpis/vendor/vendorKpisCommons.typings"), exports);
129
+ ``;
120
130
  // Company KPIs
121
131
  __exportStar(require("./typings/kpis/company/testKpi.typings"), exports);
122
132
  __exportStar(require("./typings/kpis/company/purchase/testPuchaseKpi.typings"), exports);
@@ -1,4 +1,4 @@
1
- export interface IBaseKPIProps {
1
+ export interface IBaseKPIFilters {
2
2
  company_id: string;
3
3
  start_date: string;
4
4
  end_date: string;
@@ -1,5 +1,5 @@
1
- import { IBaseKPIProps } from "../../basKPIS.typings";
2
- export interface IIssuanceVsProcurementRatioReq extends IBaseKPIProps {
1
+ import { IBaseKPIFilters } from "../../basKPIS.typings";
2
+ export interface IIssuanceVsProcurementRatioReq extends IBaseKPIFilters {
3
3
  item_id: string;
4
4
  }
5
5
  export interface IItemIssuanceVsProcurementRatioData {
@@ -1,5 +1,5 @@
1
- import { IBaseKPIProps } from "../../basKPIS.typings";
2
- export interface IItemDashboardKPICardsReq extends IBaseKPIProps {
1
+ import { IBaseKPIFilters } from "../../basKPIS.typings";
2
+ export interface IItemDashboardKPICardsReq extends IBaseKPIFilters {
3
3
  item_id: string;
4
4
  }
5
5
  export interface IItemDashboardKPICardsData {
@@ -1,5 +1,5 @@
1
- import { IBaseKPIProps } from "../../basKPIS.typings";
2
- export interface IItemPurchaseTrendReqFilters extends IBaseKPIProps {
1
+ import { IBaseKPIFilters } from "../../basKPIS.typings";
2
+ export interface IItemPurchaseTrendReqFilters extends IBaseKPIFilters {
3
3
  item_id: string;
4
4
  }
5
5
  export interface IItemPurchaseTrendData {
@@ -1,11 +1,11 @@
1
- import { IBaseKPIProps } from "../../basKPIS.typings";
2
- export interface IItemPriceTrendReqFilters extends IBaseKPIProps {
3
- item_id: string;
1
+ import { IBaseKPIFilters } from "../../basKPIS.typings";
2
+ export interface IItemPriceTrendReqFilters extends IBaseKPIFilters {
3
+ item_id: string;
4
4
  }
5
5
  export interface IItemPriceTrendData {
6
- data: {
7
- values: number[];
8
- labels: string[];
9
- average: number;
10
- };
6
+ data: {
7
+ values: number[];
8
+ labels: string[];
9
+ average: number;
10
+ };
11
11
  }
@@ -1,5 +1,5 @@
1
- import { IBaseKPIProps } from "../../basKPIS.typings";
2
- export interface IItemStockTrendKPIReqFilters extends IBaseKPIProps {
1
+ import { IBaseKPIFilters } from "../../basKPIS.typings";
2
+ export interface IItemStockTrendKPIReqFilters extends IBaseKPIFilters {
3
3
  item_id: string;
4
4
  }
5
5
  export interface IItemStockTrendKPIUnit {
@@ -1,4 +1,4 @@
1
- import { IBaseKPIProps } from "../../../basKPIS.typings";
1
+ import { IBaseKPIFilters } from "../../../basKPIS.typings";
2
2
  export interface IAvgVendorResponseRatePerRFQKPIUnit {
3
3
  xlabel: string;
4
4
  rfqs: number;
@@ -11,5 +11,5 @@ export interface IAvgVendorResponseRatePerRFQKPIResponse {
11
11
  data: IAvgVendorResponseRatePerRFQKPIUnit[];
12
12
  meta: IMetaFieldForAvgVendorResponseRAteKPI;
13
13
  }
14
- export interface IAvgVendorResponseRatePerRFQKPIReq extends IBaseKPIProps {
14
+ export interface IAvgVendorResponseRatePerRFQKPIReq extends IBaseKPIFilters {
15
15
  }
@@ -1,4 +1,4 @@
1
- import { IBaseKPIProps } from "../../../basKPIS.typings";
1
+ import { IBaseKPIFilters } from "../../../basKPIS.typings";
2
2
  export interface IPurchaseTrendKPIDataUnit {
3
3
  x: string;
4
4
  y: number;
@@ -6,5 +6,5 @@ export interface IPurchaseTrendKPIDataUnit {
6
6
  export interface IPurchaseTrendKPIResponse {
7
7
  data: IPurchaseTrendKPIDataUnit[];
8
8
  }
9
- export interface IPurchaseTrendKPIReq extends IBaseKPIProps {
9
+ export interface IPurchaseTrendKPIReq extends IBaseKPIFilters {
10
10
  }
@@ -1,5 +1,5 @@
1
- import { IBaseKPIProps } from "../../../basKPIS.typings";
2
- export interface ITopProcurementCategoriesKPIReq extends IBaseKPIProps {
1
+ import { IBaseKPIFilters } from "../../../basKPIS.typings";
2
+ export interface ITopProcurementCategoriesKPIReq extends IBaseKPIFilters {
3
3
  }
4
4
  export interface ITopProcurementCategoriesKPIUnit {
5
5
  name: string;
@@ -1,4 +1,4 @@
1
- import { IBaseKPIProps } from "../../../basKPIS.typings";
1
+ import { IBaseKPIFilters } from "../../../basKPIS.typings";
2
2
  export interface ITotalSavingsKPIDataUnit {
3
3
  x: string;
4
4
  y: number;
@@ -6,5 +6,5 @@ export interface ITotalSavingsKPIDataUnit {
6
6
  export interface ITotalSavingsKPIResponse {
7
7
  data: ITotalSavingsKPIDataUnit[];
8
8
  }
9
- export interface ITotalSavingsKPIReq extends IBaseKPIProps {
9
+ export interface ITotalSavingsKPIReq extends IBaseKPIFilters {
10
10
  }
@@ -1,6 +1,6 @@
1
- import { IBaseKPIProps } from "../../../basKPIS.typings";
1
+ import { IBaseKPIFilters } from "../../../basKPIS.typings";
2
2
  export interface ITopCategoryVendorDistributionKPIReq {
3
- company_id: IBaseKPIProps["company_id"];
3
+ company_id: IBaseKPIFilters["company_id"];
4
4
  }
5
5
  export interface ITopCategoryVendorDistributionKPIUnit {
6
6
  id: string;
@@ -0,0 +1,22 @@
1
+ import { IBaseKPIFilters } from "../../basKPIS.typings";
2
+ export interface ICompanyVendorPurchaseFlowKPIFilters extends Pick<IBaseKPIFilters, "company_id"> {
3
+ vendor_id: string;
4
+ }
5
+ export interface ICompanyVendorPurchaseFlowKPIResponse {
6
+ totals: {
7
+ rfq: number | null;
8
+ quoted: number | null;
9
+ po_send: number | null;
10
+ po_accepted: number | null;
11
+ };
12
+ avg_time_taken: {
13
+ rfq_quote: string | null;
14
+ quote_po_sent: string | null;
15
+ po_sent_po_accepted: string | null;
16
+ };
17
+ conversion_rate_percentage: {
18
+ rfq_quote: number | null;
19
+ quote_po_sent: number | null;
20
+ po_sent_po_accepted: number | null;
21
+ };
22
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ import { IBaseKPIFilters } from "../../basKPIS.typings";
2
+ export interface ICompanyVendorNegotiationGainKPIFilters extends Pick<IBaseKPIFilters, "company_id"> {
3
+ vendor_id: string;
4
+ }
5
+ export interface IRecentNegotiatedRFQData {
6
+ rfq_no: string;
7
+ savings: number | null;
8
+ }
9
+ export interface ICompanyVendorNegotiationGainKPIResponse {
10
+ avg_negotiation_gain_percentage: number | null;
11
+ total_amount_saved: number | null;
12
+ recent_negotiated_rfqs: IRecentNegotiatedRFQData[];
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ import { IBaseKPIFilters } from "../../basKPIS.typings";
2
+ export interface ITopCompanyVendorItemCategoriesKPIFilters extends IBaseKPIFilters {
3
+ company_vendor_id: string;
4
+ }
5
+ export interface ITopCompanyVendorItemCategoriesKPIResponseUnit {
6
+ category_name: string;
7
+ value: number;
8
+ }
9
+ export interface ITopCompanyVendorItemCategoriesKPIResponse {
10
+ data: ITopCompanyVendorItemCategoriesKPIResponseUnit[];
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ import { IBaseKPIFilters } from "../../basKPIS.typings";
2
+ export interface ITopCompanyVendorItemsKPIFilters extends IBaseKPIFilters {
3
+ company_vendor_id: string;
4
+ }
5
+ export interface ITopCompanyVendorItemsKPIResponseUnit {
6
+ item_name: string;
7
+ uom: string;
8
+ total_supplied_qty: number | null;
9
+ avg_per_unit_rate: number | null;
10
+ total_supplied_value: number | null;
11
+ }
12
+ export interface ITopCompanyVendorItemsKPIResponse {
13
+ data: ITopCompanyVendorItemsKPIResponseUnit[];
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ import { IBaseKPIFilters } from "../../basKPIS.typings";
2
+ export interface ITopVendorItemsKPIFilters extends IBaseKPIFilters {
3
+ company_vendor_id: string;
4
+ }
5
+ export interface ITopVendorItemsKPIResponseUnit {
6
+ item_name: string;
7
+ total_supplied_qty: number | null;
8
+ avg_per_unit_rate: number | null;
9
+ total_supplied_value: number | null;
10
+ }
11
+ export interface ITopVendorItemsKPIResponse {
12
+ data: ITopVendorItemsKPIResponseUnit[];
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ import { IBaseKPIFilters } from "../../basKPIS.typings";
2
+ export interface ITotalBusinessWithVendorKPIFilters extends Pick<IBaseKPIFilters, "company_id"> {
3
+ company_vendor_id: string;
4
+ }
5
+ export interface ITotalBusinessWithVendorKPIResponse {
6
+ total_business: {
7
+ value: number;
8
+ vendor_trade_name: string;
9
+ };
10
+ avg_po_value: {
11
+ avg_value: number;
12
+ total_po_count: number;
13
+ };
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -48,6 +48,8 @@ export interface IQuote {
48
48
  company_id: string;
49
49
  quote_no: string;
50
50
  is_quoted: boolean;
51
+ initial_total?: number | null;
52
+ initial_subtotal?: number | null;
51
53
  total?: number | null;
52
54
  subtotal?: number | null;
53
55
  delivery_by_date: string | null;
@@ -0,0 +1 @@
1
+ export declare function convertDurationToReadableFormat(diffMs: number): string;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertDurationToReadableFormat = convertDurationToReadableFormat;
4
+ function convertDurationToReadableFormat(diffMs) {
5
+ const MS = {
6
+ second: 1000,
7
+ minute: 1000 * 60,
8
+ hour: 1000 * 60 * 60,
9
+ day: 1000 * 60 * 60 * 24,
10
+ week: 1000 * 60 * 60 * 24 * 7,
11
+ month: 1000 * 60 * 60 * 24 * 30, // Approximation
12
+ };
13
+ const months = Math.floor(diffMs / MS.month);
14
+ diffMs %= MS.month;
15
+ const weeks = Math.floor(diffMs / MS.week);
16
+ diffMs %= MS.week;
17
+ const days = Math.floor(diffMs / MS.day);
18
+ diffMs %= MS.day;
19
+ const hours = Math.floor(diffMs / MS.hour);
20
+ diffMs %= MS.hour;
21
+ const minutes = Math.floor(diffMs / MS.minute);
22
+ diffMs %= MS.minute;
23
+ const seconds = Math.floor(diffMs / MS.second);
24
+ // Apply your rules
25
+ if (months > 0) {
26
+ return [
27
+ months > 0 ? `${months} month${months > 1 ? "s" : ""}` : "",
28
+ weeks > 0 ? `${weeks} week${weeks > 1 ? "s" : ""}` : "",
29
+ days > 0 ? `${days} day${days > 1 ? "s" : ""}` : "",
30
+ ]
31
+ .filter(Boolean)
32
+ .join(" ");
33
+ }
34
+ else if (weeks > 0) {
35
+ return [
36
+ weeks > 0 ? `${weeks} week${weeks > 1 ? "s" : ""}` : "",
37
+ days > 0 ? `${days} day${days > 1 ? "s" : ""}` : "",
38
+ ]
39
+ .filter(Boolean)
40
+ .join(" ");
41
+ }
42
+ else if (days > 0) {
43
+ return [
44
+ days > 0 ? `${days} day${days > 1 ? "s" : ""}` : "",
45
+ hours > 0 ? `${hours} hr${hours > 1 ? "s" : ""}` : "",
46
+ ]
47
+ .filter(Boolean)
48
+ .join(" ");
49
+ }
50
+ else if (hours > 0) {
51
+ return [
52
+ hours > 0 ? `${hours} hr${hours > 1 ? "s" : ""}` : "",
53
+ minutes > 0 ? `${minutes} min` : "",
54
+ ]
55
+ .filter(Boolean)
56
+ .join(" ");
57
+ }
58
+ else {
59
+ return [
60
+ minutes > 0 ? `${minutes} min` : "",
61
+ seconds > 0 ? `${seconds} sec` : "",
62
+ ]
63
+ .filter(Boolean)
64
+ .join(" ");
65
+ }
66
+ }
67
+ // // Example usage
68
+ // const start = new Date('2025-08-01T10:00:00Z');
69
+ // const end = new Date('2025-08-09T16:30:45Z');
70
+ // console.log(formatDurationBetween(start, end)); // "1 week 1 day"
71
+ // console.log(formatDurationBetween(new Date(), new Date(Date.now() + 90 * 60 * 1000))); // "1 hr 30 min"
72
+ // console.log(formatDurationBetween(new Date(), new Date(Date.now() + 50 * 1000))); // "50 sec"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kcommons",
3
- "version": "9.50.3",
3
+ "version": "9.51.1",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -13,6 +13,7 @@
13
13
  "author": "",
14
14
  "license": "ISC",
15
15
  "dependencies": {
16
+ "date-fns": "^4.1.0",
16
17
  "uuid": "^11.1.0"
17
18
  }
18
19
  }