@dr.pogodin/react-utils 1.43.5 → 1.43.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/build/development/server/index.js +1 -2
  2. package/build/development/server/index.js.map +1 -1
  3. package/build/development/server/utils/index.js +1 -2
  4. package/build/development/shared/components/WithTooltip/index.js +1 -2
  5. package/build/development/shared/components/WithTooltip/index.js.map +1 -1
  6. package/build/development/shared/components/index.js +4 -5
  7. package/build/development/shared/components/index.js.map +1 -1
  8. package/build/development/shared/components/selectors/CustomDropdown/index.js +1 -2
  9. package/build/development/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  10. package/build/development/shared/utils/index.js +1 -2
  11. package/build/development/shared/utils/index.js.map +1 -1
  12. package/build/development/shared/utils/jest/index.js +12 -6
  13. package/build/development/shared/utils/jest/index.js.map +1 -1
  14. package/build/development/web.bundle.js +1 -11
  15. package/build/production/server/index.js +1 -1
  16. package/build/production/server/index.js.map +1 -1
  17. package/build/production/server/utils/index.js +1 -1
  18. package/build/production/shared/components/WithTooltip/index.js +1 -1
  19. package/build/production/shared/components/WithTooltip/index.js.map +1 -1
  20. package/build/production/shared/components/index.js +1 -1
  21. package/build/production/shared/components/index.js.map +1 -1
  22. package/build/production/shared/components/selectors/CustomDropdown/index.js +1 -1
  23. package/build/production/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  24. package/build/production/shared/utils/index.js +1 -1
  25. package/build/production/shared/utils/index.js.map +1 -1
  26. package/build/production/shared/utils/jest/index.js +7 -3
  27. package/build/production/shared/utils/jest/index.js.map +1 -1
  28. package/build/production/web.bundle.js +1 -1
  29. package/build/production/web.bundle.js.map +1 -1
  30. package/build/types-code/shared/components/index.d.ts +1 -1
  31. package/package.json +15 -16
  32. package/src/shared/components/index.ts +2 -1
  33. package/src/shared/utils/jest/index.ts +12 -6
  34. package/build/development/shared/components/MetaTags.js +0 -111
  35. package/build/development/shared/components/MetaTags.js.map +0 -1
  36. package/build/production/shared/components/MetaTags.js +0 -9
  37. package/build/production/shared/components/MetaTags.js.map +0 -1
  38. package/build/types-code/shared/components/MetaTags.d.ts +0 -24
  39. package/src/shared/components/MetaTags.tsx +0 -134
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * Just an aggregation of all exported components into a single module.
3
3
  */
4
+ export { MetaTags } from '@dr.pogodin/react-helmet';
4
5
  export * from './selectors';
5
6
  export { default as Button, BaseButton } from './Button';
6
7
  export { default as Checkbox } from './Checkbox';
7
8
  export { default as Input } from './Input';
8
9
  export { default as Link } from './Link';
9
10
  export { default as PageLayout } from './PageLayout';
10
- export { default as MetaTags } from './MetaTags';
11
11
  export { default as Modal, BaseModal } from './Modal';
12
12
  export { default as NavLink } from './NavLink';
13
13
  export { default as Throbber } from './Throbber';
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.43.5",
2
+ "version": "1.43.7",
3
3
  "bin": {
4
4
  "react-utils-build": "bin/build.js",
5
5
  "react-utils-setup": "bin/setup.js"
@@ -8,12 +8,12 @@
8
8
  "url": "https://github.com/birdofpreyru/react-utils/issues"
9
9
  },
10
10
  "dependencies": {
11
- "@babel/runtime": "^7.27.0",
11
+ "@babel/runtime": "^7.27.1",
12
12
  "@dr.pogodin/babel-plugin-react-css-modules": "^6.13.5",
13
13
  "@dr.pogodin/csurf": "^1.14.2",
14
14
  "@dr.pogodin/js-utils": "^0.0.17",
15
15
  "@dr.pogodin/react-global-state": "^0.18.1",
16
- "@dr.pogodin/react-helmet": "^3.0.1",
16
+ "@dr.pogodin/react-helmet": "^3.0.2",
17
17
  "@dr.pogodin/react-themes": "^1.8.0",
18
18
  "@jest/environment": "^29.7.0",
19
19
  "axios": "^1.9.0",
@@ -46,17 +46,17 @@
46
46
  },
