@fctc/interface-logic 1.8.10 → 1.9.1

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 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 import_react_query3 = require("@tanstack/react-query");
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,11 +4748,61 @@ var ViewService = {
4748
4748
  };
4749
4749
  var view_service_default = ViewService;
4750
4750
 
4751
+ // src/hooks/auth/use-forgot-password.ts
4752
+ var useForgotPassword = () => {
4753
+ return (0, import_react_query.useMutation)({
4754
+ mutationFn: (email) => {
4755
+ return auth_service_default.forgotPassword(email);
4756
+ }
4757
+ });
4758
+ };
4759
+ var use_forgot_password_default = useForgotPassword;
4760
+
4761
+ // src/hooks/auth/use-forgotpassword-sso.ts
4762
+ var import_react_query2 = require("@tanstack/react-query");
4763
+ var useForgotPasswordSSO = () => {
4764
+ return (0, import_react_query2.useMutation)({
4765
+ mutationFn: ({
4766
+ email,
4767
+ with_context,
4768
+ method
4769
+ }) => {
4770
+ return auth_service_default.forgotPasswordSSO({ email, with_context, method });
4771
+ }
4772
+ });
4773
+ };
4774
+ var use_forgotpassword_sso_default = useForgotPasswordSSO;
4775
+
4776
+ // src/hooks/auth/use-get-provider.ts
4777
+ var import_react_query3 = require("@tanstack/react-query");
4778
+ var useGetProvider = () => {
4779
+ return (0, import_react_query3.useMutation)({
4780
+ mutationFn: (data) => {
4781
+ return auth_service_default.getProviders(data?.db);
4782
+ }
4783
+ });
4784
+ };
4785
+ var use_get_provider_default = useGetProvider;
4786
+
4787
+ // src/hooks/auth/use-isvalid-token.ts
4788
+ var import_react_query4 = require("@tanstack/react-query");
4789
+ var useIsValidToken = () => {
4790
+ return (0, import_react_query4.useMutation)({
4791
+ mutationFn: (token) => {
4792
+ return auth_service_default.isValidToken(token);
4793
+ }
4794
+ });
4795
+ };
4796
+ var use_isvalid_token_default = useIsValidToken;
4797
+
4798
+ // src/hooks/auth/use-login-credential.tsx
4799
+ var import_react_query7 = require("@tanstack/react-query");
4800
+
4751
4801
  // src/services/auth-service/backup.ts
4752
4802
  var import_react5 = require("react");
4753
4803
 
4754
4804
  // src/provider/react-query-provider.tsx
4755
- var import_react_query = require("@tanstack/react-query");
4805
+ var import_react_query5 = require("@tanstack/react-query");
4756
4806
  var import_jsx_runtime = require("react/jsx-runtime");
4757
4807
 
4758
4808
  // src/provider/redux-provider.tsx
@@ -4764,7 +4814,7 @@ var import_jsx_runtime3 = require("react/jsx-runtime");
4764
4814
 
4765
4815
  // src/provider/version-gate-provider.tsx
4766
4816
  var import_react3 = require("react");
4767
- var import_react_query2 = require("@tanstack/react-query");
4817
+ var import_react_query6 = require("@tanstack/react-query");
4768
4818
 
4769
4819
  // src/services/view-service/backup.ts
4770
4820
  var import_react2 = require("react");
@@ -5002,55 +5052,7 @@ function useAuthService() {
5002
5052
  };
5003
5053
  }
5004
5054
 
