@omnic/widget-locations 1.1.7 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,11 @@
1
1
  /// <reference types="google.maps" />
2
+ /**
3
+ * Creates zoom controls for the map.
4
+ * @param map - The Google Map instance.
5
+ */
2
6
  export declare const createZoomControls: (map: google.maps.Map) => void;
7
+ /**
8
+ * Creates a control for displaying the user's current location on the map.
9
+ * @param map - The Google Map instance.
10
+ */
3
11
  export declare const createCurrentLocationControl: (map: google.maps.Map) => void;
@@ -5,7 +5,6 @@ export declare const BALLOON_DETAILS_ID: string;
5
5
  export declare const MARKER_SIZE: Size;
6
6
  export declare const SCALED_MARKER_SIZE: Size;
7
7
  export declare const FALLBACK_ZOOM = 6;
8
- export declare const SELECTED_PLACE_ZOOM = 10;
9
8
  export declare const FALLBACK_CENTER: Coordinates;
10
9
  export declare const FALLBACK_LOCALE: Locale;
11
10
  export declare const GOOGLE_MAP_LIBRARIES: LoadScriptProps["libraries"];
@@ -1,4 +1,11 @@
1
1
  export interface UseGeoCenterOption {
2
2
  disableGeolocation?: boolean;
3
3
  }
4
+ /**
5
+ * A custom hook that handles the centering of the map based on the provided coordinates.
6
+ *
7
+ * @param center - The center coordinates.
8
+ * @param zoom - The zoom level of the map.
9
+ * @param options - The options for the hook.
10
+ */
4
11
  export declare const useGeoCenter: (center: Coordinates, zoom: number, options?: UseGeoCenterOption) => void;
@@ -1,2 +1,7 @@
1
1
  import type { Locale } from '../types/i18n';
2
+ /**
3
+ * Watches the locale and changes the language in Tolgee and Geocode accordingly.
4
+ *
5
+ * @param locale - The locale to watch.
6
+ */
2
7
  export declare const useLocaleWatcher: (locale: Nullable<Locale>) => void;
@@ -1,11 +1,39 @@
1
1
  /// <reference types="google.maps" />
2
+ import type { GeoLocationType } from '../utils';
2
3
  interface State {
3
4
  place: Nullable<google.maps.places.PlaceResult>;
4
5
  }
5
6
  interface Action {
6
- setPlace(place: Nullable<google.maps.places.PlaceResult>, zoom?: number): void;
7
+ /**
8
+ * Set the selected place.
9
+ *
10
+ * @param place - The selected place.
11
+ * @param types - The types of the place.
12
+ * @returns A promise that resolves when the place is set.
13
+ */
14
+ setPlace(place: Nullable<google.maps.places.PlaceResult>): Promise<google.maps.places.PlaceResult>;
15
+ /**
16
+ * Set the selected place.
17
+ *
18
+ * @param coordinates - The selected place.
19
+ * @param types - The types of the place.
20
+ * @returns A promise that resolves when the place is set.
21
+ */
22
+ setPlace(coordinates: Coordinates, types?: GeoLocationType[]): Promise<google.maps.places.PlaceResult>;
7
23
  }
24
+ /**
25
+ * Selects the delivery address from the state.
26
+ *
27
+ * @param state - The state object.
28
+ * @returns The selected delivery address.
29
+ */
8
30
  export declare const selectDeliveryAddress: (state: State) => Nullable<google.maps.places.PlaceResult>;
31
+ /**
32
+ * Returns the selected address locality from the state.
33
+ *
34
+ * @param state - The state object.
35
+ * @returns The selected address locality.
36
+ */
9
37
  export declare const selectedAddressLocality: (state: State) => google.maps.GeocoderAddressComponent | undefined;
10
38
  export declare const useDeliveryAddressStore: import("zustand").UseBoundStore<import("zustand").StoreApi<State & Action>>;
11
39
  export {};
@@ -3,8 +3,19 @@ interface State {
3
3
  location: Nullable<DeliveryPoint>;
4
4
  }
5
5
  interface Action {
6
+ /**
7
+ * Sets the delivery point.
8
+ *
9
+ * @param point - The delivery point.
10
+ */
6
11
  setDeliverPoint(point: Nullable<DeliveryPoint>): void;
7
12
  }
13
+ /**
14
+ * Selects the delivery point from the state.
15
+ *
16
+ * @param state - The state object.
17
+ * @returns The selected delivery point.
18
+ */
8
19
  export declare const selectDeliveryPoint: (state: State) => Nullable<DeliveryPoint>;
9
20
  export declare const useDeliveryPointStore: import("zustand").UseBoundStore<import("zustand").StoreApi<State & Action>>;
10
21
  export {};
@@ -0,0 +1,42 @@
1
+ /// <reference types="google.maps" />
2
+ interface PlusCode {
3
+ compound_code: string;
4
+ global_code: string;
5
+ }
6
+ interface GetAddressFromLatLngResponse {
7
+ plus_code: PlusCode;
8
+ results?: Array<google.maps.places.PlaceResult>;
9
+ status: string | "OK";
10
+ }
11
+ type PlaceId = string;
12
+ export type GeoLocationType = "ROOFTOP" | "GEOMETRIC_CENTER" | "RANGE_INTERPOLATED" | "GEOMETRIC_CENTER" | "APPROXIMATE";
13
+ /**
14
+ * Checks if a value is a place ID.
15
+ *
16
+ * @param value - The value to check.
17
+ * @returns True if the value is a place ID, false otherwise.
18
+ */
19
+ export declare const isPlaceId: (value: unknown) => value is string;
20
+ /**
21
+ * Checks if a value is coordinates.
22
+ *
23
+ * @param value - The value to check.
24
+ * @returns True if the value is coordinates, false otherwise.
25
+ */
26
+ export declare const isCoordinates: (value: unknown) => value is Coordinates;
27
+ /**
28
+ * Retrieves the address information from a place ID.
29
+ *
30
+ * @param placeId - The place ID.
31
+ * @returns A promise that resolves to the address information.
32
+ */
33
+ export declare function getAddressFormGeocode(placeId: PlaceId): Promise<GetAddressFromLatLngResponse>;
34
+ /**
35
+ * Retrieves the address information from a set of coordinates.
36
+ *
37
+ * @param coordinates - The coordinates.
38
+ * @param types - The types of the location.
39
+ * @returns A promise that resolves to the address information.
40
+ */
41
+ export declare function getAddressFormGeocode(coordinates: Coordinates, types?: GeoLocationType[]): Promise<GetAddressFromLatLngResponse>;
42
+ export {};
@@ -4,7 +4,7 @@ export * from "./getBoundsFromPoint";
4
4
  export * from "./createPointsIterator";
5
5
  export * from "./setWidgetCSSProperty";
6
6
  export * from "./stopImmediatePropagation";
7
- export * from "./getAddressFromLatLng";
7
+ export * from "./getAddressFormGeocode";
8
8
  export * from "./getCurrentPosition";
9
9
  export * from "./isHttpSuccess";
10
10
  export * from "./getPropertyValue";