jamespot-front-business 1.2.49 → 1.2.51

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
@@ -81,7 +81,7 @@ const oneMonthAgo$2 = () => {
81
81
  date.setMonth(date.getMonth() - 1);
82
82
  return date;
83
83
  };
84
- const initialState$s = {
84
+ const initialState$t = {
85
85
  data: [],
86
86
  loading: 'idle',
87
87
  page: 1,
@@ -113,7 +113,7 @@ const fetchLogsNavigation = toolkit.createAsyncThunk('admin/fetchLogsNavigation'
113
113
  });
114
114
  const adminLogsNavigationSlice = toolkit.createSlice({
115
115
  name: 'logsNavigation',
116
- initialState: initialState$s,
116
+ initialState: initialState$t,
117
117
  reducers: {
118
118
  setNavigationOrder: (state, action) => {
119
119
  state.orders = [...action.payload];
@@ -150,7 +150,7 @@ const oneMonthAgo$1 = () => {
150
150
  date.setMonth(date.getMonth() - 1);
151
151
  return date;
152
152
  };
153
- const initialState$r = {
153
+ const initialState$s = {
154
154
  data: [],
155
155
  loading: 'idle',
156
156
  page: 1,
@@ -182,7 +182,7 @@ const fetchLogsObjects = toolkit.createAsyncThunk('admin/fetchLogsObjects', asyn
182
182
  });
183
183
  const adminLogsObjectsSlice = toolkit.createSlice({
184
184
  name: 'logsObjects',
185
- initialState: initialState$r,
185
+ initialState: initialState$s,
186
186
  reducers: {
187
187
  setObjectsOrder: (state, action) => {
188
188
  state.orders = [...action.payload];
@@ -219,7 +219,7 @@ const oneMonthAgo = () => {
219
219
  date.setMonth(date.getMonth() - 1);
220
220
  return date;
221
221
  };
222
- const initialState$q = {
222
+ const initialState$r = {
223
223
  data: [],
224
224
  loading: 'idle',
225
225
  page: 1,
@@ -251,7 +251,7 @@ const fetchLogsSearch = toolkit.createAsyncThunk('admin/fetchLogsSearch', async
251
251
  });
252
252
  const adminLogsSearchSlice = toolkit.createSlice({
253
253
  name: 'logsSearch',
254
- initialState: initialState$q,
254
+ initialState: initialState$r,
255
255
  reducers: {
256
256
  setSearchOrder: (state, action) => {
257
257
  state.orders = [...action.payload];
@@ -308,7 +308,7 @@ const AdminLogs = {
308
308
  selectors: { selectAdminLogsNavigation, selectAdminLogsObjects, selectAdminLogsSearch },
309
309
  };
310
310
 
311
- const initialState$p = {
311
+ const initialState$q = {
312
312
  animationConfiguration: null,
313
313
  isActiveForCurrentUser: false,
314
314
  isInitialized: false,
@@ -316,7 +316,7 @@ const initialState$p = {
316
316
  };
317
317
  const animationsListSlice = toolkit.createSlice({
318
318
  name: 'animationsList',
319
- initialState: initialState$p,
319
+ initialState: initialState$q,
320
320
  reducers: {},
321
321
  extraReducers: (builder) => {
322
322
  builder.addCase(fetchCurrentAnimation.fulfilled, (state, action) => {
@@ -551,7 +551,7 @@ const Application = {
551
551
  selectors: selectors$2,
552
552
  };
553
553
 
554
- const initialState$o = {
554
+ const initialState$p = {
555
555
  entities: [],
556
556
  loading: 'idle',
557
557
  nbResults: 0,
@@ -568,7 +568,7 @@ const fetchBookableAsset = toolkit.createAsyncThunk('BookableAsset/fetchBookable
568
568
  });
569
569
  const BookableAssetSlice = toolkit.createSlice({
570
570
  name: 'bookableAsset',
571
- initialState: initialState$o,
571
+ initialState: initialState$p,
572
572
  reducers: {},
573
573
  extraReducers: (builder) => {
574
574
  builder
@@ -589,7 +589,7 @@ const BookableAssetSlice = toolkit.createSlice({
589
589
  const fetchConfiguration = toolkit.createAsyncThunk('AssetReservation/configuration', async (_, { extra }) => {
590
590
  return await extra.jApi.assetReservation.configuration();
591
591
  });
592
- const initialState$n = {
592
+ const initialState$o = {
593
593
  description: '',
594
594
  right: {
595
595
  manage: false,
@@ -603,7 +603,7 @@ const initialState$n = {
603
603
  };
604
604
  const AssetReservationConfigurationSlice = toolkit.createSlice({
605
605
  name: 'configuration',
606
- initialState: initialState$n,
606
+ initialState: initialState$o,
607
607
  reducers: {},
608
608
  extraReducers: (builder) => {
609
609
  builder
@@ -627,7 +627,7 @@ const initForm = {
627
627
  hourStart: '',
628
628
  hourEnd: '',
629
629
  };
630
- const initialState$m = {
630
+ const initialState$n = {
631
631
  entities: [],
632
632
  loading: 'idle',
633
633
  nbResults: 0,
@@ -643,7 +643,7 @@ const fetchReservation = toolkit.createAsyncThunk('Reservation/fetchReservation'
643
643
  });
644
644
  const ReservationSlice = toolkit.createSlice({
645
645
  name: 'reservation',
646
- initialState: initialState$m,
646
+ initialState: initialState$n,
647
647
  reducers: {
648
648
  setForm: (state, action) => {
649
649
  state.form = action.payload;
@@ -699,7 +699,7 @@ const AssetReservation = {
699
699
  },
700
700
  };
701
701
 
702
- const initialState$l = {
702
+ const initialState$m = {
703
703
  loading: 'idle',
704
704
  reports: [],
705
705
  page: 1,
@@ -712,7 +712,7 @@ const initialState$l = {
712
712
  };
713
713
  const contentReportSlice = toolkit.createSlice({
714
714
  name: 'contentReport',
715
- initialState: initialState$l,
715
+ initialState: initialState$m,
716
716
  reducers: {
717
717
  setTab: (state, action) => {
718
718
  state.tab = action.payload;
@@ -822,7 +822,7 @@ const ContentReport = {
822
822
  selectors: { selectContentReport },
823
823
  };
824
824
 
825
- const initialState$k = {
825
+ const initialState$l = {
826
826
  bookmarks: [],
827
827
  loading: 'idle',
828
828
  status: undefined,
@@ -884,7 +884,7 @@ const deleteBookmark = toolkit.createAsyncThunk('bookmarkList/deleteBookmark', a
884
884
  });
885
885
  const BookmarkListSlice = toolkit.createSlice({
886
886
  name: 'bookmarkList',
887
- initialState: initialState$k,
887
+ initialState: initialState$l,
888
888
  reducers: {
889
889
  resetAddBookmarkStatus: (state, action) => {
890
890
  if (state.add[action.payload]) {
@@ -1047,7 +1047,7 @@ const getBookmarkRTHandlers = function (dispatch) {
1047
1047
  ];
1048
1048
  };
1049
1049
 
1050
- const initialState$j = {
1050
+ const initialState$k = {
1051
1051
  bookmark: undefined,
1052
1052
  status: undefined,
1053
1053
  loading: 'idle',
@@ -1068,7 +1068,7 @@ const editBookmark = toolkit.createAsyncThunk('bookmarkEdit/editBookmark', async
1068
1068
  });
1069
1069
  const BookmarkEditSlice = toolkit.createSlice({
1070
1070
  name: 'bookmarkEdit',
1071
- initialState: initialState$j,
1071
+ initialState: initialState$k,
1072
1072
  reducers: {
1073
1073
  setEditBookmark: (state, action) => {
1074
1074
  state.bookmark = { ...action.payload };
@@ -1131,6 +1131,250 @@ const Bookmark = {
1131
1131
  getRTHandlers: getBookmarkRTHandlers,
1132
1132
  };
1133
1133
 
1134
+ const initialState$j = {
1135
+ list: [],
1136
+ statuses: ['subscribed', 'unanswered'],
1137
+ loading: 'idle',
1138
+ types: [],
1139
+ pendingStatusChanges: [],
1140
+ };
1141
+ const fetchEvents = toolkit.createAsyncThunk('calendarEvents/fetchEvents', async (params, { extra, rejectWithValue, dispatch, signal, getState }) => {
1142
+ const state = getState().calendar.events;
1143
+ if (!params.dates && !state.dates) {
1144
+ return rejectWithValue({ error: 1, errorMsg: 'Dates must be set' });
1145
+ }
1146
+ try {
1147
+ const payload = {
1148
+ dateStart: params.dates?.start ?? state.dates?.start ?? '',
1149
+ dateEnd: params.dates?.end ?? state.dates?.end ?? '',
1150
+ statuses: state.statuses,
1151
+ types: params.types ?? state.types,
1152
+ };
1153
+ const res = await extra.jApi.calendar.listEvents(payload, {
1154
+ format: 'raw-view',
1155
+ signal,
1156
+ });
1157
+ return res.result;
1158
+ }
1159
+ catch (error) {
1160
+ if (!isAbortError(error)) {
1161
+ dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
1162
+ }
1163
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve events' });
1164
+ }
1165
+ });
1166
+ const setDates = toolkit.createAsyncThunk('calendarEvents/setDates', async (params, { dispatch }) => {
1167
+ dispatch(fetchEvents({ dates: params }));
1168
+ return true;
1169
+ });
1170
+ const setTypes = toolkit.createAsyncThunk('calendarEvents/setTypes', async (params, { dispatch }) => {
1171
+ dispatch(fetchEvents({ types: params }));
1172
+ return true;
1173
+ });
1174
+ const changeResponse = toolkit.createAsyncThunk('calendarEvents/changeResponse', async (params, { dispatch, extra, signal, rejectWithValue }) => {
1175
+ try {
1176
+ if (params.status === 'unknown') {
1177
+ await extra.jApi.global.removeAction({
1178
+ targetId: params.id,
1179
+ targetType: params.type,
1180
+ type: 'socialEventSubscribe',
1181
+ }, { signal });
1182
+ }
1183
+ else {
1184
+ await extra.jApi.global.updateAction({
1185
+ targetId: params.id,
1186
+ targetType: params.type,
1187
+ type: 'socialEventSubscribe',
1188
+ value: params.status,
1189
+ }, { signal });
1190
+ }
1191
+ dispatch(Toast.actions.success({ label: 'GLOBAL_Successfully_Saved' }));
1192
+ return true;
1193
+ }
1194
+ catch (error) {
1195
+ if (!isAbortError(error)) {
1196
+ dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
1197
+ }
1198
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot change response' });
1199
+ }
1200
+ });
1201
+ const CalendarEventsSlice = toolkit.createSlice({
1202
+ name: 'events',
1203
+ initialState: initialState$j,
1204
+ reducers: {
1205
+ addEvent: (state, action) => {
1206
+ state.list = [action.payload, ...state.list];
1207
+ },
1208
+ removeEvent: (state, action) => {
1209
+ state.list = state.list.filter((event) => event.uri !== action.payload.uri);
1210
+ },
1211
+ updateEvent: (state, action) => {
1212
+ state.list = state.list.map((event) => (event.uri === action.payload.uri ? action.payload : event));
1213
+ },
1214
+ reset: () => initialState$j,
1215
+ },
1216
+ extraReducers: (builder) => {
1217
+ builder
1218
+ .addCase(fetchEvents.pending, (state, action) => {
1219
+ state.loading = 'pending';
1220
+ if (action.meta.arg.types)
1221
+ state.types = action.meta.arg.types;
1222
+ if (action.meta.arg.dates)
1223
+ state.dates = action.meta.arg.dates;
1224
+ })
1225
+ .addCase(fetchEvents.fulfilled, (state, action) => {
1226
+ state.loading = 'idle';
1227
+ state.list = action.payload;
1228
+ })
1229
+ .addCase(fetchEvents.rejected, (state) => {
1230
+ state.loading = 'idle';
1231
+ })
1232
+ .addCase(changeResponse.pending, (state, action) => {
1233
+ const event = state.list.find((e) => e.id === action.meta.arg.id && e.type === action.meta.arg.type);
1234
+ if (event?._extend?.socialEventRecord) {
1235
+ state.pendingStatusChanges.push({
1236
+ requestId: action.meta.requestId,
1237
+ prevStatus: event._extend.socialEventRecord.userResponseStatus,
1238
+ prevSubscribersTotal: event._extend.socialEventRecord.subscribersTotal,
1239
+ eventId: event.id,
1240
+ });
1241
+ const status = action.meta.arg.status;
1242
+ const initialStatus = event._extend.socialEventRecord.userResponseStatus;
1243
+ event._extend.socialEventRecord.userResponseStatus = status;
1244
+ if ((status === 1 || status === 'onSpot' || status === 'visio' || status === 'available') &&
1245
+ (initialStatus === 0 || initialStatus === 'unavailable' || initialStatus === 'unknown')) {
1246
+ event._extend.socialEventRecord.subscribersTotal += 1;
1247
+ }
1248
+ else if ((status === 0 || status === 'unavailable' || status === 'unknown') &&
1249
+ (initialStatus === 1 ||
1250
+ initialStatus === 'available' ||
1251
+ initialStatus === 'onSpot' ||
1252
+ initialStatus === 'visio')) {
1253
+ event._extend.socialEventRecord.subscribersTotal -= 1;
1254
+ }
1255
+ }
1256
+ })
1257
+ .addCase(changeResponse.fulfilled, (state, action) => {
1258
+ state.pendingStatusChanges = state.pendingStatusChanges.filter((e) => e.requestId !== action.meta.requestId);
1259
+ })
1260
+ .addCase(changeResponse.rejected, (state, action) => {
1261
+ const pendingChange = state.pendingStatusChanges.find((e) => e.requestId === action.meta.requestId);
1262
+ if (pendingChange) {
1263
+ const event = state.list.find((e) => e.id === action.meta.arg.id && e.type === action.meta.arg.type);
1264
+ if (event?._extend?.socialEventRecord) {
1265
+ event._extend.socialEventRecord.userResponseStatus = pendingChange.prevStatus;
1266
+ event._extend.socialEventRecord.subscribersTotal = pendingChange.prevSubscribersTotal;
1267
+ }
1268
+ state.pendingStatusChanges = state.pendingStatusChanges.filter((e) => e.requestId !== action.meta.requestId);
1269
+ }
1270
+ });
1271
+ },
1272
+ });
1273
+
1274
+ const isCalendarEvent = (type) => ['socialEvent', 'meeting', 'animatedMeeting'].includes(type);
1275
+ const getCalendarRTHandlers = function (dispatch, jApi) {
1276
+ const addEventHandler = function (message) {
1277
+ if (message.namespace === 'JAMESPOT' &&
1278
+ message.function === 'article-create' &&
1279
+ isCalendarEvent(message.object.type)) {
1280
+ jApi.article.get({ uri: message.object.uri }, { format: 'raw-view', formatExtension: ['socialEventRecord'] })
1281
+ .then((res) => {
1282
+ dispatch(CalendarEventsSlice.actions.addEvent(res.result));
1283
+ })
1284
+ .catch((e) => {
1285
+ dispatch(Toast.actions.error({ label: getErrorMessage(e) }));
1286
+ });
1287
+ }
1288
+ };
1289
+ const deleteEventHandler = function (message) {
1290
+ if (message.namespace === 'JAMESPOT' &&
1291
+ message.function === 'article-delete' &&
1292
+ isCalendarEvent(message.object.type)) {
1293
+ dispatch(CalendarEventsSlice.actions.removeEvent({ uri: message.object.uri }));
1294
+ }
1295
+ };
1296
+ const updateEventHandler = function (message) {
1297
+ if (message.namespace === 'JAMESPOT' &&
1298
+ message.function === 'article-update' &&
1299
+ isCalendarEvent(message.object.type)) {
1300
+ jApi.article.get({ uri: message.object.uri }, { format: 'raw-view', formatExtension: ['socialEventRecord'] })
1301
+ .then((res) => {
1302
+ dispatch(CalendarEventsSlice.actions.updateEvent(res.result));
1303
+ })
1304
+ .catch((e) => {
1305
+ dispatch(Toast.actions.error({ label: getErrorMessage(e) }));
1306
+ });
1307
+ }
1308
+ };
1309
+ const updateResponseHandler = function (message) {
1310
+ if ((message.namespace === 'CUSTOM-ACTION' &&
1311
+ (message.function === 'update' || message.function === 'remove') &&
1312
+ message.object.targetType &&
1313
+ message.object.targetId &&
1314
+ isCalendarEvent(message.object.targetType))) {
1315
+ jApi.article.get({ idArticle: message.object.targetId }, { format: 'raw-view', formatExtension: ['socialEventRecord'] })
1316
+ .then((res) => {
1317
+ dispatch(CalendarEventsSlice.actions.updateEvent(res.result));
1318
+ })
1319
+ .catch((e) => {
1320
+ dispatch(Toast.actions.error({ label: getErrorMessage(e) }));
1321
+ });
1322
+ }
1323
+ };
1324
+ return [
1325
+ {
1326
+ namespace: 'JAMESPOT',
1327
+ function: 'article-create',
1328
+ handler: addEventHandler,
1329
+ },
1330
+ {
1331
+ namespace: 'JAMESPOT',
1332
+ function: 'article-delete',
1333
+ handler: deleteEventHandler,
1334
+ },
1335
+ {
1336
+ namespace: 'JAMESPOT',
1337
+ function: 'article-update',
1338
+ handler: updateEventHandler,
1339
+ },
1340
+ {
1341
+ namespace: 'CUSTOM-ACTION',
1342
+ function: 'update',
1343
+ handler: updateResponseHandler,
1344
+ },
1345
+ {
1346
+ namespace: 'CUSTOM-ACTION',
1347
+ function: 'remove',
1348
+ handler: updateResponseHandler,
1349
+ },
1350
+ ];
1351
+ };
1352
+
1353
+ const joinedReducers$7 = toolkit.combineReducers({
1354
+ [CalendarEventsSlice.name]: CalendarEventsSlice.reducer,
1355
+ });
1356
+ const CalendarSlice = {
1357
+ name: 'calendar',
1358
+ reducer: joinedReducers$7,
1359
+ };
1360
+ const selectCalendarEvents = (state) => {
1361
+ return state.calendar.events;
1362
+ };
1363
+ const Calendar = {
1364
+ slice: CalendarSlice,
1365
+ actions: {
1366
+ fetchEvents,
1367
+ setDates,
1368
+ setTypes,
1369
+ changeResponse,
1370
+ ...CalendarEventsSlice.actions,
1371
+ },
1372
+ selectors: {
1373
+ selectCalendarEvents,
1374
+ },
1375
+ getCalendarRTHandlers,
1376
+ };
1377
+
1134
1378
  const initialState$i = {
1135
1379
  loading: 'idle',
1136
1380
  comments: [],
@@ -2384,6 +2628,7 @@ const getModelFontAwesomeIcon = (icon) => {
2384
2628
  'intranet-page': 'fs-intranet',
2385
2629
  lab: 'flask',
2386
2630
  magicpad: 'draftio',
2631
+ boardCard: 'square-list',
2387
2632
  meeting: 'calendar-days',
2388
2633
  news: 'newspaper',
2389
2634
  platform: 'hammer',
@@ -6348,6 +6593,7 @@ exports.Application = Application;
6348
6593
  exports.Article = Article;
6349
6594
  exports.AssetReservation = AssetReservation;
6350
6595
  exports.Bookmark = Bookmark;
6596
+ exports.Calendar = Calendar;
6351
6597
  exports.Comment = Comment;
6352
6598
  exports.ContentReport = ContentReport;
6353
6599
  exports.ExtraAppFieldsItemName = ExtraAppFieldsItemName;