@77sol-lab/form-schemas 1.5.1 → 1.6.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 (160) hide show
  1. package/{chunk-Y3FAMPYF.mjs → chunk-26KEKEEF.mjs} +82 -21
  2. package/{chunk-2CN56LSL.mjs → chunk-2BJWG5HH.mjs} +2 -2
  3. package/{chunk-HZM2PWYJ.mjs → chunk-4LRATW5F.mjs} +2 -2
  4. package/{chunk-2YVK6IDS.mjs → chunk-4NVLC5QJ.mjs} +3 -3
  5. package/{chunk-OX3X37VR.mjs → chunk-57OTHRRU.mjs} +2 -2
  6. package/{chunk-DERWNSPY.mjs → chunk-5F3IUHOW.mjs} +1 -1
  7. package/{chunk-GR2PK3Z7.mjs → chunk-5ZJ6TZRB.mjs} +2 -2
  8. package/{chunk-OUVNM2RX.mjs → chunk-6CTXET42.mjs} +1 -1
  9. package/{chunk-HHJNVLHK.mjs → chunk-6NX5BRIF.mjs} +1 -1
  10. package/{chunk-YNVJAGAY.mjs → chunk-6RYVAKNX.mjs} +41 -33
  11. package/{chunk-YQJCILG3.mjs → chunk-7L7ADQAE.mjs} +1 -1
  12. package/{chunk-AURTWOTB.mjs → chunk-7OBG2GEG.mjs} +2 -2
  13. package/{chunk-P54HBDOE.mjs → chunk-7QXG7J4P.mjs} +2 -2
  14. package/{chunk-WGPPH7DC.mjs → chunk-BJZ4B43H.mjs} +1 -1
  15. package/{chunk-MDK5KVJT.mjs → chunk-DAB6IBM6.mjs} +2 -2
  16. package/{chunk-JPFAMQGV.mjs → chunk-H245MSBR.mjs} +1 -1
  17. package/{chunk-XII4F5RZ.mjs → chunk-HSUS7XOX.mjs} +1 -1
  18. package/{chunk-3O52U22S.mjs → chunk-IV6UYEKI.mjs} +2 -2
  19. package/{chunk-VGFPONIS.mjs → chunk-J5YKKOCK.mjs} +1 -1
  20. package/{chunk-OMDC46YE.mjs → chunk-JQLNKJFR.mjs} +2 -2
  21. package/{chunk-6TFRV3FG.mjs → chunk-K6JM7OJP.mjs} +2 -2
  22. package/{chunk-2W3LQ75V.mjs → chunk-L4XSQTZM.mjs} +2 -2
  23. package/{chunk-WRJAOYL6.mjs → chunk-LH3JE57U.mjs} +1 -1
  24. package/{chunk-F76ICRGY.mjs → chunk-PZ6JDNAK.mjs} +2 -2
  25. package/{chunk-WPLLR3SO.mjs → chunk-SSMQ7WOS.mjs} +2 -2
  26. package/{chunk-THYAK7O3.mjs → chunk-TL5EG2ET.mjs} +2 -2
  27. package/{chunk-FT5BAKSG.mjs → chunk-U3WXTP5Y.mjs} +2 -2
  28. package/{chunk-3BPZV6IW.mjs → chunk-VYVXCUYH.mjs} +1 -1
  29. package/{chunk-3RSZ4NGE.mjs → chunk-WVDZZKR2.mjs} +1 -1
  30. package/{chunk-7ZERTOE7.mjs → chunk-XA4SJNUV.mjs} +2 -2
  31. package/{chunk-PO6GQE6E.mjs → chunk-XKMD2F5C.mjs} +2 -2
  32. package/{chunk-6HBDXEIK.mjs → chunk-XOTWCRWX.mjs} +2 -2
  33. package/{chunk-O7OHCS36.mjs → chunk-YS6GLH4U.mjs} +1 -1
  34. package/financing/formalization/index.d.cts +1239 -372
  35. package/financing/formalization/index.d.ts +1239 -372
  36. package/financing/formalization/index.js +89 -22
  37. package/financing/formalization/index.mjs +33 -33
  38. package/financing/formalization/schemas/AlfaPFSchema.d.cts +13 -5
  39. package/financing/formalization/schemas/AlfaPFSchema.d.ts +13 -5
  40. package/financing/formalization/schemas/AlfaPFSchema.js +72 -20
  41. package/financing/formalization/schemas/AlfaPFSchema.mjs +3 -3
  42. package/financing/formalization/schemas/AlfaPJSchema.d.cts +15 -7
  43. package/financing/formalization/schemas/AlfaPJSchema.d.ts +15 -7
  44. package/financing/formalization/schemas/AlfaPJSchema.js +72 -20
  45. package/financing/formalization/schemas/AlfaPJSchema.mjs +2 -2
  46. package/financing/formalization/schemas/BancoDoBrasilPFSchema.d.cts +13 -5
  47. package/financing/formalization/schemas/BancoDoBrasilPFSchema.d.ts +13 -5
  48. package/financing/formalization/schemas/BancoDoBrasilPFSchema.js +72 -20
  49. package/financing/formalization/schemas/BancoDoBrasilPFSchema.mjs +3 -3
  50. package/financing/formalization/schemas/BancoDoBrasilPJSchema.d.cts +15 -7
  51. package/financing/formalization/schemas/BancoDoBrasilPJSchema.d.ts +15 -7
  52. package/financing/formalization/schemas/BancoDoBrasilPJSchema.js +72 -20
  53. package/financing/formalization/schemas/BancoDoBrasilPJSchema.mjs +2 -2
  54. package/financing/formalization/schemas/BtgPFSchema.d.cts +13 -5
  55. package/financing/formalization/schemas/BtgPFSchema.d.ts +13 -5
  56. package/financing/formalization/schemas/BtgPFSchema.js +72 -20
  57. package/financing/formalization/schemas/BtgPFSchema.mjs +3 -3
  58. package/financing/formalization/schemas/BtgPJSchema.d.cts +29 -21
  59. package/financing/formalization/schemas/BtgPJSchema.d.ts +29 -21
  60. package/financing/formalization/schemas/BtgPJSchema.js +72 -20
  61. package/financing/formalization/schemas/BtgPJSchema.mjs +3 -3
  62. package/financing/formalization/schemas/BvPFSchema.d.cts +18 -10
  63. package/financing/formalization/schemas/BvPFSchema.d.ts +18 -10
  64. package/financing/formalization/schemas/BvPFSchema.js +72 -20
  65. package/financing/formalization/schemas/BvPFSchema.mjs +3 -3
  66. package/financing/formalization/schemas/BvPJSchema.d.cts +36 -28
  67. package/financing/formalization/schemas/BvPJSchema.d.ts +36 -28
  68. package/financing/formalization/schemas/BvPJSchema.js +72 -20
  69. package/financing/formalization/schemas/BvPJSchema.mjs +3 -3
  70. package/financing/formalization/schemas/CaixaEconomicaFederalPFSchema.d.cts +13 -5
  71. package/financing/formalization/schemas/CaixaEconomicaFederalPFSchema.d.ts +13 -5
  72. package/financing/formalization/schemas/CaixaEconomicaFederalPFSchema.js +72 -20
  73. package/financing/formalization/schemas/CaixaEconomicaFederalPFSchema.mjs +3 -3
  74. package/financing/formalization/schemas/CaixaEconomicaFederalPJSchema.d.cts +15 -7
  75. package/financing/formalization/schemas/CaixaEconomicaFederalPJSchema.d.ts +15 -7
  76. package/financing/formalization/schemas/CaixaEconomicaFederalPJSchema.js +72 -20
  77. package/financing/formalization/schemas/CaixaEconomicaFederalPJSchema.mjs +2 -2
  78. package/financing/formalization/schemas/CashMePFSchema.d.cts +13 -5
  79. package/financing/formalization/schemas/CashMePFSchema.d.ts +13 -5
  80. package/financing/formalization/schemas/CashMePFSchema.js +72 -20
  81. package/financing/formalization/schemas/CashMePFSchema.mjs +3 -3
  82. package/financing/formalization/schemas/CashMePJSchema.d.cts +15 -7
  83. package/financing/formalization/schemas/CashMePJSchema.d.ts +15 -7
  84. package/financing/formalization/schemas/CashMePJSchema.js +72 -20
  85. package/financing/formalization/schemas/CashMePJSchema.mjs +2 -2
  86. package/financing/formalization/schemas/Credito77PFSchema.d.cts +13 -5
  87. package/financing/formalization/schemas/Credito77PFSchema.d.ts +13 -5
  88. package/financing/formalization/schemas/Credito77PFSchema.js +72 -20
  89. package/financing/formalization/schemas/Credito77PFSchema.mjs +3 -3
  90. package/financing/formalization/schemas/Credito77PJSchema.d.cts +15 -7
  91. package/financing/formalization/schemas/Credito77PJSchema.d.ts +15 -7
  92. package/financing/formalization/schemas/Credito77PJSchema.js +72 -20
  93. package/financing/formalization/schemas/Credito77PJSchema.mjs +2 -2
  94. package/financing/formalization/schemas/EosPFSchema.d.cts +13 -5
  95. package/financing/formalization/schemas/EosPFSchema.d.ts +13 -5
  96. package/financing/formalization/schemas/EosPFSchema.js +72 -20
  97. package/financing/formalization/schemas/EosPFSchema.mjs +3 -3
  98. package/financing/formalization/schemas/EosPJSchema.d.cts +15 -7
  99. package/financing/formalization/schemas/EosPJSchema.d.ts +15 -7
  100. package/financing/formalization/schemas/EosPJSchema.js +72 -20
  101. package/financing/formalization/schemas/EosPJSchema.mjs +2 -2
  102. package/financing/formalization/schemas/HdtEnergyPFSchema.d.cts +13 -5
  103. package/financing/formalization/schemas/HdtEnergyPFSchema.d.ts +13 -5
  104. package/financing/formalization/schemas/HdtEnergyPFSchema.js +72 -20
  105. package/financing/formalization/schemas/HdtEnergyPFSchema.mjs +3 -3
  106. package/financing/formalization/schemas/HdtEnergyPJSchema.d.cts +15 -7
  107. package/financing/formalization/schemas/HdtEnergyPJSchema.d.ts +15 -7
  108. package/financing/formalization/schemas/HdtEnergyPJSchema.js +72 -20
  109. package/financing/formalization/schemas/HdtEnergyPJSchema.mjs +2 -2
  110. package/financing/formalization/schemas/LosangoPFSchema.d.cts +13 -5
  111. package/financing/formalization/schemas/LosangoPFSchema.d.ts +13 -5
  112. package/financing/formalization/schemas/LosangoPFSchema.js +72 -20
  113. package/financing/formalization/schemas/LosangoPFSchema.mjs +3 -3
  114. package/financing/formalization/schemas/LosangoPJSchema.d.cts +15 -7
  115. package/financing/formalization/schemas/LosangoPJSchema.d.ts +15 -7
  116. package/financing/formalization/schemas/LosangoPJSchema.js +72 -20
  117. package/financing/formalization/schemas/LosangoPJSchema.mjs +2 -2
  118. package/financing/formalization/schemas/SafraPFSchema.d.cts +13 -5
  119. package/financing/formalization/schemas/SafraPFSchema.d.ts +13 -5
  120. package/financing/formalization/schemas/SafraPFSchema.js +72 -20
  121. package/financing/formalization/schemas/SafraPFSchema.mjs +3 -3
  122. package/financing/formalization/schemas/SafraPJSchema.d.cts +15 -7
  123. package/financing/formalization/schemas/SafraPJSchema.d.ts +15 -7
  124. package/financing/formalization/schemas/SafraPJSchema.js +72 -20
  125. package/financing/formalization/schemas/SafraPJSchema.mjs +2 -2
  126. package/financing/formalization/schemas/SantanderPFSchema.d.cts +13 -5
  127. package/financing/formalization/schemas/SantanderPFSchema.d.ts +13 -5
  128. package/financing/formalization/schemas/SantanderPFSchema.js +72 -20
  129. package/financing/formalization/schemas/SantanderPFSchema.mjs +3 -3
  130. package/financing/formalization/schemas/SantanderPJSchema.d.cts +15 -7
  131. package/financing/formalization/schemas/SantanderPJSchema.d.ts +15 -7
  132. package/financing/formalization/schemas/SantanderPJSchema.js +72 -20
  133. package/financing/formalization/schemas/SantanderPJSchema.mjs +2 -2
  134. package/financing/formalization/schemas/SolAgoraPFSchema.d.cts +13 -5
  135. package/financing/formalization/schemas/SolAgoraPFSchema.d.ts +13 -5
  136. package/financing/formalization/schemas/SolAgoraPFSchema.js +72 -20
  137. package/financing/formalization/schemas/SolAgoraPFSchema.mjs +3 -3
  138. package/financing/formalization/schemas/SolAgoraPJSchema.d.cts +15 -7
  139. package/financing/formalization/schemas/SolAgoraPJSchema.d.ts +15 -7
  140. package/financing/formalization/schemas/SolAgoraPJSchema.js +72 -20
  141. package/financing/formalization/schemas/SolAgoraPJSchema.mjs +3 -3
  142. package/financing/formalization/schemas/SolfacilPFSchema.d.cts +13 -5
  143. package/financing/formalization/schemas/SolfacilPFSchema.d.ts +13 -5
  144. package/financing/formalization/schemas/SolfacilPFSchema.js +72 -20
  145. package/financing/formalization/schemas/SolfacilPFSchema.mjs +3 -3
  146. package/financing/formalization/schemas/SolfacilPJSchema.d.cts +22 -14
  147. package/financing/formalization/schemas/SolfacilPJSchema.d.ts +22 -14
  148. package/financing/formalization/schemas/SolfacilPJSchema.js +72 -20
  149. package/financing/formalization/schemas/SolfacilPJSchema.mjs +2 -2
  150. package/financing/formalization/schemas/UnifiedPFSchema.d.cts +20 -12
  151. package/financing/formalization/schemas/UnifiedPFSchema.d.ts +20 -12
  152. package/financing/formalization/schemas/UnifiedPFSchema.js +73 -21
  153. package/financing/formalization/schemas/UnifiedPFSchema.mjs +3 -3
  154. package/financing/formalization/schemas/UnifiedPJSchema.d.cts +50 -42
  155. package/financing/formalization/schemas/UnifiedPJSchema.d.ts +50 -42
  156. package/financing/formalization/schemas/UnifiedPJSchema.js +72 -20
  157. package/financing/formalization/schemas/UnifiedPJSchema.mjs +3 -3
  158. package/index.js +89 -22
  159. package/index.mjs +33 -33
  160. package/package.json +1 -1
