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/esm.js
CHANGED
|
@@ -1974,6 +1974,7 @@ function serverAppsToStudioApps(serverApps) {
|
|
|
1974
1974
|
const initialState$1 = {
|
|
1975
1975
|
currentStudioApp: null,
|
|
1976
1976
|
fetchCurrentStudioAppStatus: 'idle',
|
|
1977
|
+
saveCurrentStudioAppStatus: 'idle',
|
|
1977
1978
|
};
|
|
1978
1979
|
const fetchCurrentStudioApp = createAsyncThunk('studio/fetchCurrentStudioApp', ({ idApp, status }, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1979
1980
|
const jApi = extra.jApi;
|
|
@@ -1990,6 +1991,24 @@ const fetchCurrentStudioApp = createAsyncThunk('studio/fetchCurrentStudioApp', (
|
|
|
1990
1991
|
return rejectWithValue(error);
|
|
1991
1992
|
}
|
|
1992
1993
|
}));
|
|
1994
|
+
const saveCurrentStudioApp = createAsyncThunk('studio/saveCurrentStudioApp', (_, { extra, rejectWithValue, getState, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1995
|
+
const jApi = extra.jApi;
|
|
1996
|
+
const error = { error: 1, errorMsg: 'Error saving application' };
|
|
1997
|
+
const currentStudioApp = getState().studio.currentStudioApp.currentStudioApp;
|
|
1998
|
+
if (!currentStudioApp) {
|
|
1999
|
+
return rejectWithValue(error);
|
|
2000
|
+
}
|
|
2001
|
+
const stringifiedApp = JSON.stringify(currentStudioApp);
|
|
2002
|
+
try {
|
|
2003
|
+
yield jApi.application.save(currentStudioApp.idApp, stringifiedApp, 'saved');
|
|
2004
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Edition_Saved' }));
|
|
2005
|
+
return;
|
|
2006
|
+
}
|
|
2007
|
+
catch (_) {
|
|
2008
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2009
|
+
return rejectWithValue(error);
|
|
2010
|
+
}
|
|
2011
|
+
}));
|
|
1993
2012
|
const CurrentStudioAppSlice = createSlice({
|
|
1994
2013
|
name: 'currentStudioApp',
|
|
1995
2014
|
initialState: initialState$1,
|
|
@@ -1997,6 +2016,9 @@ const CurrentStudioAppSlice = createSlice({
|
|
|
1997
2016
|
setCurrentApp: (state, action) => {
|
|
1998
2017
|
state.currentStudioApp = action.payload;
|
|
1999
2018
|
},
|
|
2019
|
+
resetCurrentApp: (state) => {
|
|
2020
|
+
state.currentStudioApp = null;
|
|
2021
|
+
},
|
|
2000
2022
|
},
|
|
2001
2023
|
extraReducers: (builder) => {
|
|
2002
2024
|
builder
|
|
@@ -2012,6 +2034,18 @@ const CurrentStudioAppSlice = createSlice({
|
|
|
2012
2034
|
.addCase(fetchCurrentStudioApp.rejected, (state) => {
|
|
2013
2035
|
if (state.fetchCurrentStudioAppStatus === 'pending')
|
|
2014
2036
|
state.fetchCurrentStudioAppStatus = 'idle';
|
|
2037
|
+
})
|
|
2038
|
+
.addCase(saveCurrentStudioApp.pending, (state) => {
|
|
2039
|
+
if (state.saveCurrentStudioAppStatus === 'idle')
|
|
2040
|
+
state.saveCurrentStudioAppStatus = 'pending';
|
|
2041
|
+
})
|
|
2042
|
+
.addCase(saveCurrentStudioApp.fulfilled, (state) => {
|
|
2043
|
+
if (state.saveCurrentStudioAppStatus === 'pending')
|
|
2044
|
+
state.saveCurrentStudioAppStatus = 'idle';
|
|
2045
|
+
})
|
|
2046
|
+
.addCase(saveCurrentStudioApp.rejected, (state) => {
|
|
2047
|
+
if (state.saveCurrentStudioAppStatus === 'pending')
|
|
2048
|
+
state.saveCurrentStudioAppStatus = 'idle';
|
|
2015
2049
|
});
|
|
2016
2050
|
},
|
|
2017
2051
|
});
|
|
@@ -2028,7 +2062,7 @@ function cloneStudioAppFromExistingApp(existingApp, author) {
|
|
|
2028
2062
|
return [newApp, newAppId];
|
|
2029
2063
|
}
|
|
2030
2064
|
|
|
2031
|
-
function createNewStudioApp$1({ author }) {
|
|
2065
|
+
function createNewStudioApp$1({ author, appName }) {
|
|
2032
2066
|
const newAppId = v4();
|
|
2033
2067
|
return {
|
|
2034
2068
|
newAppId,
|
|
@@ -2037,8 +2071,8 @@ function createNewStudioApp$1({ author }) {
|
|
|
2037
2071
|
status: APP_STATUS_TYPE.DRAFT,
|
|
2038
2072
|
author: author || '',
|
|
2039
2073
|
manifest: {
|
|
2040
|
-
appShortName:
|
|
2041
|
-
appName:
|
|
2074
|
+
appShortName: appName,
|
|
2075
|
+
appName: appName,
|
|
2042
2076
|
author: author || '',
|
|
2043
2077
|
description: '',
|
|
2044
2078
|
typeLabel: '',
|
|
@@ -2068,7 +2102,7 @@ const initialState = {
|
|
|
2068
2102
|
cloneStudioAppStatus: 'idle',
|
|
2069
2103
|
createNewStudioAppStatus: 'idle',
|
|
2070
2104
|
};
|
|
2071
|
-
const fetchStudioAppsList = createAsyncThunk('studio/appsList', (_, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2105
|
+
const fetchStudioAppsList = createAsyncThunk('studio/appsList', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2072
2106
|
const jApi = extra.jApi;
|
|
2073
2107
|
try {
|
|
2074
2108
|
const { result } = yield jApi.application.list();
|
|
@@ -2079,51 +2113,61 @@ const fetchStudioAppsList = createAsyncThunk('studio/appsList', (_, { extra, rej
|
|
|
2079
2113
|
})));
|
|
2080
2114
|
}
|
|
2081
2115
|
catch (_) {
|
|
2116
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2082
2117
|
throw rejectWithValue({ error: 1, errorMsg: 'Error retrieving applications' });
|
|
2083
2118
|
}
|
|
2084
2119
|
}));
|
|
2085
|
-
const createNewStudioApp = createAsyncThunk('studio/createApp', (
|
|
2120
|
+
const createNewStudioApp = createAsyncThunk('studio/createApp', ({ appName }, { extra, dispatch, rejectWithValue, getState }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2086
2121
|
var _a;
|
|
2087
2122
|
const jApi = extra.jApi;
|
|
2088
2123
|
const author = (_a = getState().userCurrent) === null || _a === void 0 ? void 0 : _a.uri;
|
|
2089
|
-
const { newAppId, newStudioApp } = createNewStudioApp$1(Object.assign({}, (author && { author })));
|
|
2124
|
+
const { newAppId, newStudioApp } = createNewStudioApp$1(Object.assign({ appName }, (author && { author })));
|
|
2090
2125
|
try {
|
|
2091
2126
|
yield jApi.application.save(newAppId, JSON.stringify(newStudioApp), 'saved');
|
|
2127
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_StudioApp_Created' }));
|
|
2092
2128
|
dispatch(CurrentStudioAppSlice.actions.setCurrentApp(newStudioApp));
|
|
2093
2129
|
return newStudioApp;
|
|
2094
2130
|
}
|
|
2095
2131
|
catch (_) {
|
|
2132
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2096
2133
|
throw rejectWithValue({ error: 1, errorMsg: 'Error creating application' });
|
|
2097
2134
|
}
|
|
2098
2135
|
}));
|
|
2099
|
-
const deleteStudioApp = createAsyncThunk('studio/deleteApp', ({ idApp, status }, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2136
|
+
const deleteStudioApp = createAsyncThunk('studio/deleteApp', ({ idApp, status }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2100
2137
|
const jApi = extra.jApi;
|
|
2101
2138
|
try {
|
|
2102
|
-
|
|
2139
|
+
const deleteRes = yield jApi.application.delete(idApp, status);
|
|
2140
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_StudioApp_Deleted' }));
|
|
2141
|
+
return deleteRes;
|
|
2103
2142
|
}
|
|
2104
2143
|
catch (_) {
|
|
2144
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2105
2145
|
return rejectWithValue({ error: 1, errorMsg: 'Error deleting application' });
|
|
2106
2146
|
}
|
|
2107
2147
|
}));
|
|
2108
|
-
const suspendStudioApp = createAsyncThunk('studio/suspendStudioApp', ({ idApp }, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2148
|
+
const suspendStudioApp = createAsyncThunk('studio/suspendStudioApp', ({ idApp }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2109
2149
|
const jApi = extra.jApi;
|
|
2110
2150
|
try {
|
|
2111
2151
|
yield jApi.application.suspend(idApp);
|
|
2152
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Suspended' }));
|
|
2112
2153
|
}
|
|
2113
2154
|
catch (_) {
|
|
2155
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2114
2156
|
throw rejectWithValue({ error: 1, errorMsg: 'Error suspending application' });
|
|
2115
2157
|
}
|
|
2116
2158
|
}));
|
|
2117
|
-
const restartStudioApp = createAsyncThunk('studio/restartStudioApp', ({ idApp }, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2159
|
+
const restartStudioApp = createAsyncThunk('studio/restartStudioApp', ({ idApp }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2118
2160
|
const jApi = extra.jApi;
|
|
2119
2161
|
try {
|
|
2120
2162
|
yield jApi.application.restart(idApp);
|
|
2163
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Restarted' }));
|
|
2121
2164
|
}
|
|
2122
2165
|
catch (_) {
|
|
2166
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2123
2167
|
throw rejectWithValue({ error: 1, errorMsg: 'Error restarting application' });
|
|
2124
2168
|
}
|
|
2125
2169
|
}));
|
|
2126
|
-
const cloneStudioApp = createAsyncThunk('studio/cloneStudioApp', ({ idApp }, { extra, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2170
|
+
const cloneStudioApp = createAsyncThunk('studio/cloneStudioApp', ({ idApp }, { extra, getState, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2127
2171
|
var _b;
|
|
2128
2172
|
const jApi = extra.jApi;
|
|
2129
2173
|
const existingStudioApp = getState().studio.studioAppsList.studioAppsList.find((app) => app.idApp === idApp);
|
|
@@ -2134,9 +2178,11 @@ const cloneStudioApp = createAsyncThunk('studio/cloneStudioApp', ({ idApp }, { e
|
|
|
2134
2178
|
const clonedStudioAppReady = JSON.stringify(clonedStudioApp);
|
|
2135
2179
|
try {
|
|
2136
2180
|
yield jApi.application.save(newAppId, clonedStudioAppReady, 'saved');
|
|
2181
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Cloned' }));
|
|
2137
2182
|
return clonedStudioApp;
|
|
2138
2183
|
}
|
|
2139
2184
|
catch (_) {
|
|
2185
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2140
2186
|
return rejectWithValue({ error: 1, errorMsg: 'Error cloning application' });
|
|
2141
2187
|
}
|
|
2142
2188
|
}));
|
|
@@ -2283,7 +2329,8 @@ const studio = {
|
|
|
2283
2329
|
restartStudioApp,
|
|
2284
2330
|
cloneStudioApp,
|
|
2285
2331
|
createNewStudioApp,
|
|
2286
|
-
fetchCurrentStudioApp
|
|
2332
|
+
fetchCurrentStudioApp,
|
|
2333
|
+
saveCurrentStudioApp }),
|
|
2287
2334
|
selectors: {
|
|
2288
2335
|
selectStudioAppsList,
|
|
2289
2336
|
selectCurrentStudioApp,
|