jamespot-front-business 1.1.86 → 1.1.87

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 CHANGED
@@ -56,6 +56,11 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
56
56
  const isAbortError = (error) => {
57
57
  return !!error && typeof error === 'object' && 'aborted' in error && !!error.aborted;
58
58
  };
59
+ const getErrorMessage = (error, defaultError) => {
60
+ return error && typeof error === 'object' && 'errorMsg' in error && typeof error.errorMsg === 'string'
61
+ ? error.errorMsg
62
+ : defaultError !== null && defaultError !== void 0 ? defaultError : 'GLOBAL_Technical_Error';
63
+ };
59
64
 
60
65
  const toastAdapter = toolkit.createEntityAdapter({
61
66
  selectId: (toast) => toast.id,
@@ -100,7 +105,7 @@ const oneMonthAgo$2 = () => {
100
105
  date.setMonth(date.getMonth() - 1);
101
106
  return date;
102
107
  };
103
- const initialState$p = {
108
+ const initialState$q = {
104
109
  data: [],
105
110
  loading: 'idle',
106
111
  page: 1,
@@ -132,7 +137,7 @@ const fetchLogsNavigation = toolkit.createAsyncThunk('admin/fetchLogsNavigation'
132
137
  }));
133
138
  const adminLogsNavigationSlice = toolkit.createSlice({
134
139
  name: 'logsNavigation',
135
- initialState: initialState$p,
140
+ initialState: initialState$q,
136
141
  reducers: {
137
142
  setNavigationOrder: (state, action) => {
138
143
  state.orders = [...action.payload];
@@ -170,7 +175,7 @@ const oneMonthAgo$1 = () => {
170
175
  date.setMonth(date.getMonth() - 1);
171
176
  return date;
172
177
  };
173
- const initialState$o = {
178
+ const initialState$p = {
174
179
  data: [],
175
180
  loading: 'idle',
176
181
  page: 1,
@@ -202,7 +207,7 @@ const fetchLogsObjects = toolkit.createAsyncThunk('admin/fetchLogsObjects', (par
202
207
  }));
203
208
  const adminLogsObjectsSlice = toolkit.createSlice({
204
209
  name: 'logsObjects',
205
- initialState: initialState$o,
210
+ initialState: initialState$p,
206
211
  reducers: {
207
212
  setObjectsOrder: (state, action) => {
208
213
  state.orders = [...action.payload];
@@ -239,7 +244,7 @@ const oneMonthAgo = () => {
239
244
  date.setMonth(date.getMonth() - 1);
240
245
  return date;
241
246
  };
242
- const initialState$n = {
247
+ const initialState$o = {
243
248
  data: [],
244
249
  loading: 'idle',
245
250
  page: 1,
@@ -271,7 +276,7 @@ const fetchLogsSearch = toolkit.createAsyncThunk('admin/fetchLogsSearch', (param
271
276
  }));
272
277
  const adminLogsSearchSlice = toolkit.createSlice({
273
278
  name: 'logsSearch',
274
- initialState: initialState$n,
279
+ initialState: initialState$o,
275
280
  reducers: {
276
281
  setSearchOrder: (state, action) => {
277
282
  state.orders = [...action.payload];
@@ -324,7 +329,7 @@ const AdminLogs = {
324
329
  selectors: { selectAdminLogsNavigation, selectAdminLogsObjects, selectAdminLogsSearch },
325
330
  };
326
331
 
327
- const initialState$m = {
332
+ const initialState$n = {
328
333
  animationConfiguration: null,
329
334
  isActiveForCurrentUser: false,
330
335
  isInitialized: false,
@@ -332,7 +337,7 @@ const initialState$m = {
332
337
  };
333
338
  const animationsListSlice = toolkit.createSlice({
334
339
  name: 'animationsList',
335
- initialState: initialState$m,
340
+ initialState: initialState$n,
336
341
  reducers: {},
337
342
  extraReducers: (builder) => {
338
343
  builder.addCase(fetchCurrentAnimation.fulfilled, (state, action) => {
@@ -567,7 +572,7 @@ const Application = {
567
572
  selectors: selectors$2,
568
573
  };
569
574
 
570
- const initialState$l = {
575
+ const initialState$m = {
571
576
  entities: [],
572
577
  loading: 'idle',
573
578
  nbResults: 0,
@@ -583,7 +588,7 @@ const fetchBookableAsset = toolkit.createAsyncThunk('BookableAsset/fetchBookable
583
588
  }));
584
589
  const BookableAssetSlice = toolkit.createSlice({
585
590
  name: 'bookableAsset',
586
- initialState: initialState$l,
591
+ initialState: initialState$m,
587
592
  reducers: {},
588
593
  extraReducers: (builder) => {
589
594
  builder
@@ -604,7 +609,7 @@ const BookableAssetSlice = toolkit.createSlice({
604
609
  const fetchConfiguration = toolkit.createAsyncThunk('AssetReservation/configuration', (_, { extra }) => __awaiter(void 0, void 0, void 0, function* () {
605
610
  return yield extra.jApi.assetReservation.configuration();
606
611
  }));
607
- const initialState$k = {
612
+ const initialState$l = {
608
613
  description: '',
609
614
  right: {
610
615
  manage: false,
@@ -618,7 +623,7 @@ const initialState$k = {
618
623
  };
619
624
  const AssetReservationConfigurationSlice = toolkit.createSlice({
620
625
  name: 'configuration',
621
- initialState: initialState$k,
626
+ initialState: initialState$l,
622
627
  reducers: {},
623
628
  extraReducers: (builder) => {
624
629
  builder
@@ -639,7 +644,7 @@ const initForm = {
639
644
  hourStart: '',
640
645
  hourEnd: '',
641
646
  };
642
- const initialState$j = {
647
+ const initialState$k = {
643
648
  entities: [],
644
649
  loading: 'idle',
645
650
  nbResults: 0,
@@ -655,7 +660,7 @@ const fetchReservation = toolkit.createAsyncThunk('Reservation/fetchReservation'
655
660
  }));
656
661
  const ReservationSlice = toolkit.createSlice({
657
662
  name: 'reservation',
658
- initialState: initialState$j,
663
+ initialState: initialState$k,
659
664
  reducers: {
660
665
  setForm: (state, action) => {
661
666
  state.form = action.payload;
@@ -711,14 +716,14 @@ const AssetReservation = {
711
716
  },
712
717
  };
713
718
 
714
- const initialState$i = {
719
+ const initialState$j = {
715
720
  loading: 'idle',
716
721
  comments: [],
717
722
  };
718
723
  const fetchComments = toolkit.createAsyncThunk('commentList/fetchCommentList', (params, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
719
724
  var _a;
720
725
  try {
721
- const res = yield extra.jApi.article.getComments(params, 'raw-list');
726
+ const res = yield extra.jApi.article.getComments(params, { format: 'raw-list', formatExtend: ['socialActions'] });
722
727
  return { idArticle: params.idArticle, list: res.result };
723
728
  }
724
729
  catch (error) {
@@ -739,7 +744,7 @@ const deleteComment = toolkit.createAsyncThunk('commentList/deleteComment', (par
739
744
  }));
740
745
  const CommentListSlice = toolkit.createSlice({
741
746
  name: 'commentList',
742
- initialState: initialState$i,
747
+ initialState: initialState$j,
743
748
  reducers: {
744
749
  discardComments: (state, action) => {
745
750
  state.comments = state.comments.filter((c) => c.idArticle !== action.payload.idArticle);
@@ -882,6 +887,125 @@ const Comment = {
882
887
  getCommentsLikeRTHandlers,
883
888
  };
884
889
 
890
+ const initialState$i = {
891
+ loading: 'idle',
892
+ reports: [],
893
+ page: 1,
894
+ tab: 'all',
895
+ filters: [],
896
+ orders: [],
897
+ limit: 10,
898
+ nbResults: 0,
899
+ pendingReports: [],
900
+ };
901
+ const contentReportSlice = toolkit.createSlice({
902
+ name: 'contentReport',
903
+ initialState: initialState$i,
904
+ reducers: {
905
+ setTab: (state, action) => {
906
+ state.tab = action.payload;
907
+ state.page = 1;
908
+ state.orders = [];
909
+ state.filters = [];
910
+ },
911
+ setPage: (state, action) => {
912
+ state.page = action.payload;
913
+ },
914
+ setFilters: (state, action) => {
915
+ state.filters = action.payload;
916
+ },
917
+ setOrders: (state, action) => {
918
+ state.orders = action.payload;
919
+ },
920
+ },
921
+ extraReducers: (builder) => {
922
+ builder
923
+ .addCase(fetchReports.pending, (state) => {
924
+ if (state.loading === 'idle')
925
+ state.loading = 'pending';
926
+ })
927
+ .addCase(fetchReports.fulfilled, (state, action) => {
928
+ if (state.loading == 'pending')
929
+ state.loading = 'idle';
930
+ state.reports = action.payload.data;
931
+ state.nbResults = action.payload.cnt;
932
+ return state;
933
+ })
934
+ .addCase(fetchReports.rejected, (state) => {
935
+ if (state.loading == 'pending')
936
+ state.loading = 'idle';
937
+ })
938
+ .addCase(updateStatus.pending, (state, action) => {
939
+ const report = state.reports.find((report) => report.uri === action.meta.arg.uri);
940
+ if (report) {
941
+ state.pendingReports = [...state.pendingReports, Object.assign(Object.assign({}, report), { requestId: action.meta.requestId })];
942
+ state.reports = state.reports.map((report) => {
943
+ return report.uri !== action.meta.arg.uri
944
+ ? report
945
+ : Object.assign(Object.assign({}, report), { status: action.meta.arg.status });
946
+ });
947
+ }
948
+ })
949
+ .addCase(updateStatus.fulfilled, (state, action) => {
950
+ state.pendingReports = state.pendingReports.filter((report) => report.requestId !== action.meta.requestId);
951
+ })
952
+ .addCase(updateStatus.rejected, (state, action) => {
953
+ const report = state.pendingReports.find((report) => report.requestId === action.meta.requestId);
954
+ if (!report)
955
+ return;
956
+ state.reports = state.reports.map((r) => {
957
+ if (r.id !== report.id)
958
+ return r;
959
+ return report;
960
+ });
961
+ state.pendingReports = state.pendingReports.filter((r) => r.requestId !== action.meta.requestId);
962
+ });
963
+ },
964
+ });
965
+ const fetchReports = toolkit.createAsyncThunk('contentReport/fetchReports', (_params, { rejectWithValue, extra, dispatch, getState }) => __awaiter(void 0, void 0, void 0, function* () {
966
+ var _a;
967
+ const state = getState().contentReport;
968
+ const userId = (_a = getState().userCurrent) === null || _a === void 0 ? void 0 : _a.id;
969
+ try {
970
+ const filters = state.tab === 'my' && userId ? [...state.filters, { name: 'idUser', value: userId }] : [...state.filters];
971
+ const orders = state.orders.length > 0 ? state.orders : [{ name: 'dateCreation', sort: 'DESC' }];
972
+ return (yield extra.jApi.contentReport.getReports({
973
+ filters,
974
+ orders,
975
+ page: state.page,
976
+ limit: state.limit,
977
+ })).result;
978
+ }
979
+ catch (error) {
980
+ if (!isAbortError(error)) {
981
+ dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
982
+ }
983
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot fetch pads' });
984
+ }
985
+ }));
986
+ const updateStatus = toolkit.createAsyncThunk('contentReport/updateStatus', (params, { dispatch, rejectWithValue, extra }) => __awaiter(void 0, void 0, void 0, function* () {
987
+ try {
988
+ yield extra.jApi.contentReport.updateStatus(params);
989
+ dispatch(Toast.actions.success({ label: 'GLOBAL_Successfully_Saved' }));
990
+ return true;
991
+ }
992
+ catch (error) {
993
+ if (!isAbortError(error)) {
994
+ dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
995
+ }
996
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot fetch pads' });
997
+ }
998
+ }));
999
+ const selectContentReport = (state) => state.contentReport;
1000
+ const ContentReport = {
1001
+ slice: contentReportSlice,
1002
+ actions: {
1003
+ fetchReports,
1004
+ updateStatus,
1005
+ },
1006
+ selectors: { selectContentReport },
1007
+ };
1008
+
885
1009
  const initialState$h = {
886
1010
  bookmarks: [],
887
1011
  loading: 'idle',
@@ -3229,7 +3353,7 @@ const WidgetEditor = {
3229
3353
  };
3230
3354
 
3231
3355
  const adapter = toolkit.createEntityAdapter({
3232
- selectId: (socialAction) => `${socialAction.struct.targetId}-${socialAction.type}`,
3356
+ selectId: (socialAction) => `${socialAction.targetId}-${socialAction.type}`,
3233
3357
  });
3234
3358
  const slice = toolkit.createSlice({
3235
3359
  name: 'socialActions',
@@ -5653,6 +5777,7 @@ exports.Application = Application;
5653
5777
  exports.AssetReservation = AssetReservation;
5654
5778
  exports.Bookmark = Bookmark;
5655
5779
  exports.Comment = Comment;
5780
+ exports.ContentReport = ContentReport;
5656
5781
  exports.ExtraAppFieldsItemViews = ExtraAppFieldsItemViews;
5657
5782
  exports.Faq = Faq;
5658
5783
  exports.Hook = Hook;
@@ -5678,6 +5803,7 @@ exports.adminLogsReducer = adminLogsReducer;
5678
5803
  exports.adminLogsSlice = adminLogsSlice;
5679
5804
  exports.animationsReducer = animationsReducer;
5680
5805
  exports.animationsSlice = animationsSlice;
5806
+ exports.contentReportSlice = contentReportSlice;
5681
5807
  exports.fetchMediaLibraryConfig = fetchMediaLibraryConfig;
5682
5808
  exports.fetchMediaLibraryFilesStats = fetchMediaLibraryFilesStats;
5683
5809
  exports.fetchMediaLibraryFolders = fetchMediaLibraryFolders;
@@ -5685,12 +5811,14 @@ exports.fetchMediaLibraryFoldersStats = fetchMediaLibraryFoldersStats;
5685
5811
  exports.fetchMediaLibraryStats = fetchMediaLibraryStats;
5686
5812
  exports.fetchMediaLibraryUnclassifiedFiles = fetchMediaLibraryUnclassifiedFiles;
5687
5813
  exports.fetchPads = fetchPads;
5814
+ exports.fetchReports = fetchReports;
5688
5815
  exports.jland = jland;
5689
5816
  exports.magicPadSlice = magicPadSlice;
5690
5817
  exports.mediaLibraryReducer = mediaLibraryReducer;
5691
5818
  exports.mediaLibrarySlice = mediaLibrarySlice;
5692
5819
  exports.slice = slice$1;
5693
5820
  exports.studio = studio;
5821
+ exports.updateStatus = updateStatus;
5694
5822
  exports.updateWidgetContent = updateWidgetContent;
5695
5823
  exports.viewsList = viewsList;
5696
5824
  //# sourceMappingURL=cjs.js.map