@fayz-ai/plugin-crm 0.44.4 → 0.44.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"cards.d.ts","sourceRoot":"","sources":["../../src/analytics/cards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,eAAe,CAAA;AAwEzE,wBAAgB,sBAAsB,IAAI,gBAAgB,EAAE,CAoO3D"}
1
+ {"version":3,"file":"cards.d.ts","sourceRoot":"","sources":["../../src/analytics/cards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,eAAe,CAAA;AA2EzE,wBAAgB,sBAAsB,IAAI,gBAAgB,EAAE,CA0O3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"supabase.d.ts","sourceRoot":"","sources":["../../src/data/supabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AA2a9C,wBAAgB,yBAAyB,CAAC,OAAO,CAAC,EAAE;IAClD,gBAAgB,CAAC,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;IACtF,kFAAkF;IAClF,aAAa,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACvE,GAAG,eAAe,CAyxFlB"}
1
+ {"version":3,"file":"supabase.d.ts","sourceRoot":"","sources":["../../src/data/supabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AA2a9C,wBAAgB,yBAAyB,CAAC,OAAO,CAAC,EAAE;IAClD,gBAAgB,CAAC,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;IACtF,kFAAkF;IAClF,aAAa,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACvE,GAAG,eAAe,CA0xFlB"}
package/dist/index.js CHANGED
@@ -293,7 +293,7 @@ function SalesFunnelChart() {
293
293
  const t = useTranslation();
294
294
  const funnel = useCrmStore((s) => s.funnel);
295
295
  useEnsureFunnel();
296
- const data = funnel.map((s) => ({ name: s.stageName, deals: s.dealCount }));
296
+ const data = funnel.filter((s) => !s.isWon).map((s) => ({ name: s.stageName, deals: s.dealCount }));
297
297
  return /* @__PURE__ */ jsx(
298
298
  ChartWidget,
299
299
  {
@@ -310,7 +310,7 @@ function PipelineValueChart() {
310
310
  const t = useTranslation();
311
311
  const funnel = useCrmStore((s) => s.funnel);
312
312
  useEnsureFunnel();
313
- const data = funnel.map((s) => ({ name: s.stageName, value: s.totalValue }));
313
+ const data = funnel.filter((s) => !s.isWon).map((s) => ({ name: s.stageName, value: s.totalValue }));
314
314
  return /* @__PURE__ */ jsx(
315
315
  ChartWidget,
316
316
  {
@@ -4366,6 +4366,7 @@ function createSupabaseCrmProvider(options) {
4366
4366
  stageId: stage.id,
4367
4367
  stageName: stage.name,
4368
4368
  stageColor: stage.color,
4369
+ isWon: stage.isWon === true,
4369
4370
  dealCount: n?.deals ?? 0,
4370
4371
  totalValue: n?.total ?? 0
4371
4372
  };
@@ -5293,6 +5294,7 @@ function createCrmStore(provider) {
5293
5294
  }
5294
5295
  var LEADS = "plg_crm_rep_leads";
5295
5296
  var DEALS = "plg_crm_rep_deals";
5297
+ var DEALS_WON = "plg_crm_rep_deals_won";
5296
5298
  var CAT_LEADS = tl("Leads", "Leads");
5297
5299
  var CAT_DEALS = tl("Deals", "Neg\xF3cios");
5298
5300
  var LEAD_STATUS_LABELS = {
@@ -5498,8 +5500,11 @@ function buildCrmAnalyticsCards() {
5498
5500
  grain: "deal",
5499
5501
  canonicalOwner: "public.v_deals",
5500
5502
  query: {
5501
- source: { kind: "view", name: DEALS },
5502
- dimensions: [{ key: "created_at", label: tl("Date", "Data"), grain: "auto" }],
5503
+ source: { kind: "view", name: DEALS_WON },
5504
+ // Dated by the win, not by the opening: a deal opened in September and
5505
+ // won in November is November money.
5506
+ dateColumn: "won_at",
5507
+ dimensions: [{ key: "won_at", label: tl("Date", "Data"), grain: "auto" }],
5503
5508
  measures: [{ key: "won_value", label: tl("Won", "Ganho"), agg: "sum", format: "currency" }]
5504
5509
  },
5505
5510
  viz: { type: "kpi", spark: true }
@@ -5517,6 +5522,9 @@ function buildCrmAnalyticsCards() {
5517
5522
  grain: "deal",
5518
5523
  query: {
5519
5524
  source: { kind: "view", name: DEALS },
5525
+ // A snapshot: what is in each stage now, whenever it was opened. A date
5526
+ // range here hid every deal opened before the range.
5527
+ dateColumn: null,
5520
5528
  dimensions: [{ key: "stage_name", label: tl("Stage", "Etapa") }],
5521
5529
  measures: [
5522
5530
  { key: "deals", label: tl("Deals", "Neg\xF3cios"), agg: "count", format: "number" },
@@ -8484,7 +8492,7 @@ var crmV1SettingsTabs = [
8484
8492
  ];
8485
8493
 
8486
8494
  // src/index.ts
8487
- var CrmPage = React3__default.lazy(() => import('./CrmPage-QYX4ACFL.js').then((m) => ({ default: m.CrmPage })));
8495
+ var CrmPage = React3__default.lazy(() => import('./CrmPage-O7P25734.js').then((m) => ({ default: m.CrmPage })));
8488
8496
  var CrmGeneralSettings = lazyComponent(() => import('./CrmGeneralSettings-6XPS3L42.js').then((m) => m.CrmGeneralSettings));
8489
8497
  var SegmentsView = lazyComponent(() => import('./SegmentsView-JTFU6XWD.js').then((m) => m.SegmentsView));
8490
8498
  var DEFAULT_LABELS = {