47
47
  "description": "Collection of generic ReactJS components and utils",
48
48
  "devDependencies": {
49
- "@babel/cli": "^7.27.0",
50
- "@babel/core": "^7.26.10",
51
- "@babel/node": "^7.26.0",
52
- "@babel/plugin-transform-runtime": "^7.26.10",
53
- "@babel/preset-env": "^7.26.9",
54
- "@babel/preset-react": "^7.26.3",
55
- "@babel/preset-typescript": "^7.27.0",
56
- "@babel/register": "^7.25.9",
49
+ "@babel/cli": "^7.27.1",
50
+ "@babel/core": "^7.27.1",
51
+ "@babel/node": "^7.27.1",
52
+ "@babel/plugin-transform-runtime": "^7.27.1",
53
+ "@babel/preset-env": "^7.27.1",
54
+ "@babel/preset-react": "^7.27.1",
55
+ "@babel/preset-typescript": "^7.27.1",
56
+ "@babel/register": "^7.27.1",
57
57
  "@dr.pogodin/babel-plugin-transform-assets": "^1.2.4",
58
58
  "@dr.pogodin/babel-preset-svgr": "^1.9.0",
59
- "@dr.pogodin/eslint-configs": "^0.0.3",
59
+ "@dr.pogodin/eslint-configs": "^0.0.5",
60
60
  "@pmmmwh/react-refresh-webpack-plugin": "^0.6.0",
61
61
  "@testing-library/dom": "^10.4.0",
62
62
  "@testing-library/react": "^16.3.0",
@@ -74,7 +74,7 @@
74
74
  "@types/node-forge": "^1.3.11",
75
75
  "@types/pretty": "^2.0.3",
76
76
  "@types/react": "^19.1.2",
77
- "@types/react-dom": "^19.1.2",
77
+ "@types/react-dom": "^19.1.3",
78
78
  "@types/request-ip": "^0.0.41",
79
79
  "@types/serialize-javascript": "^5.0.4",
80
80
  "@types/serve-favicon": "^2.5.7",
@@ -85,14 +85,13 @@
85
85
  "babel-jest": "^29.7.0",
86
86
  "babel-loader": "^10.0.0",
87
87
  "babel-plugin-module-resolver": "^5.0.2",
88
- "core-js": "^3.41.0",
88
+ "core-js": "^3.42.0",
89
89
  "css-loader": "^7.1.2",
90
90
  "css-minimizer-webpack-plugin": "^7.0.2",
91
- "eslint": "9.25.0",
92
91
  "identity-obj-proxy": "^3.0.0",
93
92
  "jest": "^29.7.0",
94
93
  "jest-environment-jsdom": "^29.7.0",
95
- "memfs": "^4.17.0",
94
+ "memfs": "^4.17.1",
96
95
  "mini-css-extract-plugin": "^2.9.2",
97
96
  "mockdate": "^3.0.5",
98
97
  "nodelist-foreach-polyfill": "^1.2.0",
@@ -2,6 +2,8 @@
2
2
  * Just an aggregation of all exported components into a single module.
3
3
  */
4
4
 
5
+ export { MetaTags } from '@dr.pogodin/react-helmet';
6
+
5
7
  export * from 'components/selectors';
6
8
 
7
9
  export { default as Button, BaseButton } from 'components/Button';
@@ -9,7 +11,6 @@ export { default as Checkbox } from 'components/Checkbox';
9
11
  export { default as Input } from 'components/Input';
10
12
  export { default as Link } from 'components/Link';
11
13
  export { default as PageLayout } from 'components/PageLayout';
12
- export { default as MetaTags } from 'components/MetaTags';
13
14
  export { default as Modal, BaseModal } from 'components/Modal';
14
15
  export { default as NavLink } from 'components/NavLink';
15
16
  export { default as Throbber } from 'components/Throbber';
@@ -193,12 +193,18 @@ export function snapshot(
193
193
 
194
194
  if (res === undefined) throw Error('Render failed');
195
195
  if (options?.await) {
196
- // TODO: Then body of .then() is the same as the last three lines in this
197
- // function, executed for the non-async variant. We should re-use that.
198
- return promise.then(() => {
199
- const nodes = res!.asFragment().childNodes;
200
- expect(nodes.length > 1 ? [...nodes] : nodes[0]).toMatchSnapshot();
201
- return res!;
196
+ // BEWARE: Although `promise` is thenable (i.e. it has .then() method),
197
+ // it is not an instance of proper Promise class, and returning it directly
198
+ // breaks some async logic in Jest test or React test functions... thus, we
199
+ // wrap it into Promise instance here.
200
+ return new Promise((resolve) => {
201
+ void promise.then(() => {
202
+ // TODO: These lines are the same as the lines below for sync variant of
203
+ // the function. We should split and reuse them in both places.
204
+ const nodes = res!.asFragment().childNodes;
205
+ expect(nodes.length > 1 ? [...nodes] : nodes[0]).toMatchSnapshot();
206
+ resolve(res!);
207
+ });
202
208
  });
203
209
  }
204
210
 
@@ -1,111 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = require("react");
8
- var _reactHelmet = require("@dr.pogodin/react-helmet");
9
- var _jsxRuntime = require("react/jsx-runtime");
10
- // TODO: Move this component to React Helmet library.
11
-
12
- const Context = /*#__PURE__*/(0, _react.createContext)({
13
- description: '',
14
- title: ''
15
- });
16
-
17
- /**
18
- * Auxiliary wrapper around "react-helmet", which helps to inject meta tags
19
- * (page title, a brief content description, and social media thumbnails) into
20
- * generated pages.
21
- */
22
- const MetaTags = ({
23
- children,
24
- description,
25
- extraMetaTags,
26
- image,
27
- siteName,
28
- socialDescription,
29
- socialTitle,
30
- title,
31
- url
32
- }) => {
33
- // NOTE: I guess, in this very case, we should prefer title and description
34
- // also to empty social title and decscription?
35
- /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
36
- const socTitle = socialTitle || title;
37
- const socDesc = socialDescription || description;
38
- /* eslint-enable @typescript-eslint/prefer-nullish-coalescing */
39
-
40
- const context = (0, _react.useMemo)(() => ({
41
- description,
42
- image,
43
- siteName,
44
- socialDescription,
45
- socialTitle,
46
- title,
47
- url
48
- }), [description, image, siteName, socialDescription, socialTitle, title, url]);
49
- const extra = [];
50
- if (extraMetaTags?.length) {
51
- for (let i = 0; i < extraMetaTags.length; ++i) {
52
- const {
53
- content,
54
- name
55
- } = extraMetaTags[i];
56
- extra.push(/*#__PURE__*/(0, _jsxRuntime.jsx)("meta", {
57
- content: content,
58
- name: name
59
- }, `extra-meta-tag-${i}`));
60
- }
61
- }
62
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
63
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactHelmet.Helmet, {
64
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("title", {
65
- children: title
66
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("meta", {
67
- content: description,
68
- name: "description"
69
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("meta", {
70
- content: "summary_large_image",
71
- name: "twitter:card"
72
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("meta", {
73
- content: socTitle,
74
- name: "twitter:title"
75
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("meta", {
76
- content: socDesc,
77
- name: "twitter:description"
78
- }), image ? /*#__PURE__*/(0, _jsxRuntime.jsx)("meta", {
79
- content: image,
80
- name: "twitter:image"
81
- }) : null, siteName ? /*#__PURE__*/(0, _jsxRuntime.jsx)("meta", {
82
- content: `@${siteName}`,
83
- name: "twitter:site"
84
- }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)("meta", {
85
- content: socTitle,
86
- name: "og:title"
87
- }), image ? /*#__PURE__*/(0, _jsxRuntime.jsx)("meta", {
88
- content: image,
89
- name: "og:image"
90
- }) : null, image ? /*#__PURE__*/(0, _jsxRuntime.jsx)("meta", {
91
- content: socTitle,
92
- name: "og:image:alt"
93
- }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)("meta", {
94
- content: socDesc,
95
- name: "og:description"
96
- }), siteName ? /*#__PURE__*/(0, _jsxRuntime.jsx)("meta", {
97
- content: siteName,
98
- name: "og:sitename"
99
- }) : null, url ? /*#__PURE__*/(0, _jsxRuntime.jsx)("meta", {
100
- content: url,
101
- name: "og:url"
102
- }) : null, extra]
103
- }), children ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Context.Provider, {
104
- value: context,
105
- children: children
106
- }) : null]
107
- });
108
- };
109
- MetaTags.Context = Context;
110
- var _default = exports.default = MetaTags;
111
- //# sourceMappingURL=MetaTags.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MetaTags.js","names":["_react","require","_reactHelmet","_jsxRuntime","Context","createContext","description","title","MetaTags","children","extraMetaTags","image","siteName","socialDescription","socialTitle","url","socTitle","socDesc","context","useMemo","extra","length","i","content","name","push","jsx","jsxs","Fragment","Helmet","Provider","value","_default","exports","default"],"sources":["../../../../src/shared/components/MetaTags.tsx"],"sourcesContent":["// TODO: Move this component to React Helmet library.\n\nimport {\n type Context as ContextT,\n type FunctionComponent,\n type ReactNode,\n createContext,\n useMemo,\n} from 'react';\n\nimport { Helmet } from '@dr.pogodin/react-helmet';\n\ntype PropsT = {\n children?: ReactNode;\n description: string;\n extraMetaTags?: Array<{\n content: string;\n name: string;\n }>;\n image?: string;\n siteName?: string;\n socialDescription?: string;\n socialTitle?: string;\n title: string;\n url?: string;\n};\n\nconst Context = createContext<PropsT>({\n description: '',\n title: '',\n});\n\n/**\n * Auxiliary wrapper around \"react-helmet\", which helps to inject meta tags\n * (page title, a brief content description, and social media thumbnails) into\n * generated pages.\n */\nconst MetaTags: FunctionComponent<PropsT> & {\n Context: ContextT<PropsT>;\n} = ({\n children,\n description,\n extraMetaTags,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n}) => {\n // NOTE: I guess, in this very case, we should prefer title and description\n // also to empty social title and decscription?\n /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */\n const socTitle = socialTitle || title;\n const socDesc = socialDescription || description;\n /* eslint-enable @typescript-eslint/prefer-nullish-coalescing */\n\n const context = useMemo(() => ({\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n }), [\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n ]);\n\n const extra: ReactNode[] = [];\n if (extraMetaTags?.length) {\n for (let i = 0; i < extraMetaTags.length; ++i) {\n const { content, name } = extraMetaTags[i]!;\n extra.push(\n <meta\n content={content}\n key={`extra-meta-tag-${i}`}\n name={name}\n />,\n );\n }\n }\n\n return (\n <>\n <Helmet>\n {/* General tags. */}\n <title>\n {title}\n </title>\n <meta content={description} name=\"description\" />\n\n {/* Twitter cards. */}\n <meta content=\"summary_large_image\" name=\"twitter:card\" />\n <meta content={socTitle} name=\"twitter:title\" />\n <meta content={socDesc} name=\"twitter:description\" />\n { image ? <meta content={image} name=\"twitter:image\" /> : null }\n {\n siteName\n ? <meta content={`@${siteName}`} name=\"twitter:site\" />\n : null\n }\n\n {/* Open Graph data. */}\n <meta content={socTitle} name=\"og:title\" />\n { image ? <meta content={image} name=\"og:image\" /> : null }\n { image ? <meta content={socTitle} name=\"og:image:alt\" /> : null }\n <meta content={socDesc} name=\"og:description\" />\n {\n siteName ? <meta content={siteName} name=\"og:sitename\" /> : null\n }\n { url ? <meta content={url} name=\"og:url\" /> : null }\n {extra}\n </Helmet>\n {\n children ? (\n <Context.Provider value={context}>\n {children}\n </Context.Provider>\n ) : null\n }\n </>\n );\n};\n\nMetaTags.Context = Context;\n\nexport default MetaTags;\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAQA,IAAAC,YAAA,GAAAD,OAAA;AAAkD,IAAAE,WAAA,GAAAF,OAAA;AAVlD;;AA2BA,MAAMG,OAAO,gBAAG,IAAAC,oBAAa,EAAS;EACpCC,WAAW,EAAE,EAAE;EACfC,KAAK,EAAE;AACT,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA,MAAMC,QAEL,GAAGA,CAAC;EACHC,QAAQ;EACRH,WAAW;EACXI,aAAa;EACbC,KAAK;EACLC,QAAQ;EACRC,iBAAiB;EACjBC,WAAW;EACXP,KAAK;EACLQ;AACF,CAAC,KAAK;EACJ;EACA;EACA;EACA,MAAMC,QAAQ,GAAGF,WAAW,IAAIP,KAAK;EACrC,MAAMU,OAAO,GAAGJ,iBAAiB,IAAIP,WAAW;EAChD;;EAEA,MAAMY,OAAO,GAAG,IAAAC,cAAO,EAAC,OAAO;IAC7Bb,WAAW;IACXK,KAAK;IACLC,QAAQ;IACRC,iBAAiB;IACjBC,WAAW;IACXP,KAAK;IACLQ;EACF,CAAC,CAAC,EAAE,CACFT,WAAW,EACXK,KAAK,EACLC,QAAQ,EACRC,iBAAiB,EACjBC,WAAW,EACXP,KAAK,EACLQ,GAAG,CACJ,CAAC;EAEF,MAAMK,KAAkB,GAAG,EAAE;EAC7B,IAAIV,aAAa,EAAEW,MAAM,EAAE;IACzB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGZ,aAAa,CAACW,MAAM,EAAE,EAAEC,CAAC,EAAE;MAC7C,MAAM;QAAEC,OAAO;QAAEC;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B,GAAA;QAAMH,OAAO,EAAEZ,KAAM;QAACa,IAAI,EAAC;MAAU,CAAE,CAAC,GAAG,IAAI,EACvDb,KAAK,gBAAG,IAAAR,WAAA,CAAAuB,GAAA;QAAMH,OAAO,EAAEP,QAAS;QAACQ,IAAI,EAAC;MAAc,CAAE,CAAC,GAAG,IAAI,eAChE,IAAArB,WAAA,CAAAuB,GAAA;QAAMH,OAAO,EAAEN,OAAQ;QAACO,IAAI,EAAC;MAAgB,CAAE,CAAC,EAE9CZ,QAAQ,gBAAG,IAAAT,WAAA,CAAAuB,GAAA;QAAMH,OAAO,EAAEX,QAAS;QAACY,IAAI,EAAC;MAAa,CAAE,CAAC,GAAG,IAAI,EAEhET,GAAG,gBAAG,IAAAZ,WAAA,CAAAuB,GAAA;QAAMH,OAAO,EAAER,GAAI;QAACS,IAAI,EAAC;MAAQ,CAAE,CAAC,GAAG,IAAI,EAClDJ,KAAK;IAAA,CACA,CAAC,EAEPX,QAAQ,gBACN,IAAAN,WAAA,CAAAuB,GAAA,EAACtB,OAAO,CAAC0B,QAAQ;MAACC,KAAK,EAAEb,OAAQ;MAAAT,QAAA,EAC9BA;IAAQ,CACO,CAAC,GACjB,IAAI;EAAA,CAEV,CAAC;AAEP,CAAC;AAEDD,QAAQ,CAACJ,OAAO,GAAGA,OAAO;AAAC,IAAA4B,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEZ1B,QAAQ","ignoreList":[]}
@@ -1,9 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _react=require("react");var _reactHelmet=require("@dr.pogodin/react-helmet");var _jsxRuntime=require("react/jsx-runtime");// TODO: Move this component to React Helmet library.
2
- const Context=/*#__PURE__*/(0,_react.createContext)({description:"",title:""});/**
3
- * Auxiliary wrapper around "react-helmet", which helps to inject meta tags
4
- * (page title, a brief content description, and social media thumbnails) into
5
- * generated pages.
6
- */const MetaTags=({children,description,extraMetaTags,image,siteName,socialDescription,socialTitle,title,url})=>{// NOTE: I guess, in this very case, we should prefer title and description
7
- // also to empty social title and decscription?
8
- /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */const socTitle=socialTitle||title;const socDesc=socialDescription||description;/* eslint-enable @typescript-eslint/prefer-nullish-coalescing */const context=(0,_react.useMemo)(()=>({description,image,siteName,socialDescription,socialTitle,title,url}),[description,image,siteName,socialDescription,socialTitle,title,url]);const extra=[];if(extraMetaTags?.length){for(let i=0;i<extraMetaTags.length;++i){const{content,name}=extraMetaTags[i];extra.push(/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{content:content,name:name},`extra-meta-tag-${i}`))}}return/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_reactHelmet.Helmet,{children:[/*#__PURE__*/(0,_jsxRuntime.jsx)("title",{children:title}),/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{content:description,name:"description"}),/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{content:"summary_large_image",name:"twitter:card"}),/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{content:socTitle,name:"twitter:title"}),/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{content:socDesc,name:"twitter:description"}),image?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{content:image,name:"twitter:image"}):null,siteName?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{content:`@${siteName}`,name:"twitter:site"}):null,/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{content:socTitle,name:"og:title"}),image?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{content:image,name:"og:image"}):null,image?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{content:socTitle,name:"og:image:alt"}):null,/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{content:socDesc,name:"og:description"}),siteName?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{content:siteName,name:"og:sitename"}):null,url?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{content:url,name:"og:url"}):null,extra]}),children?/*#__PURE__*/(0,_jsxRuntime.jsx)(Context.Provider,{value:context,children:children}):null]})};MetaTags.Context=Context;var _default=exports.default=MetaTags;
9
- //# sourceMappingURL=MetaTags.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MetaTags.js","names":["_react","require","_reactHelmet","_jsxRuntime","Context","createContext","description","title","MetaTags","children","extraMetaTags","image","siteName","socialDescription","socialTitle","url","socTitle","socDesc","context","useMemo","extra","length","i","content","name","push","jsx","jsxs","Fragment","Helmet","Provider","value","_default","exports","default"],"sources":["../../../../src/shared/components/MetaTags.tsx"],"sourcesContent":["// TODO: Move this component to React Helmet library.\n\nimport {\n type Context as ContextT,\n type FunctionComponent,\n type ReactNode,\n createContext,\n useMemo,\n} from 'react';\n\nimport { Helmet } from '@dr.pogodin/react-helmet';\n\ntype PropsT = {\n children?: ReactNode;\n description: string;\n extraMetaTags?: Array<{\n content: string;\n name: string;\n }>;\n image?: string;\n siteName?: string;\n socialDescription?: string;\n socialTitle?: string;\n title: string;\n url?: string;\n};\n\nconst Context = createContext<PropsT>({\n description: '',\n title: '',\n});\n\n/**\n * Auxiliary wrapper around \"react-helmet\", which helps to inject meta tags\n * (page title, a brief content description, and social media thumbnails) into\n * generated pages.\n */\nconst MetaTags: FunctionComponent<PropsT> & {\n Context: ContextT<PropsT>;\n} = ({\n children,\n description,\n extraMetaTags,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n}) => {\n // NOTE: I guess, in this very case, we should prefer title and description\n // also to empty social title and decscription?\n /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */\n const socTitle = socialTitle || title;\n const socDesc = socialDescription || description;\n /* eslint-enable @typescript-eslint/prefer-nullish-coalescing */\n\n const context = useMemo(() => ({\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n }), [\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n ]);\n\n const extra: ReactNode[] = [];\n if (extraMetaTags?.length) {\n for (let i = 0; i < extraMetaTags.length; ++i) {\n const { content, name } = extraMetaTags[i]!;\n extra.push(\n <meta\n content={content}\n key={`extra-meta-tag-${i}`}\n name={name}\n />,\n );\n }\n }\n\n return (\n <>\n <Helmet>\n {/* General tags. */}\n <title>\n {title}\n </title>\n <meta content={description} name=\"description\" />\n\n {/* Twitter cards. */}\n <meta content=\"summary_large_image\" name=\"twitter:card\" />\n <meta content={socTitle} name=\"twitter:title\" />\n <meta content={socDesc} name=\"twitter:description\" />\n { image ? <meta content={image} name=\"twitter:image\" /> : null }\n {\n siteName\n ? <meta content={`@${siteName}`} name=\"twitter:site\" />\n : null\n }\n\n {/* Open Graph data. */}\n <meta content={socTitle} name=\"og:title\" />\n { image ? <meta content={image} name=\"og:image\" /> : null }\n { image ? <meta content={socTitle} name=\"og:image:alt\" /> : null }\n <meta content={socDesc} name=\"og:description\" />\n {\n siteName ? <meta content={siteName} name=\"og:sitename\" /> : null\n }\n { url ? <meta content={url} name=\"og:url\" /> : null }\n {extra}\n </Helmet>\n {\n children ? (\n <Context.Provider value={context}>\n {children}\n </Context.Provider>\n ) : null\n }\n </>\n );\n};\n\nMetaTags.Context = Context;\n\nexport default MetaTags;\n"],"mappings":"6FAEA,IAAAA,MAAA,CAAAC,OAAA,UAQA,IAAAC,YAAA,CAAAD,OAAA,6BAAkD,IAAAE,WAAA,CAAAF,OAAA,sBAVlD;AA2BA,KAAM,CAAAG,OAAO,cAAG,GAAAC,oBAAa,EAAS,CACpCC,WAAW,CAAE,EAAE,CACfC,KAAK,CAAE,EACT,CAAC,CAAC,CAEF;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAC,QAEL,CAAGA,CAAC,CACHC,QAAQ,CACRH,WAAW,CACXI,aAAa,CACbC,KAAK,CACLC,QAAQ,CACRC,iBAAiB,CACjBC,WAAW,CACXP,KAAK,CACLQ,GACF,CAAC,GAAK,CACJ;AACA;AACA,iEACA,KAAM,CAAAC,QAAQ,CAAG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AAEb,OAAQ,CAAAT,QAAA,CAC9BA,QAAQ,CACO,CAAC,CACjB,IAAI,EAEV,CAEN,CAAC,CAEDD,QAAQ,CAACJ,OAAO,CAAGA,OAAO,CAAC,IAAA4B,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEZ1B,QAAQ","ignoreList":[]}
@@ -1,24 +0,0 @@
1
- import { type Context as ContextT, type FunctionComponent, type ReactNode } from 'react';
2
- type PropsT = {
3
- children?: ReactNode;
4
- description: string;
5
- extraMetaTags?: Array<{
6
- content: string;
7
- name: string;
8
- }>;
9
- image?: string;
10
- siteName?: string;
11
- socialDescription?: string;
12
- socialTitle?: string;
13
- title: string;
14
- url?: string;
15
- };
16
- /**
17
- * Auxiliary wrapper around "react-helmet", which helps to inject meta tags
18
- * (page title, a brief content description, and social media thumbnails) into
19
- * generated pages.
20
- */
21
- declare const MetaTags: FunctionComponent<PropsT> & {
22
- Context: ContextT<PropsT>;
23
- };
24
- export default MetaTags;
@@ -1,134 +0,0 @@
1
- // TODO: Move this component to React Helmet library.
2
-
3
- import {
4
- type Context as ContextT,
5
- type FunctionComponent,
6
- type ReactNode,
7
- createContext,
8
- useMemo,
9
- } from 'react';
10
-
11
- import { Helmet } from '@dr.pogodin/react-helmet';
12
-
13
- type PropsT = {
14
- children?: ReactNode;
15
- description: string;
16
- extraMetaTags?: Array<{
17
- content: string;
18
- name: string;
19
- }>;
20
- image?: string;
21
- siteName?: string;
22
- socialDescription?: string;
23
- socialTitle?: string;
24
- title: string;
25
- url?: string;
26
- };
27
-
28
- const Context = createContext<PropsT>({
29
- description: '',
30
- title: '',
31
- });
32
-
33
- /**
34
- * Auxiliary wrapper around "react-helmet", which helps to inject meta tags
35
- * (page title, a brief content description, and social media thumbnails) into
36
- * generated pages.
37
- */
38
- const MetaTags: FunctionComponent<PropsT> & {
39
- Context: ContextT<PropsT>;
40
- } = ({
41
- children,
42
- description,
43
- extraMetaTags,
44
- image,
45
- siteName,
46
- socialDescription,
47
- socialTitle,
48
- title,
49
- url,
50
- }) => {
51
- // NOTE: I guess, in this very case, we should prefer title and description
52
- // also to empty social title and decscription?
53
- /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
54
- const socTitle = socialTitle || title;
55
- const socDesc = socialDescription || description;
56
- /* eslint-enable @typescript-eslint/prefer-nullish-coalescing */
57
-
58
- const context = useMemo(() => ({
59
- description,
60
- image,
61
- siteName,
62
- socialDescription,
63
- socialTitle,
64
- title,
65
- url,
66
- }), [
67
- description,
68
- image,
69
- siteName,
70
- socialDescription,
71
- socialTitle,
72
- title,
73
- url,
74
- ]);
75
-
76
- const extra: ReactNode[] = [];
77
- if (extraMetaTags?.length) {
78
- for (let i = 0; i < extraMetaTags.length; ++i) {
79
- const { content, name } = extraMetaTags[i]!;
80
- extra.push(
81
- <meta
82
- content={content}
83
- key={`extra-meta-tag-${i}`}
84
- name={name}
85
- />,
86
- );
87
- }
88
- }
89
-
90
- return (
91
- <>
92
- <Helmet>
93
- {/* General tags. */}
94
- <title>
95
- {title}
96
- </title>
97
- <meta content={description} name="description" />
98
-
99
- {/* Twitter cards. */}
100
- <meta content="summary_large_image" name="twitter:card" />
101
- <meta content={socTitle} name="twitter:title" />
102
- <meta content={socDesc} name="twitter:description" />
103
- { image ? <meta content={image} name="twitter:image" /> : null }
104
- {
105
- siteName
106
- ? <meta content={`@${siteName}`} name="twitter:site" />
107
- : null
108
- }
109
-
110
- {/* Open Graph data. */}
111
- <meta content={socTitle} name="og:title" />
112
- { image ? <meta content={image} name="og:image" /> : null }
113
- { image ? <meta content={socTitle} name="og:image:alt" /> : null }
114
- <meta content={socDesc} name="og:description" />
115
- {
116
- siteName ? <meta content={siteName} name="og:sitename" /> : null
117
- }
118
- { url ? <meta content={url} name="og:url" /> : null }
119
- {extra}
120
- </Helmet>
121
- {
122
- children ? (
123
- <Context.Provider value={context}>
124
- {children}
125
- </Context.Provider>
126
- ) : null
127
- }
128
- </>
129
- );
130
- };
131
-
132
- MetaTags.Context = Context;
133
-
134
- export default MetaTags;