decap-cms-core 3.5.0 → 3.6.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/dist/decap-cms-core.js +9 -9
- package/dist/decap-cms-core.js.map +1 -1
- package/dist/esm/actions/auth.js +22 -37
- package/dist/esm/actions/collections.js +9 -17
- package/dist/esm/actions/config.js +58 -74
- package/dist/esm/actions/deploys.js +10 -17
- package/dist/esm/actions/editorialWorkflow.js +87 -101
- package/dist/esm/actions/entries.js +161 -211
- package/dist/esm/actions/media.js +31 -46
- package/dist/esm/actions/mediaLibrary.js +94 -126
- package/dist/esm/actions/notifications.js +5 -13
- package/dist/esm/actions/search.js +30 -47
- package/dist/esm/actions/status.js +13 -23
- package/dist/esm/actions/waitUntil.js +4 -11
- package/dist/esm/backend.js +132 -148
- package/dist/esm/bootstrap.js +37 -44
- package/dist/esm/components/App/App.js +82 -89
- package/dist/esm/components/App/Header.js +46 -52
- package/dist/esm/components/App/NotFoundPage.js +11 -18
- package/dist/esm/components/Collection/Collection.js +55 -63
- package/dist/esm/components/Collection/CollectionControls.js +15 -22
- package/dist/esm/components/Collection/CollectionSearch.js +35 -42
- package/dist/esm/components/Collection/CollectionTop.js +23 -30
- package/dist/esm/components/Collection/ControlButton.js +10 -16
- package/dist/esm/components/Collection/Entries/Entries.js +24 -31
- package/dist/esm/components/Collection/Entries/EntriesCollection.js +52 -62
- package/dist/esm/components/Collection/Entries/EntriesSearch.js +26 -33
- package/dist/esm/components/Collection/Entries/EntryCard.js +38 -45
- package/dist/esm/components/Collection/Entries/EntryListing.js +24 -32
- package/dist/esm/components/Collection/FilterControl.js +9 -16
- package/dist/esm/components/Collection/GroupControl.js +9 -16
- package/dist/esm/components/Collection/NestedCollection.js +54 -65
- package/dist/esm/components/Collection/Sidebar.js +36 -43
- package/dist/esm/components/Collection/SortControl.js +19 -26
- package/dist/esm/components/Collection/ViewStyleControl.js +17 -24
- package/dist/esm/components/Editor/Editor.js +100 -108
- package/dist/esm/components/Editor/EditorControlPane/EditorControl.js +105 -112
- package/dist/esm/components/Editor/EditorControlPane/EditorControlPane.js +68 -62
- package/dist/esm/components/Editor/EditorControlPane/Widget.js +87 -73
- package/dist/esm/components/Editor/EditorInterface.js +95 -98
- package/dist/esm/components/Editor/EditorPreviewPane/EditorPreview.js +13 -21
- package/dist/esm/components/Editor/EditorPreviewPane/EditorPreviewContent.js +64 -23
- package/dist/esm/components/Editor/EditorPreviewPane/EditorPreviewPane.js +94 -78
- package/dist/esm/components/Editor/EditorPreviewPane/PreviewHOC.js +9 -16
- package/dist/esm/components/Editor/EditorToolbar.js +133 -140
- package/dist/esm/components/Editor/withWorkflow.js +15 -22
- package/dist/esm/components/EditorWidgets/Unknown/UnknownControl.js +9 -16
- package/dist/esm/components/EditorWidgets/Unknown/UnknownPreview.js +9 -16
- package/dist/esm/components/EditorWidgets/index.js +4 -7
- package/dist/esm/components/MediaLibrary/EmptyMessage.js +12 -19
- package/dist/esm/components/MediaLibrary/MediaLibrary.js +55 -62
- package/dist/esm/components/MediaLibrary/MediaLibraryButtons.js +28 -35
- package/dist/esm/components/MediaLibrary/MediaLibraryCard.js +36 -43
- package/dist/esm/components/MediaLibrary/MediaLibraryCardGrid.js +50 -57
- package/dist/esm/components/MediaLibrary/MediaLibraryHeader.js +16 -23
- package/dist/esm/components/MediaLibrary/MediaLibraryModal.js +59 -64
- package/dist/esm/components/MediaLibrary/MediaLibrarySearch.js +18 -25
- package/dist/esm/components/MediaLibrary/MediaLibraryTop.js +39 -46
- package/dist/esm/components/UI/DragDrop.js +21 -30
- package/dist/esm/components/UI/ErrorBoundary.js +35 -43
- package/dist/esm/components/UI/FileUploadButton.js +11 -18
- package/dist/esm/components/UI/Modal.js +19 -26
- package/dist/esm/components/UI/Notifications.js +21 -28
- package/dist/esm/components/UI/SettingsDropdown.js +28 -34
- package/dist/esm/components/UI/index.js +6 -60
- package/dist/esm/components/Workflow/Workflow.js +52 -61
- package/dist/esm/components/Workflow/WorkflowCard.js +45 -51
- package/dist/esm/components/Workflow/WorkflowList.js +43 -49
- package/dist/esm/constants/collectionTypes.js +2 -8
- package/dist/esm/constants/collectionViews.js +2 -8
- package/dist/esm/constants/commitProps.js +2 -8
- package/dist/esm/constants/configSchema.js +20 -27
- package/dist/esm/constants/fieldInference.js +8 -15
- package/dist/esm/constants/publishModes.js +6 -11
- package/dist/esm/constants/validationErrorTypes.js +1 -7
- package/dist/esm/formats/formats.js +32 -41
- package/dist/esm/formats/frontmatter.js +18 -30
- package/dist/esm/formats/helpers.js +1 -7
- package/dist/esm/formats/json.js +1 -7
- package/dist/esm/formats/toml.js +11 -18
- package/dist/esm/formats/yaml.js +7 -14
- package/dist/esm/index.js +5 -12
- package/dist/esm/integrations/index.js +8 -16
- package/dist/esm/integrations/providers/algolia/implementation.js +14 -22
- package/dist/esm/integrations/providers/assetStore/implementation.js +10 -18
- package/dist/esm/lib/consoleError.js +1 -7
- package/dist/esm/lib/formatters.js +34 -47
- package/dist/esm/lib/i18n.js +37 -66
- package/dist/esm/lib/phrases.js +4 -11
- package/dist/esm/lib/registry.js +40 -75
- package/dist/esm/lib/serializeEntryValues.js +11 -18
- package/dist/esm/lib/textHelper.js +1 -7
- package/dist/esm/lib/urlHelper.js +28 -43
- package/dist/esm/mediaLibrary.js +12 -16
- package/dist/esm/reducers/auth.js +10 -16
- package/dist/esm/reducers/collections.js +70 -102
- package/dist/esm/reducers/combinedReducer.js +4 -11
- package/dist/esm/reducers/config.js +11 -19
- package/dist/esm/reducers/cursors.js +12 -18
- package/dist/esm/reducers/deploys.js +8 -15
- package/dist/esm/reducers/editorialWorkflow.js +37 -47
- package/dist/esm/reducers/entries.js +107 -132
- package/dist/esm/reducers/entryDraft.js +64 -72
- package/dist/esm/reducers/globalUI.js +5 -11
- package/dist/esm/reducers/index.js +43 -64
- package/dist/esm/reducers/integrations.js +8 -16
- package/dist/esm/reducers/mediaLibrary.js +43 -52
- package/dist/esm/reducers/medias.js +11 -18
- package/dist/esm/reducers/notifications.js +9 -15
- package/dist/esm/reducers/search.js +12 -18
- package/dist/esm/reducers/status.js +7 -13
- package/dist/esm/redux/index.js +7 -13
- package/dist/esm/redux/middleware/waitUntilAction.js +3 -10
- package/dist/esm/routing/history.js +7 -15
- package/dist/esm/types/diacritics.d.js +0 -1
- package/dist/esm/types/global.d.js +1 -5
- package/dist/esm/types/immutable.js +1 -5
- package/dist/esm/types/redux.js +7 -8
- package/dist/esm/types/tomlify-j0.4.d.js +0 -1
- package/dist/esm/valueObjects/AssetProxy.js +2 -10
- package/dist/esm/valueObjects/EditorComponent.js +5 -12
- package/dist/esm/valueObjects/Entry.js +3 -10
- package/package.json +3 -2
- package/src/components/Collection/Entries/EntriesCollection.js +7 -8
- package/src/components/Collection/Entries/__tests__/EntriesCollection.spec.js +3 -5
- package/src/components/Collection/Entries/__tests__/__snapshots__/EntriesCollection.spec.js.snap +8 -8
- package/src/components/Collection/NestedCollection.js +2 -2
- package/src/components/Collection/__tests__/__snapshots__/NestedCollection.spec.js.snap +68 -0
- package/src/components/Editor/EditorControlPane/EditorControl.js +0 -3
- package/src/components/Editor/EditorControlPane/EditorControlPane.js +21 -8
- package/src/components/Editor/EditorControlPane/Widget.js +22 -1
- package/src/components/Editor/EditorInterface.js +6 -1
- package/src/components/Editor/EditorPreviewPane/EditorPreviewContent.js +51 -11
- package/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js +33 -1
- package/dist/esm/actions/editorControl.js +0 -14
- package/dist/esm/reducers/editorComponent.js +0 -1
- package/dist/esm/reducers/editorControl.js +0 -17
|
@@ -1,49 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var _editorialWorkflow = require("../actions/editorialWorkflow");
|
|
14
|
-
var _collections = require("./collections");
|
|
15
|
-
var _i18n = require("../lib/i18n");
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
const initialState = (0, _immutable.Map)({
|
|
18
|
-
entry: (0, _immutable.Map)(),
|
|
19
|
-
fieldsMetaData: (0, _immutable.Map)(),
|
|
20
|
-
fieldsErrors: (0, _immutable.Map)(),
|
|
1
|
+
import _get from "lodash/get";
|
|
2
|
+
import { Map, List, fromJS } from 'immutable';
|
|
3
|
+
import { v4 as uuid } from 'uuid';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
import { DRAFT_CREATE_FROM_ENTRY, DRAFT_CREATE_EMPTY, DRAFT_DISCARD, DRAFT_CHANGE_FIELD, DRAFT_VALIDATION_ERRORS, DRAFT_CLEAR_ERRORS, DRAFT_LOCAL_BACKUP_RETRIEVED, DRAFT_CREATE_FROM_LOCAL_BACKUP, DRAFT_CREATE_DUPLICATE_FROM_ENTRY, ENTRY_PERSIST_REQUEST, ENTRY_PERSIST_SUCCESS, ENTRY_PERSIST_FAILURE, ENTRY_DELETE_SUCCESS, ADD_DRAFT_ENTRY_MEDIA_FILE, REMOVE_DRAFT_ENTRY_MEDIA_FILE } from '../actions/entries';
|
|
6
|
+
import { UNPUBLISHED_ENTRY_PERSIST_REQUEST, UNPUBLISHED_ENTRY_PERSIST_SUCCESS, UNPUBLISHED_ENTRY_PERSIST_FAILURE, UNPUBLISHED_ENTRY_STATUS_CHANGE_REQUEST, UNPUBLISHED_ENTRY_STATUS_CHANGE_SUCCESS, UNPUBLISHED_ENTRY_STATUS_CHANGE_FAILURE, UNPUBLISHED_ENTRY_PUBLISH_REQUEST, UNPUBLISHED_ENTRY_PUBLISH_SUCCESS, UNPUBLISHED_ENTRY_PUBLISH_FAILURE } from '../actions/editorialWorkflow';
|
|
7
|
+
import { selectFolderEntryExtension, selectHasMetaPath } from './collections';
|
|
8
|
+
import { getDataPath, duplicateI18nFields } from '../lib/i18n';
|
|
9
|
+
const initialState = Map({
|
|
10
|
+
entry: Map(),
|
|
11
|
+
fieldsMetaData: Map(),
|
|
12
|
+
fieldsErrors: Map(),
|
|
21
13
|
hasChanged: false,
|
|
22
14
|
key: ''
|
|
23
15
|
});
|
|
24
|
-
function entryDraftReducer(state =
|
|
16
|
+
function entryDraftReducer(state = Map(), action) {
|
|
25
17
|
switch (action.type) {
|
|
26
|
-
case
|
|
18
|
+
case DRAFT_CREATE_FROM_ENTRY:
|
|
27
19
|
// Existing Entry
|
|
28
20
|
return state.withMutations(state => {
|
|
29
|
-
state.set('entry',
|
|
21
|
+
state.set('entry', fromJS(action.payload.entry));
|
|
30
22
|
state.setIn(['entry', 'newRecord'], false);
|
|
31
|
-
state.set('fieldsMetaData',
|
|
32
|
-
state.set('fieldsErrors',
|
|
23
|
+
state.set('fieldsMetaData', Map());
|
|
24
|
+
state.set('fieldsErrors', Map());
|
|
33
25
|
state.set('hasChanged', false);
|
|
34
|
-
state.set('key', (
|
|
26
|
+
state.set('key', uuid());
|
|
35
27
|
});
|
|
36
|
-
case
|
|
28
|
+
case DRAFT_CREATE_EMPTY:
|
|
37
29
|
// New Entry
|
|
38
30
|
return state.withMutations(state => {
|
|
39
|
-
state.set('entry',
|
|
31
|
+
state.set('entry', fromJS(action.payload));
|
|
40
32
|
state.setIn(['entry', 'newRecord'], true);
|
|
41
|
-
state.set('fieldsMetaData',
|
|
42
|
-
state.set('fieldsErrors',
|
|
33
|
+
state.set('fieldsMetaData', Map());
|
|
34
|
+
state.set('fieldsErrors', Map());
|
|
43
35
|
state.set('hasChanged', false);
|
|
44
|
-
state.set('key', (
|
|
36
|
+
state.set('key', uuid());
|
|
45
37
|
});
|
|
46
|
-
case
|
|
38
|
+
case DRAFT_CREATE_FROM_LOCAL_BACKUP:
|
|
47
39
|
// Local Backup
|
|
48
40
|
return state.withMutations(state => {
|
|
49
41
|
const backupDraftEntry = state.get('localBackup');
|
|
@@ -51,34 +43,34 @@ function entryDraftReducer(state = (0, _immutable.Map)(), action) {
|
|
|
51
43
|
state.delete('localBackup');
|
|
52
44
|
state.set('entry', backupEntry);
|
|
53
45
|
state.setIn(['entry', 'newRecord'], !backupEntry.get('path'));
|
|
54
|
-
state.set('fieldsMetaData',
|
|
55
|
-
state.set('fieldsErrors',
|
|
46
|
+
state.set('fieldsMetaData', Map());
|
|
47
|
+
state.set('fieldsErrors', Map());
|
|
56
48
|
state.set('hasChanged', true);
|
|
57
|
-
state.set('key', (
|
|
49
|
+
state.set('key', uuid());
|
|
58
50
|
});
|
|
59
|
-
case
|
|
51
|
+
case DRAFT_CREATE_DUPLICATE_FROM_ENTRY:
|
|
60
52
|
// Duplicate Entry
|
|
61
53
|
return state.withMutations(state => {
|
|
62
|
-
state.set('entry',
|
|
54
|
+
state.set('entry', fromJS(action.payload));
|
|
63
55
|
state.setIn(['entry', 'newRecord'], true);
|
|
64
|
-
state.set('mediaFiles',
|
|
65
|
-
state.set('fieldsMetaData',
|
|
66
|
-
state.set('fieldsErrors',
|
|
56
|
+
state.set('mediaFiles', List());
|
|
57
|
+
state.set('fieldsMetaData', Map());
|
|
58
|
+
state.set('fieldsErrors', Map());
|
|
67
59
|
state.set('hasChanged', true);
|
|
68
60
|
});
|
|
69
|
-
case
|
|
61
|
+
case DRAFT_DISCARD:
|
|
70
62
|
return initialState;
|
|
71
|
-
case
|
|
63
|
+
case DRAFT_LOCAL_BACKUP_RETRIEVED:
|
|
72
64
|
{
|
|
73
65
|
const {
|
|
74
66
|
entry
|
|
75
67
|
} = action.payload;
|
|
76
|
-
const newState = new
|
|
77
|
-
entry:
|
|
68
|
+
const newState = new Map({
|
|
69
|
+
entry: fromJS(entry)
|
|
78
70
|
});
|
|
79
71
|
return state.set('localBackup', newState);
|
|
80
72
|
}
|
|
81
|
-
case
|
|
73
|
+
case DRAFT_CHANGE_FIELD:
|
|
82
74
|
{
|
|
83
75
|
return state.withMutations(state => {
|
|
84
76
|
const {
|
|
@@ -90,56 +82,56 @@ function entryDraftReducer(state = (0, _immutable.Map)(), action) {
|
|
|
90
82
|
} = action.payload;
|
|
91
83
|
const name = field.get('name');
|
|
92
84
|
const meta = field.get('meta');
|
|
93
|
-
const dataPath = i18n &&
|
|
85
|
+
const dataPath = i18n && getDataPath(i18n.currentLocale, i18n.defaultLocale) || ['data'];
|
|
94
86
|
if (meta) {
|
|
95
87
|
state.setIn(['entry', 'meta', name], value);
|
|
96
88
|
} else {
|
|
97
89
|
state.setIn(['entry', ...dataPath, name], value);
|
|
98
90
|
if (i18n) {
|
|
99
|
-
state =
|
|
91
|
+
state = duplicateI18nFields(state, field, i18n.locales, i18n.defaultLocale);
|
|
100
92
|
}
|
|
101
93
|
}
|
|
102
|
-
state.mergeDeepIn(['fieldsMetaData'],
|
|
94
|
+
state.mergeDeepIn(['fieldsMetaData'], fromJS(metadata));
|
|
103
95
|
const newData = state.getIn(['entry', ...dataPath]);
|
|
104
96
|
const newMeta = state.getIn(['entry', 'meta']);
|
|
105
97
|
state.set('hasChanged', !entries.some(e => newData.equals(e.get(...dataPath))) || !entries.some(e => newMeta.equals(e.get('meta'))));
|
|
106
98
|
});
|
|
107
99
|
}
|
|
108
|
-
case
|
|
100
|
+
case DRAFT_VALIDATION_ERRORS:
|
|
109
101
|
if (action.payload.errors.length === 0) {
|
|
110
102
|
return state.deleteIn(['fieldsErrors', action.payload.uniquefieldId]);
|
|
111
103
|
} else {
|
|
112
104
|
return state.setIn(['fieldsErrors', action.payload.uniquefieldId], action.payload.errors);
|
|
113
105
|
}
|
|
114
|
-
case
|
|
106
|
+
case DRAFT_CLEAR_ERRORS:
|
|
115
107
|
{
|
|
116
108
|
const {
|
|
117
109
|
uniqueFieldId
|
|
118
110
|
} = action.payload;
|
|
119
111
|
return state.deleteIn(['fieldsErrors', uniqueFieldId]);
|
|
120
112
|
}
|
|
121
|
-
case
|
|
122
|
-
case
|
|
113
|
+
case ENTRY_PERSIST_REQUEST:
|
|
114
|
+
case UNPUBLISHED_ENTRY_PERSIST_REQUEST:
|
|
123
115
|
{
|
|
124
116
|
return state.setIn(['entry', 'isPersisting'], true);
|
|
125
117
|
}
|
|
126
|
-
case
|
|
127
|
-
case
|
|
118
|
+
case ENTRY_PERSIST_FAILURE:
|
|
119
|
+
case UNPUBLISHED_ENTRY_PERSIST_FAILURE:
|
|
128
120
|
{
|
|
129
121
|
return state.deleteIn(['entry', 'isPersisting']);
|
|
130
122
|
}
|
|
131
|
-
case
|
|
123
|
+
case UNPUBLISHED_ENTRY_STATUS_CHANGE_REQUEST:
|
|
132
124
|
return state.setIn(['entry', 'isUpdatingStatus'], true);
|
|
133
|
-
case
|
|
134
|
-
case
|
|
125
|
+
case UNPUBLISHED_ENTRY_STATUS_CHANGE_FAILURE:
|
|
126
|
+
case UNPUBLISHED_ENTRY_STATUS_CHANGE_SUCCESS:
|
|
135
127
|
return state.deleteIn(['entry', 'isUpdatingStatus']);
|
|
136
|
-
case
|
|
128
|
+
case UNPUBLISHED_ENTRY_PUBLISH_REQUEST:
|
|
137
129
|
return state.setIn(['entry', 'isPublishing'], true);
|
|
138
|
-
case
|
|
139
|
-
case
|
|
130
|
+
case UNPUBLISHED_ENTRY_PUBLISH_SUCCESS:
|
|
131
|
+
case UNPUBLISHED_ENTRY_PUBLISH_FAILURE:
|
|
140
132
|
return state.deleteIn(['entry', 'isPublishing']);
|
|
141
|
-
case
|
|
142
|
-
case
|
|
133
|
+
case ENTRY_PERSIST_SUCCESS:
|
|
134
|
+
case UNPUBLISHED_ENTRY_PERSIST_SUCCESS:
|
|
143
135
|
return state.withMutations(state => {
|
|
144
136
|
state.deleteIn(['entry', 'isPersisting']);
|
|
145
137
|
state.set('hasChanged', false);
|
|
@@ -147,20 +139,20 @@ function entryDraftReducer(state = (0, _immutable.Map)(), action) {
|
|
|
147
139
|
state.setIn(['entry', 'slug'], action.payload.slug);
|
|
148
140
|
}
|
|
149
141
|
});
|
|
150
|
-
case
|
|
142
|
+
case ENTRY_DELETE_SUCCESS:
|
|
151
143
|
return state.withMutations(state => {
|
|
152
144
|
state.deleteIn(['entry', 'isPersisting']);
|
|
153
145
|
state.set('hasChanged', false);
|
|
154
146
|
});
|
|
155
|
-
case
|
|
147
|
+
case ADD_DRAFT_ENTRY_MEDIA_FILE:
|
|
156
148
|
{
|
|
157
149
|
return state.withMutations(state => {
|
|
158
150
|
const mediaFiles = state.getIn(['entry', 'mediaFiles']);
|
|
159
|
-
state.setIn(['entry', 'mediaFiles'], mediaFiles.filterNot(file => file.get('id') === action.payload.id).insert(0,
|
|
151
|
+
state.setIn(['entry', 'mediaFiles'], mediaFiles.filterNot(file => file.get('id') === action.payload.id).insert(0, fromJS(action.payload)));
|
|
160
152
|
state.set('hasChanged', true);
|
|
161
153
|
});
|
|
162
154
|
}
|
|
163
|
-
case
|
|
155
|
+
case REMOVE_DRAFT_ENTRY_MEDIA_FILE:
|
|
164
156
|
{
|
|
165
157
|
return state.withMutations(state => {
|
|
166
158
|
const mediaFiles = state.getIn(['entry', 'mediaFiles']);
|
|
@@ -172,15 +164,15 @@ function entryDraftReducer(state = (0, _immutable.Map)(), action) {
|
|
|
172
164
|
return state;
|
|
173
165
|
}
|
|
174
166
|
}
|
|
175
|
-
function selectCustomPath(collection, entryDraft) {
|
|
176
|
-
if (!
|
|
167
|
+
export function selectCustomPath(collection, entryDraft) {
|
|
168
|
+
if (!selectHasMetaPath(collection)) {
|
|
177
169
|
return;
|
|
178
170
|
}
|
|
179
171
|
const meta = entryDraft.getIn(['entry', 'meta']);
|
|
180
172
|
const path = meta && meta.get('path');
|
|
181
|
-
const indexFile = (
|
|
182
|
-
const extension =
|
|
183
|
-
const customPath = path &&
|
|
173
|
+
const indexFile = _get(collection.toJS(), ['meta', 'path', 'index_file']);
|
|
174
|
+
const extension = selectFolderEntryExtension(collection);
|
|
175
|
+
const customPath = path && join(collection.get('folder'), path, `${indexFile}.${extension}`);
|
|
184
176
|
return customPath;
|
|
185
177
|
}
|
|
186
|
-
|
|
178
|
+
export default entryDraftReducer;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _immer = require("immer");
|
|
8
|
-
var _auth = require("../actions/auth");
|
|
1
|
+
import { produce } from 'immer';
|
|
2
|
+
import { USE_OPEN_AUTHORING } from '../actions/auth';
|
|
9
3
|
const LOADING_IGNORE_LIST = ['DEPLOY_PREVIEW', 'STATUS_REQUEST', 'STATUS_SUCCESS', 'STATUS_FAILURE'];
|
|
10
4
|
function ignoreWhenLoading(action) {
|
|
11
5
|
return LOADING_IGNORE_LIST.some(type => action.type.includes(type));
|
|
@@ -18,14 +12,14 @@ const defaultState = {
|
|
|
18
12
|
/**
|
|
19
13
|
* Reducer for some global UI state that we want to share between components
|
|
20
14
|
*/
|
|
21
|
-
const globalUI =
|
|
15
|
+
const globalUI = produce((state, action) => {
|
|
22
16
|
// Generic, global loading indicator
|
|
23
17
|
if (!ignoreWhenLoading(action) && action.type.includes('REQUEST')) {
|
|
24
18
|
state.isFetching = true;
|
|
25
19
|
} else if (!ignoreWhenLoading(action) && (action.type.includes('SUCCESS') || action.type.includes('FAILURE'))) {
|
|
26
20
|
state.isFetching = false;
|
|
27
|
-
} else if (action.type ===
|
|
21
|
+
} else if (action.type === USE_OPEN_AUTHORING) {
|
|
28
22
|
state.useOpenAuthoring = true;
|
|
29
23
|
}
|
|
30
24
|
}, defaultState);
|
|
31
|
-
|
|
25
|
+
export default globalUI;
|
|
@@ -1,87 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var _auth = _interopRequireDefault(require("./auth"));
|
|
18
|
-
var _config = _interopRequireDefault(require("./config"));
|
|
19
|
-
var _integrations = _interopRequireWildcard(require("./integrations"));
|
|
20
|
-
var fromIntegrations = _integrations;
|
|
21
|
-
var _entries = _interopRequireWildcard(require("./entries"));
|
|
22
|
-
var fromEntries = _entries;
|
|
23
|
-
var _cursors = _interopRequireDefault(require("./cursors"));
|
|
24
|
-
var _editorialWorkflow = _interopRequireWildcard(require("./editorialWorkflow"));
|
|
25
|
-
var fromEditorialWorkflow = _editorialWorkflow;
|
|
26
|
-
var _entryDraft = _interopRequireDefault(require("./entryDraft"));
|
|
27
|
-
var _collections = _interopRequireDefault(require("./collections"));
|
|
28
|
-
var _search = _interopRequireDefault(require("./search"));
|
|
29
|
-
var _medias = _interopRequireDefault(require("./medias"));
|
|
30
|
-
var _mediaLibrary = _interopRequireDefault(require("./mediaLibrary"));
|
|
31
|
-
var _deploys = _interopRequireWildcard(require("./deploys"));
|
|
32
|
-
var fromDeploys = _deploys;
|
|
33
|
-
var _globalUI = _interopRequireDefault(require("./globalUI"));
|
|
34
|
-
var _status = _interopRequireDefault(require("./status"));
|
|
35
|
-
var _notifications = _interopRequireDefault(require("./notifications"));
|
|
36
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
37
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
38
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
|
+
import { List } from 'immutable';
|
|
2
|
+
import auth from './auth';
|
|
3
|
+
import config from './config';
|
|
4
|
+
import integrations, * as fromIntegrations from './integrations';
|
|
5
|
+
import entries, * as fromEntries from './entries';
|
|
6
|
+
import cursors from './cursors';
|
|
7
|
+
import editorialWorkflow, * as fromEditorialWorkflow from './editorialWorkflow';
|
|
8
|
+
import entryDraft from './entryDraft';
|
|
9
|
+
import collections from './collections';
|
|
10
|
+
import search from './search';
|
|
11
|
+
import medias from './medias';
|
|
12
|
+
import mediaLibrary from './mediaLibrary';
|
|
13
|
+
import deploys, * as fromDeploys from './deploys';
|
|
14
|
+
import globalUI from './globalUI';
|
|
15
|
+
import status from './status';
|
|
16
|
+
import notifications from './notifications';
|
|
39
17
|
const reducers = {
|
|
40
|
-
auth
|
|
41
|
-
config
|
|
42
|
-
collections
|
|
43
|
-
search
|
|
44
|
-
integrations
|
|
45
|
-
entries
|
|
46
|
-
cursors
|
|
47
|
-
editorialWorkflow
|
|
48
|
-
entryDraft
|
|
49
|
-
medias
|
|
50
|
-
mediaLibrary
|
|
51
|
-
deploys
|
|
52
|
-
globalUI
|
|
53
|
-
status
|
|
54
|
-
notifications
|
|
18
|
+
auth,
|
|
19
|
+
config,
|
|
20
|
+
collections,
|
|
21
|
+
search,
|
|
22
|
+
integrations,
|
|
23
|
+
entries,
|
|
24
|
+
cursors,
|
|
25
|
+
editorialWorkflow,
|
|
26
|
+
entryDraft,
|
|
27
|
+
medias,
|
|
28
|
+
mediaLibrary,
|
|
29
|
+
deploys,
|
|
30
|
+
globalUI,
|
|
31
|
+
status,
|
|
32
|
+
notifications
|
|
55
33
|
};
|
|
56
|
-
|
|
34
|
+
export default reducers;
|
|
35
|
+
|
|
57
36
|
/*
|
|
58
37
|
* Selectors
|
|
59
38
|
*/
|
|
60
|
-
function selectEntry(state, collection, slug) {
|
|
39
|
+
export function selectEntry(state, collection, slug) {
|
|
61
40
|
return fromEntries.selectEntry(state.entries, collection, slug);
|
|
62
41
|
}
|
|
63
|
-
function selectEntries(state, collection) {
|
|
42
|
+
export function selectEntries(state, collection) {
|
|
64
43
|
return fromEntries.selectEntries(state.entries, collection);
|
|
65
44
|
}
|
|
66
|
-
function selectPublishedSlugs(state, collection) {
|
|
45
|
+
export function selectPublishedSlugs(state, collection) {
|
|
67
46
|
return fromEntries.selectPublishedSlugs(state.entries, collection);
|
|
68
47
|
}
|
|
69
|
-
function selectSearchedEntries(state, availableCollections) {
|
|
48
|
+
export function selectSearchedEntries(state, availableCollections) {
|
|
70
49
|
// only return search results for actually available collections
|
|
71
|
-
return
|
|
50
|
+
return List(state.search.entryIds).filter(entryId => availableCollections.indexOf(entryId.collection) !== -1).map(entryId => fromEntries.selectEntry(state.entries, entryId.collection, entryId.slug));
|
|
72
51
|
}
|
|
73
|
-
function selectDeployPreview(state, collection, slug) {
|
|
52
|
+
export function selectDeployPreview(state, collection, slug) {
|
|
74
53
|
return fromDeploys.selectDeployPreview(state.deploys, collection, slug);
|
|
75
54
|
}
|
|
76
|
-
function selectUnpublishedEntry(state, collection, slug) {
|
|
55
|
+
export function selectUnpublishedEntry(state, collection, slug) {
|
|
77
56
|
return fromEditorialWorkflow.selectUnpublishedEntry(state.editorialWorkflow, collection, slug);
|
|
78
57
|
}
|
|
79
|
-
function selectUnpublishedEntriesByStatus(state, status) {
|
|
58
|
+
export function selectUnpublishedEntriesByStatus(state, status) {
|
|
80
59
|
return fromEditorialWorkflow.selectUnpublishedEntriesByStatus(state.editorialWorkflow, status);
|
|
81
60
|
}
|
|
82
|
-
function selectUnpublishedSlugs(state, collection) {
|
|
61
|
+
export function selectUnpublishedSlugs(state, collection) {
|
|
83
62
|
return fromEditorialWorkflow.selectUnpublishedSlugs(state.editorialWorkflow, collection);
|
|
84
63
|
}
|
|
85
|
-
function selectIntegration(state, collection, hook) {
|
|
64
|
+
export function selectIntegration(state, collection, hook) {
|
|
86
65
|
return fromIntegrations.selectIntegration(state.integrations, collection, hook);
|
|
87
66
|
}
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
exports.getIntegrations = getIntegrations;
|
|
8
|
-
exports.selectIntegration = selectIntegration;
|
|
9
|
-
var _immutable = require("immutable");
|
|
10
|
-
var _config = require("../actions/config");
|
|
11
1
|
const _excluded = ["hooks", "collections", "provider"];
|
|
12
2
|
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; }
|
|
13
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).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; }
|
|
@@ -16,7 +6,9 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
16
6
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
7
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
18
8
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
19
|
-
|
|
9
|
+
import { fromJS } from 'immutable';
|
|
10
|
+
import { CONFIG_SUCCESS } from '../actions/config';
|
|
11
|
+
export function getIntegrations(config) {
|
|
20
12
|
const integrations = config.integrations || [];
|
|
21
13
|
const newState = integrations.reduce((acc, integration) => {
|
|
22
14
|
const {
|
|
@@ -45,15 +37,15 @@ function getIntegrations(config) {
|
|
|
45
37
|
providers: {},
|
|
46
38
|
hooks: {}
|
|
47
39
|
});
|
|
48
|
-
return
|
|
40
|
+
return fromJS(newState);
|
|
49
41
|
}
|
|
50
|
-
const defaultState =
|
|
42
|
+
const defaultState = fromJS({
|
|
51
43
|
providers: {},
|
|
52
44
|
hooks: {}
|
|
53
45
|
});
|
|
54
46
|
function integrations(state = defaultState, action) {
|
|
55
47
|
switch (action.type) {
|
|
56
|
-
case
|
|
48
|
+
case CONFIG_SUCCESS:
|
|
57
49
|
{
|
|
58
50
|
return getIntegrations(action.payload);
|
|
59
51
|
}
|
|
@@ -61,7 +53,7 @@ function integrations(state = defaultState, action) {
|
|
|
61
53
|
return state;
|
|
62
54
|
}
|
|
63
55
|
}
|
|
64
|
-
function selectIntegration(state, collection, hook) {
|
|
56
|
+
export function selectIntegration(state, collection, hook) {
|
|
65
57
|
return collection ? state.getIn(['hooks', collection, hook], false) : state.getIn(['hooks', hook], false);
|
|
66
58
|
}
|
|
67
|
-
|
|
59
|
+
export default integrations;
|