smartystreets-javascript-sdk 1.10.8 → 1.11.3-beta.0
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/examples/us_autocomplete_pro.js +1 -0
- package/package.json +2 -2
- package/src/international_address_autocomplete/Client.js +2 -2
- package/src/us_autocomplete_pro/Client.js +1 -0
- package/src/us_autocomplete_pro/Lookup.js +1 -0
- package/tests/international_address_autocomplete/test_Client.js +11 -8
- package/tests/us_autocomplete_pro/test_Client.js +3 -0
|
@@ -32,6 +32,7 @@ lookup.maxResults = 10;
|
|
|
32
32
|
lookup.includeOnlyCities = ["Chicago,La Grange,IL", "Blaine,WA"];
|
|
33
33
|
lookup.preferStates = ["IL"];
|
|
34
34
|
lookup.preferRatio = 33;
|
|
35
|
+
lookup.source = "all";
|
|
35
36
|
|
|
36
37
|
client.send(lookup)
|
|
37
38
|
.then(function(results) { logSuggestions(results, "Using Filter and Prefer") })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smartystreets-javascript-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.3-beta.0",
|
|
4
4
|
"description": "Quick and easy SmartyStreets address validation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"smartystreets",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"axios-proxy-fix": "^0.16.3",
|
|
48
|
-
"axios-retry": "
|
|
48
|
+
"axios-retry": "3.2.0",
|
|
49
49
|
"promise": "^8.1.0"
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -29,9 +29,9 @@ class Client {
|
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
function buildSuggestionsFromResponse(payload) {
|
|
32
|
-
if (payload === null) return [];
|
|
32
|
+
if (payload && payload.candidates === null) return [];
|
|
33
33
|
|
|
34
|
-
return payload.map(suggestion => new Suggestion(suggestion));
|
|
34
|
+
return payload.candidates.map(suggestion => new Suggestion(suggestion));
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -48,18 +48,21 @@ describe("An International Address Autocomplete Client", function () {
|
|
|
48
48
|
|
|
49
49
|
it("attaches suggestions from a response to a lookup", function () {
|
|
50
50
|
const responseData = {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
candidates: [
|
|
52
|
+
{
|
|
53
|
+
"street": "L alleya",
|
|
54
|
+
"locality": "Novosibirsk",
|
|
55
|
+
"administrative_area": "Novosibirskaya oblast'",
|
|
56
|
+
"postal_code": "40000",
|
|
57
|
+
"country_iso3": "RUS",
|
|
58
|
+
}
|
|
59
|
+
]
|
|
56
60
|
};
|
|
57
61
|
|
|
58
|
-
let
|
|
59
|
-
let mockSender = new MockSenderWithResponse(mockExpectedPayload);
|
|
62
|
+
let mockSender = new MockSenderWithResponse(responseData);
|
|
60
63
|
let client = new Client(mockSender);
|
|
61
64
|
let lookup = new Lookup("f");
|
|
62
|
-
let expectedSuggestion = new Suggestion(responseData);
|
|
65
|
+
let expectedSuggestion = new Suggestion(responseData.candidates[0]);
|
|
63
66
|
|
|
64
67
|
return client.send(lookup).then(() => {
|
|
65
68
|
expect(lookup.result[0]).to.deep.equal(expectedSuggestion);
|
|
@@ -28,6 +28,7 @@ describe("A US Autocomplete Pro Client", function () {
|
|
|
28
28
|
prefer_zip_codes: undefined,
|
|
29
29
|
prefer_ratio: undefined,
|
|
30
30
|
prefer_geolocation: undefined,
|
|
31
|
+
source: undefined,
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
client.send(lookup);
|
|
@@ -51,6 +52,7 @@ describe("A US Autocomplete Pro Client", function () {
|
|
|
51
52
|
lookup.preferZIPCodes = ["q", "r"];
|
|
52
53
|
lookup.preferRatio = "s";
|
|
53
54
|
lookup.preferGeolocation = "t";
|
|
55
|
+
lookup.source = "all";
|
|
54
56
|
|
|
55
57
|
let expectedParameters = {
|
|
56
58
|
search: "1",
|
|
@@ -65,6 +67,7 @@ describe("A US Autocomplete Pro Client", function () {
|
|
|
65
67
|
prefer_zip_codes: "q;r",
|
|
66
68
|
prefer_ratio: "s",
|
|
67
69
|
prefer_geolocation: "t",
|
|
70
|
+
source: "all",
|
|
68
71
|
};
|
|
69
72
|
|
|
70
73
|
client.send(lookup);
|