@@ -4,12 +4,19 @@ var zod = require('zod');
4
4
 
5
5
  // src/shared/fields/primitives.ts
6
6
  var REQUIRED_MESSAGE = "Campo obrigat\xF3rio";
7
+ var REQUIRED_STRING_PARAMS = {
8
+ required_error: REQUIRED_MESSAGE,
9
+ invalid_type_error: REQUIRED_MESSAGE
10
+ };
11
+ function requiredString() {
12
+ return zod.z.string(REQUIRED_STRING_PARAMS);
13
+ }
7
14
  function textField(maxLength) {
8
- const base = zod.z.string().trim().min(1, REQUIRED_MESSAGE);
15
+ const base = requiredString().trim().min(1, REQUIRED_MESSAGE);
9
16
  return maxLength === void 0 ? base : base.max(maxLength, `M\xE1ximo ${maxLength} caracteres`);
10
17
  }
11
- var numberField = zod.z.number({ invalid_type_error: "Valor num\xE9rico inv\xE1lido" }).nonnegative("Valor n\xE3o pode ser negativo");
12
- var integerField = zod.z.number({ invalid_type_error: "Valor num\xE9rico inv\xE1lido" }).int("Deve ser um n\xFAmero inteiro").nonnegative("Valor n\xE3o pode ser negativo");
18
+ var numberField = zod.z.number({ required_error: REQUIRED_MESSAGE, invalid_type_error: "Valor num\xE9rico inv\xE1lido" }).nonnegative("Valor n\xE3o pode ser negativo");
19
+ var integerField = zod.z.number({ required_error: REQUIRED_MESSAGE, invalid_type_error: "Valor num\xE9rico inv\xE1lido" }).int("Deve ser um n\xFAmero inteiro").nonnegative("Valor n\xE3o pode ser negativo");
13
20
  function enumField(values) {
14
21
  return zod.z.enum(values, {
15
22
  errorMap: (issue, ctx) => {
@@ -22,13 +29,16 @@ function enumField(values) {
22
29
  }
23
30
  var MAX_UPLOAD_BYTES = 5 * 1024 * 1024;
24
31
  var ACCEPTED_UPLOAD_MIME = ["image/jpeg", "image/png", "application/pdf"];
25
- var fileUploadField = zod.z.object({
26
- url: zod.z.string().url().optional(),
27
- mime: zod.z.enum(ACCEPTED_UPLOAD_MIME, {
28
- errorMap: () => ({ message: "Formato deve ser JPEG, PNG ou PDF" })
29
- }),
30
- sizeBytes: zod.z.number().max(MAX_UPLOAD_BYTES, "Arquivo deve ter no m\xE1ximo 5MB")
31
- });
32
+ var fileUploadField = zod.z.object(
33
+ {
34
+ url: zod.z.string().url().optional(),
35
+ mime: zod.z.enum(ACCEPTED_UPLOAD_MIME, {
36
+ errorMap: () => ({ message: "Formato deve ser JPEG, PNG ou PDF" })
37
+ }),
38
+ sizeBytes: zod.z.number().max(MAX_UPLOAD_BYTES, "Arquivo deve ter no m\xE1ximo 5MB")
39
+ },
40
+ REQUIRED_STRING_PARAMS
41
+ );
32
42
 
33
43
  // src/shared/enums/civil-status.ts
34
44
  var CivilStatusEnum = enumField([
@@ -84,6 +94,22 @@ var NatureOfOccupationTypeLabels = {
84
94
  empresario: "Empres\xE1rio"
85
95
  };
86
96
 
97
+ // src/shared/enums/proof-kinship-type.ts
98
+ var ProofKinshipTypeEnum = enumField([
99
+ "certidao_casamento",
100
+ "documento_identificacao",
101
+ "contrato_social",
102
+ "declaracao_parentesco",
103
+ "outro_documento"
104
+ ]);
105
+ var ProofKinshipTypeLabels = {
106
+ certidao_casamento: "Certid\xE3o de casamento",
107
+ documento_identificacao: "Documento de identifica\xE7\xE3o",
108
+ contrato_social: "Contrato social",
109
+ declaracao_parentesco: "Declara\xE7\xE3o de parentesco",
110
+ outro_documento: "Outro documento"
111
+ };
112
+
87
113
  // src/shared/enums/residence-type.ts
88
114
  var ResidenceTypeEnum = enumField([
89
115
  "proprio",
@@ -222,7 +248,9 @@ var FORMALIZATION_OPTION_LABELS = {
222
248
  uf_naturalness: UfLabels,
223
249
  emitting_state: UfLabels,
224
250
  uf_issuing_body: UfLabels,
225
- doc_issuance_uf: UfLabels
251
+ doc_issuance_uf: UfLabels,
252
+ energy_account_in_requester_name: YesOrNoLabels,
253
+ proof_kinship_type: ProofKinshipTypeLabels
226
254
  };
227
255
  function getFieldOptions(field) {
228
256
  const labels = FORMALIZATION_OPTION_LABELS[field];
@@ -328,16 +356,22 @@ function yearsSinceDMY(value, reference = /* @__PURE__ */ new Date()) {
328
356
  }
329
357
 
330
358
  // src/shared/regex/index.ts
331
- var cpfSchema = zod.z.string().transform(onlyDigits).refine((v) => PATTERNS.cpf.test(v), "CPF inv\xE1lido").refine(isValidCPF, "CPF inv\xE1lido");
332
- var cnpjSchema = zod.z.string().transform(onlyDigits).refine((v) => PATTERNS.cnpj.test(v), "CNPJ inv\xE1lido").refine(isValidCNPJ, "CNPJ inv\xE1lido");
333
- var cpfCnpjSchema = zod.z.string().transform(onlyDigits).refine(
359
+ function requiredFormatString() {
360
+ return requiredString().trim().min(1, REQUIRED_MESSAGE);
361
+ }
362
+ var cpfSchema = requiredFormatString().transform(onlyDigits).refine((v) => PATTERNS.cpf.test(v), "CPF inv\xE1lido").refine(isValidCPF, "CPF inv\xE1lido");
363
+ var cnpjSchema = requiredFormatString().transform(onlyDigits).refine((v) => PATTERNS.cnpj.test(v), "CNPJ inv\xE1lido").refine(isValidCNPJ, "CNPJ inv\xE1lido");
364
+ var cpfCnpjSchema = requiredFormatString().transform(onlyDigits).refine(
334
365
  (v) => PATTERNS.cpf.test(v) || PATTERNS.cnpj.test(v),
335
366
  "Documento deve ter 11 (CPF) ou 14 (CNPJ) d\xEDgitos"
336
367
  ).refine((v) => v.length === 11 ? isValidCPF(v) : isValidCNPJ(v), "Documento inv\xE1lido");
337
- var cepSchema = zod.z.string().transform(onlyDigits).refine((v) => PATTERNS.cep.test(v), "CEP inv\xE1lido");
338
- var phoneBRSchema = zod.z.string().transform(onlyDigits).refine((v) => PATTERNS.phoneBR.test(v), "Telefone inv\xE1lido");
339
- var emailSchema = zod.z.string().trim().refine((v) => PATTERNS.email.test(v), "E-mail inv\xE1lido");
340
- var dateDMYSchema = zod.z.string().refine((v) => PATTERNS.dateDMY.test(v), "Data inv\xE1lida").refine((v) => parseDMY(v) !== null, "Data inexistente no calend\xE1rio");
368
+ var cepSchema = requiredFormatString().transform(onlyDigits).refine((v) => PATTERNS.cep.test(v), "CEP inv\xE1lido");
369
+ var phoneBRSchema = requiredFormatString().transform(onlyDigits).refine((v) => PATTERNS.phoneBR.test(v), "Telefone inv\xE1lido");
370
+ var emailSchema = requiredFormatString().refine(
371
+ (v) => PATTERNS.email.test(v),
372
+ "E-mail inv\xE1lido"
373
+ );
374
+ var dateDMYSchema = requiredFormatString().refine((v) => PATTERNS.dateDMY.test(v), "Data inv\xE1lida").refine((v) => parseDMY(v) !== null, "Data inexistente no calend\xE1rio");
341
375
  var birthDateSchema = dateDMYSchema.refine(
342
376
  (v) => isAdultDMY(v),
343
377
  "\xC9 necess\xE1rio ser maior de idade (18+)"
@@ -346,8 +380,23 @@ var issueDateSchema = dateDMYSchema.refine(
346
380
  (v) => isNotFutureDMY(v),
347
381
  "Data de emiss\xE3o n\xE3o pode ser futura"
348
382
  );
349
- var currencySchema = zod.z.number({ invalid_type_error: "Valor monet\xE1rio inv\xE1lido" }).positive("Valor deve ser positivo");
350
- zod.z.number().int("Deve ser um n\xFAmero inteiro").min(1, "M\xEDnimo 1").max(28, "M\xE1ximo 28");
383
+ function parseBRLCurrency(value) {
384
+ if (typeof value !== "string") {
385
+ return value;
386
+ }
387
+ const trimmed = value.trim();
388
+ if (trimmed === "") {
389
+ return void 0;
390
+ }
391
+ const normalized = trimmed.replace(/R\$/gi, "").replace(/\s/g, "").replace(/\./g, "").replace(",", ".");
392
+ const parsed = Number(normalized);
393
+ return Number.isNaN(parsed) ? value : parsed;
394
+ }
395
+ var currencySchema = zod.z.preprocess(
396
+ parseBRLCurrency,
397
+ zod.z.number({ required_error: REQUIRED_MESSAGE, invalid_type_error: "Valor monet\xE1rio inv\xE1lido" }).positive("Valor deve ser positivo")
398
+ );
399
+ zod.z.number({ required_error: REQUIRED_MESSAGE, invalid_type_error: "Valor num\xE9rico inv\xE1lido" }).int("Deve ser um n\xFAmero inteiro").min(1, "M\xEDnimo 1").max(28, "M\xE1ximo 28");
351
400
 
352
401
  // src/domains/financing/formalization/refinements.ts
353
402
  var RG_MAX_EMISSION_YEARS = 10;
@@ -370,7 +419,18 @@ function applyPartnerRefinement(data, ctx) {
370
419
  }
371
420
  }
372
421
  function applyCommonRefinements(data, ctx) {
373
- if ("energy_account_in_requester_name" in data && typeof data.energy_account_in_requester_name === "string" && data.energy_account_in_requester_name !== "nao_aplica" && !data.proof_kinship) {
422
+ const accountInThirdPartyName = data.energy_account_in_requester_name === "sim";
423
+ if (!accountInThirdPartyName) {
424
+ return;
425
+ }
426
+ if (!data.proof_kinship_type) {
427
+ ctx.addIssue({
428
+ code: zod.z.ZodIssueCode.custom,
429
+ path: ["proof_kinship_type"],
430
+ message: "Tipo de comprovante \xE9 obrigat\xF3rio quando a conta est\xE1 em nome de terceiro"
431
+ });
432
+ }
433
+ if (!data.proof_kinship) {
374
434
  ctx.addIssue({
375
435
  code: zod.z.ZodIssueCode.custom,
376
436
  path: ["proof_kinship"],
@@ -404,6 +464,7 @@ function applyPjRefinements(data, ctx) {
404
464
  }
405
465
  var formalizationExtras = {
406
466
  voucher_local_installation_address: fileUploadField,
467
+ proof_kinship_type: ProofKinshipTypeEnum.optional(),
407
468
  proof_kinship: fileUploadField.optional(),
408
469
  document_front_upload: fileUploadField,
409
470
  document_back_upload: fileUploadField,
@@ -1443,7 +1504,7 @@ var unifiedPfObject = zod.z.object({
1443
1504
  complement: textField(15).optional(),
1444
1505
  mother_name: textField(),
1445
1506
  district: textField(),
1446
- energy_account_in_requester_name: textField(),
1507
+ energy_account_in_requester_name: YesOrNoEnum,
1447
1508
  city: textField(),
1448
1509
  energy_bill_owner_document: cpfCnpjSchema.optional(),
1449
1510
  state: UfEnum,
@@ -1694,6 +1755,12 @@ var FORMALIZATION_FIELD_META = {
1694
1755
  step: 1,
1695
1756
  placeholder: "Selecione uma op\xE7\xE3o"
1696
1757
  },
1758
+ proof_kinship_type: {
1759
+ kind: "select",
1760
+ label: "Tipo de comprovante",
1761
+ step: 1,
1762
+ placeholder: "Selecione uma op\xE7\xE3o"
1763
+ },
1697
1764
  proof_kinship: {
1698
1765
  kind: "file",
1699
1766
  label: "Documento de v\xEDnculo com o titular",
@@ -1,33 +1,33 @@
1
- export { BANK_SLUGS, BankEnum, FORMALIZATION_FIELD_META, FORMALIZATION_OPTION_LABELS, NATIONALITY_BRAZIL, UNIFIED_SLUG, getFieldOptions, getFormalizationBaseSchema, getFormalizationSchema, pfBaseSchemaRegistry, pfSchemaRegistry, pjBaseSchemaRegistry, pjSchemaRegistry } from '../../chunk-YNVJAGAY.mjs';
2
- import '../../chunk-GR2PK3Z7.mjs';
3
- import '../../chunk-O7OHCS36.mjs';
4
- import '../../chunk-WPLLR3SO.mjs';
5
- import '../../chunk-2W3LQ75V.mjs';
6
- import '../../chunk-PO6GQE6E.mjs';
7
- import '../../chunk-3RSZ4NGE.mjs';
8
- export { unifiedPfObject, unifiedPfSchema } from '../../chunk-2YVK6IDS.mjs';
9
- export { unifiedPjObject, unifiedPjSchema } from '../../chunk-AURTWOTB.mjs';
10
- import '../../chunk-FT5BAKSG.mjs';
11
- import '../../chunk-HHJNVLHK.mjs';
12
- import '../../chunk-3O52U22S.mjs';
13
- import '../../chunk-OUVNM2RX.mjs';
14
- import '../../chunk-2CN56LSL.mjs';
15
- import '../../chunk-DERWNSPY.mjs';
16
- import '../../chunk-6TFRV3FG.mjs';
17
- import '../../chunk-YQJCILG3.mjs';
18
- import '../../chunk-OX3X37VR.mjs';
19
- import '../../chunk-F76ICRGY.mjs';
20
- import '../../chunk-7ZERTOE7.mjs';
21
- import '../../chunk-3BPZV6IW.mjs';
22
- import '../../chunk-OMDC46YE.mjs';
23
- import '../../chunk-WRJAOYL6.mjs';
24
- import '../../chunk-MDK5KVJT.mjs';
25
- import '../../chunk-VGFPONIS.mjs';
26
- import '../../chunk-THYAK7O3.mjs';
27
- import '../../chunk-WGPPH7DC.mjs';
28
- import '../../chunk-P54HBDOE.mjs';
29
- import '../../chunk-JPFAMQGV.mjs';
30
- import '../../chunk-HZM2PWYJ.mjs';
31
- import '../../chunk-6HBDXEIK.mjs';
32
- import '../../chunk-XII4F5RZ.mjs';
33
- export { CIVIL_STATUS_REQUIRING_PARTNER, OCCUPATIONS_REQUIRING_CNPJ, PARTNER_FIELDS, applyPfRefinements, applyPjRefinements } from '../../chunk-Y3FAMPYF.mjs';
1
+ export { BANK_SLUGS, BankEnum, FORMALIZATION_FIELD_META, FORMALIZATION_OPTION_LABELS, NATIONALITY_BRAZIL, UNIFIED_SLUG, getFieldOptions, getFormalizationBaseSchema, getFormalizationSchema, pfBaseSchemaRegistry, pfSchemaRegistry, pjBaseSchemaRegistry, pjSchemaRegistry } from '../../chunk-6RYVAKNX.mjs';
2
+ import '../../chunk-5ZJ6TZRB.mjs';
3
+ import '../../chunk-YS6GLH4U.mjs';
4
+ import '../../chunk-SSMQ7WOS.mjs';
5
+ import '../../chunk-L4XSQTZM.mjs';
6
+ import '../../chunk-XKMD2F5C.mjs';
7
+ import '../../chunk-WVDZZKR2.mjs';
8
+ export { unifiedPfObject, unifiedPfSchema } from '../../chunk-4NVLC5QJ.mjs';
9
+ export { unifiedPjObject, unifiedPjSchema } from '../../chunk-7OBG2GEG.mjs';
10
+ import '../../chunk-U3WXTP5Y.mjs';
11
+ import '../../chunk-6NX5BRIF.mjs';
12
+ import '../../chunk-IV6UYEKI.mjs';
13
+ import '../../chunk-6CTXET42.mjs';
14
+ import '../../chunk-2BJWG5HH.mjs';
15
+ import '../../chunk-5F3IUHOW.mjs';
16
+ import '../../chunk-K6JM7OJP.mjs';
17
+ import '../../chunk-7L7ADQAE.mjs';
18
+ import '../../chunk-57OTHRRU.mjs';
19
+ import '../../chunk-PZ6JDNAK.mjs';
20
+ import '../../chunk-XA4SJNUV.mjs';
21
+ import '../../chunk-VYVXCUYH.mjs';
22
+ import '../../chunk-JQLNKJFR.mjs';
23
+ import '../../chunk-LH3JE57U.mjs';
24
+ import '../../chunk-DAB6IBM6.mjs';
25
+ import '../../chunk-J5YKKOCK.mjs';
26
+ import '../../chunk-TL5EG2ET.mjs';
27
+ import '../../chunk-BJZ4B43H.mjs';
28
+ import '../../chunk-7QXG7J4P.mjs';
29
+ import '../../chunk-H245MSBR.mjs';
30
+ import '../../chunk-4LRATW5F.mjs';
31
+ import '../../chunk-XOTWCRWX.mjs';
32
+ import '../../chunk-HSUS7XOX.mjs';
33
+ export { CIVIL_STATUS_REQUIRING_PARTNER, OCCUPATIONS_REQUIRING_CNPJ, PARTNER_FIELDS, applyPfRefinements, applyPjRefinements } from '../../chunk-26KEKEEF.mjs';
@@ -18,7 +18,7 @@ declare const alfaPfObject: z.ZodObject<{
18
18
  nationality: z.ZodString;
19
19
  cellphone: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
20
20
  email: z.ZodEffects<z.ZodString, string, string>;
21
- monthly_income: z.ZodNumber;
21
+ monthly_income: z.ZodEffects<z.ZodNumber, number, unknown>;
22
22
  profession: z.ZodString;
23
23
  type_doc: z.ZodEnum<[string, string]>;
24
24
  doc: z.ZodString;
@@ -37,6 +37,7 @@ declare const alfaPfObject: z.ZodObject<{
37
37
  sizeBytes: number;
38
38
  url?: string | undefined;
39
39
  }>;
40
+ proof_kinship_type: z.ZodOptional<z.ZodEnum<[string, string, string, string, string]>>;
40
41
  proof_kinship: z.ZodOptional<z.ZodObject<{
41
42
  url: z.ZodOptional<z.ZodString>;
42
43
  mime: z.ZodEnum<["image/jpeg", "image/png", "application/pdf"]>;
@@ -115,6 +116,7 @@ declare const alfaPfObject: z.ZodObject<{
115
116
  url?: string | undefined;
116
117
  };
117
118
  rd_re_insurance_toggle: boolean;
119
+ proof_kinship_type?: string | undefined;
118
120
  proof_kinship?: {
119
121
  mime: "image/jpeg" | "image/png" | "application/pdf";
120
122
  sizeBytes: number;
@@ -140,7 +142,6 @@ declare const alfaPfObject: z.ZodObject<{
140
142
  nationality: string;
141
143
  cellphone: string;
142
144
  email: string;
143
- monthly_income: number;
144
145
  profession: string;
145
146
  doc: string;
146
147
  issuing_body: string;
@@ -159,6 +160,7 @@ declare const alfaPfObject: z.ZodObject<{
159
160
  sizeBytes: number;
160
161
  url?: string | undefined;
161
162
  };
163
+ proof_kinship_type?: string | undefined;
162
164
  proof_kinship?: {
163
165
  mime: "image/jpeg" | "image/png" | "application/pdf";
164
166
  sizeBytes: number;
@@ -166,6 +168,7 @@ declare const alfaPfObject: z.ZodObject<{
166
168
  } | undefined;
167
169
  complement?: string | undefined;
168
170
  energy_bill_owner_document?: string | undefined;
171
+ monthly_income?: unknown;
169
172
  rd_re_insurance_toggle?: boolean | undefined;
170
173
  }>;
171
174
  declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
@@ -186,7 +189,7 @@ declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
186
189
  nationality: z.ZodString;
187
190
  cellphone: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
188
191
  email: z.ZodEffects<z.ZodString, string, string>;
189
- monthly_income: z.ZodNumber;
192
+ monthly_income: z.ZodEffects<z.ZodNumber, number, unknown>;
190
193
  profession: z.ZodString;
191
194
  type_doc: z.ZodEnum<[string, string]>;
192
195
  doc: z.ZodString;
@@ -205,6 +208,7 @@ declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
205
208
  sizeBytes: number;
206
209
  url?: string | undefined;
207
210
  }>;
211
+ proof_kinship_type: z.ZodOptional<z.ZodEnum<[string, string, string, string, string]>>;
208
212
  proof_kinship: z.ZodOptional<z.ZodObject<{
209
213
  url: z.ZodOptional<z.ZodString>;
210
214
  mime: z.ZodEnum<["image/jpeg", "image/png", "application/pdf"]>;
@@ -283,6 +287,7 @@ declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
283
287
  url?: string | undefined;
284
288
  };
285
289
  rd_re_insurance_toggle: boolean;
290
+ proof_kinship_type?: string | undefined;
286
291
  proof_kinship?: {
287
292
  mime: "image/jpeg" | "image/png" | "application/pdf";
288
293
  sizeBytes: number;
@@ -308,7 +313,6 @@ declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
308
313
  nationality: string;
309
314
  cellphone: string;
310
315
  email: string;
311
- monthly_income: number;
312
316
  profession: string;
313
317
  doc: string;
314
318
  issuing_body: string;
@@ -327,6 +331,7 @@ declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
327
331
  sizeBytes: number;
328
332
  url?: string | undefined;
329
333
  };
334
+ proof_kinship_type?: string | undefined;
330
335
  proof_kinship?: {
331
336
  mime: "image/jpeg" | "image/png" | "application/pdf";
332
337
  sizeBytes: number;
@@ -334,6 +339,7 @@ declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
334
339
  } | undefined;
335
340
  complement?: string | undefined;
336
341
  energy_bill_owner_document?: string | undefined;
342
+ monthly_income?: unknown;
337
343
  rd_re_insurance_toggle?: boolean | undefined;
338
344
  }>, {
339
345
  number: string;
@@ -373,6 +379,7 @@ declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
373
379
  url?: string | undefined;
374
380
  };
375
381
  rd_re_insurance_toggle: boolean;
382
+ proof_kinship_type?: string | undefined;
376
383
  proof_kinship?: {
377
384
  mime: "image/jpeg" | "image/png" | "application/pdf";
378
385
  sizeBytes: number;
@@ -398,7 +405,6 @@ declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
398
405
  nationality: string;
399
406
  cellphone: string;
400
407
  email: string;
401
- monthly_income: number;
402
408
  profession: string;
403
409
  doc: string;
404
410
  issuing_body: string;
@@ -417,6 +423,7 @@ declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
417
423
  sizeBytes: number;
418
424
  url?: string | undefined;
419
425
  };
426
+ proof_kinship_type?: string | undefined;
420
427
  proof_kinship?: {
421
428
  mime: "image/jpeg" | "image/png" | "application/pdf";
422
429
  sizeBytes: number;
@@ -424,6 +431,7 @@ declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
424
431
  } | undefined;
425
432
  complement?: string | undefined;
426
433
  energy_bill_owner_document?: string | undefined;
434
+ monthly_income?: unknown;
427
435
  rd_re_insurance_toggle?: boolean | undefined;
428
436
  }>;
429
437
  type AlfaPfFicha = z.infer<typeof alfaPfSchema>;
@@ -18,7 +18,7 @@ declare const alfaPfObject: z.ZodObject<{
18
18
  nationality: z.ZodString;
19
19
  cellphone: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
20
20
  email: z.ZodEffects<z.ZodString, string, string>;
21
- monthly_income: z.ZodNumber;
21
+ monthly_income: z.ZodEffects<z.ZodNumber, number, unknown>;
22
22
  profession: z.ZodString;
23
23
  type_doc: z.ZodEnum<[string, string]>;
24
24
  doc: z.ZodString;
@@ -37,6 +37,7 @@ declare const alfaPfObject: z.ZodObject<{
37
37
  sizeBytes: number;
38
38
  url?: string | undefined;
39
39
  }>;
40
+ proof_kinship_type: z.ZodOptional<z.ZodEnum<[string, string, string, string, string]>>;
40
41
  proof_kinship: z.ZodOptional<z.ZodObject<{
41
42
  url: z.ZodOptional<z.ZodString>;
42
43
  mime: z.ZodEnum<["image/jpeg", "image/png", "application/pdf"]>;
@@ -115,6 +116,7 @@ declare const alfaPfObject: z.ZodObject<{
115
116
  url?: string | undefined;
116
117
  };
117
118
  rd_re_insurance_toggle: boolean;
119
+ proof_kinship_type?: string | undefined;
118
120
  proof_kinship?: {
119
121
  mime: "image/jpeg" | "image/png" | "application/pdf";
120
122
  sizeBytes: number;
@@ -140,7 +142,6 @@ declare const alfaPfObject: z.ZodObject<{
140
142
  nationality: string;
141
143
  cellphone: string;
142
144
  email: string;
143
- monthly_income: number;
144
145
  profession: string;
145
146
  doc: string;
146
147
  issuing_body: string;
@@ -159,6 +160,7 @@ declare const alfaPfObject: z.ZodObject<{
159
160
  sizeBytes: number;
160
161
  url?: string | undefined;
161
162
  };
163
+ proof_kinship_type?: string | undefined;
162
164
  proof_kinship?: {
163
165
  mime: "image/jpeg" | "image/png" | "application/pdf";
164
166
  sizeBytes: number;
@@ -166,6 +168,7 @@ declare const alfaPfObject: z.ZodObject<{
166
168
  } | undefined;
167
169
  complement?: string | undefined;
168
170
  energy_bill_owner_document?: string | undefined;
171
+ monthly_income?: unknown;
169
172
  rd_re_insurance_toggle?: boolean | undefined;
170
173
  }>;
171
174
  declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
@@ -186,7 +189,7 @@ declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
186
189
  nationality: z.ZodString;
187
190
  cellphone: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
188
191
  email: z.ZodEffects<z.ZodString, string, string>;
189
- monthly_income: z.ZodNumber;
192
+ monthly_income: z.ZodEffects<z.ZodNumber, number, unknown>;
190
193
  profession: z.ZodString;
191
194
  type_doc: z.ZodEnum<[string, string]>;
192
195
  doc: z.ZodString;
@@ -205,6 +208,7 @@ declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
205
208
  sizeBytes: number;
206
209
  url?: string | undefined;
207
210
  }>;
211
+ proof_kinship_type: z.ZodOptional<z.ZodEnum<[string, string, string, string, string]>>;
208
212
  proof_kinship: z.ZodOptional<z.ZodObject<{
209
213
  url: z.ZodOptional<z.ZodString>;
210
214
  mime: z.ZodEnum<["image/jpeg", "image/png", "application/pdf"]>;
@@ -283,6 +287,7 @@ declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
283
287
  url?: string | undefined;
284
288
  };
285
289
  rd_re_insurance_toggle: boolean;
290
+ proof_kinship_type?: string | undefined;
286
291
  proof_kinship?: {
287
292
  mime: "image/jpeg" | "image/png" | "application/pdf";
288
293
  sizeBytes: number;
@@ -308,7 +313,6 @@ declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
308
313
  nationality: string;
309
314
  cellphone: string;
310
315
  email: string;
311
- monthly_income: number;
312
316
  profession: string;
313
317
  doc: string;
314
318
  issuing_body: string;
@@ -327,6 +331,7 @@ declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
327
331
  sizeBytes: number;
328
332
  url?: string | undefined;
329
333
  };
334
+ proof_kinship_type?: string | undefined;
330
335
  proof_kinship?: {
331
336
  mime: "image/jpeg" | "image/png" | "application/pdf";
332
337
  sizeBytes: number;
@@ -334,6 +339,7 @@ declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
334
339
  } | undefined;
335
340
  complement?: string | undefined;
336
341
  energy_bill_owner_document?: string | undefined;
342
+ monthly_income?: unknown;
337
343
  rd_re_insurance_toggle?: boolean | undefined;
338
344
  }>, {
339
345
  number: string;
@@ -373,6 +379,7 @@ declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
373
379
  url?: string | undefined;
374
380
  };
375
381
  rd_re_insurance_toggle: boolean;
382
+ proof_kinship_type?: string | undefined;
376
383
  proof_kinship?: {
377
384
  mime: "image/jpeg" | "image/png" | "application/pdf";
378
385
  sizeBytes: number;
@@ -398,7 +405,6 @@ declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
398
405
  nationality: string;
399
406
  cellphone: string;
400
407
  email: string;
401
- monthly_income: number;
402
408
  profession: string;
403
409
  doc: string;
404
410
  issuing_body: string;
@@ -417,6 +423,7 @@ declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
417
423
  sizeBytes: number;
418
424
  url?: string | undefined;
419
425
  };
426
+ proof_kinship_type?: string | undefined;
420
427
  proof_kinship?: {
421
428
  mime: "image/jpeg" | "image/png" | "application/pdf";
422
429
  sizeBytes: number;
@@ -424,6 +431,7 @@ declare const alfaPfSchema: z.ZodEffects<z.ZodObject<{
424
431
  } | undefined;
425
432
  complement?: string | undefined;
426
433
  energy_bill_owner_document?: string | undefined;
434
+ monthly_income?: unknown;
427
435
  rd_re_insurance_toggle?: boolean | undefined;
428
436
  }>;
429
437
  type AlfaPfFicha = z.infer<typeof alfaPfSchema>;
@@ -4,12 +4,19 @@ var zod = require('zod');
4
4
 
5
5
  // src/domains/financing/formalization/schemas/AlfaPFSchema.ts
6
6
  var REQUIRED_MESSAGE = "Campo obrigat\xF3rio";
7
+ var REQUIRED_STRING_PARAMS = {
8
+ required_error: REQUIRED_MESSAGE,
9
+ invalid_type_error: REQUIRED_MESSAGE
10
+ };
11
+ function requiredString() {
12
+ return zod.z.string(REQUIRED_STRING_PARAMS);
13
+ }
7
14
  function textField(maxLength) {
8
- const base = zod.z.string().trim().min(1, REQUIRED_MESSAGE);
15
+ const base = requiredString().trim().min(1, REQUIRED_MESSAGE);
9
16
  return maxLength === void 0 ? base : base.max(maxLength, `M\xE1ximo ${maxLength} caracteres`);
10
17
  }
11
- zod.z.number({ invalid_type_error: "Valor num\xE9rico inv\xE1lido" }).nonnegative("Valor n\xE3o pode ser negativo");
12
- zod.z.number({ invalid_type_error: "Valor num\xE9rico inv\xE1lido" }).int("Deve ser um n\xFAmero inteiro").nonnegative("Valor n\xE3o pode ser negativo");
18
+ zod.z.number({ required_error: REQUIRED_MESSAGE, invalid_type_error: "Valor num\xE9rico inv\xE1lido" }).nonnegative("Valor n\xE3o pode ser negativo");
19
+ zod.z.number({ required_error: REQUIRED_MESSAGE, invalid_type_error: "Valor num\xE9rico inv\xE1lido" }).int("Deve ser um n\xFAmero inteiro").nonnegative("Valor n\xE3o pode ser negativo");
13
20
  function enumField(values) {
14
21
  return zod.z.enum(values, {
15
22
  errorMap: (issue, ctx) => {
@@ -22,13 +29,16 @@ function enumField(values) {
22
29
  }
23
30
  var MAX_UPLOAD_BYTES = 5 * 1024 * 1024;
24
31
  var ACCEPTED_UPLOAD_MIME = ["image/jpeg", "image/png", "application/pdf"];
25
- var fileUploadField = zod.z.object({
26
- url: zod.z.string().url().optional(),
27
- mime: zod.z.enum(ACCEPTED_UPLOAD_MIME, {
28
- errorMap: () => ({ message: "Formato deve ser JPEG, PNG ou PDF" })
29
- }),
30
- sizeBytes: zod.z.number().max(MAX_UPLOAD_BYTES, "Arquivo deve ter no m\xE1ximo 5MB")
31
- });
32
+ var fileUploadField = zod.z.object(
33
+ {
34
+ url: zod.z.string().url().optional(),
35
+ mime: zod.z.enum(ACCEPTED_UPLOAD_MIME, {
36
+ errorMap: () => ({ message: "Formato deve ser JPEG, PNG ou PDF" })
37
+ }),
38
+ sizeBytes: zod.z.number().max(MAX_UPLOAD_BYTES, "Arquivo deve ter no m\xE1ximo 5MB")
39
+ },
40
+ REQUIRED_STRING_PARAMS
41
+ );
32
42
 
33
43
  // src/shared/enums/document-type.ts
34
44
  var DocumentTypeEnum = enumField([
@@ -36,6 +46,15 @@ var DocumentTypeEnum = enumField([
36
46
  "carteira_nacional_de_habilita\xE7\xE3o"
37
47
  ]);
38
48
 
49
+ // src/shared/enums/proof-kinship-type.ts
50
+ var ProofKinshipTypeEnum = enumField([
51
+ "certidao_casamento",
52
+ "documento_identificacao",
53
+ "contrato_social",
54
+ "declaracao_parentesco",
55
+ "outro_documento"
56
+ ]);
57
+
39
58
  // src/shared/enums/sex.ts
40
59
  var SexEnum = enumField(["masculino", "feminino"]);
41
60
 
@@ -166,16 +185,22 @@ function yearsSinceDMY(value, reference = /* @__PURE__ */ new Date()) {
166
185
  }
167
186
 
168
187
  // src/shared/regex/index.ts
169
- var cpfSchema = zod.z.string().transform(onlyDigits).refine((v) => PATTERNS.cpf.test(v), "CPF inv\xE1lido").refine(isValidCPF, "CPF inv\xE1lido");
170
- zod.z.string().transform(onlyDigits).refine((v) => PATTERNS.cnpj.test(v), "CNPJ inv\xE1lido").refine(isValidCNPJ, "CNPJ inv\xE1lido");
171
- var cpfCnpjSchema = zod.z.string().transform(onlyDigits).refine(
188
+ function requiredFormatString() {
189
+ return requiredString().trim().min(1, REQUIRED_MESSAGE);
190
+ }
191
+ var cpfSchema = requiredFormatString().transform(onlyDigits).refine((v) => PATTERNS.cpf.test(v), "CPF inv\xE1lido").refine(isValidCPF, "CPF inv\xE1lido");
192
+ requiredFormatString().transform(onlyDigits).refine((v) => PATTERNS.cnpj.test(v), "CNPJ inv\xE1lido").refine(isValidCNPJ, "CNPJ inv\xE1lido");
193
+ var cpfCnpjSchema = requiredFormatString().transform(onlyDigits).refine(
172
194
  (v) => PATTERNS.cpf.test(v) || PATTERNS.cnpj.test(v),
173
195
  "Documento deve ter 11 (CPF) ou 14 (CNPJ) d\xEDgitos"
174
196
  ).refine((v) => v.length === 11 ? isValidCPF(v) : isValidCNPJ(v), "Documento inv\xE1lido");
175
- var cepSchema = zod.z.string().transform(onlyDigits).refine((v) => PATTERNS.cep.test(v), "CEP inv\xE1lido");
176
- var phoneBRSchema = zod.z.string().transform(onlyDigits).refine((v) => PATTERNS.phoneBR.test(v), "Telefone inv\xE1lido");
177
- var emailSchema = zod.z.string().trim().refine((v) => PATTERNS.email.test(v), "E-mail inv\xE1lido");
178
- var dateDMYSchema = zod.z.string().refine((v) => PATTERNS.dateDMY.test(v), "Data inv\xE1lida").refine((v) => parseDMY(v) !== null, "Data inexistente no calend\xE1rio");
197
+ var cepSchema = requiredFormatString().transform(onlyDigits).refine((v) => PATTERNS.cep.test(v), "CEP inv\xE1lido");
198
+ var phoneBRSchema = requiredFormatString().transform(onlyDigits).refine((v) => PATTERNS.phoneBR.test(v), "Telefone inv\xE1lido");
199
+ var emailSchema = requiredFormatString().refine(
200
+ (v) => PATTERNS.email.test(v),
201
+ "E-mail inv\xE1lido"
202
+ );
203
+ var dateDMYSchema = requiredFormatString().refine((v) => PATTERNS.dateDMY.test(v), "Data inv\xE1lida").refine((v) => parseDMY(v) !== null, "Data inexistente no calend\xE1rio");
179
204
  var birthDateSchema = dateDMYSchema.refine(
180
205
  (v) => isAdultDMY(v),
181
206
  "\xC9 necess\xE1rio ser maior de idade (18+)"
@@ -184,10 +209,26 @@ var issueDateSchema = dateDMYSchema.refine(
184
209
  (v) => isNotFutureDMY(v),
185
210
  "Data de emiss\xE3o n\xE3o pode ser futura"
186
211
  );
187
- var currencySchema = zod.z.number({ invalid_type_error: "Valor monet\xE1rio inv\xE1lido" }).positive("Valor deve ser positivo");
188
- zod.z.number().int("Deve ser um n\xFAmero inteiro").min(1, "M\xEDnimo 1").max(28, "M\xE1ximo 28");
212
+ function parseBRLCurrency(value) {
213
+ if (typeof value !== "string") {
214
+ return value;
215
+ }
216
+ const trimmed = value.trim();
217
+ if (trimmed === "") {
218
+ return void 0;
219
+ }
220
+ const normalized = trimmed.replace(/R\$/gi, "").replace(/\s/g, "").replace(/\./g, "").replace(",", ".");
221
+ const parsed = Number(normalized);
222
+ return Number.isNaN(parsed) ? value : parsed;
223
+ }
224
+ var currencySchema = zod.z.preprocess(
225
+ parseBRLCurrency,
226
+ zod.z.number({ required_error: REQUIRED_MESSAGE, invalid_type_error: "Valor monet\xE1rio inv\xE1lido" }).positive("Valor deve ser positivo")
227
+ );
228
+ zod.z.number({ required_error: REQUIRED_MESSAGE, invalid_type_error: "Valor num\xE9rico inv\xE1lido" }).int("Deve ser um n\xFAmero inteiro").min(1, "M\xEDnimo 1").max(28, "M\xE1ximo 28");
189
229
  var formalizationExtras = {
190
230
  voucher_local_installation_address: fileUploadField,
231
+ proof_kinship_type: ProofKinshipTypeEnum.optional(),
191
232
  proof_kinship: fileUploadField.optional(),
192
233
  document_front_upload: fileUploadField,
193
234
  document_back_upload: fileUploadField,
@@ -230,7 +271,18 @@ function applyPartnerRefinement(data, ctx) {
230
271
  }
231
272
  }
232
273
  function applyCommonRefinements(data, ctx) {
233
- if ("energy_account_in_requester_name" in data && typeof data.energy_account_in_requester_name === "string" && data.energy_account_in_requester_name !== "nao_aplica" && !data.proof_kinship) {
274
+ const accountInThirdPartyName = data.energy_account_in_requester_name === "sim";
275
+ if (!accountInThirdPartyName) {
276
+ return;
277
+ }
278
+ if (!data.proof_kinship_type) {
279
+ ctx.addIssue({
280
+ code: zod.z.ZodIssueCode.custom,
281
+ path: ["proof_kinship_type"],
282
+ message: "Tipo de comprovante \xE9 obrigat\xF3rio quando a conta est\xE1 em nome de terceiro"
283
+ });
284
+ }
285
+ if (!data.proof_kinship) {
234
286
  ctx.addIssue({
235
287
  code: zod.z.ZodIssueCode.custom,
236
288
  path: ["proof_kinship"],
@@ -1,3 +1,3 @@
1
- export { alfaPfObject, alfaPfSchema } from '../../../chunk-THYAK7O3.mjs';
2
- import '../../../chunk-XII4F5RZ.mjs';
3
- import '../../../chunk-Y3FAMPYF.mjs';
1
+ export { alfaPfObject, alfaPfSchema } from '../../../chunk-TL5EG2ET.mjs';
2
+ import '../../../chunk-HSUS7XOX.mjs';
3
+ import '../../../chunk-26KEKEEF.mjs';