@iann29/rastro 0.10.8 → 0.11.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.
Files changed (182) hide show
  1. package/README.md +8 -0
  2. package/agent/integration.md +45 -0
  3. package/agent/manifest.json +4 -4
  4. package/dist/client/federation.d.ts +82 -9
  5. package/dist/client/federation.d.ts.map +1 -1
  6. package/dist/client/federation.js +40 -2
  7. package/dist/client/federation.js.map +1 -1
  8. package/dist/client/index.d.ts +464 -8
  9. package/dist/client/index.d.ts.map +1 -1
  10. package/dist/client/index.js +259 -7
  11. package/dist/client/index.js.map +1 -1
  12. package/dist/component/_generated/api.d.ts +10 -0
  13. package/dist/component/_generated/api.d.ts.map +1 -1
  14. package/dist/component/_generated/api.js.map +1 -1
  15. package/dist/component/_generated/component.d.ts +273 -21
  16. package/dist/component/_generated/component.d.ts.map +1 -1
  17. package/dist/component/_generated/server.d.ts +2 -0
  18. package/dist/component/_generated/server.d.ts.map +1 -1
  19. package/dist/component/_generated/server.js.map +1 -1
  20. package/dist/component/constants.d.ts +31 -0
  21. package/dist/component/constants.d.ts.map +1 -1
  22. package/dist/component/constants.js +31 -0
  23. package/dist/component/constants.js.map +1 -1
  24. package/dist/component/convex.config.d.ts +2 -0
  25. package/dist/component/convex.config.js +7 -0
  26. package/dist/component/convex.config.js.map +1 -1
  27. package/dist/component/errors.d.ts +1 -1
  28. package/dist/component/errors.d.ts.map +1 -1
  29. package/dist/component/errors.js.map +1 -1
  30. package/dist/component/http.d.ts.map +1 -1
  31. package/dist/component/http.js +64 -0
  32. package/dist/component/http.js.map +1 -1
  33. package/dist/component/leadAdsValidators.d.ts +1092 -0
  34. package/dist/component/leadAdsValidators.d.ts.map +1 -0
  35. package/dist/component/leadAdsValidators.js +304 -0
  36. package/dist/component/leadAdsValidators.js.map +1 -0
  37. package/dist/component/leadFormRules.d.ts +60 -0
  38. package/dist/component/leadFormRules.d.ts.map +1 -0
  39. package/dist/component/leadFormRules.js +140 -0
  40. package/dist/component/leadFormRules.js.map +1 -0
  41. package/dist/component/leadFormStore.d.ts +16 -0
  42. package/dist/component/leadFormStore.d.ts.map +1 -0
  43. package/dist/component/leadFormStore.js +92 -0
  44. package/dist/component/leadFormStore.js.map +1 -0
  45. package/dist/component/leadgenToken.d.ts +56 -0
  46. package/dist/component/leadgenToken.d.ts.map +1 -0
  47. package/dist/component/leadgenToken.js +262 -0
  48. package/dist/component/leadgenToken.js.map +1 -0
  49. package/dist/component/leads.d.ts +76 -7
  50. package/dist/component/leads.d.ts.map +1 -1
  51. package/dist/component/leads.js +112 -78
  52. package/dist/component/leads.js.map +1 -1
  53. package/dist/component/meta.d.ts.map +1 -1
  54. package/dist/component/meta.js +21 -1
  55. package/dist/component/meta.js.map +1 -1
  56. package/dist/component/metaCapi.d.ts.map +1 -1
  57. package/dist/component/metaCapi.js +10 -0
  58. package/dist/component/metaCapi.js.map +1 -1
  59. package/dist/component/metaFake.d.ts +44 -0
  60. package/dist/component/metaFake.d.ts.map +1 -1
  61. package/dist/component/metaFake.js +400 -1
  62. package/dist/component/metaFake.js.map +1 -1
  63. package/dist/component/metaGraph.d.ts +91 -0
  64. package/dist/component/metaGraph.d.ts.map +1 -1
  65. package/dist/component/metaGraph.js +217 -0
  66. package/dist/component/metaGraph.js.map +1 -1
  67. package/dist/component/metaLeads.d.ts +681 -0
  68. package/dist/component/metaLeads.d.ts.map +1 -0
  69. package/dist/component/metaLeads.js +2634 -0
  70. package/dist/component/metaLeads.js.map +1 -0
  71. package/dist/component/schema.d.ts +414 -5
  72. package/dist/component/schema.d.ts.map +1 -1
  73. package/dist/component/schema.js +169 -1
  74. package/dist/component/schema.js.map +1 -1
  75. package/dist/component/validators.d.ts +235 -11
  76. package/dist/component/validators.d.ts.map +1 -1
  77. package/dist/component/validators.js +14 -1
  78. package/dist/component/validators.js.map +1 -1
  79. package/dist/tracker/generated.d.ts +1 -1
  80. package/dist/tracker/generated.js +1 -1
  81. package/dist/ui/campaigns/CampaignsView.d.ts +5 -1
  82. package/dist/ui/campaigns/CampaignsView.d.ts.map +1 -1
  83. package/dist/ui/campaigns/CampaignsView.js.map +1 -1
  84. package/dist/ui/campaigns/Drawer.d.ts.map +1 -1
  85. package/dist/ui/campaigns/Drawer.js +8 -26
  86. package/dist/ui/campaigns/Drawer.js.map +1 -1
  87. package/dist/ui/campaigns/labels.d.ts +29 -1
  88. package/dist/ui/campaigns/labels.d.ts.map +1 -1
  89. package/dist/ui/campaigns/labels.js +77 -2
  90. package/dist/ui/campaigns/labels.js.map +1 -1
  91. package/dist/ui/campaigns/model.js +2 -2
  92. package/dist/ui/campaigns/model.js.map +1 -1
  93. package/dist/ui/forms/FirstContact.d.ts +19 -0
  94. package/dist/ui/forms/FirstContact.d.ts.map +1 -0
  95. package/dist/ui/forms/FirstContact.js +81 -0
  96. package/dist/ui/forms/FirstContact.js.map +1 -0
  97. package/dist/ui/forms/FormLead.d.ts +28 -0
  98. package/dist/ui/forms/FormLead.d.ts.map +1 -0
  99. package/dist/ui/forms/FormLead.js +199 -0
  100. package/dist/ui/forms/FormLead.js.map +1 -0
  101. package/dist/ui/forms/FormRulesDrawer.d.ts +49 -0
  102. package/dist/ui/forms/FormRulesDrawer.d.ts.map +1 -0
  103. package/dist/ui/forms/FormRulesDrawer.js +149 -0
  104. package/dist/ui/forms/FormRulesDrawer.js.map +1 -0
  105. package/dist/ui/forms/FormsView.d.ts +10 -0
  106. package/dist/ui/forms/FormsView.d.ts.map +1 -0
  107. package/dist/ui/forms/FormsView.js +215 -0
  108. package/dist/ui/forms/FormsView.js.map +1 -0
  109. package/dist/ui/forms/Icons.d.ts +46 -0
  110. package/dist/ui/forms/Icons.d.ts.map +1 -0
  111. package/dist/ui/forms/Icons.js +45 -0
  112. package/dist/ui/forms/Icons.js.map +1 -0
  113. package/dist/ui/forms/RuleRow.d.ts +37 -0
  114. package/dist/ui/forms/RuleRow.d.ts.map +1 -0
  115. package/dist/ui/forms/RuleRow.js +80 -0
  116. package/dist/ui/forms/RuleRow.js.map +1 -0
  117. package/dist/ui/forms/WhatsAppButtonGuide.d.ts +33 -0
  118. package/dist/ui/forms/WhatsAppButtonGuide.d.ts.map +1 -0
  119. package/dist/ui/forms/WhatsAppButtonGuide.js +90 -0
  120. package/dist/ui/forms/WhatsAppButtonGuide.js.map +1 -0
  121. package/dist/ui/forms/index.d.ts +11 -0
  122. package/dist/ui/forms/index.d.ts.map +1 -0
  123. package/dist/ui/forms/index.js +7 -0
  124. package/dist/ui/forms/index.js.map +1 -0
  125. package/dist/ui/forms/journey.d.ts +19 -0
  126. package/dist/ui/forms/journey.d.ts.map +1 -0
  127. package/dist/ui/forms/journey.js +54 -0
  128. package/dist/ui/forms/journey.js.map +1 -0
  129. package/dist/ui/forms/model.d.ts +239 -0
  130. package/dist/ui/forms/model.d.ts.map +1 -0
  131. package/dist/ui/forms/model.js +556 -0
  132. package/dist/ui/forms/model.js.map +1 -0
  133. package/dist/ui/forms/sample.d.ts +36 -0
  134. package/dist/ui/forms/sample.d.ts.map +1 -0
  135. package/dist/ui/forms/sample.js +444 -0
  136. package/dist/ui/forms/sample.js.map +1 -0
  137. package/dist/ui/forms/types.d.ts +454 -0
  138. package/dist/ui/forms/types.d.ts.map +1 -0
  139. package/dist/ui/forms/types.js +2 -0
  140. package/dist/ui/forms/types.js.map +1 -0
  141. package/dist/ui/index.d.ts +2 -0
  142. package/dist/ui/index.d.ts.map +1 -1
  143. package/dist/ui/index.js +4 -0
  144. package/dist/ui/index.js.map +1 -1
  145. package/dist/ui/integrations/Overlay.d.ts +3 -1
  146. package/dist/ui/integrations/Overlay.d.ts.map +1 -1
  147. package/dist/ui/integrations/Overlay.js +2 -2
  148. package/dist/ui/integrations/Overlay.js.map +1 -1
  149. package/dist/ui/portfolio/PortfolioView.d.ts +4 -1
  150. package/dist/ui/portfolio/PortfolioView.d.ts.map +1 -1
  151. package/dist/ui/portfolio/PortfolioView.js.map +1 -1
  152. package/dist/ui/sample.d.ts +3 -1
  153. package/dist/ui/sample.d.ts.map +1 -1
  154. package/dist/ui/sample.js +2 -0
  155. package/dist/ui/sample.js.map +1 -1
  156. package/dist/ui/seed.d.ts +1 -1
  157. package/dist/ui/ui.css +2301 -0
  158. package/docs/federation.md +19 -0
  159. package/docs/meta-ads.md +713 -7
  160. package/docs/upgrading.md +75 -0
  161. package/llms.txt +1 -0
  162. package/package.json +1 -1
  163. package/src/component/_generated/api.ts +10 -0
  164. package/src/component/_generated/component.ts +289 -20
  165. package/src/component/_generated/server.ts +2 -0
  166. package/src/component/constants.ts +33 -0
  167. package/src/component/convex.config.ts +7 -0
  168. package/src/component/errors.ts +3 -1
  169. package/src/component/http.ts +75 -0
  170. package/src/component/leadAdsValidators.ts +365 -0
  171. package/src/component/leadFormRules.ts +202 -0
  172. package/src/component/leadFormStore.ts +129 -0
  173. package/src/component/leadgenToken.ts +348 -0
  174. package/src/component/leads.ts +136 -84
  175. package/src/component/meta.ts +21 -1
  176. package/src/component/metaCapi.ts +13 -1
  177. package/src/component/metaFake.ts +485 -1
  178. package/src/component/metaGraph.ts +327 -0
  179. package/src/component/metaLeads.ts +3101 -0
  180. package/src/component/schema.ts +187 -1
  181. package/src/component/validators.ts +17 -1
  182. package/src/tracker/generated.ts +1 -1
