@blaze-cms/nextjs-tools 0.146.0-node18-core-styles.4 → 0.146.0-node18-core-styles-tooltips.0
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.
- package/CHANGELOG.md +3 -36
- package/lib/components/DebugSidebar/index.js +51 -6
- package/lib/components/DebugSidebar/index.js.map +1 -1
- package/lib/helpers/index.js +16 -1
- package/lib/helpers/index.js.map +1 -1
- package/lib/helpers/set-blaze-debug.js +31 -17
- package/lib/helpers/set-blaze-debug.js.map +1 -1
- package/lib-es/components/DebugSidebar/index.js +38 -3
- package/lib-es/components/DebugSidebar/index.js.map +1 -1
- package/lib-es/helpers/index.js +2 -2
- package/lib-es/helpers/index.js.map +1 -1
- package/lib-es/helpers/set-blaze-debug.js +24 -17
- package/lib-es/helpers/set-blaze-debug.js.map +1 -1
- package/package.json +17 -17
- package/src/components/DebugSidebar/index.js +64 -23
- package/src/helpers/index.js +3 -2
- package/src/helpers/set-blaze-debug.js +23 -15
- package/tests/unit/src/components/DebugSidebar/DebugSidebar.test.js +8 -0
- package/tests/unit/src/components/DebugSidebar/__snapshots__/DebugSidebar.test.js.snap +23 -0
- package/tests/unit/src/pages/Resolver.test.js +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,42 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [0.146.0-node18-core-styles.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Bug Fixes
|
|
10
|
-
|
|
11
|
-
* set blank cache-control header to override nextjs default of 0 ([#4783](https://github.com/thebyte9/blaze/issues/4783)) ([2f1653e](https://github.com/thebyte9/blaze/commit/2f1653ed3756a90575c48f8a2253776958c6c0ff))
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# [0.146.0-node18-core-styles.3](https://github.com/thebyte9/blaze/compare/v0.146.0-node18-core-styles.2...v0.146.0-node18-core-styles.3) (2025-05-19)
|
|
18
|
-
|
|
19
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
# [0.146.0-node18-core-styles.2](https://github.com/thebyte9/blaze/compare/v0.146.0-node18-core-styles.1...v0.146.0-node18-core-styles.2) (2025-05-16)
|
|
26
|
-
|
|
27
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# [0.146.0-node18-core-styles.1](https://github.com/thebyte9/blaze/compare/v0.146.0-node18-core-styles.0...v0.146.0-node18-core-styles.1) (2025-04-07)
|
|
34
|
-
|
|
35
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
# [0.146.0-node18-core-styles.0](https://github.com/thebyte9/blaze/compare/v0.145.0...v0.146.0-node18-core-styles.0) (2025-04-04)
|
|
6
|
+
# [0.146.0-node18-core-styles-tooltips.0](https://github.com/thebyte9/blaze/compare/v0.145.0...v0.146.0-node18-core-styles-tooltips.0) (2025-06-18)
|
|
42
7
|
|
|
43
8
|
|
|
44
9
|
### Bug Fixes
|
|
@@ -54,6 +19,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
54
19
|
* linting fixed automatically ([73135b9](https://github.com/thebyte9/blaze/commit/73135b9b8b0d5407e2e1dfba42ab2381f290607f))
|
|
55
20
|
* only do parent redirect when there are graphql errors ([#4697](https://github.com/thebyte9/blaze/issues/4697)) ([1ec63ba](https://github.com/thebyte9/blaze/commit/1ec63ba95c21c11d41721f07346945742d7237ae))
|
|
56
21
|
* prevent 404 error when no data is returned from and improve redi… ([#4688](https://github.com/thebyte9/blaze/issues/4688)) ([3a5af3d](https://github.com/thebyte9/blaze/commit/3a5af3ddf65d67456971d2d75525235c30965633))
|
|
22
|
+
* set blank cache-control header to override nextjs default of 0 ([#4783](https://github.com/thebyte9/blaze/issues/4783)) ([2f1653e](https://github.com/thebyte9/blaze/commit/2f1653ed3756a90575c48f8a2253776958c6c0ff))
|
|
57
23
|
* udpated yarn lock ([0cd4fa4](https://github.com/thebyte9/blaze/commit/0cd4fa4a185fca4b80b57e472badb771dd649ec2))
|
|
58
24
|
* updated with dev ([90f545f](https://github.com/thebyte9/blaze/commit/90f545f1beabb35e26ba6fb2b45a7a0dfd072927))
|
|
59
25
|
* updated with dev ([729bb6e](https://github.com/thebyte9/blaze/commit/729bb6ee7e87946081d51564a4ab45538f7be1e7))
|
|
@@ -66,6 +32,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
66
32
|
|
|
67
33
|
* allow . (dot) character in route regex ([#4552](https://github.com/thebyte9/blaze/issues/4552)) ([9be0fe0](https://github.com/thebyte9/blaze/commit/9be0fe0dd0dac2e0891c2d965a20c6b2e02165cc))
|
|
68
34
|
* debug sidebar now shows on error if enabled ([#4667](https://github.com/thebyte9/blaze/issues/4667)) ([01d43e1](https://github.com/thebyte9/blaze/commit/01d43e19c160980cfc8259c1a951ab70ebe70eb0))
|
|
35
|
+
* open frontend debug toolbar with a url param ([#4771](https://github.com/thebyte9/blaze/issues/4771)) ([37b8ea5](https://github.com/thebyte9/blaze/commit/37b8ea59a5ed4be0912465717adeb079fd6b3a89))
|
|
69
36
|
* updated react to 18 ([9335f84](https://github.com/thebyte9/blaze/commit/9335f8432b376494501abb9c3deef1ddaa9b35a8))
|
|
70
37
|
|
|
71
38
|
|
|
@@ -1,24 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.array.iterator.js");
|
|
4
3
|
require("core-js/modules/es.object.define-property.js");
|
|
5
4
|
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
6
|
-
require("core-js/modules/es.object.to-string.js");
|
|
7
|
-
require("core-js/modules/es.string.iterator.js");
|
|
8
5
|
require("core-js/modules/es.weak-map.js");
|
|
9
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
10
6
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
11
7
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
12
8
|
Object.defineProperty(exports, "__esModule", {
|
|
13
9
|
value: true
|
|
14
10
|
});
|
|
15
11
|
exports["default"] = void 0;
|
|
12
|
+
require("core-js/modules/es.array.concat.js");
|
|
13
|
+
require("core-js/modules/es.array.includes.js");
|
|
14
|
+
require("core-js/modules/es.array.iterator.js");
|
|
15
|
+
require("core-js/modules/es.date.to-string.js");
|
|
16
|
+
require("core-js/modules/es.object.to-string.js");
|
|
17
|
+
require("core-js/modules/es.regexp.to-string.js");
|
|
18
|
+
require("core-js/modules/es.string.includes.js");
|
|
19
|
+
require("core-js/modules/es.string.iterator.js");
|
|
20
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
21
|
+
require("core-js/modules/web.url-search-params.js");
|
|
16
22
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
23
|
var _react = _interopRequireWildcard(require("react"));
|
|
18
24
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
25
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
20
26
|
var _nextjsComponents = require("@blaze-cms/nextjs-components");
|
|
21
27
|
var _md = require("react-icons/md");
|
|
28
|
+
var _router = require("next/router");
|
|
29
|
+
var _io = require("react-icons/io5");
|
|
22
30
|
var _helpers = require("../../helpers");
|
|
23
31
|
var _constants = require("../../constants");
|
|
24
32
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -35,11 +43,28 @@ var DebugSidebar = function DebugSidebar(_ref) {
|
|
|
35
43
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
36
44
|
isOpen = _useState4[0],
|
|
37
45
|
setIsOpen = _useState4[1];
|
|
46
|
+
var router = (0, _router.useRouter)();
|
|
38
47
|
(0, _react.useEffect)(function () {
|
|
39
48
|
if (debugMode === true) {
|
|
40
49
|
setIsDebugMode(debugMode);
|
|
41
50
|
} else (0, _helpers.setBlazeDebug)(setIsDebugMode);
|
|
42
51
|
}, [debugMode]);
|
|
52
|
+
(0, _react.useEffect)(function () {
|
|
53
|
+
var handleRouteChange = function handleRouteChange(url) {
|
|
54
|
+
var hasDebug = url.includes("".concat(_helpers.BLAZE_DEBUG, "=1"));
|
|
55
|
+
if (hasDebug) {
|
|
56
|
+
(0, _helpers.setBlazeDebug)(setIsDebugMode);
|
|
57
|
+
setIsOpen(true);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
if (router.asPath.includes("".concat(_helpers.BLAZE_DEBUG, "=1"))) {
|
|
61
|
+
handleRouteChange(router.asPath);
|
|
62
|
+
}
|
|
63
|
+
router.events.on('routeChangeComplete', handleRouteChange);
|
|
64
|
+
return function () {
|
|
65
|
+
router.events.off('routeChangeComplete', handleRouteChange);
|
|
66
|
+
};
|
|
67
|
+
}, [router.events, router.asPath]);
|
|
43
68
|
var divClass = (0, _classnames["default"])('debug-sidebar', {
|
|
44
69
|
'debug-sidebar--open': isOpen,
|
|
45
70
|
'debug-sidebar--close': !isOpen
|
|
@@ -48,7 +73,22 @@ var DebugSidebar = function DebugSidebar(_ref) {
|
|
|
48
73
|
itemEntity: itemEntity,
|
|
49
74
|
itemId: itemId
|
|
50
75
|
});
|
|
51
|
-
|
|
76
|
+
var closeDebug = function closeDebug() {
|
|
77
|
+
(0, _helpers.setBlazeDebug)(setIsDebugMode);
|
|
78
|
+
window.blaze.debug();
|
|
79
|
+
var _router$asPath$split = router.asPath.split('?'),
|
|
80
|
+
_router$asPath$split2 = (0, _slicedToArray2["default"])(_router$asPath$split, 2),
|
|
81
|
+
pathname = _router$asPath$split2[0],
|
|
82
|
+
_router$asPath$split3 = _router$asPath$split2[1],
|
|
83
|
+
search = _router$asPath$split3 === void 0 ? '' : _router$asPath$split3;
|
|
84
|
+
var params = new URLSearchParams(search);
|
|
85
|
+
params["delete"](_helpers.BLAZE_DEBUG);
|
|
86
|
+
var newUrl = params.toString() ? "".concat(pathname, "?").concat(params.toString()) : pathname;
|
|
87
|
+
router.push('/Resolver', newUrl, {
|
|
88
|
+
shallow: true
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
return isDebugMode ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
52
92
|
className: divClass,
|
|
53
93
|
"data-testid": "debug-sidebar"
|
|
54
94
|
}, /*#__PURE__*/_react["default"].createElement(_nextjsComponents.Link, {
|
|
@@ -57,6 +97,11 @@ var DebugSidebar = function DebugSidebar(_ref) {
|
|
|
57
97
|
src: _constants.DEBUG_LOGO.SRC,
|
|
58
98
|
alt: _constants.DEBUG_LOGO.ALT
|
|
59
99
|
}), /*#__PURE__*/_react["default"].createElement("span", null, "Blaze admin")), /*#__PURE__*/_react["default"].createElement("div", {
|
|
100
|
+
role: "button",
|
|
101
|
+
className: "debug-sidebar__button debug-sidebar__button--close",
|
|
102
|
+
"data-testid": "debug-sidebar-close",
|
|
103
|
+
onClick: closeDebug
|
|
104
|
+
}, /*#__PURE__*/_react["default"].createElement(_io.IoCloseOutline, null)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
60
105
|
role: "button",
|
|
61
106
|
className: "debug-sidebar__button open",
|
|
62
107
|
"data-testid": "debug-sidebar-button",
|
|
@@ -64,7 +109,7 @@ var DebugSidebar = function DebugSidebar(_ref) {
|
|
|
64
109
|
onClick: function onClick() {
|
|
65
110
|
return setIsOpen(!isOpen);
|
|
66
111
|
}
|
|
67
|
-
}, /*#__PURE__*/_react["default"].createElement("i", null, /*#__PURE__*/_react["default"].createElement(_md.MdKeyboardArrowLeft, null)))) : null
|
|
112
|
+
}, /*#__PURE__*/_react["default"].createElement("i", null, /*#__PURE__*/_react["default"].createElement(_md.MdKeyboardArrowLeft, null)))) : null;
|
|
68
113
|
};
|
|
69
114
|
DebugSidebar.propTypes = {
|
|
70
115
|
itemEntity: _propTypes["default"].string,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_classnames","_nextjsComponents","_md","_helpers","_constants","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DebugSidebar","_ref","itemEntity","itemId","debugMode","_useState","useState","_useState2","_slicedToArray2","isDebugMode","setIsDebugMode","_useState3","_useState4","isOpen","setIsOpen","useEffect","setBlazeDebug","divClass","classnames","href","buildAdminHref","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_classnames","_nextjsComponents","_md","_router","_io","_helpers","_constants","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DebugSidebar","_ref","itemEntity","itemId","debugMode","_useState","useState","_useState2","_slicedToArray2","isDebugMode","setIsDebugMode","_useState3","_useState4","isOpen","setIsOpen","router","useRouter","useEffect","setBlazeDebug","handleRouteChange","url","hasDebug","includes","concat","BLAZE_DEBUG","asPath","events","on","off","divClass","classnames","href","buildAdminHref","closeDebug","window","blaze","debug","_router$asPath$split","split","_router$asPath$split2","pathname","_router$asPath$split3","search","params","URLSearchParams","newUrl","toString","push","shallow","createElement","className","Link","src","DEBUG_LOGO","SRC","alt","ALT","role","onClick","IoCloseOutline","id","MdKeyboardArrowLeft","propTypes","PropTypes","string","bool","defaultProps","_default","exports"],"sources":["../../../src/components/DebugSidebar/index.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport { Link } from '@blaze-cms/nextjs-components';\nimport { MdKeyboardArrowLeft } from 'react-icons/md';\nimport { useRouter } from 'next/router';\nimport { IoCloseOutline } from 'react-icons/io5';\nimport { buildAdminHref, setBlazeDebug, BLAZE_DEBUG } from '../../helpers';\nimport { DEBUG_LOGO } from '../../constants';\n\nconst DebugSidebar = ({ itemEntity, itemId, debugMode }) => {\n const [isDebugMode, setIsDebugMode] = useState(debugMode);\n const [isOpen, setIsOpen] = useState(true);\n const router = useRouter();\n\n useEffect(() => {\n if (debugMode === true) {\n setIsDebugMode(debugMode);\n } else setBlazeDebug(setIsDebugMode);\n }, [debugMode]);\n\n useEffect(() => {\n const handleRouteChange = url => {\n const hasDebug = url.includes(`${BLAZE_DEBUG}=1`);\n if (hasDebug) {\n setBlazeDebug(setIsDebugMode);\n setIsOpen(true);\n }\n };\n\n if (router.asPath.includes(`${BLAZE_DEBUG}=1`)) {\n handleRouteChange(router.asPath);\n }\n\n router.events.on('routeChangeComplete', handleRouteChange);\n return () => {\n router.events.off('routeChangeComplete', handleRouteChange);\n };\n }, [router.events, router.asPath]);\n\n const divClass = classnames('debug-sidebar', {\n 'debug-sidebar--open': isOpen,\n 'debug-sidebar--close': !isOpen\n });\n\n const href = buildAdminHref({ itemEntity, itemId });\n\n const closeDebug = () => {\n setBlazeDebug(setIsDebugMode);\n window.blaze.debug();\n\n const [pathname, search = ''] = router.asPath.split('?');\n const params = new URLSearchParams(search);\n params.delete(BLAZE_DEBUG);\n const newUrl = params.toString() ? `${pathname}?${params.toString()}` : pathname;\n\n router.push('/Resolver', newUrl, {\n shallow: true\n });\n };\n\n return isDebugMode ? (\n <div className={divClass} data-testid=\"debug-sidebar\">\n <Link href={href}>\n <img src={DEBUG_LOGO.SRC} alt={DEBUG_LOGO.ALT} />\n <span>Blaze admin</span>\n </Link>\n\n <div\n role=\"button\"\n className=\"debug-sidebar__button debug-sidebar__button--close\"\n data-testid=\"debug-sidebar-close\"\n onClick={closeDebug}>\n <IoCloseOutline />\n </div>\n\n <div\n role=\"button\"\n className=\"debug-sidebar__button open\"\n data-testid=\"debug-sidebar-button\"\n id=\"debug-sidebar-button\"\n onClick={() => setIsOpen(!isOpen)}>\n <i>\n <MdKeyboardArrowLeft />\n </i>\n </div>\n </div>\n ) : null;\n};\n\nDebugSidebar.propTypes = {\n itemEntity: PropTypes.string,\n itemId: PropTypes.string,\n debugMode: PropTypes.bool\n};\n\nDebugSidebar.defaultProps = {\n itemEntity: '',\n itemId: '',\n debugMode: false\n};\n\nexport default DebugSidebar;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,GAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,GAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AAA6C,SAAAU,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAZ,wBAAAY,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,gBAAAK,OAAA,CAAAL,CAAA,0BAAAA,CAAA,sBAAAA,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA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;IAClCU,EAAE,EAAC,sBAAsB;IACzBF,OAAO,EAAE,SAATA,OAAOA,CAAA;MAAA,OAAQ5C,SAAS,CAAC,CAACD,MAAM,CAAC;IAAA;EAAC,gBAClC7C,MAAA,YAAAiF,aAAA,yBACEjF,MAAA,YAAAiF,aAAA,CAAC1E,GAAA,CAAAsF,mBAAmB,MAAE,CACrB,CACA,CACF,CAAC,GACJ,IAAI;AACV,CAAC;AAED7D,YAAY,CAAC8D,SAAS,GAAG;EACvB5D,UAAU,EAAE6D,qBAAS,CAACC,MAAM;EAC5B7D,MAAM,EAAE4D,qBAAS,CAACC,MAAM;EACxB5D,SAAS,EAAE2D,qBAAS,CAACE;AACvB,CAAC;AAEDjE,YAAY,CAACkE,YAAY,GAAG;EAC1BhE,UAAU,EAAE,EAAE;EACdC,MAAM,EAAE,EAAE;EACVC,SAAS,EAAE;AACb,CAAC;AAAC,IAAA+D,QAAA,GAAAC,OAAA,cAEapE,YAAY","ignoreList":[]}
|
package/lib/helpers/index.js
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.array.iterator.js");
|
|
3
4
|
require("core-js/modules/es.object.define-property.js");
|
|
5
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
6
|
+
require("core-js/modules/es.object.to-string.js");
|
|
7
|
+
require("core-js/modules/es.string.iterator.js");
|
|
8
|
+
require("core-js/modules/es.weak-map.js");
|
|
9
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
4
10
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
11
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
12
|
Object.defineProperty(exports, "__esModule", {
|
|
6
13
|
value: true
|
|
7
14
|
});
|
|
15
|
+
Object.defineProperty(exports, "BLAZE_DEBUG", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function get() {
|
|
18
|
+
return _setBlazeDebug.BLAZE_DEBUG;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
8
21
|
Object.defineProperty(exports, "buildAdminHref", {
|
|
9
22
|
enumerable: true,
|
|
10
23
|
get: function get() {
|
|
@@ -76,10 +89,12 @@ var _getEntitysActions = _interopRequireDefault(require("./get-entitys-actions")
|
|
|
76
89
|
var _getSearchFilter = _interopRequireDefault(require("./get-search-filter"));
|
|
77
90
|
var _checkParent = _interopRequireDefault(require("./check-parent"));
|
|
78
91
|
var _buildAdminHref = _interopRequireDefault(require("./build-admin-href"));
|
|
79
|
-
var _setBlazeDebug =
|
|
92
|
+
var _setBlazeDebug = _interopRequireWildcard(require("./set-blaze-debug"));
|
|
80
93
|
var _checkForGtm = _interopRequireDefault(require("./check-for-gtm"));
|
|
81
94
|
var _renderAppleTags = _interopRequireDefault(require("./render-apple-tags"));
|
|
82
95
|
var _getPageData = _interopRequireDefault(require("./get-page-data"));
|
|
83
96
|
var _getErrorMessage = _interopRequireDefault(require("./get-error-message"));
|
|
84
97
|
var _getRootSelectorClasses = _interopRequireDefault(require("./get-root-selector-classes"));
|
|
98
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
99
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
85
100
|
//# sourceMappingURL=index.js.map
|
package/lib/helpers/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_checkUrl","_interopRequireDefault","require","_getEntitysActions","_getSearchFilter","_checkParent","_buildAdminHref","_setBlazeDebug","_checkForGtm","_renderAppleTags","_getPageData","_getErrorMessage","_getRootSelectorClasses"],"sources":["../../src/helpers/index.js"],"sourcesContent":["import checkUrl from './check-url';\nimport getEntitysActions from './get-entitys-actions';\nimport getSearchFilter from './get-search-filter';\nimport checkParent from './check-parent';\nimport buildAdminHref from './build-admin-href';\nimport setBlazeDebug from './set-blaze-debug';\nimport checkForGtm from './check-for-gtm';\nimport renderAppleTags from './render-apple-tags';\nimport getPageData from './get-page-data';\nimport getErrorMessage from './get-error-message';\nimport getRootSelectorClasses from './get-root-selector-classes';\n\nexport {\n buildAdminHref,\n checkForGtm,\n checkParent,\n checkUrl,\n getEntitysActions,\n getSearchFilter,\n getPageData,\n getErrorMessage,\n renderAppleTags,\n setBlazeDebug,\n getRootSelectorClasses\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_checkUrl","_interopRequireDefault","require","_getEntitysActions","_getSearchFilter","_checkParent","_buildAdminHref","_setBlazeDebug","_interopRequireWildcard","_checkForGtm","_renderAppleTags","_getPageData","_getErrorMessage","_getRootSelectorClasses","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set"],"sources":["../../src/helpers/index.js"],"sourcesContent":["import checkUrl from './check-url';\nimport getEntitysActions from './get-entitys-actions';\nimport getSearchFilter from './get-search-filter';\nimport checkParent from './check-parent';\nimport buildAdminHref from './build-admin-href';\nimport setBlazeDebug, { BLAZE_DEBUG } from './set-blaze-debug';\nimport checkForGtm from './check-for-gtm';\nimport renderAppleTags from './render-apple-tags';\nimport getPageData from './get-page-data';\nimport getErrorMessage from './get-error-message';\nimport getRootSelectorClasses from './get-root-selector-classes';\n\nexport {\n buildAdminHref,\n checkForGtm,\n checkParent,\n checkUrl,\n getEnt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,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,cAAAR,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA","ignoreList":[]}
|
|
@@ -4,26 +4,40 @@ require("core-js/modules/es.object.define-property.js");
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports["default"] = void 0;
|
|
7
|
+
exports["default"] = exports.BLAZE_DEBUG = void 0;
|
|
8
|
+
require("core-js/modules/es.array.iterator.js");
|
|
8
9
|
require("core-js/modules/es.object.keys.js");
|
|
9
|
-
|
|
10
|
+
require("core-js/modules/es.object.to-string.js");
|
|
11
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
12
|
+
require("core-js/modules/es.string.iterator.js");
|
|
13
|
+
require("core-js/modules/es.string.search.js");
|
|
14
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
15
|
+
require("core-js/modules/web.url-search-params.js");
|
|
16
|
+
var BLAZE_DEBUG = exports.BLAZE_DEBUG = 'blaze_debug';
|
|
10
17
|
var setBlazeDebug = function setBlazeDebug(setIsDebugMode) {
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
if (typeof window === 'undefined') return;
|
|
19
|
+
var _window = window,
|
|
20
|
+
localStorage = _window.localStorage,
|
|
21
|
+
location = _window.location;
|
|
22
|
+
var params = new URLSearchParams(location.search);
|
|
23
|
+
window.blaze = window.blaze || {};
|
|
24
|
+
window.blaze.debug = function () {
|
|
25
|
+
var stored = JSON.parse(localStorage.getItem(BLAZE_DEBUG));
|
|
26
|
+
if (stored) {
|
|
27
|
+
localStorage.removeItem(BLAZE_DEBUG);
|
|
28
|
+
setIsDebugMode(false);
|
|
29
|
+
} else {
|
|
30
|
+
localStorage.setItem(BLAZE_DEBUG, 'true');
|
|
31
|
+
setIsDebugMode(true);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
if (params.get(BLAZE_DEBUG) === '1') {
|
|
35
|
+
localStorage.setItem(BLAZE_DEBUG, 'true');
|
|
36
|
+
setIsDebugMode(true);
|
|
37
|
+
return;
|
|
25
38
|
}
|
|
26
|
-
|
|
39
|
+
var stored = JSON.parse(localStorage.getItem(BLAZE_DEBUG));
|
|
40
|
+
setIsDebugMode(!!stored);
|
|
27
41
|
};
|
|
28
42
|
var _default = exports["default"] = setBlazeDebug;
|
|
29
43
|
//# sourceMappingURL=set-blaze-debug.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-blaze-debug.js","names":["BLAZE_DEBUG","setBlazeDebug","setIsDebugMode","window","
|
|
1
|
+
{"version":3,"file":"set-blaze-debug.js","names":["BLAZE_DEBUG","exports","setBlazeDebug","setIsDebugMode","window","_window","localStorage","location","params","URLSearchParams","search","blaze","debug","stored","JSON","parse","getItem","removeItem","setItem","get","_default"],"sources":["../../src/helpers/set-blaze-debug.js"],"sourcesContent":["export const BLAZE_DEBUG = 'blaze_debug';\n\nconst setBlazeDebug = setIsDebugMode => {\n if (typeof window === 'undefined') return;\n\n const { localStorage, location } = window;\n const params = new URLSearchParams(location.search);\n\n window.blaze = window.blaze || {};\n window.blaze.debug = () => {\n const stored = JSON.parse(localStorage.getItem(BLAZE_DEBUG));\n if (stored) {\n localStorage.removeItem(BLAZE_DEBUG);\n setIsDebugMode(false);\n } else {\n localStorage.setItem(BLAZE_DEBUG, 'true');\n setIsDebugMode(true);\n }\n };\n\n if (params.get(BLAZE_DEBUG) === '1') {\n localStorage.setItem(BLAZE_DEBUG, 'true');\n setIsDebugMode(true);\n return;\n }\n\n const stored = JSON.parse(localStorage.getItem(BLAZE_DEBUG));\n setIsDebugMode(!!stored);\n};\n\nexport default setBlazeDebug;\n"],"mappings":";;;;;;;;;;;;;;;AAAO,IAAMA,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,aAAa;AAExC,IAAME,aAAa,GAAG,SAAhBA,aAAaA,CAAGC,cAAc,EAAI;EACtC,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;EAEnC,IAAAC,OAAA,GAAmCD,MAAM;IAAjCE,YAAY,GAAAD,OAAA,CAAZC,YAAY;IAAEC,QAAQ,GAAAF,OAAA,CAARE,QAAQ;EAC9B,IAAMC,MAAM,GAAG,IAAIC,eAAe,CAACF,QAAQ,CAACG,MAAM,CAAC;EAEnDN,MAAM,CAACO,KAAK,GAAGP,MAAM,CAACO,KAAK,IAAI,CAAC,CAAC;EACjCP,MAAM,CAACO,KAAK,CAACC,KAAK,GAAG,YAAM;IACzB,IAAMC,MAAM,GAAGC,IAAI,CAACC,KAAK,CAACT,YAAY,CAACU,OAAO,CAAChB,WAAW,CAAC,CAAC;IAC5D,IAAIa,MAAM,EAAE;MACVP,YAAY,CAACW,UAAU,CAACjB,WAAW,CAAC;MACpCG,cAAc,CAAC,KAAK,CAAC;IACvB,CAAC,MAAM;MACLG,YAAY,CAACY,OAAO,CAAClB,WAAW,EAAE,MAAM,CAAC;MACzCG,cAAc,CAAC,IAAI,CAAC;IACtB;EACF,CAAC;EAED,IAAIK,MAAM,CAACW,GAAG,CAACnB,WAAW,CAAC,KAAK,GAAG,EAAE;IACnCM,YAAY,CAACY,OAAO,CAAClB,WAAW,EAAE,MAAM,CAAC;IACzCG,cAAc,CAAC,IAAI,CAAC;IACpB;EACF;EAEA,IAAMU,MAAM,GAAGC,IAAI,CAACC,KAAK,CAACT,YAAY,CAACU,OAAO,CAAChB,WAAW,CAAC,CAAC;EAC5DG,cAAc,CAAC,CAAC,CAACU,MAAM,CAAC;AAC1B,CAAC;AAAC,IAAAO,QAAA,GAAAnB,OAAA,cAEaC,aAAa","ignoreList":[]}
|
|
@@ -3,7 +3,9 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { Link } from '@blaze-cms/nextjs-components';
|
|
5
5
|
import { MdKeyboardArrowLeft } from 'react-icons/md';
|
|
6
|
-
import {
|
|
6
|
+
import { useRouter } from 'next/router';
|
|
7
|
+
import { IoCloseOutline } from 'react-icons/io5';
|
|
8
|
+
import { buildAdminHref, setBlazeDebug, BLAZE_DEBUG } from '../../helpers';
|
|
7
9
|
import { DEBUG_LOGO } from '../../constants';
|
|
8
10
|
const DebugSidebar = ({
|
|
9
11
|
itemEntity,
|
|
@@ -12,11 +14,28 @@ const DebugSidebar = ({
|
|
|
12
14
|
}) => {
|
|
13
15
|
const [isDebugMode, setIsDebugMode] = useState(debugMode);
|
|
14
16
|
const [isOpen, setIsOpen] = useState(true);
|
|
17
|
+
const router = useRouter();
|
|
15
18
|
useEffect(() => {
|
|
16
19
|
if (debugMode === true) {
|
|
17
20
|
setIsDebugMode(debugMode);
|
|
18
21
|
} else setBlazeDebug(setIsDebugMode);
|
|
19
22
|
}, [debugMode]);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const handleRouteChange = url => {
|
|
25
|
+
const hasDebug = url.includes(`${BLAZE_DEBUG}=1`);
|
|
26
|
+
if (hasDebug) {
|
|
27
|
+
setBlazeDebug(setIsDebugMode);
|
|
28
|
+
setIsOpen(true);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
if (router.asPath.includes(`${BLAZE_DEBUG}=1`)) {
|
|
32
|
+
handleRouteChange(router.asPath);
|
|
33
|
+
}
|
|
34
|
+
router.events.on('routeChangeComplete', handleRouteChange);
|
|
35
|
+
return () => {
|
|
36
|
+
router.events.off('routeChangeComplete', handleRouteChange);
|
|
37
|
+
};
|
|
38
|
+
}, [router.events, router.asPath]);
|
|
20
39
|
const divClass = classnames('debug-sidebar', {
|
|
21
40
|
'debug-sidebar--open': isOpen,
|
|
22
41
|
'debug-sidebar--close': !isOpen
|
|
@@ -25,7 +44,18 @@ const DebugSidebar = ({
|
|
|
25
44
|
itemEntity,
|
|
26
45
|
itemId
|
|
27
46
|
});
|
|
28
|
-
|
|
47
|
+
const closeDebug = () => {
|
|
48
|
+
setBlazeDebug(setIsDebugMode);
|
|
49
|
+
window.blaze.debug();
|
|
50
|
+
const [pathname, search = ''] = router.asPath.split('?');
|
|
51
|
+
const params = new URLSearchParams(search);
|
|
52
|
+
params.delete(BLAZE_DEBUG);
|
|
53
|
+
const newUrl = params.toString() ? `${pathname}?${params.toString()}` : pathname;
|
|
54
|
+
router.push('/Resolver', newUrl, {
|
|
55
|
+
shallow: true
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
return isDebugMode ? /*#__PURE__*/React.createElement("div", {
|
|
29
59
|
className: divClass,
|
|
30
60
|
"data-testid": "debug-sidebar"
|
|
31
61
|
}, /*#__PURE__*/React.createElement(Link, {
|
|
@@ -34,12 +64,17 @@ const DebugSidebar = ({
|
|
|
34
64
|
src: DEBUG_LOGO.SRC,
|
|
35
65
|
alt: DEBUG_LOGO.ALT
|
|
36
66
|
}), /*#__PURE__*/React.createElement("span", null, "Blaze admin")), /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
role: "button",
|
|
68
|
+
className: "debug-sidebar__button debug-sidebar__button--close",
|
|
69
|
+
"data-testid": "debug-sidebar-close",
|
|
70
|
+
onClick: closeDebug
|
|
71
|
+
}, /*#__PURE__*/React.createElement(IoCloseOutline, null)), /*#__PURE__*/React.createElement("div", {
|
|
37
72
|
role: "button",
|
|
38
73
|
className: "debug-sidebar__button open",
|
|
39
74
|
"data-testid": "debug-sidebar-button",
|
|
40
75
|
id: "debug-sidebar-button",
|
|
41
76
|
onClick: () => setIsOpen(!isOpen)
|
|
42
|
-
}, /*#__PURE__*/React.createElement("i", null, /*#__PURE__*/React.createElement(MdKeyboardArrowLeft, null)))) : null
|
|
77
|
+
}, /*#__PURE__*/React.createElement("i", null, /*#__PURE__*/React.createElement(MdKeyboardArrowLeft, null)))) : null;
|
|
43
78
|
};
|
|
44
79
|
DebugSidebar.propTypes = {
|
|
45
80
|
itemEntity: PropTypes.string,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useState","useEffect","PropTypes","classnames","Link","MdKeyboardArrowLeft","buildAdminHref","setBlazeDebug","DEBUG_LOGO","DebugSidebar","itemEntity","itemId","debugMode","isDebugMode","setIsDebugMode","isOpen","setIsOpen","divClass","href","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useState","useEffect","PropTypes","classnames","Link","MdKeyboardArrowLeft","useRouter","IoCloseOutline","buildAdminHref","setBlazeDebug","BLAZE_DEBUG","DEBUG_LOGO","DebugSidebar","itemEntity","itemId","debugMode","isDebugMode","setIsDebugMode","isOpen","setIsOpen","router","handleRouteChange","url","hasDebug","includes","asPath","events","on","off","divClass","href","closeDebug","window","blaze","debug","pathname","search","split","params","URLSearchParams","delete","newUrl","toString","push","shallow","createElement","className","src","SRC","alt","ALT","role","onClick","id","propTypes","string","bool","defaultProps"],"sources":["../../../src/components/DebugSidebar/index.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport { Link } from '@blaze-cms/nextjs-components';\nimport { MdKeyboardArrowLeft } from 'react-icons/md';\nimport { useRouter } from 'next/router';\nimport { IoCloseOutline } from 'react-icons/io5';\nimport { buildAdminHref, setBlazeDebug, BLAZE_DEBUG } from '../../helpers';\nimport { DEBUG_LOGO } from '../../constants';\n\nconst DebugSidebar = ({ itemEntity, itemId, debugMode }) => {\n const [isDebugMode, setIsDebugMode] = useState(debugMode);\n const [isOpen, setIsOpen] = useState(true);\n const router = useRouter();\n\n useEffect(() => {\n if (debugMode === true) {\n setIsDebugMode(debugMode);\n } else setBlazeDebug(setIsDebugMode);\n }, [debugMode]);\n\n useEffect(() => {\n const handleRouteChange = url => {\n const hasDebug = url.includes(`${BLAZE_DEBUG}=1`);\n if (hasDebug) {\n setBlazeDebug(setIsDebugMode);\n setIsOpen(true);\n }\n };\n\n if (router.asPath.includes(`${BLAZE_DEBUG}=1`)) {\n handleRouteChange(router.asPath);\n }\n\n router.events.on('routeChangeComplete', handleRouteChange);\n return () => {\n router.events.off('routeChangeComplete', handleRouteChange);\n };\n }, [router.events, router.asPath]);\n\n const divClass = classnames('debug-sidebar', {\n 'debug-sidebar--open': isOpen,\n 'debug-sidebar--close': !isOpen\n });\n\n const href = buildAdminHref({ itemEntity, itemId });\n\n const closeDebug = () => {\n setBlazeDebug(setIsDebugMode);\n window.blaze.debug();\n\n const [pathname, search = ''] = router.asPath.split('?');\n const params = new URLSearchParams(search);\n params.delete(BLAZE_DEBUG);\n const newUrl = params.toString() ? `${pathname}?${params.toString()}` : pathname;\n\n router.push('/Resolver', newUrl, {\n shallow: true\n });\n };\n\n return isDebugMode ? (\n <div className={divClass} data-testid=\"debug-sidebar\">\n <Link href={href}>\n <img src={DEBUG_LOGO.SRC} alt={DEBUG_LOGO.ALT} />\n <span>Blaze admin</span>\n </Link>\n\n <div\n role=\"button\"\n className=\"debug-sidebar__button debug-sidebar__button--close\"\n data-testid=\"debug-sidebar-close\"\n onClick={closeDebug}>\n <IoCloseOutline />\n </div>\n\n <div\n role=\"button\"\n className=\"debug-sidebar__button open\"\n data-testid=\"debug-sidebar-button\"\n id=\"debug-sidebar-button\"\n onClick={() => setIsOpen(!isOpen)}>\n <i>\n <MdKeyboardArrowLeft />\n </i>\n </div>\n </div>\n ) : null;\n};\n\nDebugSidebar.propTypes = {\n itemEntity: PropTypes.string,\n itemId: PropTypes.string,\n debugMode: PropTypes.bool\n};\n\nDebugSidebar.defaultProps = {\n itemEntity: '',\n itemId: '',\n debugMode: false\n};\n\nexport default DebugSidebar;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAClD,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,IAAI,QAAQ,8BAA8B;AACnD,SAASC,mBAAmB,QAAQ,gBAAgB;AACpD,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,cAAc,EAAEC,aAAa,EAAEC,WAAW,QAAQ,eAAe;AAC1E,SAASC,UAAU,QAAQ,iBAAiB;AAE5C,MAAMC,YAAY,GAAGA,CAAC;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,KAAK;EAC1D,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGjB,QAAQ,CAACe,SAAS,CAAC;EACzD,MAAM,CAACG,MAAM,EAAEC,SAAS,CAAC,GAAGnB,QAAQ,CAAC,IAAI,CAAC;EAC1C,MAAMoB,MAAM,GAAGd,SAAS,CAAC,CAAC;EAE1BL,SAAS,CAAC,MAAM;IACd,IAAIc,SAAS,KAAK,IAAI,EAAE;MACtBE,cAAc,CAACF,SAAS,CAAC;IAC3B,CAAC,MAAMN,aAAa,CAACQ,cAAc,CAAC;EACtC,CAAC,EAAE,CAACF,SAAS,CAAC,CAAC;EAEfd,SAAS,CAAC,MAAM;IACd,MAAMoB,iBAAiB,GAAGC,GAAG,IAAI;MAC/B,MAAMC,QAAQ,GAAGD,GAAG,CAACE,QAAQ,CAAC,GAAGd,WAAW,IAAI,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-es/helpers/index.js
CHANGED
|
@@ -3,11 +3,11 @@ import getEntitysActions from './get-entitys-actions';
|
|
|
3
3
|
import getSearchFilter from './get-search-filter';
|
|
4
4
|
import checkParent from './check-parent';
|
|
5
5
|
import buildAdminHref from './build-admin-href';
|
|
6
|
-
import setBlazeDebug from './set-blaze-debug';
|
|
6
|
+
import setBlazeDebug, { BLAZE_DEBUG } from './set-blaze-debug';
|
|
7
7
|
import checkForGtm from './check-for-gtm';
|
|
8
8
|
import renderAppleTags from './render-apple-tags';
|
|
9
9
|
import getPageData from './get-page-data';
|
|
10
10
|
import getErrorMessage from './get-error-message';
|
|
11
11
|
import getRootSelectorClasses from './get-root-selector-classes';
|
|
12
|
-
export { buildAdminHref, checkForGtm, checkParent, checkUrl, getEntitysActions, getSearchFilter, getPageData, getErrorMessage, renderAppleTags, setBlazeDebug, getRootSelectorClasses };
|
|
12
|
+
export { buildAdminHref, checkForGtm, checkParent, checkUrl, getEntitysActions, getSearchFilter, getPageData, getErrorMessage, renderAppleTags, setBlazeDebug, getRootSelectorClasses, BLAZE_DEBUG };
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["checkUrl","getEntitysActions","getSearchFilter","checkParent","buildAdminHref","setBlazeDebug","checkForGtm","renderAppleTags","getPageData","getErrorMessage","getRootSelectorClasses"],"sources":["../../src/helpers/index.js"],"sourcesContent":["import checkUrl from './check-url';\nimport getEntitysActions from './get-entitys-actions';\nimport getSearchFilter from './get-search-filter';\nimport checkParent from './check-parent';\nimport buildAdminHref from './build-admin-href';\nimport setBlazeDebug from './set-blaze-debug';\nimport checkForGtm from './check-for-gtm';\nimport renderAppleTags from './render-apple-tags';\nimport getPageData from './get-page-data';\nimport getErrorMessage from './get-error-message';\nimport getRootSelectorClasses from './get-root-selector-classes';\n\nexport {\n buildAdminHref,\n checkForGtm,\n checkParent,\n checkUrl,\n getEntitysActions,\n getSearchFilter,\n getPageData,\n getErrorMessage,\n renderAppleTags,\n setBlazeDebug,\n getRootSelectorClasses\n};\n"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,aAAa;AAClC,OAAOC,iBAAiB,MAAM,uBAAuB;AACrD,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,WAAW,MAAM,gBAAgB;AACxC,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,OAAOC,aAAa,
|
|
1
|
+
{"version":3,"file":"index.js","names":["checkUrl","getEntitysActions","getSearchFilter","checkParent","buildAdminHref","setBlazeDebug","BLAZE_DEBUG","checkForGtm","renderAppleTags","getPageData","getErrorMessage","getRootSelectorClasses"],"sources":["../../src/helpers/index.js"],"sourcesContent":["import checkUrl from './check-url';\nimport getEntitysActions from './get-entitys-actions';\nimport getSearchFilter from './get-search-filter';\nimport checkParent from './check-parent';\nimport buildAdminHref from './build-admin-href';\nimport setBlazeDebug, { BLAZE_DEBUG } from './set-blaze-debug';\nimport checkForGtm from './check-for-gtm';\nimport renderAppleTags from './render-apple-tags';\nimport getPageData from './get-page-data';\nimport getErrorMessage from './get-error-message';\nimport getRootSelectorClasses from './get-root-selector-classes';\n\nexport {\n buildAdminHref,\n checkForGtm,\n checkParent,\n checkUrl,\n getEntitysActions,\n getSearchFilter,\n getPageData,\n getErrorMessage,\n renderAppleTags,\n setBlazeDebug,\n getRootSelectorClasses,\n BLAZE_DEBUG\n};\n"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,aAAa;AAClC,OAAOC,iBAAiB,MAAM,uBAAuB;AACrD,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,WAAW,MAAM,gBAAgB;AACxC,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,OAAOC,aAAa,IAAIC,WAAW,QAAQ,mBAAmB;AAC9D,OAAOC,WAAW,MAAM,iBAAiB;AACzC,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,WAAW,MAAM,iBAAiB;AACzC,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,sBAAsB,MAAM,6BAA6B;AAEhE,SACEP,cAAc,EACdG,WAAW,EACXJ,WAAW,EACXH,QAAQ,EACRC,iBAAiB,EACjBC,eAAe,EACfO,WAAW,EACXC,eAAe,EACfF,eAAe,EACfH,aAAa,EACbM,sBAAsB,EACtBL,WAAW","ignoreList":[]}
|
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
const BLAZE_DEBUG = 'blaze_debug';
|
|
1
|
+
export const BLAZE_DEBUG = 'blaze_debug';
|
|
2
2
|
const setBlazeDebug = setIsDebugMode => {
|
|
3
|
-
if (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
3
|
+
if (typeof window === 'undefined') return;
|
|
4
|
+
const {
|
|
5
|
+
localStorage,
|
|
6
|
+
location
|
|
7
|
+
} = window;
|
|
8
|
+
const params = new URLSearchParams(location.search);
|
|
9
|
+
window.blaze = window.blaze || {};
|
|
10
|
+
window.blaze.debug = () => {
|
|
11
|
+
const stored = JSON.parse(localStorage.getItem(BLAZE_DEBUG));
|
|
12
|
+
if (stored) {
|
|
13
|
+
localStorage.removeItem(BLAZE_DEBUG);
|
|
14
|
+
setIsDebugMode(false);
|
|
15
|
+
} else {
|
|
16
|
+
localStorage.setItem(BLAZE_DEBUG, 'true');
|
|
17
|
+
setIsDebugMode(true);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
if (params.get(BLAZE_DEBUG) === '1') {
|
|
21
|
+
localStorage.setItem(BLAZE_DEBUG, 'true');
|
|
22
|
+
setIsDebugMode(true);
|
|
23
|
+
return;
|
|
18
24
|
}
|
|
19
|
-
|
|
25
|
+
const stored = JSON.parse(localStorage.getItem(BLAZE_DEBUG));
|
|
26
|
+
setIsDebugMode(!!stored);
|
|
20
27
|
};
|
|
21
28
|
export default setBlazeDebug;
|
|
22
29
|
//# sourceMappingURL=set-blaze-debug.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-blaze-debug.js","names":["BLAZE_DEBUG","setBlazeDebug","setIsDebugMode","window","blaze","debug","
|
|
1
|
+
{"version":3,"file":"set-blaze-debug.js","names":["BLAZE_DEBUG","setBlazeDebug","setIsDebugMode","window","localStorage","location","params","URLSearchParams","search","blaze","debug","stored","JSON","parse","getItem","removeItem","setItem","get"],"sources":["../../src/helpers/set-blaze-debug.js"],"sourcesContent":["export const BLAZE_DEBUG = 'blaze_debug';\n\nconst setBlazeDebug = setIsDebugMode => {\n if (typeof window === 'undefined') return;\n\n const { localStorage, location } = window;\n const params = new URLSearchParams(location.search);\n\n window.blaze = window.blaze || {};\n window.blaze.debug = () => {\n const stored = JSON.parse(localStorage.getItem(BLAZE_DEBUG));\n if (stored) {\n localStorage.removeItem(BLAZE_DEBUG);\n setIsDebugMode(false);\n } else {\n localStorage.setItem(BLAZE_DEBUG, 'true');\n setIsDebugMode(true);\n }\n };\n\n if (params.get(BLAZE_DEBUG) === '1') {\n localStorage.setItem(BLAZE_DEBUG, 'true');\n setIsDebugMode(true);\n return;\n }\n\n const stored = JSON.parse(localStorage.getItem(BLAZE_DEBUG));\n setIsDebugMode(!!stored);\n};\n\nexport default setBlazeDebug;\n"],"mappings":"AAAA,OAAO,MAAMA,WAAW,GAAG,aAAa;AAExC,MAAMC,aAAa,GAAGC,cAAc,IAAI;EACtC,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;EAEnC,MAAM;IAAEC,YAAY;IAAEC;EAAS,CAAC,GAAGF,MAAM;EACzC,MAAMG,MAAM,GAAG,IAAIC,eAAe,CAACF,QAAQ,CAACG,MAAM,CAAC;EAEnDL,MAAM,CAACM,KAAK,GAAGN,MAAM,CAACM,KAAK,IAAI,CAAC,CAAC;EACjCN,MAAM,CAACM,KAAK,CAACC,KAAK,GAAG,MAAM;IACzB,MAAMC,MAAM,GAAGC,IAAI,CAACC,KAAK,CAACT,YAAY,CAACU,OAAO,CAACd,WAAW,CAAC,CAAC;IAC5D,IAAIW,MAAM,EAAE;MACVP,YAAY,CAACW,UAAU,CAACf,WAAW,CAAC;MACpCE,cAAc,CAAC,KAAK,CAAC;IACvB,CAAC,MAAM;MACLE,YAAY,CAACY,OAAO,CAAChB,WAAW,EAAE,MAAM,CAAC;MACzCE,cAAc,CAAC,IAAI,CAAC;IACtB;EACF,CAAC;EAED,IAAII,MAAM,CAACW,GAAG,CAACjB,WAAW,CAAC,KAAK,GAAG,EAAE;IACnCI,YAAY,CAACY,OAAO,CAAChB,WAAW,EAAE,MAAM,CAAC;IACzCE,cAAc,CAAC,IAAI,CAAC;IACpB;EACF;EAEA,MAAMS,MAAM,GAAGC,IAAI,CAACC,KAAK,CAACT,YAAY,CAACU,OAAO,CAACd,WAAW,CAAC,CAAC;EAC5DE,cAAc,CAAC,CAAC,CAACS,MAAM,CAAC;AAC1B,CAAC;AAED,eAAeV,aAAa","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/nextjs-tools",
|
|
3
|
-
"version": "0.146.0-node18-core-styles.
|
|
3
|
+
"version": "0.146.0-node18-core-styles-tooltips.0",
|
|
4
4
|
"description": "Blaze nextjs tools",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -28,21 +28,21 @@
|
|
|
28
28
|
"license": "GPL-3.0",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@apollo/client": "^3.9.2",
|
|
31
|
-
"@blaze-cms/core-auth-ui": "0.146.0-node18-core-styles.
|
|
32
|
-
"@blaze-cms/core-errors": "0.146.0-node18-core-styles.
|
|
33
|
-
"@blaze-cms/core-errors-ui": "0.146.0-node18-core-styles.0",
|
|
34
|
-
"@blaze-cms/core-ui": "0.146.0-node18-core-styles.
|
|
35
|
-
"@blaze-cms/nextjs-components": "0.146.0-node18-core-styles.0",
|
|
36
|
-
"@blaze-cms/plugin-auth-fe": "0.146.0-node18-core-styles.
|
|
37
|
-
"@blaze-cms/plugin-auth-local-fe": "0.146.0-node18-core-styles.
|
|
38
|
-
"@blaze-cms/plugin-google-maps-fe": "0.146.0-node18-core-styles.
|
|
39
|
-
"@blaze-cms/plugin-gtm-fe": "0.146.0-node18-core-styles.
|
|
40
|
-
"@blaze-cms/plugin-page-builder-fe": "0.146.0-node18-core-styles.
|
|
41
|
-
"@blaze-cms/plugin-preview-fe": "0.146.0-node18-core-styles.
|
|
42
|
-
"@blaze-cms/plugin-search-ui": "0.146.0-node18-core-styles.
|
|
43
|
-
"@blaze-cms/plugin-structured-data-fe": "0.146.0-node18-core-styles.0",
|
|
44
|
-
"@blaze-cms/react-page-builder": "0.146.0-node18-core-styles.
|
|
45
|
-
"@blaze-cms/setup-ui": "0.146.0-node18-core-styles.0",
|
|
31
|
+
"@blaze-cms/core-auth-ui": "0.146.0-node18-core-styles-tooltips.0",
|
|
32
|
+
"@blaze-cms/core-errors": "0.146.0-node18-core-styles-tooltips.0",
|
|
33
|
+
"@blaze-cms/core-errors-ui": "0.146.0-node18-core-styles-tooltips.0",
|
|
34
|
+
"@blaze-cms/core-ui": "0.146.0-node18-core-styles-tooltips.0",
|
|
35
|
+
"@blaze-cms/nextjs-components": "0.146.0-node18-core-styles-tooltips.0",
|
|
36
|
+
"@blaze-cms/plugin-auth-fe": "0.146.0-node18-core-styles-tooltips.0",
|
|
37
|
+
"@blaze-cms/plugin-auth-local-fe": "0.146.0-node18-core-styles-tooltips.0",
|
|
38
|
+
"@blaze-cms/plugin-google-maps-fe": "0.146.0-node18-core-styles-tooltips.0",
|
|
39
|
+
"@blaze-cms/plugin-gtm-fe": "0.146.0-node18-core-styles-tooltips.0",
|
|
40
|
+
"@blaze-cms/plugin-page-builder-fe": "0.146.0-node18-core-styles-tooltips.0",
|
|
41
|
+
"@blaze-cms/plugin-preview-fe": "0.146.0-node18-core-styles-tooltips.0",
|
|
42
|
+
"@blaze-cms/plugin-search-ui": "0.146.0-node18-core-styles-tooltips.0",
|
|
43
|
+
"@blaze-cms/plugin-structured-data-fe": "0.146.0-node18-core-styles-tooltips.0",
|
|
44
|
+
"@blaze-cms/react-page-builder": "0.146.0-node18-core-styles-tooltips.0",
|
|
45
|
+
"@blaze-cms/setup-ui": "0.146.0-node18-core-styles-tooltips.0",
|
|
46
46
|
"autoprefixer": "^10.2.3",
|
|
47
47
|
"core-js": "^3.2.1",
|
|
48
48
|
"cross-fetch": "^3.0.2",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"lib/*",
|
|
70
70
|
"lib-es/*"
|
|
71
71
|
],
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "fc6d636ac61f994280bd9a08da2ba38a360e41d3"
|
|
73
73
|
}
|
|
@@ -3,12 +3,15 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { Link } from '@blaze-cms/nextjs-components';
|
|
5
5
|
import { MdKeyboardArrowLeft } from 'react-icons/md';
|
|
6
|
-
import {
|
|
6
|
+
import { useRouter } from 'next/router';
|
|
7
|
+
import { IoCloseOutline } from 'react-icons/io5';
|
|
8
|
+
import { buildAdminHref, setBlazeDebug, BLAZE_DEBUG } from '../../helpers';
|
|
7
9
|
import { DEBUG_LOGO } from '../../constants';
|
|
8
10
|
|
|
9
11
|
const DebugSidebar = ({ itemEntity, itemId, debugMode }) => {
|
|
10
12
|
const [isDebugMode, setIsDebugMode] = useState(debugMode);
|
|
11
13
|
const [isOpen, setIsOpen] = useState(true);
|
|
14
|
+
const router = useRouter();
|
|
12
15
|
|
|
13
16
|
useEffect(() => {
|
|
14
17
|
if (debugMode === true) {
|
|
@@ -16,6 +19,25 @@ const DebugSidebar = ({ itemEntity, itemId, debugMode }) => {
|
|
|
16
19
|
} else setBlazeDebug(setIsDebugMode);
|
|
17
20
|
}, [debugMode]);
|
|
18
21
|
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const handleRouteChange = url => {
|
|
24
|
+
const hasDebug = url.includes(`${BLAZE_DEBUG}=1`);
|
|
25
|
+
if (hasDebug) {
|
|
26
|
+
setBlazeDebug(setIsDebugMode);
|
|
27
|
+
setIsOpen(true);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
if (router.asPath.includes(`${BLAZE_DEBUG}=1`)) {
|
|
32
|
+
handleRouteChange(router.asPath);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
router.events.on('routeChangeComplete', handleRouteChange);
|
|
36
|
+
return () => {
|
|
37
|
+
router.events.off('routeChangeComplete', handleRouteChange);
|
|
38
|
+
};
|
|
39
|
+
}, [router.events, router.asPath]);
|
|
40
|
+
|
|
19
41
|
const divClass = classnames('debug-sidebar', {
|
|
20
42
|
'debug-sidebar--open': isOpen,
|
|
21
43
|
'debug-sidebar--close': !isOpen
|
|
@@ -23,28 +45,47 @@ const DebugSidebar = ({ itemEntity, itemId, debugMode }) => {
|
|
|
23
45
|
|
|
24
46
|
const href = buildAdminHref({ itemEntity, itemId });
|
|
25
47
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
</
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
const closeDebug = () => {
|
|
49
|
+
setBlazeDebug(setIsDebugMode);
|
|
50
|
+
window.blaze.debug();
|
|
51
|
+
|
|
52
|
+
const [pathname, search = ''] = router.asPath.split('?');
|
|
53
|
+
const params = new URLSearchParams(search);
|
|
54
|
+
params.delete(BLAZE_DEBUG);
|
|
55
|
+
const newUrl = params.toString() ? `${pathname}?${params.toString()}` : pathname;
|
|
56
|
+
|
|
57
|
+
router.push('/Resolver', newUrl, {
|
|
58
|
+
shallow: true
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
return isDebugMode ? (
|
|
63
|
+
<div className={divClass} data-testid="debug-sidebar">
|
|
64
|
+
<Link href={href}>
|
|
65
|
+
<img src={DEBUG_LOGO.SRC} alt={DEBUG_LOGO.ALT} />
|
|
66
|
+
<span>Blaze admin</span>
|
|
67
|
+
</Link>
|
|
68
|
+
|
|
69
|
+
<div
|
|
70
|
+
role="button"
|
|
71
|
+
className="debug-sidebar__button debug-sidebar__button--close"
|
|
72
|
+
data-testid="debug-sidebar-close"
|
|
73
|
+
onClick={closeDebug}>
|
|
74
|
+
<IoCloseOutline />
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<div
|
|
78
|
+
role="button"
|
|
79
|
+
className="debug-sidebar__button open"
|
|
80
|
+
data-testid="debug-sidebar-button"
|
|
81
|
+
id="debug-sidebar-button"
|
|
82
|
+
onClick={() => setIsOpen(!isOpen)}>
|
|
83
|
+
<i>
|
|
84
|
+
<MdKeyboardArrowLeft />
|
|
85
|
+
</i>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
) : null;
|
|
48
89
|
};
|
|
49
90
|
|
|
50
91
|
DebugSidebar.propTypes = {
|
package/src/helpers/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import getEntitysActions from './get-entitys-actions';
|
|
|
3
3
|
import getSearchFilter from './get-search-filter';
|
|
4
4
|
import checkParent from './check-parent';
|
|
5
5
|
import buildAdminHref from './build-admin-href';
|
|
6
|
-
import setBlazeDebug from './set-blaze-debug';
|
|
6
|
+
import setBlazeDebug, { BLAZE_DEBUG } from './set-blaze-debug';
|
|
7
7
|
import checkForGtm from './check-for-gtm';
|
|
8
8
|
import renderAppleTags from './render-apple-tags';
|
|
9
9
|
import getPageData from './get-page-data';
|
|
@@ -21,5 +21,6 @@ export {
|
|
|
21
21
|
getErrorMessage,
|
|
22
22
|
renderAppleTags,
|
|
23
23
|
setBlazeDebug,
|
|
24
|
-
getRootSelectorClasses
|
|
24
|
+
getRootSelectorClasses,
|
|
25
|
+
BLAZE_DEBUG
|
|
25
26
|
};
|
|
@@ -1,23 +1,31 @@
|
|
|
1
|
-
const BLAZE_DEBUG = 'blaze_debug';
|
|
1
|
+
export const BLAZE_DEBUG = 'blaze_debug';
|
|
2
2
|
|
|
3
3
|
const setBlazeDebug = setIsDebugMode => {
|
|
4
|
-
if (
|
|
5
|
-
window.blaze = {
|
|
6
|
-
debug: () => {
|
|
7
|
-
const { localStorage } = window;
|
|
4
|
+
if (typeof window === 'undefined') return;
|
|
8
5
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
setIsDebugMode(false);
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
6
|
+
const { localStorage, location } = window;
|
|
7
|
+
const params = new URLSearchParams(location.search);
|
|
14
8
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
window.blaze = window.blaze || {};
|
|
10
|
+
window.blaze.debug = () => {
|
|
11
|
+
const stored = JSON.parse(localStorage.getItem(BLAZE_DEBUG));
|
|
12
|
+
if (stored) {
|
|
13
|
+
localStorage.removeItem(BLAZE_DEBUG);
|
|
14
|
+
setIsDebugMode(false);
|
|
15
|
+
} else {
|
|
16
|
+
localStorage.setItem(BLAZE_DEBUG, 'true');
|
|
17
|
+
setIsDebugMode(true);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
if (params.get(BLAZE_DEBUG) === '1') {
|
|
22
|
+
localStorage.setItem(BLAZE_DEBUG, 'true');
|
|
23
|
+
setIsDebugMode(true);
|
|
24
|
+
return;
|
|
19
25
|
}
|
|
20
|
-
|
|
26
|
+
|
|
27
|
+
const stored = JSON.parse(localStorage.getItem(BLAZE_DEBUG));
|
|
28
|
+
setIsDebugMode(!!stored);
|
|
21
29
|
};
|
|
22
30
|
|
|
23
31
|
export default setBlazeDebug;
|
|
@@ -7,6 +7,14 @@ import { MockedProvider } from '@apollo/client/testing';
|
|
|
7
7
|
import { render, act, fireEvent } from '@testing-library/react';
|
|
8
8
|
import { DebugSidebar } from '../../../../../src/components';
|
|
9
9
|
|
|
10
|
+
jest.mock('next/router', () => ({
|
|
11
|
+
useRouter: jest.fn(() => ({
|
|
12
|
+
asPath: 'some-url',
|
|
13
|
+
push: () => {},
|
|
14
|
+
events: { on: () => {}, off: () => {} }
|
|
15
|
+
}))
|
|
16
|
+
}));
|
|
17
|
+
|
|
10
18
|
const mockProps = {
|
|
11
19
|
itemEntity: 'published_article',
|
|
12
20
|
itemId: '0000-1111-2222-test',
|
|
@@ -21,6 +21,29 @@ exports[`DebugSidebar component should render without throwing error (isDebugMod
|
|
|
21
21
|
Blaze admin
|
|
22
22
|
</span>
|
|
23
23
|
</a>
|
|
24
|
+
<div
|
|
25
|
+
class="debug-sidebar__button debug-sidebar__button--close"
|
|
26
|
+
data-testid="debug-sidebar-close"
|
|
27
|
+
role="button"
|
|
28
|
+
>
|
|
29
|
+
<svg
|
|
30
|
+
fill="currentColor"
|
|
31
|
+
height="1em"
|
|
32
|
+
stroke="currentColor"
|
|
33
|
+
stroke-width="0"
|
|
34
|
+
viewBox="0 0 512 512"
|
|
35
|
+
width="1em"
|
|
36
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
37
|
+
>
|
|
38
|
+
<path
|
|
39
|
+
d="M368 368L144 144m224 0L144 368"
|
|
40
|
+
fill="none"
|
|
41
|
+
stroke-linecap="round"
|
|
42
|
+
stroke-linejoin="round"
|
|
43
|
+
stroke-width="32"
|
|
44
|
+
/>
|
|
45
|
+
</svg>
|
|
46
|
+
</div>
|
|
24
47
|
<div
|
|
25
48
|
class="debug-sidebar__button open"
|
|
26
49
|
data-testid="debug-sidebar-button"
|
|
@@ -9,7 +9,11 @@ import Resolver from '../../../../src/pages/Resolver';
|
|
|
9
9
|
jest.mock('../../../../src/containers/ContentContainer', () => jest.fn(() => 'ContentContainer'));
|
|
10
10
|
|
|
11
11
|
jest.mock('next/router', () => ({
|
|
12
|
-
useRouter: jest.fn(() => ({
|
|
12
|
+
useRouter: jest.fn(() => ({
|
|
13
|
+
asPath: 'some-url',
|
|
14
|
+
push: () => {},
|
|
15
|
+
events: { on: () => {}, off: () => {} }
|
|
16
|
+
}))
|
|
13
17
|
}));
|
|
14
18
|
|
|
15
19
|
jest.mock('next/error', () => jest.fn(() => 'NextError'));
|