@silexpert/core 1.0.160 → 1.0.161

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.
@@ -19,20 +19,19 @@ const isExpress = idPrestationList => {
19
19
  return !!prestaList.isBack;
20
20
  };
21
21
  const calculateScoringOfPrestation = (idPrestationType, prestations) => {
22
+ const prestationsSignedPaid = prestations.filter(prestation => prestation.paid && prestation.signed && prestation.terminationList === null);
22
23
  // Get the list of prestations that are half price
23
24
  const prestationHalfPriceList = Object.values(_PrestationType.PrestationDetail).filter(p => p.isComptable && !p.isCatalog);
24
25
  const prestationHalfPriceIds = prestationHalfPriceList.map(t => t.id);
25
- // Get the number of points for the prestation
26
+ // Get the number of points for the new prestation
26
27
  const prestaDetails = Object.values(_PrestationType.PrestationDetail).find(prestaDetail => prestaDetail.id === idPrestationType);
27
28
  const numberPoint = (prestaDetails === null || prestaDetails === void 0 ? void 0 : prestaDetails.point) || 0;
28
- const prestationsExistIds = prestations.map(prestation => prestation.idPrestationList);
29
- // If one the prestation is in the list of prestations that are half price, return 50% of points
30
- if (prestationsExistIds.some(id => prestationHalfPriceIds.includes(id))) return Math.floor(numberPoint * 0.5);
31
- // Find the prestation with the same idPrestationList and they need to be paid and signed
32
- const samePrestation = prestations.filter(prestation => prestation.idPrestationList === idPrestationType && prestation.paid === true && prestation.signed === true && prestation.terminationList === null);
33
- // If there is no prestation with the same idPrestationList, return 100% of points
34
- if (samePrestation.length === 0) return numberPoint;
35
- return 0;
29
+ // Get list of prestations that are already done and check if one of them is in the list of prestations that are half price
30
+ const prestationsExistIds = prestationsSignedPaid.map(prestation => prestation.idPrestationList);
31
+ const prestationHalfPriceAlreadyDoneIds = prestationsExistIds.filter(id => prestationHalfPriceIds.includes(id));
32
+ // If one of the prestations already done is in the list of prestations that are half price and if the idPrestationType is in prestationHalfPriceIds, return 50% of points
33
+ if (prestationHalfPriceAlreadyDoneIds.length && prestationHalfPriceIds.includes(idPrestationType)) return Math.floor(numberPoint * 0.5);
34
+ return numberPoint;
36
35
  };
37
36
  exports.isOtherAccountingMissions = isOtherAccountingMissions;
38
37
  exports.isOtherJuridicalMissions = isOtherJuridicalMissions;
