@bpd-library/utilities 1.3.2 → 1.3.3
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/geometry/geometry.d.ts +2 -1
- package/dist/geometry/geometry.js +5 -1
- package/dist/geometry/geometry.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/partition.d.ts +1 -0
- package/dist/partition.js +11 -0
- package/dist/partition.js.map +1 -0
- package/package.json +3 -3
- package/dist/api-utilities/compose-exclude-string.d.ts +0 -3
- package/dist/api-utilities/compose-exclude-string.js +0 -5
- package/dist/api-utilities/compose-exclude-string.js.map +0 -1
- package/dist/esm/api/http.js +0 -120
- package/dist/esm/api/http.js.map +0 -1
- package/dist/esm/api/index.js +0 -11
- package/dist/esm/api/index.js.map +0 -1
- package/dist/esm/api-utilities/compose-exclude-string.js +0 -6
- package/dist/esm/api-utilities/compose-exclude-string.js.map +0 -1
- package/dist/esm/api-utilities/decimal-range/merge-decimal-range.js +0 -13
- package/dist/esm/api-utilities/decimal-range/merge-decimal-range.js.map +0 -1
- package/dist/esm/api-utilities/decimal-range/merge-specification-range.js +0 -29
- package/dist/esm/api-utilities/decimal-range/merge-specification-range.js.map +0 -1
- package/dist/esm/api-utilities/district-status.js +0 -14
- package/dist/esm/api-utilities/district-status.js.map +0 -1
- package/dist/esm/api-utilities/find-filter.js +0 -41
- package/dist/esm/api-utilities/find-filter.js.map +0 -1
- package/dist/esm/api-utilities/get/coordinates.js +0 -31
- package/dist/esm/api-utilities/get/coordinates.js.map +0 -1
- package/dist/esm/api-utilities/get/layer-raster.js +0 -4
- package/dist/esm/api-utilities/get/layer-raster.js.map +0 -1
- package/dist/esm/api-utilities/show-mortgage-price.js +0 -11
- package/dist/esm/api-utilities/show-mortgage-price.js.map +0 -1
- package/dist/esm/api-utilities/show-price.js +0 -13
- package/dist/esm/api-utilities/show-price.js.map +0 -1
- package/dist/esm/constants/index.js +0 -7
- package/dist/esm/constants/index.js.map +0 -1
- package/dist/esm/date.js +0 -11
- package/dist/esm/date.js.map +0 -1
- package/dist/esm/debounce.js +0 -25
- package/dist/esm/debounce.js.map +0 -1
- package/dist/esm/dom/dom.js +0 -9
- package/dist/esm/dom/dom.js.map +0 -1
- package/dist/esm/environment.js +0 -27
- package/dist/esm/environment.js.map +0 -1
- package/dist/esm/extended-api-models/excluded-properties.js +0 -36
- package/dist/esm/extended-api-models/excluded-properties.js.map +0 -1
- package/dist/esm/extended-api-models/extended-area-projects.js +0 -12
- package/dist/esm/extended-api-models/extended-area-projects.js.map +0 -1
- package/dist/esm/extended-api-models/extended-area.js +0 -182
- package/dist/esm/extended-api-models/extended-area.js.map +0 -1
- package/dist/esm/extended-api-models/status/apartment-building-status.js +0 -60
- package/dist/esm/extended-api-models/status/apartment-building-status.js.map +0 -1
- package/dist/esm/extended-api-models/status/construction-number-status.js +0 -20
- package/dist/esm/extended-api-models/status/construction-number-status.js.map +0 -1
- package/dist/esm/extended-api-models/status/property-type-status.js +0 -60
- package/dist/esm/extended-api-models/status/property-type-status.js.map +0 -1
- package/dist/esm/extended-api-models/utilities/apartment-building-view.js +0 -5
- package/dist/esm/extended-api-models/utilities/apartment-building-view.js.map +0 -1
- package/dist/esm/extended-api-models/utilities/extended-model-price-range.js +0 -37
- package/dist/esm/extended-api-models/utilities/extended-model-price-range.js.map +0 -1
- package/dist/esm/extended-api-models/utilities/find-extended-object.js +0 -23
- package/dist/esm/extended-api-models/utilities/find-extended-object.js.map +0 -1
- package/dist/esm/extended-api-models/utilities/is-apartment.js +0 -14
- package/dist/esm/extended-api-models/utilities/is-apartment.js.map +0 -1
- package/dist/esm/function-is-true.js +0 -13
- package/dist/esm/function-is-true.js.map +0 -1
- package/dist/esm/generated/bpd-client.js +0 -53
- package/dist/esm/generated/bpd-client.js.map +0 -1
- package/dist/esm/geometry/country-bounding-box.js +0 -14
- package/dist/esm/geometry/country-bounding-box.js.map +0 -1
- package/dist/esm/geometry/geometry.js +0 -65
- package/dist/esm/geometry/geometry.js.map +0 -1
- package/dist/esm/hooks/use-click-outside.js +0 -34
- package/dist/esm/hooks/use-click-outside.js.map +0 -1
- package/dist/esm/hooks/use-form-changes.js +0 -30
- package/dist/esm/hooks/use-form-changes.js.map +0 -1
- package/dist/esm/hooks/use-history.js +0 -15
- package/dist/esm/hooks/use-history.js.map +0 -1
- package/dist/esm/hooks/use-keyboard-focus.js +0 -14
- package/dist/esm/hooks/use-keyboard-focus.js.map +0 -1
- package/dist/esm/hooks/use-lazy.js +0 -47
- package/dist/esm/hooks/use-lazy.js.map +0 -1
- package/dist/esm/hooks/use-map-storage.js +0 -16
- package/dist/esm/hooks/use-map-storage.js.map +0 -1
- package/dist/esm/hooks/use-scroll-position.js +0 -23
- package/dist/esm/hooks/use-scroll-position.js.map +0 -1
- package/dist/esm/hooks/use-scroll-to.js +0 -66
- package/dist/esm/hooks/use-scroll-to.js.map +0 -1
- package/dist/esm/hooks/use-stylesheet.js +0 -8
- package/dist/esm/hooks/use-stylesheet.js.map +0 -1
- package/dist/esm/hooks/use-url-params.js +0 -31
- package/dist/esm/hooks/use-url-params.js.map +0 -1
- package/dist/esm/index.js +0 -40
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/is-touch.js +0 -32
- package/dist/esm/is-touch.js.map +0 -1
- package/dist/esm/media-query/breakpoints.js +0 -29
- package/dist/esm/media-query/breakpoints.js.map +0 -1
- package/dist/esm/media-query/media-query.js +0 -39
- package/dist/esm/media-query/media-query.js.map +0 -1
- package/dist/esm/media-query/utils/index.js +0 -35
- package/dist/esm/media-query/utils/index.js.map +0 -1
- package/dist/esm/raf-throttle.js +0 -24
- package/dist/esm/raf-throttle.js.map +0 -1
- package/dist/esm/throttle.js +0 -23
- package/dist/esm/throttle.js.map +0 -1
- package/dist/esm/to-currency.js +0 -26
- package/dist/esm/to-currency.js.map +0 -1
- package/dist/extended-api-models/excluded-properties.d.ts +0 -5
- package/dist/extended-api-models/excluded-properties.js +0 -35
- package/dist/extended-api-models/excluded-properties.js.map +0 -1
- package/dist/hooks/use-form-changes.d.ts +0 -12
- package/dist/hooks/use-form-changes.js +0 -27
- package/dist/hooks/use-form-changes.js.map +0 -1
- package/dist/hooks/use-stylesheet.d.ts +0 -1
- package/dist/hooks/use-stylesheet.js +0 -5
- package/dist/hooks/use-stylesheet.js.map +0 -1
- package/dist/lib/api/http.js +0 -117
- package/dist/lib/api/http.js.map +0 -1
- package/dist/lib/api/index.js +0 -8
- package/dist/lib/api/index.js.map +0 -1
- package/dist/lib/api-utilities/api-utilities.js +0 -9
- package/dist/lib/api-utilities/api-utilities.js.map +0 -1
- package/dist/lib/api-utilities/api-utilities.test.js +0 -122
- package/dist/lib/api-utilities/api-utilities.test.js.map +0 -1
- package/dist/lib/api-utilities/api-utilities.types.js +0 -1
- package/dist/lib/api-utilities/api-utilities.types.js.map +0 -1
- package/dist/lib/api-utilities/compose-exclude-string.js +0 -5
- package/dist/lib/api-utilities/compose-exclude-string.js.map +0 -1
- package/dist/lib/api-utilities/decimal-range/merge-decimal-range.js +0 -12
- package/dist/lib/api-utilities/decimal-range/merge-decimal-range.js.map +0 -1
- package/dist/lib/api-utilities/decimal-range/merge-specification-range.js +0 -27
- package/dist/lib/api-utilities/decimal-range/merge-specification-range.js.map +0 -1
- package/dist/lib/api-utilities/district-status.js +0 -13
- package/dist/lib/api-utilities/district-status.js.map +0 -1
- package/dist/lib/api-utilities/find-filter.js +0 -40
- package/dist/lib/api-utilities/find-filter.js.map +0 -1
- package/dist/lib/api-utilities/get/coordinates.js +0 -29
- package/dist/lib/api-utilities/get/coordinates.js.map +0 -1
- package/dist/lib/api-utilities/get/layer-raster.js +0 -3
- package/dist/lib/api-utilities/get/layer-raster.js.map +0 -1
- package/dist/lib/api-utilities/index.js +0 -2
- package/dist/lib/api-utilities/index.js.map +0 -1
- package/dist/lib/api-utilities/show-mortgage-price.js +0 -10
- package/dist/lib/api-utilities/show-mortgage-price.js.map +0 -1
- package/dist/lib/api-utilities/show-price.js +0 -12
- package/dist/lib/api-utilities/show-price.js.map +0 -1
- package/dist/lib/constants/index.js +0 -5
- package/dist/lib/constants/index.js.map +0 -1
- package/dist/lib/date.js +0 -10
- package/dist/lib/date.js.map +0 -1
- package/dist/lib/debounce.js +0 -23
- package/dist/lib/debounce.js.map +0 -1
- package/dist/lib/dom/dom.js +0 -7
- package/dist/lib/dom/dom.js.map +0 -1
- package/dist/lib/dom/index.js +0 -2
- package/dist/lib/dom/index.js.map +0 -1
- package/dist/lib/environment.js +0 -25
- package/dist/lib/environment.js.map +0 -1
- package/dist/lib/extended-api-models/excluded-properties.js +0 -35
- package/dist/lib/extended-api-models/excluded-properties.js.map +0 -1
- package/dist/lib/extended-api-models/extended-area-projects.js +0 -10
- package/dist/lib/extended-api-models/extended-area-projects.js.map +0 -1
- package/dist/lib/extended-api-models/extended-area.js +0 -179
- package/dist/lib/extended-api-models/extended-area.js.map +0 -1
- package/dist/lib/extended-api-models/index.js +0 -7
- package/dist/lib/extended-api-models/index.js.map +0 -1
- package/dist/lib/extended-api-models/status/apartment-building-status.js +0 -58
- package/dist/lib/extended-api-models/status/apartment-building-status.js.map +0 -1
- package/dist/lib/extended-api-models/status/construction-number-status.js +0 -19
- package/dist/lib/extended-api-models/status/construction-number-status.js.map +0 -1
- package/dist/lib/extended-api-models/status/property-type-status.js +0 -58
- package/dist/lib/extended-api-models/status/property-type-status.js.map +0 -1
- package/dist/lib/extended-api-models/utilities/apartment-building-view.js +0 -4
- package/dist/lib/extended-api-models/utilities/apartment-building-view.js.map +0 -1
- package/dist/lib/extended-api-models/utilities/extended-model-price-range.js +0 -35
- package/dist/lib/extended-api-models/utilities/extended-model-price-range.js.map +0 -1
- package/dist/lib/extended-api-models/utilities/find-extended-object.js +0 -21
- package/dist/lib/extended-api-models/utilities/find-extended-object.js.map +0 -1
- package/dist/lib/extended-api-models/utilities/is-apartment.js +0 -13
- package/dist/lib/extended-api-models/utilities/is-apartment.js.map +0 -1
- package/dist/lib/function-is-true.js +0 -11
- package/dist/lib/function-is-true.js.map +0 -1
- package/dist/lib/generated/bpd-client.js +0 -50
- package/dist/lib/generated/bpd-client.js.map +0 -1
- package/dist/lib/generated/index.js +0 -2
- package/dist/lib/generated/index.js.map +0 -1
- package/dist/lib/geometry/country-bounding-box.js +0 -12
- package/dist/lib/geometry/country-bounding-box.js.map +0 -1
- package/dist/lib/geometry/geometry.js +0 -64
- package/dist/lib/geometry/geometry.js.map +0 -1
- package/dist/lib/geometry/geometry.test.js +0 -87
- package/dist/lib/geometry/geometry.test.js.map +0 -1
- package/dist/lib/geometry/index.js +0 -3
- package/dist/lib/geometry/index.js.map +0 -1
- package/dist/lib/hooks/index.js +0 -11
- package/dist/lib/hooks/index.js.map +0 -1
- package/dist/lib/hooks/use-click-outside.js +0 -32
- package/dist/lib/hooks/use-click-outside.js.map +0 -1
- package/dist/lib/hooks/use-delegate-listen.js +0 -10
- package/dist/lib/hooks/use-delegate-listen.js.map +0 -1
- package/dist/lib/hooks/use-form-changes.js +0 -27
- package/dist/lib/hooks/use-form-changes.js.map +0 -1
- package/dist/lib/hooks/use-history.js +0 -13
- package/dist/lib/hooks/use-history.js.map +0 -1
- package/dist/lib/hooks/use-input.js +0 -28
- package/dist/lib/hooks/use-input.js.map +0 -1
- package/dist/lib/hooks/use-keyboard-focus.js +0 -11
- package/dist/lib/hooks/use-keyboard-focus.js.map +0 -1
- package/dist/lib/hooks/use-lazy.js +0 -44
- package/dist/lib/hooks/use-lazy.js.map +0 -1
- package/dist/lib/hooks/use-map-storage.js +0 -14
- package/dist/lib/hooks/use-map-storage.js.map +0 -1
- package/dist/lib/hooks/use-scroll-position.js +0 -20
- package/dist/lib/hooks/use-scroll-position.js.map +0 -1
- package/dist/lib/hooks/use-scroll-to.js +0 -64
- package/dist/lib/hooks/use-scroll-to.js.map +0 -1
- package/dist/lib/hooks/use-stylesheet.js +0 -5
- package/dist/lib/hooks/use-stylesheet.js.map +0 -1
- package/dist/lib/hooks/use-text.js +0 -16
- package/dist/lib/hooks/use-text.js.map +0 -1
- package/dist/lib/hooks/use-url-params.js +0 -28
- package/dist/lib/hooks/use-url-params.js.map +0 -1
- package/dist/lib/index.js +0 -18
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/is-touch.js +0 -30
- package/dist/lib/is-touch.js.map +0 -1
- package/dist/lib/media-query/breakpoints.js +0 -27
- package/dist/lib/media-query/breakpoints.js.map +0 -1
- package/dist/lib/media-query/index.js +0 -2
- package/dist/lib/media-query/index.js.map +0 -1
- package/dist/lib/media-query/media-query.js +0 -36
- package/dist/lib/media-query/media-query.js.map +0 -1
- package/dist/lib/media-query/media-query.types.js +0 -1
- package/dist/lib/media-query/media-query.types.js.map +0 -1
- package/dist/lib/media-query/utils/index.js +0 -32
- package/dist/lib/media-query/utils/index.js.map +0 -1
- package/dist/lib/raf-throttle.js +0 -22
- package/dist/lib/raf-throttle.js.map +0 -1
- package/dist/lib/throttle.js +0 -22
- package/dist/lib/throttle.js.map +0 -1
- package/dist/lib/to-currency.js +0 -24
- package/dist/lib/to-currency.js.map +0 -1
- package/dist/types/api/http.d.ts +0 -47
- package/dist/types/api/index.d.ts +0 -2
- package/dist/types/api-utilities/api-utilities.d.ts +0 -8
- package/dist/types/api-utilities/api-utilities.test.d.ts +0 -1
- package/dist/types/api-utilities/api-utilities.types.d.ts +0 -46
- package/dist/types/api-utilities/compose-exclude-string.d.ts +0 -3
- package/dist/types/api-utilities/decimal-range/merge-decimal-range.d.ts +0 -3
- package/dist/types/api-utilities/decimal-range/merge-specification-range.d.ts +0 -13
- package/dist/types/api-utilities/district-status.d.ts +0 -3
- package/dist/types/api-utilities/find-filter.d.ts +0 -32
- package/dist/types/api-utilities/get/coordinates.d.ts +0 -6
- package/dist/types/api-utilities/get/layer-raster.d.ts +0 -3
- package/dist/types/api-utilities/index.d.ts +0 -1
- package/dist/types/api-utilities/show-mortgage-price.d.ts +0 -3
- package/dist/types/api-utilities/show-price.d.ts +0 -7
- package/dist/types/constants/index.d.ts +0 -4
- package/dist/types/date.d.ts +0 -3
- package/dist/types/debounce.d.ts +0 -5
- package/dist/types/dom/dom.d.ts +0 -6
- package/dist/types/dom/index.d.ts +0 -1
- package/dist/types/environment.d.ts +0 -9
- package/dist/types/extended-api-models/excluded-properties.d.ts +0 -5
- package/dist/types/extended-api-models/extended-area-projects.d.ts +0 -3
- package/dist/types/extended-api-models/extended-area.d.ts +0 -13
- package/dist/types/extended-api-models/index.d.ts +0 -6
- package/dist/types/extended-api-models/status/apartment-building-status.d.ts +0 -3
- package/dist/types/extended-api-models/status/construction-number-status.d.ts +0 -3
- package/dist/types/extended-api-models/status/property-type-status.d.ts +0 -4
- package/dist/types/extended-api-models/utilities/apartment-building-view.d.ts +0 -4
- package/dist/types/extended-api-models/utilities/extended-model-price-range.d.ts +0 -4
- package/dist/types/extended-api-models/utilities/find-extended-object.d.ts +0 -4
- package/dist/types/extended-api-models/utilities/is-apartment.d.ts +0 -11
- package/dist/types/function-is-true.d.ts +0 -1
- package/dist/types/generated/bpd-client.d.ts +0 -808
- package/dist/types/generated/index.d.ts +0 -1
- package/dist/types/geometry/country-bounding-box.d.ts +0 -6
- package/dist/types/geometry/geometry.d.ts +0 -11
- package/dist/types/geometry/geometry.test.d.ts +0 -8
- package/dist/types/geometry/index.d.ts +0 -2
- package/dist/types/hooks/index.d.ts +0 -10
- package/dist/types/hooks/use-click-outside.d.ts +0 -6
- package/dist/types/hooks/use-delegate-listen.d.ts +0 -6
- package/dist/types/hooks/use-form-changes.d.ts +0 -12
- package/dist/types/hooks/use-history.d.ts +0 -4
- package/dist/types/hooks/use-input.d.ts +0 -41
- package/dist/types/hooks/use-keyboard-focus.d.ts +0 -6
- package/dist/types/hooks/use-lazy.d.ts +0 -21
- package/dist/types/hooks/use-map-storage.d.ts +0 -6
- package/dist/types/hooks/use-scroll-position.d.ts +0 -10
- package/dist/types/hooks/use-scroll-to.d.ts +0 -8
- package/dist/types/hooks/use-stylesheet.d.ts +0 -1
- package/dist/types/hooks/use-text.d.ts +0 -1
- package/dist/types/hooks/use-url-params.d.ts +0 -5
- package/dist/types/index.d.ts +0 -17
- package/dist/types/is-touch.d.ts +0 -8
- package/dist/types/media-query/breakpoints.d.ts +0 -26
- package/dist/types/media-query/index.d.ts +0 -1
- package/dist/types/media-query/media-query.d.ts +0 -13
- package/dist/types/media-query/media-query.types.d.ts +0 -14
- package/dist/types/media-query/utils/index.d.ts +0 -3
- package/dist/types/raf-throttle.d.ts +0 -4
- package/dist/types/throttle.d.ts +0 -2
- package/dist/types/to-currency.d.ts +0 -3
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { filterConstructionNumbers, filterPropertyTypes, findProjectPhase, findPropertyType, getDistrictStatus, } from '../api-utilities';
|
|
2
|
-
import { composeExcludeString } from '../api-utilities/compose-exclude-string';
|
|
3
|
-
import { apartmentBuildingQuery, areaProjectGetById, constructionNumberQuery, districtQuery, projectPhaseQuery, propertyTypeQuery, } from '../generated';
|
|
4
|
-
import { EXCLUDED_CONSTRUCTION_NUMBER_PROPERTIES, EXCLUDED_PROJECT_PHASE_PROPERTIES, EXCLUDED_PROPERTY_TYPE_PROPERTIES, } from './excluded-properties';
|
|
5
|
-
import { getApartmentBuildingStatus } from './status/apartment-building-status';
|
|
6
|
-
import { constructionNumberStatus } from './status/construction-number-status';
|
|
7
|
-
import { getPropertyTypeStatus } from './status/property-type-status';
|
|
8
|
-
const ExtendedAreaModelsUtility = () => {
|
|
9
|
-
const areaState = {};
|
|
10
|
-
async function controller(areaId) {
|
|
11
|
-
let originalData;
|
|
12
|
-
if (hasSessionStorageData(areaId)) {
|
|
13
|
-
originalData = fetchSessionStorageData(areaId);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
originalData = await fetchData(areaId);
|
|
17
|
-
setSessionStorageData(areaId, originalData);
|
|
18
|
-
}
|
|
19
|
-
originalData = filterObjectsWithImages(originalData);
|
|
20
|
-
areaState[areaId].extendedData = extendModels(originalData);
|
|
21
|
-
setLoaded(areaId);
|
|
22
|
-
}
|
|
23
|
-
async function getData(areaId) {
|
|
24
|
-
if (!areaState[areaId]) {
|
|
25
|
-
areaState[areaId] = {
|
|
26
|
-
resolveArray: [],
|
|
27
|
-
};
|
|
28
|
-
controller(areaId);
|
|
29
|
-
}
|
|
30
|
-
const state = areaState[areaId];
|
|
31
|
-
if (!state.extendedData) {
|
|
32
|
-
return new Promise((res) => {
|
|
33
|
-
state.resolveArray.push(res);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
return state.extendedData;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function setLoaded(areaId) {
|
|
41
|
-
areaState[areaId].resolveArray.forEach((res) => {
|
|
42
|
-
res(areaState[areaId].extendedData);
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
function filterObjectsWithImages(data) {
|
|
46
|
-
return Object.assign(Object.assign({}, data), { constructionNumbers: data.constructionNumbers.filter(({ mainImage }) => !!(mainImage === null || mainImage === void 0 ? void 0 : mainImage.url)), propertyTypes: data.propertyTypes.filter(({ mainImage }) => !!(mainImage === null || mainImage === void 0 ? void 0 : mainImage.url)), apartmentBuildings: data.apartmentBuildings.filter(({ image }) => !!(image === null || image === void 0 ? void 0 : image.url)) });
|
|
47
|
-
}
|
|
48
|
-
function sessionStorageId(areaId) {
|
|
49
|
-
return `AreaObjects::${areaId}`;
|
|
50
|
-
}
|
|
51
|
-
function sessionStorageData(areaId) {
|
|
52
|
-
return sessionStorage.getItem(sessionStorageId(areaId));
|
|
53
|
-
}
|
|
54
|
-
function hasSessionStorageData(areaId) {
|
|
55
|
-
return !!sessionStorageData(areaId);
|
|
56
|
-
}
|
|
57
|
-
function fetchSessionStorageData(areaId) {
|
|
58
|
-
if (hasSessionStorageData(areaId)) {
|
|
59
|
-
return JSON.parse(sessionStorageData(areaId));
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function setSessionStorageData(areaId, originalData) {
|
|
66
|
-
sessionStorage.setItem(sessionStorageId(areaId), JSON.stringify(originalData));
|
|
67
|
-
}
|
|
68
|
-
async function fetchData(areaId) {
|
|
69
|
-
const propertyTypes = propertyTypeQuery({
|
|
70
|
-
AreaProjectId: areaId,
|
|
71
|
-
exclude: composeExcludeString(EXCLUDED_PROPERTY_TYPE_PROPERTIES),
|
|
72
|
-
});
|
|
73
|
-
const constructionNumbers = constructionNumberQuery({
|
|
74
|
-
AreaProjectId: areaId,
|
|
75
|
-
exclude: composeExcludeString(EXCLUDED_CONSTRUCTION_NUMBER_PROPERTIES),
|
|
76
|
-
});
|
|
77
|
-
const projectPhases = projectPhaseQuery({
|
|
78
|
-
AreaProjectId: areaId,
|
|
79
|
-
exclude: composeExcludeString(EXCLUDED_PROJECT_PHASE_PROPERTIES),
|
|
80
|
-
});
|
|
81
|
-
const apartmentBuildings = apartmentBuildingQuery({
|
|
82
|
-
AreaProjectId: areaId,
|
|
83
|
-
});
|
|
84
|
-
const districts = districtQuery({
|
|
85
|
-
AreaProjectId: areaId,
|
|
86
|
-
});
|
|
87
|
-
const areaProject = areaProjectGetById(areaId);
|
|
88
|
-
return {
|
|
89
|
-
propertyTypes: await propertyTypes,
|
|
90
|
-
constructionNumbers: await constructionNumbers,
|
|
91
|
-
projectPhases: await projectPhases,
|
|
92
|
-
apartmentBuildings: await apartmentBuildings,
|
|
93
|
-
districts: await districts,
|
|
94
|
-
areaProject: await areaProject,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
function extendModels(data) {
|
|
98
|
-
const { constructionNumbers, propertyTypes, apartmentBuildings, projectPhases, districts, areaProject, } = data;
|
|
99
|
-
constructionNumbers.forEach((constructionNumber) => {
|
|
100
|
-
const { propertyTypeId, projectPhaseId } = constructionNumber;
|
|
101
|
-
constructionNumber.areaProject = areaProject;
|
|
102
|
-
if (propertyTypeId) {
|
|
103
|
-
constructionNumber.propertyType = findPropertyType(propertyTypes, {
|
|
104
|
-
id: propertyTypeId,
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
if (projectPhaseId) {
|
|
108
|
-
constructionNumber.projectPhase = findProjectPhase(projectPhases, {
|
|
109
|
-
id: projectPhaseId,
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
constructionNumber.apartmentBuilding = apartmentBuildings.find((s) => { var _a; return (_a = s.constructionNumberIds) === null || _a === void 0 ? void 0 : _a.includes(constructionNumber.id); });
|
|
113
|
-
constructionNumber.status = constructionNumberStatus(constructionNumber);
|
|
114
|
-
constructionNumber.objectType = 'constructionNumber';
|
|
115
|
-
});
|
|
116
|
-
propertyTypes.forEach((propertyType) => {
|
|
117
|
-
const { projectPhaseId, id } = propertyType;
|
|
118
|
-
if (projectPhaseId) {
|
|
119
|
-
propertyType.projectPhase = findProjectPhase(projectPhases, {
|
|
120
|
-
id: projectPhaseId,
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
propertyType.constructionNumbers = filterConstructionNumbers(constructionNumbers, {
|
|
124
|
-
propertyTypeId: id,
|
|
125
|
-
});
|
|
126
|
-
if (propertyType.projectPhase) {
|
|
127
|
-
propertyType.status = getPropertyTypeStatus(propertyType.projectPhase, propertyType.constructionNumbers);
|
|
128
|
-
}
|
|
129
|
-
propertyType.apartmentBuildings = apartmentBuildings.filter((s) => { var _a; return (_a = s.propertyTypeIds) === null || _a === void 0 ? void 0 : _a.includes(propertyType.id); });
|
|
130
|
-
propertyType.objectType = 'propertyType';
|
|
131
|
-
});
|
|
132
|
-
projectPhases.forEach((projectPhase) => {
|
|
133
|
-
const { id } = projectPhase;
|
|
134
|
-
projectPhase.propertyTypes = filterPropertyTypes(propertyTypes, {
|
|
135
|
-
projectPhaseId: id,
|
|
136
|
-
});
|
|
137
|
-
projectPhase.constructionNumbers = filterConstructionNumbers(constructionNumbers, {
|
|
138
|
-
projectPhaseId: id,
|
|
139
|
-
});
|
|
140
|
-
projectPhase.objectType = 'projectPhase';
|
|
141
|
-
});
|
|
142
|
-
apartmentBuildings.forEach((apartmentBuilding) => {
|
|
143
|
-
const { propertyTypeIds, constructionNumberIds, projectPhaseId } = apartmentBuilding;
|
|
144
|
-
if (propertyTypeIds) {
|
|
145
|
-
apartmentBuilding.propertyTypes = propertyTypes.filter(({ id }) => propertyTypeIds === null || propertyTypeIds === void 0 ? void 0 : propertyTypeIds.includes(id));
|
|
146
|
-
}
|
|
147
|
-
if (constructionNumberIds) {
|
|
148
|
-
apartmentBuilding.constructionNumbers = constructionNumbers.filter(({ id }) => constructionNumberIds === null || constructionNumberIds === void 0 ? void 0 : constructionNumberIds.includes(id));
|
|
149
|
-
}
|
|
150
|
-
if (projectPhaseId) {
|
|
151
|
-
apartmentBuilding.projectPhase = findProjectPhase(projectPhases, {
|
|
152
|
-
id: projectPhaseId,
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
if (apartmentBuilding.projectPhase) {
|
|
156
|
-
apartmentBuilding.status = getApartmentBuildingStatus(apartmentBuilding.projectPhase, apartmentBuilding.constructionNumbers);
|
|
157
|
-
}
|
|
158
|
-
apartmentBuilding.objectType = 'apartmentBuilding';
|
|
159
|
-
});
|
|
160
|
-
districts.forEach((district) => {
|
|
161
|
-
district.status = getDistrictStatus(district, projectPhases);
|
|
162
|
-
district.objectType = 'district';
|
|
163
|
-
});
|
|
164
|
-
return {
|
|
165
|
-
constructionNumbers,
|
|
166
|
-
propertyTypes,
|
|
167
|
-
apartmentBuildings,
|
|
168
|
-
projectPhases,
|
|
169
|
-
districts,
|
|
170
|
-
areaProject,
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
return {
|
|
174
|
-
getData,
|
|
175
|
-
};
|
|
176
|
-
};
|
|
177
|
-
const extendedArea = ExtendedAreaModelsUtility();
|
|
178
|
-
export { extendedArea };
|
|
179
|
-
//# sourceMappingURL=extended-area.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extended-area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EAAE,EAAE,EAAE,EAAE,CAC9D,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,QAAQ,CAAC,EAAE,CAAC,CAChC,CAAC;aACL;YAED,IAAI,qBAAqB,EAAE;gBACvB,iBAAiB,CAAC,mBAAmB,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAC1E,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,QAAQ,CAAC,EAAE,CAAC,CACtC,CAAC;aACL;YAED,IAAI,cAAc,EAAE;gBAChB,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC,aAAa,EAAE;oBAC7D,EAAE,EAAE,cAAc;iBACrB,CAAC,CAAC;aACN;YAED,IAAI,iBAAiB,CAAC,YAAY,EAAE;gBAChC,iBAAiB,CAAC,MAAM,GAAG,0BAA0B,CACjD,iBAAiB,CAAC,YAAY,EAC9B,iBAAiB,CAAC,mBAAmB,CACxC,CAAC;aACL;YAED,iBAAiB,CAAC,UAAU,GAAG,mBAAmB,CAAC;QACvD,CAAC,CAAC,CAAC;QAKH,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC3B,QAAQ,CAAC,MAAM,GAAG,iBAAiB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;YAC7D,QAAQ,CAAC,UAAU,GAAG,UAAU,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,OAAO;YACH,mBAAmB;YACnB,aAAa;YACb,kBAAkB;YAClB,aAAa;YACb,SAAS;YACT,WAAW;SACd,CAAC;IACN,CAAC;IAED,OAAO;QACH,OAAO;KACV,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,yBAAyB,EAAE,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAsB,CAAC","sourcesContent":["import {\n ExtendedApartmentBuilding,\n ExtendedAreaProject,\n ExtendedConstructionNumber,\n ExtendedDistrict,\n ExtendedProjectPhase,\n ExtendedPropertyType,\n filterConstructionNumbers,\n filterPropertyTypes,\n findProjectPhase,\n findPropertyType,\n getDistrictStatus,\n} from '../api-utilities';\nimport { composeExcludeString } from '../api-utilities/compose-exclude-string';\nimport {\n ApartmentBuildingModel,\n apartmentBuildingQuery,\n areaProjectGetById,\n AreaProjectModel,\n ConstructionNumberModel,\n constructionNumberQuery,\n DistrictModel,\n districtQuery,\n ProjectPhaseModel,\n projectPhaseQuery,\n PropertyTypeModel,\n propertyTypeQuery,\n} from '../generated';\nimport {\n EXCLUDED_CONSTRUCTION_NUMBER_PROPERTIES,\n EXCLUDED_PROJECT_PHASE_PROPERTIES,\n EXCLUDED_PROPERTY_TYPE_PROPERTIES,\n} from './excluded-properties';\nimport { getApartmentBuildingStatus } from './status/apartment-building-status';\nimport { constructionNumberStatus } from './status/construction-number-status';\nimport { getPropertyTypeStatus } from './status/property-type-status';\n\ninterface OriginalAreaModels {\n constructionNumbers: ConstructionNumberModel[];\n propertyTypes: PropertyTypeModel[];\n apartmentBuildings: ApartmentBuildingModel[];\n projectPhases: ProjectPhaseModel[];\n districts: DistrictModel[];\n areaProject: AreaProjectModel;\n}\n\ninterface ExtendedAreaModels {\n constructionNumbers: ExtendedConstructionNumber[];\n propertyTypes: ExtendedPropertyType[];\n apartmentBuildings: ExtendedApartmentBuilding[];\n projectPhases: ExtendedProjectPhase[];\n districts: ExtendedDistrict[];\n areaProject: ExtendedAreaProject;\n}\ninterface FilterFunctions {\n constructionNumber?: (constructionNumber: ConstructionNumberModel) => boolean;\n propertyType?: (propertyType: PropertyTypeModel) => boolean;\n apartmentBuilding?: (apartmentBuilding: ApartmentBuildingModel) => boolean;\n projectPhase?: (projectPhase: ProjectPhaseModel) => boolean;\n district?: (district: DistrictModel) => boolean;\n}\n\nconst ExtendedAreaModelsUtility = () => {\n const areaState: {\n [areaId: string]: {\n extendedData?: ExtendedAreaModels;\n resolveArray: Function[];\n filterFunctions?: FilterFunctions;\n };\n } = {};\n\n async function controller(areaId: string) {\n let originalData: OriginalAreaModels;\n\n if (hasSessionStorageData(areaId)) {\n originalData = fetchSessionStorageData(areaId)!;\n } else {\n originalData = await fetchData(areaId);\n setSessionStorageData(areaId, originalData);\n }\n\n // Objects without images, should not be shown on the website\n originalData = filterObjectsWithImages(originalData);\n\n areaState[areaId].extendedData = extendModels(originalData);\n\n setLoaded(areaId);\n }\n\n async function getData(areaId: string): Promise<ExtendedAreaModels> {\n if (!areaState[areaId]) {\n areaState[areaId] = {\n resolveArray: [],\n };\n\n // Controller handles fetching + extending of data\n controller(areaId);\n }\n\n const state = areaState[areaId];\n\n if (!state.extendedData) {\n /*\n if no extendedData is found, it means it's being fetched.\n Promises will be resolved after data is loaded\n */\n return new Promise((res) => {\n state.resolveArray.push(res);\n });\n } else {\n // if no extendedData is found, it comes from sessionStorage\n return state.extendedData;\n }\n }\n\n function setLoaded(areaId: string) {\n areaState[areaId].resolveArray.forEach((res) => {\n res(areaState[areaId].extendedData);\n });\n }\n\n function filterObjectsWithImages(data: OriginalAreaModels): OriginalAreaModels {\n return {\n ...data,\n constructionNumbers: data.constructionNumbers.filter(\n ({ mainImage }) => !!mainImage?.url,\n ),\n propertyTypes: data.propertyTypes.filter(({ mainImage }) => !!mainImage?.url),\n apartmentBuildings: data.apartmentBuildings.filter(({ image }) => !!image?.url),\n };\n }\n\n function sessionStorageId(areaId: string) {\n return `AreaObjects::${areaId}`;\n }\n\n function sessionStorageData(areaId: string) {\n return sessionStorage.getItem(sessionStorageId(areaId));\n }\n\n function hasSessionStorageData(areaId: string) {\n return !!sessionStorageData(areaId);\n }\n\n function fetchSessionStorageData(areaId: string) {\n if (hasSessionStorageData(areaId)) {\n return JSON.parse(sessionStorageData(areaId)!) as OriginalAreaModels;\n } else {\n return;\n }\n }\n\n function setSessionStorageData(areaId: string, originalData: OriginalAreaModels) {\n sessionStorage.setItem(sessionStorageId(areaId), JSON.stringify(originalData));\n }\n\n async function fetchData(areaId: string) {\n const propertyTypes = propertyTypeQuery({\n AreaProjectId: areaId,\n exclude: composeExcludeString(EXCLUDED_PROPERTY_TYPE_PROPERTIES),\n });\n const constructionNumbers = constructionNumberQuery({\n AreaProjectId: areaId,\n exclude: composeExcludeString(EXCLUDED_CONSTRUCTION_NUMBER_PROPERTIES),\n });\n const projectPhases = projectPhaseQuery({\n AreaProjectId: areaId,\n exclude: composeExcludeString(EXCLUDED_PROJECT_PHASE_PROPERTIES),\n });\n const apartmentBuildings = apartmentBuildingQuery({\n AreaProjectId: areaId,\n });\n const districts = districtQuery({\n AreaProjectId: areaId,\n });\n const areaProject = areaProjectGetById(areaId);\n\n return {\n propertyTypes: await propertyTypes,\n constructionNumbers: await constructionNumbers,\n projectPhases: await projectPhases,\n apartmentBuildings: await apartmentBuildings,\n districts: await districts,\n areaProject: await areaProject,\n };\n }\n\n function extendModels(data: OriginalAreaModels): ExtendedAreaModels {\n const {\n constructionNumbers,\n propertyTypes,\n apartmentBuildings,\n projectPhases,\n districts,\n areaProject,\n } = data as ExtendedAreaModels;\n\n /*\n Extend constructionNumbers object\n */\n constructionNumbers.forEach((constructionNumber) => {\n const { propertyTypeId, projectPhaseId } = constructionNumber;\n\n constructionNumber.areaProject = areaProject;\n\n if (propertyTypeId) {\n constructionNumber.propertyType = findPropertyType(propertyTypes, {\n id: propertyTypeId,\n });\n }\n\n if (projectPhaseId) {\n constructionNumber.projectPhase = findProjectPhase(projectPhases, {\n id: projectPhaseId,\n });\n }\n\n constructionNumber.apartmentBuilding = apartmentBuildings.find((s) =>\n s.constructionNumberIds?.includes(constructionNumber.id),\n );\n\n constructionNumber.status = constructionNumberStatus(constructionNumber);\n\n constructionNumber.objectType = 'constructionNumber';\n });\n\n /*\n Extend propertTypes object\n */\n propertyTypes.forEach((propertyType) => {\n const { projectPhaseId, id } = propertyType;\n\n if (projectPhaseId) {\n propertyType.projectPhase = findProjectPhase(projectPhases, {\n id: projectPhaseId,\n });\n }\n\n propertyType.constructionNumbers = filterConstructionNumbers(constructionNumbers, {\n propertyTypeId: id,\n });\n\n if (propertyType.projectPhase) {\n propertyType.status = getPropertyTypeStatus(\n propertyType.projectPhase,\n propertyType.constructionNumbers,\n );\n }\n\n propertyType.apartmentBuildings = apartmentBuildings.filter((s) =>\n s.propertyTypeIds?.includes(propertyType.id),\n );\n\n propertyType.objectType = 'propertyType';\n });\n\n /*\n Extend projectPhase object\n */\n projectPhases.forEach((projectPhase) => {\n const { id } = projectPhase;\n\n projectPhase.propertyTypes = filterPropertyTypes(propertyTypes, {\n projectPhaseId: id,\n });\n projectPhase.constructionNumbers = filterConstructionNumbers(constructionNumbers, {\n projectPhaseId: id,\n });\n\n projectPhase.objectType = 'projectPhase';\n });\n\n /*\n Extend apartmentBuilding object\n */\n apartmentBuildings.forEach((apartmentBuilding) => {\n const { propertyTypeIds, constructionNumberIds, projectPhaseId } = apartmentBuilding;\n\n if (propertyTypeIds) {\n apartmentBuilding.propertyTypes = propertyTypes.filter(({ id }) =>\n propertyTypeIds?.includes(id),\n );\n }\n\n if (constructionNumberIds) {\n apartmentBuilding.constructionNumbers = constructionNumbers.filter(({ id }) =>\n constructionNumberIds?.includes(id),\n );\n }\n\n if (projectPhaseId) {\n apartmentBuilding.projectPhase = findProjectPhase(projectPhases, {\n id: projectPhaseId,\n });\n }\n\n if (apartmentBuilding.projectPhase) {\n apartmentBuilding.status = getApartmentBuildingStatus(\n apartmentBuilding.projectPhase,\n apartmentBuilding.constructionNumbers,\n );\n }\n\n apartmentBuilding.objectType = 'apartmentBuilding';\n });\n\n /*\n Extend district object\n */\n districts.forEach((district) => {\n district.status = getDistrictStatus(district, projectPhases);\n district.objectType = 'district';\n });\n\n return {\n constructionNumbers,\n propertyTypes,\n apartmentBuildings,\n projectPhases,\n districts,\n areaProject,\n };\n }\n\n return {\n getData,\n };\n};\n\nconst extendedArea = ExtendedAreaModelsUtility();\n\nexport { extendedArea, ExtendedAreaModels };\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from './utilities/extended-model-price-range';
|
|
2
|
-
export * from './utilities/apartment-building-view';
|
|
3
|
-
export * from './utilities/is-apartment';
|
|
4
|
-
export * from './utilities/find-extended-object';
|
|
5
|
-
export * from './extended-area';
|
|
6
|
-
export * from './extended-area-projects';
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/extended-api-models/index.ts"],"names":[],"mappings":"AAAA,cAAc,wCAAwC,CAAC;AACvD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AAEjD,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC","sourcesContent":["export * from './utilities/extended-model-price-range';\nexport * from './utilities/apartment-building-view';\nexport * from './utilities/is-apartment';\nexport * from './utilities/find-extended-object';\n\nexport * from './extended-area';\nexport * from './extended-area-projects';\n"]}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { betweenDates, calculateDifferenceInDays } from '../../date';
|
|
2
|
-
const getApartmentBuildingStatus = (projectPhase, constructionNumbers) => {
|
|
3
|
-
const currentDate = new Date();
|
|
4
|
-
const saleStartDate = projectPhase.saleStartDate && new Date(projectPhase.saleStartDate);
|
|
5
|
-
const saleEndDate = projectPhase.saleEndDate && new Date(projectPhase.saleEndDate);
|
|
6
|
-
const allocationDate = projectPhase.allocationDate && new Date(projectPhase.allocationDate);
|
|
7
|
-
if (projectPhase.status === 'Sold')
|
|
8
|
-
return 'UnderConstruction';
|
|
9
|
-
if (projectPhase.status === 'Rented')
|
|
10
|
-
return 'Rented';
|
|
11
|
-
if (!(constructionNumbers === null || constructionNumbers === void 0 ? void 0 : constructionNumbers.length))
|
|
12
|
-
return getInPreparationStatus();
|
|
13
|
-
switch (projectPhase.status) {
|
|
14
|
-
case 'InPreparation':
|
|
15
|
-
return getInPreparationStatus();
|
|
16
|
-
case 'ForRent':
|
|
17
|
-
return 'ForRent';
|
|
18
|
-
case 'OnSale':
|
|
19
|
-
return getOnSaleStatus();
|
|
20
|
-
default:
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
function getInPreparationStatus() {
|
|
24
|
-
if (projectPhase.isRental)
|
|
25
|
-
return 'InPreparation';
|
|
26
|
-
if (saleStartDate) {
|
|
27
|
-
const differenceInDays = calculateDifferenceInDays(saleStartDate, currentDate);
|
|
28
|
-
if (differenceInDays <= 30)
|
|
29
|
-
return 'SaleSoon';
|
|
30
|
-
}
|
|
31
|
-
return 'InPreparation';
|
|
32
|
-
}
|
|
33
|
-
function getOnSaleStatus() {
|
|
34
|
-
if (!saleStartDate || !saleEndDate || !allocationDate)
|
|
35
|
-
return;
|
|
36
|
-
const betweenSaleStartAndSaleEnd = betweenDates(saleStartDate, currentDate, saleEndDate);
|
|
37
|
-
const betweenSaleStartAndAllocation = betweenDates(saleStartDate, currentDate, allocationDate);
|
|
38
|
-
const afterAllocation = currentDate >= allocationDate;
|
|
39
|
-
if (betweenSaleStartAndSaleEnd)
|
|
40
|
-
return 'SaleStarted';
|
|
41
|
-
if (betweenSaleStartAndAllocation)
|
|
42
|
-
return 'AssigningOn';
|
|
43
|
-
if (afterAllocation) {
|
|
44
|
-
const constructionNumberStatusses = constructionNumbers.map(({ availabilityStatus }) => availabilityStatus);
|
|
45
|
-
const constructionNumbersAvailable = constructionNumberStatusses.filter((s) => s === 'Available');
|
|
46
|
-
const constructionNumbersInOption = constructionNumberStatusses.filter((s) => s === 'InOption');
|
|
47
|
-
if (constructionNumbersAvailable.length)
|
|
48
|
-
return 'AmountAvailable';
|
|
49
|
-
if (constructionNumbersInOption.length)
|
|
50
|
-
return 'InOption';
|
|
51
|
-
if (constructionNumberStatusses.indexOf('Sold') > -1)
|
|
52
|
-
return 'Sold';
|
|
53
|
-
}
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
export { getApartmentBuildingStatus };
|
|
58
|
-
//# sourceMappingURL=apartment-building-status.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apartment-building-status.js","sourceRoot":"","sources":["../../../../src/extended-api-models/status/apartment-building-status.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAErE,MAAM,0BAA0B,GAAG,CAC/B,YAAkC,EAClC,mBAAkD,EACf,EAAE;IACrC,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC;IAC/B,MAAM,aAAa,GAAG,YAAY,CAAC,aAAa,IAAI,IAAI,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IACzF,MAAM,WAAW,GAAG,YAAY,CAAC,WAAW,IAAI,IAAI,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IACnF,MAAM,cAAc,GAAG,YAAY,CAAC,cAAc,IAAI,IAAI,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;IAE5F,IAAI,YAAY,CAAC,MAAM,KAAK,MAAM;QAAE,OAAO,mBAAmB,CAAC;IAC/D,IAAI,YAAY,CAAC,MAAM,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAEtD,IAAI,EAAC,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,MAAM,CAAA;QAAE,OAAO,sBAAsB,EAAE,CAAC;IAElE,QAAQ,YAAY,CAAC,MAAM,EAAE;QACzB,KAAK,eAAe;YAChB,OAAO,sBAAsB,EAAE,CAAC;QACpC,KAAK,SAAS;YACV,OAAO,SAAS,CAAC;QACrB,KAAK,QAAQ;YACT,OAAO,eAAe,EAAE,CAAC;QAC7B;YACI,OAAO;KACd;IAED,SAAS,sBAAsB;QAC3B,IAAI,YAAY,CAAC,QAAQ;YAAE,OAAO,eAAe,CAAC;QAElD,IAAI,aAAa,EAAE;YACf,MAAM,gBAAgB,GAAG,yBAAyB,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;YAE/E,IAAI,gBAAgB,IAAI,EAAE;gBAAE,OAAO,UAAU,CAAC;SACjD;QAED,OAAO,eAAe,CAAC;IAC3B,CAAC;IAED,SAAS,eAAe;QACpB,IAAI,CAAC,aAAa,IAAI,CAAC,WAAW,IAAI,CAAC,cAAc;YAAE,OAAO;QAE9D,MAAM,0BAA0B,GAAG,YAAY,CAAC,aAAa,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;QACzF,MAAM,6BAA6B,GAAG,YAAY,CAC9C,aAAa,EACb,WAAW,EACX,cAAc,CACjB,CAAC;QACF,MAAM,eAAe,GAAG,WAAW,IAAI,cAAc,CAAC;QAEtD,IAAI,0BAA0B;YAAE,OAAO,aAAa,CAAC;QAErD,IAAI,6BAA6B;YAAE,OAAO,aAAa,CAAC;QAExD,IAAI,eAAe,EAAE;YACjB,MAAM,2BAA2B,GAAG,mBAAoB,CAAC,GAAG,CACxD,CAAC,EAAE,kBAAkB,EAAE,EAAE,EAAE,CAAC,kBAAkB,CACjD,CAAC;YACF,MAAM,4BAA4B,GAAG,2BAA2B,CAAC,MAAM,CACnE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,WAAW,CAC3B,CAAC;YACF,MAAM,2BAA2B,GAAG,2BAA2B,CAAC,MAAM,CAClE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,UAAU,CAC1B,CAAC;YAEF,IAAI,4BAA4B,CAAC,MAAM;gBAAE,OAAO,iBAAiB,CAAC;YAElE,IAAI,2BAA2B,CAAC,MAAM;gBAAE,OAAO,UAAU,CAAC;YAE1D,IAAI,2BAA2B,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAAE,OAAO,MAAM,CAAC;SACvE;QAED,OAAO;IACX,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,CAAC","sourcesContent":["import {\n ApartmentBuildingStatus,\n ExtendedConstructionNumber,\n ExtendedProjectPhase,\n} from '../../api-utilities/api-utilities.types';\nimport { betweenDates, calculateDifferenceInDays } from '../../date';\n\nconst getApartmentBuildingStatus = (\n projectPhase: ExtendedProjectPhase,\n constructionNumbers?: ExtendedConstructionNumber[],\n): ApartmentBuildingStatus | undefined => {\n const currentDate = new Date();\n const saleStartDate = projectPhase.saleStartDate && new Date(projectPhase.saleStartDate);\n const saleEndDate = projectPhase.saleEndDate && new Date(projectPhase.saleEndDate);\n const allocationDate = projectPhase.allocationDate && new Date(projectPhase.allocationDate);\n\n if (projectPhase.status === 'Sold') return 'UnderConstruction';\n if (projectPhase.status === 'Rented') return 'Rented';\n\n if (!constructionNumbers?.length) return getInPreparationStatus();\n\n switch (projectPhase.status) {\n case 'InPreparation':\n return getInPreparationStatus();\n case 'ForRent':\n return 'ForRent';\n case 'OnSale':\n return getOnSaleStatus();\n default:\n return;\n }\n\n function getInPreparationStatus(): ApartmentBuildingStatus {\n if (projectPhase.isRental) return 'InPreparation';\n\n if (saleStartDate) {\n const differenceInDays = calculateDifferenceInDays(saleStartDate, currentDate);\n\n if (differenceInDays <= 30) return 'SaleSoon';\n }\n\n return 'InPreparation';\n }\n\n function getOnSaleStatus(): ApartmentBuildingStatus | undefined {\n if (!saleStartDate || !saleEndDate || !allocationDate) return;\n\n const betweenSaleStartAndSaleEnd = betweenDates(saleStartDate, currentDate, saleEndDate);\n const betweenSaleStartAndAllocation = betweenDates(\n saleStartDate,\n currentDate,\n allocationDate,\n );\n const afterAllocation = currentDate >= allocationDate;\n\n if (betweenSaleStartAndSaleEnd) return 'SaleStarted';\n\n if (betweenSaleStartAndAllocation) return 'AssigningOn';\n\n if (afterAllocation) {\n const constructionNumberStatusses = constructionNumbers!.map(\n ({ availabilityStatus }) => availabilityStatus,\n );\n const constructionNumbersAvailable = constructionNumberStatusses.filter(\n (s) => s === 'Available',\n );\n const constructionNumbersInOption = constructionNumberStatusses.filter(\n (s) => s === 'InOption',\n );\n\n if (constructionNumbersAvailable.length) return 'AmountAvailable';\n\n if (constructionNumbersInOption.length) return 'InOption';\n\n if (constructionNumberStatusses.indexOf('Sold') > -1) return 'Sold';\n }\n\n return;\n }\n};\n\nexport { getApartmentBuildingStatus };\n"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const constructionNumberStatus = (constructionNumber) => {
|
|
2
|
-
const { projectPhase, availabilityStatus } = constructionNumber;
|
|
3
|
-
const { isRental, status: projectPhaseStatus } = projectPhase || {};
|
|
4
|
-
if (projectPhaseStatus === 'InPreparation')
|
|
5
|
-
return 'InPreparation';
|
|
6
|
-
if (projectPhaseStatus === 'Sold')
|
|
7
|
-
return 'UnderConstruction';
|
|
8
|
-
switch (availabilityStatus) {
|
|
9
|
-
case 'InOption':
|
|
10
|
-
return 'InOption';
|
|
11
|
-
case 'Available':
|
|
12
|
-
return 'Available';
|
|
13
|
-
case 'Sold':
|
|
14
|
-
return isRental ? 'Rented' : 'Sold';
|
|
15
|
-
}
|
|
16
|
-
return;
|
|
17
|
-
};
|
|
18
|
-
export { constructionNumberStatus };
|
|
19
|
-
//# sourceMappingURL=construction-number-status.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"construction-number-status.js","sourceRoot":"","sources":["../../../../src/extended-api-models/status/construction-number-status.ts"],"names":[],"mappings":"AAKA,MAAM,wBAAwB,GAAG,CAC7B,kBAA8C,EACD,EAAE;IAC/C,MAAM,EAAE,YAAY,EAAE,kBAAkB,EAAE,GAAG,kBAAkB,CAAC;IAEhE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,kBAAkB,EAAE,GAAG,YAAY,IAAI,EAAE,CAAC;IAEpE,IAAI,kBAAkB,KAAK,eAAe;QAAE,OAAO,eAAe,CAAC;IACnE,IAAI,kBAAkB,KAAK,MAAM;QAAE,OAAO,mBAAmB,CAAC;IAE9D,QAAQ,kBAAkB,EAAE;QACxB,KAAK,UAAU;YACX,OAAO,UAAU,CAAC;QACtB,KAAK,WAAW;YACZ,OAAO,WAAW,CAAC;QACvB,KAAK,MAAM;YACP,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,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';\n\nconst constructionNumberStatus = (\n constructionNumber: ExtendedConstructionNumber,\n): GeneratedConstructionNumberStatus | undefined => {\n const { projectPhase, availabilityStatus } = constructionNumber;\n\n const { isRental, status: projectPhaseStatus } = projectPhase || {};\n\n if (projectPhaseStatus === 'InPreparation') return 'InPreparation';\n if (projectPhaseStatus === 'Sold') return 'UnderConstruction';\n\n switch (availabilityStatus) {\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"]}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { betweenDates, calculateDifferenceInDays } from '../../date';
|
|
2
|
-
const getPropertyTypeStatus = (projectPhase, constructionNumbers) => {
|
|
3
|
-
const currentDate = new Date();
|
|
4
|
-
const saleStartDate = projectPhase.saleStartDate && new Date(projectPhase.saleStartDate);
|
|
5
|
-
const saleEndDate = projectPhase.saleEndDate && new Date(projectPhase.saleEndDate);
|
|
6
|
-
const allocationDate = projectPhase.allocationDate && new Date(projectPhase.allocationDate);
|
|
7
|
-
if (projectPhase.status === 'Sold')
|
|
8
|
-
return 'UnderConstruction';
|
|
9
|
-
if (projectPhase.status === 'Rented')
|
|
10
|
-
return 'Rented';
|
|
11
|
-
if (!(constructionNumbers === null || constructionNumbers === void 0 ? void 0 : constructionNumbers.length))
|
|
12
|
-
return getInPreparationStatus();
|
|
13
|
-
switch (projectPhase.status) {
|
|
14
|
-
case 'InPreparation':
|
|
15
|
-
return getInPreparationStatus();
|
|
16
|
-
case 'ForRent':
|
|
17
|
-
return 'ForRent';
|
|
18
|
-
case 'OnSale':
|
|
19
|
-
return getOnSaleStatus();
|
|
20
|
-
default:
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
function getInPreparationStatus() {
|
|
24
|
-
if (projectPhase.isRental)
|
|
25
|
-
return 'InPreparation';
|
|
26
|
-
if (saleStartDate) {
|
|
27
|
-
const differenceInDays = calculateDifferenceInDays(saleStartDate, currentDate);
|
|
28
|
-
if (differenceInDays <= 30)
|
|
29
|
-
return 'SaleSoon';
|
|
30
|
-
}
|
|
31
|
-
return 'InPreparation';
|
|
32
|
-
}
|
|
33
|
-
function getOnSaleStatus() {
|
|
34
|
-
if (!saleStartDate || !saleEndDate || !allocationDate)
|
|
35
|
-
return;
|
|
36
|
-
const betweenSaleStartAndSaleEnd = betweenDates(saleStartDate, currentDate, saleEndDate);
|
|
37
|
-
const betweenSaleStartAndAllocation = betweenDates(saleStartDate, currentDate, allocationDate);
|
|
38
|
-
const afterAllocation = currentDate >= allocationDate;
|
|
39
|
-
if (betweenSaleStartAndSaleEnd)
|
|
40
|
-
return 'SaleStarted';
|
|
41
|
-
if (betweenSaleStartAndAllocation)
|
|
42
|
-
return 'AssigningOn';
|
|
43
|
-
if (afterAllocation) {
|
|
44
|
-
const constructionNumberStatusses = constructionNumbers.map(({ availabilityStatus }) => availabilityStatus);
|
|
45
|
-
const constructionNumbersAvailable = constructionNumberStatusses.filter((s) => s === 'Available');
|
|
46
|
-
const constructionNumbersInOption = constructionNumberStatusses.filter((s) => s === 'InOption');
|
|
47
|
-
if (constructionNumbersAvailable.length)
|
|
48
|
-
return 'AmountAvailable';
|
|
49
|
-
if (constructionNumbersInOption.length)
|
|
50
|
-
return 'InOption';
|
|
51
|
-
if (constructionNumberStatusses.indexOf('Sold') > -1)
|
|
52
|
-
return 'Sold';
|
|
53
|
-
}
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
export { getPropertyTypeStatus };
|
|
58
|
-
//# sourceMappingURL=property-type-status.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"property-type-status.js","sourceRoot":"","sources":["../../../../src/extended-api-models/status/property-type-status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAGrE,MAAM,qBAAqB,GAAG,CAC1B,YAA+B,EAC/B,mBAA+C,EACjB,EAAE;IAChC,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC;IAC/B,MAAM,aAAa,GAAG,YAAY,CAAC,aAAa,IAAI,IAAI,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IACzF,MAAM,WAAW,GAAG,YAAY,CAAC,WAAW,IAAI,IAAI,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IACnF,MAAM,cAAc,GAAG,YAAY,CAAC,cAAc,IAAI,IAAI,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;IAE5F,IAAI,YAAY,CAAC,MAAM,KAAK,MAAM;QAAE,OAAO,mBAAmB,CAAC;IAC/D,IAAI,YAAY,CAAC,MAAM,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAEtD,IAAI,EAAC,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,MAAM,CAAA;QAAE,OAAO,sBAAsB,EAAE,CAAC;IAElE,QAAQ,YAAY,CAAC,MAAM,EAAE;QACzB,KAAK,eAAe;YAChB,OAAO,sBAAsB,EAAE,CAAC;QACpC,KAAK,SAAS;YACV,OAAO,SAAS,CAAC;QACrB,KAAK,QAAQ;YACT,OAAO,eAAe,EAAE,CAAC;QAC7B;YACI,OAAO;KACd;IAED,SAAS,sBAAsB;QAC3B,IAAI,YAAY,CAAC,QAAQ;YAAE,OAAO,eAAe,CAAC;QAElD,IAAI,aAAa,EAAE;YACf,MAAM,gBAAgB,GAAG,yBAAyB,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;YAE/E,IAAI,gBAAgB,IAAI,EAAE;gBAAE,OAAO,UAAU,CAAC;SACjD;QAED,OAAO,eAAe,CAAC;IAC3B,CAAC;IAED,SAAS,eAAe;QACpB,IAAI,CAAC,aAAa,IAAI,CAAC,WAAW,IAAI,CAAC,cAAc;YAAE,OAAO;QAE9D,MAAM,0BAA0B,GAAG,YAAY,CAAC,aAAa,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;QACzF,MAAM,6BAA6B,GAAG,YAAY,CAC9C,aAAa,EACb,WAAW,EACX,cAAc,CACjB,CAAC;QACF,MAAM,eAAe,GAAG,WAAW,IAAI,cAAc,CAAC;QAEtD,IAAI,0BAA0B;YAAE,OAAO,aAAa,CAAC;QAErD,IAAI,6BAA6B;YAAE,OAAO,aAAa,CAAC;QAExD,IAAI,eAAe,EAAE;YACjB,MAAM,2BAA2B,GAAG,mBAAoB,CAAC,GAAG,CACxD,CAAC,EAAE,kBAAkB,EAAE,EAAE,EAAE,CAAC,kBAAkB,CACjD,CAAC;YACF,MAAM,4BAA4B,GAAG,2BAA2B,CAAC,MAAM,CACnE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,WAAW,CAC3B,CAAC;YACF,MAAM,2BAA2B,GAAG,2BAA2B,CAAC,MAAM,CAClE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,UAAU,CAC1B,CAAC;YAEF,IAAI,4BAA4B,CAAC,MAAM;gBAAE,OAAO,iBAAiB,CAAC;YAElE,IAAI,2BAA2B,CAAC,MAAM;gBAAE,OAAO,UAAU,CAAC;YAE1D,IAAI,2BAA2B,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAAE,OAAO,MAAM,CAAC;SACvE;QAED,OAAO;IACX,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC","sourcesContent":["import { PropertyTypeStatus } from '../../api-utilities/api-utilities.types';\nimport { betweenDates, calculateDifferenceInDays } from '../../date';\nimport { ConstructionNumberModel, ProjectPhaseModel } from '../../generated';\n\nconst getPropertyTypeStatus = (\n projectPhase: ProjectPhaseModel,\n constructionNumbers?: ConstructionNumberModel[],\n): PropertyTypeStatus | undefined => {\n const currentDate = new Date();\n const saleStartDate = projectPhase.saleStartDate && new Date(projectPhase.saleStartDate);\n const saleEndDate = projectPhase.saleEndDate && new Date(projectPhase.saleEndDate);\n const allocationDate = projectPhase.allocationDate && new Date(projectPhase.allocationDate);\n\n if (projectPhase.status === 'Sold') return 'UnderConstruction';\n if (projectPhase.status === 'Rented') return 'Rented';\n\n if (!constructionNumbers?.length) return getInPreparationStatus();\n\n switch (projectPhase.status) {\n case 'InPreparation':\n return getInPreparationStatus();\n case 'ForRent':\n return 'ForRent';\n case 'OnSale':\n return getOnSaleStatus();\n default:\n return;\n }\n\n function getInPreparationStatus(): PropertyTypeStatus {\n if (projectPhase.isRental) return 'InPreparation';\n\n if (saleStartDate) {\n const differenceInDays = calculateDifferenceInDays(saleStartDate, currentDate);\n\n if (differenceInDays <= 30) return 'SaleSoon';\n }\n\n return 'InPreparation';\n }\n\n function getOnSaleStatus(): PropertyTypeStatus | undefined {\n if (!saleStartDate || !saleEndDate || !allocationDate) return;\n\n const betweenSaleStartAndSaleEnd = betweenDates(saleStartDate, currentDate, saleEndDate);\n const betweenSaleStartAndAllocation = betweenDates(\n saleStartDate,\n currentDate,\n allocationDate,\n );\n const afterAllocation = currentDate >= allocationDate;\n\n if (betweenSaleStartAndSaleEnd) return 'SaleStarted';\n\n if (betweenSaleStartAndAllocation) return 'AssigningOn';\n\n if (afterAllocation) {\n const constructionNumberStatusses = constructionNumbers!.map(\n ({ availabilityStatus }) => availabilityStatus,\n );\n const constructionNumbersAvailable = constructionNumberStatusses.filter(\n (s) => s === 'Available',\n );\n const constructionNumbersInOption = constructionNumberStatusses.filter(\n (s) => s === 'InOption',\n );\n\n if (constructionNumbersAvailable.length) return 'AmountAvailable';\n\n if (constructionNumbersInOption.length) return 'InOption';\n\n if (constructionNumberStatusses.indexOf('Sold') > -1) return 'Sold';\n }\n\n return;\n }\n};\n\nexport { getPropertyTypeStatus };\n"]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const getApartmentBuildingView = (constructionNumber) => { var _a, _b; return (_b = (_a = constructionNumber.apartmentBuilding) === null || _a === void 0 ? void 0 : _a.views) === null || _b === void 0 ? void 0 : _b.find((s) => { var _a; return (_a = s.pointers) === null || _a === void 0 ? void 0 : _a.find((s) => s.constructionNumberId === constructionNumber.id); }); };
|
|
2
|
-
const getApartmentBuildingViewById = (constructionNumber, id) => { var _a, _b; return (_b = (_a = constructionNumber.apartmentBuilding) === null || _a === void 0 ? void 0 : _a.views) === null || _b === void 0 ? void 0 : _b.find((view) => view.id === id); };
|
|
3
|
-
export { getApartmentBuildingView, getApartmentBuildingViewById };
|
|
4
|
-
//# sourceMappingURL=apartment-building-view.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apartment-building-view.js","sourceRoot":"","sources":["../../../../src/extended-api-models/utilities/apartment-building-view.ts"],"names":[],"mappings":"AAEA,MAAM,wBAAwB,GAAG,CAAC,kBAA8C,EAAE,EAAE,kCAChF,kBAAkB,CAAC,iBAAiB,0CAAE,KAAK,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,wBACpD,CAAC,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,oBAAoB,KAAK,kBAAkB,CAAC,EAAE,IAAC,IAC5E,CAAC;AAEN,MAAM,4BAA4B,GAAG,CAAC,kBAA8C,EAAE,EAAU,EAAE,EAAE,kCAChG,kBAAkB,CAAC,iBAAiB,0CAAE,KAAK,0CAAE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAC,CAAC;AAEhF,OAAO,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,CAAC","sourcesContent":["import { ExtendedConstructionNumber } from '../../api-utilities/api-utilities.types';\n\nconst getApartmentBuildingView = (constructionNumber: ExtendedConstructionNumber) =>\n constructionNumber.apartmentBuilding?.views?.find((s) =>\n s.pointers?.find((s) => s.constructionNumberId === constructionNumber.id),\n );\n\nconst getApartmentBuildingViewById = (constructionNumber: ExtendedConstructionNumber, id: string) =>\n constructionNumber.apartmentBuilding?.views?.find((view) => view.id === id);\n\nexport { getApartmentBuildingView, getApartmentBuildingViewById };\n"]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { mergeDecimalRange } from '../../api-utilities/decimal-range/merge-decimal-range';
|
|
2
|
-
const getExtendedModelPriceRange = (item) => {
|
|
3
|
-
const { constructionNumbers } = item;
|
|
4
|
-
let range;
|
|
5
|
-
if (!constructionNumbers || !constructionNumbers.length) {
|
|
6
|
-
if (!('propertyTypes' in item) || !item.propertyTypes || !item.propertyTypes.length)
|
|
7
|
-
return;
|
|
8
|
-
range = item.propertyTypes
|
|
9
|
-
.filter((propertyType) => propertyType.status !== 'Sold' && propertyType.status !== 'UnderConstruction')
|
|
10
|
-
.reduce((range, propertyType) => {
|
|
11
|
-
const { rentalPrice, salesPrice } = propertyType;
|
|
12
|
-
if ((rentalPrice === null || rentalPrice === void 0 ? void 0 : rentalPrice.amount) && rentalPrice.priceType !== 'PriceOnRequest')
|
|
13
|
-
return mergeDecimalRange(range, rentalPrice.amount);
|
|
14
|
-
if ((salesPrice === null || salesPrice === void 0 ? void 0 : salesPrice.amount) && salesPrice.priceType !== 'PriceOnRequest')
|
|
15
|
-
return mergeDecimalRange(range, salesPrice.amount);
|
|
16
|
-
return range;
|
|
17
|
-
}, {});
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
range = constructionNumbers
|
|
21
|
-
.filter((constructionNumber) => constructionNumber.status !== 'Sold' &&
|
|
22
|
-
constructionNumber.status !== 'UnderConstruction')
|
|
23
|
-
.reduce((range, constructionNumber) => {
|
|
24
|
-
const { rentalPrice, salesPrice } = constructionNumber;
|
|
25
|
-
if ((rentalPrice === null || rentalPrice === void 0 ? void 0 : rentalPrice.amount) && rentalPrice.priceType !== 'PriceOnRequest')
|
|
26
|
-
return mergeDecimalRange(range, rentalPrice.amount);
|
|
27
|
-
if ((salesPrice === null || salesPrice === void 0 ? void 0 : salesPrice.amount) && salesPrice.priceType !== 'PriceOnRequest')
|
|
28
|
-
return mergeDecimalRange(range, salesPrice.amount);
|
|
29
|
-
return range;
|
|
30
|
-
}, {});
|
|
31
|
-
}
|
|
32
|
-
return range;
|
|
33
|
-
};
|
|
34
|
-
export { getExtendedModelPriceRange };
|
|
35
|
-
//# sourceMappingURL=extended-model-price-range.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extended-model-price-range.js","sourceRoot":"","sources":["../../../../src/extended-api-models/utilities/extended-model-price-range.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAG1F,MAAM,0BAA0B,GAAG,CAC/B,IAAsD,EAC9B,EAAE;IAC1B,MAAM,EAAE,mBAAmB,EAAE,GAAG,IAAI,CAAC;IACrC,IAAI,KAAmB,CAAC;IAExB,IAAI,CAAC,mBAAmB,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE;QACrD,IAAI,CAAC,CAAC,eAAe,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM;YAAE,OAAO;QAE5F,KAAK,GAAG,IAAI,CAAC,aAAa;aACrB,MAAM,CACH,CAAC,YAAY,EAAE,EAAE,CACb,YAAY,CAAC,MAAM,KAAK,MAAM,IAAI,YAAY,CAAC,MAAM,KAAK,mBAAmB,CACpF;aACA,MAAM,CAAe,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE;YAC1C,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,YAAY,CAAC;YAGjD,IAAI,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,KAAI,WAAW,CAAC,SAAS,KAAK,gBAAgB;gBACjE,OAAO,iBAAiB,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;YACxD,IAAI,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,KAAI,UAAU,CAAC,SAAS,KAAK,gBAAgB;gBAC/D,OAAO,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;YAEvD,OAAO,KAAK,CAAC;QACjB,CAAC,EAAE,EAAE,CAAC,CAAC;KACd;SAAM;QACH,KAAK,GAAG,mBAAmB;aACtB,MAAM,CACH,CAAC,kBAAkB,EAAE,EAAE,CACnB,kBAAkB,CAAC,MAAM,KAAK,MAAM;YACpC,kBAAkB,CAAC,MAAM,KAAK,mBAAmB,CACxD;aACA,MAAM,CAAe,CAAC,KAAK,EAAE,kBAAkB,EAAE,EAAE;YAChD,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,kBAAkB,CAAC;YAGvD,IAAI,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,KAAI,WAAW,CAAC,SAAS,KAAK,gBAAgB;gBACjE,OAAO,iBAAiB,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;YACxD,IAAI,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,KAAI,UAAU,CAAC,SAAS,KAAK,gBAAgB;gBAC/D,OAAO,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;YAEvD,OAAO,KAAK,CAAC;QACjB,CAAC,EAAE,EAAE,CAAC,CAAC;KACd;IAED,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,CAAC","sourcesContent":["import {\n ExtendedApartmentBuilding,\n ExtendedPropertyType,\n} from '../../api-utilities/api-utilities.types';\nimport { mergeDecimalRange } from '../../api-utilities/decimal-range/merge-decimal-range';\nimport { DecimalRange } from '../../generated';\n\nconst getExtendedModelPriceRange = (\n item: ExtendedApartmentBuilding | ExtendedPropertyType,\n): DecimalRange | undefined => {\n const { constructionNumbers } = item;\n let range: DecimalRange;\n\n if (!constructionNumbers || !constructionNumbers.length) {\n if (!('propertyTypes' in item) || !item.propertyTypes || !item.propertyTypes.length) return;\n\n range = item.propertyTypes\n .filter(\n (propertyType) =>\n propertyType.status !== 'Sold' && propertyType.status !== 'UnderConstruction',\n )\n .reduce<DecimalRange>((range, propertyType) => {\n const { rentalPrice, salesPrice } = propertyType;\n\n // Do not include PriceOnRequest price types\n if (rentalPrice?.amount && rentalPrice.priceType !== 'PriceOnRequest')\n return mergeDecimalRange(range, rentalPrice.amount);\n if (salesPrice?.amount && salesPrice.priceType !== 'PriceOnRequest')\n return mergeDecimalRange(range, salesPrice.amount);\n\n return range;\n }, {});\n } else {\n range = constructionNumbers\n .filter(\n (constructionNumber) =>\n constructionNumber.status !== 'Sold' &&\n constructionNumber.status !== 'UnderConstruction',\n )\n .reduce<DecimalRange>((range, constructionNumber) => {\n const { rentalPrice, salesPrice } = constructionNumber;\n\n // Do not include PriceOnRequest price types\n if (rentalPrice?.amount && rentalPrice.priceType !== 'PriceOnRequest')\n return mergeDecimalRange(range, rentalPrice.amount);\n if (salesPrice?.amount && salesPrice.priceType !== 'PriceOnRequest')\n return mergeDecimalRange(range, salesPrice.amount);\n\n return range;\n }, {});\n }\n\n return range;\n};\n\nexport { getExtendedModelPriceRange };\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { findApartmentBuilding, findConstructionNumber, findProjectPhase, findPropertyType, } from '../../api-utilities';
|
|
2
|
-
const findExtendedObjectById = ({ constructionNumbers, propertyTypes, apartmentBuildings, projectPhases, districts, }, id) => {
|
|
3
|
-
const constructionNumber = findConstructionNumber(constructionNumbers, { id });
|
|
4
|
-
if (constructionNumber)
|
|
5
|
-
return constructionNumber;
|
|
6
|
-
const propertyType = findPropertyType(propertyTypes, { id });
|
|
7
|
-
if (propertyType)
|
|
8
|
-
return propertyType;
|
|
9
|
-
const apartmentBuilding = findApartmentBuilding(apartmentBuildings, { id });
|
|
10
|
-
if (apartmentBuilding)
|
|
11
|
-
return apartmentBuilding;
|
|
12
|
-
const projectPhase = findProjectPhase(projectPhases, { id });
|
|
13
|
-
if (projectPhase)
|
|
14
|
-
return projectPhase;
|
|
15
|
-
const district = districts.find((district) => district.id === id);
|
|
16
|
-
if (district)
|
|
17
|
-
return district;
|
|
18
|
-
return;
|
|
19
|
-
};
|
|
20
|
-
export { findExtendedObjectById };
|
|
21
|
-
//# sourceMappingURL=find-extended-object.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find-extended-object.js","sourceRoot":"","sources":["../../../../src/extended-api-models/utilities/find-extended-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAMH,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,GACnB,MAAM,qBAAqB,CAAC;AAe7B,MAAM,sBAAsB,GAAG,CAC3B,EACI,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,SAAS,GACQ,EACrB,EAAU,EAQE,EAAE;IACd,MAAM,kBAAkB,GAAG,sBAAsB,CAAC,mBAAmB,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC/E,IAAI,kBAAkB;QAAE,OAAO,kBAAkB,CAAC;IAElD,MAAM,YAAY,GAAG,gBAAgB,CAAC,aAAa,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7D,IAAI,YAAY;QAAE,OAAO,YAAY,CAAC;IAEtC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,kBAAkB,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC5E,IAAI,iBAAiB;QAAE,OAAO,iBAAiB,CAAC;IAEhD,MAAM,YAAY,GAAG,gBAAgB,CAAC,aAAa,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7D,IAAI,YAAY;QAAE,OAAO,YAAY,CAAC;IAEtC,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAClE,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAE9B,OAAO;AACX,CAAC,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC","sourcesContent":["import {\n ExtendedApartmentBuilding,\n ExtendedConstructionNumber,\n ExtendedDistrict,\n ExtendedProjectPhase,\n ExtendedPropertyType,\n findApartmentBuilding,\n findConstructionNumber,\n findProjectPhase,\n findPropertyType,\n} from '../../api-utilities';\nimport { ExtendedAreaModels } from '../extended-area';\n\n/**\n * @description Finds and returns the extended API Object with the set id.\n * @param {ExtendedAreaModels} { constructionNumbers, propertyTypes, apartmentBuildings, projectPhases }\n * @param {string} id\n * @return {*} {(ExtendedConstructionNumber\n * | ExtendedPropertyType\n * | ExtendedApartmentBuilding\n * | ExtendedProjectPhase\n * | ExtendedProjectPhase\n * | ExtendedDistrict\n * | undefined)}\n */\nconst findExtendedObjectById = (\n {\n constructionNumbers,\n propertyTypes,\n apartmentBuildings,\n projectPhases,\n districts,\n }: ExtendedAreaModels,\n id: string,\n):\n | ExtendedConstructionNumber\n | ExtendedPropertyType\n | ExtendedApartmentBuilding\n | ExtendedProjectPhase\n | ExtendedProjectPhase\n | ExtendedDistrict\n | undefined => {\n const constructionNumber = findConstructionNumber(constructionNumbers, { id });\n if (constructionNumber) return constructionNumber;\n\n const propertyType = findPropertyType(propertyTypes, { id });\n if (propertyType) return propertyType;\n\n const apartmentBuilding = findApartmentBuilding(apartmentBuildings, { id });\n if (apartmentBuilding) return apartmentBuilding;\n\n const projectPhase = findProjectPhase(projectPhases, { id });\n if (projectPhase) return projectPhase;\n\n const district = districts.find((district) => district.id === id);\n if (district) return district;\n\n return;\n};\n\nexport { findExtendedObjectById };\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const isApartment = ({ constructionNumber, propertyType, }) => {
|
|
2
|
-
var _a;
|
|
3
|
-
let houseType;
|
|
4
|
-
if (propertyType) {
|
|
5
|
-
houseType = propertyType.houseType;
|
|
6
|
-
}
|
|
7
|
-
if (constructionNumber) {
|
|
8
|
-
houseType = (_a = constructionNumber.propertyType) === null || _a === void 0 ? void 0 : _a.houseType;
|
|
9
|
-
}
|
|
10
|
-
return ['Appartement', 'Loft', 'Maisonette', 'Studio'].includes(houseType || '');
|
|
11
|
-
};
|
|
12
|
-
export { isApartment };
|
|
13
|
-
//# sourceMappingURL=is-apartment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-apartment.js","sourceRoot":"","sources":["../../../../src/extended-api-models/utilities/is-apartment.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,GAAgB,CAAC,EAC9B,kBAAkB,EAClB,YAAY,GAIf,EAAW,EAAE;;IACV,IAAI,SAAoC,CAAC;IAEzC,IAAI,YAAY,EAAE;QACd,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC;KACtC;IAED,IAAI,kBAAkB,EAAE;QACpB,SAAS,SAAG,kBAAkB,CAAC,YAAY,0CAAE,SAAS,CAAC;KAC1D;IAED,OAAO,CAAC,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;AACrF,CAAC,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import {\n ExtendedConstructionNumber,\n ExtendedPropertyType,\n} from '../../api-utilities/api-utilities.types';\n\ninterface IsApartment {\n (obj: { constructionNumber: ExtendedConstructionNumber }): boolean;\n (obj: { propertyType: ExtendedPropertyType }): boolean;\n}\n\nconst isApartment: IsApartment = ({\n constructionNumber,\n propertyType,\n}: {\n constructionNumber?: ExtendedConstructionNumber;\n propertyType?: ExtendedPropertyType;\n}): boolean => {\n let houseType: string | undefined | null;\n\n if (propertyType) {\n houseType = propertyType.houseType;\n }\n\n if (constructionNumber) {\n houseType = constructionNumber.propertyType?.houseType;\n }\n\n return ['Appartement', 'Loft', 'Maisonette', 'Studio'].includes(houseType || '');\n};\n\nexport { isApartment };\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"function-is-true.js","sourceRoot":"","sources":["../../src/function-is-true.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAY,EAAE,EAAE;IAC3C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC3B,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;YAC9B,IAAI,EAAE,EAAE,EAAE;gBACN,aAAa,CAAC,QAAQ,CAAC,CAAC;gBACxB,OAAO,EAAE,CAAC;aACb;QACL,CAAC,EAAE,EAAE,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACP,CAAC,CAAC","sourcesContent":["export const functionIsTrue = (fn: Function) => {\n return new Promise((resolve) => {\n const interval = setInterval(() => {\n if (fn()) {\n clearInterval(interval);\n resolve();\n }\n }, 50);\n });\n};\n"]}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { APIClient } from '../api';
|
|
2
|
-
export const apartmentBuildingQuery = (params, config) => APIClient.get(`/api/apartmentbuildings`, params, config).then((res) => res);
|
|
3
|
-
export const apartmentBuildingUpdateApartmentBuilding = (nodeId, body, config) => APIClient.put(`/api/apartmentbuildings/${nodeId}`, body, config).then((res) => res);
|
|
4
|
-
export const apartmentBuildingDeleteApartmentBuilding = (nodeId, body, config) => APIClient.delete(`/api/apartmentbuildings/${nodeId}`, body, config).then((res) => res);
|
|
5
|
-
export const apartmentBuildingGetByExternalId = (nodeId, params, config) => APIClient.get(`/api/apartmentbuildings/${nodeId}`, params, config).then((res) => res);
|
|
6
|
-
export const areaProjectGetById = (id, params, config) => APIClient.get(`/api/areaprojects/${id}`, params, config).then((res) => res);
|
|
7
|
-
export const areaProjectQuery = (params, config) => APIClient.get(`/api/areaprojects`, params, config).then((res) => res);
|
|
8
|
-
export const cityGetByName = (name, params, config) => APIClient.get(`/api/cities/name/${name}`, params, config).then((res) => res);
|
|
9
|
-
export const cityGetById = (id, params, config) => APIClient.get(`/api/cities/${id}`, params, config).then((res) => res);
|
|
10
|
-
export const cityQuery = (params, config) => APIClient.get(`/api/cities`, params, config).then((res) => res);
|
|
11
|
-
export const communityRedirectAsset = (objectType, id, params, config) => APIClient.get(`/api/community/asset/${objectType}/${id}`, params, config).then((res) => res);
|
|
12
|
-
export const constructionNumberGetById = (id, params, config) => APIClient.get(`/api/constructionnumbers/${id}`, params, config).then((res) => res);
|
|
13
|
-
export const constructionNumberQuery = (params, config) => APIClient.get(`/api/constructionnumbers`, params, config).then((res) => res);
|
|
14
|
-
export const countryGetByIsoCode = (isoCode, params, config) => APIClient.get(`/api/countries/isoCode/${isoCode}`, params, config).then((res) => res);
|
|
15
|
-
export const countryGetById = (id, params, config) => APIClient.get(`/api/countries/${id}`, params, config).then((res) => res);
|
|
16
|
-
export const countryQuery = (params, config) => APIClient.get(`/api/countries`, params, config).then((res) => res);
|
|
17
|
-
export const districtGetById = (id, params, config) => APIClient.get(`/api/districts/${id}`, params, config).then((res) => res);
|
|
18
|
-
export const districtQuery = (params, config) => APIClient.get(`/api/districts`, params, config).then((res) => res);
|
|
19
|
-
export const formLead = (body, config) => APIClient.post(`/api/forms/lead`, body, config).then((res) => res);
|
|
20
|
-
export const formCase = (body, config) => APIClient.post(`/api/forms/case`, body, config).then((res) => res);
|
|
21
|
-
export const formDynamic = (body, config) => APIClient.post(`/api/forms/dynamic`, body, config).then((res) => res);
|
|
22
|
-
export const fundaQuery = (params, config) => APIClient.get(`/api/Funda/query`, params, config).then((res) => res);
|
|
23
|
-
export const fundaGet = (params, config) => APIClient.get(`/api/Funda`, params, config).then((res) => res);
|
|
24
|
-
export const fundaSubmit = (body, config) => APIClient.post(`/api/Funda/submit`, body, config).then((res) => res);
|
|
25
|
-
export const fundaValidate = (body, config) => APIClient.post(`/api/Funda/validate`, body, config).then((res) => res);
|
|
26
|
-
export const fundaShowLastSubmittedProject = (params, config) => APIClient.get(`/api/Funda/ShowLastSubmittedProject`, params, config).then((res) => res);
|
|
27
|
-
export const fundaShowConvertedFundaObject = (params, config) => APIClient.get(`/api/Funda/ShowConvertedFundaObject`, params, config).then((res) => res);
|
|
28
|
-
export const fundaCompareFundaObjectRevisionChanges = (params, config) => APIClient.get(`/api/Funda/CompareFundaObjectRevisionChanges`, params, config).then((res) => res);
|
|
29
|
-
export const fundaShowFundaProjectLogs = (params, config) => APIClient.get(`/api/Funda/ShowFundaProjectLogs`, params, config).then((res) => res);
|
|
30
|
-
export const fundaExecuteFundaPublisher = (params, config) => APIClient.get(`/api/Funda/ExecuteFundaPublisher`, params, config).then((res) => res);
|
|
31
|
-
export const fundaGetAllGwnVersionsByProjectId = (params, config) => APIClient.get(`/api/Funda/GetAllGwnVersionsByProjectId`, params, config).then((res) => res);
|
|
32
|
-
export const fundaRemoveVersionFromGwn = (params, config) => APIClient.get(`/api/Funda/RemoveVersionFromGwn`, params, config).then((res) => res);
|
|
33
|
-
export const fundaGetActiveBrokersInGateway = (params, config) => APIClient.get(`/api/Funda/GetActiveBrokersInGateway`, params, config).then((res) => res);
|
|
34
|
-
export const geoFeatureUpsertGeoFeature = (areaId, objectId, body, config) => APIClient.put(`/api/geofeature/${areaId}/${objectId}`, body, config).then((res) => res);
|
|
35
|
-
export const geoFeatureUpsertAreaFeatures = (areaId, body, config) => APIClient.put(`/api/geofeature/${areaId}`, body, config).then((res) => res);
|
|
36
|
-
export const geoFeatureDeleteGeoFeature = (areaId, objectId, featureId, body, config) => APIClient.delete(`/api/geofeature/${areaId}/${objectId}/${featureId}`, body, config).then((res) => res);
|
|
37
|
-
export const grantGetById = (id, params, config) => APIClient.get(`/api/grants/${id}`, params, config).then((res) => res);
|
|
38
|
-
export const grantQuery = (params, config) => APIClient.get(`/api/grants`, params, config).then((res) => res);
|
|
39
|
-
export const projectPhaseGetById = (id, params, config) => APIClient.get(`/api/projectphases/${id}`, params, config).then((res) => res);
|
|
40
|
-
export const projectPhaseQuery = (params, config) => APIClient.get(`/api/projectphases`, params, config).then((res) => res);
|
|
41
|
-
export const propertyTypeGetById = (id, params, config) => APIClient.get(`/api/propertytypes/${id}`, params, config).then((res) => res);
|
|
42
|
-
export const propertyTypeQuery = (params, config) => APIClient.get(`/api/propertytypes`, params, config).then((res) => res);
|
|
43
|
-
export const provinceGetByName = (name, params, config) => APIClient.get(`/api/provinces/name/${name}`, params, config).then((res) => res);
|
|
44
|
-
export const provinceGetById = (id, params, config) => APIClient.get(`/api/provinces/${id}`, params, config).then((res) => res);
|
|
45
|
-
export const provinceQuery = (params, config) => APIClient.get(`/api/provinces`, params, config).then((res) => res);
|
|
46
|
-
export const regionGetById = (id, params, config) => APIClient.get(`/api/region/${id}`, params, config).then((res) => res);
|
|
47
|
-
export const regionQuery = (params, config) => APIClient.get(`/api/region`, params, config).then((res) => res);
|
|
48
|
-
export const resourceUpdateResource = (mediaId, body, config) => APIClient.put(`/api/resources/${mediaId}`, body, config).then((res) => res);
|
|
49
|
-
export const resourceDeleteResource = (mediaId, body, config) => APIClient.delete(`/api/resources/${mediaId}`, body, config).then((res) => res);
|
|
50
|
-
//# sourceMappingURL=bpd-client.js.map
|