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