radar-sdk-js 4.4.5-beta.0 → 4.4.5
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 +7 -7
- package/dist/radar.js +21 -64
- package/dist/radar.js.map +1 -1
- package/dist/types.d.ts +19 -11
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/api/geocoding.ts +2 -1
- package/src/api/search.ts +2 -0
- package/src/api/track.ts +2 -0
- package/src/api/verify.ts +1 -1
- package/src/types.ts +23 -12
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ Radar.initialize('prj_test_pk_...', { /* options */ });
|
|
|
56
56
|
|
|
57
57
|
Add the following script in your `html` file
|
|
58
58
|
```html
|
|
59
|
-
<script src="https://js.radar.com/v4.4.5
|
|
59
|
+
<script src="https://js.radar.com/v4.4.5/radar.min.js"></script>
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
Then initialize the Radar SDK
|
|
@@ -73,8 +73,8 @@ To create a map, first initialize the Radar SDK with your publishable key. Then
|
|
|
73
73
|
```html
|
|
74
74
|
<html>
|
|
75
75
|
<head>
|
|
76
|
-
<link href="https://js.radar.com/v4.4.5
|
|
77
|
-
<script src="https://js.radar.com/v4.4.5
|
|
76
|
+
<link href="https://js.radar.com/v4.4.5/radar.css" rel="stylesheet">
|
|
77
|
+
<script src="https://js.radar.com/v4.4.5/radar.min.js"></script>
|
|
78
78
|
</head>
|
|
79
79
|
|
|
80
80
|
<body>
|
|
@@ -98,8 +98,8 @@ To create an autocomplete input, first initialize the Radar SDK with your publis
|
|
|
98
98
|
```html
|
|
99
99
|
<html>
|
|
100
100
|
<head>
|
|
101
|
-
<link href="https://js.radar.com/v4.4.5
|
|
102
|
-
<script src="https://js.radar.com/v4.4.5
|
|
101
|
+
<link href="https://js.radar.com/v4.4.5/radar.css" rel="stylesheet">
|
|
102
|
+
<script src="https://js.radar.com/v4.4.5/radar.min.js"></script>
|
|
103
103
|
</head>
|
|
104
104
|
|
|
105
105
|
<body>
|
|
@@ -130,8 +130,8 @@ To power [geofencing](https://radar.com/documentation/geofencing/overview) exper
|
|
|
130
130
|
```html
|
|
131
131
|
<html>
|
|
132
132
|
<head>
|
|
133
|
-
<link href="https://js.radar.com/v4.4.5
|
|
134
|
-
<script src="https://js.radar.com/v4.4.5
|
|
133
|
+
<link href="https://js.radar.com/v4.4.5/radar.css" rel="stylesheet">
|
|
134
|
+
<script src="https://js.radar.com/v4.4.5/radar.min.js"></script>
|
|
135
135
|
</head>
|
|
136
136
|
|
|
137
137
|
<body>
|
package/dist/radar.js
CHANGED
|
@@ -405,7 +405,7 @@ class Navigator {
|
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
-
var SDK_VERSION = '4.4.5
|
|
408
|
+
var SDK_VERSION = '4.4.5';
|
|
409
409
|
|
|
410
410
|
const inFlightRequests = new Map();
|
|
411
411
|
class Http {
|
|
@@ -741,7 +741,7 @@ class Geocoding {
|
|
|
741
741
|
static forwardGeocode(params) {
|
|
742
742
|
return __awaiter(this, void 0, void 0, function* () {
|
|
743
743
|
const options = Config.get();
|
|
744
|
-
const { query, layers, country } = params;
|
|
744
|
+
const { query, layers, country, lang } = params;
|
|
745
745
|
const response = yield Http.request({
|
|
746
746
|
method: 'GET',
|
|
747
747
|
path: 'geocode/forward',
|
|
@@ -749,6 +749,7 @@ class Geocoding {
|
|
|
749
749
|
query,
|
|
750
750
|
layers,
|
|
751
751
|
country,
|
|
752
|
+
lang,
|
|
752
753
|
},
|
|
753
754
|
});
|
|
754
755
|
const forwardGeocodeRes = {
|
|
@@ -903,7 +904,7 @@ class SearchAPI {
|
|
|
903
904
|
static autocomplete(params, requestId) {
|
|
904
905
|
return __awaiter(this, void 0, void 0, function* () {
|
|
905
906
|
const options = Config.get();
|
|
906
|
-
let { query, near, limit, layers, countryCode, expandUnits, mailable, } = params;
|
|
907
|
+
let { query, near, limit, layers, countryCode, expandUnits, mailable, lang, } = params;
|
|
907
908
|
// near can be provided as a string or Location object
|
|
908
909
|
// if "near" is not provided, request will fallback to IP based location
|
|
909
910
|
if (near && typeof near !== 'string') {
|
|
@@ -922,6 +923,7 @@ class SearchAPI {
|
|
|
922
923
|
countryCode,
|
|
923
924
|
expandUnits,
|
|
924
925
|
mailable,
|
|
926
|
+
lang,
|
|
925
927
|
},
|
|
926
928
|
requestId,
|
|
927
929
|
});
|
|
@@ -1165,51 +1167,6 @@ const signJWT = (payload, key) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
1165
1167
|
return `${encodedHeader}.${encodedPayload}.${signature}`;
|
|
1166
1168
|
});
|
|
1167
1169
|
|
|
1168
|
-
const ping = (host) => {
|
|
1169
|
-
return new Promise((resolve) => {
|
|
1170
|
-
const socket = new WebSocket(host);
|
|
1171
|
-
let pings = 0;
|
|
1172
|
-
const latencies = [];
|
|
1173
|
-
let pingInterval;
|
|
1174
|
-
let timeoutInterval;
|
|
1175
|
-
const ping = () => {
|
|
1176
|
-
pings++;
|
|
1177
|
-
const start = Date.now();
|
|
1178
|
-
socket.send('ping');
|
|
1179
|
-
socket.onmessage = (event) => {
|
|
1180
|
-
if (event.data === 'pong') {
|
|
1181
|
-
const latency = Date.now() - start;
|
|
1182
|
-
latencies.push(latency);
|
|
1183
|
-
if (pings >= 3) {
|
|
1184
|
-
clearInterval(pingInterval);
|
|
1185
|
-
clearInterval(timeoutInterval);
|
|
1186
|
-
const median = latencies.sort((a, b) => a - b)[1];
|
|
1187
|
-
socket.close();
|
|
1188
|
-
resolve(median);
|
|
1189
|
-
}
|
|
1190
|
-
}
|
|
1191
|
-
};
|
|
1192
|
-
};
|
|
1193
|
-
const timeout = () => {
|
|
1194
|
-
Logger.warn('Socket timeout');
|
|
1195
|
-
clearInterval(pingInterval);
|
|
1196
|
-
clearInterval(timeoutInterval);
|
|
1197
|
-
socket.close();
|
|
1198
|
-
resolve(-1);
|
|
1199
|
-
};
|
|
1200
|
-
socket.onerror = (err) => {
|
|
1201
|
-
Logger.warn('Error opening socket');
|
|
1202
|
-
socket.close();
|
|
1203
|
-
resolve(-1);
|
|
1204
|
-
};
|
|
1205
|
-
socket.onopen = () => {
|
|
1206
|
-
ping();
|
|
1207
|
-
pingInterval = setInterval(ping, 1000);
|
|
1208
|
-
timeoutInterval = setInterval(timeout, 10000);
|
|
1209
|
-
};
|
|
1210
|
-
});
|
|
1211
|
-
};
|
|
1212
|
-
|
|
1213
1170
|
class TrackAPI {
|
|
1214
1171
|
static trackOnce(params) {
|
|
1215
1172
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1273,7 +1230,6 @@ class TrackAPI {
|
|
|
1273
1230
|
let response;
|
|
1274
1231
|
if (fraud) {
|
|
1275
1232
|
const host = 'https://api-verified.radar.io';
|
|
1276
|
-
const pingHost = 'ping.radar-verify.com';
|
|
1277
1233
|
const lang = navigator.language;
|
|
1278
1234
|
const langs = navigator.languages;
|
|
1279
1235
|
const { dk } = yield Http.request({
|
|
@@ -1292,22 +1248,23 @@ class TrackAPI {
|
|
|
1292
1248
|
});
|
|
1293
1249
|
let sclVal = -1;
|
|
1294
1250
|
let cslVal = -1;
|
|
1251
|
+
/*
|
|
1295
1252
|
try {
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
// do nothing, send scl = -1 and csl = -1
|
|
1253
|
+
const [sclRes, csl] = await Promise.all([
|
|
1254
|
+
Http.request({
|
|
1255
|
+
host: `https://${pingHost}`,
|
|
1256
|
+
method: 'GET',
|
|
1257
|
+
path: 'ping',
|
|
1258
|
+
}),
|
|
1259
|
+
ping(`wss://${pingHost}`),
|
|
1260
|
+
]);
|
|
1261
|
+
const { scl }: any = sclRes;
|
|
1262
|
+
sclVal = scl;
|
|
1263
|
+
cslVal = csl;
|
|
1264
|
+
} catch (err) {
|
|
1265
|
+
// do nothing, send scl = -1 and csl = -1
|
|
1310
1266
|
}
|
|
1267
|
+
*/
|
|
1311
1268
|
const payload = {
|
|
1312
1269
|
payload: JSON.stringify(Object.assign(Object.assign({}, body), { scl: sclVal, csl: cslVal, lang,
|
|
1313
1270
|
langs })),
|
|
@@ -1496,7 +1453,7 @@ class VerifyAPI {
|
|
|
1496
1453
|
static getVerifiedLocationToken(params) {
|
|
1497
1454
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1498
1455
|
const lastTokenElapsed = (performance.now() - lastTokenNow) / 1000;
|
|
1499
|
-
if (lastToken) {
|
|
1456
|
+
if (lastToken && lastToken.passed) {
|
|
1500
1457
|
if (lastTokenElapsed < (lastToken.expiresIn || 0)) {
|
|
1501
1458
|
return lastToken;
|
|
1502
1459
|
}
|
package/dist/radar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radar.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"radar.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/types.d.ts
CHANGED
|
@@ -195,7 +195,7 @@ export interface RadarCustomEvent {
|
|
|
195
195
|
export interface RadarConversionResponse extends RadarResponse {
|
|
196
196
|
event: RadarCustomEvent;
|
|
197
197
|
}
|
|
198
|
-
export type RadarGeocodeLayer = 'place' | 'address' | 'postalCode' | 'locality' | 'county' | 'state' | 'country' | 'coarse' | 'fine';
|
|
198
|
+
export type RadarGeocodeLayer = 'place' | 'address' | 'postalCode' | 'locality' | 'neighborhood' | 'county' | 'state' | 'country' | 'coarse' | 'fine';
|
|
199
199
|
export interface RadarAddress {
|
|
200
200
|
addressLabel?: string;
|
|
201
201
|
borough?: string;
|
|
@@ -221,9 +221,21 @@ export interface RadarAddress {
|
|
|
221
221
|
stateCode?: string;
|
|
222
222
|
street?: string;
|
|
223
223
|
}
|
|
224
|
+
export interface RadarTimeZone {
|
|
225
|
+
id: string;
|
|
226
|
+
name: string;
|
|
227
|
+
code: string;
|
|
228
|
+
currentTime: string;
|
|
229
|
+
utcOffset: number;
|
|
230
|
+
dstOffset: number;
|
|
231
|
+
}
|
|
224
232
|
export interface RadarAutocompleteAddress extends RadarAddress {
|
|
225
233
|
unit?: string;
|
|
226
234
|
}
|
|
235
|
+
export interface RadarGeocodeAddress extends RadarAddress {
|
|
236
|
+
unit?: string;
|
|
237
|
+
timeZone?: RadarTimeZone;
|
|
238
|
+
}
|
|
227
239
|
export type RadarValidationRecordType = 'S' | 'R' | 'P' | 'M' | 'H' | 'G' | 'F' | undefined;
|
|
228
240
|
export type RadarValidationPropertyType = 'commercial' | 'residential' | undefined;
|
|
229
241
|
export type RadarVerificationStatus = 'verified' | 'partially verified' | 'ambiguous' | 'unverified';
|
|
@@ -239,6 +251,7 @@ export interface RadarForwardGeocodeParams {
|
|
|
239
251
|
query: string;
|
|
240
252
|
layers?: RadarGeocodeLayer[];
|
|
241
253
|
country?: string;
|
|
254
|
+
lang?: string;
|
|
242
255
|
}
|
|
243
256
|
export interface RadarReverseGeocodeParams {
|
|
244
257
|
latitude?: number;
|
|
@@ -246,11 +259,11 @@ export interface RadarReverseGeocodeParams {
|
|
|
246
259
|
layers?: RadarGeocodeLayer[];
|
|
247
260
|
}
|
|
248
261
|
export interface RadarGeocodeResponse extends RadarResponse {
|
|
249
|
-
addresses:
|
|
262
|
+
addresses: RadarGeocodeAddress[];
|
|
250
263
|
}
|
|
251
264
|
export interface RadarIPGeocodeResponse extends RadarResponse {
|
|
252
265
|
ip: string;
|
|
253
|
-
address?:
|
|
266
|
+
address?: RadarGeocodeAddress;
|
|
254
267
|
proxy?: boolean;
|
|
255
268
|
}
|
|
256
269
|
export interface RadarAutocompleteParams {
|
|
@@ -262,6 +275,7 @@ export interface RadarAutocompleteParams {
|
|
|
262
275
|
/** @deprecated this is always true, regardless of the value passed here */
|
|
263
276
|
expandUnits?: boolean;
|
|
264
277
|
mailable?: boolean;
|
|
278
|
+
lang?: string;
|
|
265
279
|
}
|
|
266
280
|
export interface RadarAutocompleteResponse extends RadarResponse {
|
|
267
281
|
addresses: RadarAutocompleteAddress[];
|
|
@@ -412,17 +426,12 @@ export interface RadarPolygonOptions {
|
|
|
412
426
|
'border-opacity'?: number;
|
|
413
427
|
};
|
|
414
428
|
}
|
|
415
|
-
export interface RadarAutocompleteUIOptions {
|
|
429
|
+
export interface RadarAutocompleteUIOptions extends Omit<RadarAutocompleteParams, 'query'> {
|
|
416
430
|
container: string | HTMLElement;
|
|
417
|
-
near?: string | Location;
|
|
418
431
|
debounceMS?: number;
|
|
432
|
+
/** @deprecated use minCharacters instead */
|
|
419
433
|
threshold?: number;
|
|
420
434
|
minCharacters?: number;
|
|
421
|
-
limit?: number;
|
|
422
|
-
layers?: RadarGeocodeLayer[];
|
|
423
|
-
countryCode?: string;
|
|
424
|
-
expandUnits?: boolean;
|
|
425
|
-
mailable?: boolean;
|
|
426
435
|
placeholder?: string;
|
|
427
436
|
onSelection?: (selection: any) => void;
|
|
428
437
|
onRequest?: (params: RadarAutocompleteParams) => void;
|
|
@@ -437,7 +446,6 @@ export interface RadarAutocompleteUIOptions {
|
|
|
437
446
|
hideResultsOnBlur?: boolean;
|
|
438
447
|
}
|
|
439
448
|
export interface RadarAutocompleteConfig extends RadarAutocompleteUIOptions {
|
|
440
|
-
container: string | HTMLElement;
|
|
441
449
|
debounceMS: number;
|
|
442
450
|
threshold: number;
|
|
443
451
|
minCharacters: number;
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "4.4.5
|
|
1
|
+
declare const _default: "4.4.5";
|
|
2
2
|
export default _default;
|
package/package.json
CHANGED
package/src/api/geocoding.ts
CHANGED
|
@@ -13,7 +13,7 @@ class Geocoding {
|
|
|
13
13
|
static async forwardGeocode(params: RadarForwardGeocodeParams): Promise<RadarGeocodeResponse> {
|
|
14
14
|
const options = Config.get();
|
|
15
15
|
|
|
16
|
-
const { query, layers, country } = params;
|
|
16
|
+
const { query, layers, country, lang } = params;
|
|
17
17
|
|
|
18
18
|
const response: any = await Http.request({
|
|
19
19
|
method: 'GET',
|
|
@@ -22,6 +22,7 @@ class Geocoding {
|
|
|
22
22
|
query,
|
|
23
23
|
layers,
|
|
24
24
|
country,
|
|
25
|
+
lang,
|
|
25
26
|
},
|
|
26
27
|
});
|
|
27
28
|
|
package/src/api/search.ts
CHANGED
|
@@ -23,6 +23,7 @@ class SearchAPI {
|
|
|
23
23
|
countryCode,
|
|
24
24
|
expandUnits,
|
|
25
25
|
mailable,
|
|
26
|
+
lang,
|
|
26
27
|
} = params;
|
|
27
28
|
|
|
28
29
|
// near can be provided as a string or Location object
|
|
@@ -44,6 +45,7 @@ class SearchAPI {
|
|
|
44
45
|
countryCode,
|
|
45
46
|
expandUnits,
|
|
46
47
|
mailable,
|
|
48
|
+
lang,
|
|
47
49
|
},
|
|
48
50
|
requestId,
|
|
49
51
|
});
|
package/src/api/track.ts
CHANGED
|
@@ -111,6 +111,7 @@ class TrackAPI {
|
|
|
111
111
|
|
|
112
112
|
let sclVal = -1;
|
|
113
113
|
let cslVal = -1;
|
|
114
|
+
/*
|
|
114
115
|
try {
|
|
115
116
|
const [sclRes, csl] = await Promise.all([
|
|
116
117
|
Http.request({
|
|
@@ -126,6 +127,7 @@ class TrackAPI {
|
|
|
126
127
|
} catch (err) {
|
|
127
128
|
// do nothing, send scl = -1 and csl = -1
|
|
128
129
|
}
|
|
130
|
+
*/
|
|
129
131
|
|
|
130
132
|
const payload = {
|
|
131
133
|
payload: JSON.stringify({
|
package/src/api/verify.ts
CHANGED
|
@@ -159,7 +159,7 @@ class VerifyAPI {
|
|
|
159
159
|
static async getVerifiedLocationToken(params: RadarTrackVerifiedParams) {
|
|
160
160
|
const lastTokenElapsed = (performance.now() - lastTokenNow) / 1000;
|
|
161
161
|
|
|
162
|
-
if (lastToken) {
|
|
162
|
+
if (lastToken && lastToken.passed) {
|
|
163
163
|
if (lastTokenElapsed < (lastToken.expiresIn || 0)) {
|
|
164
164
|
return lastToken;
|
|
165
165
|
}
|
package/src/types.ts
CHANGED
|
@@ -278,6 +278,7 @@ export type RadarGeocodeLayer =
|
|
|
278
278
|
| 'address'
|
|
279
279
|
| 'postalCode'
|
|
280
280
|
| 'locality'
|
|
281
|
+
| 'neighborhood'
|
|
281
282
|
| 'county'
|
|
282
283
|
| 'state'
|
|
283
284
|
| 'country'
|
|
@@ -310,10 +311,24 @@ export interface RadarAddress {
|
|
|
310
311
|
street?: string;
|
|
311
312
|
}
|
|
312
313
|
|
|
314
|
+
export interface RadarTimeZone {
|
|
315
|
+
id: string;
|
|
316
|
+
name: string;
|
|
317
|
+
code: string;
|
|
318
|
+
currentTime: string;
|
|
319
|
+
utcOffset: number;
|
|
320
|
+
dstOffset: number;
|
|
321
|
+
}
|
|
322
|
+
|
|
313
323
|
export interface RadarAutocompleteAddress extends RadarAddress {
|
|
314
324
|
unit?: string;
|
|
315
325
|
}
|
|
316
326
|
|
|
327
|
+
export interface RadarGeocodeAddress extends RadarAddress {
|
|
328
|
+
unit?: string;
|
|
329
|
+
timeZone?: RadarTimeZone;
|
|
330
|
+
}
|
|
331
|
+
|
|
317
332
|
export type RadarValidationRecordType = 'S' | 'R' | 'P' | 'M' | 'H' | 'G' | 'F' | undefined;
|
|
318
333
|
|
|
319
334
|
export type RadarValidationPropertyType = 'commercial' | 'residential' | undefined;
|
|
@@ -333,6 +348,7 @@ export interface RadarForwardGeocodeParams {
|
|
|
333
348
|
query: string;
|
|
334
349
|
layers?: RadarGeocodeLayer[];
|
|
335
350
|
country?: string;
|
|
351
|
+
lang?: string;
|
|
336
352
|
}
|
|
337
353
|
|
|
338
354
|
export interface RadarReverseGeocodeParams {
|
|
@@ -341,13 +357,13 @@ export interface RadarReverseGeocodeParams {
|
|
|
341
357
|
layers?: RadarGeocodeLayer[];
|
|
342
358
|
}
|
|
343
359
|
|
|
344
|
-
export interface RadarGeocodeResponse
|
|
345
|
-
addresses:
|
|
360
|
+
export interface RadarGeocodeResponse extends RadarResponse {
|
|
361
|
+
addresses: RadarGeocodeAddress[];
|
|
346
362
|
}
|
|
347
363
|
|
|
348
364
|
export interface RadarIPGeocodeResponse extends RadarResponse {
|
|
349
365
|
ip: string;
|
|
350
|
-
address?:
|
|
366
|
+
address?: RadarGeocodeAddress;
|
|
351
367
|
proxy?: boolean;
|
|
352
368
|
}
|
|
353
369
|
|
|
@@ -360,6 +376,7 @@ export interface RadarAutocompleteParams {
|
|
|
360
376
|
/** @deprecated this is always true, regardless of the value passed here */
|
|
361
377
|
expandUnits?: boolean;
|
|
362
378
|
mailable?: boolean;
|
|
379
|
+
lang?: string;
|
|
363
380
|
}
|
|
364
381
|
|
|
365
382
|
export interface RadarAutocompleteResponse extends RadarResponse {
|
|
@@ -539,17 +556,12 @@ export interface RadarPolygonOptions {
|
|
|
539
556
|
'border-opacity'?: number;
|
|
540
557
|
},
|
|
541
558
|
}
|
|
542
|
-
export interface RadarAutocompleteUIOptions {
|
|
559
|
+
export interface RadarAutocompleteUIOptions extends Omit<RadarAutocompleteParams, 'query'> {
|
|
543
560
|
container: string | HTMLElement;
|
|
544
|
-
near?: string | Location; // bias for location results
|
|
545
561
|
debounceMS?: number, // Debounce time in milliseconds
|
|
546
|
-
|
|
562
|
+
/** @deprecated use minCharacters instead */
|
|
563
|
+
threshold?: number,
|
|
547
564
|
minCharacters?: number, // Minimum number of characters to trigger autocomplete
|
|
548
|
-
limit?: number, // Maximum number of autocomplete results
|
|
549
|
-
layers?: RadarGeocodeLayer[];
|
|
550
|
-
countryCode?: string;
|
|
551
|
-
expandUnits?: boolean;
|
|
552
|
-
mailable?: boolean;
|
|
553
565
|
placeholder?: string, // Placeholder text for the input field
|
|
554
566
|
onSelection?: (selection: any) => void,
|
|
555
567
|
onRequest?: (params: RadarAutocompleteParams) => void,
|
|
@@ -565,7 +577,6 @@ export interface RadarAutocompleteUIOptions {
|
|
|
565
577
|
}
|
|
566
578
|
|
|
567
579
|
export interface RadarAutocompleteConfig extends RadarAutocompleteUIOptions {
|
|
568
|
-
container: string | HTMLElement;
|
|
569
580
|
debounceMS: number, // Debounce time in milliseconds
|
|
570
581
|
threshold: number, // DEPRECATED(use minCharacters instead)
|
|
571
582
|
minCharacters: number, // Minimum number of characters to trigger autocomplete
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '4.4.5
|
|
1
|
+
export default '4.4.5';
|