@blaze-cms/nextjs-tools 0.146.0-alpha.50 → 0.146.0-alpha.51

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 CHANGED
@@ -3,6 +3,17 @@
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-alpha.51](https://github.com/thebyte9/blaze/compare/v0.146.0-alpha.50...v0.146.0-alpha.51) (2025-06-11)
7
+
8
+
9
+ ### Features
10
+
11
+ * open frontend debug toolbar with a url param ([#4771](https://github.com/thebyte9/blaze/issues/4771)) ([37b8ea5](https://github.com/thebyte9/blaze/commit/37b8ea59a5ed4be0912465717adeb079fd6b3a89))
12
+
13
+
14
+
15
+
16
+
6
17
  # [0.146.0-alpha.50](https://github.com/thebyte9/blaze/compare/v0.146.0-alpha.49...v0.146.0-alpha.50) (2025-05-16)
7
18
 
8
19
  **Note:** Version bump only for package @blaze-cms/nextjs-tools
@@ -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 _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
@@ -34,11 +42,28 @@ var DebugSidebar = function DebugSidebar(_ref) {
34
42
  _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
35
43
  isOpen = _useState4[0],
36
44
  setIsOpen = _useState4[1];
45
+ var router = (0, _router.useRouter)();
37
46
  (0, _react.useEffect)(function () {
38
47
  if (debugMode === true) {
39
48
  setIsDebugMode(debugMode);
40
49
  } else (0, _helpers.setBlazeDebug)(setIsDebugMode);
41
50
  }, [debugMode]);
51
+ (0, _react.useEffect)(function () {
52
+ var handleRouteChange = function handleRouteChange(url) {
53
+ var hasDebug = url.includes("".concat(_helpers.BLAZE_DEBUG, "=1"));
54
+ if (hasDebug) {
55
+ (0, _helpers.setBlazeDebug)(setIsDebugMode);
56
+ setIsOpen(true);
57
+ }
58
+ };
59
+ if (router.asPath.includes("".concat(_helpers.BLAZE_DEBUG, "=1"))) {
60
+ handleRouteChange(router.asPath);
61
+ }
62
+ router.events.on('routeChangeComplete', handleRouteChange);
63
+ return function () {
64
+ router.events.off('routeChangeComplete', handleRouteChange);
65
+ };
66
+ }, [router.events, router.asPath]);
42
67
  var divClass = (0, _classnames["default"])('debug-sidebar', {
43
68
  'debug-sidebar--open': isOpen,
44
69
  'debug-sidebar--close': !isOpen
@@ -47,6 +72,21 @@ var DebugSidebar = function DebugSidebar(_ref) {
47
72
  itemEntity: itemEntity,
48
73
  itemId: itemId
49
74
  });
75
+ var closeDebug = function closeDebug() {
76
+ (0, _helpers.setBlazeDebug)(setIsDebugMode);
77
+ window.blaze.debug();
78
+ var _router$asPath$split = router.asPath.split('?'),
79
+ _router$asPath$split2 = (0, _slicedToArray2["default"])(_router$asPath$split, 2),
80
+ pathname = _router$asPath$split2[0],
81
+ _router$asPath$split3 = _router$asPath$split2[1],
82
+ search = _router$asPath$split3 === void 0 ? '' : _router$asPath$split3;
83
+ var params = new URLSearchParams(search);
84
+ params["delete"](_helpers.BLAZE_DEBUG);
85
+ var newUrl = params.toString() ? "".concat(pathname, "?").concat(params.toString()) : pathname;
86
+ router.push('/Resolver', newUrl, {
87
+ shallow: true
88
+ });
89
+ };
50
90
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, isDebugMode ? /*#__PURE__*/_react["default"].createElement("div", {
51
91
  className: divClass,
52
92
  "data-testid": "debug-sidebar"
@@ -56,6 +96,11 @@ var DebugSidebar = function DebugSidebar(_ref) {
56
96
  src: _constants.DEBUG_LOGO.SRC,
57
97
  alt: _constants.DEBUG_LOGO.ALT
58
98
  }), /*#__PURE__*/_react["default"].createElement("span", null, "Blaze admin")), /*#__PURE__*/_react["default"].createElement("div", {
99
+ role: "button",
100
+ className: "debug-sidebar__button debug-sidebar__button--close",
101
+ "data-testid": "debug-sidebar-close",
102
+ onClick: closeDebug
103
+ }, /*#__PURE__*/_react["default"].createElement(_io.IoCloseOutline, null)), /*#__PURE__*/_react["default"].createElement("div", {
59
104
  role: "button",
60
105
  className: "debug-sidebar__button open",
61
106
  "data-testid": "debug-sidebar-button",
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_classnames","_nextjsComponents","_md","_helpers","_constants","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","DebugSidebar","_ref","itemEntity","itemId","debugMode","_useState","useState","_useState2","_slicedToArray2","isDebugMode","setIsDebugMode","_useState3","_useState4","isOpen","setIsOpen","useEffect","setBlazeDebug","divClass","classnames","href","buildAdminHref","createElement","Fragment","className","Link","src","DEBUG_LOGO","SRC","alt","ALT","role","id","onClick","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 { buildAdminHref, setBlazeDebug } 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\n useEffect(\n () => {\n if (debugMode === true) {\n setIsDebugMode(debugMode);\n } else setBlazeDebug(setIsDebugMode);\n },\n [debugMode]\n );\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 return (\n <>\n {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 <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 );\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,QAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAA6C,SAAAD,wBAAAS,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,wBAAAS,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,mBAAAT,CAAA,iBAAAA,CAAA,gBAAAU,OAAA,CAAAV,CAAA,0BAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,C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","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_classnames","_nextjsComponents","_md","_router","_io","_helpers","_constants","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","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","Fragment","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 () => {\n if (debugMode === true) {\n setIsDebugMode(debugMode);\n } else setBlazeDebug(setIsDebugMode);\n },\n [debugMode]\n );\n\n useEffect(\n () => {\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 },\n [router.events, router.asPath]\n );\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 (\n <>\n {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 );\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,WAA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@ -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,11 @@ 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 = _interopRequireDefault(require("./set-blaze-debug"));
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 _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
85
99
  //# sourceMappingURL=index.js.map
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,gBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,YAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,cAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,YAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,gBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,YAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,gBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,uBAAA,GAAAX,sBAAA,CAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_checkUrl","_interopRequireDefault","require","_getEntitysActions","_getSearchFilter","_checkParent","_buildAdminHref","_setBlazeDebug","_interopRequireWildcard","_checkForGtm","_renderAppleTags","_getPageData","_getErrorMessage","_getRootSelectorClasses","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"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,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,gBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,YAAA,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AM,GAAA,IAAAd,CAAA,CAAAc,GAAA,WAAAN,CAAA,KAAAR,CAAA,EAAAC,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
- var BLAZE_DEBUG = 'blaze_debug';
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 (!window.blaze) {
12
- window.blaze = {
13
- debug: function debug() {
14
- var _window = window,
15
- localStorage = _window.localStorage;
16
- if (JSON.parse(localStorage.getItem(BLAZE_DEBUG))) {
17
- localStorage.removeItem(BLAZE_DEBUG);
18
- setIsDebugMode(false);
19
- return;
20
- }
21
- localStorage.setItem(BLAZE_DEBUG, true);
22
- setIsDebugMode(true);
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
- setIsDebugMode(JSON.parse(localStorage.getItem(BLAZE_DEBUG)));
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","blaze","debug","_window","localStorage","JSON","parse","getItem","removeItem","setItem","_default","exports"],"sources":["../../src/helpers/set-blaze-debug.js"],"sourcesContent":["const BLAZE_DEBUG = 'blaze_debug';\n\nconst setBlazeDebug = setIsDebugMode => {\n if (!window.blaze) {\n window.blaze = {\n debug: () => {\n const { localStorage } = window;\n\n if (JSON.parse(localStorage.getItem(BLAZE_DEBUG))) {\n localStorage.removeItem(BLAZE_DEBUG);\n setIsDebugMode(false);\n return;\n }\n\n localStorage.setItem(BLAZE_DEBUG, true);\n setIsDebugMode(true);\n }\n };\n }\n setIsDebugMode(JSON.parse(localStorage.getItem(BLAZE_DEBUG)));\n};\n\nexport default setBlazeDebug;\n"],"mappings":";;;;;;;;AAAA,IAAMA,WAAW,GAAG,aAAa;AAEjC,IAAMC,aAAa,GAAG,SAAhBA,aAAaA,CAAGC,cAAc,EAAI;EACtC,IAAI,CAACC,MAAM,CAACC,KAAK,EAAE;IACjBD,MAAM,CAACC,KAAK,GAAG;MACbC,KAAK,EAAE,SAAPA,KAAKA,CAAA,EAAQ;QACX,IAAAC,OAAA,GAAyBH,MAAM;UAAvBI,YAAY,GAAAD,OAAA,CAAZC,YAAY;QAEpB,IAAIC,IAAI,CAACC,KAAK,CAACF,YAAY,CAACG,OAAO,CAACV,WAAW,CAAC,CAAC,EAAE;UACjDO,YAAY,CAACI,UAAU,CAACX,WAAW,CAAC;UACpCE,cAAc,CAAC,KAAK,CAAC;UACrB;QACF;QAEAK,YAAY,CAACK,OAAO,CAACZ,WAAW,EAAE,IAAI,CAAC;QACvCE,cAAc,CAAC,IAAI,CAAC;MACtB;IACF,CAAC;EACH;EACAA,cAAc,CAACM,IAAI,CAACC,KAAK,CAACF,YAAY,CAACG,OAAO,CAACV,WAAW,CAAC,CAAC,CAAC;AAC/D,CAAC;AAAC,IAAAa,QAAA,GAAAC,OAAA,cAEab,aAAa","ignoreList":[]}
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 { buildAdminHref, setBlazeDebug } from '../../helpers';
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,6 +44,17 @@ const DebugSidebar = ({
25
44
  itemEntity,
26
45
  itemId
27
46
  });
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
+ };
28
58
  return /*#__PURE__*/React.createElement(React.Fragment, null, isDebugMode ? /*#__PURE__*/React.createElement("div", {
29
59
  className: divClass,
30
60
  "data-testid": "debug-sidebar"
@@ -34,6 +64,11 @@ 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",
@@ -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","createElement","Fragment","className","src","SRC","alt","ALT","role","id","onClick","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 { buildAdminHref, setBlazeDebug } 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\n useEffect(\n () => {\n if (debugMode === true) {\n setIsDebugMode(debugMode);\n } else setBlazeDebug(setIsDebugMode);\n },\n [debugMode]\n );\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 return (\n <>\n {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 <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 );\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,cAAc,EAAEC,aAAa,QAAQ,eAAe;AAC7D,SAASC,UAAU,QAAQ,iBAAiB;AAE5C,MAAMC,YAAY,GAAGA,CAAC;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,KAAK;EAC1D,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGd,QAAQ,CAACY,SAAS,CAAC;EACzD,MAAM,CAACG,MAAM,EAAEC,SAAS,CAAC,GAAGhB,QAAQ,CAAC,IAAI,CAAC;EAE1CC,SAAS,CACP,MAAM;IACJ,IAAIW,SAAS,KAAK,IAAI,EAAE;MACtBE,cAAc,CAACF,SAAS,CAAC;IAC3B,CAAC,MAAML,aAAa,CAACO,cAAc,CAAC;EACtC,CAAC,EACD,CAACF,SAAS,CACZ,CAAC;EAED,MAAMK,QAAQ,GAAGd,UAAU,CAAC,eAAe,EAAE;IAC3C,qBAAqB,EAAEY,MAAM;IAC7B,sBAAsB,EAAE,CAACA;EAC3B,CAAC,CAAC;EAEF,MAAMG,IAAI,GAAGZ,cAAc,CAAC;IAAEI,UAAU;IAAEC;EAAO,CAAC,CAAC;EAEnD,oBACEZ,KAAA,CAAAoB,aAAA,CAAApB,KAAA,CAAAqB,QAAA,QACGP,WAAW,gBACVd,KAAA,CAAAoB,aAAA;IAAKE,SAAS,EAAEJ,QAAS;IAAC,eAAY;EAAe,gBACnDlB,KAAA,CAAAoB,aAAA,CAACf,IAAI;IAACc,IAAI,EAAEA;EAAK,gBACfnB,KAAA,CAAAoB,aAAA;IAAKG,GAAG,EAAEd,UAAU,CAACe,GAAI;IAACC,GAAG,EAAEhB,UAAU,CAACiB;EAAI,CAAE,CAAC,eACjD1B,KAAA,CAAAoB,aAAA,eAAM,aAAiB,CACnB,CAAC,eACPpB,KAAA,CAAAoB,aAAA;IACEO,IAAI,EAAC,QAAQ;IACbL,SAAS,EAAC,4BAA4B;IACtC,eAAY,sBAAsB;IAClCM,EAAE,EAAC,sBAAsB;IACzBC,OAAO,EAAEA,CAAA,KAAMZ,SAAS,CAAC,CAACD,MAAM;EAAE,gBAClChB,KAAA,CAAAoB,aAAA,yBACEpB,KAAA,CAAAoB,aAAA,CAACd,mBAAmB,MAAE,CACrB,CACA,CACF,CAAC,GACJ,IACJ,CAAC;AAEP,CAAC;AAEDI,YAAY,CAACoB,SAAS,GAAG;EACvBnB,UAAU,EAAER,SAAS,CAAC4B,MAAM;EAC5BnB,MAAM,EAAET,SAAS,CAAC4B,MAAM;EACxBlB,SAAS,EAAEV,SAAS,CAAC6B;AACvB,CAAC;AAEDtB,YAAY,CAACuB,YAAY,GAAG;EAC1BtB,UAAU,EAAE,EAAE;EACdC,MAAM,EAAE,EAAE;EACVC,SAAS,EAAE;AACb,CAAC;AAED,eAAeH,YAAY","ignoreList":[]}
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","Fragment","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 () => {\n if (debugMode === true) {\n setIsDebugMode(debugMode);\n } else setBlazeDebug(setIsDebugMode);\n },\n [debugMode]\n );\n\n useEffect(\n () => {\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 },\n [router.events, router.asPath]\n );\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 (\n <>\n {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 );\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,CACP,MAAM;IACJ,IAAIc,SAAS,KAAK,IAA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EP,CAAC;AAEDO,YAAY,CAAC2C,SAAS,GAAG;EACvB1C,UAAU,EAAEX,SAAS,CAACsD,MAAM;EAC5B1C,MAAM,EAAEZ,SAAS,CAACsD,MAAM;EACxBzC,SAAS,EAAEb,SAAS,CAACuD;AACvB,CAAC;AAED7C,YAAY,CAAC8C,YAAY,GAAG;EAC1B7C,UAAU,EAAE,EAAE;EACdC,MAAM,EAAE,EAAE;EACVC,SAAS,EAAE;AACb,CAAC;AAED,eAAeH,YAAY","ignoreList":[]}
@@ -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,MAAM,mBAAmB;AAC7C,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,SACEN,cAAc,EACdE,WAAW,EACXH,WAAW,EACXH,QAAQ,EACRC,iBAAiB,EACjBC,eAAe,EACfM,WAAW,EACXC,eAAe,EACfF,eAAe,EACfF,aAAa,EACbK,sBAAsB","ignoreList":[]}
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 (!window.blaze) {
4
- window.blaze = {
5
- debug: () => {
6
- const {
7
- localStorage
8
- } = window;
9
- if (JSON.parse(localStorage.getItem(BLAZE_DEBUG))) {
10
- localStorage.removeItem(BLAZE_DEBUG);
11
- setIsDebugMode(false);
12
- return;
13
- }
14
- localStorage.setItem(BLAZE_DEBUG, true);
15
- setIsDebugMode(true);
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
- setIsDebugMode(JSON.parse(localStorage.getItem(BLAZE_DEBUG)));
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","localStorage","JSON","parse","getItem","removeItem","setItem"],"sources":["../../src/helpers/set-blaze-debug.js"],"sourcesContent":["const BLAZE_DEBUG = 'blaze_debug';\n\nconst setBlazeDebug = setIsDebugMode => {\n if (!window.blaze) {\n window.blaze = {\n debug: () => {\n const { localStorage } = window;\n\n if (JSON.parse(localStorage.getItem(BLAZE_DEBUG))) {\n localStorage.removeItem(BLAZE_DEBUG);\n setIsDebugMode(false);\n return;\n }\n\n localStorage.setItem(BLAZE_DEBUG, true);\n setIsDebugMode(true);\n }\n };\n }\n setIsDebugMode(JSON.parse(localStorage.getItem(BLAZE_DEBUG)));\n};\n\nexport default setBlazeDebug;\n"],"mappings":"AAAA,MAAMA,WAAW,GAAG,aAAa;AAEjC,MAAMC,aAAa,GAAGC,cAAc,IAAI;EACtC,IAAI,CAACC,MAAM,CAACC,KAAK,EAAE;IACjBD,MAAM,CAACC,KAAK,GAAG;MACbC,KAAK,EAAEA,CAAA,KAAM;QACX,MAAM;UAAEC;QAAa,CAAC,GAAGH,MAAM;QAE/B,IAAII,IAAI,CAACC,KAAK,CAACF,YAAY,CAACG,OAAO,CAACT,WAAW,CAAC,CAAC,EAAE;UACjDM,YAAY,CAACI,UAAU,CAACV,WAAW,CAAC;UACpCE,cAAc,CAAC,KAAK,CAAC;UACrB;QACF;QAEAI,YAAY,CAACK,OAAO,CAACX,WAAW,EAAE,IAAI,CAAC;QACvCE,cAAc,CAAC,IAAI,CAAC;MACtB;IACF,CAAC;EACH;EACAA,cAAc,CAACK,IAAI,CAACC,KAAK,CAACF,YAAY,CAACG,OAAO,CAACT,WAAW,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,eAAeC,aAAa","ignoreList":[]}
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-alpha.50",
3
+ "version": "0.146.0-alpha.51",
4
4
  "description": "Blaze nextjs tools",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-es/index.js",
@@ -35,13 +35,13 @@
35
35
  "@blaze-cms/nextjs-components": "0.146.0-alpha.28",
36
36
  "@blaze-cms/plugin-auth-fe": "0.146.0-alpha.50",
37
37
  "@blaze-cms/plugin-auth-local-fe": "0.146.0-alpha.50",
38
- "@blaze-cms/plugin-google-maps-fe": "0.146.0-alpha.50",
39
- "@blaze-cms/plugin-gtm-fe": "0.146.0-alpha.50",
40
- "@blaze-cms/plugin-page-builder-fe": "0.146.0-alpha.50",
38
+ "@blaze-cms/plugin-google-maps-fe": "0.146.0-alpha.51",
39
+ "@blaze-cms/plugin-gtm-fe": "0.146.0-alpha.51",
40
+ "@blaze-cms/plugin-page-builder-fe": "0.146.0-alpha.51",
41
41
  "@blaze-cms/plugin-preview-fe": "0.146.0-alpha.42",
42
42
  "@blaze-cms/plugin-search-ui": "0.146.0-alpha.42",
43
43
  "@blaze-cms/plugin-structured-data-fe": "^0.140.3",
44
- "@blaze-cms/react-page-builder": "0.146.0-alpha.50",
44
+ "@blaze-cms/react-page-builder": "0.146.0-alpha.51",
45
45
  "@blaze-cms/setup-ui": "^0.140.3",
46
46
  "autoprefixer": "^10.2.3",
47
47
  "core-js": "^3.2.1",
@@ -69,5 +69,5 @@
69
69
  "lib/*",
70
70
  "lib-es/*"
71
71
  ],
72
- "gitHead": "1599a916aa4fd9dbaace05ea2c6892ddd5e26dfb"
72
+ "gitHead": "62793c80df6661ee81f1ab98d933f25eaf7a0187"
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 { buildAdminHref, setBlazeDebug } from '../../helpers';
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
  () => {
@@ -19,6 +22,28 @@ const DebugSidebar = ({ itemEntity, itemId, debugMode }) => {
19
22
  [debugMode]
20
23
  );
21
24
 
25
+ useEffect(
26
+ () => {
27
+ const handleRouteChange = url => {
28
+ const hasDebug = url.includes(`${BLAZE_DEBUG}=1`);
29
+ if (hasDebug) {
30
+ setBlazeDebug(setIsDebugMode);
31
+ setIsOpen(true);
32
+ }
33
+ };
34
+
35
+ if (router.asPath.includes(`${BLAZE_DEBUG}=1`)) {
36
+ handleRouteChange(router.asPath);
37
+ }
38
+
39
+ router.events.on('routeChangeComplete', handleRouteChange);
40
+ return () => {
41
+ router.events.off('routeChangeComplete', handleRouteChange);
42
+ };
43
+ },
44
+ [router.events, router.asPath]
45
+ );
46
+
22
47
  const divClass = classnames('debug-sidebar', {
23
48
  'debug-sidebar--open': isOpen,
24
49
  'debug-sidebar--close': !isOpen
@@ -26,6 +51,20 @@ const DebugSidebar = ({ itemEntity, itemId, debugMode }) => {
26
51
 
27
52
  const href = buildAdminHref({ itemEntity, itemId });
28
53
 
54
+ const closeDebug = () => {
55
+ setBlazeDebug(setIsDebugMode);
56
+ window.blaze.debug();
57
+
58
+ const [pathname, search = ''] = router.asPath.split('?');
59
+ const params = new URLSearchParams(search);
60
+ params.delete(BLAZE_DEBUG);
61
+ const newUrl = params.toString() ? `${pathname}?${params.toString()}` : pathname;
62
+
63
+ router.push('/Resolver', newUrl, {
64
+ shallow: true
65
+ });
66
+ };
67
+
29
68
  return (
30
69
  <>
31
70
  {isDebugMode ? (
@@ -34,6 +73,15 @@ const DebugSidebar = ({ itemEntity, itemId, debugMode }) => {
34
73
  <img src={DEBUG_LOGO.SRC} alt={DEBUG_LOGO.ALT} />
35
74
  <span>Blaze admin</span>
36
75
  </Link>
76
+
77
+ <div
78
+ role="button"
79
+ className="debug-sidebar__button debug-sidebar__button--close"
80
+ data-testid="debug-sidebar-close"
81
+ onClick={closeDebug}>
82
+ <IoCloseOutline />
83
+ </div>
84
+
37
85
  <div
38
86
  role="button"
39
87
  className="debug-sidebar__button open"
@@ -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 (!window.blaze) {
5
- window.blaze = {
6
- debug: () => {
7
- const { localStorage } = window;
4
+ if (typeof window === 'undefined') return;
8
5
 
9
- if (JSON.parse(localStorage.getItem(BLAZE_DEBUG))) {
10
- localStorage.removeItem(BLAZE_DEBUG);
11
- setIsDebugMode(false);
12
- return;
13
- }
6
+ const { localStorage, location } = window;
7
+ const params = new URLSearchParams(location.search);
14
8
 
15
- localStorage.setItem(BLAZE_DEBUG, true);
16
- setIsDebugMode(true);
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
- setIsDebugMode(JSON.parse(localStorage.getItem(BLAZE_DEBUG)));
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',
@@ -18,6 +18,29 @@ exports[`DebugSidebar component should render without throwing error (isDebugMod
18
18
  Blaze admin
19
19
  </span>
20
20
  </a>
21
+ <div
22
+ class="debug-sidebar__button debug-sidebar__button--close"
23
+ data-testid="debug-sidebar-close"
24
+ role="button"
25
+ >
26
+ <svg
27
+ fill="currentColor"
28
+ height="1em"
29
+ stroke="currentColor"
30
+ stroke-width="0"
31
+ viewBox="0 0 512 512"
32
+ width="1em"
33
+ xmlns="http://www.w3.org/2000/svg"
34
+ >
35
+ <path
36
+ d="M368 368L144 144m224 0L144 368"
37
+ fill="none"
38
+ stroke-linecap="round"
39
+ stroke-linejoin="round"
40
+ stroke-width="32"
41
+ />
42
+ </svg>
43
+ </div>
21
44
  <div
22
45
  class="debug-sidebar__button open"
23
46
  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(() => ({ asPath: 'some-url', push: () => {} }))
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'));