@@ -1 +1 @@
1
- {"version":3,"file":"prestation.js","names":["_PrestationType","require","isOtherAccountingMissions","idPrestationList","PrestationType","PREVISIONNEL","BILAN_INTERMEDIAIRE","AVANCE_OU_ABANDON_COMPTE_COURANT_ASSOCIE","AUTRE_MISSION_COMPTABLE","TVS","ETUDE_FISCALE","BILAN_PREVISIONNEL","includes","isOtherJuridicalMissions","isJuridique","isCatalog","GESTION_JURIDIQUE","isOtherSocialMission","AUTRE_MISSION_SOCIALE_HORS_PAIE","isAdditionalPresta","hidden","isOnlyPrevi","filter","idPL","PV_AG","length","isOnlySocial","FRUCTUPAIE","SOCIAL","isOnlyJuridic","isCreation","CREATION_SOCIETE","isExpress","prestationDetailValues","Object","values","PrestationDetail","prestaList","find","pr","id","isBack","calculateScoringOfPrestation","idPrestationType","prestations","prestationHalfPriceList","p","isComptable","prestationHalfPriceIds","map","t","prestaDetails","prestaDetail","numberPoint","point","prestationsExistIds","prestation","some","Math","floor","samePrestation","paid","signed","terminationList","exports"],"sources":["../../ts/utils/prestation.ts"],"sourcesContent":["import { IPrestation } from '../types';\nimport { PrestationDetail, PrestationType } from '../types/Enum/PrestationType';\n\nconst isOtherAccountingMissions = (idPrestationList: number): boolean => [\n PrestationType.PREVISIONNEL,\n PrestationType.BILAN_INTERMEDIAIRE,\n PrestationType.AVANCE_OU_ABANDON_COMPTE_COURANT_ASSOCIE,\n PrestationType.AUTRE_MISSION_COMPTABLE,\n PrestationType.TVS,\n PrestationType.ETUDE_FISCALE,\n PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList);\n\nconst isOtherJuridicalMissions = (isJuridique:boolean, isCatalog:boolean, idPrestationList: number): boolean => idPrestationList !== PrestationType.GESTION_JURIDIQUE && isCatalog && isJuridique;\n\nconst isOtherSocialMission = (idPrestationList: number): boolean => idPrestationList === PrestationType.AUTRE_MISSION_SOCIALE_HORS_PAIE;\n\nconst isAdditionalPresta = (hidden:boolean, isCatalog:boolean): boolean => !hidden && isCatalog;\n\nconst isOnlyPrevi = (idPrestationList: number[]):boolean => !idPrestationList.filter((idPL:number) => ![PrestationType.PREVISIONNEL, PrestationType.BILAN_PREVISIONNEL, PrestationType.PV_AG].includes(idPL)).length;\n\nconst isOnlySocial = (idPrestationList: number[]):boolean => !idPrestationList.filter((idPL:number) => ![PrestationType.FRUCTUPAIE, PrestationType.SOCIAL].includes(idPL)).length;\n\nconst isOnlyJuridic = (idPrestationList: number[]):boolean => !idPrestationList.filter((idPL:number) => ![PrestationType.GESTION_JURIDIQUE].includes(idPL)).length;\n\nconst isCreation = (idPrestationList: number[]):boolean => idPrestationList.includes(PrestationType.CREATION_SOCIETE);\n\nconst isExpress = (idPrestationList: number):boolean => {\n const prestationDetailValues = Object.values(PrestationDetail) as any;\n const prestaList = prestationDetailValues.find((pr:any) => pr.id === idPrestationList);\n return !!prestaList.isBack;\n};\n\nconst calculateScoringOfPrestation = (idPrestationType: PrestationType, prestations: IPrestation[]): number => {\n // Get the list of prestations that are half price\n const prestationHalfPriceList = Object.values(PrestationDetail).filter((p) => p.isComptable && !p.isCatalog);\n const prestationHalfPriceIds = prestationHalfPriceList.map((t) => t.id);\n\n // Get the number of points for the prestation\n const prestaDetails = Object.values(PrestationDetail).find((prestaDetail) => prestaDetail.id === idPrestationType);\n const numberPoint = prestaDetails?.point || 0;\n\n const prestationsExistIds = prestations.map((prestation) => prestation.idPrestationList);\n // If one the prestation is in the list of prestations that are half price, return 50% of points\n if (prestationsExistIds.some((id) => prestationHalfPriceIds.includes(id))) return Math.floor(numberPoint * 0.5);\n\n // Find the prestation with the same idPrestationList and they need to be paid and signed\n const samePrestation = prestations.filter((prestation) => (prestation.idPrestationList === idPrestationType) && (prestation.paid === true && prestation.signed === true && prestation.terminationList === null));\n\n // If there is no prestation with the same idPrestationList, return 100% of points\n if (samePrestation.length === 0) return numberPoint;\n\n return 0;\n};\n\nexport {\n isOtherAccountingMissions, isOtherJuridicalMissions, isAdditionalPresta, isOtherSocialMission, isOnlyPrevi, isOnlySocial, isOnlyJuridic, isCreation, isExpress, calculateScoringOfPrestation,\n};"],"mappings":";;;;;;AACA,IAAAA,eAAA,GAAAC,OAAA;AAEA,MAAMC,yBAAyB,GAAIC,gBAAwB,IAAc,CACvEC,8BAAc,CAACC,YAAY,EAC3BD,8BAAc,CAACE,mBAAmB,EAClCF,8BAAc,CAACG,wCAAwC,EACvDH,8BAAc,CAACI,uBAAuB,EACtCJ,8BAAc,CAACK,GAAG,EAClBL,8BAAc,CAACM,aAAa,EAC5BN,8BAAc,CAACO,kBAAkB,CAAC,CAACC,QAAQ,CAACT,gBAAgB,CAAC;AAE/D,MAAMU,wBAAwB,GAAGA,CAACC,WAAmB,EAAEC,SAAiB,EAAEZ,gBAAwB,KAAcA,gBAAgB,KAAKC,8BAAc,CAACY,iBAAiB,IAAID,SAAS,IAAID,WAAW;AAEjM,MAAMG,oBAAoB,GAAId,gBAAwB,IAAcA,gBAAgB,KAAKC,8BAAc,CAACc,+BAA+B;AAEvI,MAAMC,kBAAkB,GAAGA,CAACC,MAAc,EAAEL,SAAiB,KAAc,CAACK,MAAM,IAAIL,SAAS;AAE/F,MAAMM,WAAW,GAAIlB,gBAA0B,IAAa,CAACA,gBAAgB,CAACmB,MAAM,CAAEC,IAAW,IAAK,CAAC,CAACnB,8BAAc,CAACC,YAAY,EAAED,8BAAc,CAACO,kBAAkB,EAAEP,8BAAc,CAACoB,KAAK,CAAC,CAACZ,QAAQ,CAACW,IAAI,CAAC,CAAC,CAACE,MAAM;AAEpN,MAAMC,YAAY,GAAIvB,gBAA0B,IAAa,CAACA,gBAAgB,CAACmB,MAAM,CAAEC,IAAW,IAAK,CAAC,CAACnB,8BAAc,CAACuB,UAAU,EAAEvB,8BAAc,CAACwB,MAAM,CAAC,CAAChB,QAAQ,CAACW,IAAI,CAAC,CA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EACxF;EACA,IAAIoD,mBAAmB,CAACE,IAAI,CAAEjB,EAAE,IAAKQ,sBAAsB,CAACpC,QAAQ,CAAC4B,EAAE,CAAC,CAAC,EAAE,OAAOkB,IAAI,CAACC,KAAK,CAACN,WAAW,GAAG,GAAG,CAAC;EAE/G;EACA,MAAMO,cAAc,GAAGhB,WAAW,CAACtB,MAAM,CAAEkC,UAAU,IAAMA,UAAU,CAACrD,gBAAgB,KAAKwC,gBAAgB,IAAMa,UAAU,CAACK,IAAI,KAAK,IAAI,IAAIL,UAAU,CAACM,MAAM,KAAK,IAAI,IAAIN,UAAU,CAACO,eAAe,KAAK,IAAK,CAAC;EAEhN;EACA,IAAIH,cAAc,CAACnC,MAAM,KAAK,CAAC,EAAE,OAAO4B,WAAW;EAEnD,OAAO,CAAC;AACV,CAAC;AAACW,OAAA,CAGA9D,yBAAyB,GAAzBA,yBAAyB;AAAA8D,OAAA,CAAEnD,wBAAwB,GAAxBA,wBAAwB;AAAAmD,OAAA,CAAE7C,kBAAkB,GAAlBA,kBAAkB;AAAA6C,OAAA,CAAE/C,oBAAoB,GAApBA,oBAAoB;AAAA+C,OAAA,CAAE3C,WAAW,GAAXA,WAAW;AAAA2C,OAAA,CAAEtC,YAAY,GAAZA,YAAY;AAAAsC,OAAA,CAAEnC,aAAa,GAAbA,aAAa;AAAAmC,OAAA,CAAElC,UAAU,GAAVA,UAAU;AAAAkC,OAAA,CAAEhC,SAAS,GAATA,SAAS;AAAAgC,OAAA,CAAEtB,4BAA4B,GAA5BA,4BAA4B"}
1
+ {"version":3,"file":"prestation.js","names":["_PrestationType","require","isOtherAccountingMissions","idPrestationList","PrestationType","PREVISIONNEL","BILAN_INTERMEDIAIRE","AVANCE_OU_ABANDON_COMPTE_COURANT_ASSOCIE","AUTRE_MISSION_COMPTABLE","TVS","ETUDE_FISCALE","BILAN_PREVISIONNEL","includes","isOtherJuridicalMissions","isJuridique","isCatalog","GESTION_JURIDIQUE","isOtherSocialMission","AUTRE_MISSION_SOCIALE_HORS_PAIE","isAdditionalPresta","hidden","isOnlyPrevi","filter","idPL","PV_AG","length","isOnlySocial","FRUCTUPAIE","SOCIAL","isOnlyJuridic","isCreation","CREATION_SOCIETE","isExpress","prestationDetailValues","Object","values","PrestationDetail","prestaList","find","pr","id","isBack","calculateScoringOfPrestation","idPrestationType","prestations","prestationsSignedPaid","prestation","paid","signed","terminationList","prestationHalfPriceList","p","isComptable","prestationHalfPriceIds","map","t","prestaDetails","prestaDetail","numberPoint","point","prestationsExistIds","prestationHalfPriceAlreadyDoneIds","Math","floor","exports"],"sources":["../../ts/utils/prestation.ts"],"sourcesContent":["import { IPrestation } from '../types';\nimport { PrestationDetail, PrestationType } from '../types/Enum/PrestationType';\n\nconst isOtherAccountingMissions = (idPrestationList: number): boolean => [\n PrestationType.PREVISIONNEL,\n PrestationType.BILAN_INTERMEDIAIRE,\n PrestationType.AVANCE_OU_ABANDON_COMPTE_COURANT_ASSOCIE,\n PrestationType.AUTRE_MISSION_COMPTABLE,\n PrestationType.TVS,\n PrestationType.ETUDE_FISCALE,\n PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList);\n\nconst isOtherJuridicalMissions = (isJuridique:boolean, isCatalog:boolean, idPrestationList: number): boolean => idPrestationList !== PrestationType.GESTION_JURIDIQUE && isCatalog && isJuridique;\n\nconst isOtherSocialMission = (idPrestationList: number): boolean => idPrestationList === PrestationType.AUTRE_MISSION_SOCIALE_HORS_PAIE;\n\nconst isAdditionalPresta = (hidden:boolean, isCatalog:boolean): boolean => !hidden && isCatalog;\n\nconst isOnlyPrevi = (idPrestationList: number[]):boolean => !idPrestationList.filter((idPL:number) => ![PrestationType.PREVISIONNEL, PrestationType.BILAN_PREVISIONNEL, PrestationType.PV_AG].includes(idPL)).length;\n\nconst isOnlySocial = (idPrestationList: number[]):boolean => !idPrestationList.filter((idPL:number) => ![PrestationType.FRUCTUPAIE, PrestationType.SOCIAL].includes(idPL)).length;\n\nconst isOnlyJuridic = (idPrestationList: number[]):boolean => !idPrestationList.filter((idPL:number) => ![PrestationType.GESTION_JURIDIQUE].includes(idPL)).length;\n\nconst isCreation = (idPrestationList: number[]):boolean => idPrestationList.includes(PrestationType.CREATION_SOCIETE);\n\nconst isExpress = (idPrestationList: number):boolean => {\n const prestationDetailValues = Object.values(PrestationDetail) as any;\n const prestaList = prestationDetailValues.find((pr:any) => pr.id === idPrestationList);\n return !!prestaList.isBack;\n};\n\nconst calculateScoringOfPrestation = (idPrestationType: PrestationType, prestations: IPrestation[]): number => {\n const prestationsSignedPaid = prestations.filter((prestation) => prestation.paid && prestation.signed && prestation.terminationList === null);\n\n // Get the list of prestations that are half price\n const prestationHalfPriceList = Object.values(PrestationDetail).filter((p) => p.isComptable && !p.isCatalog);\n const prestationHalfPriceIds = prestationHalfPriceList.map((t) => t.id);\n\n // Get the number of points for the new prestation\n const prestaDetails = Object.values(PrestationDetail).find((prestaDetail) => prestaDetail.id === idPrestationType);\n const numberPoint = prestaDetails?.point || 0;\n\n // Get list of prestations that are already done and check if one of them is in the list of prestations that are half price\n const prestationsExistIds = prestationsSignedPaid.map((prestation) => prestation.idPrestationList);\n const prestationHalfPriceAlreadyDoneIds = prestationsExistIds.filter((id) => prestationHalfPriceIds.includes(id));\n\n // If one of the prestations already done is in the list of prestations that are half price and if the idPrestationType is in prestationHalfPriceIds, return 50% of points\n if (prestationHalfPriceAlreadyDoneIds.length && prestationHalfPriceIds.includes(idPrestationType)) return Math.floor(numberPoint * 0.5);\n\n return numberPoint;\n};\n\nexport {\n isOtherAccountingMissions, isOtherJuridicalMissions, isAdditionalPresta, isOtherSocialMission, isOnlyPrevi, isOnlySocial, isOnlyJuridic, isCreation, isExpress, calculateScoringOfPrestation,\n};"],"mappings":";;;;;;AACA,IAAAA,eAAA,GAAAC,OAAA;AAEA,MAAMC,yBAAyB,GAAIC,gBAAwB,IAAc,CACvEC,8BAAc,CAACC,YAAY,EAC3BD,8BAAc,CAACE,mBAAmB,EAClCF,8BAAc,CAACG,wCAAw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4B,sBAAsB,CAACzC,QAAQ,CAAC+B,gBAAgB,CAAC,EAAE,OAAOmB,IAAI,CAACC,KAAK,CAACL,WAAW,GAAG,GAAG,CAAC;EAEvI,OAAOA,WAAW;AACpB,CAAC;AAACM,OAAA,CAGA9D,yBAAyB,GAAzBA,yBAAyB;AAAA8D,OAAA,CAAEnD,wBAAwB,GAAxBA,wBAAwB;AAAAmD,OAAA,CAAE7C,kBAAkB,GAAlBA,kBAAkB;AAAA6C,OAAA,CAAE/C,oBAAoB,GAApBA,oBAAoB;AAAA+C,OAAA,CAAE3C,WAAW,GAAXA,WAAW;AAAA2C,OAAA,CAAEtC,YAAY,GAAZA,YAAY;AAAAsC,OAAA,CAAEnC,aAAa,GAAbA,aAAa;AAAAmC,OAAA,CAAElC,UAAU,GAAVA,UAAU;AAAAkC,OAAA,CAAEhC,SAAS,GAATA,SAAS;AAAAgC,OAAA,CAAEtB,4BAA4B,GAA5BA,4BAA4B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "1.0.160",
3
+ "version": "1.0.161",
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
  "main": "js/index.js",
@@ -0,0 +1 @@
1
+ export const DateHolidays = ['2028-01-01', '2028-04-17', '2028-05-01', '2028-05-08', '2028-05-25', '2028-06-05', '2028-07-14', '2028-08-15', '2028-11-01', '2028-11-11', '2028-12-25', '2027-01-01', '2027-03-29', '2027-05-01', '2027-05-06', '2027-05-08', '2027-05-17', '2027-07-14', '2027-08-15', '2027-11-01', '2027-11-11', '2027-12-25', '2026-01-01', '2026-04-06', '2026-05-01', '2026-05-08', '2026-05-14', '2026-05-25', '2026-07-14', '2026-08-15', '2026-11-01', '2026-11-11', '2026-12-25', '2025-01-01', '2025-04-21', '2025-05-01', '2025-05-08', '2025-05-29', '2025-06-09', '2025-07-14', '2025-08-15', '2025-11-01', '2025-11-11', '2025-12-25', '2024-01-01', '2024-04-01', '2024-05-01', '2024-05-08', '2024-05-09', '2024-05-20', '2024-07-14', '2024-08-15', '2024-11-01', '2024-11-11', '2024-12-25', '2023-01-01', '2023-04-10', '2023-05-01', '2023-05-08', '2023-05-18', '2023-05-29', '2023-07-14', '2023-08-15', '2023-11-01', '2023-11-11', '2023-12-25'];
@@ -255,7 +255,7 @@ export const PrestationDetail: PrestationDetailEnum = {
255
255
  isComplementary: false,
256
256
  signaturePosition: '400,54,569,90',
257
257
  signaturePage: 5,
258
- point: 0,
258
+ point: 125,
259
259
  },
260
260
  PREVISIONNEL: {
261
261
  id: 6,
package/ts/types/index.ts CHANGED
@@ -476,6 +476,7 @@ export * from './Enum/GeneralThirdParty';
476
476
  export * from './Enum/MailDomainType';
477
477
  export * from './Enum/TextMessageType';
478
478
  export * from './Enum/JobTitle';
479
+ export * from './Enum/Holidays';
479
480
 
480
481
  // Interfaces API
481
482
  export * from './Interface/api/partnerTransactionType/ReadPartnerTransactionType';
@@ -31,25 +31,24 @@ const isExpress = (idPrestationList: number):boolean => {
31
31
  };
32
32
 
33
33
  const calculateScoringOfPrestation = (idPrestationType: PrestationType, prestations: IPrestation[]): number => {
34
+ const prestationsSignedPaid = prestations.filter((prestation) => prestation.paid && prestation.signed && prestation.terminationList === null);
35
+
34
36
  // Get the list of prestations that are half price
35
37
  const prestationHalfPriceList = Object.values(PrestationDetail).filter((p) => p.isComptable && !p.isCatalog);
36
38
  const prestationHalfPriceIds = prestationHalfPriceList.map((t) => t.id);
37
39
 
38
- // Get the number of points for the prestation
40
+ // Get the number of points for the new prestation
39
41
  const prestaDetails = Object.values(PrestationDetail).find((prestaDetail) => prestaDetail.id === idPrestationType);
40
42
  const numberPoint = prestaDetails?.point || 0;
41
43
 
42
- const prestationsExistIds = prestations.map((prestation) => prestation.idPrestationList);
43
- // If one the prestation is in the list of prestations that are half price, return 50% of points
44
- if (prestationsExistIds.some((id) => prestationHalfPriceIds.includes(id))) return Math.floor(numberPoint * 0.5);
45
-
46
- // Find the prestation with the same idPrestationList and they need to be paid and signed
47
- const samePrestation = prestations.filter((prestation) => (prestation.idPrestationList === idPrestationType) && (prestation.paid === true && prestation.signed === true && prestation.terminationList === null));
44
+ // Get list of prestations that are already done and check if one of them is in the list of prestations that are half price
45
+ const prestationsExistIds = prestationsSignedPaid.map((prestation) => prestation.idPrestationList);
46
+ const prestationHalfPriceAlreadyDoneIds = prestationsExistIds.filter((id) => prestationHalfPriceIds.includes(id));
48
47
 
49
- // If there is no prestation with the same idPrestationList, return 100% of points
50
- if (samePrestation.length === 0) return numberPoint;
48
+ // If one of the prestations already done is in the list of prestations that are half price and if the idPrestationType is in prestationHalfPriceIds, return 50% of points
49
+ if (prestationHalfPriceAlreadyDoneIds.length && prestationHalfPriceIds.includes(idPrestationType)) return Math.floor(numberPoint * 0.5);
51
50
 
52
- return 0;
51
+ return numberPoint;
53
52
  };
54
53
 
55
54
  export {