@silexpert/core 1.1.185 → 1.1.186

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 (119) hide show
  1. package/dist/cjs/api/resources/Card.d.ts +2 -2
  2. package/dist/cjs/api/resources/Card.d.ts.map +1 -1
  3. package/dist/cjs/api/resources/Card.js +4 -4
  4. package/dist/cjs/api/resources/Card.js.map +1 -1
  5. package/dist/cjs/api/resources/Contest.d.ts +12 -0
  6. package/dist/cjs/api/resources/Contest.d.ts.map +1 -0
  7. package/dist/cjs/api/resources/Contest.js +43 -0
  8. package/dist/cjs/api/resources/Contest.js.map +1 -0
  9. package/dist/cjs/api/resources.d.ts +2 -0
  10. package/dist/cjs/api/resources.d.ts.map +1 -1
  11. package/dist/cjs/api/resources.js +2 -0
  12. package/dist/cjs/api/resources.js.map +1 -1
  13. package/dist/cjs/types/Enum/BrandClementine.d.ts +7 -0
  14. package/dist/cjs/types/Enum/BrandClementine.d.ts.map +1 -1
  15. package/dist/cjs/types/Enum/BrandClementine.js +3 -0
  16. package/dist/cjs/types/Enum/BrandClementine.js.map +1 -1
  17. package/dist/cjs/types/Enum/BrandPourcentage.d.ts +1 -1
  18. package/dist/cjs/types/Enum/BrandPourcentage.d.ts.map +1 -1
  19. package/dist/cjs/types/Enum/BrandPourcentage.js +29 -28
  20. package/dist/cjs/types/Enum/BrandPourcentage.js.map +1 -1
  21. package/dist/cjs/types/Enum/PriceGridPourcentage.js +48 -48
  22. package/dist/cjs/types/Enum/PriceGridPourcentage.js.map +1 -1
  23. package/dist/cjs/types/Interface/api/contest/Create.d.ts +26 -0
  24. package/dist/cjs/types/Interface/api/contest/Create.d.ts.map +1 -0
  25. package/dist/cjs/types/Interface/api/contest/Create.js +102 -0
  26. package/dist/cjs/types/Interface/api/contest/Create.js.map +1 -0
  27. package/dist/cjs/types/Interface/api/contest/Query.d.ts +7 -0
  28. package/dist/cjs/types/Interface/api/contest/Query.d.ts.map +1 -0
  29. package/dist/cjs/types/Interface/api/contest/Query.js +38 -0
  30. package/dist/cjs/types/Interface/api/contest/Query.js.map +1 -0
  31. package/dist/cjs/types/Interface/api/contest/Read.d.ts +6 -0
  32. package/dist/cjs/types/Interface/api/contest/Read.d.ts.map +1 -0
  33. package/dist/cjs/types/Interface/api/contest/Read.js +3 -0
  34. package/dist/cjs/types/Interface/api/contest/Read.js.map +1 -0
  35. package/dist/cjs/types/Interface/models/IUserContest.d.ts +20 -0
  36. package/dist/cjs/types/Interface/models/IUserContest.d.ts.map +1 -0
  37. package/dist/cjs/types/Interface/models/IUserContest.js +3 -0
  38. package/dist/cjs/types/Interface/models/IUserContest.js.map +1 -0
  39. package/dist/cjs/types/Interface/models/IVoteContest.d.ts +14 -0
  40. package/dist/cjs/types/Interface/models/IVoteContest.d.ts.map +1 -0
  41. package/dist/cjs/types/Interface/models/IVoteContest.js +3 -0
  42. package/dist/cjs/types/Interface/models/IVoteContest.js.map +1 -0
  43. package/dist/cjs/types/index.d.ts +5 -0
  44. package/dist/cjs/types/index.d.ts.map +1 -1
  45. package/dist/cjs/types/index.js +5 -0
  46. package/dist/cjs/types/index.js.map +1 -1
  47. package/dist/cjs/utils/email/templates/signature.d.ts.map +1 -1
  48. package/dist/cjs/utils/email/templates/signature.js +42 -10
  49. package/dist/cjs/utils/email/templates/signature.js.map +1 -1
  50. package/dist/cjs/utils/email.d.ts.map +1 -1
  51. package/dist/cjs/utils/email.js +9 -1
  52. package/dist/cjs/utils/email.js.map +1 -1
  53. package/dist/mjs/api/resources/Card.d.ts +2 -2
  54. package/dist/mjs/api/resources/Card.d.ts.map +1 -1
  55. package/dist/mjs/api/resources/Card.js +10 -4
  56. package/dist/mjs/api/resources/Card.js.map +1 -1
  57. package/dist/mjs/api/resources/Contest.d.ts +12 -0
  58. package/dist/mjs/api/resources/Contest.d.ts.map +1 -0
  59. package/dist/mjs/api/resources/Contest.js +39 -0
  60. package/dist/mjs/api/resources/Contest.js.map +1 -0
  61. package/dist/mjs/api/resources.d.ts +2 -0
  62. package/dist/mjs/api/resources.d.ts.map +1 -1
  63. package/dist/mjs/api/resources.js +2 -0
  64. package/dist/mjs/api/resources.js.map +1 -1
  65. package/dist/mjs/types/Enum/BrandClementine.d.ts +7 -0
  66. package/dist/mjs/types/Enum/BrandClementine.d.ts.map +1 -1
  67. package/dist/mjs/types/Enum/BrandClementine.js +3 -0
  68. package/dist/mjs/types/Enum/BrandClementine.js.map +1 -1
  69. package/dist/mjs/types/Enum/BrandPourcentage.d.ts +1 -1
  70. package/dist/mjs/types/Enum/BrandPourcentage.d.ts.map +1 -1
  71. package/dist/mjs/types/Enum/BrandPourcentage.js +29 -28
  72. package/dist/mjs/types/Enum/BrandPourcentage.js.map +1 -1
  73. package/dist/mjs/types/Enum/PriceGridPourcentage.js +48 -48
  74. package/dist/mjs/types/Enum/PriceGridPourcentage.js.map +1 -1
  75. package/dist/mjs/types/Interface/api/contest/Create.d.ts +26 -0
  76. package/dist/mjs/types/Interface/api/contest/Create.d.ts.map +1 -0
  77. package/dist/mjs/types/Interface/api/contest/Create.js +114 -0
  78. package/dist/mjs/types/Interface/api/contest/Create.js.map +1 -0
  79. package/dist/mjs/types/Interface/api/contest/Query.d.ts +7 -0
  80. package/dist/mjs/types/Interface/api/contest/Query.d.ts.map +1 -0
  81. package/dist/mjs/types/Interface/api/contest/Query.js +38 -0
  82. package/dist/mjs/types/Interface/api/contest/Query.js.map +1 -0
  83. package/dist/mjs/types/Interface/api/contest/Read.d.ts +6 -0
  84. package/dist/mjs/types/Interface/api/contest/Read.d.ts.map +1 -0
  85. package/dist/mjs/types/Interface/api/contest/Read.js +2 -0
  86. package/dist/mjs/types/Interface/api/contest/Read.js.map +1 -0
  87. package/dist/mjs/types/Interface/models/IUserContest.d.ts +20 -0
  88. package/dist/mjs/types/Interface/models/IUserContest.d.ts.map +1 -0
  89. package/dist/mjs/types/Interface/models/IUserContest.js +2 -0
  90. package/dist/mjs/types/Interface/models/IUserContest.js.map +1 -0
  91. package/dist/mjs/types/Interface/models/IVoteContest.d.ts +14 -0
  92. package/dist/mjs/types/Interface/models/IVoteContest.d.ts.map +1 -0
  93. package/dist/mjs/types/Interface/models/IVoteContest.js +2 -0
  94. package/dist/mjs/types/Interface/models/IVoteContest.js.map +1 -0
  95. package/dist/mjs/types/index.d.ts +5 -0
  96. package/dist/mjs/types/index.d.ts.map +1 -1
  97. package/dist/mjs/types/index.js +5 -0
  98. package/dist/mjs/types/index.js.map +1 -1
  99. package/dist/mjs/utils/email/templates/signature.d.ts.map +1 -1
  100. package/dist/mjs/utils/email/templates/signature.js +42 -10
  101. package/dist/mjs/utils/email/templates/signature.js.map +1 -1
  102. package/dist/mjs/utils/email.d.ts.map +1 -1
  103. package/dist/mjs/utils/email.js +18 -1
  104. package/dist/mjs/utils/email.js.map +1 -1
  105. package/package.json +1 -1
  106. package/ts/api/resources/Card.ts +10 -4
  107. package/ts/api/resources/Contest.ts +47 -0
  108. package/ts/api/resources.ts +2 -0
  109. package/ts/types/Enum/BrandClementine.ts +3 -0
  110. package/ts/types/Enum/BrandPourcentage.ts +29 -28
  111. package/ts/types/Enum/PriceGridPourcentage.ts +48 -48
  112. package/ts/types/Interface/api/contest/Create.ts +69 -0
  113. package/ts/types/Interface/api/contest/Query.ts +20 -0
  114. package/ts/types/Interface/api/contest/Read.ts +6 -0
  115. package/ts/types/Interface/models/IUserContest.ts +22 -0
  116. package/ts/types/Interface/models/IVoteContest.ts +16 -0
  117. package/ts/types/index.ts +6 -1
  118. package/ts/utils/email/templates/signature.ts +43 -10
  119. package/ts/utils/email.ts +18 -1