@@ -0,0 +1,1092 @@
1
+ import { type Infer } from "convex/values";
2
+ /** One option of a choice question, as Meta lists it. */
3
+ export declare const metaFormOptionValidator: import("convex/values").VObject<{
4
+ key: string;
5
+ value: string;
6
+ }, {
7
+ key: import("convex/values").VString<string, "required">;
8
+ value: import("convex/values").VString<string, "required">;
9
+ }, "required", "key" | "value">;
10
+ /** One question of an instant form. `options` only on choice questions. */
11
+ export declare const metaFormQuestionValidator: import("convex/values").VObject<{
12
+ key: string;
13
+ label: string;
14
+ options?: {
15
+ key: string;
16
+ value: string;
17
+ }[] | undefined;
18
+ type: string;
19
+ }, {
20
+ key: import("convex/values").VString<string, "required">;
21
+ label: import("convex/values").VString<string, "required">;
22
+ /** Meta's type: `FULL_NAME`, `EMAIL`, `PHONE`, `CUSTOM`… */
23
+ type: import("convex/values").VString<string, "required">;
24
+ options: import("convex/values").VArray<{
25
+ key: string;
26
+ value: string;
27
+ }[] | undefined, import("convex/values").VObject<{
28
+ key: string;
29
+ value: string;
30
+ }, {
31
+ key: import("convex/values").VString<string, "required">;
32
+ value: import("convex/values").VString<string, "required">;
33
+ }, "required", "key" | "value">, "optional">;
34
+ }, "required", "key" | "label" | "options" | "type">;
35
+ /** Where a rule sends a lead: a board column, or the discard with a reason. */
36
+ export declare const formRuleTargetValidator: import("convex/values").VUnion<{
37
+ column: string;
38
+ } | {
39
+ discard: string;
40
+ }, [import("convex/values").VObject<{
41
+ column: string;
42
+ }, {
43
+ column: import("convex/values").VString<string, "required">;
44
+ }, "required", "column">, import("convex/values").VObject<{
45
+ discard: string;
46
+ }, {
47
+ discard: import("convex/values").VString<string, "required">;
48
+ }, "required", "discard">], "required", "column" | "discard">;
49
+ /** One rule: an answer to a choice question decides where the lead goes. */
50
+ export declare const formRuleValidator: import("convex/values").VObject<{
51
+ answers: string[];
52
+ questionKey: string;
53
+ to: {
54
+ column: string;
55
+ } | {
56
+ discard: string;
57
+ };
58
+ }, {
59
+ questionKey: import("convex/values").VString<string, "required">;
60
+ /** Option keys (or values) of the question; any of them matches. */
61
+ answers: import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">;
62
+ to: import("convex/values").VUnion<{
63
+ column: string;
64
+ } | {
65
+ discard: string;
66
+ }, [import("convex/values").VObject<{
67
+ column: string;
68
+ }, {
69
+ column: import("convex/values").VString<string, "required">;
70
+ }, "required", "column">, import("convex/values").VObject<{
71
+ discard: string;
72
+ }, {
73
+ discard: import("convex/values").VString<string, "required">;
74
+ }, "required", "discard">], "required", "column" | "discard">;
75
+ }, "required", "answers" | "questionKey" | "to" | "to.column" | "to.discard">;
76
+ /** The brakes on an automatic first message (the host's own sender). */
77
+ export declare const firstContactBrakesValidator: import("convex/values").VObject<{
78
+ businessHoursOnly: boolean;
79
+ maxPerHour: number;
80
+ waitMinutes: number;
81
+ }, {
82
+ waitMinutes: import("convex/values").VFloat64<number, "required">;
83
+ maxPerHour: import("convex/values").VFloat64<number, "required">;
84
+ businessHoursOnly: import("convex/values").VBoolean<boolean, "required">;
85
+ }, "required", "businessHoursOnly" | "maxPerHour" | "waitMinutes">;
86
+ /**
87
+ * How the host makes the first contact. `lead_starts`: the form's end screen
88
+ * has the WhatsApp button and the lead writes first (recommended);
89
+ * `one_click`: a person sends the suggested `text`; `automatic`: a scheduled
90
+ * send under `brakes`, which the host keeps off unless the business accepted
91
+ * the risk.
92
+ */
93
+ export declare const firstContactValidator: import("convex/values").VObject<{
94
+ brakes?: {
95
+ businessHoursOnly: boolean;
96
+ maxPerHour: number;
97
+ waitMinutes: number;
98
+ } | undefined;
99
+ mode: "automatic" | "lead_starts" | "one_click";
100
+ text?: string | undefined;
101
+ }, {
102
+ mode: import("convex/values").VUnion<"automatic" | "lead_starts" | "one_click", [import("convex/values").VLiteral<"lead_starts", "required">, import("convex/values").VLiteral<"one_click", "required">, import("convex/values").VLiteral<"automatic", "required">], "required", never>;
103
+ text: import("convex/values").VString<string | undefined, "optional">;
104
+ brakes: import("convex/values").VObject<{
105
+ businessHoursOnly: boolean;
106
+ maxPerHour: number;
107
+ waitMinutes: number;
108
+ } | undefined, {
109
+ waitMinutes: import("convex/values").VFloat64<number, "required">;
110
+ maxPerHour: import("convex/values").VFloat64<number, "required">;
111
+ businessHoursOnly: import("convex/values").VBoolean<boolean, "required">;
112
+ }, "optional", "businessHoursOnly" | "maxPerHour" | "waitMinutes">;
113
+ }, "required", "brakes" | "brakes.businessHoursOnly" | "brakes.maxPerHour" | "brakes.waitMinutes" | "mode" | "text">;
114
+ /**
115
+ * What the rules decided for a lead: a column (`null` is the host's own
116
+ * entry, when no rule matched and the form names no entry column), or the
117
+ * discard with its reason.
118
+ */
119
+ export declare const formLeadDecisionValidator: import("convex/values").VUnion<{
120
+ column: string | null;
121
+ } | {
122
+ discard: string;
123
+ }, [import("convex/values").VObject<{
124
+ column: string | null;
125
+ }, {
126
+ column: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
127
+ }, "required", "column">, import("convex/values").VObject<{
128
+ discard: string;
129
+ }, {
130
+ discard: import("convex/values").VString<string, "required">;
131
+ }, "required", "discard">], "required", "column" | "discard">;
132
+ /** A choice answer as stored: the question and the option keys picked. */
133
+ export declare const formChoiceAnswerValidator: import("convex/values").VObject<{
134
+ answers: string[];
135
+ questionKey: string;
136
+ }, {
137
+ questionKey: import("convex/values").VString<string, "required">;
138
+ answers: import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">;
139
+ }, "required", "answers" | "questionKey">;
140
+ /** Where a form lead came from: the Page, the form and the ad. */
141
+ export declare const formLeadOriginValidator: import("convex/values").VObject<{
142
+ adId: string | null;
143
+ adName: string | null;
144
+ adsetId: string | null;
145
+ adsetName: string | null;
146
+ campaignId: string | null;
147
+ campaignName: string | null;
148
+ formId: string;
149
+ formName: string | null;
150
+ isOrganic: boolean;
151
+ pageId: string;
152
+ pageName: string | null;
153
+ platform: string | null;
154
+ }, {
155
+ pageId: import("convex/values").VString<string, "required">;
156
+ pageName: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
157
+ formId: import("convex/values").VString<string, "required">;
158
+ formName: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
159
+ adId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
160
+ adName: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
161
+ adsetId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
162
+ adsetName: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
163
+ campaignId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
164
+ campaignName: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
165
+ /** `fb` or `ig`, as Meta says where the form was filled. */
166
+ platform: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
167
+ isOrganic: import("convex/values").VBoolean<boolean, "required">;
168
+ }, "required", "adId" | "adName" | "adsetId" | "adsetName" | "campaignId" | "campaignName" | "formId" | "formName" | "isOrganic" | "pageId" | "pageName" | "platform">;
169
+ /** A choice answer with the labels the form shows. */
170
+ export declare const formLabeledAnswerValidator: import("convex/values").VObject<{
171
+ label: string;
172
+ questionKey: string;
173
+ values: string[];
174
+ }, {
175
+ questionKey: import("convex/values").VString<string, "required">;
176
+ label: import("convex/values").VString<string, "required">;
177
+ values: import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">;
178
+ }, "required", "label" | "questionKey" | "values">;
179
+ /**
180
+ * What the component hands the host's form lead handler (an internal
181
+ * mutation registered with `setFormLeadHandler`). `contact` and
182
+ * `freeAnswers` come from Meta in memory and are never stored by Rastro; the
183
+ * host owns the person from here. The handler must be idempotent on
184
+ * `leadgenId`.
185
+ */
186
+ export declare const formLeadPayloadValidator: import("convex/values").VObject<{
187
+ answers: {
188
+ label: string;
189
+ questionKey: string;
190
+ values: string[];
191
+ }[];
192
+ contact: {
193
+ email: string | null;
194
+ name: string | null;
195
+ phone: string | null;
196
+ };
197
+ decision: {
198
+ column: string | null;
199
+ } | {
200
+ discard: string;
201
+ };
202
+ firstContact: {
203
+ brakes?: {
204
+ businessHoursOnly: boolean;
205
+ maxPerHour: number;
206
+ waitMinutes: number;
207
+ } | undefined;
208
+ mode: "automatic" | "lead_starts" | "one_click";
209
+ text?: string | undefined;
210
+ };
211
+ freeAnswers: {
212
+ label: string;
213
+ questionKey: string;
214
+ value: string;
215
+ }[];
216
+ leadId: string;
217
+ leadKey: string;
218
+ leadgenId: string;
219
+ origin: {
220
+ adId: string | null;
221
+ adName: string | null;
222
+ adsetId: string | null;
223
+ adsetName: string | null;
224
+ campaignId: string | null;
225
+ campaignName: string | null;
226
+ formId: string;
227
+ formName: string | null;
228
+ isOrganic: boolean;
229
+ pageId: string;
230
+ pageName: string | null;
231
+ platform: string | null;
232
+ };
233
+ receivedAt: number;
234
+ ruleIndex: number | null;
235
+ rulePath: number[];
236
+ siteId: string;
237
+ }, {
238
+ siteId: import("convex/values").VString<string, "required">;
239
+ /** Rastro's lead; `leadKey` is what `setLeadStage` takes for it. */
240
+ leadId: import("convex/values").VString<string, "required">;
241
+ leadKey: import("convex/values").VString<string, "required">;
242
+ leadgenId: import("convex/values").VString<string, "required">;
243
+ /** When the lead submitted the form (Meta's `created_time`). */
244
+ receivedAt: import("convex/values").VFloat64<number, "required">;
245
+ contact: import("convex/values").VObject<{
246
+ email: string | null;
247
+ name: string | null;
248
+ phone: string | null;
249
+ }, {
250
+ name: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
251
+ /** As the lead typed it, usually with the country code (`+55…`). */
252
+ phone: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
253
+ email: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
254
+ }, "required", "email" | "name" | "phone">;
255
+ /** Answers typed freely (and any personal field besides the contact). */
256
+ freeAnswers: import("convex/values").VArray<{
257
+ label: string;
258
+ questionKey: string;
259
+ value: string;
260
+ }[], import("convex/values").VObject<{
261
+ label: string;
262
+ questionKey: string;
263
+ value: string;
264
+ }, {
265
+ questionKey: import("convex/values").VString<string, "required">;
266
+ label: import("convex/values").VString<string, "required">;
267
+ value: import("convex/values").VString<string, "required">;
268
+ }, "required", "label" | "questionKey" | "value">, "required">;
269
+ /** The choice answers, with the labels the form shows. */
270
+ answers: import("convex/values").VArray<{
271
+ label: string;
272
+ questionKey: string;
273
+ values: string[];
274
+ }[], import("convex/values").VObject<{
275
+ label: string;
276
+ questionKey: string;
277
+ values: string[];
278
+ }, {
279
+ questionKey: import("convex/values").VString<string, "required">;
280
+ label: import("convex/values").VString<string, "required">;
281
+ values: import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">;
282
+ }, "required", "label" | "questionKey" | "values">, "required">;
283
+ decision: import("convex/values").VUnion<{
284
+ column: string | null;
285
+ } | {
286
+ discard: string;
287
+ }, [import("convex/values").VObject<{
288
+ column: string | null;
289
+ }, {
290
+ column: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
291
+ }, "required", "column">, import("convex/values").VObject<{
292
+ discard: string;
293
+ }, {
294
+ discard: import("convex/values").VString<string, "required">;
295
+ }, "required", "discard">], "required", "column" | "discard">;
296
+ /** The rule indexes evaluated, in order; the last one decided if any did. */
297
+ rulePath: import("convex/values").VArray<number[], import("convex/values").VFloat64<number, "required">, "required">;
298
+ /** The rule that decided, or null when none matched. */
299
+ ruleIndex: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
300
+ origin: import("convex/values").VObject<{
301
+ adId: string | null;
302
+ adName: string | null;
303
+ adsetId: string | null;
304
+ adsetName: string | null;
305
+ campaignId: string | null;
306
+ campaignName: string | null;
307
+ formId: string;
308
+ formName: string | null;
309
+ isOrganic: boolean;
310
+ pageId: string;
311
+ pageName: string | null;
312
+ platform: string | null;
313
+ }, {
314
+ pageId: import("convex/values").VString<string, "required">;
315
+ pageName: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
316
+ formId: import("convex/values").VString<string, "required">;
317
+ formName: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
318
+ adId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
319
+ adName: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
320
+ adsetId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
321
+ adsetName: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
322
+ campaignId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
323
+ campaignName: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
324
+ /** `fb` or `ig`, as Meta says where the form was filled. */
325
+ platform: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
326
+ isOrganic: import("convex/values").VBoolean<boolean, "required">;
327
+ }, "required", "adId" | "adName" | "adsetId" | "adsetName" | "campaignId" | "campaignName" | "formId" | "formName" | "isOrganic" | "pageId" | "pageName" | "platform">;
328
+ firstContact: import("convex/values").VObject<{
329
+ brakes?: {
330
+ businessHoursOnly: boolean;
331
+ maxPerHour: number;
332
+ waitMinutes: number;
333
+ } | undefined;
334
+ mode: "automatic" | "lead_starts" | "one_click";
335
+ text?: string | undefined;
336
+ }, {
337
+ mode: import("convex/values").VUnion<"automatic" | "lead_starts" | "one_click", [import("convex/values").VLiteral<"lead_starts", "required">, import("convex/values").VLiteral<"one_click", "required">, import("convex/values").VLiteral<"automatic", "required">], "required", never>;
338
+ text: import("convex/values").VString<string | undefined, "optional">;
339
+ brakes: import("convex/values").VObject<{
340
+ businessHoursOnly: boolean;
341
+ maxPerHour: number;
342
+ waitMinutes: number;
343
+ } | undefined, {
344
+ waitMinutes: import("convex/values").VFloat64<number, "required">;
345
+ maxPerHour: import("convex/values").VFloat64<number, "required">;
346
+ businessHoursOnly: import("convex/values").VBoolean<boolean, "required">;
347
+ }, "optional", "businessHoursOnly" | "maxPerHour" | "waitMinutes">;
348
+ }, "required", "brakes" | "brakes.businessHoursOnly" | "brakes.maxPerHour" | "brakes.waitMinutes" | "mode" | "text">;
349
+ }, "required", "answers" | "contact" | "contact.email" | "contact.name" | "contact.phone" | "decision" | "decision.column" | "decision.discard" | "firstContact" | "firstContact.brakes" | "firstContact.brakes.businessHoursOnly" | "firstContact.brakes.maxPerHour" | "firstContact.brakes.waitMinutes" | "firstContact.mode" | "firstContact.text" | "freeAnswers" | "leadId" | "leadKey" | "leadgenId" | "origin" | "origin.adId" | "origin.adName" | "origin.adsetId" | "origin.adsetName" | "origin.campaignId" | "origin.campaignName" | "origin.formId" | "origin.formName" | "origin.isOrganic" | "origin.pageId" | "origin.pageName" | "origin.platform" | "receivedAt" | "ruleIndex" | "rulePath" | "siteId">;
350
+ /**
351
+ * What stops or slows a linked Page, as a code a screen maps to its own text
352
+ * (decision D6). Only `META_TOKEN_INVALID` and `META_PERMISSION_MISSING` are
353
+ * fixed by reconnecting Meta (the second also covers a Page the login no
354
+ * longer lists). `HANDLER_MISSING`, `HANDLER_FAILED` and `HANDLER_GAVE_UP`
355
+ * are the host's (no form lead handler; it throws and the lead is read again;
356
+ * it threw too often and the lead was skipped for good); `SECRETS_KEY_MISSING`
357
+ * is the host's env.
358
+ * `META_TRUNCATED`, `META_RATE_LIMITED`, `META_UNAVAILABLE` and `RUN_TIMEOUT`
359
+ * pass by themselves: the next run goes on.
360
+ */
361
+ export declare const META_PAGE_ERROR_CODES: readonly ["META_TOKEN_INVALID", "META_PERMISSION_MISSING", "HANDLER_MISSING", "HANDLER_FAILED", "HANDLER_GAVE_UP", "SECRETS_KEY_MISSING", "META_TRUNCATED", "META_RATE_LIMITED", "META_UNAVAILABLE", "RUN_TIMEOUT"];
362
+ export type MetaPageErrorCode = (typeof META_PAGE_ERROR_CODES)[number];
363
+ export declare const metaPageErrorCodeValidator: import("convex/values").VUnion<"HANDLER_FAILED" | "HANDLER_GAVE_UP" | "HANDLER_MISSING" | "META_PERMISSION_MISSING" | "META_RATE_LIMITED" | "META_TOKEN_INVALID" | "META_TRUNCATED" | "META_UNAVAILABLE" | "RUN_TIMEOUT" | "SECRETS_KEY_MISSING", [import("convex/values").VLiteral<"META_TOKEN_INVALID", "required">, import("convex/values").VLiteral<"META_PERMISSION_MISSING", "required">, import("convex/values").VLiteral<"HANDLER_MISSING", "required">, import("convex/values").VLiteral<"HANDLER_FAILED", "required">, import("convex/values").VLiteral<"HANDLER_GAVE_UP", "required">, import("convex/values").VLiteral<"SECRETS_KEY_MISSING", "required">, import("convex/values").VLiteral<"META_TRUNCATED", "required">, import("convex/values").VLiteral<"META_RATE_LIMITED", "required">, import("convex/values").VLiteral<"META_UNAVAILABLE", "required">, import("convex/values").VLiteral<"RUN_TIMEOUT", "required">], "required", never>;
364
+ /** What `metaLinkedPages` answers the control plane (decision D1). */
365
+ export declare const linkedPagesValidator: import("convex/values").VObject<{
366
+ audience: string | null;
367
+ handlerReady: boolean;
368
+ issuer: string;
369
+ leadgenReady: boolean;
370
+ pages: {
371
+ pageId: string;
372
+ siteId: string;
373
+ }[];
374
+ }, {
375
+ pages: import("convex/values").VArray<{
376
+ pageId: string;
377
+ siteId: string;
378
+ }[], import("convex/values").VObject<{
379
+ pageId: string;
380
+ siteId: string;
381
+ }, {
382
+ pageId: import("convex/values").VString<string, "required">;
383
+ siteId: import("convex/values").VString<string, "required">;
384
+ }, "required", "pageId" | "siteId">, "required">;
385
+ /**
386
+ * The component has `RASTRO_FEDERATION_AUDIENCE`: its leadgen route can
387
+ * verify a forward. False, every forward would answer `503`.
388
+ */
389
+ leadgenReady: import("convex/values").VBoolean<boolean, "required">;
390
+ /** The issuer the leadgen route verifies forwards against. */
391
+ issuer: import("convex/values").VString<string, "required">;
392
+ /**
393
+ * The audience the leadgen route expects (`RASTRO_FEDERATION_AUDIENCE`,
394
+ * without a trailing slash), or null when it has none.
395
+ */
396
+ audience: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
397
+ /**
398
+ * The host registered its form lead handler (the Lead Ads opt-in). False,
399
+ * the component reads no Pages: the list stays empty until it does, and
400
+ * reconnecting Meta changes nothing.
401
+ */
402
+ handlerReady: import("convex/values").VBoolean<boolean, "required">;
403
+ }, "required", "audience" | "handlerReady" | "issuer" | "leadgenReady" | "pages">;
404
+ /** A Page an owner's Meta connection lists, as a screen shows it. */
405
+ export declare const metaPageValidator: import("convex/values").VObject<{
406
+ handlerReady: boolean;
407
+ lastError: "HANDLER_FAILED" | "HANDLER_GAVE_UP" | "HANDLER_MISSING" | "META_PERMISSION_MISSING" | "META_RATE_LIMITED" | "META_TOKEN_INVALID" | "META_TRUNCATED" | "META_UNAVAILABLE" | "RUN_TIMEOUT" | "SECRETS_KEY_MISSING" | null;
408
+ leadsAllowed: boolean;
409
+ linkedOutsideScope?: boolean | undefined;
410
+ linkedSiteId: string | null;
411
+ name: string;
412
+ own: boolean | null;
413
+ pageId: string;
414
+ subscribedAt: number | null;
415
+ tasks: string[];
416
+ }, {
417
+ pageId: import("convex/values").VString<string, "required">;
418
+ name: import("convex/values").VString<string, "required">;
419
+ tasks: import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">;
420
+ /** Meta granted `leads_retrieval` for the Page to this login. */
421
+ leadsAllowed: import("convex/values").VBoolean<boolean, "required">;
422
+ /** The site the Page feeds, whoever linked it; null when free. */
423
+ linkedSiteId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
424
+ /** Federated reads only: linked to a site outside the caller's grant. */
425
+ linkedOutsideScope: import("convex/values").VBoolean<boolean | undefined, "optional">;
426
+ /** Whether this owner linked it; null while the Page is free. */
427
+ own: import("convex/values").VUnion<boolean | null, [import("convex/values").VBoolean<boolean, "required">, import("convex/values").VNull<null, "required">], "required", never>;
428
+ subscribedAt: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
429
+ /**
430
+ * What stops or slows the Page, as a code (`META_PAGE_ERROR_CODES`): Meta
431
+ * refused its token or lead access, or, for a Page this owner linked, the
432
+ * host's handler or the last reconciliation. Null when nothing does.
433
+ */
434
+ lastError: import("convex/values").VUnion<"HANDLER_FAILED" | "HANDLER_GAVE_UP" | "HANDLER_MISSING" | "META_PERMISSION_MISSING" | "META_RATE_LIMITED" | "META_TOKEN_INVALID" | "META_TRUNCATED" | "META_UNAVAILABLE" | "RUN_TIMEOUT" | "SECRETS_KEY_MISSING" | null, [import("convex/values").VUnion<"HANDLER_FAILED" | "HANDLER_GAVE_UP" | "HANDLER_MISSING" | "META_PERMISSION_MISSING" | "META_RATE_LIMITED" | "META_TOKEN_INVALID" | "META_TRUNCATED" | "META_UNAVAILABLE" | "RUN_TIMEOUT" | "SECRETS_KEY_MISSING", [import("convex/values").VLiteral<"META_TOKEN_INVALID", "required">, import("convex/values").VLiteral<"META_PERMISSION_MISSING", "required">, import("convex/values").VLiteral<"HANDLER_MISSING", "required">, import("convex/values").VLiteral<"HANDLER_FAILED", "required">, import("convex/values").VLiteral<"HANDLER_GAVE_UP", "required">, import("convex/values").VLiteral<"SECRETS_KEY_MISSING", "required">, import("convex/values").VLiteral<"META_TRUNCATED", "required">, import("convex/values").VLiteral<"META_RATE_LIMITED", "required">, import("convex/values").VLiteral<"META_UNAVAILABLE", "required">, import("convex/values").VLiteral<"RUN_TIMEOUT", "required">], "required", never>, import("convex/values").VNull<null, "required">], "required", never>;
435
+ /** Whether the host registered its form lead handler (no lead comes in without it). */
436
+ handlerReady: import("convex/values").VBoolean<boolean, "required">;
437
+ }, "required", "handlerReady" | "lastError" | "leadsAllowed" | "linkedOutsideScope" | "linkedSiteId" | "name" | "own" | "pageId" | "subscribedAt" | "tasks">;
438
+ /** One instant form of a Page linked to the site, for the forms screen. */
439
+ export declare const metaFormRowValidator: import("convex/values").VObject<{
440
+ createdTime: number | null;
441
+ daily: number[] | null;
442
+ formId: string;
443
+ lastLeadAt: number | null;
444
+ leads30d: number | null;
445
+ name: string;
446
+ questions: {
447
+ key: string;
448
+ label: string;
449
+ options?: {
450
+ key: string;
451
+ value: string;
452
+ }[] | undefined;
453
+ type: string;
454
+ }[];
455
+ rules: {
456
+ configured: boolean;
457
+ count: number;
458
+ entryColumn: string | null;
459
+ own?: boolean | undefined;
460
+ };
461
+ status: string;
462
+ syncedAt: number;
463
+ whatsappButton: boolean | null;
464
+ whatsappButtonConfirmed: boolean;
465
+ }, {
466
+ formId: import("convex/values").VString<string, "required">;
467
+ name: import("convex/values").VString<string, "required">;
468
+ /** Meta's status: `ACTIVE`, `ARCHIVED`, `DELETED`, `DRAFT`. */
469
+ status: import("convex/values").VString<string, "required">;
470
+ questions: import("convex/values").VArray<{
471
+ key: string;
472
+ label: string;
473
+ options?: {
474
+ key: string;
475
+ value: string;
476
+ }[] | undefined;
477
+ type: string;
478
+ }[], import("convex/values").VObject<{
479
+ key: string;
480
+ label: string;
481
+ options?: {
482
+ key: string;
483
+ value: string;
484
+ }[] | undefined;
485
+ type: string;
486
+ }, {
487
+ key: import("convex/values").VString<string, "required">;
488
+ label: import("convex/values").VString<string, "required">;
489
+ /** Meta's type: `FULL_NAME`, `EMAIL`, `PHONE`, `CUSTOM`… */
490
+ type: import("convex/values").VString<string, "required">;
491
+ options: import("convex/values").VArray<{
492
+ key: string;
493
+ value: string;
494
+ }[] | undefined, import("convex/values").VObject<{
495
+ key: string;
496
+ value: string;
497
+ }, {
498
+ key: import("convex/values").VString<string, "required">;
499
+ value: import("convex/values").VString<string, "required">;
500
+ }, "required", "key" | "value">, "optional">;
501
+ }, "required", "key" | "label" | "options" | "type">, "required">;
502
+ /** The end screen's WhatsApp button; null when Meta does not say. */
503
+ whatsappButton: import("convex/values").VUnion<boolean | null, [import("convex/values").VBoolean<boolean, "required">, import("convex/values").VNull<null, "required">], "required", never>;
504
+ /** The host marked the button as set by hand ("Já liguei"). */
505
+ whatsappButtonConfirmed: import("convex/values").VBoolean<boolean, "required">;
506
+ createdTime: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
507
+ syncedAt: import("convex/values").VFloat64<number, "required">;
508
+ /** Leads in the 30 UTC days up to `now`; null without `now`. */
509
+ leads30d: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
510
+ /** Those leads per UTC day, oldest first (30 entries); null without `now`. */
511
+ daily: import("convex/values").VUnion<number[] | null, [import("convex/values").VArray<number[], import("convex/values").VFloat64<number, "required">, "required">, import("convex/values").VNull<null, "required">], "required", never>;
512
+ lastLeadAt: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
513
+ rules: import("convex/values").VObject<{
514
+ configured: boolean;
515
+ count: number;
516
+ entryColumn: string | null;
517
+ own?: boolean | undefined;
518
+ }, {
519
+ configured: import("convex/values").VBoolean<boolean, "required">;
520
+ count: import("convex/values").VFloat64<number, "required">;
521
+ entryColumn: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
522
+ /** With an owner: whether that owner may edit them (not another's). */
523
+ own: import("convex/values").VBoolean<boolean | undefined, "optional">;
524
+ }, "required", "configured" | "count" | "entryColumn" | "own">;
525
+ }, "required", "createdTime" | "daily" | "formId" | "lastLeadAt" | "leads30d" | "name" | "questions" | "rules" | "rules.configured" | "rules.count" | "rules.entryColumn" | "rules.own" | "status" | "syncedAt" | "whatsappButton" | "whatsappButtonConfirmed">;
526
+ /** The Pages linked to a site, each with its forms. */
527
+ export declare const metaFormsValidator: import("convex/values").VArray<{
528
+ forms: {
529
+ createdTime: number | null;
530
+ daily: number[] | null;
531
+ formId: string;
532
+ lastLeadAt: number | null;
533
+ leads30d: number | null;
534
+ name: string;
535
+ questions: {
536
+ key: string;
537
+ label: string;
538
+ options?: {
539
+ key: string;
540
+ value: string;
541
+ }[] | undefined;
542
+ type: string;
543
+ }[];
544
+ rules: {
545
+ configured: boolean;
546
+ count: number;
547
+ entryColumn: string | null;
548
+ own?: boolean | undefined;
549
+ };
550
+ status: string;
551
+ syncedAt: number;
552
+ whatsappButton: boolean | null;
553
+ whatsappButtonConfirmed: boolean;
554
+ }[];
555
+ handlerReady: boolean;
556
+ lastError: "HANDLER_FAILED" | "HANDLER_GAVE_UP" | "HANDLER_MISSING" | "META_PERMISSION_MISSING" | "META_RATE_LIMITED" | "META_TOKEN_INVALID" | "META_TRUNCATED" | "META_UNAVAILABLE" | "RUN_TIMEOUT" | "SECRETS_KEY_MISSING" | null;
557
+ lastLeadAt: number | null;
558
+ lastReconcileAt: number | null;
559
+ leadsAllowed: boolean;
560
+ own?: boolean | undefined;
561
+ pageId: string;
562
+ pageName: string;
563
+ subscribedAt: number | null;
564
+ }[], import("convex/values").VObject<{
565
+ forms: {
566
+ createdTime: number | null;
567
+ daily: number[] | null;
568
+ formId: string;
569
+ lastLeadAt: number | null;
570
+ leads30d: number | null;
571
+ name: string;
572
+ questions: {
573
+ key: string;
574
+ label: string;
575
+ options?: {
576
+ key: string;
577
+ value: string;
578
+ }[] | undefined;
579
+ type: string;
580
+ }[];
581
+ rules: {
582
+ configured: boolean;
583
+ count: number;
584
+ entryColumn: string | null;
585
+ own?: boolean | undefined;
586
+ };
587
+ status: string;
588
+ syncedAt: number;
589
+ whatsappButton: boolean | null;
590
+ whatsappButtonConfirmed: boolean;
591
+ }[];
592
+ handlerReady: boolean;
593
+ lastError: "HANDLER_FAILED" | "HANDLER_GAVE_UP" | "HANDLER_MISSING" | "META_PERMISSION_MISSING" | "META_RATE_LIMITED" | "META_TOKEN_INVALID" | "META_TRUNCATED" | "META_UNAVAILABLE" | "RUN_TIMEOUT" | "SECRETS_KEY_MISSING" | null;
594
+ lastLeadAt: number | null;
595
+ lastReconcileAt: number | null;
596
+ leadsAllowed: boolean;
597
+ own?: boolean | undefined;
598
+ pageId: string;
599
+ pageName: string;
600
+ subscribedAt: number | null;
601
+ }, {
602
+ pageId: import("convex/values").VString<string, "required">;
603
+ pageName: import("convex/values").VString<string, "required">;
604
+ leadsAllowed: import("convex/values").VBoolean<boolean, "required">;
605
+ subscribedAt: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
606
+ lastReconcileAt: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
607
+ lastLeadAt: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
608
+ /** As on `metaPages`: a code of `META_PAGE_ERROR_CODES`, or null. */
609
+ lastError: import("convex/values").VUnion<"HANDLER_FAILED" | "HANDLER_GAVE_UP" | "HANDLER_MISSING" | "META_PERMISSION_MISSING" | "META_RATE_LIMITED" | "META_TOKEN_INVALID" | "META_TRUNCATED" | "META_UNAVAILABLE" | "RUN_TIMEOUT" | "SECRETS_KEY_MISSING" | null, [import("convex/values").VUnion<"HANDLER_FAILED" | "HANDLER_GAVE_UP" | "HANDLER_MISSING" | "META_PERMISSION_MISSING" | "META_RATE_LIMITED" | "META_TOKEN_INVALID" | "META_TRUNCATED" | "META_UNAVAILABLE" | "RUN_TIMEOUT" | "SECRETS_KEY_MISSING", [import("convex/values").VLiteral<"META_TOKEN_INVALID", "required">, import("convex/values").VLiteral<"META_PERMISSION_MISSING", "required">, import("convex/values").VLiteral<"HANDLER_MISSING", "required">, import("convex/values").VLiteral<"HANDLER_FAILED", "required">, import("convex/values").VLiteral<"HANDLER_GAVE_UP", "required">, import("convex/values").VLiteral<"SECRETS_KEY_MISSING", "required">, import("convex/values").VLiteral<"META_TRUNCATED", "required">, import("convex/values").VLiteral<"META_RATE_LIMITED", "required">, import("convex/values").VLiteral<"META_UNAVAILABLE", "required">, import("convex/values").VLiteral<"RUN_TIMEOUT", "required">], "required", never>, import("convex/values").VNull<null, "required">], "required", never>;
610
+ /** With an owner: whether that owner linked the Page. */
611
+ own: import("convex/values").VBoolean<boolean | undefined, "optional">;
612
+ /** Whether the host registered its form lead handler. */
613
+ handlerReady: import("convex/values").VBoolean<boolean, "required">;
614
+ forms: import("convex/values").VArray<{
615
+ createdTime: number | null;
616
+ daily: number[] | null;
617
+ formId: string;
618
+ lastLeadAt: number | null;
619
+ leads30d: number | null;
620
+ name: string;
621
+ questions: {
622
+ key: string;
623
+ label: string;
624
+ options?: {
625
+ key: string;
626
+ value: string;
627
+ }[] | undefined;
628
+ type: string;
629
+ }[];
630
+ rules: {
631
+ configured: boolean;
632
+ count: number;
633
+ entryColumn: string | null;
634
+ own?: boolean | undefined;
635
+ };
636
+ status: string;
637
+ syncedAt: number;
638
+ whatsappButton: boolean | null;
639
+ whatsappButtonConfirmed: boolean;
640
+ }[], import("convex/values").VObject<{
641
+ createdTime: number | null;
642
+ daily: number[] | null;
643
+ formId: string;
644
+ lastLeadAt: number | null;
645
+ leads30d: number | null;
646
+ name: string;
647
+ questions: {
648
+ key: string;
649
+ label: string;
650
+ options?: {
651
+ key: string;
652
+ value: string;
653
+ }[] | undefined;
654
+ type: string;
655
+ }[];
656
+ rules: {
657
+ configured: boolean;
658
+ count: number;
659
+ entryColumn: string | null;
660
+ own?: boolean | undefined;
661
+ };
662
+ status: string;
663
+ syncedAt: number;
664
+ whatsappButton: boolean | null;
665
+ whatsappButtonConfirmed: boolean;
666
+ }, {
667
+ formId: import("convex/values").VString<string, "required">;
668
+ name: import("convex/values").VString<string, "required">;
669
+ /** Meta's status: `ACTIVE`, `ARCHIVED`, `DELETED`, `DRAFT`. */
670
+ status: import("convex/values").VString<string, "required">;
671
+ questions: import("convex/values").VArray<{
672
+ key: string;
673
+ label: string;
674
+ options?: {
675
+ key: string;
676
+ value: string;
677
+ }[] | undefined;
678
+ type: string;
679
+ }[], import("convex/values").VObject<{
680
+ key: string;
681
+ label: string;
682
+ options?: {
683
+ key: string;
684
+ value: string;
685
+ }[] | undefined;
686
+ type: string;
687
+ }, {
688
+ key: import("convex/values").VString<string, "required">;
689
+ label: import("convex/values").VString<string, "required">;
690
+ /** Meta's type: `FULL_NAME`, `EMAIL`, `PHONE`, `CUSTOM`… */
691
+ type: import("convex/values").VString<string, "required">;
692
+ options: import("convex/values").VArray<{
693
+ key: string;
694
+ value: string;
695
+ }[] | undefined, import("convex/values").VObject<{
696
+ key: string;
697
+ value: string;
698
+ }, {
699
+ key: import("convex/values").VString<string, "required">;
700
+ value: import("convex/values").VString<string, "required">;
701
+ }, "required", "key" | "value">, "optional">;
702
+ }, "required", "key" | "label" | "options" | "type">, "required">;
703
+ /** The end screen's WhatsApp button; null when Meta does not say. */
704
+ whatsappButton: import("convex/values").VUnion<boolean | null, [import("convex/values").VBoolean<boolean, "required">, import("convex/values").VNull<null, "required">], "required", never>;
705
+ /** The host marked the button as set by hand ("Já liguei"). */
706
+ whatsappButtonConfirmed: import("convex/values").VBoolean<boolean, "required">;
707
+ createdTime: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
708
+ syncedAt: import("convex/values").VFloat64<number, "required">;
709
+ /** Leads in the 30 UTC days up to `now`; null without `now`. */
710
+ leads30d: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
711
+ /** Those leads per UTC day, oldest first (30 entries); null without `now`. */
712
+ daily: import("convex/values").VUnion<number[] | null, [import("convex/values").VArray<number[], import("convex/values").VFloat64<number, "required">, "required">, import("convex/values").VNull<null, "required">], "required", never>;
713
+ lastLeadAt: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
714
+ rules: import("convex/values").VObject<{
715
+ configured: boolean;
716
+ count: number;
717
+ entryColumn: string | null;
718
+ own?: boolean | undefined;
719
+ }, {
720
+ configured: import("convex/values").VBoolean<boolean, "required">;
721
+ count: import("convex/values").VFloat64<number, "required">;
722
+ entryColumn: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
723
+ /** With an owner: whether that owner may edit them (not another's). */
724
+ own: import("convex/values").VBoolean<boolean | undefined, "optional">;
725
+ }, "required", "configured" | "count" | "entryColumn" | "own">;
726
+ }, "required", "createdTime" | "daily" | "formId" | "lastLeadAt" | "leads30d" | "name" | "questions" | "rules" | "rules.configured" | "rules.count" | "rules.entryColumn" | "rules.own" | "status" | "syncedAt" | "whatsappButton" | "whatsappButtonConfirmed">, "required">;
727
+ }, "required", "forms" | "handlerReady" | "lastError" | "lastLeadAt" | "lastReconcileAt" | "leadsAllowed" | "own" | "pageId" | "pageName" | "subscribedAt">, "required">;
728
+ /** A form's rules as the drawer edits them, each with its monthly count. */
729
+ export declare const formRulesValidator: import("convex/values").VObject<{
730
+ configured: boolean;
731
+ entryColumn: string | null;
732
+ firstContact: {
733
+ brakes?: {
734
+ businessHoursOnly: boolean;
735
+ maxPerHour: number;
736
+ waitMinutes: number;
737
+ } | undefined;
738
+ mode: "automatic" | "lead_starts" | "one_click";
739
+ text?: string | undefined;
740
+ };
741
+ formId: string;
742
+ own?: boolean | undefined;
743
+ rules: {
744
+ answers: string[];
745
+ monthCount: number | null;
746
+ questionKey: string;
747
+ to: {
748
+ column: string;
749
+ } | {
750
+ discard: string;
751
+ };
752
+ }[];
753
+ siteId: string;
754
+ updatedAt: number | null;
755
+ whatsappButtonConfirmed: boolean;
756
+ }, {
757
+ siteId: import("convex/values").VString<string, "required">;
758
+ formId: import("convex/values").VString<string, "required">;
759
+ configured: import("convex/values").VBoolean<boolean, "required">;
760
+ entryColumn: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
761
+ rules: import("convex/values").VArray<{
762
+ answers: string[];
763
+ monthCount: number | null;
764
+ questionKey: string;
765
+ to: {
766
+ column: string;
767
+ } | {
768
+ discard: string;
769
+ };
770
+ }[], import("convex/values").VObject<{
771
+ answers: string[];
772
+ monthCount: number | null;
773
+ questionKey: string;
774
+ to: {
775
+ column: string;
776
+ } | {
777
+ discard: string;
778
+ };
779
+ }, {
780
+ questionKey: import("convex/values").VString<string, "required">;
781
+ /** Option keys (or values) of the question; any of them matches. */
782
+ answers: import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">;
783
+ to: import("convex/values").VUnion<{
784
+ column: string;
785
+ } | {
786
+ discard: string;
787
+ }, [import("convex/values").VObject<{
788
+ column: string;
789
+ }, {
790
+ column: import("convex/values").VString<string, "required">;
791
+ }, "required", "column">, import("convex/values").VObject<{
792
+ discard: string;
793
+ }, {
794
+ discard: import("convex/values").VString<string, "required">;
795
+ }, "required", "discard">], "required", "column" | "discard">;
796
+ /** Leads this rule decided in the 30 days up to `now`; null without. */
797
+ monthCount: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
798
+ }, "required", "answers" | "monthCount" | "questionKey" | "to" | "to.column" | "to.discard">, "required">;
799
+ firstContact: import("convex/values").VObject<{
800
+ brakes?: {
801
+ businessHoursOnly: boolean;
802
+ maxPerHour: number;
803
+ waitMinutes: number;
804
+ } | undefined;
805
+ mode: "automatic" | "lead_starts" | "one_click";
806
+ text?: string | undefined;
807
+ }, {
808
+ mode: import("convex/values").VUnion<"automatic" | "lead_starts" | "one_click", [import("convex/values").VLiteral<"lead_starts", "required">, import("convex/values").VLiteral<"one_click", "required">, import("convex/values").VLiteral<"automatic", "required">], "required", never>;
809
+ text: import("convex/values").VString<string | undefined, "optional">;
810
+ brakes: import("convex/values").VObject<{
811
+ businessHoursOnly: boolean;
812
+ maxPerHour: number;
813
+ waitMinutes: number;
814
+ } | undefined, {
815
+ waitMinutes: import("convex/values").VFloat64<number, "required">;
816
+ maxPerHour: import("convex/values").VFloat64<number, "required">;
817
+ businessHoursOnly: import("convex/values").VBoolean<boolean, "required">;
818
+ }, "optional", "businessHoursOnly" | "maxPerHour" | "waitMinutes">;
819
+ }, "required", "brakes" | "brakes.businessHoursOnly" | "brakes.maxPerHour" | "brakes.waitMinutes" | "mode" | "text">;
820
+ whatsappButtonConfirmed: import("convex/values").VBoolean<boolean, "required">;
821
+ updatedAt: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
822
+ /** With an owner: whether that owner may edit them (not another's). */
823
+ own: import("convex/values").VBoolean<boolean | undefined, "optional">;
824
+ }, "required", "configured" | "entryColumn" | "firstContact" | "firstContact.brakes" | "firstContact.brakes.businessHoursOnly" | "firstContact.brakes.maxPerHour" | "firstContact.brakes.waitMinutes" | "firstContact.mode" | "firstContact.text" | "formId" | "own" | "rules" | "siteId" | "updatedAt" | "whatsappButtonConfirmed">;
825
+ /** The last 30 days' leads of a form under a draft of its rules. */
826
+ export declare const formRulesSimulationValidator: import("convex/values").VObject<{
827
+ columns: {
828
+ column: string;
829
+ leads: number;
830
+ }[];
831
+ discarded: {
832
+ leads: number;
833
+ reason: string;
834
+ }[];
835
+ entry: number;
836
+ partial: boolean;
837
+ rules: number[];
838
+ total: number;
839
+ }, {
840
+ total: import("convex/values").VFloat64<number, "required">;
841
+ /**
842
+ * Leads no rule matched: they go to the entry. Unlike `formsReport`'s
843
+ * `entry`, this counts them whether or not the draft names an entry column.
844
+ */
845
+ entry: import("convex/values").VFloat64<number, "required">;
846
+ /** Per draft rule, in order: the leads it would decide. */
847
+ rules: import("convex/values").VArray<number[], import("convex/values").VFloat64<number, "required">, "required">;
848
+ /**
849
+ * Leads per column the draft sends them to. With an `entryColumn`, its row
850
+ * already holds the `entry` leads: add `entry` only when no row names it.
851
+ */
852
+ columns: import("convex/values").VArray<{
853
+ column: string;
854
+ leads: number;
855
+ }[], import("convex/values").VObject<{
856
+ column: string;
857
+ leads: number;
858
+ }, {
859
+ column: import("convex/values").VString<string, "required">;
860
+ leads: import("convex/values").VFloat64<number, "required">;
861
+ }, "required", "column" | "leads">, "required">;
862
+ discarded: import("convex/values").VArray<{
863
+ leads: number;
864
+ reason: string;
865
+ }[], import("convex/values").VObject<{
866
+ leads: number;
867
+ reason: string;
868
+ }, {
869
+ reason: import("convex/values").VString<string, "required">;
870
+ leads: import("convex/values").VFloat64<number, "required">;
871
+ }, "required", "leads" | "reason">, "required">;
872
+ /** A read cap was hit: the figures cover the newest leads only. */
873
+ partial: import("convex/values").VBoolean<boolean, "required">;
874
+ }, "required", "columns" | "discarded" | "entry" | "partial" | "rules" | "total">;
875
+ /**
876
+ * Per form: its leads in the range and where the rules sent them. One row per
877
+ * (siteId, formId): a Page moved from one site to another inside the range
878
+ * has a row for each, so key rows by both. The range is whole UTC days:
879
+ * `from` floors to its day and `to` takes in the UTC day it falls on.
880
+ */
881
+ export declare const formsReportValidator: import("convex/values").VObject<{
882
+ forms: {
883
+ columns: {
884
+ column: string;
885
+ leads: number;
886
+ }[];
887
+ discarded: {
888
+ leads: number;
889
+ reason: string;
890
+ }[];
891
+ entry: number;
892
+ formId: string;
893
+ leads: number;
894
+ name: string | null;
895
+ pageId: string;
896
+ qualified: number;
897
+ returned: number;
898
+ revenueCents: number;
899
+ siteId: string;
900
+ won: number;
901
+ }[];
902
+ partial: boolean;
903
+ }, {
904
+ forms: import("convex/values").VArray<{
905
+ columns: {
906
+ column: string;
907
+ leads: number;
908
+ }[];
909
+ discarded: {
910
+ leads: number;
911
+ reason: string;
912
+ }[];
913
+ entry: number;
914
+ formId: string;
915
+ leads: number;
916
+ name: string | null;
917
+ pageId: string;
918
+ qualified: number;
919
+ returned: number;
920
+ revenueCents: number;
921
+ siteId: string;
922
+ won: number;
923
+ }[], import("convex/values").VObject<{
924
+ columns: {
925
+ column: string;
926
+ leads: number;
927
+ }[];
928
+ discarded: {
929
+ leads: number;
930
+ reason: string;
931
+ }[];
932
+ entry: number;
933
+ formId: string;
934
+ leads: number;
935
+ name: string | null;
936
+ pageId: string;
937
+ qualified: number;
938
+ returned: number;
939
+ revenueCents: number;
940
+ siteId: string;
941
+ won: number;
942
+ }, {
943
+ leads: import("convex/values").VFloat64<number, "required">;
944
+ qualified: import("convex/values").VFloat64<number, "required">;
945
+ won: import("convex/values").VFloat64<number, "required">;
946
+ revenueCents: import("convex/values").VFloat64<number, "required">;
947
+ siteId: import("convex/values").VString<string, "required">;
948
+ pageId: import("convex/values").VString<string, "required">;
949
+ formId: import("convex/values").VString<string, "required">;
950
+ name: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
951
+ /** Leads a rule (or the entry column) sent to each column. */
952
+ columns: import("convex/values").VArray<{
953
+ column: string;
954
+ leads: number;
955
+ }[], import("convex/values").VObject<{
956
+ column: string;
957
+ leads: number;
958
+ }, {
959
+ column: import("convex/values").VString<string, "required">;
960
+ leads: import("convex/values").VFloat64<number, "required">;
961
+ }, "required", "column" | "leads">, "required">;
962
+ /** Leads that went to the host's own entry (no column named). */
963
+ entry: import("convex/values").VFloat64<number, "required">;
964
+ discarded: import("convex/values").VArray<{
965
+ leads: number;
966
+ reason: string;
967
+ }[], import("convex/values").VObject<{
968
+ leads: number;
969
+ reason: string;
970
+ }, {
971
+ reason: import("convex/values").VString<string, "required">;
972
+ leads: import("convex/values").VFloat64<number, "required">;
973
+ }, "required", "leads" | "reason">, "required">;
974
+ /** Discarded leads someone sent back to the funnel. */
975
+ returned: import("convex/values").VFloat64<number, "required">;
976
+ }, "required", "columns" | "discarded" | "entry" | "formId" | "leads" | "name" | "pageId" | "qualified" | "returned" | "revenueCents" | "siteId" | "won">, "required">;
977
+ /** A read cap was hit: the decision counts are a lower bound. */
978
+ partial: import("convex/values").VBoolean<boolean, "required">;
979
+ }, "required", "forms" | "partial">;
980
+ /** A form lead as the journey shows it: answers, origin and the path. */
981
+ export declare const formLeadDetailValidator: import("convex/values").VObject<{
982
+ answers: {
983
+ label: string;
984
+ questionKey: string;
985
+ values: string[];
986
+ }[];
987
+ decision: {
988
+ column: string | null;
989
+ } | {
990
+ discard: string;
991
+ };
992
+ leadgenId: string;
993
+ origin: {
994
+ adId: string | null;
995
+ adName: string | null;
996
+ adsetId: string | null;
997
+ adsetName: string | null;
998
+ campaignId: string | null;
999
+ campaignName: string | null;
1000
+ formId: string;
1001
+ formName: string | null;
1002
+ isOrganic: boolean;
1003
+ pageId: string;
1004
+ pageName: string | null;
1005
+ platform: string | null;
1006
+ };
1007
+ receivedAt: number;
1008
+ returned: {
1009
+ at: number;
1010
+ reason: string;
1011
+ } | null;
1012
+ ruleIndex: number | null;
1013
+ rulePath: number[];
1014
+ }, {
1015
+ leadgenId: import("convex/values").VString<string, "required">;
1016
+ receivedAt: import("convex/values").VFloat64<number, "required">;
1017
+ origin: import("convex/values").VObject<{
1018
+ adId: string | null;
1019
+ adName: string | null;
1020
+ adsetId: string | null;
1021
+ adsetName: string | null;
1022
+ campaignId: string | null;
1023
+ campaignName: string | null;
1024
+ formId: string;
1025
+ formName: string | null;
1026
+ isOrganic: boolean;
1027
+ pageId: string;
1028
+ pageName: string | null;
1029
+ platform: string | null;
1030
+ }, {
1031
+ pageId: import("convex/values").VString<string, "required">;
1032
+ pageName: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
1033
+ formId: import("convex/values").VString<string, "required">;
1034
+ formName: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
1035
+ adId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
1036
+ adName: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
1037
+ adsetId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
1038
+ adsetName: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
1039
+ campaignId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
1040
+ campaignName: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
1041
+ /** `fb` or `ig`, as Meta says where the form was filled. */
1042
+ platform: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
1043
+ isOrganic: import("convex/values").VBoolean<boolean, "required">;
1044
+ }, "required", "adId" | "adName" | "adsetId" | "adsetName" | "campaignId" | "campaignName" | "formId" | "formName" | "isOrganic" | "pageId" | "pageName" | "platform">;
1045
+ answers: import("convex/values").VArray<{
1046
+ label: string;
1047
+ questionKey: string;
1048
+ values: string[];
1049
+ }[], import("convex/values").VObject<{
1050
+ label: string;
1051
+ questionKey: string;
1052
+ values: string[];
1053
+ }, {
1054
+ questionKey: import("convex/values").VString<string, "required">;
1055
+ label: import("convex/values").VString<string, "required">;
1056
+ values: import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">;
1057
+ }, "required", "label" | "questionKey" | "values">, "required">;
1058
+ decision: import("convex/values").VUnion<{
1059
+ column: string | null;
1060
+ } | {
1061
+ discard: string;
1062
+ }, [import("convex/values").VObject<{
1063
+ column: string | null;
1064
+ }, {
1065
+ column: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
1066
+ }, "required", "column">, import("convex/values").VObject<{
1067
+ discard: string;
1068
+ }, {
1069
+ discard: import("convex/values").VString<string, "required">;
1070
+ }, "required", "discard">], "required", "column" | "discard">;
1071
+ rulePath: import("convex/values").VArray<number[], import("convex/values").VFloat64<number, "required">, "required">;
1072
+ ruleIndex: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
1073
+ /** When a discarded lead was sent back, and the reason it had. */
1074
+ returned: import("convex/values").VUnion<{
1075
+ at: number;
1076
+ reason: string;
1077
+ } | null, [import("convex/values").VObject<{
1078
+ at: number;
1079
+ reason: string;
1080
+ }, {
1081
+ at: import("convex/values").VFloat64<number, "required">;
1082
+ reason: import("convex/values").VString<string, "required">;
1083
+ }, "required", "at" | "reason">, import("convex/values").VNull<null, "required">], "required", "at" | "reason">;
1084
+ }, "required", "answers" | "decision" | "decision.column" | "decision.discard" | "leadgenId" | "origin" | "origin.adId" | "origin.adName" | "origin.adsetId" | "origin.adsetName" | "origin.campaignId" | "origin.campaignName" | "origin.formId" | "origin.formName" | "origin.isOrganic" | "origin.pageId" | "origin.pageName" | "origin.platform" | "receivedAt" | "returned" | "returned.at" | "returned.reason" | "ruleIndex" | "rulePath">;
1085
+ export type FormRule = Infer<typeof formRuleValidator>;
1086
+ export type FormRuleTarget = Infer<typeof formRuleTargetValidator>;
1087
+ export type FirstContact = Infer<typeof firstContactValidator>;
1088
+ export type FormLeadDecision = Infer<typeof formLeadDecisionValidator>;
1089
+ export type FormLeadPayload = Infer<typeof formLeadPayloadValidator>;
1090
+ export type MetaFormQuestion = Infer<typeof metaFormQuestionValidator>;
1091
+ export type FormChoiceAnswer = Infer<typeof formChoiceAnswerValidator>;
1092
+ //# sourceMappingURL=leadAdsValidators.d.ts.map