@wikicasa-dev/utilities 0.2.0 → 1.0.0
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/ArrayUtils.cjs +1 -0
- package/dist/ArrayUtils.js +4 -0
- package/dist/ColorUtils.cjs +1 -0
- package/dist/ColorUtils.js +8 -0
- package/dist/CookieUtils.cjs +1 -0
- package/dist/CookieUtils.js +32 -0
- package/dist/CurrencyUtils.cjs +1 -0
- package/dist/CurrencyUtils.js +14 -0
- package/dist/DOMUtils.cjs +1 -0
- package/dist/DOMUtils.js +18 -0
- package/dist/DateUtils.cjs +1 -0
- package/dist/DateUtils.js +7 -0
- package/dist/DeviceDetectionUtils.cjs +1 -0
- package/dist/DeviceDetectionUtils.js +8 -0
- package/dist/EmailUtils.cjs +1 -0
- package/dist/EmailUtils.js +27 -0
- package/dist/FunctionUtils.cjs +1 -0
- package/dist/FunctionUtils.js +21 -0
- package/dist/GenericUtils.cjs +1 -0
- package/dist/GenericUtils.js +25 -0
- package/dist/LazyLoadingBg.cjs +1 -0
- package/dist/LazyLoadingBg.js +13 -0
- package/dist/NumberUtils.cjs +1 -0
- package/dist/NumberUtils.js +50 -0
- package/dist/ObjectUtils.cjs +1 -0
- package/dist/ObjectUtils.js +23 -0
- package/dist/ObserverUtils.cjs +1 -0
- package/dist/ObserverUtils.js +20 -0
- package/dist/PermissionUtils.cjs +1 -0
- package/dist/PermissionUtils.js +18 -0
- package/dist/RESB_UrlBuilder.cjs +1 -0
- package/dist/RESB_UrlBuilder.js +80 -0
- package/dist/StringUtils.cjs +1 -0
- package/dist/StringUtils.js +40 -0
- package/dist/URLBuilderUtils.cjs +1 -0
- package/dist/URLBuilderUtils.js +11 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +17 -34
- package/dist/index.js +62 -0
- package/dist/main.cjs +1 -0
- package/dist/vite-env.cjs +1 -0
- package/dist/vite-env.js +1 -0
- package/package.json +17 -13
- package/dist/custom/constants.d.ts +0 -2
- package/dist/custom/icons.d.ts +0 -5
- package/dist/custom/leaflet_map.d.ts +0 -99
- package/dist/services/agencyAPI.d.ts +0 -19
- package/dist/services/geographyAPI.d.ts +0 -9
- package/dist/services/insightsAPI.d.ts +0 -2
- package/dist/services/mailAPI.d.ts +0 -24
- package/dist/services/placesAPI.d.ts +0 -5
- package/dist/services/portfolioCustomerAPI.d.ts +0 -1
- package/dist/services/publicUserAPI.d.ts +0 -20
- package/dist/services/realEstateAPI.d.ts +0 -14
- package/dist/services/requestAPI.d.ts +0 -16
- package/dist/services/servicesUtils.d.ts +0 -8
- package/dist/services/statisticsAPI.d.ts +0 -9
- package/dist/services/valuationAPI.d.ts +0 -11
- package/dist/services/wikicasaPro.d.ts +0 -2
- package/dist/utilities.cjs +0 -5
- package/dist/utilities.iife.js +0 -5
- package/dist/utilities.mjs +0 -2437
- package/dist/utils/FavoriteUtils.d.ts +0 -2
- package/dist/utils/GAutocompleteUtils.d.ts +0 -6
- package/dist/utils/MapUtils.d.ts +0 -23
- package/dist/utils/RequestUtils.d.ts +0 -2
- package/dist/utils/URLPagesFactory.d.ts +0 -9
- package/index.html +0 -13
- package/src/custom/constants.ts +0 -3
- package/src/custom/icons.ts +0 -63
- package/src/custom/leaflet_map.ts +0 -946
- package/src/index.ts +0 -171
- package/src/services/agencyAPI.ts +0 -105
- package/src/services/geographyAPI.ts +0 -129
- package/src/services/insightsAPI.ts +0 -20
- package/src/services/mailAPI.ts +0 -89
- package/src/services/placesAPI.ts +0 -72
- package/src/services/portfolioCustomerAPI.ts +0 -16
- package/src/services/publicUserAPI.ts +0 -216
- package/src/services/realEstateAPI.ts +0 -133
- package/src/services/requestAPI.ts +0 -40
- package/src/services/servicesUtils.ts +0 -27
- package/src/services/statisticsAPI.ts +0 -84
- package/src/services/valuationAPI.ts +0 -45
- package/src/services/wikicasaPro.ts +0 -25
- package/src/utils/ArrayUtils.ts +0 -2
- package/src/utils/ColorUtils.ts +0 -11
- package/src/utils/CookieUtils.ts +0 -43
- package/src/utils/CurrencyUtils.ts +0 -18
- package/src/utils/DOMUtils.ts +0 -28
- package/src/utils/DateUtils.ts +0 -9
- package/src/utils/DeviceDetectionUtils.ts +0 -17
- package/src/utils/EmailUtils.ts +0 -45
- package/src/utils/FavoriteUtils.ts +0 -19
- package/src/utils/FunctionUtils.ts +0 -29
- package/src/utils/GAutocompleteUtils.ts +0 -70
- package/src/utils/GenericUtils.ts +0 -37
- package/src/utils/LazyLoadingBg.ts +0 -18
- package/src/utils/MapUtils.ts +0 -118
- package/src/utils/NumberUtils.ts +0 -90
- package/src/utils/ObjectUtils.ts +0 -34
- package/src/utils/ObserverUtils.ts +0 -32
- package/src/utils/PermissionUtils.ts +0 -41
- package/src/utils/RESB_UrlBuilder.ts +0 -99
- package/src/utils/RequestUtils.ts +0 -20
- package/src/utils/StringUtils.ts +0 -75
- package/src/utils/URLBuilderUtils.ts +0 -21
- package/src/utils/URLPagesFactory.ts +0 -20
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.json +0 -38
- package/vite.config.ts +0 -42
- /package/{src/main.ts → dist/main.js} +0 -0
package/src/index.ts
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
// SERVICE
|
|
2
|
-
export {
|
|
3
|
-
sendAgencyContactAsync,
|
|
4
|
-
getAgencyById,
|
|
5
|
-
sendMortgage,
|
|
6
|
-
getAgenciesData,
|
|
7
|
-
} from "@services/agencyAPI";
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
getPlacesAddressAutocomplete,
|
|
11
|
-
getPlacesDetails,
|
|
12
|
-
guessPlace,
|
|
13
|
-
getPlaceFromPlaceID,
|
|
14
|
-
getCountryPolygonJSON,
|
|
15
|
-
getRegionPolygonJSON,
|
|
16
|
-
getProvincePolygonJSON,
|
|
17
|
-
getCityPolygonJSON,
|
|
18
|
-
} from "@services/geographyAPI";
|
|
19
|
-
|
|
20
|
-
export { getTransactionGraphData } from "@services/insightsAPI";
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
sendInfoPremium,
|
|
24
|
-
sendBrochureRequest,
|
|
25
|
-
sendJobApplicationForm,
|
|
26
|
-
sendBrochureMR,
|
|
27
|
-
sendInfoMR,
|
|
28
|
-
} from "@services/mailAPI";
|
|
29
|
-
|
|
30
|
-
export {
|
|
31
|
-
getPlacesByQuery,
|
|
32
|
-
getPlace,
|
|
33
|
-
getZones,
|
|
34
|
-
getDistrictsByZoneId,
|
|
35
|
-
} from "@services/placesAPI";
|
|
36
|
-
|
|
37
|
-
export { updateNewsletterConsent } from "@services/portfolioCustomerAPI";
|
|
38
|
-
|
|
39
|
-
export {
|
|
40
|
-
getMenuInfo,
|
|
41
|
-
getPublicUser,
|
|
42
|
-
getMarketingConsent,
|
|
43
|
-
deleteAllSaveSearch,
|
|
44
|
-
deleteSaveSearch,
|
|
45
|
-
getFavourites,
|
|
46
|
-
addUserFavorite,
|
|
47
|
-
deleteUserFavorite,
|
|
48
|
-
updateNote,
|
|
49
|
-
removeFavourites,
|
|
50
|
-
saveUserFirebaseToken,
|
|
51
|
-
deleteUserFirebaseToken,
|
|
52
|
-
updateMarketingConsent,
|
|
53
|
-
getPublicUserSaveSearchList,
|
|
54
|
-
updatePublicUserSavedSearchBean,
|
|
55
|
-
getSavedSearchesCount,
|
|
56
|
-
} from "@services/publicUserAPI";
|
|
57
|
-
|
|
58
|
-
export {
|
|
59
|
-
getRealEstateNotes,
|
|
60
|
-
saveSearch,
|
|
61
|
-
saveSearchFromRequest,
|
|
62
|
-
getRealEstateCounter,
|
|
63
|
-
getRealEstatesData,
|
|
64
|
-
getMapMarkers,
|
|
65
|
-
} from "@services/realEstateAPI";
|
|
66
|
-
|
|
67
|
-
export {
|
|
68
|
-
sendSuggestion,
|
|
69
|
-
addGenericRequest,
|
|
70
|
-
sendWidgetRequest,
|
|
71
|
-
} from "@services/requestAPI";
|
|
72
|
-
|
|
73
|
-
export { handleAxiosError } from "@services/servicesUtils";
|
|
74
|
-
|
|
75
|
-
export {
|
|
76
|
-
updateViewListing,
|
|
77
|
-
updateRealEstateSearch,
|
|
78
|
-
updatePhoneView,
|
|
79
|
-
getPlaceTrendData,
|
|
80
|
-
getSaleGraphData,
|
|
81
|
-
} from "@services/statisticsAPI";
|
|
82
|
-
|
|
83
|
-
export { evaluateRealEstateWidget } from "@services/valuationAPI";
|
|
84
|
-
|
|
85
|
-
export { userValuationWithPhotoFeedback } from "@services/wikicasaPro";
|
|
86
|
-
|
|
87
|
-
// UTILITIES
|
|
88
|
-
|
|
89
|
-
export { isArrNullOrEmpty } from "@utils/ArrayUtils";
|
|
90
|
-
|
|
91
|
-
export { rgba } from "@utils/ColorUtils";
|
|
92
|
-
|
|
93
|
-
export {
|
|
94
|
-
encodeCookie,
|
|
95
|
-
getCookie,
|
|
96
|
-
decodeCookie,
|
|
97
|
-
removeCookie,
|
|
98
|
-
} from "@utils/CookieUtils";
|
|
99
|
-
|
|
100
|
-
export { formatCurrency } from "@utils/CurrencyUtils";
|
|
101
|
-
|
|
102
|
-
export { formatDate } from "@utils/DateUtils";
|
|
103
|
-
|
|
104
|
-
export { isiOSDevice, isMobile, isSafari } from "@utils/DeviceDetectionUtils";
|
|
105
|
-
|
|
106
|
-
export {
|
|
107
|
-
getSingleElement,
|
|
108
|
-
emptyElem,
|
|
109
|
-
showElem,
|
|
110
|
-
hideElem,
|
|
111
|
-
} from "@utils/DOMUtils";
|
|
112
|
-
|
|
113
|
-
export { hashEmail } from "@utils/EmailUtils";
|
|
114
|
-
|
|
115
|
-
export { debounce } from "@utils/FunctionUtils";
|
|
116
|
-
|
|
117
|
-
export {
|
|
118
|
-
showAddFavoritesIcon,
|
|
119
|
-
showRemoveFavoritesIcons,
|
|
120
|
-
} from "@utils/FavoriteUtils";
|
|
121
|
-
|
|
122
|
-
export {
|
|
123
|
-
googlePlaceConverter,
|
|
124
|
-
getPlaceFromGAutocomplete,
|
|
125
|
-
} from "@utils/GAutocompleteUtils";
|
|
126
|
-
|
|
127
|
-
export { awaitableSetTimeout } from "@utils/GenericUtils";
|
|
128
|
-
|
|
129
|
-
export {
|
|
130
|
-
formatInteger,
|
|
131
|
-
formatFloat,
|
|
132
|
-
parseLocaleNumber,
|
|
133
|
-
formatLocaleNumber,
|
|
134
|
-
formatNumber,
|
|
135
|
-
formatterNumberObj,
|
|
136
|
-
} from "@utils/NumberUtils";
|
|
137
|
-
|
|
138
|
-
export {
|
|
139
|
-
isEmptyObject,
|
|
140
|
-
shallowCopyObjectTo,
|
|
141
|
-
deepCopy,
|
|
142
|
-
} from "@utils/ObjectUtils";
|
|
143
|
-
|
|
144
|
-
export { observeOnce } from "@utils/ObserverUtils";
|
|
145
|
-
|
|
146
|
-
export {
|
|
147
|
-
addPermissionStateListener,
|
|
148
|
-
onNotificationsPermissionChange,
|
|
149
|
-
} from "@utils/PermissionUtils";
|
|
150
|
-
|
|
151
|
-
export { sendRequestGeneric } from "@utils/RequestUtils";
|
|
152
|
-
|
|
153
|
-
export {
|
|
154
|
-
buildURL,
|
|
155
|
-
buildParams,
|
|
156
|
-
buildParamsForAgency,
|
|
157
|
-
} from "@utils/RESB_UrlBuilder";
|
|
158
|
-
|
|
159
|
-
export {
|
|
160
|
-
replaceAll,
|
|
161
|
-
replaceAllTokens,
|
|
162
|
-
capitalizeFirstLetter,
|
|
163
|
-
formatAddress,
|
|
164
|
-
decodeTextWithEntities,
|
|
165
|
-
cleanASCII,
|
|
166
|
-
stringToHyphened
|
|
167
|
-
} from "@utils/StringUtils";
|
|
168
|
-
|
|
169
|
-
export { appendQueryString } from "@utils/URLBuilderUtils";
|
|
170
|
-
|
|
171
|
-
export { getURLPage } from "@utils/URLPagesFactory";
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { baseURL, handleAxiosError } from "./servicesUtils";
|
|
2
|
-
import axios, { AxiosError } from "axios";
|
|
3
|
-
import type {
|
|
4
|
-
AgencyItem,
|
|
5
|
-
MapMarker,
|
|
6
|
-
Contacts,
|
|
7
|
-
Nullable,
|
|
8
|
-
} from "@wikicasa-dev/types";
|
|
9
|
-
import { deepCopy } from "@utils/ObjectUtils";
|
|
10
|
-
|
|
11
|
-
declare global {
|
|
12
|
-
interface Window {
|
|
13
|
-
_serializedAgencySearchBean?: Nullable<any>;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const baseController = `${baseURL}/rest/agency`;
|
|
18
|
-
|
|
19
|
-
export const sendAgencyContactAsync = async (
|
|
20
|
-
data: Contacts
|
|
21
|
-
): Promise<boolean> => {
|
|
22
|
-
try {
|
|
23
|
-
const res = await axios.post(`${baseController}/agencyContacts`, data);
|
|
24
|
-
return res.data as boolean;
|
|
25
|
-
} catch (error) {
|
|
26
|
-
handleAxiosError(error as AxiosError);
|
|
27
|
-
throw error;
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
export const getAgencyById = async (
|
|
31
|
-
agencyId: number,
|
|
32
|
-
lang: string
|
|
33
|
-
): Promise<AgencyItem> => {
|
|
34
|
-
try {
|
|
35
|
-
const res = await axios.get(
|
|
36
|
-
`/rest/agency/getAgencyByIDLang/${agencyId}/${lang}`
|
|
37
|
-
);
|
|
38
|
-
return res.data;
|
|
39
|
-
} catch (error) {
|
|
40
|
-
handleAxiosError(error as AxiosError);
|
|
41
|
-
throw error;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
export const sendMortgage = async (data: {
|
|
45
|
-
name: string;
|
|
46
|
-
email: string;
|
|
47
|
-
phone: string;
|
|
48
|
-
url: string;
|
|
49
|
-
realEstateId: number;
|
|
50
|
-
price: number;
|
|
51
|
-
tenantId: number;
|
|
52
|
-
}): Promise<boolean> => {
|
|
53
|
-
try {
|
|
54
|
-
const res = await axios.post("/rest/agency/sendMutuo", data);
|
|
55
|
-
return res.data;
|
|
56
|
-
} catch (error) {
|
|
57
|
-
handleAxiosError(error as AxiosError);
|
|
58
|
-
throw error;
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export const getAgenciesData = async (
|
|
63
|
-
ids: Array<number>
|
|
64
|
-
): Promise<AgencyItem[]> => {
|
|
65
|
-
try {
|
|
66
|
-
const res = await axios.post(
|
|
67
|
-
`${baseController}/getAgencyListForInfoWindow`,
|
|
68
|
-
ids
|
|
69
|
-
);
|
|
70
|
-
return res.data as AgencyItem[];
|
|
71
|
-
} catch (error) {
|
|
72
|
-
handleAxiosError(error as AxiosError);
|
|
73
|
-
throw error;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export const getMapMarkers = async (): Promise<
|
|
78
|
-
Array<MapMarker> | undefined
|
|
79
|
-
> => {
|
|
80
|
-
if (!window["_serializedAgencySearchBean"]) return;
|
|
81
|
-
|
|
82
|
-
const agencySearchBean = deepCopy(
|
|
83
|
-
JSON.parse(window["_serializedAgencySearchBean"])
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
delete agencySearchBean["latitude"];
|
|
87
|
-
delete agencySearchBean["longitude"];
|
|
88
|
-
|
|
89
|
-
try {
|
|
90
|
-
const res = await axios.post(
|
|
91
|
-
`${baseController}/getAgenciesMarkers`,
|
|
92
|
-
agencySearchBean,
|
|
93
|
-
{
|
|
94
|
-
headers: {
|
|
95
|
-
"Content-Type": "application/json",
|
|
96
|
-
Accept: "application/json",
|
|
97
|
-
},
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
return res.data as MapMarker[];
|
|
101
|
-
} catch (error) {
|
|
102
|
-
handleAxiosError(error as AxiosError);
|
|
103
|
-
throw [];
|
|
104
|
-
}
|
|
105
|
-
};
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import axios, { AxiosError } from "axios";
|
|
2
|
-
import { v4 as uuidv4 } from "uuid";
|
|
3
|
-
import type {
|
|
4
|
-
Place,
|
|
5
|
-
GAutocompleteTypes,
|
|
6
|
-
GooglePredictionType,
|
|
7
|
-
GPlaceDetails,
|
|
8
|
-
Nullable,
|
|
9
|
-
} from "@wikicasa-dev/types";
|
|
10
|
-
|
|
11
|
-
import { appendQueryString } from "@utils/URLBuilderUtils";
|
|
12
|
-
import { handleAxiosError, baseURL } from "./servicesUtils";
|
|
13
|
-
|
|
14
|
-
const baseController = `${baseURL}/rest/geography`;
|
|
15
|
-
|
|
16
|
-
let sessionToken = uuidv4();
|
|
17
|
-
|
|
18
|
-
export const getPlacesAddressAutocomplete = async (
|
|
19
|
-
query: string,
|
|
20
|
-
radius: number,
|
|
21
|
-
types: GAutocompleteTypes[] = []
|
|
22
|
-
): Promise<GooglePredictionType[]> => {
|
|
23
|
-
if (!sessionToken) sessionToken = uuidv4();
|
|
24
|
-
|
|
25
|
-
const url = new URL(`${baseController}/placesAddressAutocomplete`);
|
|
26
|
-
|
|
27
|
-
const length = types.length;
|
|
28
|
-
const _types = types.reduce((acc, cur, currentIndex) => {
|
|
29
|
-
if (length === 1) return cur;
|
|
30
|
-
|
|
31
|
-
if (currentIndex === length - 1) return acc;
|
|
32
|
-
|
|
33
|
-
return (acc += `${cur}|`);
|
|
34
|
-
}, "");
|
|
35
|
-
|
|
36
|
-
const urlWithQueryString = appendQueryString(url, {
|
|
37
|
-
query,
|
|
38
|
-
radius,
|
|
39
|
-
sessionToken: sessionToken,
|
|
40
|
-
types: _types,
|
|
41
|
-
});
|
|
42
|
-
const res = await axios.get(urlWithQueryString.toString());
|
|
43
|
-
if (res.data.status !== "OK")
|
|
44
|
-
throw new Error("There was an error in the request");
|
|
45
|
-
|
|
46
|
-
return res.data.predictions as GooglePredictionType[];
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const getPlacesDetails = async (
|
|
50
|
-
placeId: string
|
|
51
|
-
): Promise<GPlaceDetails> => {
|
|
52
|
-
const url = new URL(`${baseController}/getPlacesDetails`);
|
|
53
|
-
const urlWithQueryString = appendQueryString(url, {
|
|
54
|
-
placeId,
|
|
55
|
-
sessionToken: sessionToken,
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
const res = await axios.get(urlWithQueryString.toString());
|
|
59
|
-
sessionToken = "";
|
|
60
|
-
|
|
61
|
-
if (res.data.status !== "OK")
|
|
62
|
-
throw new Error("There was an error in the request");
|
|
63
|
-
|
|
64
|
-
return res.data.result as GPlaceDetails;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export const guessPlace = async (
|
|
68
|
-
latitude?: number,
|
|
69
|
-
longitude?: number
|
|
70
|
-
): Promise<Place> => {
|
|
71
|
-
const url = new URL(
|
|
72
|
-
`${baseController}/guessCityPlace/${latitude}/${longitude}`
|
|
73
|
-
);
|
|
74
|
-
const res = await axios.get(url.toString());
|
|
75
|
-
return res.data as Place;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export const getPlaceFromPlaceID = async (
|
|
79
|
-
id?: Nullable<number>
|
|
80
|
-
): Promise<Place> => {
|
|
81
|
-
if (id === null || id === undefined) throw new Error("The id can't be null");
|
|
82
|
-
|
|
83
|
-
const res = await axios.get(`${baseController}/getPlaceFromPlaceID/${id}`);
|
|
84
|
-
return res.data as Place;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export const getCountryPolygonJSON = async (id: number): Promise<any> => {
|
|
88
|
-
try {
|
|
89
|
-
const res = await axios.get(
|
|
90
|
-
`${baseController}/getCountryPolygonJson/${id}`
|
|
91
|
-
);
|
|
92
|
-
return res.data;
|
|
93
|
-
} catch (e) {
|
|
94
|
-
handleAxiosError(e as AxiosError);
|
|
95
|
-
throw e;
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export const getRegionPolygonJSON = async (id: number): Promise<any> => {
|
|
100
|
-
try {
|
|
101
|
-
const res = await axios.get(`${baseController}/getRegionPolygonJson/${id}`);
|
|
102
|
-
return res.data;
|
|
103
|
-
} catch (e) {
|
|
104
|
-
handleAxiosError(e as AxiosError);
|
|
105
|
-
throw e;
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
export const getCityPolygonJSON = async (id: number): Promise<any> => {
|
|
110
|
-
try {
|
|
111
|
-
const res = await axios.get(`${baseController}/getCityPolygonJson/${id}`);
|
|
112
|
-
return res.data;
|
|
113
|
-
} catch (e) {
|
|
114
|
-
handleAxiosError(e as AxiosError);
|
|
115
|
-
throw e;
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
export const getProvincePolygonJSON = async (id: number): Promise<any> => {
|
|
120
|
-
try {
|
|
121
|
-
const res = await axios.get(
|
|
122
|
-
`${baseController}/getProvincePolygonJson/${id}`
|
|
123
|
-
);
|
|
124
|
-
return res.data;
|
|
125
|
-
} catch (e) {
|
|
126
|
-
handleAxiosError(e as AxiosError);
|
|
127
|
-
throw e;
|
|
128
|
-
}
|
|
129
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import axios, { AxiosError } from "axios";
|
|
2
|
-
import { handleAxiosError } from "./servicesUtils";
|
|
3
|
-
import type { Place, GraphData } from "@wikicasa-dev/types";
|
|
4
|
-
|
|
5
|
-
const baseStatisticControllerUrl = "/rest/insights";
|
|
6
|
-
|
|
7
|
-
export const getTransactionGraphData = async (
|
|
8
|
-
place: Place
|
|
9
|
-
): Promise<GraphData[]> => {
|
|
10
|
-
try {
|
|
11
|
-
const res = await axios.post(
|
|
12
|
-
`${baseStatisticControllerUrl}/getTransactionsGraphData`,
|
|
13
|
-
place
|
|
14
|
-
);
|
|
15
|
-
return res.data;
|
|
16
|
-
} catch (error) {
|
|
17
|
-
handleAxiosError(error as AxiosError);
|
|
18
|
-
throw error;
|
|
19
|
-
}
|
|
20
|
-
};
|
package/src/services/mailAPI.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import axios, { AxiosError } from "axios";
|
|
2
|
-
import { baseURL, handleAxiosError } from "./servicesUtils";
|
|
3
|
-
|
|
4
|
-
const baseController = `${baseURL}/rest/mail`;
|
|
5
|
-
|
|
6
|
-
type InfoPremiumPayload = {
|
|
7
|
-
name: string;
|
|
8
|
-
phone: string;
|
|
9
|
-
agency?: string;
|
|
10
|
-
agency_name?: string;
|
|
11
|
-
email: string;
|
|
12
|
-
contact_preference: number;
|
|
13
|
-
service?: string;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const sendInfoPremium = async (
|
|
17
|
-
data: InfoPremiumPayload
|
|
18
|
-
): Promise<boolean> => {
|
|
19
|
-
try {
|
|
20
|
-
const res = await axios.post(`${baseController}/infoPremium`, data);
|
|
21
|
-
return res.data as boolean;
|
|
22
|
-
} catch (err) {
|
|
23
|
-
handleAxiosError(err as AxiosError);
|
|
24
|
-
throw err;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const sendBrochureRequest = async (data: {
|
|
29
|
-
email: string;
|
|
30
|
-
}): Promise<boolean> => {
|
|
31
|
-
try {
|
|
32
|
-
const res = await axios.post(`${baseController}/sendBrochurePremium`, data);
|
|
33
|
-
return res.data as boolean;
|
|
34
|
-
} catch (err) {
|
|
35
|
-
handleAxiosError(err as AxiosError);
|
|
36
|
-
throw err;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const sendJobApplicationForm = async (
|
|
41
|
-
data: FormData
|
|
42
|
-
): Promise<boolean> => {
|
|
43
|
-
try {
|
|
44
|
-
const res = await axios.post<boolean>(
|
|
45
|
-
`${baseController}/submitJobApplication`,
|
|
46
|
-
data,
|
|
47
|
-
{
|
|
48
|
-
headers: {
|
|
49
|
-
"Content-Type": "multipart/form-data",
|
|
50
|
-
},
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
return res.data;
|
|
54
|
-
} catch (e) {
|
|
55
|
-
handleAxiosError(e as AxiosError);
|
|
56
|
-
throw e;
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
/* Market Report */
|
|
61
|
-
export const sendBrochureMR = async (data: {
|
|
62
|
-
email: string;
|
|
63
|
-
}): Promise<boolean> => {
|
|
64
|
-
try {
|
|
65
|
-
const res = await axios.post<boolean>(
|
|
66
|
-
`${baseController}/sendBrochureMR`,
|
|
67
|
-
data
|
|
68
|
-
);
|
|
69
|
-
return res.data;
|
|
70
|
-
} catch (e) {
|
|
71
|
-
handleAxiosError(e as AxiosError);
|
|
72
|
-
throw e;
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export const sendInfoMR = async (data: {
|
|
77
|
-
phone: string;
|
|
78
|
-
email: string;
|
|
79
|
-
agency: string;
|
|
80
|
-
name?: string;
|
|
81
|
-
}): Promise<boolean> => {
|
|
82
|
-
try {
|
|
83
|
-
const res = await axios.post<boolean>(`${baseController}/infoMR`, data);
|
|
84
|
-
return res.data;
|
|
85
|
-
} catch (e) {
|
|
86
|
-
handleAxiosError(e as AxiosError);
|
|
87
|
-
throw e;
|
|
88
|
-
}
|
|
89
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import axios, { AxiosError } from "axios";
|
|
2
|
-
import { handleAxiosError } from "./servicesUtils";
|
|
3
|
-
import type { PLACE_TYPE, Place } from "@wikicasa-dev/types";
|
|
4
|
-
import { appendQueryString } from "@utils/URLBuilderUtils";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const baseURL = window["_baseURLIt"];
|
|
8
|
-
const baseController = "/ws";
|
|
9
|
-
|
|
10
|
-
export const getPlacesByQuery = async (
|
|
11
|
-
value: string,
|
|
12
|
-
placeType: PLACE_TYPE[] = [],
|
|
13
|
-
provinceId: number | string | null = ""
|
|
14
|
-
): Promise<Place[]> => {
|
|
15
|
-
try {
|
|
16
|
-
if (!provinceId) provinceId = "";
|
|
17
|
-
|
|
18
|
-
const res = await axios.get(
|
|
19
|
-
`${baseController}/places?query=${value}&type=${placeType.join(",")}${
|
|
20
|
-
provinceId ? `&provinceID=${provinceId}` : ""
|
|
21
|
-
}`
|
|
22
|
-
);
|
|
23
|
-
return res.data as Place[];
|
|
24
|
-
} catch (err) {
|
|
25
|
-
handleAxiosError(err as AxiosError);
|
|
26
|
-
throw err;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export function getPlace(
|
|
31
|
-
query: string,
|
|
32
|
-
types = "C,P,Z,L,I,R,A"
|
|
33
|
-
): Promise<Array<Place>> {
|
|
34
|
-
return new Promise((resolve) => {
|
|
35
|
-
axios
|
|
36
|
-
.get(`${baseController}/places?query=${query}&type=${types}`)
|
|
37
|
-
.then((response) => {
|
|
38
|
-
if (!response?.data) {
|
|
39
|
-
resolve([]);
|
|
40
|
-
}
|
|
41
|
-
resolve(response?.data);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function getZones(cityID: number): Promise<Array<Place>> {
|
|
47
|
-
return new Promise((resolve) => {
|
|
48
|
-
axios.get(`${baseController}/zones?cityID=${cityID}`).then((response) => {
|
|
49
|
-
if (!response?.data) {
|
|
50
|
-
resolve([]);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
resolve(response?.data);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export const getDistrictsByZoneId = async (
|
|
59
|
-
zoneID: number
|
|
60
|
-
): Promise<Place[]> => {
|
|
61
|
-
try {
|
|
62
|
-
const res = await axios.get(
|
|
63
|
-
appendQueryString(new URL(`${baseURL}${baseController}/districts`), {
|
|
64
|
-
zoneID,
|
|
65
|
-
}).toString()
|
|
66
|
-
);
|
|
67
|
-
return res.data as Place[];
|
|
68
|
-
} catch (e) {
|
|
69
|
-
handleAxiosError(e as AxiosError);
|
|
70
|
-
throw e;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import axios, { AxiosError } from "axios";
|
|
2
|
-
import { handleAxiosError } from "./servicesUtils";
|
|
3
|
-
|
|
4
|
-
export const updateNewsletterConsent = async (
|
|
5
|
-
email: string
|
|
6
|
-
): Promise<boolean> => {
|
|
7
|
-
try {
|
|
8
|
-
const res = await axios.post(
|
|
9
|
-
`/rest/portfolioCustomer/updateNewsletterConsent/?email=${email}`
|
|
10
|
-
);
|
|
11
|
-
return res.data;
|
|
12
|
-
} catch (error) {
|
|
13
|
-
handleAxiosError(error as AxiosError);
|
|
14
|
-
throw error;
|
|
15
|
-
}
|
|
16
|
-
};
|