jamespot-front-business 1.1.8 → 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 +664 -367
- package/dist/cjs.js.map +1 -1
- package/dist/esm.js +665 -369
- package/dist/esm.js.map +1 -1
- package/dist/types.d.ts +368 -227
- 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$5 = {
|
|
|
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,391 +198,336 @@ const AssetReservation = {
|
|
|
197
198
|
},
|
|
198
199
|
};
|
|
199
200
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
for (let index = 0; index < 16; index++) {
|
|
203
|
-
id += (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
204
|
-
}
|
|
205
|
-
return id;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
const WIDGET_ARTICLE_TITLE = 'widget-article-title';
|
|
209
|
-
const WIDGET_ARTICLE_TEXT = 'widget-article-text';
|
|
210
|
-
const WIDGET_ARTICLE_IMAGE = 'widget-article-image';
|
|
211
|
-
const WIDGET_ARTICLE_BUTTON = 'widget-article-button';
|
|
212
|
-
const WIDGET_ARTICLE_GALLERY = 'widget-article-gallery';
|
|
213
|
-
const WIDGET_ARTICLE_ATTACHMENT = 'widget-article-attachment';
|
|
214
|
-
|
|
215
|
-
var WIDGETS = /*#__PURE__*/Object.freeze({
|
|
216
|
-
__proto__: null,
|
|
217
|
-
WIDGET_ARTICLE_TITLE: WIDGET_ARTICLE_TITLE,
|
|
218
|
-
WIDGET_ARTICLE_TEXT: WIDGET_ARTICLE_TEXT,
|
|
219
|
-
WIDGET_ARTICLE_IMAGE: WIDGET_ARTICLE_IMAGE,
|
|
220
|
-
WIDGET_ARTICLE_BUTTON: WIDGET_ARTICLE_BUTTON,
|
|
221
|
-
WIDGET_ARTICLE_GALLERY: WIDGET_ARTICLE_GALLERY,
|
|
222
|
-
WIDGET_ARTICLE_ATTACHMENT: WIDGET_ARTICLE_ATTACHMENT
|
|
201
|
+
const toastAdapter = toolkit.createEntityAdapter({
|
|
202
|
+
selectId: (toast) => toast.id,
|
|
223
203
|
});
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
204
|
+
const slice$2 = toolkit.createSlice({
|
|
205
|
+
name: 'toasts',
|
|
206
|
+
initialState: toastAdapter.getInitialState(),
|
|
207
|
+
reducers: {
|
|
208
|
+
addOne: toastAdapter.addOne,
|
|
209
|
+
removeOne: toastAdapter.removeOne,
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
const randomId = () => Math.random().toString(16).slice(2);
|
|
213
|
+
const addMessage = (_a, type, timeout) => {
|
|
214
|
+
var { id = randomId() } = _a, toast = __rest(_a, ["id"]);
|
|
215
|
+
if (type === void 0) { type = 'success'; }
|
|
216
|
+
if (timeout === void 0) { timeout = 3000; }
|
|
217
|
+
return (dispatch) => {
|
|
218
|
+
dispatch(slice$2.actions.addOne(Object.assign(Object.assign({ id }, toast), { timeout, type })));
|
|
219
|
+
setTimeout(() => {
|
|
220
|
+
dispatch(slice$2.actions.removeOne(id));
|
|
221
|
+
}, timeout);
|
|
222
|
+
return id;
|
|
234
223
|
};
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
case WIDGET_ARTICLE_IMAGE:
|
|
249
|
-
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
250
|
-
widgets: [],
|
|
251
|
-
displayAs: 'image',
|
|
252
|
-
backgroundPosition: 'center',
|
|
253
|
-
backgroundSize: 'cover',
|
|
254
|
-
borderRadius: 8
|
|
255
|
-
} }) });
|
|
256
|
-
case WIDGET_ARTICLE_BUTTON:
|
|
257
|
-
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
258
|
-
text: 'This is a button',
|
|
259
|
-
variant: 'contained',
|
|
260
|
-
fontSize: '14',
|
|
261
|
-
color: '#fff',
|
|
262
|
-
backgroundColor: '#4dbf96',
|
|
263
|
-
buttonSize: 'lg',
|
|
264
|
-
borderRadius: '4'
|
|
265
|
-
} }) });
|
|
266
|
-
case WIDGET_ARTICLE_TITLE:
|
|
267
|
-
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
268
|
-
text: 'Ceci est un titre',
|
|
269
|
-
heading: 'h1',
|
|
270
|
-
backgroundColor: 'transparent'
|
|
271
|
-
} }) });
|
|
272
|
-
case WIDGET_ARTICLE_TEXT:
|
|
273
|
-
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
274
|
-
fontSize: '18',
|
|
275
|
-
lineHeight: '1.6',
|
|
276
|
-
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.'
|
|
277
|
-
} }) });
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
function widgetDefinition(name) {
|
|
282
|
-
switch (name) {
|
|
283
|
-
default:
|
|
284
|
-
return {
|
|
285
|
-
label: 'WIDGET_Article_Gallery',
|
|
286
|
-
description: 'WIDGET_Article_Gallery_Description',
|
|
287
|
-
name: 'widget-article-image',
|
|
288
|
-
img: '/img/fast-intranet/widget-slider.png',
|
|
289
|
-
available: true,
|
|
290
|
-
panel: {
|
|
291
|
-
useWrapper: false,
|
|
292
|
-
useEditor: true,
|
|
293
|
-
useWidgets: false
|
|
294
|
-
},
|
|
295
|
-
};
|
|
296
|
-
case WIDGET_ARTICLE_GALLERY:
|
|
297
|
-
return {
|
|
298
|
-
label: 'WIDGET_Article_Gallery',
|
|
299
|
-
description: 'WIDGET_Article_Gallery_Description',
|
|
300
|
-
name,
|
|
301
|
-
img: '/img/fast-intranet/widget-slider.png',
|
|
302
|
-
available: true,
|
|
303
|
-
panel: {
|
|
304
|
-
useWrapper: false,
|
|
305
|
-
useEditor: true,
|
|
306
|
-
useWidgets: false
|
|
307
|
-
},
|
|
308
|
-
};
|
|
309
|
-
case WIDGET_ARTICLE_ATTACHMENT:
|
|
310
|
-
return {
|
|
311
|
-
label: 'WIDGET_Article_Attachment',
|
|
312
|
-
description: 'WIDGET_Article_Attachment_Description',
|
|
313
|
-
name,
|
|
314
|
-
img: '/img/fast-intranet/widget-file.png',
|
|
315
|
-
available: true,
|
|
316
|
-
panel: {
|
|
317
|
-
useWrapper: true,
|
|
318
|
-
useEditor: true,
|
|
319
|
-
useWidgets: false
|
|
320
|
-
},
|
|
321
|
-
};
|
|
322
|
-
case WIDGET_ARTICLE_TEXT:
|
|
323
|
-
return {
|
|
324
|
-
label: 'WIDGET_Text',
|
|
325
|
-
description: 'WIDGET_Text_Description',
|
|
326
|
-
name,
|
|
327
|
-
img: '/img/fast-intranet/widget-text.png',
|
|
328
|
-
available: true,
|
|
329
|
-
panel: {
|
|
330
|
-
useWrapper: false,
|
|
331
|
-
useEditor: true,
|
|
332
|
-
useWidgets: false
|
|
333
|
-
},
|
|
334
|
-
};
|
|
335
|
-
case WIDGET_ARTICLE_TITLE:
|
|
336
|
-
return {
|
|
337
|
-
label: 'WIDGET_Title',
|
|
338
|
-
description: 'WIDGET_Title_Description',
|
|
339
|
-
name,
|
|
340
|
-
img: '/img/fast-intranet/widget-text.png',
|
|
341
|
-
available: true,
|
|
342
|
-
panel: {
|
|
343
|
-
useWrapper: false,
|
|
344
|
-
useEditor: true,
|
|
345
|
-
useWidgets: false
|
|
346
|
-
},
|
|
347
|
-
};
|
|
348
|
-
case WIDGET_ARTICLE_IMAGE:
|
|
349
|
-
return {
|
|
350
|
-
label: 'WIDGET_Article_Image',
|
|
351
|
-
description: 'WIDGET_Article_Image_Description',
|
|
352
|
-
name,
|
|
353
|
-
img: '/img/fast-intranet/widget-image.png',
|
|
354
|
-
available: true,
|
|
355
|
-
panel: {
|
|
356
|
-
useWrapper: false,
|
|
357
|
-
useEditor: true,
|
|
358
|
-
useWidgets: false
|
|
359
|
-
},
|
|
360
|
-
};
|
|
361
|
-
case WIDGET_ARTICLE_BUTTON:
|
|
362
|
-
return {
|
|
363
|
-
label: 'WIDGET_Button',
|
|
364
|
-
description: 'WIDGET_Button_Description',
|
|
365
|
-
name,
|
|
366
|
-
img: '/img/fast-intranet/widget-button.png',
|
|
367
|
-
available: true,
|
|
368
|
-
panel: {
|
|
369
|
-
useWrapper: false,
|
|
370
|
-
useEditor: true,
|
|
371
|
-
useWidgets: false
|
|
372
|
-
},
|
|
373
|
-
};
|
|
374
|
-
}
|
|
375
|
-
}
|
|
224
|
+
};
|
|
225
|
+
const actions = {
|
|
226
|
+
addMessage,
|
|
227
|
+
success: (toast, timeout) => addMessage(toast, 'success', timeout),
|
|
228
|
+
warning: (toast, timeout) => addMessage(toast, 'warning', timeout),
|
|
229
|
+
error: (toast, timeout) => addMessage(toast, 'error', timeout),
|
|
230
|
+
};
|
|
231
|
+
const selectors$1 = toastAdapter.getSelectors((state) => state.toasts);
|
|
232
|
+
const Toast = {
|
|
233
|
+
slice: slice$2,
|
|
234
|
+
actions: Object.assign(Object.assign({}, actions), slice$2.actions),
|
|
235
|
+
selectors: selectors$1,
|
|
236
|
+
};
|
|
376
237
|
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
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: {},
|
|
384
250
|
};
|
|
385
|
-
const
|
|
386
|
-
|
|
387
|
-
|
|
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,
|
|
388
302
|
reducers: {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
state.states[uniqid] = { busy: false, initialized: false, loading: false, mounted: false };
|
|
393
|
-
},
|
|
394
|
-
updateWidget: (state, action) => {
|
|
395
|
-
var _a;
|
|
396
|
-
const { uniqid, content } = action.payload;
|
|
397
|
-
const wrapper = Object.assign({}, state.ids[uniqid]);
|
|
398
|
-
if (wrapper !== undefined && wrapper.widget !== undefined) {
|
|
399
|
-
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 }) });
|
|
303
|
+
resetAddBookmarkStatus: (state, action) => {
|
|
304
|
+
if (state.add[action.payload]) {
|
|
305
|
+
delete state.add[action.payload];
|
|
400
306
|
}
|
|
401
307
|
},
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
delete state.states[uniqid];
|
|
308
|
+
resetMoveBookmarkStatus: (state) => {
|
|
309
|
+
state.move.status = undefined;
|
|
310
|
+
state.move.loading = 'idle';
|
|
406
311
|
},
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
if (wrapper !== undefined && wrapper.widget !== undefined) {
|
|
411
|
-
if (position) {
|
|
412
|
-
state.ids[uniqid] = Object.assign(Object.assign({}, wrapper), { title, position, widget: wrapper.widget });
|
|
413
|
-
}
|
|
414
|
-
else {
|
|
415
|
-
state.ids[uniqid] = Object.assign(Object.assign({}, wrapper), { title, widget: wrapper.widget });
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
},
|
|
419
|
-
setToken: (state, action) => {
|
|
420
|
-
state.token = action.payload.token;
|
|
421
|
-
},
|
|
422
|
-
setState: (state, action) => {
|
|
423
|
-
const { uniqid } = action.payload;
|
|
424
|
-
const widgetState = Object.assign({}, state.states[uniqid]);
|
|
425
|
-
if (widgetState !== undefined) {
|
|
426
|
-
state.states[uniqid] = Object.assign(Object.assign({}, state.states[uniqid]), action.payload);
|
|
312
|
+
resetDeleteBookmarkStatus: (state, action) => {
|
|
313
|
+
if (state.delete[action.payload]) {
|
|
314
|
+
delete state.delete[action.payload];
|
|
427
315
|
}
|
|
428
316
|
},
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
const widgetState = Object.assign({}, state.states[key]);
|
|
433
|
-
if (widgetState !== undefined) {
|
|
434
|
-
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 });
|
|
435
|
-
}
|
|
436
|
-
});
|
|
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); });
|
|
437
320
|
},
|
|
438
|
-
|
|
439
|
-
state.
|
|
321
|
+
deleteBookmarkRT: (state, action) => {
|
|
322
|
+
state.bookmarks = state.bookmarks.filter((bookmark) => bookmark.id !== action.payload.id);
|
|
440
323
|
},
|
|
441
|
-
|
|
442
|
-
state.
|
|
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); });
|
|
443
328
|
},
|
|
444
329
|
},
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
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
|
+
});
|
|
458
408
|
},
|
|
459
|
-
|
|
460
|
-
selectors: {
|
|
461
|
-
selectToken,
|
|
462
|
-
selectWidgets,
|
|
463
|
-
selectWidget,
|
|
464
|
-
selectWidgetState,
|
|
465
|
-
selectWidgetContent,
|
|
466
|
-
selectModal,
|
|
467
|
-
}
|
|
468
|
-
};
|
|
409
|
+
});
|
|
469
410
|
|
|
470
|
-
const
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
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,
|
|
491
434
|
},
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
];
|
|
435
|
+
{
|
|
436
|
+
namespace: 'CUSTOM-ACTION',
|
|
437
|
+
function: 'remove',
|
|
438
|
+
handler: deleteBookmarkHandler,
|
|
497
439
|
},
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
return ed.uniqid === uniqid ? Object.assign(Object.assign({}, ed), { position }) : ed;
|
|
503
|
-
}),
|
|
504
|
-
];
|
|
440
|
+
{
|
|
441
|
+
namespace: 'BOOKMARKS',
|
|
442
|
+
function: 'add',
|
|
443
|
+
handler: addBookmarkHandler,
|
|
505
444
|
},
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
return ed.uniqid === uniqid ? Object.assign(Object.assign({}, ed), { content }) : ed;
|
|
511
|
-
}),
|
|
512
|
-
];
|
|
445
|
+
{
|
|
446
|
+
namespace: 'BOOKMARKS',
|
|
447
|
+
function: 'delete',
|
|
448
|
+
handler: deleteBookmarkHandler,
|
|
513
449
|
},
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
450
|
+
{
|
|
451
|
+
namespace: 'BOOKMARKS',
|
|
452
|
+
function: 'update',
|
|
453
|
+
handler: updateBookmarkHandler,
|
|
517
454
|
},
|
|
518
|
-
|
|
519
|
-
});
|
|
520
|
-
const selectEditors = (state) => state.editors.editors;
|
|
521
|
-
const selectEditor = (state, uniqid) => state.editors.editors.find((editor) => editor.uniqid === uniqid);
|
|
522
|
-
const WidgetEditor = {
|
|
523
|
-
slice: editorsSlice,
|
|
524
|
-
selectors: {
|
|
525
|
-
selectEditors,
|
|
526
|
-
selectEditor,
|
|
527
|
-
},
|
|
455
|
+
];
|
|
528
456
|
};
|
|
529
457
|
|
|
530
|
-
const
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
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,
|
|
537
481
|
reducers: {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
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
|
+
});
|
|
541
508
|
},
|
|
542
509
|
});
|
|
543
|
-
const selectors$1 = adapter.getSelectors((state) => state.entities.models);
|
|
544
|
-
const Model = {
|
|
545
|
-
slice: slice$2,
|
|
546
|
-
actions: Object.assign({}, slice$2.actions),
|
|
547
|
-
selectors: selectors$1,
|
|
548
|
-
};
|
|
549
510
|
|
|
550
|
-
const
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
const slice$1 = toolkit.createSlice({
|
|
554
|
-
name: 'toasts',
|
|
555
|
-
initialState: toastAdapter.getInitialState(),
|
|
556
|
-
reducers: {
|
|
557
|
-
addOne: toastAdapter.addOne,
|
|
558
|
-
removeOne: toastAdapter.removeOne,
|
|
559
|
-
},
|
|
511
|
+
const BookmarkReducer = redux.combineReducers({
|
|
512
|
+
[BookmarkListSlice.name]: BookmarkListSlice.reducer,
|
|
513
|
+
[BookmarkEditSlice.name]: BookmarkEditSlice.reducer,
|
|
560
514
|
});
|
|
561
|
-
const
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
if (type === void 0) { type = 'success'; }
|
|
565
|
-
if (timeout === void 0) { timeout = 3000; }
|
|
566
|
-
return (dispatch) => {
|
|
567
|
-
dispatch(slice$1.actions.addOne(Object.assign(Object.assign({ id }, toast), { timeout, type })));
|
|
568
|
-
setTimeout(() => {
|
|
569
|
-
dispatch(slice$1.actions.removeOne(id));
|
|
570
|
-
}, timeout);
|
|
571
|
-
return id;
|
|
572
|
-
};
|
|
573
|
-
};
|
|
574
|
-
const actions = {
|
|
575
|
-
addMessage,
|
|
576
|
-
success: (toast, timeout) => addMessage(toast, 'success', timeout),
|
|
577
|
-
warning: (toast, timeout) => addMessage(toast, 'warning', timeout),
|
|
578
|
-
error: (toast, timeout) => addMessage(toast, 'error', timeout),
|
|
515
|
+
const bookmarkSlice = {
|
|
516
|
+
name: 'bookmark',
|
|
517
|
+
reducer: BookmarkReducer,
|
|
579
518
|
};
|
|
580
|
-
const
|
|
581
|
-
const
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
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,
|
|
585
531
|
};
|
|
586
532
|
|
|
587
533
|
const extractJlandUrlBaseFromMap = (map) => {
|
|
@@ -817,7 +763,7 @@ const initialMap = {
|
|
|
817
763
|
illustration: '',
|
|
818
764
|
assignLicense: false,
|
|
819
765
|
};
|
|
820
|
-
const initialState$
|
|
766
|
+
const initialState$3 = {
|
|
821
767
|
map: Object.assign({}, initialMap),
|
|
822
768
|
loading: 'idle',
|
|
823
769
|
status: undefined,
|
|
@@ -861,13 +807,13 @@ const createMap = toolkit.createAsyncThunk('mapCreate/create', ({ map, jlandUrlB
|
|
|
861
807
|
}));
|
|
862
808
|
const MapCreateSlice = toolkit.createSlice({
|
|
863
809
|
name: 'mapCreate',
|
|
864
|
-
initialState: initialState$
|
|
810
|
+
initialState: initialState$3,
|
|
865
811
|
reducers: {
|
|
866
812
|
setMap: (state, action) => {
|
|
867
813
|
state.map = action.payload;
|
|
868
814
|
},
|
|
869
815
|
resetCreateMapState: () => {
|
|
870
|
-
return initialState$
|
|
816
|
+
return initialState$3;
|
|
871
817
|
},
|
|
872
818
|
},
|
|
873
819
|
extraReducers: (builder) => {
|
|
@@ -921,7 +867,27 @@ const jland = {
|
|
|
921
867
|
utils: { buildUrlToJland },
|
|
922
868
|
};
|
|
923
869
|
|
|
924
|
-
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 = {
|
|
925
891
|
id: 0,
|
|
926
892
|
mainType: 'user',
|
|
927
893
|
type: 'user',
|
|
@@ -934,7 +900,7 @@ const initialState = {
|
|
|
934
900
|
};
|
|
935
901
|
const slice = toolkit.createSlice({
|
|
936
902
|
name: 'userCurrent',
|
|
937
|
-
initialState,
|
|
903
|
+
initialState: initialState$2,
|
|
938
904
|
reducers: {
|
|
939
905
|
init: (_, { payload }) => {
|
|
940
906
|
return payload;
|
|
@@ -956,8 +922,339 @@ const UserCurrent = {
|
|
|
956
922
|
utils: { isAdmin },
|
|
957
923
|
};
|
|
958
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
|
+
|
|
959
1255
|
exports.Application = Application;
|
|
960
1256
|
exports.AssetReservation = AssetReservation;
|
|
1257
|
+
exports.Bookmark = Bookmark;
|
|
961
1258
|
exports.MODE_EDIT = MODE_EDIT;
|
|
962
1259
|
exports.MODE_VIEW = MODE_VIEW;
|
|
963
1260
|
exports.Model = Model;
|