ecotransac-shared-js 1.2.21 → 1.2.22

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 CHANGED
@@ -11,14 +11,11 @@ type Mandate$1 = {
11
11
  netOwnerPrice: number | null;
12
12
  leaseRightsPrice: number | null;
13
13
  businessAssetsPrice: number | null;
14
+ agencyFees: number;
14
15
  };
15
16
  declare const getNetPrice: (mandate: Mandate$1) => number;
16
- declare const getAgencyFees: (mandate: Mandate$1 & {
17
- agencyFeePercentage: number | null;
18
- }) => number;
19
- declare const getDisplayedPrice: (mandate: Mandate$1 & {
20
- agencyFeePercentage: number | null;
21
- }) => number;
17
+ declare const getAgencyFeesPercentage: (mandate: Mandate$1) => number;
18
+ declare const getDisplayedPrice: (mandate: Mandate$1) => number;
22
19
  declare const getIsLowPrice: (mandate: Mandate$1) => boolean;
23
20
 
24
21
  type Maybe<T> = T | null;
@@ -1012,4 +1009,4 @@ type TierStep = {
1012
1009
  declare const TIER_INFOS: TierStep[];
1013
1010
  declare const getTierInfo: (realizedRevenue: number) => TierStep;
1014
1011
 
1015
- export { COMPANY_INFO, CONDITIONS, COUNTRIES, type Condition, ESTATE_CONDITION, EXPOSURES, type Field, GENDER, HEATING_ENERGY, INSULATION_LEVELS, KITCHEN_TYPE, LEASE_ESTABLISHMENT, LEASE_TRANSFERT_PERMISSIONS, LEGAL_NATURE, LEGAL_STATUS, MANDATE_EXCLUSIVITY, MARITAL_STATUS, PRENUP_TYPES, RENOVATION_TYPES, SHARING_CONFIGURATION, STANDINGS, type SelectOption, type State, TIER_INFOS, VIEWS, and, contactFormFields, featuresFormFields, formatAddress, formatAgentLegalData, formatDate, formatMandateNumber, formatNumber, formatPhone, formatPrice, formatReference, formatRegistrationNumber, formatSeconds, getAgencyFees, getContactState, getDisplayedPrice, getFeesPercentage, getIsLowPrice, getLabel, getLowThreshold, getNetPrice, getPropertyState, getPropertyTitle, getRenovationState, getTierInfo, getValue, mandateFormFields, not, only, or, propertyFields, renovationFormFields, renovationProjectFormFields, renovationPropertyFormFields, shouldRender, surfacesFormFields, technicalFormFields };
1012
+ export { COMPANY_INFO, CONDITIONS, COUNTRIES, type Condition, ESTATE_CONDITION, EXPOSURES, type Field, GENDER, HEATING_ENERGY, INSULATION_LEVELS, KITCHEN_TYPE, LEASE_ESTABLISHMENT, LEASE_TRANSFERT_PERMISSIONS, LEGAL_NATURE, LEGAL_STATUS, MANDATE_EXCLUSIVITY, MARITAL_STATUS, PRENUP_TYPES, RENOVATION_TYPES, SHARING_CONFIGURATION, STANDINGS, type SelectOption, type State, TIER_INFOS, VIEWS, and, contactFormFields, featuresFormFields, formatAddress, formatAgentLegalData, formatDate, formatMandateNumber, formatNumber, formatPhone, formatPrice, formatReference, formatRegistrationNumber, formatSeconds, getAgencyFeesPercentage, getContactState, getDisplayedPrice, getFeesPercentage, getIsLowPrice, getLabel, getLowThreshold, getNetPrice, getPropertyState, getPropertyTitle, getRenovationState, getTierInfo, getValue, mandateFormFields, not, only, or, propertyFields, renovationFormFields, renovationProjectFormFields, renovationPropertyFormFields, shouldRender, surfacesFormFields, technicalFormFields };
package/dist/index.d.ts CHANGED
@@ -11,14 +11,11 @@ type Mandate$1 = {
11
11
  netOwnerPrice: number | null;
12
12
  leaseRightsPrice: number | null;
13
13
  businessAssetsPrice: number | null;
14
+ agencyFees: number;
14
15
  };
15
16
  declare const getNetPrice: (mandate: Mandate$1) => number;
16
- declare const getAgencyFees: (mandate: Mandate$1 & {
17
- agencyFeePercentage: number | null;
18
- }) => number;
19
- declare const getDisplayedPrice: (mandate: Mandate$1 & {
20
- agencyFeePercentage: number | null;
21
- }) => number;
17
+ declare const getAgencyFeesPercentage: (mandate: Mandate$1) => number;
18
+ declare const getDisplayedPrice: (mandate: Mandate$1) => number;
22
19
  declare const getIsLowPrice: (mandate: Mandate$1) => boolean;
23
20
 
24
21
  type Maybe<T> = T | null;
@@ -1012,4 +1009,4 @@ type TierStep = {
1012
1009
  declare const TIER_INFOS: TierStep[];
1013
1010
  declare const getTierInfo: (realizedRevenue: number) => TierStep;
1014
1011
 
1015
- export { COMPANY_INFO, CONDITIONS, COUNTRIES, type Condition, ESTATE_CONDITION, EXPOSURES, type Field, GENDER, HEATING_ENERGY, INSULATION_LEVELS, KITCHEN_TYPE, LEASE_ESTABLISHMENT, LEASE_TRANSFERT_PERMISSIONS, LEGAL_NATURE, LEGAL_STATUS, MANDATE_EXCLUSIVITY, MARITAL_STATUS, PRENUP_TYPES, RENOVATION_TYPES, SHARING_CONFIGURATION, STANDINGS, type SelectOption, type State, TIER_INFOS, VIEWS, and, contactFormFields, featuresFormFields, formatAddress, formatAgentLegalData, formatDate, formatMandateNumber, formatNumber, formatPhone, formatPrice, formatReference, formatRegistrationNumber, formatSeconds, getAgencyFees, getContactState, getDisplayedPrice, getFeesPercentage, getIsLowPrice, getLabel, getLowThreshold, getNetPrice, getPropertyState, getPropertyTitle, getRenovationState, getTierInfo, getValue, mandateFormFields, not, only, or, propertyFields, renovationFormFields, renovationProjectFormFields, renovationPropertyFormFields, shouldRender, surfacesFormFields, technicalFormFields };
1012
+ export { COMPANY_INFO, CONDITIONS, COUNTRIES, type Condition, ESTATE_CONDITION, EXPOSURES, type Field, GENDER, HEATING_ENERGY, INSULATION_LEVELS, KITCHEN_TYPE, LEASE_ESTABLISHMENT, LEASE_TRANSFERT_PERMISSIONS, LEGAL_NATURE, LEGAL_STATUS, MANDATE_EXCLUSIVITY, MARITAL_STATUS, PRENUP_TYPES, RENOVATION_TYPES, SHARING_CONFIGURATION, STANDINGS, type SelectOption, type State, TIER_INFOS, VIEWS, and, contactFormFields, featuresFormFields, formatAddress, formatAgentLegalData, formatDate, formatMandateNumber, formatNumber, formatPhone, formatPrice, formatReference, formatRegistrationNumber, formatSeconds, getAgencyFeesPercentage, getContactState, getDisplayedPrice, getFeesPercentage, getIsLowPrice, getLabel, getLowThreshold, getNetPrice, getPropertyState, getPropertyTitle, getRenovationState, getTierInfo, getValue, mandateFormFields, not, only, or, propertyFields, renovationFormFields, renovationProjectFormFields, renovationPropertyFormFields, shouldRender, surfacesFormFields, technicalFormFields };
package/dist/index.js CHANGED
@@ -64,7 +64,7 @@ __export(src_exports, {
64
64
  formatReference: () => formatReference,
65
65
  formatRegistrationNumber: () => formatRegistrationNumber,
66
66
  formatSeconds: () => formatSeconds,
67
- getAgencyFees: () => getAgencyFees,
67
+ getAgencyFeesPercentage: () => getAgencyFeesPercentage,
68
68
  getContactState: () => getContactState,
69
69
  getDisplayedPrice: () => getDisplayedPrice,
70
70
  getFeesPercentage: () => getFeesPercentage,
@@ -126,19 +126,14 @@ var getNetPrice = (mandate) => {
126
126
  }
127
127
  return netOwnerPrice;
128
128
  };
129
- var getAgencyFees = (mandate) => {
129
+ var getAgencyFeesPercentage = (mandate) => {
130
130
  const netPrice = getNetPrice(mandate);
131
- const isLowPrice = getIsLowPrice(mandate);
132
- const { agencyFeePercentage, isForProfessionalUse } = mandate;
133
- if (!isLowPrice && agencyFeePercentage === null)
134
- throw new Error("Missing agencyFeePercentage for high price mandate");
135
- const { limit, fees } = getLowThreshold(isForProfessionalUse);
136
- if (netPrice < limit) return fees;
137
- return (0, import_currency.default)(netPrice).multiply((agencyFeePercentage || 100) / 100).value;
131
+ const agencyFees = mandate.agencyFees || 0;
132
+ return Number((agencyFees / netPrice * 100).toFixed(2));
138
133
  };
139
134
  var getDisplayedPrice = (mandate) => {
140
135
  const netPrice = getNetPrice(mandate);
141
- const agencyFees = getAgencyFees(mandate);
136
+ const agencyFees = mandate.agencyFees || 0;
142
137
  return (0, import_currency.default)(netPrice).add(agencyFees).value;
143
138
  };
144
139
  var getIsLowPrice = (mandate) => {
@@ -1920,7 +1915,7 @@ var getTierInfo = (realizedRevenue) => {
1920
1915
  formatReference,
1921
1916
  formatRegistrationNumber,
1922
1917
  formatSeconds,
1923
- getAgencyFees,
1918
+ getAgencyFeesPercentage,
1924
1919
  getContactState,
1925
1920
  getDisplayedPrice,
1926
1921
  getFeesPercentage,
package/dist/index.mjs CHANGED
@@ -33,19 +33,14 @@ var getNetPrice = (mandate) => {
33
33
  }
34
34
  return netOwnerPrice;
35
35
  };
36
- var getAgencyFees = (mandate) => {
36
+ var getAgencyFeesPercentage = (mandate) => {
37
37
  const netPrice = getNetPrice(mandate);
38
- const isLowPrice = getIsLowPrice(mandate);
39
- const { agencyFeePercentage, isForProfessionalUse } = mandate;
40
- if (!isLowPrice && agencyFeePercentage === null)
41
- throw new Error("Missing agencyFeePercentage for high price mandate");
42
- const { limit, fees } = getLowThreshold(isForProfessionalUse);
43
- if (netPrice < limit) return fees;
44
- return currency(netPrice).multiply((agencyFeePercentage || 100) / 100).value;
38
+ const agencyFees = mandate.agencyFees || 0;
39
+ return Number((agencyFees / netPrice * 100).toFixed(2));
45
40
  };
46
41
  var getDisplayedPrice = (mandate) => {
47
42
  const netPrice = getNetPrice(mandate);
48
- const agencyFees = getAgencyFees(mandate);
43
+ const agencyFees = mandate.agencyFees || 0;
49
44
  return currency(netPrice).add(agencyFees).value;
50
45
  };
51
46
  var getIsLowPrice = (mandate) => {
@@ -1826,7 +1821,7 @@ export {
1826
1821
  formatReference,
1827
1822
  formatRegistrationNumber,
1828
1823
  formatSeconds,
1829
- getAgencyFees,
1824
+ getAgencyFeesPercentage,
1830
1825
  getContactState,
1831
1826
  getDisplayedPrice,
1832
1827
  getFeesPercentage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ecotransac-shared-js",
3
- "version": "1.2.21",
3
+ "version": "1.2.22",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "modules": "dist/index.mjs",