evo360-types 1.3.389 → 1.3.390

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.
@@ -29,6 +29,27 @@ export interface ILeadDistChannel {
29
29
  ref?: FirestoreDocumentReference;
30
30
  updated_at?: Date | null;
31
31
  }
32
+ /** Origem de aquisição do lead (feat-038) — base expansível p/ múltiplas
33
+ * plataformas. v1 implementa só `type:'ctwa'` (Click-to-WhatsApp da Meta);
34
+ * Google Ads / Instagram Direct / TikTok / site ficam para fast-follow. */
35
+ export type LeadReferralType = "ctwa" | "instagram_direct" | "google_ads" | "tiktok" | "site" | "other";
36
+ export interface ILeadReferralBase {
37
+ type: LeadReferralType;
38
+ captured_at?: Date | string | null;
39
+ source_url?: string | null;
40
+ label?: string | null;
41
+ raw?: Record<string, unknown> | null;
42
+ }
43
+ export interface ILeadReferralCTWA extends ILeadReferralBase {
44
+ type: "ctwa";
45
+ ad_id?: string | null;
46
+ source_type?: string | null;
47
+ headline?: string | null;
48
+ body?: string | null;
49
+ media_type?: string | null;
50
+ ctwa_clid?: string | null;
51
+ }
52
+ export type ILeadReferral = ILeadReferralCTWA;
32
53
  /** Estado da régua de reativação de lead (feat-037).
33
54
  * Mantido pelo subscriber `ticket_closed` (streak) e pela task
34
55
  * `lead_reactivation` (último disparo). Semântica do streak alinhada ao
@@ -57,6 +78,10 @@ export interface ILead extends IProfile {
57
78
  tags?: ITag[] | null;
58
79
  userRef?: FirestoreDocumentReference;
59
80
  ctwa_clid?: string | null;
81
+ /**
82
+ * @deprecated A ESCRITA foi substituída por `acquisition_sources[]` (feat-038).
83
+ * Tipo mantido para leitura de leads antigos; sem backfill.
84
+ */
60
85
  ctwa_referral?: {
61
86
  source_type?: string;
62
87
  source_id?: string;
@@ -66,6 +91,7 @@ export interface ILead extends IProfile {
66
91
  media_type?: string;
67
92
  captured_at?: Date | string | null;
68
93
  } | null;
94
+ acquisition_sources?: ILeadReferral[] | null;
69
95
  reactivation?: ILeadReactivation | null;
70
96
  [key: string]: unknown;
71
97
  }
@@ -44,6 +44,37 @@ export interface ILeadDistChannel {
44
44
  updated_at?: Date | null;
45
45
  }
46
46
 
47
+ /** Origem de aquisição do lead (feat-038) — base expansível p/ múltiplas
48
+ * plataformas. v1 implementa só `type:'ctwa'` (Click-to-WhatsApp da Meta);
49
+ * Google Ads / Instagram Direct / TikTok / site ficam para fast-follow. */
50
+ export type LeadReferralType =
51
+ | "ctwa" // Click-to-WhatsApp (Meta FB/IG → WhatsApp) ← v1
52
+ | "instagram_direct" // ig.me ?ref= ← futuro
53
+ | "google_ads" // gclid / token em ?text= ← futuro
54
+ | "tiktok"
55
+ | "site"
56
+ | "other"; // ← futuro
57
+
58
+ export interface ILeadReferralBase {
59
+ type: LeadReferralType; // discriminador p/ o parser
60
+ captured_at?: Date | string | null; // 1º toque desta origem (idioma do repo)
61
+ source_url?: string | null; // link clicável
62
+ label?: string | null; // rótulo de exibição (headline || ad_id || domínio)
63
+ raw?: Record<string, unknown> | null; // payload original lossless → re-parse futuro sem backfill
64
+ }
65
+
66
+ export interface ILeadReferralCTWA extends ILeadReferralBase {
67
+ type: "ctwa";
68
+ ad_id?: string | null; // referral.source_id
69
+ source_type?: string | null; // 'ad' | 'post'
70
+ headline?: string | null;
71
+ body?: string | null;
72
+ media_type?: string | null;
73
+ ctwa_clid?: string | null; // espelho; o de topo (CAPI/feat-034) permanece na raiz
74
+ }
75
+
76
+ export type ILeadReferral = ILeadReferralCTWA; // | ILeadReferralGoogleAds | ...
77
+
47
78
  /** Estado da régua de reativação de lead (feat-037).
48
79
  * Mantido pelo subscriber `ticket_closed` (streak) e pela task
49
80
  * `lead_reactivation` (último disparo). Semântica do streak alinhada ao
@@ -74,6 +105,10 @@ export interface ILead extends IProfile {
74
105
  userRef?: FirestoreDocumentReference;
75
106
  // CTWA attribution (feat-034) — capturado do referral do 1º inbound vindo de anúncio Click-to-WhatsApp.
76
107
  ctwa_clid?: string | null;
108
+ /**
109
+ * @deprecated A ESCRITA foi substituída por `acquisition_sources[]` (feat-038).
110
+ * Tipo mantido para leitura de leads antigos; sem backfill.
111
+ */
77
112
  ctwa_referral?: {
78
113
  source_type?: string;
79
114
  source_id?: string;
@@ -83,6 +118,9 @@ export interface ILead extends IProfile {
83
118
  media_type?: string;
84
119
  captured_at?: Date | string | null;
85
120
  } | null;
121
+ // Origens de aquisição multi-touch (feat-038) — união discriminada por `type`.
122
+ // Substitui a escrita de `ctwa_referral`; `ctwa_clid` de topo permanece (CAPI).
123
+ acquisition_sources?: ILeadReferral[] | null;
86
124
  // Régua de reativação (feat-037) — mantida pelo subscriber ticket_closed + task lead_reactivation.
87
125
  reactivation?: ILeadReactivation | null;
88
126
  [key: string]: unknown; // index signature
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evo360-types",
3
- "version": "1.3.389",
3
+ "version": "1.3.390",
4
4
  "description": "HREVO360 Shared Types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",