gatsby-theme-q3 1.43.6 → 2.2.2

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,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [1.43.6](https://github.com/3merge/q/compare/v1.43.5...v1.43.6) (2021-11-09)
6
+ ## [2.2.2](https://github.com/3merge/q/compare/v2.2.1...v2.2.2) (2021-12-09)
7
7
 
8
8
  **Note:** Version bump only for package gatsby-theme-q3
9
9
 
@@ -11,97 +11,144 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
11
 
12
12
 
13
13
 
14
- # [1.42.0](https://github.com/3merge/q/compare/v1.41.8...v1.42.0) (2021-10-14)
15
-
16
-
17
- ### Features
18
-
19
- * hook for looking up records by ID ([#350](https://github.com/3merge/q/issues/350)) ([3a73f61](https://github.com/3merge/q/commit/3a73f617a5d9747bd6435b68a238d78de1a4c125))
20
-
21
-
22
-
23
-
24
-
25
- ## [1.41.8](https://github.com/3merge/q/compare/v1.41.7...v1.41.8) (2021-10-14)
14
+ ## [2.1.1](https://github.com/3merge/q/compare/v2.1.0...v2.1.1) (2021-11-29)
26
15
 
27
16
 
28
17
  ### Bug Fixes
29
18
 
30
- * child props ([331bee7](https://github.com/3merge/q/commit/331bee7e62862d0ce91408883c4b5a0c250199d5))
31
-
32
-
33
-
34
-
35
-
36
- ## [1.41.7](https://github.com/3merge/q/compare/v1.41.6...v1.41.7) (2021-10-13)
37
-
38
- **Note:** Version bump only for package gatsby-theme-q3
39
-
40
-
41
-
42
-
19
+ * webpack util resolve ([60b3713](https://github.com/3merge/q/commit/60b37132309dc0b6167b469ee9849a9585b2466b))
43
20
 
44
- ## [1.41.6](https://github.com/3merge/q/compare/v1.41.5...v1.41.6) (2021-10-13)
45
-
46
- **Note:** Version bump only for package gatsby-theme-q3
47
-
48
-
49
-
50
-
51
-
52
- ## [1.41.4](https://github.com/3merge/q/compare/v1.41.3...v1.41.4) (2021-10-12)
53
-
54
-
55
- ### Bug Fixes
56
-
57
- * invalid hook ([79641d2](https://github.com/3merge/q/commit/79641d263282868ff7d344dcd74eb340313a5e14))
58
-
59
-
60
-
61
-
62
-
63
- ## [1.41.3](https://github.com/3merge/q/compare/v1.41.2...v1.41.3) (2021-10-12)
64
-
65
-
66
- ### Bug Fixes
67
21
 
68
- * react dep ([4488a6e](https://github.com/3merge/q/commit/4488a6e2e039eabb34bb072219404cee4cc95e88))
69
22
 
70
23
 
71
24
 
72
-
73
-
74
- ## [1.41.2](https://github.com/3merge/q/compare/v1.41.1...v1.41.2) (2021-10-11)
75
-
76
-
77
- ### Bug Fixes
78
-
79
- * ssr ([3748086](https://github.com/3merge/q/commit/3748086da42bd1f1ecebad74608c3a785bab38d7))
80
-
81
-
82
-
83
-
84
-
85
- # [1.40.0](https://github.com/3merge/q/compare/v1.39.3...v1.40.0) (2021-10-07)
25
+ # [2.1.0](https://github.com/3merge/q/compare/v1.43.11...v2.1.0) (2021-11-29)
86
26
 
87
27
 
88
28
  ### Features
89
29
 
90
- * remember redirect to login ([#348](https://github.com/3merge/q/issues/348)) ([ce98193](https://github.com/3merge/q/commit/ce9819377be5acbd7c5624b30efa9ea31264aef5))
91
-
92
-
93
-
94
-
95
-
96
- ## [1.36.7](https://github.com/3merge/q/compare/v1.36.6...v1.36.7) (2021-07-15)
97
-
98
- **Note:** Version bump only for package gatsby-theme-q3
30
+ * v2 ([#358](https://github.com/3merge/q/issues/358)) ([8e4a15a](https://github.com/3merge/q/commit/8e4a15a99f1f433b4f5770497e8af971d7663c23))
99
31
 
100
32
 
101
33
 
102
34
 
103
35
 
104
36
 
37
+ # [2.0.0](https://github.com/3merge/q/compare/v1.43.11...v2.0.0) (2021-11-29)
38
+
39
+ **Note:** Version bump only for package gatsby-theme-q3
40
+
41
+
42
+
43
+
44
+
45
+ ## [1.43.10](https://github.com/3merge/q/compare/v1.43.9...v1.43.10) (2021-11-26)
46
+
47
+ **Note:** Version bump only for package gatsby-theme-q3
48
+
49
+
50
+
51
+
52
+
53
+ ## [1.43.6](https://github.com/3merge/q/compare/v1.43.5...v1.43.6) (2021-11-09)
54
+
55
+ **Note:** Version bump only for package gatsby-theme-q3
56
+
57
+
58
+
59
+
60
+
61
+ # [1.42.0](https://github.com/3merge/q/compare/v1.41.8...v1.42.0) (2021-10-14)
62
+
63
+
64
+ ### Features
65
+
66
+ * hook for looking up records by ID ([#350](https://github.com/3merge/q/issues/350)) ([3a73f61](https://github.com/3merge/q/commit/3a73f617a5d9747bd6435b68a238d78de1a4c125))
67
+
68
+
69
+
70
+
71
+
72
+ ## [1.41.8](https://github.com/3merge/q/compare/v1.41.7...v1.41.8) (2021-10-14)
73
+
74
+
75
+ ### Bug Fixes
76
+
77
+ * child props ([331bee7](https://github.com/3merge/q/commit/331bee7e62862d0ce91408883c4b5a0c250199d5))
78
+
79
+
80
+
81
+
82
+
83
+ ## [1.41.7](https://github.com/3merge/q/compare/v1.41.6...v1.41.7) (2021-10-13)
84
+
85
+ **Note:** Version bump only for package gatsby-theme-q3
86
+
87
+
88
+
89
+
90
+
91
+ ## [1.41.6](https://github.com/3merge/q/compare/v1.41.5...v1.41.6) (2021-10-13)
92
+
93
+ **Note:** Version bump only for package gatsby-theme-q3
94
+
95
+
96
+
97
+
98
+
99
+ ## [1.41.4](https://github.com/3merge/q/compare/v1.41.3...v1.41.4) (2021-10-12)
100
+
101
+
102
+ ### Bug Fixes
103
+
104
+ * invalid hook ([79641d2](https://github.com/3merge/q/commit/79641d263282868ff7d344dcd74eb340313a5e14))
105
+
106
+
107
+
108
+
109
+
110
+ ## [1.41.3](https://github.com/3merge/q/compare/v1.41.2...v1.41.3) (2021-10-12)
111
+
112
+
113
+ ### Bug Fixes
114
+
115
+ * react dep ([4488a6e](https://github.com/3merge/q/commit/4488a6e2e039eabb34bb072219404cee4cc95e88))
116
+
117
+
118
+
119
+
120
+
121
+ ## [1.41.2](https://github.com/3merge/q/compare/v1.41.1...v1.41.2) (2021-10-11)
122
+
123
+
124
+ ### Bug Fixes
125
+
126
+ * ssr ([3748086](https://github.com/3merge/q/commit/3748086da42bd1f1ecebad74608c3a785bab38d7))
127
+
128
+
129
+
130
+
131
+
132
+ # [1.40.0](https://github.com/3merge/q/compare/v1.39.3...v1.40.0) (2021-10-07)
133
+
134
+
135
+ ### Features
136
+
137
+ * remember redirect to login ([#348](https://github.com/3merge/q/issues/348)) ([ce98193](https://github.com/3merge/q/commit/ce9819377be5acbd7c5624b30efa9ea31264aef5))
138
+
139
+
140
+
141
+
142
+
143
+ ## [1.36.7](https://github.com/3merge/q/compare/v1.36.6...v1.36.7) (2021-07-15)
144
+
145
+ **Note:** Version bump only for package gatsby-theme-q3
146
+
147
+
148
+
149
+
150
+
151
+
105
152
  # [1.35.0](https://github.com/3merge/q/compare/v1.34.13...v1.35.0) (2021-06-09)
106
153
 
107
154
 
package/gatsby-config.js CHANGED
@@ -14,12 +14,22 @@ module.exports = ({
14
14
  netlify,
15
15
  }) => {
16
16
  const plugins = [
17
+ {
18
+ resolve: require.resolve(
19
+ './src/plugins/gatsby-local-top-layout',
20
+ ),
21
+ },
22
+ 'gatsby-plugin-material-ui',
17
23
  'gatsby-plugin-force-trailing-slashes',
18
24
  'gatsby-plugin-sitemap',
19
- 'gatsby-plugin-polyfill-io',
20
- 'gatsby-plugin-material-ui',
25
+ {
26
+ resolve: 'gatsby-transformer-sharp',
27
+ options: {
28
+ // The option defaults to true
29
+ checkSupportedExtensions: true,
30
+ },
31
+ },
21
32
  'gatsby-plugin-sharp',
22
- 'gatsby-transformer-sharp',
23
33
  {
24
34
  resolve: 'gatsby-plugin-robots-txt',
25
35
  options: {
package/gatsby-node.js CHANGED
@@ -1,60 +1,26 @@
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
+ util: false,
10
+ fs: false,
11
+ path: false,
41
12
  },
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
- });
13
+ },
14
+ };
15
+
16
+ if (stage === 'build-javascript' || stage === 'develop')
17
+ config.plugins = [
18
+ plugins.provide({
19
+ process: 'process/browser',
20
+ }),
21
+ ];
56
22
 
57
- actions.replaceWebpackConfig(config);
23
+ actions.setWebpackConfig(config);
58
24
  };
59
25
 
60
26
  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
@@ -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,7 +52,7 @@ function SEO({
52
52
  content: metaDescription
53
53
  }].concat(meta)
54
54
  });
55
- }
55
+ };
56
56
 
57
57
  SEO.defaultProps = {
58
58
  lang: 'en',
@@ -7,12 +7,8 @@ exports.default = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
- var _q3Ui = _interopRequireDefault(require("q3-ui"));
11
-
12
10
  var _axios = _interopRequireDefault(require("axios"));
13
11
 
14
- var _q3UiLocale = require("q3-ui-locale");
15
-
16
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
17
13
 
18
14
  var _q3UiForms = _interopRequireDefault(require("q3-ui-forms"));
@@ -21,16 +17,7 @@ var _q3UiPermissions = _interopRequireDefault(require("q3-ui-permissions"));
21
17
 
22
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
19
 
24
- // eslint-disable-next-line
25
- const registeri18ResourceBundles = contentData => {
26
- if (!contentData || !('en' in contentData)) return;
27
- Object.entries(contentData).forEach(([key, bundle]) => {
28
- Object.entries(bundle).forEach(([namespace, data]) => {
29
- _q3UiLocale.i18n.addResourceBundle(key, namespace, data, true, true);
30
- });
31
- });
32
- };
33
-
20
+ /* eslint-disable import/no-extraneous-dependencies */
34
21
  const setBaseUrlForRest = (baseURL = process.env.GATSBY_APP_BASE_URL || 'http://localhost:9000') => {
35
22
  _axios.default.defaults.baseURL = baseURL;
36
23
  return _axios.default.defaults;
@@ -38,15 +25,12 @@ const setBaseUrlForRest = (baseURL = process.env.GATSBY_APP_BASE_URL || 'http://
38
25
 
39
26
  const Wrapper = ({
40
27
  children,
41
- baseURL,
42
- locale,
43
- ...providerProps
28
+ baseURL
44
29
  }) => {
45
30
  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, {
31
+ return /*#__PURE__*/_react.default.createElement(_q3UiPermissions.default, null, /*#__PURE__*/_react.default.createElement(_q3UiForms.default, {
48
32
  preventDuplicate: true
49
- }, children)));
33
+ }, children));
50
34
  };
51
35
 
52
36
  Wrapper.defaultProps = {
@@ -54,11 +38,7 @@ Wrapper.defaultProps = {
54
38
  };
55
39
  Wrapper.propTypes = {
56
40
  baseURL: _propTypes.default.string,
57
- children: _propTypes.default.node.isRequired,
58
- // eslint-disable-next-line
59
- locale: _propTypes.default.object.isRequired,
60
- // eslint-disable-next-line
61
- theme: _propTypes.default.object.isRequired
41
+ children: _propTypes.default.node.isRequired
62
42
  };
63
43
  var _default = Wrapper;
64
44
  exports.default = _default;
@@ -69,12 +69,6 @@ Object.defineProperty(exports, "RichText", {
69
69
  return _RichText.default;
70
70
  }
71
71
  });
72
- Object.defineProperty(exports, "renderRichText", {
73
- enumerable: true,
74
- get: function () {
75
- return _RichText.renderRichText;
76
- }
77
- });
78
72
  Object.defineProperty(exports, "SearchEngine", {
79
73
  enumerable: true,
80
74
  get: function () {
@@ -87,6 +81,12 @@ Object.defineProperty(exports, "Wrapper", {
87
81
  return _Wrapper.default;
88
82
  }
89
83
  });
84
+ Object.defineProperty(exports, "renderRichText", {
85
+ enumerable: true,
86
+ get: function () {
87
+ return _RichText.renderRichText;
88
+ }
89
+ });
90
90
 
91
91
  var _AdminLoader = _interopRequireDefault(require("./AdminLoader"));
92
92
 
@@ -114,8 +114,8 @@ var _SearchEngine = _interopRequireDefault(require("./SearchEngine"));
114
114
 
115
115
  var _Wrapper = _interopRequireDefault(require("./Wrapper"));
116
116
 
117
- 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); }
118
118
 
119
- 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; }
120
120
 
121
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"
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "wrapRootElement", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _gatsbySsr.wrapRootElement;
10
+ }
11
+ });
12
+
13
+ var _gatsbySsr = require("./gatsby-ssr");
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.wrapRootElement = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _q3Ui = _interopRequireDefault(require("q3-ui"));
11
+
12
+ var _q3UiLocale = require("q3-ui-locale");
13
+
14
+ var _propTypes = _interopRequireDefault(require("prop-types"));
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ /* eslint-disable import/prefer-default-export, import/no-extraneous-dependencies, react/prop-types, react/jsx-filename-extension */
19
+ const registeri18ResourceBundles = contentData => {
20
+ if (!contentData || !('en' in contentData)) return;
21
+ Object.entries(contentData).forEach(([key, bundle]) => {
22
+ Object.entries(bundle).forEach(([namespace, data]) => {
23
+ _q3UiLocale.i18n.addResourceBundle(key, namespace, data, true, true);
24
+ });
25
+ });
26
+ };
27
+
28
+ const LocaleBundles = ({
29
+ children,
30
+ locale
31
+ }) => {
32
+ registeri18ResourceBundles(locale);
33
+ return children;
34
+ };
35
+
36
+ LocaleBundles.defaultProps = {
37
+ children: null,
38
+ locale: {}
39
+ };
40
+ LocaleBundles.propTypes = {
41
+ // eslint-disable-next-line
42
+ children: _propTypes.default.any,
43
+ // eslint-disable-next-line
44
+ locale: _propTypes.default.object
45
+ };
46
+
47
+ const Wrapper = ({
48
+ children,
49
+ locale,
50
+ ...providerProps
51
+ }) => /*#__PURE__*/_react.default.createElement(_q3Ui.default, providerProps, /*#__PURE__*/_react.default.createElement(LocaleBundles, {
52
+ locale: locale
53
+ }, children));
54
+
55
+ Wrapper.propTypes = {
56
+ children: _propTypes.default.node.isRequired,
57
+ // eslint-disable-next-line
58
+ locale: _propTypes.default.object.isRequired,
59
+ // eslint-disable-next-line
60
+ theme: _propTypes.default.object.isRequired
61
+ };
62
+
63
+ const wrapRootElement = ({
64
+ element
65
+ }, {
66
+ locale,
67
+ ...providerProps
68
+ }) => /*#__PURE__*/_react.default.createElement(_q3Ui.default, providerProps, /*#__PURE__*/_react.default.createElement(LocaleBundles, {
69
+ locale: locale
70
+ }, element));
71
+
72
+ exports.wrapRootElement = wrapRootElement;
@@ -0,0 +1,2 @@
1
+ // noop
2
+ "use strict";
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "gatsby-local-top-layout",
3
+ "private": true,
4
+ "main": "index.js"
5
+ }
package/package.json CHANGED
@@ -1,60 +1,43 @@
1
1
  {
2
2
  "name": "gatsby-theme-q3",
3
- "version": "1.43.6",
3
+ "version": "2.2.2",
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": "12c582761b7caeb6c4181a1c4e14198719f623b8"
42
+ "gitHead": "57057a3cc44effedb0abd4635d3aee6f1eaf866c"
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
 
@@ -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,7 +3,7 @@ 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
8
  const metaDescription = description || site.description;
9
9
 
@@ -46,7 +46,7 @@ function SEO({ description, lang, meta, title }) {
46
46
  ].concat(meta)}
47
47
  />
48
48
  );
49
- }
49
+ };
50
50
 
51
51
  SEO.defaultProps = {
52
52
  lang: 'en',
@@ -1,28 +1,10 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
1
2
  import React from 'react';
2
- import Provider from 'q3-ui';
3
- // eslint-disable-next-line
4
3
  import axios from 'axios';
5
- import { i18n } from 'q3-ui-locale';
6
4
  import PropTypes from 'prop-types';
7
5
  import FormProviders from 'q3-ui-forms';
8
6
  import AuthProvider from 'q3-ui-permissions';
9
7
 
10
- const registeri18ResourceBundles = (contentData) => {
11
- if (!contentData || !('en' in contentData)) return;
12
-
13
- Object.entries(contentData).forEach(([key, bundle]) => {
14
- Object.entries(bundle).forEach(([namespace, data]) => {
15
- i18n.addResourceBundle(
16
- key,
17
- namespace,
18
- data,
19
- true,
20
- true,
21
- );
22
- });
23
- });
24
- };
25
-
26
8
  const setBaseUrlForRest = (
27
9
  baseURL = process.env.GATSBY_APP_BASE_URL ||
28
10
  'http://localhost:9000',
@@ -31,23 +13,15 @@ const setBaseUrlForRest = (
31
13
  return axios.defaults;
32
14
  };
33
15
 
34
- const Wrapper = ({
35
- children,
36
- baseURL,
37
- locale,
38
- ...providerProps
39
- }) => {
16
+ const Wrapper = ({ children, baseURL }) => {
40
17
  setBaseUrlForRest(baseURL);
41
- registeri18ResourceBundles(locale);
42
18
 
43
19
  return (
44
- <Provider {...providerProps}>
45
- <AuthProvider>
46
- <FormProviders preventDuplicate>
47
- {children}
48
- </FormProviders>
49
- </AuthProvider>
50
- </Provider>
20
+ <AuthProvider>
21
+ <FormProviders preventDuplicate>
22
+ {children}
23
+ </FormProviders>
24
+ </AuthProvider>
51
25
  );
52
26
  };
53
27
 
@@ -58,12 +32,6 @@ Wrapper.defaultProps = {
58
32
  Wrapper.propTypes = {
59
33
  baseURL: PropTypes.string,
60
34
  children: PropTypes.node.isRequired,
61
-
62
- // eslint-disable-next-line
63
- locale: PropTypes.object.isRequired,
64
-
65
- // eslint-disable-next-line
66
- theme: PropTypes.object.isRequired,
67
35
  };
68
36
 
69
37
  export default Wrapper;
@@ -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';
@@ -0,0 +1 @@
1
+ export { wrapRootElement } from './gatsby-ssr';
@@ -0,0 +1,67 @@
1
+ /* eslint-disable import/prefer-default-export, import/no-extraneous-dependencies, react/prop-types, react/jsx-filename-extension */
2
+ import React from 'react';
3
+ import Provider from 'q3-ui';
4
+ import { i18n } from 'q3-ui-locale';
5
+ import PropTypes from 'prop-types';
6
+
7
+ const registeri18ResourceBundles = (contentData) => {
8
+ if (!contentData || !('en' in contentData)) return;
9
+
10
+ Object.entries(contentData).forEach(([key, bundle]) => {
11
+ Object.entries(bundle).forEach(([namespace, data]) => {
12
+ i18n.addResourceBundle(
13
+ key,
14
+ namespace,
15
+ data,
16
+ true,
17
+ true,
18
+ );
19
+ });
20
+ });
21
+ };
22
+
23
+ const LocaleBundles = ({ children, locale }) => {
24
+ registeri18ResourceBundles(locale);
25
+ return children;
26
+ };
27
+
28
+ LocaleBundles.defaultProps = {
29
+ children: null,
30
+ locale: {},
31
+ };
32
+
33
+ LocaleBundles.propTypes = {
34
+ // eslint-disable-next-line
35
+ children: PropTypes.any,
36
+ // eslint-disable-next-line
37
+ locale: PropTypes.object,
38
+ };
39
+
40
+ const Wrapper = ({
41
+ children,
42
+ locale,
43
+ ...providerProps
44
+ }) => (
45
+ <Provider {...providerProps}>
46
+ <LocaleBundles locale={locale}>
47
+ {children}
48
+ </LocaleBundles>
49
+ </Provider>
50
+ );
51
+
52
+ Wrapper.propTypes = {
53
+ children: PropTypes.node.isRequired,
54
+ // eslint-disable-next-line
55
+ locale: PropTypes.object.isRequired,
56
+ // eslint-disable-next-line
57
+ theme: PropTypes.object.isRequired,
58
+ };
59
+
60
+ export const wrapRootElement = (
61
+ { element },
62
+ { locale, ...providerProps },
63
+ ) => (
64
+ <Provider {...providerProps}>
65
+ <LocaleBundles locale={locale}>{element}</LocaleBundles>
66
+ </Provider>
67
+ );
@@ -0,0 +1 @@
1
+ // noop
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "gatsby-local-top-layout",
3
+ "private": true,
4
+ "main": "index.js"
5
+ }
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
- );