@blaze-cms/nextjs-tools 0.146.0-node18-core-styles.4 → 0.146.0-node18-core-styles-tooltips.2

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +7 -21
  2. package/lib/components/DebugSidebar/index.js +91 -13
  3. package/lib/components/DebugSidebar/index.js.map +1 -1
  4. package/lib/components/EditorMode/BlazeLogo.js +21 -0
  5. package/lib/components/EditorMode/BlazeLogo.js.map +1 -0
  6. package/lib/components/EditorMode/EditorMode.js +72 -0
  7. package/lib/components/EditorMode/EditorMode.js.map +1 -0
  8. package/lib/components/EditorMode/constants.js +9 -0
  9. package/lib/components/EditorMode/constants.js.map +1 -0
  10. package/lib/components/EditorMode/index.js +11 -0
  11. package/lib/components/EditorMode/index.js.map +1 -0
  12. package/lib/constants.js +4 -0
  13. package/lib/constants.js.map +1 -1
  14. package/lib/containers/ContentContainer.js +23 -5
  15. package/lib/containers/ContentContainer.js.map +1 -1
  16. package/lib/helpers/get-from-local.js +19 -0
  17. package/lib/helpers/get-from-local.js.map +1 -0
  18. package/lib/helpers/set-blaze-debug.js +33 -16
  19. package/lib/helpers/set-blaze-debug.js.map +1 -1
  20. package/lib/pages/Resolver.js +1 -8
  21. package/lib/pages/Resolver.js.map +1 -1
  22. package/lib-es/components/DebugSidebar/index.js +73 -8
  23. package/lib-es/components/DebugSidebar/index.js.map +1 -1
  24. package/lib-es/components/EditorMode/BlazeLogo.js +12 -0
  25. package/lib-es/components/EditorMode/BlazeLogo.js.map +1 -0
  26. package/lib-es/components/EditorMode/EditorMode.js +62 -0
  27. package/lib-es/components/EditorMode/EditorMode.js.map +1 -0
  28. package/lib-es/components/EditorMode/constants.js +2 -0
  29. package/lib-es/components/EditorMode/constants.js.map +1 -0
  30. package/lib-es/components/EditorMode/index.js +3 -0
  31. package/lib-es/components/EditorMode/index.js.map +1 -0
  32. package/lib-es/constants.js +4 -0
  33. package/lib-es/constants.js.map +1 -1
  34. package/lib-es/containers/ContentContainer.js +20 -3
  35. package/lib-es/containers/ContentContainer.js.map +1 -1
  36. package/lib-es/helpers/get-from-local.js +11 -0
  37. package/lib-es/helpers/get-from-local.js.map +1 -0
  38. package/lib-es/helpers/set-blaze-debug.js +26 -17
  39. package/lib-es/helpers/set-blaze-debug.js.map +1 -1
  40. package/lib-es/pages/Resolver.js +1 -8
  41. package/lib-es/pages/Resolver.js.map +1 -1
  42. package/package.json +17 -17
  43. package/src/components/DebugSidebar/index.js +96 -27
  44. package/src/components/EditorMode/BlazeLogo.js +12 -0
  45. package/src/components/EditorMode/EditorMode.js +59 -0
  46. package/src/components/EditorMode/constants.js +1 -0
  47. package/src/components/EditorMode/index.js +3 -0
  48. package/src/constants.js +4 -0
  49. package/src/containers/ContentContainer.js +19 -2
  50. package/src/helpers/get-from-local.js +12 -0
  51. package/src/helpers/set-blaze-debug.js +25 -15
  52. package/src/pages/Resolver.js +3 -8
  53. package/tests/unit/src/__snapshots__/constants.test.js.snap +2 -0
  54. package/tests/unit/src/components/DebugSidebar/DebugSidebar.test.js +14 -1
  55. package/tests/unit/src/components/DebugSidebar/__snapshots__/DebugSidebar.test.js.snap +23 -0
  56. package/tests/unit/src/containers/ContentContainer.test.js +2 -0
  57. package/tests/unit/src/containers/__snapshots__/ContentContainer.test.js.snap +7 -2
  58. package/tests/unit/src/pages/Resolver.test.js +5 -1
@@ -1,29 +1,46 @@
1
1
  "use strict";
2
2
 
3
3
  require("core-js/modules/es.object.define-property.js");
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports["default"] = void 0;
9
+ require("core-js/modules/es.array.iterator.js");
8
10
  require("core-js/modules/es.object.keys.js");
9
- var BLAZE_DEBUG = 'blaze_debug';
11
+ require("core-js/modules/es.object.to-string.js");
12
+ require("core-js/modules/es.regexp.exec.js");
13
+ require("core-js/modules/es.string.iterator.js");
14
+ require("core-js/modules/es.string.search.js");
15
+ require("core-js/modules/web.dom-collections.iterator.js");
16
+ require("core-js/modules/web.url-search-params.js");
17
+ var _constants = require("../constants");
18
+ var _getFromLocal = _interopRequireDefault(require("./get-from-local"));
10
19
  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
- };
20
+ if (typeof window === 'undefined') return;
21
+ var _window = window,
22
+ localStorage = _window.localStorage,
23
+ location = _window.location;
24
+ var params = new URLSearchParams(location.search);
25
+ window.blaze = window.blaze || {};
26
+ window.blaze.debug = function () {
27
+ var stored = (0, _getFromLocal["default"])(_constants.BLAZE_DEBUG);
28
+ if (stored) {
29
+ localStorage.removeItem(_constants.BLAZE_DEBUG);
30
+ window.localStorage.removeItem(_constants.BLAZE_PB_EDITOR_MODE);
31
+ setIsDebugMode(false);
32
+ } else {
33
+ localStorage.setItem(_constants.BLAZE_DEBUG, 'true');
34
+ setIsDebugMode(true);
35
+ }
36
+ };
37
+ if (params.get(_constants.BLAZE_DEBUG) === '1') {
38
+ localStorage.setItem(_constants.BLAZE_DEBUG, 'true');
39
+ setIsDebugMode(true);
40
+ return;
25
41
  }
26
- setIsDebugMode(JSON.parse(localStorage.getItem(BLAZE_DEBUG)));
42
+ var stored = JSON.parse(localStorage.getItem(_constants.BLAZE_DEBUG));
43
+ setIsDebugMode(!!stored);
27
44
  };
28
45
  var _default = exports["default"] = setBlazeDebug;
29
46
  //# 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":["_constants","require","_getFromLocal","_interopRequireDefault","setBlazeDebug","setIsDebugMode","window","_window","localStorage","location","params","URLSearchParams","search","blaze","debug","stored","getFromLocal","BLAZE_DEBUG","removeItem","BLAZE_PB_EDITOR_MODE","setItem","get","JSON","parse","getItem","_default","exports"],"sources":["../../src/helpers/set-blaze-debug.js"],"sourcesContent":["import { BLAZE_DEBUG, BLAZE_PB_EDITOR_MODE } from '../constants';\nimport getFromLocal from './get-from-local';\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 = getFromLocal(BLAZE_DEBUG);\n if (stored) {\n localStorage.removeItem(BLAZE_DEBUG);\n window.localStorage.removeItem(BLAZE_PB_EDITOR_MODE);\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,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAMG,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,GAAG,IAAAC,wBAAY,EAACC,sBAAW,CAAC;IACxC,IAAIF,MAAM,EAAE;MACVP,YAAY,CAACU,UAAU,CAACD,sBAAW,CAAC;MACpCX,MAAM,CAACE,YAAY,CAACU,UAAU,CAACC,+BAAoB,CAAC;MACpDd,cAAc,CAAC,KAAK,CAAC;IACvB,CAAC,MAAM;MACLG,YAAY,CAACY,OAAO,CAACH,sBAAW,EAAE,MAAM,CAAC;MACzCZ,cAAc,CAAC,IAAI,CAAC;IACtB;EACF,CAAC;EAED,IAAIK,MAAM,CAACW,GAAG,CAACJ,sBAAW,CAAC,KAAK,GAAG,EAAE;IACnCT,YAAY,CAACY,OAAO,CAACH,sBAAW,EAAE,MAAM,CAAC;IACzCZ,cAAc,CAAC,IAAI,CAAC;IACpB;EACF;EAEA,IAAMU,MAAM,GAAGO,IAAI,CAACC,KAAK,CAACf,YAAY,CAACgB,OAAO,CAACP,sBAAW,CAAC,CAAC;EAC5DZ,cAAc,CAAC,CAAC,CAACU,MAAM,CAAC;AAC1B,CAAC;AAAC,IAAAU,QAAA,GAAAC,OAAA,cAEatB,aAAa","ignoreList":[]}
@@ -20,7 +20,6 @@ var _react = _interopRequireDefault(require("react"));
20
20
  var _error = _interopRequireDefault(require("next/error"));
21
21
  var _router = require("next/router");
22
22
  var _propTypes = _interopRequireDefault(require("prop-types"));
23
- var _components = require("../components");
24
23
  var _helpers = require("../helpers");
25
24
  var _containers = require("../containers");
26
25
  var _constants = require("../constants");
@@ -60,14 +59,11 @@ var Resolver = function Resolver(props) {
60
59
  if (redirecting) return null;
61
60
  if (isStatusPage) return 'OK';
62
61
  if (!pageData || !itemId || !itemEntity) {
63
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
62
+ return /*#__PURE__*/_react["default"].createElement("div", {
64
63
  className: "next_error"
65
64
  }, /*#__PURE__*/_react["default"].createElement(_error["default"], {
66
65
  statusCode: errorCode,
67
66
  title: errorMessage
68
- })), /*#__PURE__*/_react["default"].createElement(_components.DebugSidebar, {
69
- itemId: itemId,
70
- itemEntity: itemEntity
71
67
  }));
72
68
  }
