jamespot-front-business 1.1.89 → 1.1.91
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/cjs.js +487 -254
- package/dist/cjs.js.map +1 -1
- package/dist/esm.js +480 -256
- package/dist/esm.js.map +1 -1
- package/dist/types.d.ts +5938 -2011
- package/package.json +2 -2
package/dist/cjs.js
CHANGED
|
@@ -57,9 +57,16 @@ const isAbortError = (error) => {
|
|
|
57
57
|
return !!error && typeof error === 'object' && 'aborted' in error && !!error.aborted;
|
|
58
58
|
};
|
|
59
59
|
const getErrorMessage = (error, defaultError) => {
|
|
60
|
-
|
|
61
|
-
?
|
|
62
|
-
|
|
60
|
+
if (!error || typeof error !== 'object') {
|
|
61
|
+
return defaultError !== null && defaultError !== void 0 ? defaultError : 'GLOBAL_Technical_Error';
|
|
62
|
+
}
|
|
63
|
+
if ('errorMsg' in error && typeof error.errorMsg === 'string') {
|
|
64
|
+
return error.errorMsg;
|
|
65
|
+
}
|
|
66
|
+
if ('message' in error && typeof error.message === 'string') {
|
|
67
|
+
return error.message;
|
|
68
|
+
}
|
|
69
|
+
return defaultError !== null && defaultError !== void 0 ? defaultError : 'GLOBAL_Technical_Error';
|
|
63
70
|
};
|
|
64
71
|
|
|
65
72
|
const toastAdapter = toolkit.createEntityAdapter({
|
|
@@ -105,7 +112,7 @@ const oneMonthAgo$2 = () => {
|
|
|
105
112
|
date.setMonth(date.getMonth() - 1);
|
|
106
113
|
return date;
|
|
107
114
|
};
|
|
108
|
-
const initialState$
|
|
115
|
+
const initialState$r = {
|
|
109
116
|
data: [],
|
|
110
117
|
loading: 'idle',
|
|
111
118
|
page: 1,
|
|
@@ -130,14 +137,14 @@ const fetchLogsNavigation = toolkit.createAsyncThunk('admin/fetchLogsNavigation'
|
|
|
130
137
|
}
|
|
131
138
|
catch (err) {
|
|
132
139
|
if (!isAbortError(err)) {
|
|
133
|
-
dispatch(Toast.actions.error({ label:
|
|
140
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
134
141
|
}
|
|
135
142
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve admin logs navigation' });
|
|
136
143
|
}
|
|
137
144
|
}));
|
|
138
145
|
const adminLogsNavigationSlice = toolkit.createSlice({
|
|
139
146
|
name: 'logsNavigation',
|
|
140
|
-
initialState: initialState$
|
|
147
|
+
initialState: initialState$r,
|
|
141
148
|
reducers: {
|
|
142
149
|
setNavigationOrder: (state, action) => {
|
|
143
150
|
state.orders = [...action.payload];
|
|
@@ -175,7 +182,7 @@ const oneMonthAgo$1 = () => {
|
|
|
175
182
|
date.setMonth(date.getMonth() - 1);
|
|
176
183
|
return date;
|
|
177
184
|
};
|
|
178
|
-
const initialState$
|
|
185
|
+
const initialState$q = {
|
|
179
186
|
data: [],
|
|
180
187
|
loading: 'idle',
|
|
181
188
|
page: 1,
|
|
@@ -200,14 +207,14 @@ const fetchLogsObjects = toolkit.createAsyncThunk('admin/fetchLogsObjects', (par
|
|
|
200
207
|
}
|
|
201
208
|
catch (err) {
|
|
202
209
|
if (!isAbortError(err)) {
|
|
203
|
-
dispatch(Toast.actions.error({ label:
|
|
210
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
204
211
|
}
|
|
205
212
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve admin logs Objects' });
|
|
206
213
|
}
|
|
207
214
|
}));
|
|
208
215
|
const adminLogsObjectsSlice = toolkit.createSlice({
|
|
209
216
|
name: 'logsObjects',
|
|
210
|
-
initialState: initialState$
|
|
217
|
+
initialState: initialState$q,
|
|
211
218
|
reducers: {
|
|
212
219
|
setObjectsOrder: (state, action) => {
|
|
213
220
|
state.orders = [...action.payload];
|
|
@@ -244,7 +251,7 @@ const oneMonthAgo = () => {
|
|
|
244
251
|
date.setMonth(date.getMonth() - 1);
|
|
245
252
|
return date;
|
|
246
253
|
};
|
|
247
|
-
const initialState$
|
|
254
|
+
const initialState$p = {
|
|
248
255
|
data: [],
|
|
249
256
|
loading: 'idle',
|
|
250
257
|
page: 1,
|
|
@@ -269,14 +276,14 @@ const fetchLogsSearch = toolkit.createAsyncThunk('admin/fetchLogsSearch', (param
|
|
|
269
276
|
}
|
|
270
277
|
catch (err) {
|
|
271
278
|
if (!isAbortError(err)) {
|
|
272
|
-
dispatch(Toast.actions.error({ label:
|
|
279
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
273
280
|
}
|
|
274
281
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve admin logs Search' });
|
|
275
282
|
}
|
|
276
283
|
}));
|
|
277
284
|
const adminLogsSearchSlice = toolkit.createSlice({
|
|
278
285
|
name: 'logsSearch',
|
|
279
|
-
initialState: initialState$
|
|
286
|
+
initialState: initialState$p,
|
|
280
287
|
reducers: {
|
|
281
288
|
setSearchOrder: (state, action) => {
|
|
282
289
|
state.orders = [...action.payload];
|
|
@@ -329,7 +336,7 @@ const AdminLogs = {
|
|
|
329
336
|
selectors: { selectAdminLogsNavigation, selectAdminLogsObjects, selectAdminLogsSearch },
|
|
330
337
|
};
|
|
331
338
|
|
|
332
|
-
const initialState$
|
|
339
|
+
const initialState$o = {
|
|
333
340
|
animationConfiguration: null,
|
|
334
341
|
isActiveForCurrentUser: false,
|
|
335
342
|
isInitialized: false,
|
|
@@ -337,7 +344,7 @@ const initialState$n = {
|
|
|
337
344
|
};
|
|
338
345
|
const animationsListSlice = toolkit.createSlice({
|
|
339
346
|
name: 'animationsList',
|
|
340
|
-
initialState: initialState$
|
|
347
|
+
initialState: initialState$o,
|
|
341
348
|
reducers: {},
|
|
342
349
|
extraReducers: (builder) => {
|
|
343
350
|
builder.addCase(fetchCurrentAnimation.fulfilled, (state, action) => {
|
|
@@ -369,7 +376,7 @@ const fetchCurrentAnimation = toolkit.createAsyncThunk('animations/fetchCurrentA
|
|
|
369
376
|
}
|
|
370
377
|
catch (err) {
|
|
371
378
|
if (!isAbortError(err)) {
|
|
372
|
-
dispatch(Toast.actions.error({ label:
|
|
379
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
373
380
|
}
|
|
374
381
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation' });
|
|
375
382
|
}
|
|
@@ -378,8 +385,8 @@ const fetchCurrentAnimationApp = toolkit.createAsyncThunk('animations/fetchCurre
|
|
|
378
385
|
try {
|
|
379
386
|
return (yield extra.jApi.animations.GetCurrentAnimationApp()).result;
|
|
380
387
|
}
|
|
381
|
-
catch (
|
|
382
|
-
dispatch(Toast.actions.error({ label:
|
|
388
|
+
catch (err) {
|
|
389
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
383
390
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation' });
|
|
384
391
|
}
|
|
385
392
|
}));
|
|
@@ -388,8 +395,8 @@ const deleteCurrentAnimation = toolkit.createAsyncThunk('animations/deleteCurren
|
|
|
388
395
|
yield extra.jApi.animations.DeleteAnimation();
|
|
389
396
|
return;
|
|
390
397
|
}
|
|
391
|
-
catch (
|
|
392
|
-
dispatch(Toast.actions.error({ label:
|
|
398
|
+
catch (err) {
|
|
399
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
393
400
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot delete animation' });
|
|
394
401
|
}
|
|
395
402
|
}));
|
|
@@ -398,8 +405,8 @@ const saveCurrentAnimation = toolkit.createAsyncThunk('animations/saveCurrentAni
|
|
|
398
405
|
yield extra.jApi.animations.SaveAnimationConfiguration(params);
|
|
399
406
|
return;
|
|
400
407
|
}
|
|
401
|
-
catch (
|
|
402
|
-
dispatch(Toast.actions.error({ label:
|
|
408
|
+
catch (err) {
|
|
409
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
403
410
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot update animation' });
|
|
404
411
|
}
|
|
405
412
|
}));
|
|
@@ -408,8 +415,8 @@ const toggleAnimationIsActive = toolkit.createAsyncThunk('animations/toggleAnima
|
|
|
408
415
|
yield extra.jApi.animations.ToggleAnimationActive();
|
|
409
416
|
return;
|
|
410
417
|
}
|
|
411
|
-
catch (
|
|
412
|
-
dispatch(Toast.actions.error({ label:
|
|
418
|
+
catch (err) {
|
|
419
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
413
420
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot update animation' });
|
|
414
421
|
}
|
|
415
422
|
}));
|
|
@@ -456,8 +463,8 @@ const fetchAnimationStats = toolkit.createAsyncThunk('animations/fetchAnimationS
|
|
|
456
463
|
const stats = (yield extra.jApi.animations.GetAnimationStats(name)).result.data;
|
|
457
464
|
return stats;
|
|
458
465
|
}
|
|
459
|
-
catch (
|
|
460
|
-
dispatch(Toast.actions.error({ label:
|
|
466
|
+
catch (err) {
|
|
467
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
461
468
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation stats' });
|
|
462
469
|
}
|
|
463
470
|
}));
|
|
@@ -488,8 +495,8 @@ const fetchAnimationStatsCurrent = toolkit.createAsyncThunk('animations/fetchAni
|
|
|
488
495
|
const stats = (yield extra.jApi.animations.GetAnimationStatsCurrent(uri)).result;
|
|
489
496
|
return stats;
|
|
490
497
|
}
|
|
491
|
-
catch (
|
|
492
|
-
dispatch(Toast.actions.error({ label:
|
|
498
|
+
catch (err) {
|
|
499
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
493
500
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation stats current' });
|
|
494
501
|
}
|
|
495
502
|
}));
|
|
@@ -572,7 +579,7 @@ const Application = {
|
|
|
572
579
|
selectors: selectors$2,
|
|
573
580
|
};
|
|
574
581
|
|
|
575
|
-
const initialState$
|
|
582
|
+
const initialState$n = {
|
|
576
583
|
entities: [],
|
|
577
584
|
loading: 'idle',
|
|
578
585
|
nbResults: 0,
|
|
@@ -588,7 +595,7 @@ const fetchBookableAsset = toolkit.createAsyncThunk('BookableAsset/fetchBookable
|
|
|
588
595
|
}));
|
|
589
596
|
const BookableAssetSlice = toolkit.createSlice({
|
|
590
597
|
name: 'bookableAsset',
|
|
591
|
-
initialState: initialState$
|
|
598
|
+
initialState: initialState$n,
|
|
592
599
|
reducers: {},
|
|
593
600
|
extraReducers: (builder) => {
|
|
594
601
|
builder
|
|
@@ -609,7 +616,7 @@ const BookableAssetSlice = toolkit.createSlice({
|
|
|
609
616
|
const fetchConfiguration = toolkit.createAsyncThunk('AssetReservation/configuration', (_, { extra }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
610
617
|
return yield extra.jApi.assetReservation.configuration();
|
|
611
618
|
}));
|
|
612
|
-
const initialState$
|
|
619
|
+
const initialState$m = {
|
|
613
620
|
description: '',
|
|
614
621
|
right: {
|
|
615
622
|
manage: false,
|
|
@@ -623,7 +630,7 @@ const initialState$l = {
|
|
|
623
630
|
};
|
|
624
631
|
const AssetReservationConfigurationSlice = toolkit.createSlice({
|
|
625
632
|
name: 'configuration',
|
|
626
|
-
initialState: initialState$
|
|
633
|
+
initialState: initialState$m,
|
|
627
634
|
reducers: {},
|
|
628
635
|
extraReducers: (builder) => {
|
|
629
636
|
builder
|
|
@@ -644,7 +651,7 @@ const initForm = {
|
|
|
644
651
|
hourStart: '',
|
|
645
652
|
hourEnd: '',
|
|
646
653
|
};
|
|
647
|
-
const initialState$
|
|
654
|
+
const initialState$l = {
|
|
648
655
|
entities: [],
|
|
649
656
|
loading: 'idle',
|
|
650
657
|
nbResults: 0,
|
|
@@ -660,7 +667,7 @@ const fetchReservation = toolkit.createAsyncThunk('Reservation/fetchReservation'
|
|
|
660
667
|
}));
|
|
661
668
|
const ReservationSlice = toolkit.createSlice({
|
|
662
669
|
name: 'reservation',
|
|
663
|
-
initialState: initialState$
|
|
670
|
+
initialState: initialState$l,
|
|
664
671
|
reducers: {
|
|
665
672
|
setForm: (state, action) => {
|
|
666
673
|
state.form = action.payload;
|
|
@@ -716,181 +723,7 @@ const AssetReservation = {
|
|
|
716
723
|
},
|
|
717
724
|
};
|
|
718
725
|
|
|
719
|
-
const initialState$
|
|
720
|
-
loading: 'idle',
|
|
721
|
-
comments: [],
|
|
722
|
-
};
|
|
723
|
-
const fetchComments = toolkit.createAsyncThunk('commentList/fetchCommentList', (params, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
724
|
-
var _a;
|
|
725
|
-
try {
|
|
726
|
-
const res = yield extra.jApi.article.getComments(params, {
|
|
727
|
-
format: 'raw-list',
|
|
728
|
-
formatExtension: ['actions'],
|
|
729
|
-
});
|
|
730
|
-
return { idArticle: params.idArticle, list: res.result };
|
|
731
|
-
}
|
|
732
|
-
catch (error) {
|
|
733
|
-
dispatch(Toast.actions.error({ label: (_a = error.errorMsg) !== null && _a !== void 0 ? _a : 'GLOBAL_Technical_Error' }));
|
|
734
|
-
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve comments' });
|
|
735
|
-
}
|
|
736
|
-
}));
|
|
737
|
-
const deleteComment = toolkit.createAsyncThunk('commentList/deleteComment', (params, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
738
|
-
var _b;
|
|
739
|
-
try {
|
|
740
|
-
yield extra.jApi.article.deleteComment(params.idComment);
|
|
741
|
-
return true;
|
|
742
|
-
}
|
|
743
|
-
catch (error) {
|
|
744
|
-
dispatch(Toast.actions.error({ label: (_b = error.errorMsg) !== null && _b !== void 0 ? _b : 'GLOBAL_Technical_Error' }));
|
|
745
|
-
return rejectWithValue({ error: 1, errorMsg: 'Cannot delete comment' });
|
|
746
|
-
}
|
|
747
|
-
}));
|
|
748
|
-
const CommentListSlice = toolkit.createSlice({
|
|
749
|
-
name: 'commentList',
|
|
750
|
-
initialState: initialState$j,
|
|
751
|
-
reducers: {
|
|
752
|
-
discardComments: (state, action) => {
|
|
753
|
-
state.comments = state.comments.filter((c) => c.idArticle !== action.payload.idArticle);
|
|
754
|
-
},
|
|
755
|
-
hydrateComment: (state, action) => {
|
|
756
|
-
const { idArticle, list } = action.payload;
|
|
757
|
-
const hasList = state.comments.find((c) => c.idArticle === idArticle);
|
|
758
|
-
if (!hasList) {
|
|
759
|
-
state.comments = [
|
|
760
|
-
...state.comments.filter((c) => c.idArticle !== idArticle),
|
|
761
|
-
{
|
|
762
|
-
idArticle,
|
|
763
|
-
list: Array.isArray(list) ? list : [],
|
|
764
|
-
},
|
|
765
|
-
];
|
|
766
|
-
return;
|
|
767
|
-
}
|
|
768
|
-
const initialUris = [];
|
|
769
|
-
const allUris = state.comments.reduce((uris, c) => {
|
|
770
|
-
return Array.isArray(c.list) ? [...uris, ...c.list.map((el) => el.uri)] : [...uris];
|
|
771
|
-
}, initialUris);
|
|
772
|
-
const safeList = Array.isArray(list) ? list.filter((el) => !allUris.includes(el.uri)) : [];
|
|
773
|
-
state.comments = state.comments.map((c) => {
|
|
774
|
-
return c.idArticle === idArticle
|
|
775
|
-
? Object.assign(Object.assign({}, c), { list: Array.isArray(c.list) ? [...c.list, ...safeList] : [...safeList] }) : c;
|
|
776
|
-
});
|
|
777
|
-
},
|
|
778
|
-
updateComment: (state, action) => {
|
|
779
|
-
state.comments = state.comments.map((c) => {
|
|
780
|
-
const { idArticle, idComment, data } = action.payload;
|
|
781
|
-
return c.idArticle === idArticle
|
|
782
|
-
? Object.assign(Object.assign({}, c), { list: c.list.map((comment) => comment.id === idComment ? Object.assign(Object.assign({}, comment), { description: data.description }) : comment) }) : c;
|
|
783
|
-
});
|
|
784
|
-
},
|
|
785
|
-
},
|
|
786
|
-
extraReducers: (builder) => {
|
|
787
|
-
builder
|
|
788
|
-
.addCase(fetchComments.pending, (state) => {
|
|
789
|
-
state.loading = 'pending';
|
|
790
|
-
})
|
|
791
|
-
.addCase(fetchComments.fulfilled, (state, action) => {
|
|
792
|
-
state.loading = 'idle';
|
|
793
|
-
state.comments = [
|
|
794
|
-
...state.comments.filter((c) => c.idArticle !== action.payload.idArticle),
|
|
795
|
-
{
|
|
796
|
-
idArticle: action.payload.idArticle,
|
|
797
|
-
list: action.payload.list.reverse(),
|
|
798
|
-
},
|
|
799
|
-
];
|
|
800
|
-
})
|
|
801
|
-
.addCase(fetchComments.rejected, (state) => {
|
|
802
|
-
state.loading = 'idle';
|
|
803
|
-
})
|
|
804
|
-
.addCase(deleteComment.pending, (state, action) => {
|
|
805
|
-
state.comments = state.comments.map((c) => {
|
|
806
|
-
if (c.idArticle !== action.meta.arg.idArticle) {
|
|
807
|
-
return c;
|
|
808
|
-
}
|
|
809
|
-
return Object.assign(Object.assign({}, c), { list: c.list.map((comment) => comment.id === action.meta.arg.idComment ? Object.assign(Object.assign({}, comment), { pending: true }) : comment) });
|
|
810
|
-
});
|
|
811
|
-
})
|
|
812
|
-
.addCase(deleteComment.rejected, (state, action) => {
|
|
813
|
-
state.comments = state.comments.map((c) => {
|
|
814
|
-
if (c.idArticle !== action.meta.arg.idArticle) {
|
|
815
|
-
return c;
|
|
816
|
-
}
|
|
817
|
-
return Object.assign(Object.assign({}, c), { list: c.list.map((comment) => comment.id === action.meta.arg.idComment ? Object.assign(Object.assign({}, comment), { pending: false }) : comment) });
|
|
818
|
-
});
|
|
819
|
-
});
|
|
820
|
-
},
|
|
821
|
-
});
|
|
822
|
-
|
|
823
|
-
const getCommentRTHandlers = function (dispatch, idArticle) {
|
|
824
|
-
const addCommentHandler = function (message) {
|
|
825
|
-
if (message.namespace === 'JAMESPOT' &&
|
|
826
|
-
message.function === 'comment-create' &&
|
|
827
|
-
message.object.idArticle === idArticle) {
|
|
828
|
-
dispatch(fetchComments({ idArticle }));
|
|
829
|
-
}
|
|
830
|
-
};
|
|
831
|
-
const deleteCommentHandler = function (message) {
|
|
832
|
-
if (message.namespace === 'JAMESPOT' &&
|
|
833
|
-
message.function === 'comment-delete' &&
|
|
834
|
-
Number(message.object.idArticle) === idArticle) {
|
|
835
|
-
dispatch(fetchComments({ idArticle }));
|
|
836
|
-
}
|
|
837
|
-
};
|
|
838
|
-
return [
|
|
839
|
-
{
|
|
840
|
-
namespace: 'JAMESPOT',
|
|
841
|
-
function: 'comment-create',
|
|
842
|
-
handler: addCommentHandler,
|
|
843
|
-
},
|
|
844
|
-
{
|
|
845
|
-
namespace: 'JAMESPOT',
|
|
846
|
-
function: 'comment-delete',
|
|
847
|
-
handler: deleteCommentHandler,
|
|
848
|
-
},
|
|
849
|
-
];
|
|
850
|
-
};
|
|
851
|
-
|
|
852
|
-
const getCommentsLikeRTHandlers = function (dispatch, idComments, idArticle) {
|
|
853
|
-
const commentLikeHandler = function (message) {
|
|
854
|
-
if (message.namespace === 'CUSTOM-ACTION' &&
|
|
855
|
-
(message.function === 'add' || message.function === 'remove') &&
|
|
856
|
-
message.object.type === 'sociallike' &&
|
|
857
|
-
message.object.targetId &&
|
|
858
|
-
idComments &&
|
|
859
|
-
idComments.includes(message.object.targetId)) {
|
|
860
|
-
dispatch(fetchComments({ idArticle }));
|
|
861
|
-
}
|
|
862
|
-
};
|
|
863
|
-
return idComments
|
|
864
|
-
? [
|
|
865
|
-
{ namespace: 'CUSTOM-ACTION', function: 'add', handler: commentLikeHandler },
|
|
866
|
-
{ namespace: 'CUSTOM-ACTION', function: 'remove', handler: commentLikeHandler },
|
|
867
|
-
]
|
|
868
|
-
: [];
|
|
869
|
-
};
|
|
870
|
-
|
|
871
|
-
const CommentReducer = redux.combineReducers({
|
|
872
|
-
[CommentListSlice.name]: CommentListSlice.reducer,
|
|
873
|
-
});
|
|
874
|
-
const commentSlice = {
|
|
875
|
-
name: 'comment',
|
|
876
|
-
reducer: CommentReducer,
|
|
877
|
-
};
|
|
878
|
-
const selectCommentList = (state, idArticle, limit = 0) => {
|
|
879
|
-
const data = state.comment.commentList.comments.find((c) => c.idArticle === idArticle);
|
|
880
|
-
const list = data ? [...data.list].sort((c1, c2) => c1.id - c2.id) : [];
|
|
881
|
-
return limit !== 0 ? list.slice(-limit) : list;
|
|
882
|
-
};
|
|
883
|
-
const Comment = {
|
|
884
|
-
slice: commentSlice,
|
|
885
|
-
actions: Object.assign({ fetchComments, deleteComment }, CommentListSlice.actions),
|
|
886
|
-
selectors: {
|
|
887
|
-
commentList: selectCommentList,
|
|
888
|
-
},
|
|
889
|
-
getCommentRTHandlers,
|
|
890
|
-
getCommentsLikeRTHandlers,
|
|
891
|
-
};
|
|
892
|
-
|
|
893
|
-
const initialState$i = {
|
|
726
|
+
const initialState$k = {
|
|
894
727
|
loading: 'idle',
|
|
895
728
|
reports: [],
|
|
896
729
|
page: 1,
|
|
@@ -903,7 +736,7 @@ const initialState$i = {
|
|
|
903
736
|
};
|
|
904
737
|
const contentReportSlice = toolkit.createSlice({
|
|
905
738
|
name: 'contentReport',
|
|
906
|
-
initialState: initialState$
|
|
739
|
+
initialState: initialState$k,
|
|
907
740
|
reducers: {
|
|
908
741
|
setTab: (state, action) => {
|
|
909
742
|
state.tab = action.payload;
|
|
@@ -1009,7 +842,7 @@ const ContentReport = {
|
|
|
1009
842
|
selectors: { selectContentReport },
|
|
1010
843
|
};
|
|
1011
844
|
|
|
1012
|
-
const initialState$
|
|
845
|
+
const initialState$j = {
|
|
1013
846
|
bookmarks: [],
|
|
1014
847
|
loading: 'idle',
|
|
1015
848
|
status: undefined,
|
|
@@ -1027,13 +860,12 @@ const fetchBookmark = toolkit.createAsyncThunk('bookmarkList/fetchbookmarkList',
|
|
|
1027
860
|
try {
|
|
1028
861
|
return yield extra.jApi.bookmark.getFormattedList(filterSpec, 'raw-list');
|
|
1029
862
|
}
|
|
1030
|
-
catch (
|
|
1031
|
-
dispatch(Toast.actions.error({ label:
|
|
863
|
+
catch (err) {
|
|
864
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
1032
865
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve bookmarks' });
|
|
1033
866
|
}
|
|
1034
867
|
}));
|
|
1035
868
|
const addBookmark = toolkit.createAsyncThunk('bookmarkList/addBookmark', (bookmark, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1036
|
-
var _a;
|
|
1037
869
|
try {
|
|
1038
870
|
if (jamespot.jEnsure.isBookmarkLink(bookmark)) {
|
|
1039
871
|
const result = yield extra.jApi.bookmark.addFormattedLink(bookmark.targetId, bookmark.targetType, 'raw-list');
|
|
@@ -1045,7 +877,7 @@ const addBookmark = toolkit.createAsyncThunk('bookmarkList/addBookmark', (bookma
|
|
|
1045
877
|
}
|
|
1046
878
|
}
|
|
1047
879
|
catch (error) {
|
|
1048
|
-
const toastLabel = (
|
|
880
|
+
const toastLabel = getErrorMessage(error);
|
|
1049
881
|
dispatch(Toast.actions.error({ label: toastLabel }));
|
|
1050
882
|
return rejectWithValue({ error: 1, errorMsg: 'Error saving bookmark' });
|
|
1051
883
|
}
|
|
@@ -1055,8 +887,8 @@ const moveBookmark = toolkit.createAsyncThunk('bookmarkList/moveBookmark', ({ bo
|
|
|
1055
887
|
yield extra.jApi.bookmark.move(bookmark.id, bookmarkReference.id, position);
|
|
1056
888
|
return;
|
|
1057
889
|
}
|
|
1058
|
-
catch (
|
|
1059
|
-
dispatch(Toast.actions.error({ label:
|
|
890
|
+
catch (err) {
|
|
891
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
1060
892
|
return rejectWithValue({ error: 1, errorMsg: 'Error moving bookmark' });
|
|
1061
893
|
}
|
|
1062
894
|
}));
|
|
@@ -1065,14 +897,14 @@ const deleteBookmark = toolkit.createAsyncThunk('bookmarkList/deleteBookmark', (
|
|
|
1065
897
|
yield extra.jApi.bookmark.delete(bookmark.id);
|
|
1066
898
|
return;
|
|
1067
899
|
}
|
|
1068
|
-
catch (
|
|
1069
|
-
dispatch(Toast.actions.error({ label:
|
|
900
|
+
catch (err) {
|
|
901
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
1070
902
|
return rejectWithValue({ error: 1, errorMsg: 'Error deleting bookmark' });
|
|
1071
903
|
}
|
|
1072
904
|
}));
|
|
1073
905
|
const BookmarkListSlice = toolkit.createSlice({
|
|
1074
906
|
name: 'bookmarkList',
|
|
1075
|
-
initialState: initialState$
|
|
907
|
+
initialState: initialState$j,
|
|
1076
908
|
reducers: {
|
|
1077
909
|
resetAddBookmarkStatus: (state, action) => {
|
|
1078
910
|
if (state.add[action.payload]) {
|
|
@@ -1235,7 +1067,7 @@ const getBookmarkRTHandlers = function (dispatch) {
|
|
|
1235
1067
|
];
|
|
1236
1068
|
};
|
|
1237
1069
|
|
|
1238
|
-
const initialState$
|
|
1070
|
+
const initialState$i = {
|
|
1239
1071
|
bookmark: undefined,
|
|
1240
1072
|
status: undefined,
|
|
1241
1073
|
loading: 'idle',
|
|
@@ -1257,7 +1089,7 @@ const editBookmark = toolkit.createAsyncThunk('bookmarkEdit/editBookmark', (book
|
|
|
1257
1089
|
}));
|
|
1258
1090
|
const BookmarkEditSlice = toolkit.createSlice({
|
|
1259
1091
|
name: 'bookmarkEdit',
|
|
1260
|
-
initialState: initialState$
|
|
1092
|
+
initialState: initialState$i,
|
|
1261
1093
|
reducers: {
|
|
1262
1094
|
setEditBookmark: (state, action) => {
|
|
1263
1095
|
state.bookmark = Object.assign({}, action.payload);
|
|
@@ -1316,6 +1148,405 @@ const Bookmark = {
|
|
|
1316
1148
|
getRTHandlers: getBookmarkRTHandlers,
|
|
1317
1149
|
};
|
|
1318
1150
|
|
|
1151
|
+
const initialState$h = {
|
|
1152
|
+
loading: 'idle',
|
|
1153
|
+
comments: [],
|
|
1154
|
+
};
|
|
1155
|
+
const fetchComments = toolkit.createAsyncThunk('commentList/fetchCommentList', (params, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1156
|
+
try {
|
|
1157
|
+
const res = yield extra.jApi.article.getComments(params, {
|
|
1158
|
+
format: 'raw-list',
|
|
1159
|
+
formatExtension: ['actions'],
|
|
1160
|
+
});
|
|
1161
|
+
return { idArticle: params.idArticle, list: res.result };
|
|
1162
|
+
}
|
|
1163
|
+
catch (error) {
|
|
1164
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
1165
|
+
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve comments' });
|
|
1166
|
+
}
|
|
1167
|
+
}));
|
|
1168
|
+
const deleteComment = toolkit.createAsyncThunk('commentList/deleteComment', (params, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1169
|
+
try {
|
|
1170
|
+
yield extra.jApi.article.deleteComment(params.idComment);
|
|
1171
|
+
return true;
|
|
1172
|
+
}
|
|
1173
|
+
catch (error) {
|
|
1174
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
1175
|
+
return rejectWithValue({ error: 1, errorMsg: 'Cannot delete comment' });
|
|
1176
|
+
}
|
|
1177
|
+
}));
|
|
1178
|
+
const CommentListSlice = toolkit.createSlice({
|
|
1179
|
+
name: 'commentList',
|
|
1180
|
+
initialState: initialState$h,
|
|
1181
|
+
reducers: {
|
|
1182
|
+
discardComments: (state, action) => {
|
|
1183
|
+
state.comments = state.comments.filter((c) => c.idArticle !== action.payload.idArticle);
|
|
1184
|
+
},
|
|
1185
|
+
hydrateComment: (state, action) => {
|
|
1186
|
+
const { idArticle, list } = action.payload;
|
|
1187
|
+
const hasList = state.comments.find((c) => c.idArticle === idArticle);
|
|
1188
|
+
if (!hasList) {
|
|
1189
|
+
state.comments = [
|
|
1190
|
+
...state.comments.filter((c) => c.idArticle !== idArticle),
|
|
1191
|
+
{
|
|
1192
|
+
idArticle,
|
|
1193
|
+
list: Array.isArray(list) ? list : [],
|
|
1194
|
+
},
|
|
1195
|
+
];
|
|
1196
|
+
return;
|
|
1197
|
+
}
|
|
1198
|
+
const initialUris = [];
|
|
1199
|
+
const allUris = state.comments.reduce((uris, c) => {
|
|
1200
|
+
return Array.isArray(c.list) ? [...uris, ...c.list.map((el) => el.uri)] : [...uris];
|
|
1201
|
+
}, initialUris);
|
|
1202
|
+
const safeList = Array.isArray(list) ? list.filter((el) => !allUris.includes(el.uri)) : [];
|
|
1203
|
+
state.comments = state.comments.map((c) => {
|
|
1204
|
+
return c.idArticle === idArticle
|
|
1205
|
+
? Object.assign(Object.assign({}, c), { list: Array.isArray(c.list) ? [...c.list, ...safeList] : [...safeList] }) : c;
|
|
1206
|
+
});
|
|
1207
|
+
},
|
|
1208
|
+
updateComment: (state, action) => {
|
|
1209
|
+
state.comments = state.comments.map((c) => {
|
|
1210
|
+
const { idArticle, idComment, data } = action.payload;
|
|
1211
|
+
return c.idArticle === idArticle
|
|
1212
|
+
? Object.assign(Object.assign({}, c), { list: c.list.map((comment) => comment.id === idComment ? Object.assign(Object.assign({}, comment), { description: data.description }) : comment) }) : c;
|
|
1213
|
+
});
|
|
1214
|
+
},
|
|
1215
|
+
},
|
|
1216
|
+
extraReducers: (builder) => {
|
|
1217
|
+
builder
|
|
1218
|
+
.addCase(fetchComments.pending, (state) => {
|
|
1219
|
+
state.loading = 'pending';
|
|
1220
|
+
})
|
|
1221
|
+
.addCase(fetchComments.fulfilled, (state, action) => {
|
|
1222
|
+
state.loading = 'idle';
|
|
1223
|
+
state.comments = [
|
|
1224
|
+
...state.comments.filter((c) => c.idArticle !== action.payload.idArticle),
|
|
1225
|
+
{
|
|
1226
|
+
idArticle: action.payload.idArticle,
|
|
1227
|
+
list: action.payload.list.reverse(),
|
|
1228
|
+
},
|
|
1229
|
+
];
|
|
1230
|
+
})
|
|
1231
|
+
.addCase(fetchComments.rejected, (state) => {
|
|
1232
|
+
state.loading = 'idle';
|
|
1233
|
+
})
|
|
1234
|
+
.addCase(deleteComment.pending, (state, action) => {
|
|
1235
|
+
state.comments = state.comments.map((c) => {
|
|
1236
|
+
if (c.idArticle !== action.meta.arg.idArticle) {
|
|
1237
|
+
return c;
|
|
1238
|
+
}
|
|
1239
|
+
return Object.assign(Object.assign({}, c), { list: c.list.map((comment) => comment.id === action.meta.arg.idComment ? Object.assign(Object.assign({}, comment), { pending: true }) : comment) });
|
|
1240
|
+
});
|
|
1241
|
+
})
|
|
1242
|
+
.addCase(deleteComment.rejected, (state, action) => {
|
|
1243
|
+
state.comments = state.comments.map((c) => {
|
|
1244
|
+
if (c.idArticle !== action.meta.arg.idArticle) {
|
|
1245
|
+
return c;
|
|
1246
|
+
}
|
|
1247
|
+
return Object.assign(Object.assign({}, c), { list: c.list.map((comment) => comment.id === action.meta.arg.idComment ? Object.assign(Object.assign({}, comment), { pending: false }) : comment) });
|
|
1248
|
+
});
|
|
1249
|
+
});
|
|
1250
|
+
},
|
|
1251
|
+
});
|
|
1252
|
+
|
|
1253
|
+
const getCommentRTHandlers = function (dispatch, idArticle) {
|
|
1254
|
+
const addCommentHandler = function (message) {
|
|
1255
|
+
if (message.namespace === 'JAMESPOT' &&
|
|
1256
|
+
message.function === 'comment-create' &&
|
|
1257
|
+
message.object.idArticle === idArticle) {
|
|
1258
|
+
dispatch(fetchComments({ idArticle }));
|
|
1259
|
+
}
|
|
1260
|
+
};
|
|
1261
|
+
const deleteCommentHandler = function (message) {
|
|
1262
|
+
if (message.namespace === 'JAMESPOT' &&
|
|
1263
|
+
message.function === 'comment-delete' &&
|
|
1264
|
+
Number(message.object.idArticle) === idArticle) {
|
|
1265
|
+
dispatch(fetchComments({ idArticle }));
|
|
1266
|
+
}
|
|
1267
|
+
};
|
|
1268
|
+
return [
|
|
1269
|
+
{
|
|
1270
|
+
namespace: 'JAMESPOT',
|
|
1271
|
+
function: 'comment-create',
|
|
1272
|
+
handler: addCommentHandler,
|
|
1273
|
+
},
|
|
1274
|
+
{
|
|
1275
|
+
namespace: 'JAMESPOT',
|
|
1276
|
+
function: 'comment-delete',
|
|
1277
|
+
handler: deleteCommentHandler,
|
|
1278
|
+
},
|
|
1279
|
+
];
|
|
1280
|
+
};
|
|
1281
|
+
|
|
1282
|
+
const getCommentsLikeRTHandlers = function (dispatch, idComments, idArticle) {
|
|
1283
|
+
const commentLikeHandler = function (message) {
|
|
1284
|
+
if (message.namespace === 'CUSTOM-ACTION' &&
|
|
1285
|
+
(message.function === 'add' || message.function === 'remove') &&
|
|
1286
|
+
message.object.type === 'sociallike' &&
|
|
1287
|
+
message.object.targetId &&
|
|
1288
|
+
idComments &&
|
|
1289
|
+
idComments.includes(message.object.targetId)) {
|
|
1290
|
+
dispatch(fetchComments({ idArticle }));
|
|
1291
|
+
}
|
|
1292
|
+
};
|
|
1293
|
+
return idComments
|
|
1294
|
+
? [
|
|
1295
|
+
{ namespace: 'CUSTOM-ACTION', function: 'add', handler: commentLikeHandler },
|
|
1296
|
+
{ namespace: 'CUSTOM-ACTION', function: 'remove', handler: commentLikeHandler },
|
|
1297
|
+
]
|
|
1298
|
+
: [];
|
|
1299
|
+
};
|
|
1300
|
+
|
|
1301
|
+
const CommentReducer = redux.combineReducers({
|
|
1302
|
+
[CommentListSlice.name]: CommentListSlice.reducer,
|
|
1303
|
+
});
|
|
1304
|
+
const commentSlice = {
|
|
1305
|
+
name: 'comment',
|
|
1306
|
+
reducer: CommentReducer,
|
|
1307
|
+
};
|
|
1308
|
+
const selectCommentList = (state, idArticle, limit = 0) => {
|
|
1309
|
+
const data = state.comment.commentList.comments.find((c) => c.idArticle === idArticle);
|
|
1310
|
+
const list = data ? [...data.list].sort((c1, c2) => c1.id - c2.id) : [];
|
|
1311
|
+
return limit !== 0 ? list.slice(-limit) : list;
|
|
1312
|
+
};
|
|
1313
|
+
const Comment = {
|
|
1314
|
+
slice: commentSlice,
|
|
1315
|
+
actions: Object.assign({ fetchComments, deleteComment }, CommentListSlice.actions),
|
|
1316
|
+
selectors: {
|
|
1317
|
+
commentList: selectCommentList,
|
|
1318
|
+
},
|
|
1319
|
+
getCommentRTHandlers,
|
|
1320
|
+
getCommentsLikeRTHandlers,
|
|
1321
|
+
};
|
|
1322
|
+
|
|
1323
|
+
const ExtraBotConst = {
|
|
1324
|
+
route: 'extra-bot',
|
|
1325
|
+
moduleName: 'ExtraBotHook',
|
|
1326
|
+
configurationType: 'extraBot',
|
|
1327
|
+
listLimit: 20,
|
|
1328
|
+
listDefaultPage: 1,
|
|
1329
|
+
};
|
|
1330
|
+
|
|
1331
|
+
const initialState$g = {
|
|
1332
|
+
global: {
|
|
1333
|
+
loading: 'idle',
|
|
1334
|
+
},
|
|
1335
|
+
listAll: {
|
|
1336
|
+
loading: 'idle',
|
|
1337
|
+
data: [],
|
|
1338
|
+
limit: ExtraBotConst.listLimit,
|
|
1339
|
+
nbResults: 0,
|
|
1340
|
+
page: ExtraBotConst.listDefaultPage,
|
|
1341
|
+
filters: [],
|
|
1342
|
+
orders: [],
|
|
1343
|
+
},
|
|
1344
|
+
listMines: {
|
|
1345
|
+
loading: 'idle',
|
|
1346
|
+
data: [],
|
|
1347
|
+
limit: ExtraBotConst.listLimit,
|
|
1348
|
+
nbResults: 0,
|
|
1349
|
+
page: ExtraBotConst.listDefaultPage,
|
|
1350
|
+
filters: [],
|
|
1351
|
+
orders: [],
|
|
1352
|
+
},
|
|
1353
|
+
formModal: {
|
|
1354
|
+
open: false,
|
|
1355
|
+
mode: 'create',
|
|
1356
|
+
type: 'all',
|
|
1357
|
+
extraBot: undefined,
|
|
1358
|
+
},
|
|
1359
|
+
};
|
|
1360
|
+
const fetchExtraBotListAll = toolkit.createAsyncThunk('extraBot/fetchAll', (_, { extra, rejectWithValue, dispatch, getState }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1361
|
+
const state = getState().extraBot.listAll;
|
|
1362
|
+
try {
|
|
1363
|
+
return (yield extra.jApi.extraBot.list('all', {
|
|
1364
|
+
limit: state.limit,
|
|
1365
|
+
page: state.page,
|
|
1366
|
+
filters: state.filters,
|
|
1367
|
+
orders: state.orders,
|
|
1368
|
+
})).result;
|
|
1369
|
+
}
|
|
1370
|
+
catch (err) {
|
|
1371
|
+
if (!isAbortError(err)) {
|
|
1372
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
1373
|
+
}
|
|
1374
|
+
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve extra bot list' });
|
|
1375
|
+
}
|
|
1376
|
+
}));
|
|
1377
|
+
const fetchExtraBotListMines = toolkit.createAsyncThunk('extraBot/fetchMines', (_, { extra, rejectWithValue, dispatch, getState }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1378
|
+
const state = getState().extraBot.listMines;
|
|
1379
|
+
try {
|
|
1380
|
+
return (yield extra.jApi.extraBot.list('mines', {
|
|
1381
|
+
limit: state.limit,
|
|
1382
|
+
page: state.page,
|
|
1383
|
+
filters: state.filters,
|
|
1384
|
+
orders: state.orders,
|
|
1385
|
+
})).result;
|
|
1386
|
+
}
|
|
1387
|
+
catch (err) {
|
|
1388
|
+
if (!isAbortError(err)) {
|
|
1389
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
1390
|
+
}
|
|
1391
|
+
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve extra bot list' });
|
|
1392
|
+
}
|
|
1393
|
+
}));
|
|
1394
|
+
const toggleExtraBotActivation = toolkit.createAsyncThunk('extraBot/toggleActivation', (extraBot, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1395
|
+
try {
|
|
1396
|
+
const enabled = !extraBot.enabled;
|
|
1397
|
+
const res = (yield extra.jApi.article.update(Object.assign(Object.assign({}, extraBot), { enabled }), { format: jamespot.Format.VIEW })).result;
|
|
1398
|
+
dispatch(Toast.actions.success({
|
|
1399
|
+
label: enabled ? 'APP_ExtraBot_Toast_ActivationSuccess' : 'APP_ExtraBot_Toast_DeactivationSuccess',
|
|
1400
|
+
}));
|
|
1401
|
+
return res;
|
|
1402
|
+
}
|
|
1403
|
+
catch (err) {
|
|
1404
|
+
if (!isAbortError(err)) {
|
|
1405
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
1406
|
+
}
|
|
1407
|
+
return rejectWithValue({ error: 1, errorMsg: 'Failed to change extra bot activation' });
|
|
1408
|
+
}
|
|
1409
|
+
}));
|
|
1410
|
+
const saveExtraBot = toolkit.createAsyncThunk('extraBot/save', ({ extraBot }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1411
|
+
try {
|
|
1412
|
+
const data = Object.assign(Object.assign({}, extraBot), { type: ExtraBotConst.configurationType, publishTo: '' });
|
|
1413
|
+
let res;
|
|
1414
|
+
let user;
|
|
1415
|
+
delete data.avatar;
|
|
1416
|
+
if (extraBot.uri) {
|
|
1417
|
+
res = (yield extra.jApi.article.update(data, { format: jamespot.Format.VIEW }))
|
|
1418
|
+
.result;
|
|
1419
|
+
user = (yield extra.jApi.extraBot.updateBot(res.uri)).result;
|
|
1420
|
+
}
|
|
1421
|
+
else {
|
|
1422
|
+
res = (yield extra.jApi.article.create(Object.assign({}, data), jamespot.Format.VIEW)).result[0];
|
|
1423
|
+
if (!res) {
|
|
1424
|
+
throw new Error('ExtraBot configuration creation failed');
|
|
1425
|
+
}
|
|
1426
|
+
user = (yield extra.jApi.extraBot.createBot(res.uri)).result;
|
|
1427
|
+
res._user = user;
|
|
1428
|
+
}
|
|
1429
|
+
const label = extraBot.uri ? 'APP_ExtraBot_Toast_SaveEdit' : 'APP_ExtraBot_Toast_SaveCreate';
|
|
1430
|
+
dispatch(Toast.actions.success({ label }));
|
|
1431
|
+
return res;
|
|
1432
|
+
}
|
|
1433
|
+
catch (err) {
|
|
1434
|
+
if (!isAbortError(err)) {
|
|
1435
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
1436
|
+
}
|
|
1437
|
+
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve extra bot' });
|
|
1438
|
+
}
|
|
1439
|
+
}));
|
|
1440
|
+
const updateListBotProperty = (state, extraBotUri, property, value) => {
|
|
1441
|
+
const listAllExtraBot = state.listAll.data.find((eb) => eb.uri === extraBotUri);
|
|
1442
|
+
const listMinesExtraBot = state.listMines.data.find((eb) => eb.uri === extraBotUri);
|
|
1443
|
+
if (listAllExtraBot) {
|
|
1444
|
+
listAllExtraBot[property] = value;
|
|
1445
|
+
}
|
|
1446
|
+
if (listMinesExtraBot) {
|
|
1447
|
+
listMinesExtraBot[property] = value;
|
|
1448
|
+
}
|
|
1449
|
+
};
|
|
1450
|
+
const extraBotSlice = toolkit.createSlice({
|
|
1451
|
+
name: 'extraBot',
|
|
1452
|
+
initialState: initialState$g,
|
|
1453
|
+
reducers: {
|
|
1454
|
+
setListAllOrder: (state, action) => {
|
|
1455
|
+
state.listAll.orders = [...action.payload];
|
|
1456
|
+
state.listAll.page = ExtraBotConst.listDefaultPage;
|
|
1457
|
+
},
|
|
1458
|
+
setListAllFilter: (state, action) => {
|
|
1459
|
+
state.listAll.filters = [...action.payload];
|
|
1460
|
+
state.listAll.page = ExtraBotConst.listDefaultPage;
|
|
1461
|
+
},
|
|
1462
|
+
setListAllPage: (state, action) => {
|
|
1463
|
+
state.listAll.page = action.payload;
|
|
1464
|
+
},
|
|
1465
|
+
setListMinesOrder: (state, action) => {
|
|
1466
|
+
state.listMines.orders = [...action.payload];
|
|
1467
|
+
state.listMines.page = ExtraBotConst.listDefaultPage;
|
|
1468
|
+
},
|
|
1469
|
+
setListMinesFilter: (state, action) => {
|
|
1470
|
+
state.listMines.filters = [...action.payload];
|
|
1471
|
+
state.listMines.page = ExtraBotConst.listDefaultPage;
|
|
1472
|
+
},
|
|
1473
|
+
setListMinesPage: (state, action) => {
|
|
1474
|
+
state.listMines.page = action.payload;
|
|
1475
|
+
},
|
|
1476
|
+
openFormModal: (state, action) => {
|
|
1477
|
+
state.formModal.open = true;
|
|
1478
|
+
state.formModal.mode = action.payload.mode;
|
|
1479
|
+
state.formModal.type = action.payload.type;
|
|
1480
|
+
state.formModal.extraBot = action.payload.extraBot;
|
|
1481
|
+
},
|
|
1482
|
+
closeFormModal: (state) => {
|
|
1483
|
+
state.formModal.open = false;
|
|
1484
|
+
},
|
|
1485
|
+
},
|
|
1486
|
+
extraReducers: (builder) => {
|
|
1487
|
+
builder
|
|
1488
|
+
.addCase(fetchExtraBotListAll.pending, (state) => {
|
|
1489
|
+
state.listAll.loading = 'pending';
|
|
1490
|
+
})
|
|
1491
|
+
.addCase(fetchExtraBotListAll.fulfilled, (state, action) => {
|
|
1492
|
+
var _a;
|
|
1493
|
+
state.listAll.data = action.payload.data;
|
|
1494
|
+
state.listAll.nbResults = action.payload.cnt;
|
|
1495
|
+
state.listAll.limit = (_a = action.payload.limit) !== null && _a !== void 0 ? _a : ExtraBotConst.listLimit;
|
|
1496
|
+
state.listAll.page = action.payload.page;
|
|
1497
|
+
state.listAll.loading = 'idle';
|
|
1498
|
+
})
|
|
1499
|
+
.addCase(fetchExtraBotListAll.rejected, (state) => {
|
|
1500
|
+
state.listAll.loading = 'idle';
|
|
1501
|
+
})
|
|
1502
|
+
.addCase(fetchExtraBotListMines.pending, (state) => {
|
|
1503
|
+
state.listMines.loading = 'pending';
|
|
1504
|
+
})
|
|
1505
|
+
.addCase(fetchExtraBotListMines.fulfilled, (state, action) => {
|
|
1506
|
+
var _a;
|
|
1507
|
+
state.listMines.data = action.payload.data;
|
|
1508
|
+
state.listMines.nbResults = action.payload.cnt;
|
|
1509
|
+
state.listMines.limit = (_a = action.payload.limit) !== null && _a !== void 0 ? _a : ExtraBotConst.listLimit;
|
|
1510
|
+
state.listMines.page = action.payload.page;
|
|
1511
|
+
state.listMines.loading = 'idle';
|
|
1512
|
+
})
|
|
1513
|
+
.addCase(fetchExtraBotListMines.rejected, (state) => {
|
|
1514
|
+
state.listMines.loading = 'idle';
|
|
1515
|
+
})
|
|
1516
|
+
.addCase(toggleExtraBotActivation.pending, (state) => {
|
|
1517
|
+
state.global.loading = 'pending';
|
|
1518
|
+
})
|
|
1519
|
+
.addCase(toggleExtraBotActivation.fulfilled, (state, action) => {
|
|
1520
|
+
state.global.loading = 'idle';
|
|
1521
|
+
const extraBot = action.payload;
|
|
1522
|
+
updateListBotProperty(state, extraBot.uri, 'enabled', extraBot.enabled);
|
|
1523
|
+
})
|
|
1524
|
+
.addCase(toggleExtraBotActivation.rejected, (state) => {
|
|
1525
|
+
state.global.loading = 'idle';
|
|
1526
|
+
})
|
|
1527
|
+
.addCase(saveExtraBot.pending, (state) => {
|
|
1528
|
+
state.global.loading = 'pending';
|
|
1529
|
+
})
|
|
1530
|
+
.addCase(saveExtraBot.fulfilled, (state, _action) => {
|
|
1531
|
+
state.global.loading = 'idle';
|
|
1532
|
+
state.formModal.open = false;
|
|
1533
|
+
})
|
|
1534
|
+
.addCase(saveExtraBot.rejected, (state) => {
|
|
1535
|
+
state.global.loading = 'idle';
|
|
1536
|
+
});
|
|
1537
|
+
},
|
|
1538
|
+
});
|
|
1539
|
+
const selectExtraBotListAll = (state) => state.extraBot.listAll;
|
|
1540
|
+
const selectExtraBotListMines = (state) => state.extraBot.listMines;
|
|
1541
|
+
const ExtraBot = {
|
|
1542
|
+
slice: extraBotSlice,
|
|
1543
|
+
actions: Object.assign({ fetchExtraBotListAll,
|
|
1544
|
+
fetchExtraBotListMines,
|
|
1545
|
+
toggleExtraBotActivation,
|
|
1546
|
+
saveExtraBot }, extraBotSlice.actions),
|
|
1547
|
+
selectors: { selectExtraBotListAll, selectExtraBotListMines },
|
|
1548
|
+
};
|
|
1549
|
+
|
|
1319
1550
|
const initialState$f = {
|
|
1320
1551
|
loading: 'idle',
|
|
1321
1552
|
access: { createCategory: false },
|
|
@@ -1867,7 +2098,6 @@ const magicPadSlice = toolkit.createSlice({
|
|
|
1867
2098
|
},
|
|
1868
2099
|
});
|
|
1869
2100
|
const fetchPads = toolkit.createAsyncThunk('magicPad/fetchPads', (params, { extra, rejectWithValue, dispatch, getState }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1870
|
-
var _a;
|
|
1871
2101
|
try {
|
|
1872
2102
|
const state = getState().magicPad;
|
|
1873
2103
|
const page = state.page;
|
|
@@ -1895,7 +2125,7 @@ const fetchPads = toolkit.createAsyncThunk('magicPad/fetchPads', (params, { extr
|
|
|
1895
2125
|
})).result;
|
|
1896
2126
|
}
|
|
1897
2127
|
catch (error) {
|
|
1898
|
-
dispatch(Toast.actions.error({ label: (
|
|
2128
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
1899
2129
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot fetch pads' });
|
|
1900
2130
|
}
|
|
1901
2131
|
}));
|
|
@@ -2019,7 +2249,6 @@ const mediaLibrarySlice = toolkit.createSlice({
|
|
|
2019
2249
|
},
|
|
2020
2250
|
});
|
|
2021
2251
|
const fetchMediaLibraryFolders = toolkit.createAsyncThunk('MediaLibrary/fetchMediaLibraryFolders', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2022
|
-
var _a;
|
|
2023
2252
|
const args = {
|
|
2024
2253
|
type: MediaLibraryAppConst.typeMediaLibraryFolder,
|
|
2025
2254
|
format: 'raw-little',
|
|
@@ -2029,12 +2258,11 @@ const fetchMediaLibraryFolders = toolkit.createAsyncThunk('MediaLibrary/fetchMed
|
|
|
2029
2258
|
return yield extra.jApi.article.list(args);
|
|
2030
2259
|
}
|
|
2031
2260
|
catch (error) {
|
|
2032
|
-
dispatch(Toast.actions.error({ label: (
|
|
2261
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
2033
2262
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve folders' });
|
|
2034
2263
|
}
|
|
2035
2264
|
}));
|
|
2036
2265
|
const fetchMediaLibraryUnclassifiedFiles = toolkit.createAsyncThunk('MediaLibrary/fetchMediaLibraryUnclassifiedFiles', (page, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2037
|
-
var _b;
|
|
2038
2266
|
try {
|
|
2039
2267
|
return yield extra.jApi.mediaLibrary.GetUnclassifiedFiles({
|
|
2040
2268
|
format: 'raw-little',
|
|
@@ -2043,47 +2271,43 @@ const fetchMediaLibraryUnclassifiedFiles = toolkit.createAsyncThunk('MediaLibrar
|
|
|
2043
2271
|
});
|
|
2044
2272
|
}
|
|
2045
2273
|
catch (error) {
|
|
2046
|
-
dispatch(Toast.actions.error({ label: (
|
|
2274
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
2047
2275
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve UnclassifiedFiles' });
|
|
2048
2276
|
}
|
|
2049
2277
|
}));
|
|
2050
2278
|
const fetchMediaLibraryConfig = toolkit.createAsyncThunk('MediaLibrary/fetchMediaLibraryConfig', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2051
|
-
var _c;
|
|
2052
2279
|
try {
|
|
2053
2280
|
return yield extra.jApi.mediaLibrary.getAccess();
|
|
2054
2281
|
}
|
|
2055
2282
|
catch (error) {
|
|
2056
|
-
dispatch(Toast.actions.error({ label: (
|
|
2283
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
2057
2284
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot get MediaLibrary Config' });
|
|
2058
2285
|
}
|
|
2059
2286
|
}));
|
|
2060
2287
|
const fetchMediaLibraryFoldersStats = toolkit.createAsyncThunk('MediaLibrary/fetchMediaLibraryFoldersStats', ({ page, filters, orders }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2061
|
-
var _d;
|
|
2062
2288
|
try {
|
|
2063
2289
|
return yield extra.jApi.mediaLibrary.getFoldersStatsList(filters, orders, page);
|
|
2064
2290
|
}
|
|
2065
2291
|
catch (error) {
|
|
2066
|
-
dispatch(Toast.actions.error({ label: (
|
|
2292
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
2067
2293
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot get MediaLibrary folders stats' });
|
|
2068
2294
|
}
|
|
2069
2295
|
}));
|
|
2070
2296
|
const fetchMediaLibraryFilesStats = toolkit.createAsyncThunk('MediaLibrary/fetchMediaLibraryFilesStats', ({ page, filters, orders }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2071
|
-
var _e;
|
|
2072
2297
|
try {
|
|
2073
2298
|
return yield extra.jApi.mediaLibrary.getFilesStatsList(filters, orders, page);
|
|
2074
2299
|
}
|
|
2075
2300
|
catch (error) {
|
|
2076
|
-
dispatch(Toast.actions.error({ label: (
|
|
2301
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
2077
2302
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot get MediaLibrary files stats' });
|
|
2078
2303
|
}
|
|
2079
2304
|
}));
|
|
2080
2305
|
const fetchMediaLibraryStats = toolkit.createAsyncThunk('MediaLibrary/fetchMediaLibraryStats', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2081
|
-
var _f;
|
|
2082
2306
|
try {
|
|
2083
2307
|
return yield extra.jApi.mediaLibrary.getStats();
|
|
2084
2308
|
}
|
|
2085
2309
|
catch (error) {
|
|
2086
|
-
dispatch(Toast.actions.error({ label: (
|
|
2310
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
2087
2311
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot get MediaLibrary stats' });
|
|
2088
2312
|
}
|
|
2089
2313
|
}));
|
|
@@ -5218,8 +5442,8 @@ const saveCurrentStudioApp = toolkit.createAsyncThunk('studio/saveCurrentStudioA
|
|
|
5218
5442
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Edition_Saved' }));
|
|
5219
5443
|
return;
|
|
5220
5444
|
}
|
|
5221
|
-
catch (
|
|
5222
|
-
dispatch(Toast.actions.error({ label:
|
|
5445
|
+
catch (err) {
|
|
5446
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5223
5447
|
return rejectWithValue(error);
|
|
5224
5448
|
}
|
|
5225
5449
|
}));
|
|
@@ -5238,8 +5462,8 @@ const installStudioApp = toolkit.createAsyncThunk('studio/installApp', ({ callba
|
|
|
5238
5462
|
callback();
|
|
5239
5463
|
return;
|
|
5240
5464
|
}
|
|
5241
|
-
catch (
|
|
5242
|
-
dispatch(Toast.actions.error({ label:
|
|
5465
|
+
catch (err) {
|
|
5466
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5243
5467
|
return rejectWithValue(error);
|
|
5244
5468
|
}
|
|
5245
5469
|
}));
|
|
@@ -5433,9 +5657,9 @@ const fetchStudioAppsList = toolkit.createAsyncThunk('studio/appsList', (intl, {
|
|
|
5433
5657
|
}));
|
|
5434
5658
|
return transformedApps;
|
|
5435
5659
|
}
|
|
5436
|
-
catch (
|
|
5437
|
-
console.error(
|
|
5438
|
-
dispatch(Toast.actions.error({ label:
|
|
5660
|
+
catch (err) {
|
|
5661
|
+
console.error(err);
|
|
5662
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5439
5663
|
throw rejectWithValue({ error: 1, errorMsg: 'Error retrieving applications' });
|
|
5440
5664
|
}
|
|
5441
5665
|
}));
|
|
@@ -5472,8 +5696,8 @@ const createNewStudioApp = toolkit.createAsyncThunk('studio/createApp', ({ appNa
|
|
|
5472
5696
|
callback();
|
|
5473
5697
|
return newStudioApp;
|
|
5474
5698
|
}
|
|
5475
|
-
catch (
|
|
5476
|
-
dispatch(Toast.actions.error({ label:
|
|
5699
|
+
catch (err) {
|
|
5700
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5477
5701
|
throw rejectWithValue({ error: 1, errorMsg: 'Error creating application' });
|
|
5478
5702
|
}
|
|
5479
5703
|
}));
|
|
@@ -5484,8 +5708,8 @@ const deleteStudioApp = toolkit.createAsyncThunk('studio/deleteApp', ({ idApp, s
|
|
|
5484
5708
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_StudioApp_Deleted' }));
|
|
5485
5709
|
return deleteRes;
|
|
5486
5710
|
}
|
|
5487
|
-
catch (
|
|
5488
|
-
dispatch(Toast.actions.error({ label:
|
|
5711
|
+
catch (err) {
|
|
5712
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5489
5713
|
return rejectWithValue({ error: 1, errorMsg: 'Error deleting application' });
|
|
5490
5714
|
}
|
|
5491
5715
|
}));
|
|
@@ -5495,8 +5719,8 @@ const suspendStudioApp = toolkit.createAsyncThunk('studio/suspendStudioApp', ({
|
|
|
5495
5719
|
yield jApi.application.studioSuspend(idApp);
|
|
5496
5720
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Suspended' }));
|
|
5497
5721
|
}
|
|
5498
|
-
catch (
|
|
5499
|
-
dispatch(Toast.actions.error({ label:
|
|
5722
|
+
catch (err) {
|
|
5723
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5500
5724
|
throw rejectWithValue({ error: 1, errorMsg: 'Error suspending application' });
|
|
5501
5725
|
}
|
|
5502
5726
|
}));
|
|
@@ -5506,8 +5730,8 @@ const restartStudioApp = toolkit.createAsyncThunk('studio/restartStudioApp', ({
|
|
|
5506
5730
|
yield jApi.application.studioRestart(idApp);
|
|
5507
5731
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Restarted' }));
|
|
5508
5732
|
}
|
|
5509
|
-
catch (
|
|
5510
|
-
dispatch(Toast.actions.error({ label:
|
|
5733
|
+
catch (err) {
|
|
5734
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5511
5735
|
throw rejectWithValue({ error: 1, errorMsg: 'Error restarting application' });
|
|
5512
5736
|
}
|
|
5513
5737
|
}));
|
|
@@ -5533,8 +5757,8 @@ const cloneStudioApp = toolkit.createAsyncThunk('studio/cloneStudioApp', ({ idAp
|
|
|
5533
5757
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Cloned' }));
|
|
5534
5758
|
return clonedStudioApp;
|
|
5535
5759
|
}
|
|
5536
|
-
catch (
|
|
5537
|
-
dispatch(Toast.actions.error({ label:
|
|
5760
|
+
catch (err) {
|
|
5761
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5538
5762
|
return rejectWithValue({ error: 1, errorMsg: 'Error cloning application' });
|
|
5539
5763
|
}
|
|
5540
5764
|
}));
|
|
@@ -5554,8 +5778,8 @@ const createInWorkStudioApp = toolkit.createAsyncThunk('studio/createInWorkStudi
|
|
|
5554
5778
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_CreateInWork' }));
|
|
5555
5779
|
return clonedStudioApp;
|
|
5556
5780
|
}
|
|
5557
|
-
catch (
|
|
5558
|
-
dispatch(Toast.actions.error({ label:
|
|
5781
|
+
catch (err) {
|
|
5782
|
+
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5559
5783
|
return rejectWithValue({ error: 1, errorMsg: 'Error creating in work version for application' });
|
|
5560
5784
|
}
|
|
5561
5785
|
}));
|
|
@@ -5781,6 +6005,7 @@ exports.Bookmark = Bookmark;
|
|
|
5781
6005
|
exports.Comment = Comment;
|
|
5782
6006
|
exports.ContentReport = ContentReport;
|
|
5783
6007
|
exports.ExtraAppFieldsItemViews = ExtraAppFieldsItemViews;
|
|
6008
|
+
exports.ExtraBot = ExtraBot;
|
|
5784
6009
|
exports.Faq = Faq;
|
|
5785
6010
|
exports.Hook = Hook;
|
|
5786
6011
|
exports.MagicPad = MagicPad;
|
|
@@ -5806,6 +6031,9 @@ exports.adminLogsSlice = adminLogsSlice;
|
|
|
5806
6031
|
exports.animationsReducer = animationsReducer;
|
|
5807
6032
|
exports.animationsSlice = animationsSlice;
|
|
5808
6033
|
exports.contentReportSlice = contentReportSlice;
|
|
6034
|
+
exports.extraBotSlice = extraBotSlice;
|
|
6035
|
+
exports.fetchExtraBotListAll = fetchExtraBotListAll;
|
|
6036
|
+
exports.fetchExtraBotListMines = fetchExtraBotListMines;
|
|
5809
6037
|
exports.fetchMediaLibraryConfig = fetchMediaLibraryConfig;
|
|
5810
6038
|
exports.fetchMediaLibraryFilesStats = fetchMediaLibraryFilesStats;
|
|
5811
6039
|
exports.fetchMediaLibraryFolders = fetchMediaLibraryFolders;
|
|
@@ -5818,8 +6046,13 @@ exports.jland = jland;
|
|
|
5818
6046
|
exports.magicPadSlice = magicPadSlice;
|
|
5819
6047
|
exports.mediaLibraryReducer = mediaLibraryReducer;
|
|
5820
6048
|
exports.mediaLibrarySlice = mediaLibrarySlice;
|
|
6049
|
+
exports.saveExtraBot = saveExtraBot;
|
|
6050
|
+
exports.selectExtraBotListAll = selectExtraBotListAll;
|
|
6051
|
+
exports.selectExtraBotListMines = selectExtraBotListMines;
|
|
5821
6052
|
exports.slice = slice$1;
|
|
5822
6053
|
exports.studio = studio;
|
|
6054
|
+
exports.toggleExtraBotActivation = toggleExtraBotActivation;
|
|
6055
|
+
exports.updateListBotProperty = updateListBotProperty;
|
|
5823
6056
|
exports.updateStatus = updateStatus;
|
|
5824
6057
|
exports.updateWidgetContent = updateWidgetContent;
|
|
5825
6058
|
exports.viewsList = viewsList;
|