Comparing version 1.1.0 to 1.1.1
@@ -1,11 +0,5 @@ | ||
import { dataId } from '../core/constants'; | ||
var getSsrData = function getSsrData(defaultDataId) { | ||
if (defaultDataId === void 0) { | ||
defaultDataId = dataId; | ||
} | ||
return typeof window !== 'undefined' && !!document ? JSON.parse(document.getElementById(defaultDataId).textContent) : {}; | ||
var getSsrData = function getSsrData() { | ||
return typeof window !== 'undefined' && !!document ? window.__CENTARIUS_SERVER_STATE__ : {}; | ||
}; | ||
export default getSsrData; |
import _extends from "@babel/runtime/helpers/extends"; | ||
import _objectSpread from "@babel/runtime/helpers/objectSpread"; | ||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose"; | ||
@@ -7,14 +6,11 @@ import React from 'react'; | ||
import serialize from 'serialize-javascript'; | ||
import { dataId } from '../core/constants'; | ||
var CentariusData = function CentariusData(_ref) { | ||
var id = _ref.id, | ||
data = _ref.data, | ||
rest = _objectWithoutPropertiesLoose(_ref, ["id", "data"]); | ||
var data = _ref.data, | ||
rest = _objectWithoutPropertiesLoose(_ref, ["data"]); | ||
return React.createElement("script", _extends({ | ||
id: id, | ||
type: "application/json", | ||
dangerouslySetInnerHTML: { | ||
__html: serialize(_objectSpread({}, data)).replace(/<\/script>/g, '%3C/script%3E') | ||
__html: "window.__CENTARIUS_SERVER_STATE__=" + serialize(data) | ||
} | ||
@@ -25,9 +21,7 @@ }, rest)); | ||
CentariusData.propTypes = process.env.NODE_ENV !== "production" ? { | ||
data: PropTypes.any, | ||
id: PropTypes.string | ||
data: PropTypes.any | ||
} : {}; | ||
CentariusData.defaultProps = { | ||
data: {}, | ||
id: dataId | ||
data: {} | ||
}; | ||
export default CentariusData; |
{ | ||
"name": "centarius", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "♥ Sweet React SSR for Everyone ♥", | ||
@@ -68,3 +68,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "f18ae2990e455b03cedbea6ac55c266e6d53f239" | ||
"gitHead": "bb1e9ac1450674e89ac6da8008e864cece73d2fa" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58882
812