@fayz-ai/plugin-crm 0.39.2 → 0.40.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.
Files changed (54) hide show
  1. package/dist/{CrmPage-BJASPPQI.js → CrmPage-DLFFHQJP.js} +80 -1111
  2. package/dist/CrmPage-DLFFHQJP.js.map +1 -0
  3. package/dist/CrmQuotesSurface-KLH533QS.js +43 -0
  4. package/dist/CrmQuotesSurface-KLH533QS.js.map +1 -0
  5. package/dist/chunk-5AB4K3PY.js +1166 -0
  6. package/dist/chunk-5AB4K3PY.js.map +1 -0
  7. package/dist/chunk-VI25ZESQ.js +12 -0
  8. package/dist/chunk-VI25ZESQ.js.map +1 -0
  9. package/dist/chunk-ZWUFORDV.js +26 -0
  10. package/dist/chunk-ZWUFORDV.js.map +1 -0
  11. package/dist/components/QuoteAttachments.d.ts +18 -0
  12. package/dist/components/QuoteAttachments.d.ts.map +1 -0
  13. package/dist/components/QuoteClient.d.ts +26 -0
  14. package/dist/components/QuoteClient.d.ts.map +1 -0
  15. package/dist/components/QuoteStatusDropdown.d.ts +2 -0
  16. package/dist/components/QuoteStatusDropdown.d.ts.map +1 -1
  17. package/dist/components/TalkToPerson.d.ts +13 -0
  18. package/dist/components/TalkToPerson.d.ts.map +1 -1
  19. package/dist/data/mock.d.ts.map +1 -1
  20. package/dist/data/supabase.d.ts.map +1 -1
  21. package/dist/data/types.d.ts +7 -1
  22. package/dist/data/types.d.ts.map +1 -1
  23. package/dist/index.d.ts +6 -0
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +321 -22
  26. package/dist/index.js.map +1 -1
  27. package/dist/lib/crm-scope.d.ts +16 -0
  28. package/dist/lib/crm-scope.d.ts.map +1 -0
  29. package/dist/lib/customer-extensions.d.ts +64 -0
  30. package/dist/lib/customer-extensions.d.ts.map +1 -0
  31. package/dist/lib/deal-headline.d.ts +3 -2
  32. package/dist/lib/deal-headline.d.ts.map +1 -1
  33. package/dist/lib/quote-extensions.d.ts +87 -0
  34. package/dist/lib/quote-extensions.d.ts.map +1 -0
  35. package/dist/locales/en.d.ts.map +1 -1
  36. package/dist/locales/pt-BR.d.ts.map +1 -1
  37. package/dist/types.d.ts +26 -0
  38. package/dist/types.d.ts.map +1 -1
  39. package/dist/views/CrmPage.d.ts.map +1 -1
  40. package/dist/views/CrmQuotesSurface.d.ts +26 -0
  41. package/dist/views/CrmQuotesSurface.d.ts.map +1 -0
  42. package/dist/views/CustomersCrudPage.d.ts +23 -0
  43. package/dist/views/CustomersCrudPage.d.ts.map +1 -0
  44. package/dist/views/DistributionView.d.ts.map +1 -1
  45. package/dist/views/LeadDetailView.d.ts.map +1 -1
  46. package/dist/views/LeadListView.d.ts.map +1 -1
  47. package/dist/views/QuoteDetailView.d.ts.map +1 -1
  48. package/dist/views/QuoteEditRoute.d.ts +7 -0
  49. package/dist/views/QuoteEditRoute.d.ts.map +1 -0
  50. package/dist/views/QuoteFormView.d.ts.map +1 -1
  51. package/dist/views/QuoteListView.d.ts +7 -1
  52. package/dist/views/QuoteListView.d.ts.map +1 -1
  53. package/package.json +6 -6
  54. package/dist/CrmPage-BJASPPQI.js.map +0 -1
