evo360-types 1.3.647 → 1.3.654

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.
@@ -143,6 +143,16 @@ exports.zCsqAlertSchema = zod_1.z.object({
143
143
  resolved_note: zod_1.z.string().optional(),
144
144
  appointment_id: zod_1.z.string().optional(),
145
145
  calendar_id: zod_1.z.string().optional(),
146
+ /** feat-206 F6a: claim que gerou o alerta de agenda (rechecagem tardia). */
147
+ appointment_claim: zod_1.z
148
+ .object({
149
+ date: zod_1.z.string(),
150
+ time: zod_1.z.string().optional(),
151
+ professional: zod_1.z.string().optional(),
152
+ patient_name: zod_1.z.string().optional(),
153
+ modality: zod_1.z.string().optional(),
154
+ })
155
+ .optional(),
146
156
  first_seen_ticket_id: zod_1.z.string(),
147
157
  created_at: zod_schemas_1.zFirestoreDateSchema,
148
158
  });
@@ -212,6 +222,8 @@ exports.zCsqClaimAppointmentInformedSchema = zod_1.z.object({
212
222
  modality: zod_1.z.string().optional(),
213
223
  /** Nome do PACIENTE informado na conversa (pode diferir do lead: mae/filho). */
214
224
  patient_name: zod_1.z.string().optional(),
225
+ /** feat-206 F6: cancelado ou substituido depois, na mesma jornada. */
226
+ superseded: zod_1.z.boolean().optional(),
215
227
  evidence: zod_1.z.array(exports.zCsqEvidenceSchema),
216
228
  });
