gatsby-theme-q3 1.43.10 → 2.3.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,45 +3,18 @@
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.10](https://github.com/3merge/q/compare/v1.43.9...v1.43.10) (2021-11-26)
7
-
8
- **Note:** Version bump only for package gatsby-theme-q3
9
-
10
-
11
-
12
-
13
-
14
- ## [1.43.6](https://github.com/3merge/q/compare/v1.43.5...v1.43.6) (2021-11-09)
15
-
16
- **Note:** Version bump only for package gatsby-theme-q3
17
-
18
-
19
-
20
-
21
-
22
- # [1.42.0](https://github.com/3merge/q/compare/v1.41.8...v1.42.0) (2021-10-14)
6
+ # [2.3.0](https://github.com/3merge/q/compare/v2.2.2...v2.3.0) (2021-12-09)
23
7
 
24
8
 
25
9
  ### Features
26
10
 
27
- * hook for looking up records by ID ([#350](https://github.com/3merge/q/issues/350)) ([3a73f61](https://github.com/3merge/q/commit/3a73f617a5d9747bd6435b68a238d78de1a4c125))
28
-
29
-
30
-
31
-
32
-
33
- ## [1.41.8](https://github.com/3merge/q/compare/v1.41.7...v1.41.8) (2021-10-14)
11
+ * theme for prevent unstyled load ([#361](https://github.com/3merge/q/issues/361)) ([a1f1535](https://github.com/3merge/q/commit/a1f15358262b40829d3e1312864a1c0d08c778dc))
34
12
 
35
13
 
36
- ### Bug Fixes
37
-
38
- * child props ([331bee7](https://github.com/3merge/q/commit/331bee7e62862d0ce91408883c4b5a0c250199d5))
39
-
40
14
 
41
15
 
42
16
 
43
-
44
- ## [1.41.7](https://github.com/3merge/q/compare/v1.41.6...v1.41.7) (2021-10-13)
17
+ ## [2.2.2](https://github.com/3merge/q/compare/v2.2.1...v2.2.2) (2021-12-09)
45
18
 
46
19
  **Note:** Version bump only for package gatsby-theme-q3
47
20
 
@@ -49,67 +22,144 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
49
22
 
50
23
 
51
24
 
52
- ## [1.41.6](https://github.com/3merge/q/compare/v1.41.5...v1.41.6) (2021-10-13)
53
-
54
- **Note:** Version bump only for package gatsby-theme-q3
55
-
56
-
57
-
58
-
59
-
60
- ## [1.41.4](https://github.com/3merge/q/compare/v1.41.3...v1.41.4) (2021-10-12)
61
-
62
-
63
- ### Bug Fixes
64
-
65
- * invalid hook ([79641d2](https://github.com/3merge/q/commit/79641d263282868ff7d344dcd74eb340313a5e14))
66
-
67
-
68
-
69
-
70
-
71
- ## [1.41.3](https://github.com/3merge/q/compare/v1.41.2...v1.41.3) (2021-10-12)
72
-
73
-
74
- ### Bug Fixes
75
-
76
- * react dep ([4488a6e](https://github.com/3merge/q/commit/4488a6e2e039eabb34bb072219404cee4cc95e88))
77
-
78
-
79
-
80
-
81
-
82
- ## [1.41.2](https://github.com/3merge/q/compare/v1.41.1...v1.41.2) (2021-10-11)
25
+ ## [2.1.1](https://github.com/3merge/q/compare/v2.1.0...v2.1.1) (2021-11-29)
83
26
 
84
27
 
85
28
  ### Bug Fixes
86
29
 
87
- * ssr ([3748086](https://github.com/3merge/q/commit/3748086da42bd1f1ecebad74608c3a785bab38d7))
30
+ * webpack util resolve ([60b3713](https://github.com/3merge/q/commit/60b37132309dc0b6167b469ee9849a9585b2466b))
88
31
 
89
32
 
90
33
 
91
34
 
92
35
 
93
- # [1.40.0](https://github.com/3merge/q/compare/v1.39.3...v1.40.0) (2021-10-07)
36
+ # [2.1.0](https://github.com/3merge/q/compare/v1.43.11...v2.1.0) (2021-11-29)
94
37
 
95
38
 
96
39
  ### Features
97
40
 
98
- * remember redirect to login ([#348](https://github.com/3merge/q/issues/348)) ([ce98193](https://github.com/3merge/q/commit/ce9819377be5acbd7c5624b30efa9ea31264aef5))
99
-
100
-
101
-
102
-
103
-
104
- ## [1.36.7](https://github.com/3merge/q/compare/v1.36.6...v1.36.7) (2021-07-15)
105
-
106
- **Note:** Version bump only for package gatsby-theme-q3
41
+ * v2 ([#358](https://github.com/3merge/q/issues/358)) ([8e4a15a](https://github.com/3merge/q/commit/8e4a15a99f1f433b4f5770497e8af971d7663c23))
107
42
 
108
43
 
109
44
 
110
45
 
111
46
 
112
47
 
48
+ # [2.0.0](https://github.com/3merge/q/compare/v1.43.11...v2.0.0) (2021-11-29)
49
+
50
+ **Note:** Version bump only for package gatsby-theme-q3
51
+
52
+
53
+
54
+
55
+
56
+ ## [1.43.10](https://github.com/3merge/q/compare/v1.43.9...v1.43.10) (2021-11-26)
57
+
58
+ **Note:** Version bump only for package gatsby-theme-q3
59
+
60
+
61
+
62
+
63
+
64
+ ## [1.43.6](https://github.com/3merge/q/compare/v1.43.5...v1.43.6) (2021-11-09)
65
+
66
+ **Note:** Version bump only for package gatsby-theme-q3
67
+
68
+
69
+
70
+
71
+
72
+ # [1.42.0](https://github.com/3merge/q/compare/v1.41.8...v1.42.0) (2021-10-14)
73
+
74
+
75
+ ### Features
76
+
77
+ * hook for looking up records by ID ([#350](https://github.com/3merge/q/issues/350)) ([3a73f61](https://github.com/3merge/q/commit/3a73f617a5d9747bd6435b68a238d78de1a4c125))
78
+
79
+
80
+
81
+
82
+
83
+ ## [1.41.8](https://github.com/3merge/q/compare/v1.41.7...v1.41.8) (2021-10-14)
84
+
85
+
86
+ ### Bug Fixes
87
+
88
+ * child props ([331bee7](https://github.com/3merge/q/commit/331bee7e62862d0ce91408883c4b5a0c250199d5))
89
+
90
+
91
+
92
+
93
+
94
+ ## [1.41.7](https://github.com/3merge/q/compare/v1.41.6...v1.41.7) (2021-10-13)
95
+
96
+ **Note:** Version bump only for package gatsby-theme-q3
97
+
98
+
99
+
100
+
101
+
102
+ ## [1.41.6](https://github.com/3merge/q/compare/v1.41.5...v1.41.6) (2021-10-13)
103
+
104
+ **Note:** Version bump only for package gatsby-theme-q3
105
+
106
+
107
+
108
+
109
+
110
+ ## [1.41.4](https://github.com/3merge/q/compare/v1.41.3...v1.41.4) (2021-10-12)
111
+
112
+
113
+ ### Bug Fixes
114
+
115
+ * invalid hook ([79641d2](https://github.com/3merge/q/commit/79641d263282868ff7d344dcd74eb340313a5e14))
116
+
117
+
118
+
119
+
120
+
121
+ ## [1.41.3](https://github.com/3merge/q/compare/v1.41.2...v1.41.3) (2021-10-12)
122
+
123
+
124
+ ### Bug Fixes
125
+
126
+ * react dep ([4488a6e](https://github.com/3merge/q/commit/4488a6e2e039eabb34bb072219404cee4cc95e88))
127
+
128
+
129
+
130
+
131
+
132
+ ## [1.41.2](https://github.com/3merge/q/compare/v1.41.1...v1.41.2) (2021-10-11)
133
+
134
+
135
+ ### Bug Fixes
136
+
137
+ * ssr ([3748086](https://github.com/3merge/q/commit/3748086da42bd1f1ecebad74608c3a785bab38d7))
138
+
139
+
140
+
141
+
142
+
143
+ # [1.40.0](https://github.com/3merge/q/compare/v1.39.3...v1.40.0) (2021-10-07)
144
+
145
+
146
+ ### Features
147
+
148
+ * remember redirect to login ([#348](https://github.com/3merge/q/issues/348)) ([ce98193](https://github.com/3merge/q/commit/ce9819377be5acbd7c5624b30efa9ea31264aef5))
149
+
150
+
151
+
152
+
153
+
154
+ ## [1.36.7](https://github.com/3merge/q/compare/v1.36.6...v1.36.7) (2021-07-15)
155
+
156
+ **Note:** Version bump only for package gatsby-theme-q3
157
+
158
+
159
+
160
+
161
+
162
+
113
163
  # [1.35.0](https://github.com/3merge/q/compare/v1.34.13...v1.35.0) (2021-06-09)
114
164
 
115
165
 
package/gatsby-config.js CHANGED
@@ -12,14 +12,26 @@ module.exports = ({
12
12
  brandingColor,
13
13
  icon,
14
14
  netlify,
15
+ theme,
15
16
  }) => {
16
17
  const plugins = [
18
+ {
19
+ resolve: 'gatsby-theme-q3-mui',
20
+ options: {
21
+ theme,
22
+ },
23
+ },
24
+ 'gatsby-plugin-material-ui',
17
25
  'gatsby-plugin-force-trailing-slashes',
18
26
  'gatsby-plugin-sitemap',
19
- 'gatsby-plugin-polyfill-io',
20
- 'gatsby-plugin-material-ui',
27
+ {
28
+ resolve: 'gatsby-transformer-sharp',
29
+ options: {
30
+ // The option defaults to true
31
+ checkSupportedExtensions: true,
32
+ },
33
+ },
21
34
  'gatsby-plugin-sharp',
22
- 'gatsby-transformer-sharp',
23
35
  {
24
36
  resolve: 'gatsby-plugin-robots-txt',
25
37
  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
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _q3UiLocale = require("q3-ui-locale");
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ const registeri18ResourceBundles = contentData => {
15
+ if (!contentData || !('en' in contentData)) return;
16
+ Object.entries(contentData).forEach(([key, bundle]) => {
17
+ Object.entries(bundle).forEach(([namespace, data]) => {
18
+ _q3UiLocale.i18n.addResourceBundle(key, namespace, data, true, true);
19
+ });
20
+ });
21
+ };
22
+
23
+ const LocaleBundles = ({
24
+ children,
25
+ locale
26
+ }) => {
27
+ registeri18ResourceBundles(locale);
28
+ return children;
29
+ };
30
+
31
+ LocaleBundles.defaultProps = {
32
+ children: null,
33
+ locale: {}
34
+ };
35
+ LocaleBundles.propTypes = {
36
+ // eslint-disable-next-line
37
+ children: _propTypes.default.any,
38
+ // eslint-disable-next-line
39
+ locale: _propTypes.default.object
40
+ };
41
+ var _default = LocaleBundles;
42
+ exports.default = _default;
@@ -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,44 +7,33 @@ 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"));
19
15
 
20
16
  var _q3UiPermissions = _interopRequireDefault(require("q3-ui-permissions"));
21
17
 
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+ var _LocaleBundles = _interopRequireDefault(require("./LocaleBundles"));
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
- };
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
21
 
22
+ /* eslint-disable import/no-extraneous-dependencies */
34
23
  const setBaseUrlForRest = (baseURL = process.env.GATSBY_APP_BASE_URL || 'http://localhost:9000') => {
35
24
  _axios.default.defaults.baseURL = baseURL;
36
25
  return _axios.default.defaults;
37
26
  };
38
27
 
39
28
  const Wrapper = ({
40
- children,
41
29
  baseURL,
42
- locale,
43
- ...providerProps
30
+ children,
31
+ locale
44
32
  }) => {
45
33
  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, {
34
+ return /*#__PURE__*/_react.default.createElement(_LocaleBundles.default, {
35
+ locale: locale
36
+ }, /*#__PURE__*/_react.default.createElement(_q3UiPermissions.default, null, /*#__PURE__*/_react.default.createElement(_q3UiForms.default, {
48
37
  preventDuplicate: true
49
38
  }, children)));
50
39
  };
@@ -56,9 +45,7 @@ Wrapper.propTypes = {
56
45
  baseURL: _propTypes.default.string,
57
46
  children: _propTypes.default.node.isRequired,
58
47
  // eslint-disable-next-line
59
- locale: _propTypes.default.object.isRequired,
60
- // eslint-disable-next-line
61
- theme: _propTypes.default.object.isRequired
48
+ locale: _propTypes.default.object.isRequired
62
49
  };
63
50
  var _default = Wrapper;
64
51
  exports.default = _default;
@@ -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,45 @@
1
1
  {
2
2
  "name": "gatsby-theme-q3",
3
- "version": "1.43.10",
3
+ "version": "2.3.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
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-theme-q3-mui": "^2.3.0",
33
+ "gatsby-transformer-sharp": "^4.2.0",
43
34
  "lodash": "^4.17.20",
35
+ "process": "^0.11.10",
44
36
  "prop-types": "^15.7.2",
37
+ "q3-ui-locale": "^2.2.2",
45
38
  "query-string": "^7.0.1",
46
- "react": "^17.0.1",
47
39
  "react-share": "^4.3.1",
48
40
  "slugify": "^1.6.3",
49
- "string-replace-webpack-plugin": "^0.1.3",
50
41
  "transform-loader": "^0.2.4",
51
42
  "yarn": "^1.22.17"
52
43
  },
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"
58
- },
59
- "gitHead": "387498694663947f873bb1da86f94d78f9684c03"
44
+ "gitHead": "4faefb196bc5f15db568e7ca0df98e7f108e4c25"
60
45
  }
@@ -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,37 @@
1
+ import { i18n } from 'q3-ui-locale';
2
+ import PropTypes from 'prop-types';
3
+
4
+ const registeri18ResourceBundles = (contentData) => {
5
+ if (!contentData || !('en' in contentData)) return;
6
+
7
+ Object.entries(contentData).forEach(([key, bundle]) => {
8
+ Object.entries(bundle).forEach(([namespace, data]) => {
9
+ i18n.addResourceBundle(
10
+ key,
11
+ namespace,
12
+ data,
13
+ true,
14
+ true,
15
+ );
16
+ });
17
+ });
18
+ };
19
+
20
+ const LocaleBundles = ({ children, locale }) => {
21
+ registeri18ResourceBundles(locale);
22
+ return children;
23
+ };
24
+
25
+ LocaleBundles.defaultProps = {
26
+ children: null,
27
+ locale: {},
28
+ };
29
+
30
+ LocaleBundles.propTypes = {
31
+ // eslint-disable-next-line
32
+ children: PropTypes.any,
33
+ // eslint-disable-next-line
34
+ locale: PropTypes.object,
35
+ };
36
+
37
+ export default LocaleBundles;
@@ -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,27 +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
-
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
- };
7
+ import LocaleBundles from './LocaleBundles';
25
8
 
26
9
  const setBaseUrlForRest = (
27
10
  baseURL = process.env.GATSBY_APP_BASE_URL ||
@@ -31,23 +14,17 @@ const setBaseUrlForRest = (
31
14
  return axios.defaults;
32
15
  };
33
16
 
34
- const Wrapper = ({
35
- children,
36
- baseURL,
37
- locale,
38
- ...providerProps
39
- }) => {
17
+ const Wrapper = ({ baseURL, children, locale }) => {
40
18
  setBaseUrlForRest(baseURL);
41
- registeri18ResourceBundles(locale);
42
19
 
43
20
  return (
44
- <Provider {...providerProps}>
21
+ <LocaleBundles locale={locale}>
45
22
  <AuthProvider>
46
23
  <FormProviders preventDuplicate>
47
24
  {children}
48
25
  </FormProviders>
49
26
  </AuthProvider>
50
- </Provider>
27
+ </LocaleBundles>
51
28
  );
52
29
  };
53
30
 
@@ -61,9 +38,6 @@ Wrapper.propTypes = {
61
38
 
62
39
  // eslint-disable-next-line
63
40
  locale: PropTypes.object.isRequired,
64
-
65
- // eslint-disable-next-line
66
- theme: PropTypes.object.isRequired,
67
41
  };
68
42
 
69
43
  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';
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
- );