@sentecacommerce-theme/lib 0.14.15 → 0.14.16
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/config/SentecaProvider.js +4 -4
- package/dist/cjs/listing/components/BasicListingSEO.js +1 -0
- package/dist/cjs/seo/components/BasicSEO/index.js +3 -0
- package/dist/cjs/seo/components/OpenGraph/index.js +4 -0
- package/dist/esm/config/SentecaProvider.js +4 -4
- package/dist/esm/listing/components/BasicListingSEO.js +1 -0
- package/dist/esm/seo/components/BasicSEO/index.js +3 -0
- package/dist/esm/seo/components/OpenGraph/index.js +4 -0
- package/package.json +4 -4
@@ -47,6 +47,7 @@ var ConfigStateContext = /*#__PURE__*/ _react.default.createContext(undefined);
|
|
47
47
|
function SentecaProvider(param) {
|
48
48
|
var defaultConfig = param.defaultConfig, transientConfig = param.transientConfig, localeData = param.localeData, children = param.children, disableStaged = param.disableStaged;
|
49
49
|
var queryCache = (0, _reactQuery).useQueryCache();
|
50
|
+
var router = (0, _router).useRouter();
|
50
51
|
var options = (0, _getSDKConfig).getOptions(defaultConfig);
|
51
52
|
// add interfaceKey and storeKey in the headers
|
52
53
|
if (localeData) {
|
@@ -62,12 +63,11 @@ function SentecaProvider(param) {
|
|
62
63
|
headers: _objectSpread({}, options.headers || {}, transientConfig.headers || {})
|
63
64
|
}));
|
64
65
|
}
|
65
|
-
var router = (0, _router).useRouter();
|
66
66
|
_react.default.useEffect(function() {
|
67
67
|
if (disableStaged || router.query.staged !== 'true') return;
|
68
|
-
var pageName = router.pathname;
|
68
|
+
var pageName = router === null || router === void 0 ? void 0 : router.pathname;
|
69
69
|
if (pageName === '/[[...path]]') {
|
70
|
-
pageName = router.asPath.split('?')[0];
|
70
|
+
pageName = router === null || router === void 0 ? void 0 : router.asPath.split('?')[0];
|
71
71
|
}
|
72
72
|
router.replace({
|
73
73
|
pathname: '/preview',
|
@@ -81,7 +81,7 @@ function SentecaProvider(param) {
|
|
81
81
|
router,
|
82
82
|
disableStaged
|
83
83
|
]);
|
84
|
-
if (!disableStaged && router.asPath.includes('staged=true')) return null;
|
84
|
+
if (!disableStaged && (router === null || router === void 0 ? void 0 : router.asPath.includes('staged=true'))) return null;
|
85
85
|
if (!defaultConfig) {
|
86
86
|
throw new Error('SentecaProvider requires a valid config object');
|
87
87
|
}
|
@@ -33,6 +33,7 @@ var BasicListingSEO = function(param) {
|
|
33
33
|
var formattedDescription = favorDescriptionTemplateOverMeta ? createTemplate(descriptionTemplate) : metaDescription || createTemplate(descriptionTemplate);
|
34
34
|
return(/*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/ _react.default.createElement(_head.default, null, isSearchPage && /*#__PURE__*/ _react.default.createElement("meta", {
|
35
35
|
name: "robots",
|
36
|
+
key: "robots",
|
36
37
|
content: "noindex"
|
37
38
|
}), (pagination === null || pagination === void 0 ? void 0 : pagination.hasPrevious) && /*#__PURE__*/ _react.default.createElement("link", {
|
38
39
|
rel: "prev",
|
@@ -13,12 +13,15 @@ function BasicSEO(props) {
|
|
13
13
|
var title = props.title, description = props.description, keywords = props.keywords, noIndex = props.noIndex;
|
14
14
|
return(/*#__PURE__*/ _react.default.createElement(_head.default, null, Boolean(noIndex) && /*#__PURE__*/ _react.default.createElement("meta", {
|
15
15
|
name: "robots",
|
16
|
+
key: "robots",
|
16
17
|
content: "noindex"
|
17
18
|
}), Boolean(title) && /*#__PURE__*/ _react.default.createElement("title", null, title), Boolean(description) && /*#__PURE__*/ _react.default.createElement("meta", {
|
18
19
|
name: "description",
|
20
|
+
key: "description",
|
19
21
|
content: description
|
20
22
|
}), Boolean(keywords) && /*#__PURE__*/ _react.default.createElement("meta", {
|
21
23
|
name: "keywords",
|
24
|
+
key: "keywords",
|
22
25
|
content: keywords
|
23
26
|
})));
|
24
27
|
}
|
@@ -17,9 +17,11 @@ var OpenGraph = function(props) {
|
|
17
17
|
var domain = (0, _useConfig).useConfigState().domain;
|
18
18
|
return(/*#__PURE__*/ _react.default.createElement(_head.default, null, /*#__PURE__*/ _react.default.createElement("meta", {
|
19
19
|
property: "og:title",
|
20
|
+
key: "og:title",
|
20
21
|
content: title
|
21
22
|
}), /*#__PURE__*/ _react.default.createElement("meta", {
|
22
23
|
property: "og:type",
|
24
|
+
key: "og:type",
|
23
25
|
content: type
|
24
26
|
}), Array.isArray(image) ? image.map(function(img) {
|
25
27
|
/*#__PURE__*/ return _react.default.createElement("meta", {
|
@@ -29,9 +31,11 @@ var OpenGraph = function(props) {
|
|
29
31
|
});
|
30
32
|
}) : /*#__PURE__*/ _react.default.createElement("meta", {
|
31
33
|
property: "og:image",
|
34
|
+
key: "og:image",
|
32
35
|
content: image
|
33
36
|
}), /*#__PURE__*/ _react.default.createElement("meta", {
|
34
37
|
property: "og:url",
|
38
|
+
key: "og:url",
|
35
39
|
content: url || "https://".concat(domain).concat(router === null || router === void 0 ? void 0 : router.asPath)
|
36
40
|
}), Array.isArray(additionalProps) ? additionalProps.map(function(prop) {
|
37
41
|
/*#__PURE__*/ return _react.default.createElement("meta", {
|
@@ -38,6 +38,7 @@ var ConfigStateContext = /*#__PURE__*/ React.createContext(undefined);
|
|
38
38
|
export function SentecaProvider(param) {
|
39
39
|
var defaultConfig = param.defaultConfig, transientConfig = param.transientConfig, localeData = param.localeData, children = param.children, disableStaged = param.disableStaged;
|
40
40
|
var queryCache = useQueryCache();
|
41
|
+
var router = useRouter();
|
41
42
|
var options = getOptions(defaultConfig);
|
42
43
|
// add interfaceKey and storeKey in the headers
|
43
44
|
if (localeData) {
|
@@ -53,12 +54,11 @@ export function SentecaProvider(param) {
|
|
53
54
|
headers: _objectSpread({}, options.headers || {}, transientConfig.headers || {})
|
54
55
|
}));
|
55
56
|
}
|
56
|
-
var router = useRouter();
|
57
57
|
React.useEffect(function() {
|
58
58
|
if (disableStaged || router.query.staged !== 'true') return;
|
59
|
-
var pageName = router.pathname;
|
59
|
+
var pageName = router === null || router === void 0 ? void 0 : router.pathname;
|
60
60
|
if (pageName === '/[[...path]]') {
|
61
|
-
pageName = router.asPath.split('?')[0];
|
61
|
+
pageName = router === null || router === void 0 ? void 0 : router.asPath.split('?')[0];
|
62
62
|
}
|
63
63
|
router.replace({
|
64
64
|
pathname: '/preview',
|
@@ -72,7 +72,7 @@ export function SentecaProvider(param) {
|
|
72
72
|
router,
|
73
73
|
disableStaged
|
74
74
|
]);
|
75
|
-
if (!disableStaged && router.asPath.includes('staged=true')) return null;
|
75
|
+
if (!disableStaged && (router === null || router === void 0 ? void 0 : router.asPath.includes('staged=true'))) return null;
|
76
76
|
if (!defaultConfig) {
|
77
77
|
throw new Error('SentecaProvider requires a valid config object');
|
78
78
|
}
|
@@ -29,6 +29,7 @@ import { useListingMeta, useListingPagination } from '../hooks';
|
|
29
29
|
var formattedDescription = favorDescriptionTemplateOverMeta ? createTemplate(descriptionTemplate) : metaDescription || createTemplate(descriptionTemplate);
|
30
30
|
return(/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Head, null, isSearchPage && /*#__PURE__*/ React.createElement("meta", {
|
31
31
|
name: "robots",
|
32
|
+
key: "robots",
|
32
33
|
content: "noindex"
|
33
34
|
}), (pagination === null || pagination === void 0 ? void 0 : pagination.hasPrevious) && /*#__PURE__*/ React.createElement("link", {
|
34
35
|
rel: "prev",
|
@@ -4,12 +4,15 @@ export function BasicSEO(props) {
|
|
4
4
|
var title = props.title, description = props.description, keywords = props.keywords, noIndex = props.noIndex;
|
5
5
|
return(/*#__PURE__*/ React.createElement(Head, null, Boolean(noIndex) && /*#__PURE__*/ React.createElement("meta", {
|
6
6
|
name: "robots",
|
7
|
+
key: "robots",
|
7
8
|
content: "noindex"
|
8
9
|
}), Boolean(title) && /*#__PURE__*/ React.createElement("title", null, title), Boolean(description) && /*#__PURE__*/ React.createElement("meta", {
|
9
10
|
name: "description",
|
11
|
+
key: "description",
|
10
12
|
content: description
|
11
13
|
}), Boolean(keywords) && /*#__PURE__*/ React.createElement("meta", {
|
12
14
|
name: "keywords",
|
15
|
+
key: "keywords",
|
13
16
|
content: keywords
|
14
17
|
})));
|
15
18
|
}
|
@@ -8,9 +8,11 @@ export var OpenGraph = function(props) {
|
|
8
8
|
var domain = useConfigState().domain;
|
9
9
|
return(/*#__PURE__*/ React.createElement(Head, null, /*#__PURE__*/ React.createElement("meta", {
|
10
10
|
property: "og:title",
|
11
|
+
key: "og:title",
|
11
12
|
content: title
|
12
13
|
}), /*#__PURE__*/ React.createElement("meta", {
|
13
14
|
property: "og:type",
|
15
|
+
key: "og:type",
|
14
16
|
content: type
|
15
17
|
}), Array.isArray(image) ? image.map(function(img) {
|
16
18
|
/*#__PURE__*/ return React.createElement("meta", {
|
@@ -20,9 +22,11 @@ export var OpenGraph = function(props) {
|
|
20
22
|
});
|
21
23
|
}) : /*#__PURE__*/ React.createElement("meta", {
|
22
24
|
property: "og:image",
|
25
|
+
key: "og:image",
|
23
26
|
content: image
|
24
27
|
}), /*#__PURE__*/ React.createElement("meta", {
|
25
28
|
property: "og:url",
|
29
|
+
key: "og:url",
|
26
30
|
content: url || "https://".concat(domain).concat(router === null || router === void 0 ? void 0 : router.asPath)
|
27
31
|
}), Array.isArray(additionalProps) ? additionalProps.map(function(prop) {
|
28
32
|
/*#__PURE__*/ return React.createElement("meta", {
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sentecacommerce-theme/lib",
|
3
3
|
"sideEffects": false,
|
4
|
-
"version": "0.14.
|
4
|
+
"version": "0.14.16",
|
5
5
|
"main": "dist/cjs/index.js",
|
6
6
|
"module": "dist/esm/index.js",
|
7
7
|
"types": "dist/types/index.d.ts",
|
@@ -31,13 +31,13 @@
|
|
31
31
|
"watch:cjs": "swc src --out-dir dist/cjs -w",
|
32
32
|
"watch:esm": "swc src --out-dir dist/esm --no-swcrc -w"
|
33
33
|
},
|
34
|
-
"gitHead": "
|
34
|
+
"gitHead": "d6cdf200ac4174fa2f33aa2120ff0169df884f0a",
|
35
35
|
"peerDependencies": {
|
36
36
|
"react-query": "^2.26.2"
|
37
37
|
},
|
38
38
|
"dependencies": {
|
39
|
-
"@sentecacommerce-theme/base": "^0.14.
|
40
|
-
"@sentecacommerce-theme/cms": "^0.14.
|
39
|
+
"@sentecacommerce-theme/base": "^0.14.16",
|
40
|
+
"@sentecacommerce-theme/cms": "^0.14.16",
|
41
41
|
"@sentecacommerce/sdk": "2.0.175",
|
42
42
|
"body-scroll-lock": "^3.1.5",
|
43
43
|
"copy-to-clipboard": "^3.3.1",
|