@silexpert/core 1.0.109 → 1.0.112

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 (102) hide show
  1. package/es/api/resources/Commercial.d.ts +1 -0
  2. package/es/api/resources/Commercial.d.ts.map +1 -1
  3. package/es/api/resources/Commercial.js +3 -0
  4. package/es/api/resources/Commercial.js.map +1 -1
  5. package/es/api/resources/RevisionGuide.d.ts +3 -3
  6. package/es/api/resources/RevisionGuide.d.ts.map +1 -1
  7. package/es/api/resources/RevisionGuide.js +6 -6
  8. package/es/api/resources/RevisionGuide.js.map +1 -1
  9. package/es/types/Enum/Activity.d.ts +9 -1
  10. package/es/types/Enum/Activity.d.ts.map +1 -1
  11. package/es/types/Enum/Activity.js +8 -0
  12. package/es/types/Enum/Activity.js.map +1 -1
  13. package/es/types/Enum/BalanceSheet.d.ts +13 -13
  14. package/es/types/Enum/BalanceSheet.js +13 -13
  15. package/es/types/Enum/BalanceSheet.js.map +1 -1
  16. package/es/types/Enum/GeneralThirdParty.d.ts.map +1 -1
  17. package/es/types/Enum/GeneralThirdParty.js +0 -1
  18. package/es/types/Enum/GeneralThirdParty.js.map +1 -1
  19. package/es/types/Enum/MailDomainType.d.ts +3 -0
  20. package/es/types/Enum/MailDomainType.d.ts.map +1 -0
  21. package/es/types/Enum/MailDomainType.js +105 -0
  22. package/es/types/Enum/MailDomainType.js.map +1 -0
  23. package/es/types/Interface/api/facturation/CreateRebilling.js +2 -2
  24. package/es/types/Interface/api/facturation/CreateRebilling.js.map +1 -1
  25. package/es/types/Interface/api/gedFile/createFileAndGed.d.ts +1 -0
  26. package/es/types/Interface/api/gedFile/createFileAndGed.d.ts.map +1 -1
  27. package/es/types/Interface/api/gedFile/createFileAndGed.js +6 -0
  28. package/es/types/Interface/api/gedFile/createFileAndGed.js.map +1 -1
  29. package/es/types/Interface/api/revisionGuide/CreateRevisionGuide.d.ts +1 -0
  30. package/es/types/Interface/api/revisionGuide/CreateRevisionGuide.d.ts.map +1 -1
  31. package/es/types/Interface/api/revisionGuide/CreateRevisionGuide.js +4 -0
  32. package/es/types/Interface/api/revisionGuide/CreateRevisionGuide.js.map +1 -1
  33. package/es/types/Interface/models/IExercice.d.ts +2 -2
  34. package/es/types/Interface/models/IExercice.js.map +1 -1
  35. package/es/types/Interface/models/IRevisionGuide.d.ts +1 -0
  36. package/es/types/Interface/models/IRevisionGuide.d.ts.map +1 -1
  37. package/es/types/Interface/models/IRevisionGuide.js.map +1 -1
  38. package/es/types/Interface/models/ISociety.d.ts +1 -0
  39. package/es/types/Interface/models/ISociety.d.ts.map +1 -1
  40. package/es/types/Interface/models/ISociety.js.map +1 -1
  41. package/es/types/index.d.ts +1 -0
  42. package/es/types/index.d.ts.map +1 -1
  43. package/es/types/index.js +1 -0
  44. package/es/types/index.js.map +1 -1
  45. package/es/utils/commercialManagement/document.d.ts +3 -3
  46. package/es/utils/commercialManagement/document.d.ts.map +1 -1
  47. package/es/utils/commercialManagement/document.js.map +1 -1
  48. package/es/utils/commercialManagement/templates/common.js +2 -2
  49. package/es/utils/commercialManagement/templates/common.js.map +1 -1
  50. package/es/utils/index.d.ts +1 -0
  51. package/es/utils/index.d.ts.map +1 -1
  52. package/es/utils/index.js +1 -0
  53. package/es/utils/index.js.map +1 -1
  54. package/es/utils/quotation.d.ts +13 -0
  55. package/es/utils/quotation.d.ts.map +1 -0
  56. package/es/utils/quotation.js +107 -0
  57. package/es/utils/quotation.js.map +1 -0
  58. package/js/api/resources/Commercial.js +4 -0
  59. package/js/api/resources/Commercial.js.map +1 -1
  60. package/js/api/resources/RevisionGuide.js +6 -6
  61. package/js/api/resources/RevisionGuide.js.map +1 -1
  62. package/js/types/Enum/Activity.js +8 -0
  63. package/js/types/Enum/Activity.js.map +1 -1
  64. package/js/types/Enum/BalanceSheet.js +13 -13
  65. package/js/types/Enum/BalanceSheet.js.map +1 -1
  66. package/js/types/Enum/GeneralThirdParty.js +0 -3
  67. package/js/types/Enum/GeneralThirdParty.js.map +1 -1
  68. package/js/types/Enum/MailDomainType.js +8 -0
  69. package/js/types/Enum/MailDomainType.js.map +1 -0
  70. package/js/types/Interface/api/facturation/CreateRebilling.js +1 -1
  71. package/js/types/Interface/api/facturation/CreateRebilling.js.map +1 -1
  72. package/js/types/Interface/api/gedFile/createFileAndGed.js +2 -0
  73. package/js/types/Interface/api/gedFile/createFileAndGed.js.map +1 -1
  74. package/js/types/Interface/api/revisionGuide/CreateRevisionGuide.js +2 -0
  75. package/js/types/Interface/api/revisionGuide/CreateRevisionGuide.js.map +1 -1
  76. package/js/types/index.js +12 -0
  77. package/js/types/index.js.map +1 -1
  78. package/js/utils/commercialManagement/document.js.map +1 -1
  79. package/js/utils/commercialManagement/templates/common.js +2 -2
  80. package/js/utils/commercialManagement/templates/common.js.map +1 -1
  81. package/js/utils/index.js +12 -0
  82. package/js/utils/index.js.map +1 -1
  83. package/js/utils/quotation.js +137 -0
  84. package/js/utils/quotation.js.map +1 -0
  85. package/package.json +1 -1
  86. package/ts/api/resources/Commercial.ts +3 -0
  87. package/ts/api/resources/RevisionGuide.ts +6 -6
  88. package/ts/types/Enum/Activity.ts +8 -0
  89. package/ts/types/Enum/BalanceSheet.ts +13 -13
  90. package/ts/types/Enum/GeneralThirdParty.ts +0 -1
  91. package/ts/types/Enum/MailDomainType.ts +105 -0
  92. package/ts/types/Interface/api/facturation/CreateRebilling.ts +2 -2
  93. package/ts/types/Interface/api/gedFile/createFileAndGed.ts +5 -0
  94. package/ts/types/Interface/api/revisionGuide/CreateRevisionGuide.ts +3 -0
  95. package/ts/types/Interface/models/IExercice.ts +2 -2
  96. package/ts/types/Interface/models/IRevisionGuide.ts +1 -0
  97. package/ts/types/Interface/models/ISociety.ts +1 -0
  98. package/ts/types/index.ts +1 -0
  99. package/ts/utils/commercialManagement/document.ts +3 -3
  100. package/ts/utils/commercialManagement/templates/common.ts +2 -2
  101. package/ts/utils/index.ts +2 -1
  102. 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
+ }