@sitecore-jss/sitecore-jss-react 12.0.3 → 12.0.4
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.
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var react_1 = __importDefault(require("react"));
|
|
7
3
|
var withSitecoreContext_1 = require("../enhancers/withSitecoreContext");
|
|
8
4
|
var emittedVI = false;
|
|
9
5
|
var VIComponent = function (_a) {
|
|
10
6
|
var sitecoreContext = _a.sitecoreContext;
|
|
11
|
-
if (
|
|
12
|
-
typeof document
|
|
13
|
-
sitecoreContext.visitorIdentificationTimestamp) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
script.type = 'text/javascript';
|
|
18
|
-
document.getElementsByTagName('head')[0].appendChild(script);
|
|
19
|
-
return (react_1.default.createElement("meta", { name: "VIcurrentDateTime", content: sitecoreContext.visitorIdentificationTimestamp }));
|
|
7
|
+
if (emittedVI ||
|
|
8
|
+
typeof document === 'undefined' ||
|
|
9
|
+
!sitecoreContext.visitorIdentificationTimestamp) {
|
|
10
|
+
// Don't emit VI script and meta tag if we've already done so,
|
|
11
|
+
// aren't rendering client-side, or don't have a VI timestamp.
|
|
12
|
+
return null;
|
|
20
13
|
}
|
|
14
|
+
emittedVI = true;
|
|
15
|
+
var script = document.createElement('script');
|
|
16
|
+
script.src = "/layouts/system/VisitorIdentification.js";
|
|
17
|
+
script.type = 'text/javascript';
|
|
18
|
+
var meta = document.createElement('meta');
|
|
19
|
+
meta.name = 'VIcurrentDateTime';
|
|
20
|
+
meta.content = sitecoreContext.visitorIdentificationTimestamp;
|
|
21
|
+
var head = document.querySelector('head');
|
|
22
|
+
head && head.appendChild(script);
|
|
23
|
+
head && head.appendChild(meta);
|
|
21
24
|
return null;
|
|
22
25
|
};
|
|
23
26
|
VIComponent.displayName = 'VisitorIdentification';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-jss/sitecore-jss-react",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run clean && tsc",
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"react-dom": "^16.9.0"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@sitecore-jss/sitecore-jss": "^12.0.
|
|
59
|
+
"@sitecore-jss/sitecore-jss": "^12.0.4",
|
|
60
60
|
"prop-types": "^15.7.2",
|
|
61
61
|
"style-attr": "^1.3.0"
|
|
62
62
|
},
|
|
63
63
|
"description": "",
|
|
64
64
|
"types": "types/index.d.ts",
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "5270fdb5ab261e6856d5040332e0dff718a89003"
|
|
66
66
|
}
|