jamespot-front-business 1.1.17 → 1.1.19

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
@@ -63,7 +63,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
63
63
  });
64
64
  }
65
65
 
66
- const initialState$9 = {
66
+ const initialState$b = {
67
67
  entities: [],
68
68
  loading: 'idle',
69
69
  nbResults: 0,
@@ -74,7 +74,7 @@ const fetchBookableAsset = toolkit.createAsyncThunk('BookableAsset/fetchBookable
74
74
  }));
75
75
  const BookableAssetSlice = toolkit.createSlice({
76
76
  name: 'bookableAsset',
77
- initialState: initialState$9,
77
+ initialState: initialState$b,
78
78
  reducers: {},
79
79
  extraReducers: (builder) => {
80
80
  builder
@@ -95,7 +95,7 @@ const BookableAssetSlice = toolkit.createSlice({
95
95
  const fetchConfiguration = toolkit.createAsyncThunk('AssetReservation/configuration', (_, { extra }) => __awaiter(void 0, void 0, void 0, function* () {
96
96
  return yield extra.jApi.assetReservation.configuration();
97
97
  }));
98
- const initialState$8 = {
98
+ const initialState$a = {
99
99
  description: '',
100
100
  right: {
101
101
  manage: false,
@@ -109,7 +109,7 @@ const initialState$8 = {
109
109
  };
110
110
  const AssetReservationConfigurationSlice = toolkit.createSlice({
111
111
  name: 'configuration',
112
- initialState: initialState$8,
112
+ initialState: initialState$a,
113
113
  reducers: {},
114
114
  extraReducers: (builder) => {
115
115
  builder
@@ -130,7 +130,7 @@ const initForm = {
130
130
  hourStart: '',
131
131
  hourEnd: '',
132
132
  };
133
- const initialState$7 = {
133
+ const initialState$9 = {
134
134
  entities: [],
135
135
  loading: 'idle',
136
136
  nbResults: 0,
@@ -142,7 +142,7 @@ const fetchReservation = toolkit.createAsyncThunk('Reservation/fetchReservation'
142
142
  }));
143
143
  const ReservationSlice = toolkit.createSlice({
144
144
  name: 'reservation',
145
- initialState: initialState$7,
145
+ initialState: initialState$9,
146
146
  reducers: {
147
147
  setForm: (state, action) => {
148
148
  state.form = action.payload;
@@ -235,7 +235,7 @@ const Toast = {
235
235
  selectors: selectors$1,
236
236
  };
237
237
 
238
- const initialState$6 = {
238
+ const initialState$8 = {
239
239
  bookmarks: [],
240
240
  loading: 'idle',
241
241
  status: undefined,
@@ -298,7 +298,7 @@ const deleteBookmark = toolkit.createAsyncThunk('bookmarkList/deleteBookmark', (
298
298
  }));
299
299
  const BookmarkListSlice = toolkit.createSlice({
300
300
  name: 'bookmarkList',
301
- initialState: initialState$6,
301
+ initialState: initialState$8,
302
302
  reducers: {
303
303
  resetAddBookmarkStatus: (state, action) => {
304
304
  if (state.add[action.payload]) {
@@ -461,7 +461,7 @@ const getRTHandlers = function (dispatch) {
461
461
  ];
462
462
  };
463
463
 
464
- const initialState$5 = {
464
+ const initialState$7 = {
465
465
  bookmark: undefined,
466
466
  status: undefined,
467
467
  loading: 'idle',
@@ -483,7 +483,7 @@ const editBookmark = toolkit.createAsyncThunk('bookmarkEdit/editBookmark', (book
483
483
  }));
484
484
  const BookmarkEditSlice = toolkit.createSlice({
485
485
  name: 'bookmarkEdit',
486
- initialState: initialState$5,
486
+ initialState: initialState$7,
487
487
  reducers: {
488
488
  setEditBookmark: (state, action) => {
489
489
  state.bookmark = Object.assign({}, action.payload);
@@ -771,7 +771,7 @@ const initialMap = {
771
771
  illustration: '',
772
772
  assignLicense: false,
773
773
  };
774
- const initialState$4 = {
774
+ const initialState$6 = {
775
775
  map: Object.assign({}, initialMap),
776
776
  loading: 'idle',
777
777
  status: undefined,
@@ -815,13 +815,13 @@ const createMap = toolkit.createAsyncThunk('mapCreate/create', ({ map, jlandUrlB
815
815
  }));
816
816
  const MapCreateSlice = toolkit.createSlice({
817
817
  name: 'mapCreate',
818
- initialState: initialState$4,
818
+ initialState: initialState$6,
819
819
  reducers: {
820
820
  setMap: (state, action) => {
821
821
  state.map = action.payload;
822
822
  },
823
823
  resetCreateMapState: () => {
824
- return initialState$4;
824
+ return initialState$6;
825
825
  },
826
826
  },
827
827
  extraReducers: (builder) => {
@@ -879,6 +879,14 @@ const adapter = toolkit.createEntityAdapter({
879
879
  selectId: (model) => model.type,
880
880
  sortComparer: (a, b) => a.label.localeCompare(b.label),
881
881
  });
882
+ const getModelIconSrc = (model, size) => {
883
+ const imgProps = {
884
+ from: "imagestatic",
885
+ size: size !== null && size !== void 0 ? size : 'fitx600',
886
+ uri: `icons/${model && model.icon ? model.icon : `article`}-white`,
887
+ };
888
+ return jamespotUserApi.formatImgUrl(imgProps);
889
+ };
882
890
  const slice$1 = toolkit.createSlice({
883
891
  name: 'models',
884
892
  initialState: adapter.getInitialState(),
@@ -889,13 +897,169 @@ const slice$1 = toolkit.createSlice({
889
897
  },
890
898
  });
891
899
  const selectors = adapter.getSelectors((state) => state.entities.models);
900
+ const utils = {
901
+ getModelIconSrc
902
+ };
892
903
  const selectByIds = (state, types) => types.map(type => state.entities.models.entities[type]).filter(model => !!model);
893
904
  const Model = {
894
905
  slice: slice$1,
895
906
  actions: Object.assign({}, slice$1.actions),
907
+ utils,
896
908
  selectors: Object.assign(Object.assign({}, selectors), { selectByIds }),
897
909
  };
898
910
 
911
+ const initialQuery = {
912
+ query: '',
913
+ filters: [],
914
+ limit: 20,
915
+ orders: [{ name: 'dateCreation', sort: 'DESC' }],
916
+ page: 1,
917
+ };
918
+ const fetchFiles = toolkit.createAsyncThunk('/fetchFiles', ({ page, query, sort }, { extra, getState }) => __awaiter(void 0, void 0, void 0, function* () {
919
+ const jApi = extra.jApi;
920
+ const state = getState();
921
+ const filters = state.wedoc.tab === 'my-documents' ? [{ name: 'idUser', value: '0' }] : [];
922
+ const orders = [{ name: 'dateCreation', sort }];
923
+ const resolvePage = query !== state.wedoc.query ? 1 : page;
924
+ return yield jApi.wedoc.getFiles(Object.assign(Object.assign({}, initialQuery), { filters, query, orders, page: resolvePage, limit: 12 }));
925
+ }));
926
+ const fetchRecentFiles = toolkit.createAsyncThunk('/fetchRecentFiles', (_, { extra, getState }) => __awaiter(void 0, void 0, void 0, function* () {
927
+ const jApi = extra.jApi;
928
+ const state = getState();
929
+ const filters = state.wedoc.tab === 'my-documents' ? [{ name: 'idUser', value: '0' }] : [];
930
+ return yield jApi.wedoc.getFiles(Object.assign(Object.assign({}, initialQuery), { filters, limit: 4 }));
931
+ }));
932
+
933
+ const initialState$5 = {
934
+ entities: [],
935
+ nbEntities: 0,
936
+ entitiesRecent: [],
937
+ tab: 'my-documents',
938
+ loading: 'idle',
939
+ loadingRecent: 'idle',
940
+ query: '',
941
+ page: 1
942
+ };
943
+ const WedocAppSlice = toolkit.createSlice({
944
+ name: 'wedoc',
945
+ initialState: initialState$5,
946
+ reducers: {
947
+ update: (state, action) => {
948
+ state.entities = [
949
+ ...state.entities.map((file) => file.id === action.payload.id ? Object.assign(Object.assign({}, file), action.payload) : file)
950
+ ];
951
+ },
952
+ setQuery: (state, action) => {
953
+ state.query = action.payload;
954
+ },
955
+ setTab: (state, action) => {
956
+ state.tab = action.payload;
957
+ },
958
+ },
959
+ extraReducers: (builder) => {
960
+ builder
961
+ .addCase(fetchFiles.pending, (state) => {
962
+ state.loading = 'pending';
963
+ })
964
+ .addCase(fetchFiles.fulfilled, (state, action) => {
965
+ state.loading = 'idle';
966
+ state.entities = action.payload.result.data;
967
+ state.nbEntities = action.payload.result.cnt;
968
+ state.page = action.payload.result.page;
969
+ })
970
+ .addCase(fetchFiles.rejected, (state) => {
971
+ state.loading = 'idle';
972
+ })
973
+ .addCase(fetchRecentFiles.pending, (state) => {
974
+ state.loadingRecent = 'pending';
975
+ })
976
+ .addCase(fetchRecentFiles.fulfilled, (state, action) => {
977
+ state.loadingRecent = 'idle';
978
+ state.entitiesRecent = action.payload.result.data;
979
+ })
980
+ .addCase(fetchRecentFiles.rejected, (state) => {
981
+ state.loadingRecent = 'idle';
982
+ });
983
+ },
984
+ });
985
+
986
+ const WedocApp = {
987
+ slice: WedocAppSlice,
988
+ selectors: {
989
+ getFiles: (state) => {
990
+ return {
991
+ entities: state.wedoc.entities,
992
+ nbEntities: state.wedoc.nbEntities,
993
+ loading: state.wedoc.loading === 'pending',
994
+ tab: state.wedoc.tab,
995
+ query: state.wedoc.query,
996
+ page: state.wedoc.page
997
+ };
998
+ },
999
+ getRecent: (state) => {
1000
+ return {
1001
+ entities: state.wedoc.entitiesRecent,
1002
+ loading: state.wedoc.loadingRecent === 'pending',
1003
+ tab: state.wedoc.tab,
1004
+ };
1005
+ },
1006
+ },
1007
+ actions: {
1008
+ fetchFiles,
1009
+ fetchRecentFiles
1010
+ },
1011
+ };
1012
+
1013
+ const fetchRequest = toolkit.createAsyncThunk('/fetchRequest', ({ uri, idUser }, { extra }) => __awaiter(void 0, void 0, void 0, function* () {
1014
+ const jApi = extra.jApi;
1015
+ return yield jApi.share.getObjectAccessRequest(uri, idUser);
1016
+ }));
1017
+
1018
+ const initialState$4 = {
1019
+ entities: [],
1020
+ nbEntities: 0,
1021
+ loading: 'idle',
1022
+ };
1023
+ const ShareSlice = toolkit.createSlice({
1024
+ name: 'share',
1025
+ initialState: initialState$4,
1026
+ reducers: {
1027
+ remove: (state, action) => {
1028
+ state.entities = [
1029
+ ...state.entities.filter((entity) => entity.id !== action.payload)
1030
+ ];
1031
+ },
1032
+ },
1033
+ extraReducers: (builder) => {
1034
+ builder
1035
+ .addCase(fetchRequest.pending, (state) => {
1036
+ state.loading = 'pending';
1037
+ })
1038
+ .addCase(fetchRequest.fulfilled, (state, action) => {
1039
+ state.loading = 'idle';
1040
+ state.entities = action.payload.result;
1041
+ })
1042
+ .addCase(fetchRequest.rejected, (state) => {
1043
+ state.loading = 'idle';
1044
+ });
1045
+ },
1046
+ });
1047
+
1048
+ const Share = {
1049
+ slice: ShareSlice,
1050
+ selectors: {
1051
+ requests: (state) => {
1052
+ return {
1053
+ loading: state.share.loading,
1054
+ entities: state.share.entities
1055
+ };
1056
+ },
1057
+ },
1058
+ actions: {
1059
+ fetchRequest,
1060
+ },
1061
+ };
1062
+
899
1063
  const initialState$3 = {
900
1064
  channels: undefined,
901
1065
  loading: 'idle',
@@ -909,6 +1073,7 @@ const fetchChannels = toolkit.createAsyncThunk('/fetchChannels', (page, { extra
909
1073
  type: 'tvDisplayChannel',
910
1074
  format: 'raw-list',
911
1075
  page: askedPage,
1076
+ orders: [{ name: 'id', sort: 'DESC' }],
912
1077
  };
913
1078
  jApi.article
914
1079
  .list(config)
@@ -921,6 +1086,21 @@ const fetchChannels = toolkit.createAsyncThunk('/fetchChannels', (page, { extra
921
1086
  });
922
1087
  });
923
1088
  }));
1089
+ const deleteChannel = toolkit.createAsyncThunk('/deleteChannel', ({ channel }, { extra, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
1090
+ const jApi = extra.jApi;
1091
+ return yield new Promise((resolve, reject) => {
1092
+ jApi.article
1093
+ .delete(channel.id)
1094
+ .then((response) => {
1095
+ resolve(response.result);
1096
+ dispatch(fetchChannels());
1097
+ })
1098
+ .catch((ex) => {
1099
+ var _a, _b;
1100
+ reject({ error: (_a = ex.error) !== null && _a !== void 0 ? _a : 1, errorMsg: (_b = ex.errorMsg) !== null && _b !== void 0 ? _b : 'Error deleting channel' });
1101
+ });
1102
+ });
1103
+ }));
924
1104
  const ChannelsListSlice = toolkit.createSlice({
925
1105
  name: 'channelsList',
926
1106
  initialState: Object.assign({}, initialState$3),
@@ -942,6 +1122,19 @@ const ChannelsListSlice = toolkit.createSlice({
942
1122
  if (state.loading === 'pending') {
943
1123
  state.loading = 'idle';
944
1124
  }
1125
+ })
1126
+ .addCase(deleteChannel.pending, (state) => {
1127
+ state.loadingChannelDeletion = 'pending';
1128
+ })
1129
+ .addCase(deleteChannel.fulfilled, (state) => {
1130
+ if (state.loadingChannelDeletion === 'pending') {
1131
+ state.loadingChannelDeletion = 'idle';
1132
+ }
1133
+ })
1134
+ .addCase(deleteChannel.rejected, (state) => {
1135
+ if (state.loadingChannelDeletion === 'pending') {
1136
+ state.loadingChannelDeletion = 'idle';
1137
+ }
945
1138
  });
946
1139
  },
947
1140
  });
@@ -951,7 +1144,7 @@ function isChannelConfigured(channel) {
951
1144
  return !!channel.tvChannelBackgroundColor && !!channel.tvChannelGroupTarget;
952
1145
  }
953
1146
  else {
954
- return !!channel.tvChannelBackgroundColor && channel.tvChannelNumImages !== 0;
1147
+ return channel.tvChannelNumImages !== 0;
955
1148
  }
956
1149
  }
957
1150
 
@@ -969,6 +1162,7 @@ const TVDisplay = {
969
1162
  slice: TVDisplaySlice,
970
1163
  actions: {
971
1164
  fetchChannels,
1165
+ deleteChannel,
972
1166
  },
973
1167
  selectors: {
974
1168
  selectChannelsList,
@@ -1423,9 +1617,11 @@ exports.Bookmark = Bookmark;
1423
1617
  exports.MODE_EDIT = MODE_EDIT;
1424
1618
  exports.MODE_VIEW = MODE_VIEW;
1425
1619
  exports.Model = Model;
1620
+ exports.Share = Share;
1426
1621
  exports.TVDisplay = TVDisplay;
1427
1622
  exports.Toast = Toast;
1428
1623
  exports.UserCurrent = UserCurrent;
1624
+ exports.WedocApp = WedocApp;
1429
1625
  exports.Widget = Widget;
1430
1626
  exports.WidgetEditor = WidgetEditor;
1431
1627
  exports.actions = actions;