ecotransac-shared-js 1.1.7 → 1.1.9
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/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +36 -0
- package/dist/index.mjs +35 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -874,7 +874,9 @@ declare const getLowThreshold: (isForPro: boolean) => {
|
|
|
874
874
|
declare const getFeesPercentage: (price: number, isForProfessionalUse: boolean) => 0 | 10 | 9 | 8 | 7 | 8.5 | 7.5 | 6.5 | 6 | 5;
|
|
875
875
|
type GetNetPriceMandate = Pick<Mandate, "isForProfessionalUse" | "isCommercialWallsSale" | "isBusinessAssetsTransfer" | "isLeaseRightsTransfer" | "netOwnerPrice" | "leaseRightsPrice" | "businessAssetsPrice">;
|
|
876
876
|
declare const getNetPrice: (mandate: GetNetPriceMandate) => number;
|
|
877
|
-
declare const getAgencyFees: (mandate:
|
|
877
|
+
declare const getAgencyFees: (mandate: GetNetPriceMandate & {
|
|
878
|
+
agencyFeePercentage: number;
|
|
879
|
+
}) => number;
|
|
878
880
|
|
|
879
881
|
declare const getLabel: <T>(list: {
|
|
880
882
|
value: T;
|
|
@@ -927,6 +929,9 @@ declare const LEASE_TRANSFERT_PERMISSIONS: SelectOption[];
|
|
|
927
929
|
declare const KITCHEN_TYPE: SelectOption[];
|
|
928
930
|
declare const HEATING_ENERGY: SelectOption[];
|
|
929
931
|
|
|
932
|
+
type StateType = Pick<Property, "isForProfessionalUse" | "propertyType" | "isOccupied" | "isCoOwnership" | "isHousingScheme" | "isBusinessAssetsTransfer" | "isLeaseRightsTransfer" | "isCommercialWallsSale" | "isDpeCompleted" | "isEnergyAuditCompleted" | "leaseEstablishedUnder" | "constructionYear">;
|
|
933
|
+
declare const getPropertyState: (property: StateType) => State;
|
|
934
|
+
|
|
930
935
|
declare const COMPANY_INFO: {
|
|
931
936
|
name: string;
|
|
932
937
|
contactEmail: string;
|
|
@@ -975,4 +980,4 @@ declare const MANDATE_EXCLUSIVITY: {
|
|
|
975
980
|
label: string;
|
|
976
981
|
}[];
|
|
977
982
|
|
|
978
|
-
export { COMPANY_INFO, CONDITIONS, COUNTRIES, ESTATE_CONDITION, EXPOSURES, GENDER, HEATING_ENERGY, IDENTIFICATION_DOCUMENTS, KITCHEN_TYPE, LEASE_ESTABLISHMENT, LEASE_TRANSFERT_PERMISSIONS, LEGAL_NATURE, MANDATE_EXCLUSIVITY, MARITAL_STATUS, PRENUP_TYPES, SHARING_CONFIGURATION, STANDINGS, VIEWS, featuresFormFields, formatAddress, formatAgentLegalData, formatDate, formatMandateNumber, formatNumber, formatPhone, formatPrice, formatSeconds, getAgencyFees, getFeesPercentage, getLabel, getLowThreshold, getNetPrice, getPropertyTitle, propertyFields, surfacesFormFields, technicalFormFields };
|
|
983
|
+
export { COMPANY_INFO, CONDITIONS, COUNTRIES, type Condition, ESTATE_CONDITION, EXPOSURES, type Field, GENDER, HEATING_ENERGY, IDENTIFICATION_DOCUMENTS, KITCHEN_TYPE, LEASE_ESTABLISHMENT, LEASE_TRANSFERT_PERMISSIONS, LEGAL_NATURE, MANDATE_EXCLUSIVITY, MARITAL_STATUS, PRENUP_TYPES, SHARING_CONFIGURATION, STANDINGS, type SelectOption, type State, VIEWS, featuresFormFields, formatAddress, formatAgentLegalData, formatDate, formatMandateNumber, formatNumber, formatPhone, formatPrice, formatSeconds, getAgencyFees, getFeesPercentage, getLabel, getLowThreshold, getNetPrice, getPropertyState, getPropertyTitle, propertyFields, surfacesFormFields, technicalFormFields };
|
package/dist/index.d.ts
CHANGED
|
@@ -874,7 +874,9 @@ declare const getLowThreshold: (isForPro: boolean) => {
|
|
|
874
874
|
declare const getFeesPercentage: (price: number, isForProfessionalUse: boolean) => 0 | 10 | 9 | 8 | 7 | 8.5 | 7.5 | 6.5 | 6 | 5;
|
|
875
875
|
type GetNetPriceMandate = Pick<Mandate, "isForProfessionalUse" | "isCommercialWallsSale" | "isBusinessAssetsTransfer" | "isLeaseRightsTransfer" | "netOwnerPrice" | "leaseRightsPrice" | "businessAssetsPrice">;
|
|
876
876
|
declare const getNetPrice: (mandate: GetNetPriceMandate) => number;
|
|
877
|
-
declare const getAgencyFees: (mandate:
|
|
877
|
+
declare const getAgencyFees: (mandate: GetNetPriceMandate & {
|
|
878
|
+
agencyFeePercentage: number;
|
|
879
|
+
}) => number;
|
|
878
880
|
|
|
879
881
|
declare const getLabel: <T>(list: {
|
|
880
882
|
value: T;
|
|
@@ -927,6 +929,9 @@ declare const LEASE_TRANSFERT_PERMISSIONS: SelectOption[];
|
|
|
927
929
|
declare const KITCHEN_TYPE: SelectOption[];
|
|
928
930
|
declare const HEATING_ENERGY: SelectOption[];
|
|
929
931
|
|
|
932
|
+
type StateType = Pick<Property, "isForProfessionalUse" | "propertyType" | "isOccupied" | "isCoOwnership" | "isHousingScheme" | "isBusinessAssetsTransfer" | "isLeaseRightsTransfer" | "isCommercialWallsSale" | "isDpeCompleted" | "isEnergyAuditCompleted" | "leaseEstablishedUnder" | "constructionYear">;
|
|
933
|
+
declare const getPropertyState: (property: StateType) => State;
|
|
934
|
+
|
|
930
935
|
declare const COMPANY_INFO: {
|
|
931
936
|
name: string;
|
|
932
937
|
contactEmail: string;
|
|
@@ -975,4 +980,4 @@ declare const MANDATE_EXCLUSIVITY: {
|
|
|
975
980
|
label: string;
|
|
976
981
|
}[];
|
|
977
982
|
|
|
978
|
-
export { COMPANY_INFO, CONDITIONS, COUNTRIES, ESTATE_CONDITION, EXPOSURES, GENDER, HEATING_ENERGY, IDENTIFICATION_DOCUMENTS, KITCHEN_TYPE, LEASE_ESTABLISHMENT, LEASE_TRANSFERT_PERMISSIONS, LEGAL_NATURE, MANDATE_EXCLUSIVITY, MARITAL_STATUS, PRENUP_TYPES, SHARING_CONFIGURATION, STANDINGS, VIEWS, featuresFormFields, formatAddress, formatAgentLegalData, formatDate, formatMandateNumber, formatNumber, formatPhone, formatPrice, formatSeconds, getAgencyFees, getFeesPercentage, getLabel, getLowThreshold, getNetPrice, getPropertyTitle, propertyFields, surfacesFormFields, technicalFormFields };
|
|
983
|
+
export { COMPANY_INFO, CONDITIONS, COUNTRIES, type Condition, ESTATE_CONDITION, EXPOSURES, type Field, GENDER, HEATING_ENERGY, IDENTIFICATION_DOCUMENTS, KITCHEN_TYPE, LEASE_ESTABLISHMENT, LEASE_TRANSFERT_PERMISSIONS, LEGAL_NATURE, MANDATE_EXCLUSIVITY, MARITAL_STATUS, PRENUP_TYPES, SHARING_CONFIGURATION, STANDINGS, type SelectOption, type State, VIEWS, featuresFormFields, formatAddress, formatAgentLegalData, formatDate, formatMandateNumber, formatNumber, formatPhone, formatPrice, formatSeconds, getAgencyFees, getFeesPercentage, getLabel, getLowThreshold, getNetPrice, getPropertyState, getPropertyTitle, propertyFields, surfacesFormFields, technicalFormFields };
|
package/dist/index.js
CHANGED
|
@@ -62,6 +62,7 @@ __export(src_exports, {
|
|
|
62
62
|
getLabel: () => getLabel,
|
|
63
63
|
getLowThreshold: () => getLowThreshold,
|
|
64
64
|
getNetPrice: () => getNetPrice,
|
|
65
|
+
getPropertyState: () => getPropertyState,
|
|
65
66
|
getPropertyTitle: () => getPropertyTitle,
|
|
66
67
|
propertyFields: () => propertyFields,
|
|
67
68
|
surfacesFormFields: () => surfacesFormFields,
|
|
@@ -768,6 +769,21 @@ var surfacesFormFields = [
|
|
|
768
769
|
props: { suffix: "m\xB2", tooltip: "1 hectare = 10 000 m\xB2" },
|
|
769
770
|
requiredFor: ["MANDATE_CREATION" /* MandateCreation */, "DIFFUSION" /* Diffusion */]
|
|
770
771
|
},
|
|
772
|
+
{
|
|
773
|
+
name: "roomCount",
|
|
774
|
+
fieldType: "number",
|
|
775
|
+
label: "Nombre de pi\xE8ce(s)",
|
|
776
|
+
condition: and(not("isLand"), not("isParking"), not("isBuilding")),
|
|
777
|
+
props: {
|
|
778
|
+
suffix: "pi\xE8ce(s)",
|
|
779
|
+
tooltip: "Inclure seulement : la pi\xE8ce principale + les chambres. Exemple : appartement 3 pi\xE8ces : un s\xE9jour, 2 chambres."
|
|
780
|
+
// TODO: isForProfessionalUse
|
|
781
|
+
// Inclure les surfaces utiles.
|
|
782
|
+
// <br />
|
|
783
|
+
// Exemple : plateau de 10 bureaux, 1 salle de réunion, une cuisine = 12
|
|
784
|
+
// pièces.
|
|
785
|
+
}
|
|
786
|
+
},
|
|
771
787
|
{
|
|
772
788
|
name: "bathroomsCount",
|
|
773
789
|
fieldType: "number",
|
|
@@ -873,6 +889,25 @@ var propertyFields = [
|
|
|
873
889
|
|
|
874
890
|
// src/static/property/state.ts
|
|
875
891
|
var import_date_fns2 = require("date-fns");
|
|
892
|
+
var getPropertyState = (property) => ({
|
|
893
|
+
isForProfessionalUse: Boolean(property.isForProfessionalUse),
|
|
894
|
+
isApartment: property.propertyType === "Appartement",
|
|
895
|
+
isHouse: property.propertyType === "Maison" || property.propertyType === "Villa" || property.propertyType === "Ch\xE2teau",
|
|
896
|
+
isLand: property.propertyType === "Terrain",
|
|
897
|
+
isBuilding: property.propertyType === "Immeuble",
|
|
898
|
+
isParking: property.propertyType.includes("Parking"),
|
|
899
|
+
isOccupied: property.isOccupied === true,
|
|
900
|
+
isCoOwnership: property.isCoOwnership === true,
|
|
901
|
+
isHousingScheme: property.isHousingScheme === true,
|
|
902
|
+
isBusinessAssetsTransfer: Boolean(property.isBusinessAssetsTransfer),
|
|
903
|
+
isLeaseRightsTransfer: Boolean(property.isLeaseRightsTransfer),
|
|
904
|
+
isCommercialWallsSale: Boolean(property.isCommercialWallsSale),
|
|
905
|
+
isDpeCompleted: Boolean(property.isDpeCompleted),
|
|
906
|
+
isEnergyAuditCompleted: Boolean(property.isEnergyAuditCompleted),
|
|
907
|
+
isNotaryDeed: property.leaseEstablishedUnder === "NOTARY_DEED",
|
|
908
|
+
isBuiltBefore1949: property.constructionYear ? (0, import_date_fns2.isBefore)(property.constructionYear, /* @__PURE__ */ new Date(1949)) : false,
|
|
909
|
+
isUnderTenYearsOld: property.constructionYear ? (0, import_date_fns2.isAfter)(property.constructionYear, (0, import_date_fns2.sub)(/* @__PURE__ */ new Date(), { years: 10 })) : false
|
|
910
|
+
});
|
|
876
911
|
|
|
877
912
|
// src/static/company-details.ts
|
|
878
913
|
var COMPANY_INFO = {
|
|
@@ -1296,6 +1331,7 @@ var MANDATE_EXCLUSIVITY = [
|
|
|
1296
1331
|
getLabel,
|
|
1297
1332
|
getLowThreshold,
|
|
1298
1333
|
getNetPrice,
|
|
1334
|
+
getPropertyState,
|
|
1299
1335
|
getPropertyTitle,
|
|
1300
1336
|
propertyFields,
|
|
1301
1337
|
surfacesFormFields,
|
package/dist/index.mjs
CHANGED
|
@@ -697,6 +697,21 @@ var surfacesFormFields = [
|
|
|
697
697
|
props: { suffix: "m\xB2", tooltip: "1 hectare = 10 000 m\xB2" },
|
|
698
698
|
requiredFor: ["MANDATE_CREATION" /* MandateCreation */, "DIFFUSION" /* Diffusion */]
|
|
699
699
|
},
|
|
700
|
+
{
|
|
701
|
+
name: "roomCount",
|
|
702
|
+
fieldType: "number",
|
|
703
|
+
label: "Nombre de pi\xE8ce(s)",
|
|
704
|
+
condition: and(not("isLand"), not("isParking"), not("isBuilding")),
|
|
705
|
+
props: {
|
|
706
|
+
suffix: "pi\xE8ce(s)",
|
|
707
|
+
tooltip: "Inclure seulement : la pi\xE8ce principale + les chambres. Exemple : appartement 3 pi\xE8ces : un s\xE9jour, 2 chambres."
|
|
708
|
+
// TODO: isForProfessionalUse
|
|
709
|
+
// Inclure les surfaces utiles.
|
|
710
|
+
// <br />
|
|
711
|
+
// Exemple : plateau de 10 bureaux, 1 salle de réunion, une cuisine = 12
|
|
712
|
+
// pièces.
|
|
713
|
+
}
|
|
714
|
+
},
|
|
700
715
|
{
|
|
701
716
|
name: "bathroomsCount",
|
|
702
717
|
fieldType: "number",
|
|
@@ -802,6 +817,25 @@ var propertyFields = [
|
|
|
802
817
|
|
|
803
818
|
// src/static/property/state.ts
|
|
804
819
|
import { isAfter, isBefore, sub } from "date-fns";
|
|
820
|
+
var getPropertyState = (property) => ({
|
|
821
|
+
isForProfessionalUse: Boolean(property.isForProfessionalUse),
|
|
822
|
+
isApartment: property.propertyType === "Appartement",
|
|
823
|
+
isHouse: property.propertyType === "Maison" || property.propertyType === "Villa" || property.propertyType === "Ch\xE2teau",
|
|
824
|
+
isLand: property.propertyType === "Terrain",
|
|
825
|
+
isBuilding: property.propertyType === "Immeuble",
|
|
826
|
+
isParking: property.propertyType.includes("Parking"),
|
|
827
|
+
isOccupied: property.isOccupied === true,
|
|
828
|
+
isCoOwnership: property.isCoOwnership === true,
|
|
829
|
+
isHousingScheme: property.isHousingScheme === true,
|
|
830
|
+
isBusinessAssetsTransfer: Boolean(property.isBusinessAssetsTransfer),
|
|
831
|
+
isLeaseRightsTransfer: Boolean(property.isLeaseRightsTransfer),
|
|
832
|
+
isCommercialWallsSale: Boolean(property.isCommercialWallsSale),
|
|
833
|
+
isDpeCompleted: Boolean(property.isDpeCompleted),
|
|
834
|
+
isEnergyAuditCompleted: Boolean(property.isEnergyAuditCompleted),
|
|
835
|
+
isNotaryDeed: property.leaseEstablishedUnder === "NOTARY_DEED",
|
|
836
|
+
isBuiltBefore1949: property.constructionYear ? isBefore(property.constructionYear, /* @__PURE__ */ new Date(1949)) : false,
|
|
837
|
+
isUnderTenYearsOld: property.constructionYear ? isAfter(property.constructionYear, sub(/* @__PURE__ */ new Date(), { years: 10 })) : false
|
|
838
|
+
});
|
|
805
839
|
|
|
806
840
|
// src/static/company-details.ts
|
|
807
841
|
var COMPANY_INFO = {
|
|
@@ -1224,6 +1258,7 @@ export {
|
|
|
1224
1258
|
getLabel,
|
|
1225
1259
|
getLowThreshold,
|
|
1226
1260
|
getNetPrice,
|
|
1261
|
+
getPropertyState,
|
|
1227
1262
|
getPropertyTitle,
|
|
1228
1263
|
propertyFields,
|
|
1229
1264
|
surfacesFormFields,
|