217
229
  exports.zCsqClaimPromiseSchema = zod_1.z.object({
@@ -286,13 +298,14 @@ exports.zCsqClaimTypeSchema = zod_1.z.enum([
286
298
  /** Linha da tabela "o que foi dito x o que consta" (report-spec §2.5). */
287
299
  exports.zCsqCrossCheckSchema = zod_1.z.object({
288
300
  claim_type: exports.zCsqClaimTypeSchema,
289
- result: zod_1.z.enum(["match", "mismatch", "missing", "inconclusive"]),
301
+ result: zod_1.z.enum(["match", "mismatch", "missing", "inconclusive", "cancelled_after"]),
290
302
  expected: zod_1.z.string(),
291
303
  found: zod_1.z.string().nullable(),
292
304
  alert_code: exports.zCsqAlertCodeSchema.optional(),
293
305
  note: zod_1.z.string().optional(),
294
306
  appointment_id: zod_1.z.string().optional(),
295
307
  calendar_id: zod_1.z.string().optional(),
308
+ matched_by: zod_1.z.enum(["linked", "phone", "name", "name_fuzzy"]).optional(),
296
309
  });
297
310
  // ───────── Avaliacao (report-spec §4) ─────────
298
311
  exports.zCsqCriterionScoreSchema = zod_1.z.object({
@@ -375,6 +388,8 @@ exports.zCsqTriageReasonSchema = zod_1.z.enum([
375
388
  "reopen_without_new_messages",
376
389
  "automation_only",
377
390
  "ack_only",
391
+ "no_attendant_message",
392
+ "attendant_ack_only",
378
393
  "forced",
379
394
  ]);
380
395
  exports.zCsqTriageDecisionSchema = zod_1.z.object({
@@ -468,6 +483,8 @@ exports.zCsqAppointmentFactSchema = zod_1.z.object({
468
483
  professional_name: zod_1.z.string().optional(),
469
484
  modality: zod_1.z.string().optional(),
470
485
  created_at: zod_schemas_1.zFirestoreDateSchema.optional(),
486
+ removed: zod_1.z.enum(["deleted", "cancelled"]).optional(),
487
+ removed_at: zod_schemas_1.zFirestoreDateSchema.optional(),
471
488
  });
472
489
  exports.zCsqOverlapAppointmentFactSchema = zod_1.z.object({
473
490
  id: zod_1.z.string(),
@@ -163,6 +163,16 @@ export const zCsqAlertSchema = z.object({
163
163
  resolved_note: z.string().optional(),
164
164
  appointment_id: z.string().optional(),
165
165
  calendar_id: z.string().optional(),
166
+ /** feat-206 F6a: claim que gerou o alerta de agenda (rechecagem tardia). */
167
+ appointment_claim: z
168
+ .object({
169
+ date: z.string(),
170
+ time: z.string().optional(),
171
+ professional: z.string().optional(),
172
+ patient_name: z.string().optional(),
173
+ modality: z.string().optional(),
174
+ })
175
+ .optional(),
166
176
  first_seen_ticket_id: z.string(),
167
177
  created_at: zFirestoreDateSchema,
168
178
  });
@@ -242,6 +252,8 @@ export const zCsqClaimAppointmentInformedSchema = z.object({
242
252
  modality: z.string().optional(),
243
253
  /** Nome do PACIENTE informado na conversa (pode diferir do lead: mae/filho). */
244
254
  patient_name: z.string().optional(),
255
+ /** feat-206 F6: cancelado ou substituido depois, na mesma jornada. */
256
+ superseded: z.boolean().optional(),
245
257
  evidence: z.array(zCsqEvidenceSchema),
246
258
  });
247
259
 
@@ -327,13 +339,14 @@ export const zCsqClaimTypeSchema = z.enum([
327
339
  /** Linha da tabela "o que foi dito x o que consta" (report-spec §2.5). */
328
340
  export const zCsqCrossCheckSchema = z.object({
329
341
  claim_type: zCsqClaimTypeSchema,
330
- result: z.enum(["match", "mismatch", "missing", "inconclusive"]),
342
+ result: z.enum(["match", "mismatch", "missing", "inconclusive", "cancelled_after"]),
331
343
  expected: z.string(),
332
344
  found: z.string().nullable(),
333
345
  alert_code: zCsqAlertCodeSchema.optional(),
334
346
  note: z.string().optional(),
335
347
  appointment_id: z.string().optional(),
336
348
  calendar_id: z.string().optional(),
349
+ matched_by: z.enum(["linked", "phone", "name", "name_fuzzy"]).optional(),
337
350
  });
338
351
 
339
352
  // ───────── Avaliacao (report-spec §4) ─────────
@@ -432,6 +445,8 @@ export const zCsqTriageReasonSchema = z.enum([
432
445
  "reopen_without_new_messages",
433
446
  "automation_only",
434
447
  "ack_only",
448
+ "no_attendant_message",
449
+ "attendant_ack_only",
435
450
  "forced",
436
451
  ]);
437
452
 
@@ -538,6 +553,8 @@ export const zCsqAppointmentFactSchema = z.object({
538
553
  professional_name: z.string().optional(),
539
554
  modality: z.string().optional(),
540
555
  created_at: zFirestoreDateSchema.optional(),
556
+ removed: z.enum(["deleted", "cancelled"]).optional(),
557
+ removed_at: zFirestoreDateSchema.optional(),
541
558
  });
542
559
 
543
560
  export const zCsqOverlapAppointmentFactSchema = z.object({
@@ -14573,6 +14573,15 @@ export declare const zNexVendasJourneyPaymentSchema: z.ZodObject<{
14573
14573
  due_date?: string | null | undefined;
14574
14574
  } | null | undefined;
14575
14575
  paid_at?: Date | null | undefined;
14576
+ superseded?: {
14577
+ method: "payment_link" | "boleto" | "card_subscription";
14578
+ kind: "payment_link" | "boleto" | "asaas_checkout";
14579
+ at: Date;
14580
+ revoked?: boolean | null | undefined;
14581
+ checkout_id?: string | null | undefined;
14582
+ payment_id?: string | null | undefined;
14583
+ payment_link_id?: string | null | undefined;
14584
+ }[] | null | undefined;
14576
14585
  subscription_id?: string | null | undefined;
14577
14586
  checkout_id?: string | null | undefined;
14578
14587
  payment_link_id?: string | null | undefined;
@@ -14585,15 +14594,6 @@ export declare const zNexVendasJourneyPaymentSchema: z.ZodObject<{
14585
14594
  payment_id?: string | null | undefined;
14586
14595
  payment_status?: string | null | undefined;
14587
14596
  }[] | null | undefined;
14588
- superseded?: {
14589
- method: "payment_link" | "boleto" | "card_subscription";
14590
- kind: "payment_link" | "boleto" | "asaas_checkout";
14591
- at: Date;
14592
- revoked?: boolean | null | undefined;
14593
- checkout_id?: string | null | undefined;
14594
- payment_id?: string | null | undefined;
14595
- payment_link_id?: string | null | undefined;
14596
- }[] | null | undefined;
14597
14597
  }, {
14598
14598
  state: "awaiting_payment" | "paid" | "none" | "compensating";
14599
14599
  link?: string | null | undefined;
@@ -14612,6 +14612,15 @@ export declare const zNexVendasJourneyPaymentSchema: z.ZodObject<{
14612
14612
  due_date?: string | null | undefined;
14613
14613
  } | null | undefined;
14614
14614
  paid_at?: unknown;
14615
+ superseded?: {
14616
+ method: "payment_link" | "boleto" | "card_subscription";
14617
+ kind: "payment_link" | "boleto" | "asaas_checkout";
14618
+ revoked?: boolean | null | undefined;
14619
+ at?: unknown;
14620
+ checkout_id?: string | null | undefined;
14621
+ payment_id?: string | null | undefined;
14622
+ payment_link_id?: string | null | undefined;
14623
+ }[] | null | undefined;
14615
14624
  subscription_id?: string | null | undefined;
14616
14625
  checkout_id?: string | null | undefined;
14617
14626
  payment_link_id?: string | null | undefined;
@@ -14624,15 +14633,6 @@ export declare const zNexVendasJourneyPaymentSchema: z.ZodObject<{
14624
14633
  payment_id?: string | null | undefined;
14625
14634
  payment_status?: string | null | undefined;
14626
14635
  }[] | null | undefined;
14627
- superseded?: {
14628
- method: "payment_link" | "boleto" | "card_subscription";
14629
- kind: "payment_link" | "boleto" | "asaas_checkout";
14630
- revoked?: boolean | null | undefined;
14631
- at?: unknown;
14632
- checkout_id?: string | null | undefined;
14633
- payment_id?: string | null | undefined;
14634
- payment_link_id?: string | null | undefined;
14635
- }[] | null | undefined;
14636
14636
  }>;
14637
14637
  /**
14638
14638
  * Franquia de uma métrica no contrato. `included` é número discreto e inteiro
@@ -14785,6 +14785,21 @@ export declare const zNexFinopsBillingCardChargeSchema: z.ZodObject<{
14785
14785
  taker_id?: string | undefined;
14786
14786
  allow_early?: boolean | undefined;
14787
14787
  }>;
14788
+ /**
14789
+ * Portal (`evo_billing`) `POST /me/payment-methods/capture` (feat-253 fatia 9).
14790
+ * O cliente confirma a cobrança e o valor que viu na prévia (`capture_target`);
14791
+ * provider/ambiente/tomador são resolvidos no backend. `.strip()`: nada de cartão entra aqui.
14792
+ */
14793
+ export declare const zEvoBillingPortalCardCaptureSchema: z.ZodObject<{
14794
+ billing_id: z.ZodString;
14795
+ expected_value: z.ZodNumber;
14796
+ }, "strip", z.ZodTypeAny, {
14797
+ expected_value: number;
14798
+ billing_id: string;
14799
+ }, {
14800
+ expected_value: number;
14801
+ billing_id: string;
14802
+ }>;
14788
14803
  /** `POST /payment-methods/discover` — sem `confirm` é dry-run. */
14789
14804
  export declare const zNexFinopsPaymentMethodsDiscoverSchema: z.ZodObject<{
14790
14805
  customer_id: z.ZodOptional<z.ZodString>;
@@ -1,7 +1,7 @@
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.zNexFinopsPaymentMethodsDiscoverSchema = exports.zNexFinopsBillingCardChargeSchema = exports.zNexFinopsContractPaymentMethodsWriteSchema = exports.zNexFinopsPaymentMethodPatchSchema = exports.zNexFinopsPaymentMethodStatusSchema = exports.zNexFinopsPaymentMethodKindSchema = 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.zNexFinopsProposalStatusSchema = exports.zServiceInvoiceSchema = exports.zPaymentLinkSchema = exports.zPaymentLinkDocumentStateSchema = exports.zAsaasPaymentLinkSubscriptionCycleSchema = exports.zAsaasPaymentLinkChargeTypeSchema = exports.zAsaasPaymentLinkBillingTypeSchema = exports.zProviderPayloadSnapshotSchema = exports.zProviderTraceSchema = exports.zProviderInvoiceErrorSchema = exports.zProviderInvoiceIdentifiersSchema = exports.zProviderInvoiceLinksSchema = void 0;
4
+ exports.zNexFinopsPaymentMethodsDiscoverSchema = exports.zEvoBillingPortalCardCaptureSchema = exports.zNexFinopsBillingCardChargeSchema = exports.zNexFinopsContractPaymentMethodsWriteSchema = exports.zNexFinopsPaymentMethodPatchSchema = exports.zNexFinopsPaymentMethodStatusSchema = exports.zNexFinopsPaymentMethodKindSchema = 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.zNexFinopsProposalStatusSchema = exports.zServiceInvoiceSchema = exports.zPaymentLinkSchema = exports.zPaymentLinkDocumentStateSchema = exports.zAsaasPaymentLinkSubscriptionCycleSchema = exports.zAsaasPaymentLinkChargeTypeSchema = exports.zAsaasPaymentLinkBillingTypeSchema = exports.zProviderPayloadSnapshotSchema = exports.zProviderTraceSchema = exports.zProviderInvoiceErrorSchema = exports.zProviderInvoiceIdentifiersSchema = exports.zProviderInvoiceLinksSchema = void 0;
5
5
  const zod_1 = require("zod");
6
6
  const zod_schemas_1 = require("../shared/zod-schemas");
7
7
  // ---- Provider enums and base ----
@@ -984,6 +984,17 @@ exports.zNexFinopsBillingCardChargeSchema = zod_1.z
984
984
  allow_early: zod_1.z.boolean().optional(),
985
985
  })
986
986
  .strip();
987
+ /**
988
+ * Portal (`evo_billing`) `POST /me/payment-methods/capture` (feat-253 fatia 9).
989
+ * O cliente confirma a cobrança e o valor que viu na prévia (`capture_target`);
990
+ * provider/ambiente/tomador são resolvidos no backend. `.strip()`: nada de cartão entra aqui.
991
+ */
992
+ exports.zEvoBillingPortalCardCaptureSchema = zod_1.z
993
+ .object({
994
+ billing_id: zod_1.z.string().min(1).max(128),
995
+ expected_value: zod_1.z.number(),
996
+ })
997
+ .strip();
987
998
  /** `POST /payment-methods/discover` — sem `confirm` é dry-run. */
988
999
  exports.zNexFinopsPaymentMethodsDiscoverSchema = zod_1.z
989
1000
  .object({
@@ -1080,6 +1080,18 @@ export const zNexFinopsBillingCardChargeSchema = z
1080
1080
  })
1081
1081
  .strip();
1082
1082
 
1083
+ /**
1084
+ * Portal (`evo_billing`) `POST /me/payment-methods/capture` (feat-253 fatia 9).
1085
+ * O cliente confirma a cobrança e o valor que viu na prévia (`capture_target`);
1086
+ * provider/ambiente/tomador são resolvidos no backend. `.strip()`: nada de cartão entra aqui.
1087
+ */
1088
+ export const zEvoBillingPortalCardCaptureSchema = z
1089
+ .object({
1090
+ billing_id: z.string().min(1).max(128),
1091
+ expected_value: z.number(),
1092
+ })
1093
+ .strip();
1094
+
1083
1095
  /** `POST /payment-methods/discover` — sem `confirm` é dry-run. */
1084
1096
  export const zNexFinopsPaymentMethodsDiscoverSchema = z
1085
1097
  .object({
@@ -5,3 +5,45 @@ export declare const EvoBillingPermissions: {
5
5
  readonly Admin: "evo_billing_admin";
6
6
  };
7
7
  export type EvoBillingPermissions = (typeof EvoBillingPermissions)[keyof typeof EvoBillingPermissions];
8
+ export type EvoBillingPortalPaymentMethodKind = 'asaas_card_token' | 'asaas_subscription';
9
+ export type EvoBillingPortalPaymentMethodStatus = 'active' | 'failing' | 'inactive' | 'revoked';
10
+ export interface IEvoBillingPortalPaymentMethodContract {
11
+ contract_id: string;
12
+ name: string | null;
13
+ /** O contrato cobra neste método por padrão. */
14
+ is_default: boolean;
15
+ }
16
+ export interface IEvoBillingPortalPaymentMethod {
17
+ /** Chave opaca só para a lista (não é o id do método). */
18
+ key: string;
19
+ kind: EvoBillingPortalPaymentMethodKind;
20
+ status: EvoBillingPortalPaymentMethodStatus;
21
+ brand: string | null;
22
+ last4: string | null;
23
+ /** Contratos do cliente que usam este método. */
24
+ contracts: IEvoBillingPortalPaymentMethodContract[];
25
+ }
26
+ /** Cobrança que o "Cadastrar/trocar cartão" usaria agora (ou null: aguarda a próxima). */
27
+ export interface IEvoBillingPortalCardCaptureTarget {
28
+ billing_id: string;
29
+ contract_id: string | null;
30
+ competency_key: string | null;
31
+ value: number;
32
+ due_date: string | null;
33
+ }
34
+ export interface IEvoBillingPortalPaymentMethodsResponse {
35
+ ok: true;
36
+ items: IEvoBillingPortalPaymentMethod[];
37
+ /** O cadastro de cartão pelo portal está ligado no ambiente atual. */
38
+ capture_enabled: boolean;
39
+ capture_target: IEvoBillingPortalCardCaptureTarget | null;
40
+ }
41
+ export interface IEvoBillingPortalCardCaptureResponse {
42
+ ok: true;
43
+ billing_id: string;
44
+ invoice_url: string;
45
+ value: number;
46
+ due_date: string;
47
+ reused: boolean;
48
+ }
49
+ export type EvoBillingPortalCardCaptureErrorCode = 'no_open_billing' | 'card_capture_unavailable' | 'customer_document_missing' | 'taker_without_remote_customer' | 'preview_changed' | 'already_paid' | 'internal';
@@ -8,3 +8,64 @@ export const EvoBillingPermissions = {
8
8
 
9
9
  export type EvoBillingPermissions =
10
10
  (typeof EvoBillingPermissions)[keyof typeof EvoBillingPermissions];
11
+
12
+ // ── Métodos de pagamento no portal (feat-253 fatia 9) ──
13
+ //
14
+ // Projeção do `payment_methods` para o cliente. PCI/escopo: só bandeira + últimos 4.
15
+ // Sem id do método, `cus_`, `pay_`/`sub_` ou token.
16
+
17
+ export type EvoBillingPortalPaymentMethodKind = 'asaas_card_token' | 'asaas_subscription';
18
+ export type EvoBillingPortalPaymentMethodStatus = 'active' | 'failing' | 'inactive' | 'revoked';
19
+
20
+ export interface IEvoBillingPortalPaymentMethodContract {
21
+ contract_id: string;
22
+ name: string | null;
23
+ /** O contrato cobra neste método por padrão. */
24
+ is_default: boolean;
25
+ }
26
+
27
+ export interface IEvoBillingPortalPaymentMethod {
28
+ /** Chave opaca só para a lista (não é o id do método). */
29
+ key: string;
30
+ kind: EvoBillingPortalPaymentMethodKind;
31
+ status: EvoBillingPortalPaymentMethodStatus;
32
+ brand: string | null;
33
+ last4: string | null;
34
+ /** Contratos do cliente que usam este método. */
35
+ contracts: IEvoBillingPortalPaymentMethodContract[];
36
+ }
37
+
38
+ /** Cobrança que o "Cadastrar/trocar cartão" usaria agora (ou null: aguarda a próxima). */
39
+ export interface IEvoBillingPortalCardCaptureTarget {
40
+ billing_id: string;
41
+ contract_id: string | null;
42
+ competency_key: string | null;
43
+ value: number;
44
+ due_date: string | null;
45
+ }
46
+
47
+ export interface IEvoBillingPortalPaymentMethodsResponse {
48
+ ok: true;
49
+ items: IEvoBillingPortalPaymentMethod[];
50
+ /** O cadastro de cartão pelo portal está ligado no ambiente atual. */
51
+ capture_enabled: boolean;
52
+ capture_target: IEvoBillingPortalCardCaptureTarget | null;
53
+ }
54
+
55
+ export interface IEvoBillingPortalCardCaptureResponse {
56
+ ok: true;
57
+ billing_id: string;
58
+ invoice_url: string;
59
+ value: number;
60
+ due_date: string;
61
+ reused: boolean;
62
+ }
63
+
64
+ export type EvoBillingPortalCardCaptureErrorCode =
65
+ | 'no_open_billing'
66
+ | 'card_capture_unavailable'
67
+ | 'customer_document_missing'
68
+ | 'taker_without_remote_customer'
69
+ | 'preview_changed'
70
+ | 'already_paid'
71
+ | 'internal';
@@ -165,10 +165,28 @@ export interface ICsqAlert {
165
165
  * Nexus linkar `/{tenant}/evo-med/calendar/{calendar_id}/appointment/{appointment_id}`. */
166
166
  appointment_id?: string;
167
167
  calendar_id?: string;
168
+ /** So em alertas de agenda (feat-206 F6a): o claim que gerou o alerta, gravado
169
+ * quando ele nasce. As rechecagens tardias (passos 3 e 4, `closed_at + 4 h` e
170
+ * `+ 24 h`) reconferem a agenda a partir DELE, porque o claim so existe em
171
+ * `report.claims` da avaliacao que o extraiu e um laudo mais novo do mesmo
172
+ * lead pode ter herdado o alerta. Ausente em alertas antigos: passo tardio
173
+ * nao se aplica (sem backfill). */
174
+ appointment_claim?: ICsqAlertAppointmentClaim;
168
175
  /** Ticket em que o alerta apareceu pela primeira vez (herdado x novo). */
169
176
  first_seen_ticket_id: string;
170
177
  created_at: Date;
171
178
  }
179
+ /** O que foi informado ao lead, copiado do claim `appointment_informed`
180
+ * (feat-206 F6a). Sem `evidence`: a evidencia ja esta em `ICsqAlert.evidence`. */
181
+ export interface ICsqAlertAppointmentClaim {
182
+ /** YYYY-MM-DD, TZ do tenant. */
183
+ date: string;
184
+ /** HH:mm. */
185
+ time?: string;
186
+ professional?: string;
187
+ patient_name?: string;
188
+ modality?: string;
189
+ }
172
190
  /** Indicadores quantitativos calculados por codigo, por lente
173
191
  * ("neste atendimento" e "na jornada"). `null` = nao aplicavel a lente ou
174
192
  * indisponivel (ex.: metricas liquidas sem horario comercial configurado). */
@@ -266,6 +284,10 @@ export interface ICsqClaimAppointmentInformed {
266
284
  modality?: string;
267
285
  /** Nome do paciente informado na conversa (mae/filho: pode diferir do lead). */
268
286
  patient_name?: string;
287
+ /** feat-206 F6: o agendamento informado deixou de valer DEPOIS, na mesma
288
+ * jornada (o lead cancelou/desistiu, ou foi trocado por outro horario). O
289
+ * codigo nao exige registro na agenda de um claim assim. */
290
+ superseded?: boolean;
269
291
  evidence: ICsqEvidence[];
270
292
  }
271
293
  /** "Prometi X ate quando". */
@@ -328,11 +350,19 @@ export interface ICsqClaimPriceInformed {
328
350
  /** Uniao discriminada por `type` — o juiz extrai, o codigo verifica (§5). */
329
351
  export type ICsqClaim = ICsqClaimAppointmentInformed | ICsqClaimPromise | ICsqClaimDataCollected | ICsqClaimRequiredData | ICsqClaimOutcome | ICsqClaimQuestionRequiresAnswer | ICsqClaimFirstConcreteOffer | ICsqClaimPatientStatus | ICsqClaimPriceInformed;
330
352
  export type CsqClaimType = ICsqClaim["type"];
353
+ /** Como o agendamento da agenda foi identificado como sendo do paciente da
354
+ * conversa, na ordem de forca da prova (feat-154 B1; `name_fuzzy` na feat-206
355
+ * F6a: nome com grafia diferente, so no mesmo dia e hora do claim). */
356
+ export type CsqAppointmentMatch = "linked" | "phone" | "name" | "name_fuzzy";
357
+ /** Resultado do cruzamento por codigo.
358
+ * - `cancelled_after` (feat-206 F6a): o agendamento EXISTIU e foi cancelado ou
359
+ * excluido DEPOIS da mensagem que o informou ao lead — nao e "nao registrado". */
360
+ export type CsqCrossCheckResult = "match" | "mismatch" | "missing" | "inconclusive" | "cancelled_after";
331
361
  /** Linha da tabela "o que foi dito x o que consta" (report-spec §2.5). */
332
362
  export interface ICsqCrossCheck {
333
363
  claim_type: CsqClaimType;
334
364
  /** Resultado da verificacao por codigo. */
335
- result: "match" | "mismatch" | "missing" | "inconclusive";
365
+ result: CsqCrossCheckResult;
336
366
  /** O que foi dito (resumo do claim). */
337
367
  expected: string;
338
368
  /** O que consta no sistema. */
@@ -343,6 +373,8 @@ export interface ICsqCrossCheck {
343
373
  /** So em cruzamentos de agenda: agendamento encontrado (link no Nexus). */
344
374
  appointment_id?: string;
345
375
  calendar_id?: string;
376
+ /** So em cruzamentos de agenda: como o agendamento foi identificado. */
377
+ matched_by?: CsqAppointmentMatch;
346
378
  }
347
379
  /** Nota de um criterio. Todo criterio < 100 exige evidencia valida; sem ela o
348
380
  * codigo zera para `null` e tira do denominador. */
@@ -453,7 +485,13 @@ export type CsqTriageMode = "skip_llm" | "full_review";
453
485
  /** Motivo da triagem. `skip_llm` sempre tem motivo; `full_review` normalmente
454
486
  * nao tem (lista vazia), salvo `forced` (replay do dry-run com
455
487
  * `--force-review`; producao nunca usa). */
456
- export type CsqTriageReason = "document_only" | "spam_close" | "reopen_without_new_messages" | "automation_only" | "ack_only" | "forced";
488
+ export type CsqTriageReason = "document_only" | "spam_close" | "reopen_without_new_messages" | "automation_only" | "ack_only"
489
+ /** feat-206 F6b: nenhum texto livre de atendente humano nem nota; a HubIA
490
+ * falou no maximo uma vez (saudacao/fora do expediente). */
491
+ | "no_attendant_message"
492
+ /** feat-206 F6b: o lead nao escreveu texto livre e todo texto da atendente
493
+ * e confirmacao curta (sem data/hora, valor ou pergunta). */
494
+ | "attendant_ack_only" | "forced";
457
495
  export interface ICsqTriageDecision {
458
496
  mode: CsqTriageMode;
459
497
  reasons: CsqTriageReason[];
@@ -558,6 +596,13 @@ export interface ICsqAppointmentFact {
558
596
  professional_name?: string;
559
597
  modality?: string;
560
598
  created_at?: Date;
599
+ /** feat-206 F6a: agendamento que saiu da agenda — excluido (`deleted_at`) ou
600
+ * cancelado (`status_base` cancelado). So vem marcado na leitura de
601
+ * candidatos da agenda; o verificador nunca o trata como agendamento vivo. */
602
+ removed?: "deleted" | "cancelled";
603
+ /** Quando saiu: `deleted_at`; cancelado sem `deleted_at` usa `updated_at`.
604
+ * Ausente = nao comparavel com a mensagem que informou o agendamento. */
605
+ removed_at?: Date;
561
606
  }
562
607
  /** Agendamento envolvido numa sobreposicao (lote 9). */
563
608
  export interface ICsqOverlapAppointmentFact {
@@ -365,11 +365,30 @@ export interface ICsqAlert {
365
365
  * Nexus linkar `/{tenant}/evo-med/calendar/{calendar_id}/appointment/{appointment_id}`. */
366
366
  appointment_id?: string;
367
367
  calendar_id?: string;
368
+ /** So em alertas de agenda (feat-206 F6a): o claim que gerou o alerta, gravado
369
+ * quando ele nasce. As rechecagens tardias (passos 3 e 4, `closed_at + 4 h` e
370
+ * `+ 24 h`) reconferem a agenda a partir DELE, porque o claim so existe em
371
+ * `report.claims` da avaliacao que o extraiu e um laudo mais novo do mesmo
372
+ * lead pode ter herdado o alerta. Ausente em alertas antigos: passo tardio
373
+ * nao se aplica (sem backfill). */
374
+ appointment_claim?: ICsqAlertAppointmentClaim;
368
375
  /** Ticket em que o alerta apareceu pela primeira vez (herdado x novo). */
369
376
  first_seen_ticket_id: string;
370
377
  created_at: Date;
371
378
  }
372
379
 
380
+ /** O que foi informado ao lead, copiado do claim `appointment_informed`
381
+ * (feat-206 F6a). Sem `evidence`: a evidencia ja esta em `ICsqAlert.evidence`. */
382
+ export interface ICsqAlertAppointmentClaim {
383
+ /** YYYY-MM-DD, TZ do tenant. */
384
+ date: string;
385
+ /** HH:mm. */
386
+ time?: string;
387
+ professional?: string;
388
+ patient_name?: string;
389
+ modality?: string;
390
+ }
391
+
373
392
  // ───────── Indicadores (report-spec §3) ─────────
374
393
 
375
394
  /** Indicadores quantitativos calculados por codigo, por lente
@@ -478,6 +497,10 @@ export interface ICsqClaimAppointmentInformed {
478
497
  modality?: string;
479
498
  /** Nome do paciente informado na conversa (mae/filho: pode diferir do lead). */
480
499
  patient_name?: string;
500
+ /** feat-206 F6: o agendamento informado deixou de valer DEPOIS, na mesma
501
+ * jornada (o lead cancelou/desistiu, ou foi trocado por outro horario). O
502
+ * codigo nao exige registro na agenda de um claim assim. */
503
+ superseded?: boolean;
481
504
  evidence: ICsqEvidence[];
482
505
  }
483
506
 
@@ -560,11 +583,26 @@ export type ICsqClaim =
560
583
 
561
584
  export type CsqClaimType = ICsqClaim["type"];
562
585
 
586
+ /** Como o agendamento da agenda foi identificado como sendo do paciente da
587
+ * conversa, na ordem de forca da prova (feat-154 B1; `name_fuzzy` na feat-206
588
+ * F6a: nome com grafia diferente, so no mesmo dia e hora do claim). */
589
+ export type CsqAppointmentMatch = "linked" | "phone" | "name" | "name_fuzzy";
590
+
591
+ /** Resultado do cruzamento por codigo.
592
+ * - `cancelled_after` (feat-206 F6a): o agendamento EXISTIU e foi cancelado ou
593
+ * excluido DEPOIS da mensagem que o informou ao lead — nao e "nao registrado". */
594
+ export type CsqCrossCheckResult =
595
+ | "match"
596
+ | "mismatch"
597
+ | "missing"
598
+ | "inconclusive"
599
+ | "cancelled_after";
600
+
563
601
  /** Linha da tabela "o que foi dito x o que consta" (report-spec §2.5). */
564
602
  export interface ICsqCrossCheck {
565
603
  claim_type: CsqClaimType;
566
604
  /** Resultado da verificacao por codigo. */
567
- result: "match" | "mismatch" | "missing" | "inconclusive";
605
+ result: CsqCrossCheckResult;
568
606
  /** O que foi dito (resumo do claim). */
569
607
  expected: string;
570
608
  /** O que consta no sistema. */
@@ -575,6 +613,8 @@ export interface ICsqCrossCheck {
575
613
  /** So em cruzamentos de agenda: agendamento encontrado (link no Nexus). */
576
614
  appointment_id?: string;
577
615
  calendar_id?: string;
616
+ /** So em cruzamentos de agenda: como o agendamento foi identificado. */
617
+ matched_by?: CsqAppointmentMatch;
578
618
  }
579
619
 
580
620
  // ───────── Avaliacao (report-spec §4) ─────────
@@ -714,6 +754,12 @@ export type CsqTriageReason =
714
754
  | "reopen_without_new_messages"
715
755
  | "automation_only"
716
756
  | "ack_only"
757
+ /** feat-206 F6b: nenhum texto livre de atendente humano nem nota; a HubIA
758
+ * falou no maximo uma vez (saudacao/fora do expediente). */
759
+ | "no_attendant_message"
760
+ /** feat-206 F6b: o lead nao escreveu texto livre e todo texto da atendente
761
+ * e confirmacao curta (sem data/hora, valor ou pergunta). */
762
+ | "attendant_ack_only"
717
763
  | "forced";
718
764
 
719
765
  export interface ICsqTriageDecision {
@@ -835,6 +881,13 @@ export interface ICsqAppointmentFact {
835
881
  professional_name?: string;
836
882
  modality?: string;
837
883
  created_at?: Date;
884
+ /** feat-206 F6a: agendamento que saiu da agenda — excluido (`deleted_at`) ou
885
+ * cancelado (`status_base` cancelado). So vem marcado na leitura de
886
+ * candidatos da agenda; o verificador nunca o trata como agendamento vivo. */
887
+ removed?: "deleted" | "cancelled";
888
+ /** Quando saiu: `deleted_at`; cancelado sem `deleted_at` usa `updated_at`.
889
+ * Ausente = nao comparavel com a mensagem que informou o agendamento. */
890
+ removed_at?: Date;
838
891
  }
839
892
 
840
893
  /** Agendamento envolvido numa sobreposicao (lote 9). */
@@ -137,6 +137,12 @@ export interface INexFinopsBillingCardCharge {
137
137
  /** Provider/ambiente onde o `pay_` foi criado. */
138
138
  provider_id?: string | null;
139
139
  env?: 'sandbox' | 'production' | null;
140
+ /**
141
+ * feat-253 fatia 9: quem gerou a fatura de captura. `portal` = o próprio cliente pediu
142
+ * "Cadastrar/trocar cartão" → o cartão capturado vira o padrão do contrato. Ausente/`nexus`
143
+ * = regra da F2b (habilita só em contrato sem método; senão fica como sugestão).
144
+ */
145
+ capture_origin?: 'nexus' | 'portal' | null;
140
146
  }
141
147
  export type NexFinopsBillingCardCaptureStatus = 'captured' | 'no_token' | 'skipped';
142
148
  export interface INexFinopsBilling extends IFireGlobalDoc {
@@ -168,6 +168,12 @@ export interface INexFinopsBillingCardCharge {
168
168
  /** Provider/ambiente onde o `pay_` foi criado. */
169
169
  provider_id?: string | null;
170
170
  env?: 'sandbox' | 'production' | null;
171
+ /**
172
+ * feat-253 fatia 9: quem gerou a fatura de captura. `portal` = o próprio cliente pediu
173
+ * "Cadastrar/trocar cartão" → o cartão capturado vira o padrão do contrato. Ausente/`nexus`
174
+ * = regra da F2b (habilita só em contrato sem método; senão fica como sugestão).
175
+ */
176
+ capture_origin?: 'nexus' | 'portal' | null;
171
177
  }
172
178
 
173
179
  export type NexFinopsBillingCardCaptureStatus = 'captured' | 'no_token' | 'skipped';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evo360-types",
3
- "version": "1.3.647",
3
+ "version": "1.3.654",
4
4
  "description": "HREVO360 Shared Types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",