@silexpert/core 2.0.23-0 → 2.0.25

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 (49) hide show
  1. package/dist/api/resources/Dashboard.d.ts +2 -2
  2. package/dist/api/resources/Dashboard.d.ts.map +1 -1
  3. package/dist/api/resources/Dashboard.js +2 -2
  4. package/dist/api/resources/Dashboard.js.map +1 -1
  5. package/dist/api/resources/Exercice.d.ts +2 -8
  6. package/dist/api/resources/Exercice.d.ts.map +1 -1
  7. package/dist/api/resources/Exercice.js +2 -12
  8. package/dist/api/resources/Exercice.js.map +1 -1
  9. package/dist/api/resources/Transaction.d.ts +2 -2
  10. package/dist/api/resources/Transaction.d.ts.map +1 -1
  11. package/dist/api/resources/Transaction.js.map +1 -1
  12. package/dist/types/Enum/BalanceSheet.d.ts +1 -8
  13. package/dist/types/Enum/BalanceSheet.d.ts.map +1 -1
  14. package/dist/types/Enum/BalanceSheet.js +3 -11
  15. package/dist/types/Enum/BalanceSheet.js.map +1 -1
  16. package/dist/types/Enum/DashboardBlock.d.ts +2 -1
  17. package/dist/types/Enum/DashboardBlock.d.ts.map +1 -1
  18. package/dist/types/Enum/DashboardBlock.js +1 -0
  19. package/dist/types/Enum/DashboardBlock.js.map +1 -1
  20. package/dist/types/Enum/Ged.d.ts +2 -4
  21. package/dist/types/Enum/Ged.d.ts.map +1 -1
  22. package/dist/types/Enum/Ged.js +0 -12
  23. package/dist/types/Enum/Ged.js.map +1 -1
  24. package/dist/types/Interface/api/dashboard/QueryTopProviders.d.ts +7 -0
  25. package/dist/types/Interface/api/dashboard/QueryTopProviders.d.ts.map +1 -1
  26. package/dist/types/Interface/api/dashboard/QueryTopProviders.js +22 -0
  27. package/dist/types/Interface/api/dashboard/QueryTopProviders.js.map +1 -1
  28. package/dist/types/Interface/api/dashboard/ReadTopProviders.d.ts +10 -0
  29. package/dist/types/Interface/api/dashboard/ReadTopProviders.d.ts.map +1 -1
  30. package/dist/types/Interface/api/dashboard/ReadTopProviders.js +2 -0
  31. package/dist/types/Interface/api/dashboard/ReadTopProviders.js.map +1 -1
  32. package/dist/types/Interface/api/exercice/Create.d.ts +0 -4
  33. package/dist/types/Interface/api/exercice/Create.d.ts.map +1 -1
  34. package/dist/types/Interface/api/exercice/Create.js +0 -18
  35. package/dist/types/Interface/api/exercice/Create.js.map +1 -1
  36. package/dist/utils/commercialManagement/document.d.ts.map +1 -1
  37. package/dist/utils/commercialManagement/document.js +7 -2
  38. package/dist/utils/commercialManagement/document.js.map +1 -1
  39. package/package.json +3 -1
  40. package/ts/api/resources/Dashboard.ts +4 -4
  41. package/ts/api/resources/Exercice.ts +2 -16
  42. package/ts/api/resources/Transaction.ts +2 -1
  43. package/ts/types/Enum/BalanceSheet.ts +11 -19
  44. package/ts/types/Enum/DashboardBlock.ts +1 -0
  45. package/ts/types/Enum/Ged.ts +1 -13
  46. package/ts/types/Interface/api/dashboard/QueryTopProviders.ts +16 -0
  47. package/ts/types/Interface/api/dashboard/ReadTopProviders.ts +11 -0
  48. package/ts/types/Interface/api/exercice/Create.ts +0 -15
  49. package/ts/utils/commercialManagement/document.ts +9 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "2.0.23-0",
