@fctc/interface-logic 1.0.9 → 1.2.0
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/config.js +7 -34
- package/dist/config.mjs +7 -34
- package/dist/constants.d.mts +1 -4
- package/dist/constants.d.ts +1 -4
- package/dist/constants.js +0 -3
- package/dist/constants.mjs +0 -3
- package/dist/environment.d.mts +0 -1
- package/dist/environment.d.ts +0 -1
- package/dist/environment.js +7 -36
- package/dist/environment.mjs +7 -36
- package/dist/hook.d.mts +1 -45
- package/dist/hook.d.ts +1 -45
- package/dist/hook.js +112 -444
- package/dist/hook.mjs +71 -395
- package/dist/index.d.mts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +152 -452
- package/dist/index.mjs +106 -398
- package/dist/model.js +7 -39
- package/dist/model.mjs +7 -39
- package/dist/provider.d.mts +3 -4
- package/dist/provider.d.ts +3 -4
- package/dist/provider.js +13 -160
- package/dist/provider.mjs +13 -160
- package/dist/services.d.mts +1 -35
- package/dist/services.d.ts +1 -35
- package/dist/services.js +10 -192
- package/dist/services.mjs +10 -192
- package/dist/utils.d.mts +7 -4
- package/dist/utils.d.ts +7 -4
- package/dist/utils.js +35 -21
- package/dist/utils.mjs +34 -20
- package/package.json +87 -87
package/dist/services.js
CHANGED
@@ -66,9 +66,6 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
|
|
66
66
|
UriConstants2["CREATE_UPDATE_PATH"] = `/create_update`;
|
67
67
|
UriConstants2["TWOFA_METHOD_PATH"] = `/id/api/v2/call`;
|
68
68
|
UriConstants2["SIGNIN_SSO"] = `/signin-sso/oauth`;
|
69
|
-
UriConstants2["GRANT_ACCESS"] = "/grant-access";
|
70
|
-
UriConstants2["TOKEN_BY_CODE"] = "/token";
|
71
|
-
UriConstants2["LOGOUT"] = "/logout";
|
72
69
|
return UriConstants2;
|
73
70
|
})(UriConstants || {});
|
74
71
|
|
@@ -2185,30 +2182,12 @@ function matchDomain(record, domain) {
|
|
2185
2182
|
}
|
2186
2183
|
|
2187
2184
|
// src/utils/function.ts
|
2185
|
+
var import_react = require("react");
|
2188
2186
|
var toQueryString = (params) => {
|
2189
2187
|
return Object.keys(params).map(
|
2190
2188
|
(key) => encodeURIComponent(key) + "=" + encodeURIComponent(params[key].toString())
|
2191
2189
|
).join("&");
|
2192
2190
|
};
|
2193
|
-
var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
|
2194
|
-
if (!originalRequest.data) return originalRequest.data;
|
2195
|
-
if (typeof originalRequest.data === "string") {
|
2196
|
-
try {
|
2197
|
-
const parsedData = JSON.parse(originalRequest.data);
|
2198
|
-
if (parsedData.with_context && typeof parsedData.with_context === "object") {
|
2199
|
-
parsedData.with_context.token = newAccessToken;
|
2200
|
-
}
|
2201
|
-
return JSON.stringify(parsedData);
|
2202
|
-
} catch (e) {
|
2203
|
-
console.warn("Failed to parse originalRequest.data", e);
|
2204
|
-
return originalRequest.data;
|
2205
|
-
}
|
2206
|
-
}
|
2207
|
-
if (typeof originalRequest.data === "object" && originalRequest.data.with_context) {
|
2208
|
-
originalRequest.data.with_context.token = newAccessToken;
|
2209
|
-
}
|
2210
|
-
return originalRequest.data;
|
2211
|
-
};
|
2212
2191
|
|
2213
2192
|
// src/utils/storage/local-storage.ts
|
2214
2193
|
var localStorageUtils = () => {
|
@@ -2273,8 +2252,7 @@ var axiosClient = {
|
|
2273
2252
|
});
|
2274
2253
|
instance.interceptors.request.use(
|
2275
2254
|
async (config2) => {
|
2276
|
-
const
|
2277
|
-
const token = useRefreshToken ? await localStorage2.getRefreshToken() : await localStorage2.getAccessToken();
|
2255
|
+
const token = await localStorage2.getAccessToken();
|
2278
2256
|
if (token) {
|
2279
2257
|
config2.headers["Authorization"] = "Bearer " + token;
|
2280
2258
|
}
|
@@ -2300,7 +2278,7 @@ var axiosClient = {
|
|
2300
2278
|
return data;
|
2301
2279
|
};
|
2302
2280
|
const originalRequest = error.config;
|
2303
|
-
if ((error.response?.status === 403 || error.response?.status === 401 || error.response?.status === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401
|
2281
|
+
if ((error.response?.status === 403 || error.response?.status === 401 || error.response?.status === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401].includes(
|
2304
2282
|
error.response.data.code
|
2305
2283
|
)) {
|
2306
2284
|
if (isRefreshing) {
|
@@ -2308,10 +2286,6 @@ var axiosClient = {
|
|
2308
2286
|
failedQueue.push({ resolve, reject });
|
2309
2287
|
}).then((token) => {
|
2310
2288
|
originalRequest.headers["Authorization"] = "Bearer " + token;
|
2311
|
-
originalRequest.data = updateTokenParamInOriginalRequest(
|
2312
|
-
originalRequest,
|
2313
|
-
token
|
2314
|
-
);
|
2315
2289
|
return instance.request(originalRequest);
|
2316
2290
|
}).catch(async (err) => {
|
2317
2291
|
if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
|
@@ -2336,11 +2310,11 @@ var axiosClient = {
|
|
2336
2310
|
);
|
2337
2311
|
return new Promise(function(resolve) {
|
2338
2312
|
import_axios.default.post(
|
2339
|
-
`${config.baseUrl}${
|
2313
|
+
`${config.baseUrl}${"/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
|
2340
2314
|
payload,
|
2341
2315
|
{
|
2342
2316
|
headers: {
|
2343
|
-
"Content-Type":
|
2317
|
+
"Content-Type": "multipart/form-data",
|
2344
2318
|
Authorization: `Bearer ${accessTokenExp}`
|
2345
2319
|
}
|
2346
2320
|
}
|
@@ -2350,14 +2324,10 @@ var axiosClient = {
|
|
2350
2324
|
await localStorage2.setRefreshToken(data.refresh_token);
|
2351
2325
|
import_axios.default.defaults.headers.common["Authorization"] = "Bearer " + data.access_token;
|
2352
2326
|
originalRequest.headers["Authorization"] = "Bearer " + data.access_token;
|
2353
|
-
originalRequest.data = updateTokenParamInOriginalRequest(
|
2354
|
-
originalRequest,
|
2355
|
-
data.access_token
|
2356
|
-
);
|
2357
2327
|
processQueue(null, data.access_token);
|
2358
2328
|
resolve(instance.request(originalRequest));
|
2359
2329
|
}).catch(async (err) => {
|
2360
|
-
if (err && (err?.error_code === "AUTHEN_FAIL" || err?.error_code === "TOKEN_EXPIRED" || err?.error_code === "TOKEN_INCORRECT" || err?.code === "ERR_BAD_REQUEST")
|
2330
|
+
if (err && (err?.error_code === "AUTHEN_FAIL" || err?.error_code === "TOKEN_EXPIRED" || err?.error_code === "TOKEN_INCORRECT" || err?.code === "ERR_BAD_REQUEST")) {
|
2361
2331
|
await clearAuthToken();
|
2362
2332
|
}
|
2363
2333
|
if (err && err.response) {
|
@@ -2407,7 +2377,7 @@ var axiosClient = {
|
|
2407
2377
|
const responseBody = (response) => response;
|
2408
2378
|
const requests = {
|
2409
2379
|
get: (url, headers) => instance.get(formatUrl(url, db), headers).then(responseBody),
|
2410
|
-
post: (url, body, headers) => instance.post(formatUrl(url, db), body, headers).then(responseBody),
|
2380
|
+
post: (url, body, headers) => instance.post(formatUrl(url, db), body, { headers }).then(responseBody),
|
2411
2381
|
post_excel: (url, body, headers) => instance.post(formatUrl(url, db), body, {
|
2412
2382
|
responseType: "arraybuffer",
|
2413
2383
|
headers: {
|
@@ -3050,7 +3020,6 @@ var EnvStore = class {
|
|
3050
3020
|
db;
|
3051
3021
|
localStorageUtils;
|
3052
3022
|
sessionStorageUtils;
|
3053
|
-
refreshTokenEndpoint;
|
3054
3023
|
constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
|
3055
3024
|
this.envStore = envStore2;
|
3056
3025
|
this.localStorageUtils = localStorageUtils2;
|
@@ -3067,7 +3036,6 @@ var EnvStore = class {
|
|
3067
3036
|
this.companies = env2?.companies || [];
|
3068
3037
|
this.user = env2?.user;
|
3069
3038
|
this.db = env2?.db;
|
3070
|
-
this.refreshTokenEndpoint = env2?.refreshTokenEndpoint;
|
3071
3039
|
}
|
3072
3040
|
setupEnv(envConfig) {
|
3073
3041
|
const dispatch = this.envStore.dispatch;
|
@@ -3399,38 +3367,6 @@ var AuthService = {
|
|
3399
3367
|
async getProviders(db) {
|
3400
3368
|
const env2 = getEnv();
|
3401
3369
|
return env2?.requests?.get("/oauth/providers", { params: { db } });
|
3402
|
-
},
|
3403
|
-
async getAccessByCode(code) {
|
3404
|
-
const env2 = getEnv();
|
3405
|
-
const data = new URLSearchParams();
|
3406
|
-
data.append("code", code);
|
3407
|
-
data.append("grant_type", "authorization_code");
|
3408
|
-
data.append("client_id", env2?.config?.clientId || "");
|
3409
|
-
data.append("redirect_uri", env2?.config?.redirectUri || "");
|
3410
|
-
return env2?.requests?.post(
|
3411
|
-
`${env2?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
|
3412
|
-
data,
|
3413
|
-
{
|
3414
|
-
headers: {
|
3415
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
3416
|
-
}
|
3417
|
-
}
|
3418
|
-
);
|
3419
|
-
},
|
3420
|
-
async logout(data) {
|
3421
|
-
const env2 = getEnv();
|
3422
|
-
console.log(data);
|
3423
|
-
return env2?.requests?.post(
|
3424
|
-
"/logout" /* LOGOUT */,
|
3425
|
-
{},
|
3426
|
-
{
|
3427
|
-
headers: {
|
3428
|
-
"Content-Type": "application/json"
|
3429
|
-
},
|
3430
|
-
withCredentials: true,
|
3431
|
-
useRefreshToken: true
|
3432
|
-
}
|
3433
|
-
);
|
3434
3370
|
}
|
3435
3371
|
};
|
3436
3372
|
var auth_service_default = AuthService;
|
@@ -4486,18 +4422,14 @@ var ViewService = {
|
|
4486
4422
|
async verify2FA({
|
4487
4423
|
method,
|
4488
4424
|
with_context,
|
4489
|
-
code
|
4490
|
-
device,
|
4491
|
-
location
|
4425
|
+
code
|
4492
4426
|
}) {
|
4493
4427
|
const env2 = getEnv();
|
4494
4428
|
const jsonData = {
|
4495
4429
|
method,
|
4496
4430
|
kwargs: {
|
4497
4431
|
vals: {
|
4498
|
-
code
|
4499
|
-
device,
|
4500
|
-
location
|
4432
|
+
code
|
4501
4433
|
}
|
4502
4434
|
},
|
4503
4435
|
with_context
|
@@ -4505,8 +4437,7 @@ var ViewService = {
|
|
4505
4437
|
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
4506
4438
|
headers: {
|
4507
4439
|
"Content-Type": "application/json"
|
4508
|
-
}
|
4509
|
-
withCredentials: true
|
4440
|
+
}
|
4510
4441
|
});
|
4511
4442
|
},
|
4512
4443
|
async signInSSO({
|
@@ -4530,119 +4461,6 @@ var ViewService = {
|
|
4530
4461
|
"Content-Type": "application/json"
|
4531
4462
|
}
|
4532
4463
|
});
|
4533
|
-
},
|
4534
|
-
async grantAccess({
|
4535
|
-
redirect_uri,
|
4536
|
-
state,
|
4537
|
-
client_id,
|
4538
|
-
scopes
|
4539
|
-
}) {
|
4540
|
-
const env2 = getEnv();
|
4541
|
-
const jsonData = {
|
4542
|
-
redirect_uri,
|
4543
|
-
state,
|
4544
|
-
client_id,
|
4545
|
-
scopes
|
4546
|
-
};
|
4547
|
-
return env2?.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
|
4548
|
-
headers: {
|
4549
|
-
"Content-Type": "application/json"
|
4550
|
-
},
|
4551
|
-
withCredentials: true
|
4552
|
-
});
|
4553
|
-
},
|
4554
|
-
async getFieldsViewSecurity({
|
4555
|
-
method,
|
4556
|
-
token,
|
4557
|
-
views
|
4558
|
-
}) {
|
4559
|
-
const env2 = getEnv();
|
4560
|
-
const jsonData = {
|
4561
|
-
method,
|
4562
|
-
kwargs: {
|
4563
|
-
views
|
4564
|
-
},
|
4565
|
-
with_context: {
|
4566
|
-
token
|
4567
|
-
}
|
4568
|
-
};
|
4569
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
4570
|
-
headers: {
|
4571
|
-
"Content-Type": "application/json"
|
4572
|
-
}
|
4573
|
-
});
|
4574
|
-
},
|
4575
|
-
async settingsWebRead2fa({
|
4576
|
-
method,
|
4577
|
-
model,
|
4578
|
-
kwargs,
|
4579
|
-
token
|
4580
|
-
}) {
|
4581
|
-
const env2 = getEnv();
|
4582
|
-
const jsonData = {
|
4583
|
-
method,
|
4584
|
-
model,
|
4585
|
-
kwargs,
|
4586
|
-
with_context: {
|
4587
|
-
token
|
4588
|
-
}
|
4589
|
-
};
|
4590
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
4591
|
-
headers: {
|
4592
|
-
"Content-Type": "application/json"
|
4593
|
-
}
|
4594
|
-
});
|
4595
|
-
},
|
4596
|
-
async requestSetupTotp({ method, token }) {
|
4597
|
-
const env2 = getEnv();
|
4598
|
-
const jsonData = {
|
4599
|
-
method,
|
4600
|
-
with_context: {
|
4601
|
-
token
|
4602
|
-
}
|
4603
|
-
};
|
4604
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
4605
|
-
headers: {
|
4606
|
-
"Content-Type": "application/json"
|
4607
|
-
}
|
4608
|
-
});
|
4609
|
-
},
|
4610
|
-
async verifyTotp({
|
4611
|
-
method,
|
4612
|
-
action_token,
|
4613
|
-
code
|
4614
|
-
}) {
|
4615
|
-
const env2 = getEnv();
|
4616
|
-
const jsonData = {
|
4617
|
-
method,
|
4618
|
-
kwargs: {
|
4619
|
-
vals: {
|
4620
|
-
code
|
4621
|
-
}
|
4622
|
-
},
|
4623
|
-
with_context: {
|
4624
|
-
action_token
|
4625
|
-
}
|
4626
|
-
};
|
4627
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
4628
|
-
headers: {
|
4629
|
-
"Content-Type": "application/json"
|
4630
|
-
}
|
4631
|
-
});
|
4632
|
-
},
|
4633
|
-
async removeTotpSetUp({ method, token }) {
|
4634
|
-
const env2 = getEnv();
|
4635
|
-
const jsonData = {
|
4636
|
-
method,
|
4637
|
-
with_context: {
|
4638
|
-
token
|
4639
|
-
}
|
4640
|
-
};
|
4641
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
4642
|
-
headers: {
|
4643
|
-
"Content-Type": "application/json"
|
4644
|
-
}
|
4645
|
-
});
|
4646
4464
|
}
|
4647
4465
|
};
|
4648
4466
|
var view_service_default = ViewService;
|
package/dist/services.mjs
CHANGED
@@ -22,9 +22,6 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
|
|
22
22
|
UriConstants2["CREATE_UPDATE_PATH"] = `/create_update`;
|
23
23
|
UriConstants2["TWOFA_METHOD_PATH"] = `/id/api/v2/call`;
|
24
24
|
UriConstants2["SIGNIN_SSO"] = `/signin-sso/oauth`;
|
25
|
-
UriConstants2["GRANT_ACCESS"] = "/grant-access";
|
26
|
-
UriConstants2["TOKEN_BY_CODE"] = "/token";
|
27
|
-
UriConstants2["LOGOUT"] = "/logout";
|
28
25
|
return UriConstants2;
|
29
26
|
})(UriConstants || {});
|
30
27
|
|
@@ -2141,30 +2138,12 @@ function matchDomain(record, domain) {
|
|
2141
2138
|
}
|
2142
2139
|
|
2143
2140
|
// src/utils/function.ts
|
2141
|
+
import { useEffect, useState } from "react";
|
2144
2142
|
var toQueryString = (params) => {
|
2145
2143
|
return Object.keys(params).map(
|
2146
2144
|
(key) => encodeURIComponent(key) + "=" + encodeURIComponent(params[key].toString())
|
2147
2145
|
).join("&");
|
2148
2146
|
};
|
2149
|
-
var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
|
2150
|
-
if (!originalRequest.data) return originalRequest.data;
|
2151
|
-
if (typeof originalRequest.data === "string") {
|
2152
|
-
try {
|
2153
|
-
const parsedData = JSON.parse(originalRequest.data);
|
2154
|
-
if (parsedData.with_context && typeof parsedData.with_context === "object") {
|
2155
|
-
parsedData.with_context.token = newAccessToken;
|
2156
|
-
}
|
2157
|
-
return JSON.stringify(parsedData);
|
2158
|
-
} catch (e) {
|
2159
|
-
console.warn("Failed to parse originalRequest.data", e);
|
2160
|
-
return originalRequest.data;
|
2161
|
-
}
|
2162
|
-
}
|
2163
|
-
if (typeof originalRequest.data === "object" && originalRequest.data.with_context) {
|
2164
|
-
originalRequest.data.with_context.token = newAccessToken;
|
2165
|
-
}
|
2166
|
-
return originalRequest.data;
|
2167
|
-
};
|
2168
2147
|
|
2169
2148
|
// src/utils/storage/local-storage.ts
|
2170
2149
|
var localStorageUtils = () => {
|
@@ -2229,8 +2208,7 @@ var axiosClient = {
|
|
2229
2208
|
});
|
2230
2209
|
instance.interceptors.request.use(
|
2231
2210
|
async (config2) => {
|
2232
|
-
const
|
2233
|
-
const token = useRefreshToken ? await localStorage2.getRefreshToken() : await localStorage2.getAccessToken();
|
2211
|
+
const token = await localStorage2.getAccessToken();
|
2234
2212
|
if (token) {
|
2235
2213
|
config2.headers["Authorization"] = "Bearer " + token;
|
2236
2214
|
}
|
@@ -2256,7 +2234,7 @@ var axiosClient = {
|
|
2256
2234
|
return data;
|
2257
2235
|
};
|
2258
2236
|
const originalRequest = error.config;
|
2259
|
-
if ((error.response?.status === 403 || error.response?.status === 401 || error.response?.status === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401
|
2237
|
+
if ((error.response?.status === 403 || error.response?.status === 401 || error.response?.status === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401].includes(
|
2260
2238
|
error.response.data.code
|
2261
2239
|
)) {
|
2262
2240
|
if (isRefreshing) {
|
@@ -2264,10 +2242,6 @@ var axiosClient = {
|
|
2264
2242
|
failedQueue.push({ resolve, reject });
|
2265
2243
|
}).then((token) => {
|
2266
2244
|
originalRequest.headers["Authorization"] = "Bearer " + token;
|
2267
|
-
originalRequest.data = updateTokenParamInOriginalRequest(
|
2268
|
-
originalRequest,
|
2269
|
-
token
|
2270
|
-
);
|
2271
2245
|
return instance.request(originalRequest);
|
2272
2246
|
}).catch(async (err) => {
|
2273
2247
|
if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
|
@@ -2292,11 +2266,11 @@ var axiosClient = {
|
|
2292
2266
|
);
|
2293
2267
|
return new Promise(function(resolve) {
|
2294
2268
|
axios.post(
|
2295
|
-
`${config.baseUrl}${
|
2269
|
+
`${config.baseUrl}${"/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
|
2296
2270
|
payload,
|
2297
2271
|
{
|
2298
2272
|
headers: {
|
2299
|
-
"Content-Type":
|
2273
|
+
"Content-Type": "multipart/form-data",
|
2300
2274
|
Authorization: `Bearer ${accessTokenExp}`
|
2301
2275
|
}
|
2302
2276
|
}
|
@@ -2306,14 +2280,10 @@ var axiosClient = {
|
|
2306
2280
|
await localStorage2.setRefreshToken(data.refresh_token);
|
2307
2281
|
axios.defaults.headers.common["Authorization"] = "Bearer " + data.access_token;
|
2308
2282
|
originalRequest.headers["Authorization"] = "Bearer " + data.access_token;
|
2309
|
-
originalRequest.data = updateTokenParamInOriginalRequest(
|
2310
|
-
originalRequest,
|
2311
|
-
data.access_token
|
2312
|
-
);
|
2313
2283
|
processQueue(null, data.access_token);
|
2314
2284
|
resolve(instance.request(originalRequest));
|
2315
2285
|
}).catch(async (err) => {
|
2316
|
-
if (err && (err?.error_code === "AUTHEN_FAIL" || err?.error_code === "TOKEN_EXPIRED" || err?.error_code === "TOKEN_INCORRECT" || err?.code === "ERR_BAD_REQUEST")
|
2286
|
+
if (err && (err?.error_code === "AUTHEN_FAIL" || err?.error_code === "TOKEN_EXPIRED" || err?.error_code === "TOKEN_INCORRECT" || err?.code === "ERR_BAD_REQUEST")) {
|
2317
2287
|
await clearAuthToken();
|
2318
2288
|
}
|
2319
2289
|
if (err && err.response) {
|
@@ -2363,7 +2333,7 @@ var axiosClient = {
|
|
2363
2333
|
const responseBody = (response) => response;
|
2364
2334
|
const requests = {
|
2365
2335
|
get: (url, headers) => instance.get(formatUrl(url, db), headers).then(responseBody),
|
2366
|
-
post: (url, body, headers) => instance.post(formatUrl(url, db), body, headers).then(responseBody),
|
2336
|
+
post: (url, body, headers) => instance.post(formatUrl(url, db), body, { headers }).then(responseBody),
|
2367
2337
|
post_excel: (url, body, headers) => instance.post(formatUrl(url, db), body, {
|
2368
2338
|
responseType: "arraybuffer",
|
2369
2339
|
headers: {
|
@@ -3006,7 +2976,6 @@ var EnvStore = class {
|
|
3006
2976
|
db;
|
3007
2977
|
localStorageUtils;
|
3008
2978
|
sessionStorageUtils;
|
3009
|
-
refreshTokenEndpoint;
|
3010
2979
|
constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
|
3011
2980
|
this.envStore = envStore2;
|
3012
2981
|
this.localStorageUtils = localStorageUtils2;
|
@@ -3023,7 +2992,6 @@ var EnvStore = class {
|
|
3023
2992
|
this.companies = env2?.companies || [];
|
3024
2993
|
this.user = env2?.user;
|
3025
2994
|
this.db = env2?.db;
|
3026
|
-
this.refreshTokenEndpoint = env2?.refreshTokenEndpoint;
|
3027
2995
|
}
|
3028
2996
|
setupEnv(envConfig) {
|
3029
2997
|
const dispatch = this.envStore.dispatch;
|
@@ -3355,38 +3323,6 @@ var AuthService = {
|
|
3355
3323
|
async getProviders(db) {
|
3356
3324
|
const env2 = getEnv();
|
3357
3325
|
return env2?.requests?.get("/oauth/providers", { params: { db } });
|
3358
|
-
},
|
3359
|
-
async getAccessByCode(code) {
|
3360
|
-
const env2 = getEnv();
|
3361
|
-
const data = new URLSearchParams();
|
3362
|
-
data.append("code", code);
|
3363
|
-
data.append("grant_type", "authorization_code");
|
3364
|
-
data.append("client_id", env2?.config?.clientId || "");
|
3365
|
-
data.append("redirect_uri", env2?.config?.redirectUri || "");
|
3366
|
-
return env2?.requests?.post(
|
3367
|
-
`${env2?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
|
3368
|
-
data,
|
3369
|
-
{
|
3370
|
-
headers: {
|
3371
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
3372
|
-
}
|
3373
|
-
}
|
3374
|
-
);
|
3375
|
-
},
|
3376
|
-
async logout(data) {
|
3377
|
-
const env2 = getEnv();
|
3378
|
-
console.log(data);
|
3379
|
-
return env2?.requests?.post(
|
3380
|
-
"/logout" /* LOGOUT */,
|
3381
|
-
{},
|
3382
|
-
{
|
3383
|
-
headers: {
|
3384
|
-
"Content-Type": "application/json"
|
3385
|
-
},
|
3386
|
-
withCredentials: true,
|
3387
|
-
useRefreshToken: true
|
3388
|
-
}
|
3389
|
-
);
|
3390
3326
|
}
|
3391
3327
|
};
|
3392
3328
|
var auth_service_default = AuthService;
|
@@ -4442,18 +4378,14 @@ var ViewService = {
|
|
4442
4378
|
async verify2FA({
|
4443
4379
|
method,
|
4444
4380
|
with_context,
|
4445
|
-
code
|
4446
|
-
device,
|
4447
|
-
location
|
4381
|
+
code
|
4448
4382
|
}) {
|
4449
4383
|
const env2 = getEnv();
|
4450
4384
|
const jsonData = {
|
4451
4385
|
method,
|
4452
4386
|
kwargs: {
|
4453
4387
|
vals: {
|
4454
|
-
code
|
4455
|
-
device,
|
4456
|
-
location
|
4388
|
+
code
|
4457
4389
|
}
|
4458
4390
|
},
|
4459
4391
|
with_context
|
@@ -4461,8 +4393,7 @@ var ViewService = {
|
|
4461
4393
|
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
4462
4394
|
headers: {
|
4463
4395
|
"Content-Type": "application/json"
|
4464
|
-
}
|
4465
|
-
withCredentials: true
|
4396
|
+
}
|
4466
4397
|
});
|
4467
4398
|
},
|
4468
4399
|
async signInSSO({
|
@@ -4486,119 +4417,6 @@ var ViewService = {
|
|
4486
4417
|
"Content-Type": "application/json"
|
4487
4418
|
}
|
4488
4419
|
});
|
4489
|
-
},
|
4490
|
-
async grantAccess({
|
4491
|
-
redirect_uri,
|
4492
|
-
state,
|
4493
|
-
client_id,
|
4494
|
-
scopes
|
4495
|
-
}) {
|
4496
|
-
const env2 = getEnv();
|
4497
|
-
const jsonData = {
|
4498
|
-
redirect_uri,
|
4499
|
-
state,
|
4500
|
-
client_id,
|
4501
|
-
scopes
|
4502
|
-
};
|
4503
|
-
return env2?.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
|
4504
|
-
headers: {
|
4505
|
-
"Content-Type": "application/json"
|
4506
|
-
},
|
4507
|
-
withCredentials: true
|
4508
|
-
});
|
4509
|
-
},
|
4510
|
-
async getFieldsViewSecurity({
|
4511
|
-
method,
|
4512
|
-
token,
|
4513
|
-
views
|
4514
|
-
}) {
|
4515
|
-
const env2 = getEnv();
|
4516
|
-
const jsonData = {
|
4517
|
-
method,
|
4518
|
-
kwargs: {
|
4519
|
-
views
|
4520
|
-
},
|
4521
|
-
with_context: {
|
4522
|
-
token
|
4523
|
-
}
|
4524
|
-
};
|
4525
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
4526
|
-
headers: {
|
4527
|
-
"Content-Type": "application/json"
|
4528
|
-
}
|
4529
|
-
});
|
4530
|
-
},
|
4531
|
-
async settingsWebRead2fa({
|
4532
|
-
method,
|
4533
|
-
model,
|
4534
|
-
kwargs,
|
4535
|
-
token
|
4536
|
-
}) {
|
4537
|
-
const env2 = getEnv();
|
4538
|
-
const jsonData = {
|
4539
|
-
method,
|
4540
|
-
model,
|
4541
|
-
kwargs,
|
4542
|
-
with_context: {
|
4543
|
-
token
|
4544
|
-
}
|
4545
|
-
};
|
4546
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
4547
|
-
headers: {
|
4548
|
-
"Content-Type": "application/json"
|
4549
|
-
}
|
4550
|
-
});
|
4551
|
-
},
|
4552
|
-
async requestSetupTotp({ method, token }) {
|
4553
|
-
const env2 = getEnv();
|
4554
|
-
const jsonData = {
|
4555
|
-
method,
|
4556
|
-
with_context: {
|
4557
|
-
token
|
4558
|
-
}
|
4559
|
-
};
|
4560
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
4561
|
-
headers: {
|
4562
|
-
"Content-Type": "application/json"
|
4563
|
-
}
|
4564
|
-
});
|
4565
|
-
},
|
4566
|
-
async verifyTotp({
|
4567
|
-
method,
|
4568
|
-
action_token,
|
4569
|
-
code
|
4570
|
-
}) {
|
4571
|
-
const env2 = getEnv();
|
4572
|
-
const jsonData = {
|
4573
|
-
method,
|
4574
|
-
kwargs: {
|
4575
|
-
vals: {
|
4576
|
-
code
|
4577
|
-
}
|
4578
|
-
},
|
4579
|
-
with_context: {
|
4580
|
-
action_token
|
4581
|
-
}
|
4582
|
-
};
|
4583
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
4584
|
-
headers: {
|
4585
|
-
"Content-Type": "application/json"
|
4586
|
-
}
|
4587
|
-
});
|
4588
|
-
},
|
4589
|
-
async removeTotpSetUp({ method, token }) {
|
4590
|
-
const env2 = getEnv();
|
4591
|
-
const jsonData = {
|
4592
|
-
method,
|
4593
|
-
with_context: {
|
4594
|
-
token
|
4595
|
-
}
|
4596
|
-
};
|
4597
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
4598
|
-
headers: {
|
4599
|
-
"Content-Type": "application/json"
|
4600
|
-
}
|
4601
|
-
});
|
4602
4420
|
}
|
4603
4421
|
};
|
4604
4422
|
var view_service_default = ViewService;
|
package/dist/utils.d.mts
CHANGED
@@ -82,9 +82,12 @@ declare const getSubdomain: (url?: string) => string | null;
|
|
82
82
|
declare const resequence: (arr: any, start: any, end: any) => any;
|
83
83
|
declare const getOffSet: (arr: any, start: any, end: any) => any;
|
84
84
|
declare const copyTextToClipboard: (text: string) => Promise<void>;
|
85
|
-
declare const updateTokenParamInOriginalRequest: (originalRequest: {
|
86
|
-
data?: any;
|
87
|
-
}, newAccessToken: string) => any;
|
88
85
|
declare const isObjectEmpty: (obj: object) => boolean;
|
86
|
+
declare const useField: (props: any) => {
|
87
|
+
invisible: boolean;
|
88
|
+
required: boolean;
|
89
|
+
readonly: boolean;
|
90
|
+
nameField: string | null;
|
91
|
+
};
|
89
92
|
|
90
|
-
export { WesapError, checkIsImageLink, convertFloatToTime, convertTimeToFloat, copyTextToClipboard, domainHelper, evalJSONContext, evalJSONDomain, filterFieldDirty, formatCurrency, formatDate, formatFileSize, formatSortingString, formatUrlPath, getFieldsOnChange, getOffSet, getSubdomain, handleError, isBase64File, isBase64Image, isObjectEmpty, mergeObjects, removeUndefinedFields, resequence, stringToColor, toQueryString,
|
93
|
+
export { WesapError, checkIsImageLink, convertFloatToTime, convertTimeToFloat, copyTextToClipboard, domainHelper, evalJSONContext, evalJSONDomain, filterFieldDirty, formatCurrency, formatDate, formatFileSize, formatSortingString, formatUrlPath, getFieldsOnChange, getOffSet, getSubdomain, handleError, isBase64File, isBase64Image, isObjectEmpty, mergeObjects, removeUndefinedFields, resequence, stringToColor, toQueryString, useField, useTabModel, validateAndParseDate };
|
package/dist/utils.d.ts
CHANGED
@@ -82,9 +82,12 @@ declare const getSubdomain: (url?: string) => string | null;
|
|
82
82
|
declare const resequence: (arr: any, start: any, end: any) => any;
|
83
83
|
declare const getOffSet: (arr: any, start: any, end: any) => any;
|
84
84
|
declare const copyTextToClipboard: (text: string) => Promise<void>;
|
85
|
-
declare const updateTokenParamInOriginalRequest: (originalRequest: {
|
86
|
-
data?: any;
|
87
|
-
}, newAccessToken: string) => any;
|
88
85
|
declare const isObjectEmpty: (obj: object) => boolean;
|
86
|
+
declare const useField: (props: any) => {
|
87
|
+
invisible: boolean;
|
88
|
+
required: boolean;
|
89
|
+
readonly: boolean;
|
90
|
+
nameField: string | null;
|
91
|
+
};
|
89
92
|
|
90
|
-
export { WesapError, checkIsImageLink, convertFloatToTime, convertTimeToFloat, copyTextToClipboard, domainHelper, evalJSONContext, evalJSONDomain, filterFieldDirty, formatCurrency, formatDate, formatFileSize, formatSortingString, formatUrlPath, getFieldsOnChange, getOffSet, getSubdomain, handleError, isBase64File, isBase64Image, isObjectEmpty, mergeObjects, removeUndefinedFields, resequence, stringToColor, toQueryString,
|
93
|
+
export { WesapError, checkIsImageLink, convertFloatToTime, convertTimeToFloat, copyTextToClipboard, domainHelper, evalJSONContext, evalJSONDomain, filterFieldDirty, formatCurrency, formatDate, formatFileSize, formatSortingString, formatUrlPath, getFieldsOnChange, getOffSet, getSubdomain, handleError, isBase64File, isBase64Image, isObjectEmpty, mergeObjects, removeUndefinedFields, resequence, stringToColor, toQueryString, useField, useTabModel, validateAndParseDate };
|