@fctc/interface-logic 1.8.9 → 1.9.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/hooks.js +266 -38
- package/dist/hooks.mjs +258 -30
- package/dist/services.d.mts +1 -28
- package/dist/services.d.ts +1 -28
- package/dist/services.js +2 -258
- package/dist/services.mjs +1 -256
- package/package.json +1 -1
package/dist/hooks.js
CHANGED
|
@@ -103,7 +103,7 @@ __export(hooks_exports, {
|
|
|
103
103
|
module.exports = __toCommonJS(hooks_exports);
|
|
104
104
|
|
|
105
105
|
// src/hooks/auth/use-forgot-password.ts
|
|
106
|
-
var
|
|
106
|
+
var import_react_query = require("@tanstack/react-query");
|
|
107
107
|
|
|
108
108
|
// src/constants/api/uri-constant.ts
|
|
109
109
|
var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
|
|
@@ -4748,38 +4748,9 @@ var ViewService = {
|
|
|
4748
4748
|
};
|
|
4749
4749
|
var view_service_default = ViewService;
|
|
4750
4750
|
|
|
4751
|
-
// src/services/auth-service/backup.ts
|
|
4752
|
-
var import_react5 = require("react");
|
|
4753
|
-
|
|
4754
|
-
// src/provider/react-query-provider.tsx
|
|
4755
|
-
var import_react_query = require("@tanstack/react-query");
|
|
4756
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
4757
|
-
|
|
4758
|
-
// src/provider/redux-provider.tsx
|
|
4759
|
-
var import_react_redux2 = require("react-redux");
|
|
4760
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
4761
|
-
|
|
4762
|
-
// src/provider/main-provider.tsx
|
|
4763
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
4764
|
-
|
|
4765
|
-
// src/provider/version-gate-provider.tsx
|
|
4766
|
-
var import_react3 = require("react");
|
|
4767
|
-
var import_react_query2 = require("@tanstack/react-query");
|
|
4768
|
-
|
|
4769
|
-
// src/services/view-service/backup.ts
|
|
4770
|
-
var import_react2 = require("react");
|
|
4771
|
-
|
|
4772
|
-
// src/provider/version-gate-provider.tsx
|
|
4773
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
4774
|
-
|
|
4775
|
-
// src/provider/env-provider.tsx
|
|
4776
|
-
var import_react4 = require("react");
|
|
4777
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
4778
|
-
var EnvContext = (0, import_react4.createContext)(null);
|
|
4779
|
-
|
|
4780
4751
|
// src/hooks/auth/use-forgot-password.ts
|
|
4781
4752
|
var useForgotPassword = () => {
|
|
4782
|
-
return (0,
|
|
4753
|
+
return (0, import_react_query.useMutation)({
|
|
4783
4754
|
mutationFn: (email) => {
|
|
4784
4755
|
return auth_service_default.forgotPassword(email);
|
|
4785
4756
|
}
|
|
@@ -4788,9 +4759,9 @@ var useForgotPassword = () => {
|
|
|
4788
4759
|
var use_forgot_password_default = useForgotPassword;
|
|
4789
4760
|
|
|
4790
4761
|
// src/hooks/auth/use-forgotpassword-sso.ts
|
|
4791
|
-
var
|
|
4762
|
+
var import_react_query2 = require("@tanstack/react-query");
|
|
4792
4763
|
var useForgotPasswordSSO = () => {
|
|
4793
|
-
return (0,
|
|
4764
|
+
return (0, import_react_query2.useMutation)({
|
|
4794
4765
|
mutationFn: ({
|
|
4795
4766
|
email,
|
|
4796
4767
|
with_context,
|
|
@@ -4803,9 +4774,9 @@ var useForgotPasswordSSO = () => {
|
|
|
4803
4774
|
var use_forgotpassword_sso_default = useForgotPasswordSSO;
|
|
4804
4775
|
|
|
4805
4776
|
// src/hooks/auth/use-get-provider.ts
|
|
4806
|
-
var
|
|
4777
|
+
var import_react_query3 = require("@tanstack/react-query");
|
|
4807
4778
|
var useGetProvider = () => {
|
|
4808
|
-
return (0,
|
|
4779
|
+
return (0, import_react_query3.useMutation)({
|
|
4809
4780
|
mutationFn: (data) => {
|
|
4810
4781
|
return auth_service_default.getProviders(data?.db);
|
|
4811
4782
|
}
|
|
@@ -4814,9 +4785,9 @@ var useGetProvider = () => {
|
|
|
4814
4785
|
var use_get_provider_default = useGetProvider;
|
|
4815
4786
|
|
|
4816
4787
|
// src/hooks/auth/use-isvalid-token.ts
|
|
4817
|
-
var
|
|
4788
|
+
var import_react_query4 = require("@tanstack/react-query");
|
|
4818
4789
|
var useIsValidToken = () => {
|
|
4819
|
-
return (0,
|
|
4790
|
+
return (0, import_react_query4.useMutation)({
|
|
4820
4791
|
mutationFn: (token) => {
|
|
4821
4792
|
return auth_service_default.isValidToken(token);
|
|
4822
4793
|
}
|
|
@@ -4826,10 +4797,267 @@ var use_isvalid_token_default = useIsValidToken;
|
|
|
4826
4797
|
|
|
4827
4798
|
// src/hooks/auth/use-login-credential.ts
|
|
4828
4799
|
var import_react_query7 = require("@tanstack/react-query");
|
|
4800
|
+
|
|
4801
|
+
// src/services/auth-service/backup.ts
|
|
4802
|
+
var import_react5 = require("react");
|
|
4803
|
+
|
|
4804
|
+
// src/provider/react-query-provider.tsx
|
|
4805
|
+
var import_react_query5 = require("@tanstack/react-query");
|
|
4806
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
4807
|
+
|
|
4808
|
+
// src/provider/redux-provider.tsx
|
|
4809
|
+
var import_react_redux2 = require("react-redux");
|
|
4810
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
4811
|
+
|
|
4812
|
+
// src/provider/main-provider.tsx
|
|
4813
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
4814
|
+
|
|
4815
|
+
// src/provider/version-gate-provider.tsx
|
|
4816
|
+
var import_react3 = require("react");
|
|
4817
|
+
var import_react_query6 = require("@tanstack/react-query");
|
|
4818
|
+
|
|
4819
|
+
// src/services/view-service/backup.ts
|
|
4820
|
+
var import_react2 = require("react");
|
|
4821
|
+
|
|
4822
|
+
// src/provider/version-gate-provider.tsx
|
|
4823
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
4824
|
+
|
|
4825
|
+
// src/provider/env-provider.tsx
|
|
4826
|
+
var import_react4 = require("react");
|
|
4827
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
4828
|
+
var EnvContext = (0, import_react4.createContext)(null);
|
|
4829
|
+
function useEnv() {
|
|
4830
|
+
const context = (0, import_react4.useContext)(EnvContext);
|
|
4831
|
+
if (!context) {
|
|
4832
|
+
throw new Error("useEnv must be used within an EnvProvider");
|
|
4833
|
+
}
|
|
4834
|
+
return context;
|
|
4835
|
+
}
|
|
4836
|
+
|
|
4837
|
+
// src/services/auth-service/backup.ts
|
|
4838
|
+
function useAuthService() {
|
|
4839
|
+
const { env: env2 } = useEnv();
|
|
4840
|
+
const login = (0, import_react5.useCallback)(
|
|
4841
|
+
async (body) => {
|
|
4842
|
+
const payload = Object.fromEntries(
|
|
4843
|
+
Object.entries({
|
|
4844
|
+
username: body.email,
|
|
4845
|
+
password: body.password,
|
|
4846
|
+
grant_type: env2?.config?.grantType || "",
|
|
4847
|
+
client_id: env2?.config?.clientId || "",
|
|
4848
|
+
client_secret: env2?.config?.clientSecret || ""
|
|
4849
|
+
}).filter(([_, value]) => !!value)
|
|
4850
|
+
);
|
|
4851
|
+
const encodedData = new URLSearchParams(payload).toString();
|
|
4852
|
+
return env2?.requests?.post(body.path, encodedData, {
|
|
4853
|
+
headers: {
|
|
4854
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
4855
|
+
}
|
|
4856
|
+
});
|
|
4857
|
+
},
|
|
4858
|
+
[env2]
|
|
4859
|
+
);
|
|
4860
|
+
const forgotPassword = (0, import_react5.useCallback)(
|
|
4861
|
+
async (email) => {
|
|
4862
|
+
const bodyData = {
|
|
4863
|
+
login: email,
|
|
4864
|
+
url: `${window.location.origin}/reset-password`
|
|
4865
|
+
};
|
|
4866
|
+
return env2?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
|
|
4867
|
+
headers: {
|
|
4868
|
+
"Content-Type": "application/json"
|
|
4869
|
+
}
|
|
4870
|
+
});
|
|
4871
|
+
},
|
|
4872
|
+
[env2]
|
|
4873
|
+
);
|
|
4874
|
+
const forgotPasswordSSO = (0, import_react5.useCallback)(
|
|
4875
|
+
async ({
|
|
4876
|
+
email,
|
|
4877
|
+
with_context,
|
|
4878
|
+
method
|
|
4879
|
+
}) => {
|
|
4880
|
+
const body = {
|
|
4881
|
+
method,
|
|
4882
|
+
kwargs: {
|
|
4883
|
+
vals: {
|
|
4884
|
+
email
|
|
4885
|
+
}
|
|
4886
|
+
},
|
|
4887
|
+
with_context
|
|
4888
|
+
};
|
|
4889
|
+
return env2?.requests?.post("/call" /* CALL_PATH */, body, {
|
|
4890
|
+
headers: {
|
|
4891
|
+
"Content-Type": "application/json"
|
|
4892
|
+
}
|
|
4893
|
+
});
|
|
4894
|
+
},
|
|
4895
|
+
[env2]
|
|
4896
|
+
);
|
|
4897
|
+
const resetPassword = (0, import_react5.useCallback)(
|
|
4898
|
+
async (data, token) => {
|
|
4899
|
+
const bodyData = {
|
|
4900
|
+
token,
|
|
4901
|
+
password: data.password,
|
|
4902
|
+
new_password: data.confirmPassword
|
|
4903
|
+
};
|
|
4904
|
+
return env2?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
|
|
4905
|
+
headers: {
|
|
4906
|
+
"Content-Type": "application/json"
|
|
4907
|
+
}
|
|
4908
|
+
});
|
|
4909
|
+
},
|
|
4910
|
+
[env2]
|
|
4911
|
+
);
|
|
4912
|
+
const resetPasswordSSO = (0, import_react5.useCallback)(
|
|
4913
|
+
async ({
|
|
4914
|
+
method,
|
|
4915
|
+
password,
|
|
4916
|
+
with_context
|
|
4917
|
+
}) => {
|
|
4918
|
+
const bodyData = {
|
|
4919
|
+
method,
|
|
4920
|
+
kwargs: {
|
|
4921
|
+
vals: {
|
|
4922
|
+
password
|
|
4923
|
+
}
|
|
4924
|
+
},
|
|
4925
|
+
with_context
|
|
4926
|
+
};
|
|
4927
|
+
return env2?.requests?.post("/call" /* CALL_PATH */, bodyData, {
|
|
4928
|
+
headers: {
|
|
4929
|
+
"Content-Type": "application/json"
|
|
4930
|
+
}
|
|
4931
|
+
});
|
|
4932
|
+
},
|
|
4933
|
+
[env2]
|
|
4934
|
+
);
|
|
4935
|
+
const updatePassword = (0, import_react5.useCallback)(
|
|
4936
|
+
async (data, token) => {
|
|
4937
|
+
const bodyData = {
|
|
4938
|
+
token,
|
|
4939
|
+
old_password: data.oldPassword,
|
|
4940
|
+
new_password: data.newPassword
|
|
4941
|
+
};
|
|
4942
|
+
return env2?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
|
|
4943
|
+
headers: {
|
|
4944
|
+
"Content-Type": "application/json"
|
|
4945
|
+
}
|
|
4946
|
+
});
|
|
4947
|
+
},
|
|
4948
|
+
[env2]
|
|
4949
|
+
);
|
|
4950
|
+
const isValidToken = (0, import_react5.useCallback)(
|
|
4951
|
+
async (token) => {
|
|
4952
|
+
const bodyData = {
|
|
4953
|
+
token
|
|
4954
|
+
};
|
|
4955
|
+
return env2?.requests?.post("/check_token" /* TOKEN */, bodyData, {
|
|
4956
|
+
headers: {
|
|
4957
|
+
"Content-Type": "application/json"
|
|
4958
|
+
}
|
|
4959
|
+
});
|
|
4960
|
+
},
|
|
4961
|
+
[env2]
|
|
4962
|
+
);
|
|
4963
|
+
const isValidActionToken = (0, import_react5.useCallback)(
|
|
4964
|
+
async (actionToken, path) => {
|
|
4965
|
+
return env2?.requests?.post(
|
|
4966
|
+
path,
|
|
4967
|
+
{},
|
|
4968
|
+
{
|
|
4969
|
+
headers: {
|
|
4970
|
+
"Content-Type": "application/json"
|
|
4971
|
+
},
|
|
4972
|
+
useActionToken: true,
|
|
4973
|
+
actionToken
|
|
4974
|
+
}
|
|
4975
|
+
);
|
|
4976
|
+
},
|
|
4977
|
+
[env2]
|
|
4978
|
+
);
|
|
4979
|
+
const loginSocial = (0, import_react5.useCallback)(
|
|
4980
|
+
async ({
|
|
4981
|
+
db,
|
|
4982
|
+
state,
|
|
4983
|
+
access_token
|
|
4984
|
+
}) => {
|
|
4985
|
+
return env2?.requests?.post(
|
|
4986
|
+
"/token/generate" /* GENTOKEN_SOCIAL */,
|
|
4987
|
+
{ state, access_token },
|
|
4988
|
+
{
|
|
4989
|
+
headers: {
|
|
4990
|
+
"Content-Type": "application/json"
|
|
4991
|
+
}
|
|
4992
|
+
}
|
|
4993
|
+
);
|
|
4994
|
+
},
|
|
4995
|
+
[env2]
|
|
4996
|
+
);
|
|
4997
|
+
const getProviders = (0, import_react5.useCallback)(
|
|
4998
|
+
async (db) => {
|
|
4999
|
+
return env2?.requests?.get("/oauth/providers", { params: { db } });
|
|
5000
|
+
},
|
|
5001
|
+
[env2]
|
|
5002
|
+
);
|
|
5003
|
+
const getAccessByCode = (0, import_react5.useCallback)(
|
|
5004
|
+
async (code) => {
|
|
5005
|
+
const data = new URLSearchParams();
|
|
5006
|
+
data.append("code", code);
|
|
5007
|
+
data.append("grant_type", "authorization_code");
|
|
5008
|
+
data.append("client_id", env2?.config?.clientId || "");
|
|
5009
|
+
data.append("redirect_uri", env2?.config?.redirectUri || "");
|
|
5010
|
+
return env2?.requests?.post(
|
|
5011
|
+
`${env2?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
|
|
5012
|
+
data,
|
|
5013
|
+
{
|
|
5014
|
+
headers: {
|
|
5015
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
5016
|
+
}
|
|
5017
|
+
}
|
|
5018
|
+
);
|
|
5019
|
+
},
|
|
5020
|
+
[env2]
|
|
5021
|
+
);
|
|
5022
|
+
const logout = (0, import_react5.useCallback)(
|
|
5023
|
+
async (data) => {
|
|
5024
|
+
console.log(data);
|
|
5025
|
+
return env2?.requests?.post(
|
|
5026
|
+
"/logout" /* LOGOUT */,
|
|
5027
|
+
{},
|
|
5028
|
+
{
|
|
5029
|
+
headers: {
|
|
5030
|
+
"Content-Type": "application/json"
|
|
5031
|
+
},
|
|
5032
|
+
withCredentials: true,
|
|
5033
|
+
useRefreshToken: true
|
|
5034
|
+
}
|
|
5035
|
+
);
|
|
5036
|
+
},
|
|
5037
|
+
[env2]
|
|
5038
|
+
);
|
|
5039
|
+
return {
|
|
5040
|
+
login,
|
|
5041
|
+
forgotPassword,
|
|
5042
|
+
forgotPasswordSSO,
|
|
5043
|
+
resetPassword,
|
|
5044
|
+
resetPasswordSSO,
|
|
5045
|
+
updatePassword,
|
|
5046
|
+
isValidToken,
|
|
5047
|
+
isValidActionToken,
|
|
5048
|
+
loginSocial,
|
|
5049
|
+
getProviders,
|
|
5050
|
+
getAccessByCode,
|
|
5051
|
+
logout
|
|
5052
|
+
};
|
|
5053
|
+
}
|
|
5054
|
+
|
|
5055
|
+
// src/hooks/auth/use-login-credential.ts
|
|
4829
5056
|
var useLoginCredential = () => {
|
|
5057
|
+
const { login } = useAuthService();
|
|
4830
5058
|
return (0, import_react_query7.useMutation)({
|
|
4831
5059
|
mutationFn: (data) => {
|
|
4832
|
-
return
|
|
5060
|
+
return login(data);
|
|
4833
5061
|
}
|
|
4834
5062
|
});
|
|
4835
5063
|
};
|
package/dist/hooks.mjs
CHANGED
|
@@ -4644,35 +4644,6 @@ var ViewService = {
|
|
|
4644
4644
|
};
|
|
4645
4645
|
var view_service_default = ViewService;
|
|
4646
4646
|
|
|
4647
|
-
// src/services/auth-service/backup.ts
|
|
4648
|
-
import { useCallback as useCallback3 } from "react";
|
|
4649
|
-
|
|
4650
|
-
// src/provider/react-query-provider.tsx
|
|
4651
|
-
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
4652
|
-
import { jsx } from "react/jsx-runtime";
|
|
4653
|
-
|
|
4654
|
-
// src/provider/redux-provider.tsx
|
|
4655
|
-
import { Provider } from "react-redux";
|
|
4656
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
4657
|
-
|
|
4658
|
-
// src/provider/main-provider.tsx
|
|
4659
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
4660
|
-
|
|
4661
|
-
// src/provider/version-gate-provider.tsx
|
|
4662
|
-
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
4663
|
-
import { useQueryClient } from "@tanstack/react-query";
|
|
4664
|
-
|
|
4665
|
-
// src/services/view-service/backup.ts
|
|
4666
|
-
import { useCallback } from "react";
|
|
4667
|
-
|
|
4668
|
-
// src/provider/version-gate-provider.tsx
|
|
4669
|
-
import { Fragment, jsx as jsx4 } from "react/jsx-runtime";
|
|
4670
|
-
|
|
4671
|
-
// src/provider/env-provider.tsx
|
|
4672
|
-
import { createContext, useContext, useState as useState3, useCallback as useCallback2 } from "react";
|
|
4673
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
4674
|
-
var EnvContext = createContext(null);
|
|
4675
|
-
|
|
4676
4647
|
// src/hooks/auth/use-forgot-password.ts
|
|
4677
4648
|
var useForgotPassword = () => {
|
|
4678
4649
|
return useMutation({
|
|
@@ -4722,10 +4693,267 @@ var use_isvalid_token_default = useIsValidToken;
|
|
|
4722
4693
|
|
|
4723
4694
|
// src/hooks/auth/use-login-credential.ts
|
|
4724
4695
|
import { useMutation as useMutation5 } from "@tanstack/react-query";
|
|
4696
|
+
|
|
4697
|
+
// src/services/auth-service/backup.ts
|
|
4698
|
+
import { useCallback as useCallback3 } from "react";
|
|
4699
|
+
|
|
4700
|
+
// src/provider/react-query-provider.tsx
|
|
4701
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
4702
|
+
import { jsx } from "react/jsx-runtime";
|
|
4703
|
+
|
|
4704
|
+
// src/provider/redux-provider.tsx
|
|
4705
|
+
import { Provider } from "react-redux";
|
|
4706
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
4707
|
+
|
|
4708
|
+
// src/provider/main-provider.tsx
|
|
4709
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
4710
|
+
|
|
4711
|
+
// src/provider/version-gate-provider.tsx
|
|
4712
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
4713
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
4714
|
+
|
|
4715
|
+
// src/services/view-service/backup.ts
|
|
4716
|
+
import { useCallback } from "react";
|
|
4717
|
+
|
|
4718
|
+
// src/provider/version-gate-provider.tsx
|
|
4719
|
+
import { Fragment, jsx as jsx4 } from "react/jsx-runtime";
|
|
4720
|
+
|
|
4721
|
+
// src/provider/env-provider.tsx
|
|
4722
|
+
import { createContext, useContext, useState as useState3, useCallback as useCallback2 } from "react";
|
|
4723
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
4724
|
+
var EnvContext = createContext(null);
|
|
4725
|
+
function useEnv() {
|
|
4726
|
+
const context = useContext(EnvContext);
|
|
4727
|
+
if (!context) {
|
|
4728
|
+
throw new Error("useEnv must be used within an EnvProvider");
|
|
4729
|
+
}
|
|
4730
|
+
return context;
|
|
4731
|
+
}
|
|
4732
|
+
|
|
4733
|
+
// src/services/auth-service/backup.ts
|
|
4734
|
+
function useAuthService() {
|
|
4735
|
+
const { env: env2 } = useEnv();
|
|
4736
|
+
const login = useCallback3(
|
|
4737
|
+
async (body) => {
|
|
4738
|
+
const payload = Object.fromEntries(
|
|
4739
|
+
Object.entries({
|
|
4740
|
+
username: body.email,
|
|
4741
|
+
password: body.password,
|
|
4742
|
+
grant_type: env2?.config?.grantType || "",
|
|
4743
|
+
client_id: env2?.config?.clientId || "",
|
|
4744
|
+
client_secret: env2?.config?.clientSecret || ""
|
|
4745
|
+
}).filter(([_, value]) => !!value)
|
|
4746
|
+
);
|
|
4747
|
+
const encodedData = new URLSearchParams(payload).toString();
|
|
4748
|
+
return env2?.requests?.post(body.path, encodedData, {
|
|
4749
|
+
headers: {
|
|
4750
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
4751
|
+
}
|
|
4752
|
+
});
|
|
4753
|
+
},
|
|
4754
|
+
[env2]
|
|
4755
|
+
);
|
|
4756
|
+
const forgotPassword = useCallback3(
|
|
4757
|
+
async (email) => {
|
|
4758
|
+
const bodyData = {
|
|
4759
|
+
login: email,
|
|
4760
|
+
url: `${window.location.origin}/reset-password`
|
|
4761
|
+
};
|
|
4762
|
+
return env2?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
|
|
4763
|
+
headers: {
|
|
4764
|
+
"Content-Type": "application/json"
|
|
4765
|
+
}
|
|
4766
|
+
});
|
|
4767
|
+
},
|
|
4768
|
+
[env2]
|
|
4769
|
+
);
|
|
4770
|
+
const forgotPasswordSSO = useCallback3(
|
|
4771
|
+
async ({
|
|
4772
|
+
email,
|
|
4773
|
+
with_context,
|
|
4774
|
+
method
|
|
4775
|
+
}) => {
|
|
4776
|
+
const body = {
|
|
4777
|
+
method,
|
|
4778
|
+
kwargs: {
|
|
4779
|
+
vals: {
|
|
4780
|
+
email
|
|
4781
|
+
}
|
|
4782
|
+
},
|
|
4783
|
+
with_context
|
|
4784
|
+
};
|
|
4785
|
+
return env2?.requests?.post("/call" /* CALL_PATH */, body, {
|
|
4786
|
+
headers: {
|
|
4787
|
+
"Content-Type": "application/json"
|
|
4788
|
+
}
|
|
4789
|
+
});
|
|
4790
|
+
},
|
|
4791
|
+
[env2]
|
|
4792
|
+
);
|
|
4793
|
+
const resetPassword = useCallback3(
|
|
4794
|
+
async (data, token) => {
|
|
4795
|
+
const bodyData = {
|
|
4796
|
+
token,
|
|
4797
|
+
password: data.password,
|
|
4798
|
+
new_password: data.confirmPassword
|
|
4799
|
+
};
|
|
4800
|
+
return env2?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
|
|
4801
|
+
headers: {
|
|
4802
|
+
"Content-Type": "application/json"
|
|
4803
|
+
}
|
|
4804
|
+
});
|
|
4805
|
+
},
|
|
4806
|
+
[env2]
|
|
4807
|
+
);
|
|
4808
|
+
const resetPasswordSSO = useCallback3(
|
|
4809
|
+
async ({
|
|
4810
|
+
method,
|
|
4811
|
+
password,
|
|
4812
|
+
with_context
|
|
4813
|
+
}) => {
|
|
4814
|
+
const bodyData = {
|
|
4815
|
+
method,
|
|
4816
|
+
kwargs: {
|
|
4817
|
+
vals: {
|
|
4818
|
+
password
|
|
4819
|
+
}
|
|
4820
|
+
},
|
|
4821
|
+
with_context
|
|
4822
|
+
};
|
|
4823
|
+
return env2?.requests?.post("/call" /* CALL_PATH */, bodyData, {
|
|
4824
|
+
headers: {
|
|
4825
|
+
"Content-Type": "application/json"
|
|
4826
|
+
}
|
|
4827
|
+
});
|
|
4828
|
+
},
|
|
4829
|
+
[env2]
|
|
4830
|
+
);
|
|
4831
|
+
const updatePassword = useCallback3(
|
|
4832
|
+
async (data, token) => {
|
|
4833
|
+
const bodyData = {
|
|
4834
|
+
token,
|
|
4835
|
+
old_password: data.oldPassword,
|
|
4836
|
+
new_password: data.newPassword
|
|
4837
|
+
};
|
|
4838
|
+
return env2?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
|
|
4839
|
+
headers: {
|
|
4840
|
+
"Content-Type": "application/json"
|
|
4841
|
+
}
|
|
4842
|
+
});
|
|
4843
|
+
},
|
|
4844
|
+
[env2]
|
|
4845
|
+
);
|
|
4846
|
+
const isValidToken = useCallback3(
|
|
4847
|
+
async (token) => {
|
|
4848
|
+
const bodyData = {
|
|
4849
|
+
token
|
|
4850
|
+
};
|
|
4851
|
+
return env2?.requests?.post("/check_token" /* TOKEN */, bodyData, {
|
|
4852
|
+
headers: {
|
|
4853
|
+
"Content-Type": "application/json"
|
|
4854
|
+
}
|
|
4855
|
+
});
|
|
4856
|
+
},
|
|
4857
|
+
[env2]
|
|
4858
|
+
);
|
|
4859
|
+
const isValidActionToken = useCallback3(
|
|
4860
|
+
async (actionToken, path) => {
|
|
4861
|
+
return env2?.requests?.post(
|
|
4862
|
+
path,
|
|
4863
|
+
{},
|
|
4864
|
+
{
|
|
4865
|
+
headers: {
|
|
4866
|
+
"Content-Type": "application/json"
|
|
4867
|
+
},
|
|
4868
|
+
useActionToken: true,
|
|
4869
|
+
actionToken
|
|
4870
|
+
}
|
|
4871
|
+
);
|
|
4872
|
+
},
|
|
4873
|
+
[env2]
|
|
4874
|
+
);
|
|
4875
|
+
const loginSocial = useCallback3(
|
|
4876
|
+
async ({
|
|
4877
|
+
db,
|
|
4878
|
+
state,
|
|
4879
|
+
access_token
|
|
4880
|
+
}) => {
|
|
4881
|
+
return env2?.requests?.post(
|
|
4882
|
+
"/token/generate" /* GENTOKEN_SOCIAL */,
|
|
4883
|
+
{ state, access_token },
|
|
4884
|
+
{
|
|
4885
|
+
headers: {
|
|
4886
|
+
"Content-Type": "application/json"
|
|
4887
|
+
}
|
|
4888
|
+
}
|
|
4889
|
+
);
|
|
4890
|
+
},
|
|
4891
|
+
[env2]
|
|
4892
|
+
);
|
|
4893
|
+
const getProviders = useCallback3(
|
|
4894
|
+
async (db) => {
|
|
4895
|
+
return env2?.requests?.get("/oauth/providers", { params: { db } });
|
|
4896
|
+
},
|
|
4897
|
+
[env2]
|
|
4898
|
+
);
|
|
4899
|
+
const getAccessByCode = useCallback3(
|
|
4900
|
+
async (code) => {
|
|
4901
|
+
const data = new URLSearchParams();
|
|
4902
|
+
data.append("code", code);
|
|
4903
|
+
data.append("grant_type", "authorization_code");
|
|
4904
|
+
data.append("client_id", env2?.config?.clientId || "");
|
|
4905
|
+
data.append("redirect_uri", env2?.config?.redirectUri || "");
|
|
4906
|
+
return env2?.requests?.post(
|
|
4907
|
+
`${env2?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
|
|
4908
|
+
data,
|
|
4909
|
+
{
|
|
4910
|
+
headers: {
|
|
4911
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
4912
|
+
}
|
|
4913
|
+
}
|
|
4914
|
+
);
|
|
4915
|
+
},
|
|
4916
|
+
[env2]
|
|
4917
|
+
);
|
|
4918
|
+
const logout = useCallback3(
|
|
4919
|
+
async (data) => {
|
|
4920
|
+
console.log(data);
|
|
4921
|
+
return env2?.requests?.post(
|
|
4922
|
+
"/logout" /* LOGOUT */,
|
|
4923
|
+
{},
|
|
4924
|
+
{
|
|
4925
|
+
headers: {
|
|
4926
|
+
"Content-Type": "application/json"
|
|
4927
|
+
},
|
|
4928
|
+
withCredentials: true,
|
|
4929
|
+
useRefreshToken: true
|
|
4930
|
+
}
|
|
4931
|
+
);
|
|
4932
|
+
},
|
|
4933
|
+
[env2]
|
|
4934
|
+
);
|
|
4935
|
+
return {
|
|
4936
|
+
login,
|
|
4937
|
+
forgotPassword,
|
|
4938
|
+
forgotPasswordSSO,
|
|
4939
|
+
resetPassword,
|
|
4940
|
+
resetPasswordSSO,
|
|
4941
|
+
updatePassword,
|
|
4942
|
+
isValidToken,
|
|
4943
|
+
isValidActionToken,
|
|
4944
|
+
loginSocial,
|
|
4945
|
+
getProviders,
|
|
4946
|
+
getAccessByCode,
|
|
4947
|
+
logout
|
|
4948
|
+
};
|
|
4949
|
+
}
|
|
4950
|
+
|
|
4951
|
+
// src/hooks/auth/use-login-credential.ts
|
|
4725
4952
|
var useLoginCredential = () => {
|
|
4953
|
+
const { login } = useAuthService();
|
|
4726
4954
|
return useMutation5({
|
|
4727
4955
|
mutationFn: (data) => {
|
|
4728
|
-
return
|
|
4956
|
+
return login(data);
|
|
4729
4957
|
}
|
|
4730
4958
|
});
|
|
4731
4959
|
};
|
package/dist/services.d.mts
CHANGED
|
@@ -253,31 +253,4 @@ declare const ViewService: {
|
|
|
253
253
|
}): Promise<any>;
|
|
254
254
|
};
|
|
255
255
|
|
|
256
|
-
|
|
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 };
|
|
256
|
+
export { ActionService, AuthService, CompanyService, ExcelService, FormService, KanbanServices as KanbanService, ModelService, UserService, ViewService };
|
package/dist/services.d.ts
CHANGED
|
@@ -253,31 +253,4 @@ declare const ViewService: {
|
|
|
253
253
|
}): Promise<any>;
|
|
254
254
|
};
|
|
255
255
|
|
|
256
|
-
|
|
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 };
|
|
256
|
+
export { ActionService, AuthService, CompanyService, ExcelService, FormService, KanbanServices as KanbanService, ModelService, UserService, ViewService };
|
package/dist/services.js
CHANGED
|
@@ -38,8 +38,7 @@ __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
|
|
42
|
-
useAuthService: () => useAuthService
|
|
41
|
+
ViewService: () => view_service_default
|
|
43
42
|
});
|
|
44
43
|
module.exports = __toCommonJS(services_exports);
|
|
45
44
|
|
|
@@ -4663,260 +4662,6 @@ var ViewService = {
|
|
|
4663
4662
|
}
|
|
4664
4663
|
};
|
|
4665
4664
|
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
|
-
}
|
|
4920
4665
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4921
4666
|
0 && (module.exports = {
|
|
4922
4667
|
ActionService,
|
|
@@ -4927,6 +4672,5 @@ function useAuthService() {
|
|
|
4927
4672
|
KanbanService,
|
|
4928
4673
|
ModelService,
|
|
4929
4674
|
UserService,
|
|
4930
|
-
ViewService
|
|
4931
|
-
useAuthService
|
|
4675
|
+
ViewService
|
|
4932
4676
|
});
|
package/dist/services.mjs
CHANGED
|
@@ -4618,260 +4618,6 @@ var ViewService = {
|
|
|
4618
4618
|
}
|
|
4619
4619
|
};
|
|
4620
4620
|
var view_service_default = ViewService;
|
|
4621
|
-
|
|
4622
|
-
// src/services/auth-service/backup.ts
|
|
4623
|
-
import { useCallback as useCallback3 } from "react";
|
|
4624
|
-
|
|
4625
|
-
// src/provider/react-query-provider.tsx
|
|
4626
|
-
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
4627
|
-
import { jsx } from "react/jsx-runtime";
|
|
4628
|
-
|
|
4629
|
-
// src/provider/redux-provider.tsx
|
|
4630
|
-
import { Provider } from "react-redux";
|
|
4631
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
4632
|
-
|
|
4633
|
-
// src/provider/main-provider.tsx
|
|
4634
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
4635
|
-
|
|
4636
|
-
// src/provider/version-gate-provider.tsx
|
|
4637
|
-
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
4638
|
-
import { useQueryClient } from "@tanstack/react-query";
|
|
4639
|
-
|
|
4640
|
-
// src/services/view-service/backup.ts
|
|
4641
|
-
import { useCallback } from "react";
|
|
4642
|
-
|
|
4643
|
-
// src/provider/version-gate-provider.tsx
|
|
4644
|
-
import { Fragment, jsx as jsx4 } from "react/jsx-runtime";
|
|
4645
|
-
|
|
4646
|
-
// src/provider/env-provider.tsx
|
|
4647
|
-
import { createContext, useContext, useState as useState3, useCallback as useCallback2 } from "react";
|
|
4648
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
4649
|
-
var EnvContext = createContext(null);
|
|
4650
|
-
function useEnv() {
|
|
4651
|
-
const context = useContext(EnvContext);
|
|
4652
|
-
if (!context) {
|
|
4653
|
-
throw new Error("useEnv must be used within an EnvProvider");
|
|
4654
|
-
}
|
|
4655
|
-
return context;
|
|
4656
|
-
}
|
|
4657
|
-
|
|
4658
|
-
// src/services/auth-service/backup.ts
|
|
4659
|
-
function useAuthService() {
|
|
4660
|
-
const { env: env2 } = useEnv();
|
|
4661
|
-
const login = useCallback3(
|
|
4662
|
-
async (body) => {
|
|
4663
|
-
const payload = Object.fromEntries(
|
|
4664
|
-
Object.entries({
|
|
4665
|
-
username: body.email,
|
|
4666
|
-
password: body.password,
|
|
4667
|
-
grant_type: env2?.config?.grantType || "",
|
|
4668
|
-
client_id: env2?.config?.clientId || "",
|
|
4669
|
-
client_secret: env2?.config?.clientSecret || ""
|
|
4670
|
-
}).filter(([_, value]) => !!value)
|
|
4671
|
-
);
|
|
4672
|
-
const encodedData = new URLSearchParams(payload).toString();
|
|
4673
|
-
return env2?.requests?.post(body.path, encodedData, {
|
|
4674
|
-
headers: {
|
|
4675
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
4676
|
-
}
|
|
4677
|
-
});
|
|
4678
|
-
},
|
|
4679
|
-
[env2]
|
|
4680
|
-
);
|
|
4681
|
-
const forgotPassword = useCallback3(
|
|
4682
|
-
async (email) => {
|
|
4683
|
-
const bodyData = {
|
|
4684
|
-
login: email,
|
|
4685
|
-
url: `${window.location.origin}/reset-password`
|
|
4686
|
-
};
|
|
4687
|
-
return env2?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
|
|
4688
|
-
headers: {
|
|
4689
|
-
"Content-Type": "application/json"
|
|
4690
|
-
}
|
|
4691
|
-
});
|
|
4692
|
-
},
|
|
4693
|
-
[env2]
|
|
4694
|
-
);
|
|
4695
|
-
const forgotPasswordSSO = useCallback3(
|
|
4696
|
-
async ({
|
|
4697
|
-
email,
|
|
4698
|
-
with_context,
|
|
4699
|
-
method
|
|
4700
|
-
}) => {
|
|
4701
|
-
const body = {
|
|
4702
|
-
method,
|
|
4703
|
-
kwargs: {
|
|
4704
|
-
vals: {
|
|
4705
|
-
email
|
|
4706
|
-
}
|
|
4707
|
-
},
|
|
4708
|
-
with_context
|
|
4709
|
-
};
|
|
4710
|
-
return env2?.requests?.post("/call" /* CALL_PATH */, body, {
|
|
4711
|
-
headers: {
|
|
4712
|
-
"Content-Type": "application/json"
|
|
4713
|
-
}
|
|
4714
|
-
});
|
|
4715
|
-
},
|
|
4716
|
-
[env2]
|
|
4717
|
-
);
|
|
4718
|
-
const resetPassword = useCallback3(
|
|
4719
|
-
async (data, token) => {
|
|
4720
|
-
const bodyData = {
|
|
4721
|
-
token,
|
|
4722
|
-
password: data.password,
|
|
4723
|
-
new_password: data.confirmPassword
|
|
4724
|
-
};
|
|
4725
|
-
return env2?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
|
|
4726
|
-
headers: {
|
|
4727
|
-
"Content-Type": "application/json"
|
|
4728
|
-
}
|
|
4729
|
-
});
|
|
4730
|
-
},
|
|
4731
|
-
[env2]
|
|
4732
|
-
);
|
|
4733
|
-
const resetPasswordSSO = useCallback3(
|
|
4734
|
-
async ({
|
|
4735
|
-
method,
|
|
4736
|
-
password,
|
|
4737
|
-
with_context
|
|
4738
|
-
}) => {
|
|
4739
|
-
const bodyData = {
|
|
4740
|
-
method,
|
|
4741
|
-
kwargs: {
|
|
4742
|
-
vals: {
|
|
4743
|
-
password
|
|
4744
|
-
}
|
|
4745
|
-
},
|
|
4746
|
-
with_context
|
|
4747
|
-
};
|
|
4748
|
-
return env2?.requests?.post("/call" /* CALL_PATH */, bodyData, {
|
|
4749
|
-
headers: {
|
|
4750
|
-
"Content-Type": "application/json"
|
|
4751
|
-
}
|
|
4752
|
-
});
|
|
4753
|
-
},
|
|
4754
|
-
[env2]
|
|
4755
|
-
);
|
|
4756
|
-
const updatePassword = useCallback3(
|
|
4757
|
-
async (data, token) => {
|
|
4758
|
-
const bodyData = {
|
|
4759
|
-
token,
|
|
4760
|
-
old_password: data.oldPassword,
|
|
4761
|
-
new_password: data.newPassword
|
|
4762
|
-
};
|
|
4763
|
-
return env2?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
|
|
4764
|
-
headers: {
|
|
4765
|
-
"Content-Type": "application/json"
|
|
4766
|
-
}
|
|
4767
|
-
});
|
|
4768
|
-
},
|
|
4769
|
-
[env2]
|
|
4770
|
-
);
|
|
4771
|
-
const isValidToken = useCallback3(
|
|
4772
|
-
async (token) => {
|
|
4773
|
-
const bodyData = {
|
|
4774
|
-
token
|
|
4775
|
-
};
|
|
4776
|
-
return env2?.requests?.post("/check_token" /* TOKEN */, bodyData, {
|
|
4777
|
-
headers: {
|
|
4778
|
-
"Content-Type": "application/json"
|
|
4779
|
-
}
|
|
4780
|
-
});
|
|
4781
|
-
},
|
|
4782
|
-
[env2]
|
|
4783
|
-
);
|
|
4784
|
-
const isValidActionToken = useCallback3(
|
|
4785
|
-
async (actionToken, path) => {
|
|
4786
|
-
return env2?.requests?.post(
|
|
4787
|
-
path,
|
|
4788
|
-
{},
|
|
4789
|
-
{
|
|
4790
|
-
headers: {
|
|
4791
|
-
"Content-Type": "application/json"
|
|
4792
|
-
},
|
|
4793
|
-
useActionToken: true,
|
|
4794
|
-
actionToken
|
|
4795
|
-
}
|
|
4796
|
-
);
|
|
4797
|
-
},
|
|
4798
|
-
[env2]
|
|
4799
|
-
);
|
|
4800
|
-
const loginSocial = useCallback3(
|
|
4801
|
-
async ({
|
|
4802
|
-
db,
|
|
4803
|
-
state,
|
|
4804
|
-
access_token
|
|
4805
|
-
}) => {
|
|
4806
|
-
return env2?.requests?.post(
|
|
4807
|
-
"/token/generate" /* GENTOKEN_SOCIAL */,
|
|
4808
|
-
{ state, access_token },
|
|
4809
|
-
{
|
|
4810
|
-
headers: {
|
|
4811
|
-
"Content-Type": "application/json"
|
|
4812
|
-
}
|
|
4813
|
-
}
|
|
4814
|
-
);
|
|
4815
|
-
},
|
|
4816
|
-
[env2]
|
|
4817
|
-
);
|
|
4818
|
-
const getProviders = useCallback3(
|
|
4819
|
-
async (db) => {
|
|
4820
|
-
return env2?.requests?.get("/oauth/providers", { params: { db } });
|
|
4821
|
-
},
|
|
4822
|
-
[env2]
|
|
4823
|
-
);
|
|
4824
|
-
const getAccessByCode = useCallback3(
|
|
4825
|
-
async (code) => {
|
|
4826
|
-
const data = new URLSearchParams();
|
|
4827
|
-
data.append("code", code);
|
|
4828
|
-
data.append("grant_type", "authorization_code");
|
|
4829
|
-
data.append("client_id", env2?.config?.clientId || "");
|
|
4830
|
-
data.append("redirect_uri", env2?.config?.redirectUri || "");
|
|
4831
|
-
return env2?.requests?.post(
|
|
4832
|
-
`${env2?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
|
|
4833
|
-
data,
|
|
4834
|
-
{
|
|
4835
|
-
headers: {
|
|
4836
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
4837
|
-
}
|
|
4838
|
-
}
|
|
4839
|
-
);
|
|
4840
|
-
},
|
|
4841
|
-
[env2]
|
|
4842
|
-
);
|
|
4843
|
-
const logout = useCallback3(
|
|
4844
|
-
async (data) => {
|
|
4845
|
-
console.log(data);
|
|
4846
|
-
return env2?.requests?.post(
|
|
4847
|
-
"/logout" /* LOGOUT */,
|
|
4848
|
-
{},
|
|
4849
|
-
{
|
|
4850
|
-
headers: {
|
|
4851
|
-
"Content-Type": "application/json"
|
|
4852
|
-
},
|
|
4853
|
-
withCredentials: true,
|
|
4854
|
-
useRefreshToken: true
|
|
4855
|
-
}
|
|
4856
|
-
);
|
|
4857
|
-
},
|
|
4858
|
-
[env2]
|
|
4859
|
-
);
|
|
4860
|
-
return {
|
|
4861
|
-
login,
|
|
4862
|
-
forgotPassword,
|
|
4863
|
-
forgotPasswordSSO,
|
|
4864
|
-
resetPassword,
|
|
4865
|
-
resetPasswordSSO,
|
|
4866
|
-
updatePassword,
|
|
4867
|
-
isValidToken,
|
|
4868
|
-
isValidActionToken,
|
|
4869
|
-
loginSocial,
|
|
4870
|
-
getProviders,
|
|
4871
|
-
getAccessByCode,
|
|
4872
|
-
logout
|
|
4873
|
-
};
|
|
4874
|
-
}
|
|
4875
4621
|
export {
|
|
4876
4622
|
action_service_default as ActionService,
|
|
4877
4623
|
auth_service_default as AuthService,
|
|
@@ -4881,6 +4627,5 @@ export {
|
|
|
4881
4627
|
kanban_service_default as KanbanService,
|
|
4882
4628
|
model_service_default as ModelService,
|
|
4883
4629
|
user_service_default as UserService,
|
|
4884
|
-
view_service_default as ViewService
|
|
4885
|
-
useAuthService
|
|
4630
|
+
view_service_default as ViewService
|
|
4886
4631
|
};
|