@wikicasa-dev/utilities 0.0.9 → 0.0.11

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.
Files changed (45) hide show
  1. package/dist/custom/constants.d.ts +2 -0
  2. package/dist/custom/icons.d.ts +5 -0
  3. package/dist/custom/leaflet_map.d.ts +99 -0
  4. package/dist/index.d.ts +34 -0
  5. package/dist/services/agencyAPI.d.ts +19 -0
  6. package/dist/services/geographyAPI.d.ts +9 -0
  7. package/dist/services/insightsAPI.d.ts +2 -0
  8. package/dist/services/mailAPI.d.ts +24 -0
  9. package/dist/services/placesAPI.d.ts +5 -0
  10. package/dist/services/portfolioCustomerAPI.d.ts +1 -0
  11. package/dist/services/publicUserAPI.d.ts +20 -0
  12. package/dist/services/realEstateAPI.d.ts +14 -0
  13. package/dist/services/requestAPI.d.ts +16 -0
  14. package/dist/services/servicesUtils.d.ts +8 -0
  15. package/dist/services/statisticsAPI.d.ts +9 -0
  16. package/dist/services/valuationAPI.d.ts +11 -0
  17. package/dist/services/wikicasaPro.d.ts +2 -0
  18. package/dist/utilities.js +2706 -34
  19. package/dist/utilities.umd.cjs +5 -1
  20. package/dist/utils/AppRedirectUtils.d.ts +1 -0
  21. package/dist/utils/ArrayUtils.d.ts +1 -0
  22. package/dist/utils/ColorUtils.d.ts +4 -0
  23. package/dist/utils/CookieUtils.d.ts +4 -0
  24. package/dist/utils/CurrencyUtils.d.ts +1 -0
  25. package/dist/utils/DOMUtils.d.ts +5 -0
  26. package/dist/utils/DeviceDetectionUtils.d.ts +8 -0
  27. package/dist/utils/EmailUtils.d.ts +2 -0
  28. package/dist/utils/FavoriteUtils.d.ts +2 -0
  29. package/dist/utils/FunctionUtils.d.ts +10 -0
  30. package/dist/utils/GAEvents.d.ts +2 -0
  31. package/dist/utils/GAutocompleteUtils.d.ts +6 -0
  32. package/dist/utils/GenericUtils.d.ts +6 -0
  33. package/dist/utils/LazyLoadingBg.d.ts +0 -0
  34. package/dist/utils/MapUtils.d.ts +23 -0
  35. package/dist/utils/ObjectUtils.d.ts +8 -0
  36. package/dist/utils/ObserverUtils.d.ts +4 -0
  37. package/dist/utils/PermissionUtils.d.ts +10 -0
  38. package/dist/utils/RESB_UrlBuilder.d.ts +11 -0
  39. package/dist/utils/RequestUtils.d.ts +2 -0
  40. package/dist/utils/StringUtils.d.ts +12 -0
  41. package/dist/utils/URLBuilderUtils.d.ts +9 -0
  42. package/dist/utils/URLPagesFactory.d.ts +9 -0
  43. package/package.json +21 -2
  44. package/dist/main.d.ts +0 -2
  45. /package/dist/{NumberUtils.d.ts → utils/NumberUtils.d.ts} +0 -0
