hvp-shared 2.0.1 → 3.0.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,5 @@
1
+ /**
2
+ * Constants barrel export for hvp-shared
3
+ */
4
+ export * from './mexican-states';
5
+ export * from './sat-catalogs';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * Constants barrel export for hvp-shared
19
+ */
20
+ __exportStar(require("./mexican-states"), exports);
21
+ __exportStar(require("./sat-catalogs"), exports);
@@ -1,43 +1,61 @@
1
1
  /**
2
- * Mexican States - Official INEGI codes
3
- * Used for address validation
2
+ * Mexican States - SAT Federal Entity Codes (c_Estado)
3
+ *
4
+ * Using SAT codes instead of INEGI codes for CFDI compatibility.
5
+ * These codes are required for electronic invoicing (CFDI) in Mexico.
6
+ *
7
+ * @see SAT Catalog: http://omawww.sat.gob.mx/tramitesyservicios/Paginas/anexo_20_version3-3.htm
4
8
  */
5
9
  export declare const MEXICAN_STATES: {
6
- readonly AGS: "Aguascalientes";
7
- readonly BC: "Baja California";
10
+ readonly AGU: "Aguascalientes";
11
+ readonly BCN: "Baja California";
8
12
  readonly BCS: "Baja California Sur";
9
- readonly CAMP: "Campeche";
10
- readonly CHIS: "Chiapas";
11
- readonly CHIH: "Chihuahua";
12
- readonly COAH: "Coahuila";
13
+ readonly CAM: "Campeche";
14
+ readonly CHP: "Chiapas";
15
+ readonly CHH: "Chihuahua";
16
+ readonly COA: "Coahuila de Zaragoza";
13
17
  readonly COL: "Colima";
14
- readonly CDMX: "Ciudad de México";
15
- readonly DGO: "Durango";
16
- readonly GTO: "Guanajuato";
18
+ readonly DIF: "Ciudad de México";
19
+ readonly DUR: "Durango";
20
+ readonly GUA: "Guanajuato";
17
21
  readonly GRO: "Guerrero";
18
- readonly HGO: "Hidalgo";
22
+ readonly HID: "Hidalgo";
19
23
  readonly JAL: "Jalisco";
20
24
  readonly MEX: "Estado de México";
21
- readonly MICH: "Michoacán";
25
+ readonly MIC: "Michoacán de Ocampo";
22
26
  readonly MOR: "Morelos";
23
27
  readonly NAY: "Nayarit";
24
- readonly NL: "Nuevo León";
28
+ readonly NLE: "Nuevo León";
25
29
  readonly OAX: "Oaxaca";
26
30
  readonly PUE: "Puebla";
27
- readonly QRO: "Querétaro";
28
- readonly QROO: "Quintana Roo";
31
+ readonly QUE: "Querétaro";
32
+ readonly ROO: "Quintana Roo";
29
33
  readonly SLP: "San Luis Potosí";
30
34
  readonly SIN: "Sinaloa";
31
35
  readonly SON: "Sonora";
32
36
  readonly TAB: "Tabasco";
33
- readonly TAMPS: "Tamaulipas";
34
- readonly TLAX: "Tlaxcala";
35
- readonly VER: "Veracruz";
37
+ readonly TAM: "Tamaulipas";
38
+ readonly TLA: "Tlaxcala";
39
+ readonly VER: "Veracruz de Ignacio de la Llave";
36
40
  readonly YUC: "Yucatán";
37
41
  readonly ZAC: "Zacatecas";
38
42
  };
39
43
  export type MexicanStateCode = keyof typeof MEXICAN_STATES;
