gatsby-theme-q3 1.43.10 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.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,113 +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.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.1.0](https://github.com/3merge/q/compare/v1.43.11...v2.1.0) (2021-11-29)
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)
34
-
35
-
36
- ### Bug Fixes
37
-
38
- * child props ([331bee7](https://github.com/3merge/q/commit/331bee7e62862d0ce91408883c4b5a0c250199d5))
39
-
40
-
41
-
42
-
43
-
44
- ## [1.41.7](https://github.com/3merge/q/compare/v1.41.6...v1.41.7) (2021-10-13)
45
-
46
- **Note:** Version bump only for package gatsby-theme-q3
47
-
48
-
49
-
50
-
51
-
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)
83
-
84
-
85
- ### Bug Fixes
86
-
87
- * ssr ([3748086](https://github.com/3merge/q/commit/3748086da42bd1f1ecebad74608c3a785bab38d7))
88
-
89
-
90
-
91
-
92
-
93
- # [1.40.0](https://github.com/3merge/q/compare/v1.39.3...v1.40.0) (2021-10-07)
94
-
95
-
96
- ### Features
97
-
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
11
+ * v2 ([#358](https://github.com/3merge/q/issues/358)) ([8e4a15a](https://github.com/3merge/q/commit/8e4a15a99f1f433b4f5770497e8af971d7663c23))
107
12
 
108
13
 
109
14
 
110
15
 
111
16
 
112
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
+
113
133
  # [1.35.0](https://github.com/3merge/q/compare/v1.34.13...v1.35.0) (2021-06-09)
114
134
 
115
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
@@ -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',
@@ -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 = {
@@ -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.43.10",
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
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
36
  "query-string": "^7.0.1",
46
- "react": "^17.0.1",
47
37
  "react-share": "^4.3.1",
48
38
  "slugify": "^1.6.3",
49
- "string-replace-webpack-plugin": "^0.1.3",
50
39
  "transform-loader": "^0.2.4",
51
40
  "yarn": "^1.22.17"
52
41
  },
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"
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
 
@@ -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',
@@ -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
  };
@@ -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
- );