@fctc/interface-logic 1.10.3 → 1.10.5
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.js +13 -20
- package/dist/hooks.mjs +0 -7
- package/dist/provider.d.mts +1 -7
- package/dist/provider.d.ts +1 -7
- package/dist/provider.js +2 -39
- package/dist/provider.mjs +1 -36
- package/package.json +1 -1
package/dist/hooks.js
CHANGED
|
@@ -4225,7 +4225,7 @@ var use_isvalid_token_default = useIsValidToken;
|
|
|
4225
4225
|
var import_react_query7 = require("@tanstack/react-query");
|
|
4226
4226
|
|
|
4227
4227
|
// src/services/auth-service/backup.ts
|
|
4228
|
-
var
|
|
4228
|
+
var import_react5 = require("react");
|
|
4229
4229
|
|
|
4230
4230
|
// src/provider/react-query-provider.tsx
|
|
4231
4231
|
var import_react_query5 = require("@tanstack/react-query");
|
|
@@ -4893,23 +4893,16 @@ var initialEnvState = {
|
|
|
4893
4893
|
var EnvContext = (0, import_react4.createContext)(null);
|
|
4894
4894
|
function useEnv() {
|
|
4895
4895
|
const context = (0, import_react4.useContext)(EnvContext);
|
|
4896
|
-
console.log("useEnv context:", context, new Error().stack);
|
|
4897
4896
|
if (!context) {
|
|
4898
4897
|
return initialEnvState;
|
|
4899
4898
|
}
|
|
4900
4899
|
return context;
|
|
4901
4900
|
}
|
|
4902
4901
|
|
|
4903
|
-
// src/provider/env-share.tsx
|
|
4904
|
-
var import_react5 = require("react");
|
|
4905
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
4906
|
-
var EnvShareContext = (0, import_react5.createContext)(null);
|
|
4907
|
-
|
|
4908
4902
|
// src/services/auth-service/backup.ts
|
|
4909
4903
|
function useAuthService() {
|
|
4910
4904
|
const { env: env2 } = useEnv();
|
|
4911
|
-
|
|
4912
|
-
const login = (0, import_react6.useCallback)(
|
|
4905
|
+
const login = (0, import_react5.useCallback)(
|
|
4913
4906
|
async (body) => {
|
|
4914
4907
|
const payload = Object.fromEntries(
|
|
4915
4908
|
Object.entries({
|
|
@@ -4929,7 +4922,7 @@ function useAuthService() {
|
|
|
4929
4922
|
},
|
|
4930
4923
|
[env2]
|
|
4931
4924
|
);
|
|
4932
|
-
const forgotPassword = (0,
|
|
4925
|
+
const forgotPassword = (0, import_react5.useCallback)(
|
|
4933
4926
|
async (email) => {
|
|
4934
4927
|
const bodyData = {
|
|
4935
4928
|
login: email,
|
|
@@ -4943,7 +4936,7 @@ function useAuthService() {
|
|
|
4943
4936
|
},
|
|
4944
4937
|
[env2]
|
|
4945
4938
|
);
|
|
4946
|
-
const forgotPasswordSSO = (0,
|
|
4939
|
+
const forgotPasswordSSO = (0, import_react5.useCallback)(
|
|
4947
4940
|
async ({
|
|
4948
4941
|
email,
|
|
4949
4942
|
with_context,
|
|
@@ -4966,7 +4959,7 @@ function useAuthService() {
|
|
|
4966
4959
|
},
|
|
4967
4960
|
[env2]
|
|
4968
4961
|
);
|
|
4969
|
-
const resetPassword = (0,
|
|
4962
|
+
const resetPassword = (0, import_react5.useCallback)(
|
|
4970
4963
|
async (data, token) => {
|
|
4971
4964
|
const bodyData = {
|
|
4972
4965
|
token,
|
|
@@ -4981,7 +4974,7 @@ function useAuthService() {
|
|
|
4981
4974
|
},
|
|
4982
4975
|
[env2]
|
|
4983
4976
|
);
|
|
4984
|
-
const resetPasswordSSO = (0,
|
|
4977
|
+
const resetPasswordSSO = (0, import_react5.useCallback)(
|
|
4985
4978
|
async ({
|
|
4986
4979
|
method,
|
|
4987
4980
|
password,
|
|
@@ -5004,7 +4997,7 @@ function useAuthService() {
|
|
|
5004
4997
|
},
|
|
5005
4998
|
[env2]
|
|
5006
4999
|
);
|
|
5007
|
-
const updatePassword = (0,
|
|
5000
|
+
const updatePassword = (0, import_react5.useCallback)(
|
|
5008
5001
|
async (data, token) => {
|
|
5009
5002
|
const bodyData = {
|
|
5010
5003
|
token,
|
|
@@ -5019,7 +5012,7 @@ function useAuthService() {
|
|
|
5019
5012
|
},
|
|
5020
5013
|
[env2]
|
|
5021
5014
|
);
|
|
5022
|
-
const isValidToken = (0,
|
|
5015
|
+
const isValidToken = (0, import_react5.useCallback)(
|
|
5023
5016
|
async (token) => {
|
|
5024
5017
|
const bodyData = {
|
|
5025
5018
|
token
|
|
@@ -5032,7 +5025,7 @@ function useAuthService() {
|
|
|
5032
5025
|
},
|
|
5033
5026
|
[env2]
|
|
5034
5027
|
);
|
|
5035
|
-
const isValidActionToken = (0,
|
|
5028
|
+
const isValidActionToken = (0, import_react5.useCallback)(
|
|
5036
5029
|
async (actionToken, path) => {
|
|
5037
5030
|
return env2?.requests?.post(
|
|
5038
5031
|
path,
|
|
@@ -5048,7 +5041,7 @@ function useAuthService() {
|
|
|
5048
5041
|
},
|
|
5049
5042
|
[env2]
|
|
5050
5043
|
);
|
|
5051
|
-
const loginSocial = (0,
|
|
5044
|
+
const loginSocial = (0, import_react5.useCallback)(
|
|
5052
5045
|
async ({
|
|
5053
5046
|
db,
|
|
5054
5047
|
state,
|
|
@@ -5066,13 +5059,13 @@ function useAuthService() {
|
|
|
5066
5059
|
},
|
|
5067
5060
|
[env2]
|
|
5068
5061
|
);
|
|
5069
|
-
const getProviders = (0,
|
|
5062
|
+
const getProviders = (0, import_react5.useCallback)(
|
|
5070
5063
|
async (db) => {
|
|
5071
5064
|
return env2?.requests?.get("/oauth/providers", { params: { db } });
|
|
5072
5065
|
},
|
|
5073
5066
|
[env2]
|
|
5074
5067
|
);
|
|
5075
|
-
const getAccessByCode = (0,
|
|
5068
|
+
const getAccessByCode = (0, import_react5.useCallback)(
|
|
5076
5069
|
async (code) => {
|
|
5077
5070
|
const data = new URLSearchParams();
|
|
5078
5071
|
data.append("code", code);
|
|
@@ -5091,7 +5084,7 @@ function useAuthService() {
|
|
|
5091
5084
|
},
|
|
5092
5085
|
[env2]
|
|
5093
5086
|
);
|
|
5094
|
-
const logout = (0,
|
|
5087
|
+
const logout = (0, import_react5.useCallback)(
|
|
5095
5088
|
async (data) => {
|
|
5096
5089
|
console.log(data);
|
|
5097
5090
|
return env2?.requests?.post(
|
package/dist/hooks.mjs
CHANGED
|
@@ -4789,22 +4789,15 @@ var initialEnvState = {
|
|
|
4789
4789
|
var EnvContext = createContext(null);
|
|
4790
4790
|
function useEnv() {
|
|
4791
4791
|
const context = useContext(EnvContext);
|
|
4792
|
-
console.log("useEnv context:", context, new Error().stack);
|
|
4793
4792
|
if (!context) {
|
|
4794
4793
|
return initialEnvState;
|
|
4795
4794
|
}
|
|
4796
4795
|
return context;
|
|
4797
4796
|
}
|
|
4798
4797
|
|
|
4799
|
-
// src/provider/env-share.tsx
|
|
4800
|
-
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
4801
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
4802
|
-
var EnvShareContext = createContext2(null);
|
|
4803
|
-
|
|
4804
4798
|
// src/services/auth-service/backup.ts
|
|
4805
4799
|
function useAuthService() {
|
|
4806
4800
|
const { env: env2 } = useEnv();
|
|
4807
|
-
console.log("auth env", env2);
|
|
4808
4801
|
const login = useCallback3(
|
|
4809
4802
|
async (body) => {
|
|
4810
4803
|
const payload = Object.fromEntries(
|
package/dist/provider.d.mts
CHANGED
|
@@ -57,10 +57,4 @@ declare function useEnv(): EnvConfig | {
|
|
|
57
57
|
setEnvFile: (envFile: any) => void;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
children: React.ReactNode;
|
|
62
|
-
env: EnvConfig;
|
|
63
|
-
}): react_jsx_runtime.JSX.Element;
|
|
64
|
-
declare function useSharedEnv(): EnvConfig;
|
|
65
|
-
|
|
66
|
-
export { EnvProvider, EnvShareProvider, MainProvider, ReactQueryProvider, VersionGate, useEnv, useSharedEnv };
|
|
60
|
+
export { EnvProvider, MainProvider, ReactQueryProvider, VersionGate, useEnv };
|
package/dist/provider.d.ts
CHANGED
|
@@ -57,10 +57,4 @@ declare function useEnv(): EnvConfig | {
|
|
|
57
57
|
setEnvFile: (envFile: any) => void;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
children: React.ReactNode;
|
|
62
|
-
env: EnvConfig;
|
|
63
|
-
}): react_jsx_runtime.JSX.Element;
|
|
64
|
-
declare function useSharedEnv(): EnvConfig;
|
|
65
|
-
|
|
66
|
-
export { EnvProvider, EnvShareProvider, MainProvider, ReactQueryProvider, VersionGate, useEnv, useSharedEnv };
|
|
60
|
+
export { EnvProvider, MainProvider, ReactQueryProvider, VersionGate, useEnv };
|
package/dist/provider.js
CHANGED
|
@@ -31,12 +31,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var provider_exports = {};
|
|
32
32
|
__export(provider_exports, {
|
|
33
33
|
EnvProvider: () => EnvProvider,
|
|
34
|
-
EnvShareProvider: () => EnvShareProvider,
|
|
35
34
|
MainProvider: () => MainProvider,
|
|
36
35
|
ReactQueryProvider: () => ReactQueryProvider,
|
|
37
36
|
VersionGate: () => VersionGate,
|
|
38
|
-
useEnv: () => useEnv
|
|
39
|
-
useSharedEnv: () => useSharedEnv
|
|
37
|
+
useEnv: () => useEnv
|
|
40
38
|
});
|
|
41
39
|
module.exports = __toCommonJS(provider_exports);
|
|
42
40
|
|
|
@@ -3307,7 +3305,6 @@ var import_react_query6 = require("@tanstack/react-query");
|
|
|
3307
3305
|
var import_react3 = require("react");
|
|
3308
3306
|
function useAuthService() {
|
|
3309
3307
|
const { env } = useEnv();
|
|
3310
|
-
console.log("auth env", env);
|
|
3311
3308
|
const login = (0, import_react3.useCallback)(
|
|
3312
3309
|
async (body) => {
|
|
3313
3310
|
const payload = Object.fromEntries(
|
|
@@ -3644,7 +3641,6 @@ function EnvProvider({
|
|
|
3644
3641
|
}
|
|
3645
3642
|
function useEnv() {
|
|
3646
3643
|
const context = (0, import_react4.useContext)(EnvContext);
|
|
3647
|
-
console.log("useEnv context:", context, new Error().stack);
|
|
3648
3644
|
if (!context) {
|
|
3649
3645
|
return initialEnvState;
|
|
3650
3646
|
}
|
|
@@ -3864,19 +3860,6 @@ var VersionGate = ({ children }) => {
|
|
|
3864
3860
|
};
|
|
3865
3861
|
const validateVersion = async () => {
|
|
3866
3862
|
const serverVersion = await getVersion();
|
|
3867
|
-
console.log("serverVersion", serverVersion);
|
|
3868
|
-
login.mutate(
|
|
3869
|
-
{
|
|
3870
|
-
email: "admin",
|
|
3871
|
-
password: "admin",
|
|
3872
|
-
path: "/authentication/oauth2/token"
|
|
3873
|
-
},
|
|
3874
|
-
{
|
|
3875
|
-
onSuccess: (res) => {
|
|
3876
|
-
console.log("res login", res);
|
|
3877
|
-
}
|
|
3878
|
-
}
|
|
3879
|
-
);
|
|
3880
3863
|
const cached = localStorage.getItem("__api_version__");
|
|
3881
3864
|
if (cached !== serverVersion?.api_version) {
|
|
3882
3865
|
clearVersion();
|
|
@@ -3899,31 +3882,11 @@ var VersionGate = ({ children }) => {
|
|
|
3899
3882
|
}, [queryClient]);
|
|
3900
3883
|
return ready ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children }) : null;
|
|
3901
3884
|
};
|
|
3902
|
-
|
|
3903
|
-
// src/provider/env-share.tsx
|
|
3904
|
-
var import_react6 = require("react");
|
|
3905
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
3906
|
-
var EnvShareContext = (0, import_react6.createContext)(null);
|
|
3907
|
-
function EnvShareProvider({
|
|
3908
|
-
children,
|
|
3909
|
-
env
|
|
3910
|
-
}) {
|
|
3911
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(EnvShareContext.Provider, { value: env, children });
|
|
3912
|
-
}
|
|
3913
|
-
function useSharedEnv() {
|
|
3914
|
-
const env = (0, import_react6.useContext)(EnvShareContext);
|
|
3915
|
-
if (!env) {
|
|
3916
|
-
throw new Error("useSharedEnv must be used within an EnvShareProvider");
|
|
3917
|
-
}
|
|
3918
|
-
return env;
|
|
3919
|
-
}
|
|
3920
3885
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3921
3886
|
0 && (module.exports = {
|
|
3922
3887
|
EnvProvider,
|
|
3923
|
-
EnvShareProvider,
|
|
3924
3888
|
MainProvider,
|
|
3925
3889
|
ReactQueryProvider,
|
|
3926
3890
|
VersionGate,
|
|
3927
|
-
useEnv
|
|
3928
|
-
useSharedEnv
|
|
3891
|
+
useEnv
|
|
3929
3892
|
});
|
package/dist/provider.mjs
CHANGED
|
@@ -3265,7 +3265,6 @@ import { useMutation as useMutation5 } from "@tanstack/react-query";
|
|
|
3265
3265
|
import { useCallback as useCallback2 } from "react";
|
|
3266
3266
|
function useAuthService() {
|
|
3267
3267
|
const { env } = useEnv();
|
|
3268
|
-
console.log("auth env", env);
|
|
3269
3268
|
const login = useCallback2(
|
|
3270
3269
|
async (body) => {
|
|
3271
3270
|
const payload = Object.fromEntries(
|
|
@@ -3602,7 +3601,6 @@ function EnvProvider({
|
|
|
3602
3601
|
}
|
|
3603
3602
|
function useEnv() {
|
|
3604
3603
|
const context = useContext(EnvContext);
|
|
3605
|
-
console.log("useEnv context:", context, new Error().stack);
|
|
3606
3604
|
if (!context) {
|
|
3607
3605
|
return initialEnvState;
|
|
3608
3606
|
}
|
|
@@ -3822,19 +3820,6 @@ var VersionGate = ({ children }) => {
|
|
|
3822
3820
|
};
|
|
3823
3821
|
const validateVersion = async () => {
|
|
3824
3822
|
const serverVersion = await getVersion();
|
|
3825
|
-
console.log("serverVersion", serverVersion);
|
|
3826
|
-
login.mutate(
|
|
3827
|
-
{
|
|
3828
|
-
email: "admin",
|
|
3829
|
-
password: "admin",
|
|
3830
|
-
path: "/authentication/oauth2/token"
|
|
3831
|
-
},
|
|
3832
|
-
{
|
|
3833
|
-
onSuccess: (res) => {
|
|
3834
|
-
console.log("res login", res);
|
|
3835
|
-
}
|
|
3836
|
-
}
|
|
3837
|
-
);
|
|
3838
3823
|
const cached = localStorage.getItem("__api_version__");
|
|
3839
3824
|
if (cached !== serverVersion?.api_version) {
|
|
3840
3825
|
clearVersion();
|
|
@@ -3857,30 +3842,10 @@ var VersionGate = ({ children }) => {
|
|
|
3857
3842
|
}, [queryClient]);
|
|
3858
3843
|
return ready ? /* @__PURE__ */ jsx5(Fragment, { children }) : null;
|
|
3859
3844
|
};
|
|
3860
|
-
|
|
3861
|
-
// src/provider/env-share.tsx
|
|
3862
|
-
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
3863
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
3864
|
-
var EnvShareContext = createContext2(null);
|
|
3865
|
-
function EnvShareProvider({
|
|
3866
|
-
children,
|
|
3867
|
-
env
|
|
3868
|
-
}) {
|
|
3869
|
-
return /* @__PURE__ */ jsx6(EnvShareContext.Provider, { value: env, children });
|
|
3870
|
-
}
|
|
3871
|
-
function useSharedEnv() {
|
|
3872
|
-
const env = useContext2(EnvShareContext);
|
|
3873
|
-
if (!env) {
|
|
3874
|
-
throw new Error("useSharedEnv must be used within an EnvShareProvider");
|
|
3875
|
-
}
|
|
3876
|
-
return env;
|
|
3877
|
-
}
|
|
3878
3845
|
export {
|
|
3879
3846
|
EnvProvider,
|
|
3880
|
-
EnvShareProvider,
|
|
3881
3847
|
MainProvider,
|
|
3882
3848
|
ReactQueryProvider,
|
|
3883
3849
|
VersionGate,
|
|
3884
|
-
useEnv
|
|
3885
|
-
useSharedEnv
|
|
3850
|
+
useEnv
|
|
3886
3851
|
};
|