44
+ /**
45
+ * Helper array for frontend dropdowns
46
+ * Sorted alphabetically by state name for better UX
47
+ */
40
48
  export declare const MEXICAN_STATES_ARRAY: {
41
49
  code: MexicanStateCode;
42
- name: "Aguascalientes" | "Baja California" | "Baja California Sur" | "Campeche" | "Chiapas" | "Chihuahua" | "Coahuila" | "Colima" | "Ciudad de México" | "Durango" | "Guanajuato" | "Guerrero" | "Hidalgo" | "Jalisco" | "Estado de México" | "Michoacán" | "Morelos" | "Nayarit" | "Nuevo León" | "Oaxaca" | "Puebla" | "Querétaro" | "Quintana Roo" | "San Luis Potosí" | "Sinaloa" | "Sonora" | "Tabasco" | "Tamaulipas" | "Tlaxcala" | "Veracruz" | "Yucatán" | "Zacatecas";
50
+ name: "Aguascalientes" | "Baja California" | "Baja California Sur" | "Campeche" | "Chiapas" | "Chihuahua" | "Coahuila de Zaragoza" | "Colima" | "Ciudad de México" | "Durango" | "Guanajuato" | "Guerrero" | "Hidalgo" | "Jalisco" | "Estado de México" | "Michoacán de Ocampo" | "Morelos" | "Nayarit" | "Nuevo León" | "Oaxaca" | "Puebla" | "Querétaro" | "Quintana Roo" | "San Luis Potosí" | "Sinaloa" | "Sonora" | "Tabasco" | "Tamaulipas" | "Tlaxcala" | "Veracruz de Ignacio de la Llave" | "Yucatán" | "Zacatecas";
43
51
  }[];
52
+ /**
53
+ * Migration helper: INEGI to SAT code mapping
54
+ * Use this for database migrations from old INEGI codes to SAT codes
55
+ */
56
+ export declare const INEGI_TO_SAT_CODE_MAP: Record<string, MexicanStateCode>;
57
+ /**
58
+ * Convert INEGI code to SAT code
59
+ * Returns the code unchanged if already a valid SAT code
60
+ */
61
+ export declare function toSATStateCode(code: string): MexicanStateCode | null;
@@ -1,46 +1,107 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MEXICAN_STATES_ARRAY = exports.MEXICAN_STATES = void 0;
3
+ exports.INEGI_TO_SAT_CODE_MAP = exports.MEXICAN_STATES_ARRAY = exports.MEXICAN_STATES = void 0;
4
+ exports.toSATStateCode = toSATStateCode;
4
5
  /**
5
- * Mexican States - Official INEGI codes
6
- * Used for address validation
6
+ * Mexican States - SAT Federal Entity Codes (c_Estado)
7
+ *
8
+ * Using SAT codes instead of INEGI codes for CFDI compatibility.
9
+ * These codes are required for electronic invoicing (CFDI) in Mexico.
10
+ *
11
+ * @see SAT Catalog: http://omawww.sat.gob.mx/tramitesyservicios/Paginas/anexo_20_version3-3.htm
7
12
  */
8
13
  exports.MEXICAN_STATES = {
9
- AGS: 'Aguascalientes',
10
- BC: 'Baja California',
14
+ AGU: 'Aguascalientes',
15
+ BCN: 'Baja California',
11
16
  BCS: 'Baja California Sur',
12
- CAMP: 'Campeche',
13
- CHIS: 'Chiapas',
14
- CHIH: 'Chihuahua',
15
- COAH: 'Coahuila',
17
+ CAM: 'Campeche',
18
+ CHP: 'Chiapas',
19
+ CHH: 'Chihuahua',
20
+ COA: 'Coahuila de Zaragoza',
16
21
  COL: 'Colima',
17
- CDMX: 'Ciudad de México',
18
- DGO: 'Durango',
19
- GTO: 'Guanajuato',
22
+ DIF: 'Ciudad de México', // Distrito Federal in SAT codes
23
+ DUR: 'Durango',
24
+ GUA: 'Guanajuato',
20
25
  GRO: 'Guerrero',
21
- HGO: 'Hidalgo',
26
+ HID: 'Hidalgo',
22
27
  JAL: 'Jalisco',
23
28
  MEX: 'Estado de México',
24
- MICH: 'Michoacán',
29
+ MIC: 'Michoacán de Ocampo',
25
30
  MOR: 'Morelos',
26
31
  NAY: 'Nayarit',
27
- NL: 'Nuevo León',
32
+ NLE: 'Nuevo León',
28
33
  OAX: 'Oaxaca',
29
34
  PUE: 'Puebla',
30
- QRO: 'Querétaro',
31
- QROO: 'Quintana Roo',
35
+ QUE: 'Querétaro',
36
+ ROO: 'Quintana Roo',
32
37
  SLP: 'San Luis Potosí',
33
38
  SIN: 'Sinaloa',
34
39
  SON: 'Sonora',
35
40
  TAB: 'Tabasco',
36
- TAMPS: 'Tamaulipas',
37
- TLAX: 'Tlaxcala',
38
- VER: 'Veracruz',
41
+ TAM: 'Tamaulipas',
42
+ TLA: 'Tlaxcala',
43
+ VER: 'Veracruz de Ignacio de la Llave',
39
44
  YUC: 'Yucatán',
40
- ZAC: 'Zacatecas'
45
+ ZAC: 'Zacatecas',
41
46
  };