73
69
  return /*#__PURE__*/_react["default"].createElement("div", {
@@ -78,9 +74,6 @@ var Resolver = function Resolver(props) {
78
74
  itemEntity: itemEntity,
79
75
  isPreview: isPreview,
80
76
  fullUrl: fullUrl
81
- }), /*#__PURE__*/_react["default"].createElement(_components.DebugSidebar, {
82
- itemId: itemId,
83
- itemEntity: itemEntity
84
77
  }));
85
78
  };
86
79
  Resolver.getInitialProps = /*#__PURE__*/function () {
@@ -1 +1 @@
1
- {"version":3,"file":"Resolver.js","names":["_react","_interopRequireDefault","require","_error","_router","_propTypes","_components","_helpers","_containers","_constants","Resolver","props","pageData","itemId","itemEntity","isStatusPage","fullUrl","disableSsr","_props$rootSelectorCl","rootSelectorClasses","RESOLVER_CONTAINER_CLASS","_props$isPreview","isPreview","_props$errorCode","errorCode","NOT_FOUND_STATUS_CODE","_props$errorMessage","errorMessage","_props$redirecting","redirecting","router","useRouter","window","asPath","location","hash","url","URL","href","searchParams","set","Date","now","push","createElement","Fragment","className","statusCode","title","DebugSidebar","ContentContainer","getInitialProps","_ref","_asyncToGenerator2","_regenerator","mark","_callee","wrap","_callee$","_context","prev","next","abrupt","checkUrl","stop","_x","apply","arguments","propTypes","PropTypes","string","object","bool","number","defaultProps","_default","exports"],"sources":["../../src/pages/Resolver.js"],"sourcesContent":["import React from 'react';\nimport NextError from 'next/error';\nimport { useRouter } from 'next/router';\nimport PropTypes from 'prop-types';\nimport { DebugSidebar } from '../components';\nimport { checkUrl } from '../helpers';\nimport { ContentContainer } from '../containers';\nimport { NOT_FOUND_STATUS_CODE, RESOLVER_CONTAINER_CLASS } from '../constants';\n\nconst Resolver = props => {\n const {\n pageData,\n itemId,\n itemEntity,\n isStatusPage,\n fullUrl,\n disableSsr,\n rootSelectorClasses = RESOLVER_CONTAINER_CLASS,\n isPreview = false,\n errorCode = NOT_FOUND_STATUS_CODE,\n errorMessage = null,\n redirecting = false\n } = props;\n\n const router = useRouter();\n\n if (disableSsr) {\n if (typeof window !== 'undefined') {\n let { asPath } = router;\n if (window.location.hash) {\n // handle nextjs issue not calling getInitialProps if pushing a url with a hash in it\n // we add a new query string param to force calling getInitialProps\n // this should only happen if disableSsr and window.location.hash\n const url = new URL(router.asPath, window.location.href);\n if (url.hash) url.searchParams.set('_h', Date.now());\n asPath = url;\n }\n\n router.push('/Resolver', asPath);\n }\n return '';\n }\n\n if (redirecting) return null;\n\n if (isStatusPage) return 'OK';\n\n if (!pageData || !itemId || !itemEntity) {\n return (\n <>\n <div className=\"next_error\">\n <NextError statusCode={errorCode} title={errorMessage} />\n </div>\n <DebugSidebar itemId={itemId} itemEntity={itemEntity} />\n </>\n );\n }\n\n return (\n <div className={rootSelectorClasses}>\n <ContentContainer\n pageData={pageData}\n itemId={itemId}\n itemEntity={itemEntity}\n isPreview={isPreview}\n fullUrl={fullUrl}\n />\n <DebugSidebar itemId={itemId} itemEntity={itemEntity} />\n </div>\n );\n};\n\nResolver.getInitialProps = async props => checkUrl(props);\n\nResolver.propTypes = {\n itemId: PropTypes.string,\n itemEntity: PropTypes.string,\n pageData: PropTypes.object,\n isStatusPage: PropTypes.bool,\n fullUrl: PropTypes.string,\n isPreview: PropTypes.bool,\n errorCode: PropTypes.number,\n disableSsr: PropTypes.bool,\n errorMessage: PropTypes.string,\n rootSelectorClasses: PropTypes.string,\n redirecting: PropTypes.bool\n};\n\nResolver.defaultProps = {\n itemId: null,\n itemEntity: null,\n pageData: null,\n isStatusPage: false,\n fullUrl: '',\n isPreview: false,\n errorCode: NOT_FOUND_STATUS_CODE,\n disableSsr: false,\n errorMessage: null,\n rootSelectorClasses: RESOLVER_CONTAINER_CLASS,\n redirecting: false\n};\n\nexport default Resolver;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBA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;EACXM,SAAS,EAAE,KAAK;EAChBE,SAAS,EAAEC,gCAAqB;EAChCR,UAAU,EAAE,KAAK;EACjBU,YAAY,EAAE,IAAI;EAClBR,mBAAmB,EAAEC,mCAAwB;EAC7CS,WAAW,EAAE;AACf,CAAC;AAAC,IAAA8C,QAAA,GAAAC,OAAA,cAEalE,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"Resolver.js","names":["_react","_interopRequireDefault","require","_error","_router","_propTypes","_helpers","_containers","_constants","Resolver","props","pageData","itemId","itemEntity","isStatusPage","fullUrl","disableSsr","_props$rootSelectorCl","rootSelectorClasses","RESOLVER_CONTAINER_CLASS","_props$isPreview","isPreview","_props$errorCode","errorCode","NOT_FOUND_STATUS_CODE","_props$errorMessage","errorMessage","_props$redirecting","redirecting","router","useRouter","window","asPath","location","hash","url","URL","href","searchParams","set","Date","now","push","createElement","className","statusCode","title","ContentContainer","getInitialProps","_ref","_asyncToGenerator2","_regenerator","mark","_callee","wrap","_callee$","_context","prev","next","abrupt","checkUrl","stop","_x","apply","arguments","propTypes","PropTypes","string","object","bool","number","defaultProps","_default","exports"],"sources":["../../src/pages/Resolver.js"],"sourcesContent":["import React from 'react';\nimport NextError from 'next/error';\nimport { useRouter } from 'next/router';\nimport PropTypes from 'prop-types';\nimport { checkUrl } from '../helpers';\nimport { ContentContainer } from '../containers';\nimport { NOT_FOUND_STATUS_CODE, RESOLVER_CONTAINER_CLASS } from '../constants';\n\nconst Resolver = props => {\n const {\n pageData,\n itemId,\n itemEntity,\n isStatusPage,\n fullUrl,\n disableSsr,\n rootSelectorClasses = RESOLVER_CONTAINER_CLASS,\n isPreview = false,\n errorCode = NOT_FOUND_STATUS_CODE,\n errorMessage = null,\n redirecting = false\n } = props;\n\n const router = useRouter();\n\n if (disableSsr) {\n if (typeof window !== 'undefined') {\n let { asPath } = router;\n if (window.location.hash) {\n // handle nextjs issue not calling getInitialProps if pushing a url with a hash in it\n // we add a new query string param to force calling getInitialProps\n // this should only happen if disableSsr and window.location.hash\n const url = new URL(router.asPath, window.location.href);\n if (url.hash) url.searchParams.set('_h', Date.now());\n asPath = url;\n }\n\n router.push('/Resolver', asPath);\n }\n return '';\n }\n\n if (redirecting) return null;\n\n if (isStatusPage) return 'OK';\n\n if (!pageData || !itemId || !itemEntity) {\n return (\n <div className=\"next_error\">\n <NextError statusCode={errorCode} title={errorMessage} />\n </div>\n );\n }\n\n return (\n <div className={rootSelectorClasses}>\n <ContentContainer\n pageData={pageData}\n itemId={itemId}\n itemEntity={itemEntity}\n isPreview={isPreview}\n fullUrl={fullUrl}\n />\n </div>\n );\n};\n\nResolver.getInitialProps = async props => checkUrl(props);\n\nResolver.propTypes = {\n itemId: PropTypes.string,\n itemEntity: PropTypes.string,\n pageData: PropTypes.object,\n isStatusPage: PropTypes.bool,\n fullUrl: PropTypes.string,\n isPreview: PropTypes.bool,\n errorCode: PropTypes.number,\n disableSsr: PropTypes.bool,\n errorMessage: PropTypes.string,\n rootSelectorClasses: PropTypes.string,\n redirecting: PropTypes.bool\n};\n\nResolver.defaultProps = {\n itemId: null,\n itemEntity: null,\n pageData: null,\n isStatusPage: false,\n fullUrl: '',\n isPreview: false,\n errorCode: NOT_FOUND_STATUS_CODE,\n disableSsr: false,\n errorMessage: null,\n rootSelectorClasses: RESOLVER_CONTAINER_CLASS,\n redirecting: false\n};\n\nexport default Resolver;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAEA,IAAMO,QAAQ,GAAG,SAAXA,QAAQA,CAAGC,KAAK,EAAI;EACxB,IACEC,QAAQ,GAWND,KAAK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AS,CAACC,MAAM;EAC5BxD,QAAQ,EAAEuD,qBAAS,CAACE,MAAM;EAC1BtD,YAAY,EAAEoD,qBAAS,CAACG,IAAI;EAC5BtD,OAAO,EAAEmD,qBAAS,CAACC,MAAM;EACzB9C,SAAS,EAAE6C,qBAAS,CAACG,IAAI;EACzB9C,SAAS,EAAE2C,qBAAS,CAACI,MAAM;EAC3BtD,UAAU,EAAEkD,qBAAS,CAACG,IAAI;EAC1B3C,YAAY,EAAEwC,qBAAS,CAACC,MAAM;EAC9BjD,mBAAmB,EAAEgD,qBAAS,CAACC,MAAM;EACrCvC,WAAW,EAAEsC,qBAAS,CAACG;AACzB,CAAC;AAED5D,QAAQ,CAAC8D,YAAY,GAAG;EACtB3D,MAAM,EAAE,IAAI;EACZC,UAAU,EAAE,IAAI;EAChBF,QAAQ,EAAE,IAAI;EACdG,YAAY,EAAE,KAAK;EACnBC,OAAO,EAAE,EAAE;EACXM,SAAS,EAAE,KAAK;EAChBE,SAAS,EAAEC,gCAAqB;EAChCR,UAAU,EAAE,KAAK;EACjBU,YAAY,EAAE,IAAI;EAClBR,mBAAmB,EAAEC,mCAAwB;EAC7CS,WAAW,EAAE;AACf,CAAC;AAAC,IAAA4C,QAAA,GAAAC,OAAA,cAEahE,QAAQ","ignoreList":[]}
@@ -2,30 +2,79 @@ import React, { useState, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classnames from 'classnames';
4
4
  import { Link } from '@blaze-cms/nextjs-components';
5
- import { MdKeyboardArrowLeft } from 'react-icons/md';
5
+ import { MdKeyboardArrowLeft, MdEdit, MdEditOff } from 'react-icons/md';
6
+ import { useRouter } from 'next/router';
7
+ import { IoCloseOutline } from 'react-icons/io5';
6
8
  import { buildAdminHref, setBlazeDebug } from '../../helpers';
7
- import { DEBUG_LOGO } from '../../constants';
9
+ import { BLAZE_DEBUG, DEBUG_LOGO } from '../../constants';
10
+ import getFromLocal from '../../helpers/get-from-local';
11
+ import EditorMode from '../EditorMode';
8
12
  const DebugSidebar = ({
9
13
  itemEntity,
10
14
  itemId,
15
+ updatedDebugOptions,
11
16
  debugMode
12
17
  }) => {
13
18
  const [isDebugMode, setIsDebugMode] = useState(debugMode);
19
+ const [isEditorMode, setIsEditorMode] = useState(false);
14
20
  const [isOpen, setIsOpen] = useState(true);
21
+ const router = useRouter();
15
22
  useEffect(() => {
16
- if (debugMode === true) {
17
- setIsDebugMode(debugMode);
18
- } else setBlazeDebug(setIsDebugMode);
19
- }, [debugMode]);
23
+ // const currentEditorMode = getFromLocal(BLAZE_PB_EDITOR_MODE);
24
+ const currentDebugValue = getFromLocal(BLAZE_DEBUG);
25
+ setIsDebugMode(currentDebugValue);
26
+ setIsOpen(currentDebugValue);
27
+ setBlazeDebug(setIsDebugMode);
28
+ // setIsEditorMode(!!currentEditorMode); // todo: initilize on load
29
+ }, []);
30
+ useEffect(() => {
31
+ const handleRouteChange = url => {
32
+ const hasDebug = url.includes(`${BLAZE_DEBUG}=1`);
33
+ if (hasDebug) {
34
+ setBlazeDebug(setIsDebugMode);
35
+ setIsOpen(true);
36
+ }
37
+ };
38
+ if (router.asPath.includes(`${BLAZE_DEBUG}=1`)) {
39
+ handleRouteChange(router.asPath);
40
+ }
41
+ router.events.on('routeChangeComplete', handleRouteChange);
42
+ return () => {
43
+ router.events.off('routeChangeComplete', handleRouteChange);
44
+ };
45
+ }, [router.events, router.asPath]);
20
46
  const divClass = classnames('debug-sidebar', {
21
47
  'debug-sidebar--open': isOpen,
22
48
  'debug-sidebar--close': !isOpen
23
49
  });
50
+ const toggleEditorMode = () => {
51
+ // todo: persist editor mode in local storage
52
+ // const currentEditorMode = getFromLocal(BLAZE_PB_EDITOR_MODE);
53
+ // if (currentEditorMode) {
54
+ // window.localStorage.removeItem(BLAZE_PB_EDITOR_MODE);
55
+ // } else {
56
+ // window.localStorage.setItem(BLAZE_PB_EDITOR_MODE, true);
57
+ // }
58
+ updatedDebugOptions('editorModeEnabled', !isEditorMode);
59
+ setIsEditorMode(!isEditorMode);
60
+ };
24
61
  const href = buildAdminHref({
25
62
  itemEntity,
26
63
  itemId
27
64
  });
28
- return /*#__PURE__*/React.createElement(React.Fragment, null, isDebugMode ? /*#__PURE__*/React.createElement("div", {
65
+ if (!isDebugMode) return null;
66
+ const closeDebug = () => {
67
+ setBlazeDebug(setIsDebugMode);
68
+ window.blaze.debug();
69
+ const [pathname, search = ''] = router.asPath.split('?');
70
+ const params = new URLSearchParams(search);
71
+ params.delete(BLAZE_DEBUG);
72
+ const newUrl = params.toString() ? `${pathname}?${params.toString()}` : pathname;
73
+ router.push('/Resolver', newUrl, {
74
+ shallow: true
75
+ });
76
+ };
77
+ return /*#__PURE__*/React.createElement("div", {
29
78
  className: divClass,
30
79
  "data-testid": "debug-sidebar"
31
80
  }, /*#__PURE__*/React.createElement(Link, {
@@ -34,14 +83,30 @@ const DebugSidebar = ({
34
83
  src: DEBUG_LOGO.SRC,
35
84
  alt: DEBUG_LOGO.ALT
36
85
  }), /*#__PURE__*/React.createElement("span", null, "Blaze admin")), /*#__PURE__*/React.createElement("div", {
86
+ role: "button",
87
+ className: "debug-sidebar__button debug-sidebar__button--close",
88
+ "data-testid": "debug-sidebar-close",
89
+ onClick: closeDebug
90
+ }, /*#__PURE__*/React.createElement(IoCloseOutline, null)), isEditorMode && /*#__PURE__*/React.createElement(EditorMode, {
91
+ adminHref: href,
92
+ itemEntity: itemEntity,
93
+ itemId: itemId
94
+ }), /*#__PURE__*/React.createElement("div", {
95
+ role: "button",
96
+ className: "debug-sidebar__button debug-sidebar__button--editor",
97
+ "data-testid": "debug-sidebar-editor-button",
98
+ id: "debug-sidebar-editor-button",
99
+ onClick: toggleEditorMode
100
+ }, /*#__PURE__*/React.createElement("i", null, isEditorMode ? /*#__PURE__*/React.createElement(MdEditOff, null) : /*#__PURE__*/React.createElement(MdEdit, null))), /*#__PURE__*/React.createElement("div", {
37
101
  role: "button",
38
102
  className: "debug-sidebar__button open",
39
103
  "data-testid": "debug-sidebar-button",
40
104
  id: "debug-sidebar-button",
41
105
  onClick: () => setIsOpen(!isOpen)
42
- }, /*#__PURE__*/React.createElement("i", null, /*#__PURE__*/React.createElement(MdKeyboardArrowLeft, null)))) : null);
106
+ }, /*#__PURE__*/React.createElement("i", null, /*#__PURE__*/React.createElement(MdKeyboardArrowLeft, null))));
43
107
  };
44
108
  DebugSidebar.propTypes = {
109
+ updatedDebugOptions: PropTypes.func.isRequired,
45
110
  itemEntity: PropTypes.string,
46
111
  itemId: PropTypes.string,
47
112
  debugMode: PropTypes.bool
@@ -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 if (debugMode === true) {\n setIsDebugMode(debugMode);\n } else setBlazeDebug(setIsDebugMode);\n }, [debugMode]);\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,CAAC,MAAM;IACd,IAAIW,SAAS,KAAK,IAAI,EAAE;MACtBE,cAAc,CAACF,SAAS,CAAC;IAC3B,CAAC,MAAML,aAAa,CAACO,cAAc,CAAC;EACtC,CAAC,EAAE,CAACF,SAAS,CAAC,CAAC;EAEf,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","MdEdit","MdEditOff","useRouter","IoCloseOutline","buildAdminHref","setBlazeDebug","BLAZE_DEBUG","DEBUG_LOGO","getFromLocal","EditorMode","DebugSidebar","itemEntity","itemId","updatedDebugOptions","debugMode","isDebugMode","setIsDebugMode","isEditorMode","setIsEditorMode","isOpen","setIsOpen","router","currentDebugValue","handleRouteChange","url","hasDebug","includes","asPath","events","on","off","divClass","toggleEditorMode","href","closeDebug","window","blaze","debug","pathname","search","split","params","URLSearchParams","delete","newUrl","toString","push","shallow","createElement","className","src","SRC","alt","ALT","role","onClick","adminHref","id","propTypes","func","isRequired","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, MdEdit, MdEditOff } from 'react-icons/md';\nimport { useRouter } from 'next/router';\nimport { IoCloseOutline } from 'react-icons/io5';\nimport { buildAdminHref, setBlazeDebug } from '../../helpers';\nimport { BLAZE_DEBUG, DEBUG_LOGO } from '../../constants';\nimport getFromLocal from '../../helpers/get-from-local';\nimport EditorMode from '../EditorMode';\n\nconst DebugSidebar = ({ itemEntity, itemId, updatedDebugOptions, debugMode }) => {\n const [isDebugMode, setIsDebugMode] = useState(debugMode);\n const [isEditorMode, setIsEditorMode] = useState(false);\n const [isOpen, setIsOpen] = useState(true);\n const router = useRouter();\n\n useEffect(() => {\n // const currentEditorMode = getFromLocal(BLAZE_PB_EDITOR_MODE);\n const currentDebugValue = getFromLocal(BLAZE_DEBUG);\n setIsDebugMode(currentDebugValue);\n setIsOpen(currentDebugValue);\n setBlazeDebug(setIsDebugMode);\n // setIsEditorMode(!!currentEditorMode); // todo: initilize on load\n }, []);\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 toggleEditorMode = () => {\n // todo: persist editor mode in local storage\n // const currentEditorMode = getFromLocal(BLAZE_PB_EDITOR_MODE);\n // if (currentEditorMode) {\n // window.localStorage.removeItem(BLAZE_PB_EDITOR_MODE);\n // } else {\n // window.localStorage.setItem(BLAZE_PB_EDITOR_MODE, true);\n // }\n updatedDebugOptions('editorModeEnabled', !isEditorMode);\n setIsEditorMode(!isEditorMode);\n };\n\n const href = buildAdminHref({ itemEntity, itemId });\n if (!isDebugMode) return null;\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 <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 debug-sidebar__button--close\"\n data-testid=\"debug-sidebar-close\"\n onClick={closeDebug}>\n <IoCloseOutline />\n </div>\n\n {isEditorMode && <EditorMode adminHref={href} itemEntity={itemEntity} itemId={itemId} />}\n <div\n role=\"button\"\n className=\"debug-sidebar__button debug-sidebar__button--editor\"\n data-testid=\"debug-sidebar-editor-button\"\n id=\"debug-sidebar-editor-button\"\n onClick={toggleEditorMode}>\n <i>{isEditorMode ? <MdEditOff /> : <MdEdit />}</i>\n </div>\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 );\n};\n\nDebugSidebar.propTypes = {\n updatedDebugOptions: PropTypes.func.isRequired,\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,EAAEC,MAAM,EAAEC,SAAS,QAAQ,gBAAgB;AACvE,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,cAAc,EAAEC,aAAa,QAAQ,eAAe;AAC7D,SAASC,WAAW,EAAEC,UAAU,QAAQ,iBAAiB;AACzD,OAAOC,YAAY,MAAM,8BAA8B;AACvD,OAAOC,UAAU,MAAM,eAAe;AAEtC,MAAMC,YAAY,GAAGA,CAAC;EAAEC,UAAU;EAAEC,MAAM;EAAEC,mBAAmB;EAAEC;AAAU,CAAC,KAAK;EAC/E,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGtB,QAAQ,CAACoB,SAAS,CAAC;EACzD,MAAM,CAACG,YAAY,EAAEC,eAAe,CAAC,GAAGxB,QAAQ,CAAC,KAAK,CAAC;EACvD,MAAM,CAACyB,MAAM,EAAEC,SAAS,CAAC,GAAG1B,QAAQ,CAAC,IAAI,CAAC;EAC1C,MAAM2B,MAAM,GAAGnB,SAAS,CAAC,CAAC;EAE1BP,SAAS,CAAC,MAAM;IACd;IACA,MAAM2B,iBAAiB,GAAGd,YAAY,CAACF,WAAW,CAAC;IACnDU,cAAc,CAACM,iBAAiB,CAAC;IACjCF,SAAS,CAACE,iBAAiB,CAAC;IAC5BjB,aAAa,CAACW,cAAc,CAAC;IAC7B;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zCQ,EAAE,EAAC,6BAA6B;IAChCF,OAAO,EAAEvB;EAAiB,gBAC1BvC,KAAA,CAAAuD,aAAA,YAAI/B,YAAY,gBAAGxB,KAAA,CAAAuD,aAAA,CAAC/C,SAAS,MAAE,CAAC,gBAAGR,KAAA,CAAAuD,aAAA,CAAChD,MAAM,MAAE,CAAK,CAC9C,CAAC,eACNP,KAAA,CAAAuD,aAAA;IACEM,IAAI,EAAC,QAAQ;IACbL,SAAS,EAAC,4BAA4B;IACtC,eAAY,sBAAsB;IAClCQ,EAAE,EAAC,sBAAsB;IACzBF,OAAO,EAAEA,CAAA,KAAMnC,SAAS,CAAC,CAACD,MAAM;EAAE,gBAClC1B,KAAA,CAAAuD,aAAA,yBACEvD,KAAA,CAAAuD,aAAA,CAACjD,mBAAmB,MAAE,CACrB,CACA,CACF,CAAC;AAEV,CAAC;AAEDW,YAAY,CAACgD,SAAS,GAAG;EACvB7C,mBAAmB,EAAEjB,SAAS,CAAC+D,IAAI,CAACC,UAAU;EAC9CjD,UAAU,EAAEf,SAAS,CAACiE,MAAM;EAC5BjD,MAAM,EAAEhB,SAAS,CAACiE,MAAM;EACxB/C,SAAS,EAAElB,SAAS,CAACkE;AACvB,CAAC;AAEDpD,YAAY,CAACqD,YAAY,GAAG;EAC1BpD,UAAU,EAAE,EAAE;EACdC,MAAM,EAAE,EAAE;EACVE,SAAS,EAAE;AACb,CAAC;AAED,eAAeJ,YAAY","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ const BlazeLogo = () => /*#__PURE__*/React.createElement("svg", {
2
+ xmlns: "http://www.w3.org/2000/svg",
3
+ width: "22",
4
+ height: "33"
5
+ }, /*#__PURE__*/React.createElement("path", {
6
+ fill: "currentColor",
7
+ transform: "translate(1.0415 1.85962)",
8
+ d: "M7.0214715 6.2017469C7.0214715 6.2017469 4.6948299 13.380771 5.2965479 15.065234C5.6174636 15.947572 6.3796396 16.18821 7.3022733 15.386085C9.1074257 13.781834 13.078762 6.3621721 9.949831 0.42644304C8.7463951 -1.8596147 18.293648 5.1589837 16.328037 18.755013C16.087351 20.559793 16.809412 19.998306 17.250671 19.236286C19.176168 15.947572 17.972733 11.616095 17.972733 10.894181C17.972733 10.172268 19.657541 12.939602 19.777885 18.353949C19.89823 23.768295 17.050098 29.022219 11.393953 29.98477C10.03006 30.225407 13.199106 27.578392 13.640366 24.610529C13.68048 24.329784 10.39109 28.300306 9.5888004 27.738817C9.2277699 27.49818 15.36529 19.877987 13.199106 13.300558C13.158992 13.140133 11.754984 24.409996 6.3796396 27.097116C3.3309369 28.621155 0.60315031 25.051697 0.12177619 21.963514C-1.0415446 13.862046 6.4999828 8.7284422 7.0214715 6.2017469Z",
9
+ fillRule: "evenodd"
10
+ }));
11
+ export default BlazeLogo;
12
+ //# sourceMappingURL=BlazeLogo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlazeLogo.js","names":["BlazeLogo","React","createElement","xmlns","width","height","fill","transform","d","fillRule"],"sources":["../../../src/components/EditorMode/BlazeLogo.js"],"sourcesContent":["const BlazeLogo = () => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"33\">\n <path\n fill=\"currentColor\"\n transform=\"translate(1.0415 1.85962)\"\n d=\"M7.0214715 6.2017469C7.0214715 6.2017469 4.6948299 13.380771 5.2965479 15.065234C5.6174636 15.947572 6.3796396 16.18821 7.3022733 15.386085C9.1074257 13.781834 13.078762 6.3621721 9.949831 0.42644304C8.7463951 -1.8596147 18.293648 5.1589837 16.328037 18.755013C16.087351 20.559793 16.809412 19.998306 17.250671 19.236286C19.176168 15.947572 17.972733 11.616095 17.972733 10.894181C17.972733 10.172268 19.657541 12.939602 19.777885 18.353949C19.89823 23.768295 17.050098 29.022219 11.393953 29.98477C10.03006 30.225407 13.199106 27.578392 13.640366 24.610529C13.68048 24.329784 10.39109 28.300306 9.5888004 27.738817C9.2277699 27.49818 15.36529 19.877987 13.199106 13.300558C13.158992 13.140133 11.754984 24.409996 6.3796396 27.097116C3.3309369 28.621155 0.60315031 25.051697 0.12177619 21.963514C-1.0415446 13.862046 6.4999828 8.7284422 7.0214715 6.2017469Z\"\n fillRule=\"evenodd\"\n />\n </svg>\n);\n\nexport default BlazeLogo;\n"],"mappings":"AAAA,MAAMA,SAAS,GAAGA,CAAA,kBAChBC,KAAA,CAAAC,aAAA;EAAKC,KAAK,EAAC,4BAA4B;EAACC,KAAK,EAAC,IAAI;EAACC,MAAM,EAAC;AAAI,gBAC5DJ,KAAA,CAAAC,aAAA;EACEI,IAAI,EAAC,cAAc;EACnBC,SAAS,EAAC,2BAA2B;EACrCC,CAAC,EAAC,21BAA21B;EAC71BC,QAAQ,EAAC;AAAS,CACnB,CACE,CACN;AAED,eAAeT,SAAS","ignoreList":[]}
@@ -0,0 +1,62 @@
1
+ import { useEffect } from 'react';
2
+ import { getComponentId } from '@blaze-cms/react-page-builder';
3
+ import { BLAZE_WINDOW_ID } from './constants'; // todo: get it working in same tab
4
+
5
+ const EditorMode = ({
6
+ adminHref,
7
+ itemEntity,
8
+ itemId
9
+ }) => {
10
+ useEffect(() => {
11
+ const pbStarts = document.querySelectorAll('pb-wrapper-start');
12
+ const allComponentNodes = [];
13
+ pbStarts.forEach(pbStart => {
14
+ const {
15
+ parentNode
16
+ } = pbStart;
17
+ const componentName = pbStart.getAttribute('pb-component-name');
18
+ if (!parentNode || !parentNode.children || !componentName) return;
19
+ const parentChildren = parentNode.children;
20
+ let childMatch = false;
21
+ let childNode = null;
22
+ Object.keys(parentChildren).forEach(key => {
23
+ const child = parentChildren[key];
24
+ if (childMatch) {
25
+ if (childNode) return;
26
+ childNode = child;
27
+ }
28
+ const tagName = child.tagName.toLowerCase();
29
+ const currentComponentName = child.getAttribute('pb-component-name');
30
+ if (currentComponentName === componentName && tagName === 'pb-wrapper-start') {
31
+ childMatch = true;
32
+ }
33
+ });
34
+ if (childNode) {
35
+ allComponentNodes.push({
36
+ componentName,
37
+ componentNode: childNode
38
+ });
39
+ childNode.onclick = e => {
40
+ e.stopPropagation();
41
+ e.preventDefault();
42
+ window.open(`${adminHref}#${getComponentId(componentName)}`, [BLAZE_WINDOW_ID, itemEntity, itemId].join(':'));
43
+ };
44
+ childNode.onmouseenter = e => {
45
+ allComponentNodes.forEach(({
46
+ componentName: cn,
47
+ componentNode
48
+ }) => {
49
+ componentNode.classList.remove('blaze-pb-editor-highlight');
50
+ });
51
+ childNode.classList.add('blaze-pb-editor-highlight');
52
+ };
53
+ childNode.onmouseleave = e => {
54
+ childNode.classList.remove('blaze-pb-editor-highlight');
55
+ };
56
+ }
57
+ });
58
+ }, [adminHref, itemEntity, itemId]);
59
+ return null;
60
+ };
61
+ export default EditorMode;
62
+ //# sourceMappingURL=EditorMode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditorMode.js","names":["useEffect","getComponentId","BLAZE_WINDOW_ID","EditorMode","adminHref","itemEntity","itemId","pbStarts","document","querySelectorAll","allComponentNodes","forEach","pbStart","parentNode","componentName","getAttribute","children","parentChildren","childMatch","childNode","Object","keys","key","child","tagName","toLowerCase","currentComponentName","push","componentNode","onclick","e","stopPropagation","preventDefault","window","open","join","onmouseenter","cn","classList","remove","add","onmouseleave"],"sources":["../../../src/components/EditorMode/EditorMode.js"],"sourcesContent":["import { useEffect } from 'react';\nimport { getComponentId } from '@blaze-cms/react-page-builder';\nimport { BLAZE_WINDOW_ID } from './constants'; // todo: get it working in same tab\n\nconst EditorMode = ({ adminHref, itemEntity, itemId }) => {\n useEffect(\n () => {\n const pbStarts = document.querySelectorAll('pb-wrapper-start');\n const allComponentNodes = [];\n pbStarts.forEach(pbStart => {\n const { parentNode } = pbStart;\n const componentName = pbStart.getAttribute('pb-component-name');\n if (!parentNode || !parentNode.children || !componentName) return;\n const parentChildren = parentNode.children;\n let childMatch = false;\n let childNode = null;\n\n Object.keys(parentChildren).forEach(key => {\n const child = parentChildren[key];\n if (childMatch) {\n if (childNode) return;\n childNode = child;\n }\n const tagName = child.tagName.toLowerCase();\n const currentComponentName = child.getAttribute('pb-component-name');\n if (currentComponentName === componentName && tagName === 'pb-wrapper-start') {\n childMatch = true;\n }\n });\n\n if (childNode) {\n allComponentNodes.push({ componentName, componentNode: childNode });\n childNode.onclick = e => {\n e.stopPropagation();\n e.preventDefault();\n window.open(\n `${adminHref}#${getComponentId(componentName)}`,\n [BLAZE_WINDOW_ID, itemEntity, itemId].join(':')\n );\n };\n childNode.onmouseenter = e => {\n allComponentNodes.forEach(({ componentName: cn, componentNode }) => {\n componentNode.classList.remove('blaze-pb-editor-highlight');\n });\n childNode.classList.add('blaze-pb-editor-highlight');\n };\n childNode.onmouseleave = e => {\n childNode.classList.remove('blaze-pb-editor-highlight');\n };\n }\n });\n },\n [adminHref, itemEntity, itemId]\n );\n\n return null;\n};\n\nexport default EditorMode;\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,SAASC,eAAe,QAAQ,aAAa,CAAC,CAAC;;AAE/C,MAAMC,UAAU,GAAGA,CAAC;EAAEC,SAAS;EAAEC,UAAU;EAAEC;AAAO,CAAC,KAAK;EACxDN,SAAS,CACP,MAAM;IACJ,MAAMO,QAAQ,GAAGC,QAAQ,CAACC,gBAAgB,CAAC,kBAAkB,CAAC;IAC9D,MAAMC,iBAAiB,GAAG,EAAE;IAC5BH,QAAQ,CAACI,OAAO,CAACC,OAAO,IAAI;MAC1B,MAAM;QAAEC;MAAW,CAAC,GAAGD,OAAO;MAC9B,MAAME,aAAa,GAAGF,OAAO,CAACG,YAAY,CAAC,mBAAmB,CAAC;MAC/D,IAAI,CAACF,UAAU,IAAI,CAACA,UAAU,CAACG,QAAQ,IAAI,CAACF,aAAa,EAAE;MAC3D,MAAMG,cAAc,GAAGJ,UAAU,CAACG,QAAQ;MAC1C,IAAIE,UAAU,GAAG,KAAK;MACtB,IAAIC,SAAS,GAAG,IAAI;MAEpBC,MAAM,CAACC,IAAI,CAACJ,cAAc,CAAC,CAACN,OAAO,CAAC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AC,CAAC;EACJ,CAAC,EACD,CAACnC,SAAS,EAAEC,UAAU,EAAEC,MAAM,CAChC,CAAC;EAED,OAAO,IAAI;AACb,CAAC;AAED,eAAeH,UAAU","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export const BLAZE_WINDOW_ID = 'blaze';
2
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","names":["BLAZE_WINDOW_ID"],"sources":["../../../src/components/EditorMode/constants.js"],"sourcesContent":["export const BLAZE_WINDOW_ID = 'blaze';\n"],"mappings":"AAAA,OAAO,MAAMA,eAAe,GAAG,OAAO","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import EditorMode from './EditorMode';
2
+ export default EditorMode;
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["EditorMode"],"sources":["../../../src/components/EditorMode/index.js"],"sourcesContent":["import EditorMode from './EditorMode';\n\nexport default EditorMode;\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,cAAc;AAErC,eAAeA,UAAU","ignoreList":[]}
@@ -26,6 +26,8 @@ const ROUTE_REGEX = process.env.BLAZE_ROUTE_REGEX ? new RegExp(process.env.BLAZE
26
26
  const PREVIEW_REGEX = /^(\/_preview)/;
27
27
  const PREVIEW_MODE = 'Preview Mode';
28
28
  const GTM_STRING = 'gtm';
29
+ const BLAZE_DEBUG = 'blaze_debug';
30
+ const BLAZE_PB_EDITOR_MODE = 'blaze_pb_editor_mode';
29
31
  const DEBUG_LOGO = {
30
32
  SRC: 'https://images.thisisblaze.com/logo-small-27-40.png',
31
33
  ALT: 'blaze-logo'
@@ -74,6 +76,8 @@ module.exports = {
74
76
  PREVIEW_MODE,
75
77
  ROUTE_REGEX,
76
78
  PREVIEW_REGEX,
79
+ BLAZE_DEBUG,
80
+ BLAZE_PB_EDITOR_MODE,
77
81
  DEBUG_LOGO,
78
82
  PUBLISHED_,
79
83
  RESPONSE_404,
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["ACTIVE_META_TAGS","BLAZE_X_FRAME_OPTIONS_DEFAULT","META_TAGS_LOOKUP","description","apiKey","htmlTagName","tagKeyName","contentDataKeyName","canonical","PB_TYPE_IMAGE","PB_TYPE_TEXTBLOCK","PB_TYPE_CAROUSEL","SEARCH_FILTER","COLON","DOUBLE_SLASH","HTTPS","DEFAULT_ROUTE_REGEX","ROUTE_REGEX","process","env","BLAZE_ROUTE_REGEX","RegExp","PREVIEW_REGEX","PREVIEW_MODE","GTM_STRING","DEBUG_LOGO","SRC","ALT","PUBLISHED_","RESPONSE_404","SITEMAP_STORE_KEY","ROUTE_PATTERN_SITEMAP","BLAZE_ROUTE_PATTERN_SITEMAP","sitemapFilePrefix","BLAZE_CONTENT_SITEMAP_URL_PREFIX","ROUTE_PATTERN_SITEMAP_FILE_REGEX","ROUTE_PATTERN_ROBOTS_TXT","BLAZE_STATIC_ROUTE_STORE_KEY","STATIC_FILE_FORWARD_HEADERS","APPLE_TAGS","href","rel","sizes","NOT_FOUND_STATUS_CODE","ROOT_SELECTOR_CLASS_PREFIX","ROOT_SELECTOR_SEPARATOR","RESOLVER_CONTAINER_CLASS","module","exports"],"sources":["../src/constants.js"],"sourcesContent":["const ACTIVE_META_TAGS = ['description', 'canonical'];\nconst BLAZE_X_FRAME_OPTIONS_DEFAULT = 'SAMEORIGIN';\n\nconst META_TAGS_LOOKUP = {\n description: {\n apiKey: 'metaDescription',\n htmlTagName: 'meta',\n tagKeyName: 'name',\n contentDataKeyName: 'content'\n },\n canonical: {\n apiKey: 'canonicalUrl',\n htmlTagName: 'link',\n tagKeyName: 'rel',\n contentDataKeyName: 'href'\n }\n};\n\nconst PB_TYPE_IMAGE = 'image';\nconst PB_TYPE_TEXTBLOCK = 'textblock';\nconst PB_TYPE_CAROUSEL = 'carousel';\nconst SEARCH_FILTER = 'searchfilter';\nconst COLON = ':';\nconst DOUBLE_SLASH = '//';\nconst HTTPS = 'https://';\n\nconst DEFAULT_ROUTE_REGEX = /^\\/[a-z0-9€_\\/]+(?:[-\\/\\.]{1,2}[a-z0-9\\/€_\\/]+)*$|^\\/$/i;\nconst ROUTE_REGEX = process.env.BLAZE_ROUTE_REGEX\n ? new RegExp(process.env.BLAZE_ROUTE_REGEX)\n : DEFAULT_ROUTE_REGEX;\nconst PREVIEW_REGEX = /^(\\/_preview)/;\nconst PREVIEW_MODE = 'Preview Mode';\nconst GTM_STRING = 'gtm';\n\nconst DEBUG_LOGO = {\n SRC: 'https://images.thisisblaze.com/logo-small-27-40.png',\n ALT: 'blaze-logo'\n};\n\nconst PUBLISHED_ = 'published_';\n\nconst RESPONSE_404 = '404 Not Found\\n';\n\nconst SITEMAP_STORE_KEY = 'default_sitemap';\nconst ROUTE_PATTERN_SITEMAP = process.env.BLAZE_ROUTE_PATTERN_SITEMAP || '/sitemap.xml';\nconst sitemapFilePrefix = process.env.BLAZE_CONTENT_SITEMAP_URL_PREFIX || 'sitemap';\nconst ROUTE_PATTERN_SITEMAP_FILE_REGEX = new RegExp(`/${sitemapFilePrefix}/.*\\.xml`);\nconst ROUTE_PATTERN_ROBOTS_TXT = '/robots.txt';\nconst BLAZE_STATIC_ROUTE_STORE_KEY = 'default';\n\nconst STATIC_FILE_FORWARD_HEADERS = ['content-length', 'last-modified', 'etag'];\n\nconst APPLE_TAGS = [\n { href: '/static/icons/touch-icon-iphone.png', rel: 'apple-touch-icon' },\n { href: '/static/icons/touch-icon-ipad.png', rel: 'apple-touch-icon', sizes: '152x152' },\n { href: '/static/icons/touch-icon-iphone-retina.png', rel: 'apple-touch-icon', sizes: '180x180' },\n { href: '/static/icons/touch-icon-ipad-retina.png', rel: 'apple-touch-icon', sizes: '167x167' }\n];\n\nconst NOT_FOUND_STATUS_CODE = 404;\n\nconst ROOT_SELECTOR_CLASS_PREFIX = 'root-selector';\nconst ROOT_SELECTOR_SEPARATOR = '--';\nconst RESOLVER_CONTAINER_CLASS = 'resolver-container';\n\nmodule.exports = {\n APPLE_TAGS,\n ACTIVE_META_TAGS,\n COLON,\n DOUBLE_SLASH,\n GTM_STRING,\n HTTPS,\n META_TAGS_LOOKUP,\n SEARCH_FILTER,\n PB_TYPE_IMAGE,\n PB_TYPE_TEXTBLOCK,\n PB_TYPE_CAROUSEL,\n PREVIEW_MODE,\n ROUTE_REGEX,\n PREVIEW_REGEX,\n DEBUG_LOGO,\n PUBLISHED_,\n RESPONSE_404,\n NOT_FOUND_STATUS_CODE,\n SITEMAP_STORE_KEY,\n ROUTE_PATTERN_SITEMAP,\n ROUTE_PATTERN_SITEMAP_FILE_REGEX,\n ROUTE_PATTERN_ROBOTS_TXT,\n BLAZE_STATIC_ROUTE_STORE_KEY,\n STATIC_FILE_FORWARD_HEADERS,\n ROOT_SELECTOR_CLASS_PREFIX,\n ROOT_SELECTOR_SEPARATOR,\n RESOLVER_CONTAINER_CLASS,\n BLAZE_X_FRAME_OPTIONS_DEFAULT\n};\n"],"mappings":"AAAA,MAAMA,gBAAgB,GAAG,CAAC,aAAa,EAAE,WAAW,CAAC;AACrD,MAAMC,6BAA6B,GAAG,YAAY;AAElD,MAAMC,gBAAgB,GAAG;EACvBC,WAAW,EAAE;IACXC,MAAM,EAAE,iBAAiB;IACzBC,WAAW,EAAE,MAAM;IACnBC,UAAU,EAAE,MAAM;IAClBC,kBAAkB,EAAE;EACtB,CAAC;EACDC,SAAS,EAAE;IACTJ,MAAM,EAAE,cAAc;IACtBC,WAAW,EAAE,MAAM;IACnBC,UAAU,EAAE,KAAK;IACjBC,kBAAkB,EAAE;EACtB;AACF,CAAC;AAED,MAAME,aAAa,GAAG,OAAO;AAC7B,MAAMC,iBAAiB,GAAG,WAAW;AACrC,MAAMC,gBAAgB,GAAG,UAAU;AACnC,MAAMC,aAAa,GAAG,cAAc;AACpC,MAAMC,KAAK,GAAG,GAAG;AACjB,MAAMC,YAAY,GAAG,IAAI;AACzB,MAAMC,KAAK,GAAG,UAAU;AAExB,MAAMC,mBAAmB,GAAG,yDAAyD;AAC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AAMC,uBAAuB,GAAG,IAAI;AACpC,MAAMC,wBAAwB,GAAG,oBAAoB;AAErDC,MAAM,CAACC,OAAO,GAAG;EACfT,UAAU;EACVvC,gBAAgB;EAChBa,KAAK;EACLC,YAAY;EACZU,UAAU;EACVT,KAAK;EACLb,gBAAgB;EAChBU,aAAa;EACbH,aAAa;EACbC,iBAAiB;EACjBC,gBAAgB;EAChBY,YAAY;EACZN,WAAW;EACXK,aAAa;EACbG,UAAU;EACVG,UAAU;EACVC,YAAY;EACZc,qBAAqB;EACrBb,iBAAiB;EACjBC,qBAAqB;EACrBI,gCAAgC;EAChCC,wBAAwB;EACxBC,4BAA4B;EAC5BC,2BAA2B;EAC3BM,0BAA0B;EAC1BC,uBAAuB;EACvBC,wBAAwB;EACxB7C;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"constants.js","names":["ACTIVE_META_TAGS","BLAZE_X_FRAME_OPTIONS_DEFAULT","META_TAGS_LOOKUP","description","apiKey","htmlTagName","tagKeyName","contentDataKeyName","canonical","PB_TYPE_IMAGE","PB_TYPE_TEXTBLOCK","PB_TYPE_CAROUSEL","SEARCH_FILTER","COLON","DOUBLE_SLASH","HTTPS","DEFAULT_ROUTE_REGEX","ROUTE_REGEX","process","env","BLAZE_ROUTE_REGEX","RegExp","PREVIEW_REGEX","PREVIEW_MODE","GTM_STRING","BLAZE_DEBUG","BLAZE_PB_EDITOR_MODE","DEBUG_LOGO","SRC","ALT","PUBLISHED_","RESPONSE_404","SITEMAP_STORE_KEY","ROUTE_PATTERN_SITEMAP","BLAZE_ROUTE_PATTERN_SITEMAP","sitemapFilePrefix","BLAZE_CONTENT_SITEMAP_URL_PREFIX","ROUTE_PATTERN_SITEMAP_FILE_REGEX","ROUTE_PATTERN_ROBOTS_TXT","BLAZE_STATIC_ROUTE_STORE_KEY","STATIC_FILE_FORWARD_HEADERS","APPLE_TAGS","href","rel","sizes","NOT_FOUND_STATUS_CODE","ROOT_SELECTOR_CLASS_PREFIX","ROOT_SELECTOR_SEPARATOR","RESOLVER_CONTAINER_CLASS","module","exports"],"sources":["../src/constants.js"],"sourcesContent":["const ACTIVE_META_TAGS = ['description', 'canonical'];\nconst BLAZE_X_FRAME_OPTIONS_DEFAULT = 'SAMEORIGIN';\n\nconst META_TAGS_LOOKUP = {\n description: {\n apiKey: 'metaDescription',\n htmlTagName: 'meta',\n tagKeyName: 'name',\n contentDataKeyName: 'content'\n },\n canonical: {\n apiKey: 'canonicalUrl',\n htmlTagName: 'link',\n tagKeyName: 'rel',\n contentDataKeyName: 'href'\n }\n};\n\nconst PB_TYPE_IMAGE = 'image';\nconst PB_TYPE_TEXTBLOCK = 'textblock';\nconst PB_TYPE_CAROUSEL = 'carousel';\nconst SEARCH_FILTER = 'searchfilter';\nconst COLON = ':';\nconst DOUBLE_SLASH = '//';\nconst HTTPS = 'https://';\n\nconst DEFAULT_ROUTE_REGEX = /^\\/[a-z0-9€_\\/]+(?:[-\\/\\.]{1,2}[a-z0-9\\/€_\\/]+)*$|^\\/$/i;\nconst ROUTE_REGEX = process.env.BLAZE_ROUTE_REGEX\n ? new RegExp(process.env.BLAZE_ROUTE_REGEX)\n : DEFAULT_ROUTE_REGEX;\nconst PREVIEW_REGEX = /^(\\/_preview)/;\nconst PREVIEW_MODE = 'Preview Mode';\nconst GTM_STRING = 'gtm';\n\nconst BLAZE_DEBUG = 'blaze_debug';\nconst BLAZE_PB_EDITOR_MODE = 'blaze_pb_editor_mode';\nconst DEBUG_LOGO = {\n SRC: 'https://images.thisisblaze.com/logo-small-27-40.png',\n ALT: 'blaze-logo'\n};\n\nconst PUBLISHED_ = 'published_';\n\nconst RESPONSE_404 = '404 Not Found\\n';\n\nconst SITEMAP_STORE_KEY = 'default_sitemap';\nconst ROUTE_PATTERN_SITEMAP = process.env.BLAZE_ROUTE_PATTERN_SITEMAP || '/sitemap.xml';\nconst sitemapFilePrefix = process.env.BLAZE_CONTENT_SITEMAP_URL_PREFIX || 'sitemap';\nconst ROUTE_PATTERN_SITEMAP_FILE_REGEX = new RegExp(`/${sitemapFilePrefix}/.*\\.xml`);\nconst ROUTE_PATTERN_ROBOTS_TXT = '/robots.txt';\nconst BLAZE_STATIC_ROUTE_STORE_KEY = 'default';\n\nconst STATIC_FILE_FORWARD_HEADERS = ['content-length', 'last-modified', 'etag'];\n\nconst APPLE_TAGS = [\n { href: '/static/icons/touch-icon-iphone.png', rel: 'apple-touch-icon' },\n { href: '/static/icons/touch-icon-ipad.png', rel: 'apple-touch-icon', sizes: '152x152' },\n { href: '/static/icons/touch-icon-iphone-retina.png', rel: 'apple-touch-icon', sizes: '180x180' },\n { href: '/static/icons/touch-icon-ipad-retina.png', rel: 'apple-touch-icon', sizes: '167x167' }\n];\n\nconst NOT_FOUND_STATUS_CODE = 404;\n\nconst ROOT_SELECTOR_CLASS_PREFIX = 'root-selector';\nconst ROOT_SELECTOR_SEPARATOR = '--';\nconst RESOLVER_CONTAINER_CLASS = 'resolver-container';\n\nmodule.exports = {\n APPLE_TAGS,\n ACTIVE_META_TAGS,\n COLON,\n DOUBLE_SLASH,\n GTM_STRING,\n HTTPS,\n META_TAGS_LOOKUP,\n SEARCH_FILTER,\n PB_TYPE_IMAGE,\n PB_TYPE_TEXTBLOCK,\n PB_TYPE_CAROUSEL,\n PREVIEW_MODE,\n ROUTE_REGEX,\n PREVIEW_REGEX,\n BLAZE_DEBUG,\n BLAZE_PB_EDITOR_MODE,\n DEBUG_LOGO,\n PUBLISHED_,\n RESPONSE_404,\n NOT_FOUND_STATUS_CODE,\n SITEMAP_STORE_KEY,\n ROUTE_PATTERN_SITEMAP,\n ROUTE_PATTERN_SITEMAP_FILE_REGEX,\n ROUTE_PATTERN_ROBOTS_TXT,\n BLAZE_STATIC_ROUTE_STORE_KEY,\n STATIC_FILE_FORWARD_HEADERS,\n ROOT_SELECTOR_CLASS_PREFIX,\n ROOT_SELECTOR_SEPARATOR,\n RESOLVER_CONTAINER_CLASS,\n BLAZE_X_FRAME_OPTIONS_DEFAULT\n};\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C;AACF,CAAC","ignoreList":[]}
@@ -8,7 +8,9 @@ import PropTypes from 'prop-types';
8
8
  import { buildPBComponents, getLightboxImages } from '@blaze-cms/plugin-page-builder-fe';
9
9
  import { Header, MainContextProvider } from '@blaze-cms/nextjs-components';
10
10
  import { getSearchFilter, checkForGtm } from '../helpers';
11
- import { PREVIEW_MODE } from '../constants';
11
+ import { BLAZE_PB_EDITOR_MODE, PREVIEW_MODE } from '../constants';
12
+ import { DebugSidebar } from '../components';
13
+ import getFromLocal from '../helpers/get-from-local';
12
14
  const ContentContainer = ({
13
15
  fullUrl,
14
16
  pageData,
@@ -17,9 +19,14 @@ const ContentContainer = ({
17
19
  itemEntity
18
20
  }) => {
19
21
  const [open, setOpen] = useState(false);
22
+ const [debugOptions, setDebugOptions] = useState({
23
+ editorModeEnabled: false
24
+ });
20
25
  const [selectedImage, setSelectedImage] = useState(0);
21
26
  const toggleModal = () => setOpen(!open);
22
27
  useEffect(() => {
28
+ const isEditorModeEnabled = getFromLocal(BLAZE_PB_EDITOR_MODE);
29
+ updatedDebugOptions('editorModeEnabled', isEditorModeEnabled);
23
30
  if (open) setOpen(false);
24
31
  },
25
32
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -59,14 +66,24 @@ const ContentContainer = ({
59
66
  const buildPBComponentsOptions = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, options), metaProps), GlobalLigthBoxProps), {}, {
60
67
  hasGTM
61
68
  });
69
+ const updatedDebugOptions = (key, value) => {
70
+ setDebugOptions(_objectSpread(_objectSpread({}, debugOptions), {}, {
71
+ [key]: value
72
+ }));
73
+ };
62
74
  return /*#__PURE__*/React.createElement(MainContextProvider, {
63
75
  value: {
64
76
  fullUrl,
65
77
  isPreview,
66
78
  itemId,
67
- hasGTM
79
+ hasGTM,
80
+ debugOptions
68
81
  }
69
- }, /*#__PURE__*/React.createElement(Header, metaProps), isPreview && /*#__PURE__*/React.createElement("div", {
82
+ }, /*#__PURE__*/React.createElement(Header, metaProps), /*#__PURE__*/React.createElement(DebugSidebar, {
83
+ itemId: itemId,
84
+ itemEntity: itemEntity,
85
+ updatedDebugOptions: updatedDebugOptions
86
+ }), isPreview && /*#__PURE__*/React.createElement("div", {
70
87
  className: "preview-header"
71
88
  }, PREVIEW_MODE), !!pageBuilder.length && buildPBComponents(pageBuilder, buildPBComponentsOptions, true));
72
89
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ContentContainer.js","names":["React","useState","useEffect","PropTypes","buildPBComponents","getLightboxImages","Header","MainContextProvider","getSearchFilter","checkForGtm","PREVIEW_MODE","ContentContainer","fullUrl","pageData","isPreview","itemId","itemEntity","open","setOpen","selectedImage","setSelectedImage","toggleModal","category","tags","preparedPageBuilderComponents","metaProps","_objectWithoutProperties","_excluded","pageBuilder","options","parent","searchFilterItems","defaultSearchFilter","settings","url","searchFilter","allSearchFilters","lightboxImages","hasGTM","GlobalLigthBoxProps","buildPBComponentsOptions","_objectSpread","createElement","value","className","length","propTypes","string","isRequired","object","bool"],"sources":["../../src/containers/ContentContainer.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { buildPBComponents, getLightboxImages } from '@blaze-cms/plugin-page-builder-fe';\nimport { Header, MainContextProvider } from '@blaze-cms/nextjs-components';\nimport { getSearchFilter, checkForGtm } from '../helpers';\nimport { PREVIEW_MODE } from '../constants';\n\nconst ContentContainer = ({ fullUrl, pageData, isPreview, itemId, itemEntity }) => {\n const [open, setOpen] = useState(false);\n const [selectedImage, setSelectedImage] = useState(0);\n const toggleModal = () => setOpen(!open);\n\n useEffect(\n () => {\n if (open) setOpen(false);\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [fullUrl]\n );\n\n const { category, tags, preparedPageBuilderComponents, ...metaProps } = pageData;\n const pageBuilder = preparedPageBuilderComponents || [];\n const options = { parent: { itemId, itemEntity, category, tags } };\n const searchFilterItems = getSearchFilter(pageBuilder);\n const defaultSearchFilter = searchFilterItems[0];\n // TODO check if this can be removed\n if (defaultSearchFilter && !defaultSearchFilter.settings.url) {\n options.searchFilter = defaultSearchFilter;\n }\n options.allSearchFilters = searchFilterItems;\n const lightboxImages = getLightboxImages(pageBuilder);\n const hasGTM = checkForGtm(pageBuilder);\n const GlobalLigthBoxProps = {\n open,\n setOpen,\n toggleModal,\n selectedImage,\n lightboxImages,\n setSelectedImage\n };\n const buildPBComponentsOptions = {\n ...options,\n ...metaProps,\n ...GlobalLigthBoxProps,\n hasGTM\n };\n\n return (\n <MainContextProvider value={{ fullUrl, isPreview, itemId, hasGTM }}>\n <Header {...metaProps} />\n {isPreview && <div className=\"preview-header\">{PREVIEW_MODE}</div>}\n {!!pageBuilder.length && buildPBComponents(pageBuilder, buildPBComponentsOptions, true)}\n </MainContextProvider>\n );\n};\n\nContentContainer.propTypes = {\n fullUrl: PropTypes.string.isRequired,\n pageData: PropTypes.object.isRequired,\n isPreview: PropTypes.bool.isRequired,\n itemId: PropTypes.string.isRequired,\n itemEntity: PropTypes.string.isRequired\n};\n\nexport default ContentContainer;\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAClD,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,iBAAiB,EAAEC,iBAAiB,QAAQ,mCAAmC;AACxF,SAASC,MAAM,EAAEC,mBAAmB,QAAQ,8BAA8B;AAC1E,SAASC,eAAe,EAAEC,WAAW,QAAQ,YAAY;AACzD,SAASC,YAAY,QAAQ,cAAc;AAE3C,MAAMC,gBAAgB,GAAGA,CAAC;EAAEC,OAAO;EAAEC,QAAQ;EAAEC,SAAS;EAAEC,MAAM;EAAEC;AAAW,CAAC,KAAK;EACjF,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGjB,QAAQ,CAAC,KAAK,CAAC;EACvC,MAAM,CAACkB,aAAa,EAAEC,gBAAgB,CAAC,GAAGnB,QAAQ,CAAC,CAAC,CAAC;EACrD,MAAMoB,WAAW,GAAGA,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A,CAAA0C,aAAA,CAACpC,MAAM,EAAKmB,SAAY,CAAC,EACxBX,SAAS,iBAAId,KAAA,CAAA0C,aAAA;IAAKE,SAAS,EAAC;EAAgB,GAAElC,YAAkB,CAAC,EACjE,CAAC,CAACkB,WAAW,CAACiB,MAAM,IAAIzC,iBAAiB,CAACwB,WAAW,EAAEY,wBAAwB,EAAE,IAAI,CACnE,CAAC;AAE1B,CAAC;AAED7B,gBAAgB,CAACmC,SAAS,GAAG;EAC3BlC,OAAO,EAAET,SAAS,CAAC4C,MAAM,CAACC,UAAU;EACpCnC,QAAQ,EAAEV,SAAS,CAAC8C,MAAM,CAACD,UAAU;EACrClC,SAAS,EAAEX,SAAS,CAAC+C,IAAI,CAACF,UAAU;EACpCjC,MAAM,EAAEZ,SAAS,CAAC4C,MAAM,CAACC,UAAU;EACnChC,UAAU,EAAEb,SAAS,CAAC4C,MAAM,CAACC;AAC/B,CAAC;AAED,eAAerC,gBAAgB","ignoreList":[]}
1
+ {"version":3,"file":"ContentContainer.js","names":["React","useState","useEffect","PropTypes","buildPBComponents","getLightboxImages","Header","MainContextProvider","getSearchFilter","checkForGtm","BLAZE_PB_EDITOR_MODE","PREVIEW_MODE","DebugSidebar","getFromLocal","ContentContainer","fullUrl","pageData","isPreview","itemId","itemEntity","open","setOpen","debugOptions","setDebugOptions","editorModeEnabled","selectedImage","setSelectedImage","toggleModal","isEditorModeEnabled","updatedDebugOptions","category","tags","preparedPageBuilderComponents","metaProps","_objectWithoutProperties","_excluded","pageBuilder","options","parent","searchFilterItems","defaultSearchFilter","settings","url","searchFilter","allSearchFilters","lightboxImages","hasGTM","GlobalLigthBoxProps","buildPBComponentsOptions","_objectSpread","key","value","createElement","className","length","propTypes","string","isRequired","object","bool"],"sources":["../../src/containers/ContentContainer.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { buildPBComponents, getLightboxImages } from '@blaze-cms/plugin-page-builder-fe';\nimport { Header, MainContextProvider } from '@blaze-cms/nextjs-components';\nimport { getSearchFilter, checkForGtm } from '../helpers';\nimport { BLAZE_PB_EDITOR_MODE, PREVIEW_MODE } from '../constants';\nimport { DebugSidebar } from '../components';\nimport getFromLocal from '../helpers/get-from-local';\n\nconst ContentContainer = ({ fullUrl, pageData, isPreview, itemId, itemEntity }) => {\n const [open, setOpen] = useState(false);\n const [debugOptions, setDebugOptions] = useState({ editorModeEnabled: false });\n const [selectedImage, setSelectedImage] = useState(0);\n const toggleModal = () => setOpen(!open);\n\n useEffect(\n () => {\n const isEditorModeEnabled = getFromLocal(BLAZE_PB_EDITOR_MODE);\n updatedDebugOptions('editorModeEnabled', isEditorModeEnabled);\n if (open) setOpen(false);\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [fullUrl]\n );\n\n const { category, tags, preparedPageBuilderComponents, ...metaProps } = pageData;\n const pageBuilder = preparedPageBuilderComponents || [];\n const options = { parent: { itemId, itemEntity, category, tags } };\n const searchFilterItems = getSearchFilter(pageBuilder);\n const defaultSearchFilter = searchFilterItems[0];\n // TODO check if this can be removed\n if (defaultSearchFilter && !defaultSearchFilter.settings.url) {\n options.searchFilter = defaultSearchFilter;\n }\n options.allSearchFilters = searchFilterItems;\n const lightboxImages = getLightboxImages(pageBuilder);\n const hasGTM = checkForGtm(pageBuilder);\n const GlobalLigthBoxProps = {\n open,\n setOpen,\n toggleModal,\n selectedImage,\n lightboxImages,\n setSelectedImage\n };\n const buildPBComponentsOptions = {\n ...options,\n ...metaProps,\n ...GlobalLigthBoxProps,\n hasGTM\n };\n\n const updatedDebugOptions = (key, value) => {\n setDebugOptions({\n ...debugOptions,\n [key]: value\n });\n };\n\n return (\n <MainContextProvider value={{ fullUrl, isPreview, itemId, hasGTM, debugOptions }}>\n <Header {...metaProps} />\n <DebugSidebar\n itemId={itemId}\n itemEntity={itemEntity}\n updatedDebugOptions={updatedDebugOptions}\n />\n {isPreview && <div className=\"preview-header\">{PREVIEW_MODE}</div>}\n {!!pageBuilder.length && buildPBComponents(pageBuilder, buildPBComponentsOptions, true)}\n </MainContextProvider>\n );\n};\n\nContentContainer.propTypes = {\n fullUrl: PropTypes.string.isRequired,\n pageData: PropTypes.object.isRequired,\n isPreview: PropTypes.bool.isRequired,\n itemId: PropTypes.string.isRequired,\n itemEntity: PropTypes.string.isRequired\n};\n\nexport default ContentContainer;\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAClD,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,iBAAiB,EAAEC,iBAAiB,QAAQ,mCAAmC;AACxF,SAASC,MAAM,EAAEC,mBAAmB,QAAQ,8BAA8B;AAC1E,SAASC,eAAe,EAAEC,WAAW,QAAQ,YAAY;AACzD,SAASC,oBAAoB,EAAEC,YAAY,QAAQ,cAAc;AACjE,SAASC,YAAY,QAAQ,eAAe;AAC5C,OAAOC,YAAY,MAAM,2BAA2B;AAEpD,MAAMC,gBAAgB,GAAGA,CAAC;EAAEC,OAAO;EAAEC,QAAQ;EAAEC,SAAS;EAAEC,MAAM;EAAEC;AAAW,CAAC,KAAK;EACjF,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGpB,QAAQ,CAAC,KAAK,CAAC;EACvC,MAAM,CAACqB,YAAY,EAAEC,eAAe,CAAC,GAAGtB,QAAQ,CAAC;IAAEuB,iBAAiB,EAAE;EAAM,CAAC,CAAC;EAC9E,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAGzB,QAAQ,CAAC,CAAC,CAAC;EACrD,MAAM0B,WAAW,GAAGA,CAAA,KAAMN,OAAO,CAAC,CAACD,IAAI,CAAC;EAExClB,SAAS,CACP,MAAM;IACJ,MAAM0B,mBAAmB,GAAGf,YAAY,CAACH,oBAAoB,CAAC;IAC9DmB,mBAAmB,CAAC,mBAAmB,EAAED,mBAAmB,CAAC;IAC7D,IAAIR,IAAI,EAAEC,OAAO,CAAC,KAAK,CAAC;EAC1B,CAAC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,SAAS;MAAEC,MAAM;MAAE4B,MAAM;MAAExB;IAAa;EAAE,gBAC/EtB,KAAA,CAAAoD,aAAA,CAAC9C,MAAM,EAAK2B,SAAY,CAAC,eACzBjC,KAAA,CAAAoD,aAAA,CAACxC,YAAY;IACXM,MAAM,EAAEA,MAAO;IACfC,UAAU,EAAEA,UAAW;IACvBU,mBAAmB,EAAEA;EAAoB,CAC1C,CAAC,EACDZ,SAAS,iBAAIjB,KAAA,CAAAoD,aAAA;IAAKC,SAAS,EAAC;EAAgB,GAAE1C,YAAkB,CAAC,EACjE,CAAC,CAACyB,WAAW,CAACkB,MAAM,IAAIlD,iBAAiB,CAACgC,WAAW,EAAEY,wBAAwB,EAAE,IAAI,CACnE,CAAC;AAE1B,CAAC;AAEDlC,gBAAgB,CAACyC,SAAS,GAAG;EAC3BxC,OAAO,EAAEZ,SAAS,CAACqD,MAAM,CAACC,UAAU;EACpCzC,QAAQ,EAAEb,SAAS,CAACuD,MAAM,CAACD,UAAU;EACrCxC,SAAS,EAAEd,SAAS,CAACwD,IAAI,CAACF,UAAU;EACpCvC,MAAM,EAAEf,SAAS,CAACqD,MAAM,CAACC,UAAU;EACnCtC,UAAU,EAAEhB,SAAS,CAACqD,MAAM,CAACC;AAC/B,CAAC;AAED,eAAe3C,gBAAgB","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ const getFromLocal = key => {
2
+ if (typeof window === 'undefined') return null;
3
+ try {
4
+ const value = localStorage.getItem(key);
5
+ return value ? JSON.parse(value) : null;
6
+ } catch (error) {
7
+ return null;
8
+ }
9
+ };
10
+ export default getFromLocal;
11
+ //# sourceMappingURL=get-from-local.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-from-local.js","names":["getFromLocal","key","window","value","localStorage","getItem","JSON","parse","error"],"sources":["../../src/helpers/get-from-local.js"],"sourcesContent":["const getFromLocal = key => {\n if (typeof window === 'undefined') return null;\n\n try {\n const value = localStorage.getItem(key);\n return value ? JSON.parse(value) : null;\n } catch (error) {\n return null;\n }\n};\n\nexport default getFromLocal;\n"],"mappings":"AAAA,MAAMA,YAAY,GAAGC,GAAG,IAAI;EAC1B,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE,OAAO,IAAI;EAE9C,IAAI;IACF,MAAMC,KAAK,GAAGC,YAAY,CAACC,OAAO,CAACJ,GAAG,CAAC;IACvC,OAAOE,KAAK,GAAGG,IAAI,CAACC,KAAK,CAACJ,KAAK,CAAC,GAAG,IAAI;EACzC,CAAC,CAAC,OAAOK,KAAK,EAAE;IACd,OAAO,IAAI;EACb;AACF,CAAC;AAED,eAAeR,YAAY","ignoreList":[]}