@77sol-lab/form-schemas 1.2.0 → 1.3.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.
@@ -1245,8 +1245,155 @@ var solfacilPjObject = zod.z.object({
1245
1245
  )
1246
1246
  });
1247
1247
  var solfacilPjSchema = solfacilPjObject.strict().superRefine(applyPjRefinements);
1248
+ var unifiedPfObject = zod.z.object({
1249
+ ...formalizationExtras,
1250
+ name: textField(),
1251
+ cep: cepSchema,
1252
+ cpf: cpfSchema,
1253
+ address: textField(),
1254
+ birth_date: birthDateSchema,
1255
+ number: textField(),
1256
+ sex: SexEnum,
1257
+ complement: textField(15).optional(),
1258
+ mother_name: textField(),
1259
+ district: textField(),
1260
+ energy_account_in_requester_name: textField(),
1261
+ city: textField(),
1262
+ energy_bill_owner_document: cpfCnpjSchema.optional(),
1263
+ state: textField(2),
1264
+ nationality: textField(),
1265
+ cellphone: phoneBRSchema,
1266
+ email: emailSchema,
1267
+ monthly_income: currencySchema,
1268
+ profession: textField(),
1269
+ type_doc: DocumentTypeEnum,
1270
+ doc: textField(15),
1271
+ issuing_body: textField(6),
1272
+ doc_issue_date: issueDateSchema,
1273
+ residence_situation: textField().optional(),
1274
+ months_in_residence: integerField.optional(),
1275
+ is_installation_at_requester: textField().optional(),
1276
+ civil_status: textField().optional(),
1277
+ uf_naturalness: textField(2).optional(),
1278
+ naturalness: textField().optional(),
1279
+ nature_of_occupation: textField().optional(),
1280
+ company_time: numberField.optional(),
1281
+ cnpj_proprietary: cnpjSchema.optional(),
1282
+ equity_value: currencySchema.optional(),
1283
+ emitting_state: textField(2).optional(),
1284
+ pep_relationship: textField().optional()
1285
+ });
1286
+ var unifiedPfSchema = unifiedPfObject.strict().superRefine(applyPfRefinements);
1287
+ var unifiedPjObject = zod.z.object({
1288
+ ...formalizationExtras,
1289
+ financing_company: zod.z.object({
1290
+ corporate_name: textField(),
1291
+ cnpj: cnpjSchema,
1292
+ foundation_date: issueDateSchema,
1293
+ address: textField(),
1294
+ number: textField(),
1295
+ email: emailSchema,
1296
+ complement: textField(15).optional(),
1297
+ phone: phoneBRSchema,
1298
+ district: textField(),
1299
+ legal_nature: textField(),
1300
+ city: textField(),
1301
+ state: textField(2),
1302
+ cep: cepSchema,
1303
+ economic_activity: textField().optional(),
1304
+ economic_activity_group: textField().optional(),
1305
+ monthly_income: currencySchema.optional(),
1306
+ residence_situation: textField().optional(),
1307
+ months_in_residence: integerField.optional(),
1308
+ capital_social: currencySchema.optional()
1309
+ }).strict(),
1310
+ financing_company_guarantor: zod.z.array(
1311
+ zod.z.object({
1312
+ name: textField(),
1313
+ cpf: cpfSchema,
1314
+ birth_date: birthDateSchema,
1315
+ address: textField(),
1316
+ number: textField(),
1317
+ cep: cepSchema,
1318
+ complement: textField(15).optional(),
1319
+ cellphone: phoneBRSchema,
1320
+ email: emailSchema,
1321
+ district: textField(),
1322
+ sex: SexEnum,
1323
+ city: textField(),
1324
+ state: textField(2),
1325
+ mother_name: textField(),
1326
+ nationality: textField(),
1327
+ office: textField().optional(),
1328
+ phone: phoneBRSchema.optional(),
1329
+ civil_status: textField().optional(),
1330
+ residence_situation: textField().optional(),
1331
+ months_in_residence: integerField.optional(),
1332
+ type_doc: DocumentTypeEnum.optional(),
1333
+ doc: textField().optional(),
1334
+ issuing_body: textField().optional(),
1335
+ uf_issuing_body: textField(2).optional(),
1336
+ doc_issue_date: issueDateSchema.optional(),
1337
+ doc_expiration_date: dateDMYSchema.optional(),
1338
+ monthly_income: currencySchema.optional(),
1339
+ patrimony: currencySchema.optional(),
1340
+ naturalness: textField().optional(),
1341
+ uf_naturalness: textField(2).optional(),
1342
+ pep_relationship: textField().optional(),
1343
+ entry_date: issueDateSchema.optional(),
1344
+ doc_issuance_uf: textField(2).optional()
1345
+ }).strict()
1346
+ ).optional(),
1347
+ financing_company_qsa: zod.z.array(
1348
+ zod.z.object({
1349
+ name: textField(),
1350
+ cpf: cpfSchema,
1351
+ birth_date: birthDateSchema,
1352
+ address: textField(),
1353
+ number: textField(),
1354
+ cep: cepSchema,
1355
+ complement: textField(15).optional(),
1356
+ cellphone: phoneBRSchema,
1357
+ email: emailSchema,
1358
+ district: textField(),
1359
+ sex: SexEnum,
1360
+ city: textField(),
1361
+ state: textField(2),
1362
+ mother_name: textField(),
1363
+ nationality: textField(),
1364
+ office: textField().optional(),
1365
+ phone: phoneBRSchema.optional(),
1366
+ civil_status: textField().optional(),
1367
+ residence_situation: textField().optional(),
1368
+ months_in_residence: integerField.optional(),
1369
+ type_doc: DocumentTypeEnum.optional(),
1370
+ doc: textField().optional(),
1371
+ issuing_body: textField().optional(),
1372
+ uf_issuing_body: textField(2).optional(),
1373
+ doc_issue_date: issueDateSchema.optional(),
1374
+ doc_expiration_date: dateDMYSchema.optional(),
1375
+ monthly_income: currencySchema.optional(),
1376
+ patrimony: currencySchema.optional(),
1377
+ naturalness: textField().optional(),
1378
+ uf_naturalness: textField(2).optional(),
1379
+ pep_relationship: textField().optional(),
1380
+ entry_date: issueDateSchema.optional(),
1381
+ doc_issuance_uf: textField(2).optional()
1382
+ }).strict()
1383
+ ).optional()
1384
+ });
1385
+ var unifiedPjSchema = unifiedPjObject.strict().superRefine(applyPjRefinements);
1248
1386
 
