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/esm.js CHANGED
@@ -48,6 +48,11 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
48
48
  const isAbortError = (error) => {
49
49
  return !!error && typeof error === 'object' && 'aborted' in error && !!error.aborted;
50
50
  };
51
+ const getErrorMessage = (error, defaultError) => {
52
+ return error && typeof error === 'object' && 'errorMsg' in error && typeof error.errorMsg === 'string'
53
+ ? error.errorMsg
54
+ : defaultError !== null && defaultError !== void 0 ? defaultError : 'GLOBAL_Technical_Error';
55
+ };
51
56
 
52
57
  const toastAdapter = createEntityAdapter({
53
58
  selectId: (toast) => toast.id,
@@ -92,7 +97,7 @@ const oneMonthAgo$2 = () => {
92
97
  date.setMonth(date.getMonth() - 1);
93
98
  return date;
94
99
  };
95
- const initialState$p = {
100
+ const initialState$q = {
96
101
  data: [],
97
102
  loading: 'idle',
98
103
  page: 1,
@@ -124,7 +129,7 @@ const fetchLogsNavigation = createAsyncThunk('admin/fetchLogsNavigation', (param
124
129
  }));
125
130
  const adminLogsNavigationSlice = createSlice({
126
131
  name: 'logsNavigation',
127
- initialState: initialState$p,
132
+ initialState: initialState$q,
128
133
  reducers: {
129
134
  setNavigationOrder: (state, action) => {
130
135
  state.orders = [...action.payload];
@@ -162,7 +167,7 @@ const oneMonthAgo$1 = () => {
162
167
  date.setMonth(date.getMonth() - 1);
163
168
  return date;
164
169
  };
165
- const initialState$o = {
170
+ const initialState$p = {
166
171
  data: [],
167
172
  loading: 'idle',
168
173
  page: 1,
@@ -194,7 +199,7 @@ const fetchLogsObjects = createAsyncThunk('admin/fetchLogsObjects', (params, { e
194
199
  }));
195
200
  const adminLogsObjectsSlice = createSlice({
196
201
  name: 'logsObjects',
197
- initialState: initialState$o,
202
+ initialState: initialState$p,
198
203
  reducers: {
199
204
  setObjectsOrder: (state, action) => {
200
205
  state.orders = [...action.payload];
@@ -231,7 +236,7 @@ const oneMonthAgo = () => {
231
236
  date.setMonth(date.getMonth() - 1);
232
237
  return date;
233
238
  };
234
- const initialState$n = {
239
+ const initialState$o = {
235
240
  data: [],
236
241
  loading: 'idle',
237
242
  page: 1,
@@ -263,7 +268,7 @@ const fetchLogsSearch = createAsyncThunk('admin/fetchLogsSearch', (params, { ext
263
268
  }));
264
269
  const adminLogsSearchSlice = createSlice({
265
270
  name: 'logsSearch',
266
- initialState: initialState$n,
271
+ initialState: initialState$o,
267
272
  reducers: {
268
273
  setSearchOrder: (state, action) => {
269
274
  state.orders = [...action.payload];
@@ -316,7 +321,7 @@ const AdminLogs = {
316
321
  selectors: { selectAdminLogsNavigation, selectAdminLogsObjects, selectAdminLogsSearch },
317
322
  };
318
323
 
319
- const initialState$m = {
324
+ const initialState$n = {
320
325
  animationConfiguration: null,
321
326
  isActiveForCurrentUser: false,
322
327
  isInitialized: false,
@@ -324,7 +329,7 @@ const initialState$m = {
324
329
  };
325
330
  const animationsListSlice = createSlice({
326
331
  name: 'animationsList',
327
- initialState: initialState$m,
332
+ initialState: initialState$n,
328
333
  reducers: {},
329
334
  extraReducers: (builder) => {
330
335
  builder.addCase(fetchCurrentAnimation.fulfilled, (state, action) => {
@@ -559,7 +564,7 @@ const Application = {
559
564
  selectors: selectors$2,
560
565
  };
561
566
 
562
- const initialState$l = {
567
+ const initialState$m = {
563
568
  entities: [],
564
569
  loading: 'idle',
565
570
  nbResults: 0,
@@ -575,7 +580,7 @@ const fetchBookableAsset = createAsyncThunk('BookableAsset/fetchBookableAsset',
575
580
  }));
576
581
  const BookableAssetSlice = createSlice({
577
582
  name: 'bookableAsset',
578
- initialState: initialState$l,
583
+ initialState: initialState$m,
579
584
  reducers: {},
580
585
  extraReducers: (builder) => {
581
586
  builder
@@ -596,7 +601,7 @@ const BookableAssetSlice = createSlice({
596
601
  const fetchConfiguration = createAsyncThunk('AssetReservation/configuration', (_, { extra }) => __awaiter(void 0, void 0, void 0, function* () {
597
602
  return yield extra.jApi.assetReservation.configuration();
598
603
  }));
599
- const initialState$k = {
604
+ const initialState$l = {
600
605
  description: '',
601
606
  right: {
602
607
  manage: false,
@@ -610,7 +615,7 @@ const initialState$k = {
610
615
  };
611
616
  const AssetReservationConfigurationSlice = createSlice({
612
617
  name: 'configuration',
613
- initialState: initialState$k,
618
+ initialState: initialState$l,
614
619
  reducers: {},
615
620
  extraReducers: (builder) => {
616
621
  builder
@@ -631,7 +636,7 @@ const initForm = {
631
636
  hourStart: '',
632
637
  hourEnd: '',
633
638
  };
634
- const initialState$j = {
639
+ const initialState$k = {
635
640
  entities: [],
636
641
  loading: 'idle',
637
642
  nbResults: 0,
@@ -647,7 +652,7 @@ const fetchReservation = createAsyncThunk('Reservation/fetchReservation', (viewM
647
652
  }));
648
653
  const ReservationSlice = createSlice({
649
654
  name: 'reservation',
650
- initialState: initialState$j,
655
+ initialState: initialState$k,
651
656
  reducers: {
652
657
  setForm: (state, action) => {
653
658
  state.form = action.payload;
@@ -703,14 +708,14 @@ const AssetReservation = {
703
708
  },
704
709
  };
705
710
 
706
- const initialState$i = {
711
+ const initialState$j = {
707
712
  loading: 'idle',
708
713
  comments: [],
709
714
  };
710
715
  const fetchComments = createAsyncThunk('commentList/fetchCommentList', (params, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
711
716
  var _a;
712
717
  try {
713
- const res = yield extra.jApi.article.getComments(params, 'raw-list');
718
+ const res = yield extra.jApi.article.getComments(params, { format: 'raw-list', formatExtend: ['socialActions'] });
714
719
  return { idArticle: params.idArticle, list: res.result };
715
720
  }
716
721
  catch (error) {
@@ -731,7 +736,7 @@ const deleteComment = createAsyncThunk('commentList/deleteComment', (params, { e
731
736
  }));
732
737
  const CommentListSlice = createSlice({
733
738
  name: 'commentList',
734
- initialState: initialState$i,
739
+ initialState: initialState$j,
735
740
  reducers: {
736
741
  discardComments: (state, action) => {
737
742
  state.comments = state.comments.filter((c) => c.idArticle !== action.payload.idArticle);
@@ -874,6 +879,125 @@ const Comment = {
874
879
  getCommentsLikeRTHandlers,
875
880
  };
876
881
 
882
+ const initialState$i = {
883
+ loading: 'idle',
884
+ reports: [],
885
+ page: 1,
886
+ tab: 'all',
887
+ filters: [],
888
+ orders: [],
889
+ limit: 10,
890
+ nbResults: 0,
891
+ pendingReports: [],
892
+ };
893
+ const contentReportSlice = createSlice({
894
+ name: 'contentReport',
895
+ initialState: initialState$i,
896
+ reducers: {
897
+ setTab: (state, action) => {
898
+ state.tab = action.payload;
899
+ state.page = 1;
900
+ state.orders = [];
901
+ state.filters = [];
902
+ },
903
+ setPage: (state, action) => {
904
+ state.page = action.payload;
905
+ },
906
+ setFilters: (state, action) => {
907
+ state.filters = action.payload;
908
+ },
909
+ setOrders: (state, action) => {
910
+ state.orders = action.payload;
911
+ },
912
+ },
913
+ extraReducers: (builder) => {
914
+ builder
915
+ .addCase(fetchReports.pending, (state) => {
916
+ if (state.loading === 'idle')
917
+ state.loading = 'pending';
918
+ })
919
+ .addCase(fetchReports.fulfilled, (state, action) => {
920
+ if (state.loading == 'pending')
921
+ state.loading = 'idle';
922
+ state.reports = action.payload.data;
923
+ state.nbResults = action.payload.cnt;
924
+ return state;
925
+ })
926
+ .addCase(fetchReports.rejected, (state) => {
927
+ if (state.loading == 'pending')
928
+ state.loading = 'idle';
929
+ })
930
+ .addCase(updateStatus.pending, (state, action) => {
931
+ const report = state.reports.find((report) => report.uri === action.meta.arg.uri);
932
+ if (report) {
933
+ state.pendingReports = [...state.pendingReports, Object.assign(Object.assign({}, report), { requestId: action.meta.requestId })];
934
+ state.reports = state.reports.map((report) => {
935
+ return report.uri !== action.meta.arg.uri
936
+ ? report
937
+ : Object.assign(Object.assign({}, report), { status: action.meta.arg.status });
938
+ });
939
+ }
940
+ })
941
+ .addCase(updateStatus.fulfilled, (state, action) => {
942
+ state.pendingReports = state.pendingReports.filter((report) => report.requestId !== action.meta.requestId);
943
+ })
944
+ .addCase(updateStatus.rejected, (state, action) => {
945
+ const report = state.pendingReports.find((report) => report.requestId === action.meta.requestId);
946
+ if (!report)
947
+ return;
948
+ state.reports = state.reports.map((r) => {
949
+ if (r.id !== report.id)
950
+ return r;
951
+ return report;
952
+ });
953
+ state.pendingReports = state.pendingReports.filter((r) => r.requestId !== action.meta.requestId);
954
+ });
955
+ },
956
+ });
957
+ const fetchReports = createAsyncThunk('contentReport/fetchReports', (_params, { rejectWithValue, extra, dispatch, getState }) => __awaiter(void 0, void 0, void 0, function* () {
958
+ var _a;
959
+ const state = getState().contentReport;
960
+ const userId = (_a = getState().userCurrent) === null || _a === void 0 ? void 0 : _a.id;
961
+ try {
962
+ const filters = state.tab === 'my' && userId ? [...state.filters, { name: 'idUser', value: userId }] : [...state.filters];
963
+ const orders = state.orders.length > 0 ? state.orders : [{ name: 'dateCreation', sort: 'DESC' }];
964
+ return (yield extra.jApi.contentReport.getReports({
965
+ filters,
966
+ orders,
967
+ page: state.page,
968
+ limit: state.limit,
969
+ })).result;
970
+ }
971
+ catch (error) {
972
+ if (!isAbortError(error)) {
973
+ dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
974
+ }
975
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot fetch pads' });
976
+ }
977
+ }));
978
+ const updateStatus = createAsyncThunk('contentReport/updateStatus', (params, { dispatch, rejectWithValue, extra }) => __awaiter(void 0, void 0, void 0, function* () {
979
+ try {
980
+ yield extra.jApi.contentReport.updateStatus(params);
981
+ dispatch(Toast.actions.success({ label: 'GLOBAL_Successfully_Saved' }));
982
+ return true;
983
+ }
984
+ catch (error) {
985
+ if (!isAbortError(error)) {
986
+ dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
987
+ }
988
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot fetch pads' });
989
+ }
990
+ }));
991
+ const selectContentReport = (state) => state.contentReport;
992
+ const ContentReport = {
993
+ slice: contentReportSlice,
994
+ actions: {
995
+ fetchReports,
996
+ updateStatus,
997
+ },
998
+ selectors: { selectContentReport },
999
+ };
1000
+
877
1001
  const initialState$h = {
878
1002
  bookmarks: [],
879
1003
  loading: 'idle',
@@ -3221,7 +3345,7 @@ const WidgetEditor = {
3221
3345
  };
3222
3346
 
3223
3347
  const adapter = createEntityAdapter({
3224
- selectId: (socialAction) => `${socialAction.struct.targetId}-${socialAction.type}`,
3348
+ selectId: (socialAction) => `${socialAction.targetId}-${socialAction.type}`,
3225
3349
  });
3226
3350
  const slice = createSlice({
3227
3351
  name: 'socialActions',
@@ -5625,5 +5749,5 @@ const studio = {
5625
5749
  },
5626
5750
  };
5627
5751
 
5628
- export { APP_STATUS_TYPE, AUDIENCE, AdminLogs, Animations, AppColumnsDefaultTypes, AppFieldFormPropertyTypes, AppFormBannedFromViews$1 as AppFormBannedFromViews, AppFormFieldOnlyInView, AppFormFixedList$1 as AppFormFixedList, AppFormItemTypes, AppFormNoAsFieldList, AppFormNonPrimaryList, AppFormPrimaryList, AppFormPrimaryListValues, AppFormUniqueList, AppFormUniqueListCheck, Application, AssetReservation, Bookmark, Comment, Description, Element, ExtraAppFieldsItemViews, Faq, Hook, MagicPad, MapExtraFieldsWithView, MediaLibrary, Model, Network, Platform, STUDIO_VIEW, Share, SocialActions, StatusType$1 as StatusType, TVDisplay, TinyMCE, Toast, UserCurrent, WedocApp, Widget, WidgetEditor, actions, adminLogsReducer, adminLogsSlice, animationsReducer, animationsSlice, fetchMediaLibraryConfig, fetchMediaLibraryFilesStats, fetchMediaLibraryFolders, fetchMediaLibraryFoldersStats, fetchMediaLibraryStats, fetchMediaLibraryUnclassifiedFiles, fetchPads, jland, magicPadSlice, mediaLibraryReducer, mediaLibrarySlice, slice$1 as slice, studio, updateWidgetContent, viewsList };
5752
+ export { APP_STATUS_TYPE, AUDIENCE, AdminLogs, Animations, AppColumnsDefaultTypes, AppFieldFormPropertyTypes, AppFormBannedFromViews$1 as AppFormBannedFromViews, AppFormFieldOnlyInView, AppFormFixedList$1 as AppFormFixedList, AppFormItemTypes, AppFormNoAsFieldList, AppFormNonPrimaryList, AppFormPrimaryList, AppFormPrimaryListValues, AppFormUniqueList, AppFormUniqueListCheck, Application, AssetReservation, Bookmark, Comment, ContentReport, Description, Element, ExtraAppFieldsItemViews, Faq, Hook, MagicPad, MapExtraFieldsWithView, MediaLibrary, Model, Network, Platform, STUDIO_VIEW, Share, SocialActions, StatusType$1 as StatusType, TVDisplay, TinyMCE, Toast, UserCurrent, WedocApp, Widget, WidgetEditor, actions, adminLogsReducer, adminLogsSlice, animationsReducer, animationsSlice, contentReportSlice, fetchMediaLibraryConfig, fetchMediaLibraryFilesStats, fetchMediaLibraryFolders, fetchMediaLibraryFoldersStats, fetchMediaLibraryStats, fetchMediaLibraryUnclassifiedFiles, fetchPads, fetchReports, jland, magicPadSlice, mediaLibraryReducer, mediaLibrarySlice, slice$1 as slice, studio, updateStatus, updateWidgetContent, viewsList };
5629
5753
  //# sourceMappingURL=esm.js.map