@@ -0,0 +1,43 @@
1
+ import { getCrmScope } from './chunk-VI25ZESQ.js';
2
+ import { QuoteListView, QuoteFormView, QuoteDetailView, QuoteEditRoute } from './chunk-5AB4K3PY.js';
3
+ import './chunk-ZWUFORDV.js';
4
+ import { CrmContextProvider } from './chunk-7V46TYYX.js';
5
+ import { FileText } from 'lucide-react';
6
+ import { navigateApp, tl } from '@fayz-ai/core';
7
+ import { PageTransition } from '@fayz-ai/ui';
8
+ import { useModuleNavigation, createViewRouter } from '@fayz-ai/admin';
9
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
10
+
11
+ var DEPTHS = { "quotes-list": 0, "quotes-new": 1, "quotes-detail": 1, "quotes-edit": 2 };
12
+ function CrmQuotesSurface({ basePath, newView, labels, list }) {
13
+ const scope = getCrmScope();
14
+ const { view, direction, navigate } = useModuleNavigation(basePath, DEPTHS, "quotes-list");
15
+ if (!scope) return /* @__PURE__ */ jsx(CrmNotInstalled, {});
16
+ const renderView = createViewRouter([
17
+ { id: "quotes-list", render: () => /* @__PURE__ */ jsx(QuoteListView, { labels, list, onNew: () => navigate("quotes-new"), onEdit: (id) => navigate(`quotes-detail:${id}`), onEditQuote: (id) => navigate(`quotes-edit:${id}`) }) },
18
+ { id: "quotes-new", render: () => newView ? /* @__PURE__ */ jsx(Fragment, { children: newView({ onSaved: (id) => id ? navigate(`quotes-detail:${id}`) : navigate("quotes-list"), onBack: () => navigate("quotes-list") }) }) : /* @__PURE__ */ jsx(QuoteFormView, { onSaved: (id) => id ? navigate(`quotes-detail:${id}`) : navigate("quotes-list") }) },
19
+ { id: "quotes-detail", render: ({ id }) => /* @__PURE__ */ jsx(
20
+ QuoteDetailView,
21
+ {
22
+ quoteId: id,
23
+ onBack: () => navigate("quotes-list"),
24
+ onEdit: () => navigate(`quotes-edit:${id}`),
25
+ onInvoiceCreated: (invoiceId) => navigateApp(`/financial/receivables/detail/${invoiceId}`)
26
+ }
27
+ ) },
28
+ { id: "quotes-edit", render: ({ id }) => /* @__PURE__ */ jsx(QuoteEditRoute, { quoteId: id, onSaved: (saved) => navigate(`quotes-detail:${saved || id}`), onBack: () => navigate(`quotes-detail:${id}`) }) }
29
+ ], "quotes-list");
30
+ return /* @__PURE__ */ jsx(CrmContextProvider, { config: scope.config, provider: scope.provider, store: scope.store, children: /* @__PURE__ */ jsx(PageTransition, { transitionKey: view, direction, children: renderView(view) }) });
31
+ }
32
+ CrmQuotesSurface.displayName = "CrmQuotesSurface";
33
+ function CrmNotInstalled() {
34
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center rounded-lg border-2 border-dashed border-muted py-12 text-center", "data-testid": "crm-not-installed", children: [
35
+ /* @__PURE__ */ jsx(FileText, { className: "mb-2 h-8 w-8 text-muted-foreground/30" }),
36
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: tl("CRM not installed", "CRM n\xE3o instalado") }),
37
+ /* @__PURE__ */ jsx("p", { className: "mt-1 max-w-sm text-xs text-muted-foreground", children: tl("Quotes live in the CRM plugin. Add createCrmPlugin() to the app to open them here.", "Os or\xE7amentos moram no plugin de CRM. Inclua createCrmPlugin() no app para abri-los aqui.") })
38
+ ] });
39
+ }
40
+
41
+ export { CrmQuotesSurface };
42
+ //# sourceMappingURL=CrmQuotesSurface-KLH533QS.js.map
43
+ //# sourceMappingURL=CrmQuotesSurface-KLH533QS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/views/CrmQuotesSurface.tsx"],"names":[],"mappings":";;;;;;;;;;AAwBA,IAAM,MAAA,GAAS,EAAE,aAAA,EAAe,CAAA,EAAG,cAAc,CAAA,EAAG,eAAA,EAAiB,CAAA,EAAG,aAAA,EAAe,CAAA,EAAE;AAgBlF,SAAS,iBAAiB,EAAE,QAAA,EAAU,OAAA,EAAS,MAAA,EAAQ,MAAK,EAA0B;AAC3F,EAAA,MAAM,QAAQ,WAAA,EAAY;AAC1B,EAAA,MAAM,EAAE,MAAM,SAAA,EAAW,QAAA,KAAa,mBAAA,CAAoB,QAAA,EAAU,QAAQ,aAAa,CAAA;AAEzF,EAAA,IAAI,CAAC,KAAA,EAAO,uBAAO,GAAA,CAAC,eAAA,EAAA,EAAgB,CAAA;AAEpC,EAAA,MAAM,aAAa,gBAAA,CAAiB;AAAA,IAClC,EAAE,EAAA,EAAI,aAAA,EAAe,MAAA,EAAQ,sBAAM,GAAA,CAAC,aAAA,EAAA,EAAc,MAAA,EAAgB,IAAA,EAAY,KAAA,EAAO,MAAM,QAAA,CAAS,YAAY,CAAA,EAAG,MAAA,EAAQ,CAAC,EAAA,KAAO,QAAA,CAAS,CAAA,cAAA,EAAiB,EAAE,CAAA,CAAE,CAAA,EAAG,WAAA,EAAa,CAAC,EAAA,KAAO,QAAA,CAAS,CAAA,YAAA,EAAe,EAAE,CAA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AAA,EAAQ,MAAM,MAAA,EAAQ,QAAA,EAAU,MAAM,QAAA,EAAU,KAAA,EAAO,MAAM,KAAA,EAC/E,QAAA,kBAAA,GAAA,CAAC,kBAAe,aAAA,EAAe,IAAA,EAAM,WAClC,QAAA,EAAA,UAAA,CAAW,IAAI,GAClB,CAAA,EACF,CAAA;AAEJ;AACA,gBAAA,CAAiB,WAAA,GAAc,kBAAA;AAG/B,SAAS,eAAA,GAAkB;AACzB,EAAA,uBACE,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,4GAAA,EAA6G,eAAY,mBAAA,EACtI,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,QAAA,EAAA,EAAS,WAAU,uCAAA,EAAwC,CAAA;AAAA,wBAC3D,GAAA,EAAA,EAAE,SAAA,EAAU,uBAAuB,QAAA,EAAA,EAAA,CAAG,mBAAA,EAAqB,sBAAmB,CAAA,EAAE,CAAA;AAAA,wBAChF,GAAA,EAAA,EAAE,SAAA,EAAU,+CACV,QAAA,EAAA,EAAA,CAAG,oFAAA,EAAsF,8FAA2F,CAAA,EACvL;AAAA,GAAA,EACF,CAAA;AAEJ","file":"CrmQuotesSurface-KLH533QS.js","sourcesContent":["import React from 'react'\nimport { FileText } from 'lucide-react'\nimport { tl, navigateApp } from '@fayz-ai/core'\nimport { PageTransition } from '@fayz-ai/ui'\nimport { useModuleNavigation, createViewRouter } from '@fayz-ai/admin'\nimport { CrmContextProvider } from '../context'\nimport { getCrmScope } from '../lib/crm-scope'\nimport { QuoteListView } from './QuoteListView'\nimport { QuoteFormView } from './QuoteFormView'\nimport { QuoteDetailView } from './QuoteDetailView'\nimport { QuoteEditRoute } from './QuoteEditRoute'\nimport type { QuoteListCustomization } from '../lib/quote-extensions'\n\n// ---------------------------------------------------------------------------\n// The CRM's quotes — list, form, record — served under ANOTHER base path.\n//\n// Another plugin's rail line (\"Propostas\" of customer-success) is the same\n// screen as CRM › Orçamentos, not a copy of it: same views, same provider, same\n// store, routed by the same hook CrmPage uses. Only the base path changes, so\n// the record opens under `${basePath}/quotes/<id>` and stays inside the\n// screen the person came from.\n// ---------------------------------------------------------------------------\n\n/** Same depths CrmPage gives its quote views. */\nconst DEPTHS = { 'quotes-list': 0, 'quotes-new': 1, 'quotes-detail': 1, 'quotes-edit': 2 }\n\nexport interface CrmQuotesSurfaceProps {\n basePath: string\n /**\n * What \"Novo\" opens on THIS surface. The owner of the surface (customer-success:\n * \"Nova proposta\" builds a license proposal from the catalogue and the house's\n * onboarding) draws its own builder; absent = the CRM's quote form.\n */\n newView?: (props: { onSaved: (savedId?: string) => void; onBack: () => void }) => React.ReactNode\n /** The surface's own words for the list (V1: \"Propostas comerciais\" · \"Nova proposta\"). */\n labels?: { title?: string; newQuote?: string }\n /** The surface's own list: columns, status tabs, search, archived shown (V1: the proposals list). */\n list?: QuoteListCustomization\n}\n\nexport function CrmQuotesSurface({ basePath, newView, labels, list }: CrmQuotesSurfaceProps) {\n const scope = getCrmScope()\n const { view, direction, navigate } = useModuleNavigation(basePath, DEPTHS, 'quotes-list')\n\n if (!scope) return <CrmNotInstalled />\n\n const renderView = createViewRouter([\n { id: 'quotes-list', render: () => <QuoteListView labels={labels} list={list} onNew={() => navigate('quotes-new')} onEdit={(id) => navigate(`quotes-detail:${id}`)} onEditQuote={(id) => navigate(`quotes-edit:${id}`)} /> },\n { id: 'quotes-new', render: () => newView\n ? <>{newView({ onSaved: (id) => id ? navigate(`quotes-detail:${id}`) : navigate('quotes-list'), onBack: () => navigate('quotes-list') })}</>\n : <QuoteFormView onSaved={(id) => id ? navigate(`quotes-detail:${id}`) : navigate('quotes-list')} /> },\n { id: 'quotes-detail', render: ({ id }) => (\n <QuoteDetailView\n quoteId={id!}\n onBack={() => navigate('quotes-list')}\n onEdit={() => navigate(`quotes-edit:${id}`)}\n onInvoiceCreated={(invoiceId) => navigateApp(`/financial/receivables/detail/${invoiceId}`)}\n />\n ) },\n { id: 'quotes-edit', render: ({ id }) => <QuoteEditRoute quoteId={id!} onSaved={(saved) => navigate(`quotes-detail:${saved || id}`)} onBack={() => navigate(`quotes-detail:${id}`)} /> },\n ], 'quotes-list')\n\n return (\n <CrmContextProvider config={scope.config} provider={scope.provider} store={scope.store}>\n <PageTransition transitionKey={view} direction={direction}>\n {renderView(view)}\n </PageTransition>\n </CrmContextProvider>\n )\n}\nCrmQuotesSurface.displayName = 'CrmQuotesSurface'\n\n/** The app mounted the surface without creating the CRM plugin. */\nfunction CrmNotInstalled() {\n return (\n <div className=\"flex flex-col items-center justify-center rounded-lg border-2 border-dashed border-muted py-12 text-center\" data-testid=\"crm-not-installed\">\n <FileText className=\"mb-2 h-8 w-8 text-muted-foreground/30\" />\n <p className=\"text-sm font-medium\">{tl('CRM not installed', 'CRM não instalado')}</p>\n <p className=\"mt-1 max-w-sm text-xs text-muted-foreground\">\n {tl('Quotes live in the CRM plugin. Add createCrmPlugin() to the app to open them here.', 'Os orçamentos moram no plugin de CRM. Inclua createCrmPlugin() no app para abri-los aqui.')}\n </p>\n </div>\n )\n}\n"]}