42
- // Helper array for frontend dropdowns
43
- exports.MEXICAN_STATES_ARRAY = Object.entries(exports.MEXICAN_STATES).map(([code, name]) => ({
47
+ /**
48
+ * Helper array for frontend dropdowns
49
+ * Sorted alphabetically by state name for better UX
50
+ */
51
+ exports.MEXICAN_STATES_ARRAY = Object.entries(exports.MEXICAN_STATES)
52
+ .map(([code, name]) => ({
44
53
  code: code,
45
- name
46
- }));
54
+ name,
55
+ }))
56
+ .sort((a, b) => a.name.localeCompare(b.name, 'es'));
57
+ /**
58
+ * Migration helper: INEGI to SAT code mapping
59
+ * Use this for database migrations from old INEGI codes to SAT codes
60
+ */
61
+ exports.INEGI_TO_SAT_CODE_MAP = {
62
+ AGS: 'AGU',
63
+ BC: 'BCN',
64
+ BCS: 'BCS',
65
+ CAMP: 'CAM',
66
+ CHIS: 'CHP',
67
+ CHIH: 'CHH',
68
+ COAH: 'COA',
69
+ COL: 'COL',
70
+ CDMX: 'DIF',
71
+ DGO: 'DUR',
72
+ GTO: 'GUA',
73
+ GRO: 'GRO',
74
+ HGO: 'HID',
75
+ JAL: 'JAL',
76
+ MEX: 'MEX',
77
+ MICH: 'MIC',
78
+ MOR: 'MOR',
79
+ NAY: 'NAY',
80
+ NL: 'NLE',
81
+ OAX: 'OAX',
82
+ PUE: 'PUE',
83
+ QRO: 'QUE',
84
+ QROO: 'ROO',
85
+ SLP: 'SLP',
86
+ SIN: 'SIN',
87
+ SON: 'SON',
88
+ TAB: 'TAB',
89
+ TAMPS: 'TAM',
90
+ TLAX: 'TLA',
91
+ VER: 'VER',
92
+ YUC: 'YUC',
93
+ ZAC: 'ZAC',
94
+ };
95
+ /**
96
+ * Convert INEGI code to SAT code
97
+ * Returns the code unchanged if already a valid SAT code
98
+ */
99
+ function toSATStateCode(code) {
100
+ const upperCode = code.toUpperCase();
101
+ // Check if already a valid SAT code
102
+ if (upperCode in exports.MEXICAN_STATES) {
103
+ return upperCode;
104
+ }
105
+ // Try to convert from INEGI
106
+ return exports.INEGI_TO_SAT_CODE_MAP[upperCode] || null;
107
+ }
@@ -0,0 +1,183 @@
1
+ /**
2
+ * SAT Catalog Constants for CFDI Nómina (Payroll)
3
+ *
4
+ * Based on SAT catalogs for electronic payroll invoicing (CFDI 4.0)
5
+ * These codes are required for CFDI compliance in Mexico.
6
+ *
7
+ * @see SAT Catalogs: http://omawww.sat.gob.mx/tramitesyservicios/Paginas/anexo_20_version3-3.htm
8
+ */
9
+ /**
10
+ * SAT Contract Type codes (c_TipoContrato)
11
+ */
12
+ export declare const SATContractType: {
13
+ readonly Permanent: "01";
14
+ readonly Temporary: "02";
15
+ readonly SeasonOrCycle: "03";
16
+ readonly Training: "04";
17
+ readonly InitialTraining: "05";
18
+ readonly HomeBased: "06";
19
+ readonly TrialPeriod: "07";
20
+ readonly RetiredPayments: "08";
21
+ readonly Retirement: "09";
22
+ readonly Other: "99";
23
+ };
24
+ export type SATContractTypeCode = (typeof SATContractType)[keyof typeof SATContractType];
25
+ /**
26
+ * Contract type labels in Spanish for UI dropdowns
27
+ */
28
+ export declare const SAT_CONTRACT_TYPE_LABELS: Record<SATContractTypeCode, string>;
29
+ /**
30
+ * Contract types array for dropdowns
31
+ */
32
+ export declare const SAT_CONTRACT_TYPES_ARRAY: {
33
+ code: SATContractTypeCode;
34
+ label: string;
35
+ }[];
36
+ /**
37
+ * SAT Regime Type codes (c_TipoRegimen)
38
+ * Employment regime types for payroll
39
+ */
40
+ export declare const SATRegimeType: {
41
+ readonly Salaries: "02";
42
+ readonly Retirement: "03";
43
+ readonly Pensions: "04";
44
+ readonly Assimilated: "05";
45
+ readonly BoardMembers: "06";
46
+ readonly Fees: "07";
47
+ readonly CommissionAgents: "08";
48
+ readonly AssimilatedOther: "09";
49
+ readonly Retirement402: "10";
50
+ readonly Syndicate: "11";
51
+ readonly Severance: "12";
52
+ readonly DeathBenefit: "13";
53
+ };
54
+ export type SATRegimeTypeCode = (typeof SATRegimeType)[keyof typeof SATRegimeType];
55
+ /**
56
+ * Regime type labels in Spanish for UI dropdowns
57
+ */
58
+ export declare const SAT_REGIME_TYPE_LABELS: Record<SATRegimeTypeCode, string>;
59
+ /**
60
+ * Regime types array for dropdowns
61
+ */
62
+ export declare const SAT_REGIME_TYPES_ARRAY: {
63
+ code: SATRegimeTypeCode;
64
+ label: string;
65
+ }[];
66
+ /**
67
+ * SAT Journey/Workday Type codes (c_TipoJornada)
68
+ */
69
+ export declare const SATJourneyType: {
70
+ readonly Day: "01";
71
+ readonly Night: "02";
72
+ readonly Mixed: "03";
73
+ readonly ByHour: "04";
74
+ readonly Reduced: "05";
75
+ readonly Continuous: "06";
76
+ readonly Split: "07";
77
+ readonly ByTurn: "08";
78
+ readonly Other: "99";
79
+ };
80
+ export type SATJourneyTypeCode = (typeof SATJourneyType)[keyof typeof SATJourneyType];
81
+ /**
82
+ * Journey type labels in Spanish for UI dropdowns
83
+ */
84
+ export declare const SAT_JOURNEY_TYPE_LABELS: Record<SATJourneyTypeCode, string>;
85
+ /**
86
+ * Journey types array for dropdowns
87
+ */
88
+ export declare const SAT_JOURNEY_TYPES_ARRAY: {
89
+ code: SATJourneyTypeCode;
90
+ label: string;
91
+ }[];
92
+ /**
93
+ * SAT Payment Frequency codes (c_PeriodicidadPago)
94
+ */
95
+ export declare const SATPaymentFrequency: {
96
+ readonly Daily: "01";
97
+ readonly Weekly: "02";
98
+ readonly Biweekly: "03";
99
+ readonly Quincenal: "04";
100
+ readonly Monthly: "05";
101
+ readonly Bimonthly: "06";
102
+ readonly ByUnit: "07";
103
+ readonly ByCommission: "08";
104
+ readonly ByPrice: "09";
105
+ readonly Decennial: "10";
106
+ readonly Other: "99";
107
+ };
108
+ export type SATPaymentFrequencyCode = (typeof SATPaymentFrequency)[keyof typeof SATPaymentFrequency];
109
+ /**
110
+ * Payment frequency labels in Spanish for UI dropdowns
111
+ */
112
+ export declare const SAT_PAYMENT_FREQUENCY_LABELS: Record<SATPaymentFrequencyCode, string>;
113
+ /**
114
+ * Payment frequencies array for dropdowns
115
+ */
116
+ export declare const SAT_PAYMENT_FREQUENCIES_ARRAY: {
117
+ code: SATPaymentFrequencyCode;
118
+ label: string;
119
+ }[];
120
+ /**
121
+ * SAT Fiscal Regime codes for employees (c_RegimenFiscal)
122
+ * Subset of fiscal regimes applicable to payroll
123
+ */
124
+ export declare const SATFiscalRegime: {
125
+ readonly SalariesAndWages: "605";
126
+ readonly WithoutFiscalObligations: "616";
127
+ };
128
+ export type SATFiscalRegimeCode = (typeof SATFiscalRegime)[keyof typeof SATFiscalRegime];
129
+ /**
130
+ * Fiscal regime labels in Spanish for UI dropdowns
131
+ */
132
+ export declare const SAT_FISCAL_REGIME_LABELS: Record<SATFiscalRegimeCode, string>;
133
+ /**
134
+ * Fiscal regimes array for dropdowns
135
+ */
136
+ export declare const SAT_FISCAL_REGIMES_ARRAY: {
137
+ code: SATFiscalRegimeCode;
138
+ label: string;
139
+ }[];
140
+ /**
141
+ * SAT Work Risk Class codes (c_RiesgoPuesto)
142
+ * IMSS risk classification for the workplace
143
+ */
144
+ export declare const SATWorkRiskClass: {
145
+ readonly ClassI: "1";
146
+ readonly ClassII: "2";
147
+ readonly ClassIII: "3";
148
+ readonly ClassIV: "4";
149
+ readonly ClassV: "5";
150
+ };
151
+ export type SATWorkRiskClassCode = (typeof SATWorkRiskClass)[keyof typeof SATWorkRiskClass];
152
+ /**
153
+ * Work risk class labels in Spanish for UI dropdowns
154
+ */
155
+ export declare const SAT_WORK_RISK_CLASS_LABELS: Record<SATWorkRiskClassCode, string>;
156
+ /**
157
+ * Work risk classes array for dropdowns
158
+ */
159
+ export declare const SAT_WORK_RISK_CLASSES_ARRAY: {
160
+ code: SATWorkRiskClassCode;
161
+ label: string;
162
+ }[];
163
+ /**
164
+ * SAT Resource Origin codes (c_OrigenRecurso)
165
+ * Origin of funds for certain payment types
166
+ */
167
+ export declare const SATResourceOrigin: {
168
+ readonly IncomePayment: "IP";
169
+ readonly FederalResources: "IF";
170
+ readonly MixedIncome: "IM";
171
+ };
172
+ export type SATResourceOriginCode = (typeof SATResourceOrigin)[keyof typeof SATResourceOrigin];
173
+ /**
174
+ * Resource origin labels in Spanish for UI dropdowns
175
+ */
176
+ export declare const SAT_RESOURCE_ORIGIN_LABELS: Record<SATResourceOriginCode, string>;
177
+ /**
178
+ * Resource origins array for dropdowns
179
+ */
180
+ export declare const SAT_RESOURCE_ORIGINS_ARRAY: {
181
+ code: SATResourceOriginCode;
182
+ label: string;
183
+ }[];
@@ -0,0 +1,259 @@
1
+ "use strict";
2
+ /**
3
+ * SAT Catalog Constants for CFDI Nómina (Payroll)
4
+ *
5
+ * Based on SAT catalogs for electronic payroll invoicing (CFDI 4.0)
6
+ * These codes are required for CFDI compliance in Mexico.
7
+ *
8
+ * @see SAT Catalogs: http://omawww.sat.gob.mx/tramitesyservicios/Paginas/anexo_20_version3-3.htm
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.SAT_RESOURCE_ORIGINS_ARRAY = exports.SAT_RESOURCE_ORIGIN_LABELS = exports.SATResourceOrigin = exports.SAT_WORK_RISK_CLASSES_ARRAY = exports.SAT_WORK_RISK_CLASS_LABELS = exports.SATWorkRiskClass = exports.SAT_FISCAL_REGIMES_ARRAY = exports.SAT_FISCAL_REGIME_LABELS = exports.SATFiscalRegime = exports.SAT_PAYMENT_FREQUENCIES_ARRAY = exports.SAT_PAYMENT_FREQUENCY_LABELS = exports.SATPaymentFrequency = exports.SAT_JOURNEY_TYPES_ARRAY = exports.SAT_JOURNEY_TYPE_LABELS = exports.SATJourneyType = exports.SAT_REGIME_TYPES_ARRAY = exports.SAT_REGIME_TYPE_LABELS = exports.SATRegimeType = exports.SAT_CONTRACT_TYPES_ARRAY = exports.SAT_CONTRACT_TYPE_LABELS = exports.SATContractType = void 0;
12
+ // ============================================================================
13
+ // Contract Type (c_TipoContrato)
14
+ // ============================================================================
15
+ /**
16
+ * SAT Contract Type codes (c_TipoContrato)
17
+ */
18
+ exports.SATContractType = {
19
+ Permanent: '01',
20
+ Temporary: '02',
21
+ SeasonOrCycle: '03',
22
+ Training: '04',
23
+ InitialTraining: '05',
24
+ HomeBased: '06',
25
+ TrialPeriod: '07',
26
+ RetiredPayments: '08',
27
+ Retirement: '09',
28
+ Other: '99',
29
+ };
30
+ /**
31
+ * Contract type labels in Spanish for UI dropdowns
32
+ */
33
+ exports.SAT_CONTRACT_TYPE_LABELS = {
34
+ '01': 'Contrato de trabajo por tiempo indeterminado',
35
+ '02': 'Contrato de trabajo para obra determinada',
36
+ '03': 'Contrato de trabajo por temporada',
37
+ '04': 'Contrato de trabajo sujeto a prueba',
38
+ '05': 'Contrato de trabajo con capacitación inicial',
39
+ '06': 'Modalidad de contratación por pago de hora laborada',
40
+ '07': 'Modalidad de trabajo por comisión laboral',
41
+ '08': 'Modalidad de contratación donde no existe relación de trabajo',
42
+ '09': 'Jubilación, pensión, retiro',
43
+ '99': 'Otro contrato',
44
+ };
45
+ /**
46
+ * Contract types array for dropdowns
47
+ */
48
+ exports.SAT_CONTRACT_TYPES_ARRAY = Object.entries(exports.SAT_CONTRACT_TYPE_LABELS).map(([code, label]) => ({
49
+ code: code,
50
+ label,
51
+ }));
52
+ // ============================================================================
53
+ // Regime Type (c_TipoRegimen)
54
+ // ============================================================================
55
+ /**
56
+ * SAT Regime Type codes (c_TipoRegimen)
57
+ * Employment regime types for payroll
58
+ */
59
+ exports.SATRegimeType = {
60
+ Salaries: '02',
61
+ Retirement: '03',
62
+ Pensions: '04',
63
+ Assimilated: '05',
64
+ BoardMembers: '06',
65
+ Fees: '07',
66
+ CommissionAgents: '08',
67
+ AssimilatedOther: '09',
68
+ Retirement402: '10',
69
+ Syndicate: '11',
70
+ Severance: '12',
71
+ DeathBenefit: '13',
72
+ };
73
+ /**
74
+ * Regime type labels in Spanish for UI dropdowns
75
+ */
76
+ exports.SAT_REGIME_TYPE_LABELS = {
77
+ '02': 'Sueldos (Incluye ingresos señalados en la fracción I del artículo 94 de LISR)',
78
+ '03': 'Jubilados',
79
+ '04': 'Pensionados',
80
+ '05': 'Asimilados Miembros Sociedades Cooperativas Producción',
81
+ '06': 'Asimilados Integrantes Sociedades Asociaciones Civiles',
82
+ '07': 'Asimilados Honorarios',
83
+ '08': 'Asimilados comisionistas',
84
+ '09': 'Asimilados Otros',
85
+ '10': 'Asimilados obtengan ingresos acciones',
86
+ '11': 'Asimilados ingresos sindicatos',
87
+ '12': 'Indemnizaciones o Separaciones',
88
+ '13': 'Subsidios por incapacidad',
89
+ };
90
+ /**
91
+ * Regime types array for dropdowns
92
+ */
93
+ exports.SAT_REGIME_TYPES_ARRAY = Object.entries(exports.SAT_REGIME_TYPE_LABELS).map(([code, label]) => ({
94
+ code: code,
95
+ label,
96
+ }));
97
+ // ============================================================================
98
+ // Journey Type (c_TipoJornada)
99
+ // ============================================================================
100
+ /**
101
+ * SAT Journey/Workday Type codes (c_TipoJornada)
102
+ */
103
+ exports.SATJourneyType = {
104
+ Day: '01',
105
+ Night: '02',
106
+ Mixed: '03',
107
+ ByHour: '04',
108
+ Reduced: '05',
109
+ Continuous: '06',
110
+ Split: '07',
111
+ ByTurn: '08',
112
+ Other: '99',
113
+ };
114
+ /**
115
+ * Journey type labels in Spanish for UI dropdowns
116
+ */
117
+ exports.SAT_JOURNEY_TYPE_LABELS = {
118
+ '01': 'Diurna',
119
+ '02': 'Nocturna',
120
+ '03': 'Mixta',
121
+ '04': 'Por hora',
122
+ '05': 'Reducida',
123
+ '06': 'Continuada',
124
+ '07': 'Partida',
125
+ '08': 'Por turnos',
126
+ '99': 'Otra jornada',
127
+ };
128
+ /**
129
+ * Journey types array for dropdowns
130
+ */
131
+ exports.SAT_JOURNEY_TYPES_ARRAY = Object.entries(exports.SAT_JOURNEY_TYPE_LABELS).map(([code, label]) => ({
132
+ code: code,
133
+ label,
134
+ }));
135
+ // ============================================================================
136
+ // Payment Frequency (c_PeriodicidadPago)
137
+ // ============================================================================
138
+ /**
139
+ * SAT Payment Frequency codes (c_PeriodicidadPago)
140
+ */
141
+ exports.SATPaymentFrequency = {
142
+ Daily: '01',
143
+ Weekly: '02',
144
+ Biweekly: '03',
145
+ Quincenal: '04',
146
+ Monthly: '05',
147
+ Bimonthly: '06',
148
+ ByUnit: '07',
149
+ ByCommission: '08',
150
+ ByPrice: '09',
151
+ Decennial: '10',
152
+ Other: '99',
153
+ };
154
+ /**
155
+ * Payment frequency labels in Spanish for UI dropdowns
156
+ */
157
+ exports.SAT_PAYMENT_FREQUENCY_LABELS = {
158
+ '01': 'Diario',
159
+ '02': 'Semanal',
160
+ '03': 'Catorcenal',
161
+ '04': 'Quincenal',
162
+ '05': 'Mensual',
163
+ '06': 'Bimestral',
164
+ '07': 'Unidad obra',
165
+ '08': 'Comisión',
166
+ '09': 'Precio alzado',
167
+ '10': 'Decenal',
168
+ '99': 'Otra periodicidad',
169
+ };
170
+ /**
171
+ * Payment frequencies array for dropdowns
172
+ */
173
+ exports.SAT_PAYMENT_FREQUENCIES_ARRAY = Object.entries(exports.SAT_PAYMENT_FREQUENCY_LABELS).map(([code, label]) => ({
174
+ code: code,
175
+ label,
176
+ }));
177
+ // ============================================================================
178
+ // Fiscal Regime for Employees (c_RegimenFiscal)
179
+ // ============================================================================
180
+ /**
181
+ * SAT Fiscal Regime codes for employees (c_RegimenFiscal)
182
+ * Subset of fiscal regimes applicable to payroll
183
+ */
184
+ exports.SATFiscalRegime = {
185
+ SalariesAndWages: '605',
186
+ WithoutFiscalObligations: '616',
187
+ };
188
+ /**
189
+ * Fiscal regime labels in Spanish for UI dropdowns
190
+ */
191
+ exports.SAT_FISCAL_REGIME_LABELS = {
192
+ '605': 'Sueldos y Salarios e Ingresos Asimilados a Salarios',
193
+ '616': 'Sin obligaciones fiscales',
194
+ };
195
+ /**
196
+ * Fiscal regimes array for dropdowns
197
+ */
198
+ exports.SAT_FISCAL_REGIMES_ARRAY = Object.entries(exports.SAT_FISCAL_REGIME_LABELS).map(([code, label]) => ({
199
+ code: code,
200
+ label,
201
+ }));
202
+ // ============================================================================
203
+ // Work Risk Class (c_RiesgoPuesto)
204
+ // ============================================================================
205
+ /**
206
+ * SAT Work Risk Class codes (c_RiesgoPuesto)
207
+ * IMSS risk classification for the workplace
208
+ */
209
+ exports.SATWorkRiskClass = {
210
+ ClassI: '1',
211
+ ClassII: '2',
212
+ ClassIII: '3',
213
+ ClassIV: '4',
214
+ ClassV: '5',
215
+ };
216
+ /**
217
+ * Work risk class labels in Spanish for UI dropdowns
218
+ */
219
+ exports.SAT_WORK_RISK_CLASS_LABELS = {
220
+ '1': 'Clase I - Riesgo ordinario',
221
+ '2': 'Clase II - Riesgo bajo',
222
+ '3': 'Clase III - Riesgo medio',
223
+ '4': 'Clase IV - Riesgo alto',
224
+ '5': 'Clase V - Riesgo máximo',
225
+ };
226
+ /**
227
+ * Work risk classes array for dropdowns
228
+ */
229
+ exports.SAT_WORK_RISK_CLASSES_ARRAY = Object.entries(exports.SAT_WORK_RISK_CLASS_LABELS).map(([code, label]) => ({
230
+ code: code,
231
+ label,
232
+ }));
233
+ // ============================================================================
234
+ // Resource Origin (c_OrigenRecurso)
235
+ // ============================================================================
236
+ /**
237
+ * SAT Resource Origin codes (c_OrigenRecurso)
238
+ * Origin of funds for certain payment types
239
+ */
240
+ exports.SATResourceOrigin = {
241
+ IncomePayment: 'IP',
242
+ FederalResources: 'IF',
243
+ MixedIncome: 'IM',
244
+ };
245
+ /**
246
+ * Resource origin labels in Spanish for UI dropdowns
247
+ */
248
+ exports.SAT_RESOURCE_ORIGIN_LABELS = {
249
+ IP: 'Ingresos propios',
250
+ IF: 'Ingresos federales',
251
+ IM: 'Ingresos mixtos',
252
+ };
253
+ /**
254
+ * Resource origins array for dropdowns
255
+ */
256
+ exports.SAT_RESOURCE_ORIGINS_ARRAY = Object.entries(exports.SAT_RESOURCE_ORIGIN_LABELS).map(([code, label]) => ({
257
+ code: code,
258
+ label,
259
+ }));
package/dist/index.d.ts CHANGED
@@ -5,3 +5,4 @@
5
5
  export * from './types';
