jamespot-front-business 1.3.4 → 1.3.6
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 +81 -23
- package/dist/cjs.js.map +1 -1
- package/dist/esm.js +81 -23
- package/dist/esm.js.map +1 -1
- package/dist/types.d.ts +48 -149
- package/package.json +2 -2
package/dist/esm.js
CHANGED
|
@@ -1136,17 +1136,27 @@ const initialState$k = {
|
|
|
1136
1136
|
types: [],
|
|
1137
1137
|
pendingStatusChanges: [],
|
|
1138
1138
|
};
|
|
1139
|
+
let fetchTimeout = null;
|
|
1140
|
+
const debounceFetch = (dispatch, params, delay = 500) => {
|
|
1141
|
+
if (fetchTimeout)
|
|
1142
|
+
clearTimeout(fetchTimeout);
|
|
1143
|
+
fetchTimeout = setTimeout(() => {
|
|
1144
|
+
dispatch(fetchEvents(params));
|
|
1145
|
+
}, delay);
|
|
1146
|
+
};
|
|
1139
1147
|
const fetchEvents = createAsyncThunk('calendarEvents/fetchEvents', async (params, { extra, rejectWithValue, dispatch, signal, getState }) => {
|
|
1140
1148
|
const state = getState().calendar.events;
|
|
1141
1149
|
if (!params.dates && !state.dates) {
|
|
1142
1150
|
return rejectWithValue({ error: 1, errorMsg: 'Dates must be set' });
|
|
1143
1151
|
}
|
|
1152
|
+
let types = params.types ?? state.types;
|
|
1153
|
+
types = types.includes('socialEvent') ? [...types, 'recurringEvent'] : [...types];
|
|
1144
1154
|
try {
|
|
1145
1155
|
const payload = {
|
|
1146
1156
|
dateStart: params.dates?.start ?? state.dates?.start ?? '',
|
|
1147
1157
|
dateEnd: params.dates?.end ?? state.dates?.end ?? '',
|
|
1148
1158
|
statuses: state.statuses,
|
|
1149
|
-
types
|
|
1159
|
+
types,
|
|
1150
1160
|
};
|
|
1151
1161
|
const res = await extra.jApi.calendar.listEvents(payload, {
|
|
1152
1162
|
format: 'raw-view',
|
|
@@ -1162,11 +1172,11 @@ const fetchEvents = createAsyncThunk('calendarEvents/fetchEvents', async (params
|
|
|
1162
1172
|
}
|
|
1163
1173
|
});
|
|
1164
1174
|
const setDates = createAsyncThunk('calendarEvents/setDates', async (params, { dispatch }) => {
|
|
1165
|
-
dispatch
|
|
1175
|
+
debounceFetch(dispatch, { dates: params });
|
|
1166
1176
|
return true;
|
|
1167
1177
|
});
|
|
1168
1178
|
const setTypes = createAsyncThunk('calendarEvents/setTypes', async (params, { dispatch }) => {
|
|
1169
|
-
dispatch
|
|
1179
|
+
debounceFetch(dispatch, { types: params });
|
|
1170
1180
|
return true;
|
|
1171
1181
|
});
|
|
1172
1182
|
const changeResponse = createAsyncThunk('calendarEvents/changeResponse', async (params, { dispatch, extra, signal, rejectWithValue }) => {
|
|
@@ -1265,19 +1275,33 @@ const CalendarEventsSlice = createSlice({
|
|
|
1265
1275
|
}
|
|
1266
1276
|
state.pendingStatusChanges = state.pendingStatusChanges.filter((e) => e.requestId !== action.meta.requestId);
|
|
1267
1277
|
}
|
|
1278
|
+
})
|
|
1279
|
+
.addCase(setDates.pending, (state, action) => {
|
|
1280
|
+
state.dates = { start: action.meta.arg.start, end: action.meta.arg.end };
|
|
1281
|
+
state.loading = 'pending';
|
|
1282
|
+
})
|
|
1283
|
+
.addCase(setTypes.pending, (state, action) => {
|
|
1284
|
+
state.types = action.meta.arg;
|
|
1285
|
+
state.loading = 'pending';
|
|
1268
1286
|
});
|
|
1269
1287
|
},
|
|
1270
1288
|
});
|
|
1271
1289
|
|
|
1272
|
-
const isCalendarEvent = (type) => ['socialEvent', 'meeting', 'animatedMeeting'].includes(type);
|
|
1290
|
+
const isCalendarEvent = (type) => ['socialEvent', 'meeting', 'animatedMeeting', 'recurringEvent', 'recurringEventOccurrence'].includes(type);
|
|
1273
1291
|
const getCalendarRTHandlers = function (dispatch, jApi) {
|
|
1274
1292
|
const addEventHandler = function (message) {
|
|
1275
1293
|
if (message.namespace === 'JAMESPOT' &&
|
|
1276
1294
|
message.function === 'article-create' &&
|
|
1277
1295
|
isCalendarEvent(message.object.type)) {
|
|
1278
|
-
|
|
1296
|
+
if (message.object.type === 'recurringEvent') {
|
|
1297
|
+
dispatch(fetchEvents({}));
|
|
1298
|
+
return;
|
|
1299
|
+
}
|
|
1300
|
+
jApi.article.get({ uri: message.object.uri }, { format: 'raw-view', formatExtension: ['socialEventRecord', 'recurringEventRecord'] })
|
|
1279
1301
|
.then((res) => {
|
|
1280
|
-
|
|
1302
|
+
if (!('hideFromCalendar' in res.result) || !res.result.hideFromCalendar) {
|
|
1303
|
+
dispatch(CalendarEventsSlice.actions.addEvent(res.result));
|
|
1304
|
+
}
|
|
1281
1305
|
})
|
|
1282
1306
|
.catch((e) => {
|
|
1283
1307
|
dispatch(Toast.actions.error({ label: getErrorMessage(e) }));
|
|
@@ -1288,6 +1312,10 @@ const getCalendarRTHandlers = function (dispatch, jApi) {
|
|
|
1288
1312
|
if (message.namespace === 'JAMESPOT' &&
|
|
1289
1313
|
message.function === 'article-delete' &&
|
|
1290
1314
|
isCalendarEvent(message.object.type)) {
|
|
1315
|
+
if (message.object.type === 'recurringEvent') {
|
|
1316
|
+
dispatch(fetchEvents({}));
|
|
1317
|
+
return;
|
|
1318
|
+
}
|
|
1291
1319
|
dispatch(CalendarEventsSlice.actions.removeEvent({ uri: message.object.uri }));
|
|
1292
1320
|
}
|
|
1293
1321
|
};
|
|
@@ -1295,9 +1323,18 @@ const getCalendarRTHandlers = function (dispatch, jApi) {
|
|
|
1295
1323
|
if (message.namespace === 'JAMESPOT' &&
|
|
1296
1324
|
message.function === 'article-update' &&
|
|
1297
1325
|
isCalendarEvent(message.object.type)) {
|
|
1298
|
-
|
|
1326
|
+
if (message.object.type === 'recurringEvent') {
|
|
1327
|
+
dispatch(fetchEvents({}));
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1330
|
+
jApi.article.get({ uri: message.object.uri }, { format: 'raw-view', formatExtension: ['socialEventRecord', 'recurringEventRecord'] })
|
|
1299
1331
|
.then((res) => {
|
|
1300
|
-
|
|
1332
|
+
if ('hideFromCalendar' in res.result && res.result.hideFromCalendar) {
|
|
1333
|
+
dispatch(CalendarEventsSlice.actions.removeEvent({ uri: message.object.uri }));
|
|
1334
|
+
}
|
|
1335
|
+
else {
|
|
1336
|
+
dispatch(CalendarEventsSlice.actions.updateEvent(res.result));
|
|
1337
|
+
}
|
|
1301
1338
|
})
|
|
1302
1339
|
.catch((e) => {
|
|
1303
1340
|
dispatch(Toast.actions.error({ label: getErrorMessage(e) }));
|
|
@@ -1305,12 +1342,12 @@ const getCalendarRTHandlers = function (dispatch, jApi) {
|
|
|
1305
1342
|
}
|
|
1306
1343
|
};
|
|
1307
1344
|
const updateResponseHandler = function (message) {
|
|
1308
|
-
if (
|
|
1345
|
+
if (message.namespace === 'CUSTOM-ACTION' &&
|
|
1309
1346
|
(message.function === 'update' || message.function === 'remove') &&
|
|
1310
1347
|
message.object.targetType &&
|
|
1311
1348
|
message.object.targetId &&
|
|
1312
|
-
isCalendarEvent(message.object.targetType))
|
|
1313
|
-
jApi.article.get({ idArticle: message.object.targetId }, { format: 'raw-view', formatExtension: ['socialEventRecord'] })
|
|
1349
|
+
isCalendarEvent(message.object.targetType)) {
|
|
1350
|
+
jApi.article.get({ idArticle: message.object.targetId }, { format: 'raw-view', formatExtension: ['socialEventRecord', 'recurringEventRecord'] })
|
|
1314
1351
|
.then((res) => {
|
|
1315
1352
|
dispatch(CalendarEventsSlice.actions.updateEvent(res.result));
|
|
1316
1353
|
})
|
|
@@ -3654,11 +3691,11 @@ const widgetQuickSurveyContent = {
|
|
|
3654
3691
|
isNotDisabled: false,
|
|
3655
3692
|
};
|
|
3656
3693
|
|
|
3657
|
-
const
|
|
3658
|
-
label: '
|
|
3659
|
-
description: '
|
|
3660
|
-
name: WidgetsName.
|
|
3661
|
-
img: '/img/fast-intranet/widget-
|
|
3694
|
+
const widgetUserProfileDefinition = {
|
|
3695
|
+
label: 'WIDGET_User_Profil',
|
|
3696
|
+
description: 'WIDGET_User_Profil_Text',
|
|
3697
|
+
name: WidgetsName.UserProfile,
|
|
3698
|
+
img: '/img/fast-intranet/widget-user-profile.png',
|
|
3662
3699
|
available: true,
|
|
3663
3700
|
panel: {
|
|
3664
3701
|
useWrapper: true,
|
|
@@ -3667,13 +3704,13 @@ const widgetWelcomeDefinition = {
|
|
|
3667
3704
|
useWidgets: false,
|
|
3668
3705
|
},
|
|
3669
3706
|
};
|
|
3670
|
-
const
|
|
3707
|
+
const widgetUserProfileContent = {};
|
|
3671
3708
|
|
|
3672
|
-
const
|
|
3673
|
-
label: '
|
|
3674
|
-
description: '
|
|
3675
|
-
name: WidgetsName.
|
|
3676
|
-
img: '/img/fast-intranet/widget-
|
|
3709
|
+
const widgetColorDefinition = {
|
|
3710
|
+
label: 'WIDGET_Color',
|
|
3711
|
+
description: 'WIDGET_Color_Text',
|
|
3712
|
+
name: WidgetsName.Color,
|
|
3713
|
+
img: '/img/fast-intranet/widget-color.png',
|
|
3677
3714
|
available: true,
|
|
3678
3715
|
panel: {
|
|
3679
3716
|
useWrapper: true,
|
|
@@ -3682,7 +3719,22 @@ const widgetUserProfileDefinition = {
|
|
|
3682
3719
|
useWidgets: false,
|
|
3683
3720
|
},
|
|
3684
3721
|
};
|
|
3685
|
-
const
|
|
3722
|
+
const widgetColorContent = {};
|
|
3723
|
+
|
|
3724
|
+
const widgetWelcomeDefinition = {
|
|
3725
|
+
label: 'WIDGET_Welcome',
|
|
3726
|
+
description: 'WIDGET_Welcome_Text',
|
|
3727
|
+
name: WidgetsName.Welcome,
|
|
3728
|
+
img: '/img/fast-intranet/widget-welcome.png',
|
|
3729
|
+
available: true,
|
|
3730
|
+
panel: {
|
|
3731
|
+
useWrapper: true,
|
|
3732
|
+
useEditor: true,
|
|
3733
|
+
useSelection: true,
|
|
3734
|
+
useWidgets: false,
|
|
3735
|
+
},
|
|
3736
|
+
};
|
|
3737
|
+
const widgetWelcomeContent = {};
|
|
3686
3738
|
|
|
3687
3739
|
function widgetDefinition(name) {
|
|
3688
3740
|
switch (name) {
|
|
@@ -3726,6 +3778,8 @@ function widgetDefinition(name) {
|
|
|
3726
3778
|
return widgetUserProfileDefinition;
|
|
3727
3779
|
case 'widget-extension':
|
|
3728
3780
|
return widgetExtensionDefinition;
|
|
3781
|
+
case 'widget-color':
|
|
3782
|
+
return widgetColorDefinition;
|
|
3729
3783
|
}
|
|
3730
3784
|
}
|
|
3731
3785
|
|
|
@@ -3822,6 +3876,10 @@ function content(name) {
|
|
|
3822
3876
|
return {
|
|
3823
3877
|
...widgetExtensionContent,
|
|
3824
3878
|
};
|
|
3879
|
+
case 'widget-color':
|
|
3880
|
+
return {
|
|
3881
|
+
...widgetColorContent,
|
|
3882
|
+
};
|
|
3825
3883
|
}
|
|
3826
3884
|
}
|
|
3827
3885
|
|