jamespot-front-business 1.2.49 → 1.2.50

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
@@ -79,7 +79,7 @@ const oneMonthAgo$2 = () => {
79
79
  date.setMonth(date.getMonth() - 1);
80
80
  return date;
81
81
  };
82
- const initialState$s = {
82
+ const initialState$t = {
83
83
  data: [],
84
84
  loading: 'idle',
85
85
  page: 1,
@@ -111,7 +111,7 @@ const fetchLogsNavigation = createAsyncThunk('admin/fetchLogsNavigation', async
111
111
  });
112
112
  const adminLogsNavigationSlice = createSlice({
113
113
  name: 'logsNavigation',
114
- initialState: initialState$s,
114
+ initialState: initialState$t,
115
115
  reducers: {
116
116
  setNavigationOrder: (state, action) => {
117
117
  state.orders = [...action.payload];
@@ -148,7 +148,7 @@ const oneMonthAgo$1 = () => {
148
148
  date.setMonth(date.getMonth() - 1);
149
149
  return date;
150
150
  };
151
- const initialState$r = {
151
+ const initialState$s = {
152
152
  data: [],
153
153
  loading: 'idle',
154
154
  page: 1,
@@ -180,7 +180,7 @@ const fetchLogsObjects = createAsyncThunk('admin/fetchLogsObjects', async (param
180
180
  });
181
181
  const adminLogsObjectsSlice = createSlice({
182
182
  name: 'logsObjects',
183
- initialState: initialState$r,
183
+ initialState: initialState$s,
184
184
  reducers: {
185
185
  setObjectsOrder: (state, action) => {
186
186
  state.orders = [...action.payload];
@@ -217,7 +217,7 @@ const oneMonthAgo = () => {
217
217
  date.setMonth(date.getMonth() - 1);
218
218
  return date;
219
219
  };
220
- const initialState$q = {
220
+ const initialState$r = {
221
221
  data: [],
222
222
  loading: 'idle',
223
223
  page: 1,
@@ -249,7 +249,7 @@ const fetchLogsSearch = createAsyncThunk('admin/fetchLogsSearch', async (params,
249
249
  });
250
250
  const adminLogsSearchSlice = createSlice({
251
251
  name: 'logsSearch',
252
- initialState: initialState$q,
252
+ initialState: initialState$r,
253
253
  reducers: {
254
254
  setSearchOrder: (state, action) => {
255
255
  state.orders = [...action.payload];
@@ -306,7 +306,7 @@ const AdminLogs = {
306
306
  selectors: { selectAdminLogsNavigation, selectAdminLogsObjects, selectAdminLogsSearch },
307
307
  };
308
308
 
309
- const initialState$p = {
309
+ const initialState$q = {
310
310
  animationConfiguration: null,
311
311
  isActiveForCurrentUser: false,
312
312
  isInitialized: false,
@@ -314,7 +314,7 @@ const initialState$p = {
314
314
  };
315
315
  const animationsListSlice = createSlice({
316
316
  name: 'animationsList',
317
- initialState: initialState$p,
317
+ initialState: initialState$q,
318
318
  reducers: {},
319
319
  extraReducers: (builder) => {
320
320
  builder.addCase(fetchCurrentAnimation.fulfilled, (state, action) => {
@@ -549,7 +549,7 @@ const Application = {
549
549
  selectors: selectors$2,
550
550
  };
551
551
 
552
- const initialState$o = {
552
+ const initialState$p = {
553
553
  entities: [],
554
554
  loading: 'idle',
555
555
  nbResults: 0,
@@ -566,7 +566,7 @@ const fetchBookableAsset = createAsyncThunk('BookableAsset/fetchBookableAsset',
566
566
  });
567
567
  const BookableAssetSlice = createSlice({
568
568
  name: 'bookableAsset',
569
- initialState: initialState$o,
569
+ initialState: initialState$p,
570
570
  reducers: {},
571
571
  extraReducers: (builder) => {
572
572
  builder
@@ -587,7 +587,7 @@ const BookableAssetSlice = createSlice({
587
587
  const fetchConfiguration = createAsyncThunk('AssetReservation/configuration', async (_, { extra }) => {
588
588
  return await extra.jApi.assetReservation.configuration();
589
589
  });
590
- const initialState$n = {
590
+ const initialState$o = {
591
591
  description: '',
592
592
  right: {
593
593
  manage: false,
@@ -601,7 +601,7 @@ const initialState$n = {
601
601
  };
602
602
  const AssetReservationConfigurationSlice = createSlice({
603
603
  name: 'configuration',
604
- initialState: initialState$n,
604
+ initialState: initialState$o,
605
605
  reducers: {},
606
606
  extraReducers: (builder) => {
607
607
  builder
@@ -625,7 +625,7 @@ const initForm = {
625
625
  hourStart: '',
626
626
  hourEnd: '',
627
627
  };
628
- const initialState$m = {
628
+ const initialState$n = {
629
629
  entities: [],
630
630
  loading: 'idle',
631
631
  nbResults: 0,
@@ -641,7 +641,7 @@ const fetchReservation = createAsyncThunk('Reservation/fetchReservation', async
641
641
  });
642
642
  const ReservationSlice = createSlice({
643
643
  name: 'reservation',
644
- initialState: initialState$m,
644
+ initialState: initialState$n,
645
645
  reducers: {
646
646
  setForm: (state, action) => {
647
647
  state.form = action.payload;
@@ -697,7 +697,7 @@ const AssetReservation = {
697
697
  },
698
698
  };
699
699
 
700
- const initialState$l = {
700
+ const initialState$m = {
701
701
  loading: 'idle',
702
702
  reports: [],
703
703
  page: 1,
@@ -710,7 +710,7 @@ const initialState$l = {
710
710
  };
711
711
  const contentReportSlice = createSlice({
712
712
  name: 'contentReport',
713
- initialState: initialState$l,
713
+ initialState: initialState$m,
714
714
  reducers: {
715
715
  setTab: (state, action) => {
716
716
  state.tab = action.payload;
@@ -820,7 +820,7 @@ const ContentReport = {
820
820
  selectors: { selectContentReport },
821
821
  };
822
822
 
823
- const initialState$k = {
823
+ const initialState$l = {
824
824
  bookmarks: [],
825
825
  loading: 'idle',
826
826
  status: undefined,
@@ -882,7 +882,7 @@ const deleteBookmark = createAsyncThunk('bookmarkList/deleteBookmark', async (bo
882
882
  });
883
883
  const BookmarkListSlice = createSlice({
884
884
  name: 'bookmarkList',
885
- initialState: initialState$k,
885
+ initialState: initialState$l,
886
886
  reducers: {
887
887
  resetAddBookmarkStatus: (state, action) => {
888
888
  if (state.add[action.payload]) {
@@ -1045,7 +1045,7 @@ const getBookmarkRTHandlers = function (dispatch) {
1045
1045
  ];
1046
1046
  };
1047
1047
 
1048
- const initialState$j = {
1048
+ const initialState$k = {
1049
1049
  bookmark: undefined,
1050
1050
  status: undefined,
1051
1051
  loading: 'idle',
@@ -1066,7 +1066,7 @@ const editBookmark = createAsyncThunk('bookmarkEdit/editBookmark', async (bookma
1066
1066
  });
1067
1067
  const BookmarkEditSlice = createSlice({
1068
1068
  name: 'bookmarkEdit',
1069
- initialState: initialState$j,
1069
+ initialState: initialState$k,
1070
1070
  reducers: {
1071
1071
  setEditBookmark: (state, action) => {
1072
1072
  state.bookmark = { ...action.payload };
@@ -1129,6 +1129,250 @@ const Bookmark = {
1129
1129
  getRTHandlers: getBookmarkRTHandlers,
1130
1130
  };
1131
1131
 
1132
+ const initialState$j = {
1133
+ list: [],
1134
+ statuses: ['subscribed', 'unanswered'],
1135
+ loading: 'idle',
1136
+ types: [],
1137
+ pendingStatusChanges: [],
1138
+ };
1139
+ const fetchEvents = createAsyncThunk('calendarEvents/fetchEvents', async (params, { extra, rejectWithValue, dispatch, signal, getState }) => {
1140
+ const state = getState().calendar.events;
1141
+ if (!params.dates && !state.dates) {
1142
+ return rejectWithValue({ error: 1, errorMsg: 'Dates must be set' });
1143
+ }
1144
+ try {
1145
+ const payload = {
1146
+ dateStart: params.dates?.start ?? state.dates?.start ?? '',
1147
+ dateEnd: params.dates?.end ?? state.dates?.end ?? '',
1148
+ statuses: state.statuses,
1149
+ types: params.types ?? state.types,
1150
+ };
1151
+ const res = await extra.jApi.calendar.listEvents(payload, {
1152
+ format: 'raw-view',
1153
+ signal,
1154
+ });
1155
+ return res.result;
1156
+ }
1157
+ catch (error) {
1158
+ if (!isAbortError(error)) {
1159
+ dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
1160
+ }
1161
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve events' });
1162
+ }
1163
+ });
1164
+ const setDates = createAsyncThunk('calendarEvents/setDates', async (params, { dispatch }) => {
1165
+ dispatch(fetchEvents({ dates: params }));
1166
+ return true;
1167
+ });
1168
+ const setTypes = createAsyncThunk('calendarEvents/setTypes', async (params, { dispatch }) => {
1169
+ dispatch(fetchEvents({ types: params }));
1170
+ return true;
1171
+ });
1172
+ const changeResponse = createAsyncThunk('calendarEvents/changeResponse', async (params, { dispatch, extra, signal, rejectWithValue }) => {
1173
+ try {
1174
+ if (params.status === 'unknown') {
1175
+ await extra.jApi.global.removeAction({
1176
+ targetId: params.id,
1177
+ targetType: params.type,
1178
+ type: 'socialEventSubscribe',
1179
+ }, { signal });
1180
+ }
1181
+ else {
1182
+ await extra.jApi.global.updateAction({
1183
+ targetId: params.id,
1184
+ targetType: params.type,
1185
+ type: 'socialEventSubscribe',
1186
+ value: params.status,
1187
+ }, { signal });
1188
+ }
1189
+ dispatch(Toast.actions.success({ label: 'GLOBAL_Successfully_Saved' }));
1190
+ return true;
1191
+ }
1192
+ catch (error) {
1193
+ if (!isAbortError(error)) {
1194
+ dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
1195
+ }
1196
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot change response' });
1197
+ }
1198
+ });
1199
+ const CalendarEventsSlice = createSlice({
1200
+ name: 'events',
1201
+ initialState: initialState$j,
1202
+ reducers: {
1203
+ addEvent: (state, action) => {
1204
+ state.list = [action.payload, ...state.list];
1205
+ },
1206
+ removeEvent: (state, action) => {
1207
+ state.list = state.list.filter((event) => event.uri !== action.payload.uri);
1208
+ },
1209
+ updateEvent: (state, action) => {
1210
+ state.list = state.list.map((event) => (event.uri === action.payload.uri ? action.payload : event));
1211
+ },
1212
+ reset: () => initialState$j,
1213
+ },
1214
+ extraReducers: (builder) => {
1215
+ builder
1216
+ .addCase(fetchEvents.pending, (state, action) => {
1217
+ state.loading = 'pending';
1218
+ if (action.meta.arg.types)
1219
+ state.types = action.meta.arg.types;
1220
+ if (action.meta.arg.dates)
1221
+ state.dates = action.meta.arg.dates;
1222
+ })
1223
+ .addCase(fetchEvents.fulfilled, (state, action) => {
1224
+ state.loading = 'idle';
1225
+ state.list = action.payload;
1226
+ })
1227
+ .addCase(fetchEvents.rejected, (state) => {
1228
+ state.loading = 'idle';
1229
+ })
1230
+ .addCase(changeResponse.pending, (state, action) => {
1231
+ const event = state.list.find((e) => e.id === action.meta.arg.id && e.type === action.meta.arg.type);
1232
+ if (event?._extend?.socialEventRecord) {
1233
+ state.pendingStatusChanges.push({
1234
+ requestId: action.meta.requestId,
1235
+ prevStatus: event._extend.socialEventRecord.userResponseStatus,
1236
+ prevSubscribersTotal: event._extend.socialEventRecord.subscribersTotal,
1237
+ eventId: event.id,
1238
+ });
1239
+ const status = action.meta.arg.status;
1240
+ const initialStatus = event._extend.socialEventRecord.userResponseStatus;
1241
+ event._extend.socialEventRecord.userResponseStatus = status;
1242
+ if ((status === 1 || status === 'onSpot' || status === 'visio' || status === 'available') &&
1243
+ (initialStatus === 0 || initialStatus === 'unavailable' || initialStatus === 'unknown')) {
1244
+ event._extend.socialEventRecord.subscribersTotal += 1;
1245
+ }
1246
+ else if ((status === 0 || status === 'unavailable' || status === 'unknown') &&
1247
+ (initialStatus === 1 ||
1248
+ initialStatus === 'available' ||
1249
+ initialStatus === 'onSpot' ||
1250
+ initialStatus === 'visio')) {
1251
+ event._extend.socialEventRecord.subscribersTotal -= 1;
1252
+ }
1253
+ }
1254
+ })
1255
+ .addCase(changeResponse.fulfilled, (state, action) => {
1256
+ state.pendingStatusChanges = state.pendingStatusChanges.filter((e) => e.requestId !== action.meta.requestId);
1257
+ })
1258
+ .addCase(changeResponse.rejected, (state, action) => {
1259
+ const pendingChange = state.pendingStatusChanges.find((e) => e.requestId === action.meta.requestId);
1260
+ if (pendingChange) {
1261
+ const event = state.list.find((e) => e.id === action.meta.arg.id && e.type === action.meta.arg.type);
1262
+ if (event?._extend?.socialEventRecord) {
1263
+ event._extend.socialEventRecord.userResponseStatus = pendingChange.prevStatus;
1264
+ event._extend.socialEventRecord.subscribersTotal = pendingChange.prevSubscribersTotal;
1265
+ }
1266
+ state.pendingStatusChanges = state.pendingStatusChanges.filter((e) => e.requestId !== action.meta.requestId);
1267
+ }
1268
+ });
1269
+ },
1270
+ });
1271
+
1272
+ const isCalendarEvent = (type) => ['socialEvent', 'meeting', 'animatedMeeting'].includes(type);
1273
+ const getCalendarRTHandlers = function (dispatch, jApi) {
1274
+ const addEventHandler = function (message) {
1275
+ if (message.namespace === 'JAMESPOT' &&
1276
+ message.function === 'article-create' &&
1277
+ isCalendarEvent(message.object.type)) {
1278
+ jApi.article.get({ uri: message.object.uri }, { format: 'raw-view', formatExtension: ['socialEventRecord'] })
1279
+ .then((res) => {
1280
+ dispatch(CalendarEventsSlice.actions.addEvent(res.result));
1281
+ })
1282
+ .catch((e) => {
1283
+ dispatch(Toast.actions.error({ label: getErrorMessage(e) }));
1284
+ });
1285
+ }
1286
+ };
1287
+ const deleteEventHandler = function (message) {
1288
+ if (message.namespace === 'JAMESPOT' &&
1289
+ message.function === 'article-delete' &&
1290
+ isCalendarEvent(message.object.type)) {
1291
+ dispatch(CalendarEventsSlice.actions.removeEvent({ uri: message.object.uri }));
1292
+ }
1293
+ };
1294
+ const updateEventHandler = function (message) {
1295
+ if (message.namespace === 'JAMESPOT' &&
1296
+ message.function === 'article-update' &&
1297
+ isCalendarEvent(message.object.type)) {
1298
+ jApi.article.get({ uri: message.object.uri }, { format: 'raw-view', formatExtension: ['socialEventRecord'] })
1299
+ .then((res) => {
1300
+ dispatch(CalendarEventsSlice.actions.updateEvent(res.result));
1301
+ })
1302
+ .catch((e) => {
1303
+ dispatch(Toast.actions.error({ label: getErrorMessage(e) }));
1304
+ });
1305
+ }
1306
+ };
1307
+ const updateResponseHandler = function (message) {
1308
+ if ((message.namespace === 'CUSTOM-ACTION' &&
1309
+ (message.function === 'update' || message.function === 'remove') &&
1310
+ message.object.targetType &&
1311
+ message.object.targetId &&
1312
+ isCalendarEvent(message.object.targetType))) {
1313
+ jApi.article.get({ idArticle: message.object.targetId }, { format: 'raw-view', formatExtension: ['socialEventRecord'] })
1314
+ .then((res) => {
1315
+ dispatch(CalendarEventsSlice.actions.updateEvent(res.result));
1316
+ })
1317
+ .catch((e) => {
1318
+ dispatch(Toast.actions.error({ label: getErrorMessage(e) }));
1319
+ });
1320
+ }
1321
+ };
1322
+ return [
1323
+ {
1324
+ namespace: 'JAMESPOT',
1325
+ function: 'article-create',
1326
+ handler: addEventHandler,
1327
+ },
1328
+ {
1329
+ namespace: 'JAMESPOT',
1330
+ function: 'article-delete',
1331
+ handler: deleteEventHandler,
1332
+ },
1333
+ {
1334
+ namespace: 'JAMESPOT',
1335
+ function: 'article-update',
1336
+ handler: updateEventHandler,
1337
+ },
1338
+ {
1339
+ namespace: 'CUSTOM-ACTION',
1340
+ function: 'update',
1341
+ handler: updateResponseHandler,
1342
+ },
1343
+ {
1344
+ namespace: 'CUSTOM-ACTION',
1345
+ function: 'remove',
1346
+ handler: updateResponseHandler,
1347
+ },
1348
+ ];
1349
+ };
1350
+
1351
+ const joinedReducers$7 = combineReducers({
1352
+ [CalendarEventsSlice.name]: CalendarEventsSlice.reducer,
1353
+ });
1354
+ const CalendarSlice = {
1355
+ name: 'calendar',
1356
+ reducer: joinedReducers$7,
1357
+ };
1358
+ const selectCalendarEvents = (state) => {
1359
+ return state.calendar.events;
1360
+ };
1361
+ const Calendar = {
1362
+ slice: CalendarSlice,
1363
+ actions: {
1364
+ fetchEvents,
1365
+ setDates,
1366
+ setTypes,
1367
+ changeResponse,
1368
+ ...CalendarEventsSlice.actions,
1369
+ },
1370
+ selectors: {
1371
+ selectCalendarEvents,
1372
+ },
1373
+ getCalendarRTHandlers,
1374
+ };
1375
+
1132
1376
  const initialState$i = {
1133
1377
  loading: 'idle',
1134
1378
  comments: [],
@@ -2382,6 +2626,7 @@ const getModelFontAwesomeIcon = (icon) => {
2382
2626
  'intranet-page': 'fs-intranet',
2383
2627
  lab: 'flask',
2384
2628
  magicpad: 'draftio',
2629
+ boardCard: 'square-list',
2385
2630
  meeting: 'calendar-days',
2386
2631
  news: 'newspaper',
2387
2632
  platform: 'hammer',
@@ -6326,5 +6571,5 @@ const studio = {
6326
6571
  },
6327
6572
  };
6328
6573
 
6329
- 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, Article, AssetReservation, Bookmark, Comment, ContentReport, Description, Element, ExtraAppFieldsItemName, ExtraAppFieldsItemViews, ExtraBot, Faq, Hook, MagicPad, MapExtraFieldsWithView, MediaLibrary, Model, Network, Platform, STUDIO_VIEW, Share, SocialActions, StatusType$1 as StatusType, TVDisplay, TeamWork, TinyMCE, Toast, UserCurrent, WedocApp, Widget, WidgetEditor, actions, adminLogsReducer, adminLogsSlice, animationsReducer, animationsSlice, contentReportSlice, extraBotSlice, fetchExtraBotListAll, fetchExtraBotListMines, fetchMediaLibraryConfig, fetchMediaLibraryFilesStats, fetchMediaLibraryFolders, fetchMediaLibraryFoldersStats, fetchMediaLibraryStats, fetchMediaLibraryUnclassifiedFiles, fetchPads, fetchReports, jland, magicPadSlice, mediaLibraryReducer, mediaLibrarySlice, saveExtraBot, selectExtraBotListAll, selectExtraBotListMines, slice$1 as slice, studio, teamWorkSlice, teamworkReducer, toggleExtraBotActivation, updateListBotProperty, updateStatus, updateWidgetContent, viewsList };
6574
+ 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, Article, AssetReservation, Bookmark, Calendar, Comment, ContentReport, Description, Element, ExtraAppFieldsItemName, ExtraAppFieldsItemViews, ExtraBot, Faq, Hook, MagicPad, MapExtraFieldsWithView, MediaLibrary, Model, Network, Platform, STUDIO_VIEW, Share, SocialActions, StatusType$1 as StatusType, TVDisplay, TeamWork, TinyMCE, Toast, UserCurrent, WedocApp, Widget, WidgetEditor, actions, adminLogsReducer, adminLogsSlice, animationsReducer, animationsSlice, contentReportSlice, extraBotSlice, fetchExtraBotListAll, fetchExtraBotListMines, fetchMediaLibraryConfig, fetchMediaLibraryFilesStats, fetchMediaLibraryFolders, fetchMediaLibraryFoldersStats, fetchMediaLibraryStats, fetchMediaLibraryUnclassifiedFiles, fetchPads, fetchReports, jland, magicPadSlice, mediaLibraryReducer, mediaLibrarySlice, saveExtraBot, selectExtraBotListAll, selectExtraBotListMines, slice$1 as slice, studio, teamWorkSlice, teamworkReducer, toggleExtraBotActivation, updateListBotProperty, updateStatus, updateWidgetContent, viewsList };
6330
6575
  //# sourceMappingURL=esm.js.map