@cofondateurauchomage/libs 1.1.167 → 1.1.171
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/build/crm/index.d.ts +2 -0
- package/build/crm/index.js +18 -0
- package/build/crm/notes.d.ts +4 -0
- package/build/crm/notes.js +14 -0
- package/build/crm/searchText.d.ts +5 -0
- package/build/crm/searchText.js +42 -0
- package/build/db.model.d.ts +2 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./notes"), exports);
|
|
18
|
+
__exportStar(require("./searchText"), exports);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ICrmNote } from "../db.model";
|
|
2
|
+
export declare function hasCrmNotes(notes: ICrmNote[] | undefined): boolean;
|
|
3
|
+
export declare function sortCrmNotesDesc(notes: ICrmNote[]): ICrmNote[];
|
|
4
|
+
export declare function appendCrmNote(existing: ICrmNote[] | undefined, note: ICrmNote): ICrmNote[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasCrmNotes = hasCrmNotes;
|
|
4
|
+
exports.sortCrmNotesDesc = sortCrmNotesDesc;
|
|
5
|
+
exports.appendCrmNote = appendCrmNote;
|
|
6
|
+
function hasCrmNotes(notes) {
|
|
7
|
+
return (notes?.length ?? 0) > 0;
|
|
8
|
+
}
|
|
9
|
+
function sortCrmNotesDesc(notes) {
|
|
10
|
+
return [...notes].sort((a, b) => (b.createdAt ?? 0) - (a.createdAt ?? 0));
|
|
11
|
+
}
|
|
12
|
+
function appendCrmNote(existing, note) {
|
|
13
|
+
return sortCrmNotesDesc([note, ...(existing ?? [])]);
|
|
14
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildCrmProfileSearchText = buildCrmProfileSearchText;
|
|
4
|
+
const stringUtils_1 = require("../utils/stringUtils");
|
|
5
|
+
function pushPart(parts, value) {
|
|
6
|
+
const t = value?.trim();
|
|
7
|
+
if (t) {
|
|
8
|
+
parts.push(t);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function buildCrmProfileSearchText(doc) {
|
|
12
|
+
const parts = [];
|
|
13
|
+
if (doc.type === "prospect") {
|
|
14
|
+
const profile = doc.profile;
|
|
15
|
+
pushPart(parts, profile.email);
|
|
16
|
+
pushPart(parts, profile.firstName);
|
|
17
|
+
pushPart(parts, profile.lastName);
|
|
18
|
+
pushPart(parts, profile.city);
|
|
19
|
+
pushPart(parts, profile.linkedin);
|
|
20
|
+
}
|
|
21
|
+
else if (doc.type === "user") {
|
|
22
|
+
const profile = doc.profile;
|
|
23
|
+
pushPart(parts, profile.firstName);
|
|
24
|
+
pushPart(parts, profile.lastName);
|
|
25
|
+
pushPart(parts, profile.city);
|
|
26
|
+
pushPart(parts, doc.contact?.email);
|
|
27
|
+
pushPart(parts, doc.contact?.linkedin);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
const profile = doc.profile;
|
|
31
|
+
pushPart(parts, profile.name);
|
|
32
|
+
pushPart(parts, profile.firstName);
|
|
33
|
+
pushPart(parts, profile.lastName);
|
|
34
|
+
pushPart(parts, profile.city);
|
|
35
|
+
pushPart(parts, doc.contact?.email);
|
|
36
|
+
pushPart(parts, doc.contact?.linkedin);
|
|
37
|
+
}
|
|
38
|
+
for (const note of doc.notes ?? []) {
|
|
39
|
+
pushPart(parts, note.text);
|
|
40
|
+
}
|
|
41
|
+
return (0, stringUtils_1.foldSearchText)(parts.join(" "));
|
|
42
|
+
}
|
package/build/db.model.d.ts
CHANGED
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./api"), exports);
|
|
18
18
|
__exportStar(require("./api.validate"), exports);
|
|
19
19
|
__exportStar(require("./const"), exports);
|
|
20
|
+
__exportStar(require("./crm"), exports);
|
|
20
21
|
__exportStar(require("./db.model"), exports);
|
|
21
22
|
__exportStar(require("./regex"), exports);
|
|
22
23
|
__exportStar(require("./utils"), exports);
|