3
+ "version": "2.0.25",
4
4
  "description": "Silex Core perform HTTP Request and object binding. Silex core helps developers to retrieve and return formatted object",
5
5
  "homepage": "https://gitlab.compta-clementine.fr/dev/silex-api",
6
6
  "type": "module",
@@ -92,6 +92,7 @@
92
92
  },
93
93
  "dependencies": {
94
94
  "@types/geojson": "^7946.0.16",
95
+ "@types/sanitize-html": "^2.16.1",
95
96
  "axios": "1.13.6",
96
97
  "class-transformer": "^0.5.1",
97
98
  "class-validator": "^0.15.1",
@@ -100,6 +101,7 @@
100
101
  "libphonenumber-js": "^1.12.37",
101
102
  "lodash-es": "^4.17.23",
102
103
  "rxjs": "^7.8.2",
104
+ "sanitize-html": "^2.17.2",
103
105
  "sms-length": "^0.2.2",
104
106
  "stripe": "18.1.1"
105
107
  }
@@ -3,8 +3,6 @@ import {
3
3
  QueryBalanceBankAccount,
4
4
  QueryTurnoverProfitAndLoss,
5
5
  QueryTopBuys,
6
- QueryTopProviders,
7
- ReadTopProviders,
8
6
  ReadBalanceBankAccount,
9
7
  ReadTopBuys,
10
8
  QueryDeadline,
@@ -14,6 +12,8 @@ import {
14
12
  ReadVatDisbursed,
15
13
  QueryRecentActivity,
16
14
  ReadRecentActivity,
15
+ QueryTopThirdParties,
16
+ ReadTopThirdParty,
17
17
  } from '../../types/index.js';
18
18
 
19
19
  const ROUTE = 'dashboard';
@@ -30,8 +30,8 @@ export class Dashboard extends Resource {
30
30
  return this.axios.$get(`${ROUTE}/topBuys`, { params: dates });
31
31
  }
32
32
 
33
- getTopProviders(params: QueryTopProviders): Promise<ReadTopProviders[]> {
34
- return this.axios.$get(`${ROUTE}/topProviders`, { params });
33
+ getTopThirdParties(params: QueryTopThirdParties): Promise<ReadTopThirdParty[]> {
34
+ return this.axios.$get(`${ROUTE}/top-third-parties`, { params });
35
35
  }
36
36
 
37
37
  getDeadlines(params: QueryDeadline): Promise<ReadDeadline> {
@@ -7,8 +7,6 @@ import {
7
7
  UpdateOrCreateAdjustment,
8
8
  CreateProjectExercice,
9
9
  QuerySocietyExercice,
10
- GenerateProjectExercice,
11
- IGedFile,
12
10
  } from '../../types/index.js';
13
11
  import { Resource } from '../Resource.js';
14
12
 
@@ -45,8 +43,8 @@ export class Exercice extends Resource {
45
43
  return this.axios.$delete(`/exercices/${id}`);
46
44
  }
47
45
 
48
- generateBalanceSheetProject(idSociety: number, idExercice: number, params?: GenerateProjectExercice): Promise<boolean> {
49
- return this.axios.$post(`/societies/${idSociety}/exercices/${idExercice}/project/generate`, params);
46
+ generateBalanceSheetProject(idSociety: number, idExercice: number): Promise<boolean> {
47
+ return this.axios.$post(`/societies/${idSociety}/exercices/${idExercice}/project/generate`);
50
48
  }
51
49
 
52
50
  sendBalanceSheetProject(idSociety: number, idExercice: number, params: CreateProjectExercice): Promise<boolean> {
@@ -73,16 +71,4 @@ export class Exercice extends Resource {
73
71
  isFeasible(idExercice: number): Promise<boolean> {
74
72
  return this.axios.$get(`exercices/${idExercice}/is-feasible`);
75
73
  }
76
-
77
- checkProjectAcceptation(idSociety: number): Promise<IGedFile[]> {
78
- return this.axios.$get(`/societies/${idSociety}/project-acceptation`);
79
- }
80
-
81
- /**
82
- * @description This endpoint is only to send the preview project email for CADOR balanceSheet (on clementinier), the accountant will upload the document from cador directly in the GED and the project will be send to the client with the email template in brevo
83
- * For the other clients, the preview project will be send with the endpoint generateProject
84
- */
85
- sendProjectAcceptationEmail(idSociety: number, idExercice: number): Promise<void> {
86
- return this.axios.$post(`/societies/${idSociety}/exercices/${idExercice}/project/send-cador-preview-mail`);
87
- }
88
74
  }
@@ -26,6 +26,7 @@ import {
26
26
  ProcessVatTransaction,
27
27
  QuerySocietyTransactionGetBalance,
28
28
  ReadSocietyTransactionGetBalance,
29
+ UpdatedAccountingTransactions,
29
30
  } from '../../types/index.js';
30
31
 
31
32
  export class Transaction extends Resource {
@@ -77,7 +78,7 @@ export class Transaction extends Resource {
77
78
  annotate(id: number, data: UpdateAccountingTransaction): Promise<ReadFormattedAccountingTransaction> {
78
79
  return this.axios.$put(`/transactions/${id}`, data);
79
80
  }
80
- annotateAll(ids: number[], data: UpdateAccountingTransaction): Promise<ReadFormattedAccountingTransaction> {
81
+ annotateAll(ids: number[], data: UpdateAccountingTransaction): Promise<UpdatedAccountingTransactions> {
81
82
  return this.axios.$put('/transactions/annotate-all', { ids, data });
82
83
  }
83
84
  delete(idSociety: number, id: number): Promise<number> {
@@ -35,7 +35,6 @@ export enum BalanceSheetState {
35
35
  ABANDONED_FORECAST = 28,
36
36
  ESTABLISH_REFUSED = 29,
37
37
  STANDBY = 30,
38
- PROJECT_SENT = 31,
39
38
  }
40
39
 
41
40
  export const BalanceSheetDetails = [
@@ -85,13 +84,6 @@ export const BalanceSheetDetails = [
85
84
  textColor: 'red--text red--lighten-3',
86
85
  forRoles: [['front_office', 'manager'], ['front_office_express', 'manager'], ['expert']],
87
86
  },
88
- {
89
- text: 'Projet envoyé',
90
- value: BalanceSheetState.PROJECT_SENT,
91
- color: 'green',
92
- textColor: 'green--text',
93
- forRoles: [['admin'], ['super_admin'], ['controle_interne']],
94
- },
95
87
  {
96
88
  text: 'À superviser',
97
89
  value: BalanceSheetState.TO_SUPERVISE,
@@ -242,14 +234,14 @@ export const BalanceSheetDetails = [
242
234
  forRoles: [['front_office'], ['expert'], ['satisfaction']],
243
235
  },
244
236
  {
245
- text: 'Accepté SIE en l\'état',
237
+ text: "Accepté SIE en l'état",
246
238
  value: BalanceSheetState.ACCEPTED_BY_SIE_IN_STATE,
247
239
  color: 'green darken-3',
248
240
  colorText: 'green--text',
249
241
  forRoles: [['front_office'], ['expert']],
250
242
  },
251
243
  {
252
- text: 'Refus d\'établir',
244
+ text: "Refus d'établir",
253
245
  value: BalanceSheetState.ESTABLISH_REFUSED,
254
246
  color: 'orange darken-1',
255
247
  colorText: 'orange--text text--darken-1',
@@ -280,7 +272,7 @@ export const ForecastBalanceSheetDetails = [
280
272
  forRoles: [['front_office'], ['expert']],
281
273
  },
282
274
  {
283
- text: 'Prévisionnel d\' abandonné',
275
+ text: "Prévisionnel d' abandonné",
284
276
  value: BalanceSheetState.ABANDONED_FORECAST,
285
277
  color: 'green darken-3',
286
278
  colorText: 'green--text',
@@ -328,7 +320,7 @@ export type BalanceSheetList = BalanceSheetField[];
328
320
 
329
321
  export enum BalanceSheetLabel {
330
322
  CAPITAL_SOUSCRIT = 'Capital souscrit - non appelé',
331
- FRAIS_ETABLISSEMENT = 'Frais d\'établissement',
323
+ FRAIS_ETABLISSEMENT = "Frais d'établissement",
332
324
  CONCESSIONS_BREVETS = 'Concessions, brevets, licences, marques, procédés, logiciels, droits et valeurs similaires',
333
325
  FOND_COMMERCIAL = 'Fonds commercial',
334
326
  AUTRES_IMMOBILISATIONS_INCORPORELLES = 'Autres immobilisations inc.',
@@ -339,7 +331,7 @@ export enum BalanceSheetLabel {
339
331
  INSTALLATIONS_TECHNIQUES = 'Installations techniques, matériels, et outillage industriels',
340
332
  AUTRES_IMMOBILISATIONS_CORPORELLES = 'Autres immobilisations corp.',
341
333
  IMMOBILISATIONS_CORPORELLES_EN_COURS = 'Immobilisations corporelles en cours',
342
- TITRES_IMMOBILISES_DE_LACTIVITE = 'Titres immobilisés de l\'activité de portefeuille',
334
+ TITRES_IMMOBILISES_DE_LACTIVITE = "Titres immobilisés de l'activité de portefeuille",
343
335
  AVANCES_ET_ACOMPTES_CORPORELLES = 'Avances et acomptes',
344
336
  CREANCES_RATTACHEES_PARTICIPATIONS = 'Créances rattachées à des participations',
345
337
  AUTRES_TITRES_IMMOBILISES = 'Autres titres immobilisés',
@@ -358,7 +350,7 @@ export enum BalanceSheetLabel {
358
350
  VALEUR_MOBILIERE_PLACEMENT_ACTION_PROPRE = 'Actions propres',
359
351
  VALEUR_MOBILIERE_PLACEMENT = 'Valeurs mobilières de placement',
360
352
  DISPONIBILITES = 'Disponibilités',
361
- CHARGES_CONSTATEES_AVANCE = 'Charges constatées d\'avance',
353
+ CHARGES_CONSTATEES_AVANCE = "Charges constatées d'avance",
362
354
  TOTAL_2 = 'Total (II)',
363
355
  PRIMES_DE_REMBOURSEMENT_DES_EMPRUNTS = 'Primes de remboursement des emprunts (IV)',
364
356
  ECARTS_DE_CONVERSIONS = 'Ecarts de conversion Actif (V)',
@@ -732,15 +724,15 @@ export const BALANCE_SHEET_LIST_ACTIVE: BalanceSheetList = [
732
724
  export enum BalanceSheetPassiveLabel {
733
725
  CAPITAL = 'Capital (dont versé...)',
734
726
  RESERVE_LEGALE = 'Réserve légale',
735
- PRIMES_EMISSION = 'Primes d\'émission, de fusion, d\'apport',
727
+ PRIMES_EMISSION = "Primes d'émission, de fusion, d'apport",
736
728
  ECART_DE_REEVALUATION = 'Ecart de réévaluation',
737
- ECART_EQUIVALENCE = 'Ecart d\'équivalence',
729
+ ECART_EQUIVALENCE = "Ecart d'équivalence",
738
730
  RESERVES_STATUAIRES = 'Réserves statutaires ou contractuelles',
739
731
  RESERVES_REGLEMENTEES = 'Réserves réglementées',
740
732
  AUTRES_RESERVES = 'Autres',
741
733
  REPORT_A_NOUVEAU = 'Report à nouveau',
742
- RESULTAT_DE_L_EXERCICE = 'Résultat de l\'exercice (bénéfice ou perte)',
743
- SUBVENTIONS_INVESTISSEMENT = 'Subventions d\'investissement',
734
+ RESULTAT_DE_L_EXERCICE = "Résultat de l'exercice (bénéfice ou perte)",
735
+ SUBVENTIONS_INVESTISSEMENT = "Subventions d'investissement",
744
736
  PROVISIONS_REFLEMENTEES = 'Provisions réglementées',
745
737
  PROVISIONS_POUR_RISQUES = 'Provisions pour risques',
746
738
  PROVISIONS_POUR_CHARGES = 'Provisions pour charges',
@@ -753,7 +745,7 @@ export enum BalanceSheetPassiveLabel {
753
745
  DETTES_FISCALES_ET_SOCIALES = 'Dettes fiscales et sociales',
754
746
  DETTES_SUR_IMMOBILISATIONS_ET_COMPTES_RATTACHES = 'Dettes sur immobilisations et Comptes rattachés',
755
747
  AUTRES_DETTES = 'Autres dettes',
756
- PRODUITS_CONSTATES_D_AVANCE = 'Produits constatés d\'avance',
748
+ PRODUITS_CONSTATES_D_AVANCE = "Produits constatés d'avance",
757
749
  ECART_PASSIF = 'Ecarts de conversion passif (IV)',
758
750
  TOTAL_GENERAL = 'Total général (I+II+III+IV)',
759
751
  CONCOURS = '(1) Dont concours bancaires courants et soldes créditeurs de banques',
@@ -10,4 +10,5 @@ export enum DashboardBlock {
10
10
  CURRENT_VAT = 'CURRENT_VAT',
11
11
  ASSOCIATE_CURRENT_ACCOUNT = 'ASSOCIATE_CURRENT_ACCOUNT',
12
12
  RECURRENT_REVENUES = 'RECURRENT_REVENUES',
13
+ TOP_CUSTOMERS = 'TOP_CUSTOMERS',
13
14
  }
@@ -114,7 +114,7 @@ export enum TypeFile {
114
114
  AUTHORIZATION = 52,
115
115
  COMMERCIAL_LEASE_AND_RELEASE = 53,
116
116
  CLOSE_BALANCE_SHEET = 54,
117
- PLAQUETTE = 55, // Plaquette bilan comptable
117
+ PLAQUETTE = 55,
118
118
  BALANCE_SHEET_NOTE = 56,
119
119
  SUMMARY_NOTE = 57,
120
120
  STATUTES = 58,
@@ -174,8 +174,6 @@ export enum TypeFile {
174
174
  APPROVAL = 112, // Appro des comptes
175
175
  BANK_STATEMENT = 113, // Relevé bancaire
176
176
  CUSTOMER_REPORTING = 114, // reporting client (customerActivity)
177
- ACCOUNTING_CONSISTENCY_CHECK = 115, // Contrôle de cohérence
178
- ACCOUNTING_PREVIEW_PLAQUETTE = 116, // Preview plaquette comptable
179
177
  }
180
178
 
181
179
  /** @deprecated this is a legacy enum try to use TypeFile enum if you can or use both enum's */
@@ -993,14 +991,4 @@ Le montant de l’indemnité calculée`,
993
991
  name: 'Relevé bancaire',
994
992
  idGedFolder: GedFolder.BANK_STATEMENT,
995
993
  },
996
- [TypeFile.ACCOUNTING_CONSISTENCY_CHECK]: {
997
- typeFile: TypeFile.ACCOUNTING_CONSISTENCY_CHECK,
998
- name: 'Contrôle de cohérence',
999
- idGedFolder: GedFolder.FORMALISM,
1000
- },
1001
- [TypeFile.ACCOUNTING_PREVIEW_PLAQUETTE]: {
1002
- typeFile: TypeFile.ACCOUNTING_PREVIEW_PLAQUETTE,
1003
- name: 'Projet',
1004
- idGedFolder: GedFolder.CLOSE_BALANCE_SHEET,
1005
- }
1006
994
  };
@@ -1,5 +1,8 @@
1
+ import { ThirdPartyType } from '#types/Enum/ThirdPartyType.js';
1
2
  import { ApiProperty } from '@nestjs/swagger';
3
+ import { IsDateString } from 'class-validator';
2
4
 
5
+ /** @deprecated */
3
6
  export class QueryTopProviders {
4
7
  @ApiProperty()
5
8
  startDate: string | Date;
@@ -7,3 +10,16 @@ export class QueryTopProviders {
7
10
  @ApiProperty()
8
11
  endDate: string | Date;
9
12
  }
13
+
14
+ export class QueryTopThirdParties {
15
+ @ApiProperty()
16
+ @IsDateString()
17
+ startDate: string | Date;
18
+
19
+ @ApiProperty()
20
+ @IsDateString()
21
+ endDate: string | Date;
22
+
23
+ @ApiProperty({ enum: ThirdPartyType })
24
+ idThirdPartyType: ThirdPartyType;
25
+ }
@@ -1,3 +1,4 @@
1
+ /** @deprecated use ReadTopThirdParty */
1
2
  export class ReadTopProviders {
2
3
  icon: string;
3
4
  color: string;
@@ -7,6 +8,7 @@ export class ReadTopProviders {
7
8
  iconPNG: string;
8
9
  }
9
10
 
11
+ /** @deprecated use ReadTopThirdParty */
10
12
  export class ReadTopCustomers {
11
13
  icon: string;
12
14
  color: string;
@@ -15,3 +17,12 @@ export class ReadTopCustomers {
15
17
  amount: number;
16
18
  iconPNG: string;
17
19
  }
20
+
21
+ export type ReadTopThirdParty = {
22
+ icon: string;
23
+ color: string;
24
+ company: string;
25
+ idThirdParty: number;
26
+ amount: number;
27
+ iconPNG: string;
28
+ };
@@ -129,18 +129,3 @@ export class CreateProjectExercice {
129
129
  @IsOptional()
130
130
  files?: TFile[];
131
131
  }
132
-
133
- export class GenerateProjectExercice {
134
- @ApiPropertyOptional()
135
- @IsOptional()
136
- @IsBoolean()
137
- @ToBoolean()
138
- isPreview?: boolean;
139
-
140
-
141
- @ApiPropertyOptional()
142
- @IsOptional()
143
- @IsBoolean()
144
- @ToBoolean()
145
- withReporting?: boolean;
146
- }
@@ -24,6 +24,7 @@ import { internationalizationChoices, internationalizationConsistency } from './
24
24
  import ejs from 'ejs';
25
25
  import 'dayjs/locale/fr.js';
26
26
  import { orderBy, groupBy, sumBy, round, uniq } from 'lodash-es';
27
+ import sanitize from 'sanitize-html';
27
28
 
28
29
  type brandColorType = {
29
30
  primary: string;
@@ -148,10 +149,16 @@ export function generateCommercialDocument(
148
149
  header: ejs.render(commonTemplate.header, data),
149
150
  body: ejs.render(bodyTemplate, {
150
151
  ...data,
151
- comment: data.comment && typeof data.comment === 'string' ? data.comment?.replace(/\n/g, '<br/>') : null,
152
+ comment:
153
+ data.comment && typeof data.comment === 'string'
154
+ ? sanitize(data.comment?.replace(/\n/g, '<br/>'), { allowedTags: ['b', 'i', 'em', 'br', 'strong'] })
155
+ : null,
152
156
  products: data.products.map((p) => ({
153
157
  ...p,
154
- comment: p.comment && typeof p.comment === 'string' ? p.comment?.replace(/\n/g, '<br/>') : null,
158
+ comment:
159
+ p.comment && typeof p.comment === 'string'
160
+ ? sanitize(p.comment?.replace(/\n/g, '<br/>'), { allowedTags: ['b', 'i', 'em', 'br', 'strong'] })
161
+ : null,
155
162
  // @ts-expect-error
156
163
  unitFormatted: internationalizationConsistency(locale, p.unitFormatted, 'unit'),
157
164
  })),