hvp-shared 6.41.0 → 6.43.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,25 @@
1
+ /**
2
+ * HR Enums — shared across backend and frontend.
3
+ *
4
+ * These enums were previously duplicated in both repos.
5
+ * Single source of truth lives here in hvp-shared.
6
+ */
7
+ export declare enum PayrollStatus {
8
+ Pending = "pending",
9
+ Approved = "approved",
10
+ Paid = "paid",
11
+ Billed = "billed"
12
+ }
13
+ export declare enum CfdiStatus {
14
+ Pending = "pending",
15
+ Ready = "ready",
16
+ Stamped = "stamped",
17
+ StampedExternal = "stamped_external",
18
+ Cancelled = "cancelled",
19
+ Error = "error"
20
+ }
21
+ export declare enum HRPaymentType {
22
+ HOURLY = "HOURLY",
23
+ SALARY = "SALARY",
24
+ INFORMAL = "INFORMAL"
25
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ /**
3
+ * HR Enums — shared across backend and frontend.
4
+ *
5
+ * These enums were previously duplicated in both repos.
6
+ * Single source of truth lives here in hvp-shared.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.HRPaymentType = exports.CfdiStatus = exports.PayrollStatus = void 0;
10
+ var PayrollStatus;
11
+ (function (PayrollStatus) {
12
+ PayrollStatus["Pending"] = "pending";
13
+ PayrollStatus["Approved"] = "approved";
14
+ PayrollStatus["Paid"] = "paid";
15
+ PayrollStatus["Billed"] = "billed";
16
+ })(PayrollStatus || (exports.PayrollStatus = PayrollStatus = {}));
17
+ var CfdiStatus;
18
+ (function (CfdiStatus) {
19
+ CfdiStatus["Pending"] = "pending";
20
+ CfdiStatus["Ready"] = "ready";
21
+ CfdiStatus["Stamped"] = "stamped";
22
+ CfdiStatus["StampedExternal"] = "stamped_external";
23
+ CfdiStatus["Cancelled"] = "cancelled";
24
+ CfdiStatus["Error"] = "error";
25
+ })(CfdiStatus || (exports.CfdiStatus = CfdiStatus = {}));
26
+ var HRPaymentType;
27
+ (function (HRPaymentType) {
28
+ HRPaymentType["HOURLY"] = "HOURLY";
29
+ HRPaymentType["SALARY"] = "SALARY";
30
+ HRPaymentType["INFORMAL"] = "INFORMAL";
31
+ })(HRPaymentType || (exports.HRPaymentType = HRPaymentType = {}));
@@ -14,3 +14,4 @@ export * from './background-job.constants';
14
14
  export * from './job-category.constants';
15
15
  export * from './special-collaborators.constants';
16
16
  export * from './commissions.constants';
17
+ export * from './hr.enums';
@@ -30,3 +30,4 @@ __exportStar(require("./background-job.constants"), exports);
30
30
  __exportStar(require("./job-category.constants"), exports);
31
31
  __exportStar(require("./special-collaborators.constants"), exports);
32
32
  __exportStar(require("./commissions.constants"), exports);
33
+ __exportStar(require("./hr.enums"), exports);
@@ -4,12 +4,8 @@
4
4
  * Each item is self-describing: carries SAT codes, taxed/exempt split,
5
5
  * source key for internal reference, and an optional formula explaining
6
6
  * how the amount was calculated.
7
- *
8
- * NOTE: CfdiStatus and PayrollStatus enums are NOT imported here because
9
- * they live in repo-specific enum files (used in 19+ files each). Instead,
10
- * the `status` and `payrollStatus` fields use `string`, which is compatible
11
- * since TypeScript string enum values ARE strings.
12
7
  */
8
+ import { CfdiStatus, PayrollStatus } from '../constants/hr.enums';
13
9
  export declare enum PayrollItemCategory {
14
10
  BASE_SALARY = "BASE_SALARY",
15
11
  ADDITIONAL_FIXED = "ADDITIONAL_FIXED",
@@ -88,22 +84,46 @@ export interface PayrollEmployeeSnapshot {
88
84
  readonly positionRisk?: string;
89
85
  }
90
86
  export interface PayrollV2Cfdi {
91
- /** CfdiStatus value — typed as string to avoid coupling to repo-specific enums */
92
- readonly status: string;
87
+ readonly status: CfdiStatus;
93
88
  readonly uuid?: string;
94
89
  readonly facturamaId?: string;
95
90
  readonly stampedAt?: Date | string;
96
91
  readonly cancelledAt?: Date | string;
97
92
  readonly errorMessage?: string;
98
93
  }
94
+ /**
95
+ * A named amount concept (bonus, deduction, etc.).
96
+ * Mirrors the PayrollConcept shape used in both frontend and backend.
97
+ */
98
+ export interface PayrollConceptDto {
99
+ readonly name: string;
100
+ readonly description?: string;
101
+ readonly amount: number;
102
+ }
103
+ /**
104
+ * The subset of payroll fields that users can edit directly.
105
+ * Everything else is calculated by the V2 engine.
106
+ *
107
+ * Used by:
108
+ * - PATCH /payrolls/:id/v2 (save edits)
109
+ * - POST /payrolls/recalculate-v2 (preview recalculation)
110
+ * - Frontend edit form state
111
+ */
112
+ export interface PayrollEditableOverrides {
113
+ readonly specialBonuses?: PayrollConceptDto[];
114
+ readonly endYearBonus?: number;
115
+ readonly extraVariableCompensations?: PayrollConceptDto[];
116
+ readonly profitSharing?: number;
117
+ readonly otherFixedDeductions?: PayrollConceptDto[];
118
+ readonly otherVariableDeductions?: PayrollConceptDto[];
119
+ }
99
120
  export interface PayrollV2 {
100
121
  readonly collaboratorId?: string;
101
122
  readonly employmentId?: string;
102
123
  readonly jobId?: string;
103
124
  readonly periodStartDate?: string;
104
125
  readonly periodEndDate?: string;
105
- /** PayrollStatus value — typed as string to avoid coupling to repo-specific enums */
106
- readonly payrollStatus?: string;
126
+ readonly payrollStatus?: PayrollStatus;
107
127
  readonly daysPaid?: number;
108
128
  readonly perceptions: PayrollItem[];
109
129
  readonly deductions: PayrollItem[];
@@ -5,11 +5,6 @@
5
5
  * Each item is self-describing: carries SAT codes, taxed/exempt split,
6
6
  * source key for internal reference, and an optional formula explaining
7
7
  * how the amount was calculated.
8
- *
9
- * NOTE: CfdiStatus and PayrollStatus enums are NOT imported here because
10
- * they live in repo-specific enum files (used in 19+ files each). Instead,
11
- * the `status` and `payrollStatus` fields use `string`, which is compatible
12
- * since TypeScript string enum values ARE strings.
13
8
  */
14
9
  Object.defineProperty(exports, "__esModule", { value: true });
15
10
  exports.PayrollItemCategory = void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hvp-shared",
3
- "version": "6.41.0",
3
+ "version": "6.43.0",
4
4
  "description": "Shared types and utilities for HVP backend and frontend",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",