@fctc/interface-logic 1.8.7 → 1.8.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/configs.js +9 -12
- package/dist/configs.mjs +9 -12
- package/dist/environment.d.mts +16 -15
- package/dist/environment.d.ts +16 -15
- package/dist/environment.js +90 -79
- package/dist/environment.mjs +89 -79
- package/dist/hooks.d.mts +6 -1
- package/dist/hooks.d.ts +6 -1
- package/dist/hooks.js +278 -210
- package/dist/hooks.mjs +215 -148
- package/dist/provider.js +12 -13
- package/dist/provider.mjs +12 -13
- package/dist/services.d.mts +29 -1
- package/dist/services.d.ts +29 -1
- package/dist/services.js +359 -80
- package/dist/services.mjs +357 -79
- package/dist/store.js +7 -5
- package/dist/store.mjs +7 -5
- package/package.json +1 -1
package/dist/provider.js
CHANGED
|
@@ -83,11 +83,13 @@ var breadcrums_slice_default = breadcrumbsSlice.reducer;
|
|
|
83
83
|
var import_toolkit2 = require("@reduxjs/toolkit");
|
|
84
84
|
var initialState2 = {
|
|
85
85
|
baseUrl: "",
|
|
86
|
-
requests: null,
|
|
87
86
|
companies: [],
|
|
88
87
|
user: {},
|
|
88
|
+
db: "",
|
|
89
|
+
refreshTokenEndpoint: "",
|
|
89
90
|
config: null,
|
|
90
91
|
envFile: null,
|
|
92
|
+
requests: null,
|
|
91
93
|
defaultCompany: {
|
|
92
94
|
id: null,
|
|
93
95
|
logo: "",
|
|
@@ -3175,19 +3177,16 @@ var axiosClient = {
|
|
|
3175
3177
|
timeout: 5e4,
|
|
3176
3178
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
3177
3179
|
});
|
|
3178
|
-
instance.interceptors.request.use(
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
if (token) {
|
|
3183
|
-
config2.headers["Authorization"] = "Bearer " + token;
|
|
3184
|
-
}
|
|
3185
|
-
return config2;
|
|
3186
|
-
},
|
|
3187
|
-
(error) => {
|
|
3188
|
-
Promise.reject(error);
|
|
3180
|
+
instance.interceptors.request.use(async (config2) => {
|
|
3181
|
+
const { useRefreshToken, useActionToken, actionToken } = config2;
|
|
3182
|
+
if (useActionToken && actionToken) {
|
|
3183
|
+
config2.headers["Action-Token"] = actionToken;
|
|
3189
3184
|
}
|
|
3190
|
-
|
|
3185
|
+
const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
|
|
3186
|
+
const token = await getToken?.();
|
|
3187
|
+
if (token) config2.headers["Authorization"] = `Bearer ${token}`;
|
|
3188
|
+
return config2;
|
|
3189
|
+
}, Promise.reject);
|
|
3191
3190
|
instance.interceptors.response.use(
|
|
3192
3191
|
(response) => {
|
|
3193
3192
|
return handleResponse(response);
|
package/dist/provider.mjs
CHANGED
|
@@ -43,11 +43,13 @@ var breadcrums_slice_default = breadcrumbsSlice.reducer;
|
|
|
43
43
|
import { createSlice as createSlice2 } from "@reduxjs/toolkit";
|
|
44
44
|
var initialState2 = {
|
|
45
45
|
baseUrl: "",
|
|
46
|
-
requests: null,
|
|
47
46
|
companies: [],
|
|
48
47
|
user: {},
|
|
48
|
+
db: "",
|
|
49
|
+
refreshTokenEndpoint: "",
|
|
49
50
|
config: null,
|
|
50
51
|
envFile: null,
|
|
52
|
+
requests: null,
|
|
51
53
|
defaultCompany: {
|
|
52
54
|
id: null,
|
|
53
55
|
logo: "",
|
|
@@ -3135,19 +3137,16 @@ var axiosClient = {
|
|
|
3135
3137
|
timeout: 5e4,
|
|
3136
3138
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
3137
3139
|
});
|
|
3138
|
-
instance.interceptors.request.use(
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
if (token) {
|
|
3143
|
-
config2.headers["Authorization"] = "Bearer " + token;
|
|
3144
|
-
}
|
|
3145
|
-
return config2;
|
|
3146
|
-
},
|
|
3147
|
-
(error) => {
|
|
3148
|
-
Promise.reject(error);
|
|
3140
|
+
instance.interceptors.request.use(async (config2) => {
|
|
3141
|
+
const { useRefreshToken, useActionToken, actionToken } = config2;
|
|
3142
|
+
if (useActionToken && actionToken) {
|
|
3143
|
+
config2.headers["Action-Token"] = actionToken;
|
|
3149
3144
|
}
|
|
3150
|
-
|
|
3145
|
+
const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
|
|
3146
|
+
const token = await getToken?.();
|
|
3147
|
+
if (token) config2.headers["Authorization"] = `Bearer ${token}`;
|
|
3148
|
+
return config2;
|
|
3149
|
+
}, Promise.reject);
|
|
3151
3150
|
instance.interceptors.response.use(
|
|
3152
3151
|
(response) => {
|
|
3153
3152
|
return handleResponse(response);
|
package/dist/services.d.mts
CHANGED
|
@@ -51,6 +51,7 @@ declare const AuthService: {
|
|
|
51
51
|
}): Promise<any>;
|
|
52
52
|
updatePassword(data: UpdatePasswordRequest, token: string | null): Promise<any>;
|
|
53
53
|
isValidToken(token: string | null): Promise<any>;
|
|
54
|
+
isValidActionToken(actionToken: string | null, path: string): Promise<any>;
|
|
54
55
|
loginSocial({ db, state, access_token, }: {
|
|
55
56
|
db: string;
|
|
56
57
|
state: object;
|
|
@@ -252,4 +253,31 @@ declare const ViewService: {
|
|
|
252
253
|
}): Promise<any>;
|
|
253
254
|
};
|
|
254
255
|
|
|
255
|
-
|
|
256
|
+
declare function useAuthService(): {
|
|
257
|
+
login: (body: LoginCredentialBody) => Promise<any>;
|
|
258
|
+
forgotPassword: (email: string) => Promise<any>;
|
|
259
|
+
forgotPasswordSSO: ({ email, with_context, method, }: {
|
|
260
|
+
email: string;
|
|
261
|
+
with_context: any;
|
|
262
|
+
method: string;
|
|
263
|
+
}) => Promise<any>;
|
|
264
|
+
resetPassword: (data: ResetPasswordRequest, token: string | null) => Promise<any>;
|
|
265
|
+
resetPasswordSSO: ({ method, password, with_context, }: {
|
|
266
|
+
method: any;
|
|
267
|
+
password: string;
|
|
268
|
+
with_context: any;
|
|
269
|
+
}) => Promise<any>;
|
|
270
|
+
updatePassword: (data: UpdatePasswordRequest, token: string | null) => Promise<any>;
|
|
271
|
+
isValidToken: (token: string | null) => Promise<any>;
|
|
272
|
+
isValidActionToken: (actionToken: string | null, path: string) => Promise<any>;
|
|
273
|
+
loginSocial: ({ db, state, access_token, }: {
|
|
274
|
+
db: string;
|
|
275
|
+
state: object;
|
|
276
|
+
access_token: string;
|
|
277
|
+
}) => Promise<any>;
|
|
278
|
+
getProviders: (db?: string) => Promise<any>;
|
|
279
|
+
getAccessByCode: (code: string) => Promise<any>;
|
|
280
|
+
logout: (data: string) => Promise<any>;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
export { ActionService, AuthService, CompanyService, ExcelService, FormService, KanbanServices as KanbanService, ModelService, UserService, ViewService, useAuthService };
|
package/dist/services.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ declare const AuthService: {
|
|
|
51
51
|
}): Promise<any>;
|
|
52
52
|
updatePassword(data: UpdatePasswordRequest, token: string | null): Promise<any>;
|
|
53
53
|
isValidToken(token: string | null): Promise<any>;
|
|
54
|
+
isValidActionToken(actionToken: string | null, path: string): Promise<any>;
|
|
54
55
|
loginSocial({ db, state, access_token, }: {
|
|
55
56
|
db: string;
|
|
56
57
|
state: object;
|
|
@@ -252,4 +253,31 @@ declare const ViewService: {
|
|
|
252
253
|
}): Promise<any>;
|
|
253
254
|
};
|
|
254
255
|
|
|
255
|
-
|
|
256
|
+
declare function useAuthService(): {
|
|
257
|
+
login: (body: LoginCredentialBody) => Promise<any>;
|
|
258
|
+
forgotPassword: (email: string) => Promise<any>;
|
|
259
|
+
forgotPasswordSSO: ({ email, with_context, method, }: {
|
|
260
|
+
email: string;
|
|
261
|
+
with_context: any;
|
|
262
|
+
method: string;
|
|
263
|
+
}) => Promise<any>;
|
|
264
|
+
resetPassword: (data: ResetPasswordRequest, token: string | null) => Promise<any>;
|
|
265
|
+
resetPasswordSSO: ({ method, password, with_context, }: {
|
|
266
|
+
method: any;
|
|
267
|
+
password: string;
|
|
268
|
+
with_context: any;
|
|
269
|
+
}) => Promise<any>;
|
|
270
|
+
updatePassword: (data: UpdatePasswordRequest, token: string | null) => Promise<any>;
|
|
271
|
+
isValidToken: (token: string | null) => Promise<any>;
|
|
272
|
+
isValidActionToken: (actionToken: string | null, path: string) => Promise<any>;
|
|
273
|
+
loginSocial: ({ db, state, access_token, }: {
|
|
274
|
+
db: string;
|
|
275
|
+
state: object;
|
|
276
|
+
access_token: string;
|
|
277
|
+
}) => Promise<any>;
|
|
278
|
+
getProviders: (db?: string) => Promise<any>;
|
|
279
|
+
getAccessByCode: (code: string) => Promise<any>;
|
|
280
|
+
logout: (data: string) => Promise<any>;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
export { ActionService, AuthService, CompanyService, ExcelService, FormService, KanbanServices as KanbanService, ModelService, UserService, ViewService, useAuthService };
|
package/dist/services.js
CHANGED
|
@@ -38,7 +38,8 @@ __export(services_exports, {
|
|
|
38
38
|
KanbanService: () => kanban_service_default,
|
|
39
39
|
ModelService: () => model_service_default,
|
|
40
40
|
UserService: () => user_service_default,
|
|
41
|
-
ViewService: () => view_service_default
|
|
41
|
+
ViewService: () => view_service_default,
|
|
42
|
+
useAuthService: () => useAuthService
|
|
42
43
|
});
|
|
43
44
|
module.exports = __toCommonJS(services_exports);
|
|
44
45
|
|
|
@@ -2272,19 +2273,16 @@ var axiosClient = {
|
|
|
2272
2273
|
timeout: 5e4,
|
|
2273
2274
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2274
2275
|
});
|
|
2275
|
-
instance.interceptors.request.use(
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
Promise.reject(error);
|
|
2286
|
-
}
|
|
2287
|
-
);
|
|
2276
|
+
instance.interceptors.request.use(async (config2) => {
|
|
2277
|
+
const { useRefreshToken, useActionToken, actionToken } = config2;
|
|
2278
|
+
if (useActionToken && actionToken) {
|
|
2279
|
+
config2.headers["Action-Token"] = actionToken;
|
|
2280
|
+
}
|
|
2281
|
+
const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
|
|
2282
|
+
const token = await getToken?.();
|
|
2283
|
+
if (token) config2.headers["Authorization"] = `Bearer ${token}`;
|
|
2284
|
+
return config2;
|
|
2285
|
+
}, Promise.reject);
|
|
2288
2286
|
instance.interceptors.response.use(
|
|
2289
2287
|
(response) => {
|
|
2290
2288
|
return handleResponse(response);
|
|
@@ -2448,11 +2446,13 @@ var breadcrums_slice_default = breadcrumbsSlice.reducer;
|
|
|
2448
2446
|
var import_toolkit2 = require("@reduxjs/toolkit");
|
|
2449
2447
|
var initialState2 = {
|
|
2450
2448
|
baseUrl: "",
|
|
2451
|
-
requests: null,
|
|
2452
2449
|
companies: [],
|
|
2453
2450
|
user: {},
|
|
2451
|
+
db: "",
|
|
2452
|
+
refreshTokenEndpoint: "",
|
|
2454
2453
|
config: null,
|
|
2455
2454
|
envFile: null,
|
|
2455
|
+
requests: null,
|
|
2456
2456
|
defaultCompany: {
|
|
2457
2457
|
id: null,
|
|
2458
2458
|
logo: "",
|
|
@@ -3039,73 +3039,83 @@ var envStore = (0, import_toolkit11.configureStore)({
|
|
|
3039
3039
|
});
|
|
3040
3040
|
|
|
3041
3041
|
// src/environment/EnvStore.ts
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3042
|
+
var EnvStore = class {
|
|
3043
|
+
envStore;
|
|
3044
|
+
baseUrl;
|
|
3045
|
+
requests;
|
|
3046
|
+
context;
|
|
3047
|
+
defaultCompany;
|
|
3048
|
+
config;
|
|
3049
|
+
companies;
|
|
3050
|
+
user;
|
|
3051
|
+
db;
|
|
3052
|
+
localStorageUtils;
|
|
3053
|
+
sessionStorageUtils;
|
|
3054
|
+
refreshTokenEndpoint;
|
|
3055
|
+
constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
|
|
3056
|
+
this.envStore = envStore2;
|
|
3057
|
+
this.localStorageUtils = localStorageUtils2;
|
|
3058
|
+
this.sessionStorageUtils = sessionStorageUtils2;
|
|
3059
|
+
this.setup();
|
|
3060
|
+
}
|
|
3061
|
+
setup() {
|
|
3062
|
+
const env2 = this.envStore.getState().env;
|
|
3063
|
+
this.baseUrl = env2?.baseUrl;
|
|
3064
|
+
this.requests = env2?.requests;
|
|
3065
|
+
this.context = env2?.context;
|
|
3066
|
+
this.defaultCompany = env2?.defaultCompany;
|
|
3067
|
+
this.config = env2?.config;
|
|
3068
|
+
this.companies = env2?.companies || [];
|
|
3069
|
+
this.user = env2?.user;
|
|
3070
|
+
this.db = env2?.db;
|
|
3071
|
+
this.refreshTokenEndpoint = env2?.refreshTokenEndpoint;
|
|
3072
|
+
}
|
|
3073
|
+
setupEnv(envConfig) {
|
|
3074
|
+
const dispatch = this.envStore.dispatch;
|
|
3075
|
+
const env2 = {
|
|
3061
3076
|
...envConfig,
|
|
3062
|
-
localStorageUtils:
|
|
3063
|
-
sessionStorageUtils:
|
|
3077
|
+
localStorageUtils: this.localStorageUtils,
|
|
3078
|
+
sessionStorageUtils: this.sessionStorageUtils
|
|
3064
3079
|
};
|
|
3065
|
-
const requests = axiosClient.init(
|
|
3066
|
-
dispatch(setEnv({ ...
|
|
3067
|
-
|
|
3068
|
-
}
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
}
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
setDefaultCompany: setupDefaultCompany,
|
|
3101
|
-
setUserInfo
|
|
3102
|
-
};
|
|
3103
|
-
}
|
|
3080
|
+
const requests = axiosClient.init(env2);
|
|
3081
|
+
dispatch(setEnv({ ...env2, requests }));
|
|
3082
|
+
this.setup();
|
|
3083
|
+
}
|
|
3084
|
+
setUid(uid) {
|
|
3085
|
+
const dispatch = this.envStore.dispatch;
|
|
3086
|
+
dispatch(setUid(uid));
|
|
3087
|
+
this.setup();
|
|
3088
|
+
}
|
|
3089
|
+
setLang(lang) {
|
|
3090
|
+
const dispatch = this.envStore.dispatch;
|
|
3091
|
+
dispatch(setLang(lang));
|
|
3092
|
+
this.setup();
|
|
3093
|
+
}
|
|
3094
|
+
setAllowCompanies(allowCompanies) {
|
|
3095
|
+
const dispatch = this.envStore.dispatch;
|
|
3096
|
+
dispatch(setAllowCompanies(allowCompanies));
|
|
3097
|
+
this.setup();
|
|
3098
|
+
}
|
|
3099
|
+
setCompanies(companies) {
|
|
3100
|
+
const dispatch = this.envStore.dispatch;
|
|
3101
|
+
dispatch(setCompanies(companies));
|
|
3102
|
+
this.setup();
|
|
3103
|
+
}
|
|
3104
|
+
setDefaultCompany(company) {
|
|
3105
|
+
const dispatch = this.envStore.dispatch;
|
|
3106
|
+
dispatch(setDefaultCompany(company));
|
|
3107
|
+
this.setup();
|
|
3108
|
+
}
|
|
3109
|
+
setUserInfo(userInfo) {
|
|
3110
|
+
const dispatch = this.envStore.dispatch;
|
|
3111
|
+
dispatch(setUser(userInfo));
|
|
3112
|
+
this.setup();
|
|
3113
|
+
}
|
|
3114
|
+
};
|
|
3104
3115
|
var env = null;
|
|
3105
3116
|
function getEnv() {
|
|
3106
|
-
if (!env)
|
|
3107
|
-
env =
|
|
3108
|
-
}
|
|
3117
|
+
if (!env)
|
|
3118
|
+
env = new EnvStore(envStore, localStorageUtils(), sessionStorageUtils());
|
|
3109
3119
|
return env;
|
|
3110
3120
|
}
|
|
3111
3121
|
|
|
@@ -3371,6 +3381,20 @@ var AuthService = {
|
|
|
3371
3381
|
}
|
|
3372
3382
|
});
|
|
3373
3383
|
},
|
|
3384
|
+
async isValidActionToken(actionToken, path) {
|
|
3385
|
+
const env2 = getEnv();
|
|
3386
|
+
return env2?.requests?.post(
|
|
3387
|
+
path,
|
|
3388
|
+
{},
|
|
3389
|
+
{
|
|
3390
|
+
headers: {
|
|
3391
|
+
"Content-Type": "application/json"
|
|
3392
|
+
},
|
|
3393
|
+
useActionToken: true,
|
|
3394
|
+
actionToken
|
|
3395
|
+
}
|
|
3396
|
+
);
|
|
3397
|
+
},
|
|
3374
3398
|
async loginSocial({
|
|
3375
3399
|
db,
|
|
3376
3400
|
state,
|
|
@@ -4135,7 +4159,7 @@ var model_service_default = ModelService;
|
|
|
4135
4159
|
var UserService = {
|
|
4136
4160
|
async getProfile(path) {
|
|
4137
4161
|
const env2 = getEnv();
|
|
4138
|
-
return env2
|
|
4162
|
+
return env2?.requests?.get(path ?? "/userinfo" /* PROFILE_PATH */, {
|
|
4139
4163
|
headers: {
|
|
4140
4164
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
4141
4165
|
}
|
|
@@ -4639,6 +4663,260 @@ var ViewService = {
|
|
|
4639
4663
|
}
|
|
4640
4664
|
};
|
|
4641
4665
|
var view_service_default = ViewService;
|
|
4666
|
+
|
|
4667
|
+
// src/services/auth-service/backup.ts
|
|
4668
|
+
var import_react5 = require("react");
|
|
4669
|
+
|
|
4670
|
+
// src/provider/react-query-provider.tsx
|
|
4671
|
+
var import_react_query = require("@tanstack/react-query");
|
|
4672
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
4673
|
+
|
|
4674
|
+
// src/provider/redux-provider.tsx
|
|
4675
|
+
var import_react_redux2 = require("react-redux");
|
|
4676
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
4677
|
+
|
|
4678
|
+
// src/provider/main-provider.tsx
|
|
4679
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
4680
|
+
|
|
4681
|
+
// src/provider/version-gate-provider.tsx
|
|
4682
|
+
var import_react3 = require("react");
|
|
4683
|
+
var import_react_query2 = require("@tanstack/react-query");
|
|
4684
|
+
|
|
4685
|
+
// src/services/view-service/backup.ts
|
|
4686
|
+
var import_react2 = require("react");
|
|
4687
|
+
|
|
4688
|
+
// src/provider/version-gate-provider.tsx
|
|
4689
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
4690
|
+
|
|
4691
|
+
// src/provider/env-provider.tsx
|
|
4692
|
+
var import_react4 = require("react");
|
|
4693
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
4694
|
+
var EnvContext = (0, import_react4.createContext)(null);
|
|
4695
|
+
function useEnv() {
|
|
4696
|
+
const context = (0, import_react4.useContext)(EnvContext);
|
|
4697
|
+
if (!context) {
|
|
4698
|
+
throw new Error("useEnv must be used within an EnvProvider");
|
|
4699
|
+
}
|
|
4700
|
+
return context;
|
|
4701
|
+
}
|
|
4702
|
+
|
|
4703
|
+
// src/services/auth-service/backup.ts
|
|
4704
|
+
function useAuthService() {
|
|
4705
|
+
const { env: env2 } = useEnv();
|
|
4706
|
+
const login = (0, import_react5.useCallback)(
|
|
4707
|
+
async (body) => {
|
|
4708
|
+
const payload = Object.fromEntries(
|
|
4709
|
+
Object.entries({
|
|
4710
|
+
username: body.email,
|
|
4711
|
+
password: body.password,
|
|
4712
|
+
grant_type: env2?.config?.grantType || "",
|
|
4713
|
+
client_id: env2?.config?.clientId || "",
|
|
4714
|
+
client_secret: env2?.config?.clientSecret || ""
|
|
4715
|
+
}).filter(([_, value]) => !!value)
|
|
4716
|
+
);
|
|
4717
|
+
const encodedData = new URLSearchParams(payload).toString();
|
|
4718
|
+
return env2?.requests?.post(body.path, encodedData, {
|
|
4719
|
+
headers: {
|
|
4720
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
4721
|
+
}
|
|
4722
|
+
});
|
|
4723
|
+
},
|
|
4724
|
+
[env2]
|
|
4725
|
+
);
|
|
4726
|
+
const forgotPassword = (0, import_react5.useCallback)(
|
|
4727
|
+
async (email) => {
|
|
4728
|
+
const bodyData = {
|
|
4729
|
+
login: email,
|
|
4730
|
+
url: `${window.location.origin}/reset-password`
|
|
4731
|
+
};
|
|
4732
|
+
return env2?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
|
|
4733
|
+
headers: {
|
|
4734
|
+
"Content-Type": "application/json"
|
|
4735
|
+
}
|
|
4736
|
+
});
|
|
4737
|
+
},
|
|
4738
|
+
[env2]
|
|
4739
|
+
);
|
|
4740
|
+
const forgotPasswordSSO = (0, import_react5.useCallback)(
|
|
4741
|
+
async ({
|
|
4742
|
+
email,
|
|
4743
|
+
with_context,
|
|
4744
|
+
method
|
|
4745
|
+
}) => {
|
|
4746
|
+
const body = {
|
|
4747
|
+
method,
|
|
4748
|
+
kwargs: {
|
|
4749
|
+
vals: {
|
|
4750
|
+
email
|
|
4751
|
+
}
|
|
4752
|
+
},
|
|
4753
|
+
with_context
|
|
4754
|
+
};
|
|
4755
|
+
return env2?.requests?.post("/call" /* CALL_PATH */, body, {
|
|
4756
|
+
headers: {
|
|
4757
|
+
"Content-Type": "application/json"
|
|
4758
|
+
}
|
|
4759
|
+
});
|
|
4760
|
+
},
|
|
4761
|
+
[env2]
|
|
4762
|
+
);
|
|
4763
|
+
const resetPassword = (0, import_react5.useCallback)(
|
|
4764
|
+
async (data, token) => {
|
|
4765
|
+
const bodyData = {
|
|
4766
|
+
token,
|
|
4767
|
+
password: data.password,
|
|
4768
|
+
new_password: data.confirmPassword
|
|
4769
|
+
};
|
|
4770
|
+
return env2?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
|
|
4771
|
+
headers: {
|
|
4772
|
+
"Content-Type": "application/json"
|
|
4773
|
+
}
|
|
4774
|
+
});
|
|
4775
|
+
},
|
|
4776
|
+
[env2]
|
|
4777
|
+
);
|
|
4778
|
+
const resetPasswordSSO = (0, import_react5.useCallback)(
|
|
4779
|
+
async ({
|
|
4780
|
+
method,
|
|
4781
|
+
password,
|
|
4782
|
+
with_context
|
|
4783
|
+
}) => {
|
|
4784
|
+
const bodyData = {
|
|
4785
|
+
method,
|
|
4786
|
+
kwargs: {
|
|
4787
|
+
vals: {
|
|
4788
|
+
password
|
|
4789
|
+
}
|
|
4790
|
+
},
|
|
4791
|
+
with_context
|
|
4792
|
+
};
|
|
4793
|
+
return env2?.requests?.post("/call" /* CALL_PATH */, bodyData, {
|
|
4794
|
+
headers: {
|
|
4795
|
+
"Content-Type": "application/json"
|
|
4796
|
+
}
|
|
4797
|
+
});
|
|
4798
|
+
},
|
|
4799
|
+
[env2]
|
|
4800
|
+
);
|
|
4801
|
+
const updatePassword = (0, import_react5.useCallback)(
|
|
4802
|
+
async (data, token) => {
|
|
4803
|
+
const bodyData = {
|
|
4804
|
+
token,
|
|
4805
|
+
old_password: data.oldPassword,
|
|
4806
|
+
new_password: data.newPassword
|
|
4807
|
+
};
|
|
4808
|
+
return env2?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
|
|
4809
|
+
headers: {
|
|
4810
|
+
"Content-Type": "application/json"
|
|
4811
|
+
}
|
|
4812
|
+
});
|
|
4813
|
+
},
|
|
4814
|
+
[env2]
|
|
4815
|
+
);
|
|
4816
|
+
const isValidToken = (0, import_react5.useCallback)(
|
|
4817
|
+
async (token) => {
|
|
4818
|
+
const bodyData = {
|
|
4819
|
+
token
|
|
4820
|
+
};
|
|
4821
|
+
return env2?.requests?.post("/check_token" /* TOKEN */, bodyData, {
|
|
4822
|
+
headers: {
|
|
4823
|
+
"Content-Type": "application/json"
|
|
4824
|
+
}
|
|
4825
|
+
});
|
|
4826
|
+
},
|
|
4827
|
+
[env2]
|
|
4828
|
+
);
|
|
4829
|
+
const isValidActionToken = (0, import_react5.useCallback)(
|
|
4830
|
+
async (actionToken, path) => {
|
|
4831
|
+
return env2?.requests?.post(
|
|
4832
|
+
path,
|
|
4833
|
+
{},
|
|
4834
|
+
{
|
|
4835
|
+
headers: {
|
|
4836
|
+
"Content-Type": "application/json"
|
|
4837
|
+
},
|
|
4838
|
+
useActionToken: true,
|
|
4839
|
+
actionToken
|
|
4840
|
+
}
|
|
4841
|
+
);
|
|
4842
|
+
},
|
|
4843
|
+
[env2]
|
|
4844
|
+
);
|
|
4845
|
+
const loginSocial = (0, import_react5.useCallback)(
|
|
4846
|
+
async ({
|
|
4847
|
+
db,
|
|
4848
|
+
state,
|
|
4849
|
+
access_token
|
|
4850
|
+
}) => {
|
|
4851
|
+
return env2?.requests?.post(
|
|
4852
|
+
"/token/generate" /* GENTOKEN_SOCIAL */,
|
|
4853
|
+
{ state, access_token },
|
|
4854
|
+
{
|
|
4855
|
+
headers: {
|
|
4856
|
+
"Content-Type": "application/json"
|
|
4857
|
+
}
|
|
4858
|
+
}
|
|
4859
|
+
);
|
|
4860
|
+
},
|
|
4861
|
+
[env2]
|
|
4862
|
+
);
|
|
4863
|
+
const getProviders = (0, import_react5.useCallback)(
|
|
4864
|
+
async (db) => {
|
|
4865
|
+
return env2?.requests?.get("/oauth/providers", { params: { db } });
|
|
4866
|
+
},
|
|
4867
|
+
[env2]
|
|
4868
|
+
);
|
|
4869
|
+
const getAccessByCode = (0, import_react5.useCallback)(
|
|
4870
|
+
async (code) => {
|
|
4871
|
+
const data = new URLSearchParams();
|
|
4872
|
+
data.append("code", code);
|
|
4873
|
+
data.append("grant_type", "authorization_code");
|
|
4874
|
+
data.append("client_id", env2?.config?.clientId || "");
|
|
4875
|
+
data.append("redirect_uri", env2?.config?.redirectUri || "");
|
|
4876
|
+
return env2?.requests?.post(
|
|
4877
|
+
`${env2?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
|
|
4878
|
+
data,
|
|
4879
|
+
{
|
|
4880
|
+
headers: {
|
|
4881
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
4882
|
+
}
|
|
4883
|
+
}
|
|
4884
|
+
);
|
|
4885
|
+
},
|
|
4886
|
+
[env2]
|
|
4887
|
+
);
|
|
4888
|
+
const logout = (0, import_react5.useCallback)(
|
|
4889
|
+
async (data) => {
|
|
4890
|
+
console.log(data);
|
|
4891
|
+
return env2?.requests?.post(
|
|
4892
|
+
"/logout" /* LOGOUT */,
|
|
4893
|
+
{},
|
|
4894
|
+
{
|
|
4895
|
+
headers: {
|
|
4896
|
+
"Content-Type": "application/json"
|
|
4897
|
+
},
|
|
4898
|
+
withCredentials: true,
|
|
4899
|
+
useRefreshToken: true
|
|
4900
|
+
}
|
|
4901
|
+
);
|
|
4902
|
+
},
|
|
4903
|
+
[env2]
|
|
4904
|
+
);
|
|
4905
|
+
return {
|
|
4906
|
+
login,
|
|
4907
|
+
forgotPassword,
|
|
4908
|
+
forgotPasswordSSO,
|
|
4909
|
+
resetPassword,
|
|
4910
|
+
resetPasswordSSO,
|
|
4911
|
+
updatePassword,
|
|
4912
|
+
isValidToken,
|
|
4913
|
+
isValidActionToken,
|
|
4914
|
+
loginSocial,
|
|
4915
|
+
getProviders,
|
|
4916
|
+
getAccessByCode,
|
|
4917
|
+
logout
|
|
4918
|
+
};
|
|
4919
|
+
}
|
|
4642
4920
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4643
4921
|
0 && (module.exports = {
|
|
4644
4922
|
ActionService,
|
|
@@ -4649,5 +4927,6 @@ var view_service_default = ViewService;
|
|
|
4649
4927
|
KanbanService,
|
|
4650
4928
|
ModelService,
|
|
4651
4929
|
UserService,
|
|
4652
|
-
ViewService
|
|
4930
|
+
ViewService,
|
|
4931
|
+
useAuthService
|
|
4653
4932
|
});
|