jamespot-front-business 1.1.7 → 1.1.9
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 +669 -38
- package/dist/cjs.js.map +1 -1
- package/dist/esm.js +666 -40
- package/dist/esm.js.map +1 -1
- package/dist/types.d.ts +370 -96
- package/package.json +2 -2
package/dist/cjs.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var toolkit = require('@reduxjs/toolkit');
|
|
6
|
+
var redux = require('redux');
|
|
6
7
|
var jamespotUserApi = require('jamespot-user-api');
|
|
7
8
|
|
|
8
9
|
const adapter$1 = toolkit.createEntityAdapter({
|
|
@@ -62,7 +63,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
const initialState$
|
|
66
|
+
const initialState$8 = {
|
|
66
67
|
entities: [],
|
|
67
68
|
loading: 'idle',
|
|
68
69
|
nbResults: 0,
|
|
@@ -73,7 +74,7 @@ const fetchBookableAsset = toolkit.createAsyncThunk('BookableAsset/fetchBookable
|
|
|
73
74
|
}));
|
|
74
75
|
const BookableAssetSlice = toolkit.createSlice({
|
|
75
76
|
name: 'bookableAsset',
|
|
76
|
-
initialState: initialState$
|
|
77
|
+
initialState: initialState$8,
|
|
77
78
|
reducers: {},
|
|
78
79
|
extraReducers: (builder) => {
|
|
79
80
|
builder
|
|
@@ -94,7 +95,7 @@ const BookableAssetSlice = toolkit.createSlice({
|
|
|
94
95
|
const fetchConfiguration = toolkit.createAsyncThunk('AssetReservation/configuration', (_, { extra }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
95
96
|
return yield extra.jApi.assetReservation.configuration();
|
|
96
97
|
}));
|
|
97
|
-
const initialState$
|
|
98
|
+
const initialState$7 = {
|
|
98
99
|
description: '',
|
|
99
100
|
right: {
|
|
100
101
|
manage: false,
|
|
@@ -108,7 +109,7 @@ const initialState$3 = {
|
|
|
108
109
|
};
|
|
109
110
|
const AssetReservationConfigurationSlice = toolkit.createSlice({
|
|
110
111
|
name: 'configuration',
|
|
111
|
-
initialState: initialState$
|
|
112
|
+
initialState: initialState$7,
|
|
112
113
|
reducers: {},
|
|
113
114
|
extraReducers: (builder) => {
|
|
114
115
|
builder
|
|
@@ -129,7 +130,7 @@ const initForm = {
|
|
|
129
130
|
hourStart: '',
|
|
130
131
|
hourEnd: '',
|
|
131
132
|
};
|
|
132
|
-
const initialState$
|
|
133
|
+
const initialState$6 = {
|
|
133
134
|
entities: [],
|
|
134
135
|
loading: 'idle',
|
|
135
136
|
nbResults: 0,
|
|
@@ -141,7 +142,7 @@ const fetchReservation = toolkit.createAsyncThunk('Reservation/fetchReservation'
|
|
|
141
142
|
}));
|
|
142
143
|
const ReservationSlice = toolkit.createSlice({
|
|
143
144
|
name: 'reservation',
|
|
144
|
-
initialState: initialState$
|
|
145
|
+
initialState: initialState$6,
|
|
145
146
|
reducers: {
|
|
146
147
|
setForm: (state, action) => {
|
|
147
148
|
state.form = action.payload;
|
|
@@ -197,30 +198,10 @@ const AssetReservation = {
|
|
|
197
198
|
},
|
|
198
199
|
};
|
|
199
200
|
|
|
200
|
-
const adapter = toolkit.createEntityAdapter({
|
|
201
|
-
selectId: (model) => model.type,
|
|
202
|
-
sortComparer: (a, b) => a.label.localeCompare(b.label),
|
|
203
|
-
});
|
|
204
|
-
const slice$2 = toolkit.createSlice({
|
|
205
|
-
name: 'models',
|
|
206
|
-
initialState: adapter.getInitialState(),
|
|
207
|
-
reducers: {
|
|
208
|
-
addOne: adapter.addOne,
|
|
209
|
-
addMany: adapter.addMany,
|
|
210
|
-
setAll: adapter.setAll,
|
|
211
|
-
},
|
|
212
|
-
});
|
|
213
|
-
const selectors$1 = adapter.getSelectors((state) => state.entities.models);
|
|
214
|
-
const Model = {
|
|
215
|
-
slice: slice$2,
|
|
216
|
-
actions: Object.assign({}, slice$2.actions),
|
|
217
|
-
selectors: selectors$1,
|
|
218
|
-
};
|
|
219
|
-
|
|
220
201
|
const toastAdapter = toolkit.createEntityAdapter({
|
|
221
202
|
selectId: (toast) => toast.id,
|
|
222
203
|
});
|
|
223
|
-
const slice$
|
|
204
|
+
const slice$2 = toolkit.createSlice({
|
|
224
205
|
name: 'toasts',
|
|
225
206
|
initialState: toastAdapter.getInitialState(),
|
|
226
207
|
reducers: {
|
|
@@ -234,9 +215,9 @@ const addMessage = (_a, type, timeout) => {
|
|
|
234
215
|
if (type === void 0) { type = 'success'; }
|
|
235
216
|
if (timeout === void 0) { timeout = 3000; }
|
|
236
217
|
return (dispatch) => {
|
|
237
|
-
dispatch(slice$
|
|
218
|
+
dispatch(slice$2.actions.addOne(Object.assign(Object.assign({ id }, toast), { timeout, type })));
|
|
238
219
|
setTimeout(() => {
|
|
239
|
-
dispatch(slice$
|
|
220
|
+
dispatch(slice$2.actions.removeOne(id));
|
|
240
221
|
}, timeout);
|
|
241
222
|
return id;
|
|
242
223
|
};
|
|
@@ -247,11 +228,306 @@ const actions = {
|
|
|
247
228
|
warning: (toast, timeout) => addMessage(toast, 'warning', timeout),
|
|
248
229
|
error: (toast, timeout) => addMessage(toast, 'error', timeout),
|
|
249
230
|
};
|
|
250
|
-
const selectors = toastAdapter.getSelectors((state) => state.toasts);
|
|
231
|
+
const selectors$1 = toastAdapter.getSelectors((state) => state.toasts);
|
|
251
232
|
const Toast = {
|
|
252
|
-
slice: slice$
|
|
253
|
-
actions: Object.assign(Object.assign({}, actions), slice$
|
|
254
|
-
selectors,
|
|
233
|
+
slice: slice$2,
|
|
234
|
+
actions: Object.assign(Object.assign({}, actions), slice$2.actions),
|
|
235
|
+
selectors: selectors$1,
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
const initialState$5 = {
|
|
239
|
+
bookmarks: [],
|
|
240
|
+
loading: 'idle',
|
|
241
|
+
status: undefined,
|
|
242
|
+
isInitialized: false,
|
|
243
|
+
nbResults: 0,
|
|
244
|
+
add: {},
|
|
245
|
+
move: {
|
|
246
|
+
loading: 'idle',
|
|
247
|
+
status: undefined,
|
|
248
|
+
},
|
|
249
|
+
delete: {},
|
|
250
|
+
};
|
|
251
|
+
const fetchBookmark = toolkit.createAsyncThunk('bookmarkList/fetchbookmarkList', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
252
|
+
const filterSpec = { limit: 999 };
|
|
253
|
+
try {
|
|
254
|
+
return yield extra.jApi.bookmark.getFormattedList(filterSpec, 'raw-list');
|
|
255
|
+
}
|
|
256
|
+
catch (_) {
|
|
257
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
258
|
+
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve bookmarks' });
|
|
259
|
+
}
|
|
260
|
+
}));
|
|
261
|
+
const addBookmark = toolkit.createAsyncThunk('bookmarkList/addBookmark', (bookmark, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
262
|
+
var _a;
|
|
263
|
+
try {
|
|
264
|
+
if (jamespotUserApi.jEnsure.isBookmarkLink(bookmark)) {
|
|
265
|
+
const result = yield extra.jApi.bookmark.addFormattedLink(bookmark.targetId, bookmark.targetType, 'raw-list');
|
|
266
|
+
return result;
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
const result = yield extra.jApi.bookmark.addBookmark(bookmark);
|
|
270
|
+
return result;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
catch (errorThrown) {
|
|
274
|
+
const toastLabel = (_a = errorThrown.errorMsg) !== null && _a !== void 0 ? _a : 'GLOBAL_Technical_Error';
|
|
275
|
+
dispatch(Toast.actions.error({ label: toastLabel }));
|
|
276
|
+
return rejectWithValue({ error: 1, errorMsg: 'Error saving bookark' });
|
|
277
|
+
}
|
|
278
|
+
}));
|
|
279
|
+
const moveBookmark = toolkit.createAsyncThunk('bookmarkList/moveBookmark', ({ bookmark, bookmarkReference, position }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
280
|
+
try {
|
|
281
|
+
yield extra.jApi.bookmark.move(bookmark.id, bookmarkReference.id, position);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
catch (_) {
|
|
285
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
286
|
+
return rejectWithValue({ error: 1, errorMsg: 'Error moving bookark' });
|
|
287
|
+
}
|
|
288
|
+
}));
|
|
289
|
+
const deleteBookmark = toolkit.createAsyncThunk('bookmarkList/deleteBookmark', (bookmark, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
290
|
+
try {
|
|
291
|
+
yield extra.jApi.bookmark.delete(bookmark.id);
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
catch (_) {
|
|
295
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
296
|
+
return rejectWithValue({ error: 1, errorMsg: 'Error deleteing bookark' });
|
|
297
|
+
}
|
|
298
|
+
}));
|
|
299
|
+
const BookmarkListSlice = toolkit.createSlice({
|
|
300
|
+
name: 'bookmarkList',
|
|
301
|
+
initialState: initialState$5,
|
|
302
|
+
reducers: {
|
|
303
|
+
resetAddBookmarkStatus: (state, action) => {
|
|
304
|
+
if (state.add[action.payload]) {
|
|
305
|
+
delete state.add[action.payload];
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
resetMoveBookmarkStatus: (state) => {
|
|
309
|
+
state.move.status = undefined;
|
|
310
|
+
state.move.loading = 'idle';
|
|
311
|
+
},
|
|
312
|
+
resetDeleteBookmarkStatus: (state, action) => {
|
|
313
|
+
if (state.delete[action.payload]) {
|
|
314
|
+
delete state.delete[action.payload];
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
addBookmarkRT: (state, action) => {
|
|
318
|
+
state.bookmarks.push(action.payload);
|
|
319
|
+
state.bookmarks.sort((a, b) => { var _a, _b; return ((_a = a.bookmarkOrder) !== null && _a !== void 0 ? _a : 0) - ((_b = b.bookmarkOrder) !== null && _b !== void 0 ? _b : 0); });
|
|
320
|
+
},
|
|
321
|
+
deleteBookmarkRT: (state, action) => {
|
|
322
|
+
state.bookmarks = state.bookmarks.filter((bookmark) => bookmark.id !== action.payload.id);
|
|
323
|
+
},
|
|
324
|
+
updateBookmarkRT: (state, action) => {
|
|
325
|
+
state.bookmarks = state.bookmarks
|
|
326
|
+
.map((bookmark) => (bookmark.id === action.payload.id ? action.payload : bookmark))
|
|
327
|
+
.sort((a, b) => { var _a, _b; return ((_a = a.bookmarkOrder) !== null && _a !== void 0 ? _a : 0) - ((_b = b.bookmarkOrder) !== null && _b !== void 0 ? _b : 0); });
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
extraReducers: (builder) => {
|
|
331
|
+
builder
|
|
332
|
+
.addCase(fetchBookmark.pending, (state) => {
|
|
333
|
+
state.loading = 'pending';
|
|
334
|
+
state.status = undefined;
|
|
335
|
+
})
|
|
336
|
+
.addCase(fetchBookmark.fulfilled, (state, action) => {
|
|
337
|
+
state.loading = 'idle';
|
|
338
|
+
state.bookmarks = action.payload.result.data;
|
|
339
|
+
state.nbResults = action.payload.result.cnt;
|
|
340
|
+
state.isInitialized = true;
|
|
341
|
+
state.status = 'success';
|
|
342
|
+
})
|
|
343
|
+
.addCase(fetchBookmark.rejected, (state) => {
|
|
344
|
+
state.loading = 'idle';
|
|
345
|
+
state.status = 'error';
|
|
346
|
+
})
|
|
347
|
+
.addCase(addBookmark.pending, (state, action) => {
|
|
348
|
+
if (action.meta.arg.requestId) {
|
|
349
|
+
state.add[action.meta.arg.requestId] = {
|
|
350
|
+
loading: 'pending',
|
|
351
|
+
status: undefined,
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
})
|
|
355
|
+
.addCase(addBookmark.fulfilled, (state, action) => {
|
|
356
|
+
if (action.meta.arg.requestId) {
|
|
357
|
+
state.add[action.meta.arg.requestId] = {
|
|
358
|
+
loading: 'idle',
|
|
359
|
+
status: 'success',
|
|
360
|
+
id: action.payload.result.id,
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
})
|
|
364
|
+
.addCase(addBookmark.rejected, (state, action) => {
|
|
365
|
+
if (action.meta.arg.requestId) {
|
|
366
|
+
state.add[action.meta.arg.requestId] = {
|
|
367
|
+
loading: 'idle',
|
|
368
|
+
status: 'error',
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
})
|
|
372
|
+
.addCase(moveBookmark.pending, (state) => {
|
|
373
|
+
state.move.loading = 'pending';
|
|
374
|
+
state.move.status = undefined;
|
|
375
|
+
})
|
|
376
|
+
.addCase(moveBookmark.fulfilled, (state) => {
|
|
377
|
+
state.move.loading = 'idle';
|
|
378
|
+
state.move.status = 'success';
|
|
379
|
+
})
|
|
380
|
+
.addCase(moveBookmark.rejected, (state) => {
|
|
381
|
+
state.move.loading = 'idle';
|
|
382
|
+
state.move.status = 'error';
|
|
383
|
+
})
|
|
384
|
+
.addCase(deleteBookmark.pending, (state, action) => {
|
|
385
|
+
if (action.meta.arg.requestId) {
|
|
386
|
+
state.delete[action.meta.arg.requestId] = {
|
|
387
|
+
loading: 'pending',
|
|
388
|
+
status: undefined,
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
})
|
|
392
|
+
.addCase(deleteBookmark.fulfilled, (state, action) => {
|
|
393
|
+
if (action.meta.arg.requestId) {
|
|
394
|
+
state.delete[action.meta.arg.requestId] = {
|
|
395
|
+
loading: 'idle',
|
|
396
|
+
status: 'success',
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
})
|
|
400
|
+
.addCase(deleteBookmark.rejected, (state, action) => {
|
|
401
|
+
if (action.meta.arg.requestId) {
|
|
402
|
+
state.delete[action.meta.arg.requestId] = {
|
|
403
|
+
loading: 'idle',
|
|
404
|
+
status: 'error',
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
},
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
const getRTHandlers = function (dispatch) {
|
|
412
|
+
const dispatchOrFetch = function (message, action) {
|
|
413
|
+
if (jamespotUserApi.jEnsure.objectIsType('bookmarkLink', message.object)) {
|
|
414
|
+
dispatch(action(message.object));
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
dispatch(fetchBookmark());
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
const updateBookmarkHandler = function (_message) {
|
|
421
|
+
dispatch(fetchBookmark());
|
|
422
|
+
};
|
|
423
|
+
const addBookmarkHandler = function (message) {
|
|
424
|
+
dispatchOrFetch(message, BookmarkListSlice.actions.addBookmarkRT);
|
|
425
|
+
};
|
|
426
|
+
const deleteBookmarkHandler = (message) => {
|
|
427
|
+
dispatchOrFetch(message, BookmarkListSlice.actions.deleteBookmarkRT);
|
|
428
|
+
};
|
|
429
|
+
return [
|
|
430
|
+
{
|
|
431
|
+
namespace: 'CUSTOM-ACTION',
|
|
432
|
+
function: 'add',
|
|
433
|
+
handler: addBookmarkHandler,
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
namespace: 'CUSTOM-ACTION',
|
|
437
|
+
function: 'remove',
|
|
438
|
+
handler: deleteBookmarkHandler,
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
namespace: 'BOOKMARKS',
|
|
442
|
+
function: 'add',
|
|
443
|
+
handler: addBookmarkHandler,
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
namespace: 'BOOKMARKS',
|
|
447
|
+
function: 'delete',
|
|
448
|
+
handler: deleteBookmarkHandler,
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
namespace: 'BOOKMARKS',
|
|
452
|
+
function: 'update',
|
|
453
|
+
handler: updateBookmarkHandler,
|
|
454
|
+
},
|
|
455
|
+
];
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
const initialState$4 = {
|
|
459
|
+
bookmark: undefined,
|
|
460
|
+
status: undefined,
|
|
461
|
+
loading: 'idle',
|
|
462
|
+
};
|
|
463
|
+
const editBookmark = toolkit.createAsyncThunk('bookmarkEdit/editBookmark', (bookmark, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
464
|
+
var _a, _b;
|
|
465
|
+
if (!bookmark.id) {
|
|
466
|
+
return rejectWithValue({ error: 1, errorMsg: 'Bookmark id is required' });
|
|
467
|
+
}
|
|
468
|
+
const bookmarkLabel = (_a = bookmark.bookmarkLabel) !== null && _a !== void 0 ? _a : '';
|
|
469
|
+
const bookmarkUrl = (_b = bookmark.bookmarkUrl) !== null && _b !== void 0 ? _b : '';
|
|
470
|
+
try {
|
|
471
|
+
yield extra.jApi.bookmark.rename(bookmark.id, bookmarkLabel, bookmarkUrl);
|
|
472
|
+
}
|
|
473
|
+
catch (rejectValue) {
|
|
474
|
+
return rejectWithValue({ error: 2, errorMsg: 'Error saving bookmark' });
|
|
475
|
+
}
|
|
476
|
+
return;
|
|
477
|
+
}));
|
|
478
|
+
const BookmarkEditSlice = toolkit.createSlice({
|
|
479
|
+
name: 'bookmarkEdit',
|
|
480
|
+
initialState: initialState$4,
|
|
481
|
+
reducers: {
|
|
482
|
+
setEditBookmark: (state, action) => {
|
|
483
|
+
state.bookmark = Object.assign({}, action.payload);
|
|
484
|
+
},
|
|
485
|
+
unsetEditBookmark: (state) => {
|
|
486
|
+
state.bookmark = undefined;
|
|
487
|
+
},
|
|
488
|
+
resetStatus: (state) => {
|
|
489
|
+
state.status = undefined;
|
|
490
|
+
state.loading = 'idle';
|
|
491
|
+
}
|
|
492
|
+
},
|
|
493
|
+
extraReducers: (builder) => {
|
|
494
|
+
builder
|
|
495
|
+
.addCase(editBookmark.pending, (state) => {
|
|
496
|
+
state.loading = 'pending';
|
|
497
|
+
state.status = undefined;
|
|
498
|
+
})
|
|
499
|
+
.addCase(editBookmark.fulfilled, (state) => {
|
|
500
|
+
state.loading = 'idle';
|
|
501
|
+
state.bookmark = undefined;
|
|
502
|
+
state.status = 'success';
|
|
503
|
+
})
|
|
504
|
+
.addCase(editBookmark.rejected, (state) => {
|
|
505
|
+
state.status = 'error';
|
|
506
|
+
state.loading = 'idle';
|
|
507
|
+
});
|
|
508
|
+
},
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
const BookmarkReducer = redux.combineReducers({
|
|
512
|
+
[BookmarkListSlice.name]: BookmarkListSlice.reducer,
|
|
513
|
+
[BookmarkEditSlice.name]: BookmarkEditSlice.reducer,
|
|
514
|
+
});
|
|
515
|
+
const bookmarkSlice = {
|
|
516
|
+
name: 'bookmark',
|
|
517
|
+
reducer: BookmarkReducer,
|
|
518
|
+
};
|
|
519
|
+
const selectBookmarkList = (state) => state.bookmark.bookmarkList;
|
|
520
|
+
const selectBookmarkListIsInitialized = (state) => state.bookmark.bookmarkList.isInitialized;
|
|
521
|
+
const selectBookmarkEditBookmark = (state) => state.bookmark.bookmarkEdit.bookmark;
|
|
522
|
+
const Bookmark = {
|
|
523
|
+
slice: bookmarkSlice,
|
|
524
|
+
actions: Object.assign(Object.assign({ fetchBookmark, addBookmark, moveBookmark, deleteBookmark, editBookmark }, BookmarkEditSlice.actions), BookmarkListSlice.actions),
|
|
525
|
+
selectors: {
|
|
526
|
+
bookmarkList: selectBookmarkList,
|
|
527
|
+
bookmarkListIsInitialized: selectBookmarkListIsInitialized,
|
|
528
|
+
bookmarkEditBookmark: selectBookmarkEditBookmark
|
|
529
|
+
},
|
|
530
|
+
getRTHandlers: getRTHandlers,
|
|
255
531
|
};
|
|
256
532
|
|
|
257
533
|
const extractJlandUrlBaseFromMap = (map) => {
|
|
@@ -487,7 +763,7 @@ const initialMap = {
|
|
|
487
763
|
illustration: '',
|
|
488
764
|
assignLicense: false,
|
|
489
765
|
};
|
|
490
|
-
const initialState$
|
|
766
|
+
const initialState$3 = {
|
|
491
767
|
map: Object.assign({}, initialMap),
|
|
492
768
|
loading: 'idle',
|
|
493
769
|
status: undefined,
|
|
@@ -531,13 +807,13 @@ const createMap = toolkit.createAsyncThunk('mapCreate/create', ({ map, jlandUrlB
|
|
|
531
807
|
}));
|
|
532
808
|
const MapCreateSlice = toolkit.createSlice({
|
|
533
809
|
name: 'mapCreate',
|
|
534
|
-
initialState: initialState$
|
|
810
|
+
initialState: initialState$3,
|
|
535
811
|
reducers: {
|
|
536
812
|
setMap: (state, action) => {
|
|
537
813
|
state.map = action.payload;
|
|
538
814
|
},
|
|
539
815
|
resetCreateMapState: () => {
|
|
540
|
-
return initialState$
|
|
816
|
+
return initialState$3;
|
|
541
817
|
},
|
|
542
818
|
},
|
|
543
819
|
extraReducers: (builder) => {
|
|
@@ -591,7 +867,27 @@ const jland = {
|
|
|
591
867
|
utils: { buildUrlToJland },
|
|
592
868
|
};
|
|
593
869
|
|
|
594
|
-
const
|
|
870
|
+
const adapter = toolkit.createEntityAdapter({
|
|
871
|
+
selectId: (model) => model.type,
|
|
872
|
+
sortComparer: (a, b) => a.label.localeCompare(b.label),
|
|
873
|
+
});
|
|
874
|
+
const slice$1 = toolkit.createSlice({
|
|
875
|
+
name: 'models',
|
|
876
|
+
initialState: adapter.getInitialState(),
|
|
877
|
+
reducers: {
|
|
878
|
+
addOne: adapter.addOne,
|
|
879
|
+
addMany: adapter.addMany,
|
|
880
|
+
setAll: adapter.setAll,
|
|
881
|
+
},
|
|
882
|
+
});
|
|
883
|
+
const selectors = adapter.getSelectors((state) => state.entities.models);
|
|
884
|
+
const Model = {
|
|
885
|
+
slice: slice$1,
|
|
886
|
+
actions: Object.assign({}, slice$1.actions),
|
|
887
|
+
selectors,
|
|
888
|
+
};
|
|
889
|
+
|
|
890
|
+
const initialState$2 = {
|
|
595
891
|
id: 0,
|
|
596
892
|
mainType: 'user',
|
|
597
893
|
type: 'user',
|
|
@@ -604,7 +900,7 @@ const initialState = {
|
|
|
604
900
|
};
|
|
605
901
|
const slice = toolkit.createSlice({
|
|
606
902
|
name: 'userCurrent',
|
|
607
|
-
initialState,
|
|
903
|
+
initialState: initialState$2,
|
|
608
904
|
reducers: {
|
|
609
905
|
init: (_, { payload }) => {
|
|
610
906
|
return payload;
|
|
@@ -626,11 +922,346 @@ const UserCurrent = {
|
|
|
626
922
|
utils: { isAdmin },
|
|
627
923
|
};
|
|
628
924
|
|
|
925
|
+
function uniqid() {
|
|
926
|
+
let id = '';
|
|
927
|
+
for (let index = 0; index < 16; index++) {
|
|
928
|
+
id += (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
929
|
+
}
|
|
930
|
+
return id;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
const WIDGET_ARTICLE_TITLE = 'widget-article-title';
|
|
934
|
+
const WIDGET_ARTICLE_TEXT = 'widget-article-text';
|
|
935
|
+
const WIDGET_ARTICLE_IMAGE = 'widget-article-image';
|
|
936
|
+
const WIDGET_ARTICLE_BUTTON = 'widget-article-button';
|
|
937
|
+
const WIDGET_ARTICLE_GALLERY = 'widget-article-gallery';
|
|
938
|
+
const WIDGET_ARTICLE_ATTACHMENT = 'widget-article-attachment';
|
|
939
|
+
|
|
940
|
+
var WIDGETS = /*#__PURE__*/Object.freeze({
|
|
941
|
+
__proto__: null,
|
|
942
|
+
WIDGET_ARTICLE_TITLE: WIDGET_ARTICLE_TITLE,
|
|
943
|
+
WIDGET_ARTICLE_TEXT: WIDGET_ARTICLE_TEXT,
|
|
944
|
+
WIDGET_ARTICLE_IMAGE: WIDGET_ARTICLE_IMAGE,
|
|
945
|
+
WIDGET_ARTICLE_BUTTON: WIDGET_ARTICLE_BUTTON,
|
|
946
|
+
WIDGET_ARTICLE_GALLERY: WIDGET_ARTICLE_GALLERY,
|
|
947
|
+
WIDGET_ARTICLE_ATTACHMENT: WIDGET_ARTICLE_ATTACHMENT
|
|
948
|
+
});
|
|
949
|
+
|
|
950
|
+
function widgetFactory(name, widgetWrapperExtraParams) {
|
|
951
|
+
const widgetWrapper = {
|
|
952
|
+
title: '',
|
|
953
|
+
widget: {
|
|
954
|
+
name,
|
|
955
|
+
uniqid: uniqid(),
|
|
956
|
+
content: {}
|
|
957
|
+
},
|
|
958
|
+
position: { x: 0, y: 0 }
|
|
959
|
+
};
|
|
960
|
+
switch (name) {
|
|
961
|
+
default:
|
|
962
|
+
case WIDGET_ARTICLE_ATTACHMENT:
|
|
963
|
+
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
964
|
+
files: []
|
|
965
|
+
} }) });
|
|
966
|
+
case WIDGET_ARTICLE_GALLERY:
|
|
967
|
+
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
968
|
+
widgets: [],
|
|
969
|
+
gap: '4',
|
|
970
|
+
horizontalNumber: '3',
|
|
971
|
+
galleryDisplay: 'landscape'
|
|
972
|
+
} }) });
|
|
973
|
+
case WIDGET_ARTICLE_IMAGE:
|
|
974
|
+
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
975
|
+
widgets: [],
|
|
976
|
+
displayAs: 'image',
|
|
977
|
+
backgroundPosition: 'center',
|
|
978
|
+
backgroundSize: 'cover',
|
|
979
|
+
borderRadius: 8
|
|
980
|
+
} }) });
|
|
981
|
+
case WIDGET_ARTICLE_BUTTON:
|
|
982
|
+
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
983
|
+
text: 'This is a button',
|
|
984
|
+
variant: 'contained',
|
|
985
|
+
fontSize: '14',
|
|
986
|
+
color: '#fff',
|
|
987
|
+
backgroundColor: '#4dbf96',
|
|
988
|
+
buttonSize: 'lg',
|
|
989
|
+
borderRadius: '4'
|
|
990
|
+
} }) });
|
|
991
|
+
case WIDGET_ARTICLE_TITLE:
|
|
992
|
+
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
993
|
+
text: 'Ceci est un titre',
|
|
994
|
+
heading: 'h1',
|
|
995
|
+
backgroundColor: 'transparent'
|
|
996
|
+
} }) });
|
|
997
|
+
case WIDGET_ARTICLE_TEXT:
|
|
998
|
+
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
999
|
+
fontSize: '18',
|
|
1000
|
+
lineHeight: '1.6',
|
|
1001
|
+
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
|
|
1002
|
+
} }) });
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
function widgetDefinition(name) {
|
|
1007
|
+
switch (name) {
|
|
1008
|
+
default:
|
|
1009
|
+
return {
|
|
1010
|
+
label: 'WIDGET_Article_Gallery',
|
|
1011
|
+
description: 'WIDGET_Article_Gallery_Description',
|
|
1012
|
+
name: 'widget-article-image',
|
|
1013
|
+
img: '/img/fast-intranet/widget-slider.png',
|
|
1014
|
+
available: true,
|
|
1015
|
+
panel: {
|
|
1016
|
+
useWrapper: false,
|
|
1017
|
+
useEditor: true,
|
|
1018
|
+
useWidgets: false
|
|
1019
|
+
},
|
|
1020
|
+
};
|
|
1021
|
+
case WIDGET_ARTICLE_GALLERY:
|
|
1022
|
+
return {
|
|
1023
|
+
label: 'WIDGET_Article_Gallery',
|
|
1024
|
+
description: 'WIDGET_Article_Gallery_Description',
|
|
1025
|
+
name,
|
|
1026
|
+
img: '/img/fast-intranet/widget-slider.png',
|
|
1027
|
+
available: true,
|
|
1028
|
+
panel: {
|
|
1029
|
+
useWrapper: false,
|
|
1030
|
+
useEditor: true,
|
|
1031
|
+
useWidgets: false
|
|
1032
|
+
},
|
|
1033
|
+
};
|
|
1034
|
+
case WIDGET_ARTICLE_ATTACHMENT:
|
|
1035
|
+
return {
|
|
1036
|
+
label: 'WIDGET_Article_Attachment',
|
|
1037
|
+
description: 'WIDGET_Article_Attachment_Description',
|
|
1038
|
+
name,
|
|
1039
|
+
img: '/img/fast-intranet/widget-file.png',
|
|
1040
|
+
available: true,
|
|
1041
|
+
panel: {
|
|
1042
|
+
useWrapper: true,
|
|
1043
|
+
useEditor: true,
|
|
1044
|
+
useWidgets: false
|
|
1045
|
+
},
|
|
1046
|
+
};
|
|
1047
|
+
case WIDGET_ARTICLE_TEXT:
|
|
1048
|
+
return {
|
|
1049
|
+
label: 'WIDGET_Text',
|
|
1050
|
+
description: 'WIDGET_Text_Description',
|
|
1051
|
+
name,
|
|
1052
|
+
img: '/img/fast-intranet/widget-text.png',
|
|
1053
|
+
available: true,
|
|
1054
|
+
panel: {
|
|
1055
|
+
useWrapper: false,
|
|
1056
|
+
useEditor: true,
|
|
1057
|
+
useWidgets: false
|
|
1058
|
+
},
|
|
1059
|
+
};
|
|
1060
|
+
case WIDGET_ARTICLE_TITLE:
|
|
1061
|
+
return {
|
|
1062
|
+
label: 'WIDGET_Title',
|
|
1063
|
+
description: 'WIDGET_Title_Description',
|
|
1064
|
+
name,
|
|
1065
|
+
img: '/img/fast-intranet/widget-text.png',
|
|
1066
|
+
available: true,
|
|
1067
|
+
panel: {
|
|
1068
|
+
useWrapper: false,
|
|
1069
|
+
useEditor: true,
|
|
1070
|
+
useWidgets: false
|
|
1071
|
+
},
|
|
1072
|
+
};
|
|
1073
|
+
case WIDGET_ARTICLE_IMAGE:
|
|
1074
|
+
return {
|
|
1075
|
+
label: 'WIDGET_Article_Image',
|
|
1076
|
+
description: 'WIDGET_Article_Image_Description',
|
|
1077
|
+
name,
|
|
1078
|
+
img: '/img/fast-intranet/widget-image.png',
|
|
1079
|
+
available: true,
|
|
1080
|
+
panel: {
|
|
1081
|
+
useWrapper: false,
|
|
1082
|
+
useEditor: true,
|
|
1083
|
+
useWidgets: false
|
|
1084
|
+
},
|
|
1085
|
+
};
|
|
1086
|
+
case WIDGET_ARTICLE_BUTTON:
|
|
1087
|
+
return {
|
|
1088
|
+
label: 'WIDGET_Button',
|
|
1089
|
+
description: 'WIDGET_Button_Description',
|
|
1090
|
+
name,
|
|
1091
|
+
img: '/img/fast-intranet/widget-button.png',
|
|
1092
|
+
available: true,
|
|
1093
|
+
panel: {
|
|
1094
|
+
useWrapper: false,
|
|
1095
|
+
useEditor: true,
|
|
1096
|
+
useWidgets: false
|
|
1097
|
+
},
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
const MODE_EDIT = 'edit';
|
|
1103
|
+
const MODE_VIEW = 'view';
|
|
1104
|
+
const initialState$1 = {
|
|
1105
|
+
token: undefined,
|
|
1106
|
+
ids: {},
|
|
1107
|
+
states: {},
|
|
1108
|
+
modal: undefined,
|
|
1109
|
+
};
|
|
1110
|
+
const widgetsSlice = toolkit.createSlice({
|
|
1111
|
+
name: 'widgets',
|
|
1112
|
+
initialState: initialState$1,
|
|
1113
|
+
reducers: {
|
|
1114
|
+
registerWidget: (state, action) => {
|
|
1115
|
+
const { uniqid, widget } = action.payload;
|
|
1116
|
+
state.ids[uniqid] = widget;
|
|
1117
|
+
state.states[uniqid] = { busy: false, initialized: false, loading: false, mounted: false };
|
|
1118
|
+
},
|
|
1119
|
+
updateWidget: (state, action) => {
|
|
1120
|
+
var _a;
|
|
1121
|
+
const { uniqid, content } = action.payload;
|
|
1122
|
+
const wrapper = Object.assign({}, state.ids[uniqid]);
|
|
1123
|
+
if (wrapper !== undefined && wrapper.widget !== undefined) {
|
|
1124
|
+
state.ids[uniqid] = Object.assign(Object.assign({}, wrapper), { title: (_a = wrapper === null || wrapper === void 0 ? void 0 : wrapper.title) !== null && _a !== void 0 ? _a : '', widget: Object.assign(Object.assign({}, wrapper.widget), { content }) });
|
|
1125
|
+
}
|
|
1126
|
+
},
|
|
1127
|
+
flushWidget: (state, action) => {
|
|
1128
|
+
const { uniqid } = action.payload;
|
|
1129
|
+
delete state.ids[uniqid];
|
|
1130
|
+
delete state.states[uniqid];
|
|
1131
|
+
},
|
|
1132
|
+
updateWidgetWrapper: (state, action) => {
|
|
1133
|
+
const { uniqid, title, position } = action.payload;
|
|
1134
|
+
const wrapper = Object.assign({}, state.ids[uniqid]);
|
|
1135
|
+
if (wrapper !== undefined && wrapper.widget !== undefined) {
|
|
1136
|
+
if (position) {
|
|
1137
|
+
state.ids[uniqid] = Object.assign(Object.assign({}, wrapper), { title, position, widget: wrapper.widget });
|
|
1138
|
+
}
|
|
1139
|
+
else {
|
|
1140
|
+
state.ids[uniqid] = Object.assign(Object.assign({}, wrapper), { title, widget: wrapper.widget });
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
},
|
|
1144
|
+
setToken: (state, action) => {
|
|
1145
|
+
state.token = action.payload.token;
|
|
1146
|
+
},
|
|
1147
|
+
setState: (state, action) => {
|
|
1148
|
+
const { uniqid } = action.payload;
|
|
1149
|
+
const widgetState = Object.assign({}, state.states[uniqid]);
|
|
1150
|
+
if (widgetState !== undefined) {
|
|
1151
|
+
state.states[uniqid] = Object.assign(Object.assign({}, state.states[uniqid]), action.payload);
|
|
1152
|
+
}
|
|
1153
|
+
},
|
|
1154
|
+
setAllStates: (state, action) => {
|
|
1155
|
+
const { busy, initialized, loading, mounted } = action.payload;
|
|
1156
|
+
Object.keys(state.states).map((key) => {
|
|
1157
|
+
const widgetState = Object.assign({}, state.states[key]);
|
|
1158
|
+
if (widgetState !== undefined) {
|
|
1159
|
+
state.states[key] = Object.assign(Object.assign({}, state.states[key]), { busy: busy !== null && busy !== void 0 ? busy : widgetState.busy, initialized: initialized !== null && initialized !== void 0 ? initialized : widgetState.initialized, loading: loading !== null && loading !== void 0 ? loading : widgetState.loading, mounted: mounted !== null && mounted !== void 0 ? mounted : widgetState.mounted });
|
|
1160
|
+
}
|
|
1161
|
+
});
|
|
1162
|
+
},
|
|
1163
|
+
registerModal: (state, action) => {
|
|
1164
|
+
state.modal = action.payload;
|
|
1165
|
+
},
|
|
1166
|
+
flushModal: (state) => {
|
|
1167
|
+
state.modal = undefined;
|
|
1168
|
+
},
|
|
1169
|
+
},
|
|
1170
|
+
});
|
|
1171
|
+
const selectToken = (state) => state.widgets.token;
|
|
1172
|
+
const selectModal = (state) => state.widgets.modal;
|
|
1173
|
+
const selectWidgets = (state) => state.widgets.ids;
|
|
1174
|
+
const selectWidgetContent = (state, uniqid) => { var _a, _b; return (_b = (_a = state.widgets) === null || _a === void 0 ? void 0 : _a.ids[uniqid]) === null || _b === void 0 ? void 0 : _b.widget.content; };
|
|
1175
|
+
const selectWidgetState = (state, uniqid) => { var _a; return (_a = state.widgets.states[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
|
|
1176
|
+
const selectWidget = (state, uniqid) => { var _a; return (_a = state.widgets.ids[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
|
|
1177
|
+
const Widget = {
|
|
1178
|
+
const: WIDGETS,
|
|
1179
|
+
factory: widgetFactory,
|
|
1180
|
+
definition: widgetDefinition,
|
|
1181
|
+
utils: {
|
|
1182
|
+
uniqid
|
|
1183
|
+
},
|
|
1184
|
+
slice: widgetsSlice,
|
|
1185
|
+
selectors: {
|
|
1186
|
+
selectToken,
|
|
1187
|
+
selectWidgets,
|
|
1188
|
+
selectWidget,
|
|
1189
|
+
selectWidgetState,
|
|
1190
|
+
selectWidgetContent,
|
|
1191
|
+
selectModal,
|
|
1192
|
+
}
|
|
1193
|
+
};
|
|
1194
|
+
|
|
1195
|
+
const initialState = {
|
|
1196
|
+
editors: [],
|
|
1197
|
+
};
|
|
1198
|
+
const editorsSlice = toolkit.createSlice({
|
|
1199
|
+
name: 'editors',
|
|
1200
|
+
initialState,
|
|
1201
|
+
reducers: {
|
|
1202
|
+
registerEditor: (state, action) => {
|
|
1203
|
+
const { uniqid, name } = action.payload;
|
|
1204
|
+
const ed = {
|
|
1205
|
+
uniqid,
|
|
1206
|
+
name,
|
|
1207
|
+
position: 'right'
|
|
1208
|
+
};
|
|
1209
|
+
state.editors = state.editors.find((ed) => ed.uniqid === uniqid) ? state.editors : [...state.editors, ed];
|
|
1210
|
+
},
|
|
1211
|
+
registerEditorPopup: (state, action) => {
|
|
1212
|
+
const { uniqid, view } = action.payload;
|
|
1213
|
+
state.editors = [
|
|
1214
|
+
...state.editors.map((editor) => editor.uniqid === uniqid ? Object.assign(Object.assign({}, editor), { popup: true, view }) : editor),
|
|
1215
|
+
];
|
|
1216
|
+
},
|
|
1217
|
+
flushEditorPopup: (state, action) => {
|
|
1218
|
+
const { uniqid } = action.payload;
|
|
1219
|
+
state.editors = [
|
|
1220
|
+
...state.editors.map((editor) => (editor.uniqid === uniqid ? Object.assign(Object.assign({}, editor), { popup: false }) : editor)),
|
|
1221
|
+
];
|
|
1222
|
+
},
|
|
1223
|
+
setEditorPosition: (state, action) => {
|
|
1224
|
+
const { uniqid, position } = action.payload;
|
|
1225
|
+
state.editors = [
|
|
1226
|
+
...state.editors.map((ed) => {
|
|
1227
|
+
return ed.uniqid === uniqid ? Object.assign(Object.assign({}, ed), { position }) : ed;
|
|
1228
|
+
}),
|
|
1229
|
+
];
|
|
1230
|
+
},
|
|
1231
|
+
updateEditor: (state, action) => {
|
|
1232
|
+
const { uniqid, content } = action.payload;
|
|
1233
|
+
state.editors = [
|
|
1234
|
+
...state.editors.map((ed) => {
|
|
1235
|
+
return ed.uniqid === uniqid ? Object.assign(Object.assign({}, ed), { content }) : ed;
|
|
1236
|
+
}),
|
|
1237
|
+
];
|
|
1238
|
+
},
|
|
1239
|
+
flushEditor: (state, action) => {
|
|
1240
|
+
const { uniqid } = action.payload;
|
|
1241
|
+
state.editors = [...state.editors.filter((ed) => ed.uniqid !== uniqid)];
|
|
1242
|
+
},
|
|
1243
|
+
},
|
|
1244
|
+
});
|
|
1245
|
+
const selectEditors = (state) => state.editors.editors;
|
|
1246
|
+
const selectEditor = (state, uniqid) => state.editors.editors.find((editor) => editor.uniqid === uniqid);
|
|
1247
|
+
const WidgetEditor = {
|
|
1248
|
+
slice: editorsSlice,
|
|
1249
|
+
selectors: {
|
|
1250
|
+
selectEditors,
|
|
1251
|
+
selectEditor,
|
|
1252
|
+
},
|
|
1253
|
+
};
|
|
1254
|
+
|
|
629
1255
|
exports.Application = Application;
|
|
630
1256
|
exports.AssetReservation = AssetReservation;
|
|
1257
|
+
exports.Bookmark = Bookmark;
|
|
1258
|
+
exports.MODE_EDIT = MODE_EDIT;
|
|
1259
|
+
exports.MODE_VIEW = MODE_VIEW;
|
|
631
1260
|
exports.Model = Model;
|
|
632
1261
|
exports.Toast = Toast;
|
|
633
1262
|
exports.UserCurrent = UserCurrent;
|
|
1263
|
+
exports.Widget = Widget;
|
|
1264
|
+
exports.WidgetEditor = WidgetEditor;
|
|
634
1265
|
exports.actions = actions;
|
|
635
1266
|
exports.jland = jland;
|
|
636
1267
|
exports.slice = slice;
|