@iann29/rastro 0.10.9 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/agent/integration.md +45 -0
- package/agent/manifest.json +4 -4
- package/dist/client/federation.d.ts +82 -9
- package/dist/client/federation.d.ts.map +1 -1
- package/dist/client/federation.js +40 -2
- package/dist/client/federation.js.map +1 -1
- package/dist/client/index.d.ts +465 -8
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +259 -7
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/api.d.ts +10 -0
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +274 -21
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/_generated/server.d.ts +2 -0
- package/dist/component/_generated/server.d.ts.map +1 -1
- package/dist/component/_generated/server.js.map +1 -1
- package/dist/component/constants.d.ts +31 -0
- package/dist/component/constants.d.ts.map +1 -1
- package/dist/component/constants.js +31 -0
- package/dist/component/constants.js.map +1 -1
- package/dist/component/convex.config.d.ts +2 -0
- package/dist/component/convex.config.js +7 -0
- package/dist/component/convex.config.js.map +1 -1
- package/dist/component/errors.d.ts +1 -1
- package/dist/component/errors.d.ts.map +1 -1
- package/dist/component/errors.js.map +1 -1
- package/dist/component/http.d.ts.map +1 -1
- package/dist/component/http.js +64 -0
- package/dist/component/http.js.map +1 -1
- package/dist/component/leadAdsValidators.d.ts +1106 -0
- package/dist/component/leadAdsValidators.d.ts.map +1 -0
- package/dist/component/leadAdsValidators.js +311 -0
- package/dist/component/leadAdsValidators.js.map +1 -0
- package/dist/component/leadFormRules.d.ts +60 -0
- package/dist/component/leadFormRules.d.ts.map +1 -0
- package/dist/component/leadFormRules.js +140 -0
- package/dist/component/leadFormRules.js.map +1 -0
- package/dist/component/leadFormStore.d.ts +16 -0
- package/dist/component/leadFormStore.d.ts.map +1 -0
- package/dist/component/leadFormStore.js +92 -0
- package/dist/component/leadFormStore.js.map +1 -0
- package/dist/component/leadgenToken.d.ts +56 -0
- package/dist/component/leadgenToken.d.ts.map +1 -0
- package/dist/component/leadgenToken.js +262 -0
- package/dist/component/leadgenToken.js.map +1 -0
- package/dist/component/leads.d.ts +76 -7
- package/dist/component/leads.d.ts.map +1 -1
- package/dist/component/leads.js +112 -78
- package/dist/component/leads.js.map +1 -1
- package/dist/component/meta.d.ts.map +1 -1
- package/dist/component/meta.js +21 -1
- package/dist/component/meta.js.map +1 -1
- package/dist/component/metaFake.d.ts +44 -0
- package/dist/component/metaFake.d.ts.map +1 -1
- package/dist/component/metaFake.js +400 -1
- package/dist/component/metaFake.js.map +1 -1
- package/dist/component/metaGraph.d.ts +91 -0
- package/dist/component/metaGraph.d.ts.map +1 -1
- package/dist/component/metaGraph.js +217 -0
- package/dist/component/metaGraph.js.map +1 -1
- package/dist/component/metaLeads.d.ts +683 -0
- package/dist/component/metaLeads.d.ts.map +1 -0
- package/dist/component/metaLeads.js +2639 -0
- package/dist/component/metaLeads.js.map +1 -0
- package/dist/component/schema.d.ts +420 -5
- package/dist/component/schema.d.ts.map +1 -1
- package/dist/component/schema.js +176 -1
- package/dist/component/schema.js.map +1 -1
- package/dist/component/validators.d.ts +235 -11
- package/dist/component/validators.d.ts.map +1 -1
- package/dist/component/validators.js +14 -1
- package/dist/component/validators.js.map +1 -1
- package/dist/tracker/generated.d.ts +5 -5
- package/dist/tracker/generated.d.ts.map +1 -1
- package/dist/tracker/generated.js +5 -5
- package/dist/tracker/generated.js.map +1 -1
- package/dist/ui/campaigns/CampaignsView.d.ts +5 -1
- package/dist/ui/campaigns/CampaignsView.d.ts.map +1 -1
- package/dist/ui/campaigns/CampaignsView.js.map +1 -1
- package/dist/ui/campaigns/Drawer.d.ts.map +1 -1
- package/dist/ui/campaigns/Drawer.js +8 -26
- package/dist/ui/campaigns/Drawer.js.map +1 -1
- package/dist/ui/campaigns/labels.d.ts +29 -1
- package/dist/ui/campaigns/labels.d.ts.map +1 -1
- package/dist/ui/campaigns/labels.js +77 -2
- package/dist/ui/campaigns/labels.js.map +1 -1
- package/dist/ui/campaigns/model.js +2 -2
- package/dist/ui/campaigns/model.js.map +1 -1
- package/dist/ui/forms/FirstContact.d.ts +19 -0
- package/dist/ui/forms/FirstContact.d.ts.map +1 -0
- package/dist/ui/forms/FirstContact.js +81 -0
- package/dist/ui/forms/FirstContact.js.map +1 -0
- package/dist/ui/forms/FormLead.d.ts +28 -0
- package/dist/ui/forms/FormLead.d.ts.map +1 -0
- package/dist/ui/forms/FormLead.js +199 -0
- package/dist/ui/forms/FormLead.js.map +1 -0
- package/dist/ui/forms/FormRulesDrawer.d.ts +49 -0
- package/dist/ui/forms/FormRulesDrawer.d.ts.map +1 -0
- package/dist/ui/forms/FormRulesDrawer.js +149 -0
- package/dist/ui/forms/FormRulesDrawer.js.map +1 -0
- package/dist/ui/forms/FormsView.d.ts +10 -0
- package/dist/ui/forms/FormsView.d.ts.map +1 -0
- package/dist/ui/forms/FormsView.js +227 -0
- package/dist/ui/forms/FormsView.js.map +1 -0
- package/dist/ui/forms/Icons.d.ts +46 -0
- package/dist/ui/forms/Icons.d.ts.map +1 -0
- package/dist/ui/forms/Icons.js +45 -0
- package/dist/ui/forms/Icons.js.map +1 -0
- package/dist/ui/forms/RuleRow.d.ts +37 -0
- package/dist/ui/forms/RuleRow.d.ts.map +1 -0
- package/dist/ui/forms/RuleRow.js +80 -0
- package/dist/ui/forms/RuleRow.js.map +1 -0
- package/dist/ui/forms/WhatsAppButtonGuide.d.ts +33 -0
- package/dist/ui/forms/WhatsAppButtonGuide.d.ts.map +1 -0
- package/dist/ui/forms/WhatsAppButtonGuide.js +90 -0
- package/dist/ui/forms/WhatsAppButtonGuide.js.map +1 -0
- package/dist/ui/forms/index.d.ts +11 -0
- package/dist/ui/forms/index.d.ts.map +1 -0
- package/dist/ui/forms/index.js +7 -0
- package/dist/ui/forms/index.js.map +1 -0
- package/dist/ui/forms/journey.d.ts +19 -0
- package/dist/ui/forms/journey.d.ts.map +1 -0
- package/dist/ui/forms/journey.js +54 -0
- package/dist/ui/forms/journey.js.map +1 -0
- package/dist/ui/forms/model.d.ts +243 -0
- package/dist/ui/forms/model.d.ts.map +1 -0
- package/dist/ui/forms/model.js +564 -0
- package/dist/ui/forms/model.js.map +1 -0
- package/dist/ui/forms/sample.d.ts +36 -0
- package/dist/ui/forms/sample.d.ts.map +1 -0
- package/dist/ui/forms/sample.js +448 -0
- package/dist/ui/forms/sample.js.map +1 -0
- package/dist/ui/forms/types.d.ts +472 -0
- package/dist/ui/forms/types.d.ts.map +1 -0
- package/dist/ui/forms/types.js +2 -0
- package/dist/ui/forms/types.js.map +1 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +4 -0
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/integrations/Overlay.d.ts +3 -1
- package/dist/ui/integrations/Overlay.d.ts.map +1 -1
- package/dist/ui/integrations/Overlay.js +2 -2
- package/dist/ui/integrations/Overlay.js.map +1 -1
- package/dist/ui/portfolio/PortfolioView.d.ts +4 -1
- package/dist/ui/portfolio/PortfolioView.d.ts.map +1 -1
- package/dist/ui/portfolio/PortfolioView.js.map +1 -1
- package/dist/ui/sample.d.ts +3 -1
- package/dist/ui/sample.d.ts.map +1 -1
- package/dist/ui/sample.js +2 -0
- package/dist/ui/sample.js.map +1 -1
- package/dist/ui/seed.d.ts +1 -1
- package/dist/ui/ui.css +2305 -0
- package/docs/federation.md +19 -0
- package/docs/meta-ads.md +723 -7
- package/docs/upgrading.md +70 -0
- package/llms.txt +1 -0
- package/package.json +1 -1
- package/src/component/_generated/api.ts +10 -0
- package/src/component/_generated/component.ts +290 -20
- package/src/component/_generated/server.ts +2 -0
- package/src/component/constants.ts +33 -0
- package/src/component/convex.config.ts +7 -0
- package/src/component/errors.ts +3 -1
- package/src/component/http.ts +75 -0
- package/src/component/leadAdsValidators.ts +376 -0
- package/src/component/leadFormRules.ts +202 -0
- package/src/component/leadFormStore.ts +129 -0
- package/src/component/leadgenToken.ts +348 -0
- package/src/component/leads.ts +136 -84
- package/src/component/meta.ts +21 -1
- package/src/component/metaFake.ts +485 -1
- package/src/component/metaGraph.ts +327 -0
- package/src/component/metaLeads.ts +3111 -0
- package/src/component/schema.ts +197 -1
- package/src/component/validators.ts +17 -1
- package/src/tracker/generated.ts +5 -5
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Formulários screens' pure logic: which Page and form says what, where a
|
|
3
|
+
* draft sends the last 30 days' leads, the suggested text and its variable,
|
|
4
|
+
* and the path a form lead followed. Pure, so the views and their tests read
|
|
5
|
+
* the same answers.
|
|
6
|
+
*/
|
|
7
|
+
import type { FirstContact, FirstContactBrakes, FormBoard, FormColumn, FormLeadVia, FormReportRow, FormRule, FormRules, FormRulesChoice, FormRulesDraft, FormRulesSimulation, FormRulesSummary, FormsReport, IntegrationSite, MetaForm, MetaFormQuestion, MetaFormsPage, MetaPage } from "./types.js";
|
|
8
|
+
/** Rules a form holds at most: more than this is a funnel, not a form. */
|
|
9
|
+
export declare const MAX_FORM_RULES = 20;
|
|
10
|
+
/** Answers one rule names at most, as the host's `setFormRules` takes. */
|
|
11
|
+
export declare const MAX_RULE_ANSWERS = 30;
|
|
12
|
+
/** The text a discard reason fits in, on the card. */
|
|
13
|
+
export declare const MAX_DISCARD_REASON = 80;
|
|
14
|
+
/** The suggested first message's length. */
|
|
15
|
+
export declare const MAX_FIRST_CONTACT_TEXT = 500;
|
|
16
|
+
/** The first name's variable in the suggested text. */
|
|
17
|
+
export declare const FIRST_NAME_VARIABLE = "{primeiro_nome}";
|
|
18
|
+
/** The brakes the automatic send starts with (the design's D7). */
|
|
19
|
+
export declare const DEFAULT_BRAKES: FirstContactBrakes;
|
|
20
|
+
/** Waiting for the lead to write first never goes under this. */
|
|
21
|
+
export declare const MIN_WAIT_MINUTES = 15;
|
|
22
|
+
export declare const WAIT_CHOICES: readonly [15, 30, 60, 120];
|
|
23
|
+
export declare const PER_HOUR_CHOICES: readonly [5, 10, 20, 30];
|
|
24
|
+
/**
|
|
25
|
+
* The pause between two automatic sends: fixed by the host, shown so the
|
|
26
|
+
* company knows it is there (the contract's brakes have no field for it).
|
|
27
|
+
*/
|
|
28
|
+
export declare const RANDOM_INTERVAL_LABEL = "entre 45 s e 3 min";
|
|
29
|
+
/** "9:02", "14:51", in Brasília time like the rest of the screens. */
|
|
30
|
+
export declare const clockLabel: (at: number) => string;
|
|
31
|
+
/** "hoje, 14:51", "ontem, 19:10", "12/09". */
|
|
32
|
+
export declare function dayLabel(at: number, now: number, { time }?: {
|
|
33
|
+
time?: boolean | undefined;
|
|
34
|
+
}): string;
|
|
35
|
+
/** The form's newest lead: "último há 4 min", "hoje, 9:02", "12/09". */
|
|
36
|
+
export declare function lastLeadLabel(at: number | null | undefined, now: number): string | null;
|
|
37
|
+
/** "há 3 min", "há 1 h", "há 2 d"; "agora" under a minute. */
|
|
38
|
+
export declare function waitLabel(since: number, now: number): string;
|
|
39
|
+
/** "1 regra", "3 regras". */
|
|
40
|
+
export declare const plural: (count: number, one: string, many: string) => string;
|
|
41
|
+
/** The questions a rule can read: the ones with options to choose from. */
|
|
42
|
+
export declare const choiceQuestions: (form: Pick<MetaForm, "questions">) => MetaFormQuestion[];
|
|
43
|
+
/** "Ativo", "Arquivado na Meta"; an unknown status stays raw. */
|
|
44
|
+
export declare const formStatusLabel: (status: string) => string;
|
|
45
|
+
export declare const isArchived: (form: Pick<MetaForm, "status">) => boolean;
|
|
46
|
+
/** A board column by key. */
|
|
47
|
+
export declare const columnOf: (board: FormBoard | undefined, key: string | null) => FormColumn | undefined;
|
|
48
|
+
/** The columns a rule or the entry can pick: all but the discard column. */
|
|
49
|
+
export declare const pickableColumns: (board: FormBoard | undefined) => FormColumn[];
|
|
50
|
+
/** The neutral dot for a column without color, and the discard's. */
|
|
51
|
+
export declare const NO_COLOR = "var(--rastro-muted-fg)";
|
|
52
|
+
export declare const DISCARD_COLOR = "var(--rastro-forms-discard)";
|
|
53
|
+
/**
|
|
54
|
+
* Where a lead goes when no rule matches: the form's entry column, or the
|
|
55
|
+
* board's own door. `door` says it is the board's porta de entrada.
|
|
56
|
+
*/
|
|
57
|
+
export declare function entryOf(board: FormBoard | undefined, entryColumn: string | null): {
|
|
58
|
+
key: string | null;
|
|
59
|
+
name: string;
|
|
60
|
+
color: string;
|
|
61
|
+
door: boolean;
|
|
62
|
+
};
|
|
63
|
+
/** The discard as the board names it: "Descartado" by default. */
|
|
64
|
+
export declare function discardOf(board: FormBoard | undefined): {
|
|
65
|
+
name: string;
|
|
66
|
+
color: string;
|
|
67
|
+
};
|
|
68
|
+
/** A form's state on the list. */
|
|
69
|
+
export type FormState = "active" | "new" | "archived";
|
|
70
|
+
/**
|
|
71
|
+
* What the list shows of a form's rules: the full rules when read (the open
|
|
72
|
+
* drawer's), else the summary `metaForms` carries; undefined while loading,
|
|
73
|
+
* null when unreadable.
|
|
74
|
+
*/
|
|
75
|
+
export declare function rulesSummaryOf(form: Pick<MetaForm, "rules">, rules: FormRules | null | undefined): FormRulesSummary | null | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* `new` only when the host says the form was never configured; rules still
|
|
78
|
+
* loading (undefined) or unreadable (null) are not read as "no rules".
|
|
79
|
+
*/
|
|
80
|
+
export declare function formState(form: MetaForm, rules: Pick<FormRulesSummary, "configured"> | null | undefined): FormState;
|
|
81
|
+
/**
|
|
82
|
+
* The end screen's WhatsApp button: `on` when Meta shows it, `off` when Meta
|
|
83
|
+
* shows it missing, `confirmed` when Meta does not say and the company said
|
|
84
|
+
* it is there ("Já liguei", `whatsappButtonConfirmed`), `unknown` otherwise.
|
|
85
|
+
*/
|
|
86
|
+
export type ButtonState = "on" | "off" | "confirmed" | "unknown";
|
|
87
|
+
export declare function buttonState(form: Pick<MetaForm, "whatsappButton">, confirmed: boolean | null | undefined): ButtonState;
|
|
88
|
+
/**
|
|
89
|
+
* The host's `metaForms` (a site's Pages, each with its forms) as the flat
|
|
90
|
+
* rows the screens read: the Page's id on each form, `createdTime` as
|
|
91
|
+
* `createdAt`. Concatenate the sites' answers before passing them.
|
|
92
|
+
*/
|
|
93
|
+
export declare function metaFormsRows(pages: readonly MetaFormsPage[] | undefined): MetaForm[] | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* A Page's `lastError` as its code: `META_TOKEN_INVALID`, `HANDLER_MISSING`…
|
|
96
|
+
* The component writes the code alone, or the code and a note after a colon
|
|
97
|
+
* (older hosts); either reads the same.
|
|
98
|
+
*/
|
|
99
|
+
export declare function pageErrorCode(lastError: string | null | undefined): string | null;
|
|
100
|
+
/**
|
|
101
|
+
* What a linked Page's status asks of the reader: `reconnect` (only Meta's
|
|
102
|
+
* token or permission refusals: reconnecting fixes them), `host` (the host's
|
|
103
|
+
* own setup holds the leads back, such as its missing form lead handler) or
|
|
104
|
+
* `delay` (Meta is slow or busy; the reconciliation catches up alone).
|
|
105
|
+
*/
|
|
106
|
+
export type PageIssueKind = "reconnect" | "host" | "delay";
|
|
107
|
+
export interface PageIssue {
|
|
108
|
+
kind: PageIssueKind;
|
|
109
|
+
code: string;
|
|
110
|
+
text: string;
|
|
111
|
+
}
|
|
112
|
+
/** Whether the dashboard forwards none of the linked Pages' leads at once. */
|
|
113
|
+
export declare function routeDelayed(pages: readonly MetaPage[]): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* The note a linked Page shows under its name, or null when all is well. A
|
|
116
|
+
* host that says its handler is not ready reads as `HANDLER_MISSING` even
|
|
117
|
+
* before the first reconciliation writes it. The host's own codes come
|
|
118
|
+
* first; a Page whose leads the dashboard cannot forward at once
|
|
119
|
+
* (`routeIssue`) reads as a delay.
|
|
120
|
+
*/
|
|
121
|
+
export declare function pageIssue(page: Pick<MetaPage, "lastError" | "handlerReady" | "routeIssue">, productName?: string): PageIssue | null;
|
|
122
|
+
/**
|
|
123
|
+
* The connection's Pages with what the host's `metaForms` says of each linked
|
|
124
|
+
* one: `handlerReady`, and its `lastError` when the Pages read has none. A
|
|
125
|
+
* Pages read that already carries both keeps its own. A Page another owner
|
|
126
|
+
* linked takes no `lastError` from `metaForms`: its link and token are that
|
|
127
|
+
* owner's, and reconnecting this one's Meta fixes nothing (the Pages read
|
|
128
|
+
* hides it for the same reason).
|
|
129
|
+
*/
|
|
130
|
+
export declare function pagesWithStatus(pages: readonly MetaPage[] | undefined, formsPages: readonly MetaFormsPage[] | undefined): MetaPage[] | undefined;
|
|
131
|
+
/** One form on the list, with what its row says. */
|
|
132
|
+
export interface FormRow {
|
|
133
|
+
form: MetaForm;
|
|
134
|
+
report: FormReportRow | null;
|
|
135
|
+
/** The full rules, when read (the open drawer's). */
|
|
136
|
+
rules: FormRules | null | undefined;
|
|
137
|
+
/** What the list shows: the full rules' or `metaForms`' summary. */
|
|
138
|
+
summary: FormRulesSummary | null | undefined;
|
|
139
|
+
state: FormState;
|
|
140
|
+
isNew: boolean;
|
|
141
|
+
button: ButtonState;
|
|
142
|
+
}
|
|
143
|
+
/** A Page and its forms, for the site it feeds. */
|
|
144
|
+
export interface PageGroup {
|
|
145
|
+
page: MetaPage;
|
|
146
|
+
/** The visible site the Page feeds, or null. */
|
|
147
|
+
site: IntegrationSite | null;
|
|
148
|
+
/** The Page feeds a site the reader cannot see. */
|
|
149
|
+
elsewhere: boolean;
|
|
150
|
+
rows: FormRow[];
|
|
151
|
+
}
|
|
152
|
+
/** The key `formsReport` rows are unique by: the site and the form. */
|
|
153
|
+
export declare const reportKey: (siteId: string, formId: string) => string;
|
|
154
|
+
/** A form's row in the report, for the site its Page feeds. */
|
|
155
|
+
export declare function reportRowOf(report: FormsReport | undefined, siteId: string | null | undefined, formId: string): FormReportRow | null;
|
|
156
|
+
/**
|
|
157
|
+
* Pages in the order Meta lists them, the readable ones first, each with its
|
|
158
|
+
* forms: active ones by leads, then archived ones.
|
|
159
|
+
*/
|
|
160
|
+
export declare function pageGroups({ sites, pages, forms, report, rules, now, }: {
|
|
161
|
+
sites: readonly IntegrationSite[];
|
|
162
|
+
pages: readonly MetaPage[];
|
|
163
|
+
forms: readonly MetaForm[];
|
|
164
|
+
report?: FormsReport | undefined;
|
|
165
|
+
rules?: Record<string, FormRules | null | undefined> | undefined;
|
|
166
|
+
now: number;
|
|
167
|
+
}): PageGroup[];
|
|
168
|
+
/** A form's leads in 30 days: the report's count, or the host's own. */
|
|
169
|
+
export declare const formLeads: (row: Pick<FormRow, "form" | "report">) => number;
|
|
170
|
+
/**
|
|
171
|
+
* "30 dias: 86 leads · 14 descartados", with the newest lead and how it came
|
|
172
|
+
* in (null when its host does not say).
|
|
173
|
+
*/
|
|
174
|
+
export declare function formsSummary(report: FormsReport | undefined, forms?: readonly Pick<MetaForm, "lastLeadAt" | "lastLeadVia">[]): {
|
|
175
|
+
leads: number;
|
|
176
|
+
discarded: number;
|
|
177
|
+
lastLeadAt: number | null;
|
|
178
|
+
lastLeadVia: FormLeadVia | null;
|
|
179
|
+
partial: boolean;
|
|
180
|
+
} | null;
|
|
181
|
+
/** A slice of the simulation bar. */
|
|
182
|
+
export interface SimulationSegment {
|
|
183
|
+
key: string;
|
|
184
|
+
label: string;
|
|
185
|
+
color: string;
|
|
186
|
+
count: number;
|
|
187
|
+
discard: boolean;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* The simulation as the bar draws it: the entry first, then the columns the
|
|
191
|
+
* rules send to (in rule order), the other columns in board order, then the
|
|
192
|
+
* discard (every reason together); empty ones left out.
|
|
193
|
+
*/
|
|
194
|
+
export declare function simulationSegments(simulation: FormRulesSimulation, board: FormBoard | undefined, entryColumn: string | null, rules?: readonly FormRule[]): SimulationSegment[];
|
|
195
|
+
/** The suggested first message for a form that has none yet. */
|
|
196
|
+
export declare function defaultFirstContactText(siteName: string, formName: string): string;
|
|
197
|
+
/** The text in pieces: plain runs and the first name's variable. */
|
|
198
|
+
export declare function templateParts(text: string): {
|
|
199
|
+
kind: "text" | "first_name";
|
|
200
|
+
text: string;
|
|
201
|
+
}[];
|
|
202
|
+
/** The text a lead receives: the variable filled with the first name. */
|
|
203
|
+
export declare const fillTemplate: (text: string, firstName: string) => string;
|
|
204
|
+
/** A rule in the drawer: the stored one plus what the screen tracks. */
|
|
205
|
+
export interface DraftRule extends FormRule {
|
|
206
|
+
/** Stable while the list reorders. */
|
|
207
|
+
id: string;
|
|
208
|
+
/** The stored rule's count, kept until the rule changes. */
|
|
209
|
+
monthCount: number | null;
|
|
210
|
+
/** Added in this edit: "nova" instead of a count. */
|
|
211
|
+
fresh: boolean;
|
|
212
|
+
}
|
|
213
|
+
export interface Draft {
|
|
214
|
+
entryColumn: string | null;
|
|
215
|
+
rules: DraftRule[];
|
|
216
|
+
firstContact: FirstContact;
|
|
217
|
+
/** "Já liguei": the company set the end screen's button by hand. */
|
|
218
|
+
whatsappButtonConfirmed: boolean;
|
|
219
|
+
}
|
|
220
|
+
export declare const nextRuleId: () => string;
|
|
221
|
+
/** The drawer's starting point: the stored rules, or a fresh form's. */
|
|
222
|
+
export declare function draftOf(rules: FormRules | null | undefined, form: MetaForm, site: Pick<IntegrationSite, "name">): Draft;
|
|
223
|
+
/** What `setFormRules` takes from a draft. */
|
|
224
|
+
export declare function choiceOf(draft: Draft): FormRulesChoice;
|
|
225
|
+
/**
|
|
226
|
+
* What the simulation reads from a draft: the entry and the complete rules
|
|
227
|
+
* (a rule still being written decides nothing yet). The first contact stays
|
|
228
|
+
* out, so editing its text never asks for another 30-day scan.
|
|
229
|
+
*/
|
|
230
|
+
export declare function simulationDraftOf(draft: Pick<Draft, "entryColumn" | "rules">, questions: readonly MetaFormQuestion[], board: FormBoard | undefined): FormRulesDraft;
|
|
231
|
+
/** Why a rule cannot be saved yet, in pt-BR; null when it can. */
|
|
232
|
+
export declare function ruleProblem(rule: FormRule, questions: readonly MetaFormQuestion[], board: FormBoard | undefined): string | null;
|
|
233
|
+
/** Whether the draft can go to `setFormRules`. */
|
|
234
|
+
export declare function draftProblem(draft: Draft, form: MetaForm, board: FormBoard | undefined): string | null;
|
|
235
|
+
/** The option labels a rule picked, in the question's order. */
|
|
236
|
+
export declare function answerLabels(question: MetaFormQuestion | undefined, answers: readonly string[]): string[];
|
|
237
|
+
/** Meta's page for the Page's forms (Meta Business Suite's forms library). */
|
|
238
|
+
export declare const metaFormsUrl: (form: Pick<MetaForm, "pageId">) => string;
|
|
239
|
+
/** The column a lead's decision names, for a card or a path. */
|
|
240
|
+
export declare function columnName(board: FormBoard | undefined, key: string): string;
|
|
241
|
+
/** A column's color, or the neutral dot. */
|
|
242
|
+
export declare const colorOf: (column: FormColumn | undefined) => string;
|
|
243
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/ui/forms/model.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,UAAU,EACV,WAAW,EACX,aAAa,EACb,QAAQ,EACR,SAAS,EACT,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,QAAQ,EACT,MAAM,YAAY,CAAC;AAOpB,0EAA0E;AAC1E,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,0EAA0E;AAC1E,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,sDAAsD;AACtD,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,4CAA4C;AAC5C,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAI1C,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAErD,mEAAmE;AACnE,eAAO,MAAM,cAAc,EAAE,kBAI5B,CAAC;AACF,iEAAiE;AACjE,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,YAAY,YAAI,EAAE,EAAE,EA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