evo360-types 1.3.419 → 1.3.423

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.
@@ -45,8 +45,15 @@ export interface ICampaignCta {
45
45
  label: string;
46
46
  /** WhatsApp template button position (0,1,2...). */
47
47
  button_index?: number;
48
- /** Final destination for the /qr redirect. */
48
+ /** Final destination for the /qr redirect. Optional on WhatsApp QUICK_REPLY
49
+ * buttons (the tap itself is tracked); required for email CTAs and URL buttons. */
49
50
  target_url?: string;
51
+ /** Email CTA destination kind (feat-081 F2.5): external URL or a wa.me deep link. */
52
+ dest_type?: "external_url" | "whatsapp" | null;
53
+ /** WA channel whose number builds the wa.me link (dest_type='whatsapp'). */
54
+ wa_channel_id?: string | null;
55
+ /** Prefilled message for the wa.me link (dest_type='whatsapp'). */
56
+ wa_message?: string | null;
50
57
  }
51
58
  export interface ICampaignPacingWindow {
52
59
  /** 'HH:mm' local (tenant timezone). */
@@ -71,8 +78,12 @@ export interface ICampaignTicketPolicy {
71
78
  export interface ICampaignMedia {
72
79
  /** 'image' | 'video' | 'document' — WhatsApp header media type. */
73
80
  type: string;
81
+ /** Full gs:// URI in WABA_MEDIA_BUCKET under tenants/<tenant>/ (feat-082/084 flow). */
74
82
  gcs_path?: string;
75
83
  url?: string;
84
+ /** Mime type of the uploaded media (drives the header component). */
85
+ mime_type?: string | null;
86
+ filename?: string | null;
76
87
  }
77
88
  /** Per-channel configuration (whatsapp/email) of a campaign. */
78
89
  export interface ICampaignChannelConfig {
@@ -251,7 +262,10 @@ export interface ICampaignBucket extends IFireDoc {
251
262
  counts?: ICampaignBucketCounts;
252
263
  }
253
264
  /** Flat field driving the batch queue (indexed). */
254
- export type RecipientDispatchState = "pending" | "dispatched" | "done" | "excluded";
265
+ export type RecipientDispatchState = "pending" | "dispatched" | "done" | "excluded"
266
+ /** Campaign canceled with this recipient still pending (feat-081 F3 — formalizes
267
+ * what F2 stored as 'excluded'; readers must accept both on old docs). */
268
+ | "canceled";
255
269
  /** Per-channel delivery status of a recipient (monotonic). */
256
270
  export type RecipientChannelStatus = "pending" | "scheduled" | "sent" | "delivered" | "read" | "failed" | "clicked" | "replied";
257
271
  /** Aggregated, monotonic recipient status (Portuguese labels — FE display). */
@@ -95,8 +95,15 @@ export interface ICampaignCta {
95
95
  label: string;
96
96
  /** WhatsApp template button position (0,1,2...). */
97
97
  button_index?: number;
98
- /** Final destination for the /qr redirect. */
98
+ /** Final destination for the /qr redirect. Optional on WhatsApp QUICK_REPLY
99
+ * buttons (the tap itself is tracked); required for email CTAs and URL buttons. */
99
100
  target_url?: string;
101
+ /** Email CTA destination kind (feat-081 F2.5): external URL or a wa.me deep link. */
102
+ dest_type?: "external_url" | "whatsapp" | null;
103
+ /** WA channel whose number builds the wa.me link (dest_type='whatsapp'). */
104
+ wa_channel_id?: string | null;
105
+ /** Prefilled message for the wa.me link (dest_type='whatsapp'). */
106
+ wa_message?: string | null;
100
107
  }
101
108
 
102
109
  // ----- Pacing + ticket policy -----------------------------------------------
@@ -127,8 +134,12 @@ export interface ICampaignTicketPolicy {
127
134
  export interface ICampaignMedia {
128
135
  /** 'image' | 'video' | 'document' — WhatsApp header media type. */
129
136
  type: string;
137
+ /** Full gs:// URI in WABA_MEDIA_BUCKET under tenants/<tenant>/ (feat-082/084 flow). */
130
138
  gcs_path?: string;
131
139
  url?: string;
140
+ /** Mime type of the uploaded media (drives the header component). */
141
+ mime_type?: string | null;
142
+ filename?: string | null;
132
143
  }
133
144
 
134
145
  // ----- Channel config -------------------------------------------------------
@@ -348,7 +359,10 @@ export type RecipientDispatchState =
348
359
  | "pending"
349
360
  | "dispatched"
350
361
  | "done"
351
- | "excluded";
362
+ | "excluded"
363
+ /** Campaign canceled with this recipient still pending (feat-081 F3 — formalizes
364
+ * what F2 stored as 'excluded'; readers must accept both on old docs). */
365
+ | "canceled";
352
366
 
353
367
  /** Per-channel delivery status of a recipient (monotonic). */
354
368
  export type RecipientChannelStatus =
@@ -43,7 +43,24 @@ export interface IAutomationAppointmentSelection {
43
43
  payment_status_in?: string[];
44
44
  };
45
45
  }
46
- export type IAutomationSelection = IAutomationAppointmentSelection;
46
+ export interface IAutomationLeadSelection {
47
+ target: "lead";
48
+ lead: {
49
+ status_in?: string[];
50
+ qualification_codes?: string[];
51
+ dist_channel_codes?: string[];
52
+ tag_names?: string[];
53
+ };
54
+ }
55
+ export interface IAutomationPatientSelection {
56
+ target: "patient";
57
+ patient: {
58
+ status_in?: string[];
59
+ source_codes?: string[];
60
+ tag_names?: string[];
61
+ };
62
+ }
63
+ export type IAutomationSelection = IAutomationAppointmentSelection | IAutomationLeadSelection | IAutomationPatientSelection;
47
64
  export interface IAutomationFilterValues {
48
65
  professionals: string[];
49
66
  procedures: string[];
@@ -55,7 +72,11 @@ export interface IAutomationFilterValues {
55
72
  }
56
73
  export declare const AUTOMATION_APPOINTMENT_FACTS: readonly ["appointment.status", "appointment.status_base", "appointment.appointment_type", "appointment.appointment_base_type", "appointment.appointment_mode", "appointment.professional_id", "appointment.procedure_ids", "appointment.professional_name", "appointment.procedure_names", "appointment.insurance_name", "appointment.address_name", "appointment.payment_status", "appointment.calendar_id"];
57
74
  export type AutomationAppointmentFact = (typeof AUTOMATION_APPOINTMENT_FACTS)[number];
58
- export type AutomationFact = AutomationAppointmentFact;
75
+ export declare const AUTOMATION_LEAD_FACTS: readonly ["lead.status", "lead.qualification_code", "lead.qualification_name", "lead.qualification_funnel_level", "lead.dist_channel_code", "lead.dist_channel_name", "lead.tags"];
76
+ export type AutomationLeadFact = (typeof AUTOMATION_LEAD_FACTS)[number];
77
+ export declare const AUTOMATION_PATIENT_FACTS: readonly ["patient.status", "patient.source_code", "patient.source_name", "patient.tags"];
78
+ export type AutomationPatientFact = (typeof AUTOMATION_PATIENT_FACTS)[number];
79
+ export type AutomationFact = AutomationAppointmentFact | AutomationLeadFact | AutomationPatientFact;
59
80
  export declare const AutomationOperatorEnum: {
60
81
  readonly Eq: "eq";
61
82
  readonly Neq: "neq";
@@ -190,7 +211,9 @@ export interface IAutomationRunBranchCounts {
190
211
  already_existed: number;
191
212
  }
192
213
  export interface IAutomationRunSample {
193
- appointment_id: string;
214
+ appointment_id?: string;
215
+ target_kind?: "appointment" | "lead" | "patient";
216
+ target_id?: string;
194
217
  branch_id?: string;
195
218
  decision: string;
196
219
  task_id?: string;
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.AutomationRunStatusEnum = exports.AutomationOutputTypeEnum = exports.AutomationOperatorEnum = exports.AUTOMATION_APPOINTMENT_FACTS = exports.HubAutomationPermissions = void 0;
17
+ exports.AutomationRunStatusEnum = exports.AutomationOutputTypeEnum = exports.AutomationOperatorEnum = exports.AUTOMATION_PATIENT_FACTS = exports.AUTOMATION_LEAD_FACTS = exports.AUTOMATION_APPOINTMENT_FACTS = exports.HubAutomationPermissions = void 0;
18
18
  __exportStar(require("./fb_collections"), exports);
19
19
  // ======================================================
20
20
  // hub-automation
@@ -60,6 +60,29 @@ exports.AUTOMATION_APPOINTMENT_FACTS = [
60
60
  "appointment.payment_status",
61
61
  "appointment.calendar_id",
62
62
  ];
63
+ // feat-085 (F3): lead domain facts (derived from the fields ILead exposes;
64
+ // resolved from the event-preloaded lead). Mirror of the appointment catalog.
65
+ exports.AUTOMATION_LEAD_FACTS = [
66
+ // 'active' | 'inactive' | 'draft'
67
+ "lead.status",
68
+ // qualification is a {code,name,funnelLevel} ref — surface all three.
69
+ "lead.qualification_code",
70
+ "lead.qualification_name",
71
+ "lead.qualification_funnel_level",
72
+ // distChannel is a {code,name} ref.
73
+ "lead.dist_channel_code",
74
+ "lead.dist_channel_name",
75
+ // string[] of tag names — matches if ANY tag name matches.
76
+ "lead.tags",
77
+ ];
78
+ // feat-085 (F3): patient domain facts (derived from IPatient).
79
+ exports.AUTOMATION_PATIENT_FACTS = [
80
+ "patient.status",
81
+ "patient.source_code",
82
+ "patient.source_name",
83
+ // string[] of tag names — matches if ANY tag name matches.
84
+ "patient.tags",
85
+ ];
63
86
  // ------------------------------------------------------
64
87
  // Conditions (recursive AND/OR groups)
65
88
  // ------------------------------------------------------
@@ -109,7 +109,36 @@ export interface IAutomationAppointmentSelection {
109
109
  };
110
110
  }
111
111
 
112
- export type IAutomationSelection = IAutomationAppointmentSelection;
112
+ // feat-085 (F3): lead/patient selections. Cron selection is appointment-only;
113
+ // these targets only arrive via the domain-event trigger, where the consumer
114
+ // PRE-LOADS the single target from the event (the `lead`/`patient` filters below
115
+ // are therefore not enforced at event runtime — they exist so a routine can be
116
+ // authored/validated with a lead/patient target and, later, for a possible
117
+ // lead/patient sweep). Discriminated by `target`.
118
+ export interface IAutomationLeadSelection {
119
+ target: "lead";
120
+ lead: {
121
+ // Reserved narrowing filters (glob-aware like the appointment filters).
122
+ status_in?: string[];
123
+ qualification_codes?: string[];
124
+ dist_channel_codes?: string[];
125
+ tag_names?: string[];
126
+ };
127
+ }
128
+
129
+ export interface IAutomationPatientSelection {
130
+ target: "patient";
131
+ patient: {
132
+ status_in?: string[];
133
+ source_codes?: string[];
134
+ tag_names?: string[];
135
+ };
136
+ }
137
+
138
+ export type IAutomationSelection =
139
+ | IAutomationAppointmentSelection
140
+ | IAutomationLeadSelection
141
+ | IAutomationPatientSelection;
113
142
 
114
143
  // Distinct filter values for a calendar, built from a limited window of local
115
144
  // appointments (GET /routines/filter-values?calendar_id=). Feeds the GUI's
@@ -153,7 +182,39 @@ export const AUTOMATION_APPOINTMENT_FACTS = [
153
182
  export type AutomationAppointmentFact =
154
183
  (typeof AUTOMATION_APPOINTMENT_FACTS)[number];
155
184
 
156
- export type AutomationFact = AutomationAppointmentFact;
185
+ // feat-085 (F3): lead domain facts (derived from the fields ILead exposes;
186
+ // resolved from the event-preloaded lead). Mirror of the appointment catalog.
187
+ export const AUTOMATION_LEAD_FACTS = [
188
+ // 'active' | 'inactive' | 'draft'
189
+ "lead.status",
190
+ // qualification is a {code,name,funnelLevel} ref — surface all three.
191
+ "lead.qualification_code",
192
+ "lead.qualification_name",
193
+ "lead.qualification_funnel_level",
194
+ // distChannel is a {code,name} ref.
195
+ "lead.dist_channel_code",
196
+ "lead.dist_channel_name",
197
+ // string[] of tag names — matches if ANY tag name matches.
198
+ "lead.tags",
199
+ ] as const;
200
+
201
+ export type AutomationLeadFact = (typeof AUTOMATION_LEAD_FACTS)[number];
202
+
203
+ // feat-085 (F3): patient domain facts (derived from IPatient).
204
+ export const AUTOMATION_PATIENT_FACTS = [
205
+ "patient.status",
206
+ "patient.source_code",
207
+ "patient.source_name",
208
+ // string[] of tag names — matches if ANY tag name matches.
209
+ "patient.tags",
210
+ ] as const;
211
+
212
+ export type AutomationPatientFact = (typeof AUTOMATION_PATIENT_FACTS)[number];
213
+
214
+ export type AutomationFact =
215
+ | AutomationAppointmentFact
216
+ | AutomationLeadFact
217
+ | AutomationPatientFact;
157
218
 
158
219
  // ------------------------------------------------------
159
220
  // Conditions (recursive AND/OR groups)
@@ -378,7 +439,12 @@ export interface IAutomationRunBranchCounts {
378
439
  }
379
440
 
380
441
  export interface IAutomationRunSample {
381
- appointment_id: string;
442
+ // feat-085 (F3): a run target may now be an appointment, a lead or a patient.
443
+ // `appointment_id` is kept (still set for appointment targets) for backward
444
+ // compatibility; `target_kind`/`target_id` are the domain-agnostic identity.
445
+ appointment_id?: string;
446
+ target_kind?: "appointment" | "lead" | "patient";
447
+ target_id?: string;
382
448
  branch_id?: string;
383
449
  // e.g. 'created' | 'already_existed' | 'not_matched' | 'suppressed_by_limit'
384
450
  decision: string;
@@ -11,6 +11,8 @@ export declare const ExternalObjectTypeEnum: {
11
11
  * desfecho do envio (sent/failed + os codes da feat-072).
12
12
  */
13
13
  readonly EvoTask: "evo_task";
14
+ /** Campanha do hub-omni (feat-081) — liga mensagens/tickets à campanha que os originou. */
15
+ readonly Campaign: "campaign";
14
16
  /** Nexus FinOps billing document */
15
17
  readonly NexBilling: "nex_billing";
16
18
  readonly NexContract: "nex_contract";
@@ -15,6 +15,8 @@ exports.ExternalObjectTypeEnum = {
15
15
  * desfecho do envio (sent/failed + os codes da feat-072).
16
16
  */
17
17
  EvoTask: "evo_task",
18
+ /** Campanha do hub-omni (feat-081) — liga mensagens/tickets à campanha que os originou. */
19
+ Campaign: "campaign",
18
20
  /** Nexus FinOps billing document */
19
21
  NexBilling: "nex_billing",
20
22
  NexContract: "nex_contract",
@@ -15,6 +15,8 @@ export const ExternalObjectTypeEnum = {
15
15
  * desfecho do envio (sent/failed + os codes da feat-072).
16
16
  */
17
17
  EvoTask: "evo_task",
18
+ /** Campanha do hub-omni (feat-081) — liga mensagens/tickets à campanha que os originou. */
19
+ Campaign: "campaign",
18
20
  /** Nexus FinOps billing document */
19
21
  NexBilling: "nex_billing",
20
22
  NexContract: "nex_contract",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evo360-types",
3
- "version": "1.3.419",
3
+ "version": "1.3.423",
4
4
  "description": "HREVO360 Shared Types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",