@@ -0,0 +1,2 @@
1
+ export declare const MAP_TILER_STYLE = "ac216796-6d5d-4f21-a7ce-d80a4b3a45e4";
2
+ export declare const MAP_TILER_TOKEN = "pk.eyJ1Ijoid2lraWNhc2EiLCJhIjoiY2pqZnVlNXFrMHRzMTNwcGF4aXd2a3N5ZiJ9.BctgdXWxGJ9JRMp2U-SyRw";
@@ -0,0 +1,5 @@
1
+ /// <reference types="jquery" />
2
+ /// <reference types="jquery" />
3
+ export declare const SVG = "<svg viewBox=\"0 0 128 128\" class=\"icon-spin\"><circle class=\"path\" cx=\"64\" cy=\"64\" r=\"42\" fill=\"none\" stroke-width=\"9\"></circle></svg>";
4
+ export declare function addSpinner(btn: HTMLElement | JQuery, append?: boolean): void;
5
+ export declare function removeSpinner(btn: HTMLElement | JQuery): void;
@@ -0,0 +1,99 @@
1
+ /// <reference types="jquery" />
2
+ /// <reference types="jquery" />
3
+ /// <reference types="jquery" />
4
+ import type { LatLng, MarkerCluster, Popup, Marker, Polyline, MarkerClusterGroup, FitBoundsOptions } from "leaflet";
5
+ declare global {
6
+ interface Window {
7
+ _cdn: string;
8
+ touch: boolean;
9
+ }
10
+ }
11
+ export declare const MAX_ZOOM = 18;
12
+ interface LMap extends L.Map {
13
+ touchExtend: Record<string, any>;
14
+ }
15
+ /**
16
+ * @author Andrea Moraglia
17
+ */
18
+ export default class {
19
+ private markers;
20
+ private callbacks;
21
+ private initialized;
22
+ private markerClusterer;
23
+ private clusterHightlight;
24
+ private map;
25
+ private mapContainer;
26
+ private infowindow;
27
+ private infowindowCarousel;
28
+ private freeDraw;
29
+ private shapeLayer;
30
+ private config;
31
+ private drawHandler;
32
+ private spinner;
33
+ private buttonsWrapper;
34
+ private spinnerIcon;
35
+ private drawing;
36
+ private search;
37
+ constructor();
38
+ findMarker(id: number): Marker | undefined;
39
+ findCluster(id: number): Marker | undefined;
40
+ highlightCluster(cluster: MarkerCluster): void;
41
+ highlightMarker(id: number): void;
42
+ clearHighlight(): void;
43
+ addMarkerBulk(data: Array<Marker>, center: L.LatLng | null, limit: number, icon?: string): void;
44
+ addMarker(key: number | null, position: LatLng, icon?: any): void;
45
+ addCompleteMarker(marker: Marker): void;
46
+ removeMarker(id: number): void;
47
+ getVisibleMarkersId(): Array<number>;
48
+ initMarkerClusterer(): Promise<unknown>;
49
+ detachMarkerClusterer(): void;
50
+ attachMarkerClusterer(): void;
51
+ disableControls(): void;
52
+ enableControls(): void;
53
+ setDrawing(): void;
54
+ stopDrawing(): void;
55
+ isDrawing(): boolean;
56
+ initDrawingManager(): Promise<unknown>;
57
+ drawPolygonFromPoints(latLngs: Array<LatLng>): void;
58
+ deleteMarkers(): void;
59
+ deleteShape(): void;
60
+ hasShape(): boolean;
61
+ getShape(): Polyline;
62
+ getShapePoints(): Array<LatLng>;
63
+ initSearch(): Promise<unknown>;
64
+ isInitialized(): boolean;
65
+ getInfowindow(): Popup;
66
+ getInfowindowCarousel(): Popup;
67
+ getMap(): LMap;
68
+ getMapContainer(): HTMLElement;
69
+ getMarkers(): Map<number, Marker>;
70
+ getMarkersCount(): number;
71
+ getMarkerClusterer(): MarkerClusterGroup;
72
+ addListener(obj: any, event: string, fn: (args?: any) => unknown | void): void;
73
+ init(selector: JQuery, apiKey: string, COLORS: Record<string, string>, opts?: any, longLat?: {
74
+ longitude: number;
75
+ latitude: number;
76
+ } | null, zoom?: number): void;
77
+ load(config: any, apiKey: string, opts: any): void;
78
+ startSpinner(): void;
79
+ stopSpinner(): void;
80
+ ready(fn: () => unknown): void;
81
+ on(event: string, fn: any): void;
82
+ setCenter(lat: number, lng: number, zoom?: number): void;
83
+ setZoom(zoom: number): void;
84
+ getZoom(): number;
85
+ reset(): void;
86
+ fitBounds(myBounds: {
87
+ getNorthEast: () => LatLng;
88
+ getSouthWest: () => LatLng;
89
+ }, opts?: FitBoundsOptions): void;
90
+ fitZoom(myPoint: LatLng): void;
91
+ validateCoordinate(lat: number, lng: number): boolean;
92
+ getDistance(latLng: LatLng, otherLatLng: LatLng): number;
93
+ geocode(address: string): JQueryPromise<unknown>;
94
+ isMarkerInsidePolygon(coordinates: Array<number>, points: Array<LatLng>): boolean;
95
+ addButton(btn: JQuery): void;
96
+ addTouchHandler(): void;
97
+ }
98
+ export declare function getL(): any;
99
+ export {};
@@ -0,0 +1,34 @@
1
+ export { sendAgencyContactAsync, getAgencyById, sendMortgage, getAgenciesData, } from './services/agencyAPI';
2
+ export { getPlacesAddressAutocomplete, getPlacesDetails, guessPlace, getPlaceFromPlaceID, getCountryPolygonJSON, getRegionPolygonJSON, getProvincePolygonJSON, getCityPolygonJSON, } from './services/geographyAPI';
3
+ export { getTransactionGraphData } from './services/insightsAPI';
4
+ export { sendInfoPremium, sendBrochureRequest, sendJobApplicationForm, sendBrochureMR, sendInfoMR, } from './services/mailAPI';
5
+ export { getPlacesByQuery, getPlace, getZones, getDistrictsByZoneId, } from './services/placesAPI';
6
+ export { updateNewsletterConsent } from './services/portfolioCustomerAPI';
7
+ export { getMenuInfo, getPublicUser, getMarketingConsent, deleteAllSaveSearch, deleteSaveSearch, getFavourites, addUserFavorite, deleteUserFavorite, updateNote, removeFavourites, saveUserFirebaseToken, deleteUserFirebaseToken, updateMarketingConsent, getPublicUserSaveSearchList, updatePublicUserSavedSearchBean, getSavedSearchesCount, } from './services/publicUserAPI';
8
+ export { getRealEstateNotes, saveSearch, saveSearchFromRequest, getRealEstateCounter, getRealEstatesData, getMapMarkers, } from './services/realEstateAPI';
9
+ export { sendSuggestion, addGenericRequest, sendWidgetRequest, } from './services/requestAPI';
10
+ export { handleAxiosError } from './services/servicesUtils';
11
+ export { updateViewListing, updateRealEstateSearch, updatePhoneView, getPlaceTrendData, getSaleGraphData, } from './services/statisticsAPI';
12
+ export { evaluateRealEstateWidget } from './services/valuationAPI';
13
+ export { userValuationWithPhotoFeedback } from './services/wikicasaPro';
14
+ export { redirectToApp } from './utils/AppRedirectUtils';
15
+ export { isArrNullOrEmpty } from './utils/ArrayUtils';
16
+ export { rgba } from './utils/ColorUtils';
17
+ export { encodeCookie, getCookie, decodeCookie, removeCookie, } from './utils/CookieUtils';
18
+ export { formatCurrency } from './utils/CurrencyUtils';
19
+ export { isiOSDevice, isMobile, isSafari } from './utils/DeviceDetectionUtils';
20
+ export { getSingleElement, emptyElem, showElem, hideElem, } from './utils/DOMUtils';
21
+ export { hashEmail } from './utils/EmailUtils';
22
+ export { showAddFavoritesIcon, showRemoveFavoritesIcons, } from './utils/FavoriteUtils';
23
+ export { sendGAEvent } from './utils/GAEvents';
24
+ export { googlePlaceConverter, getPlaceFromGAutocomplete, } from './utils/GAutocompleteUtils';
25
+ export { awaitableSetTimeout } from './utils/GenericUtils';
26
+ export { formatInteger, formatFloat, parseLocaleNumber, formatLocaleNumber, formatNumber, formatterNumberObj, } from './utils/NumberUtils';
27
+ export { isEmptyObject, shallowCopyObjectTo, deepCopy, } from './utils/ObjectUtils';
28
+ export { observeOnce } from './utils/ObserverUtils';
29
+ export { addPermissionStateListener, onNotificationsPermissionChange, } from './utils/PermissionUtils';
30
+ export { sendRequestGeneric } from './utils/RequestUtils';
31
+ export { buildURL, buildParams, buildParamsForAgency, } from './utils/RESB_UrlBuilder';
32
+ export { replaceAll, replaceAllTokens, capitalizeFirstLetter, formatAddress, decodeTextWithEntities, cleanASCII, } from './utils/StringUtils';
33
+ export { appendQueryString } from './utils/URLBuilderUtils';
34
+ export { getURLPage } from './utils/URLPagesFactory';
@@ -0,0 +1,19 @@
1
+ import type { AgencyItem, MapMarker, Contacts, Nullable } from "@wikicasa-dev/types/dist/index.d.ts";
2
+ declare global {
3
+ interface Window {
4
+ _serializedAgencySearchBean?: Nullable<any>;
5
+ }
6
+ }
7
+ export declare const sendAgencyContactAsync: (data: Contacts) => Promise<boolean>;
8
+ export declare const getAgencyById: (agencyId: number, lang: string) => Promise<AgencyItem>;
9
+ export declare const sendMortgage: (data: {
10
+ name: string;
11
+ email: string;
12
+ phone: string;
13
+ url: string;
14
+ realEstateId: number;
15
+ price: number;
16
+ tenantId: number;
17
+ }) => Promise<boolean>;
18
+ export declare const getAgenciesData: (ids: Array<number>) => Promise<AgencyItem[]>;
19
+ export declare const getMapMarkers: () => Promise<Array<MapMarker> | undefined>;
@@ -0,0 +1,9 @@
1
+ import type { Place, GAutocompleteTypes, GooglePredictionType, GPlaceDetails, Nullable } from "@wikicasa-dev/types/dist/index.d.ts";
2
+ export declare const getPlacesAddressAutocomplete: (query: string, radius: number, types?: GAutocompleteTypes[]) => Promise<GooglePredictionType[]>;
3
+ export declare const getPlacesDetails: (placeId: string) => Promise<GPlaceDetails>;
4
+ export declare const guessPlace: (latitude?: number, longitude?: number) => Promise<Place>;
5
+ export declare const getPlaceFromPlaceID: (id?: Nullable<number>) => Promise<Place>;
6
+ export declare const getCountryPolygonJSON: (id: number) => Promise<any>;
7
+ export declare const getRegionPolygonJSON: (id: number) => Promise<any>;
8
+ export declare const getCityPolygonJSON: (id: number) => Promise<any>;
9
+ export declare const getProvincePolygonJSON: (id: number) => Promise<any>;
@@ -0,0 +1,2 @@
1
+ import type { Place, GraphData } from "@wikicasa-dev/types/dist/index.d.ts";
2
+ export declare const getTransactionGraphData: (place: Place) => Promise<GraphData[]>;
@@ -0,0 +1,24 @@
1
+ type InfoPremiumPayload = {
2
+ name: string;
3
+ phone: string;
4
+ agency?: string;
5
+ agency_name?: string;
6
+ email: string;
7
+ contact_preference: number;
8
+ service?: string;
9
+ };
10
+ export declare const sendInfoPremium: (data: InfoPremiumPayload) => Promise<boolean>;
11
+ export declare const sendBrochureRequest: (data: {
12
+ email: string;
13
+ }) => Promise<boolean>;
14
+ export declare const sendJobApplicationForm: (data: FormData) => Promise<boolean>;
15
+ export declare const sendBrochureMR: (data: {
16
+ email: string;
17
+ }) => Promise<boolean>;
18
+ export declare const sendInfoMR: (data: {
19
+ phone: string;
20
+ email: string;
21
+ agency: string;
22
+ name?: string;
23
+ }) => Promise<boolean>;
24
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { PLACE_TYPE, Place } from "@wikicasa-dev/types/dist/index.d.ts";
2
+ export declare const getPlacesByQuery: (value: string, placeType?: PLACE_TYPE[], provinceId?: number | string | null) => Promise<Place[]>;
3
+ export declare function getPlace(query: string, types?: string): Promise<Array<Place>>;
4
+ export declare function getZones(cityID: number): Promise<Array<Place>>;
5
+ export declare const getDistrictsByZoneId: (zoneID: number) => Promise<Place[]>;
@@ -0,0 +1 @@
1
+ export declare const updateNewsletterConsent: (email: string) => Promise<boolean>;
@@ -0,0 +1,20 @@
1
+ import type { PublicUser, PublicUserMenuInfo, SaveSearchBean } from "@wikicasa-dev/types/dist/index.d.ts";
2
+ export declare const getMenuInfo: () => Promise<PublicUserMenuInfo>;
3
+ export declare const getPublicUser: () => Promise<PublicUser>;
4
+ export declare const getMarketingConsent: (email: string) => Promise<boolean>;
5
+ export declare const deleteAllSaveSearch: () => Promise<number>;
6
+ export declare const deleteSaveSearch: (id: number) => Promise<string>;
7
+ export declare const getFavourites: () => Promise<number[]>;
8
+ export declare const addUserFavorite: (id: number) => Promise<boolean>;
9
+ export declare const deleteUserFavorite: (id: number) => Promise<boolean>;
10
+ export declare const updateNote: (id: number, note: string | null) => Promise<boolean>;
11
+ export declare const removeFavourites: () => Promise<boolean>;
12
+ export declare const saveUserFirebaseToken: (firebaseToken: string) => Promise<boolean>;
13
+ export declare const deleteUserFirebaseToken: (firebaseToken: string) => Promise<boolean>;
14
+ export declare const updateMarketingConsent: (data: {
15
+ email: string;
16
+ marketingConsent: boolean;
17
+ }) => Promise<boolean>;
18
+ export declare const getPublicUserSaveSearchList: (offset?: number, limit?: number) => Promise<Array<any>>;
19
+ export declare const updatePublicUserSavedSearchBean: (savedSearchBean: SaveSearchBean) => Promise<SaveSearchBean>;
20
+ export declare const getSavedSearchesCount: () => Promise<number>;
@@ -0,0 +1,14 @@
1
+ import { AxiosResponse } from "axios";
2
+ import type { RealEstateSearchBean, MapMarker, RealEstateMiniItem, Nullable } from "@wikicasa-dev/types/dist/index.d.ts";
3
+ declare global {
4
+ interface Window {
5
+ _serializedSearchBean?: Nullable<any>;
6
+ _locale: string;
7
+ }
8
+ }
9
+ export declare const getRealEstateNotes: (realEstateId: number) => Promise<string>;
10
+ export declare const saveSearch: (email: string, title: string, hourly: boolean, resb: RealEstateSearchBean, pushNotifications?: boolean) => Promise<AxiosResponse>;
11
+ export declare const saveSearchFromRequest: (email: string, searchBean: RealEstateSearchBean, pushNotifications?: boolean) => Promise<boolean>;
12
+ export declare const getRealEstateCounter: (resb: RealEstateSearchBean) => Promise<number | null>;
13
+ export declare const getRealEstatesData: (ids: Array<number>) => Promise<Array<RealEstateMiniItem> | null>;
14
+ export declare const getMapMarkers: () => Promise<Array<MapMarker> | undefined>;
@@ -0,0 +1,16 @@
1
+ import type { Contacts } from "@wikicasa-dev/types/dist/index.d.ts";
2
+ export declare const sendSuggestion: (suggestion: {
3
+ argument: string;
4
+ email: string;
5
+ message: string;
6
+ privacy: boolean;
7
+ url: string;
8
+ }) => Promise<boolean>;
9
+ export declare const addGenericRequest: (data: Contacts) => Promise<boolean>;
10
+ export declare const sendWidgetRequest: (suggestion: {
11
+ name: string;
12
+ company: string;
13
+ email: string;
14
+ phone: string;
15
+ privacy: boolean;
16
+ }) => Promise<boolean>;
@@ -0,0 +1,8 @@
1
+ import { AxiosError } from "axios";
2
+ declare global {
3
+ interface Window {
4
+ _baseURLIt: string;
5
+ }
6
+ }
7
+ export declare const baseURL: string;
8
+ export declare const handleAxiosError: (error: AxiosError) => void;
@@ -0,0 +1,9 @@
1
+ import type { Place, GraphData } from "@wikicasa-dev/types/dist/index.d.ts";
2
+ export declare const updateViewListing: (data: Array<{
3
+ agencyId: number;
4
+ realEstateId: number;
5
+ }>) => Promise<boolean>;
6
+ export declare const updateRealEstateSearch: (realEstateSearchBean: any) => Promise<boolean>;
7
+ export declare const updatePhoneView: (agencyId: number, id: number) => Promise<boolean>;
8
+ export declare const getPlaceTrendData: (place: Place) => Promise<any>;
9
+ export declare const getSaleGraphData: (place: Place, filters?: any) => Promise<GraphData[]>;
@@ -0,0 +1,11 @@
1
+ import type { PublicValuation, Nullable } from "@wikicasa-dev/types/dist/index.d.ts";
2
+ export interface ValuationResult extends Record<string, number | boolean | undefined> {
3
+ valid: boolean;
4
+ upper: number;
5
+ mean: number;
6
+ lower: number;
7
+ estimated: number;
8
+ count: number;
9
+ maxDistance?: number;
10
+ }
11
+ export declare const evaluateRealEstateWidget: (publicValuation: PublicValuation, token: Nullable<string>, conditionTypeId?: number | undefined, floor?: number | undefined) => Promise<PublicValuation>;
@@ -0,0 +1,2 @@
1
+ import type { FEEDBACK } from "@wikicasa-dev/types/dist/index";
2
+ export declare const userValuationWithPhotoFeedback: (email: string, token: string, feedback: FEEDBACK, userFeedbackValue?: number) => Promise<boolean>;