@omnic/widget-locations 1.0.60 → 1.0.61
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 +25 -6
- package/dist/lib/constants/http.d.ts +8 -0
- package/dist/lib/services/address.d.ts +36 -0
- package/dist/lib/types/points.d.ts +2 -1
- package/dist/lib/utils/index.d.ts +1 -0
- package/dist/lib/utils/isHttpSuccess.d.ts +2 -0
- package/dist/lib/widget.es.js +4038 -3998
- package/dist/lib/widget.umd.js +24 -22
- package/package.json +7 -7
- /package/dist/lib/constants/{global.d.ts → widget.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -91,9 +91,28 @@ interface LocationPoint {
|
|
|
91
91
|
near_metro_station?: string;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
interface NormalizeAddressResponseData {
|
|
95
|
+
country_name: string;
|
|
96
|
+
country_code: string;
|
|
97
|
+
region: string;
|
|
98
|
+
city: string;
|
|
99
|
+
latitude: number;
|
|
100
|
+
longitude: number;
|
|
101
|
+
street: string;
|
|
102
|
+
house: string;
|
|
103
|
+
block: string;
|
|
104
|
+
office: string;
|
|
105
|
+
postal_index: string;
|
|
106
|
+
address: string;
|
|
107
|
+
address_full: string;
|
|
108
|
+
city_place_id: string;
|
|
109
|
+
region_place_id: string;
|
|
110
|
+
place_id: string;
|
|
111
|
+
}
|
|
112
|
+
|
|
94
113
|
interface CourierPoint {
|
|
95
114
|
coords: Coordinates;
|
|
96
|
-
address:
|
|
115
|
+
address: Nullable<NormalizeAddressResponseData>;
|
|
97
116
|
}
|
|
98
117
|
|
|
99
118
|
interface CourierDeliveryPoint extends CourierPoint {
|
|
@@ -138,17 +157,17 @@ Then `OMNIC_WIDGET_LOCATIONS_CONFIG` has the following structure:
|
|
|
138
157
|
`WidgetInputs` type has the following structure:
|
|
139
158
|
|
|
140
159
|
```typescript
|
|
141
|
-
|
|
160
|
+
interface ForwardedInputElement extends Pick<HTMLInputElement, "focus" | "blur"> {
|
|
142
161
|
setValue: (value: string) => void;
|
|
143
162
|
}
|
|
144
163
|
|
|
145
|
-
|
|
164
|
+
interface InputConfig {
|
|
146
165
|
name: string;
|
|
147
166
|
ref: RefObject<ForwardedInputElement>;
|
|
148
167
|
onClick?: (name: string) => void;
|
|
149
168
|
}
|
|
150
169
|
|
|
151
|
-
|
|
170
|
+
interface WidgetInputs {
|
|
152
171
|
/**
|
|
153
172
|
Widget Map address input
|
|
154
173
|
*/
|
|
@@ -171,12 +190,12 @@ export interface WidgetInputs {
|
|
|
171
190
|
`WidgetHandlers` type has the following structure:
|
|
172
191
|
|
|
173
192
|
```typescript
|
|
174
|
-
|
|
193
|
+
interface LocationSelectorElement {
|
|
175
194
|
open: () => void;
|
|
176
195
|
close: () => void;
|
|
177
196
|
}
|
|
178
197
|
|
|
179
|
-
|
|
198
|
+
interface WidgetHandlers {
|
|
180
199
|
locationSelector: RefObject<LocationSelectorElement>;
|
|
181
200
|
}
|
|
182
201
|
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const STATUS_OK = 200;
|
|
2
|
+
export declare const STATUS_BAD_REQUEST = 400;
|
|
3
|
+
export declare const STATUS_UNAUTHORIZED = 401;
|
|
4
|
+
export declare const STATUS_FORBIDDEN = 403;
|
|
5
|
+
export declare const STATUS_NOT_FOUND = 404;
|
|
6
|
+
export declare const STATUS_INTERNAL_SERVER_ERROR = 500;
|
|
7
|
+
export declare const STATUS_SERVICE_UNAVAILABLE = 503;
|
|
8
|
+
export declare const STATUS_GATEWAY_TIMEOUT = 504;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { AxiosResponse } from "axios";
|
|
2
|
+
import type { Locale } from '../types/i18n';
|
|
3
|
+
interface NormalizeAddressRequestParams {
|
|
4
|
+
language: Locale;
|
|
5
|
+
address: string;
|
|
6
|
+
service: number;
|
|
7
|
+
algorithm: number;
|
|
8
|
+
}
|
|
9
|
+
export interface NormalizeAddressResponseData {
|
|
10
|
+
country_name: string;
|
|
11
|
+
country_code: string;
|
|
12
|
+
region: string;
|
|
13
|
+
city: string;
|
|
14
|
+
latitude: number;
|
|
15
|
+
longitude: number;
|
|
16
|
+
street: string;
|
|
17
|
+
house: string;
|
|
18
|
+
block: string;
|
|
19
|
+
office: string;
|
|
20
|
+
postal_index: string;
|
|
21
|
+
address: string;
|
|
22
|
+
address_full: string;
|
|
23
|
+
city_place_id: string;
|
|
24
|
+
region_place_id: string;
|
|
25
|
+
place_id: string;
|
|
26
|
+
}
|
|
27
|
+
export interface NormalizeAddressResponse {
|
|
28
|
+
success: boolean;
|
|
29
|
+
status: number;
|
|
30
|
+
message: Nullable<unknown>;
|
|
31
|
+
ids: Nullable<unknown[]>;
|
|
32
|
+
extra: unknown;
|
|
33
|
+
data: NormalizeAddressResponseData;
|
|
34
|
+
}
|
|
35
|
+
export declare const getNormalizedAddress: (params: NormalizeAddressRequestParams) => Promise<AxiosResponse<NormalizeAddressResponse, NormalizeAddressRequestParams>>;
|
|
36
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { NormalizeAddressResponseData } from '../services/address';
|
|
1
2
|
import type { City } from "./cities";
|
|
2
3
|
import type { Region } from "./regions";
|
|
3
4
|
import type { Country } from "./countries";
|
|
@@ -35,7 +36,7 @@ export interface LocationPoint {
|
|
|
35
36
|
}
|
|
36
37
|
export interface CourierPoint {
|
|
37
38
|
coords: Coordinates;
|
|
38
|
-
address:
|
|
39
|
+
address: Nullable<NormalizeAddressResponseData>;
|
|
39
40
|
}
|
|
40
41
|
export interface CourierDeliveryPoint extends CourierPoint {
|
|
41
42
|
comment: string;
|