@@ -0,0 +1,69 @@
1
+ import { IsOptional, IsBoolean } from 'class-validator';
2
+ import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
3
+ import { TFile } from '../file/TFile';
4
+ import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
5
+
6
+ export class CreateUserContest {
7
+ @ApiProperty()
8
+ firstname: string;
9
+
10
+ @ApiProperty()
11
+ lastname: string;
12
+
13
+ @ApiProperty()
14
+ email: string;
15
+
16
+ @ApiProperty()
17
+ phone: string;
18
+
19
+ @ApiProperty()
20
+ societyName: string;
21
+
22
+ @ApiProperty()
23
+ siren: string;
24
+
25
+ @ApiPropertyOptional()
26
+ productDescription?: string;
27
+
28
+ @ApiPropertyOptional()
29
+ societyDescription?: string;
30
+
31
+ @ApiPropertyOptional()
32
+ @IsOptional()
33
+ photo?: TFile;
34
+
35
+ @ApiPropertyOptional()
36
+ @IsOptional()
37
+ logo?: TFile;
38
+
39
+ @ApiPropertyOptional()
40
+ @IsOptional()
41
+ @IsBoolean()
42
+ @ToBoolean()
43
+ isTestMode?: boolean;
44
+
45
+ @ApiPropertyOptional()
46
+ recaptcha?: string;
47
+ }
48
+
49
+ export class CreateCheckVote {
50
+ @ApiProperty()
51
+ email: string;
52
+
53
+ @ApiProperty()
54
+ ipAddress: string;
55
+
56
+ @ApiProperty()
57
+ idVoter: number;
58
+
59
+ @ApiPropertyOptional()
60
+ recaptcha?: string;
61
+ }
62
+
63
+ export class CreateVoteContest {
64
+ @ApiProperty()
65
+ emailHash: string;
66
+
67
+ @ApiProperty()
68
+ userHash: string;
69
+ }
@@ -0,0 +1,20 @@
1
+ import { IsBoolean, IsOptional } from 'class-validator';
2
+ import { ApiPropertyOptional } from '../../../../utils';
3
+ import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
4
+
5
+ export class QueryFetchUserContest {
6
+ @ApiPropertyOptional()
7
+ search?: string;
8
+
9
+ @ApiPropertyOptional()
10
+ orderBy?: string;
11
+
12
+ @ApiPropertyOptional()
13
+ @IsBoolean()
14
+ @ToBoolean()
15
+ @IsOptional()
16
+ top?: boolean | null;
17
+
18
+ @ApiPropertyOptional()
19
+ idToExclude?: number;
20
+ }
@@ -0,0 +1,6 @@
1
+ import { IUserContest } from '../../models/IUserContest';
2
+
3
+ export type ReadVoteChecking = {
4
+ success: boolean;
5
+ existingVoteUser: IUserContest | null
6
+ };
@@ -0,0 +1,22 @@
1
+ import { IVoteContest } from './IVoteContest';
2
+
3
+ export interface IUserContest {
4
+ id?: number;
5
+ firstname: string;
6
+ lastname: string;
7
+ email: string;
8
+ hash: string;
9
+ phone: string;
10
+ societyName: string;
11
+ siren: string;
12
+ productDescription?: string | null;
13
+ societyDescription?: string | null;
14
+ tokenPhoto?: string | null;
15
+ tokenLogo?: string | null;
16
+ createdAt?: Date | null;
17
+ updatedAt?: Date | null;
18
+ deletedAt?: Date | null;
19
+
20
+ // associations
21
+ voteContests: IVoteContest[]
22
+ }
@@ -0,0 +1,16 @@
1
+ import { IUser } from '../..';
2
+
3
+ export interface IVoteContest {
4
+ id?: number;
5
+ emailVoter: string;
6
+ emailHash: string;
7
+ ipAddress: string;
8
+ hasVoteBeenCompleted: boolean
9
+ idUserVoteFor?: number | null;
10
+ createdAt?: Date | null;
11
+ updatedAt?: Date | null;
12
+ deletedAt?: Date | null;
13
+
14
+ // Associations
15
+ userVoteFor?: IUser;
16
+ }
package/ts/types/index.ts CHANGED
@@ -320,6 +320,9 @@ export * from './Interface/models/IBalanceSheetHistory';
320
320
  export * from './Interface/models/ICard';
