jamespot-front-business 1.2.34 → 1.2.36
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 +665 -548
- package/dist/cjs.js.map +1 -1
- package/dist/esm.js +665 -542
- package/dist/esm.js.map +1 -1
- package/dist/types.d.ts +8113 -25506
- package/package.json +31 -32
- package/rollup.config.mjs +36 -0
- package/tsconfig.json +22 -8
package/dist/esm.js
CHANGED
|
@@ -3,54 +3,12 @@ import { combineReducers as combineReducers$1 } from 'redux';
|
|
|
3
3
|
import jamespot, { jEnsure, Format, formatImgUrl, UserLevel, WidgetsName, StudioApplicationStatus } from 'jamespot-user-api';
|
|
4
4
|
import { v4 } from 'uuid';
|
|
5
5
|
|
|
6
|
-
/******************************************************************************
|
|
7
|
-
Copyright (c) Microsoft Corporation.
|
|
8
|
-
|
|
9
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
10
|
-
purpose with or without fee is hereby granted.
|
|
11
|
-
|
|
12
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
13
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
14
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
15
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
16
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
17
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
18
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
19
|
-
***************************************************************************** */
|
|
20
|
-
|
|
21
|
-
function __rest(s, e) {
|
|
22
|
-
var t = {};
|
|
23
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
24
|
-
t[p] = s[p];
|
|
25
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
26
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
27
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
28
|
-
t[p[i]] = s[p[i]];
|
|
29
|
-
}
|
|
30
|
-
return t;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
34
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
35
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
36
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
37
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
38
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
39
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
44
|
-
var e = new Error(message);
|
|
45
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
6
|
const isAbortError = (error) => {
|
|
49
7
|
return !!error && typeof error === 'object' && 'aborted' in error && !!error.aborted;
|
|
50
8
|
};
|
|
51
9
|
const getErrorMessage = (error, defaultError) => {
|
|
52
10
|
if (!error || typeof error !== 'object') {
|
|
53
|
-
return defaultError
|
|
11
|
+
return defaultError ?? 'GLOBAL_Technical_Error';
|
|
54
12
|
}
|
|
55
13
|
if ('errorMsg' in error && typeof error.errorMsg === 'string') {
|
|
56
14
|
return error.errorMsg;
|
|
@@ -58,7 +16,7 @@ const getErrorMessage = (error, defaultError) => {
|
|
|
58
16
|
if ('message' in error && typeof error.message === 'string') {
|
|
59
17
|
return error.message;
|
|
60
18
|
}
|
|
61
|
-
return defaultError
|
|
19
|
+
return defaultError ?? 'GLOBAL_Technical_Error';
|
|
62
20
|
};
|
|
63
21
|
|
|
64
22
|
const toastAdapter = createEntityAdapter({
|
|
@@ -73,12 +31,10 @@ const slice$5 = createSlice({
|
|
|
73
31
|
},
|
|
74
32
|
});
|
|
75
33
|
const randomId = () => Math.random().toString(16).slice(2);
|
|
76
|
-
const addMessage = (
|
|
77
|
-
var { id = randomId() } = _a, toast = __rest(_a, ["id"]);
|
|
78
|
-
if (type === void 0) { type = 'success'; }
|
|
79
|
-
if (timeout === void 0) { timeout = 3000; }
|
|
34
|
+
const addMessage = ({ id = randomId(), ...toast }, type = 'success', timeout = 3000) => {
|
|
80
35
|
return (dispatch) => {
|
|
81
|
-
|
|
36
|
+
const t = { id, ...toast, timeout, type };
|
|
37
|
+
dispatch(slice$5.actions.addOne(t));
|
|
82
38
|
setTimeout(() => {
|
|
83
39
|
dispatch(slice$5.actions.removeOne(id));
|
|
84
40
|
}, timeout);
|
|
@@ -94,7 +50,7 @@ const actions = {
|
|
|
94
50
|
const selectors$3 = toastAdapter.getSelectors((state) => state.toasts);
|
|
95
51
|
const Toast = {
|
|
96
52
|
slice: slice$5,
|
|
97
|
-
actions:
|
|
53
|
+
actions: { ...actions, ...slice$5.actions },
|
|
98
54
|
selectors: selectors$3,
|
|
99
55
|
};
|
|
100
56
|
|
|
@@ -115,16 +71,16 @@ const initialState$s = {
|
|
|
115
71
|
value: {
|
|
116
72
|
start: formatDate$2(oneMonthAgo$2()),
|
|
117
73
|
end: formatDate$2(new Date()),
|
|
118
|
-
}
|
|
119
|
-
}
|
|
74
|
+
},
|
|
75
|
+
},
|
|
120
76
|
],
|
|
121
77
|
orders: [],
|
|
122
78
|
limit: 30,
|
|
123
79
|
nbResults: 0,
|
|
124
80
|
};
|
|
125
|
-
const fetchLogsNavigation = createAsyncThunk('admin/fetchLogsNavigation', (params, { extra, rejectWithValue, dispatch }) =>
|
|
81
|
+
const fetchLogsNavigation = createAsyncThunk('admin/fetchLogsNavigation', async (params, { extra, rejectWithValue, dispatch }) => {
|
|
126
82
|
try {
|
|
127
|
-
const logs = (
|
|
83
|
+
const logs = (await extra.jApi.admin.logs.getLogsNavigation(params)).result;
|
|
128
84
|
return logs;
|
|
129
85
|
}
|
|
130
86
|
catch (err) {
|
|
@@ -133,7 +89,7 @@ const fetchLogsNavigation = createAsyncThunk('admin/fetchLogsNavigation', (param
|
|
|
133
89
|
}
|
|
134
90
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve admin logs navigation' });
|
|
135
91
|
}
|
|
136
|
-
})
|
|
92
|
+
});
|
|
137
93
|
const adminLogsNavigationSlice = createSlice({
|
|
138
94
|
name: 'logsNavigation',
|
|
139
95
|
initialState: initialState$s,
|
|
@@ -155,10 +111,9 @@ const adminLogsNavigationSlice = createSlice({
|
|
|
155
111
|
state.loading = 'pending';
|
|
156
112
|
});
|
|
157
113
|
builder.addCase(fetchLogsNavigation.fulfilled, (state, action) => {
|
|
158
|
-
var _a;
|
|
159
114
|
state.data = action.payload.data;
|
|
160
115
|
state.nbResults = action.payload.cnt;
|
|
161
|
-
state.limit =
|
|
116
|
+
state.limit = action.payload.limit ?? 30;
|
|
162
117
|
state.page = action.payload.page;
|
|
163
118
|
state.loading = 'idle';
|
|
164
119
|
});
|
|
@@ -185,16 +140,16 @@ const initialState$r = {
|
|
|
185
140
|
value: {
|
|
186
141
|
start: formatDate$1(oneMonthAgo$1()),
|
|
187
142
|
end: formatDate$1(new Date()),
|
|
188
|
-
}
|
|
189
|
-
}
|
|
143
|
+
},
|
|
144
|
+
},
|
|
190
145
|
],
|
|
191
146
|
orders: [],
|
|
192
147
|
limit: 30,
|
|
193
148
|
nbResults: 0,
|
|
194
149
|
};
|
|
195
|
-
const fetchLogsObjects = createAsyncThunk('admin/fetchLogsObjects', (params, { extra, rejectWithValue, dispatch }) =>
|
|
150
|
+
const fetchLogsObjects = createAsyncThunk('admin/fetchLogsObjects', async (params, { extra, rejectWithValue, dispatch }) => {
|
|
196
151
|
try {
|
|
197
|
-
const logs = (
|
|
152
|
+
const logs = (await extra.jApi.admin.logs.getLogsObjects(params)).result;
|
|
198
153
|
return logs;
|
|
199
154
|
}
|
|
200
155
|
catch (err) {
|
|
@@ -203,7 +158,7 @@ const fetchLogsObjects = createAsyncThunk('admin/fetchLogsObjects', (params, { e
|
|
|
203
158
|
}
|
|
204
159
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve admin logs Objects' });
|
|
205
160
|
}
|
|
206
|
-
})
|
|
161
|
+
});
|
|
207
162
|
const adminLogsObjectsSlice = createSlice({
|
|
208
163
|
name: 'logsObjects',
|
|
209
164
|
initialState: initialState$r,
|
|
@@ -254,16 +209,16 @@ const initialState$q = {
|
|
|
254
209
|
value: {
|
|
255
210
|
start: formatDate(oneMonthAgo()),
|
|
256
211
|
end: formatDate(new Date()),
|
|
257
|
-
}
|
|
258
|
-
}
|
|
212
|
+
},
|
|
213
|
+
},
|
|
259
214
|
],
|
|
260
215
|
orders: [],
|
|
261
216
|
limit: 30,
|
|
262
217
|
nbResults: 0,
|
|
263
218
|
};
|
|
264
|
-
const fetchLogsSearch = createAsyncThunk('admin/fetchLogsSearch', (params, { extra, rejectWithValue, dispatch }) =>
|
|
219
|
+
const fetchLogsSearch = createAsyncThunk('admin/fetchLogsSearch', async (params, { extra, rejectWithValue, dispatch }) => {
|
|
265
220
|
try {
|
|
266
|
-
const logs = (
|
|
221
|
+
const logs = (await extra.jApi.admin.logs.getLogsSearch(params)).result;
|
|
267
222
|
return logs;
|
|
268
223
|
}
|
|
269
224
|
catch (err) {
|
|
@@ -272,7 +227,7 @@ const fetchLogsSearch = createAsyncThunk('admin/fetchLogsSearch', (params, { ext
|
|
|
272
227
|
}
|
|
273
228
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve admin logs Search' });
|
|
274
229
|
}
|
|
275
|
-
})
|
|
230
|
+
});
|
|
276
231
|
const adminLogsSearchSlice = createSlice({
|
|
277
232
|
name: 'logsSearch',
|
|
278
233
|
initialState: initialState$q,
|
|
@@ -294,10 +249,9 @@ const adminLogsSearchSlice = createSlice({
|
|
|
294
249
|
state.loading = 'pending';
|
|
295
250
|
});
|
|
296
251
|
builder.addCase(fetchLogsSearch.fulfilled, (state, action) => {
|
|
297
|
-
var _a;
|
|
298
252
|
state.data = action.payload.data;
|
|
299
253
|
state.nbResults = action.payload.cnt;
|
|
300
|
-
state.limit =
|
|
254
|
+
state.limit = action.payload.limit ?? 30;
|
|
301
255
|
state.page = action.payload.page;
|
|
302
256
|
state.loading = 'idle';
|
|
303
257
|
});
|
|
@@ -322,9 +276,14 @@ const adminLogsSlice = {
|
|
|
322
276
|
const adminLogsReducer = adminLogsSlice.reducer;
|
|
323
277
|
const AdminLogs = {
|
|
324
278
|
slice: adminLogsSlice,
|
|
325
|
-
actions:
|
|
279
|
+
actions: {
|
|
280
|
+
...adminLogsNavigationSlice.actions,
|
|
281
|
+
...adminLogsObjectsSlice.actions,
|
|
282
|
+
...adminLogsSearchSlice.actions,
|
|
283
|
+
fetchLogsNavigation,
|
|
326
284
|
fetchLogsObjects,
|
|
327
|
-
fetchLogsSearch
|
|
285
|
+
fetchLogsSearch,
|
|
286
|
+
},
|
|
328
287
|
selectors: { selectAdminLogsNavigation, selectAdminLogsObjects, selectAdminLogsSearch },
|
|
329
288
|
};
|
|
330
289
|
|
|
@@ -360,10 +319,10 @@ const animationsListSlice = createSlice({
|
|
|
360
319
|
});
|
|
361
320
|
},
|
|
362
321
|
});
|
|
363
|
-
const fetchCurrentAnimation = createAsyncThunk('animations/fetchCurrentAnimation', (_, { extra, rejectWithValue, dispatch, signal }) =>
|
|
322
|
+
const fetchCurrentAnimation = createAsyncThunk('animations/fetchCurrentAnimation', async (_, { extra, rejectWithValue, dispatch, signal }) => {
|
|
364
323
|
try {
|
|
365
|
-
const animationConfiguration = (
|
|
366
|
-
const isActiveForCurrentUser = (
|
|
324
|
+
const animationConfiguration = (await extra.jApi.animations.GetCurrentAnimation({ signal })).result;
|
|
325
|
+
const isActiveForCurrentUser = (await extra.jApi.animations.GetAnimationActive({ signal })).result;
|
|
367
326
|
return { animationConfiguration, isActiveForCurrentUser, isInitialized: true };
|
|
368
327
|
}
|
|
369
328
|
catch (err) {
|
|
@@ -372,46 +331,46 @@ const fetchCurrentAnimation = createAsyncThunk('animations/fetchCurrentAnimation
|
|
|
372
331
|
}
|
|
373
332
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation' });
|
|
374
333
|
}
|
|
375
|
-
})
|
|
376
|
-
const fetchCurrentAnimationApp = createAsyncThunk('animations/fetchCurrentAnimationApp', (_, { extra, rejectWithValue, dispatch }) =>
|
|
334
|
+
});
|
|
335
|
+
const fetchCurrentAnimationApp = createAsyncThunk('animations/fetchCurrentAnimationApp', async (_, { extra, rejectWithValue, dispatch }) => {
|
|
377
336
|
try {
|
|
378
|
-
return (
|
|
337
|
+
return (await extra.jApi.animations.GetCurrentAnimationApp()).result;
|
|
379
338
|
}
|
|
380
339
|
catch (err) {
|
|
381
340
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
382
341
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation' });
|
|
383
342
|
}
|
|
384
|
-
})
|
|
385
|
-
const deleteCurrentAnimation = createAsyncThunk('animations/deleteCurrentAnimation', (_, { extra, rejectWithValue, dispatch }) =>
|
|
343
|
+
});
|
|
344
|
+
const deleteCurrentAnimation = createAsyncThunk('animations/deleteCurrentAnimation', async (_, { extra, rejectWithValue, dispatch }) => {
|
|
386
345
|
try {
|
|
387
|
-
|
|
346
|
+
await extra.jApi.animations.DeleteAnimation();
|
|
388
347
|
return;
|
|
389
348
|
}
|
|
390
349
|
catch (err) {
|
|
391
350
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
392
351
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot delete animation' });
|
|
393
352
|
}
|
|
394
|
-
})
|
|
395
|
-
const saveCurrentAnimation = createAsyncThunk('animations/saveCurrentAnimation', (params, { extra, rejectWithValue, dispatch }) =>
|
|
353
|
+
});
|
|
354
|
+
const saveCurrentAnimation = createAsyncThunk('animations/saveCurrentAnimation', async (params, { extra, rejectWithValue, dispatch }) => {
|
|
396
355
|
try {
|
|
397
|
-
|
|
356
|
+
await extra.jApi.animations.SaveAnimationConfiguration(params);
|
|
398
357
|
return;
|
|
399
358
|
}
|
|
400
359
|
catch (err) {
|
|
401
360
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
402
361
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot update animation' });
|
|
403
362
|
}
|
|
404
|
-
})
|
|
405
|
-
const toggleAnimationIsActive = createAsyncThunk('animations/toggleAnimationIsActive', (_, { extra, rejectWithValue, dispatch }) =>
|
|
363
|
+
});
|
|
364
|
+
const toggleAnimationIsActive = createAsyncThunk('animations/toggleAnimationIsActive', async (_, { extra, rejectWithValue, dispatch }) => {
|
|
406
365
|
try {
|
|
407
|
-
|
|
366
|
+
await extra.jApi.animations.ToggleAnimationActive();
|
|
408
367
|
return;
|
|
409
368
|
}
|
|
410
369
|
catch (err) {
|
|
411
370
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
412
371
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot update animation' });
|
|
413
372
|
}
|
|
414
|
-
})
|
|
373
|
+
});
|
|
415
374
|
|
|
416
375
|
const getAnimationsRTHandlers = function (dispatch) {
|
|
417
376
|
const addAnimationHandler = function (message) {
|
|
@@ -450,16 +409,16 @@ const getAnimationsRTHandlers = function (dispatch) {
|
|
|
450
409
|
];
|
|
451
410
|
};
|
|
452
411
|
|
|
453
|
-
const fetchAnimationStats = createAsyncThunk('animations/fetchAnimationStats', ({ name }, { extra, rejectWithValue, dispatch }) =>
|
|
412
|
+
const fetchAnimationStats = createAsyncThunk('animations/fetchAnimationStats', async ({ name }, { extra, rejectWithValue, dispatch }) => {
|
|
454
413
|
try {
|
|
455
|
-
const stats = (
|
|
414
|
+
const stats = (await extra.jApi.animations.GetAnimationStats(name)).result.data;
|
|
456
415
|
return stats;
|
|
457
416
|
}
|
|
458
417
|
catch (err) {
|
|
459
418
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
460
419
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation stats' });
|
|
461
420
|
}
|
|
462
|
-
})
|
|
421
|
+
});
|
|
463
422
|
const animationStatsInitialState$1 = {
|
|
464
423
|
stats: [],
|
|
465
424
|
loading: 'idle',
|
|
@@ -482,16 +441,16 @@ const animationStatsSlice = createSlice({
|
|
|
482
441
|
},
|
|
483
442
|
});
|
|
484
443
|
|
|
485
|
-
const fetchAnimationStatsCurrent = createAsyncThunk('animations/fetchAnimationStatsCurrent', (uri, { extra, rejectWithValue, dispatch }) =>
|
|
444
|
+
const fetchAnimationStatsCurrent = createAsyncThunk('animations/fetchAnimationStatsCurrent', async (uri, { extra, rejectWithValue, dispatch }) => {
|
|
486
445
|
try {
|
|
487
|
-
const stats = (
|
|
446
|
+
const stats = (await extra.jApi.animations.GetAnimationStatsCurrent(uri)).result;
|
|
488
447
|
return stats;
|
|
489
448
|
}
|
|
490
449
|
catch (err) {
|
|
491
450
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
492
451
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation stats current' });
|
|
493
452
|
}
|
|
494
|
-
})
|
|
453
|
+
});
|
|
495
454
|
const animationStatsInitialState = {
|
|
496
455
|
stats: null,
|
|
497
456
|
loading: 'idle',
|
|
@@ -547,9 +506,9 @@ const adapter$2 = createEntityAdapter({
|
|
|
547
506
|
selectId: (app) => app.name,
|
|
548
507
|
sortComparer: (a, b) => a.label.localeCompare(b.label),
|
|
549
508
|
});
|
|
550
|
-
const fetchList = createAsyncThunk('application/fetch', (_, { extra }) =>
|
|
551
|
-
return
|
|
552
|
-
})
|
|
509
|
+
const fetchList = createAsyncThunk('application/fetch', async (_, { extra }) => {
|
|
510
|
+
return await extra.jApi.application.list();
|
|
511
|
+
});
|
|
553
512
|
const slice$4 = createSlice({
|
|
554
513
|
name: 'applications',
|
|
555
514
|
initialState: adapter$2.getInitialState(),
|
|
@@ -567,7 +526,7 @@ const slice$4 = createSlice({
|
|
|
567
526
|
const selectors$2 = adapter$2.getSelectors((state) => state.entities.applications);
|
|
568
527
|
const Application = {
|
|
569
528
|
slice: slice$4,
|
|
570
|
-
actions:
|
|
529
|
+
actions: { fetchList, ...slice$4.actions },
|
|
571
530
|
selectors: selectors$2,
|
|
572
531
|
};
|
|
573
532
|
|
|
@@ -576,15 +535,15 @@ const initialState$o = {
|
|
|
576
535
|
loading: 'idle',
|
|
577
536
|
nbResults: 0,
|
|
578
537
|
};
|
|
579
|
-
const fetchBookableAsset = createAsyncThunk('BookableAsset/fetchBookableAsset', (_, { extra }) =>
|
|
538
|
+
const fetchBookableAsset = createAsyncThunk('BookableAsset/fetchBookableAsset', async (_, { extra }) => {
|
|
580
539
|
const filterSpec = {
|
|
581
540
|
type: 'bookableAsset',
|
|
582
541
|
format: 'raw-list',
|
|
583
542
|
limit: 50,
|
|
584
543
|
public: true,
|
|
585
544
|
};
|
|
586
|
-
return
|
|
587
|
-
})
|
|
545
|
+
return await extra.jApi.article.list(filterSpec);
|
|
546
|
+
});
|
|
588
547
|
const BookableAssetSlice = createSlice({
|
|
589
548
|
name: 'bookableAsset',
|
|
590
549
|
initialState: initialState$o,
|
|
@@ -605,9 +564,9 @@ const BookableAssetSlice = createSlice({
|
|
|
605
564
|
},
|
|
606
565
|
});
|
|
607
566
|
|
|
608
|
-
const fetchConfiguration = createAsyncThunk('AssetReservation/configuration', (_, { extra }) =>
|
|
609
|
-
return
|
|
610
|
-
})
|
|
567
|
+
const fetchConfiguration = createAsyncThunk('AssetReservation/configuration', async (_, { extra }) => {
|
|
568
|
+
return await extra.jApi.assetReservation.configuration();
|
|
569
|
+
});
|
|
611
570
|
const initialState$n = {
|
|
612
571
|
description: '',
|
|
613
572
|
right: {
|
|
@@ -630,7 +589,10 @@ const AssetReservationConfigurationSlice = createSlice({
|
|
|
630
589
|
state.loading = 'pending';
|
|
631
590
|
})
|
|
632
591
|
.addCase(fetchConfiguration.fulfilled, (_, action) => {
|
|
633
|
-
return
|
|
592
|
+
return {
|
|
593
|
+
...action.payload.result,
|
|
594
|
+
loading: 'idle',
|
|
595
|
+
};
|
|
634
596
|
})
|
|
635
597
|
.addCase(fetchConfiguration.rejected, (state) => {
|
|
636
598
|
state.loading = 'idle';
|
|
@@ -649,14 +611,14 @@ const initialState$m = {
|
|
|
649
611
|
nbResults: 0,
|
|
650
612
|
form: initForm,
|
|
651
613
|
};
|
|
652
|
-
const fetchReservation = createAsyncThunk('Reservation/fetchReservation', (viewMode, { extra }) =>
|
|
614
|
+
const fetchReservation = createAsyncThunk('Reservation/fetchReservation', async (viewMode, { extra }) => {
|
|
653
615
|
const filterSpec = {
|
|
654
616
|
format: 'raw-list',
|
|
655
617
|
limit: 50,
|
|
656
618
|
viewMode: viewMode === 'history' ? 'history' : undefined,
|
|
657
619
|
};
|
|
658
|
-
return
|
|
659
|
-
})
|
|
620
|
+
return await extra.jApi.assetReservation.getList(filterSpec);
|
|
621
|
+
});
|
|
660
622
|
const ReservationSlice = createSlice({
|
|
661
623
|
name: 'reservation',
|
|
662
624
|
initialState: initialState$m,
|
|
@@ -704,7 +666,7 @@ const selectReservationLoading = (state) => state.assetReservation.reservation.l
|
|
|
704
666
|
const selectReservationForm = (state) => state.assetReservation.reservation.form;
|
|
705
667
|
const AssetReservation = {
|
|
706
668
|
slice: assetReservationSlice,
|
|
707
|
-
actions:
|
|
669
|
+
actions: { ...ReservationSlice.actions, fetchBookableAsset, fetchConfiguration, fetchReservation },
|
|
708
670
|
selectors: {
|
|
709
671
|
configuration: selectConfiguration,
|
|
710
672
|
bookableAssetEntities: selectBookableAssetEntities,
|
|
@@ -766,11 +728,14 @@ const contentReportSlice = createSlice({
|
|
|
766
728
|
.addCase(updateStatus.pending, (state, action) => {
|
|
767
729
|
const report = state.reports.find((report) => report.uri === action.meta.arg.uri);
|
|
768
730
|
if (report) {
|
|
769
|
-
state.pendingReports = [...state.pendingReports,
|
|
731
|
+
state.pendingReports = [...state.pendingReports, { ...report, requestId: action.meta.requestId }];
|
|
770
732
|
state.reports = state.reports.map((report) => {
|
|
771
733
|
return report.uri !== action.meta.arg.uri
|
|
772
734
|
? report
|
|
773
|
-
:
|
|
735
|
+
: {
|
|
736
|
+
...report,
|
|
737
|
+
status: action.meta.arg.status,
|
|
738
|
+
};
|
|
774
739
|
});
|
|
775
740
|
}
|
|
776
741
|
})
|
|
@@ -790,14 +755,15 @@ const contentReportSlice = createSlice({
|
|
|
790
755
|
});
|
|
791
756
|
},
|
|
792
757
|
});
|
|
793
|
-
const fetchReports = createAsyncThunk('contentReport/fetchReports', (_params, { rejectWithValue, extra, dispatch, getState }) =>
|
|
794
|
-
var _a;
|
|
758
|
+
const fetchReports = createAsyncThunk('contentReport/fetchReports', async (_params, { rejectWithValue, extra, dispatch, getState }) => {
|
|
795
759
|
const state = getState().contentReport;
|
|
796
|
-
const userId =
|
|
760
|
+
const userId = getState().userCurrent?.id;
|
|
797
761
|
try {
|
|
798
|
-
const filters = state.tab === 'my' && userId
|
|
762
|
+
const filters = state.tab === 'my' && userId
|
|
763
|
+
? [...state.filters, { name: 'idUser', value: userId }]
|
|
764
|
+
: [...state.filters];
|
|
799
765
|
const orders = state.orders.length > 0 ? state.orders : [{ name: 'dateCreation', sort: 'DESC' }];
|
|
800
|
-
return (
|
|
766
|
+
return (await extra.jApi.contentReport.getReports({
|
|
801
767
|
filters,
|
|
802
768
|
orders,
|
|
803
769
|
page: state.page,
|
|
@@ -810,10 +776,10 @@ const fetchReports = createAsyncThunk('contentReport/fetchReports', (_params, {
|
|
|
810
776
|
}
|
|
811
777
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot fetch pads' });
|
|
812
778
|
}
|
|
813
|
-
})
|
|
814
|
-
const updateStatus = createAsyncThunk('contentReport/updateStatus', (params, { dispatch, rejectWithValue, extra }) =>
|
|
779
|
+
});
|
|
780
|
+
const updateStatus = createAsyncThunk('contentReport/updateStatus', async (params, { dispatch, rejectWithValue, extra }) => {
|
|
815
781
|
try {
|
|
816
|
-
|
|
782
|
+
await extra.jApi.contentReport.updateStatus(params);
|
|
817
783
|
dispatch(Toast.actions.success({ label: 'GLOBAL_Successfully_Saved' }));
|
|
818
784
|
return true;
|
|
819
785
|
}
|
|
@@ -823,7 +789,7 @@ const updateStatus = createAsyncThunk('contentReport/updateStatus', (params, { d
|
|
|
823
789
|
}
|
|
824
790
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot fetch pads' });
|
|
825
791
|
}
|
|
826
|
-
})
|
|
792
|
+
});
|
|
827
793
|
const selectContentReport = (state) => state.contentReport;
|
|
828
794
|
const ContentReport = {
|
|
829
795
|
slice: contentReportSlice,
|
|
@@ -847,24 +813,24 @@ const initialState$k = {
|
|
|
847
813
|
},
|
|
848
814
|
delete: {},
|
|
849
815
|
};
|
|
850
|
-
const fetchBookmark = createAsyncThunk('bookmarkList/fetchbookmarkList', (_, { extra, rejectWithValue, dispatch }) =>
|
|
816
|
+
const fetchBookmark = createAsyncThunk('bookmarkList/fetchbookmarkList', async (_, { extra, rejectWithValue, dispatch }) => {
|
|
851
817
|
const filterSpec = { limit: 999 };
|
|
852
818
|
try {
|
|
853
|
-
return
|
|
819
|
+
return await extra.jApi.bookmark.getFormattedList(filterSpec, 'raw-list');
|
|
854
820
|
}
|
|
855
821
|
catch (err) {
|
|
856
822
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
857
823
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve bookmarks' });
|
|
858
824
|
}
|
|
859
|
-
})
|
|
860
|
-
const addBookmark = createAsyncThunk('bookmarkList/addBookmark', (bookmark, { extra, rejectWithValue, dispatch }) =>
|
|
825
|
+
});
|
|
826
|
+
const addBookmark = createAsyncThunk('bookmarkList/addBookmark', async (bookmark, { extra, rejectWithValue, dispatch }) => {
|
|
861
827
|
try {
|
|
862
828
|
if (jEnsure.isBookmarkLink(bookmark)) {
|
|
863
|
-
const result =
|
|
829
|
+
const result = await extra.jApi.bookmark.addFormattedLink(bookmark.targetId, bookmark.targetType, 'raw-list');
|
|
864
830
|
return result;
|
|
865
831
|
}
|
|
866
832
|
else {
|
|
867
|
-
const result =
|
|
833
|
+
const result = await extra.jApi.bookmark.addBookmark(bookmark);
|
|
868
834
|
return result;
|
|
869
835
|
}
|
|
870
836
|
}
|
|
@@ -873,27 +839,27 @@ const addBookmark = createAsyncThunk('bookmarkList/addBookmark', (bookmark, { ex
|
|
|
873
839
|
dispatch(Toast.actions.error({ label: toastLabel }));
|
|
874
840
|
return rejectWithValue({ error: 1, errorMsg: 'Error saving bookmark' });
|
|
875
841
|
}
|
|
876
|
-
})
|
|
877
|
-
const moveBookmark = createAsyncThunk('bookmarkList/moveBookmark', ({ bookmark, bookmarkReference, position }, { extra, rejectWithValue, dispatch }) =>
|
|
842
|
+
});
|
|
843
|
+
const moveBookmark = createAsyncThunk('bookmarkList/moveBookmark', async ({ bookmark, bookmarkReference, position }, { extra, rejectWithValue, dispatch }) => {
|
|
878
844
|
try {
|
|
879
|
-
|
|
845
|
+
await extra.jApi.bookmark.move(bookmark.id, bookmarkReference.id, position);
|
|
880
846
|
return;
|
|
881
847
|
}
|
|
882
848
|
catch (err) {
|
|
883
849
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
884
850
|
return rejectWithValue({ error: 1, errorMsg: 'Error moving bookmark' });
|
|
885
851
|
}
|
|
886
|
-
})
|
|
887
|
-
const deleteBookmark = createAsyncThunk('bookmarkList/deleteBookmark', (bookmark, { extra, rejectWithValue, dispatch }) =>
|
|
852
|
+
});
|
|
853
|
+
const deleteBookmark = createAsyncThunk('bookmarkList/deleteBookmark', async (bookmark, { extra, rejectWithValue, dispatch }) => {
|
|
888
854
|
try {
|
|
889
|
-
|
|
855
|
+
await extra.jApi.bookmark.delete(bookmark.id);
|
|
890
856
|
return;
|
|
891
857
|
}
|
|
892
858
|
catch (err) {
|
|
893
859
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
894
860
|
return rejectWithValue({ error: 1, errorMsg: 'Error deleting bookmark' });
|
|
895
861
|
}
|
|
896
|
-
})
|
|
862
|
+
});
|
|
897
863
|
const BookmarkListSlice = createSlice({
|
|
898
864
|
name: 'bookmarkList',
|
|
899
865
|
initialState: initialState$k,
|
|
@@ -914,7 +880,7 @@ const BookmarkListSlice = createSlice({
|
|
|
914
880
|
},
|
|
915
881
|
addBookmarkRT: (state, action) => {
|
|
916
882
|
state.bookmarks.push(action.payload);
|
|
917
|
-
state.bookmarks.sort((a, b) =>
|
|
883
|
+
state.bookmarks.sort((a, b) => (a.bookmarkOrder ?? 0) - (b.bookmarkOrder ?? 0));
|
|
918
884
|
},
|
|
919
885
|
deleteBookmarkRT: (state, action) => {
|
|
920
886
|
state.bookmarks = state.bookmarks.filter((bookmark) => bookmark.id !== action.payload.id);
|
|
@@ -922,7 +888,7 @@ const BookmarkListSlice = createSlice({
|
|
|
922
888
|
updateBookmarkRT: (state, action) => {
|
|
923
889
|
state.bookmarks = state.bookmarks
|
|
924
890
|
.map((bookmark) => (bookmark.id === action.payload.id ? action.payload : bookmark))
|
|
925
|
-
.sort((a, b) =>
|
|
891
|
+
.sort((a, b) => (a.bookmarkOrder ?? 0) - (b.bookmarkOrder ?? 0));
|
|
926
892
|
},
|
|
927
893
|
},
|
|
928
894
|
extraReducers: (builder) => {
|
|
@@ -1064,27 +1030,26 @@ const initialState$j = {
|
|
|
1064
1030
|
status: undefined,
|
|
1065
1031
|
loading: 'idle',
|
|
1066
1032
|
};
|
|
1067
|
-
const editBookmark = createAsyncThunk('bookmarkEdit/editBookmark', (bookmark, { extra, rejectWithValue }) =>
|
|
1068
|
-
var _a, _b;
|
|
1033
|
+
const editBookmark = createAsyncThunk('bookmarkEdit/editBookmark', async (bookmark, { extra, rejectWithValue }) => {
|
|
1069
1034
|
if (!bookmark.id) {
|
|
1070
1035
|
return rejectWithValue({ error: 1, errorMsg: 'Bookmark id is required' });
|
|
1071
1036
|
}
|
|
1072
|
-
const bookmarkLabel =
|
|
1073
|
-
const bookmarkUrl =
|
|
1037
|
+
const bookmarkLabel = bookmark.bookmarkLabel ?? '';
|
|
1038
|
+
const bookmarkUrl = bookmark.bookmarkUrl ?? '';
|
|
1074
1039
|
try {
|
|
1075
|
-
|
|
1040
|
+
await extra.jApi.bookmark.rename(bookmark.id, bookmarkLabel, bookmarkUrl);
|
|
1076
1041
|
}
|
|
1077
1042
|
catch (rejectValue) {
|
|
1078
1043
|
return rejectWithValue({ error: 2, errorMsg: 'Error saving bookmark' });
|
|
1079
1044
|
}
|
|
1080
1045
|
return;
|
|
1081
|
-
})
|
|
1046
|
+
});
|
|
1082
1047
|
const BookmarkEditSlice = createSlice({
|
|
1083
1048
|
name: 'bookmarkEdit',
|
|
1084
1049
|
initialState: initialState$j,
|
|
1085
1050
|
reducers: {
|
|
1086
1051
|
setEditBookmark: (state, action) => {
|
|
1087
|
-
state.bookmark =
|
|
1052
|
+
state.bookmark = { ...action.payload };
|
|
1088
1053
|
},
|
|
1089
1054
|
unsetEditBookmark: (state) => {
|
|
1090
1055
|
state.bookmark = undefined;
|
|
@@ -1126,11 +1091,15 @@ const selectBookmarkEditBookmark = (state) => state.bookmark.bookmarkEdit.bookma
|
|
|
1126
1091
|
const selectBookmarkByArticleId = (state, idArticle) => state.bookmark.bookmarkList.bookmarks.find((bookmark) => bookmark.targetId === idArticle);
|
|
1127
1092
|
const Bookmark = {
|
|
1128
1093
|
slice: bookmarkSlice,
|
|
1129
|
-
actions:
|
|
1094
|
+
actions: {
|
|
1095
|
+
fetchBookmark,
|
|
1130
1096
|
addBookmark,
|
|
1131
1097
|
moveBookmark,
|
|
1132
1098
|
deleteBookmark,
|
|
1133
|
-
editBookmark
|
|
1099
|
+
editBookmark,
|
|
1100
|
+
...BookmarkEditSlice.actions,
|
|
1101
|
+
...BookmarkListSlice.actions,
|
|
1102
|
+
},
|
|
1134
1103
|
selectors: {
|
|
1135
1104
|
bookmarkList: selectBookmarkList,
|
|
1136
1105
|
bookmarkListIsInitialized: selectBookmarkListIsInitialized,
|
|
@@ -1144,9 +1113,9 @@ const initialState$i = {
|
|
|
1144
1113
|
loading: 'idle',
|
|
1145
1114
|
comments: [],
|
|
1146
1115
|
};
|
|
1147
|
-
const fetchComments = createAsyncThunk('commentList/fetchCommentList', (params, { extra, rejectWithValue, dispatch }) =>
|
|
1116
|
+
const fetchComments = createAsyncThunk('commentList/fetchCommentList', async (params, { extra, rejectWithValue, dispatch }) => {
|
|
1148
1117
|
try {
|
|
1149
|
-
const res =
|
|
1118
|
+
const res = await extra.jApi.article.getComments(params, {
|
|
1150
1119
|
format: 'raw-list',
|
|
1151
1120
|
formatExtension: ['actions'],
|
|
1152
1121
|
});
|
|
@@ -1156,17 +1125,17 @@ const fetchComments = createAsyncThunk('commentList/fetchCommentList', (params,
|
|
|
1156
1125
|
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
1157
1126
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve comments' });
|
|
1158
1127
|
}
|
|
1159
|
-
})
|
|
1160
|
-
const deleteComment = createAsyncThunk('commentList/deleteComment', (params, { extra, rejectWithValue, dispatch }) =>
|
|
1128
|
+
});
|
|
1129
|
+
const deleteComment = createAsyncThunk('commentList/deleteComment', async (params, { extra, rejectWithValue, dispatch }) => {
|
|
1161
1130
|
try {
|
|
1162
|
-
|
|
1131
|
+
await extra.jApi.article.deleteComment(params.idComment);
|
|
1163
1132
|
return true;
|
|
1164
1133
|
}
|
|
1165
1134
|
catch (error) {
|
|
1166
1135
|
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
1167
1136
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot delete comment' });
|
|
1168
1137
|
}
|
|
1169
|
-
})
|
|
1138
|
+
});
|
|
1170
1139
|
const CommentListSlice = createSlice({
|
|
1171
1140
|
name: 'commentList',
|
|
1172
1141
|
initialState: initialState$i,
|
|
@@ -1194,14 +1163,22 @@ const CommentListSlice = createSlice({
|
|
|
1194
1163
|
const safeList = Array.isArray(list) ? list.filter((el) => !allUris.includes(el.uri)) : [];
|
|
1195
1164
|
state.comments = state.comments.map((c) => {
|
|
1196
1165
|
return c.idArticle === idArticle
|
|
1197
|
-
?
|
|
1166
|
+
? {
|
|
1167
|
+
...c,
|
|
1168
|
+
list: Array.isArray(c.list) ? [...c.list, ...safeList] : [...safeList],
|
|
1169
|
+
}
|
|
1170
|
+
: c;
|
|
1198
1171
|
});
|
|
1199
1172
|
},
|
|
1200
1173
|
updateComment: (state, action) => {
|
|
1201
1174
|
state.comments = state.comments.map((c) => {
|
|
1202
1175
|
const { idArticle, idComment, data } = action.payload;
|
|
1203
1176
|
return c.idArticle === idArticle
|
|
1204
|
-
?
|
|
1177
|
+
? {
|
|
1178
|
+
...c,
|
|
1179
|
+
list: c.list.map((comment) => comment.id === idComment ? { ...comment, description: data.description } : comment),
|
|
1180
|
+
}
|
|
1181
|
+
: c;
|
|
1205
1182
|
});
|
|
1206
1183
|
},
|
|
1207
1184
|
},
|
|
@@ -1228,7 +1205,10 @@ const CommentListSlice = createSlice({
|
|
|
1228
1205
|
if (c.idArticle !== action.meta.arg.idArticle) {
|
|
1229
1206
|
return c;
|
|
1230
1207
|
}
|
|
1231
|
-
return
|
|
1208
|
+
return {
|
|
1209
|
+
...c,
|
|
1210
|
+
list: c.list.map((comment) => comment.id === action.meta.arg.idComment ? { ...comment, pending: true } : comment),
|
|
1211
|
+
};
|
|
1232
1212
|
});
|
|
1233
1213
|
})
|
|
1234
1214
|
.addCase(deleteComment.rejected, (state, action) => {
|
|
@@ -1236,7 +1216,10 @@ const CommentListSlice = createSlice({
|
|
|
1236
1216
|
if (c.idArticle !== action.meta.arg.idArticle) {
|
|
1237
1217
|
return c;
|
|
1238
1218
|
}
|
|
1239
|
-
return
|
|
1219
|
+
return {
|
|
1220
|
+
...c,
|
|
1221
|
+
list: c.list.map((comment) => comment.id === action.meta.arg.idComment ? { ...comment, pending: false } : comment),
|
|
1222
|
+
};
|
|
1240
1223
|
});
|
|
1241
1224
|
});
|
|
1242
1225
|
},
|
|
@@ -1304,7 +1287,7 @@ const selectCommentList = (state, idArticle, limit = 0) => {
|
|
|
1304
1287
|
};
|
|
1305
1288
|
const Comment = {
|
|
1306
1289
|
slice: commentSlice,
|
|
1307
|
-
actions:
|
|
1290
|
+
actions: { fetchComments, deleteComment, ...CommentListSlice.actions },
|
|
1308
1291
|
selectors: {
|
|
1309
1292
|
commentList: selectCommentList,
|
|
1310
1293
|
},
|
|
@@ -1349,10 +1332,10 @@ const initialState$h = {
|
|
|
1349
1332
|
extraBot: undefined,
|
|
1350
1333
|
},
|
|
1351
1334
|
};
|
|
1352
|
-
const fetchExtraBotListAll = createAsyncThunk('extraBot/fetchAll', (_, { extra, rejectWithValue, dispatch, getState }) =>
|
|
1335
|
+
const fetchExtraBotListAll = createAsyncThunk('extraBot/fetchAll', async (_, { extra, rejectWithValue, dispatch, getState }) => {
|
|
1353
1336
|
const state = getState().extraBot.listAll;
|
|
1354
1337
|
try {
|
|
1355
|
-
return (
|
|
1338
|
+
return (await extra.jApi.extraBot.list('all', {
|
|
1356
1339
|
limit: state.limit,
|
|
1357
1340
|
page: state.page,
|
|
1358
1341
|
filters: state.filters,
|
|
@@ -1365,11 +1348,11 @@ const fetchExtraBotListAll = createAsyncThunk('extraBot/fetchAll', (_, { extra,
|
|
|
1365
1348
|
}
|
|
1366
1349
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve extra bot list' });
|
|
1367
1350
|
}
|
|
1368
|
-
})
|
|
1369
|
-
const fetchExtraBotListMines = createAsyncThunk('extraBot/fetchMines', (_, { extra, rejectWithValue, dispatch, getState }) =>
|
|
1351
|
+
});
|
|
1352
|
+
const fetchExtraBotListMines = createAsyncThunk('extraBot/fetchMines', async (_, { extra, rejectWithValue, dispatch, getState }) => {
|
|
1370
1353
|
const state = getState().extraBot.listMines;
|
|
1371
1354
|
try {
|
|
1372
|
-
return (
|
|
1355
|
+
return (await extra.jApi.extraBot.list('mines', {
|
|
1373
1356
|
limit: state.limit,
|
|
1374
1357
|
page: state.page,
|
|
1375
1358
|
filters: state.filters,
|
|
@@ -1382,14 +1365,16 @@ const fetchExtraBotListMines = createAsyncThunk('extraBot/fetchMines', (_, { ext
|
|
|
1382
1365
|
}
|
|
1383
1366
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve extra bot list' });
|
|
1384
1367
|
}
|
|
1385
|
-
})
|
|
1386
|
-
const toggleExtraBotActivation = createAsyncThunk('extraBot/toggleActivation', (extraBot, { extra, rejectWithValue, dispatch }) =>
|
|
1368
|
+
});
|
|
1369
|
+
const toggleExtraBotActivation = createAsyncThunk('extraBot/toggleActivation', async (extraBot, { extra, rejectWithValue, dispatch }) => {
|
|
1387
1370
|
try {
|
|
1388
1371
|
const enabled = !extraBot.enabled;
|
|
1389
|
-
const res = (
|
|
1372
|
+
const res = (await extra.jApi.article.update({ ...extraBot, enabled }, { format: Format.VIEW })).result;
|
|
1390
1373
|
if (res.enabled !== extraBot.enabled) {
|
|
1391
1374
|
dispatch(Toast.actions.success({
|
|
1392
|
-
label: enabled
|
|
1375
|
+
label: enabled
|
|
1376
|
+
? 'APP_ExtraBot_Toast_ActivationSuccess'
|
|
1377
|
+
: 'APP_ExtraBot_Toast_DeactivationSuccess',
|
|
1393
1378
|
}));
|
|
1394
1379
|
dispatch(fetchExtraBotListAll());
|
|
1395
1380
|
}
|
|
@@ -1406,25 +1391,25 @@ const toggleExtraBotActivation = createAsyncThunk('extraBot/toggleActivation', (
|
|
|
1406
1391
|
}
|
|
1407
1392
|
return rejectWithValue({ error: 1, errorMsg: 'Failed to change extra bot activation' });
|
|
1408
1393
|
}
|
|
1409
|
-
})
|
|
1410
|
-
const saveExtraBot = createAsyncThunk('extraBot/save', ({ extraBot }, { extra, rejectWithValue, dispatch }) =>
|
|
1394
|
+
});
|
|
1395
|
+
const saveExtraBot = createAsyncThunk('extraBot/save', async ({ extraBot }, { extra, rejectWithValue, dispatch }) => {
|
|
1411
1396
|
try {
|
|
1412
|
-
const data =
|
|
1397
|
+
const data = { ...extraBot, type: ExtraBotConst.configurationType, publishTo: '' };
|
|
1413
1398
|
let res;
|
|
1414
1399
|
let user;
|
|
1415
1400
|
delete data.avatar;
|
|
1416
1401
|
if (extraBot.uri) {
|
|
1417
|
-
res = (
|
|
1402
|
+
res = (await extra.jApi.article.update(data, {
|
|
1418
1403
|
format: Format.VIEW,
|
|
1419
1404
|
})).result;
|
|
1420
|
-
user = (
|
|
1405
|
+
user = (await extra.jApi.extraBot.updateBot(res.uri)).result;
|
|
1421
1406
|
}
|
|
1422
1407
|
else {
|
|
1423
|
-
res = (
|
|
1408
|
+
res = (await extra.jApi.article.create({ ...data }, Format.VIEW)).result[0];
|
|
1424
1409
|
if (!res) {
|
|
1425
1410
|
throw new Error('ExtraBot configuration creation failed');
|
|
1426
1411
|
}
|
|
1427
|
-
user = (
|
|
1412
|
+
user = (await extra.jApi.extraBot.createBot(res.uri)).result;
|
|
1428
1413
|
res._user = user;
|
|
1429
1414
|
}
|
|
1430
1415
|
const label = extraBot.uri ? 'APP_ExtraBot_Toast_SaveEdit' : 'APP_ExtraBot_Toast_SaveCreate';
|
|
@@ -1437,7 +1422,7 @@ const saveExtraBot = createAsyncThunk('extraBot/save', ({ extraBot }, { extra, r
|
|
|
1437
1422
|
}
|
|
1438
1423
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve extra bot' });
|
|
1439
1424
|
}
|
|
1440
|
-
})
|
|
1425
|
+
});
|
|
1441
1426
|
const updateListBotProperty = (state, extraBotUri, property, value) => {
|
|
1442
1427
|
const listAllExtraBot = state.listAll.data.find((eb) => eb.uri === extraBotUri);
|
|
1443
1428
|
const listMinesExtraBot = state.listMines.data.find((eb) => eb.uri === extraBotUri);
|
|
@@ -1490,10 +1475,9 @@ const extraBotSlice = createSlice({
|
|
|
1490
1475
|
state.listAll.loading = 'pending';
|
|
1491
1476
|
})
|
|
1492
1477
|
.addCase(fetchExtraBotListAll.fulfilled, (state, action) => {
|
|
1493
|
-
var _a;
|
|
1494
1478
|
state.listAll.data = action.payload.data;
|
|
1495
1479
|
state.listAll.nbResults = action.payload.cnt;
|
|
1496
|
-
state.listAll.limit =
|
|
1480
|
+
state.listAll.limit = action.payload.limit ?? ExtraBotConst.listLimit;
|
|
1497
1481
|
state.listAll.page = action.payload.page;
|
|
1498
1482
|
state.listAll.loading = 'idle';
|
|
1499
1483
|
})
|
|
@@ -1504,10 +1488,9 @@ const extraBotSlice = createSlice({
|
|
|
1504
1488
|
state.listMines.loading = 'pending';
|
|
1505
1489
|
})
|
|
1506
1490
|
.addCase(fetchExtraBotListMines.fulfilled, (state, action) => {
|
|
1507
|
-
var _a;
|
|
1508
1491
|
state.listMines.data = action.payload.data;
|
|
1509
1492
|
state.listMines.nbResults = action.payload.cnt;
|
|
1510
|
-
state.listMines.limit =
|
|
1493
|
+
state.listMines.limit = action.payload.limit ?? ExtraBotConst.listLimit;
|
|
1511
1494
|
state.listMines.page = action.payload.page;
|
|
1512
1495
|
state.listMines.loading = 'idle';
|
|
1513
1496
|
})
|
|
@@ -1541,10 +1524,13 @@ const selectExtraBotListAll = (state) => state.extraBot.listAll;
|
|
|
1541
1524
|
const selectExtraBotListMines = (state) => state.extraBot.listMines;
|
|
1542
1525
|
const ExtraBot = {
|
|
1543
1526
|
slice: extraBotSlice,
|
|
1544
|
-
actions:
|
|
1527
|
+
actions: {
|
|
1528
|
+
fetchExtraBotListAll,
|
|
1545
1529
|
fetchExtraBotListMines,
|
|
1546
1530
|
toggleExtraBotActivation,
|
|
1547
|
-
saveExtraBot
|
|
1531
|
+
saveExtraBot,
|
|
1532
|
+
...extraBotSlice.actions,
|
|
1533
|
+
},
|
|
1548
1534
|
selectors: { selectExtraBotListAll, selectExtraBotListMines },
|
|
1549
1535
|
};
|
|
1550
1536
|
|
|
@@ -1552,11 +1538,11 @@ const initialState$g = {
|
|
|
1552
1538
|
loading: 'idle',
|
|
1553
1539
|
access: { createCategory: false },
|
|
1554
1540
|
};
|
|
1555
|
-
const fetchFaqConfig = createAsyncThunk('faqConfig/fetch', () =>
|
|
1541
|
+
const fetchFaqConfig = createAsyncThunk('faqConfig/fetch', async () => {
|
|
1556
1542
|
try {
|
|
1557
|
-
const [hookProperties, access] =
|
|
1558
|
-
|
|
1559
|
-
|
|
1543
|
+
const [hookProperties, access] = await Promise.all([
|
|
1544
|
+
await jamespot.faq.getHookProperties(['_web', 'appImage', 'appImageText', '_displayComment']),
|
|
1545
|
+
await jamespot.faq.getAccess(),
|
|
1560
1546
|
]);
|
|
1561
1547
|
return {
|
|
1562
1548
|
_web: hookProperties.result._web,
|
|
@@ -1574,7 +1560,7 @@ const fetchFaqConfig = createAsyncThunk('faqConfig/fetch', () => __awaiter(void
|
|
|
1574
1560
|
}
|
|
1575
1561
|
throw e;
|
|
1576
1562
|
}
|
|
1577
|
-
})
|
|
1563
|
+
});
|
|
1578
1564
|
const FaqConfigSlice = createSlice({
|
|
1579
1565
|
name: 'config',
|
|
1580
1566
|
initialState: initialState$g,
|
|
@@ -1616,12 +1602,12 @@ const initialState$f = {
|
|
|
1616
1602
|
loading: 'idle',
|
|
1617
1603
|
categories: null,
|
|
1618
1604
|
};
|
|
1619
|
-
const fetchFaqCategories = createAsyncThunk('faqCategories/fetch', () =>
|
|
1620
|
-
const categories =
|
|
1605
|
+
const fetchFaqCategories = createAsyncThunk('faqCategories/fetch', async () => {
|
|
1606
|
+
const categories = await jamespot.faq.getCategoriesList();
|
|
1621
1607
|
return {
|
|
1622
1608
|
categories: categories.result.data,
|
|
1623
1609
|
};
|
|
1624
|
-
})
|
|
1610
|
+
});
|
|
1625
1611
|
const FaqCategoriesSlice = createSlice({
|
|
1626
1612
|
name: 'categories',
|
|
1627
1613
|
initialState: initialState$f,
|
|
@@ -1691,8 +1677,7 @@ const selectHook = (state, hook) => {
|
|
|
1691
1677
|
return state.hooks[hook];
|
|
1692
1678
|
};
|
|
1693
1679
|
const hasHookLicense = (state, hook) => {
|
|
1694
|
-
|
|
1695
|
-
return !!((_a = state.hooks[hook]) === null || _a === void 0 ? void 0 : _a.hasLicense);
|
|
1680
|
+
return !!state.hooks[hook]?.hasLicense;
|
|
1696
1681
|
};
|
|
1697
1682
|
const Hook = {
|
|
1698
1683
|
slice: slice$3,
|
|
@@ -1716,10 +1701,10 @@ const buildUrlToJland = (map, hostname, urlBase) => {
|
|
|
1716
1701
|
return `${urlBase}/map/${hostname}/${map.uri}`;
|
|
1717
1702
|
};
|
|
1718
1703
|
|
|
1719
|
-
const fetchJLandMaps = createAsyncThunk('/fetchMaps', ({ jlandUrlBase, retrieveAllMaps }, { extra }) =>
|
|
1704
|
+
const fetchJLandMaps = createAsyncThunk('/fetchMaps', async ({ jlandUrlBase, retrieveAllMaps }, { extra }) => {
|
|
1720
1705
|
const jApi = extra.jApi;
|
|
1721
|
-
const hostname =
|
|
1722
|
-
return
|
|
1706
|
+
const hostname = await jApi.network.getHostname();
|
|
1707
|
+
return await new Promise((resolve, reject) => {
|
|
1723
1708
|
const config = {
|
|
1724
1709
|
type: 'jlandmap',
|
|
1725
1710
|
format: 'raw-list',
|
|
@@ -1730,7 +1715,7 @@ const fetchJLandMaps = createAsyncThunk('/fetchMaps', ({ jlandUrlBase, retrieveA
|
|
|
1730
1715
|
.then((mapsResp) => {
|
|
1731
1716
|
const maps = mapsResp.result.data;
|
|
1732
1717
|
const result = maps.map((currentMap) => {
|
|
1733
|
-
const newMap =
|
|
1718
|
+
const newMap = { ...currentMap };
|
|
1734
1719
|
newMap.urlToJland = buildUrlToJland(currentMap, hostname, jlandUrlBase);
|
|
1735
1720
|
return newMap;
|
|
1736
1721
|
});
|
|
@@ -1743,10 +1728,10 @@ const fetchJLandMaps = createAsyncThunk('/fetchMaps', ({ jlandUrlBase, retrieveA
|
|
|
1743
1728
|
reject({ error: 1, errorMsg: 'Error retrieving maps' });
|
|
1744
1729
|
});
|
|
1745
1730
|
});
|
|
1746
|
-
})
|
|
1747
|
-
const fetchJLandAvailableLicenses = createAsyncThunk('/fetchAvailableLicenses', (_, { extra }) =>
|
|
1731
|
+
});
|
|
1732
|
+
const fetchJLandAvailableLicenses = createAsyncThunk('/fetchAvailableLicenses', async (_, { extra }) => {
|
|
1748
1733
|
const jApi = extra.jApi;
|
|
1749
|
-
return
|
|
1734
|
+
return await new Promise((resolve, reject) => {
|
|
1750
1735
|
jApi.admin.license
|
|
1751
1736
|
.getLicensesNotAssigned('jlandmap')
|
|
1752
1737
|
.then((response) => {
|
|
@@ -1763,14 +1748,14 @@ const fetchJLandAvailableLicenses = createAsyncThunk('/fetchAvailableLicenses',
|
|
|
1763
1748
|
});
|
|
1764
1749
|
});
|
|
1765
1750
|
});
|
|
1766
|
-
})
|
|
1767
|
-
const unassignLicense = createAsyncThunk('/unassignLicense', ({ map, retrieveAllMaps }, { extra, dispatch }) =>
|
|
1751
|
+
});
|
|
1752
|
+
const unassignLicense = createAsyncThunk('/unassignLicense', async ({ map, retrieveAllMaps }, { extra, dispatch }) => {
|
|
1768
1753
|
const jApi = extra.jApi;
|
|
1769
1754
|
const jlandUrlBase = extractJlandUrlBaseFromMap(map);
|
|
1770
1755
|
if (!jlandUrlBase) {
|
|
1771
1756
|
return false;
|
|
1772
1757
|
}
|
|
1773
|
-
return
|
|
1758
|
+
return await new Promise((resolve, reject) => {
|
|
1774
1759
|
jApi.admin.license
|
|
1775
1760
|
.unAssignLicense(map.uri)
|
|
1776
1761
|
.then((response) => {
|
|
@@ -1788,14 +1773,14 @@ const unassignLicense = createAsyncThunk('/unassignLicense', ({ map, retrieveAll
|
|
|
1788
1773
|
reject({ error: 1, errorMsg: 'Error unassign license' });
|
|
1789
1774
|
});
|
|
1790
1775
|
});
|
|
1791
|
-
})
|
|
1792
|
-
const deleteJlandMap = createAsyncThunk('/deleteLicense', ({ map, retrieveAllMaps }, { extra, dispatch }) =>
|
|
1776
|
+
});
|
|
1777
|
+
const deleteJlandMap = createAsyncThunk('/deleteLicense', async ({ map, retrieveAllMaps }, { extra, dispatch }) => {
|
|
1793
1778
|
const jApi = extra.jApi;
|
|
1794
1779
|
const jlandUrlBase = extractJlandUrlBaseFromMap(map);
|
|
1795
1780
|
if (!jlandUrlBase) {
|
|
1796
1781
|
return false;
|
|
1797
1782
|
}
|
|
1798
|
-
return
|
|
1783
|
+
return await new Promise((resolve, reject) => {
|
|
1799
1784
|
jApi.article
|
|
1800
1785
|
.delete(map.id)
|
|
1801
1786
|
.then((response) => {
|
|
@@ -1811,14 +1796,14 @@ const deleteJlandMap = createAsyncThunk('/deleteLicense', ({ map, retrieveAllMap
|
|
|
1811
1796
|
reject({ error: 1, errorMsg: err.errorMsg + '' });
|
|
1812
1797
|
});
|
|
1813
1798
|
});
|
|
1814
|
-
})
|
|
1815
|
-
const assignLicense = createAsyncThunk('/assignLicense', ({ map, retrieveAllMaps }, { extra, dispatch }) =>
|
|
1799
|
+
});
|
|
1800
|
+
const assignLicense = createAsyncThunk('/assignLicense', async ({ map, retrieveAllMaps }, { extra, dispatch }) => {
|
|
1816
1801
|
const jlandUrlBase = extractJlandUrlBaseFromMap(map);
|
|
1817
1802
|
if (!jlandUrlBase) {
|
|
1818
1803
|
return false;
|
|
1819
1804
|
}
|
|
1820
1805
|
const jApi = extra.jApi;
|
|
1821
|
-
return
|
|
1806
|
+
return await new Promise((resolve, reject) => {
|
|
1822
1807
|
jApi.admin.license
|
|
1823
1808
|
.assignLicense(map.uri)
|
|
1824
1809
|
.then((response) => {
|
|
@@ -1836,7 +1821,7 @@ const assignLicense = createAsyncThunk('/assignLicense', ({ map, retrieveAllMaps
|
|
|
1836
1821
|
reject({ error: 1, errorMsg: 'Error assign license' });
|
|
1837
1822
|
});
|
|
1838
1823
|
});
|
|
1839
|
-
})
|
|
1824
|
+
});
|
|
1840
1825
|
const JLandMapListSlice = createSlice({
|
|
1841
1826
|
name: 'jLandMapList',
|
|
1842
1827
|
initialState: {
|
|
@@ -1938,12 +1923,12 @@ const initialMap = {
|
|
|
1938
1923
|
assignLicense: false,
|
|
1939
1924
|
};
|
|
1940
1925
|
const initialState$e = {
|
|
1941
|
-
map:
|
|
1926
|
+
map: { ...initialMap },
|
|
1942
1927
|
loading: 'idle',
|
|
1943
1928
|
status: undefined,
|
|
1944
1929
|
msg: undefined,
|
|
1945
1930
|
};
|
|
1946
|
-
const createMap = createAsyncThunk('mapCreate/create', ({ map, jlandUrlBase }, { extra, dispatch }) =>
|
|
1931
|
+
const createMap = createAsyncThunk('mapCreate/create', async ({ map, jlandUrlBase }, { extra, dispatch }) => {
|
|
1947
1932
|
const payload = {
|
|
1948
1933
|
title: map.title,
|
|
1949
1934
|
publishTo: map.audience.reduce((finalValue, currentElement, index, array) => {
|
|
@@ -1959,27 +1944,27 @@ const createMap = createAsyncThunk('mapCreate/create', ({ map, jlandUrlBase }, {
|
|
|
1959
1944
|
type: 'jlandmap',
|
|
1960
1945
|
};
|
|
1961
1946
|
const jApi = extra.jApi;
|
|
1962
|
-
return
|
|
1947
|
+
return await new Promise((resolve, reject) => {
|
|
1963
1948
|
jApi.article
|
|
1964
1949
|
.create(payload, 'raw-list')
|
|
1965
|
-
.then((response) =>
|
|
1950
|
+
.then(async (response) => {
|
|
1966
1951
|
if (response.error) {
|
|
1967
1952
|
reject({ error: 1, errorMsg: response.errorMsg });
|
|
1968
1953
|
return;
|
|
1969
1954
|
}
|
|
1970
1955
|
const createdMap = response.result[0];
|
|
1971
1956
|
if (map.assignLicense && createdMap !== undefined) {
|
|
1972
|
-
const hostname =
|
|
1957
|
+
const hostname = await jApi.network.getHostname();
|
|
1973
1958
|
createdMap.urlToJland = buildUrlToJland(createdMap, hostname, jlandUrlBase);
|
|
1974
1959
|
dispatch(assignLicense({ map: createdMap, retrieveAllMaps: false }));
|
|
1975
1960
|
}
|
|
1976
1961
|
resolve(response.result);
|
|
1977
|
-
})
|
|
1962
|
+
})
|
|
1978
1963
|
.catch(() => {
|
|
1979
1964
|
reject({ error: 1, errorMsg: 'Error assign license' });
|
|
1980
1965
|
});
|
|
1981
1966
|
});
|
|
1982
|
-
})
|
|
1967
|
+
});
|
|
1983
1968
|
const MapCreateSlice = createSlice({
|
|
1984
1969
|
name: 'mapCreate',
|
|
1985
1970
|
initialState: initialState$e,
|
|
@@ -2001,8 +1986,7 @@ const MapCreateSlice = createSlice({
|
|
|
2001
1986
|
state.status = 'success';
|
|
2002
1987
|
})
|
|
2003
1988
|
.addCase(createMap.rejected, (state, action) => {
|
|
2004
|
-
|
|
2005
|
-
state.msg = (_a = action.error.message) !== null && _a !== void 0 ? _a : undefined;
|
|
1989
|
+
state.msg = action.error.message ?? undefined;
|
|
2006
1990
|
state.status = 'error';
|
|
2007
1991
|
state.loading = 'idle';
|
|
2008
1992
|
});
|
|
@@ -2028,12 +2012,15 @@ const jlandSlice = {
|
|
|
2028
2012
|
};
|
|
2029
2013
|
const jland = {
|
|
2030
2014
|
slice: jlandSlice,
|
|
2031
|
-
actions:
|
|
2015
|
+
actions: {
|
|
2016
|
+
...MapCreateSlice.actions,
|
|
2017
|
+
assignLicense,
|
|
2032
2018
|
unassignLicense,
|
|
2033
2019
|
deleteJlandMap,
|
|
2034
2020
|
fetchJLandMaps,
|
|
2035
2021
|
fetchJLandAvailableLicenses,
|
|
2036
|
-
createMap
|
|
2022
|
+
createMap,
|
|
2023
|
+
},
|
|
2037
2024
|
selectors: {
|
|
2038
2025
|
selectJLandMaps,
|
|
2039
2026
|
selectJLandAvailableLicenses,
|
|
@@ -2098,7 +2085,7 @@ const magicPadSlice = createSlice({
|
|
|
2098
2085
|
});
|
|
2099
2086
|
},
|
|
2100
2087
|
});
|
|
2101
|
-
const fetchPads = createAsyncThunk('magicPad/fetchPads', (params, { extra, rejectWithValue, dispatch, getState }) =>
|
|
2088
|
+
const fetchPads = createAsyncThunk('magicPad/fetchPads', async (params, { extra, rejectWithValue, dispatch, getState }) => {
|
|
2102
2089
|
try {
|
|
2103
2090
|
const state = getState().magicPad;
|
|
2104
2091
|
const page = state.page;
|
|
@@ -2115,7 +2102,7 @@ const fetchPads = createAsyncThunk('magicPad/fetchPads', (params, { extra, rejec
|
|
|
2115
2102
|
: []),
|
|
2116
2103
|
];
|
|
2117
2104
|
const orders = state.orders.length > 0 ? state.orders : [{ name: 'dateCreation', sort: 'DESC' }];
|
|
2118
|
-
return (
|
|
2105
|
+
return (await extra.jApi.article.list({
|
|
2119
2106
|
type: 'magicpad',
|
|
2120
2107
|
limit: state.limit,
|
|
2121
2108
|
format: 'raw-view',
|
|
@@ -2129,7 +2116,7 @@ const fetchPads = createAsyncThunk('magicPad/fetchPads', (params, { extra, rejec
|
|
|
2129
2116
|
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
2130
2117
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot fetch pads' });
|
|
2131
2118
|
}
|
|
2132
|
-
})
|
|
2119
|
+
});
|
|
2133
2120
|
const selectMagicPad = (state) => state.magicPad;
|
|
2134
2121
|
const MagicPad = {
|
|
2135
2122
|
slice: magicPadSlice,
|
|
@@ -2140,11 +2127,7 @@ const MagicPad = {
|
|
|
2140
2127
|
};
|
|
2141
2128
|
|
|
2142
2129
|
const MediaLibraryAppConst = {
|
|
2143
|
-
|
|
2144
|
-
moduleName: 'MediaLibraryHook',
|
|
2145
|
-
typeMediaLibraryFolder: 'mediaLibraryFolder',
|
|
2146
|
-
typeMediaLibraryFile: 'mediaLibraryFile',
|
|
2147
|
-
};
|
|
2130
|
+
typeMediaLibraryFolder: 'mediaLibraryFolder'};
|
|
2148
2131
|
const FILES_PER_PAGE = 18;
|
|
2149
2132
|
|
|
2150
2133
|
const initialState$c = {
|
|
@@ -2163,13 +2146,22 @@ const mediaLibrarySlice = createSlice({
|
|
|
2163
2146
|
initialState: initialState$c,
|
|
2164
2147
|
reducers: {
|
|
2165
2148
|
setPage(state, action) {
|
|
2166
|
-
return
|
|
2149
|
+
return {
|
|
2150
|
+
...state,
|
|
2151
|
+
page: action.payload,
|
|
2152
|
+
};
|
|
2167
2153
|
},
|
|
2168
2154
|
setFolderList(state, action) {
|
|
2169
|
-
return
|
|
2155
|
+
return {
|
|
2156
|
+
...state,
|
|
2157
|
+
folders: action.payload,
|
|
2158
|
+
};
|
|
2170
2159
|
},
|
|
2171
2160
|
setFileUnclassifiedList(state, action) {
|
|
2172
|
-
return
|
|
2161
|
+
return {
|
|
2162
|
+
...state,
|
|
2163
|
+
unclassifiedFiles: action.payload,
|
|
2164
|
+
};
|
|
2173
2165
|
},
|
|
2174
2166
|
},
|
|
2175
2167
|
extraReducers: (builder) => {
|
|
@@ -2203,9 +2195,8 @@ const mediaLibrarySlice = createSlice({
|
|
|
2203
2195
|
state.loading = 'idle';
|
|
2204
2196
|
})
|
|
2205
2197
|
.addCase(fetchMediaLibraryConfig.fulfilled, (state, action) => {
|
|
2206
|
-
var _a, _b;
|
|
2207
2198
|
state.loading = 'idle';
|
|
2208
|
-
state.mediaLibraryAccess =
|
|
2199
|
+
state.mediaLibraryAccess = action.payload?.result ?? false;
|
|
2209
2200
|
})
|
|
2210
2201
|
.addCase(fetchMediaLibraryConfig.rejected, (state) => {
|
|
2211
2202
|
state.loading = 'idle';
|
|
@@ -2216,9 +2207,8 @@ const mediaLibrarySlice = createSlice({
|
|
|
2216
2207
|
state.mediaLibraryAccess = false;
|
|
2217
2208
|
})
|
|
2218
2209
|
.addCase(fetchMediaLibraryStats.fulfilled, (state, action) => {
|
|
2219
|
-
var _a;
|
|
2220
2210
|
state.loading = 'idle';
|
|
2221
|
-
state.stats =
|
|
2211
|
+
state.stats = { ...action.payload?.result };
|
|
2222
2212
|
})
|
|
2223
2213
|
.addCase(fetchMediaLibraryStats.rejected, (state) => {
|
|
2224
2214
|
state.loading = 'idle';
|
|
@@ -2228,8 +2218,7 @@ const mediaLibrarySlice = createSlice({
|
|
|
2228
2218
|
state.loading = 'pending';
|
|
2229
2219
|
})
|
|
2230
2220
|
.addCase(fetchMediaLibraryFoldersStats.fulfilled, (state, action) => {
|
|
2231
|
-
|
|
2232
|
-
state.foldersStats = { loading: false, pager: (_a = action.payload) === null || _a === void 0 ? void 0 : _a.result };
|
|
2221
|
+
state.foldersStats = { loading: false, pager: action.payload?.result };
|
|
2233
2222
|
})
|
|
2234
2223
|
.addCase(fetchMediaLibraryFoldersStats.rejected, (state) => {
|
|
2235
2224
|
state.foldersStats = { loading: false, pager: null };
|
|
@@ -2238,8 +2227,7 @@ const mediaLibrarySlice = createSlice({
|
|
|
2238
2227
|
state.foldersStats.loading = true;
|
|
2239
2228
|
})
|
|
2240
2229
|
.addCase(fetchMediaLibraryFilesStats.fulfilled, (state, action) => {
|
|
2241
|
-
|
|
2242
|
-
state.filesStats = { loading: false, pager: (_a = action.payload) === null || _a === void 0 ? void 0 : _a.result };
|
|
2230
|
+
state.filesStats = { loading: false, pager: action.payload?.result };
|
|
2243
2231
|
})
|
|
2244
2232
|
.addCase(fetchMediaLibraryFilesStats.rejected, (state) => {
|
|
2245
2233
|
state.filesStats = { loading: false, pager: null };
|
|
@@ -2249,23 +2237,23 @@ const mediaLibrarySlice = createSlice({
|
|
|
2249
2237
|
});
|
|
2250
2238
|
},
|
|
2251
2239
|
});
|
|
2252
|
-
const fetchMediaLibraryFolders = createAsyncThunk('MediaLibrary/fetchMediaLibraryFolders', (_, { extra, rejectWithValue, dispatch }) =>
|
|
2240
|
+
const fetchMediaLibraryFolders = createAsyncThunk('MediaLibrary/fetchMediaLibraryFolders', async (_, { extra, rejectWithValue, dispatch }) => {
|
|
2253
2241
|
const args = {
|
|
2254
2242
|
type: MediaLibraryAppConst.typeMediaLibraryFolder,
|
|
2255
2243
|
format: 'raw-little',
|
|
2256
2244
|
limit: 10,
|
|
2257
2245
|
};
|
|
2258
2246
|
try {
|
|
2259
|
-
return
|
|
2247
|
+
return await extra.jApi.article.list(args);
|
|
2260
2248
|
}
|
|
2261
2249
|
catch (error) {
|
|
2262
2250
|
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
2263
2251
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve folders' });
|
|
2264
2252
|
}
|
|
2265
|
-
})
|
|
2266
|
-
const fetchMediaLibraryUnclassifiedFiles = createAsyncThunk('MediaLibrary/fetchMediaLibraryUnclassifiedFiles', (page, { extra, rejectWithValue, dispatch }) =>
|
|
2253
|
+
});
|
|
2254
|
+
const fetchMediaLibraryUnclassifiedFiles = createAsyncThunk('MediaLibrary/fetchMediaLibraryUnclassifiedFiles', async (page, { extra, rejectWithValue, dispatch }) => {
|
|
2267
2255
|
try {
|
|
2268
|
-
return
|
|
2256
|
+
return await extra.jApi.mediaLibrary.GetUnclassifiedFiles({
|
|
2269
2257
|
format: 'raw-little',
|
|
2270
2258
|
page,
|
|
2271
2259
|
limit: FILES_PER_PAGE,
|
|
@@ -2275,43 +2263,43 @@ const fetchMediaLibraryUnclassifiedFiles = createAsyncThunk('MediaLibrary/fetchM
|
|
|
2275
2263
|
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
2276
2264
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve UnclassifiedFiles' });
|
|
2277
2265
|
}
|
|
2278
|
-
})
|
|
2279
|
-
const fetchMediaLibraryConfig = createAsyncThunk('MediaLibrary/fetchMediaLibraryConfig', (_, { extra, rejectWithValue, dispatch }) =>
|
|
2266
|
+
});
|
|
2267
|
+
const fetchMediaLibraryConfig = createAsyncThunk('MediaLibrary/fetchMediaLibraryConfig', async (_, { extra, rejectWithValue, dispatch }) => {
|
|
2280
2268
|
try {
|
|
2281
|
-
return
|
|
2269
|
+
return await extra.jApi.mediaLibrary.getAccess();
|
|
2282
2270
|
}
|
|
2283
2271
|
catch (error) {
|
|
2284
2272
|
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
2285
2273
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot get MediaLibrary Config' });
|
|
2286
2274
|
}
|
|
2287
|
-
})
|
|
2288
|
-
const fetchMediaLibraryFoldersStats = createAsyncThunk('MediaLibrary/fetchMediaLibraryFoldersStats', ({ page, filters, orders }, { extra, rejectWithValue, dispatch }) =>
|
|
2275
|
+
});
|
|
2276
|
+
const fetchMediaLibraryFoldersStats = createAsyncThunk('MediaLibrary/fetchMediaLibraryFoldersStats', async ({ page, filters, orders }, { extra, rejectWithValue, dispatch }) => {
|
|
2289
2277
|
try {
|
|
2290
|
-
return
|
|
2278
|
+
return await extra.jApi.mediaLibrary.getFoldersStatsList(filters, orders, page);
|
|
2291
2279
|
}
|
|
2292
2280
|
catch (error) {
|
|
2293
2281
|
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
2294
2282
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot get MediaLibrary folders stats' });
|
|
2295
2283
|
}
|
|
2296
|
-
})
|
|
2297
|
-
const fetchMediaLibraryFilesStats = createAsyncThunk('MediaLibrary/fetchMediaLibraryFilesStats', ({ page, filters, orders }, { extra, rejectWithValue, dispatch }) =>
|
|
2284
|
+
});
|
|
2285
|
+
const fetchMediaLibraryFilesStats = createAsyncThunk('MediaLibrary/fetchMediaLibraryFilesStats', async ({ page, filters, orders }, { extra, rejectWithValue, dispatch }) => {
|
|
2298
2286
|
try {
|
|
2299
|
-
return
|
|
2287
|
+
return await extra.jApi.mediaLibrary.getFilesStatsList(filters, orders, page);
|
|
2300
2288
|
}
|
|
2301
2289
|
catch (error) {
|
|
2302
2290
|
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
2303
2291
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot get MediaLibrary files stats' });
|
|
2304
2292
|
}
|
|
2305
|
-
})
|
|
2306
|
-
const fetchMediaLibraryStats = createAsyncThunk('MediaLibrary/fetchMediaLibraryStats', (_, { extra, rejectWithValue, dispatch }) =>
|
|
2293
|
+
});
|
|
2294
|
+
const fetchMediaLibraryStats = createAsyncThunk('MediaLibrary/fetchMediaLibraryStats', async (_, { extra, rejectWithValue, dispatch }) => {
|
|
2307
2295
|
try {
|
|
2308
|
-
return
|
|
2296
|
+
return await extra.jApi.mediaLibrary.getStats();
|
|
2309
2297
|
}
|
|
2310
2298
|
catch (error) {
|
|
2311
2299
|
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
2312
2300
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot get MediaLibrary stats' });
|
|
2313
2301
|
}
|
|
2314
|
-
})
|
|
2302
|
+
});
|
|
2315
2303
|
const selectMediaLibrary = (state) => state.mediaLibrary;
|
|
2316
2304
|
const selectMediaLibraryStats = (state) => state.mediaLibrary.stats;
|
|
2317
2305
|
const selectMediaLibraryFoldersStats = (state) => state.mediaLibrary.foldersStats;
|
|
@@ -2342,13 +2330,12 @@ const adapter$1 = createEntityAdapter({
|
|
|
2342
2330
|
const getModelIconSrc = (model, size) => {
|
|
2343
2331
|
const imgProps = {
|
|
2344
2332
|
from: 'imagestatic',
|
|
2345
|
-
size: size
|
|
2333
|
+
size: size ?? 'fitx600',
|
|
2346
2334
|
uri: `icons/${model && model.icon ? model.icon : `article`}-white`,
|
|
2347
2335
|
};
|
|
2348
2336
|
return formatImgUrl(imgProps);
|
|
2349
2337
|
};
|
|
2350
2338
|
const getModelFontAwesomeIcon = (icon) => {
|
|
2351
|
-
var _a;
|
|
2352
2339
|
const modelIconToFAIcon = {
|
|
2353
2340
|
actionplan: 'fs-actionplan',
|
|
2354
2341
|
animatedMeeting: 'fs-animated_meeting',
|
|
@@ -2385,7 +2372,7 @@ const getModelFontAwesomeIcon = (icon) => {
|
|
|
2385
2372
|
wiki: 'fs-wiki',
|
|
2386
2373
|
workgroup: 'fs-workgroup',
|
|
2387
2374
|
};
|
|
2388
|
-
return `icon-${
|
|
2375
|
+
return `icon-${modelIconToFAIcon[icon] ?? icon}`;
|
|
2389
2376
|
};
|
|
2390
2377
|
const slice$2 = createSlice({
|
|
2391
2378
|
name: 'models',
|
|
@@ -2404,9 +2391,12 @@ const utils = {
|
|
|
2404
2391
|
const selectByIds = (state, types) => types.map((type) => state.entities.models.entities[type]).filter((model) => !!model);
|
|
2405
2392
|
const Model = {
|
|
2406
2393
|
slice: slice$2,
|
|
2407
|
-
actions:
|
|
2394
|
+
actions: { ...slice$2.actions },
|
|
2408
2395
|
utils,
|
|
2409
|
-
selectors:
|
|
2396
|
+
selectors: {
|
|
2397
|
+
...selectors$1,
|
|
2398
|
+
selectByIds,
|
|
2399
|
+
},
|
|
2410
2400
|
};
|
|
2411
2401
|
|
|
2412
2402
|
const initialState$b = {};
|
|
@@ -2438,7 +2428,9 @@ const selectNetworkMe = (state) => {
|
|
|
2438
2428
|
};
|
|
2439
2429
|
const Network = {
|
|
2440
2430
|
slice: NetworkSlice,
|
|
2441
|
-
actions:
|
|
2431
|
+
actions: {
|
|
2432
|
+
...NetworkStaticsSlice.actions,
|
|
2433
|
+
},
|
|
2442
2434
|
selectors: {
|
|
2443
2435
|
selectNetworkStatics,
|
|
2444
2436
|
selectNetworkPublic,
|
|
@@ -2461,7 +2453,7 @@ const PlatformConfigSlice = createSlice({
|
|
|
2461
2453
|
});
|
|
2462
2454
|
|
|
2463
2455
|
const joinedReducers$3 = combineReducers({
|
|
2464
|
-
|
|
2456
|
+
config: PlatformConfigSlice.reducer,
|
|
2465
2457
|
});
|
|
2466
2458
|
const PlatformSlice = {
|
|
2467
2459
|
name: 'platform',
|
|
@@ -2478,7 +2470,9 @@ const selectUserAccountStatus = (state) => {
|
|
|
2478
2470
|
};
|
|
2479
2471
|
const Platform = {
|
|
2480
2472
|
slice: PlatformSlice,
|
|
2481
|
-
actions:
|
|
2473
|
+
actions: {
|
|
2474
|
+
...PlatformConfigSlice.actions,
|
|
2475
|
+
},
|
|
2482
2476
|
selectors: {
|
|
2483
2477
|
selectPlatformConfig,
|
|
2484
2478
|
selectUserHighlightFields,
|
|
@@ -2493,20 +2487,20 @@ const initialQuery = {
|
|
|
2493
2487
|
orders: [{ name: 'dateCreation', sort: 'DESC' }],
|
|
2494
2488
|
page: 1,
|
|
2495
2489
|
};
|
|
2496
|
-
const fetchFiles = createAsyncThunk('/fetchFiles', ({ page, query, sort }, { extra, getState }) =>
|
|
2490
|
+
const fetchFiles = createAsyncThunk('/fetchFiles', async ({ page, query, sort }, { extra, getState }) => {
|
|
2497
2491
|
const jApi = extra.jApi;
|
|
2498
2492
|
const state = getState();
|
|
2499
2493
|
const filters = state.wedoc.tab === 'my-documents' ? [{ name: 'idUser', value: '0' }] : [];
|
|
2500
2494
|
const orders = [{ name: 'dateCreation', sort }];
|
|
2501
2495
|
const resolvePage = query !== state.wedoc.query ? 1 : page;
|
|
2502
|
-
return
|
|
2503
|
-
})
|
|
2504
|
-
const fetchRecentFiles = createAsyncThunk('/fetchRecentFiles', (_, { extra, getState }) =>
|
|
2496
|
+
return await jApi.wedoc.getFiles({ ...initialQuery, filters, query, orders, page: resolvePage, limit: 12 });
|
|
2497
|
+
});
|
|
2498
|
+
const fetchRecentFiles = createAsyncThunk('/fetchRecentFiles', async (_, { extra, getState }) => {
|
|
2505
2499
|
const jApi = extra.jApi;
|
|
2506
2500
|
const state = getState();
|
|
2507
2501
|
const filters = state.wedoc.tab === 'my-documents' ? [{ name: 'idUser', value: '0' }] : [];
|
|
2508
|
-
return
|
|
2509
|
-
})
|
|
2502
|
+
return await jApi.wedoc.getFiles({ ...initialQuery, filters, limit: 3 });
|
|
2503
|
+
});
|
|
2510
2504
|
|
|
2511
2505
|
const initialState$9 = {
|
|
2512
2506
|
entities: [],
|
|
@@ -2524,7 +2518,7 @@ const WedocAppSlice = createSlice({
|
|
|
2524
2518
|
reducers: {
|
|
2525
2519
|
update: (state, action) => {
|
|
2526
2520
|
state.entities = [
|
|
2527
|
-
...state.entities.map((file) => file.id === action.payload.id ?
|
|
2521
|
+
...state.entities.map((file) => file.id === action.payload.id ? { ...file, ...action.payload } : file),
|
|
2528
2522
|
];
|
|
2529
2523
|
},
|
|
2530
2524
|
setQuery: (state, action) => {
|
|
@@ -2588,10 +2582,10 @@ const WedocApp = {
|
|
|
2588
2582
|
},
|
|
2589
2583
|
};
|
|
2590
2584
|
|
|
2591
|
-
const fetchRequest = createAsyncThunk('/fetchRequest', ({ uri, idUser }, { extra }) =>
|
|
2585
|
+
const fetchRequest = createAsyncThunk('/fetchRequest', async ({ uri, idUser }, { extra }) => {
|
|
2592
2586
|
const jApi = extra.jApi;
|
|
2593
|
-
return
|
|
2594
|
-
})
|
|
2587
|
+
return await jApi.object.getAccessRequest(uri, idUser);
|
|
2588
|
+
});
|
|
2595
2589
|
|
|
2596
2590
|
const initialState$8 = {
|
|
2597
2591
|
entities: [],
|
|
@@ -2660,15 +2654,14 @@ const teamWorkToDoSlice = createSlice({
|
|
|
2660
2654
|
}
|
|
2661
2655
|
});
|
|
2662
2656
|
builder.addCase(startToDoCreation.rejected, (state, action) => {
|
|
2663
|
-
var _a, _b;
|
|
2664
2657
|
state.status = 'error';
|
|
2665
|
-
state.message =
|
|
2658
|
+
state.message = action.payload?.errorMsg ?? 'GLOBAL_Technical_Error';
|
|
2666
2659
|
});
|
|
2667
2660
|
},
|
|
2668
2661
|
});
|
|
2669
|
-
const startToDoCreation = createAsyncThunk('teamWork/startToDoCreation', (_, { extra, rejectWithValue, dispatch, signal }) =>
|
|
2662
|
+
const startToDoCreation = createAsyncThunk('teamWork/startToDoCreation', async (_, { extra, rejectWithValue, dispatch, signal }) => {
|
|
2670
2663
|
try {
|
|
2671
|
-
const isSent = (
|
|
2664
|
+
const isSent = (await extra.jApi.teamWork.aiGeneratedToDo({ signal })).result;
|
|
2672
2665
|
return isSent;
|
|
2673
2666
|
}
|
|
2674
2667
|
catch (err) {
|
|
@@ -2677,7 +2670,7 @@ const startToDoCreation = createAsyncThunk('teamWork/startToDoCreation', (_, { e
|
|
|
2677
2670
|
}
|
|
2678
2671
|
return rejectWithValue({ error: 1, errorMsg: 'APP_TEAMWORK_ToDo_Not_Sent' });
|
|
2679
2672
|
}
|
|
2680
|
-
})
|
|
2673
|
+
});
|
|
2681
2674
|
|
|
2682
2675
|
const getTeamWorkRTHandlers = function (dispatch) {
|
|
2683
2676
|
const toDoUpdateHandler = function (message) {
|
|
@@ -2705,7 +2698,10 @@ const teamWorkSlice = {
|
|
|
2705
2698
|
const teamworkReducer = teamWorkSlice.reducer;
|
|
2706
2699
|
const TeamWork = {
|
|
2707
2700
|
slice: teamWorkSlice,
|
|
2708
|
-
actions:
|
|
2701
|
+
actions: {
|
|
2702
|
+
...teamWorkToDoSlice.actions,
|
|
2703
|
+
startToDoCreation,
|
|
2704
|
+
},
|
|
2709
2705
|
selectors: { selectToDoState },
|
|
2710
2706
|
getTeamWorkRTHandlers,
|
|
2711
2707
|
};
|
|
@@ -2715,10 +2711,10 @@ const initialState$6 = {
|
|
|
2715
2711
|
loading: 'idle',
|
|
2716
2712
|
loadingChannelDeletion: 'idle',
|
|
2717
2713
|
};
|
|
2718
|
-
const fetchChannels = createAsyncThunk('/fetchChannels', (page, { extra }) =>
|
|
2719
|
-
const askedPage = page
|
|
2714
|
+
const fetchChannels = createAsyncThunk('/fetchChannels', async (page, { extra }) => {
|
|
2715
|
+
const askedPage = page ?? 1;
|
|
2720
2716
|
const jApi = extra.jApi;
|
|
2721
|
-
return
|
|
2717
|
+
return await new Promise((resolve, reject) => {
|
|
2722
2718
|
const config = {
|
|
2723
2719
|
type: 'tvDisplayChannel',
|
|
2724
2720
|
format: 'raw-list',
|
|
@@ -2731,14 +2727,13 @@ const fetchChannels = createAsyncThunk('/fetchChannels', (page, { extra }) => __
|
|
|
2731
2727
|
resolve(channelsResp.result);
|
|
2732
2728
|
})
|
|
2733
2729
|
.catch((ex) => {
|
|
2734
|
-
|
|
2735
|
-
reject({ error: (_a = ex.error) !== null && _a !== void 0 ? _a : 1, errorMsg: (_b = ex.errorMsg) !== null && _b !== void 0 ? _b : 'Error retrieving channels' });
|
|
2730
|
+
reject({ error: ex.error ?? 1, errorMsg: ex.errorMsg ?? 'Error retrieving channels' });
|
|
2736
2731
|
});
|
|
2737
2732
|
});
|
|
2738
|
-
})
|
|
2739
|
-
const deleteChannel = createAsyncThunk('/deleteChannel', ({ channel }, { extra, dispatch }) =>
|
|
2733
|
+
});
|
|
2734
|
+
const deleteChannel = createAsyncThunk('/deleteChannel', async ({ channel }, { extra, dispatch }) => {
|
|
2740
2735
|
const jApi = extra.jApi;
|
|
2741
|
-
return
|
|
2736
|
+
return await new Promise((resolve, reject) => {
|
|
2742
2737
|
jApi.article
|
|
2743
2738
|
.delete(channel.id)
|
|
2744
2739
|
.then((response) => {
|
|
@@ -2746,14 +2741,13 @@ const deleteChannel = createAsyncThunk('/deleteChannel', ({ channel }, { extra,
|
|
|
2746
2741
|
dispatch(fetchChannels());
|
|
2747
2742
|
})
|
|
2748
2743
|
.catch((ex) => {
|
|
2749
|
-
|
|
2750
|
-
reject({ error: (_a = ex.error) !== null && _a !== void 0 ? _a : 1, errorMsg: (_b = ex.errorMsg) !== null && _b !== void 0 ? _b : 'Error deleting channel' });
|
|
2744
|
+
reject({ error: ex.error ?? 1, errorMsg: ex.errorMsg ?? 'Error deleting channel' });
|
|
2751
2745
|
});
|
|
2752
2746
|
});
|
|
2753
|
-
})
|
|
2747
|
+
});
|
|
2754
2748
|
const ChannelsListSlice = createSlice({
|
|
2755
2749
|
name: 'channelsList',
|
|
2756
|
-
initialState:
|
|
2750
|
+
initialState: { ...initialState$6 },
|
|
2757
2751
|
reducers: {},
|
|
2758
2752
|
extraReducers: (builder) => {
|
|
2759
2753
|
builder
|
|
@@ -2848,7 +2842,9 @@ const selectTinyMCEExtendedOptions = (state) => {
|
|
|
2848
2842
|
};
|
|
2849
2843
|
const TinyMCE = {
|
|
2850
2844
|
slice: TinyMCESlice,
|
|
2851
|
-
actions:
|
|
2845
|
+
actions: {
|
|
2846
|
+
...TinyMCEOptionsSlice.actions,
|
|
2847
|
+
},
|
|
2852
2848
|
selectors: {
|
|
2853
2849
|
selectTinyMCECommonOptions,
|
|
2854
2850
|
selectTinyMCEExtendedOptions,
|
|
@@ -2887,7 +2883,7 @@ const isLogged = (userCurrent) => {
|
|
|
2887
2883
|
};
|
|
2888
2884
|
const UserCurrent = {
|
|
2889
2885
|
slice: slice$1,
|
|
2890
|
-
actions:
|
|
2886
|
+
actions: { ...slice$1.actions },
|
|
2891
2887
|
selectors: {
|
|
2892
2888
|
get,
|
|
2893
2889
|
},
|
|
@@ -2917,18 +2913,18 @@ const WIDGET_QUICK_SURVEY_DESCRIPTION = 'WIDGET_Quick_Survey_Text';
|
|
|
2917
2913
|
|
|
2918
2914
|
var WIDGETS = /*#__PURE__*/Object.freeze({
|
|
2919
2915
|
__proto__: null,
|
|
2920
|
-
|
|
2921
|
-
WIDGET_ARTICLE_TEXT: WIDGET_ARTICLE_TEXT,
|
|
2922
|
-
WIDGET_ARTICLE_IMAGE: WIDGET_ARTICLE_IMAGE,
|
|
2916
|
+
WIDGET_ARTICLE_ATTACHMENT: WIDGET_ARTICLE_ATTACHMENT,
|
|
2923
2917
|
WIDGET_ARTICLE_BUTTON: WIDGET_ARTICLE_BUTTON,
|
|
2924
2918
|
WIDGET_ARTICLE_GALLERY: WIDGET_ARTICLE_GALLERY,
|
|
2925
|
-
|
|
2919
|
+
WIDGET_ARTICLE_IMAGE: WIDGET_ARTICLE_IMAGE,
|
|
2920
|
+
WIDGET_ARTICLE_TEXT: WIDGET_ARTICLE_TEXT,
|
|
2921
|
+
WIDGET_ARTICLE_TITLE: WIDGET_ARTICLE_TITLE,
|
|
2926
2922
|
WIDGET_CHECK_LIST: WIDGET_CHECK_LIST,
|
|
2927
|
-
WIDGET_CHECK_LIST_LABEL: WIDGET_CHECK_LIST_LABEL,
|
|
2928
2923
|
WIDGET_CHECK_LIST_DESCRIPTION: WIDGET_CHECK_LIST_DESCRIPTION,
|
|
2924
|
+
WIDGET_CHECK_LIST_LABEL: WIDGET_CHECK_LIST_LABEL,
|
|
2929
2925
|
WIDGET_QUICK_SURVEY: WIDGET_QUICK_SURVEY,
|
|
2930
|
-
|
|
2931
|
-
|
|
2926
|
+
WIDGET_QUICK_SURVEY_DESCRIPTION: WIDGET_QUICK_SURVEY_DESCRIPTION,
|
|
2927
|
+
WIDGET_QUICK_SURVEY_LABEL: WIDGET_QUICK_SURVEY_LABEL
|
|
2932
2928
|
});
|
|
2933
2929
|
|
|
2934
2930
|
const widgetArticleAttachmentDefinition = {
|
|
@@ -3305,37 +3301,69 @@ function content(name) {
|
|
|
3305
3301
|
switch (name) {
|
|
3306
3302
|
default:
|
|
3307
3303
|
case 'widget-lucca-absence':
|
|
3308
|
-
return
|
|
3304
|
+
return {
|
|
3305
|
+
...widgetLuccaAbsenceContent,
|
|
3306
|
+
};
|
|
3309
3307
|
case 'widget-article-attachment':
|
|
3310
|
-
return
|
|
3308
|
+
return {
|
|
3309
|
+
...widgetArticleAttachmentContent,
|
|
3310
|
+
};
|
|
3311
3311
|
case 'widget-presence':
|
|
3312
|
-
return
|
|
3312
|
+
return {
|
|
3313
|
+
...widgetPresenceContent,
|
|
3314
|
+
};
|
|
3313
3315
|
case 'widget-datasource-table':
|
|
3314
|
-
return
|
|
3316
|
+
return {
|
|
3317
|
+
...widgetDatasourceTaleContent,
|
|
3318
|
+
};
|
|
3315
3319
|
case 'widget-excel-datasource-table':
|
|
3316
|
-
return
|
|
3320
|
+
return {
|
|
3321
|
+
...widgetExcelDatasourceTaleContent,
|
|
3322
|
+
};
|
|
3317
3323
|
case 'widget-article-slider':
|
|
3318
|
-
return
|
|
3324
|
+
return {
|
|
3325
|
+
...widgetArticleSliderContent,
|
|
3326
|
+
};
|
|
3319
3327
|
case 'widget-article-gallery':
|
|
3320
|
-
return
|
|
3328
|
+
return {
|
|
3329
|
+
...widgetArticleGalleryContent,
|
|
3330
|
+
};
|
|
3321
3331
|
case 'widget-article-button':
|
|
3322
|
-
return
|
|
3332
|
+
return {
|
|
3333
|
+
...widgetArticleButtonContent,
|
|
3334
|
+
};
|
|
3323
3335
|
case 'widget-article-title':
|
|
3324
|
-
return
|
|
3336
|
+
return {
|
|
3337
|
+
...widgetArticleTitleContent,
|
|
3338
|
+
};
|
|
3325
3339
|
case 'widget-article-image':
|
|
3326
|
-
return
|
|
3340
|
+
return {
|
|
3341
|
+
...widgetArticleImageContent,
|
|
3342
|
+
};
|
|
3327
3343
|
case 'widget-article-text':
|
|
3328
|
-
return
|
|
3344
|
+
return {
|
|
3345
|
+
...widgetArticleTextContent,
|
|
3346
|
+
};
|
|
3329
3347
|
case 'widget-check-list':
|
|
3330
|
-
return
|
|
3348
|
+
return {
|
|
3349
|
+
...widgetCheckListContent,
|
|
3350
|
+
};
|
|
3331
3351
|
case 'widget-quick-survey':
|
|
3332
|
-
return
|
|
3352
|
+
return {
|
|
3353
|
+
...widgetQuickSurveyContent,
|
|
3354
|
+
};
|
|
3333
3355
|
case 'widget-calendar-calDav':
|
|
3334
|
-
return
|
|
3356
|
+
return {
|
|
3357
|
+
...widgetCalendarCalDavContent,
|
|
3358
|
+
};
|
|
3335
3359
|
case 'widget-contact-cardDav':
|
|
3336
|
-
return
|
|
3360
|
+
return {
|
|
3361
|
+
...widgetContactCardDavContent,
|
|
3362
|
+
};
|
|
3337
3363
|
case 'widget-emails-imap':
|
|
3338
|
-
return
|
|
3364
|
+
return {
|
|
3365
|
+
...widgetEmailsImapContent,
|
|
3366
|
+
};
|
|
3339
3367
|
}
|
|
3340
3368
|
}
|
|
3341
3369
|
|
|
@@ -3402,23 +3430,32 @@ const widgetsSlice = createSlice({
|
|
|
3402
3430
|
},
|
|
3403
3431
|
setWidgetWrapperStyle: (state, action) => {
|
|
3404
3432
|
const { uniqid, styles } = action.payload;
|
|
3405
|
-
state.widgetWrapperStyle[uniqid] =
|
|
3433
|
+
state.widgetWrapperStyle[uniqid] = { ...state.widgetWrapperStyle[uniqid], ...styles };
|
|
3406
3434
|
},
|
|
3407
3435
|
setWidgetTitleStyle: (state, action) => {
|
|
3408
3436
|
const { uniqid, styles } = action.payload;
|
|
3409
|
-
state.widgetTitleStyle[uniqid] =
|
|
3437
|
+
state.widgetTitleStyle[uniqid] = { ...state.widgetTitleStyle[uniqid], ...styles };
|
|
3410
3438
|
},
|
|
3411
3439
|
updateWidget: (state, action) => {
|
|
3412
3440
|
const { uniqid } = action.payload;
|
|
3413
|
-
const wrapper =
|
|
3441
|
+
const wrapper = { ...state.ids[uniqid] };
|
|
3414
3442
|
const states = state.states[uniqid];
|
|
3415
|
-
if (states
|
|
3443
|
+
if (states?.locked) {
|
|
3416
3444
|
return;
|
|
3417
3445
|
}
|
|
3418
3446
|
if (state.ids[uniqid] && wrapper && wrapper.widget) {
|
|
3419
|
-
state.ids[uniqid] = Object.assign(
|
|
3447
|
+
state.ids[uniqid] = Object.assign({
|
|
3448
|
+
...state.ids[uniqid],
|
|
3449
|
+
widget: {
|
|
3450
|
+
...wrapper.widget,
|
|
3451
|
+
content: action.payload.override
|
|
3420
3452
|
? action.payload.content
|
|
3421
|
-
: Object.assign(
|
|
3453
|
+
: Object.assign({
|
|
3454
|
+
...wrapper.widget.content,
|
|
3455
|
+
...action.payload.content,
|
|
3456
|
+
}),
|
|
3457
|
+
},
|
|
3458
|
+
});
|
|
3422
3459
|
}
|
|
3423
3460
|
},
|
|
3424
3461
|
registerWidgetRTObject: (state, action) => {
|
|
@@ -3446,18 +3483,30 @@ const widgetsSlice = createSlice({
|
|
|
3446
3483
|
updateWidgetWrapper: (state, action) => {
|
|
3447
3484
|
const { uniqid } = action.payload;
|
|
3448
3485
|
if (state.ids && state.ids[uniqid]) {
|
|
3449
|
-
state.ids[uniqid] = Object.assign(
|
|
3486
|
+
state.ids[uniqid] = Object.assign({ ...state.ids[uniqid], ...action.payload });
|
|
3450
3487
|
}
|
|
3451
3488
|
},
|
|
3452
3489
|
registerLayer: (state, action) => {
|
|
3453
3490
|
const layerId = uniqid();
|
|
3454
|
-
const wrapper =
|
|
3491
|
+
const wrapper = { ...state.ids[action.payload.uniqid] };
|
|
3455
3492
|
if (wrapper && wrapper.widget) {
|
|
3456
3493
|
if (state.ids[action.payload.uniqid] && wrapper.widget.layers) {
|
|
3457
|
-
state.ids[action.payload.uniqid] = Object.assign(
|
|
3494
|
+
state.ids[action.payload.uniqid] = Object.assign({
|
|
3495
|
+
...state.ids[action.payload.uniqid],
|
|
3496
|
+
widget: {
|
|
3497
|
+
...wrapper.widget,
|
|
3498
|
+
layers: [...wrapper.widget.layers, layerId],
|
|
3499
|
+
},
|
|
3500
|
+
});
|
|
3458
3501
|
}
|
|
3459
3502
|
else {
|
|
3460
|
-
state.ids[action.payload.uniqid] = Object.assign(
|
|
3503
|
+
state.ids[action.payload.uniqid] = Object.assign({
|
|
3504
|
+
...state.ids[action.payload.uniqid],
|
|
3505
|
+
widget: {
|
|
3506
|
+
...wrapper.widget,
|
|
3507
|
+
layers: [layerId],
|
|
3508
|
+
},
|
|
3509
|
+
});
|
|
3461
3510
|
}
|
|
3462
3511
|
state.ids[action.payload.widget.widget.uniqid] = action.payload.widget;
|
|
3463
3512
|
state.states[action.payload.widget.widget.uniqid] = {
|
|
@@ -3480,15 +3529,24 @@ const widgetsSlice = createSlice({
|
|
|
3480
3529
|
},
|
|
3481
3530
|
updateLayer: (state, action) => {
|
|
3482
3531
|
if (state.layers[action.payload.uniqid]) {
|
|
3483
|
-
state.layers[action.payload.uniqid] = Object.assign(
|
|
3532
|
+
state.layers[action.payload.uniqid] = Object.assign({
|
|
3533
|
+
...state.layers[action.payload.uniqid],
|
|
3534
|
+
...action.payload.props,
|
|
3535
|
+
});
|
|
3484
3536
|
}
|
|
3485
3537
|
},
|
|
3486
3538
|
flushLayer: (state, action) => {
|
|
3487
|
-
const wrapper =
|
|
3539
|
+
const wrapper = { ...state.ids[action.payload.uniqid] };
|
|
3488
3540
|
if (wrapper && wrapper.widget && wrapper.widget.layers) {
|
|
3489
|
-
state.ids[action.payload.uniqid] = Object.assign(
|
|
3541
|
+
state.ids[action.payload.uniqid] = Object.assign({
|
|
3542
|
+
...state.ids[action.payload.uniqid],
|
|
3543
|
+
widget: {
|
|
3544
|
+
...wrapper.widget,
|
|
3545
|
+
layers: [
|
|
3490
3546
|
...wrapper.widget.layers.filter((layerId) => layerId !== action.payload.layerId),
|
|
3491
|
-
]
|
|
3547
|
+
],
|
|
3548
|
+
},
|
|
3549
|
+
});
|
|
3492
3550
|
delete state.layers[action.payload.layerId];
|
|
3493
3551
|
}
|
|
3494
3552
|
},
|
|
@@ -3514,16 +3572,22 @@ const widgetsSlice = createSlice({
|
|
|
3514
3572
|
},
|
|
3515
3573
|
setWidgetState: (state, action) => {
|
|
3516
3574
|
const { uniqid } = action.payload;
|
|
3517
|
-
const widgetState =
|
|
3575
|
+
const widgetState = { ...state.states[uniqid] };
|
|
3518
3576
|
if (widgetState !== undefined) {
|
|
3519
|
-
state.states[uniqid] =
|
|
3577
|
+
state.states[uniqid] = {
|
|
3578
|
+
...state.states[uniqid],
|
|
3579
|
+
...action.payload,
|
|
3580
|
+
};
|
|
3520
3581
|
}
|
|
3521
3582
|
},
|
|
3522
3583
|
setAllWidgetStates: (state, action) => {
|
|
3523
3584
|
Object.keys(state.states).map((key) => {
|
|
3524
|
-
const widgetState =
|
|
3585
|
+
const widgetState = { ...state.states[key] };
|
|
3525
3586
|
if (widgetState !== undefined) {
|
|
3526
|
-
state.states[key] =
|
|
3587
|
+
state.states[key] = {
|
|
3588
|
+
...state.states[key],
|
|
3589
|
+
...action.payload,
|
|
3590
|
+
};
|
|
3527
3591
|
}
|
|
3528
3592
|
});
|
|
3529
3593
|
},
|
|
@@ -3609,10 +3673,10 @@ const selectToken = (state) => state.widgets.token;
|
|
|
3609
3673
|
const selectModal = (state) => state.widgets.modal;
|
|
3610
3674
|
const selectWidgets = (state) => state.widgets.ids;
|
|
3611
3675
|
const selectFlushedWidgets = (state) => state.widgets.flushedWidgets;
|
|
3612
|
-
const selectWidgetState = (state, uniqid) =>
|
|
3613
|
-
const selectWidget = (state, uniqid) =>
|
|
3614
|
-
const selectWidgetLevel = (state, uniqid) =>
|
|
3615
|
-
const selectWidgetObject = (state, uniqid) =>
|
|
3676
|
+
const selectWidgetState = (state, uniqid) => state.widgets.states[uniqid] ?? undefined;
|
|
3677
|
+
const selectWidget = (state, uniqid) => state.widgets.ids[uniqid] ?? undefined;
|
|
3678
|
+
const selectWidgetLevel = (state, uniqid) => state.widgets.ids[uniqid]?.level ?? undefined;
|
|
3679
|
+
const selectWidgetObject = (state, uniqid) => state.widgets.widgetObject[uniqid] ?? undefined;
|
|
3616
3680
|
const selectWidgetObjectUri = (state, uniqid) => {
|
|
3617
3681
|
const o = state.widgets.widgetObject[uniqid];
|
|
3618
3682
|
if (o && 'uri' in o) {
|
|
@@ -3620,15 +3684,15 @@ const selectWidgetObjectUri = (state, uniqid) => {
|
|
|
3620
3684
|
}
|
|
3621
3685
|
return undefined;
|
|
3622
3686
|
};
|
|
3623
|
-
const selectWidgetObjectRights = (state, uniqid) =>
|
|
3624
|
-
const selectWidgetContext = (state, uniqid) =>
|
|
3625
|
-
const selectWidgetAuthor = (state, uniqid) =>
|
|
3626
|
-
const selectWidgetChipCount = (state, uniqid) =>
|
|
3627
|
-
const selectWidgetWrapperStyle = (state, uniqid) =>
|
|
3628
|
-
const selectWidgetTitleStyle = (state, uniqid) =>
|
|
3687
|
+
const selectWidgetObjectRights = (state, uniqid) => state.widgets.widgetObjectRights[uniqid] ?? undefined;
|
|
3688
|
+
const selectWidgetContext = (state, uniqid) => state.widgets.widgetContext[uniqid] ?? undefined;
|
|
3689
|
+
const selectWidgetAuthor = (state, uniqid) => state.widgets.widgetAuthor[uniqid] ?? undefined;
|
|
3690
|
+
const selectWidgetChipCount = (state, uniqid) => state.widgets.widgetChipCount[uniqid] ?? 0;
|
|
3691
|
+
const selectWidgetWrapperStyle = (state, uniqid) => state.widgets.widgetWrapperStyle[uniqid] ?? {};
|
|
3692
|
+
const selectWidgetTitleStyle = (state, uniqid) => state.widgets.widgetTitleStyle[uniqid] ?? {};
|
|
3629
3693
|
const isActive = (state, uniqid) => state.widgets.currentEditableWidgetId === uniqid;
|
|
3630
3694
|
const selectAllWidgetRTObject = (state, uniqid) => state.widgets.rtObjectStack.filter((el) => el.uniqid === uniqid);
|
|
3631
|
-
const updateWidgetContent = (uniqid, content, override) => Widget.slice.actions.updateWidget({ uniqid, content, override: override
|
|
3695
|
+
const updateWidgetContent = (uniqid, content, override) => Widget.slice.actions.updateWidget({ uniqid, content, override: override ?? false });
|
|
3632
3696
|
const Widget = {
|
|
3633
3697
|
const: WIDGETS,
|
|
3634
3698
|
factory: widgetFactory,
|
|
@@ -3673,14 +3737,14 @@ const editorsSlice = createSlice({
|
|
|
3673
3737
|
uniqid,
|
|
3674
3738
|
name,
|
|
3675
3739
|
position: 'right',
|
|
3676
|
-
mode: mode
|
|
3740
|
+
mode: mode ?? 'view',
|
|
3677
3741
|
}
|
|
3678
3742
|
: {
|
|
3679
3743
|
uniqid,
|
|
3680
3744
|
name,
|
|
3681
3745
|
onSave,
|
|
3682
3746
|
position: 'right',
|
|
3683
|
-
mode: mode
|
|
3747
|
+
mode: mode ?? 'view',
|
|
3684
3748
|
};
|
|
3685
3749
|
state.editors = state.editors.find((ed) => ed.uniqid === uniqid)
|
|
3686
3750
|
? state.editors
|
|
@@ -3689,21 +3753,25 @@ const editorsSlice = createSlice({
|
|
|
3689
3753
|
registerEditorPopup: (state, action) => {
|
|
3690
3754
|
const { uniqid, view } = action.payload;
|
|
3691
3755
|
state.editors = [
|
|
3692
|
-
...state.editors.map((editor) => editor.uniqid === uniqid ?
|
|
3756
|
+
...state.editors.map((editor) => editor.uniqid === uniqid ? { ...editor, popup: true, view } : editor),
|
|
3693
3757
|
];
|
|
3694
3758
|
},
|
|
3695
3759
|
flushEditorPopup: (state, action) => {
|
|
3696
3760
|
const { uniqid } = action.payload;
|
|
3697
3761
|
state.editors = [
|
|
3698
3762
|
...state.editors.map((editor) => editor.uniqid === uniqid
|
|
3699
|
-
?
|
|
3763
|
+
? {
|
|
3764
|
+
...editor,
|
|
3765
|
+
popup: false,
|
|
3766
|
+
}
|
|
3767
|
+
: editor),
|
|
3700
3768
|
];
|
|
3701
3769
|
},
|
|
3702
3770
|
setEditorPosition: (state, action) => {
|
|
3703
3771
|
const { uniqid, position } = action.payload;
|
|
3704
3772
|
state.editors = [
|
|
3705
3773
|
...state.editors.map((ed) => {
|
|
3706
|
-
return ed.uniqid === uniqid ?
|
|
3774
|
+
return ed.uniqid === uniqid ? { ...ed, position } : ed;
|
|
3707
3775
|
}),
|
|
3708
3776
|
];
|
|
3709
3777
|
},
|
|
@@ -3744,7 +3812,7 @@ const slice = createSlice({
|
|
|
3744
3812
|
const selectors = adapter.getSelectors((state) => state.entities.socialActions);
|
|
3745
3813
|
const SocialActions = {
|
|
3746
3814
|
slice: slice,
|
|
3747
|
-
actions:
|
|
3815
|
+
actions: { ...slice.actions },
|
|
3748
3816
|
selectors,
|
|
3749
3817
|
};
|
|
3750
3818
|
|
|
@@ -3940,9 +4008,7 @@ const AppFormNotFields = [AppFormItemType.AUDIENCE, AppFormItemType.RANGE];
|
|
|
3940
4008
|
popup: [AppFormItemType.PUBLISHTO],
|
|
3941
4009
|
edit: [AppFormItemType.PUBLISHTO],
|
|
3942
4010
|
list: [AppFormItemType.DATECREATION],
|
|
3943
|
-
filter: [AppFormItemType.DATECREATION]
|
|
3944
|
-
view: [],
|
|
3945
|
-
});
|
|
4011
|
+
filter: [AppFormItemType.DATECREATION]});
|
|
3946
4012
|
const AppFormFixedList = [
|
|
3947
4013
|
AppFormItemType.TITLE,
|
|
3948
4014
|
AppFormItemType.PUBLISHTO,
|
|
@@ -3954,7 +4020,7 @@ const AppFormFixedList = [
|
|
|
3954
4020
|
[AppFormItemType.DESCRIPTION, AppFormItemType.IMAGE];
|
|
3955
4021
|
const AppFormBannedFromViews = new Map();
|
|
3956
4022
|
AppFormBannedFromViews.set(AppFormItemType.IMAGE, ['list', 'filter', 'view']);
|
|
3957
|
-
|
|
4023
|
+
[
|
|
3958
4024
|
AppFormItemType.TITLE,
|
|
3959
4025
|
AppFormItemType.DESCRIPTION,
|
|
3960
4026
|
AppFormItemType.TEXT,
|
|
@@ -3984,11 +4050,7 @@ const AppListFilter = [
|
|
|
3984
4050
|
({
|
|
3985
4051
|
create: [AppFormItemType.IMAGE, AppFormItemType.ADDFILEATTACHMENT, AppFormItemType.CODEHTML],
|
|
3986
4052
|
popup: [AppFormItemType.IMAGE, AppFormItemType.ADDFILEATTACHMENT, AppFormItemType.CODEHTML],
|
|
3987
|
-
edit: [AppFormItemType.IMAGE, AppFormItemType.ADDFILEATTACHMENT, AppFormItemType.CODEHTML]
|
|
3988
|
-
list: AppListFilter,
|
|
3989
|
-
filter: AppListFilter,
|
|
3990
|
-
view: AppListFilter,
|
|
3991
|
-
});
|
|
4053
|
+
edit: [AppFormItemType.IMAGE, AppFormItemType.ADDFILEATTACHMENT, AppFormItemType.CODEHTML]});
|
|
3992
4054
|
AppFormFixedList.concat(AppFormNotFields)
|
|
3993
4055
|
.concat(AppFormItemType.IDUSER)
|
|
3994
4056
|
.concat(AppFormItemType.TITLE);
|
|
@@ -4024,14 +4086,13 @@ function migrateJson(v1Json) {
|
|
|
4024
4086
|
installFor: v1.installFor || [],
|
|
4025
4087
|
};
|
|
4026
4088
|
function _renderFields() {
|
|
4027
|
-
var _a;
|
|
4028
4089
|
const v2Fields = [];
|
|
4029
4090
|
for (const v1FormItem of v1.form.formItems) {
|
|
4030
4091
|
const type = _matctTypes(v1FormItem.type);
|
|
4031
4092
|
v2Fields.push({
|
|
4032
4093
|
id: v1FormItem.id,
|
|
4033
4094
|
type,
|
|
4034
|
-
properties: _renderProperties(
|
|
4095
|
+
properties: _renderProperties(v1FormItem.properties ?? {}),
|
|
4035
4096
|
mandatory: v1FormItem.mandatory || false,
|
|
4036
4097
|
views: v1FormItem.views,
|
|
4037
4098
|
isActive: true,
|
|
@@ -4046,37 +4107,68 @@ function migrateJson(v1Json) {
|
|
|
4046
4107
|
return AppFormItemTypes[v1Type];
|
|
4047
4108
|
}
|
|
4048
4109
|
function _renderProperties(v1FormItemProperties) {
|
|
4049
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
4050
4110
|
const v2Properties = [];
|
|
4051
4111
|
const isEnhancedOptionEditor = v1FormItemProperties.options &&
|
|
4052
4112
|
Object.prototype.hasOwnProperty.call(v1FormItemProperties, 'hasDefaultValue');
|
|
4053
|
-
const baseProperty =
|
|
4113
|
+
const baseProperty = {
|
|
4114
|
+
isRequired: v1FormItemProperties.mandatory || false,
|
|
4115
|
+
...(isEnhancedOptionEditor && { isOptionsEditorEnhanced: true }),
|
|
4116
|
+
};
|
|
4054
4117
|
if (v1FormItemProperties.labels) {
|
|
4055
|
-
v2Properties.push(
|
|
4056
|
-
|
|
4118
|
+
v2Properties.push({
|
|
4119
|
+
propertyType: AppFieldFormPropertyTypes.LABEL,
|
|
4120
|
+
value: v1FormItemProperties.labels.label?.content || '',
|
|
4121
|
+
...baseProperty,
|
|
4122
|
+
});
|
|
4123
|
+
v2Properties.push({
|
|
4124
|
+
propertyType: AppFieldFormPropertyTypes.DESCRIPTION,
|
|
4125
|
+
value: v1FormItemProperties.labels.description?.content || '',
|
|
4126
|
+
...baseProperty,
|
|
4127
|
+
});
|
|
4057
4128
|
}
|
|
4058
4129
|
if (v1FormItemProperties.options) {
|
|
4059
|
-
v2Properties.push(
|
|
4130
|
+
v2Properties.push({
|
|
4131
|
+
propertyType: AppFieldFormPropertyTypes.OPTIONS_EDITOR,
|
|
4132
|
+
value: isEnhancedOptionEditor
|
|
4060
4133
|
? {
|
|
4061
|
-
propertyOptions: _renderSelectOptions(
|
|
4134
|
+
propertyOptions: _renderSelectOptions(v1FormItemProperties.options ?? []),
|
|
4062
4135
|
defaultSelectOptionValue: v1FormItemProperties.defaultValue,
|
|
4063
|
-
defaultSelectOption:
|
|
4064
|
-
canSelectMultiple:
|
|
4065
|
-
userCanModifiyByComment:
|
|
4136
|
+
defaultSelectOption: v1FormItemProperties.hasDefaultValue ?? false,
|
|
4137
|
+
canSelectMultiple: v1FormItemProperties.multiple ?? false,
|
|
4138
|
+
userCanModifiyByComment: v1FormItemProperties.explain ?? false,
|
|
4066
4139
|
}
|
|
4067
|
-
: { propertyOptions: _renderSelectOptions(
|
|
4140
|
+
: { propertyOptions: _renderSelectOptions(v1FormItemProperties.options ?? []) },
|
|
4141
|
+
...baseProperty,
|
|
4142
|
+
});
|
|
4068
4143
|
}
|
|
4069
4144
|
if (v1FormItemProperties.code) {
|
|
4070
|
-
v2Properties.push(
|
|
4145
|
+
v2Properties.push({
|
|
4146
|
+
propertyType: AppFieldFormPropertyTypes.RICHTEXT,
|
|
4147
|
+
value: { html: v1FormItemProperties.code.html, text: v1FormItemProperties.code.text },
|
|
4148
|
+
...baseProperty,
|
|
4149
|
+
});
|
|
4071
4150
|
}
|
|
4072
4151
|
if (Object.prototype.hasOwnProperty.call(v1FormItemProperties, 'digits')) {
|
|
4073
|
-
v2Properties.push(
|
|
4152
|
+
v2Properties.push({
|
|
4153
|
+
propertyType: AppFieldFormPropertyTypes.CHECKBOX,
|
|
4154
|
+
value: v1FormItemProperties.digits || false,
|
|
4155
|
+
checkBoxOptions: [{ label: 'APPSTUDIO_FormEditProps_Digits', value: v1FormItemProperties.digits }],
|
|
4156
|
+
...baseProperty,
|
|
4157
|
+
});
|
|
4074
4158
|
}
|
|
4075
4159
|
if (Object.prototype.hasOwnProperty.call(v1FormItemProperties, 'taxonomy')) {
|
|
4076
|
-
v2Properties.push(
|
|
4160
|
+
v2Properties.push({
|
|
4161
|
+
propertyType: AppFieldFormPropertyTypes.TAXONOMY,
|
|
4162
|
+
value: v1FormItemProperties.taxonomy || '',
|
|
4163
|
+
...baseProperty,
|
|
4164
|
+
});
|
|
4077
4165
|
}
|
|
4078
4166
|
if (Object.prototype.hasOwnProperty.call(v1FormItemProperties, 'contentType')) {
|
|
4079
|
-
v2Properties.push(
|
|
4167
|
+
v2Properties.push({
|
|
4168
|
+
propertyType: AppFieldFormPropertyTypes.CONTENTTYPE,
|
|
4169
|
+
value: v1FormItemProperties.contentType || '',
|
|
4170
|
+
...baseProperty,
|
|
4171
|
+
});
|
|
4080
4172
|
}
|
|
4081
4173
|
return v2Properties;
|
|
4082
4174
|
}
|
|
@@ -4113,24 +4205,48 @@ function migrateJson(v1Json) {
|
|
|
4113
4205
|
value: v1FormItemRef.fixedValue || '',
|
|
4114
4206
|
};
|
|
4115
4207
|
if (v1FormItemRef.ref === AppFormItemType.TITLE) {
|
|
4116
|
-
viewItems[v4()] =
|
|
4208
|
+
viewItems[v4()] = {
|
|
4209
|
+
...viewBase,
|
|
4210
|
+
type: ExtraAppFieldsItemViews.TITLE,
|
|
4211
|
+
isFixed: true,
|
|
4212
|
+
};
|
|
4117
4213
|
}
|
|
4118
4214
|
else if (v1FormItemRef.ref === AppFormItemType.IDUSER) {
|
|
4119
|
-
viewItems[v4()] =
|
|
4215
|
+
viewItems[v4()] = {
|
|
4216
|
+
...viewBase,
|
|
4217
|
+
type: ExtraAppFieldsItemViews.USER,
|
|
4218
|
+
isFixed: true,
|
|
4219
|
+
};
|
|
4120
4220
|
}
|
|
4121
4221
|
else if (v1FormItemRef.ref === AppFormItemType.PUBLISHTO) {
|
|
4122
|
-
viewItems[v4()] =
|
|
4222
|
+
viewItems[v4()] = {
|
|
4223
|
+
...viewBase,
|
|
4224
|
+
type: ExtraAppFieldsItemViews.PUBLISHTO,
|
|
4225
|
+
isOptional: true,
|
|
4226
|
+
};
|
|
4123
4227
|
}
|
|
4124
4228
|
else if (v1FormItemRef.ref === AppFormItemType.SENDALERTTOSUBSCRIBERS) {
|
|
4125
|
-
viewItems[v4()] =
|
|
4229
|
+
viewItems[v4()] = {
|
|
4230
|
+
...viewBase,
|
|
4231
|
+
type: ExtraAppFieldsItemViews.SENDALERTTOSUBSCRIBERS,
|
|
4232
|
+
isOptional: true,
|
|
4233
|
+
};
|
|
4126
4234
|
}
|
|
4127
4235
|
else if (v1FormItemRef.ref === AppFormItemType.RECEIVEACOPY) {
|
|
4128
|
-
viewItems[v4()] =
|
|
4236
|
+
viewItems[v4()] = {
|
|
4237
|
+
...viewBase,
|
|
4238
|
+
type: ExtraAppFieldsItemViews.RECEIVEACOPY,
|
|
4239
|
+
isOptional: true,
|
|
4240
|
+
};
|
|
4129
4241
|
}
|
|
4130
4242
|
else {
|
|
4131
4243
|
const v2Field = _mapFormItemRefWithField(v1FormItemRef);
|
|
4132
4244
|
if (v2Field) {
|
|
4133
|
-
viewItems[v2Field.id] =
|
|
4245
|
+
viewItems[v2Field.id] = {
|
|
4246
|
+
type: v2Field.type,
|
|
4247
|
+
...viewBase,
|
|
4248
|
+
properties: v2Field.properties || [],
|
|
4249
|
+
};
|
|
4134
4250
|
}
|
|
4135
4251
|
}
|
|
4136
4252
|
});
|
|
@@ -4236,7 +4352,7 @@ function _setFieldProperties(type) {
|
|
|
4236
4352
|
{ propertyType: AppFieldFormPropertyTypes.DESCRIPTION, value: '' },
|
|
4237
4353
|
{
|
|
4238
4354
|
propertyType: AppFieldFormPropertyTypes.TAXONOMY,
|
|
4239
|
-
value:
|
|
4355
|
+
value: { ...taxonomyDefaultValue },
|
|
4240
4356
|
},
|
|
4241
4357
|
];
|
|
4242
4358
|
case AppFormItemTypes.CONTENTLINK:
|
|
@@ -4245,7 +4361,7 @@ function _setFieldProperties(type) {
|
|
|
4245
4361
|
{ propertyType: AppFieldFormPropertyTypes.DESCRIPTION, value: '' },
|
|
4246
4362
|
{
|
|
4247
4363
|
propertyType: AppFieldFormPropertyTypes.CONTENTTYPE,
|
|
4248
|
-
value:
|
|
4364
|
+
value: { ...contentTypeDefaultValue },
|
|
4249
4365
|
},
|
|
4250
4366
|
];
|
|
4251
4367
|
default:
|
|
@@ -4254,7 +4370,11 @@ function _setFieldProperties(type) {
|
|
|
4254
4370
|
}
|
|
4255
4371
|
|
|
4256
4372
|
function _initField(type, installedField) {
|
|
4257
|
-
const field =
|
|
4373
|
+
const field = {
|
|
4374
|
+
...generateNewFormField(type, false),
|
|
4375
|
+
id: installedField.name,
|
|
4376
|
+
mandatory: installedField.mandatory,
|
|
4377
|
+
};
|
|
4258
4378
|
field.properties[0].value = installedField.label;
|
|
4259
4379
|
field.properties[1].value = installedField.description;
|
|
4260
4380
|
return field;
|
|
@@ -4270,14 +4390,21 @@ function _getOptions(installedOptions) {
|
|
|
4270
4390
|
return options;
|
|
4271
4391
|
}
|
|
4272
4392
|
function createAddfileattachmentField(installedField) {
|
|
4273
|
-
const field =
|
|
4393
|
+
const field = {
|
|
4394
|
+
...generateNewFormField(AppFormItemTypes.ADDFILEATTACHMENT, false),
|
|
4395
|
+
id: installedField.name,
|
|
4396
|
+
mandatory: installedField.mandatory,
|
|
4397
|
+
};
|
|
4274
4398
|
field.properties[0].value = installedField.label;
|
|
4275
4399
|
return field;
|
|
4276
4400
|
}
|
|
4277
4401
|
function createHtmlField(formItem) {
|
|
4278
|
-
const field =
|
|
4402
|
+
const field = {
|
|
4403
|
+
...generateNewFormField(AppFormItemTypes.CODEHTML, false),
|
|
4404
|
+
id: formItem.name,
|
|
4405
|
+
};
|
|
4279
4406
|
const code = formItem.properties.code;
|
|
4280
|
-
if (typeof code === 'object' &&
|
|
4407
|
+
if (typeof code === 'object' && code?.html && typeof code.html === 'string') {
|
|
4281
4408
|
field.properties[0].value = code.html;
|
|
4282
4409
|
}
|
|
4283
4410
|
else if (typeof code === 'string') {
|
|
@@ -4290,31 +4417,28 @@ function createImageField() {
|
|
|
4290
4417
|
return field;
|
|
4291
4418
|
}
|
|
4292
4419
|
function createNumberField(installedField) {
|
|
4293
|
-
var _a;
|
|
4294
4420
|
const field = _initField(AppFormItemTypes.NUMBER, installedField);
|
|
4295
|
-
field.properties[2].value =
|
|
4421
|
+
field.properties[2].value = installedField.widget.params?.step === '0.01';
|
|
4296
4422
|
return field;
|
|
4297
4423
|
}
|
|
4298
4424
|
function createTagsField(installedField) {
|
|
4299
|
-
var _a, _b;
|
|
4300
4425
|
const field = _initField(AppFormItemTypes.TAGS, installedField);
|
|
4301
|
-
field.properties[2].value.id = +(
|
|
4426
|
+
field.properties[2].value.id = +(installedField.widget.params?.idTaxonomy ?? 1);
|
|
4302
4427
|
return field;
|
|
4303
4428
|
}
|
|
4304
4429
|
function createSelectField(installedField) {
|
|
4305
|
-
var _a, _b, _c, _d, _e;
|
|
4306
4430
|
const field = _initField(AppFormItemTypes.SELECT, installedField);
|
|
4307
|
-
const defaultValue =
|
|
4431
|
+
const defaultValue = installedField.widget.params?.defaultValue
|
|
4308
4432
|
? {
|
|
4309
|
-
title: installedField.widget.options[
|
|
4310
|
-
value:
|
|
4433
|
+
title: installedField.widget.options[installedField.widget.params?.defaultValue],
|
|
4434
|
+
value: installedField.widget.params?.defaultValue,
|
|
4311
4435
|
}
|
|
4312
4436
|
: undefined;
|
|
4313
4437
|
const optionsEditorValue = {
|
|
4314
4438
|
propertyOptions: _getOptions(installedField.widget.options),
|
|
4315
4439
|
canSelectMultiple: installedField.widget.multiple === '1',
|
|
4316
|
-
userCanModifiyByComment:
|
|
4317
|
-
defaultSelectOption: !!
|
|
4440
|
+
userCanModifiyByComment: installedField.widget.params?.explain === '1',
|
|
4441
|
+
defaultSelectOption: !!installedField.widget.params?.defaultValue,
|
|
4318
4442
|
defaultSelectOptionValue: defaultValue,
|
|
4319
4443
|
};
|
|
4320
4444
|
field.properties[2].value = optionsEditorValue;
|
|
@@ -4334,12 +4458,11 @@ function createCheckboxField(installedField) {
|
|
|
4334
4458
|
return field;
|
|
4335
4459
|
}
|
|
4336
4460
|
function createContentLinkField(installedField, state) {
|
|
4337
|
-
var _a, _b;
|
|
4338
4461
|
const field = _initField(AppFormItemTypes.CONTENTLINK, installedField);
|
|
4339
|
-
field.properties[2].value.type =
|
|
4462
|
+
field.properties[2].value.type = installedField.widget.params.types ?? 'mpArticle';
|
|
4340
4463
|
const modelState = state.entities === undefined ? undefined : { entities: state.entities };
|
|
4341
4464
|
const model = modelState ? Model.selectors.selectById(modelState, field.properties[2].value.type) : undefined;
|
|
4342
|
-
field.properties[2].value.label =
|
|
4465
|
+
field.properties[2].value.label = model?.label ?? 'Article';
|
|
4343
4466
|
return field;
|
|
4344
4467
|
}
|
|
4345
4468
|
function createTextField(installedField) {
|
|
@@ -4411,7 +4534,6 @@ function appToXml(studioApp) {
|
|
|
4411
4534
|
</Application>`;
|
|
4412
4535
|
}
|
|
4413
4536
|
function createAppManifest(manifest, views, audience, installFor, idApp) {
|
|
4414
|
-
var _a;
|
|
4415
4537
|
return `<Manifest>
|
|
4416
4538
|
<ShowImport>true</ShowImport>
|
|
4417
4539
|
<AppShortName>${idApp}</AppShortName>
|
|
@@ -4421,7 +4543,7 @@ function createAppManifest(manifest, views, audience, installFor, idApp) {
|
|
|
4421
4543
|
<ManifestVersion>1.0</ManifestVersion>
|
|
4422
4544
|
<StudioVersion>2</StudioVersion>
|
|
4423
4545
|
<DateCreation>${manifest.dateCreation.toString().split('T')[0]}</DateCreation>
|
|
4424
|
-
<CssClass>${
|
|
4546
|
+
<CssClass>${manifest.cssClass?.label}</CssClass>
|
|
4425
4547
|
<CssColor>${manifest.cssColor}</CssColor>
|
|
4426
4548
|
<Categories>N.A.</Categories>
|
|
4427
4549
|
<Editor>Jamespot</Editor>
|
|
@@ -4497,14 +4619,14 @@ function renderAudience(audience, installFor) {
|
|
|
4497
4619
|
return '';
|
|
4498
4620
|
}
|
|
4499
4621
|
function renderPrimaryFields(fields) {
|
|
4500
|
-
const primaryFields = fields
|
|
4622
|
+
const primaryFields = fields?.filter((field) => AppFormPrimaryListValues.includes(field.type));
|
|
4501
4623
|
if (primaryFields.length === 0)
|
|
4502
4624
|
return '';
|
|
4503
4625
|
return `<primaryFields>${primaryFields.map((field) => formItem2xml(field)).join('')}</primaryFields>`;
|
|
4504
4626
|
}
|
|
4505
4627
|
function renderCustomFields(fields) {
|
|
4506
|
-
const customFields = fields
|
|
4507
|
-
const filteredCustomFields = customFields
|
|
4628
|
+
const customFields = fields?.filter((field) => !AppFormPrimaryListValues.includes(field.type));
|
|
4629
|
+
const filteredCustomFields = customFields?.filter((field) => field.type !== AppFormItemTypes.IMAGE);
|
|
4508
4630
|
if (filteredCustomFields.length === 0)
|
|
4509
4631
|
return '';
|
|
4510
4632
|
const articlesTablesItems = filteredCustomFields.filter((f) => f.type !== AppFormItemTypes.TAGS && !AppFormNonPrimaryList.includes(f.type));
|
|
@@ -4546,7 +4668,6 @@ function formItem2xml(field) {
|
|
|
4546
4668
|
</field>`;
|
|
4547
4669
|
}
|
|
4548
4670
|
function renderWidget(fieldType, fieldProperties) {
|
|
4549
|
-
var _a;
|
|
4550
4671
|
switch (fieldType) {
|
|
4551
4672
|
case AppFormItemTypes.DESCRIPTION:
|
|
4552
4673
|
return '<widget form="textarea"><params><param key="class" value="mceEditor"></param><param key="mention" value="1"></param></params></widget>';
|
|
@@ -4561,13 +4682,14 @@ function renderWidget(fieldType, fieldProperties) {
|
|
|
4561
4682
|
case AppFormItemTypes.DATETIME:
|
|
4562
4683
|
return `<widget form="datetime" format="d/m/Y H:i:s"></widget>`;
|
|
4563
4684
|
case AppFormItemTypes.NUMBER: {
|
|
4564
|
-
const isFloat =
|
|
4685
|
+
const isFloat = fieldProperties?.find((property) => property.propertyType === AppFieldFormPropertyTypes.CHECKBOX)
|
|
4686
|
+
?.value === true;
|
|
4565
4687
|
return `<widget form="number">
|
|
4566
4688
|
${isFloat ? `<params><param value="0.01" key="step"/></params>` : ''}
|
|
4567
4689
|
</widget>`;
|
|
4568
4690
|
}
|
|
4569
4691
|
case AppFormItemTypes.SELECT: {
|
|
4570
|
-
const optionEditor = fieldProperties
|
|
4692
|
+
const optionEditor = fieldProperties?.find((property) => property.propertyType === AppFieldFormPropertyTypes.OPTIONS_EDITOR);
|
|
4571
4693
|
if (!optionEditor)
|
|
4572
4694
|
return '';
|
|
4573
4695
|
const isMultiple = optionEditor.value.canSelectMultiple;
|
|
@@ -4591,7 +4713,7 @@ function renderWidget(fieldType, fieldProperties) {
|
|
|
4591
4713
|
</widget>`;
|
|
4592
4714
|
}
|
|
4593
4715
|
case AppFormItemTypes.RADIO: {
|
|
4594
|
-
const optionEditor = fieldProperties
|
|
4716
|
+
const optionEditor = fieldProperties?.find((property) => property.propertyType === AppFieldFormPropertyTypes.OPTIONS_EDITOR);
|
|
4595
4717
|
if (!optionEditor)
|
|
4596
4718
|
return '';
|
|
4597
4719
|
const options = optionEditor.value.propertyOptions;
|
|
@@ -4613,7 +4735,7 @@ function renderWidget(fieldType, fieldProperties) {
|
|
|
4613
4735
|
</params>
|
|
4614
4736
|
</widget>`;
|
|
4615
4737
|
case AppFormItemTypes.TAGS: {
|
|
4616
|
-
const taxonomy = fieldProperties
|
|
4738
|
+
const taxonomy = fieldProperties?.find((property) => property.propertyType === AppFieldFormPropertyTypes.TAXONOMY);
|
|
4617
4739
|
if (!taxonomy)
|
|
4618
4740
|
return '';
|
|
4619
4741
|
const taxonomyId = taxonomy.value.id;
|
|
@@ -4622,7 +4744,7 @@ function renderWidget(fieldType, fieldProperties) {
|
|
|
4622
4744
|
</widget>`;
|
|
4623
4745
|
}
|
|
4624
4746
|
case AppFormItemTypes.CHECKBOX: {
|
|
4625
|
-
const optionEditor = fieldProperties
|
|
4747
|
+
const optionEditor = fieldProperties?.find((property) => property.propertyType === AppFieldFormPropertyTypes.OPTIONS_EDITOR);
|
|
4626
4748
|
if (!optionEditor)
|
|
4627
4749
|
return '';
|
|
4628
4750
|
const options = optionEditor.value.propertyOptions;
|
|
@@ -4654,7 +4776,7 @@ function renderWidget(fieldType, fieldProperties) {
|
|
|
4654
4776
|
</params>
|
|
4655
4777
|
</widget>`;
|
|
4656
4778
|
case AppFormItemTypes.CONTENTLINK: {
|
|
4657
|
-
const contentType = fieldProperties
|
|
4779
|
+
const contentType = fieldProperties?.find((property) => property.propertyType === AppFieldFormPropertyTypes.CONTENTTYPE);
|
|
4658
4780
|
if (!contentType)
|
|
4659
4781
|
return '';
|
|
4660
4782
|
const type = contentType.value.type;
|
|
@@ -4673,7 +4795,7 @@ function renderWidget(fieldType, fieldProperties) {
|
|
|
4673
4795
|
}
|
|
4674
4796
|
}
|
|
4675
4797
|
function renderProperty(properties, propertyToFind) {
|
|
4676
|
-
const labelProperty = properties
|
|
4798
|
+
const labelProperty = properties?.find((property) => property.propertyType === propertyToFind);
|
|
4677
4799
|
if (labelProperty) {
|
|
4678
4800
|
const value = labelProperty.value.replaceAll('"', '"');
|
|
4679
4801
|
return `${propertyToFind.toLowerCase()}="${value}"`;
|
|
@@ -4812,7 +4934,6 @@ function getDisplayName(fieldId, view) {
|
|
|
4812
4934
|
}
|
|
4813
4935
|
}
|
|
4814
4936
|
function renderDisplayAttr(fieldId, view) {
|
|
4815
|
-
var _a, _b, _c;
|
|
4816
4937
|
let xml = '';
|
|
4817
4938
|
const attrName = getDisplayName(fieldId, view);
|
|
4818
4939
|
const isFixed = view.isLockedValue;
|
|
@@ -4832,7 +4953,7 @@ function renderDisplayAttr(fieldId, view) {
|
|
|
4832
4953
|
xml += `<input type="hidden" name="${attrName}[]" value=${JSON.stringify(view.value.uri)}>`;
|
|
4833
4954
|
}
|
|
4834
4955
|
else if (view.type === AppFormItemTypes.SELECT) {
|
|
4835
|
-
const canSelectMultiple =
|
|
4956
|
+
const canSelectMultiple = view.properties.find((property) => property.propertyType === AppFieldFormPropertyTypes.OPTIONS_EDITOR)?.value.canSelectMultiple;
|
|
4836
4957
|
if (canSelectMultiple) {
|
|
4837
4958
|
const values = view.value;
|
|
4838
4959
|
values.forEach((value) => {
|
|
@@ -4868,7 +4989,9 @@ function renderDisplayAttr(fieldId, view) {
|
|
|
4868
4989
|
xml += '<input type="hidden" name="' + attrName + '" value="' + xmlFixedValue + '">';
|
|
4869
4990
|
}
|
|
4870
4991
|
else if (view.type === AppFormItemTypes.TAGS) {
|
|
4871
|
-
xml += `<input type="hidden" name="${attrName}" value="${
|
|
4992
|
+
xml += `<input type="hidden" name="${attrName}" value="${view.value
|
|
4993
|
+
?.map((v) => v.uri)
|
|
4994
|
+
?.join(',')}">`;
|
|
4872
4995
|
}
|
|
4873
4996
|
else if (view.type === AppFormItemTypes.DESCRIPTION || view.type === AppFormItemTypes.TEXTAREAHTML) {
|
|
4874
4997
|
xml += `<input type="hidden" name="${attrName}" value="${view.value}">`;
|
|
@@ -4929,15 +5052,14 @@ const specialAttrName = ['title', 'alertAuthor', 'sendAlert'];
|
|
|
4929
5052
|
const ignoredFields = ['edito'];
|
|
4930
5053
|
function updateViewsFromFields(views, syncViewFieldOrder, appFields) {
|
|
4931
5054
|
return Object.assign({}, ...viewsList.map((view) => {
|
|
4932
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4933
5055
|
const viewItems = {};
|
|
4934
5056
|
let viewMissingOptionalFields = [];
|
|
4935
|
-
if (
|
|
4936
|
-
viewMissingOptionalFields = viewMissingOptionalFields.concat(
|
|
5057
|
+
if (MapExtraFieldsWithView[view]?.optional !== undefined) {
|
|
5058
|
+
viewMissingOptionalFields = viewMissingOptionalFields.concat(MapExtraFieldsWithView[view]?.optional ?? []);
|
|
4937
5059
|
}
|
|
4938
5060
|
let viewMissingFixedFields = [];
|
|
4939
|
-
if (
|
|
4940
|
-
viewMissingFixedFields = viewMissingFixedFields.concat(
|
|
5061
|
+
if (MapExtraFieldsWithView[view]?.fixed !== undefined) {
|
|
5062
|
+
viewMissingFixedFields = viewMissingFixedFields.concat(MapExtraFieldsWithView[view]?.fixed ?? []);
|
|
4941
5063
|
}
|
|
4942
5064
|
Object.entries(views[view]).forEach(([fieldId, field]) => {
|
|
4943
5065
|
if (field.isFixed) {
|
|
@@ -4952,11 +5074,11 @@ function updateViewsFromFields(views, syncViewFieldOrder, appFields) {
|
|
|
4952
5074
|
const missingFieldsSet = new Set(viewMissingFixedFields.concat(viewMissingOptionalFields));
|
|
4953
5075
|
const fieldTypeHandlers = {
|
|
4954
5076
|
[ExtraAppFieldsItemViews.CREATIONDATE]: () => getDateCreationToView(false),
|
|
4955
|
-
[ExtraAppFieldsItemViews.TITLE]: () => getTitleToView({
|
|
5077
|
+
[ExtraAppFieldsItemViews.TITLE]: () => getTitleToView({ fixedValue: undefined }),
|
|
4956
5078
|
[ExtraAppFieldsItemViews.USER]: () => getUserToView(false),
|
|
4957
|
-
[ExtraAppFieldsItemViews.RECEIVEACOPY]: () => getAlertAuthorToView({
|
|
4958
|
-
[ExtraAppFieldsItemViews.SENDALERTTOSUBSCRIBERS]: () => getSendAlertToView({
|
|
4959
|
-
[ExtraAppFieldsItemViews.PUBLISHTO]: () => getPublishToToView({
|
|
5079
|
+
[ExtraAppFieldsItemViews.RECEIVEACOPY]: () => getAlertAuthorToView({ fixedValue: undefined }),
|
|
5080
|
+
[ExtraAppFieldsItemViews.SENDALERTTOSUBSCRIBERS]: () => getSendAlertToView({ fixedValue: undefined }),
|
|
5081
|
+
[ExtraAppFieldsItemViews.PUBLISHTO]: () => getPublishToToView({ fixedValue: undefined }),
|
|
4960
5082
|
};
|
|
4961
5083
|
missingFieldsSet.forEach((fieldType) => {
|
|
4962
5084
|
const handler = fieldTypeHandlers[fieldType];
|
|
@@ -4970,35 +5092,34 @@ function updateViewsFromFields(views, syncViewFieldOrder, appFields) {
|
|
|
4970
5092
|
});
|
|
4971
5093
|
const newFields = [];
|
|
4972
5094
|
appFields.forEach((field, idx) => {
|
|
4973
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4974
5095
|
const isFieldUsedInView = field.views[view];
|
|
4975
5096
|
const isExistingField = Object.keys(views[view]).includes(field.id);
|
|
4976
5097
|
const fieldType = field.type;
|
|
4977
|
-
if (AppFormBannedFromViews$1.get(fieldType) &&
|
|
5098
|
+
if (AppFormBannedFromViews$1.get(fieldType) && AppFormBannedFromViews$1.get(fieldType)?.includes(view)) {
|
|
4978
5099
|
return;
|
|
4979
5100
|
}
|
|
4980
5101
|
let fieldValue = undefined;
|
|
4981
5102
|
if (fieldType === AppFormItemTypes.CODEHTML) {
|
|
4982
|
-
const richTextProperty =
|
|
4983
|
-
if (richTextProperty
|
|
4984
|
-
fieldValue = richTextProperty
|
|
5103
|
+
const richTextProperty = field.properties?.find((prop) => prop.propertyType === AppFieldFormPropertyTypes.RICHTEXT);
|
|
5104
|
+
if (richTextProperty?.value) {
|
|
5105
|
+
fieldValue = richTextProperty?.value;
|
|
4985
5106
|
}
|
|
4986
5107
|
}
|
|
4987
5108
|
if (fieldType === AppFormItemTypes.SELECT) {
|
|
4988
|
-
const selectProperty =
|
|
5109
|
+
const selectProperty = field.properties?.find((prop) => prop.propertyType === AppFieldFormPropertyTypes.OPTIONS_EDITOR);
|
|
4989
5110
|
if (isExistingField) {
|
|
4990
5111
|
const exField = views[view][field.id];
|
|
4991
|
-
const exSelectProperty =
|
|
4992
|
-
const isMultivalued = !!
|
|
4993
|
-
const exIsMultivalued = !!
|
|
5112
|
+
const exSelectProperty = exField.properties?.find((prop) => prop.propertyType === AppFieldFormPropertyTypes.OPTIONS_EDITOR);
|
|
5113
|
+
const isMultivalued = !!selectProperty?.value?.canSelectMultiple;
|
|
5114
|
+
const exIsMultivalued = !!exSelectProperty?.value?.canSelectMultiple;
|
|
4994
5115
|
if (isMultivalued === exIsMultivalued) {
|
|
4995
5116
|
fieldValue = exField.value;
|
|
4996
5117
|
}
|
|
4997
5118
|
}
|
|
4998
5119
|
else {
|
|
4999
|
-
const isEnhancedSelect = !!
|
|
5000
|
-
const defaultValue = isEnhancedSelect && !!
|
|
5001
|
-
? selectProperty
|
|
5120
|
+
const isEnhancedSelect = !!selectProperty?.isOptionsEditorEnhanced;
|
|
5121
|
+
const defaultValue = isEnhancedSelect && !!selectProperty?.value.defaultSelectOption
|
|
5122
|
+
? selectProperty?.value.defaultSelectOptionValue
|
|
5002
5123
|
: '';
|
|
5003
5124
|
if (defaultValue) {
|
|
5004
5125
|
fieldValue = defaultValue;
|
|
@@ -5007,7 +5128,14 @@ function updateViewsFromFields(views, syncViewFieldOrder, appFields) {
|
|
|
5007
5128
|
}
|
|
5008
5129
|
if (isExistingField) {
|
|
5009
5130
|
const exField = views[view][field.id];
|
|
5010
|
-
viewItems[field.id] =
|
|
5131
|
+
viewItems[field.id] = {
|
|
5132
|
+
...exField,
|
|
5133
|
+
properties: field.properties || exField.properties || [],
|
|
5134
|
+
...(fieldValue !== undefined && { value: fieldValue }),
|
|
5135
|
+
isUsed: isFieldUsedInView,
|
|
5136
|
+
pos: syncViewFieldOrder?.[view] ? idx : exField.pos,
|
|
5137
|
+
isLockedValue: (fieldValue !== undefined || exField.value !== undefined) && exField.isLockedValue,
|
|
5138
|
+
};
|
|
5011
5139
|
}
|
|
5012
5140
|
else {
|
|
5013
5141
|
newFields.push({ id: field.id, idx: idx });
|
|
@@ -5019,12 +5147,12 @@ function updateViewsFromFields(views, syncViewFieldOrder, appFields) {
|
|
|
5019
5147
|
isOptional: false,
|
|
5020
5148
|
isLockedValue: false,
|
|
5021
5149
|
isFixed: false,
|
|
5022
|
-
value: fieldValue
|
|
5023
|
-
pos:
|
|
5150
|
+
value: fieldValue ?? null,
|
|
5151
|
+
pos: syncViewFieldOrder?.[view] ? idx : existingFieldsLen + idx,
|
|
5024
5152
|
};
|
|
5025
5153
|
}
|
|
5026
5154
|
});
|
|
5027
|
-
if (!
|
|
5155
|
+
if (!syncViewFieldOrder?.[view]) {
|
|
5028
5156
|
newFields.forEach((nf) => {
|
|
5029
5157
|
const item = viewItems[nf.id];
|
|
5030
5158
|
item.pos = nf.idx + 1;
|
|
@@ -5083,7 +5211,7 @@ function buildView(appS, registeredFields, displayName, displayValue, tables, st
|
|
|
5083
5211
|
const newName = installedToV2ViewNames[displayName];
|
|
5084
5212
|
appS.views[newName] = {};
|
|
5085
5213
|
if (newName === 'view') {
|
|
5086
|
-
const [localFieldIdTitle, localFieldTitle] = getTitleToView({ fixedValue: undefined
|
|
5214
|
+
const [localFieldIdTitle, localFieldTitle] = getTitleToView({ fixedValue: undefined});
|
|
5087
5215
|
appS.views[newName][localFieldIdTitle] = localFieldTitle;
|
|
5088
5216
|
}
|
|
5089
5217
|
displayValue.composants.forEach((viewComponent, index) => {
|
|
@@ -5144,7 +5272,7 @@ function buildFilterView(appS, registeredFields, attrExposed, tables, state) {
|
|
|
5144
5272
|
function addFieldToViewFromRef(appS, registeredFields, tables, viewName, fieldRef, index, state) {
|
|
5145
5273
|
switch (fieldRef) {
|
|
5146
5274
|
case 'title':
|
|
5147
|
-
const [fieldIDTitle, fieldInfoTitle] = getTitleToView({
|
|
5275
|
+
const [fieldIDTitle, fieldInfoTitle] = getTitleToView({ fixedValue: undefined });
|
|
5148
5276
|
appS['views'][viewName][fieldIDTitle] = fieldInfoTitle;
|
|
5149
5277
|
break;
|
|
5150
5278
|
case 'iduser':
|
|
@@ -5205,14 +5333,14 @@ function createOrGetField(appS, registeredFields, viewComponent, tables, state)
|
|
|
5205
5333
|
const formItemRefString = htmlCode.substring(startPos, endPos);
|
|
5206
5334
|
try {
|
|
5207
5335
|
const formItemRef = JSON.parse(formItemRefString);
|
|
5208
|
-
if (
|
|
5336
|
+
if (formItemRef?.ref.toUpperCase() in ExtraAppFieldsItemViews) {
|
|
5209
5337
|
const ref = formItemRef.ref.toUpperCase();
|
|
5210
|
-
return [-1,
|
|
5338
|
+
return [-1, { ...formItemRef, ref: fieldType(ref) }];
|
|
5211
5339
|
}
|
|
5212
|
-
if (specialAttrName.includes(formItemRef
|
|
5340
|
+
if (specialAttrName.includes(formItemRef?.ref)) {
|
|
5213
5341
|
return [-1, formItemRef];
|
|
5214
5342
|
}
|
|
5215
|
-
const knownIndex = registeredFields.get(formItemRef
|
|
5343
|
+
const knownIndex = registeredFields.get(formItemRef?.ref);
|
|
5216
5344
|
if (knownIndex !== undefined) {
|
|
5217
5345
|
return [knownIndex, formItemRef];
|
|
5218
5346
|
}
|
|
@@ -5231,7 +5359,7 @@ function createOrGetField(appS, registeredFields, viewComponent, tables, state)
|
|
|
5231
5359
|
const endPosCode = htmlCode.indexOf('</JAMESPOT.STUDIO.CODEHTML>');
|
|
5232
5360
|
const formItemString = htmlCode.substring(startPosCode, endPosCode);
|
|
5233
5361
|
const formItem = JSON.parse(formItemString);
|
|
5234
|
-
const knownIndex = registeredFields.get(formItem
|
|
5362
|
+
const knownIndex = registeredFields.get(formItem?.name);
|
|
5235
5363
|
if (knownIndex !== undefined) {
|
|
5236
5364
|
return [knownIndex, undefined];
|
|
5237
5365
|
}
|
|
@@ -5314,10 +5442,9 @@ function createStudioDefinedField(appS, ref, tables, state) {
|
|
|
5314
5442
|
return [ref, index];
|
|
5315
5443
|
}
|
|
5316
5444
|
function getInstalledField(ref, tables) {
|
|
5317
|
-
var _a;
|
|
5318
5445
|
let foundField = undefined;
|
|
5319
5446
|
for (let i = 0; i < tables.length && !foundField; i++) {
|
|
5320
|
-
foundField =
|
|
5447
|
+
foundField = tables[i]?.attributes.find((attr) => {
|
|
5321
5448
|
return attr.name === ref;
|
|
5322
5449
|
});
|
|
5323
5450
|
}
|
|
@@ -5327,7 +5454,6 @@ function getInstalledField(ref, tables) {
|
|
|
5327
5454
|
return foundField;
|
|
5328
5455
|
}
|
|
5329
5456
|
function addFieldToView(viewName, field, appS, index, fixedInfo) {
|
|
5330
|
-
var _a;
|
|
5331
5457
|
if (field.views) {
|
|
5332
5458
|
field.views[viewName] = true;
|
|
5333
5459
|
appS.views[viewName][field.id] = {
|
|
@@ -5335,15 +5461,14 @@ function addFieldToView(viewName, field, appS, index, fixedInfo) {
|
|
|
5335
5461
|
properties: field.properties || [],
|
|
5336
5462
|
isUsed: true,
|
|
5337
5463
|
isOptional: false,
|
|
5338
|
-
isLockedValue: !!
|
|
5464
|
+
isLockedValue: !!fixedInfo?.fixedValue,
|
|
5339
5465
|
isFixed: false,
|
|
5340
|
-
value:
|
|
5466
|
+
value: fixedInfo?.fixedValue ?? null,
|
|
5341
5467
|
pos: index,
|
|
5342
5468
|
};
|
|
5343
5469
|
}
|
|
5344
5470
|
}
|
|
5345
5471
|
function getFormItemType(installedField) {
|
|
5346
|
-
var _a, _b, _c;
|
|
5347
5472
|
switch (installedField.widget.type) {
|
|
5348
5473
|
case 'number':
|
|
5349
5474
|
return AppFormItemTypes.NUMBER;
|
|
@@ -5364,15 +5489,15 @@ function getFormItemType(installedField) {
|
|
|
5364
5489
|
case 'file':
|
|
5365
5490
|
return AppFormItemTypes.ADDFILEATTACHMENT;
|
|
5366
5491
|
case 'checkbox':
|
|
5367
|
-
if (
|
|
5492
|
+
if (installedField.widget.options?.['1'] === 'GLOBAL_Yes') {
|
|
5368
5493
|
return AppFormItemTypes.TOGGLE;
|
|
5369
5494
|
}
|
|
5370
5495
|
return AppFormItemTypes.CHECKBOX;
|
|
5371
5496
|
case 'uri':
|
|
5372
|
-
if (
|
|
5497
|
+
if (installedField.widget.params?.views === 'user') {
|
|
5373
5498
|
return AppFormItemTypes.USERLINK;
|
|
5374
5499
|
}
|
|
5375
|
-
if (
|
|
5500
|
+
if (installedField.widget.params?.views === 'article') {
|
|
5376
5501
|
return AppFormItemTypes.CONTENTLINK;
|
|
5377
5502
|
}
|
|
5378
5503
|
break;
|
|
@@ -5396,7 +5521,6 @@ function getFormItemType(installedField) {
|
|
|
5396
5521
|
JSON.stringify(installedField));
|
|
5397
5522
|
}
|
|
5398
5523
|
function getTitleToView(fixedInfo, isUsed = true) {
|
|
5399
|
-
var _a;
|
|
5400
5524
|
return [
|
|
5401
5525
|
'title',
|
|
5402
5526
|
{
|
|
@@ -5404,9 +5528,9 @@ function getTitleToView(fixedInfo, isUsed = true) {
|
|
|
5404
5528
|
properties: [],
|
|
5405
5529
|
isUsed: isUsed,
|
|
5406
5530
|
isOptional: false,
|
|
5407
|
-
isLockedValue: !!
|
|
5531
|
+
isLockedValue: !!fixedInfo?.fixedValue,
|
|
5408
5532
|
isFixed: true,
|
|
5409
|
-
value:
|
|
5533
|
+
value: fixedInfo?.fixedValue ?? null,
|
|
5410
5534
|
pos: 0,
|
|
5411
5535
|
},
|
|
5412
5536
|
];
|
|
@@ -5419,9 +5543,9 @@ function getAlertAuthorToView(fixedInfo, isUsed = true) {
|
|
|
5419
5543
|
properties: [],
|
|
5420
5544
|
isUsed: isUsed,
|
|
5421
5545
|
isOptional: true,
|
|
5422
|
-
isLockedValue:
|
|
5546
|
+
isLockedValue: fixedInfo?.fixedValue !== undefined,
|
|
5423
5547
|
isFixed: false,
|
|
5424
|
-
value:
|
|
5548
|
+
value: fixedInfo?.fixedValue !== undefined ? fixedInfo?.fixedValue : true,
|
|
5425
5549
|
pos: 300,
|
|
5426
5550
|
},
|
|
5427
5551
|
];
|
|
@@ -5434,15 +5558,14 @@ function getSendAlertToView(fixedInfo, isUsed = true) {
|
|
|
5434
5558
|
properties: [],
|
|
5435
5559
|
isUsed: isUsed,
|
|
5436
5560
|
isOptional: true,
|
|
5437
|
-
isLockedValue:
|
|
5561
|
+
isLockedValue: fixedInfo?.fixedValue !== undefined,
|
|
5438
5562
|
isFixed: false,
|
|
5439
|
-
value:
|
|
5563
|
+
value: fixedInfo?.fixedValue !== undefined ? fixedInfo?.fixedValue : true,
|
|
5440
5564
|
pos: 200,
|
|
5441
5565
|
},
|
|
5442
5566
|
];
|
|
5443
5567
|
}
|
|
5444
5568
|
function getPublishToToView(fixedInfo, isUsed = true) {
|
|
5445
|
-
var _a;
|
|
5446
5569
|
return [
|
|
5447
5570
|
'publishTo',
|
|
5448
5571
|
{
|
|
@@ -5450,9 +5573,9 @@ function getPublishToToView(fixedInfo, isUsed = true) {
|
|
|
5450
5573
|
properties: [],
|
|
5451
5574
|
isUsed: isUsed,
|
|
5452
5575
|
isOptional: true,
|
|
5453
|
-
isLockedValue: !!
|
|
5576
|
+
isLockedValue: !!fixedInfo?.fixedValue,
|
|
5454
5577
|
isFixed: false,
|
|
5455
|
-
value:
|
|
5578
|
+
value: fixedInfo?.fixedValue ?? [],
|
|
5456
5579
|
pos: 100,
|
|
5457
5580
|
},
|
|
5458
5581
|
];
|
|
@@ -5489,7 +5612,6 @@ function getDateCreationToView(isUsed = true) {
|
|
|
5489
5612
|
}
|
|
5490
5613
|
|
|
5491
5614
|
function InstalledAppStudioAdapter(serverApp, serverApps, state) {
|
|
5492
|
-
var _a, _b, _c, _d, _e, _f;
|
|
5493
5615
|
const { version, dateCreation } = serverApp.manifest;
|
|
5494
5616
|
const appTypeServer = serverApp.typeModel;
|
|
5495
5617
|
const views = Object.assign({}, ...viewsList.map((view) => ({
|
|
@@ -5505,8 +5627,8 @@ function InstalledAppStudioAdapter(serverApp, serverApps, state) {
|
|
|
5505
5627
|
appName: serverApp.label,
|
|
5506
5628
|
description: serverApp.description,
|
|
5507
5629
|
author: serverApp.author,
|
|
5508
|
-
cssColor:
|
|
5509
|
-
cssClass: { label:
|
|
5630
|
+
cssColor: appTypeServer.cssColor ?? '#392994',
|
|
5631
|
+
cssClass: { label: appTypeServer.cssClass ?? 'star', value: appTypeServer.cssClass ?? 'star' },
|
|
5510
5632
|
version: version,
|
|
5511
5633
|
dateCreation: dateCreation,
|
|
5512
5634
|
checkAccess: false,
|
|
@@ -5514,8 +5636,8 @@ function InstalledAppStudioAdapter(serverApp, serverApps, state) {
|
|
|
5514
5636
|
attrExposed: [],
|
|
5515
5637
|
viewSolr: serverApp.view ? STUDIO_VIEW.SOLR : STUDIO_VIEW.NOT_SOLR,
|
|
5516
5638
|
typeLabel: appTypeServer.typeLabel,
|
|
5517
|
-
articlesCount:
|
|
5518
|
-
displayContentLegacyTable: !!
|
|
5639
|
+
articlesCount: serverApp.articlesCount ?? 0,
|
|
5640
|
+
displayContentLegacyTable: !!typedApp?.typeModel?.displays?.['displayDisabled'],
|
|
5519
5641
|
},
|
|
5520
5642
|
fields: [],
|
|
5521
5643
|
views,
|
|
@@ -5553,7 +5675,7 @@ function DraftAppStudioAdapter(serverApp) {
|
|
|
5553
5675
|
};
|
|
5554
5676
|
}
|
|
5555
5677
|
else {
|
|
5556
|
-
return
|
|
5678
|
+
return { ...migrateJson(parsedJson), status: _formatStatus(serverApp), migratedFrom: 1 };
|
|
5557
5679
|
}
|
|
5558
5680
|
}
|
|
5559
5681
|
function _formatStatus(serverApp) {
|
|
@@ -5599,11 +5721,11 @@ const initialState$1 = {
|
|
|
5599
5721
|
installStudioAppStatus: 'idle',
|
|
5600
5722
|
hasChanged: false,
|
|
5601
5723
|
};
|
|
5602
|
-
const fetchCurrentStudioApp = createAsyncThunk('studio/fetchCurrentStudioApp', ({ idApp, status }, { extra, rejectWithValue, getState }) =>
|
|
5724
|
+
const fetchCurrentStudioApp = createAsyncThunk('studio/fetchCurrentStudioApp', async ({ idApp, status }, { extra, rejectWithValue, getState }) => {
|
|
5603
5725
|
const jApi = extra.jApi;
|
|
5604
5726
|
const error = { error: 1, errorMsg: 'Error fetching application' };
|
|
5605
5727
|
try {
|
|
5606
|
-
const studioApplicationBase = (
|
|
5728
|
+
const studioApplicationBase = (await jApi.application.studioGet(idApp, status)).result;
|
|
5607
5729
|
const studioApplication = serverAppsToStudioApps([studioApplicationBase], getState())[0];
|
|
5608
5730
|
if (!studioApplication) {
|
|
5609
5731
|
return rejectWithValue(error);
|
|
@@ -5613,8 +5735,8 @@ const fetchCurrentStudioApp = createAsyncThunk('studio/fetchCurrentStudioApp', (
|
|
|
5613
5735
|
catch (_) {
|
|
5614
5736
|
return rejectWithValue(error);
|
|
5615
5737
|
}
|
|
5616
|
-
})
|
|
5617
|
-
const saveCurrentStudioApp = createAsyncThunk('studio/saveCurrentStudioApp', (_, { extra, rejectWithValue, getState, dispatch }) =>
|
|
5738
|
+
});
|
|
5739
|
+
const saveCurrentStudioApp = createAsyncThunk('studio/saveCurrentStudioApp', async (_, { extra, rejectWithValue, getState, dispatch }) => {
|
|
5618
5740
|
const jApi = extra.jApi;
|
|
5619
5741
|
const error = { error: 1, errorMsg: 'Error saving application' };
|
|
5620
5742
|
const currentStudioApp = getState().studio.currentStudioApp.currentStudioApp;
|
|
@@ -5623,7 +5745,7 @@ const saveCurrentStudioApp = createAsyncThunk('studio/saveCurrentStudioApp', (_,
|
|
|
5623
5745
|
}
|
|
5624
5746
|
const stringifiedApp = JSON.stringify(currentStudioApp);
|
|
5625
5747
|
try {
|
|
5626
|
-
|
|
5748
|
+
await jApi.application.studioSave(currentStudioApp.idApp, stringifiedApp, 'saved');
|
|
5627
5749
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Edition_Saved' }));
|
|
5628
5750
|
return;
|
|
5629
5751
|
}
|
|
@@ -5631,8 +5753,8 @@ const saveCurrentStudioApp = createAsyncThunk('studio/saveCurrentStudioApp', (_,
|
|
|
5631
5753
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5632
5754
|
return rejectWithValue(error);
|
|
5633
5755
|
}
|
|
5634
|
-
})
|
|
5635
|
-
const installStudioApp = createAsyncThunk('studio/installApp', ({ callback }, { extra, rejectWithValue, getState, dispatch }) =>
|
|
5756
|
+
});
|
|
5757
|
+
const installStudioApp = createAsyncThunk('studio/installApp', async ({ callback }, { extra, rejectWithValue, getState, dispatch }) => {
|
|
5636
5758
|
const jApi = extra.jApi;
|
|
5637
5759
|
const error = { error: 1, errorMsg: 'Error saving application' };
|
|
5638
5760
|
const currentStudioApp = getState().studio.currentStudioApp.currentStudioApp;
|
|
@@ -5641,7 +5763,7 @@ const installStudioApp = createAsyncThunk('studio/installApp', ({ callback }, {
|
|
|
5641
5763
|
}
|
|
5642
5764
|
const xml = appToXml(currentStudioApp);
|
|
5643
5765
|
try {
|
|
5644
|
-
|
|
5766
|
+
await jApi.application.studioInstall(xml);
|
|
5645
5767
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Installed' }));
|
|
5646
5768
|
if (callback)
|
|
5647
5769
|
callback();
|
|
@@ -5651,7 +5773,7 @@ const installStudioApp = createAsyncThunk('studio/installApp', ({ callback }, {
|
|
|
5651
5773
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5652
5774
|
return rejectWithValue(error);
|
|
5653
5775
|
}
|
|
5654
|
-
})
|
|
5776
|
+
});
|
|
5655
5777
|
const CurrentStudioAppSlice = createSlice({
|
|
5656
5778
|
name: 'currentStudioApp',
|
|
5657
5779
|
initialState: initialState$1,
|
|
@@ -5718,7 +5840,15 @@ function cloneStudioAppFromExistingApp(existingApp, author, inWorkVersion) {
|
|
|
5718
5840
|
const newAppName = `${existingApp.manifest.appName} Copie`;
|
|
5719
5841
|
newApp.idApp = newAppId;
|
|
5720
5842
|
newApp.status = APP_STATUS_TYPE.DRAFT;
|
|
5721
|
-
newApp.manifest =
|
|
5843
|
+
newApp.manifest = {
|
|
5844
|
+
...newApp.manifest,
|
|
5845
|
+
appName: newAppName,
|
|
5846
|
+
appShortName: newAppName,
|
|
5847
|
+
author: author || newApp.manifest.author || '',
|
|
5848
|
+
dateCreation: new Date().toISOString(),
|
|
5849
|
+
version: 0.1,
|
|
5850
|
+
articlesCount: 0,
|
|
5851
|
+
};
|
|
5722
5852
|
}
|
|
5723
5853
|
else {
|
|
5724
5854
|
newApp.manifest.version = newApp.manifest.version + 0.1;
|
|
@@ -5729,9 +5859,8 @@ function cloneStudioAppFromExistingApp(existingApp, author, inWorkVersion) {
|
|
|
5729
5859
|
function createNewStudioApp$1({ author, appName }) {
|
|
5730
5860
|
const newAppId = v4();
|
|
5731
5861
|
const views = Object.assign({}, ...viewsList.map((view) => {
|
|
5732
|
-
var _a, _b;
|
|
5733
5862
|
const viewItems = {};
|
|
5734
|
-
|
|
5863
|
+
MapExtraFieldsWithView[view]?.fixed.forEach((fixedField, idx) => {
|
|
5735
5864
|
viewItems[v4()] = {
|
|
5736
5865
|
type: fixedField,
|
|
5737
5866
|
properties: [],
|
|
@@ -5743,7 +5872,7 @@ function createNewStudioApp$1({ author, appName }) {
|
|
|
5743
5872
|
pos: idx,
|
|
5744
5873
|
};
|
|
5745
5874
|
});
|
|
5746
|
-
|
|
5875
|
+
MapExtraFieldsWithView[view]?.optional.forEach((optionalField, idx) => {
|
|
5747
5876
|
viewItems[v4()] = {
|
|
5748
5877
|
type: optionalField,
|
|
5749
5878
|
properties: [],
|
|
@@ -5813,16 +5942,16 @@ const initialState = {
|
|
|
5813
5942
|
createInWorkAppStatus: 'idle',
|
|
5814
5943
|
createNewStudioAppStatus: 'idle',
|
|
5815
5944
|
};
|
|
5816
|
-
const fetchStudioAppsList = createAsyncThunk('studio/appsList', (intl, { extra, rejectWithValue, dispatch, getState }) =>
|
|
5945
|
+
const fetchStudioAppsList = createAsyncThunk('studio/appsList', async (intl, { extra, rejectWithValue, dispatch, getState }) => {
|
|
5817
5946
|
const jApi = extra.jApi;
|
|
5818
5947
|
try {
|
|
5819
|
-
const { result } =
|
|
5820
|
-
const taxonomies =
|
|
5821
|
-
const appsPromisesResult =
|
|
5822
|
-
const coreApp = (
|
|
5823
|
-
const articlesCount = (
|
|
5824
|
-
return
|
|
5825
|
-
}))
|
|
5948
|
+
const { result } = await jApi.application.studioList();
|
|
5949
|
+
const taxonomies = await jApi.taxonomy.list();
|
|
5950
|
+
const appsPromisesResult = await Promise.allSettled(result.map(async (app) => {
|
|
5951
|
+
const coreApp = (await jApi.application.studioGet(app.idApp, app.status)).result;
|
|
5952
|
+
const articlesCount = (await jApi.article.count(app.idApp)).result;
|
|
5953
|
+
return { ...coreApp, articlesCount };
|
|
5954
|
+
}));
|
|
5826
5955
|
const apps = appsPromisesResult
|
|
5827
5956
|
.map((result) => {
|
|
5828
5957
|
return result.status === 'fulfilled' ? result.value : null;
|
|
@@ -5834,12 +5963,12 @@ const fetchStudioAppsList = createAsyncThunk('studio/appsList', (intl, { extra,
|
|
|
5834
5963
|
return prev;
|
|
5835
5964
|
}, []);
|
|
5836
5965
|
const transformedApps = serverAppsToStudioApps(apps, getState());
|
|
5837
|
-
transformedApps.forEach((app) =>
|
|
5966
|
+
transformedApps.forEach(async (app) => {
|
|
5838
5967
|
app.fields = updateTaxonomies(app.fields, taxonomies, intl);
|
|
5839
5968
|
if (app.inWorkVersion) {
|
|
5840
5969
|
app.inWorkVersion.fields = updateTaxonomies(app.inWorkVersion.fields, taxonomies, intl);
|
|
5841
5970
|
}
|
|
5842
|
-
})
|
|
5971
|
+
});
|
|
5843
5972
|
return transformedApps;
|
|
5844
5973
|
}
|
|
5845
5974
|
catch (err) {
|
|
@@ -5847,19 +5976,18 @@ const fetchStudioAppsList = createAsyncThunk('studio/appsList', (intl, { extra,
|
|
|
5847
5976
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5848
5977
|
throw rejectWithValue({ error: 1, errorMsg: 'Error retrieving applications' });
|
|
5849
5978
|
}
|
|
5850
|
-
})
|
|
5979
|
+
});
|
|
5851
5980
|
function updateTaxonomies(fields, taxonomies, intl) {
|
|
5852
5981
|
return fields.map((field) => {
|
|
5853
|
-
var _a;
|
|
5854
5982
|
if (field.type !== AppFormItemTypes.TAGS) {
|
|
5855
5983
|
return field;
|
|
5856
5984
|
}
|
|
5857
5985
|
const newField = JSON.parse(JSON.stringify(field));
|
|
5858
|
-
const newFieldTaxoProp =
|
|
5986
|
+
const newFieldTaxoProp = newField.properties?.find((prop) => {
|
|
5859
5987
|
return prop.propertyType === AppFieldFormPropertyTypes.TAXONOMY;
|
|
5860
5988
|
});
|
|
5861
5989
|
const taxo = taxonomies.find((taxo) => {
|
|
5862
|
-
return taxo.id ===
|
|
5990
|
+
return taxo.id === newFieldTaxoProp?.value.id;
|
|
5863
5991
|
});
|
|
5864
5992
|
if (taxo && newFieldTaxoProp) {
|
|
5865
5993
|
newFieldTaxoProp.value.title = intl.formatMessage({ id: taxo.title });
|
|
@@ -5868,13 +5996,12 @@ function updateTaxonomies(fields, taxonomies, intl) {
|
|
|
5868
5996
|
return newField;
|
|
5869
5997
|
});
|
|
5870
5998
|
}
|
|
5871
|
-
const createNewStudioApp = createAsyncThunk('studio/createApp', ({ appName, callback }, { extra, dispatch, rejectWithValue, getState }) =>
|
|
5872
|
-
var _a;
|
|
5999
|
+
const createNewStudioApp = createAsyncThunk('studio/createApp', async ({ appName, callback }, { extra, dispatch, rejectWithValue, getState }) => {
|
|
5873
6000
|
const jApi = extra.jApi;
|
|
5874
|
-
const author =
|
|
5875
|
-
const { newAppId, newStudioApp } = createNewStudioApp$1(
|
|
6001
|
+
const author = getState().userCurrent?.uri;
|
|
6002
|
+
const { newAppId, newStudioApp } = createNewStudioApp$1({ appName, ...(author && { author }) });
|
|
5876
6003
|
try {
|
|
5877
|
-
|
|
6004
|
+
await jApi.application.studioSave(newAppId, JSON.stringify(newStudioApp), 'saved');
|
|
5878
6005
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_StudioApp_Created' }));
|
|
5879
6006
|
dispatch(CurrentStudioAppSlice.actions.setCurrentApp(newStudioApp));
|
|
5880
6007
|
if (callback)
|
|
@@ -5885,11 +6012,11 @@ const createNewStudioApp = createAsyncThunk('studio/createApp', ({ appName, call
|
|
|
5885
6012
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5886
6013
|
throw rejectWithValue({ error: 1, errorMsg: 'Error creating application' });
|
|
5887
6014
|
}
|
|
5888
|
-
})
|
|
5889
|
-
const deleteStudioApp = createAsyncThunk('studio/deleteApp', ({ idApp, status }, { extra, rejectWithValue, dispatch }) =>
|
|
6015
|
+
});
|
|
6016
|
+
const deleteStudioApp = createAsyncThunk('studio/deleteApp', async ({ idApp, status }, { extra, rejectWithValue, dispatch }) => {
|
|
5890
6017
|
const jApi = extra.jApi;
|
|
5891
6018
|
try {
|
|
5892
|
-
const deleteRes =
|
|
6019
|
+
const deleteRes = await jApi.application.studioDelete(idApp, status);
|
|
5893
6020
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_StudioApp_Deleted' }));
|
|
5894
6021
|
return deleteRes;
|
|
5895
6022
|
}
|
|
@@ -5897,33 +6024,32 @@ const deleteStudioApp = createAsyncThunk('studio/deleteApp', ({ idApp, status },
|
|
|
5897
6024
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5898
6025
|
return rejectWithValue({ error: 1, errorMsg: 'Error deleting application' });
|
|
5899
6026
|
}
|
|
5900
|
-
})
|
|
5901
|
-
const suspendStudioApp = createAsyncThunk('studio/suspendStudioApp', ({ idApp }, { extra, rejectWithValue, dispatch }) =>
|
|
6027
|
+
});
|
|
6028
|
+
const suspendStudioApp = createAsyncThunk('studio/suspendStudioApp', async ({ idApp }, { extra, rejectWithValue, dispatch }) => {
|
|
5902
6029
|
const jApi = extra.jApi;
|
|
5903
6030
|
try {
|
|
5904
|
-
|
|
6031
|
+
await jApi.application.studioSuspend(idApp);
|
|
5905
6032
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Suspended' }));
|
|
5906
6033
|
}
|
|
5907
6034
|
catch (err) {
|
|
5908
6035
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5909
6036
|
throw rejectWithValue({ error: 1, errorMsg: 'Error suspending application' });
|
|
5910
6037
|
}
|
|
5911
|
-
})
|
|
5912
|
-
const restartStudioApp = createAsyncThunk('studio/restartStudioApp', ({ idApp }, { extra, rejectWithValue, dispatch }) =>
|
|
6038
|
+
});
|
|
6039
|
+
const restartStudioApp = createAsyncThunk('studio/restartStudioApp', async ({ idApp }, { extra, rejectWithValue, dispatch }) => {
|
|
5913
6040
|
const jApi = extra.jApi;
|
|
5914
6041
|
try {
|
|
5915
|
-
|
|
6042
|
+
await jApi.application.studioRestart(idApp);
|
|
5916
6043
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Restarted' }));
|
|
5917
6044
|
}
|
|
5918
6045
|
catch (err) {
|
|
5919
6046
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5920
6047
|
throw rejectWithValue({ error: 1, errorMsg: 'Error restarting application' });
|
|
5921
6048
|
}
|
|
5922
|
-
})
|
|
5923
|
-
const cloneStudioApp = createAsyncThunk('studio/cloneStudioApp', ({ idApp, inWork }, { extra, getState, rejectWithValue, dispatch }) =>
|
|
5924
|
-
var _b, _c;
|
|
6049
|
+
});
|
|
6050
|
+
const cloneStudioApp = createAsyncThunk('studio/cloneStudioApp', async ({ idApp, inWork }, { extra, getState, rejectWithValue, dispatch }) => {
|
|
5925
6051
|
const jApi = extra.jApi;
|
|
5926
|
-
let existingStudioApp =
|
|
6052
|
+
let existingStudioApp = getState().studio.studioAppsList.studioAppsList?.find((app) => app.idApp === idApp);
|
|
5927
6053
|
if (!existingStudioApp)
|
|
5928
6054
|
return rejectWithValue({ error: 1, errorMsg: 'Error cloning application' });
|
|
5929
6055
|
if (inWork) {
|
|
@@ -5934,11 +6060,11 @@ const cloneStudioApp = createAsyncThunk('studio/cloneStudioApp', ({ idApp, inWor
|
|
|
5934
6060
|
return rejectWithValue({ error: 1, errorMsg: 'Error cloning application' });
|
|
5935
6061
|
}
|
|
5936
6062
|
}
|
|
5937
|
-
const currentUser =
|
|
6063
|
+
const currentUser = getState().userCurrent?.uri;
|
|
5938
6064
|
const [clonedStudioApp, newAppId] = cloneStudioAppFromExistingApp(existingStudioApp, currentUser);
|
|
5939
6065
|
const clonedStudioAppReady = JSON.stringify(clonedStudioApp);
|
|
5940
6066
|
try {
|
|
5941
|
-
|
|
6067
|
+
await jApi.application.studioSave(newAppId, clonedStudioAppReady, 'saved');
|
|
5942
6068
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Cloned' }));
|
|
5943
6069
|
return clonedStudioApp;
|
|
5944
6070
|
}
|
|
@@ -5946,20 +6072,19 @@ const cloneStudioApp = createAsyncThunk('studio/cloneStudioApp', ({ idApp, inWor
|
|
|
5946
6072
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5947
6073
|
return rejectWithValue({ error: 1, errorMsg: 'Error cloning application' });
|
|
5948
6074
|
}
|
|
5949
|
-
})
|
|
5950
|
-
const createInWorkStudioApp = createAsyncThunk('studio/createInWorkStudioApp', ({ idApp }, { extra, getState, rejectWithValue, dispatch }) =>
|
|
5951
|
-
var _d, _e;
|
|
6075
|
+
});
|
|
6076
|
+
const createInWorkStudioApp = createAsyncThunk('studio/createInWorkStudioApp', async ({ idApp }, { extra, getState, rejectWithValue, dispatch }) => {
|
|
5952
6077
|
const jApi = extra.jApi;
|
|
5953
|
-
const existingStudioApp =
|
|
6078
|
+
const existingStudioApp = getState().studio.studioAppsList.studioAppsList?.find((app) => app.idApp === idApp);
|
|
5954
6079
|
if (!existingStudioApp ||
|
|
5955
6080
|
![APP_STATUS_TYPE.INSTALLED, APP_STATUS_TYPE.SUSPENDED].includes(existingStudioApp.status)) {
|
|
5956
6081
|
return rejectWithValue({ error: 1, errorMsg: 'Error cloning application' });
|
|
5957
6082
|
}
|
|
5958
|
-
const currentUser =
|
|
6083
|
+
const currentUser = getState().userCurrent?.uri;
|
|
5959
6084
|
const [clonedStudioApp, newAppId] = cloneStudioAppFromExistingApp(existingStudioApp, currentUser, true);
|
|
5960
6085
|
const clonedStudioAppReady = JSON.stringify(clonedStudioApp);
|
|
5961
6086
|
try {
|
|
5962
|
-
|
|
6087
|
+
await jApi.application.studioSave(newAppId, clonedStudioAppReady, 'saved');
|
|
5963
6088
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_CreateInWork' }));
|
|
5964
6089
|
return clonedStudioApp;
|
|
5965
6090
|
}
|
|
@@ -5967,7 +6092,7 @@ const createInWorkStudioApp = createAsyncThunk('studio/createInWorkStudioApp', (
|
|
|
5967
6092
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5968
6093
|
return rejectWithValue({ error: 1, errorMsg: 'Error creating in work version for application' });
|
|
5969
6094
|
}
|
|
5970
|
-
})
|
|
6095
|
+
});
|
|
5971
6096
|
const StudioAppsListSlice = createSlice({
|
|
5972
6097
|
name: 'studioAppsList',
|
|
5973
6098
|
initialState,
|
|
@@ -5997,12 +6122,11 @@ const StudioAppsListSlice = createSlice({
|
|
|
5997
6122
|
state.deleteStudioAppStatus = 'pending';
|
|
5998
6123
|
})
|
|
5999
6124
|
.addCase(deleteStudioApp.fulfilled, (state, action) => {
|
|
6000
|
-
var _a, _b;
|
|
6001
6125
|
if (state.deleteStudioAppStatus === 'pending') {
|
|
6002
6126
|
state.deleteStudioAppStatus = 'idle';
|
|
6003
6127
|
}
|
|
6004
6128
|
state.studioAppsList =
|
|
6005
|
-
|
|
6129
|
+
state.studioAppsList?.reduce((acc, app) => {
|
|
6006
6130
|
const { idApp } = action.meta.arg;
|
|
6007
6131
|
let { status } = action.meta.arg;
|
|
6008
6132
|
if (status === APP_STATUS_TYPE.INSTALLED)
|
|
@@ -6020,7 +6144,7 @@ const StudioAppsListSlice = createSlice({
|
|
|
6020
6144
|
delete app.inWorkVersion;
|
|
6021
6145
|
}
|
|
6022
6146
|
return [...acc, app];
|
|
6023
|
-
}, [])
|
|
6147
|
+
}, []) ?? [];
|
|
6024
6148
|
})
|
|
6025
6149
|
.addCase(deleteStudioApp.rejected, (state) => {
|
|
6026
6150
|
if (state.deleteStudioAppStatus === 'pending')
|
|
@@ -6031,19 +6155,18 @@ const StudioAppsListSlice = createSlice({
|
|
|
6031
6155
|
state.suspendStudioAppStatus = 'pending';
|
|
6032
6156
|
})
|
|
6033
6157
|
.addCase(suspendStudioApp.fulfilled, (state, action) => {
|
|
6034
|
-
var _a, _b;
|
|
6035
6158
|
if (state.suspendStudioAppStatus === 'pending') {
|
|
6036
6159
|
state.suspendStudioAppStatus = 'idle';
|
|
6037
6160
|
}
|
|
6038
6161
|
state.studioAppsList =
|
|
6039
|
-
|
|
6162
|
+
state.studioAppsList?.map((app) => {
|
|
6040
6163
|
const { idApp } = action.meta.arg;
|
|
6041
6164
|
if (app.idApp === idApp) {
|
|
6042
6165
|
app.status = APP_STATUS_TYPE.SUSPENDED;
|
|
6043
6166
|
return app;
|
|
6044
6167
|
}
|
|
6045
6168
|
return app;
|
|
6046
|
-
})
|
|
6169
|
+
}) ?? [];
|
|
6047
6170
|
})
|
|
6048
6171
|
.addCase(suspendStudioApp.rejected, (state) => {
|
|
6049
6172
|
if (state.suspendStudioAppStatus === 'pending')
|
|
@@ -6054,19 +6177,18 @@ const StudioAppsListSlice = createSlice({
|
|
|
6054
6177
|
state.restartStudioAppStatus = 'pending';
|
|
6055
6178
|
})
|
|
6056
6179
|
.addCase(restartStudioApp.fulfilled, (state, action) => {
|
|
6057
|
-
var _a, _b;
|
|
6058
6180
|
if (state.restartStudioAppStatus === 'pending') {
|
|
6059
6181
|
state.restartStudioAppStatus = 'idle';
|
|
6060
6182
|
}
|
|
6061
6183
|
state.studioAppsList =
|
|
6062
|
-
|
|
6184
|
+
state.studioAppsList?.map((app) => {
|
|
6063
6185
|
const { idApp } = action.meta.arg;
|
|
6064
6186
|
if (app.idApp === idApp) {
|
|
6065
6187
|
app.status = APP_STATUS_TYPE.INSTALLED;
|
|
6066
6188
|
return app;
|
|
6067
6189
|
}
|
|
6068
6190
|
return app;
|
|
6069
|
-
})
|
|
6191
|
+
}) ?? [];
|
|
6070
6192
|
})
|
|
6071
6193
|
.addCase(restartStudioApp.rejected, (state) => {
|
|
6072
6194
|
if (state.restartStudioAppStatus === 'pending') {
|
|
@@ -6079,11 +6201,10 @@ const StudioAppsListSlice = createSlice({
|
|
|
6079
6201
|
}
|
|
6080
6202
|
})
|
|
6081
6203
|
.addCase(cloneStudioApp.fulfilled, (state, action) => {
|
|
6082
|
-
var _a;
|
|
6083
6204
|
if (state.cloneStudioAppStatus === 'pending') {
|
|
6084
6205
|
state.cloneStudioAppStatus = 'idle';
|
|
6085
6206
|
}
|
|
6086
|
-
state.studioAppsList = [...(
|
|
6207
|
+
state.studioAppsList = [...(state.studioAppsList ?? []), action.payload].sort(appLexicalSort);
|
|
6087
6208
|
})
|
|
6088
6209
|
.addCase(cloneStudioApp.rejected, (state) => {
|
|
6089
6210
|
if (state.cloneStudioAppStatus === 'pending') {
|
|
@@ -6096,11 +6217,10 @@ const StudioAppsListSlice = createSlice({
|
|
|
6096
6217
|
}
|
|
6097
6218
|
})
|
|
6098
6219
|
.addCase(createInWorkStudioApp.fulfilled, (state, action) => {
|
|
6099
|
-
var _a;
|
|
6100
6220
|
if (state.createInWorkAppStatus === 'pending') {
|
|
6101
6221
|
state.createInWorkAppStatus = 'idle';
|
|
6102
6222
|
}
|
|
6103
|
-
const app =
|
|
6223
|
+
const app = state.studioAppsList?.find((app) => {
|
|
6104
6224
|
return app.idApp === action.payload.idApp;
|
|
6105
6225
|
});
|
|
6106
6226
|
if (app) {
|
|
@@ -6118,11 +6238,10 @@ const StudioAppsListSlice = createSlice({
|
|
|
6118
6238
|
}
|
|
6119
6239
|
})
|
|
6120
6240
|
.addCase(createNewStudioApp.fulfilled, (state, action) => {
|
|
6121
|
-
var _a;
|
|
6122
6241
|
if (state.createNewStudioAppStatus === 'pending') {
|
|
6123
6242
|
state.createNewStudioAppStatus = 'idle';
|
|
6124
6243
|
}
|
|
6125
|
-
state.studioAppsList = [...(
|
|
6244
|
+
state.studioAppsList = [...(state.studioAppsList ?? []), action.payload].sort(appLexicalSort);
|
|
6126
6245
|
})
|
|
6127
6246
|
.addCase(createNewStudioApp.rejected, (state) => {
|
|
6128
6247
|
if (state.createNewStudioAppStatus === 'pending') {
|
|
@@ -6148,7 +6267,10 @@ const studioSlice = {
|
|
|
6148
6267
|
};
|
|
6149
6268
|
const studio = {
|
|
6150
6269
|
slice: studioSlice,
|
|
6151
|
-
actions:
|
|
6270
|
+
actions: {
|
|
6271
|
+
...StudioAppsListSlice.actions,
|
|
6272
|
+
...CurrentStudioAppSlice.actions,
|
|
6273
|
+
fetchStudioAppsList,
|
|
6152
6274
|
deleteStudioApp,
|
|
6153
6275
|
suspendStudioApp,
|
|
6154
6276
|
restartStudioApp,
|
|
@@ -6157,7 +6279,8 @@ const studio = {
|
|
|
6157
6279
|
fetchCurrentStudioApp,
|
|
6158
6280
|
saveCurrentStudioApp,
|
|
6159
6281
|
installStudioApp,
|
|
6160
|
-
createInWorkStudioApp
|
|
6282
|
+
createInWorkStudioApp,
|
|
6283
|
+
},
|
|
6161
6284
|
selectors: {
|
|
6162
6285
|
selectStudioAppsList,
|
|
6163
6286
|
selectCurrentStudioApp,
|