@griddo/ax 1.68.7 → 1.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/webpack.config.js +24 -0
- package/package.json +6 -2
- package/src/__mocks__/axios/ReferenceField.ts +471 -0
- package/src/{__tests__/components/Fields/UrlField → __mocks__}/mockedAxios.ts +0 -0
- package/src/__mocks__/reducers/structuredData.tsx +10 -0
- package/src/__mocks__/store/ReferenceField.ts +1671 -0
- package/src/__tests__/components/Fields/AnalyticsField/AnalyticsField.test.tsx +20 -28
- package/src/__tests__/components/Fields/CheckGroup/CheckGroup.test.tsx +16 -28
- package/src/__tests__/components/Fields/MultiCheckSelectGroup/MultiCheckSelectGroup.test.tsx +120 -0
- package/src/__tests__/components/Fields/ReferenceField/ReferenceField.test.tsx +532 -0
- package/src/__tests__/components/Fields/TextField/TextField.test.tsx +0 -1
- package/src/__tests__/components/Fields/UrlField/UrlField.test.tsx +14 -13
- package/src/__tests__/components/Fields/Wysiwyg/Wysiwyg.test.tsx +121 -0
- package/src/components/Fields/ComponentArray/MixableComponentArray/PasteModuleButton/index.tsx +4 -3
- package/src/components/Fields/ComponentArray/MixableComponentArray/index.tsx +69 -34
- package/src/components/Fields/ComponentArray/SameComponentArray/index.tsx +59 -26
- package/src/components/Fields/ComponentContainer/atoms.tsx +2 -8
- package/src/components/Fields/ComponentContainer/index.tsx +21 -21
- package/src/components/Fields/ComponentContainer/style.tsx +49 -28
- package/src/components/Fields/MultiCheckSelectGroup/index.tsx +2 -2
- package/src/components/Fields/MultiCheckSelectGroup/style.tsx +4 -4
- package/src/components/Fields/ReferenceField/AutoPanel/AutoItem/index.tsx +1 -1
- package/src/components/Fields/ReferenceField/AutoPanel/index.tsx +2 -4
- package/src/components/Fields/ReferenceField/AutoPanel/style.tsx +3 -0
- package/src/components/Fields/ReferenceField/Context/index.tsx +3 -3
- package/src/components/Fields/ReferenceField/ItemList/Item/index.tsx +15 -24
- package/src/components/Fields/ReferenceField/ItemList/Item/style.tsx +22 -15
- package/src/components/Fields/ReferenceField/ItemList/index.tsx +42 -11
- package/src/components/Fields/ReferenceField/ManualPanel/Item/index.tsx +1 -1
- package/src/components/Fields/ReferenceField/index.tsx +5 -6
- package/src/components/Fields/Wysiwyg/index.tsx +4 -4
- package/src/components/Gallery/GalleryPanel/DetailPanel/index.tsx +12 -4
- package/src/components/Gallery/GalleryPanel/index.tsx +10 -2
- package/src/components/Gallery/index.tsx +5 -1
- package/src/components/MainWrapper/AppBar/index.tsx +1 -1
- package/src/containers/App/reducer.tsx +1 -0
- package/src/containers/Gallery/actions.tsx +11 -5
- package/src/containers/Navigation/Defaults/actions.tsx +2 -2
- package/src/containers/PageEditor/actions.tsx +18 -7
- package/src/forms/elements.tsx +5 -6
- package/src/helpers/arrays.tsx +1 -2
- package/src/modules/Content/PageItem/index.tsx +13 -2
- package/src/modules/Content/index.tsx +18 -1
- package/src/modules/GlobalEditor/Editor/index.tsx +2 -2
- package/src/modules/GlobalEditor/index.tsx +9 -7
- package/src/modules/Navigation/Defaults/DefaultsEditor/Editor/index.tsx +1 -1
- package/src/modules/PageEditor/Editor/index.tsx +2 -2
- package/src/modules/PageEditor/index.tsx +8 -6
- package/src/modules/StructuredData/Form/index.tsx +7 -4
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +25 -3
- package/src/modules/StructuredData/StructuredDataList/index.tsx +4 -0
- package/src/__mocks__/reducers/analyticsState.tsx +0 -14
- package/src/__mocks__/reducers/app.tsx +0 -10
- package/src/__mocks__/reducers/pageEditor.tsx +0 -30
- package/src/__mocks__/reducers/sites.tsx +0 -10
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
IColumn,
|
|
17
17
|
ISite,
|
|
18
18
|
IUser,
|
|
19
|
+
IErrorItem,
|
|
19
20
|
} from "@ax/types";
|
|
20
21
|
import { MainWrapper, Modal, TableList, ErrorToast, Toast, EmptyState, Notification } from "@ax/components";
|
|
21
22
|
import { getFilteredStructuredData, isGlobalStructuredData, isStructuredDataFromPage } from "@ax/helpers";
|
|
@@ -55,6 +56,7 @@ const Content = (props: IProps): JSX.Element => {
|
|
|
55
56
|
totalItems,
|
|
56
57
|
lang,
|
|
57
58
|
siteLanguages,
|
|
59
|
+
errors,
|
|
58
60
|
setCurrentPageID,
|
|
59
61
|
setCurrentPageStatus,
|
|
60
62
|
setCurrentPageName,
|
|
@@ -73,7 +75,9 @@ const Content = (props: IProps): JSX.Element => {
|
|
|
73
75
|
createNewTranslation,
|
|
74
76
|
resetForm,
|
|
75
77
|
deleteBulk,
|
|
78
|
+
getPage,
|
|
76
79
|
duplicatePage,
|
|
80
|
+
validatePage,
|
|
77
81
|
activatedDataPacks,
|
|
78
82
|
activatedTemplates,
|
|
79
83
|
deleteDataContent,
|
|
@@ -92,6 +96,7 @@ const Content = (props: IProps): JSX.Element => {
|
|
|
92
96
|
getSitesByLang,
|
|
93
97
|
sitesByLang,
|
|
94
98
|
user,
|
|
99
|
+
skipReviewOnPublish,
|
|
95
100
|
} = props;
|
|
96
101
|
|
|
97
102
|
const itemsPerPage = 50;
|
|
@@ -551,6 +556,8 @@ const Content = (props: IProps): JSX.Element => {
|
|
|
551
556
|
getDataPack: getDataPack,
|
|
552
557
|
setTemplateInstanceError,
|
|
553
558
|
toggleCopiedToast,
|
|
559
|
+
validatePage,
|
|
560
|
+
getPage,
|
|
554
561
|
};
|
|
555
562
|
|
|
556
563
|
return (
|
|
@@ -567,6 +574,7 @@ const Content = (props: IProps): JSX.Element => {
|
|
|
567
574
|
categoryColors={categoryColors}
|
|
568
575
|
addCategoryColors={addCategoryColors}
|
|
569
576
|
dataPacks={dataPacks}
|
|
577
|
+
skipReview={skipReviewOnPublish}
|
|
570
578
|
/>
|
|
571
579
|
);
|
|
572
580
|
});
|
|
@@ -689,6 +697,7 @@ const Content = (props: IProps): JSX.Element => {
|
|
|
689
697
|
availableLanguages={siteLanguages}
|
|
690
698
|
rightButton={{ label: "New", action: addNewAction }}
|
|
691
699
|
searchAction={setSearchQuery}
|
|
700
|
+
errors={errors}
|
|
692
701
|
>
|
|
693
702
|
<S.ContentListWrapper>
|
|
694
703
|
<ContentFilters current={filter} dynamicValues={structuredData} resetFilter={resetFilter} />
|
|
@@ -700,7 +709,7 @@ const Content = (props: IProps): JSX.Element => {
|
|
|
700
709
|
text={`There can be only one ${templateInstanceError.templateName} page and you already have it.`}
|
|
701
710
|
/>
|
|
702
711
|
)}
|
|
703
|
-
{!!currentSiteErrorPages.length && <Notification type="error" text={errorPagesText} />}
|
|
712
|
+
{(!!currentSiteErrorPages.length || errors.length > 0) && <Notification type="error" text={errorPagesText} />}
|
|
704
713
|
<TableList
|
|
705
714
|
tableHeader={Header}
|
|
706
715
|
pagination={pagination}
|
|
@@ -763,6 +772,7 @@ const mapStateToProps = (state: IRootState) => ({
|
|
|
763
772
|
totalItems: state.sites.totalItems,
|
|
764
773
|
lang: state.app.lang,
|
|
765
774
|
pageLanguages: state.pageEditor.currentPageLanguages,
|
|
775
|
+
errors: state.pageEditor.errors,
|
|
766
776
|
siteLanguages: state.sites.currentSiteLanguages,
|
|
767
777
|
structuredData: state.structuredData.structuredData.site,
|
|
768
778
|
currentDataContent: state.structuredData.currentDataContent,
|
|
@@ -775,6 +785,7 @@ const mapStateToProps = (state: IRootState) => ({
|
|
|
775
785
|
currentSiteErrorPages: state.sites.currentSiteErrorPages,
|
|
776
786
|
sitesByLang: state.sites.sitesByLang,
|
|
777
787
|
user: state.users.currentUser,
|
|
788
|
+
skipReviewOnPublish: state.app.globalSettings.skipReviewOnPublish,
|
|
778
789
|
});
|
|
779
790
|
|
|
780
791
|
interface IDispatchProps {
|
|
@@ -795,6 +806,8 @@ interface IDispatchProps {
|
|
|
795
806
|
resetForm(): void;
|
|
796
807
|
deleteBulk(ids: any): Promise<boolean>;
|
|
797
808
|
duplicatePage(pageID: number, data?: any, siteID?: number): Promise<boolean>;
|
|
809
|
+
getPage(pageID?: number, global?: boolean): Promise<void>;
|
|
810
|
+
validatePage(publish?: boolean, browserRef?: any, currentPage?: IPage): Promise<boolean>;
|
|
798
811
|
deleteDataContent(dataID: number[]): Promise<boolean>;
|
|
799
812
|
restoreDataContent(catID: number | number[]): void;
|
|
800
813
|
setFilter(value: string): void;
|
|
@@ -821,6 +834,8 @@ const mapDispatchToProps = {
|
|
|
821
834
|
createNewTranslation: pageEditorActions.createNewTranslation,
|
|
822
835
|
deleteBulk: pageEditorActions.deleteBulk,
|
|
823
836
|
duplicatePage: pageEditorActions.duplicatePage,
|
|
837
|
+
getPage: pageEditorActions.getPage,
|
|
838
|
+
validatePage: pageEditorActions.validatePage,
|
|
824
839
|
getStructuredDataContents: structuredDataActions.getStructuredDataContents,
|
|
825
840
|
setSelectedStructuredData: structuredDataActions.setSelectedStructuredData,
|
|
826
841
|
updateForm: structuredDataActions.updateForm,
|
|
@@ -848,6 +863,7 @@ interface IPagesProps {
|
|
|
848
863
|
lang: { locale: string; id: number };
|
|
849
864
|
langID?: number;
|
|
850
865
|
pageLanguages: any[];
|
|
866
|
+
errors: IErrorItem[];
|
|
851
867
|
siteLanguages: any[];
|
|
852
868
|
structuredData: any;
|
|
853
869
|
currentStructuredData: any;
|
|
@@ -861,6 +877,7 @@ interface IPagesProps {
|
|
|
861
877
|
sites: ISite[];
|
|
862
878
|
sitesByLang: ISite[];
|
|
863
879
|
user: IUser;
|
|
880
|
+
skipReviewOnPublish?: boolean;
|
|
864
881
|
}
|
|
865
882
|
|
|
866
883
|
type IProps = IPagesProps & IDispatchProps;
|
|
@@ -90,11 +90,11 @@ interface IPageBrowserDispatchProps {
|
|
|
90
90
|
duplicateModule(editorID: number, key: string): void;
|
|
91
91
|
addComponent: (componentType: any, key: string) => void;
|
|
92
92
|
addModule: (moduleType: string, selectedID: number, key: string) => void;
|
|
93
|
-
moveElement(moduleID: number, selectedContent: any,
|
|
93
|
+
moveElement(moduleID: number, selectedContent: any, newIndex: number, key: string): void;
|
|
94
94
|
replaceModule(module: any, parent: any, objKey: string): void;
|
|
95
95
|
replaceElementsInCollection(newValue: string, reference: string): void;
|
|
96
96
|
copyModule(editorID: number): boolean;
|
|
97
|
-
pasteModule(editorID: number): Promise<{ error?: INotification }>;
|
|
97
|
+
pasteModule(editorID: number, key: string): Promise<{ error?: INotification }>;
|
|
98
98
|
setNotification: (notification: INotification) => void;
|
|
99
99
|
isGlobal: boolean;
|
|
100
100
|
isEditable: boolean;
|
|
@@ -125,9 +125,9 @@ const GlobalEditor = (props: IProps) => {
|
|
|
125
125
|
};
|
|
126
126
|
|
|
127
127
|
const publishPage = async () => {
|
|
128
|
-
const { updatePageStatus, savePage, pageID, validatePage } = props;
|
|
128
|
+
const { updatePageStatus, savePage, pageID, validatePage, skipReviewOnPublish } = props;
|
|
129
129
|
|
|
130
|
-
const validated = await validatePage(true);
|
|
130
|
+
const validated = skipReviewOnPublish ? true : await validatePage(true);
|
|
131
131
|
|
|
132
132
|
if (validated) {
|
|
133
133
|
const publishPage = {
|
|
@@ -145,9 +145,9 @@ const GlobalEditor = (props: IProps) => {
|
|
|
145
145
|
};
|
|
146
146
|
|
|
147
147
|
const publishChanges = async () => {
|
|
148
|
-
const { savePage, validatePage } = props;
|
|
148
|
+
const { savePage, validatePage, skipReviewOnPublish } = props;
|
|
149
149
|
|
|
150
|
-
const validated = await validatePage(true);
|
|
150
|
+
const validated = skipReviewOnPublish ? true : await validatePage(true);
|
|
151
151
|
|
|
152
152
|
if (validated) {
|
|
153
153
|
const publishPage = {
|
|
@@ -176,13 +176,13 @@ const GlobalEditor = (props: IProps) => {
|
|
|
176
176
|
|
|
177
177
|
const reviewPage = () => {
|
|
178
178
|
const { validatePage } = props;
|
|
179
|
-
validatePage(
|
|
179
|
+
validatePage(false);
|
|
180
180
|
};
|
|
181
181
|
|
|
182
182
|
const handlePublishDraft = async () => {
|
|
183
|
-
const { savePage, validatePage } = props;
|
|
183
|
+
const { savePage, validatePage, skipReviewOnPublish } = props;
|
|
184
184
|
|
|
185
|
-
const validated = await validatePage(true);
|
|
185
|
+
const validated = skipReviewOnPublish ? true : await validatePage(true);
|
|
186
186
|
|
|
187
187
|
if (validated) {
|
|
188
188
|
const isSaved = await savePage(false, null, true);
|
|
@@ -541,6 +541,7 @@ const mapStateToProps = (state: IRootState): IPageEditorStateProps => ({
|
|
|
541
541
|
currentUserID: state.users.currentUser.id,
|
|
542
542
|
isNewTranslation: state.pageEditor.isNewTranslation,
|
|
543
543
|
currentSiteErrorPages: state.sites.currentSiteErrorPages,
|
|
544
|
+
skipReviewOnPublish: state.app.globalSettings.skipReviewOnPublish,
|
|
544
545
|
});
|
|
545
546
|
|
|
546
547
|
interface IPageEditorStateProps {
|
|
@@ -561,6 +562,7 @@ interface IPageEditorStateProps {
|
|
|
561
562
|
currentUserID: number | null;
|
|
562
563
|
isNewTranslation: boolean;
|
|
563
564
|
currentSiteErrorPages: number[];
|
|
565
|
+
skipReviewOnPublish?: boolean;
|
|
564
566
|
}
|
|
565
567
|
|
|
566
568
|
const mapDispatchToProps = {
|
|
@@ -76,7 +76,7 @@ interface IPageBrowserDispatchProps {
|
|
|
76
76
|
addComponent: (componentType: any, key: string) => void;
|
|
77
77
|
replaceModule(module: any, parent: any, objKey: string): void;
|
|
78
78
|
replaceElementsInCollection(newValue: string, reference: string): void;
|
|
79
|
-
moveModule(moduleID: number, selectedContent: any,
|
|
79
|
+
moveModule(moduleID: number, selectedContent: any, newIndex: number, key: string): void;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
type IProps = IEditorStateProps & IPageBrowserDispatchProps;
|
|
@@ -108,14 +108,14 @@ interface IPageBrowserDispatchProps {
|
|
|
108
108
|
duplicateModule(editorID: number, key: string): void;
|
|
109
109
|
addComponent: (componentType: any, key: string) => void;
|
|
110
110
|
addModule: (moduleType: string, selectedID: number, key: string) => void;
|
|
111
|
-
moveElement(moduleID: number, selectedContent: any,
|
|
111
|
+
moveElement(moduleID: number, selectedContent: any, newIndex: number, key: string): void;
|
|
112
112
|
replaceModule(module: any, parent: any, objKey: string): void;
|
|
113
113
|
replaceElementsInCollection(newValue: string, reference: string): void;
|
|
114
114
|
setHistoryPush(path: string, isEditor: boolean): void;
|
|
115
115
|
getGlobalFromLocalPage(): void;
|
|
116
116
|
saveCurrentSiteInfo(): void;
|
|
117
117
|
copyModule(editorID: number): boolean;
|
|
118
|
-
pasteModule(editorID: number): Promise<{ error?: INotification }>;
|
|
118
|
+
pasteModule(editorID: number, key: string): Promise<{ error?: INotification }>;
|
|
119
119
|
setNotification: (notification: INotification) => void;
|
|
120
120
|
isTemplateActivated: boolean;
|
|
121
121
|
isGlobal: boolean;
|
|
@@ -129,9 +129,9 @@ const PageEditor = (props: IProps) => {
|
|
|
129
129
|
};
|
|
130
130
|
|
|
131
131
|
const publishPage = async () => {
|
|
132
|
-
const { updatePageStatus, savePage, pageID, validatePage } = props;
|
|
132
|
+
const { updatePageStatus, savePage, pageID, validatePage, skipReviewOnPublish } = props;
|
|
133
133
|
|
|
134
|
-
const validated = await validatePage(true);
|
|
134
|
+
const validated = skipReviewOnPublish ? true : await validatePage(true);
|
|
135
135
|
|
|
136
136
|
if (validated) {
|
|
137
137
|
const publishPage = {
|
|
@@ -149,9 +149,9 @@ const PageEditor = (props: IProps) => {
|
|
|
149
149
|
};
|
|
150
150
|
|
|
151
151
|
const publishChanges = async () => {
|
|
152
|
-
const { savePage, validatePage } = props;
|
|
152
|
+
const { savePage, validatePage, skipReviewOnPublish } = props;
|
|
153
153
|
|
|
154
|
-
const validated = await validatePage(true);
|
|
154
|
+
const validated = skipReviewOnPublish ? true : await validatePage(true);
|
|
155
155
|
|
|
156
156
|
if (validated) {
|
|
157
157
|
const publishPage = {
|
|
@@ -184,9 +184,9 @@ const PageEditor = (props: IProps) => {
|
|
|
184
184
|
};
|
|
185
185
|
|
|
186
186
|
const handlePublishDraft = async () => {
|
|
187
|
-
const { savePage, validatePage } = props;
|
|
187
|
+
const { savePage, validatePage, skipReviewOnPublish } = props;
|
|
188
188
|
|
|
189
|
-
const validated = await validatePage(true);
|
|
189
|
+
const validated = skipReviewOnPublish ? true : await validatePage(true);
|
|
190
190
|
|
|
191
191
|
if (validated) {
|
|
192
192
|
const isSaved = await savePage(false, null, true);
|
|
@@ -603,6 +603,7 @@ const mapStateToProps = (state: IRootState): IPageEditorStateProps => ({
|
|
|
603
603
|
currentUserID: state.users.currentUser.id,
|
|
604
604
|
isNewTranslation: state.pageEditor.isNewTranslation,
|
|
605
605
|
currentSiteErrorPages: state.sites.currentSiteErrorPages,
|
|
606
|
+
skipReviewOnPublish: state.app.globalSettings.skipReviewOnPublish,
|
|
606
607
|
});
|
|
607
608
|
|
|
608
609
|
interface IPageEditorStateProps {
|
|
@@ -624,6 +625,7 @@ interface IPageEditorStateProps {
|
|
|
624
625
|
currentUserID: number | null;
|
|
625
626
|
isNewTranslation: boolean;
|
|
626
627
|
currentSiteErrorPages: number[];
|
|
628
|
+
skipReviewOnPublish?: boolean;
|
|
627
629
|
}
|
|
628
630
|
|
|
629
631
|
const mapDispatchToProps = {
|
|
@@ -41,6 +41,7 @@ const Form = (props: IProps) => {
|
|
|
41
41
|
validateForm,
|
|
42
42
|
currentStructuredDataId,
|
|
43
43
|
resetForm,
|
|
44
|
+
skipReviewOnPublish,
|
|
44
45
|
} = props;
|
|
45
46
|
|
|
46
47
|
const [isNewStructuredData, setIsNewStructuredData] = useState(!form.id);
|
|
@@ -83,8 +84,8 @@ const Form = (props: IProps) => {
|
|
|
83
84
|
);
|
|
84
85
|
});
|
|
85
86
|
|
|
86
|
-
const handleSave = async (publish
|
|
87
|
-
const validated = publish ? await validateForm(true) : true;
|
|
87
|
+
const handleSave = async (publish: boolean) => {
|
|
88
|
+
const validated = publish && !skipReviewOnPublish ? await validateForm(true) : true;
|
|
88
89
|
|
|
89
90
|
if (validated) {
|
|
90
91
|
setIsSavedData(true);
|
|
@@ -186,7 +187,7 @@ const Form = (props: IProps) => {
|
|
|
186
187
|
};
|
|
187
188
|
|
|
188
189
|
const publishItem = async () => {
|
|
189
|
-
const validated = await validateForm(true);
|
|
190
|
+
const validated = skipReviewOnPublish ? true : await validateForm(true);
|
|
190
191
|
if (!validated) return;
|
|
191
192
|
|
|
192
193
|
if (!isNewStructuredData) {
|
|
@@ -316,6 +317,8 @@ interface IProps {
|
|
|
316
317
|
activatedDataPacks: IDataPack[];
|
|
317
318
|
errors: IErrorItem[];
|
|
318
319
|
validated: boolean;
|
|
320
|
+
currentStructuredDataId: number | null;
|
|
321
|
+
skipReviewOnPublish?: boolean;
|
|
319
322
|
createStructuredDataContent: (payload: any) => Promise<boolean>;
|
|
320
323
|
updateStructuredDataContent: (payload: any) => Promise<boolean>;
|
|
321
324
|
setLanguage(lang: { locale: string; id: number | null }): void;
|
|
@@ -325,7 +328,6 @@ interface IProps {
|
|
|
325
328
|
setDataStatus(id: number, status: string): Promise<boolean>;
|
|
326
329
|
deleteStructuredDataContent(id: number): Promise<boolean>;
|
|
327
330
|
validateForm(publish?: boolean): Promise<boolean>;
|
|
328
|
-
currentStructuredDataId: number | null;
|
|
329
331
|
resetForm(): void;
|
|
330
332
|
}
|
|
331
333
|
|
|
@@ -344,6 +346,7 @@ const mapStateToProps = (state: IRootState) => ({
|
|
|
344
346
|
activatedDataPacks: state.dataPacks.activated,
|
|
345
347
|
errors: state.structuredData.errors,
|
|
346
348
|
validated: state.structuredData.validated,
|
|
349
|
+
skipReviewOnPublish: state.app.globalSettings.skipReviewOnPublish,
|
|
347
350
|
});
|
|
348
351
|
|
|
349
352
|
const mapDispatchToProps = {
|
|
@@ -5,7 +5,16 @@ import { ICheck, IAvailableSites, ISavePageParams, ILanguage, IPageLanguage, IPa
|
|
|
5
5
|
import { getHumanLastModifiedDate, getStructuredDataTitle } from "@ax/helpers";
|
|
6
6
|
import { appActions } from "@ax/containers/App";
|
|
7
7
|
import { pageStatus, ISetCurrentPageIDAction } from "@ax/containers/PageEditor/interfaces";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
CheckField,
|
|
10
|
+
FloatingMenu,
|
|
11
|
+
Icon,
|
|
12
|
+
Flag,
|
|
13
|
+
LanguageMenu,
|
|
14
|
+
Tooltip,
|
|
15
|
+
ElementsTooltip,
|
|
16
|
+
CategoryCell,
|
|
17
|
+
} from "@ax/components";
|
|
9
18
|
import { pageEditorActions } from "@ax/containers/PageEditor";
|
|
10
19
|
import { useModal } from "@ax/hooks";
|
|
11
20
|
import { DeleteModal, DuplicateModal, UnpublishModal } from "./atoms";
|
|
@@ -27,6 +36,8 @@ const GlobalPageItem = (props: IGlobalPageItemProps): JSX.Element => {
|
|
|
27
36
|
isAllPages,
|
|
28
37
|
updatePageStatus,
|
|
29
38
|
duplicatePage,
|
|
39
|
+
getPage,
|
|
40
|
+
validatePage,
|
|
30
41
|
setHistoryPush,
|
|
31
42
|
deletePage,
|
|
32
43
|
getGlobalPages,
|
|
@@ -39,6 +50,7 @@ const GlobalPageItem = (props: IGlobalPageItemProps): JSX.Element => {
|
|
|
39
50
|
columns,
|
|
40
51
|
categoryColors,
|
|
41
52
|
addCategoryColors,
|
|
53
|
+
skipReview,
|
|
42
54
|
} = props;
|
|
43
55
|
|
|
44
56
|
const activeColumns = Object.keys(columns).filter((col: string) => columns[col].show);
|
|
@@ -140,8 +152,13 @@ const GlobalPageItem = (props: IGlobalPageItemProps): JSX.Element => {
|
|
|
140
152
|
};
|
|
141
153
|
|
|
142
154
|
const publishPage = async () => {
|
|
143
|
-
await
|
|
144
|
-
|
|
155
|
+
await getPage(globalPage.id);
|
|
156
|
+
const isValidated = skipReview ? true : await validatePage(true);
|
|
157
|
+
|
|
158
|
+
if (isValidated) {
|
|
159
|
+
await updatePageStatus([globalPage.id], pageStatus.UPLOAD_PENDING, true);
|
|
160
|
+
getGlobalPages();
|
|
161
|
+
}
|
|
145
162
|
};
|
|
146
163
|
|
|
147
164
|
const unpublishPage = async () => {
|
|
@@ -406,6 +423,8 @@ interface IGlobalPageItemProps {
|
|
|
406
423
|
globalPage: IPage;
|
|
407
424
|
updatePageStatus(ids: number[], status: string, updatedFromList: boolean): Promise<boolean>;
|
|
408
425
|
duplicatePage(pageID: number, data: { title: string; slug: string }, siteID?: number): Promise<boolean>;
|
|
426
|
+
getPage(pageID?: number, global?: boolean): Promise<void>;
|
|
427
|
+
validatePage(publish?: boolean, browserRef?: any, currentPage?: IPage): Promise<boolean>;
|
|
409
428
|
setHistoryPush(path: string, isEditor: boolean): void;
|
|
410
429
|
deletePage(params?: ISavePageParams, currentLanguage?: string): Promise<boolean>;
|
|
411
430
|
getGlobalPages(): void;
|
|
@@ -418,12 +437,15 @@ interface IGlobalPageItemProps {
|
|
|
418
437
|
columns: Record<string, IColumn>;
|
|
419
438
|
categoryColors: any;
|
|
420
439
|
addCategoryColors(cats: string[]): void;
|
|
440
|
+
skipReview?: boolean;
|
|
421
441
|
}
|
|
422
442
|
|
|
423
443
|
const mapDispatchToProps = {
|
|
424
444
|
setLanguage: appActions.setLanguage,
|
|
425
445
|
updatePageStatus: pageEditorActions.updatePageStatus,
|
|
426
446
|
duplicatePage: pageEditorActions.duplicatePage,
|
|
447
|
+
getPage: pageEditorActions.getPage,
|
|
448
|
+
validatePage: pageEditorActions.validatePage,
|
|
427
449
|
setHistoryPush: appActions.setHistoryPush,
|
|
428
450
|
deletePage: pageEditorActions.deletePage,
|
|
429
451
|
createNewTranslation: pageEditorActions.createNewTranslation,
|
|
@@ -85,6 +85,7 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
85
85
|
setCurrentDataID,
|
|
86
86
|
resetCurrentSiteErrorPages,
|
|
87
87
|
currentSiteErrorPages,
|
|
88
|
+
skipReviewOnPublish,
|
|
88
89
|
} = props;
|
|
89
90
|
|
|
90
91
|
const itemsPerPage = 50;
|
|
@@ -535,6 +536,7 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
535
536
|
columns={currentDataColumnsState}
|
|
536
537
|
categoryColors={categoryColors}
|
|
537
538
|
addCategoryColors={addCategoryColors}
|
|
539
|
+
skipReview={skipReviewOnPublish}
|
|
538
540
|
/>
|
|
539
541
|
);
|
|
540
542
|
});
|
|
@@ -634,6 +636,7 @@ const mapStateToProps = (state: IRootState) => ({
|
|
|
634
636
|
template: state.pageEditor.template,
|
|
635
637
|
currentSitePages: state.sites.currentSitePages,
|
|
636
638
|
currentSiteErrorPages: state.sites.currentSiteErrorPages,
|
|
639
|
+
skipReviewOnPublish: state.app.globalSettings.skipReviewOnPublish,
|
|
637
640
|
});
|
|
638
641
|
|
|
639
642
|
const mapDispatchToProps = {
|
|
@@ -698,6 +701,7 @@ interface ICategoriesProps {
|
|
|
698
701
|
template: string;
|
|
699
702
|
currentSitePages: IPage[];
|
|
700
703
|
currentSiteErrorPages: number[];
|
|
704
|
+
skipReviewOnPublish?: boolean;
|
|
701
705
|
}
|
|
702
706
|
|
|
703
707
|
type IProps = ICategoriesProps & IDispatchProps;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const initialState = {
|
|
2
|
-
scriptCode: "",
|
|
3
|
-
siteScriptCodeExists: false,
|
|
4
|
-
dimensions: [{ name: "", values: "" }],
|
|
5
|
-
groups: [{ templates: "", name: "", dimensions: "" }],
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
9
|
-
export default (state = initialState, action: { type: unknown }) => {
|
|
10
|
-
switch (action.type) {
|
|
11
|
-
default:
|
|
12
|
-
return state;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { AppActionsCreators } from "@ax/containers/App/interfaces";
|
|
2
|
-
import { initialState } from "@ax/containers/App/reducer";
|
|
3
|
-
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
5
|
-
export default (state = initialState, action: { type: AppActionsCreators }) => {
|
|
6
|
-
switch (action.type) {
|
|
7
|
-
default:
|
|
8
|
-
return state;
|
|
9
|
-
}
|
|
10
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { PageEditorActionsCreators } from "../../containers/PageEditor/interfaces";
|
|
2
|
-
|
|
3
|
-
const initialState = {
|
|
4
|
-
editorContent: {},
|
|
5
|
-
template: "BasicTemplate",
|
|
6
|
-
breadcrumb: [],
|
|
7
|
-
schema: {},
|
|
8
|
-
selectedContent: {},
|
|
9
|
-
tab: "content",
|
|
10
|
-
selectedEditorID: 0,
|
|
11
|
-
currentPageID: null,
|
|
12
|
-
currentPageStatus: null,
|
|
13
|
-
currentPageName: "",
|
|
14
|
-
currentPageLanguages: [],
|
|
15
|
-
isNewTranslation: false,
|
|
16
|
-
templateConfig: {},
|
|
17
|
-
selectedParent: null,
|
|
18
|
-
errors: [],
|
|
19
|
-
validated: false,
|
|
20
|
-
sitePageID: null,
|
|
21
|
-
userEditing: null,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
25
|
-
export default (state = initialState, action: { type: PageEditorActionsCreators }) => {
|
|
26
|
-
switch (action.type) {
|
|
27
|
-
default:
|
|
28
|
-
return state;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { initialState } from "@ax/containers/Sites/reducer";
|
|
2
|
-
import { SitesActionsCreators } from "@ax/containers/Sites/interfaces";
|
|
3
|
-
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
5
|
-
export default (state = initialState, action: { type: SitesActionsCreators }) => {
|
|
6
|
-
switch (action.type) {
|
|
7
|
-
default:
|
|
8
|
-
return state;
|
|
9
|
-
}
|
|
10
|
-
};
|