@medipass/utils 11.82.2 → 11.82.3
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/google-addresses.d.ts +11 -0
- package/google-addresses.js +37 -0
- package/package.json +2 -2
package/google-addresses.d.ts
CHANGED
|
@@ -12,3 +12,14 @@ export declare const parseAddress: (addressComponents: google.maps.GeocoderAddre
|
|
|
12
12
|
city?: string | undefined;
|
|
13
13
|
postcode?: string | undefined;
|
|
14
14
|
};
|
|
15
|
+
export declare const getAddressFromPlaceId: (placeId: string) => Promise<{
|
|
16
|
+
addressComponents: {
|
|
17
|
+
address?: string | undefined;
|
|
18
|
+
countryCode?: string | undefined;
|
|
19
|
+
country?: string | undefined;
|
|
20
|
+
state?: string | undefined;
|
|
21
|
+
city?: string | undefined;
|
|
22
|
+
postcode?: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
latLng: google.maps.LatLngLiteral;
|
|
25
|
+
}>;
|
package/google-addresses.js
CHANGED
|
@@ -128,7 +128,44 @@ var parseAddress = function parseAddress(addressComponents) {
|
|
|
128
128
|
|
|
129
129
|
return requestData;
|
|
130
130
|
};
|
|
131
|
+
var getAddressFromPlaceId = /*#__PURE__*/function () {
|
|
132
|
+
var _ref3 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(placeId) {
|
|
133
|
+
var results, result, latLng, addressComponents;
|
|
134
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) {
|
|
135
|
+
while (1) {
|
|
136
|
+
switch (_context3.prev = _context3.next) {
|
|
137
|
+
case 0:
|
|
138
|
+
_context3.next = 2;
|
|
139
|
+
return reactPlacesAutocomplete.geocodeByPlaceId(placeId);
|
|
140
|
+
|
|
141
|
+
case 2:
|
|
142
|
+
results = _context3.sent;
|
|
143
|
+
result = results == null ? void 0 : results[0];
|
|
144
|
+
_context3.next = 6;
|
|
145
|
+
return reactPlacesAutocomplete.getLatLng(result);
|
|
146
|
+
|
|
147
|
+
case 6:
|
|
148
|
+
latLng = _context3.sent;
|
|
149
|
+
addressComponents = parseAddress(result == null ? void 0 : result.address_components);
|
|
150
|
+
return _context3.abrupt("return", {
|
|
151
|
+
addressComponents: addressComponents,
|
|
152
|
+
latLng: latLng
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
case 9:
|
|
156
|
+
case "end":
|
|
157
|
+
return _context3.stop();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}, _callee3);
|
|
161
|
+
}));
|
|
162
|
+
|
|
163
|
+
return function getAddressFromPlaceId(_x3) {
|
|
164
|
+
return _ref3.apply(this, arguments);
|
|
165
|
+
};
|
|
166
|
+
}();
|
|
131
167
|
|
|
132
168
|
exports.geocodeAddress = geocodeAddress;
|
|
169
|
+
exports.getAddressFromPlaceId = getAddressFromPlaceId;
|
|
133
170
|
exports.mapAddressComponents = mapAddressComponents;
|
|
134
171
|
exports.parseAddress = parseAddress;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medipass/utils",
|
|
3
|
-
"version": "11.82.
|
|
3
|
+
"version": "11.82.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"rimraf": "^2.6.2",
|
|
52
52
|
"typescript": "4.8.4"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "e0ef9aeb40fd9afb9e019feb2001da6f16cfbbb4"
|
|
55
55
|
}
|