jamespot-front-business 1.1.32 → 1.1.33

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/esm.js CHANGED
@@ -60,7 +60,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
60
60
  });
61
61
  }
62
62
 
63
- const initialState$g = {
63
+ const initialState$h = {
64
64
  entities: [],
65
65
  loading: 'idle',
66
66
  nbResults: 0,
@@ -71,7 +71,7 @@ const fetchBookableAsset = createAsyncThunk('BookableAsset/fetchBookableAsset',
71
71
  }));
72
72
  const BookableAssetSlice = createSlice({
73
73
  name: 'bookableAsset',
74
- initialState: initialState$g,
74
+ initialState: initialState$h,
75
75
  reducers: {},
76
76
  extraReducers: (builder) => {
77
77
  builder
@@ -92,7 +92,7 @@ const BookableAssetSlice = createSlice({
92
92
  const fetchConfiguration = createAsyncThunk('AssetReservation/configuration', (_, { extra }) => __awaiter(void 0, void 0, void 0, function* () {
93
93
  return yield extra.jApi.assetReservation.configuration();
94
94
  }));
95
- const initialState$f = {
95
+ const initialState$g = {
96
96
  description: '',
97
97
  right: {
98
98
  manage: false,
@@ -106,7 +106,7 @@ const initialState$f = {
106
106
  };
107
107
  const AssetReservationConfigurationSlice = createSlice({
108
108
  name: 'configuration',
109
- initialState: initialState$f,
109
+ initialState: initialState$g,
110
110
  reducers: {},
111
111
  extraReducers: (builder) => {
112
112
  builder
@@ -127,7 +127,7 @@ const initForm = {
127
127
  hourStart: '',
128
128
  hourEnd: '',
129
129
  };
130
- const initialState$e = {
130
+ const initialState$f = {
131
131
  entities: [],
132
132
  loading: 'idle',
133
133
  nbResults: 0,
@@ -139,7 +139,7 @@ const fetchReservation = createAsyncThunk('Reservation/fetchReservation', (viewM
139
139
  }));
140
140
  const ReservationSlice = createSlice({
141
141
  name: 'reservation',
142
- initialState: initialState$e,
142
+ initialState: initialState$f,
143
143
  reducers: {
144
144
  setForm: (state, action) => {
145
145
  state.form = action.payload;
@@ -232,7 +232,7 @@ const Toast = {
232
232
  selectors: selectors$1,
233
233
  };
234
234
 
235
- const initialState$d = {
235
+ const initialState$e = {
236
236
  bookmarks: [],
237
237
  loading: 'idle',
238
238
  status: undefined,
@@ -295,7 +295,7 @@ const deleteBookmark = createAsyncThunk('bookmarkList/deleteBookmark', (bookmark
295
295
  }));
296
296
  const BookmarkListSlice = createSlice({
297
297
  name: 'bookmarkList',
298
- initialState: initialState$d,
298
+ initialState: initialState$e,
299
299
  reducers: {
300
300
  resetAddBookmarkStatus: (state, action) => {
301
301
  if (state.add[action.payload]) {
@@ -458,7 +458,7 @@ const getRTHandlers = function (dispatch) {
458
458
  ];
459
459
  };
460
460
 
461
- const initialState$c = {
461
+ const initialState$d = {
462
462
  bookmark: undefined,
463
463
  status: undefined,
464
464
  loading: 'idle',
@@ -480,7 +480,7 @@ const editBookmark = createAsyncThunk('bookmarkEdit/editBookmark', (bookmark, {
480
480
  }));
481
481
  const BookmarkEditSlice = createSlice({
482
482
  name: 'bookmarkEdit',
483
- initialState: initialState$c,
483
+ initialState: initialState$d,
484
484
  reducers: {
485
485
  setEditBookmark: (state, action) => {
486
486
  state.bookmark = Object.assign({}, action.payload);
@@ -533,7 +533,7 @@ const Bookmark = {
533
533
  getRTHandlers: getRTHandlers,
534
534
  };
535
535
 
536
- const initialState$b = {
536
+ const initialState$c = {
537
537
  loading: 'idle',
538
538
  access: { createCategory: false },
539
539
  };
@@ -561,7 +561,7 @@ const fetchFaqConfig = createAsyncThunk('faqConfig/fetch', () => __awaiter(void
561
561
  }));
562
562
  const FaqConfigSlice = createSlice({
563
563
  name: 'config',
564
- initialState: initialState$b,
564
+ initialState: initialState$c,
565
565
  reducers: {},
566
566
  extraReducers: (builder) => {
567
567
  builder
@@ -593,7 +593,7 @@ const FaqConfigSlice = createSlice({
593
593
  },
594
594
  });
595
595
 
596
- const initialState$a = {
596
+ const initialState$b = {
597
597
  loading: 'idle',
598
598
  categories: null,
599
599
  };
@@ -605,7 +605,7 @@ const fetchFaqCategories = createAsyncThunk('faqCategories/fetch', () => __await
605
605
  }));
606
606
  const FaqCategoriesSlice = createSlice({
607
607
  name: 'categories',
608
- initialState: initialState$a,
608
+ initialState: initialState$b,
609
609
  reducers: {},
610
610
  extraReducers: (builder) => {
611
611
  builder
@@ -887,7 +887,7 @@ const initialMap = {
887
887
  illustration: '',
888
888
  assignLicense: false,
889
889
  };
890
- const initialState$9 = {
890
+ const initialState$a = {
891
891
  map: Object.assign({}, initialMap),
892
892
  loading: 'idle',
893
893
  status: undefined,
@@ -931,13 +931,13 @@ const createMap = createAsyncThunk('mapCreate/create', ({ map, jlandUrlBase }, {
931
931
  }));
932
932
  const MapCreateSlice = createSlice({
933
933
  name: 'mapCreate',
934
- initialState: initialState$9,
934
+ initialState: initialState$a,
935
935
  reducers: {
936
936
  setMap: (state, action) => {
937
937
  state.map = action.payload;
938
938
  },
939
939
  resetCreateMapState: () => {
940
- return initialState$9;
940
+ return initialState$a;
941
941
  },
942
942
  },
943
943
  extraReducers: (builder) => {
@@ -1024,10 +1024,10 @@ const Model = {
1024
1024
  selectors: Object.assign(Object.assign({}, selectors), { selectByIds }),
1025
1025
  };
1026
1026
 
1027
- const initialState$8 = {};
1027
+ const initialState$9 = {};
1028
1028
  const NetworkStaticsSlice = createSlice({
1029
1029
  name: 'statics',
1030
- initialState: initialState$8,
1030
+ initialState: initialState$9,
1031
1031
  reducers: {
1032
1032
  initNetworkStatics: (_, { payload }) => {
1033
1033
  return payload;
@@ -1083,7 +1083,7 @@ const fetchRecentFiles = createAsyncThunk('/fetchRecentFiles', (_, { extra, getS
1083
1083
  return yield jApi.wedoc.getFiles(Object.assign(Object.assign({}, initialQuery), { filters, limit: 4 }));
1084
1084
  }));
1085
1085
 
1086
- const initialState$7 = {
1086
+ const initialState$8 = {
1087
1087
  entities: [],
1088
1088
  nbEntities: 0,
1089
1089
  entitiesRecent: [],
@@ -1095,7 +1095,7 @@ const initialState$7 = {
1095
1095
  };
1096
1096
  const WedocAppSlice = createSlice({
1097
1097
  name: 'wedoc',
1098
- initialState: initialState$7,
1098
+ initialState: initialState$8,
1099
1099
  reducers: {
1100
1100
  update: (state, action) => {
1101
1101
  state.entities = [
@@ -1168,14 +1168,14 @@ const fetchRequest = createAsyncThunk('/fetchRequest', ({ uri, idUser }, { extra
1168
1168
  return yield jApi.wedoc.getAccessRequest(uri, idUser);
1169
1169
  }));
1170
1170
 
1171
- const initialState$6 = {
1171
+ const initialState$7 = {
1172
1172
  entities: [],
1173
1173
  nbEntities: 0,
1174
1174
  loading: 'idle',
1175
1175
  };
1176
1176
  const ShareSlice = createSlice({
1177
1177
  name: 'share',
1178
- initialState: initialState$6,
1178
+ initialState: initialState$7,
1179
1179
  reducers: {
1180
1180
  remove: (state, action) => {
1181
1181
  state.entities = [
@@ -1213,7 +1213,7 @@ const Share = {
1213
1213
  },
1214
1214
  };
1215
1215
 
1216
- const initialState$5 = {
1216
+ const initialState$6 = {
1217
1217
  channels: undefined,
1218
1218
  loading: 'idle',
1219
1219
  loadingChannelDeletion: 'idle',
@@ -1256,7 +1256,7 @@ const deleteChannel = createAsyncThunk('/deleteChannel', ({ channel }, { extra,
1256
1256
  }));
1257
1257
  const ChannelsListSlice = createSlice({
1258
1258
  name: 'channelsList',
1259
- initialState: Object.assign({}, initialState$5),
1259
+ initialState: Object.assign({}, initialState$6),
1260
1260
  reducers: {},
1261
1261
  extraReducers: (builder) => {
1262
1262
  builder
@@ -1325,10 +1325,10 @@ const TVDisplay = {
1325
1325
  },
1326
1326
  };
1327
1327
 
1328
- const initialState$4 = {};
1328
+ const initialState$5 = {};
1329
1329
  const TinyMCEOptionsSlice = createSlice({
1330
1330
  name: 'options',
1331
- initialState: initialState$4,
1331
+ initialState: initialState$5,
1332
1332
  reducers: {
1333
1333
  initOptions: (_, { payload }) => {
1334
1334
  return { common: payload };
@@ -1354,7 +1354,7 @@ const TinyMCE = {
1354
1354
  },
1355
1355
  };
1356
1356
 
1357
- const initialState$3 = {
1357
+ const initialState$4 = {
1358
1358
  id: 0,
1359
1359
  mainType: 'user',
1360
1360
  type: 'user',
@@ -1368,7 +1368,7 @@ const initialState$3 = {
1368
1368
  };
1369
1369
  const slice = createSlice({
1370
1370
  name: 'userCurrent',
1371
- initialState: initialState$3,
1371
+ initialState: initialState$4,
1372
1372
  reducers: {
1373
1373
  init: (_, { payload }) => {
1374
1374
  return payload;
@@ -1586,7 +1586,7 @@ function widgetDefinition(name) {
1586
1586
 
1587
1587
  const MODE_EDIT = 'edit';
1588
1588
  const MODE_VIEW = 'view';
1589
- const initialState$2 = {
1589
+ const initialState$3 = {
1590
1590
  token: undefined,
1591
1591
  ids: {},
1592
1592
  layers: {},
@@ -1598,7 +1598,7 @@ const initialState$2 = {
1598
1598
  };
1599
1599
  const widgetsSlice = createSlice({
1600
1600
  name: 'widgets',
1601
- initialState: initialState$2,
1601
+ initialState: initialState$3,
1602
1602
  reducers: {
1603
1603
  registerWidget: (state, action) => {
1604
1604
  const { uniqid, widget } = action.payload;
@@ -1740,12 +1740,12 @@ const Widget = {
1740
1740
  },
1741
1741
  };
1742
1742
 
1743
- const initialState$1 = {
1743
+ const initialState$2 = {
1744
1744
  editors: [],
1745
1745
  };
1746
1746
  const editorsSlice = createSlice({
1747
1747
  name: 'editors',
1748
- initialState: initialState$1,
1748
+ initialState: initialState$2,
1749
1749
  reducers: {
1750
1750
  registerEditor: (state, action) => {
1751
1751
  const { uniqid, name } = action.payload;
@@ -1971,6 +1971,51 @@ function serverAppsToStudioApps(serverApps) {
1971
1971
  return studioApps;
1972
1972
  }
1973
1973
 
1974
+ const initialState$1 = {
1975
+ currentStudioApp: null,
1976
+ fetchCurrentStudioAppStatus: 'idle',
1977
+ };
1978
+ const fetchCurrentStudioApp = createAsyncThunk('studio/fetchCurrentStudioApp', ({ idApp, status }, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
1979
+ const jApi = extra.jApi;
1980
+ const error = { error: 1, errorMsg: 'Error fetching application' };
1981
+ try {
1982
+ const studioApplicationBase = (yield jApi.application.get(idApp, status)).result;
1983
+ const studioApplication = serverAppsToStudioApps([studioApplicationBase])[0];
1984
+ if (!studioApplication) {
1985
+ return rejectWithValue(error);
1986
+ }
1987
+ return studioApplication;
1988
+ }
1989
+ catch (_) {
1990
+ return rejectWithValue(error);
1991
+ }
1992
+ }));
1993
+ const CurrentStudioAppSlice = createSlice({
1994
+ name: 'currentStudioApp',
1995
+ initialState: initialState$1,
1996
+ reducers: {
1997
+ setCurrentApp: (state, action) => {
1998
+ state.currentStudioApp = action.payload;
1999
+ },
2000
+ },
2001
+ extraReducers: (builder) => {
2002
+ builder
2003
+ .addCase(fetchCurrentStudioApp.pending, (state) => {
2004
+ if (state.fetchCurrentStudioAppStatus === 'idle')
2005
+ state.fetchCurrentStudioAppStatus = 'pending';
2006
+ })
2007
+ .addCase(fetchCurrentStudioApp.fulfilled, (state, action) => {
2008
+ if (state.fetchCurrentStudioAppStatus === 'pending')
2009
+ state.fetchCurrentStudioAppStatus = 'idle';
2010
+ state.currentStudioApp = action.payload;
2011
+ })
2012
+ .addCase(fetchCurrentStudioApp.rejected, (state) => {
2013
+ if (state.fetchCurrentStudioAppStatus === 'pending')
2014
+ state.fetchCurrentStudioAppStatus = 'idle';
2015
+ });
2016
+ },
2017
+ });
2018
+
1974
2019
  function cloneStudioAppFromExistingApp(existingApp, author) {
1975
2020
  const newApp = existingApp.inWorkVersion
1976
2021
  ? JSON.parse(JSON.stringify(existingApp.inWorkVersion))
@@ -1983,6 +2028,37 @@ function cloneStudioAppFromExistingApp(existingApp, author) {
1983
2028
  return [newApp, newAppId];
1984
2029
  }
1985
2030
 
2031
+ function createNewStudioApp$1({ author }) {
2032
+ const newAppId = v4();
2033
+ return {
2034
+ newAppId,
2035
+ newStudioApp: {
2036
+ idApp: newAppId,
2037
+ status: APP_STATUS_TYPE.DRAFT,
2038
+ author: author || '',
2039
+ manifest: {
2040
+ appShortName: newAppId,
2041
+ appName: newAppId,
2042
+ author: author || '',
2043
+ description: '',
2044
+ typeLabel: '',
2045
+ cssColor: '#392994',
2046
+ cssClass: {
2047
+ label: 'star',
2048
+ value: 'star',
2049
+ },
2050
+ version: 0.1,
2051
+ dateCreation: new Date().toISOString(),
2052
+ viewSolr: 'solr',
2053
+ checkAccess: false,
2054
+ accessRightList: '',
2055
+ attrExposed: [],
2056
+ articlesCount: 0,
2057
+ },
2058
+ },
2059
+ };
2060
+ }
2061
+
1986
2062
  const initialState = {
1987
2063
  studioAppsList: [],
1988
2064
  loadingStudioAppsList: 'idle',
@@ -1990,6 +2066,7 @@ const initialState = {
1990
2066
  suspendStudioAppStatus: 'idle',
1991
2067
  restartStudioAppStatus: 'idle',
1992
2068
  cloneStudioAppStatus: 'idle',
2069
+ createNewStudioAppStatus: 'idle',
1993
2070
  };
1994
2071
  const fetchStudioAppsList = createAsyncThunk('studio/appsList', (_, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
1995
2072
  const jApi = extra.jApi;
@@ -2002,7 +2079,21 @@ const fetchStudioAppsList = createAsyncThunk('studio/appsList', (_, { extra, rej
2002
2079
  })));
2003
2080
  }
2004
2081
  catch (_) {
2005
- return rejectWithValue({ error: 1, errorMsg: 'Error retrieving applications' });
2082
+ throw rejectWithValue({ error: 1, errorMsg: 'Error retrieving applications' });
2083
+ }
2084
+ }));
2085
+ const createNewStudioApp = createAsyncThunk('studio/createApp', (_, { extra, dispatch, rejectWithValue, getState }) => __awaiter(void 0, void 0, void 0, function* () {
2086
+ var _a;
2087
+ const jApi = extra.jApi;
2088
+ const author = (_a = getState().userCurrent) === null || _a === void 0 ? void 0 : _a.uri;
2089
+ const { newAppId, newStudioApp } = createNewStudioApp$1(Object.assign({}, (author && { author })));
2090
+ try {
2091
+ yield jApi.application.save(newAppId, JSON.stringify(newStudioApp), 'saved');
2092
+ dispatch(CurrentStudioAppSlice.actions.setCurrentApp(newStudioApp));
2093
+ return newStudioApp;
2094
+ }
2095
+ catch (_) {
2096
+ throw rejectWithValue({ error: 1, errorMsg: 'Error creating application' });
2006
2097
  }
2007
2098
  }));
2008
2099
  const deleteStudioApp = createAsyncThunk('studio/deleteApp', ({ idApp, status }, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
@@ -2033,12 +2124,12 @@ const restartStudioApp = createAsyncThunk('studio/restartStudioApp', ({ idApp },
2033
2124
  }
2034
2125
  }));
2035
2126
  const cloneStudioApp = createAsyncThunk('studio/cloneStudioApp', ({ idApp }, { extra, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
2036
- var _a;
2127
+ var _b;
2037
2128
  const jApi = extra.jApi;
2038
2129
  const existingStudioApp = getState().studio.studioAppsList.studioAppsList.find((app) => app.idApp === idApp);
2039
2130
  if (!existingStudioApp)
2040
2131
  return rejectWithValue({ error: 1, errorMsg: 'Error cloning application' });
2041
- const currentUser = (_a = getState().userCurrent) === null || _a === void 0 ? void 0 : _a.uri;
2132
+ const currentUser = (_b = getState().userCurrent) === null || _b === void 0 ? void 0 : _b.uri;
2042
2133
  const [clonedStudioApp, newAppId] = cloneStudioAppFromExistingApp(existingStudioApp, currentUser);
2043
2134
  const clonedStudioAppReady = JSON.stringify(clonedStudioApp);
2044
2135
  try {
@@ -2152,29 +2243,50 @@ const StudioAppsListSlice = createSlice({
2152
2243
  .addCase(cloneStudioApp.rejected, (state) => {
2153
2244
  if (state.cloneStudioAppStatus === 'pending')
2154
2245
  state.cloneStudioAppStatus = 'idle';
2246
+ })
2247
+ .addCase(createNewStudioApp.pending, (state) => {
2248
+ if (state.createNewStudioAppStatus === 'idle')
2249
+ state.createNewStudioAppStatus = 'pending';
2250
+ })
2251
+ .addCase(createNewStudioApp.fulfilled, (state, action) => {
2252
+ if (state.createNewStudioAppStatus === 'pending') {
2253
+ state.createNewStudioAppStatus = 'idle';
2254
+ }
2255
+ state.studioAppsList = [...state.studioAppsList, action.payload];
2256
+ })
2257
+ .addCase(createNewStudioApp.rejected, (state) => {
2258
+ if (state.createNewStudioAppStatus === 'pending')
2259
+ state.createNewStudioAppStatus = 'idle';
2155
2260
  });
2156
2261
  },
2157
2262
  });
2158
2263
 
2159
2264
  const joinedReducers = combineReducers$1({
2160
2265
  [StudioAppsListSlice.name]: StudioAppsListSlice.reducer,
2266
+ [CurrentStudioAppSlice.name]: CurrentStudioAppSlice.reducer,
2161
2267
  });
2162
- const selectStudioAppsList = function selectStudioAppsList(state) {
2268
+ function selectStudioAppsList(state) {
2163
2269
  return state.studio.studioAppsList;
2164
- };
2270
+ }
2271
+ function selectCurrentStudioApp(state) {
2272
+ return state.studio.currentStudioApp;
2273
+ }
2165
2274
  const studioSlice = {
2166
2275
  name: 'studio',
2167
2276
  reducer: joinedReducers,
2168
2277
  };
2169
2278
  const studio = {
2170
2279
  slice: studioSlice,
2171
- actions: Object.assign(Object.assign({}, StudioAppsListSlice.actions), { fetchStudioAppsList,
2280
+ actions: Object.assign(Object.assign(Object.assign({}, StudioAppsListSlice.actions), CurrentStudioAppSlice.actions), { fetchStudioAppsList,
2172
2281
  deleteStudioApp,
2173
2282
  suspendStudioApp,
2174
2283
  restartStudioApp,
2175
- cloneStudioApp }),
2284
+ cloneStudioApp,
2285
+ createNewStudioApp,
2286
+ fetchCurrentStudioApp }),
2176
2287
  selectors: {
2177
2288
  selectStudioAppsList,
2289
+ selectCurrentStudioApp,
2178
2290
  },
2179
2291
  };
2180
2292