6
6
  export * from './constants';
7
7
  export * from './validation';
8
+ export { debugLog } from './utils/debug-logger';
package/dist/index.js CHANGED
@@ -18,6 +18,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
18
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.debugLog = void 0;
21
22
  __exportStar(require("./types"), exports);
22
23
  __exportStar(require("./constants"), exports);
23
24
  __exportStar(require("./validation"), exports);
25
+ var debug_logger_1 = require("./utils/debug-logger");
26
+ Object.defineProperty(exports, "debugLog", { enumerable: true, get: function () { return debug_logger_1.debugLog; } });
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Debug Logger for Shared Code
3
+ *
4
+ * Simple console.log wrapper - shared code is pure, no persistence needed.
5
+ * For full debugging with persistence, use the debugLog from backend or frontend.
6
+ *
7
+ * Enable in Node: DEBUG_LOG_ENABLED=true
8
+ * Enable in Browser: localStorage.setItem('DEBUG_LOG_ENABLED', 'true')
9
+ *
10
+ * @example
11
+ * import { debugLog } from 'hvp-shared';
12
+ *
13
+ * function validateRFC(value: string) {
14
+ * debugLog('validateRFC', { value }, 'input');
15
+ * // ... validation logic
16
+ * }
17
+ */
18
+ /**
19
+ * Log debug data (sync, console.log only)
20
+ */
21
+ export declare function debugLog(functionName: string, data: unknown, context?: string): void;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ /**
3
+ * Debug Logger for Shared Code
4
+ *
5
+ * Simple console.log wrapper - shared code is pure, no persistence needed.
6
+ * For full debugging with persistence, use the debugLog from backend or frontend.
7
+ *
8
+ * Enable in Node: DEBUG_LOG_ENABLED=true
9
+ * Enable in Browser: localStorage.setItem('DEBUG_LOG_ENABLED', 'true')
10
+ *
11
+ * @example
12
+ * import { debugLog } from 'hvp-shared';
13
+ *
14
+ * function validateRFC(value: string) {
15
+ * debugLog('validateRFC', { value }, 'input');
16
+ * // ... validation logic
17
+ * }
18
+ */
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.debugLog = debugLog;
21
+ /**
22
+ * Check if debug logging is enabled
23
+ */
24
+ function isEnabled() {
25
+ // Node.js
26
+ if (typeof process !== 'undefined' && process.env) {
27
+ return process.env.DEBUG_LOG_ENABLED === 'true';
28
+ }
29
+ // Browser
30
+ if (typeof localStorage !== 'undefined') {
31
+ try {
32
+ return localStorage.getItem('DEBUG_LOG_ENABLED') === 'true';
33
+ }
34
+ catch {
35
+ return false;
36
+ }
37
+ }
38
+ return false;
39
+ }
40
+ /**
41
+ * Log debug data (sync, console.log only)
42
+ */
43
+ function debugLog(functionName, data, context = 'default') {
44
+ if (!isEnabled())
45
+ return;
46
+ const time = new Date().toISOString().slice(11, 23);
47
+ console.log(`[DEBUG ${time}] ${functionName} (${context})`, data);
48
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hvp-shared",
3
- "version": "2.0.1",
3
+ "version": "3.0.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",