gatsby-theme-q3 1.41.8 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
package/.eslintrc.js CHANGED
@@ -1,24 +1,12 @@
1
1
  const path = require('path');
2
2
 
3
3
  module.exports = {
4
- extends: [
5
- 'react-3merge'
6
- ],
7
- plugins: [
8
- 'module-resolver'
9
- ],
10
- rules: {
11
- 'react/no-array-index-key': 0,
12
- 'import/prefer-default-export': 0,
13
- 'import/no-duplicates': 0,
14
- 'import/extensions': 0,
15
- 'import/no-named-as-default': 0
16
- },
4
+ extends: ['react-3merge'],
17
5
  settings: {
18
6
  'import/resolver': {
19
7
  'eslint-import-resolver-lerna': {
20
8
  packages: path.resolve(__dirname, '../packages'),
21
9
  },
22
10
  },
23
- }
24
- }
11
+ },
12
+ };
package/CHANGELOG.md CHANGED
@@ -3,86 +3,133 @@
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
- ## [1.41.8](https://github.com/3merge/q/compare/v1.41.7...v1.41.8) (2021-10-14)
7
-
8
-
9
- ### Bug Fixes
10
-
11
- * child props ([331bee7](https://github.com/3merge/q/commit/331bee7e62862d0ce91408883c4b5a0c250199d5))
12
-
13
-
14
-
15
-
16
-
17
- ## [1.41.7](https://github.com/3merge/q/compare/v1.41.6...v1.41.7) (2021-10-13)
18
-
19
- **Note:** Version bump only for package gatsby-theme-q3
20
-
21
-
22
-
23
-
24
-
25
- ## [1.41.6](https://github.com/3merge/q/compare/v1.41.5...v1.41.6) (2021-10-13)
26
-
27
- **Note:** Version bump only for package gatsby-theme-q3
28
-
29
-
30
-
31
-
32
-
33
- ## [1.41.4](https://github.com/3merge/q/compare/v1.41.3...v1.41.4) (2021-10-12)
34
-
35
-
36
- ### Bug Fixes
37
-
38
- * invalid hook ([79641d2](https://github.com/3merge/q/commit/79641d263282868ff7d344dcd74eb340313a5e14))
39
-
40
-
41
-
42
-
43
-
44
- ## [1.41.3](https://github.com/3merge/q/compare/v1.41.2...v1.41.3) (2021-10-12)
45
-
46
-
47
- ### Bug Fixes
48
-
49
- * react dep ([4488a6e](https://github.com/3merge/q/commit/4488a6e2e039eabb34bb072219404cee4cc95e88))
50
-
51
-
52
-
53
-
54
-
55
- ## [1.41.2](https://github.com/3merge/q/compare/v1.41.1...v1.41.2) (2021-10-11)
56
-
57
-
58
- ### Bug Fixes
59
-
60
- * ssr ([3748086](https://github.com/3merge/q/commit/3748086da42bd1f1ecebad74608c3a785bab38d7))
61
-
62
-
63
-
64
-
65
-
66
- # [1.40.0](https://github.com/3merge/q/compare/v1.39.3...v1.40.0) (2021-10-07)
6
+ # [2.1.0](https://github.com/3merge/q/compare/v1.43.11...v2.1.0) (2021-11-29)
67
7
 
68
8
 
69
9
  ### Features
70
10
 
71
- * remember redirect to login ([#348](https://github.com/3merge/q/issues/348)) ([ce98193](https://github.com/3merge/q/commit/ce9819377be5acbd7c5624b30efa9ea31264aef5))
72
-
73
-
74
-
75
-
76
-
77
- ## [1.36.7](https://github.com/3merge/q/compare/v1.36.6...v1.36.7) (2021-07-15)
78
-
79
- **Note:** Version bump only for package gatsby-theme-q3
11
+ * v2 ([#358](https://github.com/3merge/q/issues/358)) ([8e4a15a](https://github.com/3merge/q/commit/8e4a15a99f1f433b4f5770497e8af971d7663c23))
80
12
 
81
13
 
82
14
 
83
15
 
84
16
 
85
17
 
18
+ # [2.0.0](https://github.com/3merge/q/compare/v1.43.11...v2.0.0) (2021-11-29)
19
+
20
+ **Note:** Version bump only for package gatsby-theme-q3
21
+
22
+
23
+
24
+
25
+
26
+ ## [1.43.10](https://github.com/3merge/q/compare/v1.43.9...v1.43.10) (2021-11-26)
27
+
28
+ **Note:** Version bump only for package gatsby-theme-q3
29
+
30
+
31
+
32
+
33
+
34
+ ## [1.43.6](https://github.com/3merge/q/compare/v1.43.5...v1.43.6) (2021-11-09)
35
+
36
+ **Note:** Version bump only for package gatsby-theme-q3
37
+
38
+
39
+
40
+
41
+
42
+ # [1.42.0](https://github.com/3merge/q/compare/v1.41.8...v1.42.0) (2021-10-14)
43
+
44
+
45
+ ### Features
46
+
47
+ * hook for looking up records by ID ([#350](https://github.com/3merge/q/issues/350)) ([3a73f61](https://github.com/3merge/q/commit/3a73f617a5d9747bd6435b68a238d78de1a4c125))
48
+
49
+
50
+
51
+
52
+
53
+ ## [1.41.8](https://github.com/3merge/q/compare/v1.41.7...v1.41.8) (2021-10-14)
54
+
55
+
56
+ ### Bug Fixes
57
+
58
+ * child props ([331bee7](https://github.com/3merge/q/commit/331bee7e62862d0ce91408883c4b5a0c250199d5))
59
+
60
+
61
+
62
+
63
+
64
+ ## [1.41.7](https://github.com/3merge/q/compare/v1.41.6...v1.41.7) (2021-10-13)
65
+
66
+ **Note:** Version bump only for package gatsby-theme-q3
67
+
68
+
69
+
70
+
71
+
72
+ ## [1.41.6](https://github.com/3merge/q/compare/v1.41.5...v1.41.6) (2021-10-13)
73
+
74
+ **Note:** Version bump only for package gatsby-theme-q3
75
+
76
+
77
+
78
+
79
+
80
+ ## [1.41.4](https://github.com/3merge/q/compare/v1.41.3...v1.41.4) (2021-10-12)
81
+
82
+
83
+ ### Bug Fixes
84
+
85
+ * invalid hook ([79641d2](https://github.com/3merge/q/commit/79641d263282868ff7d344dcd74eb340313a5e14))
86
+
87
+
88
+
89
+
90
+
91
+ ## [1.41.3](https://github.com/3merge/q/compare/v1.41.2...v1.41.3) (2021-10-12)
92
+
93
+
94
+ ### Bug Fixes
95
+
96
+ * react dep ([4488a6e](https://github.com/3merge/q/commit/4488a6e2e039eabb34bb072219404cee4cc95e88))
97
+
98
+
99
+
100
+
101
+
102
+ ## [1.41.2](https://github.com/3merge/q/compare/v1.41.1...v1.41.2) (2021-10-11)
103
+
104
+
105
+ ### Bug Fixes
106
+
107
+ * ssr ([3748086](https://github.com/3merge/q/commit/3748086da42bd1f1ecebad74608c3a785bab38d7))
108
+
109
+
110
+
111
+
112
+
113
+ # [1.40.0](https://github.com/3merge/q/compare/v1.39.3...v1.40.0) (2021-10-07)
114
+
115
+
116
+ ### Features
117
+
118
+ * remember redirect to login ([#348](https://github.com/3merge/q/issues/348)) ([ce98193](https://github.com/3merge/q/commit/ce9819377be5acbd7c5624b30efa9ea31264aef5))
119
+
120
+
121
+
122
+
123
+
124
+ ## [1.36.7](https://github.com/3merge/q/compare/v1.36.6...v1.36.7) (2021-07-15)
125
+
126
+ **Note:** Version bump only for package gatsby-theme-q3
127
+
128
+
129
+
130
+
131
+
132
+
86
133
  # [1.35.0](https://github.com/3merge/q/compare/v1.34.13...v1.35.0) (2021-06-09)
87
134
 
88
135
 
package/gatsby-config.js CHANGED
@@ -14,12 +14,11 @@ module.exports = ({
14
14
  netlify,
15
15
  }) => {
16
16
  const plugins = [
17
+ 'gatsby-plugin-material-ui',
17
18
  'gatsby-plugin-force-trailing-slashes',
18
19
  'gatsby-plugin-sitemap',
19
- 'gatsby-plugin-polyfill-io',
20
- 'gatsby-plugin-material-ui',
21
- 'gatsby-plugin-sharp',
22
20
  'gatsby-transformer-sharp',
21
+ 'gatsby-plugin-sharp',
23
22
  {
24
23
  resolve: 'gatsby-plugin-robots-txt',
25
24
  options: {
package/gatsby-node.js CHANGED
@@ -1,60 +1,25 @@
1
- const StringReplacePlugin = require('string-replace-webpack-plugin');
2
-
3
1
  exports.onCreateWebpackConfig = ({
4
2
  actions,
5
- getConfig,
3
+ stage,
4
+ plugins,
6
5
  }) => {
7
- const config = getConfig();
8
- config.node = { fs: 'empty' };
9
-
10
- Object.assign(config.resolve.alias, {
11
- 'unicode-properties':
12
- 'unicode-properties/unicode-properties.cjs.js',
13
- 'pdfkit': 'pdfkit/js/pdfkit.js',
14
- });
15
-
16
- Object.assign(config.module, {
17
- rules: [
18
- ...config.module.rules,
19
- {
20
- test: /\.ts$/,
21
- use: ['ts-loader'],
22
- },
23
- {
24
- enforce: 'pre',
25
- test: /unicode-properties[\/\\]unicode-properties/,
26
- loader: StringReplacePlugin.replace({
27
- replacements: [
28
- {
29
- pattern:
30
- "var fs = _interopDefault(require('fs'));",
31
- replacement() {
32
- return "var fs = require('fs');";
33
- },
34
- },
35
- ],
36
- }),
37
- },
38
- {
39
- test: /unicode-properties[\/\\]unicode-properties/,
40
- loader: 'transform-loader?brfs',
6
+ const config = {
7
+ resolve: {
8
+ fallback: {
9
+ fs: false,
10
+ path: false,
41
11
  },
42
- {
43
- test: /pdfkit[/\\]js[/\\]/,
44
- loader: 'transform-loader?brfs',
45
- },
46
- {
47
- test: /fontkit[\/\\]index.js$/,
48
- loader: 'transform-loader?brfs',
49
- },
50
- {
51
- test: /linebreak[\/\\]src[\/\\]linebreaker.js/,
52
- loader: 'transform-loader?brfs',
53
- },
54
- ],
55
- });
12
+ },
13
+ };
14
+
15
+ if (stage === 'build-javascript' || stage === 'develop')
16
+ config.plugins = [
17
+ plugins.provide({
18
+ process: 'process/browser',
19
+ }),
20
+ ];
56
21
 
57
- actions.replaceWebpackConfig(config);
22
+ actions.setWebpackConfig(config);
58
23
  };
59
24
 
60
25
  exports.onCreateBabelConfig = function onCreateBabelConfig({
package/gatsby-ssr.js CHANGED
@@ -9,3 +9,12 @@ export const wrapPageElement = ({ element }, plugin) => (
9
9
  export const wrapRootElement = ({ element }, plugin) => (
10
10
  <Wrapper {...plugin}>{element}</Wrapper>
11
11
  );
12
+
13
+ export const onRenderBody = ({ setPostBodyComponents }) => {
14
+ setPostBodyComponents([
15
+ <script
16
+ key="polyfill-io"
17
+ src="https://cdn.polyfill.io/v3/polyfill.min.js"
18
+ />,
19
+ ]);
20
+ };
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
- var _reactI18next = require("react-i18next");
10
+ var _q3UiLocale = require("q3-ui-locale");
11
11
 
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
 
@@ -21,7 +21,7 @@ const FormBoxContent = ({
21
21
  }) => {
22
22
  const {
23
23
  t
24
- } = (0, _reactI18next.useTranslation)();
24
+ } = (0, _q3UiLocale.useTranslation)();
25
25
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
26
26
  variant: "h1",
27
27
  gutterBottom: true
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _gatsby = require("gatsby");
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ // eslint-disable-next-line
15
+ const Redirect = ({
16
+ to
17
+ }) => {
18
+ _react.default.useEffect(() => {
19
+ (0, _gatsby.navigate)(to);
20
+ }, []);
21
+
22
+ return null;
23
+ };
24
+
25
+ var _default = Redirect;
26
+ exports.default = _default;
@@ -7,21 +7,15 @@ exports.default = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
- var _gatsby = require("gatsby");
10
+ var _Redirect = _interopRequireDefault(require("./Redirect"));
11
11
 
12
12
  var _useSiteMetaData = _interopRequireDefault(require("./useSiteMetaData"));
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
- const IndexPage = () => {
17
- const d = (0, _useSiteMetaData.default)().appDirectory;
18
-
19
- _react.default.useEffect(() => {
20
- (0, _gatsby.navigate)(d);
21
- }, []);
22
-
23
- return null;
24
- };
16
+ const IndexPage = () => /*#__PURE__*/_react.default.createElement(_Redirect.default, {
17
+ to: (0, _useSiteMetaData.default)().appDirectory
18
+ });
25
19
 
26
20
  var _default = IndexPage;
27
21
  exports.default = _default;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.renderRichText = void 0;
6
+ exports.renderRichText = exports.default = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
@@ -109,9 +109,7 @@ const renderRichText = (json, locale = 'en-CA', sitemap = {}) => {
109
109
  [_richTextTypes.BLOCKS.HR]: () => /*#__PURE__*/_react.default.createElement(_Divider.default, null),
110
110
  [_richTextTypes.BLOCKS.QUOTE]: (node, children) => /*#__PURE__*/_react.default.createElement("blockquote", null, children),
111
111
  [_richTextTypes.BLOCKS.EMBEDDED_ASSET]: node => imageRender(node, locale),
112
- [_richTextTypes.BLOCKS.EMBEDDED_ENTRY]: () => {
113
- return null;
114
- },
112
+ [_richTextTypes.BLOCKS.EMBEDDED_ENTRY]: () => null,
115
113
  [_richTextTypes.INLINES.EMBEDDED_ENTRY]: node => {
116
114
  const path = getFromSitemap(node);
117
115
  return path ? /*#__PURE__*/_react.default.createElement(_Box.default, {
@@ -146,15 +144,13 @@ const RichText = ({
146
144
  allSitePage {
147
145
  nodes {
148
146
  path
149
- context {
150
- contentful_id
151
- }
147
+ pageContext
152
148
  }
153
149
  }
154
150
  }
155
151
  `);
156
152
  return /*#__PURE__*/_react.default.createElement("div", null, renderRichText(json, locale, data.allSitePage.nodes.reduce((acc, next, i) => {
157
- acc[(0, _lodash.get)(next, 'context.contentful_id', i)] = next.path;
153
+ acc[(0, _lodash.get)(next, 'pageContext.contentful_id', i)] = next.path;
158
154
  return acc;
159
155
  }, {})));
160
156
  };
@@ -15,12 +15,12 @@ var _useSiteMetaData = _interopRequireDefault(require("./useSiteMetaData"));
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
17
 
18
- function SEO({
18
+ const SEO = ({
19
19
  description,
20
20
  lang,
21
21
  meta,
22
22
  title
23
- }) {
23
+ }) => {
24
24
  const site = (0, _useSiteMetaData.default)();
25
25
  const metaDescription = description || site.description;
26
26
  return /*#__PURE__*/_react.default.createElement(_reactHelmet.Helmet, {
@@ -52,18 +52,19 @@ function SEO({
52
52
  content: metaDescription
53
53
  }].concat(meta)
54
54
  });
55
- }
55
+ };
56
56
 
57
57
  SEO.defaultProps = {
58
58
  lang: 'en',
59
59
  meta: [],
60
- description: ''
60
+ description: '',
61
+ title: ''
61
62
  };
62
63
  SEO.propTypes = {
63
64
  description: _propTypes.default.string,
64
65
  lang: _propTypes.default.string,
65
66
  meta: _propTypes.default.arrayOf(_propTypes.default.object),
66
- title: _propTypes.default.string.isRequired
67
+ title: _propTypes.default.string
67
68
  };
68
69
  var _default = SEO;
69
70
  exports.default = _default;
@@ -36,6 +36,25 @@ const setBaseUrlForRest = (baseURL = process.env.GATSBY_APP_BASE_URL || 'http://
36
36
  return _axios.default.defaults;
37
37
  };
38
38
 
39
+ const LocaleBundles = ({
40
+ children,
41
+ locale
42
+ }) => {
43
+ registeri18ResourceBundles(locale);
44
+ return children;
45
+ };
46
+
47
+ LocaleBundles.defaultProps = {
48
+ children: null,
49
+ locale: {}
50
+ };
51
+ LocaleBundles.propTypes = {
52
+ // eslint-disable-next-line
53
+ children: _propTypes.default.any,
54
+ // eslint-disable-next-line
55
+ locale: _propTypes.default.object
56
+ };
57
+
39
58
  const Wrapper = ({
40
59
  children,
41
60
  baseURL,
@@ -43,10 +62,11 @@ const Wrapper = ({
43
62
  ...providerProps
44
63
  }) => {
45
64
  setBaseUrlForRest(baseURL);
46
- registeri18ResourceBundles(locale);
47
- return /*#__PURE__*/_react.default.createElement(_q3Ui.default, providerProps, /*#__PURE__*/_react.default.createElement(_q3UiPermissions.default, null, /*#__PURE__*/_react.default.createElement(_q3UiForms.default, {
65
+ return /*#__PURE__*/_react.default.createElement(_q3Ui.default, providerProps, /*#__PURE__*/_react.default.createElement(LocaleBundles, {
66
+ locale: locale
67
+ }, /*#__PURE__*/_react.default.createElement(_q3UiPermissions.default, null, /*#__PURE__*/_react.default.createElement(_q3UiForms.default, {
48
68
  preventDuplicate: true
49
- }, children)));
69
+ }, children))));
50
70
  };
51
71
 
52
72
  Wrapper.defaultProps = {
@@ -51,22 +51,22 @@ Object.defineProperty(exports, "PublicTemplate", {
51
51
  return _PublicTemplate.default;
52
52
  }
53
53
  });
54
- Object.defineProperty(exports, "RedirectToIndex", {
54
+ Object.defineProperty(exports, "Redirect", {
55
55
  enumerable: true,
56
56
  get: function () {
57
- return _RedirectToIndex.default;
57
+ return _Redirect.default;
58
58
  }
59
59
  });
60
- Object.defineProperty(exports, "RichText", {
60
+ Object.defineProperty(exports, "RedirectToIndex", {
61
61
  enumerable: true,
62
62
  get: function () {
63
- return _RichText.default;
63
+ return _RedirectToIndex.default;
64
64
  }
65
65
  });
66
- Object.defineProperty(exports, "renderRichText", {
66
+ Object.defineProperty(exports, "RichText", {
67
67
  enumerable: true,
68
68
  get: function () {
69
- return _RichText.renderRichText;
69
+ return _RichText.default;
70
70
  }
71
71
  });
72
72
  Object.defineProperty(exports, "SearchEngine", {
@@ -81,6 +81,12 @@ Object.defineProperty(exports, "Wrapper", {
81
81
  return _Wrapper.default;
82
82
  }
83
83
  });
84
+ Object.defineProperty(exports, "renderRichText", {
85
+ enumerable: true,
86
+ get: function () {
87
+ return _RichText.renderRichText;
88
+ }
89
+ });
84
90
 
85
91
  var _AdminLoader = _interopRequireDefault(require("./AdminLoader"));
86
92
 
@@ -98,6 +104,8 @@ var _PageWrapper = _interopRequireDefault(require("./PageWrapper"));
98
104
 
99
105
  var _PublicTemplate = _interopRequireDefault(require("./PublicTemplate"));
100
106
 
107
+ var _Redirect = _interopRequireDefault(require("./Redirect"));
108
+
101
109
  var _RedirectToIndex = _interopRequireDefault(require("./RedirectToIndex"));
102
110
 
103
111
  var _RichText = _interopRequireWildcard(require("./RichText"));
@@ -106,8 +114,8 @@ var _SearchEngine = _interopRequireDefault(require("./SearchEngine"));
106
114
 
107
115
  var _Wrapper = _interopRequireDefault(require("./Wrapper"));
108
116
 
109
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
117
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
110
118
 
111
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
119
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
112
120
 
113
121
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
- var _i18next = _interopRequireDefault(require("i18next"));
10
+ var _q3UiLocale = require("q3-ui-locale");
11
11
 
12
12
  var _q3UiPermissions = require("q3-ui-permissions");
13
13
 
@@ -23,7 +23,7 @@ const useLocale = () => {
23
23
  (0, _q3UiRest.useTimezoneInterceptor)(profile === null || profile === void 0 ? void 0 : profile.timezone);
24
24
 
25
25
  _react.default.useEffect(() => {
26
- if (lng) _i18next.default.changeLanguage(lng);
26
+ if (lng && _q3UiLocale.i18n.resolvedLanguage) _q3UiLocale.i18n.changeLanguage(lng);
27
27
  }, [lng]);
28
28
  };
29
29
 
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
- var _reactI18next = require("react-i18next");
10
+ var _q3UiLocale = require("q3-ui-locale");
11
11
 
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
 
@@ -33,7 +33,7 @@ const withSuccessOp = (Component, msg) => {
33
33
  } = props;
34
34
  const {
35
35
  t
36
- } = (0, _reactI18next.useTranslation)();
36
+ } = (0, _q3UiLocale.useTranslation)();
37
37
  return (0, _utils.hasOp)(search) ? /*#__PURE__*/_react.default.createElement(_FormBoxNotice.default, {
38
38
  title: msg,
39
39
  description: msg
@@ -11,7 +11,7 @@ var _gatsby = require("gatsby");
11
11
 
12
12
  var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
13
13
 
14
- var _reactI18next = require("react-i18next");
14
+ var _q3UiLocale = require("q3-ui-locale");
15
15
 
16
16
  var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
17
17
 
@@ -34,7 +34,7 @@ var _default = (0, _withAuthenticate.default)(({
34
34
  }) => {
35
35
  const {
36
36
  t
37
- } = (0, _reactI18next.useTranslation)();
37
+ } = (0, _q3UiLocale.useTranslation)();
38
38
  return /*#__PURE__*/_react.default.createElement(_FormBox.default, {
39
39
  renderBottom: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_builders.Form, {
40
40
  onSubmit: authenticate
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
- var _reactI18next = require("react-i18next");
10
+ var _q3UiLocale = require("q3-ui-locale");
11
11
 
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
 
@@ -37,7 +37,7 @@ const Reverify = ({
37
37
  }) => {
38
38
  const {
39
39
  t
40
- } = (0, _reactI18next.useTranslation)();
40
+ } = (0, _q3UiLocale.useTranslation)();
41
41
  if ((0, _utils.hasOp)(search)) return /*#__PURE__*/_react.default.createElement(_FormBoxNotice.default, {
42
42
  title: "reverified",
43
43
  description: "reverified"
package/package.json CHANGED
@@ -1,60 +1,43 @@
1
1
  {
2
2
  "name": "gatsby-theme-q3",
3
- "version": "1.41.8",
3
+ "version": "2.1.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
- "bin": {
7
- "q3": "./bin/deps-sync.js",
8
- "material-deps": "./bin/peer-install.js"
9
- },
10
6
  "peerDependencies": {
11
- "@material-ui/core": "^4.10.0",
12
- "@material-ui/icons": "^4.5.1",
13
- "@material-ui/lab": "^4.0.0-alpha.54",
14
- "@material-ui/styles": "^4.10.0"
7
+ "@material-ui/core": "^4.12.3",
8
+ "@material-ui/icons": "^4.11.2",
9
+ "@material-ui/lab": "^4.0.0-alpha.60",
10
+ "@material-ui/styles": "^4.11.4",
11
+ "@reach/router": "^1.3.4",
12
+ "gatsby": "^4.2.0",
13
+ "react": "^17.0.1",
14
+ "react-dom": "^17.0.1"
15
15
  },
16
16
  "dependencies": {
17
- "@babel/plugin-proposal-export-default-from": "^7.12.13",
17
+ "@babel/plugin-proposal-export-default-from": "^7.16.0",
18
18
  "@contentful/gatsby-transformer-contentful-richtext": "^13.1.0",
19
- "@contentful/rich-text-react-renderer": "^14.1.2",
20
- "@contentful/rich-text-types": "^14.1.2",
21
- "@reach/router": "^1.3.4",
19
+ "@contentful/rich-text-react-renderer": "^15.6.2",
20
+ "@contentful/rich-text-types": "^15.7.0",
22
21
  "add": "^2.0.6",
23
- "babel-preset-gatsby": "^0.12.0",
24
- "gatsby": "^2.27.5",
25
- "gatsby-image": "^2.11.0",
26
- "gatsby-link": "^2.6.1",
27
- "gatsby-plugin-canonical-urls": "^2.10.0",
22
+ "gatsby-image": "^3.11.0",
23
+ "gatsby-plugin-canonical-urls": "^4.2.0",
28
24
  "gatsby-plugin-force-trailing-slashes": "^1.0.5",
29
- "gatsby-plugin-manifest": "^2.12.0",
30
- "gatsby-plugin-material-ui": "^2.1.9",
31
- "gatsby-plugin-netlify": "^2.11.0",
32
- "gatsby-plugin-offline": "^3.10.0",
33
- "gatsby-plugin-polyfill-io": "^1.1.0",
34
- "gatsby-plugin-react-helmet": "^3.10.0",
35
- "gatsby-plugin-remove-trailing-slashes": "^2.10.0",
36
- "gatsby-plugin-robots-txt": "^1.5.5",
37
- "gatsby-plugin-sharp": "^2.14.0",
38
- "gatsby-plugin-sitemap": "^2.12.0",
39
- "gatsby-react-router-scroll": "^3.2.0",
40
- "gatsby-source-contentful": "^4.6.0",
41
- "gatsby-source-filesystem": "^2.11.0",
42
- "gatsby-transformer-sharp": "^2.12.0",
25
+ "gatsby-plugin-manifest": "^4.2.0",
26
+ "gatsby-plugin-material-ui": "^3.0.1",
27
+ "gatsby-plugin-netlify": "^3.14.0",
28
+ "gatsby-plugin-robots-txt": "^1.6.14",
29
+ "gatsby-plugin-sharp": "^4.2.0",
30
+ "gatsby-plugin-sitemap": "^5.2.0",
31
+ "gatsby-source-contentful": "^7.0.0",
32
+ "gatsby-transformer-sharp": "^4.2.0",
43
33
  "lodash": "^4.17.20",
34
+ "process": "^0.11.10",
44
35
  "prop-types": "^15.7.2",
45
- "query-string": "^6.13.8",
46
- "react": "^17.0.1",
36
+ "query-string": "^7.0.1",
47
37
  "react-share": "^4.3.1",
48
- "slugify": "^1.4.6",
49
- "string-replace-webpack-plugin": "^0.1.3",
38
+ "slugify": "^1.6.3",
50
39
  "transform-loader": "^0.2.4",
51
- "yarn": "^1.22.10"
52
- },
53
- "devDependencies": {
54
- "child_process": "^1.0.2",
55
- "find-yarn-workspace-root": "^2.0.0",
56
- "fs": "^0.0.1-security",
57
- "path": "^0.12.7"
40
+ "yarn": "^1.22.17"
58
41
  },
59
- "gitHead": "78a0f5138b717b80e5ac55ef92dbff50c73edbda"
42
+ "gitHead": "c98d520b4a2597acb71d87198c4e6af89473e2ce"
60
43
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { useTranslation } from 'react-i18next';
2
+ import { useTranslation } from 'q3-ui-locale';
3
3
  import PropTypes from 'prop-types';
4
4
  import Typography from '@material-ui/core/Typography';
5
5
 
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { navigate } from 'gatsby';
3
+
4
+ // eslint-disable-next-line
5
+ const Redirect = ({ to }) => {
6
+ React.useEffect(() => {
7
+ navigate(to);
8
+ }, []);
9
+
10
+ return null;
11
+ };
12
+
13
+ export default Redirect;
@@ -1,15 +1,9 @@
1
1
  import React from 'react';
2
- import { navigate } from 'gatsby';
2
+ import Redirect from './Redirect';
3
3
  import useSiteMetaData from './useSiteMetaData';
4
4
 
5
- const IndexPage = () => {
6
- const d = useSiteMetaData().appDirectory;
7
-
8
- React.useEffect(() => {
9
- navigate(d);
10
- }, []);
11
-
12
- return null;
13
- };
5
+ const IndexPage = () => (
6
+ <Redirect to={useSiteMetaData().appDirectory} />
7
+ );
14
8
 
15
9
  export default IndexPage;
@@ -119,9 +119,7 @@ export const renderRichText = (
119
119
  ),
120
120
  [BLOCKS.EMBEDDED_ASSET]: (node) =>
121
121
  imageRender(node, locale),
122
- [BLOCKS.EMBEDDED_ENTRY]: () => {
123
- return null;
124
- },
122
+ [BLOCKS.EMBEDDED_ENTRY]: () => null,
125
123
  [INLINES.EMBEDDED_ENTRY]: (node) => {
126
124
  const path = getFromSitemap(node);
127
125
 
@@ -164,9 +162,7 @@ const RichText = ({ json, locale }) => {
164
162
  allSitePage {
165
163
  nodes {
166
164
  path
167
- context {
168
- contentful_id
169
- }
165
+ pageContext
170
166
  }
171
167
  }
172
168
  }
@@ -178,7 +174,7 @@ const RichText = ({ json, locale }) => {
178
174
  json,
179
175
  locale,
180
176
  data.allSitePage.nodes.reduce((acc, next, i) => {
181
- acc[get(next, 'context.contentful_id', i)] =
177
+ acc[get(next, 'pageContext.contentful_id', i)] =
182
178
  next.path;
183
179
  return acc;
184
180
  }, {}),
@@ -186,6 +182,7 @@ const RichText = ({ json, locale }) => {
186
182
  </div>
187
183
  );
188
184
  };
185
+
189
186
  RichText.propTypes = {
190
187
  // eslint-disable-next-line
191
188
  json: PropTypes.object,
@@ -3,9 +3,8 @@ import PropTypes from 'prop-types';
3
3
  import { Helmet } from 'react-helmet';
4
4
  import useSiteMetaData from './useSiteMetaData';
5
5
 
6
- function SEO({ description, lang, meta, title }) {
6
+ const SEO = ({ description, lang, meta, title }) => {
7
7
  const site = useSiteMetaData();
8
-
9
8
  const metaDescription = description || site.description;
10
9
 
11
10
  return (
@@ -47,19 +46,20 @@ function SEO({ description, lang, meta, title }) {
47
46
  ].concat(meta)}
48
47
  />
49
48
  );
50
- }
49
+ };
51
50
 
52
51
  SEO.defaultProps = {
53
52
  lang: 'en',
54
53
  meta: [],
55
54
  description: '',
55
+ title: '',
56
56
  };
57
57
 
58
58
  SEO.propTypes = {
59
59
  description: PropTypes.string,
60
60
  lang: PropTypes.string,
61
61
  meta: PropTypes.arrayOf(PropTypes.object),
62
- title: PropTypes.string.isRequired,
62
+ title: PropTypes.string,
63
63
  };
64
64
 
65
65
  export default SEO;
@@ -31,6 +31,23 @@ const setBaseUrlForRest = (
31
31
  return axios.defaults;
32
32
  };
33
33
 
34
+ const LocaleBundles = ({ children, locale }) => {
35
+ registeri18ResourceBundles(locale);
36
+ return children;
37
+ };
38
+
39
+ LocaleBundles.defaultProps = {
40
+ children: null,
41
+ locale: {},
42
+ };
43
+
44
+ LocaleBundles.propTypes = {
45
+ // eslint-disable-next-line
46
+ children: PropTypes.any,
47
+ // eslint-disable-next-line
48
+ locale: PropTypes.object,
49
+ };
50
+
34
51
  const Wrapper = ({
35
52
  children,
36
53
  baseURL,
@@ -38,15 +55,16 @@ const Wrapper = ({
38
55
  ...providerProps
39
56
  }) => {
40
57
  setBaseUrlForRest(baseURL);
41
- registeri18ResourceBundles(locale);
42
58
 
43
59
  return (
44
60
  <Provider {...providerProps}>
45
- <AuthProvider>
46
- <FormProviders preventDuplicate>
47
- {children}
48
- </FormProviders>
49
- </AuthProvider>
61
+ <LocaleBundles locale={locale}>
62
+ <AuthProvider>
63
+ <FormProviders preventDuplicate>
64
+ {children}
65
+ </FormProviders>
66
+ </AuthProvider>
67
+ </LocaleBundles>
50
68
  </Provider>
51
69
  );
52
70
  };
@@ -6,6 +6,7 @@ export { default as BlogTemplate } from './BlogTemplate';
6
6
  export { default as FormBox } from './FormBox';
7
7
  export { default as PageWrapper } from './PageWrapper';
8
8
  export { default as PublicTemplate } from './PublicTemplate';
9
+ export { default as Redirect } from './Redirect';
9
10
  export { default as RedirectToIndex } from './RedirectToIndex';
10
11
  export {
11
12
  default as RichText,
@@ -1,18 +1,19 @@
1
1
  import React from 'react';
2
- import i18n from 'i18next';
2
+ import { i18n } from 'q3-ui-locale';
3
3
  import { AuthContext } from 'q3-ui-permissions';
4
4
  import { useTimezoneInterceptor } from 'q3-ui-rest';
5
5
 
6
6
  const useLocale = () => {
7
- const profile = React.useContext(AuthContext)?.state
8
- ?.profile;
7
+ const profile =
8
+ React.useContext(AuthContext)?.state?.profile;
9
9
 
10
10
  const lng = profile?.lang;
11
11
 
12
12
  useTimezoneInterceptor(profile?.timezone);
13
13
 
14
14
  React.useEffect(() => {
15
- if (lng) i18n.changeLanguage(lng);
15
+ if (lng && i18n.resolvedLanguage)
16
+ i18n.changeLanguage(lng);
16
17
  }, [lng]);
17
18
  };
18
19
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { useTranslation } from 'react-i18next';
2
+ import { useTranslation } from 'q3-ui-locale';
3
3
  import PropTypes from 'prop-types';
4
4
  import { Link } from 'gatsby';
5
5
  import Button from '@material-ui/core/Button';
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Link } from 'gatsby';
3
3
  import MuiLink from '@material-ui/core/Button';
4
- import { useTranslation } from 'react-i18next';
4
+ import { useTranslation } from 'q3-ui-locale';
5
5
  import Typography from '@material-ui/core/Typography';
6
6
  import Divider from '@material-ui/core/Divider';
7
7
  import Grid from '@material-ui/core/Grid';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { useTranslation } from 'react-i18next';
2
+ import { useTranslation } from 'q3-ui-locale';
3
3
  import PropTypes from 'prop-types';
4
4
  import { Link } from 'gatsby';
5
5
  import axios from 'axios';
package/bin/deps-sync.js DELETED
@@ -1,60 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /* eslint-disable import/no-unresolved */
4
- const path = require('path');
5
- const fs = require('fs');
6
- const { execSync } = require('child_process');
7
-
8
- const packages = [
9
- 'q3-admin',
10
- 'q3-blocks',
11
- 'q3-components',
12
- 'q3-ui',
13
- 'q3-ui-assets',
14
- 'q3-ui-datatables',
15
- 'q3-ui-dialog',
16
- 'q3-ui-exports',
17
- 'q3-ui-forms',
18
- 'q3-ui-helpers',
19
- 'q3-ui-locale',
20
- 'q3-ui-permissions',
21
- 'q3-ui-repeater',
22
- 'q3-ui-rest',
23
- 'q3-ui-test-utils',
24
- ];
25
-
26
- const getPkgDeps = () => {
27
- const pkg = fs.readFileSync(
28
- path.resolve(process.cwd(), './package.json'),
29
- 'utf8',
30
- );
31
-
32
- return Object.keys(JSON.parse(pkg).dependencies);
33
- };
34
-
35
- const runYarnCmd = (cmd, deps = []) => {
36
- if (Array.isArray(deps) && deps.length)
37
- execSync(`yarn ${cmd} ${deps.join(' ')}`);
38
- };
39
-
40
- const determineYarnCmd = (deps = []) =>
41
- packages.reduce(
42
- (acc, next) => {
43
- if (deps.includes(next)) {
44
- acc.upgrade.push(next);
45
- } else {
46
- acc.install.push(next);
47
- }
48
-
49
- return acc;
50
- },
51
- {
52
- install: [],
53
- upgrade: [],
54
- },
55
- );
56
-
57
- const { install, upgrade } = determineYarnCmd(getPkgDeps());
58
-
59
- runYarnCmd('add', install);
60
- runYarnCmd('upgrade --latest', upgrade);
@@ -1,46 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /* eslint-disable import/no-unresolved */
4
- const path = require('path');
5
- const fs = require('fs');
6
-
7
- const { merge } = require('lodash');
8
- const { execSync } = require('child_process');
9
- const fw = require('find-yarn-workspace-root');
10
- const packageJson = require('../package.json');
11
-
12
- const getWorkspacePeerDeps = () => {
13
- const pkg = fs.readFileSync(
14
- path.join(fw(process.cwd()), 'package.json'),
15
- 'utf8',
16
- );
17
-
18
- return JSON.parse(pkg).dependencies;
19
- };
20
-
21
- const getSupportedMuiVersions = (deps = []) =>
22
- Object.entries(deps).reduce((acc, [key, value]) => {
23
- if (key.startsWith('@material-ui')) {
24
- Object.assign(acc, {
25
- [key]: value,
26
- });
27
- }
28
-
29
- return acc;
30
- }, {});
31
-
32
- fs.writeFile(
33
- path.resolve(__dirname, '../package.json'),
34
- JSON.stringify(
35
- merge({
36
- ...packageJson,
37
- peerDependencies: getSupportedMuiVersions(
38
- getWorkspacePeerDeps(),
39
- ),
40
- }),
41
- ),
42
- (err) => {
43
- // ensure differences are saved
44
- if (!err) execSync('yarn install');
45
- },
46
- );