jamespot-front-business 1.2.35 → 1.2.37
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/cjs.js
CHANGED
|
@@ -1,64 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var toolkit = require('@reduxjs/toolkit');
|
|
6
4
|
var redux = require('redux');
|
|
7
5
|
var jamespot = require('jamespot-user-api');
|
|
8
6
|
var uuid = require('uuid');
|
|
9
7
|
|
|
10
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
-
|
|
12
|
-
var jamespot__default = /*#__PURE__*/_interopDefaultLegacy(jamespot);
|
|
13
|
-
|
|
14
|
-
/******************************************************************************
|
|
15
|
-
Copyright (c) Microsoft Corporation.
|
|
16
|
-
|
|
17
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
18
|
-
purpose with or without fee is hereby granted.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
21
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
22
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
23
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
24
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
25
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
26
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
27
|
-
***************************************************************************** */
|
|
28
|
-
|
|
29
|
-
function __rest(s, e) {
|
|
30
|
-
var t = {};
|
|
31
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
32
|
-
t[p] = s[p];
|
|
33
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
34
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
35
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
36
|
-
t[p[i]] = s[p[i]];
|
|
37
|
-
}
|
|
38
|
-
return t;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
42
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
43
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
44
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
45
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
46
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
47
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
52
|
-
var e = new Error(message);
|
|
53
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
8
|
const isAbortError = (error) => {
|
|
57
9
|
return !!error && typeof error === 'object' && 'aborted' in error && !!error.aborted;
|
|
58
10
|
};
|
|
59
11
|
const getErrorMessage = (error, defaultError) => {
|
|
60
12
|
if (!error || typeof error !== 'object') {
|
|
61
|
-
return defaultError
|
|
13
|
+
return defaultError ?? 'GLOBAL_Technical_Error';
|
|
62
14
|
}
|
|
63
15
|
if ('errorMsg' in error && typeof error.errorMsg === 'string') {
|
|
64
16
|
return error.errorMsg;
|
|
@@ -66,7 +18,7 @@ const getErrorMessage = (error, defaultError) => {
|
|
|
66
18
|
if ('message' in error && typeof error.message === 'string') {
|
|
67
19
|
return error.message;
|
|
68
20
|
}
|
|
69
|
-
return defaultError
|
|
21
|
+
return defaultError ?? 'GLOBAL_Technical_Error';
|
|
70
22
|
};
|
|
71
23
|
|
|
72
24
|
const toastAdapter = toolkit.createEntityAdapter({
|
|
@@ -81,12 +33,10 @@ const slice$5 = toolkit.createSlice({
|
|
|
81
33
|
},
|
|
82
34
|
});
|
|
83
35
|
const randomId = () => Math.random().toString(16).slice(2);
|
|
84
|
-
const addMessage = (
|
|
85
|
-
var { id = randomId() } = _a, toast = __rest(_a, ["id"]);
|
|
86
|
-
if (type === void 0) { type = 'success'; }
|
|
87
|
-
if (timeout === void 0) { timeout = 3000; }
|
|
36
|
+
const addMessage = ({ id = randomId(), ...toast }, type = 'success', timeout = 3000) => {
|
|
88
37
|
return (dispatch) => {
|
|
89
|
-
|
|
38
|
+
const t = { id, ...toast, timeout, type };
|
|
39
|
+
dispatch(slice$5.actions.addOne(t));
|
|
90
40
|
setTimeout(() => {
|
|
91
41
|
dispatch(slice$5.actions.removeOne(id));
|
|
92
42
|
}, timeout);
|
|
@@ -102,7 +52,7 @@ const actions = {
|
|
|
102
52
|
const selectors$3 = toastAdapter.getSelectors((state) => state.toasts);
|
|
103
53
|
const Toast = {
|
|
104
54
|
slice: slice$5,
|
|
105
|
-
actions:
|
|
55
|
+
actions: { ...actions, ...slice$5.actions },
|
|
106
56
|
selectors: selectors$3,
|
|
107
57
|
};
|
|
108
58
|
|
|
@@ -123,16 +73,16 @@ const initialState$s = {
|
|
|
123
73
|
value: {
|
|
124
74
|
start: formatDate$2(oneMonthAgo$2()),
|
|
125
75
|
end: formatDate$2(new Date()),
|
|
126
|
-
}
|
|
127
|
-
}
|
|
76
|
+
},
|
|
77
|
+
},
|
|
128
78
|
],
|
|
129
79
|
orders: [],
|
|
130
80
|
limit: 30,
|
|
131
81
|
nbResults: 0,
|
|
132
82
|
};
|
|
133
|
-
const fetchLogsNavigation = toolkit.createAsyncThunk('admin/fetchLogsNavigation', (params, { extra, rejectWithValue, dispatch }) =>
|
|
83
|
+
const fetchLogsNavigation = toolkit.createAsyncThunk('admin/fetchLogsNavigation', async (params, { extra, rejectWithValue, dispatch }) => {
|
|
134
84
|
try {
|
|
135
|
-
const logs = (
|
|
85
|
+
const logs = (await extra.jApi.admin.logs.getLogsNavigation(params)).result;
|
|
136
86
|
return logs;
|
|
137
87
|
}
|
|
138
88
|
catch (err) {
|
|
@@ -141,7 +91,7 @@ const fetchLogsNavigation = toolkit.createAsyncThunk('admin/fetchLogsNavigation'
|
|
|
141
91
|
}
|
|
142
92
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve admin logs navigation' });
|
|
143
93
|
}
|
|
144
|
-
})
|
|
94
|
+
});
|
|
145
95
|
const adminLogsNavigationSlice = toolkit.createSlice({
|
|
146
96
|
name: 'logsNavigation',
|
|
147
97
|
initialState: initialState$s,
|
|
@@ -163,10 +113,9 @@ const adminLogsNavigationSlice = toolkit.createSlice({
|
|
|
163
113
|
state.loading = 'pending';
|
|
164
114
|
});
|
|
165
115
|
builder.addCase(fetchLogsNavigation.fulfilled, (state, action) => {
|
|
166
|
-
var _a;
|
|
167
116
|
state.data = action.payload.data;
|
|
168
117
|
state.nbResults = action.payload.cnt;
|
|
169
|
-
state.limit =
|
|
118
|
+
state.limit = action.payload.limit ?? 30;
|
|
170
119
|
state.page = action.payload.page;
|
|
171
120
|
state.loading = 'idle';
|
|
172
121
|
});
|
|
@@ -193,16 +142,16 @@ const initialState$r = {
|
|
|
193
142
|
value: {
|
|
194
143
|
start: formatDate$1(oneMonthAgo$1()),
|
|
195
144
|
end: formatDate$1(new Date()),
|
|
196
|
-
}
|
|
197
|
-
}
|
|
145
|
+
},
|
|
146
|
+
},
|
|
198
147
|
],
|
|
199
148
|
orders: [],
|
|
200
149
|
limit: 30,
|
|
201
150
|
nbResults: 0,
|
|
202
151
|
};
|
|
203
|
-
const fetchLogsObjects = toolkit.createAsyncThunk('admin/fetchLogsObjects', (params, { extra, rejectWithValue, dispatch }) =>
|
|
152
|
+
const fetchLogsObjects = toolkit.createAsyncThunk('admin/fetchLogsObjects', async (params, { extra, rejectWithValue, dispatch }) => {
|
|
204
153
|
try {
|
|
205
|
-
const logs = (
|
|
154
|
+
const logs = (await extra.jApi.admin.logs.getLogsObjects(params)).result;
|
|
206
155
|
return logs;
|
|
207
156
|
}
|
|
208
157
|
catch (err) {
|
|
@@ -211,7 +160,7 @@ const fetchLogsObjects = toolkit.createAsyncThunk('admin/fetchLogsObjects', (par
|
|
|
211
160
|
}
|
|
212
161
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve admin logs Objects' });
|
|
213
162
|
}
|
|
214
|
-
})
|
|
163
|
+
});
|
|
215
164
|
const adminLogsObjectsSlice = toolkit.createSlice({
|
|
216
165
|
name: 'logsObjects',
|
|
217
166
|
initialState: initialState$r,
|
|
@@ -262,16 +211,16 @@ const initialState$q = {
|
|
|
262
211
|
value: {
|
|
263
212
|
start: formatDate(oneMonthAgo()),
|
|
264
213
|
end: formatDate(new Date()),
|
|
265
|
-
}
|
|
266
|
-
}
|
|
214
|
+
},
|
|
215
|
+
},
|
|
267
216
|
],
|
|
268
217
|
orders: [],
|
|
269
218
|
limit: 30,
|
|
270
219
|
nbResults: 0,
|
|
271
220
|
};
|
|
272
|
-
const fetchLogsSearch = toolkit.createAsyncThunk('admin/fetchLogsSearch', (params, { extra, rejectWithValue, dispatch }) =>
|
|
221
|
+
const fetchLogsSearch = toolkit.createAsyncThunk('admin/fetchLogsSearch', async (params, { extra, rejectWithValue, dispatch }) => {
|
|
273
222
|
try {
|
|
274
|
-
const logs = (
|
|
223
|
+
const logs = (await extra.jApi.admin.logs.getLogsSearch(params)).result;
|
|
275
224
|
return logs;
|
|
276
225
|
}
|
|
277
226
|
catch (err) {
|
|
@@ -280,7 +229,7 @@ const fetchLogsSearch = toolkit.createAsyncThunk('admin/fetchLogsSearch', (param
|
|
|
280
229
|
}
|
|
281
230
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve admin logs Search' });
|
|
282
231
|
}
|
|
283
|
-
})
|
|
232
|
+
});
|
|
284
233
|
const adminLogsSearchSlice = toolkit.createSlice({
|
|
285
234
|
name: 'logsSearch',
|
|
286
235
|
initialState: initialState$q,
|
|
@@ -302,10 +251,9 @@ const adminLogsSearchSlice = toolkit.createSlice({
|
|
|
302
251
|
state.loading = 'pending';
|
|
303
252
|
});
|
|
304
253
|
builder.addCase(fetchLogsSearch.fulfilled, (state, action) => {
|
|
305
|
-
var _a;
|
|
306
254
|
state.data = action.payload.data;
|
|
307
255
|
state.nbResults = action.payload.cnt;
|
|
308
|
-
state.limit =
|
|
256
|
+
state.limit = action.payload.limit ?? 30;
|
|
309
257
|
state.page = action.payload.page;
|
|
310
258
|
state.loading = 'idle';
|
|
311
259
|
});
|
|
@@ -330,9 +278,14 @@ const adminLogsSlice = {
|
|
|
330
278
|
const adminLogsReducer = adminLogsSlice.reducer;
|
|
331
279
|
const AdminLogs = {
|
|
332
280
|
slice: adminLogsSlice,
|
|
333
|
-
actions:
|
|
281
|
+
actions: {
|
|
282
|
+
...adminLogsNavigationSlice.actions,
|
|
283
|
+
...adminLogsObjectsSlice.actions,
|
|
284
|
+
...adminLogsSearchSlice.actions,
|
|
285
|
+
fetchLogsNavigation,
|
|
334
286
|
fetchLogsObjects,
|
|
335
|
-
fetchLogsSearch
|
|
287
|
+
fetchLogsSearch,
|
|
288
|
+
},
|
|
336
289
|
selectors: { selectAdminLogsNavigation, selectAdminLogsObjects, selectAdminLogsSearch },
|
|
337
290
|
};
|
|
338
291
|
|
|
@@ -368,10 +321,10 @@ const animationsListSlice = toolkit.createSlice({
|
|
|
368
321
|
});
|
|
369
322
|
},
|
|
370
323
|
});
|
|
371
|
-
const fetchCurrentAnimation = toolkit.createAsyncThunk('animations/fetchCurrentAnimation', (_, { extra, rejectWithValue, dispatch, signal }) =>
|
|
324
|
+
const fetchCurrentAnimation = toolkit.createAsyncThunk('animations/fetchCurrentAnimation', async (_, { extra, rejectWithValue, dispatch, signal }) => {
|
|
372
325
|
try {
|
|
373
|
-
const animationConfiguration = (
|
|
374
|
-
const isActiveForCurrentUser = (
|
|
326
|
+
const animationConfiguration = (await extra.jApi.animations.GetCurrentAnimation({ signal })).result;
|
|
327
|
+
const isActiveForCurrentUser = (await extra.jApi.animations.GetAnimationActive({ signal })).result;
|
|
375
328
|
return { animationConfiguration, isActiveForCurrentUser, isInitialized: true };
|
|
376
329
|
}
|
|
377
330
|
catch (err) {
|
|
@@ -380,46 +333,46 @@ const fetchCurrentAnimation = toolkit.createAsyncThunk('animations/fetchCurrentA
|
|
|
380
333
|
}
|
|
381
334
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation' });
|
|
382
335
|
}
|
|
383
|
-
})
|
|
384
|
-
const fetchCurrentAnimationApp = toolkit.createAsyncThunk('animations/fetchCurrentAnimationApp', (_, { extra, rejectWithValue, dispatch }) =>
|
|
336
|
+
});
|
|
337
|
+
const fetchCurrentAnimationApp = toolkit.createAsyncThunk('animations/fetchCurrentAnimationApp', async (_, { extra, rejectWithValue, dispatch }) => {
|
|
385
338
|
try {
|
|
386
|
-
return (
|
|
339
|
+
return (await extra.jApi.animations.GetCurrentAnimationApp()).result;
|
|
387
340
|
}
|
|
388
341
|
catch (err) {
|
|
389
342
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
390
343
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation' });
|
|
391
344
|
}
|
|
392
|
-
})
|
|
393
|
-
const deleteCurrentAnimation = toolkit.createAsyncThunk('animations/deleteCurrentAnimation', (_, { extra, rejectWithValue, dispatch }) =>
|
|
345
|
+
});
|
|
346
|
+
const deleteCurrentAnimation = toolkit.createAsyncThunk('animations/deleteCurrentAnimation', async (_, { extra, rejectWithValue, dispatch }) => {
|
|
394
347
|
try {
|
|
395
|
-
|
|
348
|
+
await extra.jApi.animations.DeleteAnimation();
|
|
396
349
|
return;
|
|
397
350
|
}
|
|
398
351
|
catch (err) {
|
|
399
352
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
400
353
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot delete animation' });
|
|
401
354
|
}
|
|
402
|
-
})
|
|
403
|
-
const saveCurrentAnimation = toolkit.createAsyncThunk('animations/saveCurrentAnimation', (params, { extra, rejectWithValue, dispatch }) =>
|
|
355
|
+
});
|
|
356
|
+
const saveCurrentAnimation = toolkit.createAsyncThunk('animations/saveCurrentAnimation', async (params, { extra, rejectWithValue, dispatch }) => {
|
|
404
357
|
try {
|
|
405
|
-
|
|
358
|
+
await extra.jApi.animations.SaveAnimationConfiguration(params);
|
|
406
359
|
return;
|
|
407
360
|
}
|
|
408
361
|
catch (err) {
|
|
409
362
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
410
363
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot update animation' });
|
|
411
364
|
}
|
|
412
|
-
})
|
|
413
|
-
const toggleAnimationIsActive = toolkit.createAsyncThunk('animations/toggleAnimationIsActive', (_, { extra, rejectWithValue, dispatch }) =>
|
|
365
|
+
});
|
|
366
|
+
const toggleAnimationIsActive = toolkit.createAsyncThunk('animations/toggleAnimationIsActive', async (_, { extra, rejectWithValue, dispatch }) => {
|
|
414
367
|
try {
|
|
415
|
-
|
|
368
|
+
await extra.jApi.animations.ToggleAnimationActive();
|
|
416
369
|
return;
|
|
417
370
|
}
|
|
418
371
|
catch (err) {
|
|
419
372
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
420
373
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot update animation' });
|
|
421
374
|
}
|
|
422
|
-
})
|
|
375
|
+
});
|
|
423
376
|
|
|
424
377
|
const getAnimationsRTHandlers = function (dispatch) {
|
|
425
378
|
const addAnimationHandler = function (message) {
|
|
@@ -458,16 +411,16 @@ const getAnimationsRTHandlers = function (dispatch) {
|
|
|
458
411
|
];
|
|
459
412
|
};
|
|
460
413
|
|
|
461
|
-
const fetchAnimationStats = toolkit.createAsyncThunk('animations/fetchAnimationStats', ({ name }, { extra, rejectWithValue, dispatch }) =>
|
|
414
|
+
const fetchAnimationStats = toolkit.createAsyncThunk('animations/fetchAnimationStats', async ({ name }, { extra, rejectWithValue, dispatch }) => {
|
|
462
415
|
try {
|
|
463
|
-
const stats = (
|
|
416
|
+
const stats = (await extra.jApi.animations.GetAnimationStats(name)).result.data;
|
|
464
417
|
return stats;
|
|
465
418
|
}
|
|
466
419
|
catch (err) {
|
|
467
420
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
468
421
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation stats' });
|
|
469
422
|
}
|
|
470
|
-
})
|
|
423
|
+
});
|
|
471
424
|
const animationStatsInitialState$1 = {
|
|
472
425
|
stats: [],
|
|
473
426
|
loading: 'idle',
|
|
@@ -490,16 +443,16 @@ const animationStatsSlice = toolkit.createSlice({
|
|
|
490
443
|
},
|
|
491
444
|
});
|
|
492
445
|
|
|
493
|
-
const fetchAnimationStatsCurrent = toolkit.createAsyncThunk('animations/fetchAnimationStatsCurrent', (uri, { extra, rejectWithValue, dispatch }) =>
|
|
446
|
+
const fetchAnimationStatsCurrent = toolkit.createAsyncThunk('animations/fetchAnimationStatsCurrent', async (uri, { extra, rejectWithValue, dispatch }) => {
|
|
494
447
|
try {
|
|
495
|
-
const stats = (
|
|
448
|
+
const stats = (await extra.jApi.animations.GetAnimationStatsCurrent(uri)).result;
|
|
496
449
|
return stats;
|
|
497
450
|
}
|
|
498
451
|
catch (err) {
|
|
499
452
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
500
453
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation stats current' });
|
|
501
454
|
}
|
|
502
|
-
})
|
|
455
|
+
});
|
|
503
456
|
const animationStatsInitialState = {
|
|
504
457
|
stats: null,
|
|
505
458
|
loading: 'idle',
|
|
@@ -555,9 +508,9 @@ const adapter$2 = toolkit.createEntityAdapter({
|
|
|
555
508
|
selectId: (app) => app.name,
|
|
556
509
|
sortComparer: (a, b) => a.label.localeCompare(b.label),
|
|
557
510
|
});
|
|
558
|
-
const fetchList = toolkit.createAsyncThunk('application/fetch', (_, { extra }) =>
|
|
559
|
-
return
|
|
560
|
-
})
|
|
511
|
+
const fetchList = toolkit.createAsyncThunk('application/fetch', async (_, { extra }) => {
|
|
512
|
+
return await extra.jApi.application.list();
|
|
513
|
+
});
|
|
561
514
|
const slice$4 = toolkit.createSlice({
|
|
562
515
|
name: 'applications',
|
|
563
516
|
initialState: adapter$2.getInitialState(),
|
|
@@ -575,7 +528,7 @@ const slice$4 = toolkit.createSlice({
|
|
|
575
528
|
const selectors$2 = adapter$2.getSelectors((state) => state.entities.applications);
|
|
576
529
|
const Application = {
|
|
577
530
|
slice: slice$4,
|
|
578
|
-
actions:
|
|
531
|
+
actions: { fetchList, ...slice$4.actions },
|
|
579
532
|
selectors: selectors$2,
|
|
580
533
|
};
|
|
581
534
|
|
|
@@ -584,15 +537,15 @@ const initialState$o = {
|
|
|
584
537
|
loading: 'idle',
|
|
585
538
|
nbResults: 0,
|
|
586
539
|
};
|
|
587
|
-
const fetchBookableAsset = toolkit.createAsyncThunk('BookableAsset/fetchBookableAsset', (_, { extra }) =>
|
|
540
|
+
const fetchBookableAsset = toolkit.createAsyncThunk('BookableAsset/fetchBookableAsset', async (_, { extra }) => {
|
|
588
541
|
const filterSpec = {
|
|
589
542
|
type: 'bookableAsset',
|
|
590
543
|
format: 'raw-list',
|
|
591
544
|
limit: 50,
|
|
592
545
|
public: true,
|
|
593
546
|
};
|
|
594
|
-
return
|
|
595
|
-
})
|
|
547
|
+
return await extra.jApi.article.list(filterSpec);
|
|
548
|
+
});
|
|
596
549
|
const BookableAssetSlice = toolkit.createSlice({
|
|
597
550
|
name: 'bookableAsset',
|
|
598
551
|
initialState: initialState$o,
|
|
@@ -613,9 +566,9 @@ const BookableAssetSlice = toolkit.createSlice({
|
|
|
613
566
|
},
|
|
614
567
|
});
|
|
615
568
|
|
|
616
|
-
const fetchConfiguration = toolkit.createAsyncThunk('AssetReservation/configuration', (_, { extra }) =>
|
|
617
|
-
return
|
|
618
|
-
})
|
|
569
|
+
const fetchConfiguration = toolkit.createAsyncThunk('AssetReservation/configuration', async (_, { extra }) => {
|
|
570
|
+
return await extra.jApi.assetReservation.configuration();
|
|
571
|
+
});
|
|
619
572
|
const initialState$n = {
|
|
620
573
|
description: '',
|
|
621
574
|
right: {
|
|
@@ -638,7 +591,10 @@ const AssetReservationConfigurationSlice = toolkit.createSlice({
|
|
|
638
591
|
state.loading = 'pending';
|
|
639
592
|
})
|
|
640
593
|
.addCase(fetchConfiguration.fulfilled, (_, action) => {
|
|
641
|
-
return
|
|
594
|
+
return {
|
|
595
|
+
...action.payload.result,
|
|
596
|
+
loading: 'idle',
|
|
597
|
+
};
|
|
642
598
|
})
|
|
643
599
|
.addCase(fetchConfiguration.rejected, (state) => {
|
|
644
600
|
state.loading = 'idle';
|
|
@@ -657,14 +613,14 @@ const initialState$m = {
|
|
|
657
613
|
nbResults: 0,
|
|
658
614
|
form: initForm,
|
|
659
615
|
};
|
|
660
|
-
const fetchReservation = toolkit.createAsyncThunk('Reservation/fetchReservation', (viewMode, { extra }) =>
|
|
616
|
+
const fetchReservation = toolkit.createAsyncThunk('Reservation/fetchReservation', async (viewMode, { extra }) => {
|
|
661
617
|
const filterSpec = {
|
|
662
618
|
format: 'raw-list',
|
|
663
619
|
limit: 50,
|
|
664
620
|
viewMode: viewMode === 'history' ? 'history' : undefined,
|
|
665
621
|
};
|
|
666
|
-
return
|
|
667
|
-
})
|
|
622
|
+
return await extra.jApi.assetReservation.getList(filterSpec);
|
|
623
|
+
});
|
|
668
624
|
const ReservationSlice = toolkit.createSlice({
|
|
669
625
|
name: 'reservation',
|
|
670
626
|
initialState: initialState$m,
|
|
@@ -712,7 +668,7 @@ const selectReservationLoading = (state) => state.assetReservation.reservation.l
|
|
|
712
668
|
const selectReservationForm = (state) => state.assetReservation.reservation.form;
|
|
713
669
|
const AssetReservation = {
|
|
714
670
|
slice: assetReservationSlice,
|
|
715
|
-
actions:
|
|
671
|
+
actions: { ...ReservationSlice.actions, fetchBookableAsset, fetchConfiguration, fetchReservation },
|
|
716
672
|
selectors: {
|
|
717
673
|
configuration: selectConfiguration,
|
|
718
674
|
bookableAssetEntities: selectBookableAssetEntities,
|
|
@@ -774,11 +730,14 @@ const contentReportSlice = toolkit.createSlice({
|
|
|
774
730
|
.addCase(updateStatus.pending, (state, action) => {
|
|
775
731
|
const report = state.reports.find((report) => report.uri === action.meta.arg.uri);
|
|
776
732
|
if (report) {
|
|
777
|
-
state.pendingReports = [...state.pendingReports,
|
|
733
|
+
state.pendingReports = [...state.pendingReports, { ...report, requestId: action.meta.requestId }];
|
|
778
734
|
state.reports = state.reports.map((report) => {
|
|
779
735
|
return report.uri !== action.meta.arg.uri
|
|
780
736
|
? report
|
|
781
|
-
:
|
|
737
|
+
: {
|
|
738
|
+
...report,
|
|
739
|
+
status: action.meta.arg.status,
|
|
740
|
+
};
|
|
782
741
|
});
|
|
783
742
|
}
|
|
784
743
|
})
|
|
@@ -798,14 +757,15 @@ const contentReportSlice = toolkit.createSlice({
|
|
|
798
757
|
});
|
|
799
758
|
},
|
|
800
759
|
});
|
|
801
|
-
const fetchReports = toolkit.createAsyncThunk('contentReport/fetchReports', (_params, { rejectWithValue, extra, dispatch, getState }) =>
|
|
802
|
-
var _a;
|
|
760
|
+
const fetchReports = toolkit.createAsyncThunk('contentReport/fetchReports', async (_params, { rejectWithValue, extra, dispatch, getState }) => {
|
|
803
761
|
const state = getState().contentReport;
|
|
804
|
-
const userId =
|
|
762
|
+
const userId = getState().userCurrent?.id;
|
|
805
763
|
try {
|
|
806
|
-
const filters = state.tab === 'my' && userId
|
|
764
|
+
const filters = state.tab === 'my' && userId
|
|
765
|
+
? [...state.filters, { name: 'idUser', value: userId }]
|
|
766
|
+
: [...state.filters];
|
|
807
767
|
const orders = state.orders.length > 0 ? state.orders : [{ name: 'dateCreation', sort: 'DESC' }];
|
|
808
|
-
return (
|
|
768
|
+
return (await extra.jApi.contentReport.getReports({
|
|
809
769
|
filters,
|
|
810
770
|
orders,
|
|
811
771
|
page: state.page,
|
|
@@ -818,10 +778,10 @@ const fetchReports = toolkit.createAsyncThunk('contentReport/fetchReports', (_pa
|
|
|
818
778
|
}
|
|
819
779
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot fetch pads' });
|
|
820
780
|
}
|
|
821
|
-
})
|
|
822
|
-
const updateStatus = toolkit.createAsyncThunk('contentReport/updateStatus', (params, { dispatch, rejectWithValue, extra }) =>
|
|
781
|
+
});
|
|
782
|
+
const updateStatus = toolkit.createAsyncThunk('contentReport/updateStatus', async (params, { dispatch, rejectWithValue, extra }) => {
|
|
823
783
|
try {
|
|
824
|
-
|
|
784
|
+
await extra.jApi.contentReport.updateStatus(params);
|
|
825
785
|
dispatch(Toast.actions.success({ label: 'GLOBAL_Successfully_Saved' }));
|
|
826
786
|
return true;
|
|
827
787
|
}
|
|
@@ -831,7 +791,7 @@ const updateStatus = toolkit.createAsyncThunk('contentReport/updateStatus', (par
|
|
|
831
791
|
}
|
|
832
792
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot fetch pads' });
|
|
833
793
|
}
|
|
834
|
-
})
|
|
794
|
+
});
|
|
835
795
|
const selectContentReport = (state) => state.contentReport;
|
|
836
796
|
const ContentReport = {
|
|
837
797
|
slice: contentReportSlice,
|
|
@@ -855,24 +815,24 @@ const initialState$k = {
|
|
|
855
815
|
},
|
|
856
816
|
delete: {},
|
|
857
817
|
};
|
|
858
|
-
const fetchBookmark = toolkit.createAsyncThunk('bookmarkList/fetchbookmarkList', (_, { extra, rejectWithValue, dispatch }) =>
|
|
818
|
+
const fetchBookmark = toolkit.createAsyncThunk('bookmarkList/fetchbookmarkList', async (_, { extra, rejectWithValue, dispatch }) => {
|
|
859
819
|
const filterSpec = { limit: 999 };
|
|
860
820
|
try {
|
|
861
|
-
return
|
|
821
|
+
return await extra.jApi.bookmark.getFormattedList(filterSpec, 'raw-list');
|
|
862
822
|
}
|
|
863
823
|
catch (err) {
|
|
864
824
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
865
825
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve bookmarks' });
|
|
866
826
|
}
|
|
867
|
-
})
|
|
868
|
-
const addBookmark = toolkit.createAsyncThunk('bookmarkList/addBookmark', (bookmark, { extra, rejectWithValue, dispatch }) =>
|
|
827
|
+
});
|
|
828
|
+
const addBookmark = toolkit.createAsyncThunk('bookmarkList/addBookmark', async (bookmark, { extra, rejectWithValue, dispatch }) => {
|
|
869
829
|
try {
|
|
870
830
|
if (jamespot.jEnsure.isBookmarkLink(bookmark)) {
|
|
871
|
-
const result =
|
|
831
|
+
const result = await extra.jApi.bookmark.addFormattedLink(bookmark.targetId, bookmark.targetType, 'raw-list');
|
|
872
832
|
return result;
|
|
873
833
|
}
|
|
874
834
|
else {
|
|
875
|
-
const result =
|
|
835
|
+
const result = await extra.jApi.bookmark.addBookmark(bookmark);
|
|
876
836
|
return result;
|
|
877
837
|
}
|
|
878
838
|
}
|
|
@@ -881,27 +841,27 @@ const addBookmark = toolkit.createAsyncThunk('bookmarkList/addBookmark', (bookma
|
|
|
881
841
|
dispatch(Toast.actions.error({ label: toastLabel }));
|
|
882
842
|
return rejectWithValue({ error: 1, errorMsg: 'Error saving bookmark' });
|
|
883
843
|
}
|
|
884
|
-
})
|
|
885
|
-
const moveBookmark = toolkit.createAsyncThunk('bookmarkList/moveBookmark', ({ bookmark, bookmarkReference, position }, { extra, rejectWithValue, dispatch }) =>
|
|
844
|
+
});
|
|
845
|
+
const moveBookmark = toolkit.createAsyncThunk('bookmarkList/moveBookmark', async ({ bookmark, bookmarkReference, position }, { extra, rejectWithValue, dispatch }) => {
|
|
886
846
|
try {
|
|
887
|
-
|
|
847
|
+
await extra.jApi.bookmark.move(bookmark.id, bookmarkReference.id, position);
|
|
888
848
|
return;
|
|
889
849
|
}
|
|
890
850
|
catch (err) {
|
|
891
851
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
892
852
|
return rejectWithValue({ error: 1, errorMsg: 'Error moving bookmark' });
|
|
893
853
|
}
|
|
894
|
-
})
|
|
895
|
-
const deleteBookmark = toolkit.createAsyncThunk('bookmarkList/deleteBookmark', (bookmark, { extra, rejectWithValue, dispatch }) =>
|
|
854
|
+
});
|
|
855
|
+
const deleteBookmark = toolkit.createAsyncThunk('bookmarkList/deleteBookmark', async (bookmark, { extra, rejectWithValue, dispatch }) => {
|
|
896
856
|
try {
|
|
897
|
-
|
|
857
|
+
await extra.jApi.bookmark.delete(bookmark.id);
|
|
898
858
|
return;
|
|
899
859
|
}
|
|
900
860
|
catch (err) {
|
|
901
861
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
902
862
|
return rejectWithValue({ error: 1, errorMsg: 'Error deleting bookmark' });
|
|
903
863
|
}
|
|
904
|
-
})
|
|
864
|
+
});
|
|
905
865
|
const BookmarkListSlice = toolkit.createSlice({
|
|
906
866
|
name: 'bookmarkList',
|
|
907
867
|
initialState: initialState$k,
|
|
@@ -922,7 +882,7 @@ const BookmarkListSlice = toolkit.createSlice({
|
|
|
922
882
|
},
|
|
923
883
|
addBookmarkRT: (state, action) => {
|
|
924
884
|
state.bookmarks.push(action.payload);
|
|
925
|
-
state.bookmarks.sort((a, b) =>
|
|
885
|
+
state.bookmarks.sort((a, b) => (a.bookmarkOrder ?? 0) - (b.bookmarkOrder ?? 0));
|
|
926
886
|
},
|
|
927
887
|
deleteBookmarkRT: (state, action) => {
|
|
928
888
|
state.bookmarks = state.bookmarks.filter((bookmark) => bookmark.id !== action.payload.id);
|
|
@@ -930,7 +890,7 @@ const BookmarkListSlice = toolkit.createSlice({
|
|
|
930
890
|
updateBookmarkRT: (state, action) => {
|
|
931
891
|
state.bookmarks = state.bookmarks
|
|
932
892
|
.map((bookmark) => (bookmark.id === action.payload.id ? action.payload : bookmark))
|
|
933
|
-
.sort((a, b) =>
|
|
893
|
+
.sort((a, b) => (a.bookmarkOrder ?? 0) - (b.bookmarkOrder ?? 0));
|
|
934
894
|
},
|
|
935
895
|
},
|
|
936
896
|
extraReducers: (builder) => {
|
|
@@ -1072,27 +1032,26 @@ const initialState$j = {
|
|
|
1072
1032
|
status: undefined,
|
|
1073
1033
|
loading: 'idle',
|
|
1074
1034
|
};
|
|
1075
|
-
const editBookmark = toolkit.createAsyncThunk('bookmarkEdit/editBookmark', (bookmark, { extra, rejectWithValue }) =>
|
|
1076
|
-
var _a, _b;
|
|
1035
|
+
const editBookmark = toolkit.createAsyncThunk('bookmarkEdit/editBookmark', async (bookmark, { extra, rejectWithValue }) => {
|
|
1077
1036
|
if (!bookmark.id) {
|
|
1078
1037
|
return rejectWithValue({ error: 1, errorMsg: 'Bookmark id is required' });
|
|
1079
1038
|
}
|
|
1080
|
-
const bookmarkLabel =
|
|
1081
|
-
const bookmarkUrl =
|
|
1039
|
+
const bookmarkLabel = bookmark.bookmarkLabel ?? '';
|
|
1040
|
+
const bookmarkUrl = bookmark.bookmarkUrl ?? '';
|
|
1082
1041
|
try {
|
|
1083
|
-
|
|
1042
|
+
await extra.jApi.bookmark.rename(bookmark.id, bookmarkLabel, bookmarkUrl);
|
|
1084
1043
|
}
|
|
1085
1044
|
catch (rejectValue) {
|
|
1086
1045
|
return rejectWithValue({ error: 2, errorMsg: 'Error saving bookmark' });
|
|
1087
1046
|
}
|
|
1088
1047
|
return;
|
|
1089
|
-
})
|
|
1048
|
+
});
|
|
1090
1049
|
const BookmarkEditSlice = toolkit.createSlice({
|
|
1091
1050
|
name: 'bookmarkEdit',
|
|
1092
1051
|
initialState: initialState$j,
|
|
1093
1052
|
reducers: {
|
|
1094
1053
|
setEditBookmark: (state, action) => {
|
|
1095
|
-
state.bookmark =
|
|
1054
|
+
state.bookmark = { ...action.payload };
|
|
1096
1055
|
},
|
|
1097
1056
|
unsetEditBookmark: (state) => {
|
|
1098
1057
|
state.bookmark = undefined;
|
|
@@ -1134,11 +1093,15 @@ const selectBookmarkEditBookmark = (state) => state.bookmark.bookmarkEdit.bookma
|
|
|
1134
1093
|
const selectBookmarkByArticleId = (state, idArticle) => state.bookmark.bookmarkList.bookmarks.find((bookmark) => bookmark.targetId === idArticle);
|
|
1135
1094
|
const Bookmark = {
|
|
1136
1095
|
slice: bookmarkSlice,
|
|
1137
|
-
actions:
|
|
1096
|
+
actions: {
|
|
1097
|
+
fetchBookmark,
|
|
1138
1098
|
addBookmark,
|
|
1139
1099
|
moveBookmark,
|
|
1140
1100
|
deleteBookmark,
|
|
1141
|
-
editBookmark
|
|
1101
|
+
editBookmark,
|
|
1102
|
+
...BookmarkEditSlice.actions,
|
|
1103
|
+
...BookmarkListSlice.actions,
|
|
1104
|
+
},
|
|
1142
1105
|
selectors: {
|
|
1143
1106
|
bookmarkList: selectBookmarkList,
|
|
1144
1107
|
bookmarkListIsInitialized: selectBookmarkListIsInitialized,
|
|
@@ -1152,9 +1115,9 @@ const initialState$i = {
|
|
|
1152
1115
|
loading: 'idle',
|
|
1153
1116
|
comments: [],
|
|
1154
1117
|
};
|
|
1155
|
-
const fetchComments = toolkit.createAsyncThunk('commentList/fetchCommentList', (params, { extra, rejectWithValue, dispatch }) =>
|
|
1118
|
+
const fetchComments = toolkit.createAsyncThunk('commentList/fetchCommentList', async (params, { extra, rejectWithValue, dispatch }) => {
|
|
1156
1119
|
try {
|
|
1157
|
-
const res =
|
|
1120
|
+
const res = await extra.jApi.article.getComments(params, {
|
|
1158
1121
|
format: 'raw-list',
|
|
1159
1122
|
formatExtension: ['actions'],
|
|
1160
1123
|
});
|
|
@@ -1164,17 +1127,17 @@ const fetchComments = toolkit.createAsyncThunk('commentList/fetchCommentList', (
|
|
|
1164
1127
|
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
1165
1128
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve comments' });
|
|
1166
1129
|
}
|
|
1167
|
-
})
|
|
1168
|
-
const deleteComment = toolkit.createAsyncThunk('commentList/deleteComment', (params, { extra, rejectWithValue, dispatch }) =>
|
|
1130
|
+
});
|
|
1131
|
+
const deleteComment = toolkit.createAsyncThunk('commentList/deleteComment', async (params, { extra, rejectWithValue, dispatch }) => {
|
|
1169
1132
|
try {
|
|
1170
|
-
|
|
1133
|
+
await extra.jApi.article.deleteComment(params.idComment);
|
|
1171
1134
|
return true;
|
|
1172
1135
|
}
|
|
1173
1136
|
catch (error) {
|
|
1174
1137
|
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
1175
1138
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot delete comment' });
|
|
1176
1139
|
}
|
|
1177
|
-
})
|
|
1140
|
+
});
|
|
1178
1141
|
const CommentListSlice = toolkit.createSlice({
|
|
1179
1142
|
name: 'commentList',
|
|
1180
1143
|
initialState: initialState$i,
|
|
@@ -1202,14 +1165,22 @@ const CommentListSlice = toolkit.createSlice({
|
|
|
1202
1165
|
const safeList = Array.isArray(list) ? list.filter((el) => !allUris.includes(el.uri)) : [];
|
|
1203
1166
|
state.comments = state.comments.map((c) => {
|
|
1204
1167
|
return c.idArticle === idArticle
|
|
1205
|
-
?
|
|
1168
|
+
? {
|
|
1169
|
+
...c,
|
|
1170
|
+
list: Array.isArray(c.list) ? [...c.list, ...safeList] : [...safeList],
|
|
1171
|
+
}
|
|
1172
|
+
: c;
|
|
1206
1173
|
});
|
|
1207
1174
|
},
|
|
1208
1175
|
updateComment: (state, action) => {
|
|
1209
1176
|
state.comments = state.comments.map((c) => {
|
|
1210
1177
|
const { idArticle, idComment, data } = action.payload;
|
|
1211
1178
|
return c.idArticle === idArticle
|
|
1212
|
-
?
|
|
1179
|
+
? {
|
|
1180
|
+
...c,
|
|
1181
|
+
list: c.list.map((comment) => comment.id === idComment ? { ...comment, description: data.description } : comment),
|
|
1182
|
+
}
|
|
1183
|
+
: c;
|
|
1213
1184
|
});
|
|
1214
1185
|
},
|
|
1215
1186
|
},
|
|
@@ -1236,7 +1207,10 @@ const CommentListSlice = toolkit.createSlice({
|
|
|
1236
1207
|
if (c.idArticle !== action.meta.arg.idArticle) {
|
|
1237
1208
|
return c;
|
|
1238
1209
|
}
|
|
1239
|
-
return
|
|
1210
|
+
return {
|
|
1211
|
+
...c,
|
|
1212
|
+
list: c.list.map((comment) => comment.id === action.meta.arg.idComment ? { ...comment, pending: true } : comment),
|
|
1213
|
+
};
|
|
1240
1214
|
});
|
|
1241
1215
|
})
|
|
1242
1216
|
.addCase(deleteComment.rejected, (state, action) => {
|
|
@@ -1244,7 +1218,10 @@ const CommentListSlice = toolkit.createSlice({
|
|
|
1244
1218
|
if (c.idArticle !== action.meta.arg.idArticle) {
|
|
1245
1219
|
return c;
|
|
1246
1220
|
}
|
|
1247
|
-
return
|
|
1221
|
+
return {
|
|
1222
|
+
...c,
|
|
1223
|
+
list: c.list.map((comment) => comment.id === action.meta.arg.idComment ? { ...comment, pending: false } : comment),
|
|
1224
|
+
};
|
|
1248
1225
|
});
|
|
1249
1226
|
});
|
|
1250
1227
|
},
|
|
@@ -1312,7 +1289,7 @@ const selectCommentList = (state, idArticle, limit = 0) => {
|
|
|
1312
1289
|
};
|
|
1313
1290
|
const Comment = {
|
|
1314
1291
|
slice: commentSlice,
|
|
1315
|
-
actions:
|
|
1292
|
+
actions: { fetchComments, deleteComment, ...CommentListSlice.actions },
|
|
1316
1293
|
selectors: {
|
|
1317
1294
|
commentList: selectCommentList,
|
|
1318
1295
|
},
|
|
@@ -1357,10 +1334,10 @@ const initialState$h = {
|
|
|
1357
1334
|
extraBot: undefined,
|
|
1358
1335
|
},
|
|
1359
1336
|
};
|
|
1360
|
-
const fetchExtraBotListAll = toolkit.createAsyncThunk('extraBot/fetchAll', (_, { extra, rejectWithValue, dispatch, getState }) =>
|
|
1337
|
+
const fetchExtraBotListAll = toolkit.createAsyncThunk('extraBot/fetchAll', async (_, { extra, rejectWithValue, dispatch, getState }) => {
|
|
1361
1338
|
const state = getState().extraBot.listAll;
|
|
1362
1339
|
try {
|
|
1363
|
-
return (
|
|
1340
|
+
return (await extra.jApi.extraBot.list('all', {
|
|
1364
1341
|
limit: state.limit,
|
|
1365
1342
|
page: state.page,
|
|
1366
1343
|
filters: state.filters,
|
|
@@ -1373,11 +1350,11 @@ const fetchExtraBotListAll = toolkit.createAsyncThunk('extraBot/fetchAll', (_, {
|
|
|
1373
1350
|
}
|
|
1374
1351
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve extra bot list' });
|
|
1375
1352
|
}
|
|
1376
|
-
})
|
|
1377
|
-
const fetchExtraBotListMines = toolkit.createAsyncThunk('extraBot/fetchMines', (_, { extra, rejectWithValue, dispatch, getState }) =>
|
|
1353
|
+
});
|
|
1354
|
+
const fetchExtraBotListMines = toolkit.createAsyncThunk('extraBot/fetchMines', async (_, { extra, rejectWithValue, dispatch, getState }) => {
|
|
1378
1355
|
const state = getState().extraBot.listMines;
|
|
1379
1356
|
try {
|
|
1380
|
-
return (
|
|
1357
|
+
return (await extra.jApi.extraBot.list('mines', {
|
|
1381
1358
|
limit: state.limit,
|
|
1382
1359
|
page: state.page,
|
|
1383
1360
|
filters: state.filters,
|
|
@@ -1390,14 +1367,16 @@ const fetchExtraBotListMines = toolkit.createAsyncThunk('extraBot/fetchMines', (
|
|
|
1390
1367
|
}
|
|
1391
1368
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve extra bot list' });
|
|
1392
1369
|
}
|
|
1393
|
-
})
|
|
1394
|
-
const toggleExtraBotActivation = toolkit.createAsyncThunk('extraBot/toggleActivation', (extraBot, { extra, rejectWithValue, dispatch }) =>
|
|
1370
|
+
});
|
|
1371
|
+
const toggleExtraBotActivation = toolkit.createAsyncThunk('extraBot/toggleActivation', async (extraBot, { extra, rejectWithValue, dispatch }) => {
|
|
1395
1372
|
try {
|
|
1396
1373
|
const enabled = !extraBot.enabled;
|
|
1397
|
-
const res = (
|
|
1374
|
+
const res = (await extra.jApi.article.update({ ...extraBot, enabled }, { format: jamespot.Format.VIEW })).result;
|
|
1398
1375
|
if (res.enabled !== extraBot.enabled) {
|
|
1399
1376
|
dispatch(Toast.actions.success({
|
|
1400
|
-
label: enabled
|
|
1377
|
+
label: enabled
|
|
1378
|
+
? 'APP_ExtraBot_Toast_ActivationSuccess'
|
|
1379
|
+
: 'APP_ExtraBot_Toast_DeactivationSuccess',
|
|
1401
1380
|
}));
|
|
1402
1381
|
dispatch(fetchExtraBotListAll());
|
|
1403
1382
|
}
|
|
@@ -1414,25 +1393,25 @@ const toggleExtraBotActivation = toolkit.createAsyncThunk('extraBot/toggleActiva
|
|
|
1414
1393
|
}
|
|
1415
1394
|
return rejectWithValue({ error: 1, errorMsg: 'Failed to change extra bot activation' });
|
|
1416
1395
|
}
|
|
1417
|
-
})
|
|
1418
|
-
const saveExtraBot = toolkit.createAsyncThunk('extraBot/save', ({ extraBot }, { extra, rejectWithValue, dispatch }) =>
|
|
1396
|
+
});
|
|
1397
|
+
const saveExtraBot = toolkit.createAsyncThunk('extraBot/save', async ({ extraBot }, { extra, rejectWithValue, dispatch }) => {
|
|
1419
1398
|
try {
|
|
1420
|
-
const data =
|
|
1399
|
+
const data = { ...extraBot, type: ExtraBotConst.configurationType, publishTo: '' };
|
|
1421
1400
|
let res;
|
|
1422
1401
|
let user;
|
|
1423
1402
|
delete data.avatar;
|
|
1424
1403
|
if (extraBot.uri) {
|
|
1425
|
-
res = (
|
|
1404
|
+
res = (await extra.jApi.article.update(data, {
|
|
1426
1405
|
format: jamespot.Format.VIEW,
|
|
1427
1406
|
})).result;
|
|
1428
|
-
user = (
|
|
1407
|
+
user = (await extra.jApi.extraBot.updateBot(res.uri)).result;
|
|
1429
1408
|
}
|
|
1430
1409
|
else {
|
|
1431
|
-
res = (
|
|
1410
|
+
res = (await extra.jApi.article.create({ ...data }, jamespot.Format.VIEW)).result[0];
|
|
1432
1411
|
if (!res) {
|
|
1433
1412
|
throw new Error('ExtraBot configuration creation failed');
|
|
1434
1413
|
}
|
|
1435
|
-
user = (
|
|
1414
|
+
user = (await extra.jApi.extraBot.createBot(res.uri)).result;
|
|
1436
1415
|
res._user = user;
|
|
1437
1416
|
}
|
|
1438
1417
|
const label = extraBot.uri ? 'APP_ExtraBot_Toast_SaveEdit' : 'APP_ExtraBot_Toast_SaveCreate';
|
|
@@ -1445,7 +1424,7 @@ const saveExtraBot = toolkit.createAsyncThunk('extraBot/save', ({ extraBot }, {
|
|
|
1445
1424
|
}
|
|
1446
1425
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve extra bot' });
|
|
1447
1426
|
}
|
|
1448
|
-
})
|
|
1427
|
+
});
|
|
1449
1428
|
const updateListBotProperty = (state, extraBotUri, property, value) => {
|
|
1450
1429
|
const listAllExtraBot = state.listAll.data.find((eb) => eb.uri === extraBotUri);
|
|
1451
1430
|
const listMinesExtraBot = state.listMines.data.find((eb) => eb.uri === extraBotUri);
|
|
@@ -1498,10 +1477,9 @@ const extraBotSlice = toolkit.createSlice({
|
|
|
1498
1477
|
state.listAll.loading = 'pending';
|
|
1499
1478
|
})
|
|
1500
1479
|
.addCase(fetchExtraBotListAll.fulfilled, (state, action) => {
|
|
1501
|
-
var _a;
|
|
1502
1480
|
state.listAll.data = action.payload.data;
|
|
1503
1481
|
state.listAll.nbResults = action.payload.cnt;
|
|
1504
|
-
state.listAll.limit =
|
|
1482
|
+
state.listAll.limit = action.payload.limit ?? ExtraBotConst.listLimit;
|
|
1505
1483
|
state.listAll.page = action.payload.page;
|
|
1506
1484
|
state.listAll.loading = 'idle';
|
|
1507
1485
|
})
|
|
@@ -1512,10 +1490,9 @@ const extraBotSlice = toolkit.createSlice({
|
|
|
1512
1490
|
state.listMines.loading = 'pending';
|
|
1513
1491
|
})
|
|
1514
1492
|
.addCase(fetchExtraBotListMines.fulfilled, (state, action) => {
|
|
1515
|
-
var _a;
|
|
1516
1493
|
state.listMines.data = action.payload.data;
|
|
1517
1494
|
state.listMines.nbResults = action.payload.cnt;
|
|
1518
|
-
state.listMines.limit =
|
|
1495
|
+
state.listMines.limit = action.payload.limit ?? ExtraBotConst.listLimit;
|
|
1519
1496
|
state.listMines.page = action.payload.page;
|
|
1520
1497
|
state.listMines.loading = 'idle';
|
|
1521
1498
|
})
|
|
@@ -1549,10 +1526,13 @@ const selectExtraBotListAll = (state) => state.extraBot.listAll;
|
|
|
1549
1526
|
const selectExtraBotListMines = (state) => state.extraBot.listMines;
|
|
1550
1527
|
const ExtraBot = {
|
|
1551
1528
|
slice: extraBotSlice,
|
|
1552
|
-
actions:
|
|
1529
|
+
actions: {
|
|
1530
|
+
fetchExtraBotListAll,
|
|
1553
1531
|
fetchExtraBotListMines,
|
|
1554
1532
|
toggleExtraBotActivation,
|
|
1555
|
-
saveExtraBot
|
|
1533
|
+
saveExtraBot,
|
|
1534
|
+
...extraBotSlice.actions,
|
|
1535
|
+
},
|
|
1556
1536
|
selectors: { selectExtraBotListAll, selectExtraBotListMines },
|
|
1557
1537
|
};
|
|
1558
1538
|
|
|
@@ -1560,11 +1540,11 @@ const initialState$g = {
|
|
|
1560
1540
|
loading: 'idle',
|
|
1561
1541
|
access: { createCategory: false },
|
|
1562
1542
|
};
|
|
1563
|
-
const fetchFaqConfig = toolkit.createAsyncThunk('faqConfig/fetch', () =>
|
|
1543
|
+
const fetchFaqConfig = toolkit.createAsyncThunk('faqConfig/fetch', async () => {
|
|
1564
1544
|
try {
|
|
1565
|
-
const [hookProperties, access] =
|
|
1566
|
-
|
|
1567
|
-
|
|
1545
|
+
const [hookProperties, access] = await Promise.all([
|
|
1546
|
+
await jamespot.faq.getHookProperties(['_web', 'appImage', 'appImageText', '_displayComment']),
|
|
1547
|
+
await jamespot.faq.getAccess(),
|
|
1568
1548
|
]);
|
|
1569
1549
|
return {
|
|
1570
1550
|
_web: hookProperties.result._web,
|
|
@@ -1582,7 +1562,7 @@ const fetchFaqConfig = toolkit.createAsyncThunk('faqConfig/fetch', () => __await
|
|
|
1582
1562
|
}
|
|
1583
1563
|
throw e;
|
|
1584
1564
|
}
|
|
1585
|
-
})
|
|
1565
|
+
});
|
|
1586
1566
|
const FaqConfigSlice = toolkit.createSlice({
|
|
1587
1567
|
name: 'config',
|
|
1588
1568
|
initialState: initialState$g,
|
|
@@ -1624,12 +1604,12 @@ const initialState$f = {
|
|
|
1624
1604
|
loading: 'idle',
|
|
1625
1605
|
categories: null,
|
|
1626
1606
|
};
|
|
1627
|
-
const fetchFaqCategories = toolkit.createAsyncThunk('faqCategories/fetch', () =>
|
|
1628
|
-
const categories =
|
|
1607
|
+
const fetchFaqCategories = toolkit.createAsyncThunk('faqCategories/fetch', async () => {
|
|
1608
|
+
const categories = await jamespot.faq.getCategoriesList();
|
|
1629
1609
|
return {
|
|
1630
1610
|
categories: categories.result.data,
|
|
1631
1611
|
};
|
|
1632
|
-
})
|
|
1612
|
+
});
|
|
1633
1613
|
const FaqCategoriesSlice = toolkit.createSlice({
|
|
1634
1614
|
name: 'categories',
|
|
1635
1615
|
initialState: initialState$f,
|
|
@@ -1699,8 +1679,7 @@ const selectHook = (state, hook) => {
|
|
|
1699
1679
|
return state.hooks[hook];
|
|
1700
1680
|
};
|
|
1701
1681
|
const hasHookLicense = (state, hook) => {
|
|
1702
|
-
|
|
1703
|
-
return !!((_a = state.hooks[hook]) === null || _a === void 0 ? void 0 : _a.hasLicense);
|
|
1682
|
+
return !!state.hooks[hook]?.hasLicense;
|
|
1704
1683
|
};
|
|
1705
1684
|
const Hook = {
|
|
1706
1685
|
slice: slice$3,
|
|
@@ -1724,10 +1703,10 @@ const buildUrlToJland = (map, hostname, urlBase) => {
|
|
|
1724
1703
|
return `${urlBase}/map/${hostname}/${map.uri}`;
|
|
1725
1704
|
};
|
|
1726
1705
|
|
|
1727
|
-
const fetchJLandMaps = toolkit.createAsyncThunk('/fetchMaps', ({ jlandUrlBase, retrieveAllMaps }, { extra }) =>
|
|
1706
|
+
const fetchJLandMaps = toolkit.createAsyncThunk('/fetchMaps', async ({ jlandUrlBase, retrieveAllMaps }, { extra }) => {
|
|
1728
1707
|
const jApi = extra.jApi;
|
|
1729
|
-
const hostname =
|
|
1730
|
-
return
|
|
1708
|
+
const hostname = await jApi.network.getHostname();
|
|
1709
|
+
return await new Promise((resolve, reject) => {
|
|
1731
1710
|
const config = {
|
|
1732
1711
|
type: 'jlandmap',
|
|
1733
1712
|
format: 'raw-list',
|
|
@@ -1738,7 +1717,7 @@ const fetchJLandMaps = toolkit.createAsyncThunk('/fetchMaps', ({ jlandUrlBase, r
|
|
|
1738
1717
|
.then((mapsResp) => {
|
|
1739
1718
|
const maps = mapsResp.result.data;
|
|
1740
1719
|
const result = maps.map((currentMap) => {
|
|
1741
|
-
const newMap =
|
|
1720
|
+
const newMap = { ...currentMap };
|
|
1742
1721
|
newMap.urlToJland = buildUrlToJland(currentMap, hostname, jlandUrlBase);
|
|
1743
1722
|
return newMap;
|
|
1744
1723
|
});
|
|
@@ -1751,10 +1730,10 @@ const fetchJLandMaps = toolkit.createAsyncThunk('/fetchMaps', ({ jlandUrlBase, r
|
|
|
1751
1730
|
reject({ error: 1, errorMsg: 'Error retrieving maps' });
|
|
1752
1731
|
});
|
|
1753
1732
|
});
|
|
1754
|
-
})
|
|
1755
|
-
const fetchJLandAvailableLicenses = toolkit.createAsyncThunk('/fetchAvailableLicenses', (_, { extra }) =>
|
|
1733
|
+
});
|
|
1734
|
+
const fetchJLandAvailableLicenses = toolkit.createAsyncThunk('/fetchAvailableLicenses', async (_, { extra }) => {
|
|
1756
1735
|
const jApi = extra.jApi;
|
|
1757
|
-
return
|
|
1736
|
+
return await new Promise((resolve, reject) => {
|
|
1758
1737
|
jApi.admin.license
|
|
1759
1738
|
.getLicensesNotAssigned('jlandmap')
|
|
1760
1739
|
.then((response) => {
|
|
@@ -1771,14 +1750,14 @@ const fetchJLandAvailableLicenses = toolkit.createAsyncThunk('/fetchAvailableLic
|
|
|
1771
1750
|
});
|
|
1772
1751
|
});
|
|
1773
1752
|
});
|
|
1774
|
-
})
|
|
1775
|
-
const unassignLicense = toolkit.createAsyncThunk('/unassignLicense', ({ map, retrieveAllMaps }, { extra, dispatch }) =>
|
|
1753
|
+
});
|
|
1754
|
+
const unassignLicense = toolkit.createAsyncThunk('/unassignLicense', async ({ map, retrieveAllMaps }, { extra, dispatch }) => {
|
|
1776
1755
|
const jApi = extra.jApi;
|
|
1777
1756
|
const jlandUrlBase = extractJlandUrlBaseFromMap(map);
|
|
1778
1757
|
if (!jlandUrlBase) {
|
|
1779
1758
|
return false;
|
|
1780
1759
|
}
|
|
1781
|
-
return
|
|
1760
|
+
return await new Promise((resolve, reject) => {
|
|
1782
1761
|
jApi.admin.license
|
|
1783
1762
|
.unAssignLicense(map.uri)
|
|
1784
1763
|
.then((response) => {
|
|
@@ -1796,14 +1775,14 @@ const unassignLicense = toolkit.createAsyncThunk('/unassignLicense', ({ map, ret
|
|
|
1796
1775
|
reject({ error: 1, errorMsg: 'Error unassign license' });
|
|
1797
1776
|
});
|
|
1798
1777
|
});
|
|
1799
|
-
})
|
|
1800
|
-
const deleteJlandMap = toolkit.createAsyncThunk('/deleteLicense', ({ map, retrieveAllMaps }, { extra, dispatch }) =>
|
|
1778
|
+
});
|
|
1779
|
+
const deleteJlandMap = toolkit.createAsyncThunk('/deleteLicense', async ({ map, retrieveAllMaps }, { extra, dispatch }) => {
|
|
1801
1780
|
const jApi = extra.jApi;
|
|
1802
1781
|
const jlandUrlBase = extractJlandUrlBaseFromMap(map);
|
|
1803
1782
|
if (!jlandUrlBase) {
|
|
1804
1783
|
return false;
|
|
1805
1784
|
}
|
|
1806
|
-
return
|
|
1785
|
+
return await new Promise((resolve, reject) => {
|
|
1807
1786
|
jApi.article
|
|
1808
1787
|
.delete(map.id)
|
|
1809
1788
|
.then((response) => {
|
|
@@ -1819,14 +1798,14 @@ const deleteJlandMap = toolkit.createAsyncThunk('/deleteLicense', ({ map, retrie
|
|
|
1819
1798
|
reject({ error: 1, errorMsg: err.errorMsg + '' });
|
|
1820
1799
|
});
|
|
1821
1800
|
});
|
|
1822
|
-
})
|
|
1823
|
-
const assignLicense = toolkit.createAsyncThunk('/assignLicense', ({ map, retrieveAllMaps }, { extra, dispatch }) =>
|
|
1801
|
+
});
|
|
1802
|
+
const assignLicense = toolkit.createAsyncThunk('/assignLicense', async ({ map, retrieveAllMaps }, { extra, dispatch }) => {
|
|
1824
1803
|
const jlandUrlBase = extractJlandUrlBaseFromMap(map);
|
|
1825
1804
|
if (!jlandUrlBase) {
|
|
1826
1805
|
return false;
|
|
1827
1806
|
}
|
|
1828
1807
|
const jApi = extra.jApi;
|
|
1829
|
-
return
|
|
1808
|
+
return await new Promise((resolve, reject) => {
|
|
1830
1809
|
jApi.admin.license
|
|
1831
1810
|
.assignLicense(map.uri)
|
|
1832
1811
|
.then((response) => {
|
|
@@ -1844,7 +1823,7 @@ const assignLicense = toolkit.createAsyncThunk('/assignLicense', ({ map, retriev
|
|
|
1844
1823
|
reject({ error: 1, errorMsg: 'Error assign license' });
|
|
1845
1824
|
});
|
|
1846
1825
|
});
|
|
1847
|
-
})
|
|
1826
|
+
});
|
|
1848
1827
|
const JLandMapListSlice = toolkit.createSlice({
|
|
1849
1828
|
name: 'jLandMapList',
|
|
1850
1829
|
initialState: {
|
|
@@ -1946,12 +1925,12 @@ const initialMap = {
|
|
|
1946
1925
|
assignLicense: false,
|
|
1947
1926
|
};
|
|
1948
1927
|
const initialState$e = {
|
|
1949
|
-
map:
|
|
1928
|
+
map: { ...initialMap },
|
|
1950
1929
|
loading: 'idle',
|
|
1951
1930
|
status: undefined,
|
|
1952
1931
|
msg: undefined,
|
|
1953
1932
|
};
|
|
1954
|
-
const createMap = toolkit.createAsyncThunk('mapCreate/create', ({ map, jlandUrlBase }, { extra, dispatch }) =>
|
|
1933
|
+
const createMap = toolkit.createAsyncThunk('mapCreate/create', async ({ map, jlandUrlBase }, { extra, dispatch }) => {
|
|
1955
1934
|
const payload = {
|
|
1956
1935
|
title: map.title,
|
|
1957
1936
|
publishTo: map.audience.reduce((finalValue, currentElement, index, array) => {
|
|
@@ -1967,27 +1946,27 @@ const createMap = toolkit.createAsyncThunk('mapCreate/create', ({ map, jlandUrlB
|
|
|
1967
1946
|
type: 'jlandmap',
|
|
1968
1947
|
};
|
|
1969
1948
|
const jApi = extra.jApi;
|
|
1970
|
-
return
|
|
1949
|
+
return await new Promise((resolve, reject) => {
|
|
1971
1950
|
jApi.article
|
|
1972
1951
|
.create(payload, 'raw-list')
|
|
1973
|
-
.then((response) =>
|
|
1952
|
+
.then(async (response) => {
|
|
1974
1953
|
if (response.error) {
|
|
1975
1954
|
reject({ error: 1, errorMsg: response.errorMsg });
|
|
1976
1955
|
return;
|
|
1977
1956
|
}
|
|
1978
1957
|
const createdMap = response.result[0];
|
|
1979
1958
|
if (map.assignLicense && createdMap !== undefined) {
|
|
1980
|
-
const hostname =
|
|
1959
|
+
const hostname = await jApi.network.getHostname();
|
|
1981
1960
|
createdMap.urlToJland = buildUrlToJland(createdMap, hostname, jlandUrlBase);
|
|
1982
1961
|
dispatch(assignLicense({ map: createdMap, retrieveAllMaps: false }));
|
|
1983
1962
|
}
|
|
1984
1963
|
resolve(response.result);
|
|
1985
|
-
})
|
|
1964
|
+
})
|
|
1986
1965
|
.catch(() => {
|
|
1987
1966
|
reject({ error: 1, errorMsg: 'Error assign license' });
|
|
1988
1967
|
});
|
|
1989
1968
|
});
|
|
1990
|
-
})
|
|
1969
|
+
});
|
|
1991
1970
|
const MapCreateSlice = toolkit.createSlice({
|
|
1992
1971
|
name: 'mapCreate',
|
|
1993
1972
|
initialState: initialState$e,
|
|
@@ -2009,8 +1988,7 @@ const MapCreateSlice = toolkit.createSlice({
|
|
|
2009
1988
|
state.status = 'success';
|
|
2010
1989
|
})
|
|
2011
1990
|
.addCase(createMap.rejected, (state, action) => {
|
|
2012
|
-
|
|
2013
|
-
state.msg = (_a = action.error.message) !== null && _a !== void 0 ? _a : undefined;
|
|
1991
|
+
state.msg = action.error.message ?? undefined;
|
|
2014
1992
|
state.status = 'error';
|
|
2015
1993
|
state.loading = 'idle';
|
|
2016
1994
|
});
|
|
@@ -2036,12 +2014,15 @@ const jlandSlice = {
|
|
|
2036
2014
|
};
|
|
2037
2015
|
const jland = {
|
|
2038
2016
|
slice: jlandSlice,
|
|
2039
|
-
actions:
|
|
2017
|
+
actions: {
|
|
2018
|
+
...MapCreateSlice.actions,
|
|
2019
|
+
assignLicense,
|
|
2040
2020
|
unassignLicense,
|
|
2041
2021
|
deleteJlandMap,
|
|
2042
2022
|
fetchJLandMaps,
|
|
2043
2023
|
fetchJLandAvailableLicenses,
|
|
2044
|
-
createMap
|
|
2024
|
+
createMap,
|
|
2025
|
+
},
|
|
2045
2026
|
selectors: {
|
|
2046
2027
|
selectJLandMaps,
|
|
2047
2028
|
selectJLandAvailableLicenses,
|
|
@@ -2106,7 +2087,7 @@ const magicPadSlice = toolkit.createSlice({
|
|
|
2106
2087
|
});
|
|
2107
2088
|
},
|
|
2108
2089
|
});
|
|
2109
|
-
const fetchPads = toolkit.createAsyncThunk('magicPad/fetchPads', (params, { extra, rejectWithValue, dispatch, getState }) =>
|
|
2090
|
+
const fetchPads = toolkit.createAsyncThunk('magicPad/fetchPads', async (params, { extra, rejectWithValue, dispatch, getState }) => {
|
|
2110
2091
|
try {
|
|
2111
2092
|
const state = getState().magicPad;
|
|
2112
2093
|
const page = state.page;
|
|
@@ -2123,7 +2104,7 @@ const fetchPads = toolkit.createAsyncThunk('magicPad/fetchPads', (params, { extr
|
|
|
2123
2104
|
: []),
|
|
2124
2105
|
];
|
|
2125
2106
|
const orders = state.orders.length > 0 ? state.orders : [{ name: 'dateCreation', sort: 'DESC' }];
|
|
2126
|
-
return (
|
|
2107
|
+
return (await extra.jApi.article.list({
|
|
2127
2108
|
type: 'magicpad',
|
|
2128
2109
|
limit: state.limit,
|
|
2129
2110
|
format: 'raw-view',
|
|
@@ -2137,7 +2118,7 @@ const fetchPads = toolkit.createAsyncThunk('magicPad/fetchPads', (params, { extr
|
|
|
2137
2118
|
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
2138
2119
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot fetch pads' });
|
|
2139
2120
|
}
|
|
2140
|
-
})
|
|
2121
|
+
});
|
|
2141
2122
|
const selectMagicPad = (state) => state.magicPad;
|
|
2142
2123
|
const MagicPad = {
|
|
2143
2124
|
slice: magicPadSlice,
|
|
@@ -2148,11 +2129,7 @@ const MagicPad = {
|
|
|
2148
2129
|
};
|
|
2149
2130
|
|
|
2150
2131
|
const MediaLibraryAppConst = {
|
|
2151
|
-
|
|
2152
|
-
moduleName: 'MediaLibraryHook',
|
|
2153
|
-
typeMediaLibraryFolder: 'mediaLibraryFolder',
|
|
2154
|
-
typeMediaLibraryFile: 'mediaLibraryFile',
|
|
2155
|
-
};
|
|
2132
|
+
typeMediaLibraryFolder: 'mediaLibraryFolder'};
|
|
2156
2133
|
const FILES_PER_PAGE = 18;
|
|
2157
2134
|
|
|
2158
2135
|
const initialState$c = {
|
|
@@ -2171,13 +2148,22 @@ const mediaLibrarySlice = toolkit.createSlice({
|
|
|
2171
2148
|
initialState: initialState$c,
|
|
2172
2149
|
reducers: {
|
|
2173
2150
|
setPage(state, action) {
|
|
2174
|
-
return
|
|
2151
|
+
return {
|
|
2152
|
+
...state,
|
|
2153
|
+
page: action.payload,
|
|
2154
|
+
};
|
|
2175
2155
|
},
|
|
2176
2156
|
setFolderList(state, action) {
|
|
2177
|
-
return
|
|
2157
|
+
return {
|
|
2158
|
+
...state,
|
|
2159
|
+
folders: action.payload,
|
|
2160
|
+
};
|
|
2178
2161
|
},
|
|
2179
2162
|
setFileUnclassifiedList(state, action) {
|
|
2180
|
-
return
|
|
2163
|
+
return {
|
|
2164
|
+
...state,
|
|
2165
|
+
unclassifiedFiles: action.payload,
|
|
2166
|
+
};
|
|
2181
2167
|
},
|
|
2182
2168
|
},
|
|
2183
2169
|
extraReducers: (builder) => {
|
|
@@ -2211,9 +2197,8 @@ const mediaLibrarySlice = toolkit.createSlice({
|
|
|
2211
2197
|
state.loading = 'idle';
|
|
2212
2198
|
})
|
|
2213
2199
|
.addCase(fetchMediaLibraryConfig.fulfilled, (state, action) => {
|
|
2214
|
-
var _a, _b;
|
|
2215
2200
|
state.loading = 'idle';
|
|
2216
|
-
state.mediaLibraryAccess =
|
|
2201
|
+
state.mediaLibraryAccess = action.payload?.result ?? false;
|
|
2217
2202
|
})
|
|
2218
2203
|
.addCase(fetchMediaLibraryConfig.rejected, (state) => {
|
|
2219
2204
|
state.loading = 'idle';
|
|
@@ -2224,9 +2209,8 @@ const mediaLibrarySlice = toolkit.createSlice({
|
|
|
2224
2209
|
state.mediaLibraryAccess = false;
|
|
2225
2210
|
})
|
|
2226
2211
|
.addCase(fetchMediaLibraryStats.fulfilled, (state, action) => {
|
|
2227
|
-
var _a;
|
|
2228
2212
|
state.loading = 'idle';
|
|
2229
|
-
state.stats =
|
|
2213
|
+
state.stats = { ...action.payload?.result };
|
|
2230
2214
|
})
|
|
2231
2215
|
.addCase(fetchMediaLibraryStats.rejected, (state) => {
|
|
2232
2216
|
state.loading = 'idle';
|
|
@@ -2236,8 +2220,7 @@ const mediaLibrarySlice = toolkit.createSlice({
|
|
|
2236
2220
|
state.loading = 'pending';
|
|
2237
2221
|
})
|
|
2238
2222
|
.addCase(fetchMediaLibraryFoldersStats.fulfilled, (state, action) => {
|
|
2239
|
-
|
|
2240
|
-
state.foldersStats = { loading: false, pager: (_a = action.payload) === null || _a === void 0 ? void 0 : _a.result };
|
|
2223
|
+
state.foldersStats = { loading: false, pager: action.payload?.result };
|
|
2241
2224
|
})
|
|
2242
2225
|
.addCase(fetchMediaLibraryFoldersStats.rejected, (state) => {
|
|
2243
2226
|
state.foldersStats = { loading: false, pager: null };
|
|
@@ -2246,8 +2229,7 @@ const mediaLibrarySlice = toolkit.createSlice({
|
|
|
2246
2229
|
state.foldersStats.loading = true;
|
|
2247
2230
|
})
|
|
2248
2231
|
.addCase(fetchMediaLibraryFilesStats.fulfilled, (state, action) => {
|
|
2249
|
-
|
|
2250
|
-
state.filesStats = { loading: false, pager: (_a = action.payload) === null || _a === void 0 ? void 0 : _a.result };
|
|
2232
|
+
state.filesStats = { loading: false, pager: action.payload?.result };
|
|
2251
2233
|
})
|
|
2252
2234
|
.addCase(fetchMediaLibraryFilesStats.rejected, (state) => {
|
|
2253
2235
|
state.filesStats = { loading: false, pager: null };
|
|
@@ -2257,23 +2239,23 @@ const mediaLibrarySlice = toolkit.createSlice({
|
|
|
2257
2239
|
});
|
|
2258
2240
|
},
|
|
2259
2241
|
});
|
|
2260
|
-
const fetchMediaLibraryFolders = toolkit.createAsyncThunk('MediaLibrary/fetchMediaLibraryFolders', (_, { extra, rejectWithValue, dispatch }) =>
|
|
2242
|
+
const fetchMediaLibraryFolders = toolkit.createAsyncThunk('MediaLibrary/fetchMediaLibraryFolders', async (_, { extra, rejectWithValue, dispatch }) => {
|
|
2261
2243
|
const args = {
|
|
2262
2244
|
type: MediaLibraryAppConst.typeMediaLibraryFolder,
|
|
2263
2245
|
format: 'raw-little',
|
|
2264
2246
|
limit: 10,
|
|
2265
2247
|
};
|
|
2266
2248
|
try {
|
|
2267
|
-
return
|
|
2249
|
+
return await extra.jApi.article.list(args);
|
|
2268
2250
|
}
|
|
2269
2251
|
catch (error) {
|
|
2270
2252
|
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
2271
2253
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve folders' });
|
|
2272
2254
|
}
|
|
2273
|
-
})
|
|
2274
|
-
const fetchMediaLibraryUnclassifiedFiles = toolkit.createAsyncThunk('MediaLibrary/fetchMediaLibraryUnclassifiedFiles', (page, { extra, rejectWithValue, dispatch }) =>
|
|
2255
|
+
});
|
|
2256
|
+
const fetchMediaLibraryUnclassifiedFiles = toolkit.createAsyncThunk('MediaLibrary/fetchMediaLibraryUnclassifiedFiles', async (page, { extra, rejectWithValue, dispatch }) => {
|
|
2275
2257
|
try {
|
|
2276
|
-
return
|
|
2258
|
+
return await extra.jApi.mediaLibrary.GetUnclassifiedFiles({
|
|
2277
2259
|
format: 'raw-little',
|
|
2278
2260
|
page,
|
|
2279
2261
|
limit: FILES_PER_PAGE,
|
|
@@ -2283,43 +2265,43 @@ const fetchMediaLibraryUnclassifiedFiles = toolkit.createAsyncThunk('MediaLibrar
|
|
|
2283
2265
|
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
2284
2266
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve UnclassifiedFiles' });
|
|
2285
2267
|
}
|
|
2286
|
-
})
|
|
2287
|
-
const fetchMediaLibraryConfig = toolkit.createAsyncThunk('MediaLibrary/fetchMediaLibraryConfig', (_, { extra, rejectWithValue, dispatch }) =>
|
|
2268
|
+
});
|
|
2269
|
+
const fetchMediaLibraryConfig = toolkit.createAsyncThunk('MediaLibrary/fetchMediaLibraryConfig', async (_, { extra, rejectWithValue, dispatch }) => {
|
|
2288
2270
|
try {
|
|
2289
|
-
return
|
|
2271
|
+
return await extra.jApi.mediaLibrary.getAccess();
|
|
2290
2272
|
}
|
|
2291
2273
|
catch (error) {
|
|
2292
2274
|
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
2293
2275
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot get MediaLibrary Config' });
|
|
2294
2276
|
}
|
|
2295
|
-
})
|
|
2296
|
-
const fetchMediaLibraryFoldersStats = toolkit.createAsyncThunk('MediaLibrary/fetchMediaLibraryFoldersStats', ({ page, filters, orders }, { extra, rejectWithValue, dispatch }) =>
|
|
2277
|
+
});
|
|
2278
|
+
const fetchMediaLibraryFoldersStats = toolkit.createAsyncThunk('MediaLibrary/fetchMediaLibraryFoldersStats', async ({ page, filters, orders }, { extra, rejectWithValue, dispatch }) => {
|
|
2297
2279
|
try {
|
|
2298
|
-
return
|
|
2280
|
+
return await extra.jApi.mediaLibrary.getFoldersStatsList(filters, orders, page);
|
|
2299
2281
|
}
|
|
2300
2282
|
catch (error) {
|
|
2301
2283
|
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
2302
2284
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot get MediaLibrary folders stats' });
|
|
2303
2285
|
}
|
|
2304
|
-
})
|
|
2305
|
-
const fetchMediaLibraryFilesStats = toolkit.createAsyncThunk('MediaLibrary/fetchMediaLibraryFilesStats', ({ page, filters, orders }, { extra, rejectWithValue, dispatch }) =>
|
|
2286
|
+
});
|
|
2287
|
+
const fetchMediaLibraryFilesStats = toolkit.createAsyncThunk('MediaLibrary/fetchMediaLibraryFilesStats', async ({ page, filters, orders }, { extra, rejectWithValue, dispatch }) => {
|
|
2306
2288
|
try {
|
|
2307
|
-
return
|
|
2289
|
+
return await extra.jApi.mediaLibrary.getFilesStatsList(filters, orders, page);
|
|
2308
2290
|
}
|
|
2309
2291
|
catch (error) {
|
|
2310
2292
|
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
2311
2293
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot get MediaLibrary files stats' });
|
|
2312
2294
|
}
|
|
2313
|
-
})
|
|
2314
|
-
const fetchMediaLibraryStats = toolkit.createAsyncThunk('MediaLibrary/fetchMediaLibraryStats', (_, { extra, rejectWithValue, dispatch }) =>
|
|
2295
|
+
});
|
|
2296
|
+
const fetchMediaLibraryStats = toolkit.createAsyncThunk('MediaLibrary/fetchMediaLibraryStats', async (_, { extra, rejectWithValue, dispatch }) => {
|
|
2315
2297
|
try {
|
|
2316
|
-
return
|
|
2298
|
+
return await extra.jApi.mediaLibrary.getStats();
|
|
2317
2299
|
}
|
|
2318
2300
|
catch (error) {
|
|
2319
2301
|
dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
|
|
2320
2302
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot get MediaLibrary stats' });
|
|
2321
2303
|
}
|
|
2322
|
-
})
|
|
2304
|
+
});
|
|
2323
2305
|
const selectMediaLibrary = (state) => state.mediaLibrary;
|
|
2324
2306
|
const selectMediaLibraryStats = (state) => state.mediaLibrary.stats;
|
|
2325
2307
|
const selectMediaLibraryFoldersStats = (state) => state.mediaLibrary.foldersStats;
|
|
@@ -2350,13 +2332,12 @@ const adapter$1 = toolkit.createEntityAdapter({
|
|
|
2350
2332
|
const getModelIconSrc = (model, size) => {
|
|
2351
2333
|
const imgProps = {
|
|
2352
2334
|
from: 'imagestatic',
|
|
2353
|
-
size: size
|
|
2335
|
+
size: size ?? 'fitx600',
|
|
2354
2336
|
uri: `icons/${model && model.icon ? model.icon : `article`}-white`,
|
|
2355
2337
|
};
|
|
2356
2338
|
return jamespot.formatImgUrl(imgProps);
|
|
2357
2339
|
};
|
|
2358
2340
|
const getModelFontAwesomeIcon = (icon) => {
|
|
2359
|
-
var _a;
|
|
2360
2341
|
const modelIconToFAIcon = {
|
|
2361
2342
|
actionplan: 'fs-actionplan',
|
|
2362
2343
|
animatedMeeting: 'fs-animated_meeting',
|
|
@@ -2393,7 +2374,7 @@ const getModelFontAwesomeIcon = (icon) => {
|
|
|
2393
2374
|
wiki: 'fs-wiki',
|
|
2394
2375
|
workgroup: 'fs-workgroup',
|
|
2395
2376
|
};
|
|
2396
|
-
return `icon-${
|
|
2377
|
+
return `icon-${modelIconToFAIcon[icon] ?? icon}`;
|
|
2397
2378
|
};
|
|
2398
2379
|
const slice$2 = toolkit.createSlice({
|
|
2399
2380
|
name: 'models',
|
|
@@ -2412,9 +2393,12 @@ const utils = {
|
|
|
2412
2393
|
const selectByIds = (state, types) => types.map((type) => state.entities.models.entities[type]).filter((model) => !!model);
|
|
2413
2394
|
const Model = {
|
|
2414
2395
|
slice: slice$2,
|
|
2415
|
-
actions:
|
|
2396
|
+
actions: { ...slice$2.actions },
|
|
2416
2397
|
utils,
|
|
2417
|
-
selectors:
|
|
2398
|
+
selectors: {
|
|
2399
|
+
...selectors$1,
|
|
2400
|
+
selectByIds,
|
|
2401
|
+
},
|
|
2418
2402
|
};
|
|
2419
2403
|
|
|
2420
2404
|
const initialState$b = {};
|
|
@@ -2446,7 +2430,9 @@ const selectNetworkMe = (state) => {
|
|
|
2446
2430
|
};
|
|
2447
2431
|
const Network = {
|
|
2448
2432
|
slice: NetworkSlice,
|
|
2449
|
-
actions:
|
|
2433
|
+
actions: {
|
|
2434
|
+
...NetworkStaticsSlice.actions,
|
|
2435
|
+
},
|
|
2450
2436
|
selectors: {
|
|
2451
2437
|
selectNetworkStatics,
|
|
2452
2438
|
selectNetworkPublic,
|
|
@@ -2469,7 +2455,7 @@ const PlatformConfigSlice = toolkit.createSlice({
|
|
|
2469
2455
|
});
|
|
2470
2456
|
|
|
2471
2457
|
const joinedReducers$3 = toolkit.combineReducers({
|
|
2472
|
-
|
|
2458
|
+
config: PlatformConfigSlice.reducer,
|
|
2473
2459
|
});
|
|
2474
2460
|
const PlatformSlice = {
|
|
2475
2461
|
name: 'platform',
|
|
@@ -2486,7 +2472,9 @@ const selectUserAccountStatus = (state) => {
|
|
|
2486
2472
|
};
|
|
2487
2473
|
const Platform = {
|
|
2488
2474
|
slice: PlatformSlice,
|
|
2489
|
-
actions:
|
|
2475
|
+
actions: {
|
|
2476
|
+
...PlatformConfigSlice.actions,
|
|
2477
|
+
},
|
|
2490
2478
|
selectors: {
|
|
2491
2479
|
selectPlatformConfig,
|
|
2492
2480
|
selectUserHighlightFields,
|
|
@@ -2501,20 +2489,20 @@ const initialQuery = {
|
|
|
2501
2489
|
orders: [{ name: 'dateCreation', sort: 'DESC' }],
|
|
2502
2490
|
page: 1,
|
|
2503
2491
|
};
|
|
2504
|
-
const fetchFiles = toolkit.createAsyncThunk('/fetchFiles', ({ page, query, sort }, { extra, getState }) =>
|
|
2492
|
+
const fetchFiles = toolkit.createAsyncThunk('/fetchFiles', async ({ page, query, sort }, { extra, getState }) => {
|
|
2505
2493
|
const jApi = extra.jApi;
|
|
2506
2494
|
const state = getState();
|
|
2507
2495
|
const filters = state.wedoc.tab === 'my-documents' ? [{ name: 'idUser', value: '0' }] : [];
|
|
2508
2496
|
const orders = [{ name: 'dateCreation', sort }];
|
|
2509
2497
|
const resolvePage = query !== state.wedoc.query ? 1 : page;
|
|
2510
|
-
return
|
|
2511
|
-
})
|
|
2512
|
-
const fetchRecentFiles = toolkit.createAsyncThunk('/fetchRecentFiles', (_, { extra, getState }) =>
|
|
2498
|
+
return await jApi.wedoc.getFiles({ ...initialQuery, filters, query, orders, page: resolvePage, limit: 12 });
|
|
2499
|
+
});
|
|
2500
|
+
const fetchRecentFiles = toolkit.createAsyncThunk('/fetchRecentFiles', async (_, { extra, getState }) => {
|
|
2513
2501
|
const jApi = extra.jApi;
|
|
2514
2502
|
const state = getState();
|
|
2515
2503
|
const filters = state.wedoc.tab === 'my-documents' ? [{ name: 'idUser', value: '0' }] : [];
|
|
2516
|
-
return
|
|
2517
|
-
})
|
|
2504
|
+
return await jApi.wedoc.getFiles({ ...initialQuery, filters, limit: 3 });
|
|
2505
|
+
});
|
|
2518
2506
|
|
|
2519
2507
|
const initialState$9 = {
|
|
2520
2508
|
entities: [],
|
|
@@ -2532,7 +2520,7 @@ const WedocAppSlice = toolkit.createSlice({
|
|
|
2532
2520
|
reducers: {
|
|
2533
2521
|
update: (state, action) => {
|
|
2534
2522
|
state.entities = [
|
|
2535
|
-
...state.entities.map((file) => file.id === action.payload.id ?
|
|
2523
|
+
...state.entities.map((file) => file.id === action.payload.id ? { ...file, ...action.payload } : file),
|
|
2536
2524
|
];
|
|
2537
2525
|
},
|
|
2538
2526
|
setQuery: (state, action) => {
|
|
@@ -2596,10 +2584,10 @@ const WedocApp = {
|
|
|
2596
2584
|
},
|
|
2597
2585
|
};
|
|
2598
2586
|
|
|
2599
|
-
const fetchRequest = toolkit.createAsyncThunk('/fetchRequest', ({ uri, idUser }, { extra }) =>
|
|
2587
|
+
const fetchRequest = toolkit.createAsyncThunk('/fetchRequest', async ({ uri, idUser }, { extra }) => {
|
|
2600
2588
|
const jApi = extra.jApi;
|
|
2601
|
-
return
|
|
2602
|
-
})
|
|
2589
|
+
return await jApi.object.getAccessRequest(uri, idUser);
|
|
2590
|
+
});
|
|
2603
2591
|
|
|
2604
2592
|
const initialState$8 = {
|
|
2605
2593
|
entities: [],
|
|
@@ -2668,15 +2656,14 @@ const teamWorkToDoSlice = toolkit.createSlice({
|
|
|
2668
2656
|
}
|
|
2669
2657
|
});
|
|
2670
2658
|
builder.addCase(startToDoCreation.rejected, (state, action) => {
|
|
2671
|
-
var _a, _b;
|
|
2672
2659
|
state.status = 'error';
|
|
2673
|
-
state.message =
|
|
2660
|
+
state.message = action.payload?.errorMsg ?? 'GLOBAL_Technical_Error';
|
|
2674
2661
|
});
|
|
2675
2662
|
},
|
|
2676
2663
|
});
|
|
2677
|
-
const startToDoCreation = toolkit.createAsyncThunk('teamWork/startToDoCreation', (_, { extra, rejectWithValue, dispatch, signal }) =>
|
|
2664
|
+
const startToDoCreation = toolkit.createAsyncThunk('teamWork/startToDoCreation', async (_, { extra, rejectWithValue, dispatch, signal }) => {
|
|
2678
2665
|
try {
|
|
2679
|
-
const isSent = (
|
|
2666
|
+
const isSent = (await extra.jApi.teamWork.aiGeneratedToDo({ signal })).result;
|
|
2680
2667
|
return isSent;
|
|
2681
2668
|
}
|
|
2682
2669
|
catch (err) {
|
|
@@ -2685,7 +2672,7 @@ const startToDoCreation = toolkit.createAsyncThunk('teamWork/startToDoCreation',
|
|
|
2685
2672
|
}
|
|
2686
2673
|
return rejectWithValue({ error: 1, errorMsg: 'APP_TEAMWORK_ToDo_Not_Sent' });
|
|
2687
2674
|
}
|
|
2688
|
-
})
|
|
2675
|
+
});
|
|
2689
2676
|
|
|
2690
2677
|
const getTeamWorkRTHandlers = function (dispatch) {
|
|
2691
2678
|
const toDoUpdateHandler = function (message) {
|
|
@@ -2713,7 +2700,10 @@ const teamWorkSlice = {
|
|
|
2713
2700
|
const teamworkReducer = teamWorkSlice.reducer;
|
|
2714
2701
|
const TeamWork = {
|
|
2715
2702
|
slice: teamWorkSlice,
|
|
2716
|
-
actions:
|
|
2703
|
+
actions: {
|
|
2704
|
+
...teamWorkToDoSlice.actions,
|
|
2705
|
+
startToDoCreation,
|
|
2706
|
+
},
|
|
2717
2707
|
selectors: { selectToDoState },
|
|
2718
2708
|
getTeamWorkRTHandlers,
|
|
2719
2709
|
};
|
|
@@ -2723,10 +2713,10 @@ const initialState$6 = {
|
|
|
2723
2713
|
loading: 'idle',
|
|
2724
2714
|
loadingChannelDeletion: 'idle',
|
|
2725
2715
|
};
|
|
2726
|
-
const fetchChannels = toolkit.createAsyncThunk('/fetchChannels', (page, { extra }) =>
|
|
2727
|
-
const askedPage = page
|
|
2716
|
+
const fetchChannels = toolkit.createAsyncThunk('/fetchChannels', async (page, { extra }) => {
|
|
2717
|
+
const askedPage = page ?? 1;
|
|
2728
2718
|
const jApi = extra.jApi;
|
|
2729
|
-
return
|
|
2719
|
+
return await new Promise((resolve, reject) => {
|
|
2730
2720
|
const config = {
|
|
2731
2721
|
type: 'tvDisplayChannel',
|
|
2732
2722
|
format: 'raw-list',
|
|
@@ -2739,14 +2729,13 @@ const fetchChannels = toolkit.createAsyncThunk('/fetchChannels', (page, { extra
|
|
|
2739
2729
|
resolve(channelsResp.result);
|
|
2740
2730
|
})
|
|
2741
2731
|
.catch((ex) => {
|
|
2742
|
-
|
|
2743
|
-
reject({ error: (_a = ex.error) !== null && _a !== void 0 ? _a : 1, errorMsg: (_b = ex.errorMsg) !== null && _b !== void 0 ? _b : 'Error retrieving channels' });
|
|
2732
|
+
reject({ error: ex.error ?? 1, errorMsg: ex.errorMsg ?? 'Error retrieving channels' });
|
|
2744
2733
|
});
|
|
2745
2734
|
});
|
|
2746
|
-
})
|
|
2747
|
-
const deleteChannel = toolkit.createAsyncThunk('/deleteChannel', ({ channel }, { extra, dispatch }) =>
|
|
2735
|
+
});
|
|
2736
|
+
const deleteChannel = toolkit.createAsyncThunk('/deleteChannel', async ({ channel }, { extra, dispatch }) => {
|
|
2748
2737
|
const jApi = extra.jApi;
|
|
2749
|
-
return
|
|
2738
|
+
return await new Promise((resolve, reject) => {
|
|
2750
2739
|
jApi.article
|
|
2751
2740
|
.delete(channel.id)
|
|
2752
2741
|
.then((response) => {
|
|
@@ -2754,14 +2743,13 @@ const deleteChannel = toolkit.createAsyncThunk('/deleteChannel', ({ channel }, {
|
|
|
2754
2743
|
dispatch(fetchChannels());
|
|
2755
2744
|
})
|
|
2756
2745
|
.catch((ex) => {
|
|
2757
|
-
|
|
2758
|
-
reject({ error: (_a = ex.error) !== null && _a !== void 0 ? _a : 1, errorMsg: (_b = ex.errorMsg) !== null && _b !== void 0 ? _b : 'Error deleting channel' });
|
|
2746
|
+
reject({ error: ex.error ?? 1, errorMsg: ex.errorMsg ?? 'Error deleting channel' });
|
|
2759
2747
|
});
|
|
2760
2748
|
});
|
|
2761
|
-
})
|
|
2749
|
+
});
|
|
2762
2750
|
const ChannelsListSlice = toolkit.createSlice({
|
|
2763
2751
|
name: 'channelsList',
|
|
2764
|
-
initialState:
|
|
2752
|
+
initialState: { ...initialState$6 },
|
|
2765
2753
|
reducers: {},
|
|
2766
2754
|
extraReducers: (builder) => {
|
|
2767
2755
|
builder
|
|
@@ -2856,7 +2844,9 @@ const selectTinyMCEExtendedOptions = (state) => {
|
|
|
2856
2844
|
};
|
|
2857
2845
|
const TinyMCE = {
|
|
2858
2846
|
slice: TinyMCESlice,
|
|
2859
|
-
actions:
|
|
2847
|
+
actions: {
|
|
2848
|
+
...TinyMCEOptionsSlice.actions,
|
|
2849
|
+
},
|
|
2860
2850
|
selectors: {
|
|
2861
2851
|
selectTinyMCECommonOptions,
|
|
2862
2852
|
selectTinyMCEExtendedOptions,
|
|
@@ -2895,7 +2885,7 @@ const isLogged = (userCurrent) => {
|
|
|
2895
2885
|
};
|
|
2896
2886
|
const UserCurrent = {
|
|
2897
2887
|
slice: slice$1,
|
|
2898
|
-
actions:
|
|
2888
|
+
actions: { ...slice$1.actions },
|
|
2899
2889
|
selectors: {
|
|
2900
2890
|
get,
|
|
2901
2891
|
},
|
|
@@ -2925,18 +2915,18 @@ const WIDGET_QUICK_SURVEY_DESCRIPTION = 'WIDGET_Quick_Survey_Text';
|
|
|
2925
2915
|
|
|
2926
2916
|
var WIDGETS = /*#__PURE__*/Object.freeze({
|
|
2927
2917
|
__proto__: null,
|
|
2928
|
-
|
|
2929
|
-
WIDGET_ARTICLE_TEXT: WIDGET_ARTICLE_TEXT,
|
|
2930
|
-
WIDGET_ARTICLE_IMAGE: WIDGET_ARTICLE_IMAGE,
|
|
2918
|
+
WIDGET_ARTICLE_ATTACHMENT: WIDGET_ARTICLE_ATTACHMENT,
|
|
2931
2919
|
WIDGET_ARTICLE_BUTTON: WIDGET_ARTICLE_BUTTON,
|
|
2932
2920
|
WIDGET_ARTICLE_GALLERY: WIDGET_ARTICLE_GALLERY,
|
|
2933
|
-
|
|
2921
|
+
WIDGET_ARTICLE_IMAGE: WIDGET_ARTICLE_IMAGE,
|
|
2922
|
+
WIDGET_ARTICLE_TEXT: WIDGET_ARTICLE_TEXT,
|
|
2923
|
+
WIDGET_ARTICLE_TITLE: WIDGET_ARTICLE_TITLE,
|
|
2934
2924
|
WIDGET_CHECK_LIST: WIDGET_CHECK_LIST,
|
|
2935
|
-
WIDGET_CHECK_LIST_LABEL: WIDGET_CHECK_LIST_LABEL,
|
|
2936
2925
|
WIDGET_CHECK_LIST_DESCRIPTION: WIDGET_CHECK_LIST_DESCRIPTION,
|
|
2926
|
+
WIDGET_CHECK_LIST_LABEL: WIDGET_CHECK_LIST_LABEL,
|
|
2937
2927
|
WIDGET_QUICK_SURVEY: WIDGET_QUICK_SURVEY,
|
|
2938
|
-
|
|
2939
|
-
|
|
2928
|
+
WIDGET_QUICK_SURVEY_DESCRIPTION: WIDGET_QUICK_SURVEY_DESCRIPTION,
|
|
2929
|
+
WIDGET_QUICK_SURVEY_LABEL: WIDGET_QUICK_SURVEY_LABEL
|
|
2940
2930
|
});
|
|
2941
2931
|
|
|
2942
2932
|
const widgetArticleAttachmentDefinition = {
|
|
@@ -3313,37 +3303,69 @@ function content(name) {
|
|
|
3313
3303
|
switch (name) {
|
|
3314
3304
|
default:
|
|
3315
3305
|
case 'widget-lucca-absence':
|
|
3316
|
-
return
|
|
3306
|
+
return {
|
|
3307
|
+
...widgetLuccaAbsenceContent,
|
|
3308
|
+
};
|
|
3317
3309
|
case 'widget-article-attachment':
|
|
3318
|
-
return
|
|
3310
|
+
return {
|
|
3311
|
+
...widgetArticleAttachmentContent,
|
|
3312
|
+
};
|
|
3319
3313
|
case 'widget-presence':
|
|
3320
|
-
return
|
|
3314
|
+
return {
|
|
3315
|
+
...widgetPresenceContent,
|
|
3316
|
+
};
|
|
3321
3317
|
case 'widget-datasource-table':
|
|
3322
|
-
return
|
|
3318
|
+
return {
|
|
3319
|
+
...widgetDatasourceTaleContent,
|
|
3320
|
+
};
|
|
3323
3321
|
case 'widget-excel-datasource-table':
|
|
3324
|
-
return
|
|
3322
|
+
return {
|
|
3323
|
+
...widgetExcelDatasourceTaleContent,
|
|
3324
|
+
};
|
|
3325
3325
|
case 'widget-article-slider':
|
|
3326
|
-
return
|
|
3326
|
+
return {
|
|
3327
|
+
...widgetArticleSliderContent,
|
|
3328
|
+
};
|
|
3327
3329
|
case 'widget-article-gallery':
|
|
3328
|
-
return
|
|
3330
|
+
return {
|
|
3331
|
+
...widgetArticleGalleryContent,
|
|
3332
|
+
};
|
|
3329
3333
|
case 'widget-article-button':
|
|
3330
|
-
return
|
|
3334
|
+
return {
|
|
3335
|
+
...widgetArticleButtonContent,
|
|
3336
|
+
};
|
|
3331
3337
|
case 'widget-article-title':
|
|
3332
|
-
return
|
|
3338
|
+
return {
|
|
3339
|
+
...widgetArticleTitleContent,
|
|
3340
|
+
};
|
|
3333
3341
|
case 'widget-article-image':
|
|
3334
|
-
return
|
|
3342
|
+
return {
|
|
3343
|
+
...widgetArticleImageContent,
|
|
3344
|
+
};
|
|
3335
3345
|
case 'widget-article-text':
|
|
3336
|
-
return
|
|
3346
|
+
return {
|
|
3347
|
+
...widgetArticleTextContent,
|
|
3348
|
+
};
|
|
3337
3349
|
case 'widget-check-list':
|
|
3338
|
-
return
|
|
3350
|
+
return {
|
|
3351
|
+
...widgetCheckListContent,
|
|
3352
|
+
};
|
|
3339
3353
|
case 'widget-quick-survey':
|
|
3340
|
-
return
|
|
3354
|
+
return {
|
|
3355
|
+
...widgetQuickSurveyContent,
|
|
3356
|
+
};
|
|
3341
3357
|
case 'widget-calendar-calDav':
|
|
3342
|
-
return
|
|
3358
|
+
return {
|
|
3359
|
+
...widgetCalendarCalDavContent,
|
|
3360
|
+
};
|
|
3343
3361
|
case 'widget-contact-cardDav':
|
|
3344
|
-
return
|
|
3362
|
+
return {
|
|
3363
|
+
...widgetContactCardDavContent,
|
|
3364
|
+
};
|
|
3345
3365
|
case 'widget-emails-imap':
|
|
3346
|
-
return
|
|
3366
|
+
return {
|
|
3367
|
+
...widgetEmailsImapContent,
|
|
3368
|
+
};
|
|
3347
3369
|
}
|
|
3348
3370
|
}
|
|
3349
3371
|
|
|
@@ -3410,23 +3432,32 @@ const widgetsSlice = toolkit.createSlice({
|
|
|
3410
3432
|
},
|
|
3411
3433
|
setWidgetWrapperStyle: (state, action) => {
|
|
3412
3434
|
const { uniqid, styles } = action.payload;
|
|
3413
|
-
state.widgetWrapperStyle[uniqid] =
|
|
3435
|
+
state.widgetWrapperStyle[uniqid] = { ...state.widgetWrapperStyle[uniqid], ...styles };
|
|
3414
3436
|
},
|
|
3415
3437
|
setWidgetTitleStyle: (state, action) => {
|
|
3416
3438
|
const { uniqid, styles } = action.payload;
|
|
3417
|
-
state.widgetTitleStyle[uniqid] =
|
|
3439
|
+
state.widgetTitleStyle[uniqid] = { ...state.widgetTitleStyle[uniqid], ...styles };
|
|
3418
3440
|
},
|
|
3419
3441
|
updateWidget: (state, action) => {
|
|
3420
3442
|
const { uniqid } = action.payload;
|
|
3421
|
-
const wrapper =
|
|
3443
|
+
const wrapper = { ...state.ids[uniqid] };
|
|
3422
3444
|
const states = state.states[uniqid];
|
|
3423
|
-
if (states
|
|
3445
|
+
if (states?.locked) {
|
|
3424
3446
|
return;
|
|
3425
3447
|
}
|
|
3426
3448
|
if (state.ids[uniqid] && wrapper && wrapper.widget) {
|
|
3427
|
-
state.ids[uniqid] = Object.assign(
|
|
3449
|
+
state.ids[uniqid] = Object.assign({
|
|
3450
|
+
...state.ids[uniqid],
|
|
3451
|
+
widget: {
|
|
3452
|
+
...wrapper.widget,
|
|
3453
|
+
content: action.payload.override
|
|
3428
3454
|
? action.payload.content
|
|
3429
|
-
: Object.assign(
|
|
3455
|
+
: Object.assign({
|
|
3456
|
+
...wrapper.widget.content,
|
|
3457
|
+
...action.payload.content,
|
|
3458
|
+
}),
|
|
3459
|
+
},
|
|
3460
|
+
});
|
|
3430
3461
|
}
|
|
3431
3462
|
},
|
|
3432
3463
|
registerWidgetRTObject: (state, action) => {
|
|
@@ -3454,18 +3485,30 @@ const widgetsSlice = toolkit.createSlice({
|
|
|
3454
3485
|
updateWidgetWrapper: (state, action) => {
|
|
3455
3486
|
const { uniqid } = action.payload;
|
|
3456
3487
|
if (state.ids && state.ids[uniqid]) {
|
|
3457
|
-
state.ids[uniqid] = Object.assign(
|
|
3488
|
+
state.ids[uniqid] = Object.assign({ ...state.ids[uniqid], ...action.payload });
|
|
3458
3489
|
}
|
|
3459
3490
|
},
|
|
3460
3491
|
registerLayer: (state, action) => {
|
|
3461
3492
|
const layerId = uniqid();
|
|
3462
|
-
const wrapper =
|
|
3493
|
+
const wrapper = { ...state.ids[action.payload.uniqid] };
|
|
3463
3494
|
if (wrapper && wrapper.widget) {
|
|
3464
3495
|
if (state.ids[action.payload.uniqid] && wrapper.widget.layers) {
|
|
3465
|
-
state.ids[action.payload.uniqid] = Object.assign(
|
|
3496
|
+
state.ids[action.payload.uniqid] = Object.assign({
|
|
3497
|
+
...state.ids[action.payload.uniqid],
|
|
3498
|
+
widget: {
|
|
3499
|
+
...wrapper.widget,
|
|
3500
|
+
layers: [...wrapper.widget.layers, layerId],
|
|
3501
|
+
},
|
|
3502
|
+
});
|
|
3466
3503
|
}
|
|
3467
3504
|
else {
|
|
3468
|
-
state.ids[action.payload.uniqid] = Object.assign(
|
|
3505
|
+
state.ids[action.payload.uniqid] = Object.assign({
|
|
3506
|
+
...state.ids[action.payload.uniqid],
|
|
3507
|
+
widget: {
|
|
3508
|
+
...wrapper.widget,
|
|
3509
|
+
layers: [layerId],
|
|
3510
|
+
},
|
|
3511
|
+
});
|
|
3469
3512
|
}
|
|
3470
3513
|
state.ids[action.payload.widget.widget.uniqid] = action.payload.widget;
|
|
3471
3514
|
state.states[action.payload.widget.widget.uniqid] = {
|
|
@@ -3488,15 +3531,24 @@ const widgetsSlice = toolkit.createSlice({
|
|
|
3488
3531
|
},
|
|
3489
3532
|
updateLayer: (state, action) => {
|
|
3490
3533
|
if (state.layers[action.payload.uniqid]) {
|
|
3491
|
-
state.layers[action.payload.uniqid] = Object.assign(
|
|
3534
|
+
state.layers[action.payload.uniqid] = Object.assign({
|
|
3535
|
+
...state.layers[action.payload.uniqid],
|
|
3536
|
+
...action.payload.props,
|
|
3537
|
+
});
|
|
3492
3538
|
}
|
|
3493
3539
|
},
|
|
3494
3540
|
flushLayer: (state, action) => {
|
|
3495
|
-
const wrapper =
|
|
3541
|
+
const wrapper = { ...state.ids[action.payload.uniqid] };
|
|
3496
3542
|
if (wrapper && wrapper.widget && wrapper.widget.layers) {
|
|
3497
|
-
state.ids[action.payload.uniqid] = Object.assign(
|
|
3543
|
+
state.ids[action.payload.uniqid] = Object.assign({
|
|
3544
|
+
...state.ids[action.payload.uniqid],
|
|
3545
|
+
widget: {
|
|
3546
|
+
...wrapper.widget,
|
|
3547
|
+
layers: [
|
|
3498
3548
|
...wrapper.widget.layers.filter((layerId) => layerId !== action.payload.layerId),
|
|
3499
|
-
]
|
|
3549
|
+
],
|
|
3550
|
+
},
|
|
3551
|
+
});
|
|
3500
3552
|
delete state.layers[action.payload.layerId];
|
|
3501
3553
|
}
|
|
3502
3554
|
},
|
|
@@ -3522,16 +3574,22 @@ const widgetsSlice = toolkit.createSlice({
|
|
|
3522
3574
|
},
|
|
3523
3575
|
setWidgetState: (state, action) => {
|
|
3524
3576
|
const { uniqid } = action.payload;
|
|
3525
|
-
const widgetState =
|
|
3577
|
+
const widgetState = { ...state.states[uniqid] };
|
|
3526
3578
|
if (widgetState !== undefined) {
|
|
3527
|
-
state.states[uniqid] =
|
|
3579
|
+
state.states[uniqid] = {
|
|
3580
|
+
...state.states[uniqid],
|
|
3581
|
+
...action.payload,
|
|
3582
|
+
};
|
|
3528
3583
|
}
|
|
3529
3584
|
},
|
|
3530
3585
|
setAllWidgetStates: (state, action) => {
|
|
3531
3586
|
Object.keys(state.states).map((key) => {
|
|
3532
|
-
const widgetState =
|
|
3587
|
+
const widgetState = { ...state.states[key] };
|
|
3533
3588
|
if (widgetState !== undefined) {
|
|
3534
|
-
state.states[key] =
|
|
3589
|
+
state.states[key] = {
|
|
3590
|
+
...state.states[key],
|
|
3591
|
+
...action.payload,
|
|
3592
|
+
};
|
|
3535
3593
|
}
|
|
3536
3594
|
});
|
|
3537
3595
|
},
|
|
@@ -3617,10 +3675,10 @@ const selectToken = (state) => state.widgets.token;
|
|
|
3617
3675
|
const selectModal = (state) => state.widgets.modal;
|
|
3618
3676
|
const selectWidgets = (state) => state.widgets.ids;
|
|
3619
3677
|
const selectFlushedWidgets = (state) => state.widgets.flushedWidgets;
|
|
3620
|
-
const selectWidgetState = (state, uniqid) =>
|
|
3621
|
-
const selectWidget = (state, uniqid) =>
|
|
3622
|
-
const selectWidgetLevel = (state, uniqid) =>
|
|
3623
|
-
const selectWidgetObject = (state, uniqid) =>
|
|
3678
|
+
const selectWidgetState = (state, uniqid) => state.widgets.states[uniqid] ?? undefined;
|
|
3679
|
+
const selectWidget = (state, uniqid) => state.widgets.ids[uniqid] ?? undefined;
|
|
3680
|
+
const selectWidgetLevel = (state, uniqid) => state.widgets.ids[uniqid]?.level ?? undefined;
|
|
3681
|
+
const selectWidgetObject = (state, uniqid) => state.widgets.widgetObject[uniqid] ?? undefined;
|
|
3624
3682
|
const selectWidgetObjectUri = (state, uniqid) => {
|
|
3625
3683
|
const o = state.widgets.widgetObject[uniqid];
|
|
3626
3684
|
if (o && 'uri' in o) {
|
|
@@ -3628,15 +3686,15 @@ const selectWidgetObjectUri = (state, uniqid) => {
|
|
|
3628
3686
|
}
|
|
3629
3687
|
return undefined;
|
|
3630
3688
|
};
|
|
3631
|
-
const selectWidgetObjectRights = (state, uniqid) =>
|
|
3632
|
-
const selectWidgetContext = (state, uniqid) =>
|
|
3633
|
-
const selectWidgetAuthor = (state, uniqid) =>
|
|
3634
|
-
const selectWidgetChipCount = (state, uniqid) =>
|
|
3635
|
-
const selectWidgetWrapperStyle = (state, uniqid) =>
|
|
3636
|
-
const selectWidgetTitleStyle = (state, uniqid) =>
|
|
3689
|
+
const selectWidgetObjectRights = (state, uniqid) => state.widgets.widgetObjectRights[uniqid] ?? undefined;
|
|
3690
|
+
const selectWidgetContext = (state, uniqid) => state.widgets.widgetContext[uniqid] ?? undefined;
|
|
3691
|
+
const selectWidgetAuthor = (state, uniqid) => state.widgets.widgetAuthor[uniqid] ?? undefined;
|
|
3692
|
+
const selectWidgetChipCount = (state, uniqid) => state.widgets.widgetChipCount[uniqid] ?? 0;
|
|
3693
|
+
const selectWidgetWrapperStyle = (state, uniqid) => state.widgets.widgetWrapperStyle[uniqid] ?? {};
|
|
3694
|
+
const selectWidgetTitleStyle = (state, uniqid) => state.widgets.widgetTitleStyle[uniqid] ?? {};
|
|
3637
3695
|
const isActive = (state, uniqid) => state.widgets.currentEditableWidgetId === uniqid;
|
|
3638
3696
|
const selectAllWidgetRTObject = (state, uniqid) => state.widgets.rtObjectStack.filter((el) => el.uniqid === uniqid);
|
|
3639
|
-
const updateWidgetContent = (uniqid, content, override) => Widget.slice.actions.updateWidget({ uniqid, content, override: override
|
|
3697
|
+
const updateWidgetContent = (uniqid, content, override) => Widget.slice.actions.updateWidget({ uniqid, content, override: override ?? false });
|
|
3640
3698
|
const Widget = {
|
|
3641
3699
|
const: WIDGETS,
|
|
3642
3700
|
factory: widgetFactory,
|
|
@@ -3681,14 +3739,14 @@ const editorsSlice = toolkit.createSlice({
|
|
|
3681
3739
|
uniqid,
|
|
3682
3740
|
name,
|
|
3683
3741
|
position: 'right',
|
|
3684
|
-
mode: mode
|
|
3742
|
+
mode: mode ?? 'view',
|
|
3685
3743
|
}
|
|
3686
3744
|
: {
|
|
3687
3745
|
uniqid,
|
|
3688
3746
|
name,
|
|
3689
3747
|
onSave,
|
|
3690
3748
|
position: 'right',
|
|
3691
|
-
mode: mode
|
|
3749
|
+
mode: mode ?? 'view',
|
|
3692
3750
|
};
|
|
3693
3751
|
state.editors = state.editors.find((ed) => ed.uniqid === uniqid)
|
|
3694
3752
|
? state.editors
|
|
@@ -3697,21 +3755,25 @@ const editorsSlice = toolkit.createSlice({
|
|
|
3697
3755
|
registerEditorPopup: (state, action) => {
|
|
3698
3756
|
const { uniqid, view } = action.payload;
|
|
3699
3757
|
state.editors = [
|
|
3700
|
-
...state.editors.map((editor) => editor.uniqid === uniqid ?
|
|
3758
|
+
...state.editors.map((editor) => editor.uniqid === uniqid ? { ...editor, popup: true, view } : editor),
|
|
3701
3759
|
];
|
|
3702
3760
|
},
|
|
3703
3761
|
flushEditorPopup: (state, action) => {
|
|
3704
3762
|
const { uniqid } = action.payload;
|
|
3705
3763
|
state.editors = [
|
|
3706
3764
|
...state.editors.map((editor) => editor.uniqid === uniqid
|
|
3707
|
-
?
|
|
3765
|
+
? {
|
|
3766
|
+
...editor,
|
|
3767
|
+
popup: false,
|
|
3768
|
+
}
|
|
3769
|
+
: editor),
|
|
3708
3770
|
];
|
|
3709
3771
|
},
|
|
3710
3772
|
setEditorPosition: (state, action) => {
|
|
3711
3773
|
const { uniqid, position } = action.payload;
|
|
3712
3774
|
state.editors = [
|
|
3713
3775
|
...state.editors.map((ed) => {
|
|
3714
|
-
return ed.uniqid === uniqid ?
|
|
3776
|
+
return ed.uniqid === uniqid ? { ...ed, position } : ed;
|
|
3715
3777
|
}),
|
|
3716
3778
|
];
|
|
3717
3779
|
},
|
|
@@ -3752,7 +3814,7 @@ const slice = toolkit.createSlice({
|
|
|
3752
3814
|
const selectors = adapter.getSelectors((state) => state.entities.socialActions);
|
|
3753
3815
|
const SocialActions = {
|
|
3754
3816
|
slice: slice,
|
|
3755
|
-
actions:
|
|
3817
|
+
actions: { ...slice.actions },
|
|
3756
3818
|
selectors,
|
|
3757
3819
|
};
|
|
3758
3820
|
|
|
@@ -3948,9 +4010,7 @@ const AppFormNotFields = [AppFormItemType.AUDIENCE, AppFormItemType.RANGE];
|
|
|
3948
4010
|
popup: [AppFormItemType.PUBLISHTO],
|
|
3949
4011
|
edit: [AppFormItemType.PUBLISHTO],
|
|
3950
4012
|
list: [AppFormItemType.DATECREATION],
|
|
3951
|
-
filter: [AppFormItemType.DATECREATION]
|
|
3952
|
-
view: [],
|
|
3953
|
-
});
|
|
4013
|
+
filter: [AppFormItemType.DATECREATION]});
|
|
3954
4014
|
const AppFormFixedList = [
|
|
3955
4015
|
AppFormItemType.TITLE,
|
|
3956
4016
|
AppFormItemType.PUBLISHTO,
|
|
@@ -3962,7 +4022,7 @@ const AppFormFixedList = [
|
|
|
3962
4022
|
[AppFormItemType.DESCRIPTION, AppFormItemType.IMAGE];
|
|
3963
4023
|
const AppFormBannedFromViews = new Map();
|
|
3964
4024
|
AppFormBannedFromViews.set(AppFormItemType.IMAGE, ['list', 'filter', 'view']);
|
|
3965
|
-
|
|
4025
|
+
[
|
|
3966
4026
|
AppFormItemType.TITLE,
|
|
3967
4027
|
AppFormItemType.DESCRIPTION,
|
|
3968
4028
|
AppFormItemType.TEXT,
|
|
@@ -3992,11 +4052,7 @@ const AppListFilter = [
|
|
|
3992
4052
|
({
|
|
3993
4053
|
create: [AppFormItemType.IMAGE, AppFormItemType.ADDFILEATTACHMENT, AppFormItemType.CODEHTML],
|
|
3994
4054
|
popup: [AppFormItemType.IMAGE, AppFormItemType.ADDFILEATTACHMENT, AppFormItemType.CODEHTML],
|
|
3995
|
-
edit: [AppFormItemType.IMAGE, AppFormItemType.ADDFILEATTACHMENT, AppFormItemType.CODEHTML]
|
|
3996
|
-
list: AppListFilter,
|
|
3997
|
-
filter: AppListFilter,
|
|
3998
|
-
view: AppListFilter,
|
|
3999
|
-
});
|
|
4055
|
+
edit: [AppFormItemType.IMAGE, AppFormItemType.ADDFILEATTACHMENT, AppFormItemType.CODEHTML]});
|
|
4000
4056
|
AppFormFixedList.concat(AppFormNotFields)
|
|
4001
4057
|
.concat(AppFormItemType.IDUSER)
|
|
4002
4058
|
.concat(AppFormItemType.TITLE);
|
|
@@ -4032,14 +4088,13 @@ function migrateJson(v1Json) {
|
|
|
4032
4088
|
installFor: v1.installFor || [],
|
|
4033
4089
|
};
|
|
4034
4090
|
function _renderFields() {
|
|
4035
|
-
var _a;
|
|
4036
4091
|
const v2Fields = [];
|
|
4037
4092
|
for (const v1FormItem of v1.form.formItems) {
|
|
4038
4093
|
const type = _matctTypes(v1FormItem.type);
|
|
4039
4094
|
v2Fields.push({
|
|
4040
4095
|
id: v1FormItem.id,
|
|
4041
4096
|
type,
|
|
4042
|
-
properties: _renderProperties(
|
|
4097
|
+
properties: _renderProperties(v1FormItem.properties ?? {}),
|
|
4043
4098
|
mandatory: v1FormItem.mandatory || false,
|
|
4044
4099
|
views: v1FormItem.views,
|
|
4045
4100
|
isActive: true,
|
|
@@ -4054,37 +4109,68 @@ function migrateJson(v1Json) {
|
|
|
4054
4109
|
return AppFormItemTypes[v1Type];
|
|
4055
4110
|
}
|
|
4056
4111
|
function _renderProperties(v1FormItemProperties) {
|
|
4057
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
4058
4112
|
const v2Properties = [];
|
|
4059
4113
|
const isEnhancedOptionEditor = v1FormItemProperties.options &&
|
|
4060
4114
|
Object.prototype.hasOwnProperty.call(v1FormItemProperties, 'hasDefaultValue');
|
|
4061
|
-
const baseProperty =
|
|
4115
|
+
const baseProperty = {
|
|
4116
|
+
isRequired: v1FormItemProperties.mandatory || false,
|
|
4117
|
+
...(isEnhancedOptionEditor && { isOptionsEditorEnhanced: true }),
|
|
4118
|
+
};
|
|
4062
4119
|
if (v1FormItemProperties.labels) {
|
|
4063
|
-
v2Properties.push(
|
|
4064
|
-
|
|
4120
|
+
v2Properties.push({
|
|
4121
|
+
propertyType: AppFieldFormPropertyTypes.LABEL,
|
|
4122
|
+
value: v1FormItemProperties.labels.label?.content || '',
|
|
4123
|
+
...baseProperty,
|
|
4124
|
+
});
|
|
4125
|
+
v2Properties.push({
|
|
4126
|
+
propertyType: AppFieldFormPropertyTypes.DESCRIPTION,
|
|
4127
|
+
value: v1FormItemProperties.labels.description?.content || '',
|
|
4128
|
+
...baseProperty,
|
|
4129
|
+
});
|
|
4065
4130
|
}
|
|
4066
4131
|
if (v1FormItemProperties.options) {
|
|
4067
|
-
v2Properties.push(
|
|
4132
|
+
v2Properties.push({
|
|
4133
|
+
propertyType: AppFieldFormPropertyTypes.OPTIONS_EDITOR,
|
|
4134
|
+
value: isEnhancedOptionEditor
|
|
4068
4135
|
? {
|
|
4069
|
-
propertyOptions: _renderSelectOptions(
|
|
4136
|
+
propertyOptions: _renderSelectOptions(v1FormItemProperties.options ?? []),
|
|
4070
4137
|
defaultSelectOptionValue: v1FormItemProperties.defaultValue,
|
|
4071
|
-
defaultSelectOption:
|
|
4072
|
-
canSelectMultiple:
|
|
4073
|
-
userCanModifiyByComment:
|
|
4138
|
+
defaultSelectOption: v1FormItemProperties.hasDefaultValue ?? false,
|
|
4139
|
+
canSelectMultiple: v1FormItemProperties.multiple ?? false,
|
|
4140
|
+
userCanModifiyByComment: v1FormItemProperties.explain ?? false,
|
|
4074
4141
|
}
|
|
4075
|
-
: { propertyOptions: _renderSelectOptions(
|
|
4142
|
+
: { propertyOptions: _renderSelectOptions(v1FormItemProperties.options ?? []) },
|
|
4143
|
+
...baseProperty,
|
|
4144
|
+
});
|
|
4076
4145
|
}
|
|
4077
4146
|
if (v1FormItemProperties.code) {
|
|
4078
|
-
v2Properties.push(
|
|
4147
|
+
v2Properties.push({
|
|
4148
|
+
propertyType: AppFieldFormPropertyTypes.RICHTEXT,
|
|
4149
|
+
value: { html: v1FormItemProperties.code.html, text: v1FormItemProperties.code.text },
|
|
4150
|
+
...baseProperty,
|
|
4151
|
+
});
|
|
4079
4152
|
}
|
|
4080
4153
|
if (Object.prototype.hasOwnProperty.call(v1FormItemProperties, 'digits')) {
|
|
4081
|
-
v2Properties.push(
|
|
4154
|
+
v2Properties.push({
|
|
4155
|
+
propertyType: AppFieldFormPropertyTypes.CHECKBOX,
|
|
4156
|
+
value: v1FormItemProperties.digits || false,
|
|
4157
|
+
checkBoxOptions: [{ label: 'APPSTUDIO_FormEditProps_Digits', value: v1FormItemProperties.digits }],
|
|
4158
|
+
...baseProperty,
|
|
4159
|
+
});
|
|
4082
4160
|
}
|
|
4083
4161
|
if (Object.prototype.hasOwnProperty.call(v1FormItemProperties, 'taxonomy')) {
|
|
4084
|
-
v2Properties.push(
|
|
4162
|
+
v2Properties.push({
|
|
4163
|
+
propertyType: AppFieldFormPropertyTypes.TAXONOMY,
|
|
4164
|
+
value: v1FormItemProperties.taxonomy || '',
|
|
4165
|
+
...baseProperty,
|
|
4166
|
+
});
|
|
4085
4167
|
}
|
|
4086
4168
|
if (Object.prototype.hasOwnProperty.call(v1FormItemProperties, 'contentType')) {
|
|
4087
|
-
v2Properties.push(
|
|
4169
|
+
v2Properties.push({
|
|
4170
|
+
propertyType: AppFieldFormPropertyTypes.CONTENTTYPE,
|
|
4171
|
+
value: v1FormItemProperties.contentType || '',
|
|
4172
|
+
...baseProperty,
|
|
4173
|
+
});
|
|
4088
4174
|
}
|
|
4089
4175
|
return v2Properties;
|
|
4090
4176
|
}
|
|
@@ -4121,24 +4207,48 @@ function migrateJson(v1Json) {
|
|
|
4121
4207
|
value: v1FormItemRef.fixedValue || '',
|
|
4122
4208
|
};
|
|
4123
4209
|
if (v1FormItemRef.ref === AppFormItemType.TITLE) {
|
|
4124
|
-
viewItems[uuid.v4()] =
|
|
4210
|
+
viewItems[uuid.v4()] = {
|
|
4211
|
+
...viewBase,
|
|
4212
|
+
type: ExtraAppFieldsItemViews.TITLE,
|
|
4213
|
+
isFixed: true,
|
|
4214
|
+
};
|
|
4125
4215
|
}
|
|
4126
4216
|
else if (v1FormItemRef.ref === AppFormItemType.IDUSER) {
|
|
4127
|
-
viewItems[uuid.v4()] =
|
|
4217
|
+
viewItems[uuid.v4()] = {
|
|
4218
|
+
...viewBase,
|
|
4219
|
+
type: ExtraAppFieldsItemViews.USER,
|
|
4220
|
+
isFixed: true,
|
|
4221
|
+
};
|
|
4128
4222
|
}
|
|
4129
4223
|
else if (v1FormItemRef.ref === AppFormItemType.PUBLISHTO) {
|
|
4130
|
-
viewItems[uuid.v4()] =
|
|
4224
|
+
viewItems[uuid.v4()] = {
|
|
4225
|
+
...viewBase,
|
|
4226
|
+
type: ExtraAppFieldsItemViews.PUBLISHTO,
|
|
4227
|
+
isOptional: true,
|
|
4228
|
+
};
|
|
4131
4229
|
}
|
|
4132
4230
|
else if (v1FormItemRef.ref === AppFormItemType.SENDALERTTOSUBSCRIBERS) {
|
|
4133
|
-
viewItems[uuid.v4()] =
|
|
4231
|
+
viewItems[uuid.v4()] = {
|
|
4232
|
+
...viewBase,
|
|
4233
|
+
type: ExtraAppFieldsItemViews.SENDALERTTOSUBSCRIBERS,
|
|
4234
|
+
isOptional: true,
|
|
4235
|
+
};
|
|
4134
4236
|
}
|
|
4135
4237
|
else if (v1FormItemRef.ref === AppFormItemType.RECEIVEACOPY) {
|
|
4136
|
-
viewItems[uuid.v4()] =
|
|
4238
|
+
viewItems[uuid.v4()] = {
|
|
4239
|
+
...viewBase,
|
|
4240
|
+
type: ExtraAppFieldsItemViews.RECEIVEACOPY,
|
|
4241
|
+
isOptional: true,
|
|
4242
|
+
};
|
|
4137
4243
|
}
|
|
4138
4244
|
else {
|
|
4139
4245
|
const v2Field = _mapFormItemRefWithField(v1FormItemRef);
|
|
4140
4246
|
if (v2Field) {
|
|
4141
|
-
viewItems[v2Field.id] =
|
|
4247
|
+
viewItems[v2Field.id] = {
|
|
4248
|
+
type: v2Field.type,
|
|
4249
|
+
...viewBase,
|
|
4250
|
+
properties: v2Field.properties || [],
|
|
4251
|
+
};
|
|
4142
4252
|
}
|
|
4143
4253
|
}
|
|
4144
4254
|
});
|
|
@@ -4244,7 +4354,7 @@ function _setFieldProperties(type) {
|
|
|
4244
4354
|
{ propertyType: AppFieldFormPropertyTypes.DESCRIPTION, value: '' },
|
|
4245
4355
|
{
|
|
4246
4356
|
propertyType: AppFieldFormPropertyTypes.TAXONOMY,
|
|
4247
|
-
value:
|
|
4357
|
+
value: { ...taxonomyDefaultValue },
|
|
4248
4358
|
},
|
|
4249
4359
|
];
|
|
4250
4360
|
case AppFormItemTypes.CONTENTLINK:
|
|
@@ -4253,7 +4363,7 @@ function _setFieldProperties(type) {
|
|
|
4253
4363
|
{ propertyType: AppFieldFormPropertyTypes.DESCRIPTION, value: '' },
|
|
4254
4364
|
{
|
|
4255
4365
|
propertyType: AppFieldFormPropertyTypes.CONTENTTYPE,
|
|
4256
|
-
value:
|
|
4366
|
+
value: { ...contentTypeDefaultValue },
|
|
4257
4367
|
},
|
|
4258
4368
|
];
|
|
4259
4369
|
default:
|
|
@@ -4262,7 +4372,11 @@ function _setFieldProperties(type) {
|
|
|
4262
4372
|
}
|
|
4263
4373
|
|
|
4264
4374
|
function _initField(type, installedField) {
|
|
4265
|
-
const field =
|
|
4375
|
+
const field = {
|
|
4376
|
+
...generateNewFormField(type, false),
|
|
4377
|
+
id: installedField.name,
|
|
4378
|
+
mandatory: installedField.mandatory,
|
|
4379
|
+
};
|
|
4266
4380
|
field.properties[0].value = installedField.label;
|
|
4267
4381
|
field.properties[1].value = installedField.description;
|
|
4268
4382
|
return field;
|
|
@@ -4278,14 +4392,21 @@ function _getOptions(installedOptions) {
|
|
|
4278
4392
|
return options;
|
|
4279
4393
|
}
|
|
4280
4394
|
function createAddfileattachmentField(installedField) {
|
|
4281
|
-
const field =
|
|
4395
|
+
const field = {
|
|
4396
|
+
...generateNewFormField(AppFormItemTypes.ADDFILEATTACHMENT, false),
|
|
4397
|
+
id: installedField.name,
|
|
4398
|
+
mandatory: installedField.mandatory,
|
|
4399
|
+
};
|
|
4282
4400
|
field.properties[0].value = installedField.label;
|
|
4283
4401
|
return field;
|
|
4284
4402
|
}
|
|
4285
4403
|
function createHtmlField(formItem) {
|
|
4286
|
-
const field =
|
|
4404
|
+
const field = {
|
|
4405
|
+
...generateNewFormField(AppFormItemTypes.CODEHTML, false),
|
|
4406
|
+
id: formItem.name,
|
|
4407
|
+
};
|
|
4287
4408
|
const code = formItem.properties.code;
|
|
4288
|
-
if (typeof code === 'object' &&
|
|
4409
|
+
if (typeof code === 'object' && code?.html && typeof code.html === 'string') {
|
|
4289
4410
|
field.properties[0].value = code.html;
|
|
4290
4411
|
}
|
|
4291
4412
|
else if (typeof code === 'string') {
|
|
@@ -4298,31 +4419,28 @@ function createImageField() {
|
|
|
4298
4419
|
return field;
|
|
4299
4420
|
}
|
|
4300
4421
|
function createNumberField(installedField) {
|
|
4301
|
-
var _a;
|
|
4302
4422
|
const field = _initField(AppFormItemTypes.NUMBER, installedField);
|
|
4303
|
-
field.properties[2].value =
|
|
4423
|
+
field.properties[2].value = installedField.widget.params?.step === '0.01';
|
|
4304
4424
|
return field;
|
|
4305
4425
|
}
|
|
4306
4426
|
function createTagsField(installedField) {
|
|
4307
|
-
var _a, _b;
|
|
4308
4427
|
const field = _initField(AppFormItemTypes.TAGS, installedField);
|
|
4309
|
-
field.properties[2].value.id = +(
|
|
4428
|
+
field.properties[2].value.id = +(installedField.widget.params?.idTaxonomy ?? 1);
|
|
4310
4429
|
return field;
|
|
4311
4430
|
}
|
|
4312
4431
|
function createSelectField(installedField) {
|
|
4313
|
-
var _a, _b, _c, _d, _e;
|
|
4314
4432
|
const field = _initField(AppFormItemTypes.SELECT, installedField);
|
|
4315
|
-
const defaultValue =
|
|
4433
|
+
const defaultValue = installedField.widget.params?.defaultValue
|
|
4316
4434
|
? {
|
|
4317
|
-
title: installedField.widget.options[
|
|
4318
|
-
value:
|
|
4435
|
+
title: installedField.widget.options[installedField.widget.params?.defaultValue],
|
|
4436
|
+
value: installedField.widget.params?.defaultValue,
|
|
4319
4437
|
}
|
|
4320
4438
|
: undefined;
|
|
4321
4439
|
const optionsEditorValue = {
|
|
4322
4440
|
propertyOptions: _getOptions(installedField.widget.options),
|
|
4323
4441
|
canSelectMultiple: installedField.widget.multiple === '1',
|
|
4324
|
-
userCanModifiyByComment:
|
|
4325
|
-
defaultSelectOption: !!
|
|
4442
|
+
userCanModifiyByComment: installedField.widget.params?.explain === '1',
|
|
4443
|
+
defaultSelectOption: !!installedField.widget.params?.defaultValue,
|
|
4326
4444
|
defaultSelectOptionValue: defaultValue,
|
|
4327
4445
|
};
|
|
4328
4446
|
field.properties[2].value = optionsEditorValue;
|
|
@@ -4342,12 +4460,11 @@ function createCheckboxField(installedField) {
|
|
|
4342
4460
|
return field;
|
|
4343
4461
|
}
|
|
4344
4462
|
function createContentLinkField(installedField, state) {
|
|
4345
|
-
var _a, _b;
|
|
4346
4463
|
const field = _initField(AppFormItemTypes.CONTENTLINK, installedField);
|
|
4347
|
-
field.properties[2].value.type =
|
|
4464
|
+
field.properties[2].value.type = installedField.widget.params.types ?? 'mpArticle';
|
|
4348
4465
|
const modelState = state.entities === undefined ? undefined : { entities: state.entities };
|
|
4349
4466
|
const model = modelState ? Model.selectors.selectById(modelState, field.properties[2].value.type) : undefined;
|
|
4350
|
-
field.properties[2].value.label =
|
|
4467
|
+
field.properties[2].value.label = model?.label ?? 'Article';
|
|
4351
4468
|
return field;
|
|
4352
4469
|
}
|
|
4353
4470
|
function createTextField(installedField) {
|
|
@@ -4419,7 +4536,6 @@ function appToXml(studioApp) {
|
|
|
4419
4536
|
</Application>`;
|
|
4420
4537
|
}
|
|
4421
4538
|
function createAppManifest(manifest, views, audience, installFor, idApp) {
|
|
4422
|
-
var _a;
|
|
4423
4539
|
return `<Manifest>
|
|
4424
4540
|
<ShowImport>true</ShowImport>
|
|
4425
4541
|
<AppShortName>${idApp}</AppShortName>
|
|
@@ -4429,7 +4545,7 @@ function createAppManifest(manifest, views, audience, installFor, idApp) {
|
|
|
4429
4545
|
<ManifestVersion>1.0</ManifestVersion>
|
|
4430
4546
|
<StudioVersion>2</StudioVersion>
|
|
4431
4547
|
<DateCreation>${manifest.dateCreation.toString().split('T')[0]}</DateCreation>
|
|
4432
|
-
<CssClass>${
|
|
4548
|
+
<CssClass>${manifest.cssClass?.label}</CssClass>
|
|
4433
4549
|
<CssColor>${manifest.cssColor}</CssColor>
|
|
4434
4550
|
<Categories>N.A.</Categories>
|
|
4435
4551
|
<Editor>Jamespot</Editor>
|
|
@@ -4505,14 +4621,14 @@ function renderAudience(audience, installFor) {
|
|
|
4505
4621
|
return '';
|
|
4506
4622
|
}
|
|
4507
4623
|
function renderPrimaryFields(fields) {
|
|
4508
|
-
const primaryFields = fields
|
|
4624
|
+
const primaryFields = fields?.filter((field) => AppFormPrimaryListValues.includes(field.type));
|
|
4509
4625
|
if (primaryFields.length === 0)
|
|
4510
4626
|
return '';
|
|
4511
4627
|
return `<primaryFields>${primaryFields.map((field) => formItem2xml(field)).join('')}</primaryFields>`;
|
|
4512
4628
|
}
|
|
4513
4629
|
function renderCustomFields(fields) {
|
|
4514
|
-
const customFields = fields
|
|
4515
|
-
const filteredCustomFields = customFields
|
|
4630
|
+
const customFields = fields?.filter((field) => !AppFormPrimaryListValues.includes(field.type));
|
|
4631
|
+
const filteredCustomFields = customFields?.filter((field) => field.type !== AppFormItemTypes.IMAGE);
|
|
4516
4632
|
if (filteredCustomFields.length === 0)
|
|
4517
4633
|
return '';
|
|
4518
4634
|
const articlesTablesItems = filteredCustomFields.filter((f) => f.type !== AppFormItemTypes.TAGS && !AppFormNonPrimaryList.includes(f.type));
|
|
@@ -4554,7 +4670,6 @@ function formItem2xml(field) {
|
|
|
4554
4670
|
</field>`;
|
|
4555
4671
|
}
|
|
4556
4672
|
function renderWidget(fieldType, fieldProperties) {
|
|
4557
|
-
var _a;
|
|
4558
4673
|
switch (fieldType) {
|
|
4559
4674
|
case AppFormItemTypes.DESCRIPTION:
|
|
4560
4675
|
return '<widget form="textarea"><params><param key="class" value="mceEditor"></param><param key="mention" value="1"></param></params></widget>';
|
|
@@ -4569,13 +4684,14 @@ function renderWidget(fieldType, fieldProperties) {
|
|
|
4569
4684
|
case AppFormItemTypes.DATETIME:
|
|
4570
4685
|
return `<widget form="datetime" format="d/m/Y H:i:s"></widget>`;
|
|
4571
4686
|
case AppFormItemTypes.NUMBER: {
|
|
4572
|
-
const isFloat =
|
|
4687
|
+
const isFloat = fieldProperties?.find((property) => property.propertyType === AppFieldFormPropertyTypes.CHECKBOX)
|
|
4688
|
+
?.value === true;
|
|
4573
4689
|
return `<widget form="number">
|
|
4574
4690
|
${isFloat ? `<params><param value="0.01" key="step"/></params>` : ''}
|
|
4575
4691
|
</widget>`;
|
|
4576
4692
|
}
|
|
4577
4693
|
case AppFormItemTypes.SELECT: {
|
|
4578
|
-
const optionEditor = fieldProperties
|
|
4694
|
+
const optionEditor = fieldProperties?.find((property) => property.propertyType === AppFieldFormPropertyTypes.OPTIONS_EDITOR);
|
|
4579
4695
|
if (!optionEditor)
|
|
4580
4696
|
return '';
|
|
4581
4697
|
const isMultiple = optionEditor.value.canSelectMultiple;
|
|
@@ -4599,7 +4715,7 @@ function renderWidget(fieldType, fieldProperties) {
|
|
|
4599
4715
|
</widget>`;
|
|
4600
4716
|
}
|
|
4601
4717
|
case AppFormItemTypes.RADIO: {
|
|
4602
|
-
const optionEditor = fieldProperties
|
|
4718
|
+
const optionEditor = fieldProperties?.find((property) => property.propertyType === AppFieldFormPropertyTypes.OPTIONS_EDITOR);
|
|
4603
4719
|
if (!optionEditor)
|
|
4604
4720
|
return '';
|
|
4605
4721
|
const options = optionEditor.value.propertyOptions;
|
|
@@ -4621,7 +4737,7 @@ function renderWidget(fieldType, fieldProperties) {
|
|
|
4621
4737
|
</params>
|
|
4622
4738
|
</widget>`;
|
|
4623
4739
|
case AppFormItemTypes.TAGS: {
|
|
4624
|
-
const taxonomy = fieldProperties
|
|
4740
|
+
const taxonomy = fieldProperties?.find((property) => property.propertyType === AppFieldFormPropertyTypes.TAXONOMY);
|
|
4625
4741
|
if (!taxonomy)
|
|
4626
4742
|
return '';
|
|
4627
4743
|
const taxonomyId = taxonomy.value.id;
|
|
@@ -4630,7 +4746,7 @@ function renderWidget(fieldType, fieldProperties) {
|
|
|
4630
4746
|
</widget>`;
|
|
4631
4747
|
}
|
|
4632
4748
|
case AppFormItemTypes.CHECKBOX: {
|
|
4633
|
-
const optionEditor = fieldProperties
|
|
4749
|
+
const optionEditor = fieldProperties?.find((property) => property.propertyType === AppFieldFormPropertyTypes.OPTIONS_EDITOR);
|
|
4634
4750
|
if (!optionEditor)
|
|
4635
4751
|
return '';
|
|
4636
4752
|
const options = optionEditor.value.propertyOptions;
|
|
@@ -4662,7 +4778,7 @@ function renderWidget(fieldType, fieldProperties) {
|
|
|
4662
4778
|
</params>
|
|
4663
4779
|
</widget>`;
|
|
4664
4780
|
case AppFormItemTypes.CONTENTLINK: {
|
|
4665
|
-
const contentType = fieldProperties
|
|
4781
|
+
const contentType = fieldProperties?.find((property) => property.propertyType === AppFieldFormPropertyTypes.CONTENTTYPE);
|
|
4666
4782
|
if (!contentType)
|
|
4667
4783
|
return '';
|
|
4668
4784
|
const type = contentType.value.type;
|
|
@@ -4681,7 +4797,7 @@ function renderWidget(fieldType, fieldProperties) {
|
|
|
4681
4797
|
}
|
|
4682
4798
|
}
|
|
4683
4799
|
function renderProperty(properties, propertyToFind) {
|
|
4684
|
-
const labelProperty = properties
|
|
4800
|
+
const labelProperty = properties?.find((property) => property.propertyType === propertyToFind);
|
|
4685
4801
|
if (labelProperty) {
|
|
4686
4802
|
const value = labelProperty.value.replaceAll('"', '"');
|
|
4687
4803
|
return `${propertyToFind.toLowerCase()}="${value}"`;
|
|
@@ -4820,7 +4936,6 @@ function getDisplayName(fieldId, view) {
|
|
|
4820
4936
|
}
|
|
4821
4937
|
}
|
|
4822
4938
|
function renderDisplayAttr(fieldId, view) {
|
|
4823
|
-
var _a, _b, _c;
|
|
4824
4939
|
let xml = '';
|
|
4825
4940
|
const attrName = getDisplayName(fieldId, view);
|
|
4826
4941
|
const isFixed = view.isLockedValue;
|
|
@@ -4840,7 +4955,7 @@ function renderDisplayAttr(fieldId, view) {
|
|
|
4840
4955
|
xml += `<input type="hidden" name="${attrName}[]" value=${JSON.stringify(view.value.uri)}>`;
|
|
4841
4956
|
}
|
|
4842
4957
|
else if (view.type === AppFormItemTypes.SELECT) {
|
|
4843
|
-
const canSelectMultiple =
|
|
4958
|
+
const canSelectMultiple = view.properties.find((property) => property.propertyType === AppFieldFormPropertyTypes.OPTIONS_EDITOR)?.value.canSelectMultiple;
|
|
4844
4959
|
if (canSelectMultiple) {
|
|
4845
4960
|
const values = view.value;
|
|
4846
4961
|
values.forEach((value) => {
|
|
@@ -4876,7 +4991,9 @@ function renderDisplayAttr(fieldId, view) {
|
|
|
4876
4991
|
xml += '<input type="hidden" name="' + attrName + '" value="' + xmlFixedValue + '">';
|
|
4877
4992
|
}
|
|
4878
4993
|
else if (view.type === AppFormItemTypes.TAGS) {
|
|
4879
|
-
xml += `<input type="hidden" name="${attrName}" value="${
|
|
4994
|
+
xml += `<input type="hidden" name="${attrName}" value="${view.value
|
|
4995
|
+
?.map((v) => v.uri)
|
|
4996
|
+
?.join(',')}">`;
|
|
4880
4997
|
}
|
|
4881
4998
|
else if (view.type === AppFormItemTypes.DESCRIPTION || view.type === AppFormItemTypes.TEXTAREAHTML) {
|
|
4882
4999
|
xml += `<input type="hidden" name="${attrName}" value="${view.value}">`;
|
|
@@ -4937,15 +5054,14 @@ const specialAttrName = ['title', 'alertAuthor', 'sendAlert'];
|
|
|
4937
5054
|
const ignoredFields = ['edito'];
|
|
4938
5055
|
function updateViewsFromFields(views, syncViewFieldOrder, appFields) {
|
|
4939
5056
|
return Object.assign({}, ...viewsList.map((view) => {
|
|
4940
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4941
5057
|
const viewItems = {};
|
|
4942
5058
|
let viewMissingOptionalFields = [];
|
|
4943
|
-
if (
|
|
4944
|
-
viewMissingOptionalFields = viewMissingOptionalFields.concat(
|
|
5059
|
+
if (MapExtraFieldsWithView[view]?.optional !== undefined) {
|
|
5060
|
+
viewMissingOptionalFields = viewMissingOptionalFields.concat(MapExtraFieldsWithView[view]?.optional ?? []);
|
|
4945
5061
|
}
|
|
4946
5062
|
let viewMissingFixedFields = [];
|
|
4947
|
-
if (
|
|
4948
|
-
viewMissingFixedFields = viewMissingFixedFields.concat(
|
|
5063
|
+
if (MapExtraFieldsWithView[view]?.fixed !== undefined) {
|
|
5064
|
+
viewMissingFixedFields = viewMissingFixedFields.concat(MapExtraFieldsWithView[view]?.fixed ?? []);
|
|
4949
5065
|
}
|
|
4950
5066
|
Object.entries(views[view]).forEach(([fieldId, field]) => {
|
|
4951
5067
|
if (field.isFixed) {
|
|
@@ -4960,11 +5076,11 @@ function updateViewsFromFields(views, syncViewFieldOrder, appFields) {
|
|
|
4960
5076
|
const missingFieldsSet = new Set(viewMissingFixedFields.concat(viewMissingOptionalFields));
|
|
4961
5077
|
const fieldTypeHandlers = {
|
|
4962
5078
|
[ExtraAppFieldsItemViews.CREATIONDATE]: () => getDateCreationToView(false),
|
|
4963
|
-
[ExtraAppFieldsItemViews.TITLE]: () => getTitleToView({
|
|
5079
|
+
[ExtraAppFieldsItemViews.TITLE]: () => getTitleToView({ fixedValue: undefined }),
|
|
4964
5080
|
[ExtraAppFieldsItemViews.USER]: () => getUserToView(false),
|
|
4965
|
-
[ExtraAppFieldsItemViews.RECEIVEACOPY]: () => getAlertAuthorToView({
|
|
4966
|
-
[ExtraAppFieldsItemViews.SENDALERTTOSUBSCRIBERS]: () => getSendAlertToView({
|
|
4967
|
-
[ExtraAppFieldsItemViews.PUBLISHTO]: () => getPublishToToView({
|
|
5081
|
+
[ExtraAppFieldsItemViews.RECEIVEACOPY]: () => getAlertAuthorToView({ fixedValue: undefined }),
|
|
5082
|
+
[ExtraAppFieldsItemViews.SENDALERTTOSUBSCRIBERS]: () => getSendAlertToView({ fixedValue: undefined }),
|
|
5083
|
+
[ExtraAppFieldsItemViews.PUBLISHTO]: () => getPublishToToView({ fixedValue: undefined }),
|
|
4968
5084
|
};
|
|
4969
5085
|
missingFieldsSet.forEach((fieldType) => {
|
|
4970
5086
|
const handler = fieldTypeHandlers[fieldType];
|
|
@@ -4978,35 +5094,34 @@ function updateViewsFromFields(views, syncViewFieldOrder, appFields) {
|
|
|
4978
5094
|
});
|
|
4979
5095
|
const newFields = [];
|
|
4980
5096
|
appFields.forEach((field, idx) => {
|
|
4981
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4982
5097
|
const isFieldUsedInView = field.views[view];
|
|
4983
5098
|
const isExistingField = Object.keys(views[view]).includes(field.id);
|
|
4984
5099
|
const fieldType = field.type;
|
|
4985
|
-
if (AppFormBannedFromViews$1.get(fieldType) &&
|
|
5100
|
+
if (AppFormBannedFromViews$1.get(fieldType) && AppFormBannedFromViews$1.get(fieldType)?.includes(view)) {
|
|
4986
5101
|
return;
|
|
4987
5102
|
}
|
|
4988
5103
|
let fieldValue = undefined;
|
|
4989
5104
|
if (fieldType === AppFormItemTypes.CODEHTML) {
|
|
4990
|
-
const richTextProperty =
|
|
4991
|
-
if (richTextProperty
|
|
4992
|
-
fieldValue = richTextProperty
|
|
5105
|
+
const richTextProperty = field.properties?.find((prop) => prop.propertyType === AppFieldFormPropertyTypes.RICHTEXT);
|
|
5106
|
+
if (richTextProperty?.value) {
|
|
5107
|
+
fieldValue = richTextProperty?.value;
|
|
4993
5108
|
}
|
|
4994
5109
|
}
|
|
4995
5110
|
if (fieldType === AppFormItemTypes.SELECT) {
|
|
4996
|
-
const selectProperty =
|
|
5111
|
+
const selectProperty = field.properties?.find((prop) => prop.propertyType === AppFieldFormPropertyTypes.OPTIONS_EDITOR);
|
|
4997
5112
|
if (isExistingField) {
|
|
4998
5113
|
const exField = views[view][field.id];
|
|
4999
|
-
const exSelectProperty =
|
|
5000
|
-
const isMultivalued = !!
|
|
5001
|
-
const exIsMultivalued = !!
|
|
5114
|
+
const exSelectProperty = exField.properties?.find((prop) => prop.propertyType === AppFieldFormPropertyTypes.OPTIONS_EDITOR);
|
|
5115
|
+
const isMultivalued = !!selectProperty?.value?.canSelectMultiple;
|
|
5116
|
+
const exIsMultivalued = !!exSelectProperty?.value?.canSelectMultiple;
|
|
5002
5117
|
if (isMultivalued === exIsMultivalued) {
|
|
5003
5118
|
fieldValue = exField.value;
|
|
5004
5119
|
}
|
|
5005
5120
|
}
|
|
5006
5121
|
else {
|
|
5007
|
-
const isEnhancedSelect = !!
|
|
5008
|
-
const defaultValue = isEnhancedSelect && !!
|
|
5009
|
-
? selectProperty
|
|
5122
|
+
const isEnhancedSelect = !!selectProperty?.isOptionsEditorEnhanced;
|
|
5123
|
+
const defaultValue = isEnhancedSelect && !!selectProperty?.value.defaultSelectOption
|
|
5124
|
+
? selectProperty?.value.defaultSelectOptionValue
|
|
5010
5125
|
: '';
|
|
5011
5126
|
if (defaultValue) {
|
|
5012
5127
|
fieldValue = defaultValue;
|
|
@@ -5015,7 +5130,14 @@ function updateViewsFromFields(views, syncViewFieldOrder, appFields) {
|
|
|
5015
5130
|
}
|
|
5016
5131
|
if (isExistingField) {
|
|
5017
5132
|
const exField = views[view][field.id];
|
|
5018
|
-
viewItems[field.id] =
|
|
5133
|
+
viewItems[field.id] = {
|
|
5134
|
+
...exField,
|
|
5135
|
+
properties: field.properties || exField.properties || [],
|
|
5136
|
+
...(fieldValue !== undefined && { value: fieldValue }),
|
|
5137
|
+
isUsed: isFieldUsedInView,
|
|
5138
|
+
pos: syncViewFieldOrder?.[view] ? idx : exField.pos,
|
|
5139
|
+
isLockedValue: (fieldValue !== undefined || exField.value !== undefined) && exField.isLockedValue,
|
|
5140
|
+
};
|
|
5019
5141
|
}
|
|
5020
5142
|
else {
|
|
5021
5143
|
newFields.push({ id: field.id, idx: idx });
|
|
@@ -5027,12 +5149,12 @@ function updateViewsFromFields(views, syncViewFieldOrder, appFields) {
|
|
|
5027
5149
|
isOptional: false,
|
|
5028
5150
|
isLockedValue: false,
|
|
5029
5151
|
isFixed: false,
|
|
5030
|
-
value: fieldValue
|
|
5031
|
-
pos:
|
|
5152
|
+
value: fieldValue ?? null,
|
|
5153
|
+
pos: syncViewFieldOrder?.[view] ? idx : existingFieldsLen + idx,
|
|
5032
5154
|
};
|
|
5033
5155
|
}
|
|
5034
5156
|
});
|
|
5035
|
-
if (!
|
|
5157
|
+
if (!syncViewFieldOrder?.[view]) {
|
|
5036
5158
|
newFields.forEach((nf) => {
|
|
5037
5159
|
const item = viewItems[nf.id];
|
|
5038
5160
|
item.pos = nf.idx + 1;
|
|
@@ -5091,7 +5213,7 @@ function buildView(appS, registeredFields, displayName, displayValue, tables, st
|
|
|
5091
5213
|
const newName = installedToV2ViewNames[displayName];
|
|
5092
5214
|
appS.views[newName] = {};
|
|
5093
5215
|
if (newName === 'view') {
|
|
5094
|
-
const [localFieldIdTitle, localFieldTitle] = getTitleToView({ fixedValue: undefined
|
|
5216
|
+
const [localFieldIdTitle, localFieldTitle] = getTitleToView({ fixedValue: undefined});
|
|
5095
5217
|
appS.views[newName][localFieldIdTitle] = localFieldTitle;
|
|
5096
5218
|
}
|
|
5097
5219
|
displayValue.composants.forEach((viewComponent, index) => {
|
|
@@ -5152,7 +5274,7 @@ function buildFilterView(appS, registeredFields, attrExposed, tables, state) {
|
|
|
5152
5274
|
function addFieldToViewFromRef(appS, registeredFields, tables, viewName, fieldRef, index, state) {
|
|
5153
5275
|
switch (fieldRef) {
|
|
5154
5276
|
case 'title':
|
|
5155
|
-
const [fieldIDTitle, fieldInfoTitle] = getTitleToView({
|
|
5277
|
+
const [fieldIDTitle, fieldInfoTitle] = getTitleToView({ fixedValue: undefined });
|
|
5156
5278
|
appS['views'][viewName][fieldIDTitle] = fieldInfoTitle;
|
|
5157
5279
|
break;
|
|
5158
5280
|
case 'iduser':
|
|
@@ -5213,14 +5335,14 @@ function createOrGetField(appS, registeredFields, viewComponent, tables, state)
|
|
|
5213
5335
|
const formItemRefString = htmlCode.substring(startPos, endPos);
|
|
5214
5336
|
try {
|
|
5215
5337
|
const formItemRef = JSON.parse(formItemRefString);
|
|
5216
|
-
if (
|
|
5338
|
+
if (formItemRef?.ref.toUpperCase() in ExtraAppFieldsItemViews) {
|
|
5217
5339
|
const ref = formItemRef.ref.toUpperCase();
|
|
5218
|
-
return [-1,
|
|
5340
|
+
return [-1, { ...formItemRef, ref: fieldType(ref) }];
|
|
5219
5341
|
}
|
|
5220
|
-
if (specialAttrName.includes(formItemRef
|
|
5342
|
+
if (specialAttrName.includes(formItemRef?.ref)) {
|
|
5221
5343
|
return [-1, formItemRef];
|
|
5222
5344
|
}
|
|
5223
|
-
const knownIndex = registeredFields.get(formItemRef
|
|
5345
|
+
const knownIndex = registeredFields.get(formItemRef?.ref);
|
|
5224
5346
|
if (knownIndex !== undefined) {
|
|
5225
5347
|
return [knownIndex, formItemRef];
|
|
5226
5348
|
}
|
|
@@ -5239,7 +5361,7 @@ function createOrGetField(appS, registeredFields, viewComponent, tables, state)
|
|
|
5239
5361
|
const endPosCode = htmlCode.indexOf('</JAMESPOT.STUDIO.CODEHTML>');
|
|
5240
5362
|
const formItemString = htmlCode.substring(startPosCode, endPosCode);
|
|
5241
5363
|
const formItem = JSON.parse(formItemString);
|
|
5242
|
-
const knownIndex = registeredFields.get(formItem
|
|
5364
|
+
const knownIndex = registeredFields.get(formItem?.name);
|
|
5243
5365
|
if (knownIndex !== undefined) {
|
|
5244
5366
|
return [knownIndex, undefined];
|
|
5245
5367
|
}
|
|
@@ -5322,10 +5444,9 @@ function createStudioDefinedField(appS, ref, tables, state) {
|
|
|
5322
5444
|
return [ref, index];
|
|
5323
5445
|
}
|
|
5324
5446
|
function getInstalledField(ref, tables) {
|
|
5325
|
-
var _a;
|
|
5326
5447
|
let foundField = undefined;
|
|
5327
5448
|
for (let i = 0; i < tables.length && !foundField; i++) {
|
|
5328
|
-
foundField =
|
|
5449
|
+
foundField = tables[i]?.attributes.find((attr) => {
|
|
5329
5450
|
return attr.name === ref;
|
|
5330
5451
|
});
|
|
5331
5452
|
}
|
|
@@ -5335,7 +5456,6 @@ function getInstalledField(ref, tables) {
|
|
|
5335
5456
|
return foundField;
|
|
5336
5457
|
}
|
|
5337
5458
|
function addFieldToView(viewName, field, appS, index, fixedInfo) {
|
|
5338
|
-
var _a;
|
|
5339
5459
|
if (field.views) {
|
|
5340
5460
|
field.views[viewName] = true;
|
|
5341
5461
|
appS.views[viewName][field.id] = {
|
|
@@ -5343,15 +5463,14 @@ function addFieldToView(viewName, field, appS, index, fixedInfo) {
|
|
|
5343
5463
|
properties: field.properties || [],
|
|
5344
5464
|
isUsed: true,
|
|
5345
5465
|
isOptional: false,
|
|
5346
|
-
isLockedValue: !!
|
|
5466
|
+
isLockedValue: !!fixedInfo?.fixedValue,
|
|
5347
5467
|
isFixed: false,
|
|
5348
|
-
value:
|
|
5468
|
+
value: fixedInfo?.fixedValue ?? null,
|
|
5349
5469
|
pos: index,
|
|
5350
5470
|
};
|
|
5351
5471
|
}
|
|
5352
5472
|
}
|
|
5353
5473
|
function getFormItemType(installedField) {
|
|
5354
|
-
var _a, _b, _c;
|
|
5355
5474
|
switch (installedField.widget.type) {
|
|
5356
5475
|
case 'number':
|
|
5357
5476
|
return AppFormItemTypes.NUMBER;
|
|
@@ -5372,15 +5491,15 @@ function getFormItemType(installedField) {
|
|
|
5372
5491
|
case 'file':
|
|
5373
5492
|
return AppFormItemTypes.ADDFILEATTACHMENT;
|
|
5374
5493
|
case 'checkbox':
|
|
5375
|
-
if (
|
|
5494
|
+
if (installedField.widget.options?.['1'] === 'GLOBAL_Yes') {
|
|
5376
5495
|
return AppFormItemTypes.TOGGLE;
|
|
5377
5496
|
}
|
|
5378
5497
|
return AppFormItemTypes.CHECKBOX;
|
|
5379
5498
|
case 'uri':
|
|
5380
|
-
if (
|
|
5499
|
+
if (installedField.widget.params?.views === 'user') {
|
|
5381
5500
|
return AppFormItemTypes.USERLINK;
|
|
5382
5501
|
}
|
|
5383
|
-
if (
|
|
5502
|
+
if (installedField.widget.params?.views === 'article') {
|
|
5384
5503
|
return AppFormItemTypes.CONTENTLINK;
|
|
5385
5504
|
}
|
|
5386
5505
|
break;
|
|
@@ -5404,7 +5523,6 @@ function getFormItemType(installedField) {
|
|
|
5404
5523
|
JSON.stringify(installedField));
|
|
5405
5524
|
}
|
|
5406
5525
|
function getTitleToView(fixedInfo, isUsed = true) {
|
|
5407
|
-
var _a;
|
|
5408
5526
|
return [
|
|
5409
5527
|
'title',
|
|
5410
5528
|
{
|
|
@@ -5412,9 +5530,9 @@ function getTitleToView(fixedInfo, isUsed = true) {
|
|
|
5412
5530
|
properties: [],
|
|
5413
5531
|
isUsed: isUsed,
|
|
5414
5532
|
isOptional: false,
|
|
5415
|
-
isLockedValue: !!
|
|
5533
|
+
isLockedValue: !!fixedInfo?.fixedValue,
|
|
5416
5534
|
isFixed: true,
|
|
5417
|
-
value:
|
|
5535
|
+
value: fixedInfo?.fixedValue ?? null,
|
|
5418
5536
|
pos: 0,
|
|
5419
5537
|
},
|
|
5420
5538
|
];
|
|
@@ -5427,9 +5545,9 @@ function getAlertAuthorToView(fixedInfo, isUsed = true) {
|
|
|
5427
5545
|
properties: [],
|
|
5428
5546
|
isUsed: isUsed,
|
|
5429
5547
|
isOptional: true,
|
|
5430
|
-
isLockedValue:
|
|
5548
|
+
isLockedValue: fixedInfo?.fixedValue !== undefined,
|
|
5431
5549
|
isFixed: false,
|
|
5432
|
-
value:
|
|
5550
|
+
value: fixedInfo?.fixedValue !== undefined ? fixedInfo?.fixedValue : true,
|
|
5433
5551
|
pos: 300,
|
|
5434
5552
|
},
|
|
5435
5553
|
];
|
|
@@ -5442,15 +5560,14 @@ function getSendAlertToView(fixedInfo, isUsed = true) {
|
|
|
5442
5560
|
properties: [],
|
|
5443
5561
|
isUsed: isUsed,
|
|
5444
5562
|
isOptional: true,
|
|
5445
|
-
isLockedValue:
|
|
5563
|
+
isLockedValue: fixedInfo?.fixedValue !== undefined,
|
|
5446
5564
|
isFixed: false,
|
|
5447
|
-
value:
|
|
5565
|
+
value: fixedInfo?.fixedValue !== undefined ? fixedInfo?.fixedValue : true,
|
|
5448
5566
|
pos: 200,
|
|
5449
5567
|
},
|
|
5450
5568
|
];
|
|
5451
5569
|
}
|
|
5452
5570
|
function getPublishToToView(fixedInfo, isUsed = true) {
|
|
5453
|
-
var _a;
|
|
5454
5571
|
return [
|
|
5455
5572
|
'publishTo',
|
|
5456
5573
|
{
|
|
@@ -5458,9 +5575,9 @@ function getPublishToToView(fixedInfo, isUsed = true) {
|
|
|
5458
5575
|
properties: [],
|
|
5459
5576
|
isUsed: isUsed,
|
|
5460
5577
|
isOptional: true,
|
|
5461
|
-
isLockedValue: !!
|
|
5578
|
+
isLockedValue: !!fixedInfo?.fixedValue,
|
|
5462
5579
|
isFixed: false,
|
|
5463
|
-
value:
|
|
5580
|
+
value: fixedInfo?.fixedValue ?? [],
|
|
5464
5581
|
pos: 100,
|
|
5465
5582
|
},
|
|
5466
5583
|
];
|
|
@@ -5497,7 +5614,6 @@ function getDateCreationToView(isUsed = true) {
|
|
|
5497
5614
|
}
|
|
5498
5615
|
|
|
5499
5616
|
function InstalledAppStudioAdapter(serverApp, serverApps, state) {
|
|
5500
|
-
var _a, _b, _c, _d, _e, _f;
|
|
5501
5617
|
const { version, dateCreation } = serverApp.manifest;
|
|
5502
5618
|
const appTypeServer = serverApp.typeModel;
|
|
5503
5619
|
const views = Object.assign({}, ...viewsList.map((view) => ({
|
|
@@ -5513,8 +5629,8 @@ function InstalledAppStudioAdapter(serverApp, serverApps, state) {
|
|
|
5513
5629
|
appName: serverApp.label,
|
|
5514
5630
|
description: serverApp.description,
|
|
5515
5631
|
author: serverApp.author,
|
|
5516
|
-
cssColor:
|
|
5517
|
-
cssClass: { label:
|
|
5632
|
+
cssColor: appTypeServer.cssColor ?? '#392994',
|
|
5633
|
+
cssClass: { label: appTypeServer.cssClass ?? 'star', value: appTypeServer.cssClass ?? 'star' },
|
|
5518
5634
|
version: version,
|
|
5519
5635
|
dateCreation: dateCreation,
|
|
5520
5636
|
checkAccess: false,
|
|
@@ -5522,8 +5638,8 @@ function InstalledAppStudioAdapter(serverApp, serverApps, state) {
|
|
|
5522
5638
|
attrExposed: [],
|
|
5523
5639
|
viewSolr: serverApp.view ? STUDIO_VIEW.SOLR : STUDIO_VIEW.NOT_SOLR,
|
|
5524
5640
|
typeLabel: appTypeServer.typeLabel,
|
|
5525
|
-
articlesCount:
|
|
5526
|
-
displayContentLegacyTable: !!
|
|
5641
|
+
articlesCount: serverApp.articlesCount ?? 0,
|
|
5642
|
+
displayContentLegacyTable: !!typedApp?.typeModel?.displays?.['displayDisabled'],
|
|
5527
5643
|
},
|
|
5528
5644
|
fields: [],
|
|
5529
5645
|
views,
|
|
@@ -5561,7 +5677,7 @@ function DraftAppStudioAdapter(serverApp) {
|
|
|
5561
5677
|
};
|
|
5562
5678
|
}
|
|
5563
5679
|
else {
|
|
5564
|
-
return
|
|
5680
|
+
return { ...migrateJson(parsedJson), status: _formatStatus(serverApp), migratedFrom: 1 };
|
|
5565
5681
|
}
|
|
5566
5682
|
}
|
|
5567
5683
|
function _formatStatus(serverApp) {
|
|
@@ -5607,11 +5723,11 @@ const initialState$1 = {
|
|
|
5607
5723
|
installStudioAppStatus: 'idle',
|
|
5608
5724
|
hasChanged: false,
|
|
5609
5725
|
};
|
|
5610
|
-
const fetchCurrentStudioApp = toolkit.createAsyncThunk('studio/fetchCurrentStudioApp', ({ idApp, status }, { extra, rejectWithValue, getState }) =>
|
|
5726
|
+
const fetchCurrentStudioApp = toolkit.createAsyncThunk('studio/fetchCurrentStudioApp', async ({ idApp, status }, { extra, rejectWithValue, getState }) => {
|
|
5611
5727
|
const jApi = extra.jApi;
|
|
5612
5728
|
const error = { error: 1, errorMsg: 'Error fetching application' };
|
|
5613
5729
|
try {
|
|
5614
|
-
const studioApplicationBase = (
|
|
5730
|
+
const studioApplicationBase = (await jApi.application.studioGet(idApp, status)).result;
|
|
5615
5731
|
const studioApplication = serverAppsToStudioApps([studioApplicationBase], getState())[0];
|
|
5616
5732
|
if (!studioApplication) {
|
|
5617
5733
|
return rejectWithValue(error);
|
|
@@ -5621,8 +5737,8 @@ const fetchCurrentStudioApp = toolkit.createAsyncThunk('studio/fetchCurrentStudi
|
|
|
5621
5737
|
catch (_) {
|
|
5622
5738
|
return rejectWithValue(error);
|
|
5623
5739
|
}
|
|
5624
|
-
})
|
|
5625
|
-
const saveCurrentStudioApp = toolkit.createAsyncThunk('studio/saveCurrentStudioApp', (_, { extra, rejectWithValue, getState, dispatch }) =>
|
|
5740
|
+
});
|
|
5741
|
+
const saveCurrentStudioApp = toolkit.createAsyncThunk('studio/saveCurrentStudioApp', async (_, { extra, rejectWithValue, getState, dispatch }) => {
|
|
5626
5742
|
const jApi = extra.jApi;
|
|
5627
5743
|
const error = { error: 1, errorMsg: 'Error saving application' };
|
|
5628
5744
|
const currentStudioApp = getState().studio.currentStudioApp.currentStudioApp;
|
|
@@ -5631,7 +5747,7 @@ const saveCurrentStudioApp = toolkit.createAsyncThunk('studio/saveCurrentStudioA
|
|
|
5631
5747
|
}
|
|
5632
5748
|
const stringifiedApp = JSON.stringify(currentStudioApp);
|
|
5633
5749
|
try {
|
|
5634
|
-
|
|
5750
|
+
await jApi.application.studioSave(currentStudioApp.idApp, stringifiedApp, 'saved');
|
|
5635
5751
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Edition_Saved' }));
|
|
5636
5752
|
return;
|
|
5637
5753
|
}
|
|
@@ -5639,8 +5755,8 @@ const saveCurrentStudioApp = toolkit.createAsyncThunk('studio/saveCurrentStudioA
|
|
|
5639
5755
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5640
5756
|
return rejectWithValue(error);
|
|
5641
5757
|
}
|
|
5642
|
-
})
|
|
5643
|
-
const installStudioApp = toolkit.createAsyncThunk('studio/installApp', ({ callback }, { extra, rejectWithValue, getState, dispatch }) =>
|
|
5758
|
+
});
|
|
5759
|
+
const installStudioApp = toolkit.createAsyncThunk('studio/installApp', async ({ callback }, { extra, rejectWithValue, getState, dispatch }) => {
|
|
5644
5760
|
const jApi = extra.jApi;
|
|
5645
5761
|
const error = { error: 1, errorMsg: 'Error saving application' };
|
|
5646
5762
|
const currentStudioApp = getState().studio.currentStudioApp.currentStudioApp;
|
|
@@ -5649,7 +5765,7 @@ const installStudioApp = toolkit.createAsyncThunk('studio/installApp', ({ callba
|
|
|
5649
5765
|
}
|
|
5650
5766
|
const xml = appToXml(currentStudioApp);
|
|
5651
5767
|
try {
|
|
5652
|
-
|
|
5768
|
+
await jApi.application.studioInstall(xml);
|
|
5653
5769
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Installed' }));
|
|
5654
5770
|
if (callback)
|
|
5655
5771
|
callback();
|
|
@@ -5659,7 +5775,7 @@ const installStudioApp = toolkit.createAsyncThunk('studio/installApp', ({ callba
|
|
|
5659
5775
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5660
5776
|
return rejectWithValue(error);
|
|
5661
5777
|
}
|
|
5662
|
-
})
|
|
5778
|
+
});
|
|
5663
5779
|
const CurrentStudioAppSlice = toolkit.createSlice({
|
|
5664
5780
|
name: 'currentStudioApp',
|
|
5665
5781
|
initialState: initialState$1,
|
|
@@ -5726,7 +5842,15 @@ function cloneStudioAppFromExistingApp(existingApp, author, inWorkVersion) {
|
|
|
5726
5842
|
const newAppName = `${existingApp.manifest.appName} Copie`;
|
|
5727
5843
|
newApp.idApp = newAppId;
|
|
5728
5844
|
newApp.status = APP_STATUS_TYPE.DRAFT;
|
|
5729
|
-
newApp.manifest =
|
|
5845
|
+
newApp.manifest = {
|
|
5846
|
+
...newApp.manifest,
|
|
5847
|
+
appName: newAppName,
|
|
5848
|
+
appShortName: newAppName,
|
|
5849
|
+
author: author || newApp.manifest.author || '',
|
|
5850
|
+
dateCreation: new Date().toISOString(),
|
|
5851
|
+
version: 0.1,
|
|
5852
|
+
articlesCount: 0,
|
|
5853
|
+
};
|
|
5730
5854
|
}
|
|
5731
5855
|
else {
|
|
5732
5856
|
newApp.manifest.version = newApp.manifest.version + 0.1;
|
|
@@ -5737,9 +5861,8 @@ function cloneStudioAppFromExistingApp(existingApp, author, inWorkVersion) {
|
|
|
5737
5861
|
function createNewStudioApp$1({ author, appName }) {
|
|
5738
5862
|
const newAppId = uuid.v4();
|
|
5739
5863
|
const views = Object.assign({}, ...viewsList.map((view) => {
|
|
5740
|
-
var _a, _b;
|
|
5741
5864
|
const viewItems = {};
|
|
5742
|
-
|
|
5865
|
+
MapExtraFieldsWithView[view]?.fixed.forEach((fixedField, idx) => {
|
|
5743
5866
|
viewItems[uuid.v4()] = {
|
|
5744
5867
|
type: fixedField,
|
|
5745
5868
|
properties: [],
|
|
@@ -5751,7 +5874,7 @@ function createNewStudioApp$1({ author, appName }) {
|
|
|
5751
5874
|
pos: idx,
|
|
5752
5875
|
};
|
|
5753
5876
|
});
|
|
5754
|
-
|
|
5877
|
+
MapExtraFieldsWithView[view]?.optional.forEach((optionalField, idx) => {
|
|
5755
5878
|
viewItems[uuid.v4()] = {
|
|
5756
5879
|
type: optionalField,
|
|
5757
5880
|
properties: [],
|
|
@@ -5821,16 +5944,16 @@ const initialState = {
|
|
|
5821
5944
|
createInWorkAppStatus: 'idle',
|
|
5822
5945
|
createNewStudioAppStatus: 'idle',
|
|
5823
5946
|
};
|
|
5824
|
-
const fetchStudioAppsList = toolkit.createAsyncThunk('studio/appsList', (intl, { extra, rejectWithValue, dispatch, getState }) =>
|
|
5947
|
+
const fetchStudioAppsList = toolkit.createAsyncThunk('studio/appsList', async (intl, { extra, rejectWithValue, dispatch, getState }) => {
|
|
5825
5948
|
const jApi = extra.jApi;
|
|
5826
5949
|
try {
|
|
5827
|
-
const { result } =
|
|
5828
|
-
const taxonomies =
|
|
5829
|
-
const appsPromisesResult =
|
|
5830
|
-
const coreApp = (
|
|
5831
|
-
const articlesCount = (
|
|
5832
|
-
return
|
|
5833
|
-
}))
|
|
5950
|
+
const { result } = await jApi.application.studioList();
|
|
5951
|
+
const taxonomies = await jApi.taxonomy.list();
|
|
5952
|
+
const appsPromisesResult = await Promise.allSettled(result.map(async (app) => {
|
|
5953
|
+
const coreApp = (await jApi.application.studioGet(app.idApp, app.status)).result;
|
|
5954
|
+
const articlesCount = (await jApi.article.count(app.idApp)).result;
|
|
5955
|
+
return { ...coreApp, articlesCount };
|
|
5956
|
+
}));
|
|
5834
5957
|
const apps = appsPromisesResult
|
|
5835
5958
|
.map((result) => {
|
|
5836
5959
|
return result.status === 'fulfilled' ? result.value : null;
|
|
@@ -5842,12 +5965,12 @@ const fetchStudioAppsList = toolkit.createAsyncThunk('studio/appsList', (intl, {
|
|
|
5842
5965
|
return prev;
|
|
5843
5966
|
}, []);
|
|
5844
5967
|
const transformedApps = serverAppsToStudioApps(apps, getState());
|
|
5845
|
-
transformedApps.forEach((app) =>
|
|
5968
|
+
transformedApps.forEach(async (app) => {
|
|
5846
5969
|
app.fields = updateTaxonomies(app.fields, taxonomies, intl);
|
|
5847
5970
|
if (app.inWorkVersion) {
|
|
5848
5971
|
app.inWorkVersion.fields = updateTaxonomies(app.inWorkVersion.fields, taxonomies, intl);
|
|
5849
5972
|
}
|
|
5850
|
-
})
|
|
5973
|
+
});
|
|
5851
5974
|
return transformedApps;
|
|
5852
5975
|
}
|
|
5853
5976
|
catch (err) {
|
|
@@ -5855,19 +5978,18 @@ const fetchStudioAppsList = toolkit.createAsyncThunk('studio/appsList', (intl, {
|
|
|
5855
5978
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5856
5979
|
throw rejectWithValue({ error: 1, errorMsg: 'Error retrieving applications' });
|
|
5857
5980
|
}
|
|
5858
|
-
})
|
|
5981
|
+
});
|
|
5859
5982
|
function updateTaxonomies(fields, taxonomies, intl) {
|
|
5860
5983
|
return fields.map((field) => {
|
|
5861
|
-
var _a;
|
|
5862
5984
|
if (field.type !== AppFormItemTypes.TAGS) {
|
|
5863
5985
|
return field;
|
|
5864
5986
|
}
|
|
5865
5987
|
const newField = JSON.parse(JSON.stringify(field));
|
|
5866
|
-
const newFieldTaxoProp =
|
|
5988
|
+
const newFieldTaxoProp = newField.properties?.find((prop) => {
|
|
5867
5989
|
return prop.propertyType === AppFieldFormPropertyTypes.TAXONOMY;
|
|
5868
5990
|
});
|
|
5869
5991
|
const taxo = taxonomies.find((taxo) => {
|
|
5870
|
-
return taxo.id ===
|
|
5992
|
+
return taxo.id === newFieldTaxoProp?.value.id;
|
|
5871
5993
|
});
|
|
5872
5994
|
if (taxo && newFieldTaxoProp) {
|
|
5873
5995
|
newFieldTaxoProp.value.title = intl.formatMessage({ id: taxo.title });
|
|
@@ -5876,13 +5998,12 @@ function updateTaxonomies(fields, taxonomies, intl) {
|
|
|
5876
5998
|
return newField;
|
|
5877
5999
|
});
|
|
5878
6000
|
}
|
|
5879
|
-
const createNewStudioApp = toolkit.createAsyncThunk('studio/createApp', ({ appName, callback }, { extra, dispatch, rejectWithValue, getState }) =>
|
|
5880
|
-
var _a;
|
|
6001
|
+
const createNewStudioApp = toolkit.createAsyncThunk('studio/createApp', async ({ appName, callback }, { extra, dispatch, rejectWithValue, getState }) => {
|
|
5881
6002
|
const jApi = extra.jApi;
|
|
5882
|
-
const author =
|
|
5883
|
-
const { newAppId, newStudioApp } = createNewStudioApp$1(
|
|
6003
|
+
const author = getState().userCurrent?.uri;
|
|
6004
|
+
const { newAppId, newStudioApp } = createNewStudioApp$1({ appName, ...(author && { author }) });
|
|
5884
6005
|
try {
|
|
5885
|
-
|
|
6006
|
+
await jApi.application.studioSave(newAppId, JSON.stringify(newStudioApp), 'saved');
|
|
5886
6007
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_StudioApp_Created' }));
|
|
5887
6008
|
dispatch(CurrentStudioAppSlice.actions.setCurrentApp(newStudioApp));
|
|
5888
6009
|
if (callback)
|
|
@@ -5893,11 +6014,11 @@ const createNewStudioApp = toolkit.createAsyncThunk('studio/createApp', ({ appNa
|
|
|
5893
6014
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5894
6015
|
throw rejectWithValue({ error: 1, errorMsg: 'Error creating application' });
|
|
5895
6016
|
}
|
|
5896
|
-
})
|
|
5897
|
-
const deleteStudioApp = toolkit.createAsyncThunk('studio/deleteApp', ({ idApp, status }, { extra, rejectWithValue, dispatch }) =>
|
|
6017
|
+
});
|
|
6018
|
+
const deleteStudioApp = toolkit.createAsyncThunk('studio/deleteApp', async ({ idApp, status }, { extra, rejectWithValue, dispatch }) => {
|
|
5898
6019
|
const jApi = extra.jApi;
|
|
5899
6020
|
try {
|
|
5900
|
-
const deleteRes =
|
|
6021
|
+
const deleteRes = await jApi.application.studioDelete(idApp, status);
|
|
5901
6022
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_StudioApp_Deleted' }));
|
|
5902
6023
|
return deleteRes;
|
|
5903
6024
|
}
|
|
@@ -5905,33 +6026,32 @@ const deleteStudioApp = toolkit.createAsyncThunk('studio/deleteApp', ({ idApp, s
|
|
|
5905
6026
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5906
6027
|
return rejectWithValue({ error: 1, errorMsg: 'Error deleting application' });
|
|
5907
6028
|
}
|
|
5908
|
-
})
|
|
5909
|
-
const suspendStudioApp = toolkit.createAsyncThunk('studio/suspendStudioApp', ({ idApp }, { extra, rejectWithValue, dispatch }) =>
|
|
6029
|
+
});
|
|
6030
|
+
const suspendStudioApp = toolkit.createAsyncThunk('studio/suspendStudioApp', async ({ idApp }, { extra, rejectWithValue, dispatch }) => {
|
|
5910
6031
|
const jApi = extra.jApi;
|
|
5911
6032
|
try {
|
|
5912
|
-
|
|
6033
|
+
await jApi.application.studioSuspend(idApp);
|
|
5913
6034
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Suspended' }));
|
|
5914
6035
|
}
|
|
5915
6036
|
catch (err) {
|
|
5916
6037
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5917
6038
|
throw rejectWithValue({ error: 1, errorMsg: 'Error suspending application' });
|
|
5918
6039
|
}
|
|
5919
|
-
})
|
|
5920
|
-
const restartStudioApp = toolkit.createAsyncThunk('studio/restartStudioApp', ({ idApp }, { extra, rejectWithValue, dispatch }) =>
|
|
6040
|
+
});
|
|
6041
|
+
const restartStudioApp = toolkit.createAsyncThunk('studio/restartStudioApp', async ({ idApp }, { extra, rejectWithValue, dispatch }) => {
|
|
5921
6042
|
const jApi = extra.jApi;
|
|
5922
6043
|
try {
|
|
5923
|
-
|
|
6044
|
+
await jApi.application.studioRestart(idApp);
|
|
5924
6045
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Restarted' }));
|
|
5925
6046
|
}
|
|
5926
6047
|
catch (err) {
|
|
5927
6048
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5928
6049
|
throw rejectWithValue({ error: 1, errorMsg: 'Error restarting application' });
|
|
5929
6050
|
}
|
|
5930
|
-
})
|
|
5931
|
-
const cloneStudioApp = toolkit.createAsyncThunk('studio/cloneStudioApp', ({ idApp, inWork }, { extra, getState, rejectWithValue, dispatch }) =>
|
|
5932
|
-
var _b, _c;
|
|
6051
|
+
});
|
|
6052
|
+
const cloneStudioApp = toolkit.createAsyncThunk('studio/cloneStudioApp', async ({ idApp, inWork }, { extra, getState, rejectWithValue, dispatch }) => {
|
|
5933
6053
|
const jApi = extra.jApi;
|
|
5934
|
-
let existingStudioApp =
|
|
6054
|
+
let existingStudioApp = getState().studio.studioAppsList.studioAppsList?.find((app) => app.idApp === idApp);
|
|
5935
6055
|
if (!existingStudioApp)
|
|
5936
6056
|
return rejectWithValue({ error: 1, errorMsg: 'Error cloning application' });
|
|
5937
6057
|
if (inWork) {
|
|
@@ -5942,11 +6062,11 @@ const cloneStudioApp = toolkit.createAsyncThunk('studio/cloneStudioApp', ({ idAp
|
|
|
5942
6062
|
return rejectWithValue({ error: 1, errorMsg: 'Error cloning application' });
|
|
5943
6063
|
}
|
|
5944
6064
|
}
|
|
5945
|
-
const currentUser =
|
|
6065
|
+
const currentUser = getState().userCurrent?.uri;
|
|
5946
6066
|
const [clonedStudioApp, newAppId] = cloneStudioAppFromExistingApp(existingStudioApp, currentUser);
|
|
5947
6067
|
const clonedStudioAppReady = JSON.stringify(clonedStudioApp);
|
|
5948
6068
|
try {
|
|
5949
|
-
|
|
6069
|
+
await jApi.application.studioSave(newAppId, clonedStudioAppReady, 'saved');
|
|
5950
6070
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Cloned' }));
|
|
5951
6071
|
return clonedStudioApp;
|
|
5952
6072
|
}
|
|
@@ -5954,20 +6074,19 @@ const cloneStudioApp = toolkit.createAsyncThunk('studio/cloneStudioApp', ({ idAp
|
|
|
5954
6074
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5955
6075
|
return rejectWithValue({ error: 1, errorMsg: 'Error cloning application' });
|
|
5956
6076
|
}
|
|
5957
|
-
})
|
|
5958
|
-
const createInWorkStudioApp = toolkit.createAsyncThunk('studio/createInWorkStudioApp', ({ idApp }, { extra, getState, rejectWithValue, dispatch }) =>
|
|
5959
|
-
var _d, _e;
|
|
6077
|
+
});
|
|
6078
|
+
const createInWorkStudioApp = toolkit.createAsyncThunk('studio/createInWorkStudioApp', async ({ idApp }, { extra, getState, rejectWithValue, dispatch }) => {
|
|
5960
6079
|
const jApi = extra.jApi;
|
|
5961
|
-
const existingStudioApp =
|
|
6080
|
+
const existingStudioApp = getState().studio.studioAppsList.studioAppsList?.find((app) => app.idApp === idApp);
|
|
5962
6081
|
if (!existingStudioApp ||
|
|
5963
6082
|
![APP_STATUS_TYPE.INSTALLED, APP_STATUS_TYPE.SUSPENDED].includes(existingStudioApp.status)) {
|
|
5964
6083
|
return rejectWithValue({ error: 1, errorMsg: 'Error cloning application' });
|
|
5965
6084
|
}
|
|
5966
|
-
const currentUser =
|
|
6085
|
+
const currentUser = getState().userCurrent?.uri;
|
|
5967
6086
|
const [clonedStudioApp, newAppId] = cloneStudioAppFromExistingApp(existingStudioApp, currentUser, true);
|
|
5968
6087
|
const clonedStudioAppReady = JSON.stringify(clonedStudioApp);
|
|
5969
6088
|
try {
|
|
5970
|
-
|
|
6089
|
+
await jApi.application.studioSave(newAppId, clonedStudioAppReady, 'saved');
|
|
5971
6090
|
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_CreateInWork' }));
|
|
5972
6091
|
return clonedStudioApp;
|
|
5973
6092
|
}
|
|
@@ -5975,7 +6094,7 @@ const createInWorkStudioApp = toolkit.createAsyncThunk('studio/createInWorkStudi
|
|
|
5975
6094
|
dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
|
|
5976
6095
|
return rejectWithValue({ error: 1, errorMsg: 'Error creating in work version for application' });
|
|
5977
6096
|
}
|
|
5978
|
-
})
|
|
6097
|
+
});
|
|
5979
6098
|
const StudioAppsListSlice = toolkit.createSlice({
|
|
5980
6099
|
name: 'studioAppsList',
|
|
5981
6100
|
initialState,
|
|
@@ -6005,12 +6124,11 @@ const StudioAppsListSlice = toolkit.createSlice({
|
|
|
6005
6124
|
state.deleteStudioAppStatus = 'pending';
|
|
6006
6125
|
})
|
|
6007
6126
|
.addCase(deleteStudioApp.fulfilled, (state, action) => {
|
|
6008
|
-
var _a, _b;
|
|
6009
6127
|
if (state.deleteStudioAppStatus === 'pending') {
|
|
6010
6128
|
state.deleteStudioAppStatus = 'idle';
|
|
6011
6129
|
}
|
|
6012
6130
|
state.studioAppsList =
|
|
6013
|
-
|
|
6131
|
+
state.studioAppsList?.reduce((acc, app) => {
|
|
6014
6132
|
const { idApp } = action.meta.arg;
|
|
6015
6133
|
let { status } = action.meta.arg;
|
|
6016
6134
|
if (status === APP_STATUS_TYPE.INSTALLED)
|
|
@@ -6028,7 +6146,7 @@ const StudioAppsListSlice = toolkit.createSlice({
|
|
|
6028
6146
|
delete app.inWorkVersion;
|
|
6029
6147
|
}
|
|
6030
6148
|
return [...acc, app];
|
|
6031
|
-
}, [])
|
|
6149
|
+
}, []) ?? [];
|
|
6032
6150
|
})
|
|
6033
6151
|
.addCase(deleteStudioApp.rejected, (state) => {
|
|
6034
6152
|
if (state.deleteStudioAppStatus === 'pending')
|
|
@@ -6039,19 +6157,18 @@ const StudioAppsListSlice = toolkit.createSlice({
|
|
|
6039
6157
|
state.suspendStudioAppStatus = 'pending';
|
|
6040
6158
|
})
|
|
6041
6159
|
.addCase(suspendStudioApp.fulfilled, (state, action) => {
|
|
6042
|
-
var _a, _b;
|
|
6043
6160
|
if (state.suspendStudioAppStatus === 'pending') {
|
|
6044
6161
|
state.suspendStudioAppStatus = 'idle';
|
|
6045
6162
|
}
|
|
6046
6163
|
state.studioAppsList =
|
|
6047
|
-
|
|
6164
|
+
state.studioAppsList?.map((app) => {
|
|
6048
6165
|
const { idApp } = action.meta.arg;
|
|
6049
6166
|
if (app.idApp === idApp) {
|
|
6050
6167
|
app.status = APP_STATUS_TYPE.SUSPENDED;
|
|
6051
6168
|
return app;
|
|
6052
6169
|
}
|
|
6053
6170
|
return app;
|
|
6054
|
-
})
|
|
6171
|
+
}) ?? [];
|
|
6055
6172
|
})
|
|
6056
6173
|
.addCase(suspendStudioApp.rejected, (state) => {
|
|
6057
6174
|
if (state.suspendStudioAppStatus === 'pending')
|
|
@@ -6062,19 +6179,18 @@ const StudioAppsListSlice = toolkit.createSlice({
|
|
|
6062
6179
|
state.restartStudioAppStatus = 'pending';
|
|
6063
6180
|
})
|
|
6064
6181
|
.addCase(restartStudioApp.fulfilled, (state, action) => {
|
|
6065
|
-
var _a, _b;
|
|
6066
6182
|
if (state.restartStudioAppStatus === 'pending') {
|
|
6067
6183
|
state.restartStudioAppStatus = 'idle';
|
|
6068
6184
|
}
|
|
6069
6185
|
state.studioAppsList =
|
|
6070
|
-
|
|
6186
|
+
state.studioAppsList?.map((app) => {
|
|
6071
6187
|
const { idApp } = action.meta.arg;
|
|
6072
6188
|
if (app.idApp === idApp) {
|
|
6073
6189
|
app.status = APP_STATUS_TYPE.INSTALLED;
|
|
6074
6190
|
return app;
|
|
6075
6191
|
}
|
|
6076
6192
|
return app;
|
|
6077
|
-
})
|
|
6193
|
+
}) ?? [];
|
|
6078
6194
|
})
|
|
6079
6195
|
.addCase(restartStudioApp.rejected, (state) => {
|
|
6080
6196
|
if (state.restartStudioAppStatus === 'pending') {
|
|
@@ -6087,11 +6203,10 @@ const StudioAppsListSlice = toolkit.createSlice({
|
|
|
6087
6203
|
}
|
|
6088
6204
|
})
|
|
6089
6205
|
.addCase(cloneStudioApp.fulfilled, (state, action) => {
|
|
6090
|
-
var _a;
|
|
6091
6206
|
if (state.cloneStudioAppStatus === 'pending') {
|
|
6092
6207
|
state.cloneStudioAppStatus = 'idle';
|
|
6093
6208
|
}
|
|
6094
|
-
state.studioAppsList = [...(
|
|
6209
|
+
state.studioAppsList = [...(state.studioAppsList ?? []), action.payload].sort(appLexicalSort);
|
|
6095
6210
|
})
|
|
6096
6211
|
.addCase(cloneStudioApp.rejected, (state) => {
|
|
6097
6212
|
if (state.cloneStudioAppStatus === 'pending') {
|
|
@@ -6104,11 +6219,10 @@ const StudioAppsListSlice = toolkit.createSlice({
|
|
|
6104
6219
|
}
|
|
6105
6220
|
})
|
|
6106
6221
|
.addCase(createInWorkStudioApp.fulfilled, (state, action) => {
|
|
6107
|
-
var _a;
|
|
6108
6222
|
if (state.createInWorkAppStatus === 'pending') {
|
|
6109
6223
|
state.createInWorkAppStatus = 'idle';
|
|
6110
6224
|
}
|
|
6111
|
-
const app =
|
|
6225
|
+
const app = state.studioAppsList?.find((app) => {
|
|
6112
6226
|
return app.idApp === action.payload.idApp;
|
|
6113
6227
|
});
|
|
6114
6228
|
if (app) {
|
|
@@ -6126,11 +6240,10 @@ const StudioAppsListSlice = toolkit.createSlice({
|
|
|
6126
6240
|
}
|
|
6127
6241
|
})
|
|
6128
6242
|
.addCase(createNewStudioApp.fulfilled, (state, action) => {
|
|
6129
|
-
var _a;
|
|
6130
6243
|
if (state.createNewStudioAppStatus === 'pending') {
|
|
6131
6244
|
state.createNewStudioAppStatus = 'idle';
|
|
6132
6245
|
}
|
|
6133
|
-
state.studioAppsList = [...(
|
|
6246
|
+
state.studioAppsList = [...(state.studioAppsList ?? []), action.payload].sort(appLexicalSort);
|
|
6134
6247
|
})
|
|
6135
6248
|
.addCase(createNewStudioApp.rejected, (state) => {
|
|
6136
6249
|
if (state.createNewStudioAppStatus === 'pending') {
|
|
@@ -6156,7 +6269,10 @@ const studioSlice = {
|
|
|
6156
6269
|
};
|
|
6157
6270
|
const studio = {
|
|
6158
6271
|
slice: studioSlice,
|
|
6159
|
-
actions:
|
|
6272
|
+
actions: {
|
|
6273
|
+
...StudioAppsListSlice.actions,
|
|
6274
|
+
...CurrentStudioAppSlice.actions,
|
|
6275
|
+
fetchStudioAppsList,
|
|
6160
6276
|
deleteStudioApp,
|
|
6161
6277
|
suspendStudioApp,
|
|
6162
6278
|
restartStudioApp,
|
|
@@ -6165,7 +6281,8 @@ const studio = {
|
|
|
6165
6281
|
fetchCurrentStudioApp,
|
|
6166
6282
|
saveCurrentStudioApp,
|
|
6167
6283
|
installStudioApp,
|
|
6168
|
-
createInWorkStudioApp
|
|
6284
|
+
createInWorkStudioApp,
|
|
6285
|
+
},
|
|
6169
6286
|
selectors: {
|
|
6170
6287
|
selectStudioAppsList,
|
|
6171
6288
|
selectCurrentStudioApp,
|