function()

in Node/core/lib/dialogs/retrieve-facebook-location-dialog.js [18:46]


        function (session, results, next) {
            if (session.dialogData.args.reverseGeocode && results.response && results.response.place) {
                locationService.getLocationByPoint(apiKey, results.response.place.point.coordinates[0], results.response.place.point.coordinates[1])
                    .then(function (locations) {
                    var place;
                    if (locations.length && locations[0].address) {
                        var address = {
                            addressLine: undefined,
                            formattedAddress: undefined,
                            adminDistrict: locations[0].address.adminDistrict,
                            adminDistrict2: locations[0].address.adminDistrict2,
                            countryRegion: locations[0].address.countryRegion,
                            locality: locations[0].address.locality,
                            postalCode: locations[0].address.postalCode
                        };
                        place = { address: address, bbox: locations[0].bbox, confidence: locations[0].confidence, entityType: locations[0].entityType, name: locations[0].name, point: locations[0].point };
                    }
                    else {
                        place = results.response.place;
                    }
                    session.endDialogWithResult({ response: { place: place } });
                })
                    .catch(function (error) { return session.error(error); });
                ;
            }
            else {
                next(results);
            }
        }