@fctc/interface-logic 1.10.7 → 1.10.9
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/hooks.d.mts +234 -13
- package/dist/hooks.d.ts +234 -13
- package/dist/hooks.js +2298 -2761
- package/dist/hooks.mjs +2301 -2763
- package/dist/provider.d.mts +32 -8
- package/dist/provider.d.ts +32 -8
- package/dist/provider.js +2450 -1850
- package/dist/provider.mjs +2314 -1714
- package/dist/services.d.mts +141 -142
- package/dist/services.d.ts +141 -142
- package/dist/services.js +2270 -1696
- package/dist/services.mjs +2263 -1689
- package/dist/types.d.mts +1 -2
- package/dist/types.d.ts +1 -2
- package/dist/{api-type-DfAFCfCw.d.mts → view-type-BGJfDe73.d.mts} +15 -1
- package/dist/{api-type-DfAFCfCw.d.ts → view-type-BGJfDe73.d.ts} +15 -1
- package/package.json +1 -1
- package/dist/use-switch-locale-BFEf9mtg.d.mts +0 -229
- package/dist/use-switch-locale-y3Oki_i5.d.ts +0 -229
- package/dist/view-type-C6Eej-Ij.d.mts +0 -15
- package/dist/view-type-C6Eej-Ij.d.ts +0 -15
package/dist/services.mjs
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// src/services/action-service/index.ts
|
|
2
|
+
import { useCallback as useCallback2 } from "react";
|
|
3
|
+
|
|
1
4
|
// src/constants/api/uri-constant.ts
|
|
2
5
|
var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
|
|
3
6
|
UriConstants2["AUTH_TOKEN_PATH"] = "/authentication/oauth2/token";
|
|
@@ -28,9 +31,6 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
|
|
|
28
31
|
return UriConstants2;
|
|
29
32
|
})(UriConstants || {});
|
|
30
33
|
|
|
31
|
-
// src/configs/axios-client.ts
|
|
32
|
-
import axios from "axios";
|
|
33
|
-
|
|
34
34
|
// src/utils/format.ts
|
|
35
35
|
import moment from "moment";
|
|
36
36
|
|
|
@@ -2147,880 +2147,1443 @@ var toQueryString = (params) => {
|
|
|
2147
2147
|
(key) => encodeURIComponent(key) + "=" + encodeURIComponent(params[key].toString())
|
|
2148
2148
|
).join("&");
|
|
2149
2149
|
};
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2150
|
+
|
|
2151
|
+
// src/provider/react-query-provider.tsx
|
|
2152
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
2153
|
+
import { jsx } from "react/jsx-runtime";
|
|
2154
|
+
|
|
2155
|
+
// src/provider/redux-provider.tsx
|
|
2156
|
+
import { Provider } from "react-redux";
|
|
2157
|
+
|
|
2158
|
+
// src/store/index.ts
|
|
2159
|
+
import { useDispatch, useSelector } from "react-redux";
|
|
2160
|
+
|
|
2161
|
+
// src/store/reducers/breadcrums-slice/index.ts
|
|
2162
|
+
import { createSlice } from "@reduxjs/toolkit";
|
|
2163
|
+
var initialState = {
|
|
2164
|
+
breadCrumbs: []
|
|
2165
|
+
};
|
|
2166
|
+
var breadcrumbsSlice = createSlice({
|
|
2167
|
+
name: "breadcrumbs",
|
|
2168
|
+
initialState,
|
|
2169
|
+
reducers: {
|
|
2170
|
+
setBreadCrumbs: (state, action) => {
|
|
2171
|
+
state.breadCrumbs = [...state.breadCrumbs, action.payload];
|
|
2162
2172
|
}
|
|
2163
2173
|
}
|
|
2164
|
-
|
|
2165
|
-
|
|
2174
|
+
});
|
|
2175
|
+
var { setBreadCrumbs } = breadcrumbsSlice.actions;
|
|
2176
|
+
var breadcrums_slice_default = breadcrumbsSlice.reducer;
|
|
2177
|
+
|
|
2178
|
+
// src/store/reducers/env-slice/index.ts
|
|
2179
|
+
import { createSlice as createSlice2 } from "@reduxjs/toolkit";
|
|
2180
|
+
var initialState2 = {
|
|
2181
|
+
baseUrl: "",
|
|
2182
|
+
companies: [],
|
|
2183
|
+
user: {},
|
|
2184
|
+
db: "",
|
|
2185
|
+
refreshTokenEndpoint: "",
|
|
2186
|
+
config: null,
|
|
2187
|
+
envFile: null,
|
|
2188
|
+
requests: null,
|
|
2189
|
+
defaultCompany: {
|
|
2190
|
+
id: null,
|
|
2191
|
+
logo: "",
|
|
2192
|
+
secondary_color: "",
|
|
2193
|
+
primary_color: ""
|
|
2194
|
+
},
|
|
2195
|
+
context: {
|
|
2196
|
+
uid: null,
|
|
2197
|
+
allowed_company_ids: [],
|
|
2198
|
+
lang: "vi_VN",
|
|
2199
|
+
tz: "Asia/Saigon"
|
|
2166
2200
|
}
|
|
2167
|
-
return originalRequest.data;
|
|
2168
2201
|
};
|
|
2202
|
+
var envSlice = createSlice2({
|
|
2203
|
+
name: "env",
|
|
2204
|
+
initialState: initialState2,
|
|
2205
|
+
reducers: {
|
|
2206
|
+
setEnv: (state, action) => {
|
|
2207
|
+
Object.assign(state, action.payload);
|
|
2208
|
+
},
|
|
2209
|
+
setUid: (state, action) => {
|
|
2210
|
+
state.context.uid = action.payload;
|
|
2211
|
+
},
|
|
2212
|
+
setAllowCompanies: (state, action) => {
|
|
2213
|
+
state.context.allowed_company_ids = action.payload;
|
|
2214
|
+
},
|
|
2215
|
+
setCompanies: (state, action) => {
|
|
2216
|
+
state.companies = action.payload;
|
|
2217
|
+
},
|
|
2218
|
+
setDefaultCompany: (state, action) => {
|
|
2219
|
+
state.defaultCompany = action.payload;
|
|
2220
|
+
},
|
|
2221
|
+
setLang: (state, action) => {
|
|
2222
|
+
state.context.lang = action.payload;
|
|
2223
|
+
},
|
|
2224
|
+
setUser: (state, action) => {
|
|
2225
|
+
state.user = action.payload;
|
|
2226
|
+
},
|
|
2227
|
+
setConfig: (state, action) => {
|
|
2228
|
+
state.config = action.payload;
|
|
2229
|
+
},
|
|
2230
|
+
setEnvFile: (state, action) => {
|
|
2231
|
+
state.envFile = action.payload;
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
});
|
|
2235
|
+
var {
|
|
2236
|
+
setEnv,
|
|
2237
|
+
setUid,
|
|
2238
|
+
setLang,
|
|
2239
|
+
setAllowCompanies,
|
|
2240
|
+
setCompanies,
|
|
2241
|
+
setDefaultCompany,
|
|
2242
|
+
setUser,
|
|
2243
|
+
setConfig,
|
|
2244
|
+
setEnvFile
|
|
2245
|
+
} = envSlice.actions;
|
|
2246
|
+
var env_slice_default = envSlice.reducer;
|
|
2169
2247
|
|
|
2170
|
-
// src/
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
return localStorage.getItem("accessToken");
|
|
2180
|
-
};
|
|
2181
|
-
const getRefreshToken = async () => {
|
|
2182
|
-
return localStorage.getItem("refreshToken");
|
|
2183
|
-
};
|
|
2184
|
-
const clearToken = async () => {
|
|
2185
|
-
localStorage.removeItem("accessToken");
|
|
2186
|
-
localStorage.removeItem("refreshToken");
|
|
2187
|
-
};
|
|
2188
|
-
return {
|
|
2189
|
-
setToken,
|
|
2190
|
-
setRefreshToken,
|
|
2191
|
-
getAccessToken,
|
|
2192
|
-
getRefreshToken,
|
|
2193
|
-
clearToken
|
|
2194
|
-
};
|
|
2248
|
+
// src/store/reducers/excel-slice/index.ts
|
|
2249
|
+
import { createSlice as createSlice3 } from "@reduxjs/toolkit";
|
|
2250
|
+
var initialState3 = {
|
|
2251
|
+
dataParse: null,
|
|
2252
|
+
idFile: null,
|
|
2253
|
+
isFileLoaded: false,
|
|
2254
|
+
loadingImport: false,
|
|
2255
|
+
selectedFile: null,
|
|
2256
|
+
errorData: null
|
|
2195
2257
|
};
|
|
2258
|
+
var excelSlice = createSlice3({
|
|
2259
|
+
name: "excel",
|
|
2260
|
+
initialState: initialState3,
|
|
2261
|
+
reducers: {
|
|
2262
|
+
setDataParse: (state, action) => {
|
|
2263
|
+
state.dataParse = action.payload;
|
|
2264
|
+
},
|
|
2265
|
+
setIdFile: (state, action) => {
|
|
2266
|
+
state.idFile = action.payload;
|
|
2267
|
+
},
|
|
2268
|
+
setIsFileLoaded: (state, action) => {
|
|
2269
|
+
state.isFileLoaded = action.payload;
|
|
2270
|
+
},
|
|
2271
|
+
setLoadingImport: (state, action) => {
|
|
2272
|
+
state.loadingImport = action.payload;
|
|
2273
|
+
},
|
|
2274
|
+
setSelectedFile: (state, action) => {
|
|
2275
|
+
state.selectedFile = action.payload;
|
|
2276
|
+
},
|
|
2277
|
+
setErrorData: (state, action) => {
|
|
2278
|
+
state.errorData = action.payload;
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
});
|
|
2282
|
+
var {
|
|
2283
|
+
setDataParse,
|
|
2284
|
+
setIdFile,
|
|
2285
|
+
setIsFileLoaded,
|
|
2286
|
+
setLoadingImport,
|
|
2287
|
+
setSelectedFile,
|
|
2288
|
+
setErrorData
|
|
2289
|
+
} = excelSlice.actions;
|
|
2290
|
+
var excel_slice_default = excelSlice.reducer;
|
|
2196
2291
|
|
|
2197
|
-
// src/
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2292
|
+
// src/store/reducers/form-slice/index.ts
|
|
2293
|
+
import { createSlice as createSlice4 } from "@reduxjs/toolkit";
|
|
2294
|
+
var initialState4 = {
|
|
2295
|
+
viewDataStore: {},
|
|
2296
|
+
isShowingModalDetail: false,
|
|
2297
|
+
isShowModalTranslate: false,
|
|
2298
|
+
formSubmitComponent: {},
|
|
2299
|
+
fieldTranslation: null,
|
|
2300
|
+
listSubject: {},
|
|
2301
|
+
dataUser: {}
|
|
2205
2302
|
};
|
|
2303
|
+
var formSlice = createSlice4({
|
|
2304
|
+
name: "form",
|
|
2305
|
+
initialState: initialState4,
|
|
2306
|
+
reducers: {
|
|
2307
|
+
setViewDataStore: (state, action) => {
|
|
2308
|
+
state.viewDataStore = action.payload;
|
|
2309
|
+
},
|
|
2310
|
+
setIsShowingModalDetail: (state, action) => {
|
|
2311
|
+
state.isShowingModalDetail = action.payload;
|
|
2312
|
+
},
|
|
2313
|
+
setIsShowModalTranslate: (state, action) => {
|
|
2314
|
+
state.isShowModalTranslate = action.payload;
|
|
2315
|
+
},
|
|
2316
|
+
setFormSubmitComponent: (state, action) => {
|
|
2317
|
+
state.formSubmitComponent[action.payload.key] = action.payload.component;
|
|
2318
|
+
},
|
|
2319
|
+
setFieldTranslate: (state, action) => {
|
|
2320
|
+
state.fieldTranslation = action.payload;
|
|
2321
|
+
},
|
|
2322
|
+
setListSubject: (state, action) => {
|
|
2323
|
+
state.listSubject = action.payload;
|
|
2324
|
+
},
|
|
2325
|
+
setDataUser: (state, action) => {
|
|
2326
|
+
state.dataUser = action.payload;
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
});
|
|
2330
|
+
var {
|
|
2331
|
+
setViewDataStore,
|
|
2332
|
+
setIsShowingModalDetail,
|
|
2333
|
+
setIsShowModalTranslate,
|
|
2334
|
+
setFormSubmitComponent,
|
|
2335
|
+
setFieldTranslate,
|
|
2336
|
+
setListSubject,
|
|
2337
|
+
setDataUser
|
|
2338
|
+
} = formSlice.actions;
|
|
2339
|
+
var form_slice_default = formSlice.reducer;
|
|
2206
2340
|
|
|
2207
|
-
// src/
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
}
|
|
2222
|
-
});
|
|
2223
|
-
failedQueue = [];
|
|
2224
|
-
};
|
|
2225
|
-
const instance = axios.create({
|
|
2226
|
-
adapter: axios.defaults.adapter,
|
|
2227
|
-
baseURL: config.baseUrl,
|
|
2228
|
-
timeout: 5e4,
|
|
2229
|
-
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2230
|
-
});
|
|
2231
|
-
instance.interceptors.request.use(async (config2) => {
|
|
2232
|
-
const { useRefreshToken, useActionToken, actionToken } = config2;
|
|
2233
|
-
if (useActionToken && actionToken) {
|
|
2234
|
-
config2.headers["Action-Token"] = actionToken;
|
|
2235
|
-
}
|
|
2236
|
-
const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
|
|
2237
|
-
const token = await getToken?.();
|
|
2238
|
-
if (token) config2.headers["Authorization"] = `Bearer ${token}`;
|
|
2239
|
-
return config2;
|
|
2240
|
-
}, Promise.reject);
|
|
2241
|
-
instance.interceptors.response.use(
|
|
2242
|
-
(response) => {
|
|
2243
|
-
return handleResponse(response);
|
|
2244
|
-
},
|
|
2245
|
-
async (error) => {
|
|
2246
|
-
const handleError3 = async (error2) => {
|
|
2247
|
-
if (!error2.response) {
|
|
2248
|
-
return error2;
|
|
2249
|
-
}
|
|
2250
|
-
const { data } = error2.response;
|
|
2251
|
-
if (data && data.code === 400 && ["invalid_grant"].includes(data.data?.error)) {
|
|
2252
|
-
await clearAuthToken();
|
|
2253
|
-
}
|
|
2254
|
-
return data;
|
|
2255
|
-
};
|
|
2256
|
-
const originalRequest = error.config;
|
|
2257
|
-
if ((error.response?.status === 403 || error.response?.status === 401 || error.response?.status === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401, "ERR_2FA_006"].includes(
|
|
2258
|
-
error.response.data.code
|
|
2259
|
-
)) {
|
|
2260
|
-
if (isRefreshing) {
|
|
2261
|
-
return new Promise(function(resolve, reject) {
|
|
2262
|
-
failedQueue.push({ resolve, reject });
|
|
2263
|
-
}).then((token) => {
|
|
2264
|
-
originalRequest.headers["Authorization"] = "Bearer " + token;
|
|
2265
|
-
originalRequest.data = updateTokenParamInOriginalRequest(
|
|
2266
|
-
originalRequest,
|
|
2267
|
-
token
|
|
2268
|
-
);
|
|
2269
|
-
return instance.request(originalRequest);
|
|
2270
|
-
}).catch(async (err) => {
|
|
2271
|
-
if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
|
|
2272
|
-
await clearAuthToken();
|
|
2273
|
-
}
|
|
2274
|
-
});
|
|
2275
|
-
}
|
|
2276
|
-
const browserSession = await sessionStorage2.getBrowserSession();
|
|
2277
|
-
const refreshToken = await localStorage2.getRefreshToken();
|
|
2278
|
-
const accessTokenExp = await localStorage2.getAccessToken();
|
|
2279
|
-
isRefreshing = true;
|
|
2280
|
-
if (!refreshToken && (!browserSession || browserSession == "unActive")) {
|
|
2281
|
-
await clearAuthToken();
|
|
2282
|
-
} else {
|
|
2283
|
-
const payload = Object.fromEntries(
|
|
2284
|
-
Object.entries({
|
|
2285
|
-
refresh_token: refreshToken,
|
|
2286
|
-
grant_type: "refresh_token",
|
|
2287
|
-
client_id: config.config.clientId,
|
|
2288
|
-
client_secret: config.config.clientSecret
|
|
2289
|
-
}).filter(([_, value]) => !!value)
|
|
2290
|
-
);
|
|
2291
|
-
return new Promise(function(resolve) {
|
|
2292
|
-
axios.post(
|
|
2293
|
-
`${config.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
|
|
2294
|
-
payload,
|
|
2295
|
-
{
|
|
2296
|
-
headers: {
|
|
2297
|
-
"Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
|
|
2298
|
-
Authorization: `Bearer ${accessTokenExp}`
|
|
2299
|
-
}
|
|
2300
|
-
}
|
|
2301
|
-
).then(async (res) => {
|
|
2302
|
-
const data = res.data;
|
|
2303
|
-
await localStorage2.setToken(data.access_token);
|
|
2304
|
-
await localStorage2.setRefreshToken(data.refresh_token);
|
|
2305
|
-
axios.defaults.headers.common["Authorization"] = "Bearer " + data.access_token;
|
|
2306
|
-
originalRequest.headers["Authorization"] = "Bearer " + data.access_token;
|
|
2307
|
-
originalRequest.data = updateTokenParamInOriginalRequest(
|
|
2308
|
-
originalRequest,
|
|
2309
|
-
data.access_token
|
|
2310
|
-
);
|
|
2311
|
-
processQueue(null, data.access_token);
|
|
2312
|
-
resolve(instance.request(originalRequest));
|
|
2313
|
-
}).catch(async (err) => {
|
|
2314
|
-
if (err && (err?.error_code === "AUTHEN_FAIL" || err?.error_code === "TOKEN_EXPIRED" || err?.error_code === "TOKEN_INCORRECT" || err?.code === "ERR_BAD_REQUEST") || err?.error_code === "ERR_2FA_006") {
|
|
2315
|
-
await clearAuthToken();
|
|
2316
|
-
}
|
|
2317
|
-
if (err && err.response) {
|
|
2318
|
-
const { error_code } = err.response?.data || {};
|
|
2319
|
-
if (error_code === "AUTHEN_FAIL") {
|
|
2320
|
-
await clearAuthToken();
|
|
2321
|
-
}
|
|
2322
|
-
}
|
|
2323
|
-
processQueue(err, null);
|
|
2324
|
-
}).finally(() => {
|
|
2325
|
-
isRefreshing = false;
|
|
2326
|
-
});
|
|
2327
|
-
});
|
|
2328
|
-
}
|
|
2329
|
-
}
|
|
2330
|
-
return Promise.reject(await handleError3(error));
|
|
2331
|
-
}
|
|
2332
|
-
);
|
|
2333
|
-
const handleResponse = (res) => {
|
|
2334
|
-
if (res && res.data) {
|
|
2335
|
-
return res.data;
|
|
2336
|
-
}
|
|
2337
|
-
return res;
|
|
2338
|
-
};
|
|
2339
|
-
const handleError2 = (error) => {
|
|
2340
|
-
if (error.isAxiosError && error.code === "ECONNABORTED") {
|
|
2341
|
-
console.error("Request Timeout Error:", error);
|
|
2342
|
-
return "Request Timeout Error";
|
|
2343
|
-
} else if (error.isAxiosError && !error.response) {
|
|
2344
|
-
console.error("Network Error:", error);
|
|
2345
|
-
return "Network Error";
|
|
2346
|
-
} else {
|
|
2347
|
-
console.error("Other Error:", error?.response);
|
|
2348
|
-
const errorMessage = error?.response?.data?.message || "An error occurred";
|
|
2349
|
-
return { message: errorMessage, status: error?.response?.status };
|
|
2350
|
-
}
|
|
2351
|
-
};
|
|
2352
|
-
const clearAuthToken = async () => {
|
|
2353
|
-
await localStorage2.clearToken();
|
|
2354
|
-
if (typeof window !== "undefined") {
|
|
2355
|
-
window.location.href = `/login`;
|
|
2356
|
-
}
|
|
2357
|
-
};
|
|
2358
|
-
function formatUrl(url, db2) {
|
|
2359
|
-
return url + (db2 ? "?db=" + db2 : "");
|
|
2360
|
-
}
|
|
2361
|
-
const responseBody = (response) => response;
|
|
2362
|
-
const requests = {
|
|
2363
|
-
get: (url, headers) => instance.get(formatUrl(url, db), headers).then(responseBody),
|
|
2364
|
-
post: (url, body, headers) => instance.post(formatUrl(url, db), body, headers).then(responseBody),
|
|
2365
|
-
post_excel: (url, body, headers) => instance.post(formatUrl(url, db), body, {
|
|
2366
|
-
responseType: "arraybuffer",
|
|
2367
|
-
headers: {
|
|
2368
|
-
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
2369
|
-
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
2370
|
-
}
|
|
2371
|
-
}).then(responseBody),
|
|
2372
|
-
put: (url, body, headers) => instance.put(formatUrl(url, db), body, headers).then(responseBody),
|
|
2373
|
-
patch: (url, body) => instance.patch(formatUrl(url, db), body).then(responseBody),
|
|
2374
|
-
delete: (url, body) => instance.delete(formatUrl(url, db), body).then(responseBody)
|
|
2375
|
-
};
|
|
2376
|
-
return requests;
|
|
2341
|
+
// src/store/reducers/header-slice/index.ts
|
|
2342
|
+
import { createSlice as createSlice5 } from "@reduxjs/toolkit";
|
|
2343
|
+
var headerSlice = createSlice5({
|
|
2344
|
+
name: "header",
|
|
2345
|
+
initialState: {
|
|
2346
|
+
value: { allowedCompanyIds: [] }
|
|
2347
|
+
},
|
|
2348
|
+
reducers: {
|
|
2349
|
+
setHeader: (state, action) => {
|
|
2350
|
+
state.value = { ...state.value, ...action.payload };
|
|
2351
|
+
},
|
|
2352
|
+
setAllowedCompanyIds: (state, action) => {
|
|
2353
|
+
state.value.allowedCompanyIds = action.payload;
|
|
2354
|
+
}
|
|
2377
2355
|
}
|
|
2378
|
-
};
|
|
2356
|
+
});
|
|
2357
|
+
var { setAllowedCompanyIds, setHeader } = headerSlice.actions;
|
|
2358
|
+
var header_slice_default = headerSlice.reducer;
|
|
2379
2359
|
|
|
2380
|
-
// src/
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2360
|
+
// src/store/reducers/list-slice/index.ts
|
|
2361
|
+
import { createSlice as createSlice6 } from "@reduxjs/toolkit";
|
|
2362
|
+
var initialState5 = {
|
|
2363
|
+
pageLimit: 10,
|
|
2364
|
+
fields: {},
|
|
2365
|
+
order: "",
|
|
2366
|
+
selectedRowKeys: [],
|
|
2367
|
+
selectedRadioKey: 0,
|
|
2368
|
+
indexRowTableModal: -2,
|
|
2369
|
+
isUpdateTableModal: false,
|
|
2370
|
+
footerGroupTable: {},
|
|
2371
|
+
transferDetail: null,
|
|
2372
|
+
page: 0,
|
|
2373
|
+
domainTable: []
|
|
2374
|
+
};
|
|
2375
|
+
var listSlice = createSlice6({
|
|
2376
|
+
name: "list",
|
|
2377
|
+
initialState: initialState5,
|
|
2378
|
+
reducers: {
|
|
2379
|
+
setPageLimit: (state, action) => {
|
|
2380
|
+
state.pageLimit = action.payload;
|
|
2381
|
+
},
|
|
2382
|
+
setFields: (state, action) => {
|
|
2383
|
+
state.fields = action.payload;
|
|
2384
|
+
},
|
|
2385
|
+
setOrder: (state, action) => {
|
|
2386
|
+
state.order = action.payload;
|
|
2387
|
+
},
|
|
2388
|
+
setSelectedRowKeys: (state, action) => {
|
|
2389
|
+
state.selectedRowKeys = action.payload;
|
|
2390
|
+
},
|
|
2391
|
+
setSelectedRadioKey: (state, action) => {
|
|
2392
|
+
state.selectedRadioKey = action.payload;
|
|
2393
|
+
},
|
|
2394
|
+
setIndexRowTableModal: (state, action) => {
|
|
2395
|
+
state.indexRowTableModal = action.payload;
|
|
2396
|
+
},
|
|
2397
|
+
setTransferDetail: (state, action) => {
|
|
2398
|
+
state.transferDetail = action.payload;
|
|
2399
|
+
},
|
|
2400
|
+
setIsUpdateTableModal: (state, action) => {
|
|
2401
|
+
state.isUpdateTableModal = action.payload;
|
|
2402
|
+
},
|
|
2403
|
+
setPage: (state, action) => {
|
|
2404
|
+
state.page = action.payload;
|
|
2405
|
+
},
|
|
2406
|
+
setDomainTable: (state, action) => {
|
|
2407
|
+
state.domainTable = action.payload;
|
|
2386
2408
|
}
|
|
2387
|
-
this.listeners[event].push(callback);
|
|
2388
2409
|
}
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2410
|
+
});
|
|
2411
|
+
var {
|
|
2412
|
+
setPageLimit,
|
|
2413
|
+
setFields,
|
|
2414
|
+
setOrder,
|
|
2415
|
+
setSelectedRowKeys,
|
|
2416
|
+
setIndexRowTableModal,
|
|
2417
|
+
setIsUpdateTableModal,
|
|
2418
|
+
setPage,
|
|
2419
|
+
setSelectedRadioKey,
|
|
2420
|
+
setTransferDetail,
|
|
2421
|
+
setDomainTable
|
|
2422
|
+
} = listSlice.actions;
|
|
2423
|
+
var list_slice_default = listSlice.reducer;
|
|
2424
|
+
|
|
2425
|
+
// src/store/reducers/login-slice/index.ts
|
|
2426
|
+
import { createSlice as createSlice7 } from "@reduxjs/toolkit";
|
|
2427
|
+
var initialState6 = {
|
|
2428
|
+
db: "",
|
|
2429
|
+
redirectTo: "/",
|
|
2430
|
+
forgotPasswordUrl: "/"
|
|
2431
|
+
};
|
|
2432
|
+
var loginSlice = createSlice7({
|
|
2433
|
+
name: "login",
|
|
2434
|
+
initialState: initialState6,
|
|
2435
|
+
reducers: {
|
|
2436
|
+
setDb: (state, action) => {
|
|
2437
|
+
state.db = action.payload;
|
|
2438
|
+
},
|
|
2439
|
+
setRedirectTo: (state, action) => {
|
|
2440
|
+
state.redirectTo = action.payload;
|
|
2441
|
+
},
|
|
2442
|
+
setForgotPasswordUrl: (state, action) => {
|
|
2443
|
+
state.forgotPasswordUrl = action.payload;
|
|
2392
2444
|
}
|
|
2393
2445
|
}
|
|
2446
|
+
});
|
|
2447
|
+
var { setDb, setRedirectTo, setForgotPasswordUrl } = loginSlice.actions;
|
|
2448
|
+
var login_slice_default = loginSlice.reducer;
|
|
2449
|
+
|
|
2450
|
+
// src/store/reducers/navbar-slice/index.ts
|
|
2451
|
+
import { createSlice as createSlice8 } from "@reduxjs/toolkit";
|
|
2452
|
+
var initialState7 = {
|
|
2453
|
+
menuFocus: {},
|
|
2454
|
+
menuAction: {},
|
|
2455
|
+
navbarWidth: 250,
|
|
2456
|
+
menuList: []
|
|
2394
2457
|
};
|
|
2395
|
-
var
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
secondary_color: "",
|
|
2412
|
-
primary_color: ""
|
|
2413
|
-
},
|
|
2414
|
-
context: {
|
|
2415
|
-
uid: null,
|
|
2416
|
-
allowed_company_ids: [],
|
|
2417
|
-
lang: "vi_VN",
|
|
2418
|
-
tz: "Asia/Saigon"
|
|
2419
|
-
},
|
|
2420
|
-
localStorageUtils: localStorageUtil,
|
|
2421
|
-
sessionStorageUtils: sessionStorageUtil
|
|
2422
|
-
};
|
|
2423
|
-
this.emitter = new EventEmitter();
|
|
2424
|
-
this.localStorageUtil = localStorageUtil;
|
|
2425
|
-
this.sessionStorageUtil = sessionStorageUtil;
|
|
2426
|
-
}
|
|
2427
|
-
getEnv() {
|
|
2428
|
-
return { ...this.state };
|
|
2429
|
-
}
|
|
2430
|
-
onUpdate(callback) {
|
|
2431
|
-
this.emitter.on("update", callback);
|
|
2432
|
-
}
|
|
2433
|
-
setupEnv(envConfig) {
|
|
2434
|
-
this.state = {
|
|
2435
|
-
...this.state,
|
|
2436
|
-
...envConfig,
|
|
2437
|
-
localStorageUtils: this.localStorageUtil,
|
|
2438
|
-
sessionStorageUtils: this.sessionStorageUtil
|
|
2439
|
-
};
|
|
2440
|
-
this.state.requests = axiosClient.init(this.state);
|
|
2441
|
-
this.emitter.emit("update", this.getEnv());
|
|
2442
|
-
return this.getEnv();
|
|
2443
|
-
}
|
|
2444
|
-
setUid(uid) {
|
|
2445
|
-
this.state = {
|
|
2446
|
-
...this.state,
|
|
2447
|
-
context: { ...this.state.context, uid }
|
|
2448
|
-
};
|
|
2449
|
-
this.emitter.emit("update", this.getEnv());
|
|
2458
|
+
var navbarSlice = createSlice8({
|
|
2459
|
+
name: "navbar",
|
|
2460
|
+
initialState: initialState7,
|
|
2461
|
+
reducers: {
|
|
2462
|
+
setMenuFocus: (state, action) => {
|
|
2463
|
+
state.menuFocus = action.payload;
|
|
2464
|
+
},
|
|
2465
|
+
setMenuFocusAction: (state, action) => {
|
|
2466
|
+
state.menuAction = action.payload;
|
|
2467
|
+
},
|
|
2468
|
+
setNavbarWidth: (state, action) => {
|
|
2469
|
+
state.navbarWidth = action.payload;
|
|
2470
|
+
},
|
|
2471
|
+
setMenuList: (state, action) => {
|
|
2472
|
+
state.menuList = action.payload;
|
|
2473
|
+
}
|
|
2450
2474
|
}
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2475
|
+
});
|
|
2476
|
+
var { setMenuFocus, setMenuFocusAction, setNavbarWidth, setMenuList } = navbarSlice.actions;
|
|
2477
|
+
var navbar_slice_default = navbarSlice.reducer;
|
|
2478
|
+
|
|
2479
|
+
// src/store/reducers/profile-slice/index.ts
|
|
2480
|
+
import { createSlice as createSlice9 } from "@reduxjs/toolkit";
|
|
2481
|
+
var initialState8 = {
|
|
2482
|
+
profile: {}
|
|
2483
|
+
};
|
|
2484
|
+
var profileSlice = createSlice9({
|
|
2485
|
+
name: "profile",
|
|
2486
|
+
initialState: initialState8,
|
|
2487
|
+
reducers: {
|
|
2488
|
+
setProfile: (state, action) => {
|
|
2489
|
+
state.profile = action.payload;
|
|
2490
|
+
}
|
|
2457
2491
|
}
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2492
|
+
});
|
|
2493
|
+
var { setProfile } = profileSlice.actions;
|
|
2494
|
+
var profile_slice_default = profileSlice.reducer;
|
|
2495
|
+
|
|
2496
|
+
// src/store/reducers/search-slice/index.ts
|
|
2497
|
+
import { createSlice as createSlice10 } from "@reduxjs/toolkit";
|
|
2498
|
+
var initialState9 = {
|
|
2499
|
+
groupByDomain: null,
|
|
2500
|
+
searchBy: [],
|
|
2501
|
+
searchString: "",
|
|
2502
|
+
hoveredIndexSearchList: null,
|
|
2503
|
+
selectedTags: [],
|
|
2504
|
+
firstDomain: null,
|
|
2505
|
+
searchMap: {},
|
|
2506
|
+
filterBy: [],
|
|
2507
|
+
groupBy: []
|
|
2508
|
+
};
|
|
2509
|
+
var searchSlice = createSlice10({
|
|
2510
|
+
name: "search",
|
|
2511
|
+
initialState: initialState9,
|
|
2512
|
+
reducers: {
|
|
2513
|
+
setGroupByDomain: (state, action) => {
|
|
2514
|
+
state.groupByDomain = action.payload;
|
|
2515
|
+
},
|
|
2516
|
+
setSearchBy: (state, action) => {
|
|
2517
|
+
state.searchBy = action.payload;
|
|
2518
|
+
},
|
|
2519
|
+
setSearchString: (state, action) => {
|
|
2520
|
+
state.searchString = action.payload;
|
|
2521
|
+
},
|
|
2522
|
+
setHoveredIndexSearchList: (state, action) => {
|
|
2523
|
+
state.hoveredIndexSearchList = action.payload;
|
|
2524
|
+
},
|
|
2525
|
+
setSelectedTags: (state, action) => {
|
|
2526
|
+
state.selectedTags = action.payload;
|
|
2527
|
+
},
|
|
2528
|
+
setFirstDomain: (state, action) => {
|
|
2529
|
+
state.firstDomain = action.payload;
|
|
2530
|
+
},
|
|
2531
|
+
setFilterBy: (state, action) => {
|
|
2532
|
+
state.filterBy = action.payload;
|
|
2533
|
+
},
|
|
2534
|
+
setGroupBy: (state, action) => {
|
|
2535
|
+
state.groupBy = action.payload;
|
|
2536
|
+
},
|
|
2537
|
+
setSearchMap: (state, action) => {
|
|
2538
|
+
state.searchMap = action.payload;
|
|
2539
|
+
},
|
|
2540
|
+
updateSearchMap: (state, action) => {
|
|
2541
|
+
if (!state.searchMap[action.payload.key]) {
|
|
2542
|
+
state.searchMap[action.payload.key] = [];
|
|
2543
|
+
}
|
|
2544
|
+
state.searchMap[action.payload.key].push(action.payload.value);
|
|
2545
|
+
},
|
|
2546
|
+
removeKeyFromSearchMap: (state, action) => {
|
|
2547
|
+
const { key, item } = action.payload;
|
|
2548
|
+
const values = state.searchMap[key];
|
|
2549
|
+
if (!values) return;
|
|
2550
|
+
if (item) {
|
|
2551
|
+
const filtered = values.filter((value) => value.name !== item.name);
|
|
2552
|
+
if (filtered.length > 0) {
|
|
2553
|
+
state.searchMap[key] = filtered;
|
|
2554
|
+
} else {
|
|
2555
|
+
delete state.searchMap[key];
|
|
2556
|
+
}
|
|
2557
|
+
} else {
|
|
2558
|
+
delete state.searchMap[key];
|
|
2559
|
+
}
|
|
2560
|
+
},
|
|
2561
|
+
clearSearchMap: (state) => {
|
|
2562
|
+
state.searchMap = {};
|
|
2563
|
+
}
|
|
2464
2564
|
}
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2565
|
+
});
|
|
2566
|
+
var {
|
|
2567
|
+
setGroupByDomain,
|
|
2568
|
+
setSelectedTags,
|
|
2569
|
+
setSearchString,
|
|
2570
|
+
setHoveredIndexSearchList,
|
|
2571
|
+
setFirstDomain,
|
|
2572
|
+
setSearchBy,
|
|
2573
|
+
setFilterBy,
|
|
2574
|
+
setSearchMap,
|
|
2575
|
+
updateSearchMap,
|
|
2576
|
+
removeKeyFromSearchMap,
|
|
2577
|
+
setGroupBy,
|
|
2578
|
+
clearSearchMap
|
|
2579
|
+
} = searchSlice.actions;
|
|
2580
|
+
var search_slice_default = searchSlice.reducer;
|
|
2581
|
+
|
|
2582
|
+
// src/store/store.ts
|
|
2583
|
+
import { configureStore } from "@reduxjs/toolkit";
|
|
2584
|
+
|
|
2585
|
+
// node_modules/redux/dist/redux.mjs
|
|
2586
|
+
function formatProdErrorMessage(code) {
|
|
2587
|
+
return `Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
|
|
2588
|
+
}
|
|
2589
|
+
var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
|
|
2590
|
+
var ActionTypes = {
|
|
2591
|
+
INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
|
|
2592
|
+
REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
|
|
2593
|
+
PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
|
|
2594
|
+
};
|
|
2595
|
+
var actionTypes_default = ActionTypes;
|
|
2596
|
+
function isPlainObject(obj) {
|
|
2597
|
+
if (typeof obj !== "object" || obj === null)
|
|
2598
|
+
return false;
|
|
2599
|
+
let proto = obj;
|
|
2600
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
2601
|
+
proto = Object.getPrototypeOf(proto);
|
|
2468
2602
|
}
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2603
|
+
return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
|
|
2604
|
+
}
|
|
2605
|
+
function miniKindOf(val) {
|
|
2606
|
+
if (val === void 0)
|
|
2607
|
+
return "undefined";
|
|
2608
|
+
if (val === null)
|
|
2609
|
+
return "null";
|
|
2610
|
+
const type = typeof val;
|
|
2611
|
+
switch (type) {
|
|
2612
|
+
case "boolean":
|
|
2613
|
+
case "string":
|
|
2614
|
+
case "number":
|
|
2615
|
+
case "symbol":
|
|
2616
|
+
case "function": {
|
|
2617
|
+
return type;
|
|
2618
|
+
}
|
|
2472
2619
|
}
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2620
|
+
if (Array.isArray(val))
|
|
2621
|
+
return "array";
|
|
2622
|
+
if (isDate(val))
|
|
2623
|
+
return "date";
|
|
2624
|
+
if (isError(val))
|
|
2625
|
+
return "error";
|
|
2626
|
+
const constructorName = ctorName(val);
|
|
2627
|
+
switch (constructorName) {
|
|
2628
|
+
case "Symbol":
|
|
2629
|
+
case "Promise":
|
|
2630
|
+
case "WeakMap":
|
|
2631
|
+
case "WeakSet":
|
|
2632
|
+
case "Map":
|
|
2633
|
+
case "Set":
|
|
2634
|
+
return constructorName;
|
|
2635
|
+
}
|
|
2636
|
+
return Object.prototype.toString.call(val).slice(8, -1).toLowerCase().replace(/\s/g, "");
|
|
2637
|
+
}
|
|
2638
|
+
function ctorName(val) {
|
|
2639
|
+
return typeof val.constructor === "function" ? val.constructor.name : null;
|
|
2640
|
+
}
|
|
2641
|
+
function isError(val) {
|
|
2642
|
+
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
|
2643
|
+
}
|
|
2644
|
+
function isDate(val) {
|
|
2645
|
+
if (val instanceof Date)
|
|
2646
|
+
return true;
|
|
2647
|
+
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
|
2648
|
+
}
|
|
2649
|
+
function kindOf(val) {
|
|
2650
|
+
let typeOfVal = typeof val;
|
|
2651
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2652
|
+
typeOfVal = miniKindOf(val);
|
|
2476
2653
|
}
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2654
|
+
return typeOfVal;
|
|
2655
|
+
}
|
|
2656
|
+
function warning(message) {
|
|
2657
|
+
if (typeof console !== "undefined" && typeof console.error === "function") {
|
|
2658
|
+
console.error(message);
|
|
2480
2659
|
}
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2660
|
+
try {
|
|
2661
|
+
throw new Error(message);
|
|
2662
|
+
} catch (e) {
|
|
2484
2663
|
}
|
|
2485
|
-
}
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2664
|
+
}
|
|
2665
|
+
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
|
2666
|
+
const reducerKeys = Object.keys(reducers);
|
|
2667
|
+
const argumentName = action && action.type === actionTypes_default.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
|
|
2668
|
+
if (reducerKeys.length === 0) {
|
|
2669
|
+
return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
|
|
2670
|
+
}
|
|
2671
|
+
if (!isPlainObject(inputState)) {
|
|
2672
|
+
return `The ${argumentName} has unexpected type of "${kindOf(inputState)}". Expected argument to be an object with the following keys: "${reducerKeys.join('", "')}"`;
|
|
2673
|
+
}
|
|
2674
|
+
const unexpectedKeys = Object.keys(inputState).filter((key) => !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]);
|
|
2675
|
+
unexpectedKeys.forEach((key) => {
|
|
2676
|
+
unexpectedKeyCache[key] = true;
|
|
2677
|
+
});
|
|
2678
|
+
if (action && action.type === actionTypes_default.REPLACE)
|
|
2679
|
+
return;
|
|
2680
|
+
if (unexpectedKeys.length > 0) {
|
|
2681
|
+
return `Unexpected ${unexpectedKeys.length > 1 ? "keys" : "key"} "${unexpectedKeys.join('", "')}" found in ${argumentName}. Expected to find one of the known reducer keys instead: "${reducerKeys.join('", "')}". Unexpected keys will be ignored.`;
|
|
2493
2682
|
}
|
|
2494
|
-
return env;
|
|
2495
2683
|
}
|
|
2496
|
-
function
|
|
2497
|
-
|
|
2498
|
-
|
|
2684
|
+
function assertReducerShape(reducers) {
|
|
2685
|
+
Object.keys(reducers).forEach((key) => {
|
|
2686
|
+
const reducer = reducers[key];
|
|
2687
|
+
const initialState10 = reducer(void 0, {
|
|
2688
|
+
type: actionTypes_default.INIT
|
|
2689
|
+
});
|
|
2690
|
+
if (typeof initialState10 === "undefined") {
|
|
2691
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(12) : `The slice reducer for key "${key}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);
|
|
2692
|
+
}
|
|
2693
|
+
if (typeof reducer(void 0, {
|
|
2694
|
+
type: actionTypes_default.PROBE_UNKNOWN_ACTION()
|
|
2695
|
+
}) === "undefined") {
|
|
2696
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : `The slice reducer for key "${key}" returned undefined when probed with a random type. Don't try to handle '${actionTypes_default.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`);
|
|
2697
|
+
}
|
|
2698
|
+
});
|
|
2699
|
+
}
|
|
2700
|
+
function combineReducers(reducers) {
|
|
2701
|
+
const reducerKeys = Object.keys(reducers);
|
|
2702
|
+
const finalReducers = {};
|
|
2703
|
+
for (let i = 0; i < reducerKeys.length; i++) {
|
|
2704
|
+
const key = reducerKeys[i];
|
|
2705
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2706
|
+
if (typeof reducers[key] === "undefined") {
|
|
2707
|
+
warning(`No reducer provided for key "${key}"`);
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
if (typeof reducers[key] === "function") {
|
|
2711
|
+
finalReducers[key] = reducers[key];
|
|
2712
|
+
}
|
|
2713
|
+
}
|
|
2714
|
+
const finalReducerKeys = Object.keys(finalReducers);
|
|
2715
|
+
let unexpectedKeyCache;
|
|
2716
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2717
|
+
unexpectedKeyCache = {};
|
|
2499
2718
|
}
|
|
2500
|
-
|
|
2719
|
+
let shapeAssertionError;
|
|
2720
|
+
try {
|
|
2721
|
+
assertReducerShape(finalReducers);
|
|
2722
|
+
} catch (e) {
|
|
2723
|
+
shapeAssertionError = e;
|
|
2724
|
+
}
|
|
2725
|
+
return function combination(state = {}, action) {
|
|
2726
|
+
if (shapeAssertionError) {
|
|
2727
|
+
throw shapeAssertionError;
|
|
2728
|
+
}
|
|
2729
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2730
|
+
const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
|
2731
|
+
if (warningMessage) {
|
|
2732
|
+
warning(warningMessage);
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2735
|
+
let hasChanged = false;
|
|
2736
|
+
const nextState = {};
|
|
2737
|
+
for (let i = 0; i < finalReducerKeys.length; i++) {
|
|
2738
|
+
const key = finalReducerKeys[i];
|
|
2739
|
+
const reducer = finalReducers[key];
|
|
2740
|
+
const previousStateForKey = state[key];
|
|
2741
|
+
const nextStateForKey = reducer(previousStateForKey, action);
|
|
2742
|
+
if (typeof nextStateForKey === "undefined") {
|
|
2743
|
+
const actionType = action && action.type;
|
|
2744
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : `When called with an action of type ${actionType ? `"${String(actionType)}"` : "(unknown type)"}, the slice reducer for key "${key}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`);
|
|
2745
|
+
}
|
|
2746
|
+
nextState[key] = nextStateForKey;
|
|
2747
|
+
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
|
2748
|
+
}
|
|
2749
|
+
hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
|
|
2750
|
+
return hasChanged ? nextState : state;
|
|
2751
|
+
};
|
|
2752
|
+
}
|
|
2753
|
+
|
|
2754
|
+
// src/store/store.ts
|
|
2755
|
+
var rootReducer = combineReducers({
|
|
2756
|
+
env: env_slice_default,
|
|
2757
|
+
header: header_slice_default,
|
|
2758
|
+
navbar: navbar_slice_default,
|
|
2759
|
+
list: list_slice_default,
|
|
2760
|
+
search: search_slice_default,
|
|
2761
|
+
form: form_slice_default,
|
|
2762
|
+
breadcrumbs: breadcrums_slice_default,
|
|
2763
|
+
login: login_slice_default,
|
|
2764
|
+
excel: excel_slice_default,
|
|
2765
|
+
profile: profile_slice_default
|
|
2766
|
+
});
|
|
2767
|
+
var envStore = configureStore({
|
|
2768
|
+
reducer: rootReducer,
|
|
2769
|
+
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
2770
|
+
serializableCheck: false
|
|
2771
|
+
})
|
|
2772
|
+
});
|
|
2773
|
+
|
|
2774
|
+
// src/provider/redux-provider.tsx
|
|
2775
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
2776
|
+
|
|
2777
|
+
// src/provider/main-provider.tsx
|
|
2778
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
2779
|
+
|
|
2780
|
+
// src/provider/version-gate-provider.tsx
|
|
2781
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
2782
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
2783
|
+
import { Fragment, jsx as jsx4 } from "react/jsx-runtime";
|
|
2784
|
+
|
|
2785
|
+
// src/provider/env-provider.tsx
|
|
2786
|
+
import { createContext, useContext, useState as useState3, useCallback } from "react";
|
|
2787
|
+
|
|
2788
|
+
// src/configs/axios-client.ts
|
|
2789
|
+
import axios from "axios";
|
|
2790
|
+
|
|
2791
|
+
// src/provider/env-provider.tsx
|
|
2792
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
2793
|
+
var EnvContext = createContext(null);
|
|
2794
|
+
function useEnv() {
|
|
2795
|
+
const context = useContext(EnvContext);
|
|
2796
|
+
if (!context) {
|
|
2797
|
+
throw new Error("useEnv must be used within an EnvProvider");
|
|
2798
|
+
}
|
|
2799
|
+
return context;
|
|
2501
2800
|
}
|
|
2502
2801
|
|
|
2802
|
+
// src/provider/service-provider.tsx
|
|
2803
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
2804
|
+
|
|
2805
|
+
// src/hooks/auth/use-forgot-password.ts
|
|
2806
|
+
import { useMutation } from "@tanstack/react-query";
|
|
2807
|
+
|
|
2808
|
+
// src/hooks/auth/use-forgotpassword-sso.ts
|
|
2809
|
+
import { useMutation as useMutation2 } from "@tanstack/react-query";
|
|
2810
|
+
|
|
2811
|
+
// src/hooks/auth/use-get-provider.ts
|
|
2812
|
+
import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
2813
|
+
|
|
2814
|
+
// src/hooks/auth/use-isvalid-token.ts
|
|
2815
|
+
import { useMutation as useMutation4 } from "@tanstack/react-query";
|
|
2816
|
+
|
|
2817
|
+
// src/hooks/auth/use-login-credential.tsx
|
|
2818
|
+
import { useMutation as useMutation5 } from "@tanstack/react-query";
|
|
2819
|
+
|
|
2820
|
+
// src/hooks/auth/use-login-socical.ts
|
|
2821
|
+
import { useMutation as useMutation6 } from "@tanstack/react-query";
|
|
2822
|
+
|
|
2823
|
+
// src/hooks/auth/use-reset-password.ts
|
|
2824
|
+
import { useMutation as useMutation7 } from "@tanstack/react-query";
|
|
2825
|
+
|
|
2826
|
+
// src/hooks/auth/use-reset-password-sso.ts
|
|
2827
|
+
import { useMutation as useMutation8 } from "@tanstack/react-query";
|
|
2828
|
+
|
|
2829
|
+
// src/hooks/auth/use-update-password.ts
|
|
2830
|
+
import { useMutation as useMutation9 } from "@tanstack/react-query";
|
|
2831
|
+
|
|
2832
|
+
// src/hooks/auth/use-logout.ts
|
|
2833
|
+
import { useMutation as useMutation10 } from "@tanstack/react-query";
|
|
2834
|
+
|
|
2835
|
+
// src/hooks/auth/use-get-access-by-code.ts
|
|
2836
|
+
import { useMutation as useMutation11 } from "@tanstack/react-query";
|
|
2837
|
+
|
|
2838
|
+
// src/hooks/auth/use-validate-action-token.ts
|
|
2839
|
+
import { useMutation as useMutation12 } from "@tanstack/react-query";
|
|
2840
|
+
|
|
2841
|
+
// src/hooks/company/use-get-company-info.ts
|
|
2842
|
+
import { useMutation as useMutation13 } from "@tanstack/react-query";
|
|
2843
|
+
|
|
2844
|
+
// src/hooks/company/use-get-current-company.ts
|
|
2845
|
+
import { useMutation as useMutation14 } from "@tanstack/react-query";
|
|
2846
|
+
|
|
2847
|
+
// src/hooks/company/use-get-list-company.ts
|
|
2848
|
+
import { useQuery } from "@tanstack/react-query";
|
|
2849
|
+
|
|
2850
|
+
// src/hooks/excel/use-export-excel.ts
|
|
2851
|
+
import { useMutation as useMutation15 } from "@tanstack/react-query";
|
|
2852
|
+
|
|
2853
|
+
// src/hooks/excel/use-get-field-export.ts
|
|
2854
|
+
import { useMutation as useMutation16 } from "@tanstack/react-query";
|
|
2855
|
+
|
|
2856
|
+
// src/hooks/excel/use-get-file-excel.ts
|
|
2857
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
2858
|
+
|
|
2859
|
+
// src/hooks/excel/use-parse-preview.ts
|
|
2860
|
+
import { useMutation as useMutation17 } from "@tanstack/react-query";
|
|
2861
|
+
|
|
2862
|
+
// src/hooks/excel/use-upload-file.ts
|
|
2863
|
+
import { useMutation as useMutation18 } from "@tanstack/react-query";
|
|
2864
|
+
|
|
2865
|
+
// src/hooks/excel/use-upload-id-file.ts
|
|
2866
|
+
import { useMutation as useMutation19 } from "@tanstack/react-query";
|
|
2867
|
+
|
|
2868
|
+
// src/hooks/excel/uss-execute-import.ts
|
|
2869
|
+
import { useMutation as useMutation20 } from "@tanstack/react-query";
|
|
2870
|
+
|
|
2871
|
+
// src/hooks/form/use-change-status.ts
|
|
2872
|
+
import { useMutation as useMutation21 } from "@tanstack/react-query";
|
|
2873
|
+
|
|
2874
|
+
// src/hooks/form/use-delete-comment.ts
|
|
2875
|
+
import { useMutation as useMutation22 } from "@tanstack/react-query";
|
|
2876
|
+
|
|
2877
|
+
// src/hooks/form/use-get-comment.ts
|
|
2878
|
+
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
2879
|
+
|
|
2880
|
+
// src/hooks/form/use-get-form-view.ts
|
|
2881
|
+
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
2882
|
+
|
|
2883
|
+
// src/hooks/form/use-get-image.ts
|
|
2884
|
+
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
2885
|
+
|
|
2886
|
+
// src/hooks/form/use-send-comment.ts
|
|
2887
|
+
import { useMutation as useMutation23 } from "@tanstack/react-query";
|
|
2888
|
+
|
|
2889
|
+
// src/hooks/form/use-upload-image.ts
|
|
2890
|
+
import { useMutation as useMutation24 } from "@tanstack/react-query";
|
|
2891
|
+
|
|
2892
|
+
// src/hooks/model/use-delete.ts
|
|
2893
|
+
import { useMutation as useMutation25 } from "@tanstack/react-query";
|
|
2894
|
+
|
|
2895
|
+
// src/hooks/model/use-get-all.ts
|
|
2896
|
+
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
2897
|
+
|
|
2898
|
+
// src/hooks/model/use-get-conversion-rate.ts
|
|
2899
|
+
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
2900
|
+
|
|
2901
|
+
// src/hooks/model/use-get-currency.ts
|
|
2902
|
+
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
2903
|
+
|
|
2904
|
+
// src/hooks/model/use-get-detail.ts
|
|
2905
|
+
import { useMutation as useMutation26 } from "@tanstack/react-query";
|
|
2906
|
+
|
|
2907
|
+
// src/hooks/model/use-get-field-onchange.ts
|
|
2908
|
+
import { useQuery as useQuery9 } from "@tanstack/react-query";
|
|
2909
|
+
|
|
2910
|
+
// src/hooks/model/use-get-list-my-bank-account.ts
|
|
2911
|
+
import { useQuery as useQuery10 } from "@tanstack/react-query";
|
|
2912
|
+
|
|
2913
|
+
// src/hooks/model/use-onchange-form.ts
|
|
2914
|
+
import { useMutation as useMutation27 } from "@tanstack/react-query";
|
|
2915
|
+
|
|
2916
|
+
// src/hooks/model/use-save.ts
|
|
2917
|
+
import { useMutation as useMutation28 } from "@tanstack/react-query";
|
|
2918
|
+
|
|
2919
|
+
// src/hooks/user/use-get-profile.ts
|
|
2920
|
+
import { useMutation as useMutation29 } from "@tanstack/react-query";
|
|
2921
|
+
|
|
2922
|
+
// src/hooks/user/use-get-user.ts
|
|
2923
|
+
import { useMutation as useMutation30 } from "@tanstack/react-query";
|
|
2924
|
+
|
|
2925
|
+
// src/hooks/user/use-switch-locale.ts
|
|
2926
|
+
import { useMutation as useMutation31 } from "@tanstack/react-query";
|
|
2927
|
+
|
|
2928
|
+
// src/hooks/view/use-button.ts
|
|
2929
|
+
import { useMutation as useMutation32 } from "@tanstack/react-query";
|
|
2930
|
+
|
|
2931
|
+
// src/hooks/view/use-duplicate-record.ts
|
|
2932
|
+
import { useMutation as useMutation33 } from "@tanstack/react-query";
|
|
2933
|
+
|
|
2934
|
+
// src/hooks/view/use-get-action-detail.ts
|
|
2935
|
+
import { useQuery as useQuery11 } from "@tanstack/react-query";
|
|
2936
|
+
|
|
2937
|
+
// src/hooks/view/use-get-calendar.ts
|
|
2938
|
+
import { useQuery as useQuery12 } from "@tanstack/react-query";
|
|
2939
|
+
|
|
2940
|
+
// src/hooks/view/use-get-groups.ts
|
|
2941
|
+
import { useQuery as useQuery13 } from "@tanstack/react-query";
|
|
2942
|
+
|
|
2943
|
+
// src/hooks/view/use-get-list-data.ts
|
|
2944
|
+
import { useQuery as useQuery14 } from "@tanstack/react-query";
|
|
2945
|
+
|
|
2946
|
+
// src/hooks/view/use-get-menu.ts
|
|
2947
|
+
import { useQuery as useQuery15 } from "@tanstack/react-query";
|
|
2948
|
+
|
|
2949
|
+
// src/hooks/view/use-get-print-report.ts
|
|
2950
|
+
import { useMutation as useMutation34 } from "@tanstack/react-query";
|
|
2951
|
+
|
|
2952
|
+
// src/hooks/view/use-get-progress-bar.ts
|
|
2953
|
+
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
2954
|
+
|
|
2955
|
+
// src/hooks/view/use-get-selection.ts
|
|
2956
|
+
import { useQuery as useQuery17 } from "@tanstack/react-query";
|
|
2957
|
+
|
|
2958
|
+
// src/hooks/view/use-get-view.ts
|
|
2959
|
+
import { useQuery as useQuery18 } from "@tanstack/react-query";
|
|
2960
|
+
|
|
2961
|
+
// src/hooks/view/use-load-action.ts
|
|
2962
|
+
import { useMutation as useMutation35 } from "@tanstack/react-query";
|
|
2963
|
+
|
|
2964
|
+
// src/hooks/view/use-load-message.ts
|
|
2965
|
+
import { useQuery as useQuery19 } from "@tanstack/react-query";
|
|
2966
|
+
|
|
2967
|
+
// src/hooks/view/use-print.ts
|
|
2968
|
+
import { useMutation as useMutation36 } from "@tanstack/react-query";
|
|
2969
|
+
|
|
2970
|
+
// src/hooks/view/use-remove-row.ts
|
|
2971
|
+
import { useMutation as useMutation37 } from "@tanstack/react-query";
|
|
2972
|
+
|
|
2973
|
+
// src/hooks/view/use-resequence.ts
|
|
2974
|
+
import { useQuery as useQuery20 } from "@tanstack/react-query";
|
|
2975
|
+
|
|
2976
|
+
// src/hooks/view/use-run-action.ts
|
|
2977
|
+
import { useMutation as useMutation38 } from "@tanstack/react-query";
|
|
2978
|
+
|
|
2979
|
+
// src/hooks/view/use-signin-sso.ts
|
|
2980
|
+
import { useMutation as useMutation39 } from "@tanstack/react-query";
|
|
2981
|
+
|
|
2982
|
+
// src/hooks/view/use-verify-2FA.ts
|
|
2983
|
+
import { useMutation as useMutation40 } from "@tanstack/react-query";
|
|
2984
|
+
|
|
2985
|
+
// src/hooks/view/uset-get-2FA-method.ts
|
|
2986
|
+
import { useMutation as useMutation41 } from "@tanstack/react-query";
|
|
2987
|
+
|
|
2988
|
+
// src/hooks/view/use-grant-access.ts
|
|
2989
|
+
import { useMutation as useMutation42 } from "@tanstack/react-query";
|
|
2990
|
+
|
|
2991
|
+
// src/hooks/view/use-remove-totp-setup.ts
|
|
2992
|
+
import { useMutation as useMutation43 } from "@tanstack/react-query";
|
|
2993
|
+
|
|
2994
|
+
// src/hooks/view/use-request-setup-totp.ts
|
|
2995
|
+
import { useMutation as useMutation44 } from "@tanstack/react-query";
|
|
2996
|
+
|
|
2997
|
+
// src/hooks/view/use-settings-web-read-2fa.ts
|
|
2998
|
+
import { useMutation as useMutation45 } from "@tanstack/react-query";
|
|
2999
|
+
|
|
3000
|
+
// src/hooks/view/use-verify-totp.ts
|
|
3001
|
+
import { useMutation as useMutation46 } from "@tanstack/react-query";
|
|
3002
|
+
|
|
3003
|
+
// src/provider/service-provider.tsx
|
|
3004
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
3005
|
+
var ServiceContext = createContext2(null);
|
|
3006
|
+
|
|
2503
3007
|
// src/services/action-service/index.ts
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
3008
|
+
function useActionService() {
|
|
3009
|
+
const { env } = useEnv();
|
|
3010
|
+
const loadAction = useCallback2(
|
|
3011
|
+
async ({
|
|
3012
|
+
idAction,
|
|
3013
|
+
context
|
|
3014
|
+
}) => {
|
|
3015
|
+
const jsonData = {
|
|
3016
|
+
action_id: idAction,
|
|
3017
|
+
with_context: { ...context }
|
|
3018
|
+
};
|
|
3019
|
+
return env.requests.post("/load_action" /* LOAD_ACTION */, jsonData, {
|
|
3020
|
+
headers: { "Content-Type": "application/json" }
|
|
3021
|
+
});
|
|
3022
|
+
},
|
|
3023
|
+
[env]
|
|
3024
|
+
);
|
|
3025
|
+
const callButton = useCallback2(
|
|
3026
|
+
async ({
|
|
3027
|
+
model,
|
|
3028
|
+
ids = [],
|
|
3029
|
+
context,
|
|
3030
|
+
method
|
|
3031
|
+
}) => {
|
|
3032
|
+
try {
|
|
3033
|
+
const jsonData = {
|
|
3034
|
+
model,
|
|
3035
|
+
method,
|
|
3036
|
+
ids,
|
|
3037
|
+
with_context: context
|
|
3038
|
+
};
|
|
3039
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3040
|
+
headers: { "Content-Type": "application/json" }
|
|
3041
|
+
});
|
|
3042
|
+
} catch (error) {
|
|
3043
|
+
console.error("Error when calling button action:", error);
|
|
3044
|
+
throw error;
|
|
2520
3045
|
}
|
|
2521
|
-
}
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
try {
|
|
2531
|
-
const env2 = getEnv();
|
|
3046
|
+
},
|
|
3047
|
+
[env]
|
|
3048
|
+
);
|
|
3049
|
+
const removeRows = useCallback2(
|
|
3050
|
+
async ({
|
|
3051
|
+
model,
|
|
3052
|
+
ids,
|
|
3053
|
+
context
|
|
3054
|
+
}) => {
|
|
2532
3055
|
const jsonData = {
|
|
2533
3056
|
model,
|
|
2534
|
-
method,
|
|
3057
|
+
method: "unlink",
|
|
2535
3058
|
ids,
|
|
2536
3059
|
with_context: context
|
|
2537
3060
|
};
|
|
2538
|
-
return
|
|
2539
|
-
headers: {
|
|
2540
|
-
"Content-Type": "application/json"
|
|
2541
|
-
}
|
|
3061
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3062
|
+
headers: { "Content-Type": "application/json" }
|
|
2542
3063
|
});
|
|
2543
|
-
}
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
// remove Row
|
|
2549
|
-
async removeRows({
|
|
2550
|
-
model,
|
|
2551
|
-
ids,
|
|
2552
|
-
context
|
|
2553
|
-
}) {
|
|
2554
|
-
const env2 = getEnv();
|
|
2555
|
-
const jsonData = {
|
|
2556
|
-
model,
|
|
2557
|
-
method: "unlink",
|
|
2558
|
-
ids,
|
|
2559
|
-
with_context: context
|
|
2560
|
-
};
|
|
2561
|
-
return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
2562
|
-
headers: {
|
|
2563
|
-
"Content-Type": "application/json"
|
|
2564
|
-
}
|
|
2565
|
-
});
|
|
2566
|
-
},
|
|
2567
|
-
// Duplicate Model
|
|
2568
|
-
async duplicateRecord({
|
|
2569
|
-
model,
|
|
2570
|
-
id,
|
|
2571
|
-
context
|
|
2572
|
-
}) {
|
|
2573
|
-
const env2 = getEnv();
|
|
2574
|
-
const jsonData = {
|
|
3064
|
+
},
|
|
3065
|
+
[env]
|
|
3066
|
+
);
|
|
3067
|
+
const duplicateRecord = useCallback2(
|
|
3068
|
+
async ({
|
|
2575
3069
|
model,
|
|
2576
|
-
method: "copy",
|
|
2577
|
-
ids: id,
|
|
2578
|
-
with_context: context
|
|
2579
|
-
};
|
|
2580
|
-
return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
2581
|
-
headers: {
|
|
2582
|
-
"Content-Type": "application/json"
|
|
2583
|
-
}
|
|
2584
|
-
});
|
|
2585
|
-
},
|
|
2586
|
-
// Get Print Report
|
|
2587
|
-
async getPrintReportName({ id }) {
|
|
2588
|
-
const env2 = getEnv();
|
|
2589
|
-
const jsonData = {
|
|
2590
|
-
model: "ir.actions.report",
|
|
2591
|
-
method: "web_read",
|
|
2592
3070
|
id,
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
}
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
};
|
|
2652
|
-
|
|
3071
|
+
context
|
|
3072
|
+
}) => {
|
|
3073
|
+
const jsonData = {
|
|
3074
|
+
model,
|
|
3075
|
+
method: "copy",
|
|
3076
|
+
ids: id,
|
|
3077
|
+
with_context: context
|
|
3078
|
+
};
|
|
3079
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3080
|
+
headers: { "Content-Type": "application/json" }
|
|
3081
|
+
});
|
|
3082
|
+
},
|
|
3083
|
+
[env]
|
|
3084
|
+
);
|
|
3085
|
+
const getPrintReportName = useCallback2(
|
|
3086
|
+
async ({ id }) => {
|
|
3087
|
+
const jsonData = {
|
|
3088
|
+
model: "ir.actions.report",
|
|
3089
|
+
method: "web_read",
|
|
3090
|
+
id,
|
|
3091
|
+
kwargs: {
|
|
3092
|
+
specification: {
|
|
3093
|
+
report_name: {}
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
};
|
|
3097
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3098
|
+
headers: { "Content-Type": "application/json" }
|
|
3099
|
+
});
|
|
3100
|
+
},
|
|
3101
|
+
[env]
|
|
3102
|
+
);
|
|
3103
|
+
const print = useCallback2(
|
|
3104
|
+
async ({ id, report, db }) => {
|
|
3105
|
+
const jsonData = {
|
|
3106
|
+
report,
|
|
3107
|
+
id,
|
|
3108
|
+
type: "pdf",
|
|
3109
|
+
file_response: true,
|
|
3110
|
+
db
|
|
3111
|
+
};
|
|
3112
|
+
const queryString = toQueryString(jsonData);
|
|
3113
|
+
const urlWithParams = `${"/report" /* REPORT_PATH */}?${queryString}`;
|
|
3114
|
+
return env.requests.get(urlWithParams, {
|
|
3115
|
+
headers: { "Content-Type": "application/json" },
|
|
3116
|
+
responseType: "arraybuffer"
|
|
3117
|
+
});
|
|
3118
|
+
},
|
|
3119
|
+
[env]
|
|
3120
|
+
);
|
|
3121
|
+
const runAction = useCallback2(
|
|
3122
|
+
async ({
|
|
3123
|
+
idAction,
|
|
3124
|
+
context
|
|
3125
|
+
}) => {
|
|
3126
|
+
const jsonData = {
|
|
3127
|
+
action_id: idAction,
|
|
3128
|
+
with_context: { ...context }
|
|
3129
|
+
};
|
|
3130
|
+
return env.requests.post("/run_action" /* RUN_ACTION_PATH */, jsonData, {
|
|
3131
|
+
headers: { "Content-Type": "application/json" }
|
|
3132
|
+
});
|
|
3133
|
+
},
|
|
3134
|
+
[env]
|
|
3135
|
+
);
|
|
3136
|
+
return {
|
|
3137
|
+
loadAction,
|
|
3138
|
+
callButton,
|
|
3139
|
+
removeRows,
|
|
3140
|
+
duplicateRecord,
|
|
3141
|
+
getPrintReportName,
|
|
3142
|
+
print,
|
|
3143
|
+
runAction
|
|
3144
|
+
};
|
|
3145
|
+
}
|
|
2653
3146
|
|
|
2654
3147
|
// src/services/auth-service/index.ts
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
},
|
|
2674
|
-
async forgotPassword(email) {
|
|
2675
|
-
const env2 = getEnv();
|
|
2676
|
-
const bodyData = {
|
|
2677
|
-
login: email,
|
|
2678
|
-
url: `${window.location.origin}/reset-password`
|
|
2679
|
-
};
|
|
2680
|
-
return env2?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
|
|
2681
|
-
headers: {
|
|
2682
|
-
"Content-Type": "application/json"
|
|
2683
|
-
}
|
|
2684
|
-
});
|
|
2685
|
-
},
|
|
2686
|
-
async forgotPasswordSSO({
|
|
2687
|
-
email,
|
|
2688
|
-
with_context,
|
|
2689
|
-
method
|
|
2690
|
-
}) {
|
|
2691
|
-
const env2 = getEnv();
|
|
2692
|
-
const body = {
|
|
2693
|
-
method,
|
|
2694
|
-
kwargs: {
|
|
2695
|
-
vals: {
|
|
2696
|
-
email
|
|
3148
|
+
import { useCallback as useCallback3 } from "react";
|
|
3149
|
+
function useAuthService() {
|
|
3150
|
+
const { env } = useEnv();
|
|
3151
|
+
const login = useCallback3(
|
|
3152
|
+
async (body) => {
|
|
3153
|
+
const payload = Object.fromEntries(
|
|
3154
|
+
Object.entries({
|
|
3155
|
+
username: body.email,
|
|
3156
|
+
password: body.password,
|
|
3157
|
+
grant_type: env?.config?.grantType || "",
|
|
3158
|
+
client_id: env?.config?.clientId || "",
|
|
3159
|
+
client_secret: env?.config?.clientSecret || ""
|
|
3160
|
+
}).filter(([_, value]) => !!value)
|
|
3161
|
+
);
|
|
3162
|
+
const encodedData = new URLSearchParams(payload).toString();
|
|
3163
|
+
return env?.requests?.post(body.path, encodedData, {
|
|
3164
|
+
headers: {
|
|
3165
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
2697
3166
|
}
|
|
2698
|
-
}
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
password: data.password,
|
|
2712
|
-
new_password: data.confirmPassword
|
|
2713
|
-
};
|
|
2714
|
-
return env2?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
|
|
2715
|
-
headers: {
|
|
2716
|
-
"Content-Type": "application/json"
|
|
2717
|
-
}
|
|
2718
|
-
});
|
|
2719
|
-
},
|
|
2720
|
-
async resetPasswordSSO({
|
|
2721
|
-
method,
|
|
2722
|
-
password,
|
|
2723
|
-
with_context
|
|
2724
|
-
}) {
|
|
2725
|
-
const env2 = getEnv();
|
|
2726
|
-
const bodyData = {
|
|
2727
|
-
method,
|
|
2728
|
-
kwargs: {
|
|
2729
|
-
vals: {
|
|
2730
|
-
password
|
|
3167
|
+
});
|
|
3168
|
+
},
|
|
3169
|
+
[env]
|
|
3170
|
+
);
|
|
3171
|
+
const forgotPassword = useCallback3(
|
|
3172
|
+
async (email) => {
|
|
3173
|
+
const bodyData = {
|
|
3174
|
+
login: email,
|
|
3175
|
+
url: `${window.location.origin}/reset-password`
|
|
3176
|
+
};
|
|
3177
|
+
return env?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
|
|
3178
|
+
headers: {
|
|
3179
|
+
"Content-Type": "application/json"
|
|
2731
3180
|
}
|
|
2732
|
-
}
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
return env2?.requests?.post(
|
|
2768
|
-
path,
|
|
2769
|
-
{},
|
|
2770
|
-
{
|
|
3181
|
+
});
|
|
3182
|
+
},
|
|
3183
|
+
[env]
|
|
3184
|
+
);
|
|
3185
|
+
const forgotPasswordSSO = useCallback3(
|
|
3186
|
+
async ({
|
|
3187
|
+
email,
|
|
3188
|
+
with_context,
|
|
3189
|
+
method
|
|
3190
|
+
}) => {
|
|
3191
|
+
const body = {
|
|
3192
|
+
method,
|
|
3193
|
+
kwargs: {
|
|
3194
|
+
vals: {
|
|
3195
|
+
email
|
|
3196
|
+
}
|
|
3197
|
+
},
|
|
3198
|
+
with_context
|
|
3199
|
+
};
|
|
3200
|
+
return env?.requests?.post("/call" /* CALL_PATH */, body, {
|
|
3201
|
+
headers: {
|
|
3202
|
+
"Content-Type": "application/json"
|
|
3203
|
+
}
|
|
3204
|
+
});
|
|
3205
|
+
},
|
|
3206
|
+
[env]
|
|
3207
|
+
);
|
|
3208
|
+
const resetPassword = useCallback3(
|
|
3209
|
+
async (data, token) => {
|
|
3210
|
+
const bodyData = {
|
|
3211
|
+
token,
|
|
3212
|
+
password: data.password,
|
|
3213
|
+
new_password: data.confirmPassword
|
|
3214
|
+
};
|
|
3215
|
+
return env?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
|
|
2771
3216
|
headers: {
|
|
2772
3217
|
"Content-Type": "application/json"
|
|
3218
|
+
}
|
|
3219
|
+
});
|
|
3220
|
+
},
|
|
3221
|
+
[env]
|
|
3222
|
+
);
|
|
3223
|
+
const resetPasswordSSO = useCallback3(
|
|
3224
|
+
async ({
|
|
3225
|
+
method,
|
|
3226
|
+
password,
|
|
3227
|
+
with_context
|
|
3228
|
+
}) => {
|
|
3229
|
+
const bodyData = {
|
|
3230
|
+
method,
|
|
3231
|
+
kwargs: {
|
|
3232
|
+
vals: {
|
|
3233
|
+
password
|
|
3234
|
+
}
|
|
2773
3235
|
},
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
);
|
|
2778
|
-
},
|
|
2779
|
-
async loginSocial({
|
|
2780
|
-
db,
|
|
2781
|
-
state,
|
|
2782
|
-
access_token
|
|
2783
|
-
}) {
|
|
2784
|
-
const env2 = getEnv();
|
|
2785
|
-
return env2?.requests?.post(
|
|
2786
|
-
"/token/generate" /* GENTOKEN_SOCIAL */,
|
|
2787
|
-
{ state, access_token },
|
|
2788
|
-
{
|
|
3236
|
+
with_context
|
|
3237
|
+
};
|
|
3238
|
+
return env?.requests?.post("/call" /* CALL_PATH */, bodyData, {
|
|
2789
3239
|
headers: {
|
|
2790
3240
|
"Content-Type": "application/json"
|
|
2791
3241
|
}
|
|
2792
|
-
}
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
data.append("client_id", env2?.config?.clientId || "");
|
|
2805
|
-
data.append("redirect_uri", env2?.config?.redirectUri || "");
|
|
2806
|
-
return env2?.requests?.post(
|
|
2807
|
-
`${env2?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
|
|
2808
|
-
data,
|
|
2809
|
-
{
|
|
3242
|
+
});
|
|
3243
|
+
},
|
|
3244
|
+
[env]
|
|
3245
|
+
);
|
|
3246
|
+
const updatePassword = useCallback3(
|
|
3247
|
+
async (data, token) => {
|
|
3248
|
+
const bodyData = {
|
|
3249
|
+
token,
|
|
3250
|
+
old_password: data.oldPassword,
|
|
3251
|
+
new_password: data.newPassword
|
|
3252
|
+
};
|
|
3253
|
+
return env?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
|
|
2810
3254
|
headers: {
|
|
2811
|
-
"Content-Type": "application/
|
|
3255
|
+
"Content-Type": "application/json"
|
|
2812
3256
|
}
|
|
2813
|
-
}
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
{
|
|
3257
|
+
});
|
|
3258
|
+
},
|
|
3259
|
+
[env]
|
|
3260
|
+
);
|
|
3261
|
+
const isValidToken = useCallback3(
|
|
3262
|
+
async (token) => {
|
|
3263
|
+
const bodyData = {
|
|
3264
|
+
token
|
|
3265
|
+
};
|
|
3266
|
+
return env?.requests?.post("/check_token" /* TOKEN */, bodyData, {
|
|
2823
3267
|
headers: {
|
|
2824
3268
|
"Content-Type": "application/json"
|
|
2825
|
-
}
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
3269
|
+
}
|
|
3270
|
+
});
|
|
3271
|
+
},
|
|
3272
|
+
[env]
|
|
3273
|
+
);
|
|
3274
|
+
const isValidActionToken = useCallback3(
|
|
3275
|
+
async (actionToken, path) => {
|
|
3276
|
+
return env?.requests?.post(
|
|
3277
|
+
path,
|
|
3278
|
+
{},
|
|
3279
|
+
{
|
|
3280
|
+
headers: {
|
|
3281
|
+
"Content-Type": "application/json"
|
|
3282
|
+
},
|
|
3283
|
+
useActionToken: true,
|
|
3284
|
+
actionToken
|
|
3285
|
+
}
|
|
3286
|
+
);
|
|
3287
|
+
},
|
|
3288
|
+
[env]
|
|
3289
|
+
);
|
|
3290
|
+
const loginSocial = useCallback3(
|
|
3291
|
+
async ({
|
|
3292
|
+
db,
|
|
3293
|
+
state,
|
|
3294
|
+
access_token
|
|
3295
|
+
}) => {
|
|
3296
|
+
return env?.requests?.post(
|
|
3297
|
+
"/token/generate" /* GENTOKEN_SOCIAL */,
|
|
3298
|
+
{ state, access_token },
|
|
3299
|
+
{
|
|
3300
|
+
headers: {
|
|
3301
|
+
"Content-Type": "application/json"
|
|
3302
|
+
}
|
|
3303
|
+
}
|
|
3304
|
+
);
|
|
3305
|
+
},
|
|
3306
|
+
[env]
|
|
3307
|
+
);
|
|
3308
|
+
const getProviders = useCallback3(
|
|
3309
|
+
async (db) => {
|
|
3310
|
+
return env?.requests?.get("/oauth/providers", { params: { db } });
|
|
3311
|
+
},
|
|
3312
|
+
[env]
|
|
3313
|
+
);
|
|
3314
|
+
const getAccessByCode = useCallback3(
|
|
3315
|
+
async (code) => {
|
|
3316
|
+
const data = new URLSearchParams();
|
|
3317
|
+
data.append("code", code);
|
|
3318
|
+
data.append("grant_type", "authorization_code");
|
|
3319
|
+
data.append("client_id", env?.config?.clientId || "");
|
|
3320
|
+
data.append("redirect_uri", env?.config?.redirectUri || "");
|
|
3321
|
+
return env?.requests?.post(
|
|
3322
|
+
`${env?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
|
|
3323
|
+
data,
|
|
3324
|
+
{
|
|
3325
|
+
headers: {
|
|
3326
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
3327
|
+
}
|
|
3328
|
+
}
|
|
3329
|
+
);
|
|
3330
|
+
},
|
|
3331
|
+
[env]
|
|
3332
|
+
);
|
|
3333
|
+
const logout = useCallback3(
|
|
3334
|
+
async (data) => {
|
|
3335
|
+
console.log(data);
|
|
3336
|
+
return env?.requests?.post(
|
|
3337
|
+
"/logout" /* LOGOUT */,
|
|
3338
|
+
{},
|
|
3339
|
+
{
|
|
3340
|
+
headers: {
|
|
3341
|
+
"Content-Type": "application/json"
|
|
3342
|
+
},
|
|
3343
|
+
withCredentials: true,
|
|
3344
|
+
useRefreshToken: true
|
|
3345
|
+
}
|
|
3346
|
+
);
|
|
3347
|
+
},
|
|
3348
|
+
[env]
|
|
3349
|
+
);
|
|
3350
|
+
return {
|
|
3351
|
+
login,
|
|
3352
|
+
forgotPassword,
|
|
3353
|
+
forgotPasswordSSO,
|
|
3354
|
+
resetPassword,
|
|
3355
|
+
resetPasswordSSO,
|
|
3356
|
+
updatePassword,
|
|
3357
|
+
isValidToken,
|
|
3358
|
+
isValidActionToken,
|
|
3359
|
+
loginSocial,
|
|
3360
|
+
getProviders,
|
|
3361
|
+
getAccessByCode,
|
|
3362
|
+
logout
|
|
3363
|
+
};
|
|
3364
|
+
}
|
|
2833
3365
|
|
|
2834
3366
|
// src/services/company-service/index.ts
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
3367
|
+
import { useCallback as useCallback4 } from "react";
|
|
3368
|
+
function useCompanyService() {
|
|
3369
|
+
const { env } = useEnv();
|
|
3370
|
+
const getCurrentCompany = useCallback4(async () => {
|
|
3371
|
+
return await env.requests.get("/company" /* COMPANY_PATH */, {
|
|
2839
3372
|
headers: {
|
|
2840
3373
|
"Content-Type": "application/json"
|
|
2841
3374
|
}
|
|
2842
3375
|
});
|
|
2843
|
-
},
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
3376
|
+
}, [env]);
|
|
3377
|
+
const getInfoCompany = useCallback4(
|
|
3378
|
+
async (id) => {
|
|
3379
|
+
const jsonData = {
|
|
3380
|
+
ids: [id],
|
|
3381
|
+
model: "res.company" /* COMPANY */,
|
|
3382
|
+
method: "web_read" /* WEB_READ */,
|
|
3383
|
+
kwargs: {
|
|
3384
|
+
specification: {
|
|
3385
|
+
primary_color: {},
|
|
3386
|
+
secondary_color: {},
|
|
3387
|
+
logo: {},
|
|
3388
|
+
display_name: {},
|
|
3389
|
+
secondary_logo: {}
|
|
3390
|
+
}
|
|
2857
3391
|
}
|
|
2858
|
-
}
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
}
|
|
2864
|
-
}
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
3392
|
+
};
|
|
3393
|
+
return await env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3394
|
+
headers: {
|
|
3395
|
+
"Content-Type": "application/json"
|
|
3396
|
+
}
|
|
3397
|
+
});
|
|
3398
|
+
},
|
|
3399
|
+
[env]
|
|
3400
|
+
);
|
|
3401
|
+
return {
|
|
3402
|
+
getCurrentCompany,
|
|
3403
|
+
getInfoCompany
|
|
3404
|
+
};
|
|
3405
|
+
}
|
|
2868
3406
|
|
|
2869
3407
|
// src/services/excel-service/index.ts
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
},
|
|
2879
|
-
async uploadIdFile({ formData }) {
|
|
2880
|
-
const env2 = getEnv();
|
|
2881
|
-
return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
|
|
2882
|
-
headers: {
|
|
2883
|
-
"Content-Type": "multipart/form-data"
|
|
2884
|
-
}
|
|
2885
|
-
});
|
|
2886
|
-
},
|
|
2887
|
-
async parsePreview({
|
|
2888
|
-
id,
|
|
2889
|
-
selectedSheet,
|
|
2890
|
-
isHeader,
|
|
2891
|
-
context
|
|
2892
|
-
}) {
|
|
2893
|
-
const env2 = getEnv();
|
|
2894
|
-
const jsonData = {
|
|
2895
|
-
model: "base_import.import" /* BASE_IMPORT */,
|
|
2896
|
-
method: "parse_preview",
|
|
2897
|
-
ids: [id],
|
|
2898
|
-
kwargs: {
|
|
2899
|
-
options: {
|
|
2900
|
-
import_skip_records: [],
|
|
2901
|
-
import_set_empty_fields: [],
|
|
2902
|
-
fallback_values: {},
|
|
2903
|
-
name_create_enabled_fields: {},
|
|
2904
|
-
encoding: "",
|
|
2905
|
-
separator: "",
|
|
2906
|
-
quoting: '"',
|
|
2907
|
-
date_format: "",
|
|
2908
|
-
datetime_format: "",
|
|
2909
|
-
float_thousand_separator: ",",
|
|
2910
|
-
float_decimal_separator: ".",
|
|
2911
|
-
advanced: true,
|
|
2912
|
-
has_headers: isHeader,
|
|
2913
|
-
keep_matches: false,
|
|
2914
|
-
limit: 2e3,
|
|
2915
|
-
sheets: [],
|
|
2916
|
-
sheet: selectedSheet,
|
|
2917
|
-
skip: 0,
|
|
2918
|
-
tracking_disable: true
|
|
3408
|
+
import { useCallback as useCallback5 } from "react";
|
|
3409
|
+
function useExcelService() {
|
|
3410
|
+
const { env } = useEnv();
|
|
3411
|
+
const uploadFile = useCallback5(
|
|
3412
|
+
async ({ formData }) => {
|
|
3413
|
+
return env.requests.post("/upload/file" /* UPLOAD_FILE_PATH */, formData, {
|
|
3414
|
+
headers: {
|
|
3415
|
+
"Content-Type": "multipart/form-data"
|
|
2919
3416
|
}
|
|
2920
|
-
}
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
3417
|
+
});
|
|
3418
|
+
},
|
|
3419
|
+
[env]
|
|
3420
|
+
);
|
|
3421
|
+
const uploadIdFile = useCallback5(
|
|
3422
|
+
async ({ formData }) => {
|
|
3423
|
+
return env.requests.post("/upload/file" /* UPLOAD_FILE_PATH */, formData, {
|
|
3424
|
+
headers: {
|
|
3425
|
+
"Content-Type": "multipart/form-data"
|
|
3426
|
+
}
|
|
3427
|
+
});
|
|
3428
|
+
},
|
|
3429
|
+
[env]
|
|
3430
|
+
);
|
|
3431
|
+
const parsePreview = useCallback5(
|
|
3432
|
+
async ({
|
|
3433
|
+
id,
|
|
3434
|
+
selectedSheet,
|
|
3435
|
+
isHeader,
|
|
3436
|
+
context
|
|
3437
|
+
}) => {
|
|
3438
|
+
const jsonData = {
|
|
3439
|
+
model: "base_import.import" /* BASE_IMPORT */,
|
|
3440
|
+
method: "parse_preview",
|
|
3441
|
+
ids: [id],
|
|
3442
|
+
kwargs: {
|
|
3443
|
+
options: {
|
|
3444
|
+
import_skip_records: [],
|
|
3445
|
+
import_set_empty_fields: [],
|
|
3446
|
+
fallback_values: {},
|
|
3447
|
+
name_create_enabled_fields: {},
|
|
3448
|
+
encoding: "",
|
|
3449
|
+
separator: "",
|
|
3450
|
+
quoting: '"',
|
|
3451
|
+
date_format: "",
|
|
3452
|
+
datetime_format: "",
|
|
3453
|
+
float_thousand_separator: ",",
|
|
3454
|
+
float_decimal_separator: ".",
|
|
3455
|
+
advanced: true,
|
|
3456
|
+
has_headers: isHeader,
|
|
3457
|
+
keep_matches: false,
|
|
3458
|
+
limit: 2e3,
|
|
3459
|
+
sheets: [],
|
|
3460
|
+
sheet: selectedSheet,
|
|
3461
|
+
skip: 0,
|
|
3462
|
+
tracking_disable: true
|
|
3463
|
+
}
|
|
3464
|
+
},
|
|
3465
|
+
with_context: context
|
|
3466
|
+
};
|
|
3467
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3468
|
+
headers: {
|
|
3469
|
+
"Content-Type": "multipart/form-data"
|
|
3470
|
+
}
|
|
3471
|
+
});
|
|
3472
|
+
},
|
|
3473
|
+
[env]
|
|
3474
|
+
);
|
|
3475
|
+
const executeImport = useCallback5(
|
|
3476
|
+
async ({
|
|
3477
|
+
columns,
|
|
3478
|
+
fields,
|
|
3479
|
+
idFile,
|
|
3480
|
+
options,
|
|
3481
|
+
dryrun,
|
|
3482
|
+
context
|
|
3483
|
+
}) => {
|
|
3484
|
+
const jsonData = {
|
|
3485
|
+
model: "base_import.import" /* BASE_IMPORT */,
|
|
3486
|
+
method: "execute_import",
|
|
3487
|
+
ids: [idFile],
|
|
3488
|
+
kwargs: {
|
|
3489
|
+
fields,
|
|
3490
|
+
columns,
|
|
3491
|
+
options,
|
|
3492
|
+
dryrun
|
|
3493
|
+
},
|
|
3494
|
+
with_context: context
|
|
3495
|
+
};
|
|
3496
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3497
|
+
headers: {
|
|
3498
|
+
"Content-Type": "multipart/form-data"
|
|
3499
|
+
}
|
|
3500
|
+
});
|
|
3501
|
+
},
|
|
3502
|
+
[env]
|
|
3503
|
+
);
|
|
3504
|
+
const getFileExcel = useCallback5(
|
|
3505
|
+
async ({ model }) => {
|
|
3506
|
+
const jsonData = {
|
|
3507
|
+
model,
|
|
3508
|
+
method: "get_import_templates" /* GET_IMPORT */,
|
|
3509
|
+
args: []
|
|
3510
|
+
};
|
|
3511
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData);
|
|
3512
|
+
},
|
|
3513
|
+
[env]
|
|
3514
|
+
);
|
|
3515
|
+
const getFieldExport = useCallback5(
|
|
3516
|
+
async ({
|
|
3517
|
+
ids,
|
|
2979
3518
|
model,
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
jsonData
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3519
|
+
isShow,
|
|
3520
|
+
parentField,
|
|
3521
|
+
fieldType,
|
|
3522
|
+
parentName,
|
|
3523
|
+
prefix,
|
|
3524
|
+
name,
|
|
3525
|
+
context,
|
|
3526
|
+
importCompat
|
|
3527
|
+
}) => {
|
|
3528
|
+
const jsonData = {
|
|
3529
|
+
model,
|
|
3530
|
+
import_compat: importCompat,
|
|
3531
|
+
domain: [["id", "in", ids]],
|
|
3532
|
+
with_context: context
|
|
3533
|
+
};
|
|
3534
|
+
if (isShow) {
|
|
3535
|
+
jsonData.parent_field = parentField;
|
|
3536
|
+
jsonData.parent_field_type = fieldType;
|
|
3537
|
+
jsonData.parent_name = parentName;
|
|
3538
|
+
jsonData.name = name;
|
|
3539
|
+
jsonData.prefix = prefix;
|
|
3540
|
+
jsonData.exclude = [null];
|
|
3541
|
+
}
|
|
3542
|
+
return env.requests.post("/export/get_fields", jsonData);
|
|
3543
|
+
},
|
|
3544
|
+
[env]
|
|
3545
|
+
);
|
|
3546
|
+
const exportExcel = useCallback5(
|
|
3547
|
+
async ({
|
|
3006
3548
|
model,
|
|
3007
3549
|
domain,
|
|
3008
3550
|
ids,
|
|
3009
|
-
import_compat: importCompat,
|
|
3010
3551
|
fields,
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3552
|
+
type,
|
|
3553
|
+
importCompat,
|
|
3554
|
+
context,
|
|
3555
|
+
groupby
|
|
3556
|
+
}) => {
|
|
3557
|
+
const jsonData = {
|
|
3558
|
+
model,
|
|
3559
|
+
domain,
|
|
3560
|
+
ids,
|
|
3561
|
+
import_compat: importCompat,
|
|
3562
|
+
fields,
|
|
3563
|
+
with_context: context,
|
|
3564
|
+
groupby: groupby ?? []
|
|
3565
|
+
};
|
|
3566
|
+
return env.requests.post_excel(`/export/${type}`, jsonData);
|
|
3567
|
+
},
|
|
3568
|
+
[env]
|
|
3569
|
+
);
|
|
3570
|
+
return {
|
|
3571
|
+
uploadFile,
|
|
3572
|
+
uploadIdFile,
|
|
3573
|
+
parsePreview,
|
|
3574
|
+
executeImport,
|
|
3575
|
+
getFileExcel,
|
|
3576
|
+
getFieldExport,
|
|
3577
|
+
exportExcel
|
|
3578
|
+
};
|
|
3579
|
+
}
|
|
3018
3580
|
|
|
3019
3581
|
// src/services/form-service/index.ts
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3582
|
+
import { useCallback as useCallback6 } from "react";
|
|
3583
|
+
function useFormService() {
|
|
3584
|
+
const { env } = useEnv();
|
|
3585
|
+
const getComment = useCallback6(
|
|
3586
|
+
async ({ data }) => {
|
|
3024
3587
|
const jsonData = {
|
|
3025
3588
|
thread_id: data.thread_id,
|
|
3026
3589
|
thread_model: data.thread_model,
|
|
@@ -3029,19 +3592,16 @@ var FormService = {
|
|
|
3029
3592
|
lang: data.lang
|
|
3030
3593
|
}
|
|
3031
3594
|
};
|
|
3032
|
-
return
|
|
3595
|
+
return env.requests.post("/chatter/thread/messages" /* GET_MESSAGE */, jsonData, {
|
|
3033
3596
|
headers: {
|
|
3034
3597
|
"Content-Type": "application/json"
|
|
3035
3598
|
}
|
|
3036
3599
|
});
|
|
3037
|
-
}
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
async sentComment({ data }) {
|
|
3043
|
-
try {
|
|
3044
|
-
const env2 = getEnv();
|
|
3600
|
+
},
|
|
3601
|
+
[env]
|
|
3602
|
+
);
|
|
3603
|
+
const sentComment = useCallback6(
|
|
3604
|
+
async ({ data }) => {
|
|
3045
3605
|
const jsonData = {
|
|
3046
3606
|
context: {
|
|
3047
3607
|
tz: "Asia/Saigon",
|
|
@@ -3060,39 +3620,33 @@ var FormService = {
|
|
|
3060
3620
|
thread_id: Number(data.thread_id),
|
|
3061
3621
|
thread_model: data.thread_model
|
|
3062
3622
|
};
|
|
3063
|
-
return
|
|
3623
|
+
return env.requests.post("/chatter/message/post" /* SENT_MESSAGE */, jsonData, {
|
|
3064
3624
|
headers: {
|
|
3065
3625
|
"Content-Type": "application/json"
|
|
3066
3626
|
}
|
|
3067
3627
|
});
|
|
3068
|
-
}
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
async deleteComment({ data }) {
|
|
3074
|
-
try {
|
|
3075
|
-
const env2 = getEnv();
|
|
3628
|
+
},
|
|
3629
|
+
[env]
|
|
3630
|
+
);
|
|
3631
|
+
const deleteComment = useCallback6(
|
|
3632
|
+
async ({ data }) => {
|
|
3076
3633
|
const jsonData = {
|
|
3077
3634
|
attachment_ids: [],
|
|
3078
3635
|
attachment_tokens: [],
|
|
3079
3636
|
body: "",
|
|
3080
3637
|
message_id: data.message_id
|
|
3081
3638
|
};
|
|
3082
|
-
return
|
|
3639
|
+
return env.requests.post("/chatter/message/update_content" /* DELETE_MESSAGE */, jsonData, {
|
|
3083
3640
|
headers: {
|
|
3084
3641
|
"Content-Type": "application/json"
|
|
3085
3642
|
}
|
|
3086
3643
|
});
|
|
3087
|
-
}
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
try {
|
|
3094
|
-
const env2 = getEnv();
|
|
3095
|
-
return env2.requests.get(
|
|
3644
|
+
},
|
|
3645
|
+
[env]
|
|
3646
|
+
);
|
|
3647
|
+
const getImage = useCallback6(
|
|
3648
|
+
async ({ data }) => {
|
|
3649
|
+
return env.requests.get(
|
|
3096
3650
|
`${"/web/image" /* IMAGE_PATH */}?filename=${data.filename}&unique=${data.checksum}&width=1920&height=300`,
|
|
3097
3651
|
{
|
|
3098
3652
|
headers: {
|
|
@@ -3100,384 +3654,400 @@ var FormService = {
|
|
|
3100
3654
|
}
|
|
3101
3655
|
}
|
|
3102
3656
|
);
|
|
3103
|
-
}
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
try {
|
|
3110
|
-
const env2 = getEnv();
|
|
3111
|
-
return env2.requests.post("/mail/attachment/upload" /* UPLOAD_IMAGE */, data, {
|
|
3657
|
+
},
|
|
3658
|
+
[env]
|
|
3659
|
+
);
|
|
3660
|
+
const uploadImage = useCallback6(
|
|
3661
|
+
async ({ data }) => {
|
|
3662
|
+
return env.requests.post("/mail/attachment/upload" /* UPLOAD_IMAGE */, data, {
|
|
3112
3663
|
headers: {
|
|
3113
3664
|
"Content-Type": "multipart/form-data"
|
|
3114
3665
|
}
|
|
3115
3666
|
});
|
|
3116
|
-
}
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
async getFormView({ data }) {
|
|
3122
|
-
try {
|
|
3123
|
-
const env2 = getEnv();
|
|
3667
|
+
},
|
|
3668
|
+
[env]
|
|
3669
|
+
);
|
|
3670
|
+
const getFormView = useCallback6(
|
|
3671
|
+
async ({ data }) => {
|
|
3124
3672
|
const jsonData = {
|
|
3125
3673
|
model: data.model,
|
|
3126
3674
|
method: "get_formview_action",
|
|
3127
3675
|
ids: data.id ? [data.id] : [],
|
|
3128
3676
|
with_context: data.context
|
|
3129
3677
|
};
|
|
3130
|
-
return
|
|
3678
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3131
3679
|
headers: {
|
|
3132
3680
|
"Content-Type": "application/json"
|
|
3133
3681
|
}
|
|
3134
3682
|
});
|
|
3135
|
-
}
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
vals,
|
|
3158
|
-
specification: {}
|
|
3159
|
-
}
|
|
3160
|
-
};
|
|
3161
|
-
return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3162
|
-
headers: {
|
|
3163
|
-
"Content-Type": "application/json"
|
|
3164
|
-
}
|
|
3165
|
-
});
|
|
3166
|
-
}
|
|
3167
|
-
};
|
|
3168
|
-
var form_service_default = FormService;
|
|
3169
|
-
|
|
3170
|
-
// src/services/kanban-service/index.ts
|
|
3171
|
-
var KanbanServices = {
|
|
3172
|
-
async getGroups({
|
|
3173
|
-
model,
|
|
3174
|
-
width_context
|
|
3175
|
-
}) {
|
|
3176
|
-
const env2 = getEnv();
|
|
3177
|
-
const jsonDataView = {
|
|
3178
|
-
model,
|
|
3179
|
-
method: "web_read_group",
|
|
3180
|
-
kwargs: {
|
|
3181
|
-
domain: [["stage_id.fold", "=", false]],
|
|
3182
|
-
fields: ["color:sum"],
|
|
3183
|
-
groupby: ["stage_id"]
|
|
3184
|
-
},
|
|
3185
|
-
width_context
|
|
3186
|
-
};
|
|
3187
|
-
return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
|
|
3188
|
-
headers: {
|
|
3189
|
-
"Content-Type": "application/json"
|
|
3190
|
-
}
|
|
3191
|
-
});
|
|
3192
|
-
},
|
|
3193
|
-
async getProgressBar({
|
|
3194
|
-
field,
|
|
3195
|
-
color,
|
|
3196
|
-
model,
|
|
3197
|
-
width_context
|
|
3198
|
-
}) {
|
|
3199
|
-
const env2 = getEnv();
|
|
3200
|
-
const jsonDataView = {
|
|
3201
|
-
model,
|
|
3202
|
-
method: "read_progress_bar",
|
|
3203
|
-
kwargs: {
|
|
3204
|
-
domain: [],
|
|
3205
|
-
group_by: "stage_id",
|
|
3206
|
-
progress_bar: {
|
|
3207
|
-
colors: color,
|
|
3208
|
-
field
|
|
3683
|
+
},
|
|
3684
|
+
[env]
|
|
3685
|
+
);
|
|
3686
|
+
const changeStatus = useCallback6(
|
|
3687
|
+
async ({ data }) => {
|
|
3688
|
+
const vals = {
|
|
3689
|
+
[data.name]: data.stage_id
|
|
3690
|
+
};
|
|
3691
|
+
const jsonData = {
|
|
3692
|
+
model: data.model,
|
|
3693
|
+
method: "web_save",
|
|
3694
|
+
with_context: {
|
|
3695
|
+
lang: data.lang,
|
|
3696
|
+
allowed_company_ids: [1],
|
|
3697
|
+
uid: 2,
|
|
3698
|
+
search_default_my_ticket: true,
|
|
3699
|
+
search_default_is_open: true
|
|
3700
|
+
},
|
|
3701
|
+
ids: [data.id],
|
|
3702
|
+
kwargs: {
|
|
3703
|
+
vals,
|
|
3704
|
+
specification: {}
|
|
3209
3705
|
}
|
|
3210
|
-
}
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3706
|
+
};
|
|
3707
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3708
|
+
headers: {
|
|
3709
|
+
"Content-Type": "application/json"
|
|
3710
|
+
}
|
|
3711
|
+
});
|
|
3712
|
+
},
|
|
3713
|
+
[env]
|
|
3714
|
+
);
|
|
3715
|
+
return {
|
|
3716
|
+
getComment,
|
|
3717
|
+
sentComment,
|
|
3718
|
+
deleteComment,
|
|
3719
|
+
getImage,
|
|
3720
|
+
uploadImage,
|
|
3721
|
+
getFormView,
|
|
3722
|
+
changeStatus
|
|
3723
|
+
};
|
|
3724
|
+
}
|
|
3221
3725
|
|
|
3222
|
-
// src/services/
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
specification: spectification,
|
|
3236
|
-
domain,
|
|
3237
|
-
limit: 100,
|
|
3238
|
-
offset: 0
|
|
3239
|
-
}
|
|
3240
|
-
};
|
|
3241
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3242
|
-
headers: {
|
|
3243
|
-
"Content-Type": "application/json"
|
|
3244
|
-
}
|
|
3245
|
-
});
|
|
3246
|
-
},
|
|
3247
|
-
async getCurrency() {
|
|
3248
|
-
const env2 = getEnv();
|
|
3249
|
-
const jsonData = {
|
|
3250
|
-
model: "res.currency",
|
|
3251
|
-
method: "web_search_read",
|
|
3252
|
-
kwargs: {
|
|
3253
|
-
specification: {
|
|
3254
|
-
icon_url: {},
|
|
3255
|
-
name: {}
|
|
3726
|
+
// src/services/kanban-service/index.ts
|
|
3727
|
+
import { useCallback as useCallback7 } from "react";
|
|
3728
|
+
function useKanbanService() {
|
|
3729
|
+
const { env } = useEnv();
|
|
3730
|
+
const getGroups = useCallback7(
|
|
3731
|
+
async ({ model, width_context }) => {
|
|
3732
|
+
const jsonData = {
|
|
3733
|
+
model,
|
|
3734
|
+
method: "web_read_group",
|
|
3735
|
+
kwargs: {
|
|
3736
|
+
domain: [["stage_id.fold", "=", false]],
|
|
3737
|
+
fields: ["color:sum"],
|
|
3738
|
+
groupby: ["stage_id"]
|
|
3256
3739
|
},
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
fields: {
|
|
3279
|
-
company_rate: {},
|
|
3280
|
-
sell: {}
|
|
3281
|
-
}
|
|
3740
|
+
width_context
|
|
3741
|
+
};
|
|
3742
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3743
|
+
headers: {
|
|
3744
|
+
"Content-Type": "application/json"
|
|
3745
|
+
}
|
|
3746
|
+
});
|
|
3747
|
+
},
|
|
3748
|
+
[env]
|
|
3749
|
+
);
|
|
3750
|
+
const getProgressBar = useCallback7(
|
|
3751
|
+
async ({ field, color, model, width_context }) => {
|
|
3752
|
+
const jsonData = {
|
|
3753
|
+
model,
|
|
3754
|
+
method: "read_progress_bar",
|
|
3755
|
+
kwargs: {
|
|
3756
|
+
domain: [],
|
|
3757
|
+
group_by: "stage_id",
|
|
3758
|
+
progress_bar: {
|
|
3759
|
+
colors: color,
|
|
3760
|
+
field
|
|
3282
3761
|
}
|
|
3283
3762
|
},
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
}
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
order: data.sort,
|
|
3331
|
-
specification: data.specification
|
|
3332
|
-
};
|
|
3333
|
-
const jsonData = {
|
|
3334
|
-
model: String(data.model),
|
|
3335
|
-
method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
|
|
3336
|
-
ids: data.ids,
|
|
3337
|
-
with_context: data.context,
|
|
3338
|
-
kwargs: {
|
|
3339
|
-
domain: data.domain,
|
|
3340
|
-
limit: data.limit,
|
|
3341
|
-
offset: data.offset,
|
|
3342
|
-
fields: data.fields,
|
|
3343
|
-
...jsonReadGroup
|
|
3344
|
-
}
|
|
3345
|
-
};
|
|
3346
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3347
|
-
headers: {
|
|
3348
|
-
"Content-Type": "application/json"
|
|
3349
|
-
}
|
|
3350
|
-
});
|
|
3351
|
-
},
|
|
3352
|
-
async getList({
|
|
3353
|
-
model,
|
|
3354
|
-
ids = [],
|
|
3355
|
-
specification = {},
|
|
3356
|
-
domain = [],
|
|
3357
|
-
offset,
|
|
3358
|
-
order,
|
|
3359
|
-
context = {},
|
|
3360
|
-
limit = 10
|
|
3361
|
-
}) {
|
|
3362
|
-
const env2 = getEnv();
|
|
3363
|
-
const jsonData = {
|
|
3364
|
-
model,
|
|
3365
|
-
method: "web_search_read" /* WEB_SEARCH_READ */,
|
|
3366
|
-
ids,
|
|
3367
|
-
with_context: context,
|
|
3368
|
-
kwargs: {
|
|
3369
|
-
specification,
|
|
3370
|
-
domain,
|
|
3371
|
-
limit,
|
|
3372
|
-
offset,
|
|
3373
|
-
order
|
|
3374
|
-
}
|
|
3375
|
-
};
|
|
3376
|
-
return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
3377
|
-
headers: {
|
|
3378
|
-
"Content-Type": "application/json"
|
|
3379
|
-
}
|
|
3380
|
-
});
|
|
3381
|
-
},
|
|
3382
|
-
async getDetail({
|
|
3383
|
-
ids = [],
|
|
3384
|
-
model,
|
|
3385
|
-
specification,
|
|
3386
|
-
context
|
|
3387
|
-
}) {
|
|
3388
|
-
const env2 = getEnv();
|
|
3763
|
+
width_context
|
|
3764
|
+
};
|
|
3765
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3766
|
+
headers: {
|
|
3767
|
+
"Content-Type": "application/json"
|
|
3768
|
+
}
|
|
3769
|
+
});
|
|
3770
|
+
},
|
|
3771
|
+
[env]
|
|
3772
|
+
);
|
|
3773
|
+
return {
|
|
3774
|
+
getGroups,
|
|
3775
|
+
getProgressBar
|
|
3776
|
+
};
|
|
3777
|
+
}
|
|
3778
|
+
|
|
3779
|
+
// src/services/model-service/index.ts
|
|
3780
|
+
import { useCallback as useCallback8 } from "react";
|
|
3781
|
+
var OBJECT_POSITION = 2;
|
|
3782
|
+
function useModelService() {
|
|
3783
|
+
const { env } = useEnv();
|
|
3784
|
+
const getListMyBankAccount = useCallback8(
|
|
3785
|
+
async ({
|
|
3786
|
+
domain,
|
|
3787
|
+
spectification,
|
|
3788
|
+
model
|
|
3789
|
+
}) => {
|
|
3790
|
+
const jsonData = {
|
|
3791
|
+
model,
|
|
3792
|
+
method: "web_search_read",
|
|
3793
|
+
kwargs: {
|
|
3794
|
+
specification: spectification,
|
|
3795
|
+
domain,
|
|
3796
|
+
limit: 100,
|
|
3797
|
+
offset: 0
|
|
3798
|
+
}
|
|
3799
|
+
};
|
|
3800
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3801
|
+
headers: {
|
|
3802
|
+
"Content-Type": "application/json"
|
|
3803
|
+
}
|
|
3804
|
+
});
|
|
3805
|
+
},
|
|
3806
|
+
[env]
|
|
3807
|
+
);
|
|
3808
|
+
const getCurrency = useCallback8(async () => {
|
|
3389
3809
|
const jsonData = {
|
|
3390
|
-
model,
|
|
3391
|
-
method: "
|
|
3392
|
-
ids,
|
|
3393
|
-
with_context: context,
|
|
3810
|
+
model: "res.currency",
|
|
3811
|
+
method: "web_search_read",
|
|
3394
3812
|
kwargs: {
|
|
3395
|
-
specification
|
|
3813
|
+
specification: {
|
|
3814
|
+
icon_url: {},
|
|
3815
|
+
name: {}
|
|
3816
|
+
},
|
|
3817
|
+
domain: [["active", "=", true]],
|
|
3818
|
+
limit: 100,
|
|
3819
|
+
offset: 0
|
|
3396
3820
|
}
|
|
3397
3821
|
};
|
|
3398
|
-
return
|
|
3822
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3399
3823
|
headers: {
|
|
3400
3824
|
"Content-Type": "application/json"
|
|
3401
3825
|
}
|
|
3402
3826
|
});
|
|
3403
|
-
},
|
|
3404
|
-
async
|
|
3405
|
-
model,
|
|
3406
|
-
ids = [],
|
|
3407
|
-
data = {},
|
|
3408
|
-
specification = {},
|
|
3409
|
-
context = {},
|
|
3410
|
-
path
|
|
3411
|
-
}) {
|
|
3412
|
-
const env2 = getEnv();
|
|
3827
|
+
}, [env]);
|
|
3828
|
+
const getConversionRate = useCallback8(async () => {
|
|
3413
3829
|
const jsonData = {
|
|
3414
|
-
model,
|
|
3415
|
-
method: "
|
|
3416
|
-
with_context: context,
|
|
3417
|
-
ids,
|
|
3830
|
+
model: "res.currency",
|
|
3831
|
+
method: "web_search_read",
|
|
3418
3832
|
kwargs: {
|
|
3419
|
-
|
|
3420
|
-
|
|
3833
|
+
specification: {
|
|
3834
|
+
name: {},
|
|
3835
|
+
icon_url: {},
|
|
3836
|
+
rate_ids: {
|
|
3837
|
+
fields: {
|
|
3838
|
+
company_rate: {},
|
|
3839
|
+
sell: {}
|
|
3840
|
+
}
|
|
3841
|
+
}
|
|
3842
|
+
},
|
|
3843
|
+
domain: [["active", "=", true]],
|
|
3844
|
+
limit: 100,
|
|
3845
|
+
offset: 0
|
|
3421
3846
|
}
|
|
3422
3847
|
};
|
|
3423
|
-
return
|
|
3848
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3424
3849
|
headers: {
|
|
3425
3850
|
"Content-Type": "application/json"
|
|
3426
3851
|
}
|
|
3427
3852
|
});
|
|
3428
|
-
},
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3853
|
+
}, [env]);
|
|
3854
|
+
const getAll = useCallback8(
|
|
3855
|
+
async ({ data }) => {
|
|
3856
|
+
const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
|
|
3857
|
+
fields: data.fields,
|
|
3858
|
+
groupby: data.groupby
|
|
3859
|
+
} : {
|
|
3860
|
+
count_limit: 10001,
|
|
3861
|
+
order: data.sort,
|
|
3862
|
+
specification: data.specification
|
|
3863
|
+
};
|
|
3864
|
+
const jsonData = {
|
|
3865
|
+
model: String(data.model),
|
|
3866
|
+
method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
|
|
3867
|
+
ids: data.ids,
|
|
3868
|
+
with_context: data.context,
|
|
3869
|
+
kwargs: {
|
|
3870
|
+
domain: data.domain,
|
|
3871
|
+
limit: data.limit,
|
|
3872
|
+
offset: data.offset,
|
|
3873
|
+
...jsonReadGroup
|
|
3874
|
+
}
|
|
3875
|
+
};
|
|
3876
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3877
|
+
headers: {
|
|
3878
|
+
"Content-Type": "application/json"
|
|
3879
|
+
}
|
|
3880
|
+
});
|
|
3881
|
+
},
|
|
3882
|
+
[env]
|
|
3883
|
+
);
|
|
3884
|
+
const getListCalendar = useCallback8(
|
|
3885
|
+
async ({ data }) => {
|
|
3886
|
+
const jsonReadGroup = data.type == "calendar" ? data?.fields : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
|
|
3887
|
+
fields: data.fields,
|
|
3888
|
+
groupby: data.groupby
|
|
3889
|
+
} : {
|
|
3890
|
+
count_limit: 10001,
|
|
3891
|
+
order: data.sort,
|
|
3892
|
+
specification: data.specification
|
|
3893
|
+
};
|
|
3894
|
+
const jsonData = {
|
|
3895
|
+
model: String(data.model),
|
|
3896
|
+
method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
|
|
3897
|
+
ids: data.ids,
|
|
3898
|
+
with_context: data.context,
|
|
3899
|
+
kwargs: {
|
|
3900
|
+
domain: data.domain,
|
|
3901
|
+
limit: data.limit,
|
|
3902
|
+
offset: data.offset,
|
|
3903
|
+
fields: data.fields,
|
|
3904
|
+
...jsonReadGroup
|
|
3905
|
+
}
|
|
3906
|
+
};
|
|
3907
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3908
|
+
headers: {
|
|
3909
|
+
"Content-Type": "application/json"
|
|
3910
|
+
}
|
|
3911
|
+
});
|
|
3912
|
+
},
|
|
3913
|
+
[env]
|
|
3914
|
+
);
|
|
3915
|
+
const getList = useCallback8(
|
|
3916
|
+
async ({
|
|
3432
3917
|
model,
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
})
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3918
|
+
ids = [],
|
|
3919
|
+
specification = {},
|
|
3920
|
+
domain = [],
|
|
3921
|
+
offset,
|
|
3922
|
+
order,
|
|
3923
|
+
context = {},
|
|
3924
|
+
limit = 10
|
|
3925
|
+
}) => {
|
|
3926
|
+
const jsonData = {
|
|
3927
|
+
model,
|
|
3928
|
+
method: "web_search_read" /* WEB_SEARCH_READ */,
|
|
3929
|
+
ids,
|
|
3930
|
+
with_context: context,
|
|
3931
|
+
kwargs: {
|
|
3932
|
+
specification,
|
|
3933
|
+
domain,
|
|
3934
|
+
limit,
|
|
3935
|
+
offset,
|
|
3936
|
+
order
|
|
3937
|
+
}
|
|
3938
|
+
};
|
|
3939
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3940
|
+
headers: {
|
|
3941
|
+
"Content-Type": "application/json"
|
|
3942
|
+
}
|
|
3943
|
+
});
|
|
3944
|
+
},
|
|
3945
|
+
[env]
|
|
3946
|
+
);
|
|
3947
|
+
const getDetail = useCallback8(
|
|
3948
|
+
async ({ ids = [], model, specification, context }) => {
|
|
3949
|
+
const jsonData = {
|
|
3950
|
+
model,
|
|
3951
|
+
method: "web_read" /* WEB_READ */,
|
|
3952
|
+
ids,
|
|
3953
|
+
with_context: context,
|
|
3954
|
+
kwargs: {
|
|
3955
|
+
specification
|
|
3956
|
+
}
|
|
3957
|
+
};
|
|
3958
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3959
|
+
headers: {
|
|
3960
|
+
"Content-Type": "application/json"
|
|
3961
|
+
}
|
|
3962
|
+
});
|
|
3963
|
+
},
|
|
3964
|
+
[env]
|
|
3965
|
+
);
|
|
3966
|
+
const save = useCallback8(
|
|
3967
|
+
async ({
|
|
3452
3968
|
model,
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3969
|
+
ids = [],
|
|
3970
|
+
data = {},
|
|
3971
|
+
specification = {},
|
|
3972
|
+
context = {},
|
|
3973
|
+
path
|
|
3974
|
+
}) => {
|
|
3975
|
+
const jsonData = {
|
|
3976
|
+
model,
|
|
3977
|
+
method: "web_save" /* WEB_SAVE */,
|
|
3978
|
+
with_context: context,
|
|
3979
|
+
ids,
|
|
3980
|
+
kwargs: {
|
|
3981
|
+
vals: data,
|
|
3982
|
+
specification
|
|
3983
|
+
}
|
|
3984
|
+
};
|
|
3985
|
+
return env.requests.post(path ?? "/call" /* CALL_PATH */, jsonData, {
|
|
3986
|
+
headers: {
|
|
3987
|
+
"Content-Type": "application/json"
|
|
3988
|
+
}
|
|
3989
|
+
});
|
|
3990
|
+
},
|
|
3991
|
+
[env]
|
|
3992
|
+
);
|
|
3993
|
+
const deleteApi = useCallback8(
|
|
3994
|
+
async ({ ids = [], model }) => {
|
|
3995
|
+
const jsonData = {
|
|
3996
|
+
model,
|
|
3997
|
+
method: "unlink" /* UNLINK */,
|
|
3998
|
+
ids
|
|
3999
|
+
};
|
|
4000
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4001
|
+
headers: {
|
|
4002
|
+
"Content-Type": "application/json"
|
|
4003
|
+
}
|
|
4004
|
+
});
|
|
4005
|
+
},
|
|
4006
|
+
[env]
|
|
4007
|
+
);
|
|
4008
|
+
const onChange = useCallback8(
|
|
4009
|
+
async ({
|
|
4010
|
+
ids = [],
|
|
3471
4011
|
model,
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
4012
|
+
object,
|
|
4013
|
+
specification,
|
|
4014
|
+
context,
|
|
4015
|
+
fieldChange
|
|
4016
|
+
}) => {
|
|
4017
|
+
const jsonData = {
|
|
4018
|
+
model,
|
|
4019
|
+
method: "onchange" /* ONCHANGE */,
|
|
4020
|
+
ids,
|
|
4021
|
+
with_context: context,
|
|
4022
|
+
args: [
|
|
4023
|
+
object ? object : {},
|
|
4024
|
+
fieldChange ? fieldChange : [],
|
|
4025
|
+
specification
|
|
4026
|
+
]
|
|
4027
|
+
};
|
|
4028
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4029
|
+
headers: {
|
|
4030
|
+
"Content-Type": "application/json"
|
|
4031
|
+
}
|
|
4032
|
+
});
|
|
4033
|
+
},
|
|
4034
|
+
[env]
|
|
4035
|
+
);
|
|
4036
|
+
const getListFieldsOnchange = useCallback8(
|
|
4037
|
+
async ({ model }) => {
|
|
4038
|
+
const jsonData = {
|
|
4039
|
+
model,
|
|
4040
|
+
method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
|
|
4041
|
+
};
|
|
4042
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4043
|
+
headers: {
|
|
4044
|
+
"Content-Type": "application/json"
|
|
4045
|
+
}
|
|
4046
|
+
});
|
|
4047
|
+
},
|
|
4048
|
+
[env]
|
|
4049
|
+
);
|
|
4050
|
+
const parseORMOdoo = useCallback8((data) => {
|
|
3481
4051
|
for (const key in data) {
|
|
3482
4052
|
if (key === "display_name") {
|
|
3483
4053
|
delete data[key];
|
|
@@ -3489,365 +4059,368 @@ var ModelService = {
|
|
|
3489
4059
|
}
|
|
3490
4060
|
}
|
|
3491
4061
|
return { ...data };
|
|
3492
|
-
},
|
|
3493
|
-
toDataJS
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
if (
|
|
3497
|
-
if (viewData
|
|
4062
|
+
}, []);
|
|
4063
|
+
const toDataJS = useCallback8(
|
|
4064
|
+
(data, viewData, model) => {
|
|
4065
|
+
for (const key in data) {
|
|
4066
|
+
if (data[key] === false) {
|
|
4067
|
+
if (viewData && model) {
|
|
4068
|
+
if (viewData?.models?.[model]?.[key]?.type !== "boolean" /* BOOLEAN */) {
|
|
4069
|
+
data[key] = null;
|
|
4070
|
+
}
|
|
4071
|
+
} else {
|
|
3498
4072
|
data[key] = null;
|
|
3499
4073
|
}
|
|
3500
|
-
} else {
|
|
3501
|
-
data[key] =
|
|
3502
|
-
}
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
item[OBJECT_POSITION],
|
|
3515
|
-
viewData,
|
|
3516
|
-
relation
|
|
3517
|
-
);
|
|
3518
|
-
} else {
|
|
3519
|
-
return ModelService.toDataJS(item, viewData, relation);
|
|
3520
|
-
}
|
|
3521
|
-
} else {
|
|
3522
|
-
if (item?.length >= 3) {
|
|
3523
|
-
return item[OBJECT_POSITION];
|
|
4074
|
+
} else if (data[key] === "/") {
|
|
4075
|
+
data[key] = "Draft";
|
|
4076
|
+
} else if (data[key] !== false) {
|
|
4077
|
+
if (model !== void 0) {
|
|
4078
|
+
if (viewData?.models?.[model]?.[key]?.type === "one2many" /* ONE2MANY */ || viewData?.models?.[model]?.[key]?.type === "many2many" /* MANY2MANY */) {
|
|
4079
|
+
data[key] = (data[key] ??= [])?.map((item) => {
|
|
4080
|
+
const relation = viewData?.models?.[model]?.[key]?.relation;
|
|
4081
|
+
if (relation !== void 0) {
|
|
4082
|
+
if (viewData?.models?.[relation]) {
|
|
4083
|
+
if (item?.length >= 3) {
|
|
4084
|
+
return toDataJS(item[OBJECT_POSITION], viewData, relation);
|
|
4085
|
+
} else {
|
|
4086
|
+
return toDataJS(item, viewData, relation);
|
|
4087
|
+
}
|
|
3524
4088
|
} else {
|
|
3525
|
-
|
|
4089
|
+
if (item?.length >= 3) {
|
|
4090
|
+
return item[OBJECT_POSITION];
|
|
4091
|
+
} else {
|
|
4092
|
+
return item;
|
|
4093
|
+
}
|
|
3526
4094
|
}
|
|
3527
4095
|
}
|
|
3528
|
-
}
|
|
3529
|
-
}
|
|
4096
|
+
});
|
|
4097
|
+
}
|
|
3530
4098
|
}
|
|
3531
4099
|
}
|
|
3532
4100
|
}
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
4101
|
+
return { ...data };
|
|
4102
|
+
},
|
|
4103
|
+
[]
|
|
4104
|
+
);
|
|
4105
|
+
return {
|
|
4106
|
+
getListMyBankAccount,
|
|
4107
|
+
getCurrency,
|
|
4108
|
+
getConversionRate,
|
|
4109
|
+
getAll,
|
|
4110
|
+
getListCalendar,
|
|
4111
|
+
getList,
|
|
4112
|
+
getDetail,
|
|
4113
|
+
save,
|
|
4114
|
+
deleteApi,
|
|
4115
|
+
onChange,
|
|
4116
|
+
getListFieldsOnchange,
|
|
4117
|
+
parseORMOdoo,
|
|
4118
|
+
toDataJS
|
|
4119
|
+
};
|
|
4120
|
+
}
|
|
3538
4121
|
|
|
3539
4122
|
// src/services/user-service/index.ts
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
4123
|
+
import { useCallback as useCallback9 } from "react";
|
|
4124
|
+
function useUserService() {
|
|
4125
|
+
const { env } = useEnv();
|
|
4126
|
+
const getProfile = useCallback9(
|
|
4127
|
+
async (path) => {
|
|
4128
|
+
return env?.requests?.get(path ?? "/userinfo" /* PROFILE_PATH */, {
|
|
4129
|
+
headers: {
|
|
4130
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
4131
|
+
}
|
|
4132
|
+
});
|
|
4133
|
+
},
|
|
4134
|
+
[env]
|
|
4135
|
+
);
|
|
4136
|
+
const getUser = useCallback9(
|
|
4137
|
+
async ({ context, id }) => {
|
|
4138
|
+
const jsonData = {
|
|
4139
|
+
model: "res.users",
|
|
4140
|
+
method: "web_read",
|
|
4141
|
+
ids: [id],
|
|
4142
|
+
with_context: context,
|
|
4143
|
+
kwargs: {
|
|
4144
|
+
specification: {
|
|
4145
|
+
display_name: {},
|
|
4146
|
+
image_1920: {},
|
|
4147
|
+
name: {},
|
|
4148
|
+
login: {},
|
|
4149
|
+
email: {},
|
|
4150
|
+
password: {},
|
|
4151
|
+
visible_group_id: {
|
|
4152
|
+
fields: {
|
|
4153
|
+
id: {},
|
|
4154
|
+
display_name: {}
|
|
4155
|
+
}
|
|
4156
|
+
},
|
|
4157
|
+
company_id: {
|
|
4158
|
+
fields: {
|
|
4159
|
+
id: {},
|
|
4160
|
+
display_name: {}
|
|
4161
|
+
}
|
|
3574
4162
|
}
|
|
3575
4163
|
}
|
|
3576
4164
|
}
|
|
3577
|
-
}
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
}
|
|
3583
|
-
}
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
}
|
|
3599
|
-
|
|
4165
|
+
};
|
|
4166
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4167
|
+
headers: {
|
|
4168
|
+
"Content-Type": "application/json"
|
|
4169
|
+
}
|
|
4170
|
+
});
|
|
4171
|
+
},
|
|
4172
|
+
[env]
|
|
4173
|
+
);
|
|
4174
|
+
const switchUserLocale = useCallback9(
|
|
4175
|
+
async ({ id, values }) => {
|
|
4176
|
+
const jsonData = {
|
|
4177
|
+
model: "res.users",
|
|
4178
|
+
domain: [["id", "=", id]],
|
|
4179
|
+
values
|
|
4180
|
+
};
|
|
4181
|
+
return env?.requests.post(UriConstants?.CREATE_UPDATE_PATH, jsonData, {
|
|
4182
|
+
headers: {
|
|
4183
|
+
"Content-Type": "application/json"
|
|
4184
|
+
}
|
|
4185
|
+
});
|
|
4186
|
+
},
|
|
4187
|
+
[env]
|
|
4188
|
+
);
|
|
4189
|
+
return {
|
|
4190
|
+
getProfile,
|
|
4191
|
+
getUser,
|
|
4192
|
+
switchUserLocale
|
|
4193
|
+
};
|
|
4194
|
+
}
|
|
3600
4195
|
|
|
3601
4196
|
// src/services/view-service/index.ts
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
options = {},
|
|
3608
|
-
aid
|
|
3609
|
-
}) {
|
|
3610
|
-
const env2 = getEnv();
|
|
3611
|
-
const defaultOptions = {
|
|
3612
|
-
load_filters: true,
|
|
3613
|
-
toolbar: true,
|
|
3614
|
-
action_id: aid
|
|
3615
|
-
};
|
|
3616
|
-
const jsonDataView = {
|
|
4197
|
+
import { useCallback as useCallback10 } from "react";
|
|
4198
|
+
function useViewService() {
|
|
4199
|
+
const { env } = useEnv();
|
|
4200
|
+
const getView = useCallback10(
|
|
4201
|
+
async ({
|
|
3617
4202
|
model,
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
4203
|
+
views,
|
|
4204
|
+
context = {},
|
|
4205
|
+
options = {},
|
|
4206
|
+
aid
|
|
4207
|
+
}) => {
|
|
4208
|
+
const defaultOptions = {
|
|
4209
|
+
load_filters: true,
|
|
4210
|
+
toolbar: true,
|
|
4211
|
+
action_id: aid
|
|
4212
|
+
};
|
|
4213
|
+
const jsonDataView = {
|
|
4214
|
+
model,
|
|
4215
|
+
method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
|
|
4216
|
+
kwargs: {
|
|
4217
|
+
views,
|
|
4218
|
+
options: { ...options, ...defaultOptions }
|
|
4219
|
+
},
|
|
4220
|
+
with_context: context
|
|
4221
|
+
};
|
|
4222
|
+
return env?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
|
|
4223
|
+
headers: {
|
|
4224
|
+
"Content-Type": "application/json"
|
|
4225
|
+
}
|
|
4226
|
+
});
|
|
4227
|
+
},
|
|
4228
|
+
[env]
|
|
4229
|
+
);
|
|
4230
|
+
const getMenu = useCallback10(
|
|
4231
|
+
async (context) => {
|
|
4232
|
+
const jsonData = {
|
|
4233
|
+
model: "ir.ui.menu" /* MENU */,
|
|
4234
|
+
method: "web_search_read" /* WEB_SEARCH_READ */,
|
|
4235
|
+
ids: [],
|
|
4236
|
+
with_context: context,
|
|
4237
|
+
kwargs: {
|
|
4238
|
+
specification: {
|
|
4239
|
+
active: {},
|
|
4240
|
+
name: {},
|
|
4241
|
+
is_display: {},
|
|
4242
|
+
sequence: {},
|
|
4243
|
+
complete_name: {},
|
|
4244
|
+
action: {
|
|
4245
|
+
fields: {
|
|
4246
|
+
display_name: {},
|
|
4247
|
+
type: {},
|
|
4248
|
+
binding_view_types: {}
|
|
4249
|
+
}
|
|
3659
4250
|
},
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
active: {},
|
|
3667
|
-
name: {},
|
|
3668
|
-
is_display: {},
|
|
3669
|
-
sequence: {},
|
|
3670
|
-
complete_name: {},
|
|
3671
|
-
action: {
|
|
3672
|
-
fields: {
|
|
3673
|
-
display_name: {},
|
|
3674
|
-
type: {},
|
|
3675
|
-
binding_view_types: {}
|
|
3676
|
-
// res_model: {},
|
|
3677
|
-
}
|
|
4251
|
+
url_icon: {},
|
|
4252
|
+
web_icon: {},
|
|
4253
|
+
web_icon_data: {},
|
|
4254
|
+
groups_id: {
|
|
4255
|
+
fields: {
|
|
4256
|
+
full_name: {}
|
|
3678
4257
|
},
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
4258
|
+
limit: 40,
|
|
4259
|
+
order: ""
|
|
4260
|
+
},
|
|
4261
|
+
display_name: {},
|
|
4262
|
+
child_id: {
|
|
4263
|
+
fields: {
|
|
4264
|
+
active: {},
|
|
4265
|
+
name: {},
|
|
4266
|
+
is_display: {},
|
|
4267
|
+
sequence: {},
|
|
4268
|
+
complete_name: {},
|
|
4269
|
+
action: {
|
|
4270
|
+
fields: {
|
|
4271
|
+
display_name: {},
|
|
4272
|
+
type: {},
|
|
4273
|
+
binding_view_types: {}
|
|
4274
|
+
}
|
|
3685
4275
|
},
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
active: {},
|
|
3693
|
-
name: {},
|
|
3694
|
-
is_display: {},
|
|
3695
|
-
sequence: {},
|
|
3696
|
-
complete_name: {},
|
|
3697
|
-
action: {
|
|
3698
|
-
fields: {
|
|
3699
|
-
display_name: {},
|
|
3700
|
-
type: {},
|
|
3701
|
-
binding_view_types: {}
|
|
3702
|
-
// res_model: {},
|
|
3703
|
-
}
|
|
4276
|
+
url_icon: {},
|
|
4277
|
+
web_icon: {},
|
|
4278
|
+
web_icon_data: {},
|
|
4279
|
+
groups_id: {
|
|
4280
|
+
fields: {
|
|
4281
|
+
full_name: {}
|
|
3704
4282
|
},
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
4283
|
+
limit: 40,
|
|
4284
|
+
order: ""
|
|
4285
|
+
},
|
|
4286
|
+
display_name: {},
|
|
4287
|
+
child_id: {
|
|
4288
|
+
fields: {
|
|
4289
|
+
active: {},
|
|
4290
|
+
name: {},
|
|
4291
|
+
is_display: {},
|
|
4292
|
+
sequence: {},
|
|
4293
|
+
complete_name: {},
|
|
4294
|
+
action: {
|
|
4295
|
+
fields: {
|
|
4296
|
+
display_name: {},
|
|
4297
|
+
type: {},
|
|
4298
|
+
binding_view_types: {}
|
|
4299
|
+
}
|
|
3711
4300
|
},
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
active: {},
|
|
3719
|
-
name: {},
|
|
3720
|
-
is_display: {},
|
|
3721
|
-
sequence: {},
|
|
3722
|
-
complete_name: {},
|
|
3723
|
-
action: {
|
|
3724
|
-
fields: {
|
|
3725
|
-
display_name: {},
|
|
3726
|
-
type: {},
|
|
3727
|
-
binding_view_types: {}
|
|
3728
|
-
// res_model: {},
|
|
3729
|
-
}
|
|
3730
|
-
},
|
|
3731
|
-
url_icon: {},
|
|
3732
|
-
web_icon: {},
|
|
3733
|
-
web_icon_data: {},
|
|
3734
|
-
groups_id: {
|
|
3735
|
-
fields: {
|
|
3736
|
-
full_name: {}
|
|
3737
|
-
},
|
|
3738
|
-
limit: 40,
|
|
3739
|
-
order: ""
|
|
4301
|
+
url_icon: {},
|
|
4302
|
+
web_icon: {},
|
|
4303
|
+
web_icon_data: {},
|
|
4304
|
+
groups_id: {
|
|
4305
|
+
fields: {
|
|
4306
|
+
full_name: {}
|
|
3740
4307
|
},
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
fields: {},
|
|
3744
|
-
limit: 40,
|
|
3745
|
-
order: ""
|
|
3746
|
-
}
|
|
4308
|
+
limit: 40,
|
|
4309
|
+
order: ""
|
|
3747
4310
|
},
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
4311
|
+
display_name: {},
|
|
4312
|
+
child_id: {
|
|
4313
|
+
fields: {},
|
|
4314
|
+
limit: 40,
|
|
4315
|
+
order: ""
|
|
4316
|
+
}
|
|
4317
|
+
},
|
|
4318
|
+
limit: 40,
|
|
4319
|
+
order: ""
|
|
4320
|
+
}
|
|
4321
|
+
},
|
|
4322
|
+
limit: 40,
|
|
4323
|
+
order: ""
|
|
4324
|
+
}
|
|
4325
|
+
},
|
|
4326
|
+
domain: [
|
|
4327
|
+
"&",
|
|
4328
|
+
["is_display", "=", true],
|
|
4329
|
+
"&",
|
|
4330
|
+
["active", "=", true],
|
|
4331
|
+
["parent_id", "=", false]
|
|
4332
|
+
]
|
|
4333
|
+
}
|
|
4334
|
+
};
|
|
4335
|
+
return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
4336
|
+
headers: {
|
|
4337
|
+
"Content-Type": "application/json"
|
|
4338
|
+
}
|
|
4339
|
+
});
|
|
4340
|
+
},
|
|
4341
|
+
[env]
|
|
4342
|
+
);
|
|
4343
|
+
const getActionDetail = useCallback10(
|
|
4344
|
+
async (aid, context) => {
|
|
4345
|
+
const jsonData = {
|
|
4346
|
+
model: "ir.actions.act_window" /* WINDOW_ACTION */,
|
|
4347
|
+
method: "web_read" /* WEB_READ */,
|
|
4348
|
+
ids: [aid],
|
|
4349
|
+
with_context: context,
|
|
4350
|
+
kwargs: {
|
|
4351
|
+
specification: {
|
|
4352
|
+
id: {},
|
|
4353
|
+
name: {},
|
|
4354
|
+
res_model: {},
|
|
4355
|
+
views: {},
|
|
4356
|
+
view_mode: {},
|
|
4357
|
+
mobile_view_mode: {},
|
|
4358
|
+
domain: {},
|
|
4359
|
+
context: {},
|
|
4360
|
+
groups_id: {},
|
|
4361
|
+
search_view_id: {}
|
|
3758
4362
|
}
|
|
3759
|
-
},
|
|
3760
|
-
domain: [
|
|
3761
|
-
"&",
|
|
3762
|
-
["is_display", "=", true],
|
|
3763
|
-
"&",
|
|
3764
|
-
["active", "=", true],
|
|
3765
|
-
["parent_id", "=", false]
|
|
3766
|
-
]
|
|
3767
|
-
}
|
|
3768
|
-
};
|
|
3769
|
-
return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
3770
|
-
headers: {
|
|
3771
|
-
"Content-Type": "application/json"
|
|
3772
|
-
}
|
|
3773
|
-
});
|
|
3774
|
-
},
|
|
3775
|
-
async getActionDetail(aid, context) {
|
|
3776
|
-
const env2 = getEnv();
|
|
3777
|
-
const jsonData = {
|
|
3778
|
-
model: "ir.actions.act_window" /* WINDOW_ACTION */,
|
|
3779
|
-
method: "web_read" /* WEB_READ */,
|
|
3780
|
-
ids: [aid],
|
|
3781
|
-
with_context: context,
|
|
3782
|
-
kwargs: {
|
|
3783
|
-
specification: {
|
|
3784
|
-
id: {},
|
|
3785
|
-
name: {},
|
|
3786
|
-
res_model: {},
|
|
3787
|
-
views: {},
|
|
3788
|
-
view_mode: {},
|
|
3789
|
-
mobile_view_mode: {},
|
|
3790
|
-
domain: {},
|
|
3791
|
-
context: {},
|
|
3792
|
-
groups_id: {},
|
|
3793
|
-
search_view_id: {}
|
|
3794
4363
|
}
|
|
3795
|
-
}
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
}
|
|
3801
|
-
}
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
context,
|
|
3807
|
-
offset
|
|
3808
|
-
}) {
|
|
3809
|
-
const env2 = getEnv();
|
|
3810
|
-
const jsonData = {
|
|
4364
|
+
};
|
|
4365
|
+
return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
4366
|
+
headers: {
|
|
4367
|
+
"Content-Type": "application/json"
|
|
4368
|
+
}
|
|
4369
|
+
});
|
|
4370
|
+
},
|
|
4371
|
+
[env]
|
|
4372
|
+
);
|
|
4373
|
+
const getResequence = useCallback10(
|
|
4374
|
+
async ({
|
|
3811
4375
|
model,
|
|
3812
|
-
with_context: context,
|
|
3813
4376
|
ids,
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
}
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
ids: [],
|
|
3828
|
-
method: "get_data_select",
|
|
3829
|
-
with_context: data.context,
|
|
3830
|
-
kwargs: {
|
|
3831
|
-
count_limit: 10001,
|
|
3832
|
-
domain: data.domain ? data.domain : [],
|
|
3833
|
-
offset: 0,
|
|
3834
|
-
order: "",
|
|
3835
|
-
specification: data?.specification ?? {
|
|
3836
|
-
id: {},
|
|
3837
|
-
name: {},
|
|
3838
|
-
display_name: {}
|
|
4377
|
+
context,
|
|
4378
|
+
offset
|
|
4379
|
+
}) => {
|
|
4380
|
+
const jsonData = {
|
|
4381
|
+
model,
|
|
4382
|
+
with_context: context,
|
|
4383
|
+
ids,
|
|
4384
|
+
field: "sequence",
|
|
4385
|
+
...offset > 0 ? { offset } : {}
|
|
4386
|
+
};
|
|
4387
|
+
return env?.requests.post("/web/dataset/resequence", jsonData, {
|
|
4388
|
+
headers: {
|
|
4389
|
+
"Content-Type": "application/json"
|
|
3839
4390
|
}
|
|
3840
|
-
}
|
|
3841
|
-
}
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
4391
|
+
});
|
|
4392
|
+
},
|
|
4393
|
+
[env]
|
|
4394
|
+
);
|
|
4395
|
+
const getSelectionItem = useCallback10(
|
|
4396
|
+
async ({ data }) => {
|
|
4397
|
+
const jsonData = {
|
|
4398
|
+
model: data.model,
|
|
4399
|
+
ids: [],
|
|
4400
|
+
method: "get_data_select",
|
|
4401
|
+
with_context: data.context,
|
|
4402
|
+
kwargs: {
|
|
4403
|
+
count_limit: 10001,
|
|
4404
|
+
domain: data.domain ? data.domain : [],
|
|
4405
|
+
offset: 0,
|
|
4406
|
+
order: "",
|
|
4407
|
+
specification: data?.specification ?? {
|
|
4408
|
+
id: {},
|
|
4409
|
+
name: {},
|
|
4410
|
+
display_name: {}
|
|
4411
|
+
}
|
|
4412
|
+
}
|
|
4413
|
+
};
|
|
4414
|
+
return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4415
|
+
headers: {
|
|
4416
|
+
"Content-Type": "application/json"
|
|
4417
|
+
}
|
|
4418
|
+
});
|
|
4419
|
+
},
|
|
4420
|
+
[env]
|
|
4421
|
+
);
|
|
4422
|
+
const loadMessages = useCallback10(async () => {
|
|
4423
|
+
return env.requests.post(
|
|
3851
4424
|
"/load_message_failures" /* LOAD_MESSAGE */,
|
|
3852
4425
|
{},
|
|
3853
4426
|
{
|
|
@@ -3856,202 +4429,203 @@ var ViewService = {
|
|
|
3856
4429
|
}
|
|
3857
4430
|
}
|
|
3858
4431
|
);
|
|
3859
|
-
},
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
console.log("env?.requests", env2, env2?.requests);
|
|
3863
|
-
return env2?.requests?.get("", {
|
|
3864
|
-
headers: {
|
|
3865
|
-
"Content-Type": "application/json"
|
|
3866
|
-
}
|
|
3867
|
-
});
|
|
3868
|
-
},
|
|
3869
|
-
async get2FAMethods({
|
|
3870
|
-
method,
|
|
3871
|
-
with_context
|
|
3872
|
-
}) {
|
|
3873
|
-
const env2 = getEnv();
|
|
3874
|
-
const jsonData = {
|
|
3875
|
-
method,
|
|
3876
|
-
with_context
|
|
3877
|
-
};
|
|
3878
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4432
|
+
}, [env]);
|
|
4433
|
+
const getVersion = useCallback10(async () => {
|
|
4434
|
+
return env?.requests?.get("", {
|
|
3879
4435
|
headers: {
|
|
3880
4436
|
"Content-Type": "application/json"
|
|
3881
4437
|
}
|
|
3882
4438
|
});
|
|
3883
|
-
},
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
with_context,
|
|
3887
|
-
code,
|
|
3888
|
-
device,
|
|
3889
|
-
location
|
|
3890
|
-
}) {
|
|
3891
|
-
const env2 = getEnv();
|
|
3892
|
-
const jsonData = {
|
|
3893
|
-
method,
|
|
3894
|
-
kwargs: {
|
|
3895
|
-
vals: {
|
|
3896
|
-
code,
|
|
3897
|
-
device,
|
|
3898
|
-
location
|
|
3899
|
-
}
|
|
3900
|
-
},
|
|
3901
|
-
with_context
|
|
3902
|
-
};
|
|
3903
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3904
|
-
headers: {
|
|
3905
|
-
"Content-Type": "application/json"
|
|
3906
|
-
},
|
|
3907
|
-
withCredentials: true
|
|
3908
|
-
});
|
|
3909
|
-
},
|
|
3910
|
-
async signInSSO({
|
|
3911
|
-
redirect_uri,
|
|
3912
|
-
state,
|
|
3913
|
-
client_id,
|
|
3914
|
-
response_type,
|
|
3915
|
-
path
|
|
3916
|
-
}) {
|
|
3917
|
-
const env2 = getEnv();
|
|
3918
|
-
const params = new URLSearchParams({
|
|
3919
|
-
response_type,
|
|
3920
|
-
client_id,
|
|
3921
|
-
redirect_uri,
|
|
3922
|
-
state
|
|
3923
|
-
});
|
|
3924
|
-
const url = `${path}?${params.toString()}`;
|
|
3925
|
-
return env2?.requests.get(url, {
|
|
3926
|
-
headers: {
|
|
3927
|
-
"Content-Type": "application/json"
|
|
3928
|
-
},
|
|
3929
|
-
withCredentials: true
|
|
3930
|
-
});
|
|
3931
|
-
},
|
|
3932
|
-
async grantAccess({
|
|
3933
|
-
redirect_uri,
|
|
3934
|
-
state,
|
|
3935
|
-
client_id,
|
|
3936
|
-
scopes
|
|
3937
|
-
}) {
|
|
3938
|
-
const env2 = getEnv();
|
|
3939
|
-
const jsonData = {
|
|
4439
|
+
}, [env]);
|
|
4440
|
+
const grantAccess = useCallback10(
|
|
4441
|
+
async ({
|
|
3940
4442
|
redirect_uri,
|
|
3941
4443
|
state,
|
|
3942
4444
|
client_id,
|
|
3943
4445
|
scopes
|
|
3944
|
-
}
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
token
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
4446
|
+
}) => {
|
|
4447
|
+
const jsonData = {
|
|
4448
|
+
redirect_uri,
|
|
4449
|
+
state,
|
|
4450
|
+
client_id,
|
|
4451
|
+
scopes
|
|
4452
|
+
};
|
|
4453
|
+
return env?.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
|
|
4454
|
+
headers: {
|
|
4455
|
+
"Content-Type": "application/json"
|
|
4456
|
+
},
|
|
4457
|
+
withCredentials: true
|
|
4458
|
+
});
|
|
4459
|
+
},
|
|
4460
|
+
[env]
|
|
4461
|
+
);
|
|
4462
|
+
const removeTotpSetUp = useCallback10(
|
|
4463
|
+
async ({ method, token }) => {
|
|
4464
|
+
const jsonData = {
|
|
4465
|
+
method,
|
|
4466
|
+
with_context: {
|
|
4467
|
+
token
|
|
4468
|
+
}
|
|
4469
|
+
};
|
|
4470
|
+
return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4471
|
+
headers: {
|
|
4472
|
+
"Content-Type": "application/json"
|
|
4473
|
+
}
|
|
4474
|
+
});
|
|
4475
|
+
},
|
|
4476
|
+
[env]
|
|
4477
|
+
);
|
|
4478
|
+
const requestSetupTotp = useCallback10(
|
|
4479
|
+
async ({ method, token }) => {
|
|
4480
|
+
const jsonData = {
|
|
4481
|
+
method,
|
|
4482
|
+
with_context: { token }
|
|
4483
|
+
};
|
|
4484
|
+
return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4485
|
+
headers: {
|
|
4486
|
+
"Content-Type": "application/json"
|
|
4487
|
+
}
|
|
4488
|
+
});
|
|
4489
|
+
},
|
|
4490
|
+
[env]
|
|
4491
|
+
);
|
|
4492
|
+
const settingsWebRead2fa = useCallback10(
|
|
4493
|
+
async ({
|
|
3981
4494
|
method,
|
|
3982
4495
|
model,
|
|
3983
4496
|
kwargs,
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4497
|
+
token
|
|
4498
|
+
}) => {
|
|
4499
|
+
const jsonData = {
|
|
4500
|
+
method,
|
|
4501
|
+
model,
|
|
4502
|
+
kwargs,
|
|
4503
|
+
with_context: {
|
|
4504
|
+
token
|
|
4505
|
+
}
|
|
4506
|
+
};
|
|
4507
|
+
return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4508
|
+
headers: {
|
|
4509
|
+
"Content-Type": "application/json"
|
|
4510
|
+
}
|
|
4511
|
+
});
|
|
4512
|
+
},
|
|
4513
|
+
[env]
|
|
4514
|
+
);
|
|
4515
|
+
const signInSSO = useCallback10(
|
|
4516
|
+
async ({
|
|
4517
|
+
redirect_uri,
|
|
4518
|
+
state,
|
|
4519
|
+
client_id,
|
|
4520
|
+
response_type
|
|
4521
|
+
}) => {
|
|
4522
|
+
const jsonData = {
|
|
4523
|
+
redirect_uri,
|
|
4524
|
+
state,
|
|
4525
|
+
client_id,
|
|
4526
|
+
response_type
|
|
4527
|
+
};
|
|
4528
|
+
return env?.requests.get("/signin-sso/oauth" /* SIGNIN_SSO */, jsonData, {
|
|
4529
|
+
headers: {
|
|
4530
|
+
credentials: "include"
|
|
4531
|
+
}
|
|
4532
|
+
});
|
|
4533
|
+
},
|
|
4534
|
+
[env]
|
|
4535
|
+
);
|
|
4536
|
+
const verify2FA = useCallback10(
|
|
4537
|
+
({
|
|
4015
4538
|
method,
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4539
|
+
with_context,
|
|
4540
|
+
code,
|
|
4541
|
+
device,
|
|
4542
|
+
location
|
|
4543
|
+
}) => {
|
|
4544
|
+
const jsonData = {
|
|
4545
|
+
method,
|
|
4546
|
+
kwargs: {
|
|
4547
|
+
vals: {
|
|
4548
|
+
code,
|
|
4549
|
+
device,
|
|
4550
|
+
location
|
|
4551
|
+
}
|
|
4552
|
+
},
|
|
4553
|
+
with_context
|
|
4554
|
+
};
|
|
4555
|
+
return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4556
|
+
headers: {
|
|
4557
|
+
"Content-Type": "application/json"
|
|
4558
|
+
},
|
|
4559
|
+
withCredentials: true
|
|
4560
|
+
});
|
|
4561
|
+
},
|
|
4562
|
+
[env]
|
|
4563
|
+
);
|
|
4564
|
+
const get2FAMethods = useCallback10(
|
|
4565
|
+
({ method, with_context }) => {
|
|
4566
|
+
const jsonData = {
|
|
4567
|
+
method,
|
|
4568
|
+
with_context
|
|
4569
|
+
};
|
|
4570
|
+
return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4571
|
+
headers: {
|
|
4572
|
+
"Content-Type": "application/json"
|
|
4019
4573
|
}
|
|
4020
|
-
}
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
headers: {
|
|
4027
|
-
"Content-Type": "application/json"
|
|
4028
|
-
}
|
|
4029
|
-
});
|
|
4030
|
-
},
|
|
4031
|
-
async removeTotpSetUp({ method, token }) {
|
|
4032
|
-
const env2 = getEnv();
|
|
4033
|
-
const jsonData = {
|
|
4574
|
+
});
|
|
4575
|
+
},
|
|
4576
|
+
[env]
|
|
4577
|
+
);
|
|
4578
|
+
const verifyTotp = useCallback10(
|
|
4579
|
+
({
|
|
4034
4580
|
method,
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4581
|
+
action_token,
|
|
4582
|
+
code
|
|
4583
|
+
}) => {
|
|
4584
|
+
const jsonData = {
|
|
4585
|
+
method,
|
|
4586
|
+
kwargs: {
|
|
4587
|
+
vals: {
|
|
4588
|
+
code
|
|
4589
|
+
}
|
|
4590
|
+
},
|
|
4591
|
+
with_context: {
|
|
4592
|
+
action_token
|
|
4593
|
+
}
|
|
4594
|
+
};
|
|
4595
|
+
return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4596
|
+
headers: {
|
|
4597
|
+
"Content-Type": "application/json"
|
|
4598
|
+
}
|
|
4599
|
+
});
|
|
4600
|
+
},
|
|
4601
|
+
[env]
|
|
4602
|
+
);
|
|
4603
|
+
return {
|
|
4604
|
+
getView,
|
|
4605
|
+
getMenu,
|
|
4606
|
+
getActionDetail,
|
|
4607
|
+
getResequence,
|
|
4608
|
+
getSelectionItem,
|
|
4609
|
+
loadMessages,
|
|
4610
|
+
getVersion,
|
|
4611
|
+
grantAccess,
|
|
4612
|
+
removeTotpSetUp,
|
|
4613
|
+
requestSetupTotp,
|
|
4614
|
+
settingsWebRead2fa,
|
|
4615
|
+
signInSSO,
|
|
4616
|
+
verify2FA,
|
|
4617
|
+
get2FAMethods,
|
|
4618
|
+
verifyTotp
|
|
4619
|
+
};
|
|
4620
|
+
}
|
|
4047
4621
|
export {
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4622
|
+
useActionService,
|
|
4623
|
+
useAuthService,
|
|
4624
|
+
useCompanyService,
|
|
4625
|
+
useExcelService,
|
|
4626
|
+
useFormService,
|
|
4627
|
+
useKanbanService,
|
|
4628
|
+
useModelService,
|
|
4629
|
+
useUserService,
|
|
4630
|
+
useViewService
|
|
4057
4631
|
};
|