@fctc/interface-logic 1.10.8 → 1.10.9
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.d.mts +10 -12
- package/dist/hooks.d.ts +10 -12
- package/dist/hooks.js +2298 -2761
- package/dist/hooks.mjs +2301 -2763
- package/dist/provider.d.mts +1 -2
- package/dist/provider.d.ts +1 -2
- package/dist/provider.js +1929 -2409
- package/dist/provider.mjs +1816 -2296
- package/dist/services.d.mts +140 -140
- package/dist/services.d.ts +140 -140
- package/dist/services.js +2270 -1696
- package/dist/services.mjs +2263 -1689
- package/package.json +1 -1
package/dist/provider.mjs
CHANGED
|
@@ -648,10 +648,10 @@ var MainProvider = ({ children }) => {
|
|
|
648
648
|
};
|
|
649
649
|
|
|
650
650
|
// src/provider/version-gate-provider.tsx
|
|
651
|
-
import { useEffect as useEffect2, useState as
|
|
651
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
652
652
|
import { useQueryClient } from "@tanstack/react-query";
|
|
653
653
|
|
|
654
|
-
// src/services/
|
|
654
|
+
// src/services/action-service/index.ts
|
|
655
655
|
import { useCallback } from "react";
|
|
656
656
|
|
|
657
657
|
// src/constants/api/uri-constant.ts
|
|
@@ -684,6 +684,9 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
|
|
|
684
684
|
return UriConstants2;
|
|
685
685
|
})(UriConstants || {});
|
|
686
686
|
|
|
687
|
+
// src/utils/format.ts
|
|
688
|
+
import moment from "moment";
|
|
689
|
+
|
|
687
690
|
// src/constants/widget/widget-avatar-constant.ts
|
|
688
691
|
var WIDGETAVATAR = /* @__PURE__ */ ((WIDGETAVATAR2) => {
|
|
689
692
|
WIDGETAVATAR2["many2one_avatar_user"] = "many2one_avatar_user";
|
|
@@ -691,265 +694,6 @@ var WIDGETAVATAR = /* @__PURE__ */ ((WIDGETAVATAR2) => {
|
|
|
691
694
|
return WIDGETAVATAR2;
|
|
692
695
|
})(WIDGETAVATAR || {});
|
|
693
696
|
|
|
694
|
-
// src/services/view-service/backup.ts
|
|
695
|
-
function useViewService() {
|
|
696
|
-
const { env: env2 } = useEnv();
|
|
697
|
-
const getView = useCallback(
|
|
698
|
-
async ({ model, views, context = {}, options = {}, aid }) => {
|
|
699
|
-
const defaultOptions = {
|
|
700
|
-
load_filters: true,
|
|
701
|
-
toolbar: true,
|
|
702
|
-
action_id: aid
|
|
703
|
-
};
|
|
704
|
-
const jsonDataView = {
|
|
705
|
-
model,
|
|
706
|
-
method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
|
|
707
|
-
kwargs: {
|
|
708
|
-
views,
|
|
709
|
-
options: { ...options, ...defaultOptions }
|
|
710
|
-
},
|
|
711
|
-
with_context: context
|
|
712
|
-
};
|
|
713
|
-
return env2?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
|
|
714
|
-
headers: {
|
|
715
|
-
"Content-Type": "application/json"
|
|
716
|
-
}
|
|
717
|
-
});
|
|
718
|
-
},
|
|
719
|
-
[env2]
|
|
720
|
-
);
|
|
721
|
-
const getMenu = useCallback(
|
|
722
|
-
async (context) => {
|
|
723
|
-
const jsonData = {
|
|
724
|
-
model: "ir.ui.menu" /* MENU */,
|
|
725
|
-
method: "web_search_read" /* WEB_SEARCH_READ */,
|
|
726
|
-
ids: [],
|
|
727
|
-
with_context: context,
|
|
728
|
-
kwargs: {
|
|
729
|
-
specification: {
|
|
730
|
-
active: {},
|
|
731
|
-
name: {},
|
|
732
|
-
is_display: {},
|
|
733
|
-
sequence: {},
|
|
734
|
-
complete_name: {},
|
|
735
|
-
action: {
|
|
736
|
-
fields: {
|
|
737
|
-
display_name: {},
|
|
738
|
-
type: {},
|
|
739
|
-
binding_view_types: {}
|
|
740
|
-
}
|
|
741
|
-
},
|
|
742
|
-
url_icon: {},
|
|
743
|
-
web_icon: {},
|
|
744
|
-
web_icon_data: {},
|
|
745
|
-
groups_id: {
|
|
746
|
-
fields: {
|
|
747
|
-
full_name: {}
|
|
748
|
-
},
|
|
749
|
-
limit: 40,
|
|
750
|
-
order: ""
|
|
751
|
-
},
|
|
752
|
-
display_name: {},
|
|
753
|
-
child_id: {
|
|
754
|
-
fields: {
|
|
755
|
-
active: {},
|
|
756
|
-
name: {},
|
|
757
|
-
is_display: {},
|
|
758
|
-
sequence: {},
|
|
759
|
-
complete_name: {},
|
|
760
|
-
action: {
|
|
761
|
-
fields: {
|
|
762
|
-
display_name: {},
|
|
763
|
-
type: {},
|
|
764
|
-
binding_view_types: {}
|
|
765
|
-
}
|
|
766
|
-
},
|
|
767
|
-
url_icon: {},
|
|
768
|
-
web_icon: {},
|
|
769
|
-
web_icon_data: {},
|
|
770
|
-
groups_id: {
|
|
771
|
-
fields: {
|
|
772
|
-
full_name: {}
|
|
773
|
-
},
|
|
774
|
-
limit: 40,
|
|
775
|
-
order: ""
|
|
776
|
-
},
|
|
777
|
-
display_name: {},
|
|
778
|
-
child_id: {
|
|
779
|
-
fields: {
|
|
780
|
-
active: {},
|
|
781
|
-
name: {},
|
|
782
|
-
is_display: {},
|
|
783
|
-
sequence: {},
|
|
784
|
-
complete_name: {},
|
|
785
|
-
action: {
|
|
786
|
-
fields: {
|
|
787
|
-
display_name: {},
|
|
788
|
-
type: {},
|
|
789
|
-
binding_view_types: {}
|
|
790
|
-
}
|
|
791
|
-
},
|
|
792
|
-
url_icon: {},
|
|
793
|
-
web_icon: {},
|
|
794
|
-
web_icon_data: {},
|
|
795
|
-
groups_id: {
|
|
796
|
-
fields: {
|
|
797
|
-
full_name: {}
|
|
798
|
-
},
|
|
799
|
-
limit: 40,
|
|
800
|
-
order: ""
|
|
801
|
-
},
|
|
802
|
-
display_name: {},
|
|
803
|
-
child_id: {
|
|
804
|
-
fields: {},
|
|
805
|
-
limit: 40,
|
|
806
|
-
order: ""
|
|
807
|
-
}
|
|
808
|
-
},
|
|
809
|
-
limit: 40,
|
|
810
|
-
order: ""
|
|
811
|
-
}
|
|
812
|
-
},
|
|
813
|
-
limit: 40,
|
|
814
|
-
order: ""
|
|
815
|
-
}
|
|
816
|
-
},
|
|
817
|
-
domain: [
|
|
818
|
-
"&",
|
|
819
|
-
["is_display", "=", true],
|
|
820
|
-
"&",
|
|
821
|
-
["active", "=", true],
|
|
822
|
-
["parent_id", "=", false]
|
|
823
|
-
]
|
|
824
|
-
}
|
|
825
|
-
};
|
|
826
|
-
return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
827
|
-
headers: {
|
|
828
|
-
"Content-Type": "application/json"
|
|
829
|
-
}
|
|
830
|
-
});
|
|
831
|
-
},
|
|
832
|
-
[env2]
|
|
833
|
-
);
|
|
834
|
-
const getActionDetail = useCallback(
|
|
835
|
-
async (aid, context) => {
|
|
836
|
-
const jsonData = {
|
|
837
|
-
model: "ir.actions.act_window" /* WINDOW_ACTION */,
|
|
838
|
-
method: "web_read" /* WEB_READ */,
|
|
839
|
-
ids: [aid],
|
|
840
|
-
with_context: context,
|
|
841
|
-
kwargs: {
|
|
842
|
-
specification: {
|
|
843
|
-
id: {},
|
|
844
|
-
name: {},
|
|
845
|
-
res_model: {},
|
|
846
|
-
views: {},
|
|
847
|
-
view_mode: {},
|
|
848
|
-
mobile_view_mode: {},
|
|
849
|
-
domain: {},
|
|
850
|
-
context: {},
|
|
851
|
-
groups_id: {},
|
|
852
|
-
search_view_id: {}
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
};
|
|
856
|
-
return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
857
|
-
headers: {
|
|
858
|
-
"Content-Type": "application/json"
|
|
859
|
-
}
|
|
860
|
-
});
|
|
861
|
-
},
|
|
862
|
-
[env2]
|
|
863
|
-
);
|
|
864
|
-
const getResequence = useCallback(
|
|
865
|
-
async ({ model, ids, context, offset }) => {
|
|
866
|
-
const jsonData = {
|
|
867
|
-
model,
|
|
868
|
-
with_context: context,
|
|
869
|
-
ids,
|
|
870
|
-
field: "sequence",
|
|
871
|
-
...offset > 0 ? { offset } : {}
|
|
872
|
-
};
|
|
873
|
-
return env2?.requests.post("/web/dataset/resequence", jsonData, {
|
|
874
|
-
headers: {
|
|
875
|
-
"Content-Type": "application/json"
|
|
876
|
-
}
|
|
877
|
-
});
|
|
878
|
-
},
|
|
879
|
-
[env2]
|
|
880
|
-
);
|
|
881
|
-
const getSelectionItem = useCallback(
|
|
882
|
-
async ({ data }) => {
|
|
883
|
-
const jsonData = {
|
|
884
|
-
model: data.model,
|
|
885
|
-
ids: [],
|
|
886
|
-
method: "get_data_select",
|
|
887
|
-
with_context: data.context,
|
|
888
|
-
kwargs: {
|
|
889
|
-
count_limit: 10001,
|
|
890
|
-
domain: data.domain ? data.domain : [],
|
|
891
|
-
offset: 0,
|
|
892
|
-
order: "",
|
|
893
|
-
specification: data?.specification ?? {
|
|
894
|
-
id: {},
|
|
895
|
-
name: {},
|
|
896
|
-
display_name: {}
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
};
|
|
900
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
901
|
-
headers: {
|
|
902
|
-
"Content-Type": "application/json"
|
|
903
|
-
}
|
|
904
|
-
});
|
|
905
|
-
},
|
|
906
|
-
[env2]
|
|
907
|
-
);
|
|
908
|
-
const loadMessages = useCallback(
|
|
909
|
-
async () => {
|
|
910
|
-
return env2.requests.post(
|
|
911
|
-
"/load_message_failures" /* LOAD_MESSAGE */,
|
|
912
|
-
{},
|
|
913
|
-
{
|
|
914
|
-
headers: {
|
|
915
|
-
"Content-Type": "application/json"
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
);
|
|
919
|
-
},
|
|
920
|
-
[env2]
|
|
921
|
-
);
|
|
922
|
-
const getVersion = useCallback(
|
|
923
|
-
async () => {
|
|
924
|
-
console.log("env?.requests", env2, env2?.requests);
|
|
925
|
-
return env2?.requests?.get("", {
|
|
926
|
-
headers: {
|
|
927
|
-
"Content-Type": "application/json"
|
|
928
|
-
}
|
|
929
|
-
});
|
|
930
|
-
},
|
|
931
|
-
[env2]
|
|
932
|
-
);
|
|
933
|
-
return {
|
|
934
|
-
getView,
|
|
935
|
-
getMenu,
|
|
936
|
-
getActionDetail,
|
|
937
|
-
getResequence,
|
|
938
|
-
getSelectionItem,
|
|
939
|
-
loadMessages,
|
|
940
|
-
getVersion
|
|
941
|
-
};
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
// src/hooks/auth/use-forgot-password.ts
|
|
945
|
-
import { useMutation } from "@tanstack/react-query";
|
|
946
|
-
|
|
947
|
-
// src/configs/axios-client.ts
|
|
948
|
-
import axios from "axios";
|
|
949
|
-
|
|
950
|
-
// src/utils/format.ts
|
|
951
|
-
import moment from "moment";
|
|
952
|
-
|
|
953
697
|
// src/utils/domain/py_tokenizer.ts
|
|
954
698
|
var TokenizerError = class extends Error {
|
|
955
699
|
};
|
|
@@ -3098,860 +2842,586 @@ var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
|
|
|
3098
2842
|
return originalRequest.data;
|
|
3099
2843
|
};
|
|
3100
2844
|
|
|
3101
|
-
// src/
|
|
3102
|
-
|
|
3103
|
-
const
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
2845
|
+
// src/services/action-service/index.ts
|
|
2846
|
+
function useActionService() {
|
|
2847
|
+
const { env } = useEnv();
|
|
2848
|
+
const loadAction = useCallback(
|
|
2849
|
+
async ({
|
|
2850
|
+
idAction,
|
|
2851
|
+
context
|
|
2852
|
+
}) => {
|
|
2853
|
+
const jsonData = {
|
|
2854
|
+
action_id: idAction,
|
|
2855
|
+
with_context: { ...context }
|
|
2856
|
+
};
|
|
2857
|
+
return env.requests.post("/load_action" /* LOAD_ACTION */, jsonData, {
|
|
2858
|
+
headers: { "Content-Type": "application/json" }
|
|
2859
|
+
});
|
|
2860
|
+
},
|
|
2861
|
+
[env]
|
|
2862
|
+
);
|
|
2863
|
+
const callButton = useCallback(
|
|
2864
|
+
async ({
|
|
2865
|
+
model,
|
|
2866
|
+
ids = [],
|
|
2867
|
+
context,
|
|
2868
|
+
method
|
|
2869
|
+
}) => {
|
|
2870
|
+
try {
|
|
2871
|
+
const jsonData = {
|
|
2872
|
+
model,
|
|
2873
|
+
method,
|
|
2874
|
+
ids,
|
|
2875
|
+
with_context: context
|
|
2876
|
+
};
|
|
2877
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
2878
|
+
headers: { "Content-Type": "application/json" }
|
|
2879
|
+
});
|
|
2880
|
+
} catch (error) {
|
|
2881
|
+
console.error("Error when calling button action:", error);
|
|
2882
|
+
throw error;
|
|
2883
|
+
}
|
|
2884
|
+
},
|
|
2885
|
+
[env]
|
|
2886
|
+
);
|
|
2887
|
+
const removeRows = useCallback(
|
|
2888
|
+
async ({
|
|
2889
|
+
model,
|
|
2890
|
+
ids,
|
|
2891
|
+
context
|
|
2892
|
+
}) => {
|
|
2893
|
+
const jsonData = {
|
|
2894
|
+
model,
|
|
2895
|
+
method: "unlink",
|
|
2896
|
+
ids,
|
|
2897
|
+
with_context: context
|
|
2898
|
+
};
|
|
2899
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
2900
|
+
headers: { "Content-Type": "application/json" }
|
|
2901
|
+
});
|
|
2902
|
+
},
|
|
2903
|
+
[env]
|
|
2904
|
+
);
|
|
2905
|
+
const duplicateRecord = useCallback(
|
|
2906
|
+
async ({
|
|
2907
|
+
model,
|
|
2908
|
+
id,
|
|
2909
|
+
context
|
|
2910
|
+
}) => {
|
|
2911
|
+
const jsonData = {
|
|
2912
|
+
model,
|
|
2913
|
+
method: "copy",
|
|
2914
|
+
ids: id,
|
|
2915
|
+
with_context: context
|
|
2916
|
+
};
|
|
2917
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
2918
|
+
headers: { "Content-Type": "application/json" }
|
|
2919
|
+
});
|
|
2920
|
+
},
|
|
2921
|
+
[env]
|
|
2922
|
+
);
|
|
2923
|
+
const getPrintReportName = useCallback(
|
|
2924
|
+
async ({ id }) => {
|
|
2925
|
+
const jsonData = {
|
|
2926
|
+
model: "ir.actions.report",
|
|
2927
|
+
method: "web_read",
|
|
2928
|
+
id,
|
|
2929
|
+
kwargs: {
|
|
2930
|
+
specification: {
|
|
2931
|
+
report_name: {}
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
};
|
|
2935
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
2936
|
+
headers: { "Content-Type": "application/json" }
|
|
2937
|
+
});
|
|
2938
|
+
},
|
|
2939
|
+
[env]
|
|
2940
|
+
);
|
|
2941
|
+
const print = useCallback(
|
|
2942
|
+
async ({ id, report, db }) => {
|
|
2943
|
+
const jsonData = {
|
|
2944
|
+
report,
|
|
2945
|
+
id,
|
|
2946
|
+
type: "pdf",
|
|
2947
|
+
file_response: true,
|
|
2948
|
+
db
|
|
2949
|
+
};
|
|
2950
|
+
const queryString = toQueryString(jsonData);
|
|
2951
|
+
const urlWithParams = `${"/report" /* REPORT_PATH */}?${queryString}`;
|
|
2952
|
+
return env.requests.get(urlWithParams, {
|
|
2953
|
+
headers: { "Content-Type": "application/json" },
|
|
2954
|
+
responseType: "arraybuffer"
|
|
2955
|
+
});
|
|
2956
|
+
},
|
|
2957
|
+
[env]
|
|
2958
|
+
);
|
|
2959
|
+
const runAction = useCallback(
|
|
2960
|
+
async ({
|
|
2961
|
+
idAction,
|
|
2962
|
+
context
|
|
2963
|
+
}) => {
|
|
2964
|
+
const jsonData = {
|
|
2965
|
+
action_id: idAction,
|
|
2966
|
+
with_context: { ...context }
|
|
2967
|
+
};
|
|
2968
|
+
return env.requests.post("/run_action" /* RUN_ACTION_PATH */, jsonData, {
|
|
2969
|
+
headers: { "Content-Type": "application/json" }
|
|
2970
|
+
});
|
|
2971
|
+
},
|
|
2972
|
+
[env]
|
|
2973
|
+
);
|
|
3133
2974
|
return {
|
|
3134
|
-
|
|
2975
|
+
loadAction,
|
|
2976
|
+
callButton,
|
|
2977
|
+
removeRows,
|
|
2978
|
+
duplicateRecord,
|
|
2979
|
+
getPrintReportName,
|
|
2980
|
+
print,
|
|
2981
|
+
runAction
|
|
3135
2982
|
};
|
|
3136
|
-
}
|
|
2983
|
+
}
|
|
3137
2984
|
|
|
3138
|
-
// src/
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
2985
|
+
// src/services/auth-service/index.ts
|
|
2986
|
+
import { useCallback as useCallback2 } from "react";
|
|
2987
|
+
function useAuthService() {
|
|
2988
|
+
const { env } = useEnv();
|
|
2989
|
+
const login = useCallback2(
|
|
2990
|
+
async (body) => {
|
|
2991
|
+
const payload = Object.fromEntries(
|
|
2992
|
+
Object.entries({
|
|
2993
|
+
username: body.email,
|
|
2994
|
+
password: body.password,
|
|
2995
|
+
grant_type: env?.config?.grantType || "",
|
|
2996
|
+
client_id: env?.config?.clientId || "",
|
|
2997
|
+
client_secret: env?.config?.clientSecret || ""
|
|
2998
|
+
}).filter(([_, value]) => !!value)
|
|
2999
|
+
);
|
|
3000
|
+
const encodedData = new URLSearchParams(payload).toString();
|
|
3001
|
+
return env?.requests?.post(body.path, encodedData, {
|
|
3002
|
+
headers: {
|
|
3003
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
3152
3004
|
}
|
|
3153
3005
|
});
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3006
|
+
},
|
|
3007
|
+
[env]
|
|
3008
|
+
);
|
|
3009
|
+
const forgotPassword = useCallback2(
|
|
3010
|
+
async (email) => {
|
|
3011
|
+
const bodyData = {
|
|
3012
|
+
login: email,
|
|
3013
|
+
url: `${window.location.origin}/reset-password`
|
|
3014
|
+
};
|
|
3015
|
+
return env?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
|
|
3016
|
+
headers: {
|
|
3017
|
+
"Content-Type": "application/json"
|
|
3018
|
+
}
|
|
3019
|
+
});
|
|
3020
|
+
},
|
|
3021
|
+
[env]
|
|
3022
|
+
);
|
|
3023
|
+
const forgotPasswordSSO = useCallback2(
|
|
3024
|
+
async ({
|
|
3025
|
+
email,
|
|
3026
|
+
with_context,
|
|
3027
|
+
method
|
|
3028
|
+
}) => {
|
|
3029
|
+
const body = {
|
|
3030
|
+
method,
|
|
3031
|
+
kwargs: {
|
|
3032
|
+
vals: {
|
|
3033
|
+
email
|
|
3180
3034
|
}
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3035
|
+
},
|
|
3036
|
+
with_context
|
|
3037
|
+
};
|
|
3038
|
+
return env?.requests?.post("/call" /* CALL_PATH */, body, {
|
|
3039
|
+
headers: {
|
|
3040
|
+
"Content-Type": "application/json"
|
|
3041
|
+
}
|
|
3042
|
+
});
|
|
3043
|
+
},
|
|
3044
|
+
[env]
|
|
3045
|
+
);
|
|
3046
|
+
const resetPassword = useCallback2(
|
|
3047
|
+
async (data, token) => {
|
|
3048
|
+
const bodyData = {
|
|
3049
|
+
token,
|
|
3050
|
+
password: data.password,
|
|
3051
|
+
new_password: data.confirmPassword
|
|
3052
|
+
};
|
|
3053
|
+
return env?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
|
|
3054
|
+
headers: {
|
|
3055
|
+
"Content-Type": "application/json"
|
|
3056
|
+
}
|
|
3057
|
+
});
|
|
3058
|
+
},
|
|
3059
|
+
[env]
|
|
3060
|
+
);
|
|
3061
|
+
const resetPasswordSSO = useCallback2(
|
|
3062
|
+
async ({
|
|
3063
|
+
method,
|
|
3064
|
+
password,
|
|
3065
|
+
with_context
|
|
3066
|
+
}) => {
|
|
3067
|
+
const bodyData = {
|
|
3068
|
+
method,
|
|
3069
|
+
kwargs: {
|
|
3070
|
+
vals: {
|
|
3071
|
+
password
|
|
3184
3072
|
}
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3073
|
+
},
|
|
3074
|
+
with_context
|
|
3075
|
+
};
|
|
3076
|
+
return env?.requests?.post("/call" /* CALL_PATH */, bodyData, {
|
|
3077
|
+
headers: {
|
|
3078
|
+
"Content-Type": "application/json"
|
|
3079
|
+
}
|
|
3080
|
+
});
|
|
3081
|
+
},
|
|
3082
|
+
[env]
|
|
3083
|
+
);
|
|
3084
|
+
const updatePassword = useCallback2(
|
|
3085
|
+
async (data, token) => {
|
|
3086
|
+
const bodyData = {
|
|
3087
|
+
token,
|
|
3088
|
+
old_password: data.oldPassword,
|
|
3089
|
+
new_password: data.newPassword
|
|
3090
|
+
};
|
|
3091
|
+
return env?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
|
|
3092
|
+
headers: {
|
|
3093
|
+
"Content-Type": "application/json"
|
|
3094
|
+
}
|
|
3095
|
+
});
|
|
3096
|
+
},
|
|
3097
|
+
[env]
|
|
3098
|
+
);
|
|
3099
|
+
const isValidToken = useCallback2(
|
|
3100
|
+
async (token) => {
|
|
3101
|
+
const bodyData = {
|
|
3102
|
+
token
|
|
3103
|
+
};
|
|
3104
|
+
return env?.requests?.post("/check_token" /* TOKEN */, bodyData, {
|
|
3105
|
+
headers: {
|
|
3106
|
+
"Content-Type": "application/json"
|
|
3107
|
+
}
|
|
3108
|
+
});
|
|
3109
|
+
},
|
|
3110
|
+
[env]
|
|
3111
|
+
);
|
|
3112
|
+
const isValidActionToken = useCallback2(
|
|
3113
|
+
async (actionToken, path) => {
|
|
3114
|
+
return env?.requests?.post(
|
|
3115
|
+
path,
|
|
3116
|
+
{},
|
|
3117
|
+
{
|
|
3118
|
+
headers: {
|
|
3119
|
+
"Content-Type": "application/json"
|
|
3120
|
+
},
|
|
3121
|
+
useActionToken: true,
|
|
3122
|
+
actionToken
|
|
3123
|
+
}
|
|
3124
|
+
);
|
|
3125
|
+
},
|
|
3126
|
+
[env]
|
|
3127
|
+
);
|
|
3128
|
+
const loginSocial = useCallback2(
|
|
3129
|
+
async ({
|
|
3130
|
+
db,
|
|
3131
|
+
state,
|
|
3132
|
+
access_token
|
|
3133
|
+
}) => {
|
|
3134
|
+
return env?.requests?.post(
|
|
3135
|
+
"/token/generate" /* GENTOKEN_SOCIAL */,
|
|
3136
|
+
{ state, access_token },
|
|
3137
|
+
{
|
|
3138
|
+
headers: {
|
|
3139
|
+
"Content-Type": "application/json"
|
|
3206
3140
|
}
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
}
|
|
3232
|
-
).then(async (res) => {
|
|
3233
|
-
const data = res.data;
|
|
3234
|
-
await localStorage2.setToken(data.access_token);
|
|
3235
|
-
await localStorage2.setRefreshToken(data.refresh_token);
|
|
3236
|
-
axios.defaults.headers.common["Authorization"] = "Bearer " + data.access_token;
|
|
3237
|
-
originalRequest.headers["Authorization"] = "Bearer " + data.access_token;
|
|
3238
|
-
originalRequest.data = updateTokenParamInOriginalRequest(
|
|
3239
|
-
originalRequest,
|
|
3240
|
-
data.access_token
|
|
3241
|
-
);
|
|
3242
|
-
processQueue(null, data.access_token);
|
|
3243
|
-
resolve(instance.request(originalRequest));
|
|
3244
|
-
}).catch(async (err) => {
|
|
3245
|
-
if (err && (err?.error_code === "AUTHEN_FAIL" || err?.error_code === "TOKEN_EXPIRED" || err?.error_code === "TOKEN_INCORRECT" || err?.code === "ERR_BAD_REQUEST") || err?.error_code === "ERR_2FA_006") {
|
|
3246
|
-
await clearAuthToken();
|
|
3247
|
-
}
|
|
3248
|
-
if (err && err.response) {
|
|
3249
|
-
const { error_code } = err.response?.data || {};
|
|
3250
|
-
if (error_code === "AUTHEN_FAIL") {
|
|
3251
|
-
await clearAuthToken();
|
|
3252
|
-
}
|
|
3253
|
-
}
|
|
3254
|
-
processQueue(err, null);
|
|
3255
|
-
}).finally(() => {
|
|
3256
|
-
isRefreshing = false;
|
|
3257
|
-
});
|
|
3258
|
-
});
|
|
3141
|
+
}
|
|
3142
|
+
);
|
|
3143
|
+
},
|
|
3144
|
+
[env]
|
|
3145
|
+
);
|
|
3146
|
+
const getProviders = useCallback2(
|
|
3147
|
+
async (db) => {
|
|
3148
|
+
return env?.requests?.get("/oauth/providers", { params: { db } });
|
|
3149
|
+
},
|
|
3150
|
+
[env]
|
|
3151
|
+
);
|
|
3152
|
+
const getAccessByCode = useCallback2(
|
|
3153
|
+
async (code) => {
|
|
3154
|
+
const data = new URLSearchParams();
|
|
3155
|
+
data.append("code", code);
|
|
3156
|
+
data.append("grant_type", "authorization_code");
|
|
3157
|
+
data.append("client_id", env?.config?.clientId || "");
|
|
3158
|
+
data.append("redirect_uri", env?.config?.redirectUri || "");
|
|
3159
|
+
return env?.requests?.post(
|
|
3160
|
+
`${env?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
|
|
3161
|
+
data,
|
|
3162
|
+
{
|
|
3163
|
+
headers: {
|
|
3164
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
3259
3165
|
}
|
|
3260
3166
|
}
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
return
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
} else {
|
|
3278
|
-
console.error("Other Error:", error?.response);
|
|
3279
|
-
const errorMessage = error?.response?.data?.message || "An error occurred";
|
|
3280
|
-
return { message: errorMessage, status: error?.response?.status };
|
|
3281
|
-
}
|
|
3282
|
-
};
|
|
3283
|
-
const clearAuthToken = async () => {
|
|
3284
|
-
await localStorage2.clearToken();
|
|
3285
|
-
if (typeof window !== "undefined") {
|
|
3286
|
-
window.location.href = `/login`;
|
|
3287
|
-
}
|
|
3288
|
-
};
|
|
3289
|
-
function formatUrl(url, db2) {
|
|
3290
|
-
return url + (db2 ? "?db=" + db2 : "");
|
|
3291
|
-
}
|
|
3292
|
-
const responseBody = (response) => response;
|
|
3293
|
-
const requests = {
|
|
3294
|
-
get: (url, headers) => instance.get(formatUrl(url, db), headers).then(responseBody),
|
|
3295
|
-
post: (url, body, headers) => instance.post(formatUrl(url, db), body, headers).then(responseBody),
|
|
3296
|
-
post_excel: (url, body, headers) => instance.post(formatUrl(url, db), body, {
|
|
3297
|
-
responseType: "arraybuffer",
|
|
3298
|
-
headers: {
|
|
3299
|
-
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
3300
|
-
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
3167
|
+
);
|
|
3168
|
+
},
|
|
3169
|
+
[env]
|
|
3170
|
+
);
|
|
3171
|
+
const logout = useCallback2(
|
|
3172
|
+
async (data) => {
|
|
3173
|
+
console.log(data);
|
|
3174
|
+
return env?.requests?.post(
|
|
3175
|
+
"/logout" /* LOGOUT */,
|
|
3176
|
+
{},
|
|
3177
|
+
{
|
|
3178
|
+
headers: {
|
|
3179
|
+
"Content-Type": "application/json"
|
|
3180
|
+
},
|
|
3181
|
+
withCredentials: true,
|
|
3182
|
+
useRefreshToken: true
|
|
3301
3183
|
}
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
}
|
|
3320
|
-
emit(event, data) {
|
|
3321
|
-
if (this.listeners[event]) {
|
|
3322
|
-
this.listeners[event].forEach((callback) => callback(data));
|
|
3323
|
-
}
|
|
3324
|
-
}
|
|
3325
|
-
};
|
|
3326
|
-
var EnvStore = class {
|
|
3327
|
-
state;
|
|
3328
|
-
emitter;
|
|
3329
|
-
localStorageUtil;
|
|
3330
|
-
sessionStorageUtil;
|
|
3331
|
-
constructor(localStorageUtil = localStorageUtils(), sessionStorageUtil = sessionStorageUtils()) {
|
|
3332
|
-
this.state = {
|
|
3333
|
-
baseUrl: "",
|
|
3334
|
-
requests: null,
|
|
3335
|
-
companies: [],
|
|
3336
|
-
user: {},
|
|
3337
|
-
config: null,
|
|
3338
|
-
envFile: null,
|
|
3339
|
-
defaultCompany: {
|
|
3340
|
-
id: null,
|
|
3341
|
-
logo: "",
|
|
3342
|
-
secondary_color: "",
|
|
3343
|
-
primary_color: ""
|
|
3344
|
-
},
|
|
3345
|
-
context: {
|
|
3346
|
-
uid: null,
|
|
3347
|
-
allowed_company_ids: [],
|
|
3348
|
-
lang: "vi_VN",
|
|
3349
|
-
tz: "Asia/Saigon"
|
|
3350
|
-
},
|
|
3351
|
-
localStorageUtils: localStorageUtil,
|
|
3352
|
-
sessionStorageUtils: sessionStorageUtil
|
|
3353
|
-
};
|
|
3354
|
-
this.emitter = new EventEmitter();
|
|
3355
|
-
this.localStorageUtil = localStorageUtil;
|
|
3356
|
-
this.sessionStorageUtil = sessionStorageUtil;
|
|
3357
|
-
}
|
|
3358
|
-
getEnv() {
|
|
3359
|
-
return { ...this.state };
|
|
3360
|
-
}
|
|
3361
|
-
onUpdate(callback) {
|
|
3362
|
-
this.emitter.on("update", callback);
|
|
3363
|
-
}
|
|
3364
|
-
setupEnv(envConfig) {
|
|
3365
|
-
this.state = {
|
|
3366
|
-
...this.state,
|
|
3367
|
-
...envConfig,
|
|
3368
|
-
localStorageUtils: this.localStorageUtil,
|
|
3369
|
-
sessionStorageUtils: this.sessionStorageUtil
|
|
3370
|
-
};
|
|
3371
|
-
this.state.requests = axiosClient.init(this.state);
|
|
3372
|
-
this.emitter.emit("update", this.getEnv());
|
|
3373
|
-
return this.getEnv();
|
|
3374
|
-
}
|
|
3375
|
-
setUid(uid) {
|
|
3376
|
-
this.state = {
|
|
3377
|
-
...this.state,
|
|
3378
|
-
context: { ...this.state.context, uid }
|
|
3379
|
-
};
|
|
3380
|
-
this.emitter.emit("update", this.getEnv());
|
|
3381
|
-
}
|
|
3382
|
-
setLang(lang) {
|
|
3383
|
-
this.state = {
|
|
3384
|
-
...this.state,
|
|
3385
|
-
context: { ...this.state.context, lang }
|
|
3386
|
-
};
|
|
3387
|
-
this.emitter.emit("update", this.getEnv());
|
|
3388
|
-
}
|
|
3389
|
-
setAllowCompanies(allowed_company_ids) {
|
|
3390
|
-
this.state = {
|
|
3391
|
-
...this.state,
|
|
3392
|
-
context: { ...this.state.context, allowed_company_ids }
|
|
3393
|
-
};
|
|
3394
|
-
this.emitter.emit("update", this.getEnv());
|
|
3395
|
-
}
|
|
3396
|
-
setCompanies(companies) {
|
|
3397
|
-
this.state = { ...this.state, companies };
|
|
3398
|
-
this.emitter.emit("update", this.getEnv());
|
|
3399
|
-
}
|
|
3400
|
-
setDefaultCompany(defaultCompany) {
|
|
3401
|
-
this.state = { ...this.state, defaultCompany };
|
|
3402
|
-
this.emitter.emit("update", this.getEnv());
|
|
3403
|
-
}
|
|
3404
|
-
setUserInfo(user) {
|
|
3405
|
-
this.state = { ...this.state, user };
|
|
3406
|
-
this.emitter.emit("update", this.getEnv());
|
|
3407
|
-
}
|
|
3408
|
-
setConfig(config) {
|
|
3409
|
-
this.state = { ...this.state, config };
|
|
3410
|
-
this.emitter.emit("update", this.getEnv());
|
|
3411
|
-
}
|
|
3412
|
-
setEnvFile(envFile) {
|
|
3413
|
-
this.state = { ...this.state, envFile };
|
|
3414
|
-
this.emitter.emit("update", this.getEnv());
|
|
3415
|
-
}
|
|
3416
|
-
};
|
|
3417
|
-
var env = null;
|
|
3418
|
-
function initEnv({
|
|
3419
|
-
localStorageUtils: localStorageUtil = localStorageUtils(),
|
|
3420
|
-
sessionStorageUtils: sessionStorageUtil = sessionStorageUtils()
|
|
3421
|
-
}) {
|
|
3422
|
-
if (!env) {
|
|
3423
|
-
env = new EnvStore(localStorageUtil, sessionStorageUtil);
|
|
3424
|
-
}
|
|
3425
|
-
return env;
|
|
3426
|
-
}
|
|
3427
|
-
function getEnv() {
|
|
3428
|
-
if (!env) {
|
|
3429
|
-
env = initEnv({});
|
|
3430
|
-
}
|
|
3431
|
-
return env?.getEnv();
|
|
3184
|
+
);
|
|
3185
|
+
},
|
|
3186
|
+
[env]
|
|
3187
|
+
);
|
|
3188
|
+
return {
|
|
3189
|
+
login,
|
|
3190
|
+
forgotPassword,
|
|
3191
|
+
forgotPasswordSSO,
|
|
3192
|
+
resetPassword,
|
|
3193
|
+
resetPasswordSSO,
|
|
3194
|
+
updatePassword,
|
|
3195
|
+
isValidToken,
|
|
3196
|
+
isValidActionToken,
|
|
3197
|
+
loginSocial,
|
|
3198
|
+
getProviders,
|
|
3199
|
+
getAccessByCode,
|
|
3200
|
+
logout
|
|
3201
|
+
};
|
|
3432
3202
|
}
|
|
3433
3203
|
|
|
3434
|
-
// src/services/
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
}) {
|
|
3441
|
-
const env2 = getEnv();
|
|
3442
|
-
const jsonData = {
|
|
3443
|
-
action_id: idAction,
|
|
3444
|
-
with_context: {
|
|
3445
|
-
...context
|
|
3446
|
-
}
|
|
3447
|
-
};
|
|
3448
|
-
return env2.requests.post(`${"/load_action" /* LOAD_ACTION */}`, jsonData, {
|
|
3204
|
+
// src/services/company-service/index.ts
|
|
3205
|
+
import { useCallback as useCallback3 } from "react";
|
|
3206
|
+
function useCompanyService() {
|
|
3207
|
+
const { env } = useEnv();
|
|
3208
|
+
const getCurrentCompany = useCallback3(async () => {
|
|
3209
|
+
return await env.requests.get("/company" /* COMPANY_PATH */, {
|
|
3449
3210
|
headers: {
|
|
3450
3211
|
"Content-Type": "application/json"
|
|
3451
3212
|
}
|
|
3452
3213
|
});
|
|
3453
|
-
},
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
model,
|
|
3457
|
-
ids = [],
|
|
3458
|
-
context,
|
|
3459
|
-
method
|
|
3460
|
-
}) {
|
|
3461
|
-
try {
|
|
3462
|
-
const env2 = getEnv();
|
|
3214
|
+
}, [env]);
|
|
3215
|
+
const getInfoCompany = useCallback3(
|
|
3216
|
+
async (id) => {
|
|
3463
3217
|
const jsonData = {
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3218
|
+
ids: [id],
|
|
3219
|
+
model: "res.company" /* COMPANY */,
|
|
3220
|
+
method: "web_read" /* WEB_READ */,
|
|
3221
|
+
kwargs: {
|
|
3222
|
+
specification: {
|
|
3223
|
+
primary_color: {},
|
|
3224
|
+
secondary_color: {},
|
|
3225
|
+
logo: {},
|
|
3226
|
+
display_name: {},
|
|
3227
|
+
secondary_logo: {}
|
|
3228
|
+
}
|
|
3229
|
+
}
|
|
3468
3230
|
};
|
|
3469
|
-
return
|
|
3231
|
+
return await env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3470
3232
|
headers: {
|
|
3471
3233
|
"Content-Type": "application/json"
|
|
3472
3234
|
}
|
|
3473
3235
|
});
|
|
3474
|
-
}
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
ids,
|
|
3483
|
-
context
|
|
3484
|
-
}) {
|
|
3485
|
-
const env2 = getEnv();
|
|
3486
|
-
const jsonData = {
|
|
3487
|
-
model,
|
|
3488
|
-
method: "unlink",
|
|
3489
|
-
ids,
|
|
3490
|
-
with_context: context
|
|
3491
|
-
};
|
|
3492
|
-
return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3493
|
-
headers: {
|
|
3494
|
-
"Content-Type": "application/json"
|
|
3495
|
-
}
|
|
3496
|
-
});
|
|
3497
|
-
},
|
|
3498
|
-
// Duplicate Model
|
|
3499
|
-
async duplicateRecord({
|
|
3500
|
-
model,
|
|
3501
|
-
id,
|
|
3502
|
-
context
|
|
3503
|
-
}) {
|
|
3504
|
-
const env2 = getEnv();
|
|
3505
|
-
const jsonData = {
|
|
3506
|
-
model,
|
|
3507
|
-
method: "copy",
|
|
3508
|
-
ids: id,
|
|
3509
|
-
with_context: context
|
|
3510
|
-
};
|
|
3511
|
-
return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3512
|
-
headers: {
|
|
3513
|
-
"Content-Type": "application/json"
|
|
3514
|
-
}
|
|
3515
|
-
});
|
|
3516
|
-
},
|
|
3517
|
-
// Get Print Report
|
|
3518
|
-
async getPrintReportName({ id }) {
|
|
3519
|
-
const env2 = getEnv();
|
|
3520
|
-
const jsonData = {
|
|
3521
|
-
model: "ir.actions.report",
|
|
3522
|
-
method: "web_read",
|
|
3523
|
-
id,
|
|
3524
|
-
kwargs: {
|
|
3525
|
-
specification: {
|
|
3526
|
-
report_name: {}
|
|
3527
|
-
}
|
|
3528
|
-
}
|
|
3529
|
-
};
|
|
3530
|
-
return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3531
|
-
headers: {
|
|
3532
|
-
"Content-Type": "application/json"
|
|
3533
|
-
}
|
|
3534
|
-
});
|
|
3535
|
-
},
|
|
3536
|
-
//Save Print Invoice
|
|
3537
|
-
async print({ id, report, db }) {
|
|
3538
|
-
const env2 = getEnv();
|
|
3539
|
-
const jsonData = {
|
|
3540
|
-
report,
|
|
3541
|
-
id,
|
|
3542
|
-
type: "pdf",
|
|
3543
|
-
file_response: true,
|
|
3544
|
-
db
|
|
3545
|
-
};
|
|
3546
|
-
const queryString = toQueryString(jsonData);
|
|
3547
|
-
const urlWithParams = `${"/report" /* REPORT_PATH */}?${queryString}`;
|
|
3548
|
-
return env2.requests.get(urlWithParams, {
|
|
3549
|
-
headers: {
|
|
3550
|
-
"Content-Type": "application/json"
|
|
3551
|
-
},
|
|
3552
|
-
responseType: "arraybuffer"
|
|
3553
|
-
});
|
|
3554
|
-
},
|
|
3555
|
-
//Run Action
|
|
3556
|
-
async runAction({
|
|
3557
|
-
idAction,
|
|
3558
|
-
context
|
|
3559
|
-
}) {
|
|
3560
|
-
const env2 = getEnv();
|
|
3561
|
-
const jsonData = {
|
|
3562
|
-
action_id: idAction,
|
|
3563
|
-
with_context: {
|
|
3564
|
-
...context
|
|
3565
|
-
}
|
|
3566
|
-
// context: {
|
|
3567
|
-
// lang: 'en_US',
|
|
3568
|
-
// tz: 'Asia/Saigon',
|
|
3569
|
-
// uid: 2,
|
|
3570
|
-
// allowed_company_ids: [1],
|
|
3571
|
-
// active_id: Array.isArray(idDetail) ? idDetail[0] : idDetail,
|
|
3572
|
-
// active_ids: Array.isArray(idDetail) ? [...idDetail] : idDetail,
|
|
3573
|
-
// active_model: model,
|
|
3574
|
-
// },
|
|
3575
|
-
};
|
|
3576
|
-
return env2.requests.post(`${"/run_action" /* RUN_ACTION_PATH */}`, jsonData, {
|
|
3577
|
-
headers: {
|
|
3578
|
-
"Content-Type": "application/json"
|
|
3579
|
-
}
|
|
3580
|
-
});
|
|
3581
|
-
}
|
|
3582
|
-
};
|
|
3583
|
-
var action_service_default = ActionService;
|
|
3236
|
+
},
|
|
3237
|
+
[env]
|
|
3238
|
+
);
|
|
3239
|
+
return {
|
|
3240
|
+
getCurrentCompany,
|
|
3241
|
+
getInfoCompany
|
|
3242
|
+
};
|
|
3243
|
+
}
|
|
3584
3244
|
|
|
3585
|
-
// src/services/
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
password: body.password,
|
|
3593
|
-
grant_type: env2?.config?.grantType || "",
|
|
3594
|
-
client_id: env2?.config?.clientId || "",
|
|
3595
|
-
client_secret: env2?.config?.clientSecret || ""
|
|
3596
|
-
}).filter(([_, value]) => !!value)
|
|
3597
|
-
);
|
|
3598
|
-
const encodedData = new URLSearchParams(payload).toString();
|
|
3599
|
-
return env2?.requests?.post(body.path, encodedData, {
|
|
3600
|
-
headers: {
|
|
3601
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
3602
|
-
}
|
|
3603
|
-
});
|
|
3604
|
-
},
|
|
3605
|
-
async forgotPassword(email) {
|
|
3606
|
-
const env2 = getEnv();
|
|
3607
|
-
const bodyData = {
|
|
3608
|
-
login: email,
|
|
3609
|
-
url: `${window.location.origin}/reset-password`
|
|
3610
|
-
};
|
|
3611
|
-
return env2?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
|
|
3612
|
-
headers: {
|
|
3613
|
-
"Content-Type": "application/json"
|
|
3614
|
-
}
|
|
3615
|
-
});
|
|
3616
|
-
},
|
|
3617
|
-
async forgotPasswordSSO({
|
|
3618
|
-
email,
|
|
3619
|
-
with_context,
|
|
3620
|
-
method
|
|
3621
|
-
}) {
|
|
3622
|
-
const env2 = getEnv();
|
|
3623
|
-
const body = {
|
|
3624
|
-
method,
|
|
3625
|
-
kwargs: {
|
|
3626
|
-
vals: {
|
|
3627
|
-
email
|
|
3628
|
-
}
|
|
3629
|
-
},
|
|
3630
|
-
with_context
|
|
3631
|
-
};
|
|
3632
|
-
return env2?.requests?.post("/call" /* CALL_PATH */, body, {
|
|
3633
|
-
headers: {
|
|
3634
|
-
"Content-Type": "application/json"
|
|
3635
|
-
}
|
|
3636
|
-
});
|
|
3637
|
-
},
|
|
3638
|
-
async resetPassword(data, token) {
|
|
3639
|
-
const env2 = getEnv();
|
|
3640
|
-
const bodyData = {
|
|
3641
|
-
token,
|
|
3642
|
-
password: data.password,
|
|
3643
|
-
new_password: data.confirmPassword
|
|
3644
|
-
};
|
|
3645
|
-
return env2?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
|
|
3646
|
-
headers: {
|
|
3647
|
-
"Content-Type": "application/json"
|
|
3648
|
-
}
|
|
3649
|
-
});
|
|
3650
|
-
},
|
|
3651
|
-
async resetPasswordSSO({
|
|
3652
|
-
method,
|
|
3653
|
-
password,
|
|
3654
|
-
with_context
|
|
3655
|
-
}) {
|
|
3656
|
-
const env2 = getEnv();
|
|
3657
|
-
const bodyData = {
|
|
3658
|
-
method,
|
|
3659
|
-
kwargs: {
|
|
3660
|
-
vals: {
|
|
3661
|
-
password
|
|
3662
|
-
}
|
|
3663
|
-
},
|
|
3664
|
-
with_context
|
|
3665
|
-
};
|
|
3666
|
-
return env2?.requests?.post("/call" /* CALL_PATH */, bodyData, {
|
|
3667
|
-
headers: {
|
|
3668
|
-
"Content-Type": "application/json"
|
|
3669
|
-
}
|
|
3670
|
-
});
|
|
3671
|
-
},
|
|
3672
|
-
async updatePassword(data, token) {
|
|
3673
|
-
const env2 = getEnv();
|
|
3674
|
-
const bodyData = {
|
|
3675
|
-
token,
|
|
3676
|
-
old_password: data.oldPassword,
|
|
3677
|
-
new_password: data.newPassword
|
|
3678
|
-
};
|
|
3679
|
-
return env2?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
|
|
3680
|
-
headers: {
|
|
3681
|
-
"Content-Type": "application/json"
|
|
3682
|
-
}
|
|
3683
|
-
});
|
|
3684
|
-
},
|
|
3685
|
-
async isValidToken(token) {
|
|
3686
|
-
const env2 = getEnv();
|
|
3687
|
-
const bodyData = {
|
|
3688
|
-
token
|
|
3689
|
-
};
|
|
3690
|
-
return env2?.requests?.post("/check_token" /* TOKEN */, bodyData, {
|
|
3691
|
-
headers: {
|
|
3692
|
-
"Content-Type": "application/json"
|
|
3693
|
-
}
|
|
3694
|
-
});
|
|
3695
|
-
},
|
|
3696
|
-
async isValidActionToken(actionToken, path) {
|
|
3697
|
-
const env2 = getEnv();
|
|
3698
|
-
return env2?.requests?.post(
|
|
3699
|
-
path,
|
|
3700
|
-
{},
|
|
3701
|
-
{
|
|
3702
|
-
headers: {
|
|
3703
|
-
"Content-Type": "application/json"
|
|
3704
|
-
},
|
|
3705
|
-
useActionToken: true,
|
|
3706
|
-
actionToken
|
|
3707
|
-
}
|
|
3708
|
-
);
|
|
3709
|
-
},
|
|
3710
|
-
async loginSocial({
|
|
3711
|
-
db,
|
|
3712
|
-
state,
|
|
3713
|
-
access_token
|
|
3714
|
-
}) {
|
|
3715
|
-
const env2 = getEnv();
|
|
3716
|
-
return env2?.requests?.post(
|
|
3717
|
-
"/token/generate" /* GENTOKEN_SOCIAL */,
|
|
3718
|
-
{ state, access_token },
|
|
3719
|
-
{
|
|
3245
|
+
// src/services/excel-service/index.ts
|
|
3246
|
+
import { useCallback as useCallback4 } from "react";
|
|
3247
|
+
function useExcelService() {
|
|
3248
|
+
const { env } = useEnv();
|
|
3249
|
+
const uploadFile = useCallback4(
|
|
3250
|
+
async ({ formData }) => {
|
|
3251
|
+
return env.requests.post("/upload/file" /* UPLOAD_FILE_PATH */, formData, {
|
|
3720
3252
|
headers: {
|
|
3721
|
-
"Content-Type": "
|
|
3253
|
+
"Content-Type": "multipart/form-data"
|
|
3722
3254
|
}
|
|
3723
|
-
}
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
async getAccessByCode(code) {
|
|
3731
|
-
const env2 = getEnv();
|
|
3732
|
-
const data = new URLSearchParams();
|
|
3733
|
-
data.append("code", code);
|
|
3734
|
-
data.append("grant_type", "authorization_code");
|
|
3735
|
-
data.append("client_id", env2?.config?.clientId || "");
|
|
3736
|
-
data.append("redirect_uri", env2?.config?.redirectUri || "");
|
|
3737
|
-
return env2?.requests?.post(
|
|
3738
|
-
`${env2?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
|
|
3739
|
-
data,
|
|
3740
|
-
{
|
|
3255
|
+
});
|
|
3256
|
+
},
|
|
3257
|
+
[env]
|
|
3258
|
+
);
|
|
3259
|
+
const uploadIdFile = useCallback4(
|
|
3260
|
+
async ({ formData }) => {
|
|
3261
|
+
return env.requests.post("/upload/file" /* UPLOAD_FILE_PATH */, formData, {
|
|
3741
3262
|
headers: {
|
|
3742
|
-
"Content-Type": "
|
|
3263
|
+
"Content-Type": "multipart/form-data"
|
|
3743
3264
|
}
|
|
3744
|
-
}
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
secondary_logo: {}
|
|
3265
|
+
});
|
|
3266
|
+
},
|
|
3267
|
+
[env]
|
|
3268
|
+
);
|
|
3269
|
+
const parsePreview = useCallback4(
|
|
3270
|
+
async ({
|
|
3271
|
+
id,
|
|
3272
|
+
selectedSheet,
|
|
3273
|
+
isHeader,
|
|
3274
|
+
context
|
|
3275
|
+
}) => {
|
|
3276
|
+
const jsonData = {
|
|
3277
|
+
model: "base_import.import" /* BASE_IMPORT */,
|
|
3278
|
+
method: "parse_preview",
|
|
3279
|
+
ids: [id],
|
|
3280
|
+
kwargs: {
|
|
3281
|
+
options: {
|
|
3282
|
+
import_skip_records: [],
|
|
3283
|
+
import_set_empty_fields: [],
|
|
3284
|
+
fallback_values: {},
|
|
3285
|
+
name_create_enabled_fields: {},
|
|
3286
|
+
encoding: "",
|
|
3287
|
+
separator: "",
|
|
3288
|
+
quoting: '"',
|
|
3289
|
+
date_format: "",
|
|
3290
|
+
datetime_format: "",
|
|
3291
|
+
float_thousand_separator: ",",
|
|
3292
|
+
float_decimal_separator: ".",
|
|
3293
|
+
advanced: true,
|
|
3294
|
+
has_headers: isHeader,
|
|
3295
|
+
keep_matches: false,
|
|
3296
|
+
limit: 2e3,
|
|
3297
|
+
sheets: [],
|
|
3298
|
+
sheet: selectedSheet,
|
|
3299
|
+
skip: 0,
|
|
3300
|
+
tracking_disable: true
|
|
3301
|
+
}
|
|
3302
|
+
},
|
|
3303
|
+
with_context: context
|
|
3304
|
+
};
|
|
3305
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3306
|
+
headers: {
|
|
3307
|
+
"Content-Type": "multipart/form-data"
|
|
3788
3308
|
}
|
|
3789
|
-
}
|
|
3790
|
-
}
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
},
|
|
3818
|
-
async parsePreview({
|
|
3819
|
-
id,
|
|
3820
|
-
selectedSheet,
|
|
3821
|
-
isHeader,
|
|
3822
|
-
context
|
|
3823
|
-
}) {
|
|
3824
|
-
const env2 = getEnv();
|
|
3825
|
-
const jsonData = {
|
|
3826
|
-
model: "base_import.import" /* BASE_IMPORT */,
|
|
3827
|
-
method: "parse_preview",
|
|
3828
|
-
ids: [id],
|
|
3829
|
-
kwargs: {
|
|
3830
|
-
options: {
|
|
3831
|
-
import_skip_records: [],
|
|
3832
|
-
import_set_empty_fields: [],
|
|
3833
|
-
fallback_values: {},
|
|
3834
|
-
name_create_enabled_fields: {},
|
|
3835
|
-
encoding: "",
|
|
3836
|
-
separator: "",
|
|
3837
|
-
quoting: '"',
|
|
3838
|
-
date_format: "",
|
|
3839
|
-
datetime_format: "",
|
|
3840
|
-
float_thousand_separator: ",",
|
|
3841
|
-
float_decimal_separator: ".",
|
|
3842
|
-
advanced: true,
|
|
3843
|
-
has_headers: isHeader,
|
|
3844
|
-
keep_matches: false,
|
|
3845
|
-
limit: 2e3,
|
|
3846
|
-
sheets: [],
|
|
3847
|
-
sheet: selectedSheet,
|
|
3848
|
-
skip: 0,
|
|
3849
|
-
tracking_disable: true
|
|
3309
|
+
});
|
|
3310
|
+
},
|
|
3311
|
+
[env]
|
|
3312
|
+
);
|
|
3313
|
+
const executeImport = useCallback4(
|
|
3314
|
+
async ({
|
|
3315
|
+
columns,
|
|
3316
|
+
fields,
|
|
3317
|
+
idFile,
|
|
3318
|
+
options,
|
|
3319
|
+
dryrun,
|
|
3320
|
+
context
|
|
3321
|
+
}) => {
|
|
3322
|
+
const jsonData = {
|
|
3323
|
+
model: "base_import.import" /* BASE_IMPORT */,
|
|
3324
|
+
method: "execute_import",
|
|
3325
|
+
ids: [idFile],
|
|
3326
|
+
kwargs: {
|
|
3327
|
+
fields,
|
|
3328
|
+
columns,
|
|
3329
|
+
options,
|
|
3330
|
+
dryrun
|
|
3331
|
+
},
|
|
3332
|
+
with_context: context
|
|
3333
|
+
};
|
|
3334
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3335
|
+
headers: {
|
|
3336
|
+
"Content-Type": "multipart/form-data"
|
|
3850
3337
|
}
|
|
3851
|
-
}
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
const jsonData = {
|
|
3870
|
-
model: "base_import.import" /* BASE_IMPORT */,
|
|
3871
|
-
method: "execute_import",
|
|
3872
|
-
ids: [idFile],
|
|
3873
|
-
kwargs: {
|
|
3874
|
-
fields,
|
|
3875
|
-
columns,
|
|
3876
|
-
options,
|
|
3877
|
-
dryrun
|
|
3878
|
-
},
|
|
3879
|
-
with_context: context
|
|
3880
|
-
};
|
|
3881
|
-
return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3882
|
-
headers: {
|
|
3883
|
-
"Content-Type": "multipart/form-data"
|
|
3884
|
-
}
|
|
3885
|
-
});
|
|
3886
|
-
},
|
|
3887
|
-
async getFileExcel({ model }) {
|
|
3888
|
-
const env2 = getEnv();
|
|
3889
|
-
const jsonData = {
|
|
3890
|
-
model,
|
|
3891
|
-
method: "get_import_templates" /* GET_IMPORT */,
|
|
3892
|
-
args: []
|
|
3893
|
-
};
|
|
3894
|
-
return env2.requests.post("/call" /* CALL_PATH */, jsonData);
|
|
3895
|
-
},
|
|
3896
|
-
async getFieldExport({
|
|
3897
|
-
ids,
|
|
3898
|
-
model,
|
|
3899
|
-
isShow,
|
|
3900
|
-
parentField,
|
|
3901
|
-
fieldType,
|
|
3902
|
-
parentName,
|
|
3903
|
-
prefix,
|
|
3904
|
-
name,
|
|
3905
|
-
context,
|
|
3906
|
-
importCompat
|
|
3907
|
-
}) {
|
|
3908
|
-
const env2 = getEnv();
|
|
3909
|
-
const jsonData = {
|
|
3338
|
+
});
|
|
3339
|
+
},
|
|
3340
|
+
[env]
|
|
3341
|
+
);
|
|
3342
|
+
const getFileExcel = useCallback4(
|
|
3343
|
+
async ({ model }) => {
|
|
3344
|
+
const jsonData = {
|
|
3345
|
+
model,
|
|
3346
|
+
method: "get_import_templates" /* GET_IMPORT */,
|
|
3347
|
+
args: []
|
|
3348
|
+
};
|
|
3349
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData);
|
|
3350
|
+
},
|
|
3351
|
+
[env]
|
|
3352
|
+
);
|
|
3353
|
+
const getFieldExport = useCallback4(
|
|
3354
|
+
async ({
|
|
3355
|
+
ids,
|
|
3910
3356
|
model,
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
jsonData
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3357
|
+
isShow,
|
|
3358
|
+
parentField,
|
|
3359
|
+
fieldType,
|
|
3360
|
+
parentName,
|
|
3361
|
+
prefix,
|
|
3362
|
+
name,
|
|
3363
|
+
context,
|
|
3364
|
+
importCompat
|
|
3365
|
+
}) => {
|
|
3366
|
+
const jsonData = {
|
|
3367
|
+
model,
|
|
3368
|
+
import_compat: importCompat,
|
|
3369
|
+
domain: [["id", "in", ids]],
|
|
3370
|
+
with_context: context
|
|
3371
|
+
};
|
|
3372
|
+
if (isShow) {
|
|
3373
|
+
jsonData.parent_field = parentField;
|
|
3374
|
+
jsonData.parent_field_type = fieldType;
|
|
3375
|
+
jsonData.parent_name = parentName;
|
|
3376
|
+
jsonData.name = name;
|
|
3377
|
+
jsonData.prefix = prefix;
|
|
3378
|
+
jsonData.exclude = [null];
|
|
3379
|
+
}
|
|
3380
|
+
return env.requests.post("/export/get_fields", jsonData);
|
|
3381
|
+
},
|
|
3382
|
+
[env]
|
|
3383
|
+
);
|
|
3384
|
+
const exportExcel = useCallback4(
|
|
3385
|
+
async ({
|
|
3937
3386
|
model,
|
|
3938
3387
|
domain,
|
|
3939
3388
|
ids,
|
|
3940
|
-
import_compat: importCompat,
|
|
3941
3389
|
fields,
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3390
|
+
type,
|
|
3391
|
+
importCompat,
|
|
3392
|
+
context,
|
|
3393
|
+
groupby
|
|
3394
|
+
}) => {
|
|
3395
|
+
const jsonData = {
|
|
3396
|
+
model,
|
|
3397
|
+
domain,
|
|
3398
|
+
ids,
|
|
3399
|
+
import_compat: importCompat,
|
|
3400
|
+
fields,
|
|
3401
|
+
with_context: context,
|
|
3402
|
+
groupby: groupby ?? []
|
|
3403
|
+
};
|
|
3404
|
+
return env.requests.post_excel(`/export/${type}`, jsonData);
|
|
3405
|
+
},
|
|
3406
|
+
[env]
|
|
3407
|
+
);
|
|
3408
|
+
return {
|
|
3409
|
+
uploadFile,
|
|
3410
|
+
uploadIdFile,
|
|
3411
|
+
parsePreview,
|
|
3412
|
+
executeImport,
|
|
3413
|
+
getFileExcel,
|
|
3414
|
+
getFieldExport,
|
|
3415
|
+
exportExcel
|
|
3416
|
+
};
|
|
3417
|
+
}
|
|
3949
3418
|
|
|
3950
3419
|
// src/services/form-service/index.ts
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3420
|
+
import { useCallback as useCallback5 } from "react";
|
|
3421
|
+
function useFormService() {
|
|
3422
|
+
const { env } = useEnv();
|
|
3423
|
+
const getComment = useCallback5(
|
|
3424
|
+
async ({ data }) => {
|
|
3955
3425
|
const jsonData = {
|
|
3956
3426
|
thread_id: data.thread_id,
|
|
3957
3427
|
thread_model: data.thread_model,
|
|
@@ -3960,19 +3430,16 @@ var FormService = {
|
|
|
3960
3430
|
lang: data.lang
|
|
3961
3431
|
}
|
|
3962
3432
|
};
|
|
3963
|
-
return
|
|
3433
|
+
return env.requests.post("/chatter/thread/messages" /* GET_MESSAGE */, jsonData, {
|
|
3964
3434
|
headers: {
|
|
3965
3435
|
"Content-Type": "application/json"
|
|
3966
3436
|
}
|
|
3967
3437
|
});
|
|
3968
|
-
}
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
async sentComment({ data }) {
|
|
3974
|
-
try {
|
|
3975
|
-
const env2 = getEnv();
|
|
3438
|
+
},
|
|
3439
|
+
[env]
|
|
3440
|
+
);
|
|
3441
|
+
const sentComment = useCallback5(
|
|
3442
|
+
async ({ data }) => {
|
|
3976
3443
|
const jsonData = {
|
|
3977
3444
|
context: {
|
|
3978
3445
|
tz: "Asia/Saigon",
|
|
@@ -3991,39 +3458,33 @@ var FormService = {
|
|
|
3991
3458
|
thread_id: Number(data.thread_id),
|
|
3992
3459
|
thread_model: data.thread_model
|
|
3993
3460
|
};
|
|
3994
|
-
return
|
|
3461
|
+
return env.requests.post("/chatter/message/post" /* SENT_MESSAGE */, jsonData, {
|
|
3995
3462
|
headers: {
|
|
3996
3463
|
"Content-Type": "application/json"
|
|
3997
3464
|
}
|
|
3998
3465
|
});
|
|
3999
|
-
}
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
async deleteComment({ data }) {
|
|
4005
|
-
try {
|
|
4006
|
-
const env2 = getEnv();
|
|
3466
|
+
},
|
|
3467
|
+
[env]
|
|
3468
|
+
);
|
|
3469
|
+
const deleteComment = useCallback5(
|
|
3470
|
+
async ({ data }) => {
|
|
4007
3471
|
const jsonData = {
|
|
4008
3472
|
attachment_ids: [],
|
|
4009
3473
|
attachment_tokens: [],
|
|
4010
3474
|
body: "",
|
|
4011
3475
|
message_id: data.message_id
|
|
4012
3476
|
};
|
|
4013
|
-
return
|
|
3477
|
+
return env.requests.post("/chatter/message/update_content" /* DELETE_MESSAGE */, jsonData, {
|
|
4014
3478
|
headers: {
|
|
4015
3479
|
"Content-Type": "application/json"
|
|
4016
3480
|
}
|
|
4017
3481
|
});
|
|
4018
|
-
}
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
try {
|
|
4025
|
-
const env2 = getEnv();
|
|
4026
|
-
return env2.requests.get(
|
|
3482
|
+
},
|
|
3483
|
+
[env]
|
|
3484
|
+
);
|
|
3485
|
+
const getImage = useCallback5(
|
|
3486
|
+
async ({ data }) => {
|
|
3487
|
+
return env.requests.get(
|
|
4027
3488
|
`${"/web/image" /* IMAGE_PATH */}?filename=${data.filename}&unique=${data.checksum}&width=1920&height=300`,
|
|
4028
3489
|
{
|
|
4029
3490
|
headers: {
|
|
@@ -4031,152 +3492,158 @@ var FormService = {
|
|
|
4031
3492
|
}
|
|
4032
3493
|
}
|
|
4033
3494
|
);
|
|
4034
|
-
}
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
try {
|
|
4041
|
-
const env2 = getEnv();
|
|
4042
|
-
return env2.requests.post("/mail/attachment/upload" /* UPLOAD_IMAGE */, data, {
|
|
3495
|
+
},
|
|
3496
|
+
[env]
|
|
3497
|
+
);
|
|
3498
|
+
const uploadImage = useCallback5(
|
|
3499
|
+
async ({ data }) => {
|
|
3500
|
+
return env.requests.post("/mail/attachment/upload" /* UPLOAD_IMAGE */, data, {
|
|
4043
3501
|
headers: {
|
|
4044
3502
|
"Content-Type": "multipart/form-data"
|
|
4045
3503
|
}
|
|
4046
3504
|
});
|
|
4047
|
-
}
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
async getFormView({ data }) {
|
|
4053
|
-
try {
|
|
4054
|
-
const env2 = getEnv();
|
|
3505
|
+
},
|
|
3506
|
+
[env]
|
|
3507
|
+
);
|
|
3508
|
+
const getFormView = useCallback5(
|
|
3509
|
+
async ({ data }) => {
|
|
4055
3510
|
const jsonData = {
|
|
4056
3511
|
model: data.model,
|
|
4057
3512
|
method: "get_formview_action",
|
|
4058
3513
|
ids: data.id ? [data.id] : [],
|
|
4059
3514
|
with_context: data.context
|
|
4060
3515
|
};
|
|
4061
|
-
return
|
|
3516
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4062
3517
|
headers: {
|
|
4063
3518
|
"Content-Type": "application/json"
|
|
4064
3519
|
}
|
|
4065
3520
|
});
|
|
4066
|
-
}
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
3521
|
+
},
|
|
3522
|
+
[env]
|
|
3523
|
+
);
|
|
3524
|
+
const changeStatus = useCallback5(
|
|
3525
|
+
async ({ data }) => {
|
|
3526
|
+
const vals = {
|
|
3527
|
+
[data.name]: data.stage_id
|
|
3528
|
+
};
|
|
3529
|
+
const jsonData = {
|
|
3530
|
+
model: data.model,
|
|
3531
|
+
method: "web_save",
|
|
3532
|
+
with_context: {
|
|
3533
|
+
lang: data.lang,
|
|
3534
|
+
allowed_company_ids: [1],
|
|
3535
|
+
uid: 2,
|
|
3536
|
+
search_default_my_ticket: true,
|
|
3537
|
+
search_default_is_open: true
|
|
3538
|
+
},
|
|
3539
|
+
ids: [data.id],
|
|
3540
|
+
kwargs: {
|
|
3541
|
+
vals,
|
|
3542
|
+
specification: {}
|
|
3543
|
+
}
|
|
3544
|
+
};
|
|
3545
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3546
|
+
headers: {
|
|
3547
|
+
"Content-Type": "application/json"
|
|
3548
|
+
}
|
|
3549
|
+
});
|
|
3550
|
+
},
|
|
3551
|
+
[env]
|
|
3552
|
+
);
|
|
3553
|
+
return {
|
|
3554
|
+
getComment,
|
|
3555
|
+
sentComment,
|
|
3556
|
+
deleteComment,
|
|
3557
|
+
getImage,
|
|
3558
|
+
uploadImage,
|
|
3559
|
+
getFormView,
|
|
3560
|
+
changeStatus
|
|
3561
|
+
};
|
|
3562
|
+
}
|
|
4100
3563
|
|
|
4101
3564
|
// src/services/kanban-service/index.ts
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
"Content-Type": "application/json"
|
|
4121
|
-
}
|
|
4122
|
-
});
|
|
4123
|
-
},
|
|
4124
|
-
async getProgressBar({
|
|
4125
|
-
field,
|
|
4126
|
-
color,
|
|
4127
|
-
model,
|
|
4128
|
-
width_context
|
|
4129
|
-
}) {
|
|
4130
|
-
const env2 = getEnv();
|
|
4131
|
-
const jsonDataView = {
|
|
4132
|
-
model,
|
|
4133
|
-
method: "read_progress_bar",
|
|
4134
|
-
kwargs: {
|
|
4135
|
-
domain: [],
|
|
4136
|
-
group_by: "stage_id",
|
|
4137
|
-
progress_bar: {
|
|
4138
|
-
colors: color,
|
|
4139
|
-
field
|
|
3565
|
+
import { useCallback as useCallback6 } from "react";
|
|
3566
|
+
function useKanbanService() {
|
|
3567
|
+
const { env } = useEnv();
|
|
3568
|
+
const getGroups = useCallback6(
|
|
3569
|
+
async ({ model, width_context }) => {
|
|
3570
|
+
const jsonData = {
|
|
3571
|
+
model,
|
|
3572
|
+
method: "web_read_group",
|
|
3573
|
+
kwargs: {
|
|
3574
|
+
domain: [["stage_id.fold", "=", false]],
|
|
3575
|
+
fields: ["color:sum"],
|
|
3576
|
+
groupby: ["stage_id"]
|
|
3577
|
+
},
|
|
3578
|
+
width_context
|
|
3579
|
+
};
|
|
3580
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3581
|
+
headers: {
|
|
3582
|
+
"Content-Type": "application/json"
|
|
4140
3583
|
}
|
|
4141
|
-
}
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
3584
|
+
});
|
|
3585
|
+
},
|
|
3586
|
+
[env]
|
|
3587
|
+
);
|
|
3588
|
+
const getProgressBar = useCallback6(
|
|
3589
|
+
async ({ field, color, model, width_context }) => {
|
|
3590
|
+
const jsonData = {
|
|
3591
|
+
model,
|
|
3592
|
+
method: "read_progress_bar",
|
|
3593
|
+
kwargs: {
|
|
3594
|
+
domain: [],
|
|
3595
|
+
group_by: "stage_id",
|
|
3596
|
+
progress_bar: {
|
|
3597
|
+
colors: color,
|
|
3598
|
+
field
|
|
3599
|
+
}
|
|
3600
|
+
},
|
|
3601
|
+
width_context
|
|
3602
|
+
};
|
|
3603
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3604
|
+
headers: {
|
|
3605
|
+
"Content-Type": "application/json"
|
|
3606
|
+
}
|
|
3607
|
+
});
|
|
3608
|
+
},
|
|
3609
|
+
[env]
|
|
3610
|
+
);
|
|
3611
|
+
return {
|
|
3612
|
+
getGroups,
|
|
3613
|
+
getProgressBar
|
|
3614
|
+
};
|
|
3615
|
+
}
|
|
4152
3616
|
|
|
4153
3617
|
// src/services/model-service/index.ts
|
|
3618
|
+
import { useCallback as useCallback7 } from "react";
|
|
4154
3619
|
var OBJECT_POSITION = 2;
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
3620
|
+
function useModelService() {
|
|
3621
|
+
const { env } = useEnv();
|
|
3622
|
+
const getListMyBankAccount = useCallback7(
|
|
3623
|
+
async ({
|
|
3624
|
+
domain,
|
|
3625
|
+
spectification,
|
|
3626
|
+
model
|
|
3627
|
+
}) => {
|
|
3628
|
+
const jsonData = {
|
|
3629
|
+
model,
|
|
3630
|
+
method: "web_search_read",
|
|
3631
|
+
kwargs: {
|
|
3632
|
+
specification: spectification,
|
|
3633
|
+
domain,
|
|
3634
|
+
limit: 100,
|
|
3635
|
+
offset: 0
|
|
3636
|
+
}
|
|
3637
|
+
};
|
|
3638
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3639
|
+
headers: {
|
|
3640
|
+
"Content-Type": "application/json"
|
|
3641
|
+
}
|
|
3642
|
+
});
|
|
3643
|
+
},
|
|
3644
|
+
[env]
|
|
3645
|
+
);
|
|
3646
|
+
const getCurrency = useCallback7(async () => {
|
|
4180
3647
|
const jsonData = {
|
|
4181
3648
|
model: "res.currency",
|
|
4182
3649
|
method: "web_search_read",
|
|
@@ -4190,14 +3657,13 @@ var ModelService = {
|
|
|
4190
3657
|
offset: 0
|
|
4191
3658
|
}
|
|
4192
3659
|
};
|
|
4193
|
-
return
|
|
3660
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4194
3661
|
headers: {
|
|
4195
3662
|
"Content-Type": "application/json"
|
|
4196
3663
|
}
|
|
4197
3664
|
});
|
|
4198
|
-
},
|
|
4199
|
-
|
|
4200
|
-
const env2 = getEnv();
|
|
3665
|
+
}, [env]);
|
|
3666
|
+
const getConversionRate = useCallback7(async () => {
|
|
4201
3667
|
const jsonData = {
|
|
4202
3668
|
model: "res.currency",
|
|
4203
3669
|
method: "web_search_read",
|
|
@@ -4217,198 +3683,209 @@ var ModelService = {
|
|
|
4217
3683
|
offset: 0
|
|
4218
3684
|
}
|
|
4219
3685
|
};
|
|
4220
|
-
return
|
|
3686
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4221
3687
|
headers: {
|
|
4222
3688
|
"Content-Type": "application/json"
|
|
4223
3689
|
}
|
|
4224
3690
|
});
|
|
4225
|
-
},
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
fields: data.fields,
|
|
4230
|
-
groupby: data.groupby
|
|
4231
|
-
} : {
|
|
4232
|
-
count_limit: 10001,
|
|
4233
|
-
order: data.sort,
|
|
4234
|
-
specification: data.specification
|
|
4235
|
-
};
|
|
4236
|
-
const jsonData = {
|
|
4237
|
-
model: String(data.model),
|
|
4238
|
-
method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
|
|
4239
|
-
ids: data.ids,
|
|
4240
|
-
with_context: data.context,
|
|
4241
|
-
kwargs: {
|
|
4242
|
-
domain: data.domain,
|
|
4243
|
-
limit: data.limit,
|
|
4244
|
-
offset: data.offset,
|
|
4245
|
-
...jsonReadGroup
|
|
4246
|
-
}
|
|
4247
|
-
};
|
|
4248
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4249
|
-
headers: {
|
|
4250
|
-
"Content-Type": "application/json"
|
|
4251
|
-
}
|
|
4252
|
-
});
|
|
4253
|
-
},
|
|
4254
|
-
async getListCalendar({ data }) {
|
|
4255
|
-
const env2 = getEnv();
|
|
4256
|
-
const jsonReadGroup = data.type == "calendar" ? data?.fields : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
|
|
4257
|
-
fields: data.fields,
|
|
4258
|
-
groupby: data.groupby
|
|
4259
|
-
} : {
|
|
4260
|
-
count_limit: 10001,
|
|
4261
|
-
order: data.sort,
|
|
4262
|
-
specification: data.specification
|
|
4263
|
-
};
|
|
4264
|
-
const jsonData = {
|
|
4265
|
-
model: String(data.model),
|
|
4266
|
-
method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
|
|
4267
|
-
ids: data.ids,
|
|
4268
|
-
with_context: data.context,
|
|
4269
|
-
kwargs: {
|
|
4270
|
-
domain: data.domain,
|
|
4271
|
-
limit: data.limit,
|
|
4272
|
-
offset: data.offset,
|
|
3691
|
+
}, [env]);
|
|
3692
|
+
const getAll = useCallback7(
|
|
3693
|
+
async ({ data }) => {
|
|
3694
|
+
const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
|
|
4273
3695
|
fields: data.fields,
|
|
4274
|
-
|
|
4275
|
-
}
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
}
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
}
|
|
4328
|
-
}
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
});
|
|
4334
|
-
},
|
|
4335
|
-
async save({
|
|
4336
|
-
model,
|
|
4337
|
-
ids = [],
|
|
4338
|
-
data = {},
|
|
4339
|
-
specification = {},
|
|
4340
|
-
context = {},
|
|
4341
|
-
path
|
|
4342
|
-
}) {
|
|
4343
|
-
const env2 = getEnv();
|
|
4344
|
-
const jsonData = {
|
|
4345
|
-
model,
|
|
4346
|
-
method: "web_save" /* WEB_SAVE */,
|
|
4347
|
-
with_context: context,
|
|
4348
|
-
ids,
|
|
4349
|
-
kwargs: {
|
|
4350
|
-
vals: data,
|
|
4351
|
-
specification
|
|
4352
|
-
}
|
|
4353
|
-
};
|
|
4354
|
-
return env2?.requests?.post(path ?? "/call" /* CALL_PATH */, jsonData, {
|
|
4355
|
-
headers: {
|
|
4356
|
-
"Content-Type": "application/json"
|
|
4357
|
-
}
|
|
4358
|
-
});
|
|
4359
|
-
},
|
|
4360
|
-
async delete({ ids = [], model }) {
|
|
4361
|
-
const env2 = getEnv();
|
|
4362
|
-
const jsonData = {
|
|
3696
|
+
groupby: data.groupby
|
|
3697
|
+
} : {
|
|
3698
|
+
count_limit: 10001,
|
|
3699
|
+
order: data.sort,
|
|
3700
|
+
specification: data.specification
|
|
3701
|
+
};
|
|
3702
|
+
const jsonData = {
|
|
3703
|
+
model: String(data.model),
|
|
3704
|
+
method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
|
|
3705
|
+
ids: data.ids,
|
|
3706
|
+
with_context: data.context,
|
|
3707
|
+
kwargs: {
|
|
3708
|
+
domain: data.domain,
|
|
3709
|
+
limit: data.limit,
|
|
3710
|
+
offset: data.offset,
|
|
3711
|
+
...jsonReadGroup
|
|
3712
|
+
}
|
|
3713
|
+
};
|
|
3714
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3715
|
+
headers: {
|
|
3716
|
+
"Content-Type": "application/json"
|
|
3717
|
+
}
|
|
3718
|
+
});
|
|
3719
|
+
},
|
|
3720
|
+
[env]
|
|
3721
|
+
);
|
|
3722
|
+
const getListCalendar = useCallback7(
|
|
3723
|
+
async ({ data }) => {
|
|
3724
|
+
const jsonReadGroup = data.type == "calendar" ? data?.fields : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
|
|
3725
|
+
fields: data.fields,
|
|
3726
|
+
groupby: data.groupby
|
|
3727
|
+
} : {
|
|
3728
|
+
count_limit: 10001,
|
|
3729
|
+
order: data.sort,
|
|
3730
|
+
specification: data.specification
|
|
3731
|
+
};
|
|
3732
|
+
const jsonData = {
|
|
3733
|
+
model: String(data.model),
|
|
3734
|
+
method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
|
|
3735
|
+
ids: data.ids,
|
|
3736
|
+
with_context: data.context,
|
|
3737
|
+
kwargs: {
|
|
3738
|
+
domain: data.domain,
|
|
3739
|
+
limit: data.limit,
|
|
3740
|
+
offset: data.offset,
|
|
3741
|
+
fields: data.fields,
|
|
3742
|
+
...jsonReadGroup
|
|
3743
|
+
}
|
|
3744
|
+
};
|
|
3745
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3746
|
+
headers: {
|
|
3747
|
+
"Content-Type": "application/json"
|
|
3748
|
+
}
|
|
3749
|
+
});
|
|
3750
|
+
},
|
|
3751
|
+
[env]
|
|
3752
|
+
);
|
|
3753
|
+
const getList = useCallback7(
|
|
3754
|
+
async ({
|
|
4363
3755
|
model,
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
})
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
3756
|
+
ids = [],
|
|
3757
|
+
specification = {},
|
|
3758
|
+
domain = [],
|
|
3759
|
+
offset,
|
|
3760
|
+
order,
|
|
3761
|
+
context = {},
|
|
3762
|
+
limit = 10
|
|
3763
|
+
}) => {
|
|
3764
|
+
const jsonData = {
|
|
3765
|
+
model,
|
|
3766
|
+
method: "web_search_read" /* WEB_SEARCH_READ */,
|
|
3767
|
+
ids,
|
|
3768
|
+
with_context: context,
|
|
3769
|
+
kwargs: {
|
|
3770
|
+
specification,
|
|
3771
|
+
domain,
|
|
3772
|
+
limit,
|
|
3773
|
+
offset,
|
|
3774
|
+
order
|
|
3775
|
+
}
|
|
3776
|
+
};
|
|
3777
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3778
|
+
headers: {
|
|
3779
|
+
"Content-Type": "application/json"
|
|
3780
|
+
}
|
|
3781
|
+
});
|
|
3782
|
+
},
|
|
3783
|
+
[env]
|
|
3784
|
+
);
|
|
3785
|
+
const getDetail = useCallback7(
|
|
3786
|
+
async ({ ids = [], model, specification, context }) => {
|
|
3787
|
+
const jsonData = {
|
|
3788
|
+
model,
|
|
3789
|
+
method: "web_read" /* WEB_READ */,
|
|
3790
|
+
ids,
|
|
3791
|
+
with_context: context,
|
|
3792
|
+
kwargs: {
|
|
3793
|
+
specification
|
|
3794
|
+
}
|
|
3795
|
+
};
|
|
3796
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3797
|
+
headers: {
|
|
3798
|
+
"Content-Type": "application/json"
|
|
3799
|
+
}
|
|
3800
|
+
});
|
|
3801
|
+
},
|
|
3802
|
+
[env]
|
|
3803
|
+
);
|
|
3804
|
+
const save = useCallback7(
|
|
3805
|
+
async ({
|
|
4383
3806
|
model,
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
3807
|
+
ids = [],
|
|
3808
|
+
data = {},
|
|
3809
|
+
specification = {},
|
|
3810
|
+
context = {},
|
|
3811
|
+
path
|
|
3812
|
+
}) => {
|
|
3813
|
+
const jsonData = {
|
|
3814
|
+
model,
|
|
3815
|
+
method: "web_save" /* WEB_SAVE */,
|
|
3816
|
+
with_context: context,
|
|
3817
|
+
ids,
|
|
3818
|
+
kwargs: {
|
|
3819
|
+
vals: data,
|
|
3820
|
+
specification
|
|
3821
|
+
}
|
|
3822
|
+
};
|
|
3823
|
+
return env.requests.post(path ?? "/call" /* CALL_PATH */, jsonData, {
|
|
3824
|
+
headers: {
|
|
3825
|
+
"Content-Type": "application/json"
|
|
3826
|
+
}
|
|
3827
|
+
});
|
|
3828
|
+
},
|
|
3829
|
+
[env]
|
|
3830
|
+
);
|
|
3831
|
+
const deleteApi = useCallback7(
|
|
3832
|
+
async ({ ids = [], model }) => {
|
|
3833
|
+
const jsonData = {
|
|
3834
|
+
model,
|
|
3835
|
+
method: "unlink" /* UNLINK */,
|
|
3836
|
+
ids
|
|
3837
|
+
};
|
|
3838
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3839
|
+
headers: {
|
|
3840
|
+
"Content-Type": "application/json"
|
|
3841
|
+
}
|
|
3842
|
+
});
|
|
3843
|
+
},
|
|
3844
|
+
[env]
|
|
3845
|
+
);
|
|
3846
|
+
const onChange = useCallback7(
|
|
3847
|
+
async ({
|
|
3848
|
+
ids = [],
|
|
4402
3849
|
model,
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
3850
|
+
object,
|
|
3851
|
+
specification,
|
|
3852
|
+
context,
|
|
3853
|
+
fieldChange
|
|
3854
|
+
}) => {
|
|
3855
|
+
const jsonData = {
|
|
3856
|
+
model,
|
|
3857
|
+
method: "onchange" /* ONCHANGE */,
|
|
3858
|
+
ids,
|
|
3859
|
+
with_context: context,
|
|
3860
|
+
args: [
|
|
3861
|
+
object ? object : {},
|
|
3862
|
+
fieldChange ? fieldChange : [],
|
|
3863
|
+
specification
|
|
3864
|
+
]
|
|
3865
|
+
};
|
|
3866
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3867
|
+
headers: {
|
|
3868
|
+
"Content-Type": "application/json"
|
|
3869
|
+
}
|
|
3870
|
+
});
|
|
3871
|
+
},
|
|
3872
|
+
[env]
|
|
3873
|
+
);
|
|
3874
|
+
const getListFieldsOnchange = useCallback7(
|
|
3875
|
+
async ({ model }) => {
|
|
3876
|
+
const jsonData = {
|
|
3877
|
+
model,
|
|
3878
|
+
method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
|
|
3879
|
+
};
|
|
3880
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3881
|
+
headers: {
|
|
3882
|
+
"Content-Type": "application/json"
|
|
3883
|
+
}
|
|
3884
|
+
});
|
|
3885
|
+
},
|
|
3886
|
+
[env]
|
|
3887
|
+
);
|
|
3888
|
+
const parseORMOdoo = useCallback7((data) => {
|
|
4412
3889
|
for (const key in data) {
|
|
4413
3890
|
if (key === "display_name") {
|
|
4414
3891
|
delete data[key];
|
|
@@ -4420,365 +3897,368 @@ var ModelService = {
|
|
|
4420
3897
|
}
|
|
4421
3898
|
}
|
|
4422
3899
|
return { ...data };
|
|
4423
|
-
},
|
|
4424
|
-
toDataJS
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
if (
|
|
4428
|
-
if (viewData
|
|
3900
|
+
}, []);
|
|
3901
|
+
const toDataJS = useCallback7(
|
|
3902
|
+
(data, viewData, model) => {
|
|
3903
|
+
for (const key in data) {
|
|
3904
|
+
if (data[key] === false) {
|
|
3905
|
+
if (viewData && model) {
|
|
3906
|
+
if (viewData?.models?.[model]?.[key]?.type !== "boolean" /* BOOLEAN */) {
|
|
3907
|
+
data[key] = null;
|
|
3908
|
+
}
|
|
3909
|
+
} else {
|
|
4429
3910
|
data[key] = null;
|
|
4430
3911
|
}
|
|
4431
|
-
} else {
|
|
4432
|
-
data[key] =
|
|
4433
|
-
}
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
item[OBJECT_POSITION],
|
|
4446
|
-
viewData,
|
|
4447
|
-
relation
|
|
4448
|
-
);
|
|
4449
|
-
} else {
|
|
4450
|
-
return ModelService.toDataJS(item, viewData, relation);
|
|
4451
|
-
}
|
|
4452
|
-
} else {
|
|
4453
|
-
if (item?.length >= 3) {
|
|
4454
|
-
return item[OBJECT_POSITION];
|
|
3912
|
+
} else if (data[key] === "/") {
|
|
3913
|
+
data[key] = "Draft";
|
|
3914
|
+
} else if (data[key] !== false) {
|
|
3915
|
+
if (model !== void 0) {
|
|
3916
|
+
if (viewData?.models?.[model]?.[key]?.type === "one2many" /* ONE2MANY */ || viewData?.models?.[model]?.[key]?.type === "many2many" /* MANY2MANY */) {
|
|
3917
|
+
data[key] = (data[key] ??= [])?.map((item) => {
|
|
3918
|
+
const relation = viewData?.models?.[model]?.[key]?.relation;
|
|
3919
|
+
if (relation !== void 0) {
|
|
3920
|
+
if (viewData?.models?.[relation]) {
|
|
3921
|
+
if (item?.length >= 3) {
|
|
3922
|
+
return toDataJS(item[OBJECT_POSITION], viewData, relation);
|
|
3923
|
+
} else {
|
|
3924
|
+
return toDataJS(item, viewData, relation);
|
|
3925
|
+
}
|
|
4455
3926
|
} else {
|
|
4456
|
-
|
|
3927
|
+
if (item?.length >= 3) {
|
|
3928
|
+
return item[OBJECT_POSITION];
|
|
3929
|
+
} else {
|
|
3930
|
+
return item;
|
|
3931
|
+
}
|
|
4457
3932
|
}
|
|
4458
3933
|
}
|
|
3934
|
+
});
|
|
3935
|
+
}
|
|
3936
|
+
}
|
|
3937
|
+
}
|
|
3938
|
+
}
|
|
3939
|
+
return { ...data };
|
|
3940
|
+
},
|
|
3941
|
+
[]
|
|
3942
|
+
);
|
|
3943
|
+
return {
|
|
3944
|
+
getListMyBankAccount,
|
|
3945
|
+
getCurrency,
|
|
3946
|
+
getConversionRate,
|
|
3947
|
+
getAll,
|
|
3948
|
+
getListCalendar,
|
|
3949
|
+
getList,
|
|
3950
|
+
getDetail,
|
|
3951
|
+
save,
|
|
3952
|
+
deleteApi,
|
|
3953
|
+
onChange,
|
|
3954
|
+
getListFieldsOnchange,
|
|
3955
|
+
parseORMOdoo,
|
|
3956
|
+
toDataJS
|
|
3957
|
+
};
|
|
3958
|
+
}
|
|
3959
|
+
|
|
3960
|
+
// src/services/user-service/index.ts
|
|
3961
|
+
import { useCallback as useCallback8 } from "react";
|
|
3962
|
+
function useUserService() {
|
|
3963
|
+
const { env } = useEnv();
|
|
3964
|
+
const getProfile = useCallback8(
|
|
3965
|
+
async (path) => {
|
|
3966
|
+
return env?.requests?.get(path ?? "/userinfo" /* PROFILE_PATH */, {
|
|
3967
|
+
headers: {
|
|
3968
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
3969
|
+
}
|
|
3970
|
+
});
|
|
3971
|
+
},
|
|
3972
|
+
[env]
|
|
3973
|
+
);
|
|
3974
|
+
const getUser = useCallback8(
|
|
3975
|
+
async ({ context, id }) => {
|
|
3976
|
+
const jsonData = {
|
|
3977
|
+
model: "res.users",
|
|
3978
|
+
method: "web_read",
|
|
3979
|
+
ids: [id],
|
|
3980
|
+
with_context: context,
|
|
3981
|
+
kwargs: {
|
|
3982
|
+
specification: {
|
|
3983
|
+
display_name: {},
|
|
3984
|
+
image_1920: {},
|
|
3985
|
+
name: {},
|
|
3986
|
+
login: {},
|
|
3987
|
+
email: {},
|
|
3988
|
+
password: {},
|
|
3989
|
+
visible_group_id: {
|
|
3990
|
+
fields: {
|
|
3991
|
+
id: {},
|
|
3992
|
+
display_name: {}
|
|
3993
|
+
}
|
|
3994
|
+
},
|
|
3995
|
+
company_id: {
|
|
3996
|
+
fields: {
|
|
3997
|
+
id: {},
|
|
3998
|
+
display_name: {}
|
|
4459
3999
|
}
|
|
4460
|
-
});
|
|
4461
|
-
}
|
|
4462
|
-
}
|
|
4463
|
-
}
|
|
4464
|
-
}
|
|
4465
|
-
return { ...data };
|
|
4466
|
-
}
|
|
4467
|
-
};
|
|
4468
|
-
var model_service_default = ModelService;
|
|
4469
|
-
|
|
4470
|
-
// src/services/user-service/index.ts
|
|
4471
|
-
var UserService = {
|
|
4472
|
-
async getProfile(path) {
|
|
4473
|
-
const env2 = getEnv();
|
|
4474
|
-
return env2?.requests?.get(path ?? "/userinfo" /* PROFILE_PATH */, {
|
|
4475
|
-
headers: {
|
|
4476
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
4477
|
-
}
|
|
4478
|
-
});
|
|
4479
|
-
},
|
|
4480
|
-
async getUser({ context, id }) {
|
|
4481
|
-
const env2 = getEnv();
|
|
4482
|
-
const jsonData = {
|
|
4483
|
-
model: "res.users",
|
|
4484
|
-
method: "web_read",
|
|
4485
|
-
ids: [id],
|
|
4486
|
-
with_context: context,
|
|
4487
|
-
kwargs: {
|
|
4488
|
-
specification: {
|
|
4489
|
-
display_name: {},
|
|
4490
|
-
image_1920: {},
|
|
4491
|
-
name: {},
|
|
4492
|
-
login: {},
|
|
4493
|
-
email: {},
|
|
4494
|
-
password: {},
|
|
4495
|
-
visible_group_id: {
|
|
4496
|
-
fields: {
|
|
4497
|
-
id: {},
|
|
4498
|
-
display_name: {}
|
|
4499
|
-
}
|
|
4500
|
-
},
|
|
4501
|
-
company_id: {
|
|
4502
|
-
fields: {
|
|
4503
|
-
id: {},
|
|
4504
|
-
display_name: {}
|
|
4505
4000
|
}
|
|
4506
4001
|
}
|
|
4507
4002
|
}
|
|
4508
|
-
}
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
}
|
|
4514
|
-
}
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
}
|
|
4530
|
-
|
|
4003
|
+
};
|
|
4004
|
+
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4005
|
+
headers: {
|
|
4006
|
+
"Content-Type": "application/json"
|
|
4007
|
+
}
|
|
4008
|
+
});
|
|
4009
|
+
},
|
|
4010
|
+
[env]
|
|
4011
|
+
);
|
|
4012
|
+
const switchUserLocale = useCallback8(
|
|
4013
|
+
async ({ id, values }) => {
|
|
4014
|
+
const jsonData = {
|
|
4015
|
+
model: "res.users",
|
|
4016
|
+
domain: [["id", "=", id]],
|
|
4017
|
+
values
|
|
4018
|
+
};
|
|
4019
|
+
return env?.requests.post(UriConstants?.CREATE_UPDATE_PATH, jsonData, {
|
|
4020
|
+
headers: {
|
|
4021
|
+
"Content-Type": "application/json"
|
|
4022
|
+
}
|
|
4023
|
+
});
|
|
4024
|
+
},
|
|
4025
|
+
[env]
|
|
4026
|
+
);
|
|
4027
|
+
return {
|
|
4028
|
+
getProfile,
|
|
4029
|
+
getUser,
|
|
4030
|
+
switchUserLocale
|
|
4031
|
+
};
|
|
4032
|
+
}
|
|
4531
4033
|
|
|
4532
4034
|
// src/services/view-service/index.ts
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
options = {},
|
|
4539
|
-
aid
|
|
4540
|
-
}) {
|
|
4541
|
-
const env2 = getEnv();
|
|
4542
|
-
const defaultOptions = {
|
|
4543
|
-
load_filters: true,
|
|
4544
|
-
toolbar: true,
|
|
4545
|
-
action_id: aid
|
|
4546
|
-
};
|
|
4547
|
-
const jsonDataView = {
|
|
4035
|
+
import { useCallback as useCallback9 } from "react";
|
|
4036
|
+
function useViewService() {
|
|
4037
|
+
const { env } = useEnv();
|
|
4038
|
+
const getView = useCallback9(
|
|
4039
|
+
async ({
|
|
4548
4040
|
model,
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4041
|
+
views,
|
|
4042
|
+
context = {},
|
|
4043
|
+
options = {},
|
|
4044
|
+
aid
|
|
4045
|
+
}) => {
|
|
4046
|
+
const defaultOptions = {
|
|
4047
|
+
load_filters: true,
|
|
4048
|
+
toolbar: true,
|
|
4049
|
+
action_id: aid
|
|
4050
|
+
};
|
|
4051
|
+
const jsonDataView = {
|
|
4052
|
+
model,
|
|
4053
|
+
method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
|
|
4054
|
+
kwargs: {
|
|
4055
|
+
views,
|
|
4056
|
+
options: { ...options, ...defaultOptions }
|
|
4057
|
+
},
|
|
4058
|
+
with_context: context
|
|
4059
|
+
};
|
|
4060
|
+
return env?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
|
|
4061
|
+
headers: {
|
|
4062
|
+
"Content-Type": "application/json"
|
|
4063
|
+
}
|
|
4064
|
+
});
|
|
4065
|
+
},
|
|
4066
|
+
[env]
|
|
4067
|
+
);
|
|
4068
|
+
const getMenu = useCallback9(
|
|
4069
|
+
async (context) => {
|
|
4070
|
+
const jsonData = {
|
|
4071
|
+
model: "ir.ui.menu" /* MENU */,
|
|
4072
|
+
method: "web_search_read" /* WEB_SEARCH_READ */,
|
|
4073
|
+
ids: [],
|
|
4074
|
+
with_context: context,
|
|
4075
|
+
kwargs: {
|
|
4076
|
+
specification: {
|
|
4077
|
+
active: {},
|
|
4078
|
+
name: {},
|
|
4079
|
+
is_display: {},
|
|
4080
|
+
sequence: {},
|
|
4081
|
+
complete_name: {},
|
|
4082
|
+
action: {
|
|
4083
|
+
fields: {
|
|
4084
|
+
display_name: {},
|
|
4085
|
+
type: {},
|
|
4086
|
+
binding_view_types: {}
|
|
4087
|
+
}
|
|
4590
4088
|
},
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
active: {},
|
|
4598
|
-
name: {},
|
|
4599
|
-
is_display: {},
|
|
4600
|
-
sequence: {},
|
|
4601
|
-
complete_name: {},
|
|
4602
|
-
action: {
|
|
4603
|
-
fields: {
|
|
4604
|
-
display_name: {},
|
|
4605
|
-
type: {},
|
|
4606
|
-
binding_view_types: {}
|
|
4607
|
-
// res_model: {},
|
|
4608
|
-
}
|
|
4089
|
+
url_icon: {},
|
|
4090
|
+
web_icon: {},
|
|
4091
|
+
web_icon_data: {},
|
|
4092
|
+
groups_id: {
|
|
4093
|
+
fields: {
|
|
4094
|
+
full_name: {}
|
|
4609
4095
|
},
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4096
|
+
limit: 40,
|
|
4097
|
+
order: ""
|
|
4098
|
+
},
|
|
4099
|
+
display_name: {},
|
|
4100
|
+
child_id: {
|
|
4101
|
+
fields: {
|
|
4102
|
+
active: {},
|
|
4103
|
+
name: {},
|
|
4104
|
+
is_display: {},
|
|
4105
|
+
sequence: {},
|
|
4106
|
+
complete_name: {},
|
|
4107
|
+
action: {
|
|
4108
|
+
fields: {
|
|
4109
|
+
display_name: {},
|
|
4110
|
+
type: {},
|
|
4111
|
+
binding_view_types: {}
|
|
4112
|
+
}
|
|
4616
4113
|
},
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
active: {},
|
|
4624
|
-
name: {},
|
|
4625
|
-
is_display: {},
|
|
4626
|
-
sequence: {},
|
|
4627
|
-
complete_name: {},
|
|
4628
|
-
action: {
|
|
4629
|
-
fields: {
|
|
4630
|
-
display_name: {},
|
|
4631
|
-
type: {},
|
|
4632
|
-
binding_view_types: {}
|
|
4633
|
-
// res_model: {},
|
|
4634
|
-
}
|
|
4114
|
+
url_icon: {},
|
|
4115
|
+
web_icon: {},
|
|
4116
|
+
web_icon_data: {},
|
|
4117
|
+
groups_id: {
|
|
4118
|
+
fields: {
|
|
4119
|
+
full_name: {}
|
|
4635
4120
|
},
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4121
|
+
limit: 40,
|
|
4122
|
+
order: ""
|
|
4123
|
+
},
|
|
4124
|
+
display_name: {},
|
|
4125
|
+
child_id: {
|
|
4126
|
+
fields: {
|
|
4127
|
+
active: {},
|
|
4128
|
+
name: {},
|
|
4129
|
+
is_display: {},
|
|
4130
|
+
sequence: {},
|
|
4131
|
+
complete_name: {},
|
|
4132
|
+
action: {
|
|
4133
|
+
fields: {
|
|
4134
|
+
display_name: {},
|
|
4135
|
+
type: {},
|
|
4136
|
+
binding_view_types: {}
|
|
4137
|
+
}
|
|
4642
4138
|
},
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
active: {},
|
|
4650
|
-
name: {},
|
|
4651
|
-
is_display: {},
|
|
4652
|
-
sequence: {},
|
|
4653
|
-
complete_name: {},
|
|
4654
|
-
action: {
|
|
4655
|
-
fields: {
|
|
4656
|
-
display_name: {},
|
|
4657
|
-
type: {},
|
|
4658
|
-
binding_view_types: {}
|
|
4659
|
-
// res_model: {},
|
|
4660
|
-
}
|
|
4661
|
-
},
|
|
4662
|
-
url_icon: {},
|
|
4663
|
-
web_icon: {},
|
|
4664
|
-
web_icon_data: {},
|
|
4665
|
-
groups_id: {
|
|
4666
|
-
fields: {
|
|
4667
|
-
full_name: {}
|
|
4668
|
-
},
|
|
4669
|
-
limit: 40,
|
|
4670
|
-
order: ""
|
|
4139
|
+
url_icon: {},
|
|
4140
|
+
web_icon: {},
|
|
4141
|
+
web_icon_data: {},
|
|
4142
|
+
groups_id: {
|
|
4143
|
+
fields: {
|
|
4144
|
+
full_name: {}
|
|
4671
4145
|
},
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
fields: {},
|
|
4675
|
-
limit: 40,
|
|
4676
|
-
order: ""
|
|
4677
|
-
}
|
|
4146
|
+
limit: 40,
|
|
4147
|
+
order: ""
|
|
4678
4148
|
},
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
headers: {
|
|
4702
|
-
"Content-Type": "application/json"
|
|
4703
|
-
}
|
|
4704
|
-
});
|
|
4705
|
-
},
|
|
4706
|
-
async getActionDetail(aid, context) {
|
|
4707
|
-
const env2 = getEnv();
|
|
4708
|
-
const jsonData = {
|
|
4709
|
-
model: "ir.actions.act_window" /* WINDOW_ACTION */,
|
|
4710
|
-
method: "web_read" /* WEB_READ */,
|
|
4711
|
-
ids: [aid],
|
|
4712
|
-
with_context: context,
|
|
4713
|
-
kwargs: {
|
|
4714
|
-
specification: {
|
|
4715
|
-
id: {},
|
|
4716
|
-
name: {},
|
|
4717
|
-
res_model: {},
|
|
4718
|
-
views: {},
|
|
4719
|
-
view_mode: {},
|
|
4720
|
-
mobile_view_mode: {},
|
|
4721
|
-
domain: {},
|
|
4722
|
-
context: {},
|
|
4723
|
-
groups_id: {},
|
|
4724
|
-
search_view_id: {}
|
|
4149
|
+
display_name: {},
|
|
4150
|
+
child_id: {
|
|
4151
|
+
fields: {},
|
|
4152
|
+
limit: 40,
|
|
4153
|
+
order: ""
|
|
4154
|
+
}
|
|
4155
|
+
},
|
|
4156
|
+
limit: 40,
|
|
4157
|
+
order: ""
|
|
4158
|
+
}
|
|
4159
|
+
},
|
|
4160
|
+
limit: 40,
|
|
4161
|
+
order: ""
|
|
4162
|
+
}
|
|
4163
|
+
},
|
|
4164
|
+
domain: [
|
|
4165
|
+
"&",
|
|
4166
|
+
["is_display", "=", true],
|
|
4167
|
+
"&",
|
|
4168
|
+
["active", "=", true],
|
|
4169
|
+
["parent_id", "=", false]
|
|
4170
|
+
]
|
|
4725
4171
|
}
|
|
4726
|
-
}
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
}
|
|
4732
|
-
}
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4172
|
+
};
|
|
4173
|
+
return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
4174
|
+
headers: {
|
|
4175
|
+
"Content-Type": "application/json"
|
|
4176
|
+
}
|
|
4177
|
+
});
|
|
4178
|
+
},
|
|
4179
|
+
[env]
|
|
4180
|
+
);
|
|
4181
|
+
const getActionDetail = useCallback9(
|
|
4182
|
+
async (aid, context) => {
|
|
4183
|
+
const jsonData = {
|
|
4184
|
+
model: "ir.actions.act_window" /* WINDOW_ACTION */,
|
|
4185
|
+
method: "web_read" /* WEB_READ */,
|
|
4186
|
+
ids: [aid],
|
|
4187
|
+
with_context: context,
|
|
4188
|
+
kwargs: {
|
|
4189
|
+
specification: {
|
|
4190
|
+
id: {},
|
|
4191
|
+
name: {},
|
|
4192
|
+
res_model: {},
|
|
4193
|
+
views: {},
|
|
4194
|
+
view_mode: {},
|
|
4195
|
+
mobile_view_mode: {},
|
|
4196
|
+
domain: {},
|
|
4197
|
+
context: {},
|
|
4198
|
+
groups_id: {},
|
|
4199
|
+
search_view_id: {}
|
|
4200
|
+
}
|
|
4201
|
+
}
|
|
4202
|
+
};
|
|
4203
|
+
return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
4204
|
+
headers: {
|
|
4205
|
+
"Content-Type": "application/json"
|
|
4206
|
+
}
|
|
4207
|
+
});
|
|
4208
|
+
},
|
|
4209
|
+
[env]
|
|
4210
|
+
);
|
|
4211
|
+
const getResequence = useCallback9(
|
|
4212
|
+
async ({
|
|
4742
4213
|
model,
|
|
4743
|
-
with_context: context,
|
|
4744
4214
|
ids,
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
}
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
ids: [],
|
|
4759
|
-
method: "get_data_select",
|
|
4760
|
-
with_context: data.context,
|
|
4761
|
-
kwargs: {
|
|
4762
|
-
count_limit: 10001,
|
|
4763
|
-
domain: data.domain ? data.domain : [],
|
|
4764
|
-
offset: 0,
|
|
4765
|
-
order: "",
|
|
4766
|
-
specification: data?.specification ?? {
|
|
4767
|
-
id: {},
|
|
4768
|
-
name: {},
|
|
4769
|
-
display_name: {}
|
|
4215
|
+
context,
|
|
4216
|
+
offset
|
|
4217
|
+
}) => {
|
|
4218
|
+
const jsonData = {
|
|
4219
|
+
model,
|
|
4220
|
+
with_context: context,
|
|
4221
|
+
ids,
|
|
4222
|
+
field: "sequence",
|
|
4223
|
+
...offset > 0 ? { offset } : {}
|
|
4224
|
+
};
|
|
4225
|
+
return env?.requests.post("/web/dataset/resequence", jsonData, {
|
|
4226
|
+
headers: {
|
|
4227
|
+
"Content-Type": "application/json"
|
|
4770
4228
|
}
|
|
4771
|
-
}
|
|
4772
|
-
}
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4229
|
+
});
|
|
4230
|
+
},
|
|
4231
|
+
[env]
|
|
4232
|
+
);
|
|
4233
|
+
const getSelectionItem = useCallback9(
|
|
4234
|
+
async ({ data }) => {
|
|
4235
|
+
const jsonData = {
|
|
4236
|
+
model: data.model,
|
|
4237
|
+
ids: [],
|
|
4238
|
+
method: "get_data_select",
|
|
4239
|
+
with_context: data.context,
|
|
4240
|
+
kwargs: {
|
|
4241
|
+
count_limit: 10001,
|
|
4242
|
+
domain: data.domain ? data.domain : [],
|
|
4243
|
+
offset: 0,
|
|
4244
|
+
order: "",
|
|
4245
|
+
specification: data?.specification ?? {
|
|
4246
|
+
id: {},
|
|
4247
|
+
name: {},
|
|
4248
|
+
display_name: {}
|
|
4249
|
+
}
|
|
4250
|
+
}
|
|
4251
|
+
};
|
|
4252
|
+
return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4253
|
+
headers: {
|
|
4254
|
+
"Content-Type": "application/json"
|
|
4255
|
+
}
|
|
4256
|
+
});
|
|
4257
|
+
},
|
|
4258
|
+
[env]
|
|
4259
|
+
);
|
|
4260
|
+
const loadMessages = useCallback9(async () => {
|
|
4261
|
+
return env.requests.post(
|
|
4782
4262
|
"/load_message_failures" /* LOAD_MESSAGE */,
|
|
4783
4263
|
{},
|
|
4784
4264
|
{
|
|
@@ -4787,467 +4267,450 @@ var ViewService = {
|
|
|
4787
4267
|
}
|
|
4788
4268
|
}
|
|
4789
4269
|
);
|
|
4790
|
-
},
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
console.log("env?.requests", env2, env2?.requests);
|
|
4794
|
-
return env2?.requests?.get("", {
|
|
4795
|
-
headers: {
|
|
4796
|
-
"Content-Type": "application/json"
|
|
4797
|
-
}
|
|
4798
|
-
});
|
|
4799
|
-
},
|
|
4800
|
-
async get2FAMethods({
|
|
4801
|
-
method,
|
|
4802
|
-
with_context
|
|
4803
|
-
}) {
|
|
4804
|
-
const env2 = getEnv();
|
|
4805
|
-
const jsonData = {
|
|
4806
|
-
method,
|
|
4807
|
-
with_context
|
|
4808
|
-
};
|
|
4809
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4270
|
+
}, [env]);
|
|
4271
|
+
const getVersion = useCallback9(async () => {
|
|
4272
|
+
return env?.requests?.get("", {
|
|
4810
4273
|
headers: {
|
|
4811
4274
|
"Content-Type": "application/json"
|
|
4812
4275
|
}
|
|
4813
4276
|
});
|
|
4814
|
-
},
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
with_context,
|
|
4818
|
-
code,
|
|
4819
|
-
device,
|
|
4820
|
-
location
|
|
4821
|
-
}) {
|
|
4822
|
-
const env2 = getEnv();
|
|
4823
|
-
const jsonData = {
|
|
4824
|
-
method,
|
|
4825
|
-
kwargs: {
|
|
4826
|
-
vals: {
|
|
4827
|
-
code,
|
|
4828
|
-
device,
|
|
4829
|
-
location
|
|
4830
|
-
}
|
|
4831
|
-
},
|
|
4832
|
-
with_context
|
|
4833
|
-
};
|
|
4834
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4835
|
-
headers: {
|
|
4836
|
-
"Content-Type": "application/json"
|
|
4837
|
-
},
|
|
4838
|
-
withCredentials: true
|
|
4839
|
-
});
|
|
4840
|
-
},
|
|
4841
|
-
async signInSSO({
|
|
4842
|
-
redirect_uri,
|
|
4843
|
-
state,
|
|
4844
|
-
client_id,
|
|
4845
|
-
response_type,
|
|
4846
|
-
path
|
|
4847
|
-
}) {
|
|
4848
|
-
const env2 = getEnv();
|
|
4849
|
-
const params = new URLSearchParams({
|
|
4850
|
-
response_type,
|
|
4851
|
-
client_id,
|
|
4852
|
-
redirect_uri,
|
|
4853
|
-
state
|
|
4854
|
-
});
|
|
4855
|
-
const url = `${path}?${params.toString()}`;
|
|
4856
|
-
return env2?.requests.get(url, {
|
|
4857
|
-
headers: {
|
|
4858
|
-
"Content-Type": "application/json"
|
|
4859
|
-
},
|
|
4860
|
-
withCredentials: true
|
|
4861
|
-
});
|
|
4862
|
-
},
|
|
4863
|
-
async grantAccess({
|
|
4864
|
-
redirect_uri,
|
|
4865
|
-
state,
|
|
4866
|
-
client_id,
|
|
4867
|
-
scopes
|
|
4868
|
-
}) {
|
|
4869
|
-
const env2 = getEnv();
|
|
4870
|
-
const jsonData = {
|
|
4277
|
+
}, [env]);
|
|
4278
|
+
const grantAccess = useCallback9(
|
|
4279
|
+
async ({
|
|
4871
4280
|
redirect_uri,
|
|
4872
4281
|
state,
|
|
4873
4282
|
client_id,
|
|
4874
4283
|
scopes
|
|
4875
|
-
};
|
|
4876
|
-
return env2?.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
|
|
4877
|
-
headers: {
|
|
4878
|
-
"Content-Type": "application/json"
|
|
4879
|
-
},
|
|
4880
|
-
withCredentials: true
|
|
4881
|
-
});
|
|
4882
|
-
},
|
|
4883
|
-
async getFieldsViewSecurity({
|
|
4884
|
-
method,
|
|
4885
|
-
token,
|
|
4886
|
-
views
|
|
4887
|
-
}) {
|
|
4888
|
-
const env2 = getEnv();
|
|
4889
|
-
const jsonData = {
|
|
4890
|
-
method,
|
|
4891
|
-
kwargs: {
|
|
4892
|
-
views
|
|
4893
|
-
},
|
|
4894
|
-
with_context: {
|
|
4895
|
-
token
|
|
4896
|
-
}
|
|
4897
|
-
};
|
|
4898
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4899
|
-
headers: {
|
|
4900
|
-
"Content-Type": "application/json"
|
|
4901
|
-
}
|
|
4902
|
-
});
|
|
4903
|
-
},
|
|
4904
|
-
async settingsWebRead2fa({
|
|
4905
|
-
method,
|
|
4906
|
-
model,
|
|
4907
|
-
kwargs,
|
|
4908
|
-
token
|
|
4909
|
-
}) {
|
|
4910
|
-
const env2 = getEnv();
|
|
4911
|
-
const jsonData = {
|
|
4912
|
-
method,
|
|
4913
|
-
model,
|
|
4914
|
-
kwargs,
|
|
4915
|
-
with_context: {
|
|
4916
|
-
token
|
|
4917
|
-
}
|
|
4918
|
-
};
|
|
4919
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4920
|
-
headers: {
|
|
4921
|
-
"Content-Type": "application/json"
|
|
4922
|
-
}
|
|
4923
|
-
});
|
|
4924
|
-
},
|
|
4925
|
-
async requestSetupTotp({ method, token }) {
|
|
4926
|
-
const env2 = getEnv();
|
|
4927
|
-
const jsonData = {
|
|
4928
|
-
method,
|
|
4929
|
-
with_context: {
|
|
4930
|
-
token
|
|
4931
|
-
}
|
|
4932
|
-
};
|
|
4933
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4934
|
-
headers: {
|
|
4935
|
-
"Content-Type": "application/json"
|
|
4936
|
-
}
|
|
4937
|
-
});
|
|
4938
|
-
},
|
|
4939
|
-
async verifyTotp({
|
|
4940
|
-
method,
|
|
4941
|
-
action_token,
|
|
4942
|
-
code
|
|
4943
|
-
}) {
|
|
4944
|
-
const env2 = getEnv();
|
|
4945
|
-
const jsonData = {
|
|
4946
|
-
method,
|
|
4947
|
-
kwargs: {
|
|
4948
|
-
vals: {
|
|
4949
|
-
code
|
|
4950
|
-
}
|
|
4951
|
-
},
|
|
4952
|
-
with_context: {
|
|
4953
|
-
action_token
|
|
4954
|
-
}
|
|
4955
|
-
};
|
|
4956
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4957
|
-
headers: {
|
|
4958
|
-
"Content-Type": "application/json"
|
|
4959
|
-
}
|
|
4960
|
-
});
|
|
4961
|
-
},
|
|
4962
|
-
async removeTotpSetUp({ method, token }) {
|
|
4963
|
-
const env2 = getEnv();
|
|
4964
|
-
const jsonData = {
|
|
4965
|
-
method,
|
|
4966
|
-
with_context: {
|
|
4967
|
-
token
|
|
4968
|
-
}
|
|
4969
|
-
};
|
|
4970
|
-
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4971
|
-
headers: {
|
|
4972
|
-
"Content-Type": "application/json"
|
|
4973
|
-
}
|
|
4974
|
-
});
|
|
4975
|
-
}
|
|
4976
|
-
};
|
|
4977
|
-
var view_service_default = ViewService;
|
|
4978
|
-
|
|
4979
|
-
// src/hooks/auth/use-forgot-password.ts
|
|
4980
|
-
var useForgotPassword = () => {
|
|
4981
|
-
return useMutation({
|
|
4982
|
-
mutationFn: (email) => {
|
|
4983
|
-
return auth_service_default.forgotPassword(email);
|
|
4984
|
-
}
|
|
4985
|
-
});
|
|
4986
|
-
};
|
|
4987
|
-
var use_forgot_password_default = useForgotPassword;
|
|
4988
|
-
|
|
4989
|
-
// src/hooks/auth/use-forgotpassword-sso.ts
|
|
4990
|
-
import { useMutation as useMutation2 } from "@tanstack/react-query";
|
|
4991
|
-
var useForgotPasswordSSO = () => {
|
|
4992
|
-
return useMutation2({
|
|
4993
|
-
mutationFn: ({
|
|
4994
|
-
email,
|
|
4995
|
-
with_context,
|
|
4996
|
-
method
|
|
4997
4284
|
}) => {
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
5006
|
-
var useGetProvider = () => {
|
|
5007
|
-
return useMutation3({
|
|
5008
|
-
mutationFn: (data) => {
|
|
5009
|
-
return auth_service_default.getProviders(data?.db);
|
|
5010
|
-
}
|
|
5011
|
-
});
|
|
5012
|
-
};
|
|
5013
|
-
var use_get_provider_default = useGetProvider;
|
|
5014
|
-
|
|
5015
|
-
// src/hooks/auth/use-isvalid-token.ts
|
|
5016
|
-
import { useMutation as useMutation4 } from "@tanstack/react-query";
|
|
5017
|
-
var useIsValidToken = () => {
|
|
5018
|
-
return useMutation4({
|
|
5019
|
-
mutationFn: (token) => {
|
|
5020
|
-
return auth_service_default.isValidToken(token);
|
|
5021
|
-
}
|
|
5022
|
-
});
|
|
5023
|
-
};
|
|
5024
|
-
var use_isvalid_token_default = useIsValidToken;
|
|
5025
|
-
|
|
5026
|
-
// src/hooks/auth/use-login-credential.tsx
|
|
5027
|
-
import { useMutation as useMutation5 } from "@tanstack/react-query";
|
|
5028
|
-
|
|
5029
|
-
// src/services/auth-service/backup.ts
|
|
5030
|
-
import { useCallback as useCallback2 } from "react";
|
|
5031
|
-
function useAuthService() {
|
|
5032
|
-
const { env: env2 } = useEnv();
|
|
5033
|
-
const login = useCallback2(
|
|
5034
|
-
async (body) => {
|
|
5035
|
-
const payload = Object.fromEntries(
|
|
5036
|
-
Object.entries({
|
|
5037
|
-
username: body.email,
|
|
5038
|
-
password: body.password,
|
|
5039
|
-
grant_type: env2?.config?.grantType || "",
|
|
5040
|
-
client_id: env2?.config?.clientId || "",
|
|
5041
|
-
client_secret: env2?.config?.clientSecret || ""
|
|
5042
|
-
}).filter(([_, value]) => !!value)
|
|
5043
|
-
);
|
|
5044
|
-
const encodedData = new URLSearchParams(payload).toString();
|
|
5045
|
-
return env2?.requests?.post(body.path, encodedData, {
|
|
4285
|
+
const jsonData = {
|
|
4286
|
+
redirect_uri,
|
|
4287
|
+
state,
|
|
4288
|
+
client_id,
|
|
4289
|
+
scopes
|
|
4290
|
+
};
|
|
4291
|
+
return env?.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
|
|
5046
4292
|
headers: {
|
|
5047
|
-
"Content-Type": "application/
|
|
4293
|
+
"Content-Type": "application/json"
|
|
4294
|
+
},
|
|
4295
|
+
withCredentials: true
|
|
4296
|
+
});
|
|
4297
|
+
},
|
|
4298
|
+
[env]
|
|
4299
|
+
);
|
|
4300
|
+
const removeTotpSetUp = useCallback9(
|
|
4301
|
+
async ({ method, token }) => {
|
|
4302
|
+
const jsonData = {
|
|
4303
|
+
method,
|
|
4304
|
+
with_context: {
|
|
4305
|
+
token
|
|
4306
|
+
}
|
|
4307
|
+
};
|
|
4308
|
+
return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4309
|
+
headers: {
|
|
4310
|
+
"Content-Type": "application/json"
|
|
5048
4311
|
}
|
|
5049
4312
|
});
|
|
5050
4313
|
},
|
|
5051
|
-
[
|
|
4314
|
+
[env]
|
|
5052
4315
|
);
|
|
5053
|
-
const
|
|
5054
|
-
async (
|
|
5055
|
-
const
|
|
5056
|
-
|
|
5057
|
-
|
|
4316
|
+
const requestSetupTotp = useCallback9(
|
|
4317
|
+
async ({ method, token }) => {
|
|
4318
|
+
const jsonData = {
|
|
4319
|
+
method,
|
|
4320
|
+
with_context: { token }
|
|
5058
4321
|
};
|
|
5059
|
-
return
|
|
4322
|
+
return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
5060
4323
|
headers: {
|
|
5061
4324
|
"Content-Type": "application/json"
|
|
5062
4325
|
}
|
|
5063
4326
|
});
|
|
5064
4327
|
},
|
|
5065
|
-
[
|
|
4328
|
+
[env]
|
|
5066
4329
|
);
|
|
5067
|
-
const
|
|
4330
|
+
const settingsWebRead2fa = useCallback9(
|
|
5068
4331
|
async ({
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
4332
|
+
method,
|
|
4333
|
+
model,
|
|
4334
|
+
kwargs,
|
|
4335
|
+
token
|
|
5072
4336
|
}) => {
|
|
5073
|
-
const
|
|
4337
|
+
const jsonData = {
|
|
5074
4338
|
method,
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
}
|
|
5080
|
-
with_context
|
|
4339
|
+
model,
|
|
4340
|
+
kwargs,
|
|
4341
|
+
with_context: {
|
|
4342
|
+
token
|
|
4343
|
+
}
|
|
5081
4344
|
};
|
|
5082
|
-
return
|
|
4345
|
+
return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
5083
4346
|
headers: {
|
|
5084
4347
|
"Content-Type": "application/json"
|
|
5085
4348
|
}
|
|
5086
4349
|
});
|
|
5087
4350
|
},
|
|
5088
|
-
[
|
|
4351
|
+
[env]
|
|
5089
4352
|
);
|
|
5090
|
-
const
|
|
5091
|
-
async (
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
4353
|
+
const signInSSO = useCallback9(
|
|
4354
|
+
async ({
|
|
4355
|
+
redirect_uri,
|
|
4356
|
+
state,
|
|
4357
|
+
client_id,
|
|
4358
|
+
response_type
|
|
4359
|
+
}) => {
|
|
4360
|
+
const jsonData = {
|
|
4361
|
+
redirect_uri,
|
|
4362
|
+
state,
|
|
4363
|
+
client_id,
|
|
4364
|
+
response_type
|
|
5096
4365
|
};
|
|
5097
|
-
return
|
|
4366
|
+
return env?.requests.get("/signin-sso/oauth" /* SIGNIN_SSO */, jsonData, {
|
|
5098
4367
|
headers: {
|
|
5099
|
-
|
|
4368
|
+
credentials: "include"
|
|
5100
4369
|
}
|
|
5101
4370
|
});
|
|
5102
4371
|
},
|
|
5103
|
-
[
|
|
4372
|
+
[env]
|
|
5104
4373
|
);
|
|
5105
|
-
const
|
|
5106
|
-
|
|
4374
|
+
const verify2FA = useCallback9(
|
|
4375
|
+
({
|
|
5107
4376
|
method,
|
|
5108
|
-
|
|
5109
|
-
|
|
4377
|
+
with_context,
|
|
4378
|
+
code,
|
|
4379
|
+
device,
|
|
4380
|
+
location
|
|
5110
4381
|
}) => {
|
|
5111
|
-
const
|
|
4382
|
+
const jsonData = {
|
|
5112
4383
|
method,
|
|
5113
4384
|
kwargs: {
|
|
5114
4385
|
vals: {
|
|
5115
|
-
|
|
4386
|
+
code,
|
|
4387
|
+
device,
|
|
4388
|
+
location
|
|
5116
4389
|
}
|
|
5117
4390
|
},
|
|
5118
4391
|
with_context
|
|
5119
4392
|
};
|
|
5120
|
-
return
|
|
4393
|
+
return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
5121
4394
|
headers: {
|
|
5122
4395
|
"Content-Type": "application/json"
|
|
5123
|
-
}
|
|
4396
|
+
},
|
|
4397
|
+
withCredentials: true
|
|
5124
4398
|
});
|
|
5125
4399
|
},
|
|
5126
|
-
[
|
|
4400
|
+
[env]
|
|
5127
4401
|
);
|
|
5128
|
-
const
|
|
5129
|
-
|
|
5130
|
-
const
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
new_password: data.newPassword
|
|
4402
|
+
const get2FAMethods = useCallback9(
|
|
4403
|
+
({ method, with_context }) => {
|
|
4404
|
+
const jsonData = {
|
|
4405
|
+
method,
|
|
4406
|
+
with_context
|
|
5134
4407
|
};
|
|
5135
|
-
return
|
|
4408
|
+
return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
5136
4409
|
headers: {
|
|
5137
4410
|
"Content-Type": "application/json"
|
|
5138
4411
|
}
|
|
5139
4412
|
});
|
|
5140
4413
|
},
|
|
5141
|
-
[
|
|
4414
|
+
[env]
|
|
5142
4415
|
);
|
|
5143
|
-
const
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
4416
|
+
const verifyTotp = useCallback9(
|
|
4417
|
+
({
|
|
4418
|
+
method,
|
|
4419
|
+
action_token,
|
|
4420
|
+
code
|
|
4421
|
+
}) => {
|
|
4422
|
+
const jsonData = {
|
|
4423
|
+
method,
|
|
4424
|
+
kwargs: {
|
|
4425
|
+
vals: {
|
|
4426
|
+
code
|
|
4427
|
+
}
|
|
4428
|
+
},
|
|
4429
|
+
with_context: {
|
|
4430
|
+
action_token
|
|
4431
|
+
}
|
|
5147
4432
|
};
|
|
5148
|
-
return
|
|
4433
|
+
return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
5149
4434
|
headers: {
|
|
5150
4435
|
"Content-Type": "application/json"
|
|
5151
4436
|
}
|
|
5152
4437
|
});
|
|
5153
4438
|
},
|
|
5154
|
-
[
|
|
4439
|
+
[env]
|
|
5155
4440
|
);
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
4441
|
+
return {
|
|
4442
|
+
getView,
|
|
4443
|
+
getMenu,
|
|
4444
|
+
getActionDetail,
|
|
4445
|
+
getResequence,
|
|
4446
|
+
getSelectionItem,
|
|
4447
|
+
loadMessages,
|
|
4448
|
+
getVersion,
|
|
4449
|
+
grantAccess,
|
|
4450
|
+
removeTotpSetUp,
|
|
4451
|
+
requestSetupTotp,
|
|
4452
|
+
settingsWebRead2fa,
|
|
4453
|
+
signInSSO,
|
|
4454
|
+
verify2FA,
|
|
4455
|
+
get2FAMethods,
|
|
4456
|
+
verifyTotp
|
|
4457
|
+
};
|
|
4458
|
+
}
|
|
4459
|
+
|
|
4460
|
+
// src/provider/version-gate-provider.tsx
|
|
4461
|
+
import { Fragment, jsx as jsx4 } from "react/jsx-runtime";
|
|
4462
|
+
var VersionGate = ({ children }) => {
|
|
4463
|
+
const queryClient = useQueryClient();
|
|
4464
|
+
const [ready, setReady] = useState2(false);
|
|
4465
|
+
const { getVersion } = useViewService();
|
|
4466
|
+
useEffect2(() => {
|
|
4467
|
+
const clearVersion = () => {
|
|
4468
|
+
queryClient.clear();
|
|
4469
|
+
localStorage.removeItem("__api_version__");
|
|
4470
|
+
};
|
|
4471
|
+
const validateVersion = async () => {
|
|
4472
|
+
const serverVersion = await getVersion();
|
|
4473
|
+
const cached = localStorage.getItem("__api_version__");
|
|
4474
|
+
if (cached !== serverVersion?.api_version) {
|
|
4475
|
+
clearVersion();
|
|
4476
|
+
localStorage.setItem("__api_version__", serverVersion?.api_version);
|
|
4477
|
+
} else {
|
|
4478
|
+
console.log("Api version:", serverVersion?.api_version);
|
|
4479
|
+
}
|
|
4480
|
+
setReady(true);
|
|
4481
|
+
};
|
|
4482
|
+
validateVersion();
|
|
4483
|
+
if (typeof window !== "undefined") {
|
|
4484
|
+
const onKey = (e) => {
|
|
4485
|
+
const key = e.key.toLowerCase();
|
|
4486
|
+
const isHardRefresh = (key === "f5" || key === "r") && e.ctrlKey && (key !== "r" || e.shiftKey) || key === "r" && e.metaKey && e.shiftKey || key === "r" && e.metaKey && e.altKey;
|
|
4487
|
+
if (isHardRefresh) clearVersion();
|
|
4488
|
+
};
|
|
4489
|
+
window.addEventListener("keydown", onKey);
|
|
4490
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
4491
|
+
}
|
|
4492
|
+
}, [queryClient]);
|
|
4493
|
+
return ready ? /* @__PURE__ */ jsx4(Fragment, { children }) : null;
|
|
4494
|
+
};
|
|
4495
|
+
|
|
4496
|
+
// src/provider/env-provider.tsx
|
|
4497
|
+
import { createContext, useContext, useState as useState3, useCallback as useCallback10 } from "react";
|
|
4498
|
+
|
|
4499
|
+
// src/configs/axios-client.ts
|
|
4500
|
+
import axios from "axios";
|
|
4501
|
+
|
|
4502
|
+
// src/utils/storage/local-storage.ts
|
|
4503
|
+
var localStorageUtils = () => {
|
|
4504
|
+
const setToken = async (access_token) => {
|
|
4505
|
+
localStorage.setItem("accessToken", access_token);
|
|
4506
|
+
};
|
|
4507
|
+
const setRefreshToken = async (refresh_token) => {
|
|
4508
|
+
localStorage.setItem("refreshToken", refresh_token);
|
|
4509
|
+
};
|
|
4510
|
+
const getAccessToken = async () => {
|
|
4511
|
+
return localStorage.getItem("accessToken");
|
|
4512
|
+
};
|
|
4513
|
+
const getRefreshToken = async () => {
|
|
4514
|
+
return localStorage.getItem("refreshToken");
|
|
4515
|
+
};
|
|
4516
|
+
const clearToken = async () => {
|
|
4517
|
+
localStorage.removeItem("accessToken");
|
|
4518
|
+
localStorage.removeItem("refreshToken");
|
|
4519
|
+
};
|
|
4520
|
+
return {
|
|
4521
|
+
setToken,
|
|
4522
|
+
setRefreshToken,
|
|
4523
|
+
getAccessToken,
|
|
4524
|
+
getRefreshToken,
|
|
4525
|
+
clearToken
|
|
4526
|
+
};
|
|
4527
|
+
};
|
|
4528
|
+
|
|
4529
|
+
// src/utils/storage/session-storage.ts
|
|
4530
|
+
var sessionStorageUtils = () => {
|
|
4531
|
+
const getBrowserSession = async () => {
|
|
4532
|
+
return sessionStorage.getItem("browserSession");
|
|
4533
|
+
};
|
|
4534
|
+
return {
|
|
4535
|
+
getBrowserSession
|
|
4536
|
+
};
|
|
4537
|
+
};
|
|
4538
|
+
|
|
4539
|
+
// src/configs/axios-client.ts
|
|
4540
|
+
var axiosClient = {
|
|
4541
|
+
init(config) {
|
|
4542
|
+
const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
|
|
4543
|
+
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
|
|
4544
|
+
const db = config?.db;
|
|
4545
|
+
let isRefreshing = false;
|
|
4546
|
+
let failedQueue = [];
|
|
4547
|
+
const processQueue = (error, token = null) => {
|
|
4548
|
+
failedQueue?.forEach((prom) => {
|
|
4549
|
+
if (error) {
|
|
4550
|
+
prom.reject(error);
|
|
4551
|
+
} else {
|
|
4552
|
+
prom.resolve(token);
|
|
5167
4553
|
}
|
|
5168
|
-
);
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
4554
|
+
});
|
|
4555
|
+
failedQueue = [];
|
|
4556
|
+
};
|
|
4557
|
+
const instance = axios.create({
|
|
4558
|
+
adapter: axios.defaults.adapter,
|
|
4559
|
+
baseURL: config.baseUrl,
|
|
4560
|
+
timeout: 5e4,
|
|
4561
|
+
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
4562
|
+
});
|
|
4563
|
+
instance.interceptors.request.use(async (config2) => {
|
|
4564
|
+
const { useRefreshToken, useActionToken, actionToken } = config2;
|
|
4565
|
+
if (useActionToken && actionToken) {
|
|
4566
|
+
config2.headers["Action-Token"] = actionToken;
|
|
4567
|
+
}
|
|
4568
|
+
const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
|
|
4569
|
+
const token = await getToken?.();
|
|
4570
|
+
if (token) config2.headers["Authorization"] = `Bearer ${token}`;
|
|
4571
|
+
return config2;
|
|
4572
|
+
}, Promise.reject);
|
|
4573
|
+
instance.interceptors.response.use(
|
|
4574
|
+
(response) => {
|
|
4575
|
+
return handleResponse(response);
|
|
4576
|
+
},
|
|
4577
|
+
async (error) => {
|
|
4578
|
+
const handleError3 = async (error2) => {
|
|
4579
|
+
if (!error2.response) {
|
|
4580
|
+
return error2;
|
|
5184
4581
|
}
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
4582
|
+
const { data } = error2.response;
|
|
4583
|
+
if (data && data.code === 400 && ["invalid_grant"].includes(data.data?.error)) {
|
|
4584
|
+
await clearAuthToken();
|
|
4585
|
+
}
|
|
4586
|
+
return data;
|
|
4587
|
+
};
|
|
4588
|
+
const originalRequest = error.config;
|
|
4589
|
+
if ((error.response?.status === 403 || error.response?.status === 401 || error.response?.status === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401, "ERR_2FA_006"].includes(
|
|
4590
|
+
error.response.data.code
|
|
4591
|
+
)) {
|
|
4592
|
+
if (isRefreshing) {
|
|
4593
|
+
return new Promise(function(resolve, reject) {
|
|
4594
|
+
failedQueue.push({ resolve, reject });
|
|
4595
|
+
}).then((token) => {
|
|
4596
|
+
originalRequest.headers["Authorization"] = "Bearer " + token;
|
|
4597
|
+
originalRequest.data = updateTokenParamInOriginalRequest(
|
|
4598
|
+
originalRequest,
|
|
4599
|
+
token
|
|
4600
|
+
);
|
|
4601
|
+
return instance.request(originalRequest);
|
|
4602
|
+
}).catch(async (err) => {
|
|
4603
|
+
if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
|
|
4604
|
+
await clearAuthToken();
|
|
4605
|
+
}
|
|
4606
|
+
});
|
|
4607
|
+
}
|
|
4608
|
+
const browserSession = await sessionStorage2.getBrowserSession();
|
|
4609
|
+
const refreshToken = await localStorage2.getRefreshToken();
|
|
4610
|
+
const accessTokenExp = await localStorage2.getAccessToken();
|
|
4611
|
+
isRefreshing = true;
|
|
4612
|
+
if (!refreshToken && (!browserSession || browserSession == "unActive")) {
|
|
4613
|
+
await clearAuthToken();
|
|
4614
|
+
} else {
|
|
4615
|
+
const payload = Object.fromEntries(
|
|
4616
|
+
Object.entries({
|
|
4617
|
+
refresh_token: refreshToken,
|
|
4618
|
+
grant_type: "refresh_token",
|
|
4619
|
+
client_id: config.config.clientId,
|
|
4620
|
+
client_secret: config.config.clientSecret
|
|
4621
|
+
}).filter(([_, value]) => !!value)
|
|
4622
|
+
);
|
|
4623
|
+
return new Promise(function(resolve) {
|
|
4624
|
+
axios.post(
|
|
4625
|
+
`${config.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
|
|
4626
|
+
payload,
|
|
4627
|
+
{
|
|
4628
|
+
headers: {
|
|
4629
|
+
"Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
|
|
4630
|
+
Authorization: `Bearer ${accessTokenExp}`
|
|
4631
|
+
}
|
|
4632
|
+
}
|
|
4633
|
+
).then(async (res) => {
|
|
4634
|
+
const data = res.data;
|
|
4635
|
+
await localStorage2.setToken(data.access_token);
|
|
4636
|
+
await localStorage2.setRefreshToken(data.refresh_token);
|
|
4637
|
+
axios.defaults.headers.common["Authorization"] = "Bearer " + data.access_token;
|
|
4638
|
+
originalRequest.headers["Authorization"] = "Bearer " + data.access_token;
|
|
4639
|
+
originalRequest.data = updateTokenParamInOriginalRequest(
|
|
4640
|
+
originalRequest,
|
|
4641
|
+
data.access_token
|
|
4642
|
+
);
|
|
4643
|
+
processQueue(null, data.access_token);
|
|
4644
|
+
resolve(instance.request(originalRequest));
|
|
4645
|
+
}).catch(async (err) => {
|
|
4646
|
+
if (err && (err?.error_code === "AUTHEN_FAIL" || err?.error_code === "TOKEN_EXPIRED" || err?.error_code === "TOKEN_INCORRECT" || err?.code === "ERR_BAD_REQUEST") || err?.error_code === "ERR_2FA_006") {
|
|
4647
|
+
await clearAuthToken();
|
|
4648
|
+
}
|
|
4649
|
+
if (err && err.response) {
|
|
4650
|
+
const { error_code } = err.response?.data || {};
|
|
4651
|
+
if (error_code === "AUTHEN_FAIL") {
|
|
4652
|
+
await clearAuthToken();
|
|
4653
|
+
}
|
|
4654
|
+
}
|
|
4655
|
+
processQueue(err, null);
|
|
4656
|
+
}).finally(() => {
|
|
4657
|
+
isRefreshing = false;
|
|
4658
|
+
});
|
|
4659
|
+
});
|
|
5209
4660
|
}
|
|
5210
4661
|
}
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
return
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
4662
|
+
return Promise.reject(await handleError3(error));
|
|
4663
|
+
}
|
|
4664
|
+
);
|
|
4665
|
+
const handleResponse = (res) => {
|
|
4666
|
+
if (res && res.data) {
|
|
4667
|
+
return res.data;
|
|
4668
|
+
}
|
|
4669
|
+
return res;
|
|
4670
|
+
};
|
|
4671
|
+
const handleError2 = (error) => {
|
|
4672
|
+
if (error.isAxiosError && error.code === "ECONNABORTED") {
|
|
4673
|
+
console.error("Request Timeout Error:", error);
|
|
4674
|
+
return "Request Timeout Error";
|
|
4675
|
+
} else if (error.isAxiosError && !error.response) {
|
|
4676
|
+
console.error("Network Error:", error);
|
|
4677
|
+
return "Network Error";
|
|
4678
|
+
} else {
|
|
4679
|
+
console.error("Other Error:", error?.response);
|
|
4680
|
+
const errorMessage = error?.response?.data?.message || "An error occurred";
|
|
4681
|
+
return { message: errorMessage, status: error?.response?.status };
|
|
4682
|
+
}
|
|
4683
|
+
};
|
|
4684
|
+
const clearAuthToken = async () => {
|
|
4685
|
+
await localStorage2.clearToken();
|
|
4686
|
+
if (typeof window !== "undefined") {
|
|
4687
|
+
window.location.href = `/login`;
|
|
4688
|
+
}
|
|
4689
|
+
};
|
|
4690
|
+
function formatUrl(url, db2) {
|
|
4691
|
+
return url + (db2 ? "?db=" + db2 : "");
|
|
4692
|
+
}
|
|
4693
|
+
const responseBody = (response) => response;
|
|
4694
|
+
const requests = {
|
|
4695
|
+
get: (url, headers) => instance.get(formatUrl(url, db), headers).then(responseBody),
|
|
4696
|
+
post: (url, body, headers) => instance.post(formatUrl(url, db), body, headers).then(responseBody),
|
|
4697
|
+
post_excel: (url, body, headers) => instance.post(formatUrl(url, db), body, {
|
|
4698
|
+
responseType: "arraybuffer",
|
|
4699
|
+
headers: {
|
|
4700
|
+
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
4701
|
+
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
5227
4702
|
}
|
|
5228
|
-
)
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
resetPassword,
|
|
5237
|
-
resetPasswordSSO,
|
|
5238
|
-
updatePassword,
|
|
5239
|
-
isValidToken,
|
|
5240
|
-
isValidActionToken,
|
|
5241
|
-
loginSocial,
|
|
5242
|
-
getProviders,
|
|
5243
|
-
getAccessByCode,
|
|
5244
|
-
logout
|
|
5245
|
-
};
|
|
5246
|
-
}
|
|
4703
|
+
}).then(responseBody),
|
|
4704
|
+
put: (url, body, headers) => instance.put(formatUrl(url, db), body, headers).then(responseBody),
|
|
4705
|
+
patch: (url, body) => instance.patch(formatUrl(url, db), body).then(responseBody),
|
|
4706
|
+
delete: (url, body) => instance.delete(formatUrl(url, db), body).then(responseBody)
|
|
4707
|
+
};
|
|
4708
|
+
return requests;
|
|
4709
|
+
}
|
|
4710
|
+
};
|
|
5247
4711
|
|
|
5248
4712
|
// src/provider/env-provider.tsx
|
|
5249
|
-
import {
|
|
5250
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
4713
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
5251
4714
|
var initialEnvState = {
|
|
5252
4715
|
env: null,
|
|
5253
4716
|
baseUrl: "",
|
|
@@ -5275,15 +4738,15 @@ function EnvProvider({
|
|
|
5275
4738
|
localStorageUtils: localStorageUtil = localStorageUtils(),
|
|
5276
4739
|
sessionStorageUtils: sessionStorageUtil = sessionStorageUtils()
|
|
5277
4740
|
}) {
|
|
5278
|
-
const [
|
|
4741
|
+
const [env, setEnvState] = useState3({
|
|
5279
4742
|
...initialEnvState,
|
|
5280
4743
|
localStorageUtils: localStorageUtil,
|
|
5281
4744
|
sessionStorageUtils: sessionStorageUtil
|
|
5282
4745
|
});
|
|
5283
|
-
const setupEnv =
|
|
4746
|
+
const setupEnv = useCallback10(
|
|
5284
4747
|
(envConfig) => {
|
|
5285
4748
|
const updatedEnv = {
|
|
5286
|
-
...
|
|
4749
|
+
...env,
|
|
5287
4750
|
...envConfig,
|
|
5288
4751
|
localStorageUtils: localStorageUtil,
|
|
5289
4752
|
sessionStorageUtils: sessionStorageUtil
|
|
@@ -5292,33 +4755,33 @@ function EnvProvider({
|
|
|
5292
4755
|
setEnvState({ ...updatedEnv, requests });
|
|
5293
4756
|
return updatedEnv;
|
|
5294
4757
|
},
|
|
5295
|
-
[
|
|
4758
|
+
[env, localStorageUtil, sessionStorageUtil]
|
|
5296
4759
|
);
|
|
5297
|
-
const setUid2 =
|
|
4760
|
+
const setUid2 = useCallback10((uid) => {
|
|
5298
4761
|
setEnvState((prev) => ({
|
|
5299
4762
|
...prev,
|
|
5300
4763
|
context: { ...prev.context, uid }
|
|
5301
4764
|
}));
|
|
5302
4765
|
}, []);
|
|
5303
|
-
const setLang2 =
|
|
4766
|
+
const setLang2 = useCallback10((lang) => {
|
|
5304
4767
|
setEnvState((prev) => ({
|
|
5305
4768
|
...prev,
|
|
5306
4769
|
context: { ...prev.context, lang }
|
|
5307
4770
|
}));
|
|
5308
4771
|
}, []);
|
|
5309
|
-
const setAllowCompanies2 =
|
|
4772
|
+
const setAllowCompanies2 = useCallback10((allowed_company_ids) => {
|
|
5310
4773
|
setEnvState((prev) => ({
|
|
5311
4774
|
...prev,
|
|
5312
4775
|
context: { ...prev.context, allowed_company_ids }
|
|
5313
4776
|
}));
|
|
5314
4777
|
}, []);
|
|
5315
|
-
const setCompanies2 =
|
|
4778
|
+
const setCompanies2 = useCallback10((companies) => {
|
|
5316
4779
|
setEnvState((prev) => ({
|
|
5317
4780
|
...prev,
|
|
5318
4781
|
companies
|
|
5319
4782
|
}));
|
|
5320
4783
|
}, []);
|
|
5321
|
-
const setDefaultCompany2 =
|
|
4784
|
+
const setDefaultCompany2 = useCallback10(
|
|
5322
4785
|
(defaultCompany) => {
|
|
5323
4786
|
setEnvState((prev) => ({
|
|
5324
4787
|
...prev,
|
|
@@ -5327,29 +4790,29 @@ function EnvProvider({
|
|
|
5327
4790
|
},
|
|
5328
4791
|
[]
|
|
5329
4792
|
);
|
|
5330
|
-
const setUserInfo =
|
|
4793
|
+
const setUserInfo = useCallback10((user) => {
|
|
5331
4794
|
setEnvState((prev) => ({
|
|
5332
4795
|
...prev,
|
|
5333
4796
|
user
|
|
5334
4797
|
}));
|
|
5335
4798
|
}, []);
|
|
5336
|
-
const setConfig2 =
|
|
4799
|
+
const setConfig2 = useCallback10((config) => {
|
|
5337
4800
|
setEnvState((prev) => ({
|
|
5338
4801
|
...prev,
|
|
5339
4802
|
config
|
|
5340
4803
|
}));
|
|
5341
4804
|
}, []);
|
|
5342
|
-
const setEnvFile2 =
|
|
4805
|
+
const setEnvFile2 = useCallback10((envFile) => {
|
|
5343
4806
|
setEnvState((prev) => ({
|
|
5344
4807
|
...prev,
|
|
5345
4808
|
envFile
|
|
5346
4809
|
}));
|
|
5347
4810
|
}, []);
|
|
5348
|
-
return /* @__PURE__ */
|
|
4811
|
+
return /* @__PURE__ */ jsx5(
|
|
5349
4812
|
EnvContext.Provider,
|
|
5350
4813
|
{
|
|
5351
4814
|
value: {
|
|
5352
|
-
env
|
|
4815
|
+
env,
|
|
5353
4816
|
setupEnv,
|
|
5354
4817
|
setUid: setUid2,
|
|
5355
4818
|
setLang: setLang2,
|
|
@@ -5372,10 +4835,64 @@ function useEnv() {
|
|
|
5372
4835
|
return context;
|
|
5373
4836
|
}
|
|
5374
4837
|
|
|
4838
|
+
// src/provider/service-provider.tsx
|
|
4839
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
4840
|
+
|
|
4841
|
+
// src/hooks/auth/use-forgot-password.ts
|
|
4842
|
+
import { useMutation } from "@tanstack/react-query";
|
|
4843
|
+
var useForgotPassword = () => {
|
|
4844
|
+
const { forgotPassword } = useAuthService();
|
|
4845
|
+
return useMutation({
|
|
4846
|
+
mutationFn: (email) => {
|
|
4847
|
+
return forgotPassword(email);
|
|
4848
|
+
}
|
|
4849
|
+
});
|
|
4850
|
+
};
|
|
4851
|
+
var use_forgot_password_default = useForgotPassword;
|
|
4852
|
+
|
|
4853
|
+
// src/hooks/auth/use-forgotpassword-sso.ts
|
|
4854
|
+
import { useMutation as useMutation2 } from "@tanstack/react-query";
|
|
4855
|
+
var useForgotPasswordSSO = () => {
|
|
4856
|
+
const { forgotPasswordSSO } = useAuthService();
|
|
4857
|
+
return useMutation2({
|
|
4858
|
+
mutationFn: ({
|
|
4859
|
+
email,
|
|
4860
|
+
with_context,
|
|
4861
|
+
method
|
|
4862
|
+
}) => {
|
|
4863
|
+
return forgotPasswordSSO({ email, with_context, method });
|
|
4864
|
+
}
|
|
4865
|
+
});
|
|
4866
|
+
};
|
|
4867
|
+
var use_forgotpassword_sso_default = useForgotPasswordSSO;
|
|
4868
|
+
|
|
4869
|
+
// src/hooks/auth/use-get-provider.ts
|
|
4870
|
+
import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
4871
|
+
var useGetProvider = () => {
|
|
4872
|
+
const { getProviders } = useAuthService();
|
|
4873
|
+
return useMutation3({
|
|
4874
|
+
mutationFn: (data) => {
|
|
4875
|
+
return getProviders(data?.db);
|
|
4876
|
+
}
|
|
4877
|
+
});
|
|
4878
|
+
};
|
|
4879
|
+
var use_get_provider_default = useGetProvider;
|
|
4880
|
+
|
|
4881
|
+
// src/hooks/auth/use-isvalid-token.ts
|
|
4882
|
+
import { useMutation as useMutation4 } from "@tanstack/react-query";
|
|
4883
|
+
var useIsValidToken = () => {
|
|
4884
|
+
const { isValidToken } = useAuthService();
|
|
4885
|
+
return useMutation4({
|
|
4886
|
+
mutationFn: (token) => {
|
|
4887
|
+
return isValidToken(token);
|
|
4888
|
+
}
|
|
4889
|
+
});
|
|
4890
|
+
};
|
|
4891
|
+
var use_isvalid_token_default = useIsValidToken;
|
|
4892
|
+
|
|
5375
4893
|
// src/hooks/auth/use-login-credential.tsx
|
|
4894
|
+
import { useMutation as useMutation5 } from "@tanstack/react-query";
|
|
5376
4895
|
var useLoginCredential = () => {
|
|
5377
|
-
const { env: env2 } = useEnv();
|
|
5378
|
-
console.log("useLoginCredential called", env2, new Error().stack);
|
|
5379
4896
|
const { login } = useAuthService();
|
|
5380
4897
|
return useMutation5({
|
|
5381
4898
|
mutationFn: (data) => {
|
|
@@ -5388,9 +4905,10 @@ var use_login_credential_default = useLoginCredential;
|
|
|
5388
4905
|
// src/hooks/auth/use-login-socical.ts
|
|
5389
4906
|
import { useMutation as useMutation6 } from "@tanstack/react-query";
|
|
5390
4907
|
var useLoginSocial = () => {
|
|
4908
|
+
const { loginSocial } = useAuthService();
|
|
5391
4909
|
return useMutation6({
|
|
5392
4910
|
mutationFn: (data) => {
|
|
5393
|
-
return
|
|
4911
|
+
return loginSocial(data);
|
|
5394
4912
|
}
|
|
5395
4913
|
});
|
|
5396
4914
|
};
|
|
@@ -5399,9 +4917,10 @@ var use_login_socical_default = useLoginSocial;
|
|
|
5399
4917
|
// src/hooks/auth/use-reset-password.ts
|
|
5400
4918
|
import { useMutation as useMutation7 } from "@tanstack/react-query";
|
|
5401
4919
|
var useResetPassword = () => {
|
|
4920
|
+
const { resetPassword } = useAuthService();
|
|
5402
4921
|
return useMutation7({
|
|
5403
4922
|
mutationFn: (request) => {
|
|
5404
|
-
return
|
|
4923
|
+
return resetPassword(request.data, request.token);
|
|
5405
4924
|
}
|
|
5406
4925
|
});
|
|
5407
4926
|
};
|
|
@@ -5410,13 +4929,14 @@ var use_reset_password_default = useResetPassword;
|
|
|
5410
4929
|
// src/hooks/auth/use-reset-password-sso.ts
|
|
5411
4930
|
import { useMutation as useMutation8 } from "@tanstack/react-query";
|
|
5412
4931
|
var useResetPasswordSSO = () => {
|
|
4932
|
+
const { resetPasswordSSO } = useAuthService();
|
|
5413
4933
|
return useMutation8({
|
|
5414
4934
|
mutationFn: ({
|
|
5415
4935
|
method,
|
|
5416
4936
|
password,
|
|
5417
4937
|
with_context
|
|
5418
4938
|
}) => {
|
|
5419
|
-
return
|
|
4939
|
+
return resetPasswordSSO({
|
|
5420
4940
|
method,
|
|
5421
4941
|
password,
|
|
5422
4942
|
with_context
|
|
@@ -5429,9 +4949,10 @@ var use_reset_password_sso_default = useResetPasswordSSO;
|
|
|
5429
4949
|
// src/hooks/auth/use-update-password.ts
|
|
5430
4950
|
import { useMutation as useMutation9 } from "@tanstack/react-query";
|
|
5431
4951
|
var useUpdatePassword = () => {
|
|
4952
|
+
const { updatePassword } = useAuthService();
|
|
5432
4953
|
return useMutation9({
|
|
5433
4954
|
mutationFn: (request) => {
|
|
5434
|
-
return
|
|
4955
|
+
return updatePassword(request.data, request.token);
|
|
5435
4956
|
}
|
|
5436
4957
|
});
|
|
5437
4958
|
};
|
|
@@ -5440,9 +4961,10 @@ var use_update_password_default = useUpdatePassword;
|
|
|
5440
4961
|
// src/hooks/auth/use-logout.ts
|
|
5441
4962
|
import { useMutation as useMutation10 } from "@tanstack/react-query";
|
|
5442
4963
|
var useLogout = () => {
|
|
4964
|
+
const { logout } = useAuthService();
|
|
5443
4965
|
return useMutation10({
|
|
5444
4966
|
mutationFn: (data) => {
|
|
5445
|
-
return
|
|
4967
|
+
return logout(data);
|
|
5446
4968
|
}
|
|
5447
4969
|
});
|
|
5448
4970
|
};
|
|
@@ -5451,9 +4973,10 @@ var use_logout_default = useLogout;
|
|
|
5451
4973
|
// src/hooks/auth/use-get-access-by-code.ts
|
|
5452
4974
|
import { useMutation as useMutation11 } from "@tanstack/react-query";
|
|
5453
4975
|
var useGetAccessByCode = () => {
|
|
4976
|
+
const { getAccessByCode } = useAuthService();
|
|
5454
4977
|
return useMutation11({
|
|
5455
4978
|
mutationFn: ({ code }) => {
|
|
5456
|
-
return
|
|
4979
|
+
return getAccessByCode(code);
|
|
5457
4980
|
}
|
|
5458
4981
|
});
|
|
5459
4982
|
};
|
|
@@ -5462,12 +4985,13 @@ var use_get_access_by_code_default = useGetAccessByCode;
|
|
|
5462
4985
|
// src/hooks/auth/use-validate-action-token.ts
|
|
5463
4986
|
import { useMutation as useMutation12 } from "@tanstack/react-query";
|
|
5464
4987
|
var useValidateActionToken = () => {
|
|
4988
|
+
const { isValidActionToken } = useAuthService();
|
|
5465
4989
|
return useMutation12({
|
|
5466
4990
|
mutationFn: ({
|
|
5467
4991
|
actionToken,
|
|
5468
4992
|
path
|
|
5469
4993
|
}) => {
|
|
5470
|
-
return
|
|
4994
|
+
return isValidActionToken(actionToken, path);
|
|
5471
4995
|
}
|
|
5472
4996
|
});
|
|
5473
4997
|
};
|
|
@@ -5476,8 +5000,9 @@ var use_validate_action_token_default = useValidateActionToken;
|
|
|
5476
5000
|
// src/hooks/company/use-get-company-info.ts
|
|
5477
5001
|
import { useMutation as useMutation13 } from "@tanstack/react-query";
|
|
5478
5002
|
var useGetCompanyInfo = () => {
|
|
5003
|
+
const { getInfoCompany } = useCompanyService();
|
|
5479
5004
|
return useMutation13({
|
|
5480
|
-
mutationFn: (id) =>
|
|
5005
|
+
mutationFn: (id) => getInfoCompany(id)
|
|
5481
5006
|
});
|
|
5482
5007
|
};
|
|
5483
5008
|
var use_get_company_info_default = useGetCompanyInfo;
|
|
@@ -5485,8 +5010,9 @@ var use_get_company_info_default = useGetCompanyInfo;
|
|
|
5485
5010
|
// src/hooks/company/use-get-current-company.ts
|
|
5486
5011
|
import { useMutation as useMutation14 } from "@tanstack/react-query";
|
|
5487
5012
|
var useGetCurrentCompany = () => {
|
|
5013
|
+
const { getCurrentCompany } = useCompanyService();
|
|
5488
5014
|
return useMutation14({
|
|
5489
|
-
mutationFn: () =>
|
|
5015
|
+
mutationFn: () => getCurrentCompany()
|
|
5490
5016
|
});
|
|
5491
5017
|
};
|
|
5492
5018
|
var use_get_current_company_default = useGetCurrentCompany;
|
|
@@ -5494,6 +5020,7 @@ var use_get_current_company_default = useGetCurrentCompany;
|
|
|
5494
5020
|
// src/hooks/company/use-get-list-company.ts
|
|
5495
5021
|
import { useQuery } from "@tanstack/react-query";
|
|
5496
5022
|
var useGetListCompany = (companyIDs = []) => {
|
|
5023
|
+
const { getList } = useModelService();
|
|
5497
5024
|
const companySpec = {
|
|
5498
5025
|
id: {},
|
|
5499
5026
|
name: {}
|
|
@@ -5505,7 +5032,7 @@ var useGetListCompany = (companyIDs = []) => {
|
|
|
5505
5032
|
};
|
|
5506
5033
|
return useQuery({
|
|
5507
5034
|
queryKey: ["list_company" /* LIST_COMPANY */, companyIDs],
|
|
5508
|
-
queryFn: () =>
|
|
5035
|
+
queryFn: () => getList(getListParams),
|
|
5509
5036
|
refetchOnWindowFocus: false
|
|
5510
5037
|
});
|
|
5511
5038
|
};
|
|
@@ -5514,6 +5041,7 @@ var use_get_list_company_default = useGetListCompany;
|
|
|
5514
5041
|
// src/hooks/excel/use-export-excel.ts
|
|
5515
5042
|
import { useMutation as useMutation15 } from "@tanstack/react-query";
|
|
5516
5043
|
var useExportExcel = () => {
|
|
5044
|
+
const { exportExcel } = useExcelService();
|
|
5517
5045
|
return useMutation15({
|
|
5518
5046
|
mutationFn: ({
|
|
5519
5047
|
model,
|
|
@@ -5524,7 +5052,7 @@ var useExportExcel = () => {
|
|
|
5524
5052
|
importCompat,
|
|
5525
5053
|
context,
|
|
5526
5054
|
groupby
|
|
5527
|
-
}) =>
|
|
5055
|
+
}) => exportExcel({
|
|
5528
5056
|
model,
|
|
5529
5057
|
domain,
|
|
5530
5058
|
ids,
|
|
@@ -5541,6 +5069,7 @@ var use_export_excel_default = useExportExcel;
|
|
|
5541
5069
|
// src/hooks/excel/use-get-field-export.ts
|
|
5542
5070
|
import { useMutation as useMutation16 } from "@tanstack/react-query";
|
|
5543
5071
|
var useGetFieldExport = () => {
|
|
5072
|
+
const { getFieldExport } = useExcelService();
|
|
5544
5073
|
return useMutation16({
|
|
5545
5074
|
mutationFn: ({
|
|
5546
5075
|
ids,
|
|
@@ -5553,7 +5082,7 @@ var useGetFieldExport = () => {
|
|
|
5553
5082
|
name,
|
|
5554
5083
|
context,
|
|
5555
5084
|
importCompat
|
|
5556
|
-
}) =>
|
|
5085
|
+
}) => getFieldExport({
|
|
5557
5086
|
ids,
|
|
5558
5087
|
model,
|
|
5559
5088
|
isShow,
|
|
@@ -5572,9 +5101,10 @@ var use_get_field_export_default = useGetFieldExport;
|
|
|
5572
5101
|
// src/hooks/excel/use-get-file-excel.ts
|
|
5573
5102
|
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
5574
5103
|
var useGetFileExcel = ({ model }) => {
|
|
5104
|
+
const { getFileExcel } = useExcelService();
|
|
5575
5105
|
return useQuery2({
|
|
5576
5106
|
queryKey: [],
|
|
5577
|
-
queryFn: () =>
|
|
5107
|
+
queryFn: () => getFileExcel({
|
|
5578
5108
|
model
|
|
5579
5109
|
}).then((res) => {
|
|
5580
5110
|
if (res) {
|
|
@@ -5590,13 +5120,14 @@ var use_get_file_excel_default = useGetFileExcel;
|
|
|
5590
5120
|
// src/hooks/excel/use-parse-preview.ts
|
|
5591
5121
|
import { useMutation as useMutation17 } from "@tanstack/react-query";
|
|
5592
5122
|
var useParsePreview = () => {
|
|
5123
|
+
const { parsePreview } = useExcelService();
|
|
5593
5124
|
return useMutation17({
|
|
5594
5125
|
mutationFn: ({
|
|
5595
5126
|
id,
|
|
5596
5127
|
selectedSheet,
|
|
5597
5128
|
isHeader,
|
|
5598
5129
|
context
|
|
5599
|
-
}) =>
|
|
5130
|
+
}) => parsePreview({
|
|
5600
5131
|
id,
|
|
5601
5132
|
selectedSheet,
|
|
5602
5133
|
isHeader,
|
|
@@ -5609,8 +5140,9 @@ var use_parse_preview_default = useParsePreview;
|
|
|
5609
5140
|
// src/hooks/excel/use-upload-file.ts
|
|
5610
5141
|
import { useMutation as useMutation18 } from "@tanstack/react-query";
|
|
5611
5142
|
var useUploadFile = () => {
|
|
5143
|
+
const { uploadFile } = useExcelService();
|
|
5612
5144
|
return useMutation18({
|
|
5613
|
-
mutationFn: ({ formData }) =>
|
|
5145
|
+
mutationFn: ({ formData }) => uploadFile({
|
|
5614
5146
|
formData
|
|
5615
5147
|
})
|
|
5616
5148
|
});
|
|
@@ -5620,8 +5152,9 @@ var use_upload_file_default = useUploadFile;
|
|
|
5620
5152
|
// src/hooks/excel/use-upload-id-file.ts
|
|
5621
5153
|
import { useMutation as useMutation19 } from "@tanstack/react-query";
|
|
5622
5154
|
var useUploadIdFile = () => {
|
|
5155
|
+
const { uploadIdFile } = useExcelService();
|
|
5623
5156
|
return useMutation19({
|
|
5624
|
-
mutationFn: ({ formData }) =>
|
|
5157
|
+
mutationFn: ({ formData }) => uploadIdFile({
|
|
5625
5158
|
formData
|
|
5626
5159
|
})
|
|
5627
5160
|
});
|
|
@@ -5631,6 +5164,7 @@ var use_upload_id_file_default = useUploadIdFile;
|
|
|
5631
5164
|
// src/hooks/excel/uss-execute-import.ts
|
|
5632
5165
|
import { useMutation as useMutation20 } from "@tanstack/react-query";
|
|
5633
5166
|
var useExecuteImport = () => {
|
|
5167
|
+
const { executeImport } = useExcelService();
|
|
5634
5168
|
return useMutation20({
|
|
5635
5169
|
mutationFn: ({
|
|
5636
5170
|
fields,
|
|
@@ -5639,7 +5173,7 @@ var useExecuteImport = () => {
|
|
|
5639
5173
|
options,
|
|
5640
5174
|
dryrun,
|
|
5641
5175
|
context
|
|
5642
|
-
}) =>
|
|
5176
|
+
}) => executeImport({
|
|
5643
5177
|
fields,
|
|
5644
5178
|
columns,
|
|
5645
5179
|
idFile,
|
|
@@ -5654,9 +5188,10 @@ var uss_execute_import_default = useExecuteImport;
|
|
|
5654
5188
|
// src/hooks/form/use-change-status.ts
|
|
5655
5189
|
import { useMutation as useMutation21 } from "@tanstack/react-query";
|
|
5656
5190
|
var useChangeStatus = () => {
|
|
5191
|
+
const { changeStatus } = useFormService();
|
|
5657
5192
|
return useMutation21({
|
|
5658
5193
|
mutationFn: ({ data }) => {
|
|
5659
|
-
return
|
|
5194
|
+
return changeStatus({
|
|
5660
5195
|
data
|
|
5661
5196
|
});
|
|
5662
5197
|
}
|
|
@@ -5667,8 +5202,9 @@ var use_change_status_default = useChangeStatus;
|
|
|
5667
5202
|
// src/hooks/form/use-delete-comment.ts
|
|
5668
5203
|
import { useMutation as useMutation22 } from "@tanstack/react-query";
|
|
5669
5204
|
var useDeleteComment = () => {
|
|
5205
|
+
const { deleteComment } = useFormService();
|
|
5670
5206
|
return useMutation22({
|
|
5671
|
-
mutationFn: ({ data }) =>
|
|
5207
|
+
mutationFn: ({ data }) => deleteComment({
|
|
5672
5208
|
data
|
|
5673
5209
|
})
|
|
5674
5210
|
});
|
|
@@ -5678,9 +5214,10 @@ var use_delete_comment_default = useDeleteComment;
|
|
|
5678
5214
|
// src/hooks/form/use-get-comment.ts
|
|
5679
5215
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
5680
5216
|
var useGetComment = ({ data, queryKey }) => {
|
|
5217
|
+
const { getComment } = useFormService();
|
|
5681
5218
|
return useQuery3({
|
|
5682
5219
|
queryKey,
|
|
5683
|
-
queryFn: () =>
|
|
5220
|
+
queryFn: () => getComment({ data }).then((res) => {
|
|
5684
5221
|
if (res) {
|
|
5685
5222
|
return res;
|
|
5686
5223
|
}
|
|
@@ -5698,9 +5235,10 @@ var useGetFormView = ({
|
|
|
5698
5235
|
queryKey,
|
|
5699
5236
|
enabled
|
|
5700
5237
|
}) => {
|
|
5238
|
+
const { getFormView } = useFormService();
|
|
5701
5239
|
return useQuery4({
|
|
5702
5240
|
queryKey,
|
|
5703
|
-
queryFn: () =>
|
|
5241
|
+
queryFn: () => getFormView({ data }).then((res) => {
|
|
5704
5242
|
if (res) {
|
|
5705
5243
|
return res;
|
|
5706
5244
|
}
|
|
@@ -5718,9 +5256,10 @@ var useGetImage = ({
|
|
|
5718
5256
|
queryKey,
|
|
5719
5257
|
src
|
|
5720
5258
|
}) => {
|
|
5259
|
+
const { getImage } = useFormService();
|
|
5721
5260
|
return useQuery5({
|
|
5722
5261
|
queryKey,
|
|
5723
|
-
queryFn: () =>
|
|
5262
|
+
queryFn: () => getImage({ data }).then((res) => {
|
|
5724
5263
|
if (res) {
|
|
5725
5264
|
return res;
|
|
5726
5265
|
}
|
|
@@ -5734,8 +5273,9 @@ var use_get_image_default = useGetImage;
|
|
|
5734
5273
|
// src/hooks/form/use-send-comment.ts
|
|
5735
5274
|
import { useMutation as useMutation23 } from "@tanstack/react-query";
|
|
5736
5275
|
var useSendComment = () => {
|
|
5276
|
+
const { sentComment } = useFormService();
|
|
5737
5277
|
return useMutation23({
|
|
5738
|
-
mutationFn: ({ data }) =>
|
|
5278
|
+
mutationFn: ({ data }) => sentComment({
|
|
5739
5279
|
data
|
|
5740
5280
|
})
|
|
5741
5281
|
});
|
|
@@ -5745,8 +5285,9 @@ var use_send_comment_default = useSendComment;
|
|
|
5745
5285
|
// src/hooks/form/use-upload-image.ts
|
|
5746
5286
|
import { useMutation as useMutation24 } from "@tanstack/react-query";
|
|
5747
5287
|
var useUploadImage = () => {
|
|
5288
|
+
const { uploadImage } = useFormService();
|
|
5748
5289
|
return useMutation24({
|
|
5749
|
-
mutationFn: ({ data }) =>
|
|
5290
|
+
mutationFn: ({ data }) => uploadImage({
|
|
5750
5291
|
data
|
|
5751
5292
|
})
|
|
5752
5293
|
});
|
|
@@ -5756,8 +5297,9 @@ var use_upload_image_default = useUploadImage;
|
|
|
5756
5297
|
// src/hooks/model/use-delete.ts
|
|
5757
5298
|
import { useMutation as useMutation25 } from "@tanstack/react-query";
|
|
5758
5299
|
var useDelete = () => {
|
|
5300
|
+
const { deleteApi } = useModelService();
|
|
5759
5301
|
return useMutation25({
|
|
5760
|
-
mutationFn: ({ ids, model }) =>
|
|
5302
|
+
mutationFn: ({ ids, model }) => deleteApi({ ids, model })
|
|
5761
5303
|
});
|
|
5762
5304
|
};
|
|
5763
5305
|
var use_delete_default = useDelete;
|
|
@@ -5765,16 +5307,16 @@ var use_delete_default = useDelete;
|
|
|
5765
5307
|
// src/hooks/model/use-get-all.ts
|
|
5766
5308
|
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
5767
5309
|
var useGetAll = ({ data, queryKey, viewResponse }) => {
|
|
5310
|
+
const { getAll } = useModelService();
|
|
5768
5311
|
return useQuery6({
|
|
5769
5312
|
queryKey,
|
|
5770
|
-
queryFn: () =>
|
|
5313
|
+
queryFn: () => getAll({ data }).then((res) => {
|
|
5771
5314
|
if (res) {
|
|
5772
5315
|
return res;
|
|
5773
5316
|
}
|
|
5774
5317
|
}),
|
|
5775
5318
|
enabled: !!data.specification && !!data.model && !!data.domain && !!viewResponse,
|
|
5776
5319
|
refetchOnWindowFocus: false
|
|
5777
|
-
// placeholderData: keepPreviousData,
|
|
5778
5320
|
});
|
|
5779
5321
|
};
|
|
5780
5322
|
var use_get_all_default = useGetAll;
|
|
@@ -5782,9 +5324,10 @@ var use_get_all_default = useGetAll;
|
|
|
5782
5324
|
// src/hooks/model/use-get-conversion-rate.ts
|
|
5783
5325
|
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
5784
5326
|
var useGetConversionRate = () => {
|
|
5327
|
+
const { getConversionRate } = useModelService();
|
|
5785
5328
|
return useQuery7({
|
|
5786
5329
|
queryKey: ["currency-rate"],
|
|
5787
|
-
queryFn: () =>
|
|
5330
|
+
queryFn: () => getConversionRate().then((res) => {
|
|
5788
5331
|
if (res) {
|
|
5789
5332
|
return res;
|
|
5790
5333
|
}
|
|
@@ -5797,9 +5340,10 @@ var use_get_conversion_rate_default = useGetConversionRate;
|
|
|
5797
5340
|
// src/hooks/model/use-get-currency.ts
|
|
5798
5341
|
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
5799
5342
|
var useGetCurrency = () => {
|
|
5343
|
+
const { getCurrency } = useModelService();
|
|
5800
5344
|
return useQuery8({
|
|
5801
5345
|
queryKey: ["currency"],
|
|
5802
|
-
queryFn: () =>
|
|
5346
|
+
queryFn: () => getCurrency().then((res) => {
|
|
5803
5347
|
if (res) {
|
|
5804
5348
|
return res;
|
|
5805
5349
|
}
|
|
@@ -5812,13 +5356,14 @@ var use_get_currency_default = useGetCurrency;
|
|
|
5812
5356
|
// src/hooks/model/use-get-detail.ts
|
|
5813
5357
|
import { useMutation as useMutation26 } from "@tanstack/react-query";
|
|
5814
5358
|
var useGetDetail = () => {
|
|
5359
|
+
const { getDetail } = useModelService();
|
|
5815
5360
|
return useMutation26({
|
|
5816
5361
|
mutationFn: ({
|
|
5817
5362
|
model,
|
|
5818
5363
|
ids,
|
|
5819
5364
|
specification,
|
|
5820
5365
|
context
|
|
5821
|
-
}) =>
|
|
5366
|
+
}) => getDetail({
|
|
5822
5367
|
model,
|
|
5823
5368
|
ids,
|
|
5824
5369
|
specification,
|
|
@@ -5831,9 +5376,10 @@ var use_get_detail_default = useGetDetail;
|
|
|
5831
5376
|
// src/hooks/model/use-get-field-onchange.ts
|
|
5832
5377
|
import { useQuery as useQuery9 } from "@tanstack/react-query";
|
|
5833
5378
|
var useGetFieldOnChange = ({ model }) => {
|
|
5379
|
+
const { getListFieldsOnchange } = useModelService();
|
|
5834
5380
|
return useQuery9({
|
|
5835
5381
|
queryKey: [`field-onchange-${model}`, model],
|
|
5836
|
-
queryFn: () =>
|
|
5382
|
+
queryFn: () => getListFieldsOnchange({
|
|
5837
5383
|
model
|
|
5838
5384
|
}).then((res) => {
|
|
5839
5385
|
if (res) {
|
|
@@ -5853,9 +5399,10 @@ var useGetListMyBankAccount = ({
|
|
|
5853
5399
|
spectification,
|
|
5854
5400
|
model
|
|
5855
5401
|
}) => {
|
|
5402
|
+
const { getListMyBankAccount } = useModelService();
|
|
5856
5403
|
return useQuery10({
|
|
5857
5404
|
queryKey: ["bank-account", model, domain],
|
|
5858
|
-
queryFn: () =>
|
|
5405
|
+
queryFn: () => getListMyBankAccount({
|
|
5859
5406
|
domain,
|
|
5860
5407
|
spectification,
|
|
5861
5408
|
model
|
|
@@ -5997,9 +5544,10 @@ var use_model_default = useModel;
|
|
|
5997
5544
|
|
|
5998
5545
|
// src/hooks/model/use-odoo-data-transform.ts
|
|
5999
5546
|
var useOdooDataTransform = () => {
|
|
5547
|
+
const { toDataJS, parseORMOdoo } = useModelService();
|
|
6000
5548
|
return {
|
|
6001
|
-
toDataJS
|
|
6002
|
-
parseORM:
|
|
5549
|
+
toDataJS,
|
|
5550
|
+
parseORM: parseORMOdoo
|
|
6003
5551
|
};
|
|
6004
5552
|
};
|
|
6005
5553
|
var use_odoo_data_transform_default = useOdooDataTransform;
|
|
@@ -6007,6 +5555,7 @@ var use_odoo_data_transform_default = useOdooDataTransform;
|
|
|
6007
5555
|
// src/hooks/model/use-onchange-form.ts
|
|
6008
5556
|
import { useMutation as useMutation27 } from "@tanstack/react-query";
|
|
6009
5557
|
var useOnChangeForm = () => {
|
|
5558
|
+
const { onChange } = useModelService();
|
|
6010
5559
|
return useMutation27({
|
|
6011
5560
|
mutationFn: ({
|
|
6012
5561
|
ids,
|
|
@@ -6015,7 +5564,7 @@ var useOnChangeForm = () => {
|
|
|
6015
5564
|
context,
|
|
6016
5565
|
object,
|
|
6017
5566
|
fieldChange
|
|
6018
|
-
}) =>
|
|
5567
|
+
}) => onChange({
|
|
6019
5568
|
ids,
|
|
6020
5569
|
model,
|
|
6021
5570
|
specification,
|
|
@@ -6030,6 +5579,7 @@ var use_onchange_form_default = useOnChangeForm;
|
|
|
6030
5579
|
// src/hooks/model/use-save.ts
|
|
6031
5580
|
import { useMutation as useMutation28 } from "@tanstack/react-query";
|
|
6032
5581
|
var useSave = () => {
|
|
5582
|
+
const { save } = useModelService();
|
|
6033
5583
|
return useMutation28({
|
|
6034
5584
|
mutationFn: ({
|
|
6035
5585
|
ids,
|
|
@@ -6038,7 +5588,7 @@ var useSave = () => {
|
|
|
6038
5588
|
specification,
|
|
6039
5589
|
context,
|
|
6040
5590
|
path
|
|
6041
|
-
}) =>
|
|
5591
|
+
}) => save({ ids, model, data, specification, context, path })
|
|
6042
5592
|
});
|
|
6043
5593
|
};
|
|
6044
5594
|
var use_save_default = useSave;
|
|
@@ -6046,8 +5596,9 @@ var use_save_default = useSave;
|
|
|
6046
5596
|
// src/hooks/user/use-get-profile.ts
|
|
6047
5597
|
import { useMutation as useMutation29 } from "@tanstack/react-query";
|
|
6048
5598
|
var useGetProfile = (path) => {
|
|
5599
|
+
const { getProfile } = useUserService();
|
|
6049
5600
|
return useMutation29({
|
|
6050
|
-
mutationFn: () =>
|
|
5601
|
+
mutationFn: () => getProfile(path)
|
|
6051
5602
|
});
|
|
6052
5603
|
};
|
|
6053
5604
|
var use_get_profile_default = useGetProfile;
|
|
@@ -6055,8 +5606,9 @@ var use_get_profile_default = useGetProfile;
|
|
|
6055
5606
|
// src/hooks/user/use-get-user.ts
|
|
6056
5607
|
import { useMutation as useMutation30 } from "@tanstack/react-query";
|
|
6057
5608
|
var useGetUser = () => {
|
|
5609
|
+
const { getUser } = useUserService();
|
|
6058
5610
|
return useMutation30({
|
|
6059
|
-
mutationFn: ({ id, context }) =>
|
|
5611
|
+
mutationFn: ({ id, context }) => getUser({
|
|
6060
5612
|
id,
|
|
6061
5613
|
context
|
|
6062
5614
|
})
|
|
@@ -6067,9 +5619,10 @@ var use_get_user_default = useGetUser;
|
|
|
6067
5619
|
// src/hooks/user/use-switch-locale.ts
|
|
6068
5620
|
import { useMutation as useMutation31 } from "@tanstack/react-query";
|
|
6069
5621
|
var useSwitchLocale = () => {
|
|
5622
|
+
const { switchUserLocale } = useUserService();
|
|
6070
5623
|
return useMutation31({
|
|
6071
5624
|
mutationFn: ({ data }) => {
|
|
6072
|
-
return
|
|
5625
|
+
return switchUserLocale({
|
|
6073
5626
|
id: data.id,
|
|
6074
5627
|
values: data.values
|
|
6075
5628
|
});
|
|
@@ -6081,13 +5634,14 @@ var use_switch_locale_default = useSwitchLocale;
|
|
|
6081
5634
|
// src/hooks/view/use-button.ts
|
|
6082
5635
|
import { useMutation as useMutation32 } from "@tanstack/react-query";
|
|
6083
5636
|
var useButton = () => {
|
|
5637
|
+
const { callButton } = useActionService();
|
|
6084
5638
|
return useMutation32({
|
|
6085
5639
|
mutationFn: ({
|
|
6086
5640
|
model,
|
|
6087
5641
|
ids,
|
|
6088
5642
|
context,
|
|
6089
5643
|
method
|
|
6090
|
-
}) =>
|
|
5644
|
+
}) => callButton({
|
|
6091
5645
|
model,
|
|
6092
5646
|
ids,
|
|
6093
5647
|
context,
|
|
@@ -6103,12 +5657,13 @@ var use_button_default = useButton;
|
|
|
6103
5657
|
// src/hooks/view/use-duplicate-record.ts
|
|
6104
5658
|
import { useMutation as useMutation33 } from "@tanstack/react-query";
|
|
6105
5659
|
var useDuplicateRecord = () => {
|
|
5660
|
+
const { duplicateRecord } = useActionService();
|
|
6106
5661
|
return useMutation33({
|
|
6107
5662
|
mutationFn: ({
|
|
6108
5663
|
id,
|
|
6109
5664
|
model,
|
|
6110
5665
|
context
|
|
6111
|
-
}) =>
|
|
5666
|
+
}) => duplicateRecord({
|
|
6112
5667
|
id,
|
|
6113
5668
|
model,
|
|
6114
5669
|
context
|
|
@@ -6127,6 +5682,8 @@ var useGetActionDetail = ({
|
|
|
6127
5682
|
model,
|
|
6128
5683
|
queryKey
|
|
6129
5684
|
}) => {
|
|
5685
|
+
const { getFormView } = useFormService();
|
|
5686
|
+
const { getActionDetail } = useViewService();
|
|
6130
5687
|
const data = {
|
|
6131
5688
|
id,
|
|
6132
5689
|
model: model ?? "",
|
|
@@ -6136,12 +5693,12 @@ var useGetActionDetail = ({
|
|
|
6136
5693
|
queryKey,
|
|
6137
5694
|
queryFn: async () => {
|
|
6138
5695
|
if (aid) {
|
|
6139
|
-
const res = await
|
|
5696
|
+
const res = await getActionDetail(aid, context);
|
|
6140
5697
|
if (res && res.length > 0) {
|
|
6141
5698
|
return res[0];
|
|
6142
5699
|
}
|
|
6143
5700
|
} else {
|
|
6144
|
-
const res = await
|
|
5701
|
+
const res = await getFormView({ data });
|
|
6145
5702
|
return res;
|
|
6146
5703
|
}
|
|
6147
5704
|
},
|
|
@@ -6155,9 +5712,10 @@ var use_get_action_detail_default = useGetActionDetail;
|
|
|
6155
5712
|
// src/hooks/view/use-get-calendar.ts
|
|
6156
5713
|
import { useQuery as useQuery12 } from "@tanstack/react-query";
|
|
6157
5714
|
var useGetCalendar = (listDataProps, queryKey, enabled) => {
|
|
5715
|
+
const { getListCalendar } = useModelService();
|
|
6158
5716
|
return useQuery12({
|
|
6159
5717
|
queryKey,
|
|
6160
|
-
queryFn: () =>
|
|
5718
|
+
queryFn: () => getListCalendar({ data: listDataProps }).then((res) => {
|
|
6161
5719
|
if (res) {
|
|
6162
5720
|
return res;
|
|
6163
5721
|
}
|
|
@@ -6176,9 +5734,10 @@ var useGetGroups = ({
|
|
|
6176
5734
|
model,
|
|
6177
5735
|
width_context
|
|
6178
5736
|
}) => {
|
|
5737
|
+
const { getGroups } = useKanbanService();
|
|
6179
5738
|
return useQuery13({
|
|
6180
5739
|
queryKey: [model, width_context],
|
|
6181
|
-
queryFn: () =>
|
|
5740
|
+
queryFn: () => getGroups({
|
|
6182
5741
|
model,
|
|
6183
5742
|
width_context
|
|
6184
5743
|
}).then((res) => {
|
|
@@ -6195,9 +5754,10 @@ var use_get_groups_default = useGetGroups;
|
|
|
6195
5754
|
// src/hooks/view/use-get-list-data.ts
|
|
6196
5755
|
import { useQuery as useQuery14 } from "@tanstack/react-query";
|
|
6197
5756
|
var useGetListData = (listDataProps, queryKey, enabled) => {
|
|
5757
|
+
const { getAll } = useModelService();
|
|
6198
5758
|
return useQuery14({
|
|
6199
5759
|
queryKey,
|
|
6200
|
-
queryFn: () =>
|
|
5760
|
+
queryFn: () => getAll({ data: listDataProps }).then((res) => {
|
|
6201
5761
|
if (res) {
|
|
6202
5762
|
return res;
|
|
6203
5763
|
}
|
|
@@ -6213,9 +5773,10 @@ var use_get_list_data_default = useGetListData;
|
|
|
6213
5773
|
// src/hooks/view/use-get-menu.ts
|
|
6214
5774
|
import { useQuery as useQuery15 } from "@tanstack/react-query";
|
|
6215
5775
|
var useGetMenu = (context, enabled) => {
|
|
5776
|
+
const { getMenu } = useViewService();
|
|
6216
5777
|
return useQuery15({
|
|
6217
5778
|
queryKey: ["menus" /* MENU */, context],
|
|
6218
|
-
queryFn: () =>
|
|
5779
|
+
queryFn: () => getMenu(context).then((res) => {
|
|
6219
5780
|
if (res && res?.records && res?.records?.length > 0) {
|
|
6220
5781
|
return res?.records;
|
|
6221
5782
|
}
|
|
@@ -6231,8 +5792,9 @@ var use_get_menu_default = useGetMenu;
|
|
|
6231
5792
|
// src/hooks/view/use-get-print-report.ts
|
|
6232
5793
|
import { useMutation as useMutation34 } from "@tanstack/react-query";
|
|
6233
5794
|
var useGetPrintReport = () => {
|
|
5795
|
+
const { getPrintReportName } = useActionService();
|
|
6234
5796
|
return useMutation34({
|
|
6235
|
-
mutationFn: ({ id }) =>
|
|
5797
|
+
mutationFn: ({ id }) => getPrintReportName({
|
|
6236
5798
|
id
|
|
6237
5799
|
})
|
|
6238
5800
|
});
|
|
@@ -6247,9 +5809,10 @@ var useGetProGressBar = ({
|
|
|
6247
5809
|
model,
|
|
6248
5810
|
width_context
|
|
6249
5811
|
}) => {
|
|
5812
|
+
const { getProgressBar } = useKanbanService();
|
|
6250
5813
|
return useQuery16({
|
|
6251
5814
|
queryKey: [],
|
|
6252
|
-
queryFn: () =>
|
|
5815
|
+
queryFn: () => getProgressBar({
|
|
6253
5816
|
field,
|
|
6254
5817
|
color,
|
|
6255
5818
|
model,
|
|
@@ -6272,9 +5835,10 @@ var useGetSelection = ({
|
|
|
6272
5835
|
queryKey,
|
|
6273
5836
|
enabled
|
|
6274
5837
|
}) => {
|
|
5838
|
+
const { getSelectionItem } = useViewService();
|
|
6275
5839
|
return useQuery17({
|
|
6276
5840
|
queryKey,
|
|
6277
|
-
queryFn: () =>
|
|
5841
|
+
queryFn: () => getSelectionItem({ data }),
|
|
6278
5842
|
enabled,
|
|
6279
5843
|
refetchOnWindowFocus: false
|
|
6280
5844
|
});
|
|
@@ -6284,9 +5848,10 @@ var use_get_selection_default = useGetSelection;
|
|
|
6284
5848
|
// src/hooks/view/use-get-view.ts
|
|
6285
5849
|
import { useQuery as useQuery18 } from "@tanstack/react-query";
|
|
6286
5850
|
var useGetView = (viewParams, actData) => {
|
|
5851
|
+
const { getView } = useViewService();
|
|
6287
5852
|
return useQuery18({
|
|
6288
5853
|
queryKey: ["get_view_by_action" /* GET_VIEW_BY_ACTION */, viewParams],
|
|
6289
|
-
queryFn: () =>
|
|
5854
|
+
queryFn: () => getView(viewParams),
|
|
6290
5855
|
enabled: !!actData,
|
|
6291
5856
|
refetchOnWindowFocus: false,
|
|
6292
5857
|
staleTime: Infinity
|
|
@@ -6297,12 +5862,13 @@ var use_get_view_default = useGetView;
|
|
|
6297
5862
|
// src/hooks/view/use-load-action.ts
|
|
6298
5863
|
import { useMutation as useMutation35 } from "@tanstack/react-query";
|
|
6299
5864
|
var useLoadAction = () => {
|
|
5865
|
+
const { loadAction } = useActionService();
|
|
6300
5866
|
return useMutation35({
|
|
6301
5867
|
mutationFn: ({
|
|
6302
5868
|
idAction,
|
|
6303
5869
|
context
|
|
6304
5870
|
}) => {
|
|
6305
|
-
return
|
|
5871
|
+
return loadAction({
|
|
6306
5872
|
idAction,
|
|
6307
5873
|
context
|
|
6308
5874
|
});
|
|
@@ -6314,9 +5880,10 @@ var use_load_action_default = useLoadAction;
|
|
|
6314
5880
|
// src/hooks/view/use-load-message.ts
|
|
6315
5881
|
import { useQuery as useQuery19 } from "@tanstack/react-query";
|
|
6316
5882
|
var useLoadMessage = () => {
|
|
5883
|
+
const { loadMessages } = useViewService();
|
|
6317
5884
|
return useQuery19({
|
|
6318
5885
|
queryKey: [`load-message-failure`],
|
|
6319
|
-
queryFn: () =>
|
|
5886
|
+
queryFn: () => loadMessages(),
|
|
6320
5887
|
refetchOnWindowFocus: false
|
|
6321
5888
|
});
|
|
6322
5889
|
};
|
|
@@ -6325,8 +5892,9 @@ var use_load_message_default = useLoadMessage;
|
|
|
6325
5892
|
// src/hooks/view/use-print.ts
|
|
6326
5893
|
import { useMutation as useMutation36 } from "@tanstack/react-query";
|
|
6327
5894
|
var usePrint = () => {
|
|
5895
|
+
const { print } = useActionService();
|
|
6328
5896
|
return useMutation36({
|
|
6329
|
-
mutationFn: ({ id, report, db }) =>
|
|
5897
|
+
mutationFn: ({ id, report, db }) => print({
|
|
6330
5898
|
id,
|
|
6331
5899
|
report,
|
|
6332
5900
|
db
|
|
@@ -6338,12 +5906,13 @@ var use_print_default = usePrint;
|
|
|
6338
5906
|
// src/hooks/view/use-remove-row.ts
|
|
6339
5907
|
import { useMutation as useMutation37 } from "@tanstack/react-query";
|
|
6340
5908
|
var useRemoveRow = () => {
|
|
5909
|
+
const { removeRows } = useActionService();
|
|
6341
5910
|
return useMutation37({
|
|
6342
5911
|
mutationFn: ({
|
|
6343
5912
|
model,
|
|
6344
5913
|
ids,
|
|
6345
5914
|
context
|
|
6346
|
-
}) =>
|
|
5915
|
+
}) => removeRows({
|
|
6347
5916
|
model,
|
|
6348
5917
|
ids,
|
|
6349
5918
|
context
|
|
@@ -6355,9 +5924,10 @@ var use_remove_row_default = useRemoveRow;
|
|
|
6355
5924
|
// src/hooks/view/use-resequence.ts
|
|
6356
5925
|
import { useQuery as useQuery20 } from "@tanstack/react-query";
|
|
6357
5926
|
var useGetResequence = (model, resIds, context, offset) => {
|
|
5927
|
+
const { getResequence } = useViewService();
|
|
6358
5928
|
return useQuery20({
|
|
6359
5929
|
queryKey: [],
|
|
6360
|
-
queryFn: () =>
|
|
5930
|
+
queryFn: () => getResequence({
|
|
6361
5931
|
model,
|
|
6362
5932
|
ids: resIds,
|
|
6363
5933
|
context,
|
|
@@ -6372,11 +5942,12 @@ var use_resequence_default = useGetResequence;
|
|
|
6372
5942
|
// src/hooks/view/use-run-action.ts
|
|
6373
5943
|
import { useMutation as useMutation38 } from "@tanstack/react-query";
|
|
6374
5944
|
var useRunAction = () => {
|
|
5945
|
+
const { runAction } = useActionService();
|
|
6375
5946
|
return useMutation38({
|
|
6376
5947
|
mutationFn: ({
|
|
6377
5948
|
idAction,
|
|
6378
5949
|
context
|
|
6379
|
-
}) =>
|
|
5950
|
+
}) => runAction({
|
|
6380
5951
|
idAction,
|
|
6381
5952
|
context
|
|
6382
5953
|
})
|
|
@@ -6387,6 +5958,7 @@ var use_run_action_default = useRunAction;
|
|
|
6387
5958
|
// src/hooks/view/use-signin-sso.ts
|
|
6388
5959
|
import { useMutation as useMutation39 } from "@tanstack/react-query";
|
|
6389
5960
|
var useSignInSSO = () => {
|
|
5961
|
+
const { signInSSO } = useViewService();
|
|
6390
5962
|
return useMutation39({
|
|
6391
5963
|
mutationFn: ({
|
|
6392
5964
|
redirect_uri,
|
|
@@ -6395,12 +5967,11 @@ var useSignInSSO = () => {
|
|
|
6395
5967
|
response_type,
|
|
6396
5968
|
path
|
|
6397
5969
|
}) => {
|
|
6398
|
-
return
|
|
5970
|
+
return signInSSO({
|
|
6399
5971
|
redirect_uri,
|
|
6400
5972
|
state,
|
|
6401
5973
|
client_id,
|
|
6402
|
-
response_type
|
|
6403
|
-
path
|
|
5974
|
+
response_type
|
|
6404
5975
|
});
|
|
6405
5976
|
}
|
|
6406
5977
|
});
|
|
@@ -6410,6 +5981,7 @@ var use_signin_sso_default = useSignInSSO;
|
|
|
6410
5981
|
// src/hooks/view/use-verify-2FA.ts
|
|
6411
5982
|
import { useMutation as useMutation40 } from "@tanstack/react-query";
|
|
6412
5983
|
var useVerify2FA = () => {
|
|
5984
|
+
const { verify2FA } = useViewService();
|
|
6413
5985
|
return useMutation40({
|
|
6414
5986
|
mutationFn: ({
|
|
6415
5987
|
method,
|
|
@@ -6418,7 +5990,7 @@ var useVerify2FA = () => {
|
|
|
6418
5990
|
device,
|
|
6419
5991
|
location
|
|
6420
5992
|
}) => {
|
|
6421
|
-
return
|
|
5993
|
+
return verify2FA({
|
|
6422
5994
|
method,
|
|
6423
5995
|
with_context,
|
|
6424
5996
|
code,
|
|
@@ -6433,12 +6005,13 @@ var use_verify_2FA_default = useVerify2FA;
|
|
|
6433
6005
|
// src/hooks/view/uset-get-2FA-method.ts
|
|
6434
6006
|
import { useMutation as useMutation41 } from "@tanstack/react-query";
|
|
6435
6007
|
var useGet2FAMethods = () => {
|
|
6008
|
+
const { get2FAMethods } = useViewService();
|
|
6436
6009
|
return useMutation41({
|
|
6437
6010
|
mutationFn: ({
|
|
6438
6011
|
method,
|
|
6439
6012
|
with_context
|
|
6440
6013
|
}) => {
|
|
6441
|
-
return
|
|
6014
|
+
return get2FAMethods({
|
|
6442
6015
|
method,
|
|
6443
6016
|
with_context
|
|
6444
6017
|
});
|
|
@@ -6447,36 +6020,18 @@ var useGet2FAMethods = () => {
|
|
|
6447
6020
|
};
|
|
6448
6021
|
var uset_get_2FA_method_default = useGet2FAMethods;
|
|
6449
6022
|
|
|
6450
|
-
// src/hooks/view/use-get-fields-view-security.ts
|
|
6451
|
-
import { useMutation as useMutation42 } from "@tanstack/react-query";
|
|
6452
|
-
var useGetFieldsViewSecurity = () => {
|
|
6453
|
-
return useMutation42({
|
|
6454
|
-
mutationFn: ({
|
|
6455
|
-
method,
|
|
6456
|
-
token,
|
|
6457
|
-
views
|
|
6458
|
-
}) => {
|
|
6459
|
-
return view_service_default.getFieldsViewSecurity({
|
|
6460
|
-
method,
|
|
6461
|
-
token,
|
|
6462
|
-
views
|
|
6463
|
-
});
|
|
6464
|
-
}
|
|
6465
|
-
});
|
|
6466
|
-
};
|
|
6467
|
-
var use_get_fields_view_security_default = useGetFieldsViewSecurity;
|
|
6468
|
-
|
|
6469
6023
|
// src/hooks/view/use-grant-access.ts
|
|
6470
|
-
import { useMutation as
|
|
6024
|
+
import { useMutation as useMutation42 } from "@tanstack/react-query";
|
|
6471
6025
|
var useGrantAccess = () => {
|
|
6472
|
-
|
|
6026
|
+
const { grantAccess } = useViewService();
|
|
6027
|
+
return useMutation42({
|
|
6473
6028
|
mutationFn: ({
|
|
6474
6029
|
redirect_uri,
|
|
6475
6030
|
state,
|
|
6476
6031
|
client_id,
|
|
6477
6032
|
scopes
|
|
6478
6033
|
}) => {
|
|
6479
|
-
return
|
|
6034
|
+
return grantAccess({
|
|
6480
6035
|
redirect_uri,
|
|
6481
6036
|
state,
|
|
6482
6037
|
client_id,
|
|
@@ -6488,11 +6043,12 @@ var useGrantAccess = () => {
|
|
|
6488
6043
|
var use_grant_access_default = useGrantAccess;
|
|
6489
6044
|
|
|
6490
6045
|
// src/hooks/view/use-remove-totp-setup.ts
|
|
6491
|
-
import { useMutation as
|
|
6046
|
+
import { useMutation as useMutation43 } from "@tanstack/react-query";
|
|
6492
6047
|
var useRemoveTotpSetup = () => {
|
|
6493
|
-
|
|
6048
|
+
const { removeTotpSetUp } = useViewService();
|
|
6049
|
+
return useMutation43({
|
|
6494
6050
|
mutationFn: ({ method, token }) => {
|
|
6495
|
-
return
|
|
6051
|
+
return removeTotpSetUp({
|
|
6496
6052
|
method,
|
|
6497
6053
|
token
|
|
6498
6054
|
});
|
|
@@ -6502,11 +6058,12 @@ var useRemoveTotpSetup = () => {
|
|
|
6502
6058
|
var use_remove_totp_setup_default = useRemoveTotpSetup;
|
|
6503
6059
|
|
|
6504
6060
|
// src/hooks/view/use-request-setup-totp.ts
|
|
6505
|
-
import { useMutation as
|
|
6061
|
+
import { useMutation as useMutation44 } from "@tanstack/react-query";
|
|
6506
6062
|
var useRequestSetupTotp = () => {
|
|
6507
|
-
|
|
6063
|
+
const { requestSetupTotp } = useViewService();
|
|
6064
|
+
return useMutation44({
|
|
6508
6065
|
mutationFn: ({ method, token }) => {
|
|
6509
|
-
return
|
|
6066
|
+
return requestSetupTotp({
|
|
6510
6067
|
method,
|
|
6511
6068
|
token
|
|
6512
6069
|
});
|
|
@@ -6516,16 +6073,17 @@ var useRequestSetupTotp = () => {
|
|
|
6516
6073
|
var use_request_setup_totp_default = useRequestSetupTotp;
|
|
6517
6074
|
|
|
6518
6075
|
// src/hooks/view/use-settings-web-read-2fa.ts
|
|
6519
|
-
import { useMutation as
|
|
6076
|
+
import { useMutation as useMutation45 } from "@tanstack/react-query";
|
|
6520
6077
|
var useSettingsWebRead2fa = () => {
|
|
6521
|
-
|
|
6078
|
+
const { settingsWebRead2fa } = useViewService();
|
|
6079
|
+
return useMutation45({
|
|
6522
6080
|
mutationFn: ({
|
|
6523
6081
|
method,
|
|
6524
6082
|
token,
|
|
6525
6083
|
kwargs,
|
|
6526
6084
|
model
|
|
6527
6085
|
}) => {
|
|
6528
|
-
return
|
|
6086
|
+
return settingsWebRead2fa({
|
|
6529
6087
|
method,
|
|
6530
6088
|
model,
|
|
6531
6089
|
kwargs,
|
|
@@ -6537,15 +6095,16 @@ var useSettingsWebRead2fa = () => {
|
|
|
6537
6095
|
var use_settings_web_read_2fa_default = useSettingsWebRead2fa;
|
|
6538
6096
|
|
|
6539
6097
|
// src/hooks/view/use-verify-totp.ts
|
|
6540
|
-
import { useMutation as
|
|
6098
|
+
import { useMutation as useMutation46 } from "@tanstack/react-query";
|
|
6541
6099
|
var useVerifyTotp = () => {
|
|
6542
|
-
|
|
6100
|
+
const { verifyTotp } = useViewService();
|
|
6101
|
+
return useMutation46({
|
|
6543
6102
|
mutationFn: ({
|
|
6544
6103
|
method,
|
|
6545
6104
|
action_token,
|
|
6546
6105
|
code
|
|
6547
6106
|
}) => {
|
|
6548
|
-
return
|
|
6107
|
+
return verifyTotp({
|
|
6549
6108
|
method,
|
|
6550
6109
|
action_token,
|
|
6551
6110
|
code
|
|
@@ -6555,45 +6114,7 @@ var useVerifyTotp = () => {
|
|
|
6555
6114
|
};
|
|
6556
6115
|
var use_verify_totp_default = useVerifyTotp;
|
|
6557
6116
|
|
|
6558
|
-
// src/provider/version-gate-provider.tsx
|
|
6559
|
-
import { Fragment, jsx as jsx5 } from "react/jsx-runtime";
|
|
6560
|
-
var VersionGate = ({ children }) => {
|
|
6561
|
-
const queryClient = useQueryClient();
|
|
6562
|
-
const [ready, setReady] = useState3(false);
|
|
6563
|
-
const { getVersion } = useViewService();
|
|
6564
|
-
const login = use_login_credential_default();
|
|
6565
|
-
useEffect2(() => {
|
|
6566
|
-
const clearVersion = () => {
|
|
6567
|
-
queryClient.clear();
|
|
6568
|
-
localStorage.removeItem("__api_version__");
|
|
6569
|
-
};
|
|
6570
|
-
const validateVersion = async () => {
|
|
6571
|
-
const serverVersion = await getVersion();
|
|
6572
|
-
const cached = localStorage.getItem("__api_version__");
|
|
6573
|
-
if (cached !== serverVersion?.api_version) {
|
|
6574
|
-
clearVersion();
|
|
6575
|
-
localStorage.setItem("__api_version__", serverVersion?.api_version);
|
|
6576
|
-
} else {
|
|
6577
|
-
console.log("Api version:", serverVersion?.api_version);
|
|
6578
|
-
}
|
|
6579
|
-
setReady(true);
|
|
6580
|
-
};
|
|
6581
|
-
validateVersion();
|
|
6582
|
-
if (typeof window !== "undefined") {
|
|
6583
|
-
const onKey = (e) => {
|
|
6584
|
-
const key = e.key.toLowerCase();
|
|
6585
|
-
const isHardRefresh = (key === "f5" || key === "r") && e.ctrlKey && (key !== "r" || e.shiftKey) || key === "r" && e.metaKey && e.shiftKey || key === "r" && e.metaKey && e.altKey;
|
|
6586
|
-
if (isHardRefresh) clearVersion();
|
|
6587
|
-
};
|
|
6588
|
-
window.addEventListener("keydown", onKey);
|
|
6589
|
-
return () => window.removeEventListener("keydown", onKey);
|
|
6590
|
-
}
|
|
6591
|
-
}, [queryClient]);
|
|
6592
|
-
return ready ? /* @__PURE__ */ jsx5(Fragment, { children }) : null;
|
|
6593
|
-
};
|
|
6594
|
-
|
|
6595
6117
|
// src/provider/service-provider.tsx
|
|
6596
|
-
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
6597
6118
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
6598
6119
|
var ServiceContext = createContext2(null);
|
|
6599
6120
|
var ServiceProvider = ({
|
|
@@ -6663,7 +6184,6 @@ var ServiceProvider = ({
|
|
|
6663
6184
|
useRunAction: use_run_action_default,
|
|
6664
6185
|
useSignInSSO: use_signin_sso_default,
|
|
6665
6186
|
useVerify2FA: use_verify_2FA_default,
|
|
6666
|
-
useGetFieldsViewSecurity: use_get_fields_view_security_default,
|
|
6667
6187
|
useGrantAccess: use_grant_access_default,
|
|
6668
6188
|
useRemoveTotpSetup: use_remove_totp_setup_default,
|
|
6669
6189
|
useRequestSetupTotp: use_request_setup_totp_default,
|