5005
- // src/hooks/auth/use-forgot-password.ts
5006
- var useForgotPassword = () => {
5007
- return (0, import_react_query3.useMutation)({
5008
- mutationFn: (email) => {
5009
- return auth_service_default.forgotPassword(email);
5010
- }
5011
- });
5012
- };
5013
- var use_forgot_password_default = useForgotPassword;
5014
-
5015
- // src/hooks/auth/use-forgotpassword-sso.ts
5016
- var import_react_query4 = require("@tanstack/react-query");
5017
- var useForgotPasswordSSO = () => {
5018
- return (0, import_react_query4.useMutation)({
5019
- mutationFn: ({
5020
- email,
5021
- with_context,
5022
- method
5023
- }) => {
5024
- return auth_service_default.forgotPasswordSSO({ email, with_context, method });
5025
- }
5026
- });
5027
- };
5028
- var use_forgotpassword_sso_default = useForgotPasswordSSO;
5029
-
5030
- // src/hooks/auth/use-get-provider.ts
5031
- var import_react_query5 = require("@tanstack/react-query");
5032
- var useGetProvider = () => {
5033
- return (0, import_react_query5.useMutation)({
5034
- mutationFn: (data) => {
5035
- return auth_service_default.getProviders(data?.db);
5036
- }
5037
- });
5038
- };
5039
- var use_get_provider_default = useGetProvider;
5040
-
5041
- // src/hooks/auth/use-isvalid-token.ts
5042
- var import_react_query6 = require("@tanstack/react-query");
5043
- var useIsValidToken = () => {
5044
- return (0, import_react_query6.useMutation)({
5045
- mutationFn: (token) => {
5046
- return auth_service_default.isValidToken(token);
5047
- }
5048
- });
5049
- };
5050
- var use_isvalid_token_default = useIsValidToken;
5051
-
5052
- // src/hooks/auth/use-login-credential.ts
5053
- var import_react_query7 = require("@tanstack/react-query");
5055
+ // src/hooks/auth/use-login-credential.tsx
5054
5056
  var useLoginCredential = () => {
5055
5057
  const { login } = useAuthService();
5056
5058
  return (0, import_react_query7.useMutation)({
package/dist/hooks.mjs CHANGED
@@ -4644,6 +4644,56 @@ var ViewService = {
4644
4644
  };
4645
4645
  var view_service_default = ViewService;
4646
4646
 
4647
+ // src/hooks/auth/use-forgot-password.ts
4648
+ var useForgotPassword = () => {
4649
+ return useMutation({
4650
+ mutationFn: (email) => {
4651
+ return auth_service_default.forgotPassword(email);
4652
+ }
4653
+ });
4654
+ };
4655
+ var use_forgot_password_default = useForgotPassword;
4656
+
4657
+ // src/hooks/auth/use-forgotpassword-sso.ts
4658
+ import { useMutation as useMutation2 } from "@tanstack/react-query";
4659
+ var useForgotPasswordSSO = () => {
4660
+ return useMutation2({
4661
+ mutationFn: ({
4662
+ email,
4663
+ with_context,
4664
+ method
4665
+ }) => {
4666
+ return auth_service_default.forgotPasswordSSO({ email, with_context, method });
4667
+ }
4668
+ });
4669
+ };
4670
+ var use_forgotpassword_sso_default = useForgotPasswordSSO;
4671
+
4672
+ // src/hooks/auth/use-get-provider.ts
4673
+ import { useMutation as useMutation3 } from "@tanstack/react-query";
4674
+ var useGetProvider = () => {
4675
+ return useMutation3({
4676
+ mutationFn: (data) => {
4677
+ return auth_service_default.getProviders(data?.db);
4678
+ }
4679
+ });
4680
+ };
4681
+ var use_get_provider_default = useGetProvider;
4682
+
4683
+ // src/hooks/auth/use-isvalid-token.ts
4684
+ import { useMutation as useMutation4 } from "@tanstack/react-query";
4685
+ var useIsValidToken = () => {
4686
+ return useMutation4({
4687
+ mutationFn: (token) => {
4688
+ return auth_service_default.isValidToken(token);
4689
+ }
4690
+ });
4691
+ };
4692
+ var use_isvalid_token_default = useIsValidToken;
4693
+
4694
+ // src/hooks/auth/use-login-credential.tsx
4695
+ import { useMutation as useMutation5 } from "@tanstack/react-query";
4696
+
4647
4697
  // src/services/auth-service/backup.ts
4648
4698
  import { useCallback as useCallback3 } from "react";
4649
4699
 
@@ -4898,55 +4948,7 @@ function useAuthService() {
4898
4948
  };
4899
4949
  }
4900
4950
 
4901
- // src/hooks/auth/use-forgot-password.ts
4902
- var useForgotPassword = () => {
4903
- return useMutation({
4904
- mutationFn: (email) => {
4905
- return auth_service_default.forgotPassword(email);
4906
- }
4907
- });
4908
- };
4909
- var use_forgot_password_default = useForgotPassword;
4910
-
4911
- // src/hooks/auth/use-forgotpassword-sso.ts
4912
- import { useMutation as useMutation2 } from "@tanstack/react-query";
4913
- var useForgotPasswordSSO = () => {
4914
- return useMutation2({
4915
- mutationFn: ({
4916
- email,
4917
- with_context,
4918
- method
4919
- }) => {
4920
- return auth_service_default.forgotPasswordSSO({ email, with_context, method });
4921
- }
4922
- });
4923
- };
4924
- var use_forgotpassword_sso_default = useForgotPasswordSSO;
4925
-
4926
- // src/hooks/auth/use-get-provider.ts
4927
- import { useMutation as useMutation3 } from "@tanstack/react-query";
4928
- var useGetProvider = () => {
4929
- return useMutation3({
4930
- mutationFn: (data) => {
4931
- return auth_service_default.getProviders(data?.db);
4932
- }
4933
- });
4934
- };
4935
- var use_get_provider_default = useGetProvider;
4936
-
4937
- // src/hooks/auth/use-isvalid-token.ts
4938
- import { useMutation as useMutation4 } from "@tanstack/react-query";
4939
- var useIsValidToken = () => {
4940
- return useMutation4({
4941
- mutationFn: (token) => {
4942
- return auth_service_default.isValidToken(token);
4943
- }
4944
- });
4945
- };
4946
- var use_isvalid_token_default = useIsValidToken;
4947
-
4948
- // src/hooks/auth/use-login-credential.ts
4949
- import { useMutation as useMutation5 } from "@tanstack/react-query";
4951
+ // src/hooks/auth/use-login-credential.tsx
4950
4952
  var useLoginCredential = () => {
4951
4953
  const { login } = useAuthService();
4952
4954
  return useMutation5({
@@ -253,31 +253,4 @@ declare const ViewService: {
253
253
  }): Promise<any>;
254
254
  };
255
255
 
256
- declare function useAuthService(): {
257
- login: (body: LoginCredentialBody) => Promise<any>;
258
- forgotPassword: (email: string) => Promise<any>;
259
- forgotPasswordSSO: ({ email, with_context, method, }: {
260
- email: string;
261
- with_context: any;
262
- method: string;
263
- }) => Promise<any>;
264
- resetPassword: (data: ResetPasswordRequest, token: string | null) => Promise<any>;
265
- resetPasswordSSO: ({ method, password, with_context, }: {
266
- method: any;
267
- password: string;
268
- with_context: any;
269
- }) => Promise<any>;
270
- updatePassword: (data: UpdatePasswordRequest, token: string | null) => Promise<any>;
271
- isValidToken: (token: string | null) => Promise<any>;
272
- isValidActionToken: (actionToken: string | null, path: string) => Promise<any>;
273
- loginSocial: ({ db, state, access_token, }: {
274
- db: string;
275
- state: object;
276
- access_token: string;
277
- }) => Promise<any>;
278
- getProviders: (db?: string) => Promise<any>;
279
- getAccessByCode: (code: string) => Promise<any>;
280
- logout: (data: string) => Promise<any>;
281
- };
282
-
283
- export { ActionService, AuthService, CompanyService, ExcelService, FormService, KanbanServices as KanbanService, ModelService, UserService, ViewService, useAuthService };
256
+ export { ActionService, AuthService, CompanyService, ExcelService, FormService, KanbanServices as KanbanService, ModelService, UserService, ViewService };
@@ -253,31 +253,4 @@ declare const ViewService: {
253
253
  }): Promise<any>;
254
254
  };
255
255
 
256
- declare function useAuthService(): {
257
- login: (body: LoginCredentialBody) => Promise<any>;
258
- forgotPassword: (email: string) => Promise<any>;
259
- forgotPasswordSSO: ({ email, with_context, method, }: {
260
- email: string;
261
- with_context: any;
262
- method: string;
263
- }) => Promise<any>;
264
- resetPassword: (data: ResetPasswordRequest, token: string | null) => Promise<any>;
265
- resetPasswordSSO: ({ method, password, with_context, }: {
266
- method: any;
267
- password: string;
268
- with_context: any;
269
- }) => Promise<any>;
270
- updatePassword: (data: UpdatePasswordRequest, token: string | null) => Promise<any>;
271
- isValidToken: (token: string | null) => Promise<any>;
272
- isValidActionToken: (actionToken: string | null, path: string) => Promise<any>;
273
- loginSocial: ({ db, state, access_token, }: {
274
- db: string;
275
- state: object;
276
- access_token: string;
277
- }) => Promise<any>;
278
- getProviders: (db?: string) => Promise<any>;
279
- getAccessByCode: (code: string) => Promise<any>;
280
- logout: (data: string) => Promise<any>;
281
- };
282
-
283
- export { ActionService, AuthService, CompanyService, ExcelService, FormService, KanbanServices as KanbanService, ModelService, UserService, ViewService, useAuthService };
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fctc/interface-logic",
3
- "version": "1.8.10",
3
+ "version": "1.9.1",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",