@fayz-ai/plugin-crm 0.35.1 → 0.36.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.
- package/dist/{CrmPage-Z5OYCBKA.js → CrmPage-T2HQ67N2.js} +92 -127
- package/dist/CrmPage-T2HQ67N2.js.map +1 -0
- package/dist/SegmentsView-52KIU7NZ.js +489 -0
- package/dist/SegmentsView-52KIU7NZ.js.map +1 -0
- package/dist/chunk-EHGAPCZF.js +264 -0
- package/dist/chunk-EHGAPCZF.js.map +1 -0
- package/dist/{chunk-LDBCC67C.js → chunk-J6LYFSFJ.js} +24 -130
- package/dist/chunk-J6LYFSFJ.js.map +1 -0
- package/dist/chunk-VFLS65NL.js +51 -0
- package/dist/chunk-VFLS65NL.js.map +1 -0
- package/dist/components/SegmentEditorDialog.d.ts.map +1 -1
- package/dist/data/mock.d.ts.map +1 -1
- package/dist/data/supabase.d.ts.map +1 -1
- package/dist/data/types.d.ts +5 -1
- package/dist/data/types.d.ts.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +154 -20
- package/dist/index.js.map +1 -1
- package/dist/lib/segments.d.ts +13 -6
- package/dist/lib/segments.d.ts.map +1 -1
- package/dist/locales/en.d.ts.map +1 -1
- package/dist/locales/pt-BR.d.ts.map +1 -1
- package/dist/migrations/index.d.ts +2 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/main.browser.js +3 -1
- package/dist/migrations/main.browser.js.map +1 -1
- package/dist/migrations/main.js +390 -2
- package/dist/migrations/main.js.map +1 -1
- package/dist/types.d.ts +20 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/views/DealListView.d.ts.map +1 -1
- package/dist/views/SegmentsView.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/CrmPage-Z5OYCBKA.js.map +0 -1
- package/dist/SegmentsView-PHLN2MOW.js +0 -385
- package/dist/SegmentsView-PHLN2MOW.js.map +0 -1
- package/dist/chunk-LDBCC67C.js.map +0 -1
- package/dist/chunk-QJOLAGGN.js +0 -129
- package/dist/chunk-QJOLAGGN.js.map +0 -1
package/dist/lib/segments.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
import type { Segment, SegmentFieldDef, SegmentRule, SegmentRuleOp } from '../types';
|
|
1
|
+
import type { Segment, SegmentAudience, SegmentFieldDef, SegmentRule, SegmentRuleOp, SegmentRules } from '../types';
|
|
2
2
|
export declare const SEGMENT_FIELDS: SegmentFieldDef[];
|
|
3
3
|
/** A leitura de engajamento — pessoa + quando comprou e quando falaram com ela. */
|
|
4
4
|
export declare const ENGAGEMENT_VIEW = "v_crm_people_engagement";
|
|
5
|
+
/** One row per deal (migration 064): what sales actually segments by — the
|
|
6
|
+
* funnel stage, the unit, the deal's tags, its owner. */
|
|
7
|
+
export declare const DEAL_VIEW = "v_crm_deal_audience";
|
|
8
|
+
export declare const DEAL_SEGMENT_FIELDS: SegmentFieldDef[];
|
|
9
|
+
/** The fields a segment about `audience` can ask about. */
|
|
10
|
+
export declare function fieldsFor(audience: SegmentAudience): SegmentFieldDef[];
|
|
11
|
+
/** Every clause of every group, for the checks that do not care which group. */
|
|
12
|
+
export declare function allClauses(rules: SegmentRules | undefined): SegmentRule[];
|
|
13
|
+
export declare function audienceOf(segment: Pick<Segment, 'sourceView'> | null | undefined): SegmentAudience;
|
|
5
14
|
/**
|
|
6
15
|
* Sobre qual leitura este recorte tem de rodar.
|
|
7
16
|
*
|
|
@@ -13,10 +22,8 @@ export declare const ENGAGEMENT_VIEW = "v_crm_people_engagement";
|
|
|
13
22
|
* A leitura de engajamento é SUPERSET de `people`, então subir para ela nunca
|
|
14
23
|
* invalida as outras cláusulas do mesmo segmento.
|
|
15
24
|
*/
|
|
16
|
-
export declare function resolveSourceView(rules:
|
|
17
|
-
|
|
18
|
-
} | undefined): string;
|
|
19
|
-
export declare function segmentFieldFor(column: string): SegmentFieldDef | undefined;
|
|
25
|
+
export declare function resolveSourceView(rules: SegmentRules | undefined, audience?: SegmentAudience): string;
|
|
26
|
+
export declare function segmentFieldFor(column: string, audience?: SegmentAudience): SegmentFieldDef | undefined;
|
|
20
27
|
/** Operadores que não levam valor. A tela esconde o campo, e o banco não o lê. */
|
|
21
28
|
export declare const VALUELESS_OPS: SegmentRuleOp[];
|
|
22
29
|
/** Operadores cujo valor é um NÚMERO DE DIAS, não uma data. É a diferença
|
|
@@ -29,7 +36,7 @@ export declare const DAY_OPS: SegmentRuleOp[];
|
|
|
29
36
|
* segmento que ninguém confere. Quem olha a lista tem de conseguir ver que
|
|
30
37
|
* "Parados há 90 dias" pergunta por `updated_at`, e não por data de compra.
|
|
31
38
|
*/
|
|
32
|
-
export declare function describeRule(rule: SegmentRule, t: (k: string, p?: Record<string, string>) => string): string;
|
|
39
|
+
export declare function describeRule(rule: SegmentRule, t: (k: string, p?: Record<string, string>) => string, audience?: SegmentAudience): string;
|
|
33
40
|
export interface SegmentEvalRow {
|
|
34
41
|
id: string;
|
|
35
42
|
kind?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segments.d.ts","sourceRoot":"","sources":["../../src/lib/segments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"segments.d.ts","sourceRoot":"","sources":["../../src/lib/segments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAenH,eAAO,MAAM,cAAc,EAAE,eAAe,EAsB3C,CAAA;AAED,mFAAmF;AACnF,eAAO,MAAM,eAAe,4BAA4B,CAAA;AAExD;0DAC0D;AAC1D,eAAO,MAAM,SAAS,wBAAwB,CAAA;AAE9C,eAAO,MAAM,mBAAmB,EAAE,eAAe,EA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,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACrB;AA4DD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,KAAK,SAAa,GAAG,MAAM,EAAE,CAUtG"}
|
package/dist/locales/en.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/locales/en.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/locales/en.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAuiCrC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pt-BR.d.ts","sourceRoot":"","sources":["../../src/locales/pt-BR.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"pt-BR.d.ts","sourceRoot":"","sources":["../../src/locales/pt-BR.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAuiCvC,CAAA"}
|
|
@@ -61,6 +61,8 @@ export declare const MIGRATION_060_O_FUNIL_SABE_DE_QUEM_ELE_E = "-- ------------
|
|
|
61
61
|
export declare const MIGRATION_061_A_CONVERSAO_RESPEITA_O_FILTRO_DO_QUADRO = "-- 061 \u2014 The conversion chart answers the question the filter asked.\n--\n-- \u2500\u2500 The bug \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n--\n-- Board, List and Conversion are three modes of one screen, and the board's\n-- filters are persisted (`crm.board.owner`, `crm.board.period`, the tag chips).\n-- The board is honest: `getDealsByStage` asks the database once per stage with\n-- `count: 'exact'` and every predicate applied, so its column numbers shrink\n-- with the filter.\n--\n-- `crm_funnel(p_pipeline_id uuid)` takes ONE argument. It never saw a filter.\n-- So: filter the board, switch to Conversion, and the chart counts the whole\n-- funnel while the filter bar above it still says otherwise. Switch back and\n-- the numbers are right again. That is why it was reported as real and could\n-- not be reproduced on demand \u2014 through the board's SEARCH box it never fails\n-- (the header count has a special case for it), and through the filter menu it\n-- fails every time, but only after changing mode.\n--\n-- \u2500\u2500 Why an overload and not a wider signature \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n--\n-- Replacing `crm_funnel(uuid)` with a wider one is not replay-safe: the chain\n-- is replayed, 034 creates the 1-arg version, and a later DROP/CREATE of a\n-- different signature leaves two functions anyway. So the 1-arg stays exactly\n-- as 034 left it \u2014 untouched, still correct for a caller with no filter \u2014 and\n-- the filtered read is a second, 2-arg function. No DEFAULT on the new one:\n-- `crm_funnel(uuid)` and `crm_funnel(uuid, jsonb DEFAULT \u2026)` would be ambiguous\n-- for a one-argument call and Postgres would refuse to choose.\n--\n-- \u2500\u2500 The filter is jsonb on purpose \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n--\n-- `BoardFilter` has grown twice already (tags, then search+searchTags, then the\n-- period, then the owner). A positional signature would need a migration each\n-- time and would break every caller on the way. A bag costs one cast per key\n-- and the shape stays the board's to decide.\n\nCREATE OR REPLACE FUNCTION public.crm_funnel(p_pipeline_id uuid, p_filter jsonb)\nRETURNS TABLE(stage_id uuid, deals bigint, total_value numeric)\nLANGUAGE plpgsql\nSTABLE\nSECURITY DEFINER\nSET search_path TO ''\nAS $function$\ndeclare\n v_tenant uuid := app.current_tenant_id();\n v_foco uuid := nullif(app.current_unit_id(), '00000000-0000-0000-0000-000000000000'::uuid);\n v_negado boolean := app.current_unit_id() = '00000000-0000-0000-0000-000000000000'::uuid;\n v_unidades uuid[];\n v_sem_unidade boolean;\n v_dono boolean;\n v_uid uuid := auth.uid();\n -- O recorte, lido do saco. Tudo opcional: um `{}` devolve o mesmo que a\n -- fun\u00E7\u00E3o de um argumento.\n v_tags text[] := case when p_filter ? 'tags'\n then array(select jsonb_array_elements_text(p_filter->'tags')) end;\n v_busca text := nullif(trim(coalesce(p_filter->>'search', '')), '');\n v_busca_tags text[] := case when p_filter ? 'searchTags'\n then array(select jsonb_array_elements_text(p_filter->'searchTags')) end;\n v_de timestamptz := nullif(p_filter->>'createdFrom', '')::timestamptz;\n v_ate timestamptz := nullif(p_filter->>'createdTo', '')::timestamptz;\n v_dono_f text := nullif(p_filter->>'assignedToId', '');\nbegin\n if v_tenant is null or v_negado then\n return;\n end if;\n\n select coalesce(array_agg(a.unit_id), '{}'::uuid[])\n into v_unidades\n from app.user_unit_access a\n where a.tenant_id = v_tenant\n and a.user_id = v_uid\n and (v_foco is null or a.unit_id = v_foco)\n and app.has_permission('crm.pipeline.read', a.unit_id);\n\n v_sem_unidade := app.has_permission('crm.pipeline.read', null::uuid);\n v_dono := app.owner_scoped('crm.deal');\n\n return query\n -- A TABELA para a cerca, a VISTA para o texto.\n --\n -- `v_deals` n\u00E3o exp\u00F5e `unit_id` nem `owner_id` \u2014 s\u00E3o exatamente as duas\n -- colunas de que a permiss\u00E3o depende, e ler a permiss\u00E3o de uma linha que n\u00E3o\n -- as tem seria escrever uma cerca que n\u00E3o fecha. Ent\u00E3o a base continua sendo\n -- `plg_crm_deals`, como na 034, e a vista entra s\u00F3 para dar ao termo de busca\n -- as mesmas colunas que a coluna do quadro procura.\n select d.stage_id, count(*), coalesce(sum(d.value), 0)\n from public.plg_crm_deals d\n join public.v_deals v on v.id = d.id\n where d.tenant_id = v_tenant\n and d.pipeline_id = p_pipeline_id\n and d.status = 'open'\n and ( (d.unit_id is null and v_sem_unidade)\n or (d.unit_id = any (v_unidades)))\n and (not v_dono or d.owner_id is null or d.owner_id = v_uid)\n -- Os MESMOS predicados que `getDealsByStage` aplica, para que a coluna e\n -- o gr\u00E1fico n\u00E3o possam divergir por um detalhe.\n and (v_tags is null or d.tags && v_tags)\n and (v_de is null or d.created_at >= v_de)\n and (v_ate is null or d.created_at <= v_ate)\n and (v_dono_f is null\n or (v_dono_f = 'none' and d.assigned_to_id is null)\n or (v_dono_f <> 'none' and d.assigned_to_id = v_dono_f::uuid))\n -- A busca \u00E9 um OU entre as colunas do quadro e as etiquetas resolvidas no\n -- cliente \u2014 alternativa ao texto, n\u00E3o afunilamento dele.\n and (v_busca is null\n or v.title ilike '%' || v_busca || '%'\n or v.contact_name ilike '%' || v_busca || '%'\n or v.company_name ilike '%' || v_busca || '%'\n or v.notes ilike '%' || v_busca || '%'\n or v.lost_reason ilike '%' || v_busca || '%'\n or v.stage_name ilike '%' || v_busca || '%'\n or v.contact_status_name ilike '%' || v_busca || '%'\n or (v_busca_tags is not null and d.tags && v_busca_tags))\n group by d.stage_id;\nend\n$function$;\n\nREVOKE ALL ON FUNCTION public.crm_funnel(uuid, jsonb) FROM public;\nGRANT EXECUTE ON FUNCTION public.crm_funnel(uuid, jsonb) TO authenticated;\nGRANT EXECUTE ON FUNCTION public.crm_funnel(uuid, jsonb) TO service_role;\n";
|
|
62
62
|
export declare const MIGRATION_062_THE_WHOLE_CRM_SAYS_WHICH_UNIT_IT_IS = "-- ---------------------------------------------------------------------------\n-- 062_the_whole_crm_says_which_unit_it_is.sql\n--\n-- The CRM was the last module blind to units. Two brands selling out of one\n-- tenant shared a single board: 335 cards of one brand on the screen of\n-- whoever runs the other, with no way to say \"only mine\".\n--\n-- Most of the fence already existed and nobody had noticed: `plg_crm_deals.\n-- unit_id` and `people.unit_id` have carried a restrictive policy since 052 and\n-- the spine's 042, and `app.has_unit` narrows to `app.current_unit_id()`. Three\n-- things were missing, and each one hid the other two:\n--\n-- 1. the COLUMN on the two tables that lacked it \u2014 company and activity;\n-- 2. the column reaching the VIEWS, which is where the screens read: none of\n-- them returned `unit_id`, so the client had nothing to narrow by;\n-- 3. the row in `scoped_resources`, which is how the visibility screen and\n-- the generic CRUD learn that these rows carry a unit.\n--\n-- Activity stays OUT of `scoped_resources`, same call as 055: that registry\n-- serves the resource the visibility screen offers and wants `owner_id`. An\n-- activity has `created_by` \u2014 who logged it, not who owns it \u2014 and inherits its\n-- unit from the deal or lead it reports. Its fence is the policy below.\n--\n-- A company is born shared (`unit_id` null = the whole house) and every existing\n-- one stays that way. Deliberate, and the opposite of the unit's usual\n-- deny-by-default: the same restaurant chain is a customer of both brands, and\n-- pinning it to one branch would hide a book of business from the people\n-- working it.\n--\n-- Idempotent and replay-safe. Views grow by CREATE OR REPLACE with the new\n-- column LAST, which is what spares the CASCADE and recreating\n-- `plg_crm_rep_deals` by hand.\n-- ---------------------------------------------------------------------------\n\n-- \u2500\u2500 the column \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nALTER TABLE public.plg_crm_companies ADD COLUMN IF NOT EXISTS unit_id uuid;\nALTER TABLE public.plg_crm_activities ADD COLUMN IF NOT EXISTS unit_id uuid;\n\n-- SET NULL, not CASCADE: closing a branch must not delete its book of business\n-- or 551 logged calls. The row going back to shared is the acceptable worst\n-- case; losing the history is not.\nALTER TABLE public.plg_crm_companies DROP CONSTRAINT IF EXISTS plg_crm_companies_unit_fk;\nALTER TABLE public.plg_crm_companies\n ADD CONSTRAINT plg_crm_companies_unit_fk\n FOREIGN KEY (tenant_id, unit_id) REFERENCES app.units(tenant_id, id) ON DELETE SET NULL;\n\nALTER TABLE public.plg_crm_activities DROP CONSTRAINT IF EXISTS plg_crm_activities_unit_fk;\nALTER TABLE public.plg_crm_activities\n ADD CONSTRAINT plg_crm_activities_unit_fk\n FOREIGN KEY (tenant_id, unit_id) REFERENCES app.units(tenant_id, id) ON DELETE SET NULL;\n\n-- (tenant, unit) in the order the query asks: the policy filters the tenant\n-- first, and that prefix is what keeps the predicate out of a row-by-row loop.\nCREATE INDEX IF NOT EXISTS plg_crm_companies_unit_idx\n ON public.plg_crm_companies (tenant_id, unit_id);\nCREATE INDEX IF NOT EXISTS plg_crm_activities_unit_idx\n ON public.plg_crm_activities (tenant_id, unit_id);\n\n-- \u2500\u2500 the activity inherits the unit of what it reports \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n--\n-- A loose activity (no deal, no lead) stays null: inventing its branch would\n-- hide somebody's phone call on a guess.\nUPDATE public.plg_crm_activities a\n SET unit_id = d.unit_id\n FROM public.plg_crm_deals d\n WHERE a.unit_id IS NULL AND a.deal_id = d.id AND d.unit_id IS NOT NULL;\n\nUPDATE public.plg_crm_activities a\n SET unit_id = p.unit_id\n FROM public.people p\n WHERE a.unit_id IS NULL AND a.deal_id IS NULL\n AND a.lead_id = p.id AND p.unit_id IS NOT NULL;\n\n-- \u2500\u2500 the fence \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n--\n-- Same shape as the deal's policy (052): null passes, a unit asks\n-- `app.has_unit`. Additive \u2014 no row that was readable stops being readable.\n--\n-- The verb does not change here. Company stays on `sales.read`, activity stays\n-- on the tenant cut 012 wrote: widening permission and unit in one migration\n-- would be two changes with one test.\n\nDROP POLICY IF EXISTS plg_crm_companies_authz_select ON public.plg_crm_companies;\nCREATE POLICY plg_crm_companies_authz_select ON public.plg_crm_companies\n FOR SELECT TO authenticated USING (\n tenant_id = (SELECT app.current_tenant_id())\n AND (unit_id IS NULL OR (SELECT app.has_unit(plg_crm_companies.unit_id)))\n AND (SELECT app.has_permission('sales.read', NULL::uuid)));\n\nDROP POLICY IF EXISTS plg_crm_activities_select ON public.plg_crm_activities;\nCREATE POLICY plg_crm_activities_select ON public.plg_crm_activities\n FOR SELECT TO authenticated USING (\n tenant_id IN (SELECT user_tenant_ids())\n AND (unit_id IS NULL OR (SELECT app.has_unit(plg_crm_activities.unit_id))));\n\n-- \u2500\u2500 the column reaches the view \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n--\n-- Columns below are what 058 (v_deals), 054 (v_crm_leads) and 059\n-- (v_crm_companies_enriched) left, in the same order, plus `unit_id`.\n\nCREATE OR REPLACE VIEW public.v_deals WITH (security_invoker = true) AS\n SELECT d.id,\n d.tenant_id,\n d.status,\n d.value,\n COALESCE(d.title, d.notes) AS title,\n d.contact_id,\n d.assigned_to_id,\n d.tags,\n COALESCE(pc.name, d.metadata ->> 'contactName'::text) AS contact_name,\n d.created_at,\n d.updated_at,\n d.pipeline_id,\n d.stage_id,\n d.probability,\n d.expected_close_date,\n d.lead_id,\n d.lost_reason,\n ps.name AS stage_name,\n ps.color AS stage_color,\n ps.\"order\" AS stage_order,\n ps.name AS stage,\n d.won_at,\n d.lost_at,\n d.company_id,\n d.contact_status,\n d.contact_status_at,\n cs.name AS contact_status_name,\n cs.color AS contact_status_color,\n d.notes,\n cs.derived_from AS contact_status_derived_from,\n emp.name AS company_name,\n emp.document_number AS company_document,\n grp.group_id,\n grp.group_name,\n grp.group_companies,\n -- On the table since 052 and never here, so the board had no way to narrow\n -- without a second query per card.\n d.unit_id\n FROM plg_crm_deals d\n LEFT JOIN plg_crm_companies emp ON emp.id = d.company_id\n LEFT JOIN people pc ON pc.id = d.contact_id\n LEFT JOIN plg_crm_pipeline_stages ps ON ps.id = d.stage_id\n LEFT JOIN LATERAL ( SELECT s.name,\n s.color,\n s.derived_from\n FROM plg_crm_deal_statuses s\n WHERE s.tenant_id = d.tenant_id AND s.key = d.contact_status AND (s.stage_id IS NULL OR s.stage_id = d.stage_id)\n ORDER BY (s.stage_id IS NOT NULL) DESC\n LIMIT 1) cs ON true\n LEFT JOIN LATERAL ( SELECT g.id AS group_id,\n g.name AS group_name,\n ( SELECT count(*)::integer AS count\n FROM plg_crm_company_group_members m2\n WHERE m2.group_id = g.id) AS group_companies\n FROM plg_crm_company_group_members m\n JOIN plg_crm_company_groups g ON g.id = m.group_id\n WHERE m.company_id = d.company_id AND m.tenant_id = d.tenant_id AND g.is_active\n ORDER BY m.created_at, m.id\n LIMIT 1) grp ON true;\n\nGRANT SELECT ON public.v_deals TO authenticated, service_role;\n\nCREATE OR REPLACE VIEW public.v_crm_leads WITH (security_invoker = true) AS\n SELECT l.id,\n l.tenant_id,\n l.name,\n l.email,\n l.phone,\n l.notes,\n l.tags,\n l.is_active,\n l.company,\n l.source_id,\n l.source_name,\n l.lead_status,\n l.lead_value,\n l.assigned_to_id,\n l.created_at,\n l.updated_at,\n l.form_id,\n l.custom_fields,\n l.utm,\n l.status,\n l.attachments,\n cp.company_id,\n cp.role AS company_role,\n c.name AS company_name,\n c.legal_name AS company_legal_name,\n c.document_number AS company_document,\n pess.instagram,\n pess.metadata ->> 'credential_company'::text AS credential_company,\n pess.metadata ->> 'phone_raw'::text AS phone_raw,\n pess.city,\n pess.state,\n -- From `people`, not `v_leads`: the spine's view does not expose it and is\n -- not this plugin's to widen \u2014 the reason 013 wrapped it instead.\n pess.unit_id\n FROM v_leads l\n LEFT JOIN people pess ON pess.id = l.id\n LEFT JOIN LATERAL ( SELECT x.company_id,\n x.role\n FROM plg_crm_company_people x\n WHERE x.person_id = l.id\n ORDER BY x.is_primary DESC, x.created_at\n LIMIT 1) cp ON true\n LEFT JOIN plg_crm_companies c ON c.id = cp.company_id;\n\nGRANT SELECT ON public.v_crm_leads TO authenticated, service_role;\n\nCREATE OR REPLACE VIEW public.v_crm_companies_enriched WITH (security_invoker = true) AS\n SELECT c.id,\n c.tenant_id,\n c.name,\n c.legal_name,\n c.document_number,\n c.document_kind,\n c.document_root,\n c.document_valid,\n c.email,\n c.phone,\n c.website,\n c.address,\n c.city,\n c.state,\n c.country,\n c.postal_code,\n c.tags,\n c.notes,\n c.metadata,\n c.custom_fields,\n c.owner_id,\n c.is_active,\n c.created_at,\n c.updated_at,\n COALESCE(p.people_count, 0) AS people_count,\n COALESCE(d.open_deals, 0) AS open_deals,\n COALESCE(d.won_value, 0::numeric) AS won_value,\n CASE\n WHEN c.document_root IS NULL THEN 0\n ELSE COALESCE(g.group_size, 1) - 1\n END AS group_siblings,\n c.instagram,\n c.unit_id\n FROM plg_crm_companies c\n LEFT JOIN LATERAL ( SELECT count(*)::integer AS people_count\n FROM plg_crm_company_people cp\n JOIN people pe ON pe.id = cp.person_id\n WHERE cp.company_id = c.id) p ON true\n LEFT JOIN LATERAL ( SELECT count(*) FILTER (WHERE dl.status = 'open'::text)::integer AS open_deals,\n COALESCE(sum(dl.value) FILTER (WHERE dl.status = 'won'::text), 0::numeric) AS won_value\n FROM plg_crm_deals dl\n WHERE dl.company_id = c.id) d ON true\n LEFT JOIN LATERAL ( SELECT count(*)::integer AS group_size\n FROM plg_crm_companies s\n WHERE s.tenant_id = c.tenant_id AND s.document_root = c.document_root) g ON true;\n\nGRANT SELECT ON public.v_crm_companies_enriched TO authenticated, service_role;\n\n-- \u2500\u2500 the row the visibility screen reads \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n--\n-- `shareable` on both: a book of business and a funnel cross branches on\n-- purpose. `default_visibility` is what the screen OFFERS on create \u2014 unit for\n-- the deal, which is born where somebody is selling; the whole tenant for the\n-- company, which is the same chain for both brands.\nINSERT INTO public.scoped_resources (resource_table, unit_column, owner_column, shareable, default_visibility, label)\nVALUES\n ('plg_crm_deals', 'unit_id', 'owner_id', true, 'unit', 'Neg\u00F3cios'),\n ('plg_crm_companies', 'unit_id', 'owner_id', true, 'tenant', 'Empresas')\nON CONFLICT (resource_table) DO UPDATE\n SET unit_column = EXCLUDED.unit_column,\n owner_column = EXCLUDED.owner_column,\n shareable = EXCLUDED.shareable,\n default_visibility = EXCLUDED.default_visibility,\n label = EXCLUDED.label;\n";
|
|
63
63
|
export declare const MIGRATION_063_THE_ROTA_ENGINE_IS_SERVER_ONLY = "-- 063_the_rota_engine_is_server_only.sql\n--\n-- 009 and 018 meant the rota engine to be service_role only and wrote\n-- `REVOKE ALL ... FROM PUBLIC`. The pool's default privileges grant EXECUTE to\n-- `authenticated` on every new function in public, so live, any signed-in user\n-- of any tenant could offer another tenant's lead, forge a lead_created event\n-- into the handler, or sweep every tenant's offers at once \u2014 all SECURITY\n-- DEFINER with no caller check.\n--\n-- Every caller is server-side and runs as the owner: `event_runner_tick`\n-- (pg_cron) \u2192 `crm_offers_sweep`, `consume_event_log` \u2192 the handler, and the\n-- definer functions `crm_offer_decline` / `crm_offer_backlog` \u2192 `crm_offer_lead`.\n-- No screen, edge function or agent tool calls these three.\n\nREVOKE ALL ON FUNCTION public.crm_offer_lead(uuid, uuid, uuid, integer, boolean) FROM PUBLIC, anon, authenticated;\nGRANT EXECUTE ON FUNCTION public.crm_offer_lead(uuid, uuid, uuid, integer, boolean) TO service_role;\n\nREVOKE ALL ON FUNCTION public.crm_offers_sweep(integer) FROM PUBLIC, anon, authenticated;\nGRANT EXECUTE ON FUNCTION public.crm_offers_sweep(integer) TO service_role;\n\nREVOKE ALL ON FUNCTION public.plg_crm_on_lead_created_offer(jsonb) FROM PUBLIC, anon, authenticated;\nGRANT EXECUTE ON FUNCTION public.plg_crm_on_lead_created_offer(jsonb) TO service_role;\n";
|
|
64
|
+
export declare const MIGRATION_064_SEGMENTS_REACH_THE_DEAL = "-- 064_segments_reach_the_deal.sql\n--\n-- Segments could only ask about the PERSON (people / v_crm_people_engagement).\n-- The question sales asks is about the DEAL: \"open deals in Novo (feira) or\n-- Contato feito, in the ChefControl unit, tagged ICP \u00B7 Dentro\". The stage, the\n-- unit, the owner and the deal's own tags are facts of the deal, and a person\n-- can have several deals, so they cannot become person columns.\n--\n-- Three changes, all on the existing engine (crm_resolve_segment):\n--\n-- 1. `v_crm_deal_audience`: one row per deal with the columns a rule can name.\n-- It has `person_id`, so a deal segment still resolves to people for every\n-- existing caller (counts, campaigns by person), and a new resolver returns\n-- the deals themselves for campaigns that rotate through a deal's contacts.\n--\n-- 2. Match groups, as in V1 (Silvio's builder): `where` = every clause must\n-- match (AND, the only group so far), `any` = at least one must match (OR),\n-- `none` = none may match (exclusion). Missing groups mean \"no condition\",\n-- so every saved segment keeps its meaning.\n--\n-- 3. The clause builder moves to its own function so both resolvers build the\n-- same SQL. It keeps the closed operator set: an unknown operator raises,\n-- because ignoring it would widen the audience without telling anyone.\n\n-- \u2500\u2500 1. the deal as a segment source \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nCREATE OR REPLACE VIEW public.v_crm_deal_audience\nWITH (security_invoker = true) AS\nSELECT\n d.id,\n d.tenant_id,\n d.unit_id,\n d.contact_id AS person_id,\n d.company_id,\n gm.group_id,\n d.pipeline_id,\n d.stage_id,\n st.name AS stage_name,\n d.status AS deal_status,\n coalesce(d.tags, '{}'::text[]) AS tags,\n d.assigned_to_id AS owner_id,\n d.value,\n d.created_at,\n d.updated_at\nFROM public.plg_crm_deals d\nLEFT JOIN public.plg_crm_pipeline_stages st ON st.id = d.stage_id\nLEFT JOIN LATERAL (\n SELECT m.group_id FROM public.plg_crm_company_group_members m\n WHERE m.company_id = d.company_id\n ORDER BY m.created_at\n LIMIT 1\n) gm ON true;\n\nGRANT SELECT ON public.v_crm_deal_audience TO authenticated, service_role;\n\n-- \u2500\u2500 2. one clause, one place \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nCREATE OR REPLACE FUNCTION public.crm_segment_clause(p_view text, p_clause jsonb)\nRETURNS text\nLANGUAGE plpgsql\nSTABLE\nSET search_path TO ''\nAS $function$\nDECLARE\n v_col text := p_clause ->> 'column';\n v_op text := coalesce(p_clause ->> 'op', '=');\n v_sql text;\nBEGIN\n IF NOT EXISTS (SELECT 1 FROM information_schema.columns\n WHERE table_schema = 'public' AND table_name = p_view AND column_name = v_col) THEN\n RAISE EXCEPTION 'crm_segment_clause: public.% n\u00E3o tem a coluna %', p_view, v_col USING ERRCODE = '42703';\n END IF;\n\n v_sql := CASE\n WHEN v_op IN ('=', '<>', '>', '<', '>=', '<=') THEN\n format('%I %s %L', v_col,\n CASE v_op WHEN '<>' THEN '<>' WHEN '>' THEN '>' WHEN '<' THEN '<'\n WHEN '>=' THEN '>=' WHEN '<=' THEN '<=' ELSE '=' END,\n p_clause ->> 'value')\n WHEN v_op = 'ilike' THEN\n format('%I ILIKE %L', v_col, '%' || coalesce(p_clause ->> 'value', '') || '%')\n WHEN v_op IN ('in', 'not_in') THEN (\n SELECT format('%I %s (%s)', v_col,\n CASE WHEN v_op = 'not_in' THEN 'NOT IN' ELSE 'IN' END,\n coalesce(string_agg(quote_literal(e), ','), 'NULL'))\n FROM jsonb_array_elements_text(coalesce(p_clause -> 'value', '[]'::jsonb)) AS e)\n WHEN v_op = 'is_null' THEN format('%I IS NULL', v_col)\n WHEN v_op = 'not_null' THEN format('%I IS NOT NULL', v_col)\n WHEN v_op = 'has_tag' THEN\n format('%L = ANY(%I)', p_clause ->> 'value', v_col)\n -- Any of the listed tags (V1's \"\u00E9 um de\" over tags).\n WHEN v_op = 'has_any_tag' THEN (\n SELECT format('%I && ARRAY[%s]::text[]', v_col, coalesce(string_agg(quote_literal(e), ','), 'NULL'))\n FROM jsonb_array_elements_text(coalesce(p_clause -> 'value', '[]'::jsonb)) AS e)\n WHEN v_op IN ('within_days', 'older_than_days') THEN\n format('%I %s now() - make_interval(days => %s)', v_col,\n CASE WHEN v_op = 'within_days' THEN '>=' ELSE '<' END,\n (coalesce(p_clause ->> 'value', '0'))::integer)\n WHEN v_op = 'birthday_within_days' THEN\n format('%I IS NOT NULL AND ((EXTRACT(doy FROM %I::date)::int - EXTRACT(doy FROM now())::int + 366) %% 366) <= %s',\n v_col, v_col, (coalesce(p_clause ->> 'value', '0'))::integer)\n ELSE NULL\n END;\n\n IF v_sql IS NULL THEN\n RAISE EXCEPTION 'crm_segment_clause: operador % n\u00E3o \u00E9 reconhecido', v_op USING ERRCODE = '22023';\n END IF;\n RETURN '(' || v_sql || ')';\nEND $function$;\n\nREVOKE ALL ON FUNCTION public.crm_segment_clause(text, jsonb) FROM PUBLIC, anon, authenticated;\nGRANT EXECUTE ON FUNCTION public.crm_segment_clause(text, jsonb) TO service_role;\n\n-- The WHERE of a rule over a view: tenant, unit, then all / any / none.\nCREATE OR REPLACE FUNCTION public.crm_segment_where_for(p_view text, p_rules jsonb, p_unit uuid, p_tenant uuid)\nRETURNS text\nLANGUAGE plpgsql\nSTABLE\nSET search_path TO ''\nAS $function$\nDECLARE\n v_kind char;\n v_where text;\n v_part text;\nBEGIN\n IF p_view !~ '^[a-z_][a-z0-9_]*$' THEN\n RAISE EXCEPTION 'crm_segment_where: % n\u00E3o \u00E9 um nome de rela\u00E7\u00E3o simples', p_view USING ERRCODE = '22023';\n END IF;\n SELECT cl.relkind INTO v_kind FROM pg_catalog.pg_class cl\n JOIN pg_catalog.pg_namespace n ON n.oid = cl.relnamespace\n WHERE n.nspname = 'public' AND cl.relname = p_view;\n IF v_kind IS NULL THEN\n RAISE EXCEPTION 'crm_segment_where: public.% n\u00E3o existe', p_view USING ERRCODE = '42P01';\n END IF;\n\n v_where := format('tenant_id = %L', p_tenant);\n IF p_unit IS NOT NULL AND EXISTS (\n SELECT 1 FROM information_schema.columns\n WHERE table_schema = 'public' AND table_name = p_view AND column_name = 'unit_id'\n ) THEN\n v_where := v_where || format(' AND unit_id = %L', p_unit);\n END IF;\n\n SELECT string_agg(public.crm_segment_clause(p_view, c), ' AND ')\n INTO v_part FROM jsonb_array_elements(coalesce(p_rules -> 'where', '[]'::jsonb)) c;\n IF v_part IS NOT NULL THEN v_where := v_where || ' AND ' || v_part; END IF;\n\n SELECT string_agg(public.crm_segment_clause(p_view, c), ' OR ')\n INTO v_part FROM jsonb_array_elements(coalesce(p_rules -> 'any', '[]'::jsonb)) c;\n IF v_part IS NOT NULL THEN v_where := v_where || ' AND (' || v_part || ')'; END IF;\n\n SELECT string_agg(public.crm_segment_clause(p_view, c), ' OR ')\n INTO v_part FROM jsonb_array_elements(coalesce(p_rules -> 'none', '[]'::jsonb)) c;\n IF v_part IS NOT NULL THEN v_where := v_where || ' AND NOT coalesce(' || v_part || ', false)'; END IF;\n\n RETURN v_where;\nEND $function$;\n\nREVOKE ALL ON FUNCTION public.crm_segment_where_for(text, jsonb, uuid, uuid) FROM PUBLIC, anon, authenticated;\nGRANT EXECUTE ON FUNCTION public.crm_segment_where_for(text, jsonb, uuid, uuid) TO service_role;\n\n-- The WHERE of a saved segment.\nCREATE OR REPLACE FUNCTION public.crm_segment_where(p_segment_id uuid, p_tenant uuid)\nRETURNS text\nLANGUAGE plpgsql\nSTABLE\nSET search_path TO ''\nAS $function$\nDECLARE\n v_seg record;\nBEGIN\n SELECT * INTO v_seg FROM public.plg_crm_segments s WHERE s.id = p_segment_id AND s.tenant_id = p_tenant;\n IF v_seg.id IS NULL THEN\n RAISE EXCEPTION 'crm_segment_where: segmento n\u00E3o encontrado' USING ERRCODE = 'P0002';\n END IF;\n RETURN public.crm_segment_where_for(v_seg.source_view, v_seg.rules, v_seg.unit_id, p_tenant);\nEND $function$;\n\nREVOKE ALL ON FUNCTION public.crm_segment_where(uuid, uuid) FROM PUBLIC, anon, authenticated;\nGRANT EXECUTE ON FUNCTION public.crm_segment_where(uuid, uuid) TO service_role;\n\n-- How many a DRAFT rule reaches, before anyone saves it: the editor counts as\n-- the rule is written. People for a people view; deals AND their people for\n-- the deal audience.\nCREATE OR REPLACE FUNCTION public.crm_segment_preview(p_source_view text, p_rules jsonb, p_unit uuid DEFAULT NULL)\nRETURNS TABLE(rows_count bigint, people_count bigint)\nLANGUAGE plpgsql\nSTABLE SECURITY DEFINER\nSET search_path TO ''\nAS $function$\nDECLARE\n v_tenant uuid := app.current_tenant_id();\n v_where text;\n v_person text;\nBEGIN\n IF v_tenant IS NULL THEN\n RAISE EXCEPTION 'crm_segment_preview: sem tenant na sess\u00E3o' USING ERRCODE = '42501';\n END IF;\n IF NOT app.has_permission('sales.read', NULL::uuid) THEN\n RAISE EXCEPTION 'crm_segment_preview: exige sales.read' USING ERRCODE = '42501';\n END IF;\n IF p_source_view NOT IN ('people', 'v_crm_people_engagement', 'v_crm_deal_audience') THEN\n RAISE EXCEPTION 'crm_segment_preview: leitura % n\u00E3o \u00E9 um p\u00FAblico', p_source_view USING ERRCODE = '22023';\n END IF;\n v_where := public.crm_segment_where_for(p_source_view, p_rules, p_unit, v_tenant);\n v_person := CASE WHEN p_source_view = 'v_crm_deal_audience' THEN 'person_id' ELSE 'id' END;\n RETURN QUERY EXECUTE format('SELECT count(*)::bigint, count(DISTINCT %I)::bigint FROM public.%I WHERE %s',\n v_person, p_source_view, v_where);\nEND $function$;\n\nREVOKE ALL ON FUNCTION public.crm_segment_preview(text, jsonb, uuid) FROM PUBLIC, anon;\nGRANT EXECUTE ON FUNCTION public.crm_segment_preview(text, jsonb, uuid) TO authenticated, service_role;\n\n-- \u2500\u2500 3. the resolvers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n-- People, as before. A source with `person_id` (the deal audience) answers its\n-- people, once each.\nCREATE OR REPLACE FUNCTION public.crm_resolve_segment(p_segment_id uuid)\nRETURNS TABLE(person_id uuid)\nLANGUAGE plpgsql\nSTABLE SECURITY DEFINER\nSET search_path TO ''\nAS $function$\nDECLARE\n v_tenant uuid := app.current_tenant_id();\n v_seg record;\n v_col text;\nBEGIN\n IF v_tenant IS NULL THEN\n RAISE EXCEPTION 'crm_resolve_segment: sem tenant na sess\u00E3o' USING ERRCODE = '42501';\n END IF;\n IF NOT app.has_permission('sales.read', NULL::uuid) THEN\n RAISE EXCEPTION 'crm_resolve_segment: exige sales.read' USING ERRCODE = '42501';\n END IF;\n\n SELECT * INTO v_seg FROM public.plg_crm_segments s\n WHERE s.id = p_segment_id AND s.tenant_id = v_tenant;\n IF v_seg.id IS NULL THEN\n RAISE EXCEPTION 'crm_resolve_segment: segmento n\u00E3o encontrado' USING ERRCODE = 'P0002';\n END IF;\n\n -- A hand-picked list is the answer itself.\n IF v_seg.kind = 'list' THEN\n RETURN QUERY\n SELECT m.person_id FROM public.plg_crm_segment_members m\n WHERE m.segment_id = v_seg.id AND m.tenant_id = v_tenant;\n RETURN;\n END IF;\n\n v_col := CASE WHEN EXISTS (\n SELECT 1 FROM information_schema.columns\n WHERE table_schema = 'public' AND table_name = v_seg.source_view AND column_name = 'person_id'\n ) THEN 'person_id' ELSE 'id' END;\n\n RETURN QUERY EXECUTE format(\n 'SELECT DISTINCT s.%I FROM public.%I s WHERE %s AND s.%I IS NOT NULL',\n v_col, v_seg.source_view, public.crm_segment_where(v_seg.id, v_tenant), v_col);\nEND $function$;\n\n-- Deals: only for a segment over the deal audience.\nCREATE OR REPLACE FUNCTION public.crm_resolve_segment_deals(p_segment_id uuid)\nRETURNS TABLE(deal_id uuid)\nLANGUAGE plpgsql\nSTABLE SECURITY DEFINER\nSET search_path TO ''\nAS $function$\nDECLARE\n v_tenant uuid := app.current_tenant_id();\n v_view text;\nBEGIN\n IF v_tenant IS NULL THEN\n RAISE EXCEPTION 'crm_resolve_segment_deals: sem tenant na sess\u00E3o' USING ERRCODE = '42501';\n END IF;\n IF NOT app.has_permission('sales.read', NULL::uuid) THEN\n RAISE EXCEPTION 'crm_resolve_segment_deals: exige sales.read' USING ERRCODE = '42501';\n END IF;\n SELECT s.source_view INTO v_view FROM public.plg_crm_segments s\n WHERE s.id = p_segment_id AND s.tenant_id = v_tenant AND s.kind = 'rule';\n IF v_view IS DISTINCT FROM 'v_crm_deal_audience' THEN\n RAISE EXCEPTION 'crm_resolve_segment_deals: o segmento n\u00E3o \u00E9 sobre neg\u00F3cios' USING ERRCODE = '22023';\n END IF;\n RETURN QUERY EXECUTE format('SELECT s.id FROM public.v_crm_deal_audience s WHERE %s',\n public.crm_segment_where(p_segment_id, v_tenant));\nEND $function$;\n\nREVOKE ALL ON FUNCTION public.crm_resolve_segment_deals(uuid) FROM PUBLIC, anon;\nGRANT EXECUTE ON FUNCTION public.crm_resolve_segment_deals(uuid) TO authenticated, service_role;\n";
|
|
65
|
+
export declare const MIGRATION_065_A_DEAL_HAS_CONTACT_ROUTES = "-- 065_a_deal_has_contact_routes.sql\n--\n-- The sellers talked to ONE contact per deal \u2014 the central one, picked with no\n-- clear rule. When that contact does not answer, the next attempt should not\n-- be the same number again: it should be the person's other phone, then\n-- another person of the same company, then someone in the company's group.\n--\n-- This is that order, once, in the database: every way to reach a deal, best\n-- first, one row per (person, phone), with the person's e-mail on each row.\n-- Campaign journeys (conversations 017) walk it step by step.\n--\n-- SECURITY INVOKER: it reads people, phones and companies under the caller's\n-- RLS, so it can never return a contact the caller could not see.\n\nCREATE OR REPLACE FUNCTION public.crm_phone_e164(p_raw text)\nRETURNS text\nLANGUAGE sql\nIMMUTABLE\nSET search_path TO ''\nAS $function$\n -- Brazilian numbers as people type them: with or without +55, with or\n -- without punctuation. Anything that is not 10\u201313 digits is not a phone.\n SELECT CASE\n WHEN d IS NULL OR d = '' THEN NULL\n WHEN length(d) IN (10, 11) THEN '+55' || d\n WHEN length(d) IN (12, 13) AND d LIKE '55%' THEN '+' || d\n ELSE NULL\n END\n FROM (SELECT regexp_replace(coalesce(p_raw, ''), '\\D', '', 'g') AS d) x\n$function$;\n\nCREATE OR REPLACE FUNCTION public.crm_deal_contact_routes(p_deal uuid)\nRETURNS TABLE(route integer, person_id uuid, name text, phone_e164 text, email text, via text)\nLANGUAGE sql\nSTABLE\nSET search_path TO ''\nAS $function$\n WITH deal AS (\n SELECT d.id, d.tenant_id, d.contact_id, d.company_id\n FROM public.plg_crm_deals d WHERE d.id = p_deal\n ),\n grp AS (\n SELECT m2.company_id\n FROM deal\n JOIN public.plg_crm_company_group_members m1 ON m1.company_id = deal.company_id\n JOIN public.plg_crm_company_group_members m2 ON m2.group_id = m1.group_id\n WHERE m2.company_id <> deal.company_id\n ),\n -- Who, in order: the deal's contact, the company's people (primary first),\n -- the group's people.\n who AS (\n SELECT deal.contact_id AS person_id, 0 AS rank, 'primary'::text AS via FROM deal WHERE deal.contact_id IS NOT NULL\n UNION ALL\n SELECT cp.person_id, 10 + CASE WHEN cp.is_primary THEN 0 ELSE 1 END, 'company'\n FROM deal JOIN public.plg_crm_company_people cp ON cp.company_id = deal.company_id\n WHERE cp.person_id IS DISTINCT FROM deal.contact_id\n UNION ALL\n SELECT cp.person_id, 20 + CASE WHEN cp.is_primary THEN 0 ELSE 1 END, 'group'\n FROM grp JOIN public.plg_crm_company_people cp ON cp.company_id = grp.company_id\n ),\n person AS (\n SELECT DISTINCT ON (w.person_id) w.person_id, w.rank, w.via, p.name, p.email, p.phone\n FROM who w JOIN public.people p ON p.id = w.person_id\n WHERE p.merged_into_id IS NULL AND coalesce(p.is_active, true)\n ORDER BY w.person_id, w.rank\n ),\n -- Every phone of every person: the record's own first, then the list\n -- (primary first). A second phone of the deal's contact is `other_phone`.\n phones AS (\n SELECT pe.person_id, pe.rank, pe.via, pe.name, pe.email, public.crm_phone_e164(pe.phone) AS phone_e164, 0 AS ord\n FROM person pe\n UNION ALL\n SELECT pe.person_id, pe.rank, pe.via, pe.name, pe.email, public.crm_phone_e164(ph.phone),\n CASE WHEN ph.is_primary THEN 1 ELSE 2 END\n FROM person pe JOIN public.plg_crm_person_phones ph ON ph.person_id = pe.person_id\n ),\n dedup AS (\n SELECT DISTINCT ON (coalesce(ph.phone_e164, 'person:' || ph.person_id::text))\n ph.person_id, ph.rank, ph.via, ph.name, ph.email, ph.phone_e164, ph.ord\n FROM phones ph\n WHERE ph.phone_e164 IS NOT NULL OR ph.email IS NOT NULL\n ORDER BY coalesce(ph.phone_e164, 'person:' || ph.person_id::text), ph.rank, ph.ord\n ),\n numbered AS (\n SELECT d.*, row_number() OVER (PARTITION BY d.person_id ORDER BY d.ord) AS nth\n FROM dedup d\n )\n SELECT row_number() OVER (ORDER BY n.rank, n.person_id, n.nth)::integer,\n n.person_id, n.name, n.phone_e164, n.email,\n CASE WHEN n.via = 'primary' AND n.nth > 1 THEN 'other_phone' ELSE n.via END\n FROM numbered n\n -- A person with a phone does not also get a phone-less row.\n WHERE n.phone_e164 IS NOT NULL\n OR NOT EXISTS (SELECT 1 FROM numbered o WHERE o.person_id = n.person_id AND o.phone_e164 IS NOT NULL)\n ORDER BY n.rank, n.person_id, n.nth\n$function$;\n\nREVOKE ALL ON FUNCTION public.crm_deal_contact_routes(uuid) FROM PUBLIC, anon;\nGRANT EXECUTE ON FUNCTION public.crm_deal_contact_routes(uuid) TO authenticated, service_role;\nGRANT EXECUTE ON FUNCTION public.crm_phone_e164(text) TO authenticated, service_role;\n";
|
|
64
66
|
export declare const MIGRATIONS: Array<{
|
|
65
67
|
id: string;
|
|
66
68
|
sql: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,sBAAsB,0+/EAykDlC,CAAA;AAED,eAAO,MAAM,yCAAyC,8qYAkOrD,CAAA;AAED,eAAO,MAAM,+CAA+C,0onBAwT3D,CAAA;AAED,eA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HAsEvD,CAAA;AAED,eAAO,MAAM,kDAAkD,mgFA8D9D,CAAA;AAED,eAAO,MAAM,iDAAiD,o0aA+M7D,CAAA;AAED,eAAO,MAAM,gDAAgD,4gSAuJ5D,CAAA;AAED,eAAO,MAAM,8CAA8C,iybAkQ1D,CAAA;AAED,eAAO,MAAM,wCAAwC,64JAiHpD,CAAA;AAED,eAAO,MAAM,yDAAyD,k/HA4FrE,CAAA;AAED,eAAO,MAAM,wCAAwC,6gWAiLpD,CAAA;AAED,eAAO,MAAM,qDAAqD,gvNAuHjE,CAAA;AAED,eAAO,MAAM,iDAAiD,q2YAoR7D,CAAA;AAED,eAAO,MAAM,4CAA4C,s2CAsBxD,CAAA;AAED,eAAO,MAAM,qCAAqC,inaA4RjD,CAAA;AAED,eAAO,MAAM,uCAAuC,knJAoGnD,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAkEzD,CAAA"}
|
|
@@ -62,8 +62,10 @@ var MIGRATION_060_O_FUNIL_SABE_DE_QUEM_ELE_E = "";
|
|
|
62
62
|
var MIGRATION_061_A_CONVERSAO_RESPEITA_O_FILTRO_DO_QUADRO = "";
|
|
63
63
|
var MIGRATION_062_THE_WHOLE_CRM_SAYS_WHICH_UNIT_IT_IS = "";
|
|
64
64
|
var MIGRATION_063_THE_ROTA_ENGINE_IS_SERVER_ONLY = "";
|
|
65
|
+
var MIGRATION_064_SEGMENTS_REACH_THE_DEAL = "";
|
|
66
|
+
var MIGRATION_065_A_DEAL_HAS_CONTACT_ROUTES = "";
|
|
65
67
|
var MIGRATIONS = [];
|
|
66
68
|
|
|
67
|
-
export { MIGRATIONS, MIGRATION_000_BASELINE, MIGRATION_001_DE_ONDE_VEIO_E_QUEM_INDICOU, MIGRATION_002_A_PERGUNTA_QUE_O_CLIENTE_RESPONDE, MIGRATION_003_O_CLIENTE_RESPONDE_NO_PROPRIO_TELEFONE, MIGRATION_004_UM_RECORTE_DE_GENTE_QUE_TEM_NOME, MIGRATION_005_A_ETAPA_GANHA_UM_CODIGO_E_UM_COMECO, MIGRATION_006_A_ESCADA_DO_RELACIONAMENTO, MIGRATION_008_A_REGUA_DA_REDE_E_PUBLICA, MIGRATION_009_THE_LEAD_OFFER_CASCADES, MIGRATION_010_THE_BOARD_HEARS_THE_DEAL, MIGRATION_011_A_FUNNEL_IS_BORN_USABLE, MIGRATION_012_THE_CRM_SAYS_WHAT_HAPPENED, MIGRATION_013_THE_COMPANY_HOLDS_ITS_PEOPLE, MIGRATION_014_THE_SECOND_FORM_IS_THE_SAME_PERSON, MIGRATION_015_THE_FAMILY_OWNS_MORE_THAN_ONE_HOUSE, MIGRATION_016_THE_STRANGER_ONLY_EDITS_WHAT_IT_MADE, MIGRATION_017_TWO_FORMS_ONE_PERSON_AND_THE_INTEREST_ADDS_UP, MIGRATION_018_THE_ROTA_SKIPS_WHO_LEFT_AND_THE_SCREEN_SHOWS_WHO_WAITS, MIGRATION_019_QUEM_AINDA_COMPRA_E_QUEM_SUMIU, MIGRATION_020_O_STATUS_E_CONSEQUENCIA_DO_QUE_FOI_FEITO, MIGRATION_021_O_AGENTE_MEXE_NO_CARD, MIGRATION_022_A_LISTA_DO_FUNIL_PERGUNTA_POR_CIDADE, MIGRATION_023_O_CONTATO_DIZ_DE_QUE_EMPRESA_ELE_E, MIGRATION_024_O_NEGOCIO_DIZ_DE_QUE_CASA_ELE_E, MIGRATION_025_O_CARD_DIZ_QUEM_E_O_VENDEDOR, MIGRATION_026_A_LEITURA_DO_FUNIL_SAI_DO_LACO, MIGRATION_027_A_NOTA_DO_NEGOCIO_CHEGA_NA_BUSCA, MIGRATION_028_O_LEAD_DIZ_QUANTO_VALE_E_POR_QUE, MIGRATION_029_A_PORTA_DE_SERVICO_FECHA_ATRAS_DE_QUEM_ENTROU_DEPOIS, MIGRATION_030_A_LISTA_DE_ORCAMENTOS_NAO_VARRE_O_HISTORICO, MIGRATION_031_O_NOME_DO_CONTATO_ENTRA_NO_CARD, MIGRATION_032_O_PAINEL_DE_VENDAS_CONTA_NO_BANCO, MIGRATION_033_O_ENGAJAMENTO_NAO_SOMA_OS_PEDIDOS_DA_PLATAFORMA, MIGRATION_034_O_GRAFICO_DO_FUNIL_CONTA_A_ETAPA_INTEIRA, MIGRATION_035_QUEM_ESTA_NO_FUNIL_E_UM_LEAD, MIGRATION_036_O_FUNIL_DO_V1_ENTRA_NO_LUGAR_DO_FUNIL_DE_FABRICA, MIGRATION_037_O_NEGOCIO_E_O_ORCAMENTO_ATRAVESSAM_O_HISTORICO_FICA, MIGRATION_038_CANAL_ORIGEM_E_CAMPANHA_SAO_TRES_PERGUNTAS, MIGRATION_039_A_BANDEIRA_AGRUPA_O_QUE_A_RAIZ_DO_CNPJ_NAO_VE, MIGRATION_040_O_CARD_DO_FUNIL_NAO_LE_A_AGENDA_INTEIRA, MIGRATION_041_O_NOME_NO_CARD_E_DO_NEGOCIO_NAO_DA_AGENDA, MIGRATION_042_A_ATIVIDADE_DIZ_QUEM_A_FEZ, MIGRATION_043_A_CADENCIA_PARA_DE_ESPERAR_UM_FATO_QUE_NUNCA_CHEGA, MIGRATION_044_O_STATUS_NAO_E_UM_ACONTECIMENTO, MIGRATION_045_CONTATO_FEITO_E_CONTATO_QUE_ALGUEM_FEZ, MIGRATION_046_A_PASTILHA_DO_CARD_SO_FALA_QUANDO_TEM_O_QUE_DIZER, MIGRATION_047_O_DONO_DO_LEAD_TEM_UM_LUGAR_SO, MIGRATION_048_A_EMPRESA_TAMBEM_TEM_UM_ARROBA, MIGRATION_049_O_ARROBA_CHEGA_ATE_A_LISTA, MIGRATION_050_A_REUNIAO_E_UMA_ESPECIE_DECLARADA, MIGRATION_051_O_CRACHA_E_O_TELEFONE_RECUSADO_APARECEM, MIGRATION_052_O_NEGOCIO_DIZ_DE_QUE_CASA_ELE_E, MIGRATION_053_A_ATIVIDADE_DIZ_DE_QUEM_ELA_E, MIGRATION_054_A_LISTA_DE_LEADS_PERGUNTA_POR_CIDADE, MIGRATION_055_A_CESTA_DO_INTERESSE_TEM_ONDE_MORAR, MIGRATION_056_O_INTERESSE_ENTRA_PELO_AGENDAMENTO, MIGRATION_057_O_NEGOCIO_E_DO_GRUPO_NAO_DO_CNPJ, MIGRATION_058_O_CARD_DIZ_O_NOME_DO_GRUPO, MIGRATION_059_A_EMPRESA_MOSTRA_O_INSTAGRAM_QUE_ELA_GUARDA, MIGRATION_060_O_FUNIL_SABE_DE_QUEM_ELE_E, MIGRATION_061_A_CONVERSAO_RESPEITA_O_FILTRO_DO_QUADRO, MIGRATION_062_THE_WHOLE_CRM_SAYS_WHICH_UNIT_IT_IS, MIGRATION_063_THE_ROTA_ENGINE_IS_SERVER_ONLY };
|
|
69
|
+
export { MIGRATIONS, MIGRATION_000_BASELINE, MIGRATION_001_DE_ONDE_VEIO_E_QUEM_INDICOU, MIGRATION_002_A_PERGUNTA_QUE_O_CLIENTE_RESPONDE, MIGRATION_003_O_CLIENTE_RESPONDE_NO_PROPRIO_TELEFONE, MIGRATION_004_UM_RECORTE_DE_GENTE_QUE_TEM_NOME, MIGRATION_005_A_ETAPA_GANHA_UM_CODIGO_E_UM_COMECO, MIGRATION_006_A_ESCADA_DO_RELACIONAMENTO, MIGRATION_008_A_REGUA_DA_REDE_E_PUBLICA, MIGRATION_009_THE_LEAD_OFFER_CASCADES, MIGRATION_010_THE_BOARD_HEARS_THE_DEAL, MIGRATION_011_A_FUNNEL_IS_BORN_USABLE, MIGRATION_012_THE_CRM_SAYS_WHAT_HAPPENED, MIGRATION_013_THE_COMPANY_HOLDS_ITS_PEOPLE, MIGRATION_014_THE_SECOND_FORM_IS_THE_SAME_PERSON, MIGRATION_015_THE_FAMILY_OWNS_MORE_THAN_ONE_HOUSE, MIGRATION_016_THE_STRANGER_ONLY_EDITS_WHAT_IT_MADE, MIGRATION_017_TWO_FORMS_ONE_PERSON_AND_THE_INTEREST_ADDS_UP, MIGRATION_018_THE_ROTA_SKIPS_WHO_LEFT_AND_THE_SCREEN_SHOWS_WHO_WAITS, MIGRATION_019_QUEM_AINDA_COMPRA_E_QUEM_SUMIU, MIGRATION_020_O_STATUS_E_CONSEQUENCIA_DO_QUE_FOI_FEITO, MIGRATION_021_O_AGENTE_MEXE_NO_CARD, MIGRATION_022_A_LISTA_DO_FUNIL_PERGUNTA_POR_CIDADE, MIGRATION_023_O_CONTATO_DIZ_DE_QUE_EMPRESA_ELE_E, MIGRATION_024_O_NEGOCIO_DIZ_DE_QUE_CASA_ELE_E, MIGRATION_025_O_CARD_DIZ_QUEM_E_O_VENDEDOR, MIGRATION_026_A_LEITURA_DO_FUNIL_SAI_DO_LACO, MIGRATION_027_A_NOTA_DO_NEGOCIO_CHEGA_NA_BUSCA, MIGRATION_028_O_LEAD_DIZ_QUANTO_VALE_E_POR_QUE, MIGRATION_029_A_PORTA_DE_SERVICO_FECHA_ATRAS_DE_QUEM_ENTROU_DEPOIS, MIGRATION_030_A_LISTA_DE_ORCAMENTOS_NAO_VARRE_O_HISTORICO, MIGRATION_031_O_NOME_DO_CONTATO_ENTRA_NO_CARD, MIGRATION_032_O_PAINEL_DE_VENDAS_CONTA_NO_BANCO, MIGRATION_033_O_ENGAJAMENTO_NAO_SOMA_OS_PEDIDOS_DA_PLATAFORMA, MIGRATION_034_O_GRAFICO_DO_FUNIL_CONTA_A_ETAPA_INTEIRA, MIGRATION_035_QUEM_ESTA_NO_FUNIL_E_UM_LEAD, MIGRATION_036_O_FUNIL_DO_V1_ENTRA_NO_LUGAR_DO_FUNIL_DE_FABRICA, MIGRATION_037_O_NEGOCIO_E_O_ORCAMENTO_ATRAVESSAM_O_HISTORICO_FICA, MIGRATION_038_CANAL_ORIGEM_E_CAMPANHA_SAO_TRES_PERGUNTAS, MIGRATION_039_A_BANDEIRA_AGRUPA_O_QUE_A_RAIZ_DO_CNPJ_NAO_VE, MIGRATION_040_O_CARD_DO_FUNIL_NAO_LE_A_AGENDA_INTEIRA, MIGRATION_041_O_NOME_NO_CARD_E_DO_NEGOCIO_NAO_DA_AGENDA, MIGRATION_042_A_ATIVIDADE_DIZ_QUEM_A_FEZ, MIGRATION_043_A_CADENCIA_PARA_DE_ESPERAR_UM_FATO_QUE_NUNCA_CHEGA, MIGRATION_044_O_STATUS_NAO_E_UM_ACONTECIMENTO, MIGRATION_045_CONTATO_FEITO_E_CONTATO_QUE_ALGUEM_FEZ, MIGRATION_046_A_PASTILHA_DO_CARD_SO_FALA_QUANDO_TEM_O_QUE_DIZER, MIGRATION_047_O_DONO_DO_LEAD_TEM_UM_LUGAR_SO, MIGRATION_048_A_EMPRESA_TAMBEM_TEM_UM_ARROBA, MIGRATION_049_O_ARROBA_CHEGA_ATE_A_LISTA, MIGRATION_050_A_REUNIAO_E_UMA_ESPECIE_DECLARADA, MIGRATION_051_O_CRACHA_E_O_TELEFONE_RECUSADO_APARECEM, MIGRATION_052_O_NEGOCIO_DIZ_DE_QUE_CASA_ELE_E, MIGRATION_053_A_ATIVIDADE_DIZ_DE_QUEM_ELA_E, MIGRATION_054_A_LISTA_DE_LEADS_PERGUNTA_POR_CIDADE, MIGRATION_055_A_CESTA_DO_INTERESSE_TEM_ONDE_MORAR, MIGRATION_056_O_INTERESSE_ENTRA_PELO_AGENDAMENTO, MIGRATION_057_O_NEGOCIO_E_DO_GRUPO_NAO_DO_CNPJ, MIGRATION_058_O_CARD_DIZ_O_NOME_DO_GRUPO, MIGRATION_059_A_EMPRESA_MOSTRA_O_INSTAGRAM_QUE_ELA_GUARDA, MIGRATION_060_O_FUNIL_SABE_DE_QUEM_ELE_E, MIGRATION_061_A_CONVERSAO_RESPEITA_O_FILTRO_DO_QUADRO, MIGRATION_062_THE_WHOLE_CRM_SAYS_WHICH_UNIT_IT_IS, MIGRATION_063_THE_ROTA_ENGINE_IS_SERVER_ONLY, MIGRATION_064_SEGMENTS_REACH_THE_DEAL, MIGRATION_065_A_DEAL_HAS_CONTACT_ROUTES };
|
|
68
70
|
//# sourceMappingURL=main.browser.js.map
|
|
69
71
|
//# sourceMappingURL=main.browser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../node_modules/.cache/fayz-migration-stubs/main.ts"],"names":[],"mappings":";AAEO,IAAM,sBAAA,GAAyB;AAC/B,IAAM,yCAAA,GAA4C;AAClD,IAAM,+CAAA,GAAkD;AACxD,IAAM,oDAAA,GAAuD;AAC7D,IAAM,8CAAA,GAAiD;AACvD,IAAM,iDAAA,GAAoD;AAC1D,IAAM,wCAAA,GAA2C;AACjD,IAAM,uCAAA,GAA0C;AAChD,IAAM,qCAAA,GAAwC;AAC9C,IAAM,sCAAA,GAAyC;AAC/C,IAAM,qCAAA,GAAwC;AAC9C,IAAM,wCAAA,GAA2C;AACjD,IAAM,0CAAA,GAA6C;AACnD,IAAM,gDAAA,GAAmD;AACzD,IAAM,iDAAA,GAAoD;AAC1D,IAAM,kDAAA,GAAqD;AAC3D,IAAM,2DAAA,GAA8D;AACpE,IAAM,oEAAA,GAAuE;AAC7E,IAAM,4CAAA,GAA+C;AACrD,IAAM,sDAAA,GAAyD;AAC/D,IAAM,mCAAA,GAAsC;AAC5C,IAAM,kDAAA,GAAqD;AAC3D,IAAM,gDAAA,GAAmD;AACzD,IAAM,6CAAA,GAAgD;AACtD,IAAM,0CAAA,GAA6C;AACnD,IAAM,4CAAA,GAA+C;AACrD,IAAM,8CAAA,GAAiD;AACvD,IAAM,8CAAA,GAAiD;AACvD,IAAM,kEAAA,GAAqE;AAC3E,IAAM,yDAAA,GAA4D;AAClE,IAAM,6CAAA,GAAgD;AACtD,IAAM,+CAAA,GAAkD;AACxD,IAAM,6DAAA,GAAgE;AACtE,IAAM,sDAAA,GAAyD;AAC/D,IAAM,0CAAA,GAA6C;AACnD,IAAM,8DAAA,GAAiE;AACvE,IAAM,iEAAA,GAAoE;AAC1E,IAAM,wDAAA,GAA2D;AACjE,IAAM,2DAAA,GAA8D;AACpE,IAAM,qDAAA,GAAwD;AAC9D,IAAM,uDAAA,GAA0D;AAChE,IAAM,wCAAA,GAA2C;AACjD,IAAM,gEAAA,GAAmE;AACzE,IAAM,6CAAA,GAAgD;AACtD,IAAM,oDAAA,GAAuD;AAC7D,IAAM,+DAAA,GAAkE;AACxE,IAAM,4CAAA,GAA+C;AACrD,IAAM,4CAAA,GAA+C;AACrD,IAAM,wCAAA,GAA2C;AACjD,IAAM,+CAAA,GAAkD;AACxD,IAAM,qDAAA,GAAwD;AAC9D,IAAM,6CAAA,GAAgD;AACtD,IAAM,2CAAA,GAA8C;AACpD,IAAM,kDAAA,GAAqD;AAC3D,IAAM,iDAAA,GAAoD;AAC1D,IAAM,gDAAA,GAAmD;AACzD,IAAM,8CAAA,GAAiD;AACvD,IAAM,wCAAA,GAA2C;AACjD,IAAM,yDAAA,GAA4D;AAClE,IAAM,wCAAA,GAA2C;AACjD,IAAM,qDAAA,GAAwD;AAC9D,IAAM,iDAAA,GAAoD;AAC1D,IAAM,4CAAA,GAA+C;AACrD,IAAM,aAAiD","file":"main.browser.js","sourcesContent":["// GENERATED by scripts/tsup-migrations.mjs — the browser build of a\n// migrations barrel: the same names, no SQL. See that script for why.\nexport const MIGRATION_000_BASELINE = ''\nexport const MIGRATION_001_DE_ONDE_VEIO_E_QUEM_INDICOU = ''\nexport const MIGRATION_002_A_PERGUNTA_QUE_O_CLIENTE_RESPONDE = ''\nexport const MIGRATION_003_O_CLIENTE_RESPONDE_NO_PROPRIO_TELEFONE = ''\nexport const MIGRATION_004_UM_RECORTE_DE_GENTE_QUE_TEM_NOME = ''\nexport const MIGRATION_005_A_ETAPA_GANHA_UM_CODIGO_E_UM_COMECO = ''\nexport const MIGRATION_006_A_ESCADA_DO_RELACIONAMENTO = ''\nexport const MIGRATION_008_A_REGUA_DA_REDE_E_PUBLICA = ''\nexport const MIGRATION_009_THE_LEAD_OFFER_CASCADES = ''\nexport const MIGRATION_010_THE_BOARD_HEARS_THE_DEAL = ''\nexport const MIGRATION_011_A_FUNNEL_IS_BORN_USABLE = ''\nexport const MIGRATION_012_THE_CRM_SAYS_WHAT_HAPPENED = ''\nexport const MIGRATION_013_THE_COMPANY_HOLDS_ITS_PEOPLE = ''\nexport const MIGRATION_014_THE_SECOND_FORM_IS_THE_SAME_PERSON = ''\nexport const MIGRATION_015_THE_FAMILY_OWNS_MORE_THAN_ONE_HOUSE = ''\nexport const MIGRATION_016_THE_STRANGER_ONLY_EDITS_WHAT_IT_MADE = ''\nexport const MIGRATION_017_TWO_FORMS_ONE_PERSON_AND_THE_INTEREST_ADDS_UP = ''\nexport const MIGRATION_018_THE_ROTA_SKIPS_WHO_LEFT_AND_THE_SCREEN_SHOWS_WHO_WAITS = ''\nexport const MIGRATION_019_QUEM_AINDA_COMPRA_E_QUEM_SUMIU = ''\nexport const MIGRATION_020_O_STATUS_E_CONSEQUENCIA_DO_QUE_FOI_FEITO = ''\nexport const MIGRATION_021_O_AGENTE_MEXE_NO_CARD = ''\nexport const MIGRATION_022_A_LISTA_DO_FUNIL_PERGUNTA_POR_CIDADE = ''\nexport const MIGRATION_023_O_CONTATO_DIZ_DE_QUE_EMPRESA_ELE_E = ''\nexport const MIGRATION_024_O_NEGOCIO_DIZ_DE_QUE_CASA_ELE_E = ''\nexport const MIGRATION_025_O_CARD_DIZ_QUEM_E_O_VENDEDOR = ''\nexport const MIGRATION_026_A_LEITURA_DO_FUNIL_SAI_DO_LACO = ''\nexport const MIGRATION_027_A_NOTA_DO_NEGOCIO_CHEGA_NA_BUSCA = ''\nexport const MIGRATION_028_O_LEAD_DIZ_QUANTO_VALE_E_POR_QUE = ''\nexport const MIGRATION_029_A_PORTA_DE_SERVICO_FECHA_ATRAS_DE_QUEM_ENTROU_DEPOIS = ''\nexport const MIGRATION_030_A_LISTA_DE_ORCAMENTOS_NAO_VARRE_O_HISTORICO = ''\nexport const MIGRATION_031_O_NOME_DO_CONTATO_ENTRA_NO_CARD = ''\nexport const MIGRATION_032_O_PAINEL_DE_VENDAS_CONTA_NO_BANCO = ''\nexport const MIGRATION_033_O_ENGAJAMENTO_NAO_SOMA_OS_PEDIDOS_DA_PLATAFORMA = ''\nexport const MIGRATION_034_O_GRAFICO_DO_FUNIL_CONTA_A_ETAPA_INTEIRA = ''\nexport const MIGRATION_035_QUEM_ESTA_NO_FUNIL_E_UM_LEAD = ''\nexport const MIGRATION_036_O_FUNIL_DO_V1_ENTRA_NO_LUGAR_DO_FUNIL_DE_FABRICA = ''\nexport const MIGRATION_037_O_NEGOCIO_E_O_ORCAMENTO_ATRAVESSAM_O_HISTORICO_FICA = ''\nexport const MIGRATION_038_CANAL_ORIGEM_E_CAMPANHA_SAO_TRES_PERGUNTAS = ''\nexport const MIGRATION_039_A_BANDEIRA_AGRUPA_O_QUE_A_RAIZ_DO_CNPJ_NAO_VE = ''\nexport const MIGRATION_040_O_CARD_DO_FUNIL_NAO_LE_A_AGENDA_INTEIRA = ''\nexport const MIGRATION_041_O_NOME_NO_CARD_E_DO_NEGOCIO_NAO_DA_AGENDA = ''\nexport const MIGRATION_042_A_ATIVIDADE_DIZ_QUEM_A_FEZ = ''\nexport const MIGRATION_043_A_CADENCIA_PARA_DE_ESPERAR_UM_FATO_QUE_NUNCA_CHEGA = ''\nexport const MIGRATION_044_O_STATUS_NAO_E_UM_ACONTECIMENTO = ''\nexport const MIGRATION_045_CONTATO_FEITO_E_CONTATO_QUE_ALGUEM_FEZ = ''\nexport const MIGRATION_046_A_PASTILHA_DO_CARD_SO_FALA_QUANDO_TEM_O_QUE_DIZER = ''\nexport const MIGRATION_047_O_DONO_DO_LEAD_TEM_UM_LUGAR_SO = ''\nexport const MIGRATION_048_A_EMPRESA_TAMBEM_TEM_UM_ARROBA = ''\nexport const MIGRATION_049_O_ARROBA_CHEGA_ATE_A_LISTA = ''\nexport const MIGRATION_050_A_REUNIAO_E_UMA_ESPECIE_DECLARADA = ''\nexport const MIGRATION_051_O_CRACHA_E_O_TELEFONE_RECUSADO_APARECEM = ''\nexport const MIGRATION_052_O_NEGOCIO_DIZ_DE_QUE_CASA_ELE_E = ''\nexport const MIGRATION_053_A_ATIVIDADE_DIZ_DE_QUEM_ELA_E = ''\nexport const MIGRATION_054_A_LISTA_DE_LEADS_PERGUNTA_POR_CIDADE = ''\nexport const MIGRATION_055_A_CESTA_DO_INTERESSE_TEM_ONDE_MORAR = ''\nexport const MIGRATION_056_O_INTERESSE_ENTRA_PELO_AGENDAMENTO = ''\nexport const MIGRATION_057_O_NEGOCIO_E_DO_GRUPO_NAO_DO_CNPJ = ''\nexport const MIGRATION_058_O_CARD_DIZ_O_NOME_DO_GRUPO = ''\nexport const MIGRATION_059_A_EMPRESA_MOSTRA_O_INSTAGRAM_QUE_ELA_GUARDA = ''\nexport const MIGRATION_060_O_FUNIL_SABE_DE_QUEM_ELE_E = ''\nexport const MIGRATION_061_A_CONVERSAO_RESPEITA_O_FILTRO_DO_QUADRO = ''\nexport const MIGRATION_062_THE_WHOLE_CRM_SAYS_WHICH_UNIT_IT_IS = ''\nexport const MIGRATION_063_THE_ROTA_ENGINE_IS_SERVER_ONLY = ''\nexport const MIGRATIONS: Array<{ id: string; sql: string }> = []\n"]}
|
|
1
|
+
{"version":3,"sources":["../../node_modules/.cache/fayz-migration-stubs/main.ts"],"names":[],"mappings":";AAEO,IAAM,sBAAA,GAAyB;AAC/B,IAAM,yCAAA,GAA4C;AAClD,IAAM,+CAAA,GAAkD;AACxD,IAAM,oDAAA,GAAuD;AAC7D,IAAM,8CAAA,GAAiD;AACvD,IAAM,iDAAA,GAAoD;AAC1D,IAAM,wCAAA,GAA2C;AACjD,IAAM,uCAAA,GAA0C;AAChD,IAAM,qCAAA,GAAwC;AAC9C,IAAM,sCAAA,GAAyC;AAC/C,IAAM,qCAAA,GAAwC;AAC9C,IAAM,wCAAA,GAA2C;AACjD,IAAM,0CAAA,GAA6C;AACnD,IAAM,gDAAA,GAAmD;AACzD,IAAM,iDAAA,GAAoD;AAC1D,IAAM,kDAAA,GAAqD;AAC3D,IAAM,2DAAA,GAA8D;AACpE,IAAM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AM,qCAAA,GAAwC;AAC9C,IAAM,uCAAA,GAA0C;AAChD,IAAM,aAAiD","file":"main.browser.js","sourcesContent":["// GENERATED by scripts/tsup-migrations.mjs — the browser build of a\n// migrations barrel: the same names, no SQL. See that script for why.\nexport const MIGRATION_000_BASELINE = ''\nexport const MIGRATION_001_DE_ONDE_VEIO_E_QUEM_INDICOU = ''\nexport const MIGRATION_002_A_PERGUNTA_QUE_O_CLIENTE_RESPONDE = ''\nexport const MIGRATION_003_O_CLIENTE_RESPONDE_NO_PROPRIO_TELEFONE = ''\nexport const MIGRATION_004_UM_RECORTE_DE_GENTE_QUE_TEM_NOME = ''\nexport const MIGRATION_005_A_ETAPA_GANHA_UM_CODIGO_E_UM_COMECO = ''\nexport const MIGRATION_006_A_ESCADA_DO_RELACIONAMENTO = ''\nexport const MIGRATION_008_A_REGUA_DA_REDE_E_PUBLICA = ''\nexport const MIGRATION_009_THE_LEAD_OFFER_CASCADES = ''\nexport const MIGRATION_010_THE_BOARD_HEARS_THE_DEAL = ''\nexport const MIGRATION_011_A_FUNNEL_IS_BORN_USABLE = ''\nexport const MIGRATION_012_THE_CRM_SAYS_WHAT_HAPPENED = ''\nexport const MIGRATION_013_THE_COMPANY_HOLDS_ITS_PEOPLE = ''\nexport const MIGRATION_014_THE_SECOND_FORM_IS_THE_SAME_PERSON = ''\nexport const MIGRATION_015_THE_FAMILY_OWNS_MORE_THAN_ONE_HOUSE = ''\nexport const MIGRATION_016_THE_STRANGER_ONLY_EDITS_WHAT_IT_MADE = ''\nexport const MIGRATION_017_TWO_FORMS_ONE_PERSON_AND_THE_INTEREST_ADDS_UP = ''\nexport const MIGRATION_018_THE_ROTA_SKIPS_WHO_LEFT_AND_THE_SCREEN_SHOWS_WHO_WAITS = ''\nexport const MIGRATION_019_QUEM_AINDA_COMPRA_E_QUEM_SUMIU = ''\nexport const MIGRATION_020_O_STATUS_E_CONSEQUENCIA_DO_QUE_FOI_FEITO = ''\nexport const MIGRATION_021_O_AGENTE_MEXE_NO_CARD = ''\nexport const MIGRATION_022_A_LISTA_DO_FUNIL_PERGUNTA_POR_CIDADE = ''\nexport const MIGRATION_023_O_CONTATO_DIZ_DE_QUE_EMPRESA_ELE_E = ''\nexport const MIGRATION_024_O_NEGOCIO_DIZ_DE_QUE_CASA_ELE_E = ''\nexport const MIGRATION_025_O_CARD_DIZ_QUEM_E_O_VENDEDOR = ''\nexport const MIGRATION_026_A_LEITURA_DO_FUNIL_SAI_DO_LACO = ''\nexport const MIGRATION_027_A_NOTA_DO_NEGOCIO_CHEGA_NA_BUSCA = ''\nexport const MIGRATION_028_O_LEAD_DIZ_QUANTO_VALE_E_POR_QUE = ''\nexport const MIGRATION_029_A_PORTA_DE_SERVICO_FECHA_ATRAS_DE_QUEM_ENTROU_DEPOIS = ''\nexport const MIGRATION_030_A_LISTA_DE_ORCAMENTOS_NAO_VARRE_O_HISTORICO = ''\nexport const MIGRATION_031_O_NOME_DO_CONTATO_ENTRA_NO_CARD = ''\nexport const MIGRATION_032_O_PAINEL_DE_VENDAS_CONTA_NO_BANCO = ''\nexport const MIGRATION_033_O_ENGAJAMENTO_NAO_SOMA_OS_PEDIDOS_DA_PLATAFORMA = ''\nexport const MIGRATION_034_O_GRAFICO_DO_FUNIL_CONTA_A_ETAPA_INTEIRA = ''\nexport const MIGRATION_035_QUEM_ESTA_NO_FUNIL_E_UM_LEAD = ''\nexport const MIGRATION_036_O_FUNIL_DO_V1_ENTRA_NO_LUGAR_DO_FUNIL_DE_FABRICA = ''\nexport const MIGRATION_037_O_NEGOCIO_E_O_ORCAMENTO_ATRAVESSAM_O_HISTORICO_FICA = ''\nexport const MIGRATION_038_CANAL_ORIGEM_E_CAMPANHA_SAO_TRES_PERGUNTAS = ''\nexport const MIGRATION_039_A_BANDEIRA_AGRUPA_O_QUE_A_RAIZ_DO_CNPJ_NAO_VE = ''\nexport const MIGRATION_040_O_CARD_DO_FUNIL_NAO_LE_A_AGENDA_INTEIRA = ''\nexport const MIGRATION_041_O_NOME_NO_CARD_E_DO_NEGOCIO_NAO_DA_AGENDA = ''\nexport const MIGRATION_042_A_ATIVIDADE_DIZ_QUEM_A_FEZ = ''\nexport const MIGRATION_043_A_CADENCIA_PARA_DE_ESPERAR_UM_FATO_QUE_NUNCA_CHEGA = ''\nexport const MIGRATION_044_O_STATUS_NAO_E_UM_ACONTECIMENTO = ''\nexport const MIGRATION_045_CONTATO_FEITO_E_CONTATO_QUE_ALGUEM_FEZ = ''\nexport const MIGRATION_046_A_PASTILHA_DO_CARD_SO_FALA_QUANDO_TEM_O_QUE_DIZER = ''\nexport const MIGRATION_047_O_DONO_DO_LEAD_TEM_UM_LUGAR_SO = ''\nexport const MIGRATION_048_A_EMPRESA_TAMBEM_TEM_UM_ARROBA = ''\nexport const MIGRATION_049_O_ARROBA_CHEGA_ATE_A_LISTA = ''\nexport const MIGRATION_050_A_REUNIAO_E_UMA_ESPECIE_DECLARADA = ''\nexport const MIGRATION_051_O_CRACHA_E_O_TELEFONE_RECUSADO_APARECEM = ''\nexport const MIGRATION_052_O_NEGOCIO_DIZ_DE_QUE_CASA_ELE_E = ''\nexport const MIGRATION_053_A_ATIVIDADE_DIZ_DE_QUEM_ELA_E = ''\nexport const MIGRATION_054_A_LISTA_DE_LEADS_PERGUNTA_POR_CIDADE = ''\nexport const MIGRATION_055_A_CESTA_DO_INTERESSE_TEM_ONDE_MORAR = ''\nexport const MIGRATION_056_O_INTERESSE_ENTRA_PELO_AGENDAMENTO = ''\nexport const MIGRATION_057_O_NEGOCIO_E_DO_GRUPO_NAO_DO_CNPJ = ''\nexport const MIGRATION_058_O_CARD_DIZ_O_NOME_DO_GRUPO = ''\nexport const MIGRATION_059_A_EMPRESA_MOSTRA_O_INSTAGRAM_QUE_ELA_GUARDA = ''\nexport const MIGRATION_060_O_FUNIL_SABE_DE_QUEM_ELE_E = ''\nexport const MIGRATION_061_A_CONVERSAO_RESPEITA_O_FILTRO_DO_QUADRO = ''\nexport const MIGRATION_062_THE_WHOLE_CRM_SAYS_WHICH_UNIT_IT_IS = ''\nexport const MIGRATION_063_THE_ROTA_ENGINE_IS_SERVER_ONLY = ''\nexport const MIGRATION_064_SEGMENTS_REACH_THE_DEAL = ''\nexport const MIGRATION_065_A_DEAL_HAS_CONTACT_ROUTES = ''\nexport const MIGRATIONS: Array<{ id: string; sql: string }> = []\n"]}
|