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