@silexpert/core 1.0.125 → 1.0.127
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/Employee.d.ts.map +1 -1
- package/es/api/resources/Employee.js +3 -2
- package/es/api/resources/Employee.js.map +1 -1
- package/es/api/resources/Mail.d.ts +2 -1
- package/es/api/resources/Mail.d.ts.map +1 -1
- package/es/api/resources/Mail.js +3 -0
- package/es/api/resources/Mail.js.map +1 -1
- package/es/types/Enum/BrandClementine.js +15 -15
- package/es/types/Enum/BrandClementine.js.map +1 -1
- package/es/types/Enum/MailAuto.d.ts +0 -6
- package/es/types/Enum/MailAuto.d.ts.map +1 -1
- package/es/types/Enum/MailAuto.js +0 -6
- package/es/types/Enum/MailAuto.js.map +1 -1
- package/es/types/Interface/api/mail/QueryGetSignature.d.ts +6 -0
- package/es/types/Interface/api/mail/QueryGetSignature.d.ts.map +1 -0
- package/es/types/Interface/api/mail/QueryGetSignature.js +32 -0
- package/es/types/Interface/api/mail/QueryGetSignature.js.map +1 -0
- 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/templates/body.d.ts.map +1 -1
- package/es/utils/commercialManagement/templates/body.js +2 -1
- package/es/utils/commercialManagement/templates/body.js.map +1 -1
- package/es/utils/email/templates/signature.d.ts +2 -0
- package/es/utils/email/templates/signature.d.ts.map +1 -0
- package/es/utils/email/templates/signature.js +196 -0
- package/es/utils/email/templates/signature.js.map +1 -0
- package/es/utils/email.d.ts +2 -0
- package/es/utils/email.d.ts.map +1 -0
- package/es/utils/email.js +223 -0
- package/es/utils/email.js.map +1 -0
- 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/js/api/resources/Employee.js +4 -2
- package/js/api/resources/Employee.js.map +1 -1
- package/js/api/resources/Mail.js +6 -0
- package/js/api/resources/Mail.js.map +1 -1
- package/js/types/Enum/BrandClementine.js +15 -15
- package/js/types/Enum/BrandClementine.js.map +1 -1
- package/js/types/Enum/MailAuto.js +0 -6
- package/js/types/Enum/MailAuto.js.map +1 -1
- package/js/types/Interface/api/mail/QueryGetSignature.js +33 -0
- package/js/types/Interface/api/mail/QueryGetSignature.js.map +1 -0
- package/js/types/index.js +12 -0
- package/js/types/index.js.map +1 -1
- package/js/utils/commercialManagement/templates/body.js +2 -1
- package/js/utils/commercialManagement/templates/body.js.map +1 -1
- package/js/utils/email/templates/signature.js +201 -0
- package/js/utils/email/templates/signature.js.map +1 -0
- package/js/utils/email.js +317 -0
- package/js/utils/email.js.map +1 -0
- package/js/utils/index.js +12 -0
- package/js/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/ts/api/resources/Employee.ts +3 -2
- package/ts/api/resources/Mail.ts +5 -0
- package/ts/types/Enum/BrandClementine.ts +15 -15
- package/ts/types/Enum/MailAuto.ts +0 -6
- package/ts/types/Interface/api/mail/QueryGetSignature.ts +21 -0
- package/ts/types/index.ts +1 -0
- package/ts/utils/commercialManagement/templates/body.ts +2 -1
- package/ts/utils/email/templates/signature.ts +198 -0
- package/ts/utils/email.ts +230 -0
- package/ts/utils/index.ts +1 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CancelToken } from 'axios';
|
|
2
2
|
import { forEach } from 'lodash';
|
|
3
|
+
import { isDefined } from 'class-validator';
|
|
3
4
|
import {
|
|
4
5
|
BasePaginate,
|
|
5
6
|
IEmployee,
|
|
@@ -15,7 +16,7 @@ export class Employee extends Resource {
|
|
|
15
16
|
public create(payload: Partial<CreateEmployee>): Promise<IEmployee> {
|
|
16
17
|
const formData = new FormData();
|
|
17
18
|
forEach(payload, (value, key) => {
|
|
18
|
-
if (value) {
|
|
19
|
+
if (isDefined(value) || key === 'writeDpae') {
|
|
19
20
|
if (['dpaeFile', 'contractFile'].includes(key)) {
|
|
20
21
|
formData.append(key, value as File);
|
|
21
22
|
} else {
|
|
@@ -42,7 +43,7 @@ export class Employee extends Resource {
|
|
|
42
43
|
): Promise<IEmployee> {
|
|
43
44
|
const formData = new FormData();
|
|
44
45
|
forEach(payload, (value, key) => {
|
|
45
|
-
if (value) {
|
|
46
|
+
if (isDefined(value) || key === 'writeDpae') {
|
|
46
47
|
if (['dpaeFile', 'contractFile'].includes(key)) {
|
|
47
48
|
formData.append(key, value as File);
|
|
48
49
|
} else {
|
package/ts/api/resources/Mail.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
IMail,
|
|
8
8
|
CreateMailParams,
|
|
9
9
|
QueryAllMail,
|
|
10
|
+
QueryGetSignature,
|
|
10
11
|
} from '../../types';
|
|
11
12
|
|
|
12
13
|
export class Mail extends Resource {
|
|
@@ -199,4 +200,8 @@ export class Mail extends Resource {
|
|
|
199
200
|
migrateUsersMailAddresses(limit: number, idUser?: number): Promise<{ ok: number, ko: number, error?:string }> {
|
|
200
201
|
return this.axios.$post('/mails/migrate-users-mail-addresses', { limit, idUser });
|
|
201
202
|
}
|
|
203
|
+
|
|
204
|
+
getUserSignature(idUser: number, params: QueryGetSignature): Promise<string> {
|
|
205
|
+
return this.axios.$get(`/mails/${idUser}/signature`, { params });
|
|
206
|
+
}
|
|
202
207
|
}
|
|
@@ -19,22 +19,22 @@ export const BrandClementine = [
|
|
|
19
19
|
juridique: '03 83 93 16 22',
|
|
20
20
|
},
|
|
21
21
|
listMails: {
|
|
22
|
-
administratif: 'administratif@
|
|
23
|
-
app: 'app@
|
|
24
|
-
bonjour: 'bonjour@
|
|
25
|
-
contact: 'contact@
|
|
26
|
-
facturation: 'facturation@
|
|
27
|
-
feedback: 'feedback@
|
|
28
|
-
juridique: 'juridique@
|
|
22
|
+
administratif: 'administratif@clementine.fr',
|
|
23
|
+
app: 'app@clementine.fr',
|
|
24
|
+
bonjour: 'bonjour@clementine.fr',
|
|
25
|
+
contact: 'contact@clementine.fr',
|
|
26
|
+
facturation: 'facturation@clementine.fr',
|
|
27
|
+
feedback: 'feedback@clementine.fr',
|
|
28
|
+
juridique: 'juridique@clementine.fr',
|
|
29
29
|
informatique: 'informatique@compta-clementine.fr',
|
|
30
|
-
msd: 'msd@
|
|
31
|
-
noreply: 'noreply@
|
|
32
|
-
qualite: 'qualite@
|
|
33
|
-
paiement: 'paiement@
|
|
34
|
-
rh: 'rh@
|
|
35
|
-
social: 'social@
|
|
36
|
-
support: 'support@
|
|
37
|
-
tva: 'tva@
|
|
30
|
+
msd: 'msd@clementine.fr',
|
|
31
|
+
noreply: 'noreply@clementine.fr',
|
|
32
|
+
qualite: 'qualite@clementine.fr',
|
|
33
|
+
paiement: 'paiement@clementine.fr',
|
|
34
|
+
rh: 'rh@clementine.fr',
|
|
35
|
+
social: 'social@clementine.fr',
|
|
36
|
+
support: 'support@clementine.fr',
|
|
37
|
+
tva: 'tva@clementine.fr',
|
|
38
38
|
wb: 'wb@compta-clementine.fr',
|
|
39
39
|
},
|
|
40
40
|
companyInformation: {
|
|
@@ -37,14 +37,11 @@ export enum MailAuto {
|
|
|
37
37
|
REPLY_GRACEFUL_DELIVERY = 36,
|
|
38
38
|
ACCOUNTING_IMPLEMENTATION = 37,
|
|
39
39
|
INFORM_CUSTOMER_DRG_DONE = 38,
|
|
40
|
-
ASK_CERTIFICATE_NON_REMUNERATION = 39,
|
|
41
40
|
UNSYNC = 40,
|
|
42
41
|
NEW_CUSTOMER_SOCIAL = 41,
|
|
43
42
|
JURIDICAL_KBIS = 42,
|
|
44
43
|
HOME = 43,
|
|
45
44
|
HOME_SYNTHESIS = 44,
|
|
46
|
-
DOCUMENTS_WAITING = 45,
|
|
47
|
-
DOCUMENTS_TO_SIGN = 46,
|
|
48
45
|
OPINION_RECEIVED = 47,
|
|
49
46
|
RESPONSE_RECAP = 48,
|
|
50
47
|
RESPONSE_CALL_DIRECTLY_NOTATION_ECHEC = 49,
|
|
@@ -58,7 +55,6 @@ export enum MailAuto {
|
|
|
58
55
|
MEMO_RELANCE_ANNOTATION = 57,
|
|
59
56
|
APPROBATION_DIVIDEND = 58,
|
|
60
57
|
APPROBATION_JURIDICAL_DOCUMENTS = 59,
|
|
61
|
-
APPROBATION_ACCOUNTS_DEPOSIT = 60,
|
|
62
58
|
APPROBATION_ACCOUNTS_DEPOSIT_BACK = 61,
|
|
63
59
|
VAT_DECLARATION = 62,
|
|
64
60
|
TAKE_BACK_LETTER = 63,
|
|
@@ -73,7 +69,6 @@ export enum MailAuto {
|
|
|
73
69
|
TICKET_SUPPORT_CONSTATATION = 76,
|
|
74
70
|
TICKET_SUPPORT_RESOLUTION = 77,
|
|
75
71
|
SCHEDULE = 78,
|
|
76
|
-
STOP_WORKING_ACCOUNTANT = 79,
|
|
77
72
|
TERMINATION_FOR_MISSING_DOCUMENTS = 80,
|
|
78
73
|
TERMINATION = 81,
|
|
79
74
|
LAST_RELANCE_CHECK_UP = 82,
|
|
@@ -110,7 +105,6 @@ export enum MailAuto {
|
|
|
110
105
|
REPORTING_PHONE_RDV_UNAVAILABLE_6_TIMES = 116,
|
|
111
106
|
TASK_EXTERNAL_CALL_NOT_MAKE = 120,
|
|
112
107
|
MISSING_ELEMENT_FOR_CHECKLIST = 122,
|
|
113
|
-
CHECKLIST_CONFIRMED = 123,
|
|
114
108
|
MONTHLY_REPORT = 124,
|
|
115
109
|
WELCOME_TO_CLEMENTINE = 134,
|
|
116
110
|
MEETING_WITH_CLEMENTINE = 135,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IsOptional, IsInt, IsString,
|
|
3
|
+
} from 'class-validator';
|
|
4
|
+
import { ApiPropertyOptional } from '../../../../utils/decorators';
|
|
5
|
+
|
|
6
|
+
export class QueryGetSignature {
|
|
7
|
+
@ApiPropertyOptional()
|
|
8
|
+
@IsOptional()
|
|
9
|
+
@IsInt()
|
|
10
|
+
idSociety?: number;
|
|
11
|
+
|
|
12
|
+
@ApiPropertyOptional()
|
|
13
|
+
@IsOptional()
|
|
14
|
+
@IsInt()
|
|
15
|
+
idTypeBrand?: number;
|
|
16
|
+
|
|
17
|
+
@ApiPropertyOptional()
|
|
18
|
+
@IsOptional()
|
|
19
|
+
@IsString()
|
|
20
|
+
forceRole?: string;
|
|
21
|
+
}
|
package/ts/types/index.ts
CHANGED
|
@@ -525,6 +525,7 @@ export * from './Interface/api/customerProviderOperation/CreateCustomerProviderO
|
|
|
525
525
|
export * from './Interface/api/mail/QueryMail';
|
|
526
526
|
export * from './Interface/api/mail/QueryAllMail';
|
|
527
527
|
export * from './Interface/api/mail/QueryPaginatedMail';
|
|
528
|
+
export * from './Interface/api/mail/QueryGetSignature';
|
|
528
529
|
export * from './Interface/api/mail/QueryCountProcessedByUser';
|
|
529
530
|
export * from './Interface/api/mail/QueryGetAnsweringTimeByUser';
|
|
530
531
|
export * from './Interface/api/mail/QueryCountUnprocessedMail';
|
|
@@ -102,7 +102,8 @@ export const bodyTemplate = `<html class="pdf-content">
|
|
|
102
102
|
<% if (settings && (settings.iban || settings.bic)) { %>
|
|
103
103
|
<div class="row mt-30 space-between" style="page-break-inside: avoid !important;">
|
|
104
104
|
<div>
|
|
105
|
-
<% if (settings && (settings.iban || settings.bic)) { %>
|
|
105
|
+
<% if (settings && (settings.iban || settings.bic || settings.bank)) { %>
|
|
106
|
+
<% if(settings.bank) { %>BANQUE : <%= settings.bank %><br/><% } %>
|
|
106
107
|
<% if(settings.iban) { %>IBAN : <%= settings.iban %><br/><% } %>
|
|
107
108
|
<% if(settings.bic) { %>BIC : <%= settings.bic %><% } %>
|
|
108
109
|
<% } %>
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
const logoClementine = `<% if (brandName === 'Clementine') { %><tr>
|
|
2
|
+
<td
|
|
3
|
+
colspan="3"
|
|
4
|
+
class="logo"
|
|
5
|
+
style=""
|
|
6
|
+
width="850">
|
|
7
|
+
<img
|
|
8
|
+
src="https://clementine-website.s3.eu-west-3.amazonaws.com/logo_2022.png"
|
|
9
|
+
alt="Logo"
|
|
10
|
+
height="32"
|
|
11
|
+
style="padding-bottom: 10px;">
|
|
12
|
+
</td>
|
|
13
|
+
</tr><% } %>`;
|
|
14
|
+
|
|
15
|
+
const avatar = `<% if (!forceRole && user?.avatar?.token) { %>
|
|
16
|
+
<td
|
|
17
|
+
class="avatar"
|
|
18
|
+
style="text-align:center; padding: 20px 0 20px 20px; position: relative;"
|
|
19
|
+
width="100">
|
|
20
|
+
<p style="padding: 20px;background-image: url('https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_quotes.png');background-size: 26%;background-position: 81% -3%;background-repeat: no-repeat;">
|
|
21
|
+
<img
|
|
22
|
+
style="max-height: 90px;max-width: 90px; border-radius: 100%; padding-top: 1Opx"
|
|
23
|
+
src="
|
|
24
|
+
<%= hostS3 %>users/<%= user.id %>/<%= user.avatar.token %>
|
|
25
|
+
"
|
|
26
|
+
/>
|
|
27
|
+
</p>
|
|
28
|
+
</td>
|
|
29
|
+
<% } %>`;
|
|
30
|
+
|
|
31
|
+
const footer = `<% if(brandName === 'Clementine') { %>
|
|
32
|
+
<tr>
|
|
33
|
+
<td
|
|
34
|
+
style="clear:both; padding-top: 20px; font-size:17px; line-height:14px; color:#ADADAD; text-align: justify; font-family: Arial;"
|
|
35
|
+
colspan="4">
|
|
36
|
+
<table style="width: 100%" width="100%">
|
|
37
|
+
<tr>
|
|
38
|
+
<td style="padding:0 10px 0 0" width="120">
|
|
39
|
+
<a href="https://app.compta-clementine.fr/" target="_blank" style="text-decoration: none; color: #6E6E71; white-space: nowrap;">
|
|
40
|
+
<img
|
|
41
|
+
src="https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_connect2.png"
|
|
42
|
+
style="vertical-align: text-top;"
|
|
43
|
+
width="20"
|
|
44
|
+
alt="Connexion"> Connexion
|
|
45
|
+
</a>
|
|
46
|
+
</td>
|
|
47
|
+
<td style="padding:0 10px 0 0" width="170">
|
|
48
|
+
<a href="mailto:<%= supportMail %>" target="_blank" style="text-decoration: none; color: #6E6E71; white-space: nowrap;">
|
|
49
|
+
<img
|
|
50
|
+
src="https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_support2.png"
|
|
51
|
+
style="vertical-align: text-top;"
|
|
52
|
+
width="17"
|
|
53
|
+
alt="Support technique"> Support technique
|
|
54
|
+
</a>
|
|
55
|
+
</td>
|
|
56
|
+
<td style="padding:0 5px 0 0" width="24">
|
|
57
|
+
<a href="https://www.youtube.com/channel/UCVnCpcLdRwuYBLvAphHsvig/" target="_blank" style="vertical-align: middle;"><img
|
|
58
|
+
src="https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_youtube.png"
|
|
59
|
+
alt="YouTube"
|
|
60
|
+
style="width: 20px"></a>
|
|
61
|
+
</td>
|
|
62
|
+
<td style="padding:0 5px 0 0" width="24">
|
|
63
|
+
<a href="https://www.linkedin.com/company/compta-cl%C3%A9mentine/" target="_blank" style="vertical-align: middle;"><img
|
|
64
|
+
src="https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_linkedin.png"
|
|
65
|
+
alt="LinkedIn"
|
|
66
|
+
style="width: 20px"></a>
|
|
67
|
+
</td>
|
|
68
|
+
<td style="padding:0 5px 0 0" width="24">
|
|
69
|
+
<a href="https://www.instagram.com/comptaclementine/" target="_blank" style="vertical-align: middle;"><img
|
|
70
|
+
src="https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_instagram.png"
|
|
71
|
+
alt="Instagram"
|
|
72
|
+
style="width: 20px"></a>
|
|
73
|
+
</td>
|
|
74
|
+
<td style="text-align: right; vertical-align: middle; color: #6E6E71" width="430">
|
|
75
|
+
<span>Télécharger l'app</span>
|
|
76
|
+
<a href="https://apps.apple.com/fr/app/clementine/id1119493780" target="_blank" style="vertical-align: middle; margin-left: 10px"><img
|
|
77
|
+
src="https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_appstore.png"
|
|
78
|
+
alt="App Store"
|
|
79
|
+
style="width: 20px"></a>
|
|
80
|
+
<a href="https://play.google.com/store/apps/details?id=com.clementine.myclementine&hl=fr" target="_blank" style="vertical-align: middle; margin-left: 10px"><img
|
|
81
|
+
src="https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_playstore.png"
|
|
82
|
+
alt="Play Store"
|
|
83
|
+
style="width: 20px"></a>
|
|
84
|
+
</td>
|
|
85
|
+
</tr>
|
|
86
|
+
<tr>
|
|
87
|
+
<td colspan="7" style="padding-top: 12px">
|
|
88
|
+
<span style="text-align: left; text-decoration: none; color: #A0A1A6; white-space: nowrap; float: left;">
|
|
89
|
+
Une question ? Découvrez votre <a href="https://www.compta-clementine.fr/aide/" style="color: #FF7E3C">centre d'aide</a>
|
|
90
|
+
</span>
|
|
91
|
+
<span style="text-align: right; text-decoration: none; color: #A0A1A6; white-space: nowrap; float: right;">
|
|
92
|
+
Jusqu’à 500€ avec notre <a href="https://www.compta-clementine.fr/parrainage/?utm_source=signature&utm_medium=email&utm_campaign=signature&utm_content=cta" style="color: #FF7E3C">programme de parrainage</a>
|
|
93
|
+
</span>
|
|
94
|
+
</td>
|
|
95
|
+
</tr>
|
|
96
|
+
</table>
|
|
97
|
+
</td>
|
|
98
|
+
</tr>
|
|
99
|
+
<% } else if(brandName === 'Pourcentage') { %>
|
|
100
|
+
<tr>
|
|
101
|
+
<td
|
|
102
|
+
style="clear:both; padding-top: 20px; font-size:17px; line-height:14px; color:#ADADAD; text-align: justify; font-family: Arial;"
|
|
103
|
+
colspan="4">
|
|
104
|
+
<table style="width: 100%" width="100%">
|
|
105
|
+
<tr>
|
|
106
|
+
<td style="padding:0 10px 0 0" width="120">
|
|
107
|
+
<a href="https://app.pourcentage.fr/" target="_blank" style="text-decoration: none; color: #6E6E71; white-space: nowrap;">
|
|
108
|
+
<img
|
|
109
|
+
src="https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_connect2.png"
|
|
110
|
+
style="vertical-align: text-top;"
|
|
111
|
+
width="20"
|
|
112
|
+
alt="Connexion"> Connexion
|
|
113
|
+
</a>
|
|
114
|
+
</td>
|
|
115
|
+
</table>
|
|
116
|
+
</td>
|
|
117
|
+
</tr>
|
|
118
|
+
<% } %>
|
|
119
|
+
`;
|
|
120
|
+
|
|
121
|
+
export const signatureTemplate = `<table
|
|
122
|
+
border="0"
|
|
123
|
+
cellpadding="0"
|
|
124
|
+
cellspacing="0"
|
|
125
|
+
width="850"
|
|
126
|
+
class="signatureClementine">
|
|
127
|
+
|
|
128
|
+
${logoClementine}
|
|
129
|
+
|
|
130
|
+
<tr style="background: #F4F8FB">
|
|
131
|
+
${avatar}
|
|
132
|
+
<td
|
|
133
|
+
class="infos"
|
|
134
|
+
style=" padding: 20px 0 20px 30px;font-size: 17px; font-family: Arial; color:#000"
|
|
135
|
+
width="290"
|
|
136
|
+
colspan="2">
|
|
137
|
+
<table
|
|
138
|
+
border="0"
|
|
139
|
+
cellpadding="0"
|
|
140
|
+
cellspacing="0"
|
|
141
|
+
width="290">
|
|
142
|
+
<tr>
|
|
143
|
+
<td width="290">
|
|
144
|
+
<p style="font-size: 17px; margin:0px 0; padding:0">
|
|
145
|
+
<strong><span style="color:<%= primaryColor %>; font-weight: bold;"><%= user?.firstname ?? '' %> <%= user?.lastname ?? '' %></span></strong>
|
|
146
|
+
</p>
|
|
147
|
+
|
|
148
|
+
<% if(roleSignature) { %>
|
|
149
|
+
<p style="font-size: 17px; margin:0px 0; padding:0">
|
|
150
|
+
<span style="color: #6E6E71; font-weight: bold;"><%= roleSignature %></span></p>
|
|
151
|
+
</p>
|
|
152
|
+
<% } %>
|
|
153
|
+
</td>
|
|
154
|
+
</tr>
|
|
155
|
+
</table>
|
|
156
|
+
|
|
157
|
+
<p style="margin:16px 0; color:#6E6E71; border-top: 2px solid #6E6E71; width: 100px; opacity: 0.2"><!-- --></p><p style="margin:0; padding:0px 0 4px; color:#6E6E71;"><%= (user.roles && user.roles.length && user.roles.map((r) => r.idRoles).includes(22)) || (user && user.isAll === true) ? 'Nos' : 'Mes' %> horaires :<br/><%= horaires %></p>
|
|
158
|
+
</td>
|
|
159
|
+
|
|
160
|
+
<td class="infos" style="padding: 20px 20px 20px 0px; font-size: 17px; font-family: Arial; color:#000; <%= !user.calendlyUrl ? 'vertical-align: top;' : '' %>"
|
|
161
|
+
width="370">
|
|
162
|
+
<p style="margin:0px 0; padding:2px 0; color:#6E6E71; padding-left: 10px">
|
|
163
|
+
<span style="float:right">Standard : <%= standardPhoneSignature %></span><br/>
|
|
164
|
+
<% if(phoneSignature && phoneSignature !== standardPhoneSignature) { %>
|
|
165
|
+
<span style="float:right">Ligne directe : <%- phoneSignature %></span><br/>
|
|
166
|
+
<% } %>
|
|
167
|
+
</p>
|
|
168
|
+
|
|
169
|
+
<p style="margin:20px 60px 0 0; padding:0px 0 4px; color:#6E6E71; text-align: right; height: 54px;">
|
|
170
|
+
<% if(user.calendlyUrl) { %>
|
|
171
|
+
<img
|
|
172
|
+
src="https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_rightArrow.png"
|
|
173
|
+
alt="Prenez rendez-vous ici !">
|
|
174
|
+
<% } %>
|
|
175
|
+
</p>
|
|
176
|
+
|
|
177
|
+
<p style="margin:0; padding:0px 0 4px; color:#6E6E71; text-align: right"><a href="https://www.smileyourpla.net/" style="display: inline-block; color:#6E6E71;" target="_blank"><img
|
|
178
|
+
src="https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_smileYourPlanet.png"
|
|
179
|
+
alt="Initiative Smile your planet" height="36"></a>
|
|
180
|
+
<% if(user.calendlyUrl) { %>
|
|
181
|
+
<a href="<%= user.calendlyUrl %>" style="display: inline-block; color:#6E6E71;" target="_blank"><img
|
|
182
|
+
src="https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_rdv_tel.png"
|
|
183
|
+
alt="Demande de rdv téléphonique"></a>
|
|
184
|
+
<% } %>
|
|
185
|
+
</p>
|
|
186
|
+
</td>
|
|
187
|
+
</tr>
|
|
188
|
+
|
|
189
|
+
${footer}
|
|
190
|
+
|
|
191
|
+
<tr>
|
|
192
|
+
<td
|
|
193
|
+
style="clear:both; padding-top: 20px; font-size:14px; line-height:18px; color:#ADADAD; text-align: justify; font-family: Arial;"
|
|
194
|
+
colspan="4">
|
|
195
|
+
Les informations contenues dans ce courrier électronique et ses pièces jointes sont confidentielles et couvertes par le secret professionnel. Si vous n'êtes pas le(s) destinataire(s) ou avez reçu ce courrier électronique par erreur, merci de bien vouloir supprimer l'email et d'en informer l'expéditeur dès que possible. Ce courrier électronique ne peut pas être divulgué, utilisé ou copié par quelqu'un d'autre que le(s) destinataire(s).
|
|
196
|
+
</td>
|
|
197
|
+
</tr>
|
|
198
|
+
</table>`;
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import * as dayjs from 'dayjs';
|
|
2
|
+
import { orderBy as orderByLodash } from 'lodash';
|
|
3
|
+
import { Role } from '../types/Enum/Role';
|
|
4
|
+
import { getBrandConfig } from './brands';
|
|
5
|
+
import { signatureTemplate } from './email/templates/signature';
|
|
6
|
+
|
|
7
|
+
const ejs = require('ejs');
|
|
8
|
+
|
|
9
|
+
function intersection<T>(arr: [T[], T[]]) { return arr.reduce((a: T[], b: T[]) => a.filter((c) => b.includes(c)), []); }
|
|
10
|
+
|
|
11
|
+
function getRoleSignature(user:any) {
|
|
12
|
+
if (user.positionLabel) return user.positionLabel;
|
|
13
|
+
|
|
14
|
+
const isStagiaireOrAlternant = user.roles.map((r: any) => r.id).includes(Role.INTERN) || user.roles.map((r: any) => r.id).includes(Role.ALTERNATE);
|
|
15
|
+
const isManager = user.roles.map((r: any) => r.id).includes(Role.MANAGER);
|
|
16
|
+
|
|
17
|
+
const isSocial = user.roles.map((r: any) => r.id).includes(Role.SOCIAL);
|
|
18
|
+
const isJuridic = user.roles.map((r: any) => r.id).includes(Role.JURIDIC);
|
|
19
|
+
const isFacturation = user.roles.map((r: any) => r.id).includes(Role.FACTURATION);
|
|
20
|
+
const isExpert = user.roles.map((r: any) => r.id).includes(Role.EXPERT_ACCOUNTANT);
|
|
21
|
+
const isCS = user.roles.map((r: any) => r.id).includes(Role.CUSTOMER_SUCCESS);
|
|
22
|
+
const isSales = user.roles.map((r: any) => r.id).includes(Role.COMMERCIAL);
|
|
23
|
+
const isAdmin = user.roles.map((r: any) => r.id).includes(Role.ADMIN);
|
|
24
|
+
const isFront = !!intersection([user.roles.map((r: any) => r.id), [Role.FRONT_OFFICE, Role.FRONT_OFFICE_EXPRESS]]).length;
|
|
25
|
+
|
|
26
|
+
if (isSales && isManager) { return 'Responsable commercial'; }
|
|
27
|
+
if (isSales) { return `Chargé${user.idCivility === 2 ? 'e' : ''} de clientèle`; }
|
|
28
|
+
|
|
29
|
+
if (isCS && isManager) { return 'Responsable de clientèle'; }
|
|
30
|
+
if (isCS) { return `Chargé${user.idCivility === 2 ? 'e' : ''} de clientèle`; }
|
|
31
|
+
|
|
32
|
+
if (isFacturation && isStagiaireOrAlternant) { return 'Assistant facturation'; }
|
|
33
|
+
if (isFacturation && isManager) { return 'Responsable facturation'; }
|
|
34
|
+
if (isFacturation) { return `Chargé${user.idCivility === 2 ? 'e' : ''} de facturation`; }
|
|
35
|
+
|
|
36
|
+
if (isJuridic && isStagiaireOrAlternant) { return 'Assistant juridique'; }
|
|
37
|
+
if (isJuridic && isManager) { return 'Responsable juridique'; }
|
|
38
|
+
if (isJuridic) { return 'Juriste'; }
|
|
39
|
+
|
|
40
|
+
if (isSocial && isStagiaireOrAlternant) { return 'Assistant paie'; }
|
|
41
|
+
if (isSocial && isManager) { return 'Responsable paie'; }
|
|
42
|
+
if (isSocial) { return 'Gestionnaire de paie'; }
|
|
43
|
+
|
|
44
|
+
if (isExpert) { return `Expert${user.idCivility === 2 ? 'e' : ''}-comptable`; }
|
|
45
|
+
|
|
46
|
+
if (isAdmin) { return 'Développeur web'; }
|
|
47
|
+
|
|
48
|
+
if (isFront && isManager) return 'Responsable comptable';
|
|
49
|
+
if (isFront && isStagiaireOrAlternant) return 'Assistant comptable';
|
|
50
|
+
if (isFront) return `Comptable dédié${user.idCivility === 2 ? 'e' : ''}`;
|
|
51
|
+
return `Comptable dédié${user.idCivility === 2 ? 'e' : ''}`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function getHoraires(user:any) { // On affiche les horaires uniquement pour les front, et pas pour les TVA
|
|
55
|
+
if (!intersection([user.roles.map((r: any) => r.id), [Role.FRONT_OFFICE, Role.FRONT_OFFICE_EXPRESS, Role.COMMERCIAL]]).length) return 'Du lundi au vendredi de 9h à 19h';
|
|
56
|
+
|
|
57
|
+
if (!user.workingSchedules.length) return 'Du lundi au vendredi de 9h à 19h';
|
|
58
|
+
|
|
59
|
+
let reducedSchedules = user.workingSchedules.reduce((acc: any, e:any, index: number) => {
|
|
60
|
+
const name = `${dayjs(e.morningStart, 'HH:mm:ss').format('HH:mm')}-${dayjs(e.afternoonEnd || e.morningEnd, 'HH:mm:ss').format('HH:mm')}`;
|
|
61
|
+
if (!acc[name]) acc[name] = [index];
|
|
62
|
+
else acc[name].push(index);
|
|
63
|
+
return acc;
|
|
64
|
+
}, {});
|
|
65
|
+
|
|
66
|
+
reducedSchedules = orderByLodash(reducedSchedules, (elem) => elem.length, ['desc']);
|
|
67
|
+
|
|
68
|
+
let resultHoraire = '';
|
|
69
|
+
let startH;
|
|
70
|
+
let startM;
|
|
71
|
+
let endH;
|
|
72
|
+
let endM;
|
|
73
|
+
let firstDayOfWeek;
|
|
74
|
+
let lastDayOfWeek;
|
|
75
|
+
|
|
76
|
+
reducedSchedules.forEach((schedule: any, index: number) => {
|
|
77
|
+
startH = dayjs(user.workingSchedules[schedule[0]].morningStart ? user.workingSchedules[schedule[0]].morningStart : user.workingSchedules[schedule[0]].afternoonStart, 'HH:mm:ss').get('hour');
|
|
78
|
+
startM = dayjs(user.workingSchedules[schedule[0]].morningStart ? user.workingSchedules[schedule[0]].morningStart : user.workingSchedules[schedule[0]].afternoonStart, 'HH:mm:ss').get('minute');
|
|
79
|
+
endH = dayjs(user.workingSchedules[schedule[0]].afternoonEnd || user.workingSchedules[schedule[0]].morningEnd, 'HH:mm:ss').get('hour');
|
|
80
|
+
endM = dayjs(user.workingSchedules[schedule[0]].afternoonEnd || user.workingSchedules[schedule[0]].morningEnd, 'HH:mm:ss').get('minute');
|
|
81
|
+
firstDayOfWeek = dayjs().locale('fr').day(user.workingSchedules[schedule[0]].idDay).format('dddd');
|
|
82
|
+
if (!index) {
|
|
83
|
+
// pour le premier index, on affiche l'amplitude horaire la plus commune, du XX au XX de Xh à Xh
|
|
84
|
+
lastDayOfWeek = dayjs().locale('fr').day(user.workingSchedules[user.workingSchedules.length - 1].idDay).format('dddd');
|
|
85
|
+
resultHoraire += `Du ${firstDayOfWeek} au ${lastDayOfWeek} de ${startH}h${startM > 0 ? startM : ''} à ${endH}h${endM > 0 ? endM : ''}`;
|
|
86
|
+
} else { // Fonctionnel si uniquement un jour par semaine avec des horaires différents
|
|
87
|
+
resultHoraire += `<br/>Le ${firstDayOfWeek} de ${startH}h${startM > 0 ? startM : ''} à ${endH}h${endM > 0 ? endM : ''}`;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
return resultHoraire;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function getMailSignature(user:any, idTypeBrand:number) {
|
|
94
|
+
const informatiqueMail = getBrandConfig({
|
|
95
|
+
...(idTypeBrand ? { idTypeBrand } : {}),
|
|
96
|
+
objectWaited: 'listMails.informatique',
|
|
97
|
+
}) as unknown as string;
|
|
98
|
+
const bonjourMail = getBrandConfig({
|
|
99
|
+
...(idTypeBrand ? { idTypeBrand } : {}),
|
|
100
|
+
objectWaited: 'listMails.bonjour',
|
|
101
|
+
}) as unknown as string;
|
|
102
|
+
|
|
103
|
+
if (user.roles.map((r: any) => r.id).includes(Role.ADMIN)) { return informatiqueMail; }
|
|
104
|
+
if (user && !!intersection([user.roles.map((r: any) => r.id), [Role.FRONT_OFFICE, Role.FRONT_OFFICE_EXPRESS, Role.COMMERCIAL]]).length) return user.email;
|
|
105
|
+
return bonjourMail;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function getPhoneSignature(user:any) {
|
|
109
|
+
if (user.phone !== '0383931414') { return user.phone.replace(/\B(?=(\d{2})+(?!\d))/g, ' '); }
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function generateSignature(params: any): string {
|
|
114
|
+
const {
|
|
115
|
+
forceRole = null, idTypeBrand = 1, ...otherParams
|
|
116
|
+
} = params;
|
|
117
|
+
let {
|
|
118
|
+
user,
|
|
119
|
+
} = otherParams;
|
|
120
|
+
|
|
121
|
+
const hostS3 = getBrandConfig({
|
|
122
|
+
idTypeBrand,
|
|
123
|
+
objectWaited: 'urlS3',
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const brandName = getBrandConfig({
|
|
127
|
+
...(idTypeBrand ? { idTypeBrand } : {}),
|
|
128
|
+
objectWaited: 'name',
|
|
129
|
+
}) as unknown as string;
|
|
130
|
+
const bonjourMail = getBrandConfig({
|
|
131
|
+
...(idTypeBrand ? { idTypeBrand } : {}),
|
|
132
|
+
objectWaited: 'listMails.bonjour',
|
|
133
|
+
}) as unknown as string;
|
|
134
|
+
const socialMail = getBrandConfig({
|
|
135
|
+
...(idTypeBrand ? { idTypeBrand } : {}),
|
|
136
|
+
objectWaited: 'listMails.social',
|
|
137
|
+
}) as unknown as string;
|
|
138
|
+
const supportMail = getBrandConfig({
|
|
139
|
+
...(idTypeBrand ? { idTypeBrand } : {}),
|
|
140
|
+
objectWaited: 'listMails.support',
|
|
141
|
+
}) as unknown as string;
|
|
142
|
+
const juridiqueMail = getBrandConfig({
|
|
143
|
+
...(idTypeBrand ? { idTypeBrand } : {}),
|
|
144
|
+
objectWaited: 'listMails.juridique',
|
|
145
|
+
}) as unknown as string;
|
|
146
|
+
const facturationMail = getBrandConfig({
|
|
147
|
+
...(idTypeBrand ? { idTypeBrand } : {}),
|
|
148
|
+
objectWaited: 'listMails.facturation',
|
|
149
|
+
}) as unknown as string;
|
|
150
|
+
const primaryColor = getBrandConfig({
|
|
151
|
+
...(idTypeBrand ? { idTypeBrand } : {}),
|
|
152
|
+
objectWaited: 'colors.primary',
|
|
153
|
+
}) as unknown as string;
|
|
154
|
+
const standardPhoneSignature = getBrandConfig({
|
|
155
|
+
...(idTypeBrand ? { idTypeBrand } : {}),
|
|
156
|
+
objectWaited: 'listPhones.contact',
|
|
157
|
+
}) as unknown as string;
|
|
158
|
+
const juridiquePhoneSignature = getBrandConfig({
|
|
159
|
+
...(idTypeBrand ? { idTypeBrand } : {}),
|
|
160
|
+
objectWaited: 'listPhones.juridique',
|
|
161
|
+
}) as unknown as string;
|
|
162
|
+
const socialPhoneSignature = getBrandConfig({
|
|
163
|
+
...(idTypeBrand ? { idTypeBrand } : {}),
|
|
164
|
+
objectWaited: 'listPhones.social',
|
|
165
|
+
}) as unknown as string;
|
|
166
|
+
|
|
167
|
+
let roleSignature: string | null;
|
|
168
|
+
let mailSignature: string | null;
|
|
169
|
+
let phoneSignature: string | boolean;
|
|
170
|
+
let horaires: string | null;
|
|
171
|
+
[roleSignature, mailSignature, phoneSignature, horaires] = ['Expert-Comptable', bonjourMail, false, 'Du lundi au vendredi de 9h à 19h'];
|
|
172
|
+
|
|
173
|
+
if (!user) { // Signature Clementine
|
|
174
|
+
user = {
|
|
175
|
+
firstname: `L'équipe ${brandName}`,
|
|
176
|
+
isAll: true,
|
|
177
|
+
};
|
|
178
|
+
roleSignature = '';
|
|
179
|
+
} else if (forceRole === 'social') { // Signature social
|
|
180
|
+
user = {
|
|
181
|
+
firstname: 'Service social',
|
|
182
|
+
isAll: true,
|
|
183
|
+
};
|
|
184
|
+
mailSignature = socialMail;
|
|
185
|
+
roleSignature = '';
|
|
186
|
+
phoneSignature = socialPhoneSignature;
|
|
187
|
+
} else if (forceRole === 'support') { // Signature support
|
|
188
|
+
user = {
|
|
189
|
+
firstname: 'Service Support',
|
|
190
|
+
isAll: true,
|
|
191
|
+
};
|
|
192
|
+
mailSignature = supportMail;
|
|
193
|
+
roleSignature = null;
|
|
194
|
+
} else if (forceRole === 'juridique') { // Signature juridique
|
|
195
|
+
user = {
|
|
196
|
+
firstname: 'Service juridique',
|
|
197
|
+
isAll: true,
|
|
198
|
+
};
|
|
199
|
+
mailSignature = juridiqueMail;
|
|
200
|
+
roleSignature = null;
|
|
201
|
+
phoneSignature = juridiquePhoneSignature;
|
|
202
|
+
} else if (forceRole === 'facturation') { // Signature facturation
|
|
203
|
+
user = {
|
|
204
|
+
firstname: 'Service facturation',
|
|
205
|
+
isAll: true,
|
|
206
|
+
};
|
|
207
|
+
mailSignature = facturationMail;
|
|
208
|
+
roleSignature = null;
|
|
209
|
+
phoneSignature = standardPhoneSignature;
|
|
210
|
+
} else if (user !== 0) { // Signature par défaut
|
|
211
|
+
roleSignature = getRoleSignature(user);
|
|
212
|
+
mailSignature = getMailSignature(user, idTypeBrand);
|
|
213
|
+
horaires = getHoraires(user);
|
|
214
|
+
phoneSignature = getPhoneSignature(user);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return ejs.render(signatureTemplate, {
|
|
218
|
+
forceRole,
|
|
219
|
+
brandName,
|
|
220
|
+
hostS3,
|
|
221
|
+
user,
|
|
222
|
+
roleSignature,
|
|
223
|
+
mailSignature,
|
|
224
|
+
phoneSignature,
|
|
225
|
+
standardPhoneSignature,
|
|
226
|
+
horaires,
|
|
227
|
+
primaryColor,
|
|
228
|
+
supportMail,
|
|
229
|
+
});
|
|
230
|
+
}
|
package/ts/utils/index.ts
CHANGED