@bigbinary/neeto-seo-frontend 3.0.12 → 3.0.14
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/app/javascript/src/translations/hu.json +45 -0
- package/dist/.ready +1 -0
- package/dist/SeoSettingsPage.js +4 -3
- package/dist/SeoSettingsPage.js.map +1 -1
- package/dist/SeoSettingsPane.js +4 -37
- package/dist/SeoSettingsPane.js.map +1 -1
- package/dist/cjs/SeoSettingsPage.js +1 -0
- package/dist/cjs/SeoSettingsPage.js.map +1 -1
- package/dist/cjs/SeoSettingsPane.js +6 -39
- package/dist/cjs/SeoSettingsPane.js.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/v2/SeoSettingsPage.js +115 -0
- package/dist/cjs/v2/SeoSettingsPage.js.map +1 -0
- package/dist/cjs/v2/SeoSettingsPane.js +392 -0
- package/dist/cjs/v2/SeoSettingsPane.js.map +1 -0
- package/dist/cjs/v2/WelcomeScreen.js +15 -0
- package/dist/cjs/v2/WelcomeScreen.js.map +1 -0
- package/dist/cjs/v2/index.js +33 -0
- package/dist/cjs/v2/index.js.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/useSeoSettingsApi-BpSjL-Sq.js +41 -0
- package/dist/useSeoSettingsApi-BpSjL-Sq.js.map +1 -0
- package/dist/useSeoSettingsApi-CDihidUg.js +44 -0
- package/dist/useSeoSettingsApi-CDihidUg.js.map +1 -0
- package/dist/v2/SeoSettingsPage.js +113 -0
- package/dist/v2/SeoSettingsPage.js.map +1 -0
- package/dist/v2/SeoSettingsPane.js +371 -0
- package/dist/v2/SeoSettingsPane.js.map +1 -0
- package/dist/v2/WelcomeScreen.js +13 -0
- package/dist/v2/WelcomeScreen.js.map +1 -0
- package/dist/v2/index.js +26 -0
- package/dist/v2/index.js.map +1 -0
- package/package.json +41 -30
package/dist/index.js
CHANGED
|
@@ -15,6 +15,7 @@ import '@bigbinary/neetoui/Pane';
|
|
|
15
15
|
import '@bigbinary/neetoui/formik/Form';
|
|
16
16
|
import '@bigbinary/neetoui/formik/ActionBlock';
|
|
17
17
|
import 'ramda';
|
|
18
|
+
import './useSeoSettingsApi-BpSjL-Sq.js';
|
|
18
19
|
import '@babel/runtime/helpers/defineProperty';
|
|
19
20
|
import '@tanstack/react-query';
|
|
20
21
|
import '@bigbinary/neeto-commons-frontend/react-utils/useMutationWithInvalidation';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import { useQuery } from '@tanstack/react-query';
|
|
3
|
+
import useMutationWithInvalidation from '@bigbinary/neeto-commons-frontend/react-utils/useMutationWithInvalidation';
|
|
4
|
+
import axios from 'axios';
|
|
5
|
+
|
|
6
|
+
var fetch = function fetch(url) {
|
|
7
|
+
return axios.get(url);
|
|
8
|
+
};
|
|
9
|
+
var update = function update(_ref) {
|
|
10
|
+
var url = _ref.url,
|
|
11
|
+
payload = _ref.payload;
|
|
12
|
+
return axios.patch(url, payload);
|
|
13
|
+
};
|
|
14
|
+
var seoSettingsApi = {
|
|
15
|
+
fetch: fetch,
|
|
16
|
+
update: update
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
var SEO_SETTINGS_QUERY_KEY = "seo-settings";
|
|
20
|
+
|
|
21
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
|
+
var useFetchSeoSettings = function useFetchSeoSettings(params) {
|
|
24
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
25
|
+
return useQuery(_objectSpread({
|
|
26
|
+
queryKey: [SEO_SETTINGS_QUERY_KEY, params],
|
|
27
|
+
queryFn: function queryFn() {
|
|
28
|
+
return seoSettingsApi.fetch(params);
|
|
29
|
+
},
|
|
30
|
+
enabled: !!params
|
|
31
|
+
}, options));
|
|
32
|
+
};
|
|
33
|
+
var useUpdateSeoSettings = function useUpdateSeoSettings(url) {
|
|
34
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
35
|
+
return useMutationWithInvalidation(seoSettingsApi.update, _objectSpread(_objectSpread({}, options), {}, {
|
|
36
|
+
keysToInvalidate: [[SEO_SETTINGS_QUERY_KEY, url]]
|
|
37
|
+
}));
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { useUpdateSeoSettings as a, useFetchSeoSettings as u };
|
|
41
|
+
//# sourceMappingURL=useSeoSettingsApi-BpSjL-Sq.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSeoSettingsApi-BpSjL-Sq.js","sources":["../app/javascript/src/apis/seo_settings.js","../app/javascript/src/hooks/reactQuery/constants.js","../app/javascript/src/hooks/reactQuery/useSeoSettingsApi.js"],"sourcesContent":["import axios from \"axios\";\n\nconst fetch = url => axios.get(url);\n\nconst update = ({ url, payload }) => axios.patch(url, payload);\n\nconst seoSettingsApi = { fetch, update };\n\nexport default seoSettingsApi;\n","export const SEO_SETTINGS_QUERY_KEY = \"seo-settings\";\n","import { useQuery } from \"@tanstack/react-query\";\nimport useMutationWithInvalidation from \"neetocommons/react-utils/useMutationWithInvalidation\";\n\nimport seoSettingsApi from \"apis/seo_settings\";\n\nimport { SEO_SETTINGS_QUERY_KEY } from \"./constants\";\n\nconst useFetchSeoSettings = (params, options = {}) =>\n useQuery({\n queryKey: [SEO_SETTINGS_QUERY_KEY, params],\n queryFn: () => seoSettingsApi.fetch(params),\n enabled: !!params,\n ...options,\n });\n\nconst useUpdateSeoSettings = (url, options = {}) =>\n useMutationWithInvalidation(seoSettingsApi.update, {\n ...options,\n keysToInvalidate: [[SEO_SETTINGS_QUERY_KEY, url]],\n });\n\nexport { useFetchSeoSettings, useUpdateSeoSettings };\n"],"names":["fetch","url","axios","get","update","_ref","payload","patch","seoSettingsApi","SEO_SETTINGS_QUERY_KEY","useFetchSeoSettings","params","options","arguments","length","undefined","useQuery","_objectSpread","queryKey","queryFn","enabled","useUpdateSeoSettings","useMutationWithInvalidation","keysToInvalidate"],"mappings":";;;;;AAEA,IAAMA,KAAK,GAAG,SAARA,KAAKA,CAAGC,GAAG,EAAA;AAAA,EAAA,OAAIC,KAAK,CAACC,GAAG,CAACF,GAAG,CAAC;AAAA,CAAA;AAEnC,IAAMG,MAAM,GAAG,SAATA,MAAMA,CAAAC,IAAA,EAAA;AAAA,EAAA,IAAMJ,GAAG,GAAAI,IAAA,CAAHJ,GAAG;IAAEK,OAAO,GAAAD,IAAA,CAAPC,OAAO;AAAA,EAAA,OAAOJ,KAAK,CAACK,KAAK,CAACN,GAAG,EAAEK,OAAO,CAAC;AAAA,CAAA;AAE9D,IAAME,cAAc,GAAG;AAAER,EAAAA,KAAK,EAALA,KAAK;AAAEI,EAAAA,MAAM,EAANA;AAAO,CAAC;;ACNjC,IAAMK,sBAAsB,GAAG,cAAc;;;;ACOpD,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIC,MAAM,EAAA;AAAA,EAAA,IAAEC,OAAO,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,EAAE;EAAA,OAC/CG,QAAQ,CAAAC,aAAA,CAAA;AACNC,IAAAA,QAAQ,EAAE,CAACT,sBAAsB,EAAEE,MAAM,CAAC;IAC1CQ,OAAO,EAAE,SAATA,OAAOA,GAAA;AAAA,MAAA,OAAQX,cAAc,CAACR,KAAK,CAACW,MAAM,CAAC;AAAA,IAAA,CAAA;IAC3CS,OAAO,EAAE,CAAC,CAACT;GAAM,EACdC,OAAO,CACX,CAAC;AAAA;AAEJ,IAAMS,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAIpB,GAAG,EAAA;AAAA,EAAA,IAAEW,OAAO,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,EAAE;EAAA,OAC7CS,2BAA2B,CAACd,cAAc,CAACJ,MAAM,EAAAa,aAAA,CAAAA,aAAA,CAAA,EAAA,EAC5CL,OAAO,CAAA,EAAA,EAAA,EAAA;AACVW,IAAAA,gBAAgB,EAAE,CAAC,CAACd,sBAAsB,EAAER,GAAG,CAAC;AAAC,GAAA,CAClD,CAAC;AAAA;;;;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
|
+
var reactQuery = require('@tanstack/react-query');
|
|
5
|
+
var useMutationWithInvalidation = require('@bigbinary/neeto-commons-frontend/react-utils/useMutationWithInvalidation');
|
|
6
|
+
var axios = require('axios');
|
|
7
|
+
|
|
8
|
+
var fetch = function fetch(url) {
|
|
9
|
+
return axios.get(url);
|
|
10
|
+
};
|
|
11
|
+
var update = function update(_ref) {
|
|
12
|
+
var url = _ref.url,
|
|
13
|
+
payload = _ref.payload;
|
|
14
|
+
return axios.patch(url, payload);
|
|
15
|
+
};
|
|
16
|
+
var seoSettingsApi = {
|
|
17
|
+
fetch: fetch,
|
|
18
|
+
update: update
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
var SEO_SETTINGS_QUERY_KEY = "seo-settings";
|
|
22
|
+
|
|
23
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
24
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
25
|
+
var useFetchSeoSettings = function useFetchSeoSettings(params) {
|
|
26
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
27
|
+
return reactQuery.useQuery(_objectSpread({
|
|
28
|
+
queryKey: [SEO_SETTINGS_QUERY_KEY, params],
|
|
29
|
+
queryFn: function queryFn() {
|
|
30
|
+
return seoSettingsApi.fetch(params);
|
|
31
|
+
},
|
|
32
|
+
enabled: !!params
|
|
33
|
+
}, options));
|
|
34
|
+
};
|
|
35
|
+
var useUpdateSeoSettings = function useUpdateSeoSettings(url) {
|
|
36
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
37
|
+
return useMutationWithInvalidation(seoSettingsApi.update, _objectSpread(_objectSpread({}, options), {}, {
|
|
38
|
+
keysToInvalidate: [[SEO_SETTINGS_QUERY_KEY, url]]
|
|
39
|
+
}));
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
exports.useFetchSeoSettings = useFetchSeoSettings;
|
|
43
|
+
exports.useUpdateSeoSettings = useUpdateSeoSettings;
|
|
44
|
+
//# sourceMappingURL=useSeoSettingsApi-CDihidUg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSeoSettingsApi-CDihidUg.js","sources":["../app/javascript/src/apis/seo_settings.js","../app/javascript/src/hooks/reactQuery/constants.js","../app/javascript/src/hooks/reactQuery/useSeoSettingsApi.js"],"sourcesContent":["import axios from \"axios\";\n\nconst fetch = url => axios.get(url);\n\nconst update = ({ url, payload }) => axios.patch(url, payload);\n\nconst seoSettingsApi = { fetch, update };\n\nexport default seoSettingsApi;\n","export const SEO_SETTINGS_QUERY_KEY = \"seo-settings\";\n","import { useQuery } from \"@tanstack/react-query\";\nimport useMutationWithInvalidation from \"neetocommons/react-utils/useMutationWithInvalidation\";\n\nimport seoSettingsApi from \"apis/seo_settings\";\n\nimport { SEO_SETTINGS_QUERY_KEY } from \"./constants\";\n\nconst useFetchSeoSettings = (params, options = {}) =>\n useQuery({\n queryKey: [SEO_SETTINGS_QUERY_KEY, params],\n queryFn: () => seoSettingsApi.fetch(params),\n enabled: !!params,\n ...options,\n });\n\nconst useUpdateSeoSettings = (url, options = {}) =>\n useMutationWithInvalidation(seoSettingsApi.update, {\n ...options,\n keysToInvalidate: [[SEO_SETTINGS_QUERY_KEY, url]],\n });\n\nexport { useFetchSeoSettings, useUpdateSeoSettings };\n"],"names":["fetch","url","axios","get","update","_ref","payload","patch","seoSettingsApi","SEO_SETTINGS_QUERY_KEY","useFetchSeoSettings","params","options","arguments","length","undefined","useQuery","_objectSpread","queryKey","queryFn","enabled","useUpdateSeoSettings","useMutationWithInvalidation","keysToInvalidate"],"mappings":";;;;;;;AAEA,IAAMA,KAAK,GAAG,SAARA,KAAKA,CAAGC,GAAG,EAAA;AAAA,EAAA,OAAIC,KAAK,CAACC,GAAG,CAACF,GAAG,CAAC;AAAA,CAA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BAAgB,EAAE,CAAC,CAACd,sBAAsB,EAAER,GAAG,CAAC;AAAC,GAAA,CAClD,CAAC;AAAA;;;;;"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import { memo, useState } from 'react';
|
|
3
|
+
import { Typography, Button } from '@bigbinary/neeto-atoms';
|
|
4
|
+
import CardLayout from '@bigbinary/neeto-molecules/v2/CardLayout';
|
|
5
|
+
import Container from '@bigbinary/neeto-molecules/v2/Container';
|
|
6
|
+
import { useTranslation, Trans } from 'react-i18next';
|
|
7
|
+
import { withT } from '@bigbinary/neeto-commons-frontend/v2/react-utils';
|
|
8
|
+
import NeetoHeader from '@bigbinary/neeto-molecules/v2/Header';
|
|
9
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
|
+
import Pane from './SeoSettingsPane.js';
|
|
11
|
+
import '@bigbinary/neeto-atoms/formik';
|
|
12
|
+
import '@bigbinary/neeto-molecules/v2/PageLoader';
|
|
13
|
+
import 'ramda';
|
|
14
|
+
import '../useSeoSettingsApi-BpSjL-Sq.js';
|
|
15
|
+
import '@babel/runtime/helpers/defineProperty';
|
|
16
|
+
import '@tanstack/react-query';
|
|
17
|
+
import '@bigbinary/neeto-commons-frontend/react-utils/useMutationWithInvalidation';
|
|
18
|
+
import 'axios';
|
|
19
|
+
import 'i18next';
|
|
20
|
+
import 'yup';
|
|
21
|
+
import '@bigbinary/neeto-image-uploader-frontend/ImageUploader';
|
|
22
|
+
import 'formik';
|
|
23
|
+
import '@bigbinary/neeto-molecules/v2/HelpPopover';
|
|
24
|
+
import '@bigbinary/neeto-cist';
|
|
25
|
+
|
|
26
|
+
var Header$1 = withT(function (_ref) {
|
|
27
|
+
var t = _ref.t,
|
|
28
|
+
breadcrumbs = _ref.breadcrumbs,
|
|
29
|
+
helpDocUrl = _ref.helpDocUrl,
|
|
30
|
+
_ref$helpPopoverDescr = _ref.helpPopoverDescription,
|
|
31
|
+
helpPopoverDescription = _ref$helpPopoverDescr === void 0 ? "" : _ref$helpPopoverDescr;
|
|
32
|
+
return /*#__PURE__*/jsx(NeetoHeader, {
|
|
33
|
+
breadcrumbs: breadcrumbs,
|
|
34
|
+
size: "small",
|
|
35
|
+
title: t("neetoSeo.title"),
|
|
36
|
+
titleHelpPopoverProps: {
|
|
37
|
+
title: t("neetoSeo.title"),
|
|
38
|
+
description: helpPopoverDescription || t("neetoSeo.helpPopovers.seo"),
|
|
39
|
+
helpLinkProps: {
|
|
40
|
+
href: helpDocUrl
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
var Header = /*#__PURE__*/memo(Header$1);
|
|
46
|
+
|
|
47
|
+
var Page = function Page(_ref) {
|
|
48
|
+
var breadcrumbs = _ref.breadcrumbs,
|
|
49
|
+
helpDocUrl = _ref.helpDocUrl,
|
|
50
|
+
entity = _ref.entity,
|
|
51
|
+
seoFormFields = _ref.seoFormFields,
|
|
52
|
+
apiEndpointUrl = _ref.apiEndpointUrl,
|
|
53
|
+
_ref$helpPopoverDescr = _ref.helpPopoverDescription,
|
|
54
|
+
helpPopoverDescription = _ref$helpPopoverDescr === void 0 ? "" : _ref$helpPopoverDescr,
|
|
55
|
+
_ref$additionalCompon = _ref.additionalComponent,
|
|
56
|
+
additionalComponent = _ref$additionalCompon === void 0 ? null : _ref$additionalCompon;
|
|
57
|
+
var _useTranslation = useTranslation(),
|
|
58
|
+
t = _useTranslation.t;
|
|
59
|
+
var _useState = useState(false),
|
|
60
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
61
|
+
isPaneOpen = _useState2[0],
|
|
62
|
+
setIsPaneOpen = _useState2[1];
|
|
63
|
+
var openPane = function openPane() {
|
|
64
|
+
return setIsPaneOpen(true);
|
|
65
|
+
};
|
|
66
|
+
var closePane = function closePane() {
|
|
67
|
+
return setIsPaneOpen(false);
|
|
68
|
+
};
|
|
69
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
70
|
+
children: [/*#__PURE__*/jsxs(Container, {
|
|
71
|
+
children: [/*#__PURE__*/jsx(Header, {
|
|
72
|
+
breadcrumbs: breadcrumbs,
|
|
73
|
+
helpDocUrl: helpDocUrl,
|
|
74
|
+
helpPopoverDescription: helpPopoverDescription
|
|
75
|
+
}), /*#__PURE__*/jsx(CardLayout, {
|
|
76
|
+
title: t("neetoSeo.manageSeoSettings"),
|
|
77
|
+
actionBlock: /*#__PURE__*/jsx(Button, {
|
|
78
|
+
"data-testid": "neeto-seo-configure-button",
|
|
79
|
+
label: t("neetoSeo.buttons.configure"),
|
|
80
|
+
onClick: openPane
|
|
81
|
+
}),
|
|
82
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
83
|
+
"data-testid": "neeto-seo-help-text",
|
|
84
|
+
variant: "body1",
|
|
85
|
+
children: /*#__PURE__*/jsx(Trans, {
|
|
86
|
+
i18nKey: "neetoSeo.readHelpArticle",
|
|
87
|
+
components: {
|
|
88
|
+
Link: /*#__PURE__*/jsx(Button, {
|
|
89
|
+
"data-testid": "neeto-seo-read-help-article-button",
|
|
90
|
+
href: helpDocUrl,
|
|
91
|
+
rel: "noreferrer",
|
|
92
|
+
size: "lg",
|
|
93
|
+
target: "_blank",
|
|
94
|
+
variant: "link"
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
})]
|
|
100
|
+
}), /*#__PURE__*/jsx(Pane, {
|
|
101
|
+
additionalComponent: additionalComponent,
|
|
102
|
+
apiEndpointUrl: apiEndpointUrl,
|
|
103
|
+
entity: entity,
|
|
104
|
+
seoFormFields: seoFormFields,
|
|
105
|
+
defaultHelpDocUrl: helpDocUrl,
|
|
106
|
+
isOpen: isPaneOpen,
|
|
107
|
+
onClose: closePane
|
|
108
|
+
})]
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export { Page as default };
|
|
113
|
+
//# sourceMappingURL=SeoSettingsPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SeoSettingsPage.js","sources":["../../app/javascript/src/v2/components/SeoSettings/Header.jsx","../../app/javascript/src/v2/components/SeoSettings/Page.jsx"],"sourcesContent":["import { memo } from \"react\";\n\nimport { withT } from \"neetocommons/v2/react-utils\";\nimport NeetoHeader from \"neetomolecules/v2/Header\";\n\nconst Header = withT(\n ({ t, breadcrumbs, helpDocUrl, helpPopoverDescription = \"\" }) => (\n <NeetoHeader\n {...{ breadcrumbs }}\n size=\"small\"\n title={t(\"neetoSeo.title\")}\n titleHelpPopoverProps={{\n title: t(\"neetoSeo.title\"),\n description: helpPopoverDescription || t(\"neetoSeo.helpPopovers.seo\"),\n helpLinkProps: { href: helpDocUrl },\n }}\n />\n )\n);\n\nexport default memo(Header);\n","import { useState } from \"react\";\n\nimport { Typography, Button } from \"@bigbinary/neeto-atoms\";\nimport CardLayout from \"neetomolecules/v2/CardLayout\";\nimport Container from \"neetomolecules/v2/Container\";\nimport { useTranslation, Trans } from \"react-i18next\";\n\nimport Header from \"./Header\";\nimport Pane from \"./Pane\";\n\nconst Page = ({\n breadcrumbs,\n helpDocUrl,\n entity,\n seoFormFields,\n apiEndpointUrl,\n helpPopoverDescription = \"\",\n additionalComponent = null,\n}) => {\n const { t } = useTranslation();\n\n const [isPaneOpen, setIsPaneOpen] = useState(false);\n\n const openPane = () => setIsPaneOpen(true);\n const closePane = () => setIsPaneOpen(false);\n\n return (\n <>\n <Container>\n <Header {...{ breadcrumbs, helpDocUrl, helpPopoverDescription }} />\n <CardLayout\n title={t(\"neetoSeo.manageSeoSettings\")}\n actionBlock={\n <Button\n data-testid=\"neeto-seo-configure-button\"\n label={t(\"neetoSeo.buttons.configure\")}\n onClick={openPane}\n />\n }\n >\n <Typography data-testid=\"neeto-seo-help-text\" variant=\"body1\">\n <Trans\n i18nKey=\"neetoSeo.readHelpArticle\"\n components={{\n Link: (\n <Button\n data-testid=\"neeto-seo-read-help-article-button\"\n href={helpDocUrl}\n rel=\"noreferrer\"\n size=\"lg\"\n target=\"_blank\"\n variant=\"link\"\n />\n ),\n }}\n />\n </Typography>\n </CardLayout>\n </Container>\n <Pane\n {...{ additionalComponent, apiEndpointUrl, entity, seoFormFields }}\n defaultHelpDocUrl={helpDocUrl}\n isOpen={isPaneOpen}\n onClose={closePane}\n />\n </>\n );\n};\n\nexport default Page;\n"],"names":["Header","withT","_ref","t","breadcrumbs","helpDocUrl","_ref$helpPopoverDescr","helpPopoverDescription","_jsx","NeetoHeader","size","title","titleHelpPopoverProps","description","helpLinkProps","href","memo","Page","entity","seoFormFields","apiEndpointUrl","_ref$additionalCompon","additionalComponent","_useTranslation","useTranslation","_useState","useState","_useState2","_slicedToArray","isPaneOpen","setIsPaneOpen","openPane","closePane","_jsxs","_Fragment","children","Container","CardLayout","actionBlock","Button","label","onClick","Typography","variant","Trans","i18nKey","components","Link","rel","target","Pane","defaultHelpDocUrl","isOpen","onClose"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAMA,QAAM,GAAGC,KAAK,CAClB,UAAAC,IAAA,EAAA;AAAA,EAAA,IAAGC,CAAC,GAAAD,IAAA,CAADC,CAAC;IAAEC,WAAW,GAAAF,IAAA,CAAXE,WAAW;IAAEC,UAAU,GAAAH,IAAA,CAAVG,UAAU;IAAAC,qBAAA,GAAAJ,IAAA,CAAEK,sBAAsB;AAAtBA,IAAAA,sBAAsB,GAAAD,qBAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,qBAAA;EAAA,oBACxDE,GAAA,CAACC,WAAW,EAAA;AACJL,IAAAA,WAAW,EAAXA,WAAW;AACjBM,IAAAA,IAAI,EAAC,OAAO;AACZC,IAAAA,KAAK,EAAER,CAAC,CAAC,gBAAgB,CAAE;AAC3BS,IAAAA,qBAAqB,EAAE;AACrBD,MAAAA,KAAK,EAAER,CAAC,CAAC,gBAAgB,CAAC;AAC1BU,MAAAA,WAAW,EAAEN,sBAAsB,IA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9C,UAAW;AAC9B+C,MAAAA,MAAM,EAAEvB,UAAW;AACnBwB,MAAAA,OAAO,EAAErB;AAAU,KACpB,CAAC;AAAA,GACF,CAAC;AAEP;;;;"}
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { Label, Sheet, Typography } from '@bigbinary/neeto-atoms';
|
|
3
|
+
import { Switch as Switch$1, Input as Input$1, Textarea as Textarea$1, Form, ActionBlock } from '@bigbinary/neeto-atoms/formik';
|
|
4
|
+
import PageLoader from '@bigbinary/neeto-molecules/v2/PageLoader';
|
|
5
|
+
import { trim, omit } from 'ramda';
|
|
6
|
+
import { useTranslation } from 'react-i18next';
|
|
7
|
+
import { u as useFetchSeoSettings, a as useUpdateSeoSettings } from '../useSeoSettingsApi-BpSjL-Sq.js';
|
|
8
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
9
|
+
import i18next from 'i18next';
|
|
10
|
+
import * as yup from 'yup';
|
|
11
|
+
import ImageUploader from '@bigbinary/neeto-image-uploader-frontend/ImageUploader';
|
|
12
|
+
import { useFormikContext } from 'formik';
|
|
13
|
+
import HelpPopover from '@bigbinary/neeto-molecules/v2/HelpPopover';
|
|
14
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
15
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
16
|
+
import { withT } from '@bigbinary/neeto-commons-frontend/v2/react-utils';
|
|
17
|
+
import { isNot } from '@bigbinary/neeto-cist';
|
|
18
|
+
import '@tanstack/react-query';
|
|
19
|
+
import '@bigbinary/neeto-commons-frontend/react-utils/useMutationWithInvalidation';
|
|
20
|
+
import 'axios';
|
|
21
|
+
|
|
22
|
+
var CoverImage = function CoverImage(_ref) {
|
|
23
|
+
var popOverDescription = _ref.popOverDescription,
|
|
24
|
+
helpDocUrl = _ref.helpDocUrl,
|
|
25
|
+
defaultHelpDocUrl = _ref.defaultHelpDocUrl;
|
|
26
|
+
var _useTranslation = useTranslation(),
|
|
27
|
+
t = _useTranslation.t;
|
|
28
|
+
var _useFormikContext = useFormikContext(),
|
|
29
|
+
values = _useFormikContext.values,
|
|
30
|
+
setFieldValue = _useFormikContext.setFieldValue;
|
|
31
|
+
var onImageUploadComplete = function onImageUploadComplete(_ref2) {
|
|
32
|
+
var signedId = _ref2.signedId,
|
|
33
|
+
url = _ref2.url;
|
|
34
|
+
setFieldValue("coverImage", signedId);
|
|
35
|
+
setFieldValue("coverImageUrl", url);
|
|
36
|
+
};
|
|
37
|
+
return /*#__PURE__*/jsxs("div", {
|
|
38
|
+
className: "space-y-2",
|
|
39
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
40
|
+
className: "flex items-center space-x-2",
|
|
41
|
+
children: [/*#__PURE__*/jsx(Label, {
|
|
42
|
+
children: t("neetoSeo.labels.coverImage")
|
|
43
|
+
}), /*#__PURE__*/jsx(HelpPopover, {
|
|
44
|
+
helpLinkProps: {
|
|
45
|
+
href: helpDocUrl || defaultHelpDocUrl
|
|
46
|
+
},
|
|
47
|
+
description: popOverDescription || t("neetoSeo.helpPopovers.coverImage")
|
|
48
|
+
})]
|
|
49
|
+
}), /*#__PURE__*/jsx(ImageUploader, {
|
|
50
|
+
className: "h-56",
|
|
51
|
+
defaultImageSize: {
|
|
52
|
+
width: 1200,
|
|
53
|
+
height: 628
|
|
54
|
+
},
|
|
55
|
+
fixedAspectRatio: {
|
|
56
|
+
width: 1.91,
|
|
57
|
+
height: 1
|
|
58
|
+
},
|
|
59
|
+
src: values.coverImageUrl,
|
|
60
|
+
onUploadComplete: onImageUploadComplete
|
|
61
|
+
})]
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
var GoogleAnalyticsTracking = function GoogleAnalyticsTracking(_ref) {
|
|
66
|
+
var helpDocUrl = _ref.helpDocUrl,
|
|
67
|
+
popOverDescription = _ref.popOverDescription,
|
|
68
|
+
entity = _ref.entity,
|
|
69
|
+
defaultHelpDocUrl = _ref.defaultHelpDocUrl,
|
|
70
|
+
seoSetting = _ref.seoSetting;
|
|
71
|
+
var _useTranslation = useTranslation(),
|
|
72
|
+
t = _useTranslation.t;
|
|
73
|
+
var _useState = useState(!!(seoSetting !== null && seoSetting !== void 0 && seoSetting.googleAnalyticsTrackingId)),
|
|
74
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
75
|
+
googleAnalyticsEnabled = _useState2[0],
|
|
76
|
+
setGoogleAnalyticsEnabled = _useState2[1];
|
|
77
|
+
var _useFormikContext = useFormikContext(),
|
|
78
|
+
setFieldValue = _useFormikContext.setFieldValue;
|
|
79
|
+
var handleSwitchChange = function handleSwitchChange() {
|
|
80
|
+
setGoogleAnalyticsEnabled(!googleAnalyticsEnabled);
|
|
81
|
+
setFieldValue("googleAnalyticsEnabled", !googleAnalyticsEnabled);
|
|
82
|
+
setFieldValue("googleAnalyticsTrackingId", "");
|
|
83
|
+
};
|
|
84
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
85
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
86
|
+
className: "flex items-center space-x-2",
|
|
87
|
+
children: [/*#__PURE__*/jsx(Switch$1, {
|
|
88
|
+
checked: googleAnalyticsEnabled,
|
|
89
|
+
label: t("neetoSeo.labels.googleAnalytics"),
|
|
90
|
+
name: "googleAnalyticsEnabled",
|
|
91
|
+
onChange: handleSwitchChange
|
|
92
|
+
}), /*#__PURE__*/jsx(HelpPopover, {
|
|
93
|
+
helpLinkProps: {
|
|
94
|
+
href: helpDocUrl || defaultHelpDocUrl
|
|
95
|
+
},
|
|
96
|
+
description: popOverDescription || t("neetoSeo.helpPopovers.googleAnalytics", {
|
|
97
|
+
entity: entity
|
|
98
|
+
})
|
|
99
|
+
})]
|
|
100
|
+
}), googleAnalyticsEnabled && /*#__PURE__*/jsx(Input$1, {
|
|
101
|
+
className: "mt-4",
|
|
102
|
+
name: "googleAnalyticsTrackingId",
|
|
103
|
+
placeholder: t("neetoSeo.placeholders.googleAnalyticsTrackingId")
|
|
104
|
+
})]
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
var Input = withT(function (_ref) {
|
|
109
|
+
var t = _ref.t,
|
|
110
|
+
name = _ref.name,
|
|
111
|
+
helpDocUrl = _ref.helpDocUrl,
|
|
112
|
+
popOverDescription = _ref.popOverDescription,
|
|
113
|
+
entity = _ref.entity,
|
|
114
|
+
defaultHelpDocUrl = _ref.defaultHelpDocUrl,
|
|
115
|
+
altLabel = _ref.altLabel,
|
|
116
|
+
altPlaceholder = _ref.altPlaceholder,
|
|
117
|
+
maxLength = _ref.maxLength;
|
|
118
|
+
return /*#__PURE__*/jsx(Input$1, {
|
|
119
|
+
name: name,
|
|
120
|
+
label: altLabel || t("neetoSeo.labels.".concat(name), {
|
|
121
|
+
entity: entity
|
|
122
|
+
}),
|
|
123
|
+
maxLength: maxLength || 160,
|
|
124
|
+
unlimitedChars: false,
|
|
125
|
+
labelProps: {
|
|
126
|
+
helpIconProps: {
|
|
127
|
+
"data-testid": "help-popover-button",
|
|
128
|
+
popoverProps: {
|
|
129
|
+
description: popOverDescription || t("neetoSeo.helpPopovers.".concat(name)),
|
|
130
|
+
helpLinkProps: {
|
|
131
|
+
label: t("neetoSeo.labels.viewHelpArticle"),
|
|
132
|
+
href: helpDocUrl || defaultHelpDocUrl
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
placeholder: altPlaceholder || t("neetoSeo.placeholders.".concat(name), {
|
|
138
|
+
entity: entity
|
|
139
|
+
})
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
var Switch = withT(function (_ref) {
|
|
144
|
+
var t = _ref.t,
|
|
145
|
+
name = _ref.name,
|
|
146
|
+
entity = _ref.entity,
|
|
147
|
+
altLabel = _ref.altLabel,
|
|
148
|
+
helpDocUrl = _ref.helpDocUrl,
|
|
149
|
+
defaultHelpDocUrl = _ref.defaultHelpDocUrl,
|
|
150
|
+
popOverDescription = _ref.popOverDescription;
|
|
151
|
+
return /*#__PURE__*/jsxs("div", {
|
|
152
|
+
className: "flex items-center space-x-2",
|
|
153
|
+
children: [/*#__PURE__*/jsx(Switch$1, {
|
|
154
|
+
name: name,
|
|
155
|
+
label: altLabel || t("neetoSeo.labels.".concat(name), {
|
|
156
|
+
entity: entity
|
|
157
|
+
})
|
|
158
|
+
}), /*#__PURE__*/jsx(HelpPopover, {
|
|
159
|
+
helpLinkProps: {
|
|
160
|
+
href: helpDocUrl || defaultHelpDocUrl
|
|
161
|
+
},
|
|
162
|
+
description: popOverDescription || t("neetoSeo.helpPopovers.allowSearchEngineCrawl")
|
|
163
|
+
})]
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
var populateKeywords = function populateKeywords(keywords) {
|
|
168
|
+
return keywords === null || keywords === void 0 ? void 0 : keywords.map(function (keyword) {
|
|
169
|
+
return keyword === null || keyword === void 0 ? void 0 : keyword.trim();
|
|
170
|
+
}).join(", ");
|
|
171
|
+
};
|
|
172
|
+
var extractKeywords = function extractKeywords(stringOfKeywords) {
|
|
173
|
+
return stringOfKeywords === null || stringOfKeywords === void 0 ? void 0 : stringOfKeywords.split(",").map(trim).filter(isNot(""));
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
var Textarea = function Textarea(_ref) {
|
|
177
|
+
var name = _ref.name,
|
|
178
|
+
helpDocUrl = _ref.helpDocUrl,
|
|
179
|
+
popOverDescription = _ref.popOverDescription,
|
|
180
|
+
entity = _ref.entity,
|
|
181
|
+
defaultHelpDocUrl = _ref.defaultHelpDocUrl,
|
|
182
|
+
altLabel = _ref.altLabel,
|
|
183
|
+
altPlaceholder = _ref.altPlaceholder,
|
|
184
|
+
maxLength = _ref.maxLength,
|
|
185
|
+
seoSetting = _ref.seoSetting;
|
|
186
|
+
var _useTranslation = useTranslation(),
|
|
187
|
+
t = _useTranslation.t;
|
|
188
|
+
var _useState = useState(populateKeywords(seoSetting.keywords)),
|
|
189
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
190
|
+
keywordString = _useState2[0],
|
|
191
|
+
setKeywordString = _useState2[1];
|
|
192
|
+
var _useFormikContext = useFormikContext(),
|
|
193
|
+
setFieldValue = _useFormikContext.setFieldValue,
|
|
194
|
+
values = _useFormikContext.values;
|
|
195
|
+
var handleChangeKeyword = function handleChangeKeyword(event) {
|
|
196
|
+
var string = event.target.value;
|
|
197
|
+
setKeywordString(string);
|
|
198
|
+
if (name === SEO_FIELDS.KEYWORDS) {
|
|
199
|
+
var newKeywords = extractKeywords(string);
|
|
200
|
+
setFieldValue(name, newKeywords);
|
|
201
|
+
} else {
|
|
202
|
+
setFieldValue(name, string);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
206
|
+
children: [/*#__PURE__*/jsx(Textarea$1, {
|
|
207
|
+
name: name,
|
|
208
|
+
label: altLabel || t("neetoSeo.labels.".concat(name)),
|
|
209
|
+
maxLength: maxLength || 150,
|
|
210
|
+
placeholder: altPlaceholder || t("neetoSeo.placeholders.".concat(name)),
|
|
211
|
+
value: name === SEO_FIELDS.KEYWORDS ? keywordString : values[name],
|
|
212
|
+
labelProps: {
|
|
213
|
+
helpIconProps: {
|
|
214
|
+
"data-testid": "help-popover-button",
|
|
215
|
+
popoverProps: {
|
|
216
|
+
description: popOverDescription || t("neetoSeo.helpPopovers.".concat(name), {
|
|
217
|
+
entity: entity
|
|
218
|
+
}),
|
|
219
|
+
helpLinkProps: {
|
|
220
|
+
label: t("neetoSeo.labels.viewHelpArticle"),
|
|
221
|
+
href: helpDocUrl || defaultHelpDocUrl
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
onChange: handleChangeKeyword
|
|
227
|
+
}), name === SEO_FIELDS.KEYWORDS && /*#__PURE__*/jsx("span", {
|
|
228
|
+
className: "text-muted-foreground text-xs leading-tight",
|
|
229
|
+
children: t("neetoSeo.subLabels.keywords")
|
|
230
|
+
})]
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
var GOOGLE_ANALYTICS_TRACKING_ID_REGEX = /^((UA|YT|MO)-\d+-\d+)$|^(G-[a-zA-Z0-9]+)$/i;
|
|
235
|
+
var SEO_FIELDS = {
|
|
236
|
+
TITLE: "title",
|
|
237
|
+
TITLE_SUFFIX: "titleSuffix",
|
|
238
|
+
DESCRIPTION: "description",
|
|
239
|
+
KEYWORDS: "keywords",
|
|
240
|
+
ALLOW_SEARCH_ENGINE_CRAWL: "allowSearchEngineCrawl",
|
|
241
|
+
GOOGLE_ANALYTICS_TRACKING_ID: "googleAnalyticsTrackingId",
|
|
242
|
+
COVER_IMAGE: "coverImage"
|
|
243
|
+
};
|
|
244
|
+
var SEO_FIELDS_COMPONENT = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, SEO_FIELDS.TITLE, Input), SEO_FIELDS.TITLE_SUFFIX, Input), SEO_FIELDS.DESCRIPTION, Textarea), SEO_FIELDS.KEYWORDS, Textarea), SEO_FIELDS.ALLOW_SEARCH_ENGINE_CRAWL, Switch), SEO_FIELDS.GOOGLE_ANALYTICS_TRACKING_ID, GoogleAnalyticsTracking), SEO_FIELDS.COVER_IMAGE, CoverImage);
|
|
245
|
+
var SEO_SETTINGS_INITIAL_VALUES = {
|
|
246
|
+
title: "",
|
|
247
|
+
titleSuffix: "",
|
|
248
|
+
description: "",
|
|
249
|
+
keywords: [],
|
|
250
|
+
allowSearchEngineCrawl: false,
|
|
251
|
+
googleAnalyticsTrackingId: ""
|
|
252
|
+
};
|
|
253
|
+
var SEO_SETTINGS_VALIDATION_SCHEMA = yup.object().shape({
|
|
254
|
+
googleAnalyticsTrackingId: yup.string().when("googleAnalyticsEnabled", {
|
|
255
|
+
is: true,
|
|
256
|
+
then: yup.string().trim().required(i18next.t("neetoSeo.validations.required", {
|
|
257
|
+
what: i18next.t("neetoSeo.labels.googleAnalyticsTrackingId")
|
|
258
|
+
})).matches(GOOGLE_ANALYTICS_TRACKING_ID_REGEX, i18next.t("neetoSeo.validations.valid", {
|
|
259
|
+
what: i18next.t("neetoSeo.labels.googleAnalyticsTrackingId")
|
|
260
|
+
})),
|
|
261
|
+
otherwise: yup.string().nullable()
|
|
262
|
+
})
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
var Pane = function Pane(_ref) {
|
|
266
|
+
var apiEndpointUrl = _ref.apiEndpointUrl,
|
|
267
|
+
isOpen = _ref.isOpen,
|
|
268
|
+
onClose = _ref.onClose,
|
|
269
|
+
entity = _ref.entity,
|
|
270
|
+
defaultHelpDocUrl = _ref.defaultHelpDocUrl,
|
|
271
|
+
seoFormFields = _ref.seoFormFields,
|
|
272
|
+
_ref$additionalCompon = _ref.additionalComponent,
|
|
273
|
+
additionalComponent = _ref$additionalCompon === void 0 ? null : _ref$additionalCompon;
|
|
274
|
+
var _useTranslation = useTranslation(),
|
|
275
|
+
t = _useTranslation.t;
|
|
276
|
+
var _useFetchSeoSettings = useFetchSeoSettings(apiEndpointUrl, {
|
|
277
|
+
enabled: isOpen
|
|
278
|
+
}),
|
|
279
|
+
_useFetchSeoSettings$ = _useFetchSeoSettings.data,
|
|
280
|
+
seoSetting = _useFetchSeoSettings$ === void 0 ? {} : _useFetchSeoSettings$,
|
|
281
|
+
isLoading = _useFetchSeoSettings.isLoading,
|
|
282
|
+
refetch = _useFetchSeoSettings.refetch;
|
|
283
|
+
useEffect(function () {
|
|
284
|
+
if (isOpen) {
|
|
285
|
+
refetch();
|
|
286
|
+
}
|
|
287
|
+
}, [isOpen, refetch]);
|
|
288
|
+
var _useUpdateSeoSettings = useUpdateSeoSettings(apiEndpointUrl, {
|
|
289
|
+
onSuccess: onClose
|
|
290
|
+
}),
|
|
291
|
+
updateSeoSettings = _useUpdateSeoSettings.mutate;
|
|
292
|
+
var handleSubmit = function handleSubmit(values) {
|
|
293
|
+
var payload = omit(["googleAnalyticsEnabled"], values);
|
|
294
|
+
updateSeoSettings({
|
|
295
|
+
url: apiEndpointUrl,
|
|
296
|
+
payload: payload
|
|
297
|
+
});
|
|
298
|
+
};
|
|
299
|
+
if (isLoading) {
|
|
300
|
+
return /*#__PURE__*/jsx(Sheet, {
|
|
301
|
+
isOpen: isOpen,
|
|
302
|
+
onClose: onClose,
|
|
303
|
+
children: /*#__PURE__*/jsx("div", {
|
|
304
|
+
className: "flex h-screen w-full items-center justify-center",
|
|
305
|
+
children: /*#__PURE__*/jsx(PageLoader, {})
|
|
306
|
+
})
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
return /*#__PURE__*/jsxs(Sheet, {
|
|
310
|
+
isOpen: isOpen,
|
|
311
|
+
onClose: onClose,
|
|
312
|
+
children: [/*#__PURE__*/jsx(Sheet.Header, {
|
|
313
|
+
className: "space-y-2",
|
|
314
|
+
children: /*#__PURE__*/jsx(Sheet.Title, {
|
|
315
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
316
|
+
variant: "h2",
|
|
317
|
+
children: t("neetoSeo.title")
|
|
318
|
+
})
|
|
319
|
+
})
|
|
320
|
+
}), /*#__PURE__*/jsxs(Form, {
|
|
321
|
+
className: "w-full",
|
|
322
|
+
formikProps: {
|
|
323
|
+
enableReinitialize: true,
|
|
324
|
+
initialValues: seoSetting || SEO_SETTINGS_INITIAL_VALUES,
|
|
325
|
+
validationSchema: SEO_SETTINGS_VALIDATION_SCHEMA,
|
|
326
|
+
onSubmit: handleSubmit
|
|
327
|
+
},
|
|
328
|
+
children: [/*#__PURE__*/jsxs(Sheet.Body, {
|
|
329
|
+
className: "pb-6",
|
|
330
|
+
children: [seoFormFields.map(function (_ref2) {
|
|
331
|
+
var name = _ref2.name,
|
|
332
|
+
helpDocUrl = _ref2.helpDocUrl,
|
|
333
|
+
popOverDescription = _ref2.popOverDescription,
|
|
334
|
+
altLabel = _ref2.altLabel,
|
|
335
|
+
altPlaceholder = _ref2.altPlaceholder,
|
|
336
|
+
maxLength = _ref2.maxLength;
|
|
337
|
+
var FieldComponent = SEO_FIELDS_COMPONENT[name];
|
|
338
|
+
if (!FieldComponent) {
|
|
339
|
+
return null;
|
|
340
|
+
}
|
|
341
|
+
return /*#__PURE__*/jsx("div", {
|
|
342
|
+
className: "mt-4 w-full",
|
|
343
|
+
children: /*#__PURE__*/jsx(FieldComponent, {
|
|
344
|
+
altLabel: altLabel,
|
|
345
|
+
altPlaceholder: altPlaceholder,
|
|
346
|
+
defaultHelpDocUrl: defaultHelpDocUrl,
|
|
347
|
+
entity: entity,
|
|
348
|
+
helpDocUrl: helpDocUrl,
|
|
349
|
+
maxLength: maxLength,
|
|
350
|
+
name: name,
|
|
351
|
+
popOverDescription: popOverDescription,
|
|
352
|
+
seoSetting: seoSetting
|
|
353
|
+
})
|
|
354
|
+
}, name);
|
|
355
|
+
}), /*#__PURE__*/jsx("div", {
|
|
356
|
+
className: "mt-4 w-full",
|
|
357
|
+
children: additionalComponent
|
|
358
|
+
})]
|
|
359
|
+
}), /*#__PURE__*/jsx(Sheet.Footer, {
|
|
360
|
+
children: /*#__PURE__*/jsx(ActionBlock, {
|
|
361
|
+
cancelButtonProps: {
|
|
362
|
+
onClick: onClose
|
|
363
|
+
}
|
|
364
|
+
})
|
|
365
|
+
})]
|
|
366
|
+
})]
|
|
367
|
+
});
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
export { Pane as default };
|
|
371
|
+
//# sourceMappingURL=SeoSettingsPane.js.map
|