@silexpert/core 1.0.108 → 1.0.111
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/es/api/resources/RevisionGuide.d.ts +3 -3
- package/es/api/resources/RevisionGuide.d.ts.map +1 -1
- package/es/api/resources/RevisionGuide.js +6 -6
- package/es/api/resources/RevisionGuide.js.map +1 -1
- package/es/types/Enum/Activity.d.ts +9 -1
- package/es/types/Enum/Activity.d.ts.map +1 -1
- package/es/types/Enum/Activity.js +8 -0
- package/es/types/Enum/Activity.js.map +1 -1
- package/es/types/Enum/BalanceSheet.d.ts +11 -11
- package/es/types/Enum/BalanceSheet.js +11 -11
- package/es/types/Enum/BalanceSheet.js.map +1 -1
- package/es/types/Enum/GeneralThirdParty.d.ts.map +1 -1
- package/es/types/Enum/GeneralThirdParty.js +0 -1
- package/es/types/Enum/GeneralThirdParty.js.map +1 -1
- package/es/types/Enum/MailDomainType.d.ts +3 -0
- package/es/types/Enum/MailDomainType.d.ts.map +1 -0
- package/es/types/Enum/MailDomainType.js +105 -0
- package/es/types/Enum/MailDomainType.js.map +1 -0
- package/es/types/Interface/api/facturation/CreateRebilling.js +2 -2
- package/es/types/Interface/api/facturation/CreateRebilling.js.map +1 -1
- package/es/types/Interface/api/revisionGuide/CreateRevisionGuide.d.ts +1 -0
- package/es/types/Interface/api/revisionGuide/CreateRevisionGuide.d.ts.map +1 -1
- package/es/types/Interface/api/revisionGuide/CreateRevisionGuide.js +4 -0
- package/es/types/Interface/api/revisionGuide/CreateRevisionGuide.js.map +1 -1
- package/es/types/Interface/models/IExercice.d.ts +2 -2
- package/es/types/Interface/models/IExercice.js.map +1 -1
- package/es/types/Interface/models/IRevisionGuide.d.ts +1 -0
- package/es/types/Interface/models/IRevisionGuide.d.ts.map +1 -1
- package/es/types/Interface/models/IRevisionGuide.js.map +1 -1
- package/es/types/Interface/models/ISociety.d.ts +1 -0
- package/es/types/Interface/models/ISociety.d.ts.map +1 -1
- package/es/types/Interface/models/ISociety.js.map +1 -1
- package/es/types/index.d.ts +1 -0
- package/es/types/index.d.ts.map +1 -1
- package/es/types/index.js +1 -0
- package/es/types/index.js.map +1 -1
- package/es/utils/commercialManagement/document.d.ts +3 -3
- package/es/utils/commercialManagement/document.d.ts.map +1 -1
- package/es/utils/commercialManagement/document.js +6 -6
- package/es/utils/commercialManagement/document.js.map +1 -1
- package/es/utils/commercialManagement/templates/common.js +3 -3
- package/es/utils/commercialManagement/templates/common.js.map +1 -1
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.d.ts.map +1 -1
- package/es/utils/index.js +1 -0
- package/es/utils/index.js.map +1 -1
- package/es/utils/quotation.d.ts +13 -0
- package/es/utils/quotation.d.ts.map +1 -0
- package/es/utils/quotation.js +107 -0
- package/es/utils/quotation.js.map +1 -0
- package/js/api/resources/RevisionGuide.js +6 -6
- package/js/api/resources/RevisionGuide.js.map +1 -1
- package/js/types/Enum/Activity.js +8 -0
- package/js/types/Enum/Activity.js.map +1 -1
- package/js/types/Enum/BalanceSheet.js +11 -11
- package/js/types/Enum/BalanceSheet.js.map +1 -1
- package/js/types/Enum/GeneralThirdParty.js +0 -3
- package/js/types/Enum/GeneralThirdParty.js.map +1 -1
- package/js/types/Enum/MailDomainType.js +8 -0
- package/js/types/Enum/MailDomainType.js.map +1 -0
- package/js/types/Interface/api/facturation/CreateRebilling.js +1 -1
- package/js/types/Interface/api/facturation/CreateRebilling.js.map +1 -1
- package/js/types/Interface/api/revisionGuide/CreateRevisionGuide.js +2 -0
- package/js/types/Interface/api/revisionGuide/CreateRevisionGuide.js.map +1 -1
- package/js/types/index.js +12 -0
- package/js/types/index.js.map +1 -1
- package/js/utils/commercialManagement/document.js +13 -11
- package/js/utils/commercialManagement/document.js.map +1 -1
- package/js/utils/commercialManagement/templates/common.js +3 -3
- package/js/utils/commercialManagement/templates/common.js.map +1 -1
- package/js/utils/index.js +12 -0
- package/js/utils/index.js.map +1 -1
- package/js/utils/quotation.js +137 -0
- package/js/utils/quotation.js.map +1 -0
- package/package.json +1 -1
- package/ts/api/resources/RevisionGuide.ts +6 -6
- package/ts/types/Enum/Activity.ts +8 -0
- package/ts/types/Enum/BalanceSheet.ts +11 -11
- package/ts/types/Enum/GeneralThirdParty.ts +0 -1
- package/ts/types/Enum/MailDomainType.ts +105 -0
- package/ts/types/Interface/api/facturation/CreateRebilling.ts +2 -2
- package/ts/types/Interface/api/revisionGuide/CreateRevisionGuide.ts +3 -0
- package/ts/types/Interface/models/IExercice.ts +2 -2
- package/ts/types/Interface/models/IRevisionGuide.ts +1 -0
- package/ts/types/Interface/models/ISociety.ts +1 -0
- package/ts/types/index.ts +1 -0
- package/ts/utils/commercialManagement/document.ts +8 -9
- package/ts/utils/commercialManagement/templates/common.ts +3 -3
- package/ts/utils/index.ts +2 -1
- package/ts/utils/quotation.ts +125 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { ForbidenDomain, BasicDomain } from '../types/Enum/MailDomainType';
|
|
2
|
+
import { Activity } from '../types/Enum/Activity';
|
|
3
|
+
|
|
4
|
+
type getLeadQuotationParams = {
|
|
5
|
+
firstname: string,
|
|
6
|
+
lastname: string,
|
|
7
|
+
phone: string,
|
|
8
|
+
mail: string,
|
|
9
|
+
annualTurnover: number,
|
|
10
|
+
source: number,
|
|
11
|
+
alreadyExist: boolean,
|
|
12
|
+
activitySector: number,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export function getLeadQuotation(params: getLeadQuotationParams):number {
|
|
16
|
+
const {
|
|
17
|
+
firstname, lastname, phone, mail, annualTurnover, source, alreadyExist, activitySector,
|
|
18
|
+
} = params;
|
|
19
|
+
if (
|
|
20
|
+
firstname === 'test'
|
|
21
|
+
|| lastname === 'test'
|
|
22
|
+
|| mail?.includes('test')
|
|
23
|
+
|| ['606060606', '707070707', '612345678', '712345678', '687654321', '787654321'].includes(phone)
|
|
24
|
+
) {
|
|
25
|
+
return 0;
|
|
26
|
+
}
|
|
27
|
+
let quotation = 0;
|
|
28
|
+
|
|
29
|
+
/* cotation du prénom */
|
|
30
|
+
if (firstname) quotation += 5;
|
|
31
|
+
|
|
32
|
+
/* cotation du nom */
|
|
33
|
+
if (lastname) quotation += 5;
|
|
34
|
+
|
|
35
|
+
/* cotation du numéro de téléphone */
|
|
36
|
+
if (['6', '7'].includes(phone.substr(0, 1))) {
|
|
37
|
+
quotation += 15;
|
|
38
|
+
} else {
|
|
39
|
+
quotation += 5;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* cotation de l'adresse email */
|
|
43
|
+
if (BasicDomain.find((domain) => mail?.includes(domain))) {
|
|
44
|
+
quotation += 5;
|
|
45
|
+
} else
|
|
46
|
+
if (!ForbidenDomain.find((domain) => mail?.includes(domain))) {
|
|
47
|
+
quotation += 15;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* cotation du CA annuel */
|
|
51
|
+
if ([0, 150000, 400000, 783000, 783001].includes(annualTurnover)) {
|
|
52
|
+
quotation += 10;
|
|
53
|
+
} else if ([50000, 234000].includes(annualTurnover)) {
|
|
54
|
+
quotation += 5;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* cotation de la date d'ajout */
|
|
58
|
+
if ([1, 2, 3, 4, 5].includes(new Date().getDay())) {
|
|
59
|
+
const dateTime = new Date();
|
|
60
|
+
const year = dateTime.getFullYear();
|
|
61
|
+
const month = dateTime.getMonth();
|
|
62
|
+
const day = dateTime.getDate();
|
|
63
|
+
const startTime = new Date(`${year}-${month + 1}-${day} 08:45:00`);
|
|
64
|
+
const endTime = new Date(`${year}-${month + 1}-${day} 18:45:00`);
|
|
65
|
+
if ((startTime.getTime() <= dateTime.getTime()) && (endTime.getTime() >= dateTime.getTime())) {
|
|
66
|
+
quotation += 15;
|
|
67
|
+
} else {
|
|
68
|
+
quotation += 5;
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
quotation += 5;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* cotation de la source */
|
|
75
|
+
/* Parrainage */
|
|
76
|
+
if (source === 49) {
|
|
77
|
+
quotation += 10;
|
|
78
|
+
|
|
79
|
+
/* calendly, appel entrant */
|
|
80
|
+
} else if (source === 2) {
|
|
81
|
+
quotation += 8;
|
|
82
|
+
|
|
83
|
+
/* adWords, Bing, Formulaire */
|
|
84
|
+
} else if (source === 4) {
|
|
85
|
+
quotation += 6;
|
|
86
|
+
|
|
87
|
+
/* Chat, Whatsapp */
|
|
88
|
+
} else if ([29, 92].includes(source)) {
|
|
89
|
+
quotation += 2;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* cotation de la qualité (nombre de champs remplis) */
|
|
93
|
+
const fieldNumber = [firstname, lastname, phone, mail, annualTurnover, activitySector].filter((data) => !!data).length;
|
|
94
|
+
switch (fieldNumber) {
|
|
95
|
+
case 6:
|
|
96
|
+
quotation += 10;
|
|
97
|
+
break;
|
|
98
|
+
case 5:
|
|
99
|
+
quotation += 8;
|
|
100
|
+
break;
|
|
101
|
+
case 4:
|
|
102
|
+
quotation += 6;
|
|
103
|
+
break;
|
|
104
|
+
case 3:
|
|
105
|
+
quotation += 4;
|
|
106
|
+
break;
|
|
107
|
+
case 2:
|
|
108
|
+
quotation += 2;
|
|
109
|
+
break;
|
|
110
|
+
default:
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* cotation de l'existence du lead (déjà existant ou non) */
|
|
115
|
+
if (alreadyExist) quotation += 8;
|
|
116
|
+
|
|
117
|
+
/* cotation du secteur d'activité */
|
|
118
|
+
if ([Activity.INFORMATIQUE, Activity.CONSEIL].includes(activitySector)) {
|
|
119
|
+
quotation += 10;
|
|
120
|
+
} else if ([Activity.TRANSPORT, Activity.BTP, Activity.RESTAURATION, Activity.COMMERCANT, Activity.MEDICAL, Activity.PROF_LIB].includes(activitySector)) {
|
|
121
|
+
quotation += 5;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return quotation;
|
|
125
|
+
}
|