@griddo/ax 12.2.0 → 12.2.1
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/package.json +2 -2
- package/src/api/pages.tsx +16 -0
- package/src/components/Button/style.tsx +1 -1
- package/src/components/Fields/TranslateButton/index.tsx +76 -47
- package/src/containers/Forms/actions.tsx +2 -11
- package/src/containers/Forms/constants.tsx +0 -2
- package/src/containers/Forms/interfaces.tsx +6 -11
- package/src/containers/Forms/reducer.tsx +5 -8
- package/src/containers/PageEditor/actions.tsx +17 -13
- package/src/containers/PageEditor/constants.tsx +0 -1
- package/src/containers/PageEditor/interfaces.tsx +0 -6
- package/src/containers/PageEditor/reducer.tsx +0 -4
- package/src/containers/StructuredData/actions.tsx +38 -56
- package/src/containers/StructuredData/constants.tsx +0 -2
- package/src/containers/StructuredData/interfaces.tsx +16 -22
- package/src/containers/StructuredData/reducer.tsx +13 -16
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/ax",
|
|
3
3
|
"description": "Griddo Author Experience",
|
|
4
|
-
"version": "12.2.
|
|
4
|
+
"version": "12.2.1",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Diego M. Béjar <diego.bejar@secuoyas.com>",
|
|
@@ -219,5 +219,5 @@
|
|
|
219
219
|
"publishConfig": {
|
|
220
220
|
"access": "public"
|
|
221
221
|
},
|
|
222
|
-
"gitHead": "
|
|
222
|
+
"gitHead": "43786b57fe71e7e408adeb31da3405d7bfcac5fd"
|
|
223
223
|
}
|
package/src/api/pages.tsx
CHANGED
|
@@ -99,6 +99,11 @@ const SERVICES: { [key: string]: IServiceConfig } = {
|
|
|
99
99
|
endpoint: "/translations/page/",
|
|
100
100
|
method: "POST",
|
|
101
101
|
},
|
|
102
|
+
PAGE_AI_RETRANSLATION: {
|
|
103
|
+
...template,
|
|
104
|
+
endpoint: ["/translations/page/", "/retranslate"],
|
|
105
|
+
method: "POST",
|
|
106
|
+
},
|
|
102
107
|
SET_PAGE_ACCESS_GRANTS: {
|
|
103
108
|
...template,
|
|
104
109
|
endpoint: ["/site/", "/pages/", "/access-grant"],
|
|
@@ -285,6 +290,16 @@ const getPageTranslation = async (data: any, langID: number) => {
|
|
|
285
290
|
return sendRequest(SERVICES.PAGE_AI_TRANSLATION, { ...data });
|
|
286
291
|
};
|
|
287
292
|
|
|
293
|
+
const getPageRetranslation = async (pageID: number) => {
|
|
294
|
+
const {
|
|
295
|
+
host,
|
|
296
|
+
endpoint: [prefix, suffix],
|
|
297
|
+
} = SERVICES.PAGE_AI_RETRANSLATION;
|
|
298
|
+
SERVICES.PAGE_AI_RETRANSLATION.dynamicUrl = `${host}${prefix}${pageID}${suffix}`;
|
|
299
|
+
|
|
300
|
+
return sendRequest(SERVICES.PAGE_AI_RETRANSLATION);
|
|
301
|
+
};
|
|
302
|
+
|
|
288
303
|
const setPageAccessGrants = async (data: {
|
|
289
304
|
siteID: number | "global";
|
|
290
305
|
pageID: number;
|
|
@@ -321,5 +336,6 @@ export default {
|
|
|
321
336
|
pageCheck,
|
|
322
337
|
getPageSummary,
|
|
323
338
|
getPageTranslation,
|
|
339
|
+
getPageRetranslation,
|
|
324
340
|
setPageAccessGrants,
|
|
325
341
|
};
|
|
@@ -100,7 +100,7 @@ const TextButton = styled((props) => <Button {...props} />)`
|
|
|
100
100
|
`;
|
|
101
101
|
|
|
102
102
|
const LineButton = styled((props) => <Button {...props} />)<{ isInverse: boolean | undefined }>`
|
|
103
|
-
background-color: ${(p) => (p.isInverse ? p.theme.color.uiMainMenuBackground :
|
|
103
|
+
background-color: ${(p) => (p.isInverse ? p.theme.color.uiMainMenuBackground : "transparent")};
|
|
104
104
|
border: 1px solid ${(p) => (p.isInverse ? p.theme.color.interactiveInverse : p.theme.color.interactive01)};
|
|
105
105
|
color: ${(p) => (p.isInverse ? p.theme.color.interactiveInverse : p.theme.color.interactive01)};
|
|
106
106
|
:hover:before {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useState } from "react";
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
|
|
4
|
+
import { Modal } from "@ax/components";
|
|
5
|
+
import { formsActions } from "@ax/containers/Forms";
|
|
6
6
|
import { pageEditorActions } from "@ax/containers/PageEditor";
|
|
7
7
|
import { structuredDataActions } from "@ax/containers/StructuredData";
|
|
8
|
-
import {
|
|
8
|
+
import { useModals } from "@ax/hooks";
|
|
9
|
+
import type { FormContent, IRootState } from "@ax/types";
|
|
9
10
|
|
|
10
11
|
import * as S from "./style";
|
|
11
12
|
|
|
@@ -15,17 +16,12 @@ const TranslateButton = (props: ITranslateButtonProps): JSX.Element => {
|
|
|
15
16
|
autoTranslation,
|
|
16
17
|
contentType,
|
|
17
18
|
getPageTranslation,
|
|
19
|
+
getPageRetranslation,
|
|
18
20
|
editorContent,
|
|
19
|
-
isPageIATranslated,
|
|
20
|
-
isDataContentIATranslated,
|
|
21
|
-
setIsPageTranslated,
|
|
22
21
|
structuredDataForm,
|
|
23
22
|
getDataContentTranslation,
|
|
24
|
-
setIsContentTranslated,
|
|
25
23
|
formContent,
|
|
26
|
-
isFormIATranslated,
|
|
27
24
|
getFormTranslation,
|
|
28
|
-
setIsFormTranslated,
|
|
29
25
|
disabled,
|
|
30
26
|
} = props;
|
|
31
27
|
|
|
@@ -33,26 +29,23 @@ const TranslateButton = (props: ITranslateButtonProps): JSX.Element => {
|
|
|
33
29
|
return {
|
|
34
30
|
page: {
|
|
35
31
|
content: editorContent,
|
|
36
|
-
isIATranslated: isPageIATranslated,
|
|
37
32
|
getTranslationAction: getPageTranslation,
|
|
38
|
-
|
|
33
|
+
getRetranslationAction: getPageRetranslation,
|
|
39
34
|
},
|
|
40
35
|
data: {
|
|
41
36
|
content: structuredDataForm,
|
|
42
|
-
isIATranslated: isDataContentIATranslated,
|
|
43
37
|
getTranslationAction: getDataContentTranslation,
|
|
44
|
-
setIsTranslated: setIsContentTranslated,
|
|
45
38
|
},
|
|
46
39
|
form: {
|
|
47
40
|
content: formContent,
|
|
48
|
-
isIATranslated: isFormIATranslated,
|
|
49
41
|
getTranslationAction: getFormTranslation,
|
|
50
|
-
setIsTranslated: setIsFormTranslated,
|
|
51
42
|
},
|
|
52
43
|
}[type];
|
|
53
44
|
};
|
|
54
45
|
|
|
55
|
-
const { content,
|
|
46
|
+
const { content, getTranslationAction, getRetranslationAction } = getContent(contentType);
|
|
47
|
+
|
|
48
|
+
const isOriginal = content?.originalLanguage === lang;
|
|
56
49
|
|
|
57
50
|
const initialState = {
|
|
58
51
|
isLoading: false,
|
|
@@ -60,10 +53,10 @@ const TranslateButton = (props: ITranslateButtonProps): JSX.Element => {
|
|
|
60
53
|
};
|
|
61
54
|
|
|
62
55
|
const [state, setState] = useState(initialState);
|
|
63
|
-
const { isOpen, toggleModal } =
|
|
56
|
+
const { isOpen, toggleModal } = useModals(["translate", "update"]);
|
|
64
57
|
|
|
65
58
|
const handleClick = async () => {
|
|
66
|
-
toggleModal();
|
|
59
|
+
isOpen("translate") && toggleModal("translate");
|
|
67
60
|
setState((state) => ({ ...state, isLoading: true, error: false }));
|
|
68
61
|
const generated = await getTranslationAction(lang);
|
|
69
62
|
setState((state) => ({ ...state, isLoading: false }));
|
|
@@ -72,21 +65,66 @@ const TranslateButton = (props: ITranslateButtonProps): JSX.Element => {
|
|
|
72
65
|
}
|
|
73
66
|
};
|
|
74
67
|
|
|
75
|
-
const
|
|
68
|
+
const handleUpdateClick = async () => {
|
|
69
|
+
isOpen("update") && toggleModal("update");
|
|
70
|
+
setState((state) => ({ ...state, isLoading: true, error: false }));
|
|
71
|
+
const generated = (!!content.id && (await getRetranslationAction?.(content.id))) || false;
|
|
72
|
+
setState((state) => ({ ...state, isLoading: false }));
|
|
73
|
+
if (!generated) {
|
|
74
|
+
setState((state) => ({ ...state, error: true }));
|
|
75
|
+
}
|
|
76
|
+
};
|
|
76
77
|
|
|
77
|
-
const buttonText = state.isLoading ? "Processing..." : "Translate page with AI";
|
|
78
|
+
const buttonText = state.error ? "Try againg" : state.isLoading ? "Processing..." : "Translate page with AI";
|
|
79
|
+
const updateButtonText = state.error
|
|
80
|
+
? "Try againg"
|
|
81
|
+
: state.isLoading
|
|
82
|
+
? "Processing..."
|
|
83
|
+
: "Update translation with AI";
|
|
78
84
|
|
|
79
85
|
return (
|
|
80
86
|
<>
|
|
81
|
-
{
|
|
82
|
-
|
|
83
|
-
<S.
|
|
84
|
-
<S.Text>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
</S.
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
{autoTranslation && !content?.canBeTranslated && !isOriginal && (
|
|
88
|
+
<>
|
|
89
|
+
<S.Wrapper data-testid="update-translation-button-wrapper" isSmall={!!structuredDataForm}>
|
|
90
|
+
<S.Text>
|
|
91
|
+
This page has <strong>already been translated</strong>. You can update it with the latest changes from the
|
|
92
|
+
source language.
|
|
93
|
+
</S.Text>
|
|
94
|
+
<S.ButtonWrapper>
|
|
95
|
+
<S.StyledButton
|
|
96
|
+
type="button"
|
|
97
|
+
onClick={() => toggleModal("update")}
|
|
98
|
+
icon={!state.isLoading ? "Ia" : undefined}
|
|
99
|
+
loader={state.isLoading ? "circle" : undefined}
|
|
100
|
+
disabled={disabled}
|
|
101
|
+
buttonStyle="line"
|
|
102
|
+
>
|
|
103
|
+
{updateButtonText}
|
|
104
|
+
</S.StyledButton>
|
|
105
|
+
</S.ButtonWrapper>
|
|
106
|
+
{state.error && (
|
|
107
|
+
<S.ErrorText>
|
|
108
|
+
The translation could not be completed. Your previous content has been preserved.
|
|
109
|
+
</S.ErrorText>
|
|
110
|
+
)}
|
|
111
|
+
</S.Wrapper>
|
|
112
|
+
<Modal
|
|
113
|
+
isOpen={isOpen("update")}
|
|
114
|
+
hide={() => toggleModal("update")}
|
|
115
|
+
size="S"
|
|
116
|
+
title="Update translation page with AI"
|
|
117
|
+
mainAction={{ title: "Update translation with AI", icon: "Ia", onClick: handleUpdateClick }}
|
|
118
|
+
secondaryAction={{ title: "Cancel", onClick: () => toggleModal("update") }}
|
|
119
|
+
height="auto"
|
|
120
|
+
>
|
|
121
|
+
<S.ModalContent>
|
|
122
|
+
This page <strong>already has a translation</strong>. Updating it{" "}
|
|
123
|
+
<strong>will replace all existing text in this language</strong>, including any manual edits made after
|
|
124
|
+
the previous translation. This action cannot be undone.
|
|
125
|
+
</S.ModalContent>
|
|
126
|
+
</Modal>
|
|
127
|
+
</>
|
|
90
128
|
)}
|
|
91
129
|
{autoTranslation && content?.canBeTranslated ? (
|
|
92
130
|
<>
|
|
@@ -97,7 +135,7 @@ const TranslateButton = (props: ITranslateButtonProps): JSX.Element => {
|
|
|
97
135
|
<S.ButtonWrapper>
|
|
98
136
|
<S.StyledButton
|
|
99
137
|
type="button"
|
|
100
|
-
onClick={toggleModal}
|
|
138
|
+
onClick={() => toggleModal("translate")}
|
|
101
139
|
icon={!state.isLoading ? "Ia" : undefined}
|
|
102
140
|
loader={state.isLoading ? "circle" : undefined}
|
|
103
141
|
disabled={disabled}
|
|
@@ -108,12 +146,13 @@ const TranslateButton = (props: ITranslateButtonProps): JSX.Element => {
|
|
|
108
146
|
{state.error && <S.ErrorText>We're having problems. Please try again in a few minutes.</S.ErrorText>}
|
|
109
147
|
</S.Wrapper>
|
|
110
148
|
<Modal
|
|
111
|
-
isOpen={isOpen}
|
|
112
|
-
hide={toggleModal}
|
|
149
|
+
isOpen={isOpen("translate")}
|
|
150
|
+
hide={() => toggleModal("translate")}
|
|
113
151
|
size="S"
|
|
114
152
|
title="Translate page with AI"
|
|
115
153
|
mainAction={{ title: "Translate with AI", icon: "Ia", onClick: handleClick }}
|
|
116
|
-
secondaryAction={{ title: "Cancel", onClick: toggleModal }}
|
|
154
|
+
secondaryAction={{ title: "Cancel", onClick: () => toggleModal("translate") }}
|
|
155
|
+
height="auto"
|
|
117
156
|
>
|
|
118
157
|
<S.ModalContent>
|
|
119
158
|
The automatic translation <strong>will replace all the text on the page</strong>. Before proceeding, make
|
|
@@ -133,37 +172,27 @@ export interface ITranslateButtonProps {
|
|
|
133
172
|
autoTranslation: boolean;
|
|
134
173
|
editorContent: any;
|
|
135
174
|
structuredDataForm: any | null;
|
|
136
|
-
isPageIATranslated: boolean;
|
|
137
|
-
isDataContentIATranslated: boolean;
|
|
138
|
-
isFormIATranslated: boolean;
|
|
139
175
|
contentType: "page" | "data" | "form";
|
|
140
176
|
formContent: FormContent | null;
|
|
141
177
|
disabled: boolean;
|
|
142
178
|
getPageTranslation: (langID: number) => Promise<boolean>;
|
|
179
|
+
getPageRetranslation: (pageID: number) => Promise<boolean>;
|
|
143
180
|
getDataContentTranslation: (langID: number) => Promise<boolean>;
|
|
144
181
|
getFormTranslation: (langID: number) => Promise<boolean>;
|
|
145
|
-
setIsPageTranslated: (isTranslated: boolean) => Promise<void>;
|
|
146
|
-
setIsContentTranslated: (isTranslated: boolean) => Promise<void>;
|
|
147
|
-
setIsFormTranslated: (isTranslated: boolean) => void;
|
|
148
182
|
}
|
|
149
183
|
|
|
150
184
|
const mapDispatchToProps = {
|
|
151
185
|
getPageTranslation: pageEditorActions.getPageTranslation,
|
|
152
|
-
|
|
186
|
+
getPageRetranslation: pageEditorActions.getPageRetranslation,
|
|
153
187
|
getDataContentTranslation: structuredDataActions.getDataContentTranslation,
|
|
154
|
-
setIsContentTranslated: structuredDataActions.setIsTranslated,
|
|
155
188
|
getFormTranslation: formsActions.getFormTranslation,
|
|
156
|
-
setIsFormTranslated: formsActions.setIsIATranslated,
|
|
157
189
|
};
|
|
158
190
|
|
|
159
191
|
const mapStateToProps = (state: IRootState) => ({
|
|
160
192
|
autoTranslation: state.app.globalSettings.autoTranslation,
|
|
161
193
|
editorContent: state.pageEditor.editorContent,
|
|
162
|
-
isPageIATranslated: state.pageEditor.isIATranslated,
|
|
163
|
-
isDataContentIATranslated: state.structuredData.isIATranslated,
|
|
164
194
|
structuredDataForm: state.structuredData.form,
|
|
165
195
|
formContent: state.forms.formContent,
|
|
166
|
-
isFormIATranslated: state.forms.isIATranslated,
|
|
167
196
|
});
|
|
168
197
|
|
|
169
198
|
export default connect(mapStateToProps, mapDispatchToProps)(TranslateButton);
|
|
@@ -45,7 +45,6 @@ import {
|
|
|
45
45
|
SET_CURRENT_FORM_ID,
|
|
46
46
|
SET_FORM_CONTENT,
|
|
47
47
|
SET_FORMS,
|
|
48
|
-
SET_IS_IA_TRANSLATED,
|
|
49
48
|
SET_IS_NEW_TRANSLATION,
|
|
50
49
|
SET_SCHEMA,
|
|
51
50
|
SET_SELECTED_CONTENT,
|
|
@@ -62,7 +61,6 @@ import type {
|
|
|
62
61
|
ISetCurrentFormID,
|
|
63
62
|
ISetFormContent,
|
|
64
63
|
ISetForms,
|
|
65
|
-
ISetIsIATranslated,
|
|
66
64
|
ISetIsNewTranslation,
|
|
67
65
|
ISetSchema,
|
|
68
66
|
ISetSelectedContent,
|
|
@@ -140,10 +138,6 @@ function setIsNewTranslation(isNewTranslation: boolean): ISetIsNewTranslation {
|
|
|
140
138
|
return { type: SET_IS_NEW_TRANSLATION, payload: { isNewTranslation } };
|
|
141
139
|
}
|
|
142
140
|
|
|
143
|
-
function setIsIATranslated(isIATranslated: boolean): ISetIsIATranslated {
|
|
144
|
-
return { type: SET_IS_IA_TRANSLATED, payload: { isIATranslated } };
|
|
145
|
-
}
|
|
146
|
-
|
|
147
141
|
function getForms(
|
|
148
142
|
siteID: number | null,
|
|
149
143
|
params?: GetFormsParams,
|
|
@@ -199,7 +193,6 @@ function getForm(formID: number | null): (dispatch: Dispatch, getState: () => IR
|
|
|
199
193
|
}
|
|
200
194
|
generateFormContent(formData)(dispatch, getState);
|
|
201
195
|
dispatch(setCurrentFormID(response.data.id));
|
|
202
|
-
dispatch(setIsIATranslated(false));
|
|
203
196
|
}
|
|
204
197
|
} else {
|
|
205
198
|
generateNewForm()(dispatch, getState);
|
|
@@ -242,7 +235,7 @@ function generateFormContent(
|
|
|
242
235
|
} = getState();
|
|
243
236
|
|
|
244
237
|
const { pageContent } = generateEditorIDs({ ...formContent });
|
|
245
|
-
pageContent
|
|
238
|
+
pageContent.site = currentSiteInfo ? currentSiteInfo.id : null;
|
|
246
239
|
const { element: selectedContent, parent: selectedParent } = findByEditorID(pageContent, selectedEditorID);
|
|
247
240
|
const { component } = selectedContent;
|
|
248
241
|
const schema = getSchema(component);
|
|
@@ -857,9 +850,8 @@ function getFormTranslation(langID: number): (dispatch: Dispatch, getState: () =
|
|
|
857
850
|
|
|
858
851
|
const responseActions = {
|
|
859
852
|
handleSuccess: (data: FormContent) => {
|
|
860
|
-
data
|
|
853
|
+
data.canBeTranslated = false;
|
|
861
854
|
generateFormContent(data)(dispatch, getState);
|
|
862
|
-
dispatch(setIsIATranslated(true));
|
|
863
855
|
},
|
|
864
856
|
handleError: (response: any) => appActions.handleError(response)(dispatch),
|
|
865
857
|
};
|
|
@@ -938,7 +930,6 @@ export {
|
|
|
938
930
|
updateFormState,
|
|
939
931
|
createNewTranslation,
|
|
940
932
|
getFormTranslation,
|
|
941
|
-
setIsIATranslated,
|
|
942
933
|
duplicateForm,
|
|
943
934
|
copyForm,
|
|
944
935
|
};
|
|
@@ -14,7 +14,6 @@ const SET_COPY_MODULE = `${NAME}/SET_COPY_MODULE`;
|
|
|
14
14
|
const SET_SUMMARY = `${NAME}/SET_SUMMARY`;
|
|
15
15
|
const SET_CURRENT_FORM_CATEGORIES = `${NAME}/SET_CURRENT_FORM_CATEGORIES`;
|
|
16
16
|
const SET_IS_NEW_TRANSLATION = `${NAME}/SET_IS_NEW_TRANSLATION`;
|
|
17
|
-
const SET_IS_IA_TRANSLATED = `${NAME}/SET_IS_IA_TRANSLATED`;
|
|
18
17
|
|
|
19
18
|
const ITEMS_PER_PAGE = 50;
|
|
20
19
|
|
|
@@ -42,5 +41,4 @@ export {
|
|
|
42
41
|
DEFAULT_PARAMS,
|
|
43
42
|
SET_CURRENT_FORM_CATEGORIES,
|
|
44
43
|
SET_IS_NEW_TRANSLATION,
|
|
45
|
-
SET_IS_IA_TRANSLATED,
|
|
46
44
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { FormCategory, FormContent, IBreadcrumbItem, IModule, ISchema } from "@ax/types";
|
|
2
|
-
|
|
1
|
+
import type { FormCategory, FormContent, IBreadcrumbItem, IModule, ISchema } from "@ax/types";
|
|
2
|
+
|
|
3
|
+
import type {
|
|
3
4
|
SET_BREADCRUMB,
|
|
4
5
|
SET_COPY_MODULE,
|
|
6
|
+
SET_CURRENT_FORM_CATEGORIES,
|
|
5
7
|
SET_CURRENT_FORM_ID,
|
|
6
8
|
SET_FORM_CONTENT,
|
|
7
9
|
SET_FORMS,
|
|
10
|
+
SET_IS_NEW_TRANSLATION,
|
|
8
11
|
SET_SCHEMA,
|
|
9
12
|
SET_SELECTED_CONTENT,
|
|
10
13
|
SET_SELECTED_EDITOR_ID,
|
|
11
14
|
SET_SELECTED_PARENT,
|
|
15
|
+
SET_SUMMARY,
|
|
12
16
|
SET_TAB,
|
|
13
17
|
SET_TEMPLATE,
|
|
14
|
-
SET_SUMMARY,
|
|
15
|
-
SET_CURRENT_FORM_CATEGORIES,
|
|
16
|
-
SET_IS_NEW_TRANSLATION,
|
|
17
|
-
SET_IS_IA_TRANSLATED,
|
|
18
18
|
} from "./constants";
|
|
19
19
|
|
|
20
20
|
export interface ISetForms {
|
|
@@ -87,9 +87,4 @@ export interface ISetIsNewTranslation {
|
|
|
87
87
|
payload: { isNewTranslation: boolean };
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
export interface ISetIsIATranslated {
|
|
91
|
-
type: typeof SET_IS_IA_TRANSLATED;
|
|
92
|
-
payload: { isIATranslated: boolean };
|
|
93
|
-
}
|
|
94
|
-
|
|
95
90
|
export type FormsActionsCreators = ISetForms;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { FormCategory, FormContent, IBreadcrumbItem, IModule, ISchema } from "@ax/types";
|
|
1
|
+
import type { FormCategory, FormContent, IBreadcrumbItem, IModule, ISchema } from "@ax/types";
|
|
2
|
+
|
|
2
3
|
import {
|
|
3
4
|
SET_BREADCRUMB,
|
|
4
5
|
SET_COPY_MODULE,
|
|
6
|
+
SET_CURRENT_FORM_CATEGORIES,
|
|
5
7
|
SET_CURRENT_FORM_ID,
|
|
6
8
|
SET_FORM_CONTENT,
|
|
7
9
|
SET_FORMS,
|
|
10
|
+
SET_IS_NEW_TRANSLATION,
|
|
8
11
|
SET_SCHEMA,
|
|
9
12
|
SET_SELECTED_CONTENT,
|
|
10
13
|
SET_SELECTED_EDITOR_ID,
|
|
11
14
|
SET_SELECTED_PARENT,
|
|
15
|
+
SET_SUMMARY,
|
|
12
16
|
SET_TAB,
|
|
13
17
|
SET_TEMPLATE,
|
|
14
|
-
SET_SUMMARY,
|
|
15
|
-
SET_CURRENT_FORM_CATEGORIES,
|
|
16
|
-
SET_IS_NEW_TRANSLATION,
|
|
17
|
-
SET_IS_IA_TRANSLATED,
|
|
18
18
|
} from "./constants";
|
|
19
19
|
|
|
20
20
|
export interface IFormsState {
|
|
@@ -33,7 +33,6 @@ export interface IFormsState {
|
|
|
33
33
|
summary: { total: number; active: number; inactive: number };
|
|
34
34
|
currentFormCategories: FormCategory[];
|
|
35
35
|
isNewTranslation: boolean;
|
|
36
|
-
isIATranslated: boolean;
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
export const initialState = {
|
|
@@ -52,7 +51,6 @@ export const initialState = {
|
|
|
52
51
|
summary: { total: 0, active: 0, inactive: 0 },
|
|
53
52
|
currentFormCategories: [],
|
|
54
53
|
isNewTranslation: false,
|
|
55
|
-
isIATranslated: false,
|
|
56
54
|
};
|
|
57
55
|
|
|
58
56
|
export function reducer(state = initialState, action: any): IFormsState {
|
|
@@ -71,7 +69,6 @@ export function reducer(state = initialState, action: any): IFormsState {
|
|
|
71
69
|
case SET_SUMMARY:
|
|
72
70
|
case SET_CURRENT_FORM_CATEGORIES:
|
|
73
71
|
case SET_IS_NEW_TRANSLATION:
|
|
74
|
-
case SET_IS_IA_TRANSLATED:
|
|
75
72
|
return { ...state, ...action.payload };
|
|
76
73
|
default:
|
|
77
74
|
return state;
|
|
@@ -66,7 +66,6 @@ import {
|
|
|
66
66
|
SET_CURRENT_PAGE_STATUS,
|
|
67
67
|
SET_EDITOR_CONTENT,
|
|
68
68
|
SET_ERRORS,
|
|
69
|
-
SET_IS_IA_TRANSLATED,
|
|
70
69
|
SET_IS_NEW_TRANSLATION,
|
|
71
70
|
SET_LAST_ELEMENT_ADDED_ID,
|
|
72
71
|
SET_LAST_TIMEOUT,
|
|
@@ -94,7 +93,6 @@ import type {
|
|
|
94
93
|
ISetCurrentPageStatusAction,
|
|
95
94
|
ISetEditorContent,
|
|
96
95
|
ISetErrors,
|
|
97
|
-
ISetIsIATranslated,
|
|
98
96
|
ISetIsNewTranslation,
|
|
99
97
|
ISetLastElementAddedId,
|
|
100
98
|
ISetLastTimeout,
|
|
@@ -217,10 +215,6 @@ function setCopyModule(moduleCopy: { date: Date; elements: Record<string, unknow
|
|
|
217
215
|
return { type: SET_COPY_MODULE, payload: { moduleCopy } };
|
|
218
216
|
}
|
|
219
217
|
|
|
220
|
-
function setIsIATranslated(isIATranslated: boolean): ISetIsIATranslated {
|
|
221
|
-
return { type: SET_IS_IA_TRANSLATED, payload: { isIATranslated } };
|
|
222
|
-
}
|
|
223
|
-
|
|
224
218
|
function setLastTimeout(lastTimeout: NodeJS.Timeout | null): ISetLastTimeout {
|
|
225
219
|
return { type: SET_LAST_TIMEOUT, payload: { lastTimeout } };
|
|
226
220
|
}
|
|
@@ -1593,9 +1587,8 @@ function getPageTranslation(langID: number): (dispatch: Dispatch, getState: () =
|
|
|
1593
1587
|
data.canBeTranslated = false;
|
|
1594
1588
|
generatePageContent(data)(dispatch, getState);
|
|
1595
1589
|
dispatch(setCurrentPageName(data.title));
|
|
1596
|
-
dispatch(setIsIATranslated(true));
|
|
1597
1590
|
},
|
|
1598
|
-
handleError: () =>
|
|
1591
|
+
handleError: (response: any) => appActions.handleError(response)(dispatch),
|
|
1599
1592
|
};
|
|
1600
1593
|
|
|
1601
1594
|
const callback = async () => pages.getPageTranslation(editorContent, langID);
|
|
@@ -1608,12 +1601,23 @@ function getPageTranslation(langID: number): (dispatch: Dispatch, getState: () =
|
|
|
1608
1601
|
};
|
|
1609
1602
|
}
|
|
1610
1603
|
|
|
1611
|
-
function
|
|
1612
|
-
return async (dispatch) => {
|
|
1604
|
+
function getPageRetranslation(pageID: number): (dispatch: Dispatch, getState: () => IRootState) => Promise<boolean> {
|
|
1605
|
+
return async (dispatch, getState) => {
|
|
1613
1606
|
try {
|
|
1614
|
-
|
|
1607
|
+
const responseActions = {
|
|
1608
|
+
handleSuccess: (data: IPage) => {
|
|
1609
|
+
generatePageContent(data)(dispatch, getState);
|
|
1610
|
+
dispatch(setCurrentPageName(data.title));
|
|
1611
|
+
},
|
|
1612
|
+
handleError: (response: any) => appActions.handleError(response)(dispatch),
|
|
1613
|
+
};
|
|
1614
|
+
|
|
1615
|
+
const callback = async () => pages.getPageRetranslation(pageID);
|
|
1616
|
+
|
|
1617
|
+
return await handleRequest(callback, responseActions, [])(dispatch);
|
|
1615
1618
|
} catch (e) {
|
|
1616
|
-
console.log(
|
|
1619
|
+
console.log(e);
|
|
1620
|
+
return false;
|
|
1617
1621
|
}
|
|
1618
1622
|
};
|
|
1619
1623
|
}
|
|
@@ -1724,7 +1728,7 @@ export {
|
|
|
1724
1728
|
restorePageNavigation,
|
|
1725
1729
|
getPageSummary,
|
|
1726
1730
|
getPageTranslation,
|
|
1727
|
-
|
|
1731
|
+
getPageRetranslation,
|
|
1728
1732
|
schedulePublication,
|
|
1729
1733
|
setScrollEditorID,
|
|
1730
1734
|
addComponentInArray,
|
|
@@ -20,7 +20,6 @@ export const SET_SITE_PAGE_ID = `${NAME}/SET_SITE_PAGE_ID`;
|
|
|
20
20
|
export const SET_USER_EDITING = `${NAME}/SET_USER_EDITING`;
|
|
21
21
|
export const SET_LAST_ELEMENT_ADDED_ID = `${NAME}/SET_LAST_ELEMENT_ADDED_ID`;
|
|
22
22
|
export const SET_COPY_MODULE = `${NAME}/SET_COPY_MODULE`;
|
|
23
|
-
export const SET_IS_IA_TRANSLATED = `${NAME}/SET_IS_IA_TRANSLATED`;
|
|
24
23
|
export const SET_LAST_TIMEOUT = `${NAME}/SET_LAST_TIMEOUT`;
|
|
25
24
|
export const RESET_PAGE_EDITOR_STORE = `${NAME}/RESET_PAGE_EDITOR_STORE`;
|
|
26
25
|
export const SET_SCROLL_EDITOR_ID = `${NAME}/SET_SCROLL_EDITOR_ID`;
|
|
@@ -10,7 +10,6 @@ import type {
|
|
|
10
10
|
SET_CURRENT_PAGE_STATUS,
|
|
11
11
|
SET_EDITOR_CONTENT,
|
|
12
12
|
SET_ERRORS,
|
|
13
|
-
SET_IS_IA_TRANSLATED,
|
|
14
13
|
SET_IS_NEW_TRANSLATION,
|
|
15
14
|
SET_LAST_ELEMENT_ADDED_ID,
|
|
16
15
|
SET_LAST_TIMEOUT,
|
|
@@ -128,11 +127,6 @@ export interface ISetCopyModule {
|
|
|
128
127
|
payload: { moduleCopy: { date: Date; elements: Record<string, unknown>[] } | null };
|
|
129
128
|
}
|
|
130
129
|
|
|
131
|
-
export interface ISetIsIATranslated {
|
|
132
|
-
type: typeof SET_IS_IA_TRANSLATED;
|
|
133
|
-
payload: { isIATranslated: boolean };
|
|
134
|
-
}
|
|
135
|
-
|
|
136
130
|
export interface ISetLastTimeout {
|
|
137
131
|
type: typeof SET_LAST_TIMEOUT;
|
|
138
132
|
payload: { lastTimeout: NodeJS.Timeout | null };
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
SET_CURRENT_PAGE_STATUS,
|
|
21
21
|
SET_EDITOR_CONTENT,
|
|
22
22
|
SET_ERRORS,
|
|
23
|
-
SET_IS_IA_TRANSLATED,
|
|
24
23
|
SET_IS_NEW_TRANSLATION,
|
|
25
24
|
SET_LAST_ELEMENT_ADDED_ID,
|
|
26
25
|
SET_LAST_TIMEOUT,
|
|
@@ -59,7 +58,6 @@ export interface IPageEditorState {
|
|
|
59
58
|
userEditing: IUserEditing | null;
|
|
60
59
|
lastElementAddedId: null | number;
|
|
61
60
|
moduleCopy: { date: Date; elements: IModule[] } | null;
|
|
62
|
-
isIATranslated: boolean;
|
|
63
61
|
lastTimeout: NodeJS.Timeout | null;
|
|
64
62
|
scrollEditorID: number | null;
|
|
65
63
|
accessGrants: PageAccessGrantsSummary;
|
|
@@ -86,7 +84,6 @@ export const initialState = {
|
|
|
86
84
|
userEditing: null,
|
|
87
85
|
lastElementAddedId: null,
|
|
88
86
|
moduleCopy: null,
|
|
89
|
-
isIATranslated: false,
|
|
90
87
|
lastTimeout: null,
|
|
91
88
|
scrollEditorID: null,
|
|
92
89
|
accessGrants: { users: [], roles: [] },
|
|
@@ -115,7 +112,6 @@ export function reducer(state = initialState, action: any): IPageEditorState {
|
|
|
115
112
|
case SET_USER_EDITING:
|
|
116
113
|
case SET_LAST_ELEMENT_ADDED_ID:
|
|
117
114
|
case SET_COPY_MODULE:
|
|
118
|
-
case SET_IS_IA_TRANSLATED:
|
|
119
115
|
case SET_LAST_TIMEOUT:
|
|
120
116
|
case SET_SCROLL_EDITOR_ID:
|
|
121
117
|
case SET_PAGE_ACCESS_GRANTS:
|
|
@@ -1,64 +1,63 @@
|
|
|
1
|
+
import { structuredData } from "@ax/api";
|
|
2
|
+
import { appActions } from "@ax/containers/App";
|
|
3
|
+
import { setTotalItems } from "@ax/containers/Sites/actions";
|
|
4
|
+
import { findMandatoryStructuredDataErrors } from "@ax/forms";
|
|
5
|
+
import { dateToString, deepClone, handleRequest, isEmptyArray } from "@ax/helpers";
|
|
6
|
+
import type {
|
|
7
|
+
ICategoryGroupParams,
|
|
8
|
+
IErrorItem,
|
|
9
|
+
IExportDataParams,
|
|
10
|
+
IGetStructuredDataParams,
|
|
11
|
+
IOrderCategoryParams,
|
|
12
|
+
IQueryValue,
|
|
13
|
+
IRootState,
|
|
14
|
+
IStructuredData,
|
|
15
|
+
IStructuredDataCategory,
|
|
16
|
+
IStructuredDataContent,
|
|
17
|
+
} from "@ax/types";
|
|
18
|
+
|
|
1
19
|
import type { Dispatch } from "redux";
|
|
20
|
+
|
|
2
21
|
import {
|
|
22
|
+
CREATE_FORM,
|
|
23
|
+
DEFAULT_PARAMS,
|
|
3
24
|
SET_CATEGORIES,
|
|
4
|
-
|
|
25
|
+
SET_CONTENT_FILTERS,
|
|
26
|
+
SET_CURRENT_DATA_CATEGORY,
|
|
27
|
+
SET_CURRENT_SEARCH,
|
|
5
28
|
SET_CURRENT_STRUCTURED_DATA,
|
|
6
|
-
SET_CURRENT_STRUCTURED_DATA_ID,
|
|
7
29
|
SET_CURRENT_STRUCTURED_DATA_CONTENTS,
|
|
8
|
-
|
|
9
|
-
UPDATE_FORM,
|
|
10
|
-
CREATE_FORM,
|
|
30
|
+
SET_CURRENT_STRUCTURED_DATA_ID,
|
|
11
31
|
SET_ENTITY,
|
|
12
|
-
|
|
32
|
+
SET_ERRORS,
|
|
13
33
|
SET_FILTER,
|
|
34
|
+
SET_SCHEMA,
|
|
14
35
|
SET_SCHEMA_VERSION,
|
|
15
|
-
|
|
36
|
+
SET_STRUCTURED_DATA,
|
|
16
37
|
SET_VALIDATED,
|
|
17
|
-
|
|
18
|
-
SET_IS_IA_TRANSLATED,
|
|
19
|
-
SET_CURRENT_DATA_CATEGORY,
|
|
20
|
-
SET_CURRENT_SEARCH,
|
|
38
|
+
UPDATE_FORM,
|
|
21
39
|
} from "./constants";
|
|
22
|
-
|
|
23
40
|
import type {
|
|
24
41
|
ISetCategories,
|
|
25
|
-
|
|
42
|
+
ISetContentFilters,
|
|
43
|
+
ISetCurrentCategories,
|
|
26
44
|
ISetCurrentData,
|
|
27
|
-
ISetCurrentDataID,
|
|
28
45
|
ISetCurrentDataContent,
|
|
46
|
+
ISetCurrentDataID,
|
|
47
|
+
ISetCurrentSearch,
|
|
48
|
+
ISetErrors,
|
|
29
49
|
ISetFilter,
|
|
30
50
|
ISetSchemaVersion,
|
|
31
|
-
|
|
51
|
+
ISetStructuredData,
|
|
32
52
|
ISetValidated,
|
|
33
|
-
ISetContentFilters,
|
|
34
|
-
ISetIsIATranslated,
|
|
35
|
-
ISetCurrentCategories,
|
|
36
|
-
ISetCurrentSearch,
|
|
37
53
|
} from "./interfaces";
|
|
38
54
|
import {
|
|
39
|
-
|
|
40
|
-
getTaxonomies,
|
|
55
|
+
evaluateDataComputedFields,
|
|
41
56
|
filterStructuredDataByID,
|
|
57
|
+
getTaxonomies,
|
|
42
58
|
getTypes,
|
|
43
|
-
|
|
59
|
+
prepareStructuredDataContent,
|
|
44
60
|
} from "./utils";
|
|
45
|
-
import type {
|
|
46
|
-
IStructuredData,
|
|
47
|
-
IStructuredDataContent,
|
|
48
|
-
IGetStructuredDataParams,
|
|
49
|
-
IErrorItem,
|
|
50
|
-
IStructuredDataCategory,
|
|
51
|
-
ICategoryGroupParams,
|
|
52
|
-
IRootState,
|
|
53
|
-
IOrderCategoryParams,
|
|
54
|
-
IExportDataParams,
|
|
55
|
-
IQueryValue,
|
|
56
|
-
} from "@ax/types";
|
|
57
|
-
import { structuredData } from "@ax/api";
|
|
58
|
-
import { setTotalItems } from "@ax/containers/Sites/actions";
|
|
59
|
-
import { appActions } from "@ax/containers/App";
|
|
60
|
-
import { dateToString, deepClone, handleRequest, isEmptyArray } from "@ax/helpers";
|
|
61
|
-
import { findMandatoryStructuredDataErrors } from "@ax/forms";
|
|
62
61
|
|
|
63
62
|
const { setIsLoading, setIsSaving } = appActions;
|
|
64
63
|
|
|
@@ -123,10 +122,6 @@ function setContentFilters(contentFilters: Record<string, Record<string, IQueryV
|
|
|
123
122
|
return { type: SET_CONTENT_FILTERS, payload: { contentFilters } };
|
|
124
123
|
}
|
|
125
124
|
|
|
126
|
-
function setIsIATranslated(isIATranslated: boolean): ISetIsIATranslated {
|
|
127
|
-
return { type: SET_IS_IA_TRANSLATED, payload: { isIATranslated } };
|
|
128
|
-
}
|
|
129
|
-
|
|
130
125
|
function setCurrentSearch(currentSearch: string): ISetCurrentSearch {
|
|
131
126
|
return { type: SET_CURRENT_SEARCH, payload: { currentSearch } };
|
|
132
127
|
}
|
|
@@ -155,7 +150,6 @@ function resetForm(setDefault?: boolean): (dispatch: Dispatch, getState: () => I
|
|
|
155
150
|
dispatch(setErrors([]));
|
|
156
151
|
dispatch(setValidated(false));
|
|
157
152
|
dispatch(setCurrentDataID(null));
|
|
158
|
-
dispatch(setIsIATranslated(false));
|
|
159
153
|
};
|
|
160
154
|
}
|
|
161
155
|
|
|
@@ -594,7 +588,6 @@ function getDataContentTranslation(
|
|
|
594
588
|
handleSuccess: (data: IStructuredDataContent) => {
|
|
595
589
|
const newForm = { ...data, canBeTranslated: false };
|
|
596
590
|
dispatch(setForm(newForm));
|
|
597
|
-
dispatch(setIsIATranslated(true));
|
|
598
591
|
},
|
|
599
592
|
handleError: () => console.log("Error en GetDataContentTranslation"),
|
|
600
593
|
};
|
|
@@ -619,16 +612,6 @@ function setFormValues(values: any): (dispatch: Dispatch) => Promise<void> {
|
|
|
619
612
|
};
|
|
620
613
|
}
|
|
621
614
|
|
|
622
|
-
function setIsTranslated(isTranslated: boolean): (dispatch: Dispatch) => Promise<void> {
|
|
623
|
-
return async (dispatch) => {
|
|
624
|
-
try {
|
|
625
|
-
dispatch(setIsIATranslated(isTranslated));
|
|
626
|
-
} catch (e) {
|
|
627
|
-
console.log("Error", e);
|
|
628
|
-
}
|
|
629
|
-
};
|
|
630
|
-
}
|
|
631
|
-
|
|
632
615
|
function resetCurrentData(): (dispatch: Dispatch) => void {
|
|
633
616
|
return (dispatch) => {
|
|
634
617
|
dispatch(setCurrentData(null));
|
|
@@ -838,7 +821,6 @@ export {
|
|
|
838
821
|
resetStructuredData,
|
|
839
822
|
getDataContentTranslation,
|
|
840
823
|
setFormValues,
|
|
841
|
-
setIsTranslated,
|
|
842
824
|
resetCurrentData,
|
|
843
825
|
createCategoryGroup,
|
|
844
826
|
updateCategoryGroup,
|
|
@@ -15,7 +15,6 @@ const SET_SCHEMA_VERSION: string | null = `${NAME}/SET_SCHEMA_VERSION`;
|
|
|
15
15
|
const SET_ERRORS = `${NAME}/SET_ERRORS`;
|
|
16
16
|
const SET_VALIDATED = `${NAME}/SET_VALIDATED`;
|
|
17
17
|
const SET_CONTENT_FILTERS = `${NAME}/SET_CONTENT_FILTERS`;
|
|
18
|
-
const SET_IS_IA_TRANSLATED = `${NAME}/SET_IS_IA_TRANSLATED`;
|
|
19
18
|
const SET_CURRENT_SEARCH = `${NAME}/SET_CURRENT_SEARCH`;
|
|
20
19
|
|
|
21
20
|
const ITEMS_PER_PAGE = 50;
|
|
@@ -48,6 +47,5 @@ export {
|
|
|
48
47
|
SET_ERRORS,
|
|
49
48
|
SET_VALIDATED,
|
|
50
49
|
SET_CONTENT_FILTERS,
|
|
51
|
-
SET_IS_IA_TRANSLATED,
|
|
52
50
|
SET_CURRENT_SEARCH,
|
|
53
51
|
};
|
|
@@ -1,29 +1,28 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IErrorItem,
|
|
3
|
+
IQueryValue,
|
|
4
|
+
IStructuredData,
|
|
5
|
+
IStructuredDataCategory,
|
|
6
|
+
IStructuredDataContent,
|
|
7
|
+
} from "@ax/types";
|
|
8
|
+
|
|
1
9
|
import type {
|
|
2
10
|
SET_CATEGORIES,
|
|
3
|
-
|
|
11
|
+
SET_CONTENT_FILTERS,
|
|
12
|
+
SET_CURRENT_DATA_CATEGORY,
|
|
13
|
+
SET_CURRENT_SEARCH,
|
|
4
14
|
SET_CURRENT_STRUCTURED_DATA,
|
|
5
|
-
SET_CURRENT_STRUCTURED_DATA_ID,
|
|
6
15
|
SET_CURRENT_STRUCTURED_DATA_CONTENTS,
|
|
7
|
-
|
|
8
|
-
|
|
16
|
+
SET_CURRENT_STRUCTURED_DATA_ID,
|
|
17
|
+
SET_ERRORS,
|
|
9
18
|
SET_FILTER,
|
|
19
|
+
SET_SCHEMA,
|
|
10
20
|
SET_SCHEMA_VERSION,
|
|
11
|
-
|
|
21
|
+
SET_STRUCTURED_DATA,
|
|
12
22
|
SET_VALIDATED,
|
|
13
|
-
|
|
14
|
-
SET_IS_IA_TRANSLATED,
|
|
15
|
-
SET_CURRENT_DATA_CATEGORY,
|
|
16
|
-
SET_CURRENT_SEARCH,
|
|
23
|
+
UPDATE_FORM,
|
|
17
24
|
} from "./constants";
|
|
18
25
|
|
|
19
|
-
import type {
|
|
20
|
-
IStructuredData,
|
|
21
|
-
IStructuredDataContent,
|
|
22
|
-
IErrorItem,
|
|
23
|
-
IStructuredDataCategory,
|
|
24
|
-
IQueryValue,
|
|
25
|
-
} from "@ax/types";
|
|
26
|
-
|
|
27
26
|
export interface ISetCategories {
|
|
28
27
|
type: typeof SET_CATEGORIES;
|
|
29
28
|
payload: { categories: { global: IStructuredData[]; site: IStructuredData[] } };
|
|
@@ -88,11 +87,6 @@ export interface ISetContentFilters {
|
|
|
88
87
|
payload: { contentFilters: Record<string, Record<string, IQueryValue[]>> | null };
|
|
89
88
|
}
|
|
90
89
|
|
|
91
|
-
export interface ISetIsIATranslated {
|
|
92
|
-
type: typeof SET_IS_IA_TRANSLATED;
|
|
93
|
-
payload: { isIATranslated: boolean };
|
|
94
|
-
}
|
|
95
|
-
|
|
96
90
|
export interface ISetCurrentSearch {
|
|
97
91
|
type: typeof SET_CURRENT_SEARCH;
|
|
98
92
|
payload: { currentSearch: string };
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
IStructuredData,
|
|
3
|
-
IStructuredDataContent,
|
|
4
2
|
IErrorItem,
|
|
5
|
-
IStructuredDataCategory,
|
|
6
3
|
IQueryValue,
|
|
4
|
+
IStructuredData,
|
|
5
|
+
IStructuredDataCategory,
|
|
6
|
+
IStructuredDataContent,
|
|
7
7
|
} from "@ax/types";
|
|
8
|
+
|
|
8
9
|
import {
|
|
10
|
+
CREATE_FORM,
|
|
9
11
|
SET_CATEGORIES,
|
|
10
|
-
|
|
12
|
+
SET_CONTENT_FILTERS,
|
|
13
|
+
SET_CURRENT_DATA_CATEGORY,
|
|
14
|
+
SET_CURRENT_SEARCH,
|
|
11
15
|
SET_CURRENT_STRUCTURED_DATA,
|
|
12
|
-
SET_CURRENT_STRUCTURED_DATA_ID,
|
|
13
16
|
SET_CURRENT_STRUCTURED_DATA_CONTENTS,
|
|
14
|
-
|
|
15
|
-
CREATE_FORM,
|
|
16
|
-
UPDATE_FORM,
|
|
17
|
+
SET_CURRENT_STRUCTURED_DATA_ID,
|
|
17
18
|
SET_ENTITY,
|
|
19
|
+
SET_ERRORS,
|
|
18
20
|
SET_FILTER,
|
|
21
|
+
SET_SCHEMA,
|
|
19
22
|
SET_SCHEMA_VERSION,
|
|
20
|
-
|
|
23
|
+
SET_STRUCTURED_DATA,
|
|
21
24
|
SET_VALIDATED,
|
|
22
|
-
|
|
23
|
-
SET_IS_IA_TRANSLATED,
|
|
24
|
-
SET_CURRENT_DATA_CATEGORY,
|
|
25
|
-
SET_CURRENT_SEARCH,
|
|
25
|
+
UPDATE_FORM,
|
|
26
26
|
} from "./constants";
|
|
27
27
|
|
|
28
28
|
export interface IStructuredDataState {
|
|
@@ -41,7 +41,6 @@ export interface IStructuredDataState {
|
|
|
41
41
|
errors: IErrorItem[];
|
|
42
42
|
validated: boolean;
|
|
43
43
|
contentFilters: Record<string, Record<string, IQueryValue[]>> | null;
|
|
44
|
-
isIATranslated: boolean;
|
|
45
44
|
currentSearch: string;
|
|
46
45
|
}
|
|
47
46
|
|
|
@@ -61,7 +60,6 @@ export const initialState = {
|
|
|
61
60
|
errors: [],
|
|
62
61
|
validated: false,
|
|
63
62
|
contentFilters: null,
|
|
64
|
-
isIATranslated: false,
|
|
65
63
|
currentSearch: "",
|
|
66
64
|
};
|
|
67
65
|
|
|
@@ -82,7 +80,6 @@ export function reducer(state = initialState, action: any): IStructuredDataState
|
|
|
82
80
|
case SET_ERRORS:
|
|
83
81
|
case SET_VALIDATED:
|
|
84
82
|
case SET_CONTENT_FILTERS:
|
|
85
|
-
case SET_IS_IA_TRANSLATED:
|
|
86
83
|
case SET_CURRENT_SEARCH:
|
|
87
84
|
return { ...state, ...action.payload };
|
|
88
85
|
default:
|