@bpd-library/utilities 1.4.1-beta.1 → 1.4.1-beta.2
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.
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { hasDatePassed } from '../../date';
|
|
2
2
|
const constructionNumberStatus = (constructionNumber) => {
|
|
3
|
-
const { projectPhase, availabilityStatus, propertyType
|
|
3
|
+
const { projectPhase, availabilityStatus, propertyType } = constructionNumber;
|
|
4
4
|
const { status: propertyTypeStatus } = propertyType || {};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (projectPhaseStatus === 'InPreparation')
|
|
5
|
+
const { status: apartmentBuildingStatus } = constructionNumber.apartmentBuilding || {};
|
|
6
|
+
const { status: projectPhaseStatus, isRental } = constructionNumber.projectPhase || {};
|
|
7
|
+
if (propertyTypeStatus === 'AssigningOn' || apartmentBuildingStatus === 'AssigningOn') {
|
|
8
|
+
return availabilityStatus === 'Reserved' ? 'Reserved' : 'AssigningOn';
|
|
9
|
+
}
|
|
10
|
+
if (projectPhaseStatus === 'InPreparation') {
|
|
12
11
|
return availabilityStatus === 'Reserved' ? 'Reserved' : 'InPreparation';
|
|
12
|
+
}
|
|
13
13
|
if (projectPhaseStatus === 'Sold')
|
|
14
14
|
return 'UnderConstruction';
|
|
15
15
|
switch (availabilityStatus) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"construction-number-status.js","sourceRoot":"","sources":["../../../src/extended-api-models/status/construction-number-status.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,wBAAwB,GAAG,CAC7B,kBAA8C,EACD,EAAE;IAC/C,MAAM,EAAE,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"construction-number-status.js","sourceRoot":"","sources":["../../../src/extended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CAAC,MAAM,CAAC;KAC3C;IAED,OAAO;AACX,CAAC,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC","sourcesContent":["import {\n ExtendedConstructionNumber,\n GeneratedConstructionNumberStatus,\n} from '../../api-utilities/api-utilities.types';\nimport { hasDatePassed } from '../../date';\n\nconst constructionNumberStatus = (\n constructionNumber: ExtendedConstructionNumber,\n): GeneratedConstructionNumberStatus | undefined => {\n const { projectPhase, availabilityStatus, propertyType } = constructionNumber;\n const { status: propertyTypeStatus } = propertyType || {};\n const { status: apartmentBuildingStatus } = constructionNumber.apartmentBuilding || {};\n const { status: projectPhaseStatus, isRental } = constructionNumber.projectPhase || {};\n\n if (propertyTypeStatus === 'AssigningOn' || apartmentBuildingStatus === 'AssigningOn') {\n return availabilityStatus === 'Reserved' ? 'Reserved' : 'AssigningOn';\n }\n\n if (projectPhaseStatus === 'InPreparation') {\n return availabilityStatus === 'Reserved' ? 'Reserved' : 'InPreparation';\n }\n\n if (projectPhaseStatus === 'Sold') return 'UnderConstruction';\n\n switch (availabilityStatus) {\n case 'Reserved':\n if (\n projectPhaseStatus === 'OnSale' &&\n projectPhase?.allocationDate &&\n hasDatePassed(projectPhase.allocationDate)\n ) {\n return 'InOption';\n }\n return 'Reserved';\n case 'InOption':\n return 'InOption';\n case 'Available':\n return 'Available';\n case 'Sold':\n return isRental ? 'Rented' : 'Sold';\n }\n\n return;\n};\n\nexport { constructionNumberStatus };\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bpd-library/utilities",
|
|
3
|
-
"version": "1.4.1-beta.
|
|
3
|
+
"version": "1.4.1-beta.2",
|
|
4
4
|
"description": "Description",
|
|
5
5
|
"url": "https://github.com/{repo name}",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "6810066130151f18a9ee42a4ac67d824d217b2d6",
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@atomify/core": "2.4.1",
|
|
51
51
|
"@atomify/hooks": "1.1.11",
|
|
52
52
|
"@atomify/jsx": "1.7.1",
|
|
53
53
|
"@atomify/kit": "1.1.11",
|
|
54
|
-
"@bpd-library/types": "^1.4.1-beta.
|
|
54
|
+
"@bpd-library/types": "^1.4.1-beta.2",
|
|
55
55
|
"qs": "^6.9.4",
|
|
56
56
|
"query-string": "5"
|
|
57
57
|
}
|