@fayz-ai/plugin-crm 0.33.0 → 0.33.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/index.js +19 -3
- package/dist/index.js.map +1 -1
- package/dist/views/customerEntity.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_ACTIVITY_TYPES, buildCrmRegistries, T, localPhoneKey, normalizeDocument, loadMyUserId, isValidDocument, documentRoot
|
|
1
|
+
import { documentKind, formatDocument, DEFAULT_ACTIVITY_TYPES, buildCrmRegistries, T, localPhoneKey, normalizeDocument, loadMyUserId, isValidDocument, documentRoot } from './chunk-BIQL232X.js';
|
|
2
2
|
export { TagChips, humanizeTag } from './chunk-BIQL232X.js';
|
|
3
3
|
import { resolveSourceView, evaluateSegment } from './chunk-QJOLAGGN.js';
|
|
4
4
|
import { CrmContextProvider, useCrmConfig, useCrmStore, formatCurrency, useCrmProvider } from './chunk-7V46TYYX.js';
|
|
@@ -7531,7 +7531,8 @@ var PJ_LABELS = {
|
|
|
7531
7531
|
rg: "Inscri\xE7\xE3o Estadual",
|
|
7532
7532
|
profession: "Ramo de Atua\xE7\xE3o"
|
|
7533
7533
|
};
|
|
7534
|
-
var isPJ = (v) => v.personType === "pessoa_juridica";
|
|
7534
|
+
var isPJ = (v) => v.personType === "pessoa_juridica" || !v.personType && documentKind(v.documentNumber) === "cnpj";
|
|
7535
|
+
var PERSON_TYPE_LABEL = { pessoa_fisica: "Pessoa f\xEDsica", pessoa_juridica: "Pessoa jur\xEDdica" };
|
|
7535
7536
|
var pjLabel = (key) => (v) => isPJ(v) ? PJ_LABELS[key] : void 0;
|
|
7536
7537
|
var onlyPF = (v) => !isPJ(v);
|
|
7537
7538
|
function buildCrmCustomerEntity(name, namePlural, kind = "customer") {
|
|
@@ -7561,6 +7562,10 @@ function buildCrmCustomerEntity(name, namePlural, kind = "customer") {
|
|
|
7561
7562
|
defaultValue: "pessoa_fisica",
|
|
7562
7563
|
group: "identity",
|
|
7563
7564
|
span: 2,
|
|
7565
|
+
renderCell: (value, row) => {
|
|
7566
|
+
const v = value || (isPJ(row ?? {}) ? "pessoa_juridica" : documentKind(row?.documentNumber) === "cpf" ? "pessoa_fisica" : "");
|
|
7567
|
+
return v ? PERSON_TYPE_LABEL[v] : null;
|
|
7568
|
+
},
|
|
7564
7569
|
options: [
|
|
7565
7570
|
{ value: "pessoa_fisica", label: "Pessoa f\xEDsica" },
|
|
7566
7571
|
{ value: "pessoa_juridica", label: "Pessoa jur\xEDdica" }
|
|
@@ -7571,7 +7576,18 @@ function buildCrmCustomerEntity(name, namePlural, kind = "customer") {
|
|
|
7571
7576
|
// CPF only para pessoa FÍSICA. Um CNPJ numa linha de pessoa física ou
|
|
7572
7577
|
// colide em `people_tenant_document_uidx` ou vira uma segunda identidade
|
|
7573
7578
|
// da casa — por isso o tipo vem antes, e é ele que decide o rótulo.
|
|
7574
|
-
|
|
7579
|
+
// The list mixes people and companies, so its column says both; a record
|
|
7580
|
+
// says the one it is.
|
|
7581
|
+
{
|
|
7582
|
+
key: "documentNumber",
|
|
7583
|
+
label: kind === "supplier" ? "CNPJ / CPF" : "CPF / CNPJ",
|
|
7584
|
+
labelWhen: (v) => isPJ(v) ? "CNPJ" : v.personType === "pessoa_fisica" || documentKind(v.documentNumber) === "cpf" ? "CPF" : void 0,
|
|
7585
|
+
type: "text",
|
|
7586
|
+
searchable: true,
|
|
7587
|
+
showInTable: true,
|
|
7588
|
+
group: "identity",
|
|
7589
|
+
renderCell: (value) => value ? formatDocument(value) : null
|
|
7590
|
+
},
|
|
7575
7591
|
{ key: "rg", label: "Documento", labelWhen: pjLabel("rg"), type: "text", showInTable: false, group: "identity" },
|
|
7576
7592
|
{ key: "dateOfBirth", label: "Nascimento", labelWhen: pjLabel("dateOfBirth"), type: "date", showInTable: false, group: "identity" },
|
|
7577
7593
|
{ key: "profession", label: "Profiss\xE3o", labelWhen: pjLabel("profession"), type: "text", showInTable: false, group: "identity" },
|