react-yandex-api-maps-script
Advanced tools
Comparing version 1.0.6 to 1.1.0
@@ -16,5 +16,11 @@ "use strict"; | ||
var srcApi = { | ||
freeVersion: 'https://api-maps.yandex.ru', | ||
paidVersion: 'https://enterprise.api-maps.yandex.ru' | ||
}; | ||
var YandexApiMapsScript = function YandexApiMapsScript(_ref) { | ||
var apikey = _ref.apikey; | ||
var src = "https://api-maps.yandex.ru/2.1/?lang=ru_RU&apikey=".concat(apikey); | ||
var apikey = _ref.apikey, | ||
srcApi = _ref.srcApi; | ||
var src = "".concat(srcApi, "/2.1/?lang=ru_RU&apikey=").concat(apikey); | ||
return _react.default.createElement(_reactScriptTag.default, { | ||
@@ -27,5 +33,9 @@ src: src, | ||
YandexApiMapsScript.propTypes = { | ||
typeSrc: _propTypes.string, | ||
apikey: _propTypes.string.isRequired | ||
}; | ||
YandexApiMapsScript.defaultProps = { | ||
typeSrc: srcApi.freeVersion | ||
}; | ||
var _default = YandexApiMapsScript; | ||
exports.default = _default; |
{ | ||
"name": "react-yandex-api-maps-script", | ||
"version": "1.0.6", | ||
"version": "1.1.0", | ||
"description": "yandex api maps script binding for React", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -5,5 +5,11 @@ import React from 'react' | ||
const YandexApiMapsScript = ({apikey}) => { | ||
const src = `https://api-maps.yandex.ru/2.1/?lang=ru_RU&apikey=${apikey}` | ||
return ( | ||
const srcApi = { | ||
freeVersion: 'https://api-maps.yandex.ru', | ||
paidVersion: 'https://enterprise.api-maps.yandex.ru', | ||
} | ||
const YandexApiMapsScript = ({apikey, srcApi}) => { | ||
const src = `${srcApi}/2.1/?lang=ru_RU&apikey=${apikey}` | ||
return ( | ||
<ScriptTag src={src} type="text/javascript" /> | ||
@@ -14,5 +20,10 @@ ) | ||
YandexApiMapsScript.propTypes = { | ||
typeSrc: string, | ||
apikey: string.isRequired, | ||
} | ||
YandexApiMapsScript.defaultProps = { | ||
typeSrc: srcApi.freeVersion, | ||
} | ||
export default YandexApiMapsScript |
102483
62