evo360-types 1.3.784 → 1.3.787
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.
- package/dist/apps/evo-chat/forward/zod-schemas.d.ts +4 -4
- package/dist/apps/evo-finops/zod-schemas.d.ts +465 -30
- package/dist/apps/evo-finops/zod-schemas.js +123 -2
- package/dist/apps/evo-finops/zod-schemas.ts +131 -0
- package/dist/types/evo-finops/common/contract.d.ts +8 -0
- package/dist/types/evo-finops/common/contract.ts +8 -0
- package/dist/types/evo-finops/common/proposal.d.ts +25 -0
- package/dist/types/evo-finops/common/proposal.ts +28 -0
- package/dist/types/nex-vendas/adhesion.d.ts +253 -0
- package/dist/types/nex-vendas/adhesion.js +15 -0
- package/dist/types/nex-vendas/adhesion.ts +280 -0
- package/dist/types/nex-vendas/index.d.ts +3 -0
- package/dist/types/nex-vendas/index.js +3 -0
- package/dist/types/nex-vendas/index.ts +3 -0
- package/dist/types/nex-vendas/journey.d.ts +82 -4
- package/dist/types/nex-vendas/journey.ts +86 -3
- package/dist/types/nex-vendas/notifications.d.ts +14 -0
- package/dist/types/nex-vendas/notifications.js +21 -0
- package/dist/types/nex-vendas/notifications.ts +21 -0
- package/dist/types/nex-vendas/offer.d.ts +129 -0
- package/dist/types/nex-vendas/offer.js +10 -0
- package/dist/types/nex-vendas/offer.ts +154 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.zServiceTaxInfoSchema = exports.zServiceLineItemSchema = exports.zServiceInvoiceStateSchema = exports.zProviderServiceInvoiceStatusSchema = exports.zExternalLinkSchema = exports.zExternalObjectTypeSchema = exports.zInvoiceSourceRefSchema = exports.zInvoiceSourceTypeSchema = exports.zInvoiceTakerRefSchema = exports.zInvoiceTakerSnapshotSchema = exports.zInvoiceTakerSnapshotAddressSchema = exports.zTakerDocumentSchema = exports.zTakerTaxProfileSchema = exports.zTakerProviderRefsSchema = exports.zTakerAddressSchema = exports.zInvoiceTakerTypeSchema = exports.zServiceSchema = exports.zCustomerServiceTaxInfoSchema = exports.zIssuerTaxProfileSchema = exports.zIssuerNfseConfigSchema = exports.zIssuerMunicipalCredentialsRefSchema = exports.zIssuerTaxRegimeSchema = exports.zIssuerCompanyIdentitySchema = exports.zIssuerCompanyAddressSchema = exports.zTaxProfileSyncStateSchema = exports.zAsaasProviderSchema = exports.zAsaasProviderAsaasBlockSchema = exports.zAsaasProviderCapabilitiesSchema = exports.zAsaasPaymentsCapabilitiesSchema = exports.zAsaasEnvFlagSchema = exports.zAsaasNfseCapabilitiesSchema = exports.zAsaasEnvAuthConfigSchema = exports.zAsaasSubaccountInputSchema = exports.zAsaasAccountScopeSchema = exports.zAsaasWebhookConfigSchema = exports.zRetryPolicySchema = exports.zAsaasWebhookEventSchema = exports.zAsaasAccountScopeModeSchema = exports.zProviderRemoteRefsSchema = exports.zProviderFiscalInfoPayloadSchema = exports.zProviderCredentialsInputSchema = exports.zProviderCredentialsSecretRefsSchema = exports.zProviderMunicipalOptionsSnapshotSchema = exports.zProviderOptionItemSchema = exports.zProviderMunicipalAuthTypeSchema = exports.zFinopsProviderBaseSchema = exports.zProviderStatusSchema = exports.zFinopsActionSchema = exports.zFinopsProviderTypeSchema = exports.zProviderEnvSchema = void 0;
|
|
4
|
-
exports.
|
|
5
|
-
exports.zNfseFeeReimbursementExecuteSchema = exports.zNfseFeeReimbursementCompetenciaSchema = exports.zNexFinopsPaymentMethodsDiscoverSchema = exports.zNexFinopsBillingCardChargeSweepSchema = exports.zEvoBillingPortalCardCaptureSchema = exports.zNexFinopsBillingCardChargeSchema = void 0;
|
|
4
|
+
exports.zNexFinopsPaymentMethodStatusSchema = exports.zNexFinopsPaymentMethodKindSchema = exports.zNexFinopsPriceTableWriteSchema = exports.zNexFinopsPriceLinesSchema = exports.zNexFinopsPriceLineSchema = exports.zNexFinopsPriceCapSchema = exports.zNexFinopsPriceCapTierSchema = exports.zNexFinopsContractAllowancesWriteSchema = exports.zNexFinopsUsageAlertDefaultsSchema = exports.zNexFinopsAlertThresholdSchema = exports.zNexFinopsContractAllowancesSchema = exports.zNexFinopsContractAllowanceSchema = exports.zNexVendasJourneyPaymentSchema = exports.zNexVendasJourneyPaymentSupersededSchema = exports.zNexVendasJourneyPaymentWebhookEventSchema = exports.zNexVendasJourneyBoletoSchema = exports.zNexVendasJourneyPaymentChooseSchema = exports.zNexVendasJourneyPaymentStateSchema = exports.zNexVendasJourneyPaymentKindSchema = exports.zNexVendasJourneyPaymentMethodSchema = exports.zNexFinopsContractAsaasInfoSchema = exports.zNexFinopsAsaasSubscriptionStatusSchema = exports.zNexFinopsPaymentMethodSchema = exports.zNexFinopsProposalSchema = exports.zNexFinopsProposalWriteSchema = exports.zNexFinopsProposalPrefillSchema = exports.zNexFinopsProposalLoyaltyPeriodSchema = exports.zNexFinopsProposalPaymentMethodSchema = exports.zNexVendasContractTypeSchema = exports.zNexVendasAttributionSchema = exports.zNexFinopsProposalStatusSchema = exports.zServiceInvoiceSchema = exports.zServiceInvoiceReplacedBySchema = exports.zServiceInvoiceReissuedFromSchema = exports.zServiceInvoiceReissueSchema = exports.zNfseReissueStageSchema = exports.zNfseReissueFieldSchema = exports.zNfseReissueStatusSchema = exports.zServiceInvoiceCancellationSchema = exports.zNfseCancellationStatusSchema = exports.zPaymentLinkSchema = exports.zPaymentLinkDocumentStateSchema = exports.zAsaasPaymentLinkSubscriptionCycleSchema = exports.zAsaasPaymentLinkChargeTypeSchema = exports.zAsaasPaymentLinkBillingTypeSchema = exports.zProviderPayloadSnapshotSchema = exports.zProviderTraceSchema = exports.zProviderInvoiceErrorSchema = exports.zProviderInvoiceIdentifiersSchema = exports.zProviderInvoiceLinksSchema = void 0;
|
|
5
|
+
exports.zNexVendasOfferStartRequestSchema = exports.zNexVendasOfferWriteSchema = exports.zNexVendasAdhesionConfigWriteSchema = exports.zNexVendasContractTemplateAdhesionSchema = exports.zNexVendasAcceptanceRequestSchema = exports.zNfseFeeReimbursementExecuteSchema = exports.zNfseFeeReimbursementCompetenciaSchema = exports.zNexFinopsPaymentMethodsDiscoverSchema = exports.zNexFinopsBillingCardChargeSweepSchema = exports.zEvoBillingPortalCardCaptureSchema = exports.zNexFinopsBillingCardChargeSchema = exports.zNexFinopsContractPaymentMethodsWriteSchema = exports.zNexFinopsPaymentMethodPatchSchema = void 0;
|
|
6
6
|
const zod_1 = require("zod");
|
|
7
7
|
const zod_schemas_1 = require("../shared/zod-schemas");
|
|
8
8
|
// ---- Provider enums and base ----
|
|
@@ -822,6 +822,22 @@ exports.zNexFinopsProposalStatusSchema = zod_1.z.enum([
|
|
|
822
822
|
"expired",
|
|
823
823
|
"canceled",
|
|
824
824
|
]);
|
|
825
|
+
/** feat-326 — atribuição de marketing do `start` (`INexVendasAttribution`). */
|
|
826
|
+
exports.zNexVendasAttributionSchema = zod_1.z
|
|
827
|
+
.object({
|
|
828
|
+
utm_source: zod_1.z.string().max(255).optional().nullable(),
|
|
829
|
+
utm_medium: zod_1.z.string().max(255).optional().nullable(),
|
|
830
|
+
utm_campaign: zod_1.z.string().max(255).optional().nullable(),
|
|
831
|
+
utm_term: zod_1.z.string().max(255).optional().nullable(),
|
|
832
|
+
utm_content: zod_1.z.string().max(255).optional().nullable(),
|
|
833
|
+
gclid: zod_1.z.string().max(255).optional().nullable(),
|
|
834
|
+
referrer: zod_1.z.string().max(2048).optional().nullable(),
|
|
835
|
+
site: zod_1.z.string().max(64).optional().nullable(),
|
|
836
|
+
landing_path: zod_1.z.string().max(512).optional().nullable(),
|
|
837
|
+
})
|
|
838
|
+
.strip();
|
|
839
|
+
/** feat-325 — tipo de formalização do contrato (`NexVendasContractType`). */
|
|
840
|
+
exports.zNexVendasContractTypeSchema = zod_1.z.enum(["assinatura_eletronica", "adesao"]);
|
|
825
841
|
exports.zNexFinopsProposalPaymentMethodSchema = zod_1.z.enum([
|
|
826
842
|
"boleto",
|
|
827
843
|
"card_subscription",
|
|
@@ -874,6 +890,17 @@ exports.zNexFinopsProposalWriteSchema = zod_1.z
|
|
|
874
890
|
loyalty_period: exports.zNexFinopsProposalLoyaltyPeriodSchema.optional().nullable(),
|
|
875
891
|
/** Chave do modelo, nunca o id do template no provider — id não entra por HTTP. */
|
|
876
892
|
contract_template_key: zod_1.z.string().max(64).optional().nullable(),
|
|
893
|
+
/**
|
|
894
|
+
* feat-325 — derivado no backend do modelo escolhido (o valor do cliente HTTP é
|
|
895
|
+
* sobrescrito). Está no schema para o backend não perder o campo no `.strip()`.
|
|
896
|
+
*/
|
|
897
|
+
contract_type: exports.zNexVendasContractTypeSchema.optional().nullable(),
|
|
898
|
+
/** feat-326 — preenchidos pelo `start` da oferta; no CRUD do vendedor ficam ausentes. */
|
|
899
|
+
offer_slug: zod_1.z.string().max(64).optional().nullable(),
|
|
900
|
+
attribution: exports.zNexVendasAttributionSchema.optional().nullable(),
|
|
901
|
+
client_request_id: zod_1.z.string().max(64).optional().nullable(),
|
|
902
|
+
/** Resolvido no servidor (uid do token ou `system:offer`); o valor do cliente é sobrescrito. */
|
|
903
|
+
created_by: zod_1.z.string().max(128).optional().nullable(),
|
|
877
904
|
terms: zod_1.z.string().nullable().optional(),
|
|
878
905
|
valid_until: zod_1.z
|
|
879
906
|
.string()
|
|
@@ -1221,3 +1248,97 @@ exports.zNfseFeeReimbursementExecuteSchema = zod_1.z
|
|
|
1221
1248
|
}),
|
|
1222
1249
|
})
|
|
1223
1250
|
.strict();
|
|
1251
|
+
// ---- Nexus Vendas — contrato por adesão (feat-325) ----
|
|
1252
|
+
const zSha256HexSchema = zod_1.z.string().regex(/^[a-f0-9]{64}$/, "sha256 must be 64 lowercase hex chars");
|
|
1253
|
+
/**
|
|
1254
|
+
* Corpo de `POST /journeys/:short_code/contract/accept` (público). IP, user-agent,
|
|
1255
|
+
* idioma e trace vêm da requisição, nunca do corpo.
|
|
1256
|
+
*/
|
|
1257
|
+
exports.zNexVendasAcceptanceRequestSchema = zod_1.z
|
|
1258
|
+
.object({
|
|
1259
|
+
cg_sha256: zSha256HexSchema,
|
|
1260
|
+
summary_sha256: zSha256HexSchema,
|
|
1261
|
+
declaration_version: zod_1.z.string().min(1).max(64),
|
|
1262
|
+
viewed_to_end: zod_1.z.boolean(),
|
|
1263
|
+
client_request_id: zod_1.z.string().min(8).max(64),
|
|
1264
|
+
})
|
|
1265
|
+
.strip();
|
|
1266
|
+
/** Bloco `adhesion` do modelo de contrato (metadados das CG gravados pelo backend no upload). */
|
|
1267
|
+
exports.zNexVendasContractTemplateAdhesionSchema = zod_1.z
|
|
1268
|
+
.object({
|
|
1269
|
+
cg: zod_1.z
|
|
1270
|
+
.object({
|
|
1271
|
+
version: zod_1.z.string().min(1).max(64),
|
|
1272
|
+
sha256: zSha256HexSchema,
|
|
1273
|
+
storage_path: zod_1.z.string().min(1).max(512),
|
|
1274
|
+
effective_from: zod_1.z
|
|
1275
|
+
.string()
|
|
1276
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/, "effective_from must be an ISO date (YYYY-MM-DD)"),
|
|
1277
|
+
filename: zod_1.z.string().min(1).max(255),
|
|
1278
|
+
})
|
|
1279
|
+
.strip(),
|
|
1280
|
+
require_email_otp: zod_1.z.boolean().optional().nullable(),
|
|
1281
|
+
})
|
|
1282
|
+
.strip();
|
|
1283
|
+
/** Doc `core/nexus/apps/nex-vendas/config/adhesion` (escrita pelo Nexus). */
|
|
1284
|
+
exports.zNexVendasAdhesionConfigWriteSchema = zod_1.z
|
|
1285
|
+
.object({
|
|
1286
|
+
declaration: zod_1.z
|
|
1287
|
+
.object({
|
|
1288
|
+
version: zod_1.z.string().min(1).max(64),
|
|
1289
|
+
text: zod_1.z.string().min(1).max(4000),
|
|
1290
|
+
})
|
|
1291
|
+
.strip(),
|
|
1292
|
+
document_access_days: zod_1.z.number().int().min(1).max(3650).optional().nullable(),
|
|
1293
|
+
corrections_per_hour: zod_1.z.number().int().min(1).max(100).optional().nullable(),
|
|
1294
|
+
})
|
|
1295
|
+
.strip();
|
|
1296
|
+
// ---- Nexus Vendas — ofertas self-service (feat-326) ----
|
|
1297
|
+
/**
|
|
1298
|
+
* Escrita da oferta `core/nexus/apps/nex-vendas/offers/{slug}` (Nexus → `nex_finops`).
|
|
1299
|
+
* Cobre TODOS os campos de `INexVendasOffer`: o que fica fora do `.strip()` some em
|
|
1300
|
+
* silêncio. `contract_type`, `created_by` e `start_count` são resolvidos no servidor
|
|
1301
|
+
* (o valor do cliente é sobrescrito) e estão aqui para o backend não perdê-los.
|
|
1302
|
+
* Regras de negócio (v1 só `card_subscription`, modelo ativo) ficam no use case.
|
|
1303
|
+
*/
|
|
1304
|
+
exports.zNexVendasOfferWriteSchema = zod_1.z
|
|
1305
|
+
.object({
|
|
1306
|
+
slug: zod_1.z
|
|
1307
|
+
.string()
|
|
1308
|
+
.min(2)
|
|
1309
|
+
.max(64)
|
|
1310
|
+
.regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, "slug must be kebab-case [a-z0-9-]"),
|
|
1311
|
+
name: zod_1.z.string().min(1).max(255),
|
|
1312
|
+
headline: zod_1.z.string().min(1).max(255),
|
|
1313
|
+
description: zod_1.z.string().max(4000).optional().nullable(),
|
|
1314
|
+
html_content: zod_1.z.string().optional().nullable(),
|
|
1315
|
+
base_amount: zod_1.z.number().nonnegative(),
|
|
1316
|
+
due_day: zod_1.z.number().int().min(1).max(31),
|
|
1317
|
+
accepted_payment_methods: zod_1.z.array(exports.zNexFinopsProposalPaymentMethodSchema).min(1),
|
|
1318
|
+
loyalty_period: exports.zNexFinopsProposalLoyaltyPeriodSchema,
|
|
1319
|
+
contract_template_key: zod_1.z.string().min(1).max(64),
|
|
1320
|
+
contract_type: exports.zNexVendasContractTypeSchema.optional().nullable(),
|
|
1321
|
+
allowances: exports.zNexFinopsContractAllowancesSchema.nullable(),
|
|
1322
|
+
terms: zod_1.z.string().optional().nullable(),
|
|
1323
|
+
proposal_valid_days: zod_1.z.number().int().min(1).max(90),
|
|
1324
|
+
site: zod_1.z.string().min(1).max(64),
|
|
1325
|
+
origem: zod_1.z.string().min(1).max(64).optional().nullable(),
|
|
1326
|
+
active: zod_1.z.boolean(),
|
|
1327
|
+
listed: zod_1.z.boolean(),
|
|
1328
|
+
created_by: zod_1.z.string().max(128).optional(),
|
|
1329
|
+
start_count: zod_1.z.number().int().nonnegative().optional().nullable(),
|
|
1330
|
+
last_start_at: zod_schemas_1.zFirestoreDateSchema.optional().nullable(),
|
|
1331
|
+
})
|
|
1332
|
+
.strip();
|
|
1333
|
+
/** Corpo de `POST /offers/:slug/start` (público). */
|
|
1334
|
+
exports.zNexVendasOfferStartRequestSchema = zod_1.z
|
|
1335
|
+
.object({
|
|
1336
|
+
name: zod_1.z.string().trim().min(2).max(255),
|
|
1337
|
+
email: zod_1.z.string().trim().email().max(255),
|
|
1338
|
+
phone: zod_1.z.string().trim().min(8).max(32),
|
|
1339
|
+
client_request_id: zod_1.z.string().min(8).max(64),
|
|
1340
|
+
turnstile_token: zod_1.z.string().min(1).max(4096),
|
|
1341
|
+
attribution: exports.zNexVendasAttributionSchema.optional().nullable(),
|
|
1342
|
+
privacy_accepted: zod_1.z.literal(true),
|
|
1343
|
+
})
|
|
1344
|
+
.strip();
|
|
@@ -898,6 +898,24 @@ export const zNexFinopsProposalStatusSchema = z.enum([
|
|
|
898
898
|
"canceled",
|
|
899
899
|
]);
|
|
900
900
|
|
|
901
|
+
/** feat-326 — atribuição de marketing do `start` (`INexVendasAttribution`). */
|
|
902
|
+
export const zNexVendasAttributionSchema = z
|
|
903
|
+
.object({
|
|
904
|
+
utm_source: z.string().max(255).optional().nullable(),
|
|
905
|
+
utm_medium: z.string().max(255).optional().nullable(),
|
|
906
|
+
utm_campaign: z.string().max(255).optional().nullable(),
|
|
907
|
+
utm_term: z.string().max(255).optional().nullable(),
|
|
908
|
+
utm_content: z.string().max(255).optional().nullable(),
|
|
909
|
+
gclid: z.string().max(255).optional().nullable(),
|
|
910
|
+
referrer: z.string().max(2048).optional().nullable(),
|
|
911
|
+
site: z.string().max(64).optional().nullable(),
|
|
912
|
+
landing_path: z.string().max(512).optional().nullable(),
|
|
913
|
+
})
|
|
914
|
+
.strip();
|
|
915
|
+
|
|
916
|
+
/** feat-325 — tipo de formalização do contrato (`NexVendasContractType`). */
|
|
917
|
+
export const zNexVendasContractTypeSchema = z.enum(["assinatura_eletronica", "adesao"]);
|
|
918
|
+
|
|
901
919
|
export const zNexFinopsProposalPaymentMethodSchema = z.enum([
|
|
902
920
|
"boleto",
|
|
903
921
|
"card_subscription",
|
|
@@ -953,6 +971,17 @@ export const zNexFinopsProposalWriteSchema = z
|
|
|
953
971
|
loyalty_period: zNexFinopsProposalLoyaltyPeriodSchema.optional().nullable(),
|
|
954
972
|
/** Chave do modelo, nunca o id do template no provider — id não entra por HTTP. */
|
|
955
973
|
contract_template_key: z.string().max(64).optional().nullable(),
|
|
974
|
+
/**
|
|
975
|
+
* feat-325 — derivado no backend do modelo escolhido (o valor do cliente HTTP é
|
|
976
|
+
* sobrescrito). Está no schema para o backend não perder o campo no `.strip()`.
|
|
977
|
+
*/
|
|
978
|
+
contract_type: zNexVendasContractTypeSchema.optional().nullable(),
|
|
979
|
+
/** feat-326 — preenchidos pelo `start` da oferta; no CRUD do vendedor ficam ausentes. */
|
|
980
|
+
offer_slug: z.string().max(64).optional().nullable(),
|
|
981
|
+
attribution: zNexVendasAttributionSchema.optional().nullable(),
|
|
982
|
+
client_request_id: z.string().max(64).optional().nullable(),
|
|
983
|
+
/** Resolvido no servidor (uid do token ou `system:offer`); o valor do cliente é sobrescrito. */
|
|
984
|
+
created_by: z.string().max(128).optional().nullable(),
|
|
956
985
|
terms: z.string().nullable().optional(),
|
|
957
986
|
valid_until: z
|
|
958
987
|
.string()
|
|
@@ -1344,3 +1373,105 @@ export const zNfseFeeReimbursementExecuteSchema = z
|
|
|
1344
1373
|
}),
|
|
1345
1374
|
})
|
|
1346
1375
|
.strict();
|
|
1376
|
+
|
|
1377
|
+
// ---- Nexus Vendas — contrato por adesão (feat-325) ----
|
|
1378
|
+
|
|
1379
|
+
const zSha256HexSchema = z.string().regex(/^[a-f0-9]{64}$/, "sha256 must be 64 lowercase hex chars");
|
|
1380
|
+
|
|
1381
|
+
/**
|
|
1382
|
+
* Corpo de `POST /journeys/:short_code/contract/accept` (público). IP, user-agent,
|
|
1383
|
+
* idioma e trace vêm da requisição, nunca do corpo.
|
|
1384
|
+
*/
|
|
1385
|
+
export const zNexVendasAcceptanceRequestSchema = z
|
|
1386
|
+
.object({
|
|
1387
|
+
cg_sha256: zSha256HexSchema,
|
|
1388
|
+
summary_sha256: zSha256HexSchema,
|
|
1389
|
+
declaration_version: z.string().min(1).max(64),
|
|
1390
|
+
viewed_to_end: z.boolean(),
|
|
1391
|
+
client_request_id: z.string().min(8).max(64),
|
|
1392
|
+
})
|
|
1393
|
+
.strip();
|
|
1394
|
+
|
|
1395
|
+
/** Bloco `adhesion` do modelo de contrato (metadados das CG gravados pelo backend no upload). */
|
|
1396
|
+
export const zNexVendasContractTemplateAdhesionSchema = z
|
|
1397
|
+
.object({
|
|
1398
|
+
cg: z
|
|
1399
|
+
.object({
|
|
1400
|
+
version: z.string().min(1).max(64),
|
|
1401
|
+
sha256: zSha256HexSchema,
|
|
1402
|
+
storage_path: z.string().min(1).max(512),
|
|
1403
|
+
effective_from: z
|
|
1404
|
+
.string()
|
|
1405
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/, "effective_from must be an ISO date (YYYY-MM-DD)"),
|
|
1406
|
+
filename: z.string().min(1).max(255),
|
|
1407
|
+
})
|
|
1408
|
+
.strip(),
|
|
1409
|
+
require_email_otp: z.boolean().optional().nullable(),
|
|
1410
|
+
})
|
|
1411
|
+
.strip();
|
|
1412
|
+
|
|
1413
|
+
/** Doc `core/nexus/apps/nex-vendas/config/adhesion` (escrita pelo Nexus). */
|
|
1414
|
+
export const zNexVendasAdhesionConfigWriteSchema = z
|
|
1415
|
+
.object({
|
|
1416
|
+
declaration: z
|
|
1417
|
+
.object({
|
|
1418
|
+
version: z.string().min(1).max(64),
|
|
1419
|
+
text: z.string().min(1).max(4000),
|
|
1420
|
+
})
|
|
1421
|
+
.strip(),
|
|
1422
|
+
document_access_days: z.number().int().min(1).max(3650).optional().nullable(),
|
|
1423
|
+
corrections_per_hour: z.number().int().min(1).max(100).optional().nullable(),
|
|
1424
|
+
})
|
|
1425
|
+
.strip();
|
|
1426
|
+
|
|
1427
|
+
// ---- Nexus Vendas — ofertas self-service (feat-326) ----
|
|
1428
|
+
|
|
1429
|
+
/**
|
|
1430
|
+
* Escrita da oferta `core/nexus/apps/nex-vendas/offers/{slug}` (Nexus → `nex_finops`).
|
|
1431
|
+
* Cobre TODOS os campos de `INexVendasOffer`: o que fica fora do `.strip()` some em
|
|
1432
|
+
* silêncio. `contract_type`, `created_by` e `start_count` são resolvidos no servidor
|
|
1433
|
+
* (o valor do cliente é sobrescrito) e estão aqui para o backend não perdê-los.
|
|
1434
|
+
* Regras de negócio (v1 só `card_subscription`, modelo ativo) ficam no use case.
|
|
1435
|
+
*/
|
|
1436
|
+
export const zNexVendasOfferWriteSchema = z
|
|
1437
|
+
.object({
|
|
1438
|
+
slug: z
|
|
1439
|
+
.string()
|
|
1440
|
+
.min(2)
|
|
1441
|
+
.max(64)
|
|
1442
|
+
.regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, "slug must be kebab-case [a-z0-9-]"),
|
|
1443
|
+
name: z.string().min(1).max(255),
|
|
1444
|
+
headline: z.string().min(1).max(255),
|
|
1445
|
+
description: z.string().max(4000).optional().nullable(),
|
|
1446
|
+
html_content: z.string().optional().nullable(),
|
|
1447
|
+
base_amount: z.number().nonnegative(),
|
|
1448
|
+
due_day: z.number().int().min(1).max(31),
|
|
1449
|
+
accepted_payment_methods: z.array(zNexFinopsProposalPaymentMethodSchema).min(1),
|
|
1450
|
+
loyalty_period: zNexFinopsProposalLoyaltyPeriodSchema,
|
|
1451
|
+
contract_template_key: z.string().min(1).max(64),
|
|
1452
|
+
contract_type: zNexVendasContractTypeSchema.optional().nullable(),
|
|
1453
|
+
allowances: zNexFinopsContractAllowancesSchema.nullable(),
|
|
1454
|
+
terms: z.string().optional().nullable(),
|
|
1455
|
+
proposal_valid_days: z.number().int().min(1).max(90),
|
|
1456
|
+
site: z.string().min(1).max(64),
|
|
1457
|
+
origem: z.string().min(1).max(64).optional().nullable(),
|
|
1458
|
+
active: z.boolean(),
|
|
1459
|
+
listed: z.boolean(),
|
|
1460
|
+
created_by: z.string().max(128).optional(),
|
|
1461
|
+
start_count: z.number().int().nonnegative().optional().nullable(),
|
|
1462
|
+
last_start_at: zFirestoreDateSchema.optional().nullable(),
|
|
1463
|
+
})
|
|
1464
|
+
.strip();
|
|
1465
|
+
|
|
1466
|
+
/** Corpo de `POST /offers/:slug/start` (público). */
|
|
1467
|
+
export const zNexVendasOfferStartRequestSchema = z
|
|
1468
|
+
.object({
|
|
1469
|
+
name: z.string().trim().min(2).max(255),
|
|
1470
|
+
email: z.string().trim().email().max(255),
|
|
1471
|
+
phone: z.string().trim().min(8).max(32),
|
|
1472
|
+
client_request_id: z.string().min(8).max(64),
|
|
1473
|
+
turnstile_token: z.string().min(1).max(4096),
|
|
1474
|
+
attribution: zNexVendasAttributionSchema.optional().nullable(),
|
|
1475
|
+
privacy_accepted: z.literal(true),
|
|
1476
|
+
})
|
|
1477
|
+
.strip();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IFireGlobalDoc } from '../../shared';
|
|
2
|
+
import type { NexVendasContractType } from '../../nex-vendas/adhesion';
|
|
2
3
|
/**
|
|
3
4
|
* `cancellation_requested`: o cliente pediu o cancelamento e o contrato está em
|
|
4
5
|
* processo de encerramento — mas **continua em vigência** e continua faturando
|
|
@@ -148,6 +149,13 @@ export interface INexFinopsContract extends IFireGlobalDoc {
|
|
|
148
149
|
* nasce com direito a estorno; venda assistida, não. Default `false`.
|
|
149
150
|
*/
|
|
150
151
|
refund_eligible?: boolean | null;
|
|
152
|
+
/**
|
|
153
|
+
* feat-325 D2 — cópia do tipo de formalização da jornada (gravada no draft pelo
|
|
154
|
+
* `ensureContract`). Ausente = `assinatura_eletronica`.
|
|
155
|
+
*/
|
|
156
|
+
contract_type?: NexVendasContractType | null;
|
|
157
|
+
/** feat-325 — id do registro em `nex-vendas/acceptances/` (só adesão, após o aceite). */
|
|
158
|
+
acceptance_id?: string | null;
|
|
151
159
|
/** Método com que o primeiro pagamento foi feito. `accepted_payment_methods` é a oferta; este é o fato. */
|
|
152
160
|
payment_method?: NexFinopsPaymentMethod | null;
|
|
153
161
|
asaas?: INexFinopsContractAsaasInfo | null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IFireGlobalDoc } from '../../shared';
|
|
2
|
+
import type { NexVendasContractType } from '../../nex-vendas/adhesion';
|
|
2
3
|
|
|
3
4
|
// ── Status & Recurrence ──
|
|
4
5
|
|
|
@@ -176,6 +177,13 @@ export interface INexFinopsContract extends IFireGlobalDoc {
|
|
|
176
177
|
* nasce com direito a estorno; venda assistida, não. Default `false`.
|
|
177
178
|
*/
|
|
178
179
|
refund_eligible?: boolean | null;
|
|
180
|
+
/**
|
|
181
|
+
* feat-325 D2 — cópia do tipo de formalização da jornada (gravada no draft pelo
|
|
182
|
+
* `ensureContract`). Ausente = `assinatura_eletronica`.
|
|
183
|
+
*/
|
|
184
|
+
contract_type?: NexVendasContractType | null;
|
|
185
|
+
/** feat-325 — id do registro em `nex-vendas/acceptances/` (só adesão, após o aceite). */
|
|
186
|
+
acceptance_id?: string | null;
|
|
179
187
|
|
|
180
188
|
// ── Pagamento efetivo (feat-131) ──
|
|
181
189
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { IFireGlobalDoc } from '../../shared';
|
|
2
|
+
import type { NexVendasContractType } from '../../nex-vendas/adhesion';
|
|
3
|
+
import type { INexVendasAttribution } from '../../nex-vendas/offer';
|
|
2
4
|
/**
|
|
3
5
|
* `viewed` é carimbado pelo endpoint público no primeiro acesso ao `short_code`.
|
|
4
6
|
* `expired` é **derivado** de `valid_until` na leitura (não há cron): o documento
|
|
@@ -87,11 +89,28 @@ export interface INexFinopsProposal extends IFireGlobalDoc {
|
|
|
87
89
|
* existe. Ausente é o legado anterior à feat-140 — envelope no modelo único.
|
|
88
90
|
*/
|
|
89
91
|
contract_template_key?: string | null;
|
|
92
|
+
/**
|
|
93
|
+
* feat-325 D2 — cópia congelada do `contract_type` do modelo escolhido.
|
|
94
|
+
* DERIVADO no backend a cada create/update a partir de `contract_template_key`;
|
|
95
|
+
* o valor enviado pelo cliente HTTP é sobrescrito. Ausente = `assinatura_eletronica`.
|
|
96
|
+
*/
|
|
97
|
+
contract_type?: NexVendasContractType | null;
|
|
90
98
|
valid_until: string;
|
|
91
99
|
sent_at?: Date | null;
|
|
92
100
|
viewed_at?: Date | null;
|
|
93
101
|
accepted_at?: Date | null;
|
|
94
102
|
notes?: string | null;
|
|
103
|
+
/** Slug da oferta que gerou esta proposta pelo `start`. Ausente = proposta do vendedor. */
|
|
104
|
+
offer_slug?: string | null;
|
|
105
|
+
/** Atribuição de marketing do `start` (utm, gclid, referrer, site, landing). */
|
|
106
|
+
attribution?: INexVendasAttribution | null;
|
|
107
|
+
/** UUID do navegador no `start`: repetição em 24 h devolve o mesmo `short_code`. */
|
|
108
|
+
client_request_id?: string | null;
|
|
109
|
+
/**
|
|
110
|
+
* Autor: uid do usuário Nexus, ou `system:offer` (`NEX_VENDAS_OFFER_PROPOSAL_CREATED_BY`)
|
|
111
|
+
* para a proposta gerada por oferta. Ausente em propostas anteriores à feat-326.
|
|
112
|
+
*/
|
|
113
|
+
created_by?: string | null;
|
|
95
114
|
}
|
|
96
115
|
/** O que o endpoint sem auth expõe. Sem ids internos, sem dado sensível. */
|
|
97
116
|
export interface INexFinopsProposalPublic {
|
|
@@ -112,6 +131,12 @@ export interface INexFinopsProposalPublic {
|
|
|
112
131
|
* envelope usa é decisão interna.
|
|
113
132
|
*/
|
|
114
133
|
loyalty_period_label?: string | null;
|
|
134
|
+
/**
|
|
135
|
+
* feat-325 — tipo de formalização, para o shop ajustar os passos ANTES do aceite
|
|
136
|
+
* da proposta ("Assinatura" × "Aceite"). Ausente em backend anterior à feat-325
|
|
137
|
+
* (= `assinatura_eletronica`).
|
|
138
|
+
*/
|
|
139
|
+
contract_type?: NexVendasContractType | null;
|
|
115
140
|
/**
|
|
116
141
|
* Dados que o vendedor cadastrou, por inteiro, para a página pública
|
|
117
142
|
* pré-preencher o formulário. `null` quando a proposta não tem prefill; cada
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { IFireGlobalDoc } from '../../shared';
|
|
2
|
+
import type { NexVendasContractType } from '../../nex-vendas/adhesion';
|
|
3
|
+
import type { INexVendasAttribution } from '../../nex-vendas/offer';
|
|
2
4
|
|
|
3
5
|
// ── Status, origem e formas de pagamento ──
|
|
4
6
|
|
|
@@ -115,6 +117,12 @@ export interface INexFinopsProposal extends IFireGlobalDoc {
|
|
|
115
117
|
* existe. Ausente é o legado anterior à feat-140 — envelope no modelo único.
|
|
116
118
|
*/
|
|
117
119
|
contract_template_key?: string | null;
|
|
120
|
+
/**
|
|
121
|
+
* feat-325 D2 — cópia congelada do `contract_type` do modelo escolhido.
|
|
122
|
+
* DERIVADO no backend a cada create/update a partir de `contract_template_key`;
|
|
123
|
+
* o valor enviado pelo cliente HTTP é sobrescrito. Ausente = `assinatura_eletronica`.
|
|
124
|
+
*/
|
|
125
|
+
contract_type?: NexVendasContractType | null;
|
|
118
126
|
|
|
119
127
|
// Validade — data ISO `YYYY-MM-DD`, igual a `starts_at`/`ends_at` do contrato
|
|
120
128
|
valid_until: string;
|
|
@@ -125,6 +133,20 @@ export interface INexFinopsProposal extends IFireGlobalDoc {
|
|
|
125
133
|
accepted_at?: Date | null;
|
|
126
134
|
|
|
127
135
|
notes?: string | null;
|
|
136
|
+
|
|
137
|
+
// ── Self-service (feat-326) ──
|
|
138
|
+
|
|
139
|
+
/** Slug da oferta que gerou esta proposta pelo `start`. Ausente = proposta do vendedor. */
|
|
140
|
+
offer_slug?: string | null;
|
|
141
|
+
/** Atribuição de marketing do `start` (utm, gclid, referrer, site, landing). */
|
|
142
|
+
attribution?: INexVendasAttribution | null;
|
|
143
|
+
/** UUID do navegador no `start`: repetição em 24 h devolve o mesmo `short_code`. */
|
|
144
|
+
client_request_id?: string | null;
|
|
145
|
+
/**
|
|
146
|
+
* Autor: uid do usuário Nexus, ou `system:offer` (`NEX_VENDAS_OFFER_PROPOSAL_CREATED_BY`)
|
|
147
|
+
* para a proposta gerada por oferta. Ausente em propostas anteriores à feat-326.
|
|
148
|
+
*/
|
|
149
|
+
created_by?: string | null;
|
|
128
150
|
}
|
|
129
151
|
|
|
130
152
|
// ── Projeção pública ──
|
|
@@ -148,6 +170,12 @@ export interface INexFinopsProposalPublic {
|
|
|
148
170
|
* envelope usa é decisão interna.
|
|
149
171
|
*/
|
|
150
172
|
loyalty_period_label?: string | null;
|
|
173
|
+
/**
|
|
174
|
+
* feat-325 — tipo de formalização, para o shop ajustar os passos ANTES do aceite
|
|
175
|
+
* da proposta ("Assinatura" × "Aceite"). Ausente em backend anterior à feat-325
|
|
176
|
+
* (= `assinatura_eletronica`).
|
|
177
|
+
*/
|
|
178
|
+
contract_type?: NexVendasContractType | null;
|
|
151
179
|
/**
|
|
152
180
|
* Dados que o vendedor cadastrou, por inteiro, para a página pública
|
|
153
181
|
* pré-preencher o formulário. `null` quando a proposta não tem prefill; cada
|