1249
1387
  // src/domains/financing/formalization/registry.ts
1388
+ var UNIFIED_SLUG = "unified";
1389
+ var unifiedSchemaByPerson = {
1390
+ pf: unifiedPfSchema,
1391
+ pj: unifiedPjSchema
1392
+ };
1393
+ var unifiedBaseSchemaByPerson = {
1394
+ pf: unifiedPfObject,
1395
+ pj: unifiedPjObject
1396
+ };
1250
1397
  var pfSchemaRegistry = {
1251
1398
  credito77: credito77PfSchema,
1252
1399
  losango: losangoPfSchema,
@@ -1321,12 +1468,18 @@ function isCredito77WithoutPrestamista(bank, person, options) {
1321
1468
  return bank === "credito77" && person === "pf" && !options.prestamistaIncluso;
1322
1469
  }
1323
1470
  function getFormalizationSchema(bank, person, options = {}) {
1471
+ if (bank === UNIFIED_SLUG) {
1472
+ return unifiedSchemaByPerson[person];
1473
+ }
1324
1474
  if (isCredito77WithoutPrestamista(bank, person, options)) {
1325
1475
  return credito77PfObject.omit(CREDITO77_PRESTAMISTA_FIELDS).strict().superRefine(applyPfRefinements);
1326
1476
  }
1327
1477
  return person === "pf" ? pfSchemaRegistry[bank] : pjSchemaRegistry[bank];
1328
1478
  }
1329
1479
  function getFormalizationBaseSchema(bank, person, options = {}) {
1480
+ if (bank === UNIFIED_SLUG) {
1481
+ return unifiedBaseSchemaByPerson[person];
1482
+ }
1330
1483
  if (isCredito77WithoutPrestamista(bank, person, options)) {
1331
1484
  return credito77PfObject.omit(CREDITO77_PRESTAMISTA_FIELDS);
1332
1485
  }
@@ -1434,6 +1587,7 @@ exports.BankEnum = BankEnum;
1434
1587
  exports.FORMALIZATION_FIELD_META = FORMALIZATION_FIELD_META;
1435
1588
  exports.NATIONALITY_BRAZIL = NATIONALITY_BRAZIL;
1436
1589
  exports.OCCUPATIONS_REQUIRING_CNPJ = OCCUPATIONS_REQUIRING_CNPJ;
1590
+ exports.UNIFIED_SLUG = UNIFIED_SLUG;
1437
1591
  exports.applyPfRefinements = applyPfRefinements;
1438
1592
  exports.applyPjRefinements = applyPjRefinements;
1439
1593
  exports.getFormalizationBaseSchema = getFormalizationBaseSchema;
@@ -1442,3 +1596,7 @@ exports.pfBaseSchemaRegistry = pfBaseSchemaRegistry;
1442
1596
  exports.pfSchemaRegistry = pfSchemaRegistry;
1443
1597
  exports.pjBaseSchemaRegistry = pjBaseSchemaRegistry;
1444
1598
  exports.pjSchemaRegistry = pjSchemaRegistry;
1599
+ exports.unifiedPfObject = unifiedPfObject;
1600
+ exports.unifiedPfSchema = unifiedPfSchema;
1601
+ exports.unifiedPjObject = unifiedPjObject;
1602
+ exports.unifiedPjSchema = unifiedPjSchema;
@@ -1,10 +1,12 @@
1
- export { BANK_SLUGS, BankEnum, FORMALIZATION_FIELD_META, getFormalizationBaseSchema, getFormalizationSchema, pfBaseSchemaRegistry, pfSchemaRegistry, pjBaseSchemaRegistry, pjSchemaRegistry } from '../../chunk-X4DDGGAB.mjs';
1
+ export { BANK_SLUGS, BankEnum, FORMALIZATION_FIELD_META, UNIFIED_SLUG, getFormalizationBaseSchema, getFormalizationSchema, pfBaseSchemaRegistry, pfSchemaRegistry, pjBaseSchemaRegistry, pjSchemaRegistry } from '../../chunk-KKGV43J4.mjs';
2
2
  import '../../chunk-TTHE6D3Y.mjs';
3
3
  import '../../chunk-MWPQSGDD.mjs';
4
4
  import '../../chunk-RMWCQ6YU.mjs';
5
5
  import '../../chunk-B7RDVG4R.mjs';
6
6
  import '../../chunk-KXEEZLMR.mjs';
7
7
  import '../../chunk-XUMC3TQU.mjs';
8
+ export { unifiedPfObject, unifiedPfSchema } from '../../chunk-52KJIJBF.mjs';
9
+ export { unifiedPjObject, unifiedPjSchema } from '../../chunk-XNACW46V.mjs';
8
10
  import '../../chunk-ORO6OVTB.mjs';
9
11
  import '../../chunk-36GQASLI.mjs';
10
12
  import '../../chunk-2TGZGHS3.mjs';