jamespot-front-business 1.1.33 → 1.1.34
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 +59 -12
- package/dist/cjs.js.map +1 -1
- package/dist/esm.js +59 -12
- package/dist/esm.js.map +1 -1
- package/dist/types.d.ts +17 -1
- package/package.json +1 -1
package/dist/cjs.js
CHANGED
|
@@ -1982,6 +1982,7 @@ function serverAppsToStudioApps(serverApps) {
|
|
|
1982
1982
|
const initialState$1 = {
|
|
1983
1983
|
currentStudioApp: null,
|
|
1984
1984
|
fetchCurrentStudioAppStatus: 'idle',
|
|
1985
|
+
saveCurrentStudioAppStatus: 'idle',
|
|
1985
1986
|
};
|
|
1986
1987
|
const fetchCurrentStudioApp = toolkit.createAsyncThunk('studio/fetchCurrentStudioApp', ({ idApp, status }, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1987
1988
|
const jApi = extra.jApi;
|
|
@@ -1998,6 +1999,24 @@ const fetchCurrentStudioApp = toolkit.createAsyncThunk('studio/fetchCurrentStudi
|
|
|
1998
1999
|
return rejectWithValue(error);
|
|
1999
2000
|
}
|
|
2000
2001
|
}));
|
|
2002
|
+
const saveCurrentStudioApp = toolkit.createAsyncThunk('studio/saveCurrentStudioApp', (_, { extra, rejectWithValue, getState, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2003
|
+
const jApi = extra.jApi;
|
|
2004
|
+
const error = { error: 1, errorMsg: 'Error saving application' };
|
|
2005
|
+
const currentStudioApp = getState().studio.currentStudioApp.currentStudioApp;
|
|
2006
|
+
if (!currentStudioApp) {
|
|
2007
|
+
return rejectWithValue(error);
|
|
2008
|
+
}
|
|
2009
|
+
const stringifiedApp = JSON.stringify(currentStudioApp);
|
|
2010
|
+
try {
|
|
2011
|
+
yield jApi.application.save(currentStudioApp.idApp, stringifiedApp, 'saved');
|
|
2012
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Edition_Saved' }));
|
|
2013
|
+
return;
|
|
2014
|
+
}
|
|
2015
|
+
catch (_) {
|
|
2016
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2017
|
+
return rejectWithValue(error);
|
|
2018
|
+
}
|
|
2019
|
+
}));
|
|
2001
2020
|
const CurrentStudioAppSlice = toolkit.createSlice({
|
|
2002
2021
|
name: 'currentStudioApp',
|
|
2003
2022
|
initialState: initialState$1,
|
|
@@ -2005,6 +2024,9 @@ const CurrentStudioAppSlice = toolkit.createSlice({
|
|
|
2005
2024
|
setCurrentApp: (state, action) => {
|
|
2006
2025
|
state.currentStudioApp = action.payload;
|
|
2007
2026
|
},
|
|
2027
|
+
resetCurrentApp: (state) => {
|
|
2028
|
+
state.currentStudioApp = null;
|
|
2029
|
+
},
|
|
2008
2030
|
},
|
|
2009
2031
|
extraReducers: (builder) => {
|
|
2010
2032
|
builder
|
|
@@ -2020,6 +2042,18 @@ const CurrentStudioAppSlice = toolkit.createSlice({
|
|
|
2020
2042
|
.addCase(fetchCurrentStudioApp.rejected, (state) => {
|
|
2021
2043
|
if (state.fetchCurrentStudioAppStatus === 'pending')
|
|
2022
2044
|
state.fetchCurrentStudioAppStatus = 'idle';
|
|
2045
|
+
})
|
|
2046
|
+
.addCase(saveCurrentStudioApp.pending, (state) => {
|
|
2047
|
+
if (state.saveCurrentStudioAppStatus === 'idle')
|
|
2048
|
+
state.saveCurrentStudioAppStatus = 'pending';
|
|
2049
|
+
})
|
|
2050
|
+
.addCase(saveCurrentStudioApp.fulfilled, (state) => {
|
|
2051
|
+
if (state.saveCurrentStudioAppStatus === 'pending')
|
|
2052
|
+
state.saveCurrentStudioAppStatus = 'idle';
|
|
2053
|
+
})
|
|
2054
|
+
.addCase(saveCurrentStudioApp.rejected, (state) => {
|
|
2055
|
+
if (state.saveCurrentStudioAppStatus === 'pending')
|
|
2056
|
+
state.saveCurrentStudioAppStatus = 'idle';
|
|
2023
2057
|
});
|
|
2024
2058
|
},
|
|
2025
2059
|
});
|
|
@@ -2036,7 +2070,7 @@ function cloneStudioAppFromExistingApp(existingApp, author) {
|
|
|
2036
2070
|
return [newApp, newAppId];
|
|
2037
2071
|
}
|
|
2038
2072
|
|
|
2039
|
-
function createNewStudioApp$1({ author }) {
|
|
2073
|
+
function createNewStudioApp$1({ author, appName }) {
|
|
2040
2074
|
const newAppId = uuid.v4();
|
|
2041
2075
|
return {
|
|
2042
2076
|
newAppId,
|
|
@@ -2045,8 +2079,8 @@ function createNewStudioApp$1({ author }) {
|
|
|
2045
2079
|
status: APP_STATUS_TYPE.DRAFT,
|
|
2046
2080
|
author: author || '',
|
|
2047
2081
|
manifest: {
|
|
2048
|
-
appShortName:
|
|
2049
|
-
appName:
|
|
2082
|
+
appShortName: appName,
|
|
2083
|
+
appName: appName,
|
|
2050
2084
|
author: author || '',
|
|
2051
2085
|
description: '',
|
|
2052
2086
|
typeLabel: '',
|
|
@@ -2076,7 +2110,7 @@ const initialState = {
|
|
|
2076
2110
|
cloneStudioAppStatus: 'idle',
|
|
2077
2111
|
createNewStudioAppStatus: 'idle',
|
|
2078
2112
|
};
|
|
2079
|
-
const fetchStudioAppsList = toolkit.createAsyncThunk('studio/appsList', (_, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2113
|
+
const fetchStudioAppsList = toolkit.createAsyncThunk('studio/appsList', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2080
2114
|
const jApi = extra.jApi;
|
|
2081
2115
|
try {
|
|
2082
2116
|
const { result } = yield jApi.application.list();
|
|
@@ -2087,51 +2121,61 @@ const fetchStudioAppsList = toolkit.createAsyncThunk('studio/appsList', (_, { ex
|
|
|
2087
2121
|
})));
|
|
2088
2122
|
}
|
|
2089
2123
|
catch (_) {
|
|
2124
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2090
2125
|
throw rejectWithValue({ error: 1, errorMsg: 'Error retrieving applications' });
|
|
2091
2126
|
}
|
|
2092
2127
|
}));
|
|
2093
|
-
const createNewStudioApp = toolkit.createAsyncThunk('studio/createApp', (
|
|
2128
|
+
const createNewStudioApp = toolkit.createAsyncThunk('studio/createApp', ({ appName }, { extra, dispatch, rejectWithValue, getState }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2094
2129
|
var _a;
|
|
2095
2130
|
const jApi = extra.jApi;
|
|
2096
2131
|
const author = (_a = getState().userCurrent) === null || _a === void 0 ? void 0 : _a.uri;
|
|
2097
|
-
const { newAppId, newStudioApp } = createNewStudioApp$1(Object.assign({}, (author && { author })));
|
|
2132
|
+
const { newAppId, newStudioApp } = createNewStudioApp$1(Object.assign({ appName }, (author && { author })));
|
|
2098
2133
|
try {
|
|
2099
2134
|
yield jApi.application.save(newAppId, JSON.stringify(newStudioApp), 'saved');
|
|
2135
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_StudioApp_Created' }));
|
|
2100
2136
|
dispatch(CurrentStudioAppSlice.actions.setCurrentApp(newStudioApp));
|
|
2101
2137
|
return newStudioApp;
|
|
2102
2138
|
}
|
|
2103
2139
|
catch (_) {
|
|
2140
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2104
2141
|
throw rejectWithValue({ error: 1, errorMsg: 'Error creating application' });
|
|
2105
2142
|
}
|
|
2106
2143
|
}));
|
|
2107
|
-
const deleteStudioApp = toolkit.createAsyncThunk('studio/deleteApp', ({ idApp, status }, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2144
|
+
const deleteStudioApp = toolkit.createAsyncThunk('studio/deleteApp', ({ idApp, status }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2108
2145
|
const jApi = extra.jApi;
|
|
2109
2146
|
try {
|
|
2110
|
-
|
|
2147
|
+
const deleteRes = yield jApi.application.delete(idApp, status);
|
|
2148
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_StudioApp_Deleted' }));
|
|
2149
|
+
return deleteRes;
|
|
2111
2150
|
}
|
|
2112
2151
|
catch (_) {
|
|
2152
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2113
2153
|
return rejectWithValue({ error: 1, errorMsg: 'Error deleting application' });
|
|
2114
2154
|
}
|
|
2115
2155
|
}));
|
|
2116
|
-
const suspendStudioApp = toolkit.createAsyncThunk('studio/suspendStudioApp', ({ idApp }, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2156
|
+
const suspendStudioApp = toolkit.createAsyncThunk('studio/suspendStudioApp', ({ idApp }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2117
2157
|
const jApi = extra.jApi;
|
|
2118
2158
|
try {
|
|
2119
2159
|
yield jApi.application.suspend(idApp);
|
|
2160
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Suspended' }));
|
|
2120
2161
|
}
|
|
2121
2162
|
catch (_) {
|
|
2163
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2122
2164
|
throw rejectWithValue({ error: 1, errorMsg: 'Error suspending application' });
|
|
2123
2165
|
}
|
|
2124
2166
|
}));
|
|
2125
|
-
const restartStudioApp = toolkit.createAsyncThunk('studio/restartStudioApp', ({ idApp }, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2167
|
+
const restartStudioApp = toolkit.createAsyncThunk('studio/restartStudioApp', ({ idApp }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2126
2168
|
const jApi = extra.jApi;
|
|
2127
2169
|
try {
|
|
2128
2170
|
yield jApi.application.restart(idApp);
|
|
2171
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Restarted' }));
|
|
2129
2172
|
}
|
|
2130
2173
|
catch (_) {
|
|
2174
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2131
2175
|
throw rejectWithValue({ error: 1, errorMsg: 'Error restarting application' });
|
|
2132
2176
|
}
|
|
2133
2177
|
}));
|
|
2134
|
-
const cloneStudioApp = toolkit.createAsyncThunk('studio/cloneStudioApp', ({ idApp }, { extra, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2178
|
+
const cloneStudioApp = toolkit.createAsyncThunk('studio/cloneStudioApp', ({ idApp }, { extra, getState, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2135
2179
|
var _b;
|
|
2136
2180
|
const jApi = extra.jApi;
|
|
2137
2181
|
const existingStudioApp = getState().studio.studioAppsList.studioAppsList.find((app) => app.idApp === idApp);
|
|
@@ -2142,9 +2186,11 @@ const cloneStudioApp = toolkit.createAsyncThunk('studio/cloneStudioApp', ({ idAp
|
|
|
2142
2186
|
const clonedStudioAppReady = JSON.stringify(clonedStudioApp);
|
|
2143
2187
|
try {
|
|
2144
2188
|
yield jApi.application.save(newAppId, clonedStudioAppReady, 'saved');
|
|
2189
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Cloned' }));
|
|
2145
2190
|
return clonedStudioApp;
|
|
2146
2191
|
}
|
|
2147
2192
|
catch (_) {
|
|
2193
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2148
2194
|
return rejectWithValue({ error: 1, errorMsg: 'Error cloning application' });
|
|
2149
2195
|
}
|
|
2150
2196
|
}));
|
|
@@ -2291,7 +2337,8 @@ const studio = {
|
|
|
2291
2337
|
restartStudioApp,
|
|
2292
2338
|
cloneStudioApp,
|
|
2293
2339
|
createNewStudioApp,
|
|
2294
|
-
fetchCurrentStudioApp
|
|
2340
|
+
fetchCurrentStudioApp,
|
|
2341
|
+
saveCurrentStudioApp }),
|
|
2295
2342
|
selectors: {
|
|
2296
2343
|
selectStudioAppsList,
|
|
2297
2344
|
selectCurrentStudioApp,
|