@fayz-ai/plugin-crm 0.42.0 → 0.43.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/dist/{CrmPage-F3YNUGTY.js → CrmPage-QYX4ACFL.js} +30 -79
- package/dist/CrmPage-QYX4ACFL.js.map +1 -0
- package/dist/{CrmQuotesSurface-KLH533QS.js → CrmQuotesSurface-F2A4MBHS.js} +3 -3
- package/dist/{CrmQuotesSurface-KLH533QS.js.map → CrmQuotesSurface-F2A4MBHS.js.map} +1 -1
- package/dist/{chunk-5AB4K3PY.js → chunk-7KVQFYNF.js} +5 -3
- package/dist/chunk-7KVQFYNF.js.map +1 -0
- package/dist/components/QuoteStatusDropdown.d.ts.map +1 -1
- package/dist/data/crm-tasks.d.ts +11 -0
- package/dist/data/crm-tasks.d.ts.map +1 -0
- package/dist/data/supabase.d.ts.map +1 -1
- package/dist/index.js +70 -4
- package/dist/index.js.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 +1 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/main.browser.js +2 -1
- package/dist/migrations/main.browser.js.map +1 -1
- package/dist/migrations/main.js +98 -2
- package/dist/migrations/main.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/views/TasksView.d.ts +1 -4
- package/dist/views/TasksView.d.ts.map +1 -1
- package/package.json +7 -6
- package/dist/CrmPage-F3YNUGTY.js.map +0 -1
- package/dist/chunk-5AB4K3PY.js.map +0 -1
|
@@ -2,7 +2,7 @@ import { AssigneeName, formatDocument, DEFAULT_ACTIVITY_TYPES, localPhoneKey, no
|
|
|
2
2
|
import { CrmGeneralSettings } from './chunk-CA24LK57.js';
|
|
3
3
|
import { useCrmUnitFilter, UnitPicker } from './chunk-VFLS65NL.js';
|
|
4
4
|
import { DotChip, TagChips, loadTeamOrNull, loadMyUserId, humanizeTag, resolveSourceView } from './chunk-EHGAPCZF.js';
|
|
5
|
-
import { dealHeadline, dealHouseLine, QuoteFormView, QuoteListView, QuoteDetailView, QuoteEditRoute, useCanArchive, QuoteStatusDropdown } from './chunk-
|
|
5
|
+
import { dealHeadline, dealHouseLine, QuoteFormView, QuoteListView, QuoteDetailView, QuoteEditRoute, useCanArchive, QuoteStatusDropdown } from './chunk-7KVQFYNF.js';
|
|
6
6
|
import './chunk-ZWUFORDV.js';
|
|
7
7
|
import { formatCurrency, CrmContextProvider, useCrmProvider, useCrmStore, useCrmConfig } from './chunk-7V46TYYX.js';
|
|
8
8
|
import React2, { useCallback, useMemo, useState, useEffect, useRef } from 'react';
|
|
@@ -13,6 +13,8 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
|
13
13
|
import { useModuleNavigation, usePluginOnboardingGate, useUnitStore, PluginOnboardingGateSkeleton, createViewRouter, ModuleActionBar, adminNavigateTo, PageActions, usePermissionOptional, usePersistedState, useScrollMemory, useLimitGuard, useRecordVisit, AddressesTab, CrudFormSkeleton, CrudFormPage, CrudDetailSkeleton, CrudDetailPage, AskAIButton, KanbanBoard, InlineField, invalidateLimit, useOrganizationStore, getRailPage, RightRailPage, ContactPicker, PersonLink, useAgentSurface } from '@fayz-ai/admin';
|
|
14
14
|
import { createPortal } from 'react-dom';
|
|
15
15
|
import { HelpdeskStatusPanel } from '@fayz-ai/plugin-support';
|
|
16
|
+
import { getTasksProvider } from '@fayz-ai/tasks/store';
|
|
17
|
+
import { TaskCallBlock } from '@fayz-ai/tasks/components/TaskCallBlock';
|
|
16
18
|
|
|
17
19
|
function usePanel(fn, args = {}) {
|
|
18
20
|
const [data, setData] = React2.useState(null);
|
|
@@ -5212,13 +5214,6 @@ function PendingReturnsView() {
|
|
|
5212
5214
|
}
|
|
5213
5215
|
);
|
|
5214
5216
|
}
|
|
5215
|
-
var OUTCOMES = [
|
|
5216
|
-
{ id: "connected", label: "Atendeu" },
|
|
5217
|
-
{ id: "no_answer", label: "N\xE3o atendeu" },
|
|
5218
|
-
{ id: "left_message", label: "Deixei recado" },
|
|
5219
|
-
{ id: "scheduled", label: "Agendou" }
|
|
5220
|
-
];
|
|
5221
|
-
var PHONE_RE = /(\+?\(?\d[\d\s().-]{8,}\d)/g;
|
|
5222
5217
|
function today() {
|
|
5223
5218
|
const d = /* @__PURE__ */ new Date();
|
|
5224
5219
|
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
@@ -5234,8 +5229,9 @@ var BUCKETS = [
|
|
|
5234
5229
|
{ id: "next", label: "Pr\xF3ximas" },
|
|
5235
5230
|
{ id: "undated", label: "Sem prazo" }
|
|
5236
5231
|
];
|
|
5237
|
-
|
|
5238
|
-
|
|
5232
|
+
var isCrm = (t) => t.source === "crm" || (t.subjectType ?? "").startsWith("crm.");
|
|
5233
|
+
var byDue = (a, b) => (a.dueDate ?? "9999").localeCompare(b.dueDate ?? "9999") || a.createdAt.localeCompare(b.createdAt);
|
|
5234
|
+
function TasksView() {
|
|
5239
5235
|
const [me, setMe] = React2.useState(null);
|
|
5240
5236
|
const [team, setTeam] = React2.useState([]);
|
|
5241
5237
|
const [who, setWho] = React2.useState(null);
|
|
@@ -5247,13 +5243,13 @@ function TasksView({ onOpenDeal, onOpenLead }) {
|
|
|
5247
5243
|
}, []);
|
|
5248
5244
|
const load = React2.useCallback(async () => {
|
|
5249
5245
|
try {
|
|
5250
|
-
const
|
|
5251
|
-
setAll(
|
|
5246
|
+
const rows = await getTasksProvider().getTasks({ status: ["todo", "in_progress"] });
|
|
5247
|
+
setAll(rows.filter(isCrm).sort(byDue));
|
|
5252
5248
|
} catch (e) {
|
|
5253
5249
|
toast.error(e.message);
|
|
5254
5250
|
setAll([]);
|
|
5255
5251
|
}
|
|
5256
|
-
}, [
|
|
5252
|
+
}, []);
|
|
5257
5253
|
React2.useEffect(() => {
|
|
5258
5254
|
void load();
|
|
5259
5255
|
}, [load]);
|
|
@@ -5268,12 +5264,14 @@ function TasksView({ onOpenDeal, onOpenLead }) {
|
|
|
5268
5264
|
return [...n].map(([userId, count]) => ({ userId, count })).sort((a, b) => b.count - a.count);
|
|
5269
5265
|
}, [all]);
|
|
5270
5266
|
const nameOf = (id) => id ? team.find((m) => m.userId === id)?.name : void 0;
|
|
5271
|
-
async function
|
|
5272
|
-
setClosing(
|
|
5267
|
+
async function update(id, input) {
|
|
5268
|
+
setClosing(id);
|
|
5273
5269
|
try {
|
|
5274
|
-
await
|
|
5275
|
-
|
|
5276
|
-
|
|
5270
|
+
await getTasksProvider().updateTask(id, input);
|
|
5271
|
+
if (input.status === "done") {
|
|
5272
|
+
setAll((list) => (list ?? []).filter((x) => x.id !== id));
|
|
5273
|
+
toast.success("Feito \u2014 registrado no neg\xF3cio");
|
|
5274
|
+
}
|
|
5277
5275
|
} catch (e) {
|
|
5278
5276
|
toast.error(e.message);
|
|
5279
5277
|
} finally {
|
|
@@ -5323,64 +5321,17 @@ function TasksView({ onOpenDeal, onOpenLead }) {
|
|
|
5323
5321
|
g.items.length
|
|
5324
5322
|
] }),
|
|
5325
5323
|
g.items.map((t) => {
|
|
5326
|
-
const
|
|
5327
|
-
const owner = t.assignedToName ?? nameOf(t.assignedToId);
|
|
5324
|
+
const owner = t.assignedToName ?? nameOf(t.assignedToId ?? void 0);
|
|
5328
5325
|
return /* @__PURE__ */ jsxs(Card, { className: "p-3", "data-testid": "crm-task", children: [
|
|
5329
|
-
/* @__PURE__ */ jsxs("
|
|
5330
|
-
/* @__PURE__ */
|
|
5331
|
-
|
|
5332
|
-
/* @__PURE__ */ jsxs("p", { className: "mt-0.5 text-[11px] text-muted-foreground", children: [
|
|
5333
|
-
t.dueDate ? (/* @__PURE__ */ new Date(`${t.dueDate.slice(0, 10)}T12:00:00`)).toLocaleDateString("pt-BR", { day: "2-digit", month: "2-digit" }) : "sem prazo",
|
|
5334
|
-
who === "all" && owner ? ` \xB7 ${owner.split(/\s+/)[0]}` : "",
|
|
5335
|
-
t.contactName ? ` \xB7 ${t.contactName}` : ""
|
|
5336
|
-
] }),
|
|
5337
|
-
phones.length > 0 && /* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-wrap gap-1.5", children: phones.map((p) => /* @__PURE__ */ jsxs(
|
|
5338
|
-
"a",
|
|
5339
|
-
{
|
|
5340
|
-
href: `tel:${p.replace(/[^\d+]/g, "")}`,
|
|
5341
|
-
className: "inline-flex items-center gap-1 rounded-full border px-2.5 py-1 text-xs font-medium hover:bg-muted",
|
|
5342
|
-
children: [
|
|
5343
|
-
/* @__PURE__ */ jsx(Phone, { className: "h-3 w-3" }),
|
|
5344
|
-
" ",
|
|
5345
|
-
p.trim()
|
|
5346
|
-
]
|
|
5347
|
-
},
|
|
5348
|
-
p
|
|
5349
|
-
)) })
|
|
5350
|
-
] }),
|
|
5351
|
-
(t.dealId || t.leadId) && /* @__PURE__ */ jsxs(
|
|
5352
|
-
Button,
|
|
5353
|
-
{
|
|
5354
|
-
size: "sm",
|
|
5355
|
-
variant: "ghost",
|
|
5356
|
-
className: "h-7 text-xs",
|
|
5357
|
-
onClick: () => t.dealId ? onOpenDeal?.(t.dealId) : t.leadId && onOpenLead?.(t.leadId),
|
|
5358
|
-
children: [
|
|
5359
|
-
"Abrir neg\xF3cio ",
|
|
5360
|
-
/* @__PURE__ */ jsx(ChevronRight, { className: "h-3.5 w-3.5" })
|
|
5361
|
-
]
|
|
5362
|
-
}
|
|
5363
|
-
)
|
|
5326
|
+
/* @__PURE__ */ jsxs("p", { className: "flex items-center gap-1.5 text-sm font-medium", children: [
|
|
5327
|
+
t.kind === "call" && /* @__PURE__ */ jsx(Phone, { className: "h-3.5 w-3.5 shrink-0 text-info" }),
|
|
5328
|
+
t.title
|
|
5364
5329
|
] }),
|
|
5365
|
-
/* @__PURE__ */ jsxs("
|
|
5366
|
-
/* @__PURE__ */
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
size: "sm",
|
|
5371
|
-
variant: "outline",
|
|
5372
|
-
className: "h-7 text-xs",
|
|
5373
|
-
disabled: closing === t.id,
|
|
5374
|
-
onClick: () => void done(t, o.id),
|
|
5375
|
-
children: [
|
|
5376
|
-
closing === t.id ? /* @__PURE__ */ jsx(Loader2, { className: "h-3 w-3 animate-spin" }) : o.id === "connected" ? /* @__PURE__ */ jsx(Check, { className: "h-3 w-3" }) : null,
|
|
5377
|
-
" ",
|
|
5378
|
-
o.label
|
|
5379
|
-
]
|
|
5380
|
-
},
|
|
5381
|
-
o.id
|
|
5382
|
-
))
|
|
5383
|
-
] })
|
|
5330
|
+
/* @__PURE__ */ jsxs("p", { className: "mb-2 mt-0.5 text-[11px] text-muted-foreground", children: [
|
|
5331
|
+
t.dueDate ? (/* @__PURE__ */ new Date(`${t.dueDate.slice(0, 10)}T12:00:00`)).toLocaleDateString("pt-BR", { day: "2-digit", month: "2-digit" }) : "sem prazo",
|
|
5332
|
+
who === "all" && owner ? ` \xB7 ${owner.split(/\s+/)[0]}` : ""
|
|
5333
|
+
] }),
|
|
5334
|
+
/* @__PURE__ */ jsx(TaskCallBlock, { task: t, onUpdate: update, busy: closing === t.id })
|
|
5384
5335
|
] }, t.id);
|
|
5385
5336
|
})
|
|
5386
5337
|
] }, g.id))
|
|
@@ -6530,7 +6481,7 @@ function LeadQualification({ lead }) {
|
|
|
6530
6481
|
}
|
|
6531
6482
|
var PREFERRED_ORDER = ["whatsapp", "call", "visit", "email", "meeting", "note"];
|
|
6532
6483
|
var CONTACT_TYPES = /* @__PURE__ */ new Set(["whatsapp", "call", "visit", "email", "meeting"]);
|
|
6533
|
-
var
|
|
6484
|
+
var OUTCOMES = ["connected", "no_answer", "left_message", "replied", "scheduled", "not_now"];
|
|
6534
6485
|
function LogActivityButton({ target, onLogged }) {
|
|
6535
6486
|
const t = useTranslation();
|
|
6536
6487
|
const provider = useCrmProvider();
|
|
@@ -6623,7 +6574,7 @@ function LogActivityButton({ target, onLogged }) {
|
|
|
6623
6574
|
if (nextOutcome === "not_now" && !nextDate) setNextDate(defaultFutureContactDate());
|
|
6624
6575
|
}, children: [
|
|
6625
6576
|
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 text-sm", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
6626
|
-
/* @__PURE__ */ jsx(SelectContent, { children:
|
|
6577
|
+
/* @__PURE__ */ jsx(SelectContent, { children: OUTCOMES.map((o) => /* @__PURE__ */ jsx(SelectItem, { value: o, children: t(`crm.outcome.${o}`) }, o)) })
|
|
6627
6578
|
] }),
|
|
6628
6579
|
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
6629
6580
|
/* @__PURE__ */ jsx(
|
|
@@ -9905,7 +9856,7 @@ function CrmPage({ config, provider, store, registries }) {
|
|
|
9905
9856
|
}
|
|
9906
9857
|
) },
|
|
9907
9858
|
// As telas que ainda não existem — ver ./GapScreens.
|
|
9908
|
-
{ id: "tasks", render: () => /* @__PURE__ */ jsx(TasksView, {
|
|
9859
|
+
{ id: "tasks", render: () => /* @__PURE__ */ jsx(TasksView, {}) },
|
|
9909
9860
|
{ id: "follow-ups", render: () => /* @__PURE__ */ jsx(FollowUpsView, {}) },
|
|
9910
9861
|
{ id: "loyalty", render: () => /* @__PURE__ */ jsx(LoyaltyView, {}) },
|
|
9911
9862
|
{ id: "referrals", render: () => /* @__PURE__ */ jsx(ReferralsView, {}) },
|
|
@@ -9944,5 +9895,5 @@ function CrmPage({ config, provider, store, registries }) {
|
|
|
9944
9895
|
}
|
|
9945
9896
|
|
|
9946
9897
|
export { CrmPage };
|
|
9947
|
-
//# sourceMappingURL=CrmPage-
|
|
9948
|
-
//# sourceMappingURL=CrmPage-
|
|
9898
|
+
//# sourceMappingURL=CrmPage-QYX4ACFL.js.map
|
|
9899
|
+
//# sourceMappingURL=CrmPage-QYX4ACFL.js.map
|