@cofondateurauchomage/libs 1.1.149 → 1.1.151
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/db.model.d.ts +3 -3
- package/build/utils/crmSearchText.d.ts +6 -0
- package/build/utils/crmSearchText.js +43 -0
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.js +1 -0
- package/build/utils/stringUtils.d.ts +2 -0
- package/build/utils/stringUtils.js +9 -0
- package/package.json +1 -1
package/build/db.model.d.ts
CHANGED
|
@@ -87,7 +87,6 @@ export type IProspect = Partial<Omit<IUser, "id" | "plan" | "visibility" | "clic
|
|
|
87
87
|
email: string;
|
|
88
88
|
};
|
|
89
89
|
export interface IStripeMeta {
|
|
90
|
-
stripeId?: string;
|
|
91
90
|
/** First successful invoice payment tied to subscriptions (unix ms). */
|
|
92
91
|
stripeFirstPaidAt?: number;
|
|
93
92
|
/** Last successful invoice payment (unix ms). */
|
|
@@ -105,13 +104,14 @@ export interface IStripeMeta {
|
|
|
105
104
|
/** CRM mirror of `prospects/{id}` without heavy assets or long text fields. */
|
|
106
105
|
type ICrmProspectProfileSnapshot = Omit<IProspect, "motivations" | "bestStrength" | "partner" | "business" | "description" | "status_detail">;
|
|
107
106
|
/** CRM mirror of `users/{id}` without heavy assets or long text fields. */
|
|
108
|
-
type ICrmUserProfileSnapshot = Omit<IUser, "photo" | "motivations" | "bestStrength" | "partner" | "business">;
|
|
107
|
+
type ICrmUserProfileSnapshot = Omit<IUser, "photo" | "motivations" | "bestStrength" | "partner" | "business" | "clicks">;
|
|
109
108
|
/** CRM mirror of `projects/{id}` without heavy assets or long text fields. */
|
|
110
|
-
type ICrmProjectProfileSnapshot = Omit<IProject, "logo" | "description" | "partner" | "status_detail">;
|
|
109
|
+
type ICrmProjectProfileSnapshot = Omit<IProject, "logo" | "description" | "partner" | "status_detail" | "clicks">;
|
|
111
110
|
/** CRM pipeline column; computed server-side from profile + billing state. */
|
|
112
111
|
export type TCrmPipelineBucket = "lead" | "inscrit" | "pro" | "ancien_pro";
|
|
113
112
|
interface ICrmProfileBase {
|
|
114
113
|
pipelineBucket: TCrmPipelineBucket;
|
|
114
|
+
searchText: string;
|
|
115
115
|
lastTeamCallAt?: number;
|
|
116
116
|
foundPartner?: boolean;
|
|
117
117
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ICrmProfile } from "../db.model";
|
|
2
|
+
/**
|
|
3
|
+
* Rebuilds `crm_profiles.searchText` from denormalized profile (+ contact for user/project).
|
|
4
|
+
* Uses {@link foldSearchText}; apply the same folding to user queries.
|
|
5
|
+
*/
|
|
6
|
+
export declare function buildCrmProfileSearchText(doc: ICrmProfile): string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildCrmProfileSearchText = buildCrmProfileSearchText;
|
|
4
|
+
const stringUtils_1 = require("./stringUtils");
|
|
5
|
+
function pushPart(parts, value) {
|
|
6
|
+
const t = value?.trim();
|
|
7
|
+
if (t) {
|
|
8
|
+
parts.push(t);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Rebuilds `crm_profiles.searchText` from denormalized profile (+ contact for user/project).
|
|
13
|
+
* Uses {@link foldSearchText}; apply the same folding to user queries.
|
|
14
|
+
*/
|
|
15
|
+
function buildCrmProfileSearchText(doc) {
|
|
16
|
+
const parts = [];
|
|
17
|
+
if (doc.type === "prospect") {
|
|
18
|
+
const profile = doc.profile;
|
|
19
|
+
pushPart(parts, profile.email);
|
|
20
|
+
pushPart(parts, profile.firstName);
|
|
21
|
+
pushPart(parts, profile.lastName);
|
|
22
|
+
pushPart(parts, profile.city);
|
|
23
|
+
pushPart(parts, profile.linkedin);
|
|
24
|
+
}
|
|
25
|
+
else if (doc.type === "user") {
|
|
26
|
+
const profile = doc.profile;
|
|
27
|
+
pushPart(parts, profile.firstName);
|
|
28
|
+
pushPart(parts, profile.lastName);
|
|
29
|
+
pushPart(parts, profile.city);
|
|
30
|
+
pushPart(parts, doc.contact.email);
|
|
31
|
+
pushPart(parts, doc.contact.linkedin);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
const profile = doc.profile;
|
|
35
|
+
pushPart(parts, profile.name);
|
|
36
|
+
pushPart(parts, profile.firstName);
|
|
37
|
+
pushPart(parts, profile.lastName);
|
|
38
|
+
pushPart(parts, profile.city);
|
|
39
|
+
pushPart(parts, doc.contact.email);
|
|
40
|
+
pushPart(parts, doc.contact.linkedin);
|
|
41
|
+
}
|
|
42
|
+
return (0, stringUtils_1.foldSearchText)(parts.join(" "));
|
|
43
|
+
}
|
package/build/utils/index.d.ts
CHANGED
package/build/utils/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./arrayUtils"), exports);
|
|
18
|
+
__exportStar(require("./crmSearchText"), exports);
|
|
18
19
|
__exportStar(require("./errorUtils"), exports);
|
|
19
20
|
__exportStar(require("./objectUtils"), exports);
|
|
20
21
|
__exportStar(require("./stringUtils"), exports);
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.foldSearchText = foldSearchText;
|
|
3
4
|
exports.capitalize = capitalize;
|
|
5
|
+
/** Lowercases and removes diacritics (e.g. `Éléonore` → `eleonore`). */
|
|
6
|
+
function foldSearchText(raw) {
|
|
7
|
+
return raw
|
|
8
|
+
.trim()
|
|
9
|
+
.toLowerCase()
|
|
10
|
+
.normalize("NFD")
|
|
11
|
+
.replace(/\p{M}/gu, "");
|
|
12
|
+
}
|
|
4
13
|
/**
|
|
5
14
|
* Capitalize the first letter of each words separated by a space or a hyphen
|
|
6
15
|
* and prevent double space
|