@fctc/interface-logic 1.7.9 → 1.7.10
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.d.mts +4 -1
- package/dist/configs.d.ts +4 -1
- package/dist/configs.js +12 -15
- package/dist/configs.mjs +12 -15
- package/dist/environment.d.mts +36 -19
- package/dist/environment.d.ts +36 -19
- package/dist/environment.js +92 -76
- package/dist/environment.mjs +90 -76
- package/dist/hooks.d.mts +7 -2
- package/dist/hooks.d.ts +7 -2
- package/dist/hooks.js +230 -189
- package/dist/hooks.mjs +189 -149
- package/dist/provider.d.mts +3 -4
- package/dist/provider.d.ts +3 -4
- package/dist/provider.js +89 -79
- package/dist/provider.mjs +89 -79
- package/dist/services.d.mts +2 -1
- package/dist/services.d.ts +2 -1
- package/dist/services.js +104 -79
- package/dist/services.mjs +104 -79
- package/dist/store.d.mts +569 -18
- package/dist/store.d.ts +569 -18
- package/dist/store.js +4 -4
- package/dist/store.mjs +4 -4
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/{view-type-D8ukwj_2.d.mts → view-type-BGJfDe73.d.mts} +1 -1
- package/dist/{view-type-D8ukwj_2.d.ts → view-type-BGJfDe73.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/store-DvWeB4jm.d.mts +0 -294
- package/dist/store-DvWeB4jm.d.ts +0 -294
package/dist/services.js
CHANGED
|
@@ -2251,9 +2251,9 @@ var sessionStorageUtils = () => {
|
|
|
2251
2251
|
// src/configs/axios-client.ts
|
|
2252
2252
|
var axiosClient = {
|
|
2253
2253
|
init(config) {
|
|
2254
|
-
const localStorage2 = config
|
|
2255
|
-
const sessionStorage2 = config
|
|
2256
|
-
const db = config
|
|
2254
|
+
const localStorage2 = config.localStorageUtils ?? localStorageUtils();
|
|
2255
|
+
const sessionStorage2 = config.sessionStorageUtils ?? sessionStorageUtils();
|
|
2256
|
+
const db = config.db;
|
|
2257
2257
|
let isRefreshing = false;
|
|
2258
2258
|
let failedQueue = [];
|
|
2259
2259
|
const processQueue = (error, token = null) => {
|
|
@@ -2272,19 +2272,16 @@ var axiosClient = {
|
|
|
2272
2272
|
timeout: 5e4,
|
|
2273
2273
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2274
2274
|
});
|
|
2275
|
-
instance.interceptors.request.use(
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
Promise.reject(error);
|
|
2286
|
-
}
|
|
2287
|
-
);
|
|
2275
|
+
instance.interceptors.request.use(async (config2) => {
|
|
2276
|
+
const { useRefreshToken, useActionToken, actionToken } = config2;
|
|
2277
|
+
if (useActionToken && actionToken) {
|
|
2278
|
+
config2.headers["Action-Token"] = actionToken;
|
|
2279
|
+
}
|
|
2280
|
+
const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
|
|
2281
|
+
const token = await getToken?.();
|
|
2282
|
+
if (token) config2.headers["Authorization"] = `Bearer ${token}`;
|
|
2283
|
+
return config2;
|
|
2284
|
+
}, Promise.reject);
|
|
2288
2285
|
instance.interceptors.response.use(
|
|
2289
2286
|
(response) => {
|
|
2290
2287
|
return handleResponse(response);
|
|
@@ -3039,69 +3036,84 @@ var envStore = (0, import_toolkit11.configureStore)({
|
|
|
3039
3036
|
});
|
|
3040
3037
|
|
|
3041
3038
|
// src/environment/EnvStore.ts
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3039
|
+
var EnvStore = class {
|
|
3040
|
+
envStore;
|
|
3041
|
+
baseUrl;
|
|
3042
|
+
requests;
|
|
3043
|
+
context;
|
|
3044
|
+
defaultCompany;
|
|
3045
|
+
config;
|
|
3046
|
+
companies;
|
|
3047
|
+
user;
|
|
3048
|
+
db;
|
|
3049
|
+
localStorageUtils;
|
|
3050
|
+
sessionStorageUtils;
|
|
3051
|
+
refreshTokenEndpoint;
|
|
3052
|
+
constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
|
|
3053
|
+
this.envStore = envStore2;
|
|
3054
|
+
this.localStorageUtils = localStorageUtils2;
|
|
3055
|
+
this.sessionStorageUtils = sessionStorageUtils2;
|
|
3056
|
+
this.setup();
|
|
3057
|
+
}
|
|
3058
|
+
setup() {
|
|
3059
|
+
const env2 = this.envStore.getState().env;
|
|
3060
|
+
this.baseUrl = env2?.baseUrl;
|
|
3061
|
+
this.requests = env2?.requests;
|
|
3062
|
+
this.context = env2?.context;
|
|
3063
|
+
this.defaultCompany = env2?.defaultCompany;
|
|
3064
|
+
this.config = env2?.config;
|
|
3065
|
+
this.companies = env2?.companies || [];
|
|
3066
|
+
this.user = env2?.user;
|
|
3067
|
+
this.db = env2?.db;
|
|
3068
|
+
this.refreshTokenEndpoint = env2?.refreshTokenEndpoint;
|
|
3069
|
+
}
|
|
3070
|
+
setupEnv(envConfig) {
|
|
3071
|
+
const dispatch = this.envStore.dispatch;
|
|
3072
|
+
const env2 = {
|
|
3050
3073
|
...envConfig,
|
|
3051
|
-
localStorageUtils:
|
|
3052
|
-
sessionStorageUtils:
|
|
3053
|
-
}
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
);
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
}
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
}
|
|
3088
|
-
|
|
3089
|
-
getEnvData,
|
|
3090
|
-
setupEnv,
|
|
3091
|
-
setLangValue,
|
|
3092
|
-
setUidValue,
|
|
3093
|
-
setAllowCompaniesValue,
|
|
3094
|
-
setCompaniesValue,
|
|
3095
|
-
setDefaultCompanyValue,
|
|
3096
|
-
setUserInfoValue
|
|
3097
|
-
};
|
|
3098
|
-
}
|
|
3074
|
+
localStorageUtils: this.localStorageUtils,
|
|
3075
|
+
sessionStorageUtils: this.sessionStorageUtils
|
|
3076
|
+
};
|
|
3077
|
+
const requests = axiosClient.init(env2);
|
|
3078
|
+
dispatch(setEnv({ ...env2, requests }));
|
|
3079
|
+
this.setup();
|
|
3080
|
+
}
|
|
3081
|
+
setUid(uid) {
|
|
3082
|
+
const dispatch = this.envStore.dispatch;
|
|
3083
|
+
dispatch(setUid(uid));
|
|
3084
|
+
this.setup();
|
|
3085
|
+
}
|
|
3086
|
+
setLang(lang) {
|
|
3087
|
+
const dispatch = this.envStore.dispatch;
|
|
3088
|
+
dispatch(setLang(lang));
|
|
3089
|
+
this.setup();
|
|
3090
|
+
}
|
|
3091
|
+
setAllowCompanies(allowCompanies) {
|
|
3092
|
+
const dispatch = this.envStore.dispatch;
|
|
3093
|
+
dispatch(setAllowCompanies(allowCompanies));
|
|
3094
|
+
this.setup();
|
|
3095
|
+
}
|
|
3096
|
+
setCompanies(companies) {
|
|
3097
|
+
const dispatch = this.envStore.dispatch;
|
|
3098
|
+
dispatch(setCompanies(companies));
|
|
3099
|
+
this.setup();
|
|
3100
|
+
}
|
|
3101
|
+
setDefaultCompany(company) {
|
|
3102
|
+
const dispatch = this.envStore.dispatch;
|
|
3103
|
+
dispatch(setDefaultCompany(company));
|
|
3104
|
+
this.setup();
|
|
3105
|
+
}
|
|
3106
|
+
setUserInfo(userInfo) {
|
|
3107
|
+
const dispatch = this.envStore.dispatch;
|
|
3108
|
+
dispatch(setUser(userInfo));
|
|
3109
|
+
this.setup();
|
|
3110
|
+
}
|
|
3111
|
+
};
|
|
3099
3112
|
var env = null;
|
|
3100
3113
|
function getEnv() {
|
|
3101
|
-
if (!env)
|
|
3102
|
-
env =
|
|
3103
|
-
|
|
3104
|
-
return env?.getEnvData();
|
|
3114
|
+
if (!env)
|
|
3115
|
+
env = new EnvStore(envStore, localStorageUtils(), sessionStorageUtils());
|
|
3116
|
+
return env;
|
|
3105
3117
|
}
|
|
3106
3118
|
|
|
3107
3119
|
// src/services/action-service/index.ts
|
|
@@ -3366,6 +3378,20 @@ var AuthService = {
|
|
|
3366
3378
|
}
|
|
3367
3379
|
});
|
|
3368
3380
|
},
|
|
3381
|
+
async isValidActionToken(actionToken, path) {
|
|
3382
|
+
const env2 = getEnv();
|
|
3383
|
+
return env2?.requests?.post(
|
|
3384
|
+
path,
|
|
3385
|
+
{},
|
|
3386
|
+
{
|
|
3387
|
+
headers: {
|
|
3388
|
+
"Content-Type": "application/json"
|
|
3389
|
+
},
|
|
3390
|
+
useActionToken: true,
|
|
3391
|
+
actionToken
|
|
3392
|
+
}
|
|
3393
|
+
);
|
|
3394
|
+
},
|
|
3369
3395
|
async loginSocial({
|
|
3370
3396
|
db,
|
|
3371
3397
|
state,
|
|
@@ -4130,7 +4156,7 @@ var model_service_default = ModelService;
|
|
|
4130
4156
|
var UserService = {
|
|
4131
4157
|
async getProfile(path) {
|
|
4132
4158
|
const env2 = getEnv();
|
|
4133
|
-
return env2
|
|
4159
|
+
return env2?.requests?.get(path ?? "/userinfo" /* PROFILE_PATH */, {
|
|
4134
4160
|
headers: {
|
|
4135
4161
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
4136
4162
|
}
|
|
@@ -4449,8 +4475,7 @@ var ViewService = {
|
|
|
4449
4475
|
},
|
|
4450
4476
|
async getVersion() {
|
|
4451
4477
|
const env2 = getEnv();
|
|
4452
|
-
|
|
4453
|
-
return env2?.requests?.get("", {
|
|
4478
|
+
return env2?.requests.get("", {
|
|
4454
4479
|
headers: {
|
|
4455
4480
|
"Content-Type": "application/json"
|
|
4456
4481
|
}
|
package/dist/services.mjs
CHANGED
|
@@ -2207,9 +2207,9 @@ var sessionStorageUtils = () => {
|
|
|
2207
2207
|
// src/configs/axios-client.ts
|
|
2208
2208
|
var axiosClient = {
|
|
2209
2209
|
init(config) {
|
|
2210
|
-
const localStorage2 = config
|
|
2211
|
-
const sessionStorage2 = config
|
|
2212
|
-
const db = config
|
|
2210
|
+
const localStorage2 = config.localStorageUtils ?? localStorageUtils();
|
|
2211
|
+
const sessionStorage2 = config.sessionStorageUtils ?? sessionStorageUtils();
|
|
2212
|
+
const db = config.db;
|
|
2213
2213
|
let isRefreshing = false;
|
|
2214
2214
|
let failedQueue = [];
|
|
2215
2215
|
const processQueue = (error, token = null) => {
|
|
@@ -2228,19 +2228,16 @@ var axiosClient = {
|
|
|
2228
2228
|
timeout: 5e4,
|
|
2229
2229
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2230
2230
|
});
|
|
2231
|
-
instance.interceptors.request.use(
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
Promise.reject(error);
|
|
2242
|
-
}
|
|
2243
|
-
);
|
|
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);
|
|
2244
2241
|
instance.interceptors.response.use(
|
|
2245
2242
|
(response) => {
|
|
2246
2243
|
return handleResponse(response);
|
|
@@ -2995,69 +2992,84 @@ var envStore = configureStore({
|
|
|
2995
2992
|
});
|
|
2996
2993
|
|
|
2997
2994
|
// src/environment/EnvStore.ts
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
2995
|
+
var EnvStore = class {
|
|
2996
|
+
envStore;
|
|
2997
|
+
baseUrl;
|
|
2998
|
+
requests;
|
|
2999
|
+
context;
|
|
3000
|
+
defaultCompany;
|
|
3001
|
+
config;
|
|
3002
|
+
companies;
|
|
3003
|
+
user;
|
|
3004
|
+
db;
|
|
3005
|
+
localStorageUtils;
|
|
3006
|
+
sessionStorageUtils;
|
|
3007
|
+
refreshTokenEndpoint;
|
|
3008
|
+
constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
|
|
3009
|
+
this.envStore = envStore2;
|
|
3010
|
+
this.localStorageUtils = localStorageUtils2;
|
|
3011
|
+
this.sessionStorageUtils = sessionStorageUtils2;
|
|
3012
|
+
this.setup();
|
|
3013
|
+
}
|
|
3014
|
+
setup() {
|
|
3015
|
+
const env2 = this.envStore.getState().env;
|
|
3016
|
+
this.baseUrl = env2?.baseUrl;
|
|
3017
|
+
this.requests = env2?.requests;
|
|
3018
|
+
this.context = env2?.context;
|
|
3019
|
+
this.defaultCompany = env2?.defaultCompany;
|
|
3020
|
+
this.config = env2?.config;
|
|
3021
|
+
this.companies = env2?.companies || [];
|
|
3022
|
+
this.user = env2?.user;
|
|
3023
|
+
this.db = env2?.db;
|
|
3024
|
+
this.refreshTokenEndpoint = env2?.refreshTokenEndpoint;
|
|
3025
|
+
}
|
|
3026
|
+
setupEnv(envConfig) {
|
|
3027
|
+
const dispatch = this.envStore.dispatch;
|
|
3028
|
+
const env2 = {
|
|
3006
3029
|
...envConfig,
|
|
3007
|
-
localStorageUtils:
|
|
3008
|
-
sessionStorageUtils:
|
|
3009
|
-
}
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
);
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
}
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
}
|
|
3044
|
-
|
|
3045
|
-
getEnvData,
|
|
3046
|
-
setupEnv,
|
|
3047
|
-
setLangValue,
|
|
3048
|
-
setUidValue,
|
|
3049
|
-
setAllowCompaniesValue,
|
|
3050
|
-
setCompaniesValue,
|
|
3051
|
-
setDefaultCompanyValue,
|
|
3052
|
-
setUserInfoValue
|
|
3053
|
-
};
|
|
3054
|
-
}
|
|
3030
|
+
localStorageUtils: this.localStorageUtils,
|
|
3031
|
+
sessionStorageUtils: this.sessionStorageUtils
|
|
3032
|
+
};
|
|
3033
|
+
const requests = axiosClient.init(env2);
|
|
3034
|
+
dispatch(setEnv({ ...env2, requests }));
|
|
3035
|
+
this.setup();
|
|
3036
|
+
}
|
|
3037
|
+
setUid(uid) {
|
|
3038
|
+
const dispatch = this.envStore.dispatch;
|
|
3039
|
+
dispatch(setUid(uid));
|
|
3040
|
+
this.setup();
|
|
3041
|
+
}
|
|
3042
|
+
setLang(lang) {
|
|
3043
|
+
const dispatch = this.envStore.dispatch;
|
|
3044
|
+
dispatch(setLang(lang));
|
|
3045
|
+
this.setup();
|
|
3046
|
+
}
|
|
3047
|
+
setAllowCompanies(allowCompanies) {
|
|
3048
|
+
const dispatch = this.envStore.dispatch;
|
|
3049
|
+
dispatch(setAllowCompanies(allowCompanies));
|
|
3050
|
+
this.setup();
|
|
3051
|
+
}
|
|
3052
|
+
setCompanies(companies) {
|
|
3053
|
+
const dispatch = this.envStore.dispatch;
|
|
3054
|
+
dispatch(setCompanies(companies));
|
|
3055
|
+
this.setup();
|
|
3056
|
+
}
|
|
3057
|
+
setDefaultCompany(company) {
|
|
3058
|
+
const dispatch = this.envStore.dispatch;
|
|
3059
|
+
dispatch(setDefaultCompany(company));
|
|
3060
|
+
this.setup();
|
|
3061
|
+
}
|
|
3062
|
+
setUserInfo(userInfo) {
|
|
3063
|
+
const dispatch = this.envStore.dispatch;
|
|
3064
|
+
dispatch(setUser(userInfo));
|
|
3065
|
+
this.setup();
|
|
3066
|
+
}
|
|
3067
|
+
};
|
|
3055
3068
|
var env = null;
|
|
3056
3069
|
function getEnv() {
|
|
3057
|
-
if (!env)
|
|
3058
|
-
env =
|
|
3059
|
-
|
|
3060
|
-
return env?.getEnvData();
|
|
3070
|
+
if (!env)
|
|
3071
|
+
env = new EnvStore(envStore, localStorageUtils(), sessionStorageUtils());
|
|
3072
|
+
return env;
|
|
3061
3073
|
}
|
|
3062
3074
|
|
|
3063
3075
|
// src/services/action-service/index.ts
|
|
@@ -3322,6 +3334,20 @@ var AuthService = {
|
|
|
3322
3334
|
}
|
|
3323
3335
|
});
|
|
3324
3336
|
},
|
|
3337
|
+
async isValidActionToken(actionToken, path) {
|
|
3338
|
+
const env2 = getEnv();
|
|
3339
|
+
return env2?.requests?.post(
|
|
3340
|
+
path,
|
|
3341
|
+
{},
|
|
3342
|
+
{
|
|
3343
|
+
headers: {
|
|
3344
|
+
"Content-Type": "application/json"
|
|
3345
|
+
},
|
|
3346
|
+
useActionToken: true,
|
|
3347
|
+
actionToken
|
|
3348
|
+
}
|
|
3349
|
+
);
|
|
3350
|
+
},
|
|
3325
3351
|
async loginSocial({
|
|
3326
3352
|
db,
|
|
3327
3353
|
state,
|
|
@@ -4086,7 +4112,7 @@ var model_service_default = ModelService;
|
|
|
4086
4112
|
var UserService = {
|
|
4087
4113
|
async getProfile(path) {
|
|
4088
4114
|
const env2 = getEnv();
|
|
4089
|
-
return env2
|
|
4115
|
+
return env2?.requests?.get(path ?? "/userinfo" /* PROFILE_PATH */, {
|
|
4090
4116
|
headers: {
|
|
4091
4117
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
4092
4118
|
}
|
|
@@ -4405,8 +4431,7 @@ var ViewService = {
|
|
|
4405
4431
|
},
|
|
4406
4432
|
async getVersion() {
|
|
4407
4433
|
const env2 = getEnv();
|
|
4408
|
-
|
|
4409
|
-
return env2?.requests?.get("", {
|
|
4434
|
+
return env2?.requests.get("", {
|
|
4410
4435
|
headers: {
|
|
4411
4436
|
"Content-Type": "application/json"
|
|
4412
4437
|
}
|