radar-sdk-js 4.4.6 → 4.4.7
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 +36 -5
- package/dist/radar.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/ui/autocomplete.d.ts +4 -2
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/api/search.ts +2 -0
- package/src/types.ts +1 -0
- package/src/ui/autocomplete.ts +33 -5
- 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.
|
|
59
|
+
<script src="https://js.radar.com/v4.4.7/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.
|
|
77
|
-
<script src="https://js.radar.com/v4.4.
|
|
76
|
+
<link href="https://js.radar.com/v4.4.7/radar.css" rel="stylesheet">
|
|
77
|
+
<script src="https://js.radar.com/v4.4.7/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.
|
|
102
|
-
<script src="https://js.radar.com/v4.4.
|
|
101
|
+
<link href="https://js.radar.com/v4.4.7/radar.css" rel="stylesheet">
|
|
102
|
+
<script src="https://js.radar.com/v4.4.7/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.
|
|
134
|
-
<script src="https://js.radar.com/v4.4.
|
|
133
|
+
<link href="https://js.radar.com/v4.4.7/radar.css" rel="stylesheet">
|
|
134
|
+
<script src="https://js.radar.com/v4.4.7/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.
|
|
408
|
+
var SDK_VERSION = '4.4.7';
|
|
409
409
|
|
|
410
410
|
const inFlightRequests = new Map();
|
|
411
411
|
class Http {
|
|
@@ -904,7 +904,7 @@ class SearchAPI {
|
|
|
904
904
|
static autocomplete(params, requestId) {
|
|
905
905
|
return __awaiter(this, void 0, void 0, function* () {
|
|
906
906
|
const options = Config.get();
|
|
907
|
-
let { query, near, limit, layers, countryCode, expandUnits, mailable, lang, } = params;
|
|
907
|
+
let { query, near, limit, layers, countryCode, expandUnits, mailable, lang, postalCode, } = params;
|
|
908
908
|
// near can be provided as a string or Location object
|
|
909
909
|
// if "near" is not provided, request will fallback to IP based location
|
|
910
910
|
if (near && typeof near !== 'string') {
|
|
@@ -924,6 +924,7 @@ class SearchAPI {
|
|
|
924
924
|
expandUnits,
|
|
925
925
|
mailable,
|
|
926
926
|
lang,
|
|
927
|
+
postalCode,
|
|
927
928
|
},
|
|
928
929
|
requestId,
|
|
929
930
|
});
|
|
@@ -2583,7 +2584,7 @@ class AutocompleteUI {
|
|
|
2583
2584
|
}
|
|
2584
2585
|
fetchResults(query) {
|
|
2585
2586
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2586
|
-
const { limit, layers, countryCode, expandUnits, mailable, onRequest } = this.config;
|
|
2587
|
+
const { limit, layers, countryCode, expandUnits, mailable, lang, postalCode, onRequest } = this.config;
|
|
2587
2588
|
const params = {
|
|
2588
2589
|
query,
|
|
2589
2590
|
limit,
|
|
@@ -2591,6 +2592,8 @@ class AutocompleteUI {
|
|
|
2591
2592
|
countryCode,
|
|
2592
2593
|
expandUnits,
|
|
2593
2594
|
mailable,
|
|
2595
|
+
lang,
|
|
2596
|
+
postalCode,
|
|
2594
2597
|
};
|
|
2595
2598
|
if (this.near) {
|
|
2596
2599
|
params.near = this.near;
|
|
@@ -2805,12 +2808,22 @@ class AutocompleteUI {
|
|
|
2805
2808
|
return this;
|
|
2806
2809
|
}
|
|
2807
2810
|
setWidth(width) {
|
|
2808
|
-
|
|
2811
|
+
if (width === null) {
|
|
2812
|
+
this.config.width = undefined;
|
|
2813
|
+
}
|
|
2814
|
+
else if (typeof width === 'string' || typeof width === 'number') {
|
|
2815
|
+
this.config.width = width;
|
|
2816
|
+
}
|
|
2809
2817
|
setWidth(this.wrapper, this.config);
|
|
2810
2818
|
return this;
|
|
2811
2819
|
}
|
|
2812
2820
|
setMaxHeight(height) {
|
|
2813
|
-
|
|
2821
|
+
if (height === null) {
|
|
2822
|
+
this.config.maxHeight = undefined;
|
|
2823
|
+
}
|
|
2824
|
+
else if (typeof height === 'string' || typeof height === 'number') {
|
|
2825
|
+
this.config.maxHeight = height;
|
|
2826
|
+
}
|
|
2814
2827
|
setHeight(this.resultsList, this.config);
|
|
2815
2828
|
return this;
|
|
2816
2829
|
}
|
|
@@ -2823,6 +2836,24 @@ class AutocompleteUI {
|
|
|
2823
2836
|
this.config.limit = limit;
|
|
2824
2837
|
return this;
|
|
2825
2838
|
}
|
|
2839
|
+
setLang(lang) {
|
|
2840
|
+
if (lang === null) {
|
|
2841
|
+
this.config.lang = undefined;
|
|
2842
|
+
}
|
|
2843
|
+
else if (typeof lang === 'string') {
|
|
2844
|
+
this.config.lang = lang;
|
|
2845
|
+
}
|
|
2846
|
+
return this;
|
|
2847
|
+
}
|
|
2848
|
+
setPostalCode(postalCode) {
|
|
2849
|
+
if (postalCode === null) {
|
|
2850
|
+
this.config.postalCode = undefined;
|
|
2851
|
+
}
|
|
2852
|
+
else if (typeof postalCode === 'string') {
|
|
2853
|
+
this.config.postalCode = postalCode;
|
|
2854
|
+
}
|
|
2855
|
+
return this;
|
|
2856
|
+
}
|
|
2826
2857
|
setShowMarkers(showMarkers) {
|
|
2827
2858
|
this.config.showMarkers = showMarkers;
|
|
2828
2859
|
if (showMarkers) {
|
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
|
@@ -276,6 +276,7 @@ export interface RadarAutocompleteParams {
|
|
|
276
276
|
expandUnits?: boolean;
|
|
277
277
|
mailable?: boolean;
|
|
278
278
|
lang?: string;
|
|
279
|
+
postalCode?: string;
|
|
279
280
|
}
|
|
280
281
|
export interface RadarAutocompleteResponse extends RadarResponse {
|
|
281
282
|
addresses: RadarAutocompleteAddress[];
|
|
@@ -28,10 +28,12 @@ declare class AutocompleteUI {
|
|
|
28
28
|
setPlaceholder(placeholder: string): this;
|
|
29
29
|
setDisabled(disabled: boolean): this;
|
|
30
30
|
setResponsive(responsive: boolean): this;
|
|
31
|
-
setWidth(width: number | string): this;
|
|
32
|
-
setMaxHeight(height: number | string): this;
|
|
31
|
+
setWidth(width: number | string | null): this;
|
|
32
|
+
setMaxHeight(height: number | string | null): this;
|
|
33
33
|
setMinCharacters(minCharacters: number): this;
|
|
34
34
|
setLimit(limit: number): this;
|
|
35
|
+
setLang(lang: string | null): this;
|
|
36
|
+
setPostalCode(postalCode: string | null): this;
|
|
35
37
|
setShowMarkers(showMarkers: boolean): this;
|
|
36
38
|
setMarkerColor(color: string): this;
|
|
37
39
|
setHideResultsOnBlur(hideResultsOnBlur: boolean): this;
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "4.4.
|
|
1
|
+
declare const _default: "4.4.7";
|
|
2
2
|
export default _default;
|
package/package.json
CHANGED
package/src/api/search.ts
CHANGED
|
@@ -24,6 +24,7 @@ class SearchAPI {
|
|
|
24
24
|
expandUnits,
|
|
25
25
|
mailable,
|
|
26
26
|
lang,
|
|
27
|
+
postalCode,
|
|
27
28
|
} = params;
|
|
28
29
|
|
|
29
30
|
// near can be provided as a string or Location object
|
|
@@ -46,6 +47,7 @@ class SearchAPI {
|
|
|
46
47
|
expandUnits,
|
|
47
48
|
mailable,
|
|
48
49
|
lang,
|
|
50
|
+
postalCode,
|
|
49
51
|
},
|
|
50
52
|
requestId,
|
|
51
53
|
});
|
package/src/types.ts
CHANGED
package/src/ui/autocomplete.ts
CHANGED
|
@@ -247,7 +247,7 @@ class AutocompleteUI {
|
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
public async fetchResults(query: string) {
|
|
250
|
-
const { limit, layers, countryCode, expandUnits, mailable, onRequest } = this.config;
|
|
250
|
+
const { limit, layers, countryCode, expandUnits, mailable, lang, postalCode, onRequest } = this.config;
|
|
251
251
|
|
|
252
252
|
const params: RadarAutocompleteParams = {
|
|
253
253
|
query,
|
|
@@ -256,6 +256,8 @@ class AutocompleteUI {
|
|
|
256
256
|
countryCode,
|
|
257
257
|
expandUnits,
|
|
258
258
|
mailable,
|
|
259
|
+
lang,
|
|
260
|
+
postalCode,
|
|
259
261
|
}
|
|
260
262
|
|
|
261
263
|
if (this.near) {
|
|
@@ -507,14 +509,22 @@ class AutocompleteUI {
|
|
|
507
509
|
return this;
|
|
508
510
|
}
|
|
509
511
|
|
|
510
|
-
public setWidth(width: number | string) {
|
|
511
|
-
|
|
512
|
+
public setWidth(width: number | string | null) {
|
|
513
|
+
if (width === null) {
|
|
514
|
+
this.config.width = undefined;
|
|
515
|
+
} else if (typeof width === 'string' || typeof width === 'number') {
|
|
516
|
+
this.config.width = width;
|
|
517
|
+
}
|
|
512
518
|
setWidth(this.wrapper, this.config);
|
|
513
519
|
return this;
|
|
514
520
|
}
|
|
515
521
|
|
|
516
|
-
public setMaxHeight(height: number | string) {
|
|
517
|
-
|
|
522
|
+
public setMaxHeight(height: number | string | null) {
|
|
523
|
+
if (height === null) {
|
|
524
|
+
this.config.maxHeight = undefined;
|
|
525
|
+
} else if (typeof height === 'string' || typeof height === 'number') {
|
|
526
|
+
this.config.maxHeight = height;
|
|
527
|
+
}
|
|
518
528
|
setHeight(this.resultsList, this.config);
|
|
519
529
|
return this;
|
|
520
530
|
}
|
|
@@ -530,6 +540,24 @@ class AutocompleteUI {
|
|
|
530
540
|
return this;
|
|
531
541
|
}
|
|
532
542
|
|
|
543
|
+
public setLang(lang: string | null) {
|
|
544
|
+
if (lang === null) {
|
|
545
|
+
this.config.lang = undefined;
|
|
546
|
+
} else if (typeof lang === 'string') {
|
|
547
|
+
this.config.lang = lang;
|
|
548
|
+
}
|
|
549
|
+
return this;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
public setPostalCode(postalCode: string | null) {
|
|
553
|
+
if (postalCode === null) {
|
|
554
|
+
this.config.postalCode = undefined;
|
|
555
|
+
} else if (typeof postalCode === 'string') {
|
|
556
|
+
this.config.postalCode = postalCode;
|
|
557
|
+
}
|
|
558
|
+
return this;
|
|
559
|
+
}
|
|
560
|
+
|
|
533
561
|
public setShowMarkers(showMarkers: boolean) {
|
|
534
562
|
this.config.showMarkers = showMarkers;
|
|
535
563
|
if (showMarkers) {
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '4.4.
|
|
1
|
+
export default '4.4.7';
|