@omnic/widget-locations 1.1.49 → 1.1.50
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/README.md +3 -0
- package/dist/lib/hooks/usePointsLoader.d.ts +7 -1
- package/dist/lib/services/points.d.ts +8 -7
- package/dist/lib/stores/locationPoints.d.ts +11 -2
- package/dist/lib/types/config.d.ts +3 -0
- package/dist/lib/utils/createPointsIterator.d.ts +8 -2
- package/dist/lib/widget.cjs.js +18 -18
- package/dist/lib/widget.esm.js +521 -496
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -166,6 +166,9 @@ Then `OMNIC_WIDGET_LOCATIONS_CONFIG` has the following structure:
|
|
|
166
166
|
| onLocationSelect | function | Callback that will be called when user selects a location Callback will be called with `google.maps.places.PlaceResult` argument |
|
|
167
167
|
| onCloseLocationSelector | function | Callback that will be called when user closes location selector |
|
|
168
168
|
| gMapKey | string | google map key |
|
|
169
|
+
| countryAbbreviation | string | used for points loading |
|
|
170
|
+
| regionName | string | used for points loading |
|
|
171
|
+
| cityName | string | used for points loading |
|
|
169
172
|
|
|
170
173
|
`WidgetInputs` type has the following structure:
|
|
171
174
|
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
interface UsePointsLoaderArgs {
|
|
2
|
+
cityName?: string;
|
|
3
|
+
countryAbbreviation?: string;
|
|
4
|
+
regionName?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const usePointsLoader: ({ cityName, countryAbbreviation, regionName }: UsePointsLoaderArgs) => void;
|
|
7
|
+
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LoadPointsParams } from '../stores/locationPoints';
|
|
2
2
|
import type { PointsList } from '../types/points';
|
|
3
|
-
interface FetchPointsRequestParams {
|
|
4
|
-
q?: string;
|
|
5
|
-
bounds?: Nullable<Bounds>;
|
|
6
|
-
filter?: Nullable<Filter>;
|
|
7
|
-
}
|
|
8
3
|
interface FetchPointsRequestOptions {
|
|
9
4
|
controller?: AbortController;
|
|
10
5
|
}
|
|
11
|
-
|
|
6
|
+
interface FetchPointsRequestArgs {
|
|
7
|
+
loadPointsParams?: LoadPointsParams;
|
|
8
|
+
q?: string;
|
|
9
|
+
bounds?: Nullable<Bounds>;
|
|
10
|
+
options?: FetchPointsRequestOptions;
|
|
11
|
+
}
|
|
12
|
+
export declare function fetchPointsRequest({ bounds, loadPointsParams: { city_name, country_abbreviation, filter, region_name }, options: { controller }, q, }: FetchPointsRequestArgs): AsyncGenerator<import("axios").AxiosResponse<HttpResponse<PointsList>, any>, import("axios").AxiosResponse<HttpResponse<PointsList>, any>, unknown>;
|
|
12
13
|
export {};
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import type { Filter } from '../types/filters';
|
|
2
2
|
import type { LocationPoint } from '../types/points';
|
|
3
|
+
export interface LoadPointsParams {
|
|
4
|
+
filter?: Filter;
|
|
5
|
+
country_abbreviation?: string;
|
|
6
|
+
region_name?: string;
|
|
7
|
+
city_name?: string;
|
|
8
|
+
}
|
|
9
|
+
interface LoadNextArgs extends LoadPointsParams {
|
|
10
|
+
bounds: Bounds;
|
|
11
|
+
}
|
|
3
12
|
interface State {
|
|
4
13
|
error: boolean;
|
|
5
14
|
loaded: boolean;
|
|
@@ -9,8 +18,8 @@ interface State {
|
|
|
9
18
|
samePoints: LocationPoint[];
|
|
10
19
|
}
|
|
11
20
|
interface Action {
|
|
12
|
-
loadFirst(
|
|
13
|
-
loadNext(
|
|
21
|
+
loadFirst(args: LoadPointsParams): Promise<void>;
|
|
22
|
+
loadNext(args: LoadNextArgs): Promise<void>;
|
|
14
23
|
setSamePoints(points: LocationPoint[]): void;
|
|
15
24
|
closeSamePoints(): void;
|
|
16
25
|
}
|
|
@@ -74,6 +74,9 @@ export interface WidgetConfig {
|
|
|
74
74
|
mapTheme?: "omnic" | "google" | "omnic-light";
|
|
75
75
|
iconType?: "omnic" | "omni-llama" | "we-chip";
|
|
76
76
|
gMapKey?: string;
|
|
77
|
+
countryAbbreviation?: string;
|
|
78
|
+
regionName?: string;
|
|
79
|
+
cityName?: string;
|
|
77
80
|
onPointClick?: PointClickHandler;
|
|
78
81
|
onLocationSelect?: LocationSelectHandler;
|
|
79
82
|
onCloseLocationSelector?: CloseLocationSelectorHandler;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LoadPointsParams } from '../stores/locationPoints';
|
|
2
2
|
import type { PointsList } from '../types/points';
|
|
3
|
-
|
|
3
|
+
interface CreatePointsArgs {
|
|
4
|
+
loading: boolean;
|
|
5
|
+
loadPointsParams: LoadPointsParams;
|
|
6
|
+
bounds?: Nullable<Bounds>;
|
|
7
|
+
}
|
|
8
|
+
export declare const createPointsIterator: ({ bounds, loadPointsParams, loading }: CreatePointsArgs) => (fn: (data: HttpResponse<PointsList>) => void) => Promise<void>;
|
|
9
|
+
export {};
|