321
321
  export * from './Interface/models/ICardHistory';
322
322
  export * from './Interface/models/IDubiousCustomer';
323
+ export * from './Interface/models/IUserContest';
324
+ export * from './Interface/models/IVoteContest';
325
+
323
326
 
324
327
  // Schemas
325
328
  export * from './Interface/schemas/IRegistrationDetail';
@@ -998,7 +1001,9 @@ export * from './Interface/api/card/QueryUserCardsStats';
998
1001
  export * from './Interface/api/card/UpdateCard';
999
1002
  export * from './Interface/api/notion/NotionResponse';
1000
1003
  export * from './Interface/api/IntermediateManagementRebate';
1001
-
1004
+ export * from './Interface/api/contest/Create';
1005
+ export * from './Interface/api/contest/Query';
1006
+ export * from './Interface/api/contest/Read';
1002
1007
  // Enums types
1003
1008
  export * from './Interface/enum/Util';
1004
1009
  export * from './Interface/enum/Date';
@@ -1,4 +1,15 @@
1
- const logoClementine = `<% if (brandName === 'Clementine') { %><tr>
1
+ const newIban = `<% if (commercialName === 'Clementine' && isFacturation) { %>
2
+ <p style="font-size: 15px; font-family: Arial; margin:0; padding:0px 0 4px; color:#6E6E71; margin-bottom: 10px; font-weight: bold;">
3
+ <span style="color: #A0A0A0">Nos coordonnées bancaires </span>IBAN : <%= iban %> - BIC : <%= bic %>
4
+ </p>
5
+ <% }else if (commercialName === 'Pourcentage' && [5, 7].includes(idTypeBrand)) { %>
6
+ <p style="font-size: 15px; font-family: Arial; margin:0; padding:0px 0 4px; color:#6E6E71; margin-bottom: 10px; font-weight: bold;">
7
+ <span style="color: #A0A0A0">Attention changement de RIB </span>IBAN : <%= iban %> - BIC : <%= bic %>
8
+ </p>
9
+ <% } %>
10
+ `;
11
+
12
+ const logoClementine = `<% if (commercialName === 'Clementine') { %><tr>
2
13
  <td
3
14
  colspan="3"
4
15
  class="logo"
@@ -17,17 +28,27 @@ const avatar = `<% if (!forceRole && user?.avatar?.token) { %>
17
28
  class="avatar"
18
29
  style="text-align:center; padding: 20px 0 20px 20px; position: relative;"
19
30
  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: 10px"
31
+ <% if(commercialName === 'Clementine') { %>
32
+ <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;">
33
+ <img
34
+ style="max-height: 90px;max-width: 90px; border-radius: 100%; margin-top: 10px"
35
+ alt="Avatar"
36
+ src="<%= hostS3 %>users/<%= user.id %>/<%= user.avatar.token %>"
37
+ />
38
+ </p>
39
+ <% } else { %>
40
+ <p style="padding: 20px;">
41
+ <img
42
+ style="max-height: 90px;max-width: 90px; border-radius: 100%; margin-top: 10px"
23
43
  alt="Avatar"
24
44
  src="<%= hostS3 %>users/<%= user.id %>/<%= user.avatar.token %>"
25
- />
26
- </p>
45
+ />
46
+ </p>
47
+ <% } %>
27
48
  </td>
28
49
  <% } %>`;
29
50
 
30
- const footer = `<% if(brandName === 'Clementine') { %>
51
+ const footer = `<% if(commercialName === 'Clementine') { %>
31
52
  <tr>
32
53
  <td
33
54
  style="clear:both; padding-top: 20px; font-size:17px; line-height:14px; color:#ADADAD; text-align: justify; font-family: Arial;"
@@ -95,7 +116,7 @@ const footer = `<% if(brandName === 'Clementine') { %>
95
116
  </table>
96
117
  </td>
97
118
  </tr>
98
- <% } else if(brandName === 'Pourcentage') { %>
119
+ <% } else if(commercialName === 'Pourcentage') { %>
99
120
  <tr>
100
121
  <td
101
122
  style="clear:both; padding-top: 20px; font-size:17px; line-height:14px; color:#ADADAD; text-align: justify; font-family: Arial;"
@@ -111,13 +132,25 @@ const footer = `<% if(brandName === 'Clementine') { %>
111
132
  alt="Connexion"> Connexion
112
133
  </a>
113
134
  </td>
135
+ <td style="text-align: right; vertical-align: middle; color: #6E6E71" width="430">
136
+ <span>Télécharger l'app</span>
137
+ <a href="https://apps.apple.com/fr/app/pourcentage-fr/id1631156043" target="_blank" style="vertical-align: middle; margin-left: 10px"><img
138
+ src="https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_appstore.png"
139
+ alt="App Store"
140
+ style="width: 20px"></a>
141
+ <a href="https://play.google.com/store/apps/details?id=com.clementine.pourcentage" target="_blank" style="vertical-align: middle; margin-left: 10px"><img
142
+ src="https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_playstore.png"
143
+ alt="Play Store"
144
+ style="width: 20px"></a>
145
+ </td>
146
+ </tr>
114
147
  </table>
115
148
  </td>
116
149
  </tr>
117
150
  <% } %>
118
151
  `;
119
152
 
120
- export const signatureTemplate = `<table
153
+ export const signatureTemplate = `${newIban}<table
121
154
  border="0"
122
155
  cellpadding="0"
123
156
  cellspacing="0"
@@ -179,7 +212,7 @@ ${logoClementine}
179
212
  <% if(user.calendlyUrl) { %>
180
213
  <a href="<%= user.calendlyUrl %>" style="display: inline-block; color:#6E6E71;" target="_blank">
181
214
  <img
182
- src="https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_rdv_tel<%= brandName === 'Pourcentage' ? '_pourcentage' : '' %>.png"
215
+ src="https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_rdv_tel<%= commercialName === 'Pourcentage' ? '_pourcentage' : '' %>.png"
183
216
  alt="Demande de rdv téléphonique">
184
217
  </a>
185
218
  <% } %>
package/ts/utils/email.ts CHANGED
@@ -166,6 +166,18 @@ export function generateSignature(params: any): string {
166
166
  ...(idTypeBrand ? { idTypeBrand } : {}),
167
167
  objectWaited: 'name',
168
168
  }) as unknown as string;
169
+ const commercialName = getBrandConfig({
170
+ ...(idTypeBrand ? { idTypeBrand } : {}),
171
+ objectWaited: 'commercialName',
172
+ }) as unknown as string;
173
+ const iban = getBrandConfig({
174
+ ...(idTypeBrand ? { idTypeBrand } : {}),
175
+ objectWaited: 'bank.IBAN',
176
+ }) as unknown as string;
177
+ const bic = getBrandConfig({
178
+ ...(idTypeBrand ? { idTypeBrand } : {}),
179
+ objectWaited: 'bank.BIC',
180
+ }) as unknown as string;
169
181
  const bonjourMail = getBrandConfig({
170
182
  ...(idTypeBrand ? { idTypeBrand } : {}),
171
183
  objectWaited: 'listMails.bonjour',
@@ -242,7 +254,7 @@ export function generateSignature(params: any): string {
242
254
  phoneSignature = standardPhoneSignature;
243
255
  } else if (!user) { // Signature Clementine
244
256
  user = {
245
- firstname: `L'équipe ${brandName}`,
257
+ firstname: `L'équipe ${commercialName}`,
246
258
  isAll: true,
247
259
  };
248
260
  roleSignature = '';
@@ -255,7 +267,12 @@ export function generateSignature(params: any): string {
255
267
 
256
268
  return ejs.render(signatureTemplate, {
257
269
  forceRole,
270
+ isFacturation: user.roles ? user.roles.some((r: any) => r.id === Role.FACTURATION) : false,
258
271
  brandName,
272
+ idTypeBrand,
273
+ commercialName,
274
+ iban,
275
+ bic,
259
276
  hostS3,
260
277
  user,
261
278
  roleSignature,