@antscorp/antsomi-ui 1.3.7-beta.53 → 1.3.7-beta.55
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/es/components/molecules/AddDynamicContent/AddDynamicContent.js +123 -114
- package/es/components/molecules/SelectAccount/hook/useGetAbstractUsers.d.ts +2 -2
- package/es/components/molecules/TemplateSaveAs/hooks/useTemplateSave.d.ts +2 -2
- package/es/components/molecules/UploadImage/index.js +3 -2
- package/es/components/organism/ContentSources/Settings.js +40 -41
- package/es/components/organism/DataTable/hooks/useDataTableListing/useDataTableListing.js +7 -5
- package/es/components/organism/Help/queries/useGetListUser.js +4 -1
- package/es/components/organism/LeftMenu/components/HomeMenu/useHomeMenu.js +1 -1
- package/es/components/organism/LeftMenu/hooks/usePermission.d.ts +1 -1
- package/es/components/organism/TicketEditorV2/queries/useFetchAccountPermission.js +4 -1
- package/es/components/organism/TicketEditorV2/queries/useGetDetailTicket.d.ts +1 -1
- package/es/components/organism/TicketEditorV2/queries/useGetListComments.d.ts +1 -1
- package/es/components/organism/TicketEditorV2/queries/useGetListUser.js +4 -1
- package/es/components/template/TemplateListing/hooks/useTemplateListing.d.ts +2 -3
- package/es/providers/ConfigProvider/ConfigProvider.js +1 -1
- package/es/providers/ConfigProvider/GlobalStyle.js +70 -68
- package/es/queries/AI/index.d.ts +3 -3
- package/es/queries/AI/useSqlGeneration.d.ts +3 -3
- package/es/queries/AI/useSqlGeneration.js +2 -2
- package/es/queries/Account/useGetAccountList.d.ts +3 -3
- package/es/queries/Account/useGetAccountList.js +2 -1
- package/es/queries/BusinessObject/useGetBODetail.d.ts +1 -1
- package/es/queries/BusinessObject/useGetListAllEvents.d.ts +1 -1
- package/es/queries/BusinessObject/useGetListBO.d.ts +1 -1
- package/es/queries/BusinessObject/useGetListEventAttr.d.ts +1 -1
- package/es/queries/BusinessObject/useGetListPromotionCodeAttr.d.ts +1 -1
- package/es/queries/BusinessObject/useGetListSourceByEvent.d.ts +1 -1
- package/es/queries/CustomFunction/useCustomFunction.d.ts +3 -3
- package/es/queries/CustomFunction/useCustomFunction.js +8 -4
- package/es/queries/DataTable/index.d.ts +25 -25
- package/es/queries/DataTable/index.js +26 -19
- package/es/queries/DynamicContentAttribute/useGetDynamicContentAttr.d.ts +1 -1
- package/es/queries/LeftMenu/index.d.ts +9 -9
- package/es/queries/LeftMenu/index.js +4 -6
- package/es/queries/Permission/index.d.ts +2 -2
- package/es/queries/PromotionPool/useGetListPromotionPool.d.ts +1 -1
- package/es/queries/TemplateListing/index.d.ts +5 -5
- package/es/queries/TemplateListing/index.js +28 -14
- package/es/queries/ThirdParty/useGetEventTrackingAttributes.d.ts +1 -1
- package/es/queries/ThirdParty/useGetListFallbackBO.d.ts +1 -1
- package/es/queries/ThirdParty/useStoreSavedMedia.d.ts +1 -1
- package/es/queries/ThirdParty/useStoreSavedMedia.js +1 -0
- package/es/queries/Unsubscribe/useGetUnsubscribeList.d.ts +1 -1
- package/es/queries/Unsubscribe/useGetUnsubscribeList.js +2 -2
- package/es/queries/Unsubscribe/useGetUnsubscribeListByIdentifier.d.ts +1 -1
- package/es/queries/Unsubscribe/useGetUnsubscribeListPermission.d.ts +1 -1
- package/es/queries/Unsubscribe/useGetUnsubscribeListPermission.js +2 -2
- package/es/queries/Unsubscribe/useGetUnsubscribePreferences.d.ts +1 -1
- package/es/queries/User/index.d.ts +1 -1
- package/es/queries/User/index.js +11 -7
- package/es/queries/User/userGetUserInfo.js +6 -3
- package/package.json +3 -3
|
@@ -11,17 +11,18 @@ export const useGetDashboard = (params) => {
|
|
|
11
11
|
return useQuery({
|
|
12
12
|
queryKey: [QUERY_KEYS.GET_DASHBOARD, args.params, args.auth],
|
|
13
13
|
queryFn: () => getDashboard(params.args),
|
|
14
|
-
onSuccess() { },
|
|
15
14
|
...options,
|
|
16
15
|
});
|
|
17
16
|
};
|
|
18
17
|
export const useRemoveDashboard = () => {
|
|
19
18
|
const queryClient = useQueryClient();
|
|
20
|
-
return useMutation(
|
|
19
|
+
return useMutation({
|
|
20
|
+
mutationFn: removeDashboard,
|
|
21
21
|
onSuccess: data => {
|
|
22
22
|
const { code } = data || {};
|
|
23
23
|
if (code === API_RESPONSE_CODE.SUCCESS) {
|
|
24
|
-
queryClient.invalidateQueries(
|
|
24
|
+
queryClient.invalidateQueries({
|
|
25
|
+
queryKey: [QUERY_KEYS.GET_DASHBOARD],
|
|
25
26
|
exact: false,
|
|
26
27
|
});
|
|
27
28
|
}
|
|
@@ -34,7 +35,6 @@ export const useGetListMenu = (params) => {
|
|
|
34
35
|
return useQuery({
|
|
35
36
|
queryKey: [QUERY_KEYS.GET_LIST_MENU, args.params, args.auth],
|
|
36
37
|
queryFn: () => getListMenu(params.args),
|
|
37
|
-
onSuccess() { },
|
|
38
38
|
enabled: !!auth?.token && !!auth.portalId && !!auth?.userId,
|
|
39
39
|
...options,
|
|
40
40
|
});
|
|
@@ -45,7 +45,6 @@ export const useGetListMenuPermission = (params) => {
|
|
|
45
45
|
return useQuery({
|
|
46
46
|
queryKey: [QUERY_KEYS.GET_LIST_MENU_PERMISSION, args.params, token, accountId, userId],
|
|
47
47
|
queryFn: () => getListMenuPermission(params.args),
|
|
48
|
-
onSuccess() { },
|
|
49
48
|
enabled: !!token && !!userId,
|
|
50
49
|
...options,
|
|
51
50
|
});
|
|
@@ -55,7 +54,6 @@ export const useGetDestinationChannel = (params) => {
|
|
|
55
54
|
return useQuery({
|
|
56
55
|
queryKey: [QUERY_KEYS.GET_DESTINATION_CHANNEL, args.params, args.auth],
|
|
57
56
|
queryFn: () => getDestinationChannel(params.args),
|
|
58
|
-
onSuccess() { },
|
|
59
57
|
...options,
|
|
60
58
|
});
|
|
61
59
|
};
|
|
@@ -2,7 +2,7 @@ import { UseQueryOptions } from '@tanstack/react-query';
|
|
|
2
2
|
import { TGetAccountList } from '../../services/Permission';
|
|
3
3
|
interface GetAccountListProps {
|
|
4
4
|
args: TGetAccountList;
|
|
5
|
-
options?: UseQueryOptions<any, any, any[], any[]>;
|
|
5
|
+
options?: Omit<UseQueryOptions<any, any, any[], any[]>, 'queryKey' | 'queryFn'>;
|
|
6
6
|
}
|
|
7
|
-
export declare const useGetPermissionAccountList: (props: GetAccountListProps) => import("@tanstack/react-query").UseQueryResult<any[]
|
|
7
|
+
export declare const useGetPermissionAccountList: (props: GetAccountListProps) => import("@tanstack/react-query").UseQueryResult<NoInfer<any[]>, any>;
|
|
8
8
|
export {};
|
|
@@ -5,5 +5,5 @@ interface TReturnData {
|
|
|
5
5
|
rows: any[];
|
|
6
6
|
total: number;
|
|
7
7
|
}
|
|
8
|
-
export declare const useGetListPromotionPool: <T = TReturnData>(apiConfig: APIParams, infos: PayloadInfo, queryOptions?: Omit<UseQueryOptions<TReturnData, any, T>, 'queryKey' | 'queryFn'>) => import("@tanstack/react-query").UseQueryResult<T
|
|
8
|
+
export declare const useGetListPromotionPool: <T = TReturnData>(apiConfig: APIParams, infos: PayloadInfo, queryOptions?: Omit<UseQueryOptions<TReturnData, any, T>, 'queryKey' | 'queryFn'>) => import("@tanstack/react-query").UseQueryResult<NoInfer<T>, any>;
|
|
9
9
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UseInfiniteQueryOptions, UseMutationOptions, UseQueryOptions } from '@tanstack/react-query';
|
|
2
2
|
import { TemplateCategory } from '@antscorp/antsomi-ui/es/models/TemplateCategory';
|
|
3
3
|
import { TBulkUpdateObjectTemplateArgs, TGetCategoryListArgs, TGetObjectTemplateDetailArgs, TGetObjectTemplateListArgs, TGetSaveAsGalleryPermissionArgs, TUpdateObjectTemplateArgs, TValidateObjectTemplateNameArgs } from '@antscorp/antsomi-ui/es/services/TemplateListing';
|
|
4
|
-
import { ResponseCheckNameExist
|
|
4
|
+
import { ResponseCheckNameExist } from '../../types';
|
|
5
5
|
import { ObjectTemplate } from '../../models/ObjectTemplate';
|
|
6
6
|
import { TCreateObjectTemplateArgs } from '../../services/TemplateListing';
|
|
7
7
|
export type TGetTemplateCategoryList = {
|
|
@@ -14,7 +14,7 @@ export type TGetSaveAsGalleryPermissionEmails = {
|
|
|
14
14
|
};
|
|
15
15
|
export type TGetObjectTEmplateList = {
|
|
16
16
|
args: TGetObjectTemplateListArgs;
|
|
17
|
-
options?: UseInfiniteQueryOptions<any, any, any,
|
|
17
|
+
options?: UseInfiniteQueryOptions<any, any, any, (string | Record<string, any>)[]>;
|
|
18
18
|
};
|
|
19
19
|
export type TGetObjectTemplateDetail = {
|
|
20
20
|
args: TGetObjectTemplateDetailArgs;
|
|
@@ -38,10 +38,10 @@ export type TUsePersistTemplate = {
|
|
|
38
38
|
params: TUpdateObjectTemplateArgs;
|
|
39
39
|
}, unknown>;
|
|
40
40
|
};
|
|
41
|
-
export declare const useGetTemplateCategoryList: (params: TGetTemplateCategoryList) => import("@tanstack/react-query").UseQueryResult<TemplateCategory[]
|
|
42
|
-
export declare const useGetSaveAsGalleryPermissionEmails: (params: TGetSaveAsGalleryPermissionEmails) => import("@tanstack/react-query").UseQueryResult<string[]
|
|
41
|
+
export declare const useGetTemplateCategoryList: (params: TGetTemplateCategoryList) => import("@tanstack/react-query").UseQueryResult<NoInfer<TemplateCategory[]>, any>;
|
|
42
|
+
export declare const useGetSaveAsGalleryPermissionEmails: (params: TGetSaveAsGalleryPermissionEmails) => import("@tanstack/react-query").UseQueryResult<NoInfer<string[]>, any>;
|
|
43
43
|
export declare const useGetObjectTemplateList: (params: TGetObjectTEmplateList) => import("@tanstack/react-query").UseInfiniteQueryResult<any, any>;
|
|
44
|
-
export declare const useGetObjectTemplateDetail: (params: TGetObjectTemplateDetail) => import("@tanstack/react-query").UseQueryResult<ObjectTemplate
|
|
44
|
+
export declare const useGetObjectTemplateDetail: (params: TGetObjectTemplateDetail) => import("@tanstack/react-query").UseQueryResult<NoInfer<ObjectTemplate>, any>;
|
|
45
45
|
export declare const useValidateTemplateName: (params: TUseValidateTemplateName) => import("@tanstack/react-query").UseMutationResult<ResponseCheckNameExist, any, TValidateObjectTemplateNameArgs, unknown>;
|
|
46
46
|
export declare const useBulkUpdateTemplate: (params: TBulkUpdateTemplate) => import("@tanstack/react-query").UseMutationResult<any, any, TBulkUpdateObjectTemplateArgs, unknown>;
|
|
47
47
|
export declare const useCreateTemplate: (params: TUseCreateTemplate) => import("@tanstack/react-query").UseMutationResult<any, any, TCreateObjectTemplateArgs, unknown>;
|
|
@@ -14,7 +14,6 @@ export const useGetTemplateCategoryList = (params) => {
|
|
|
14
14
|
queryFn: () => args?.params?.publicLevel === PUBLIC_LEVEL.PUBLIC
|
|
15
15
|
? category.getPublicList(params.args)
|
|
16
16
|
: category.getList(params.args),
|
|
17
|
-
onSuccess() { },
|
|
18
17
|
...options,
|
|
19
18
|
});
|
|
20
19
|
};
|
|
@@ -23,7 +22,6 @@ export const useGetSaveAsGalleryPermissionEmails = (params) => {
|
|
|
23
22
|
return useQuery({
|
|
24
23
|
queryKey: [QUERY_KEYS.GET_SAVE_AS_GALLERY_PERMISSION_EMAILS],
|
|
25
24
|
queryFn: () => objectTemplate.getSaveAsGalleryPermission(params.args),
|
|
26
|
-
onSuccess() { },
|
|
27
25
|
...options,
|
|
28
26
|
});
|
|
29
27
|
};
|
|
@@ -31,15 +29,17 @@ export const useGetObjectTemplateList = (params) => {
|
|
|
31
29
|
const { options, args } = params;
|
|
32
30
|
return useInfiniteQuery({
|
|
33
31
|
queryKey: [QUERY_KEYS.GET_OBJECT_TEMPLATE_LIST, args.params],
|
|
34
|
-
|
|
32
|
+
initialPageParam: 1,
|
|
33
|
+
queryFn: async ({ pageParam }) => {
|
|
34
|
+
const page = pageParam || 1;
|
|
35
35
|
const res = args?.params?.public_level === PUBLIC_LEVEL.PUBLIC
|
|
36
36
|
? await objectTemplate.getPublicList({
|
|
37
37
|
...args,
|
|
38
|
-
params: { ...args.params, page
|
|
38
|
+
params: { ...args.params, page },
|
|
39
39
|
})
|
|
40
40
|
: await objectTemplate.getList({
|
|
41
41
|
...args,
|
|
42
|
-
params: { ...args.params, page
|
|
42
|
+
params: { ...args.params, page },
|
|
43
43
|
});
|
|
44
44
|
return res;
|
|
45
45
|
},
|
|
@@ -73,10 +73,12 @@ export const useBulkUpdateTemplate = (params) => {
|
|
|
73
73
|
return useMutation({
|
|
74
74
|
mutationFn: objectTemplate.bulkUpdate,
|
|
75
75
|
onSettled() {
|
|
76
|
-
queryClient.invalidateQueries(
|
|
76
|
+
queryClient.invalidateQueries({
|
|
77
|
+
queryKey: [QUERY_KEYS.GET_OBJECT_TEMPLATE_LIST],
|
|
77
78
|
exact: false,
|
|
78
79
|
});
|
|
79
|
-
queryClient.invalidateQueries(
|
|
80
|
+
queryClient.invalidateQueries({
|
|
81
|
+
queryKey: [QUERY_KEYS.GET_TEMPLATE_CATEGORY_LIST],
|
|
80
82
|
exact: false,
|
|
81
83
|
});
|
|
82
84
|
},
|
|
@@ -89,10 +91,12 @@ export const useCreateTemplate = (params) => {
|
|
|
89
91
|
return useMutation({
|
|
90
92
|
mutationFn: objectTemplate.create,
|
|
91
93
|
onSettled() {
|
|
92
|
-
queryClient.invalidateQueries(
|
|
94
|
+
queryClient.invalidateQueries({
|
|
95
|
+
queryKey: [QUERY_KEYS.GET_OBJECT_TEMPLATE_LIST],
|
|
93
96
|
exact: false,
|
|
94
97
|
});
|
|
95
|
-
queryClient.invalidateQueries(
|
|
98
|
+
queryClient.invalidateQueries({
|
|
99
|
+
queryKey: [QUERY_KEYS.GET_TEMPLATE_CATEGORY_LIST],
|
|
96
100
|
exact: false,
|
|
97
101
|
});
|
|
98
102
|
},
|
|
@@ -105,10 +109,12 @@ export const useUpdateTemplate = (params) => {
|
|
|
105
109
|
return useMutation({
|
|
106
110
|
mutationFn: objectTemplate.update,
|
|
107
111
|
onSettled() {
|
|
108
|
-
queryClient.invalidateQueries(
|
|
112
|
+
queryClient.invalidateQueries({
|
|
113
|
+
queryKey: [QUERY_KEYS.GET_OBJECT_TEMPLATE_LIST],
|
|
109
114
|
exact: false,
|
|
110
115
|
});
|
|
111
|
-
queryClient.invalidateQueries(
|
|
116
|
+
queryClient.invalidateQueries({
|
|
117
|
+
queryKey: [QUERY_KEYS.GET_TEMPLATE_CATEGORY_LIST],
|
|
112
118
|
exact: false,
|
|
113
119
|
});
|
|
114
120
|
},
|
|
@@ -130,11 +136,19 @@ export const usePersistTemplate = (params) => {
|
|
|
130
136
|
}
|
|
131
137
|
},
|
|
132
138
|
onSettled(data, error, variables) {
|
|
133
|
-
queryClient.invalidateQueries(
|
|
134
|
-
|
|
139
|
+
queryClient.invalidateQueries({
|
|
140
|
+
queryKey: [
|
|
141
|
+
QUERY_KEYS.GET_OBJECT_TEMPLATE_DETAIL,
|
|
142
|
+
+get(variables, 'params.data.template_id', -1),
|
|
143
|
+
],
|
|
144
|
+
exact: true,
|
|
145
|
+
});
|
|
146
|
+
queryClient.invalidateQueries({
|
|
147
|
+
queryKey: [QUERY_KEYS.GET_OBJECT_TEMPLATE_LIST],
|
|
135
148
|
exact: false,
|
|
136
149
|
});
|
|
137
|
-
queryClient.invalidateQueries(
|
|
150
|
+
queryClient.invalidateQueries({
|
|
151
|
+
queryKey: [QUERY_KEYS.GET_TEMPLATE_CATEGORY_LIST],
|
|
138
152
|
exact: false,
|
|
139
153
|
});
|
|
140
154
|
},
|
|
@@ -10,5 +10,5 @@ type GetDataTableBOProps<T> = {
|
|
|
10
10
|
eventActionId: number;
|
|
11
11
|
options?: Omit<UseQueryOptions<any, any, T, any[]>, OptionHasDefault>;
|
|
12
12
|
};
|
|
13
|
-
export declare const useGetEventTrackingAttributes: <T = EventTrackingAttribute>(props: GetDataTableBOProps<T>) => import("@tanstack/react-query").UseQueryResult<T
|
|
13
|
+
export declare const useGetEventTrackingAttributes: <T = EventTrackingAttribute>(props: GetDataTableBOProps<T>) => import("@tanstack/react-query").UseQueryResult<NoInfer<T>, any>;
|
|
14
14
|
export {};
|
|
@@ -6,5 +6,5 @@ type GetDataTableBOProps<T> = {
|
|
|
6
6
|
serviceAuth: TServiceAuth;
|
|
7
7
|
options?: Omit<UseQueryOptions<any, any, T, any[]>, OptionHasDefault>;
|
|
8
8
|
};
|
|
9
|
-
export declare const useGetListFallbackBO: <T = FallbackBO[]>(props: GetDataTableBOProps<T>) => import("@tanstack/react-query").UseQueryResult<T
|
|
9
|
+
export declare const useGetListFallbackBO: <T = FallbackBO[]>(props: GetDataTableBOProps<T>) => import("@tanstack/react-query").UseQueryResult<NoInfer<T>, any>;
|
|
10
10
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useStoreSavedMedia: (domain: string, slug: string, infos: any) => import("@tanstack/react-query").UseInfiniteQueryResult<import("../../models/SavedMedia").SavedMedia[], unknown>;
|
|
1
|
+
export declare const useStoreSavedMedia: (domain: string, slug: string, infos: any) => import("@tanstack/react-query").UseInfiniteQueryResult<import("@tanstack/react-query").InfiniteData<import("../../models/SavedMedia").SavedMedia[], unknown>, Error>;
|
|
@@ -7,6 +7,7 @@ import { QUERY_KEYS } from '../../constants';
|
|
|
7
7
|
// Hook to fetch data with infinite scrolling
|
|
8
8
|
export const useStoreSavedMedia = (domain, slug, infos) => useInfiniteQuery({
|
|
9
9
|
queryKey: [QUERY_KEYS.GET_LIST_SAVED_MEDIA, domain, slug, infos],
|
|
10
|
+
initialPageParam: 1,
|
|
10
11
|
queryFn: ({ pageParam }) => getListingSavedMedia(domain, slug, infos, pageParam),
|
|
11
12
|
getNextPageParam: (lastPage, pages) => (lastPage.length >= 10 ? pages.length + 1 : undefined),
|
|
12
13
|
});
|
|
@@ -2,7 +2,7 @@ import { UseQueryOptions } from '@tanstack/react-query';
|
|
|
2
2
|
import { TGetUnsubscribeListArgs, TUnsubscribePayloadInfo } from '../../services/Unsubscribe';
|
|
3
3
|
interface UseGetUnsubscribeListProps {
|
|
4
4
|
args: TGetUnsubscribeListArgs;
|
|
5
|
-
options?: UseQueryOptions<any, Error, any>;
|
|
5
|
+
options?: Omit<UseQueryOptions<any, Error, any>, 'queryKey' | 'queryFn'>;
|
|
6
6
|
}
|
|
7
7
|
export declare const useGetUnsubscribeList: ({ args, options }: UseGetUnsubscribeListProps, infos: TUnsubscribePayloadInfo) => import("@tanstack/react-query").UseQueryResult<any, Error>;
|
|
8
8
|
export {};
|
|
@@ -7,8 +7,8 @@ import { unsubscribeServices, } from '../../services/Unsubscribe';
|
|
|
7
7
|
import { QUERY_KEYS } from '../../constants';
|
|
8
8
|
export const useGetUnsubscribeList = ({ args, options }, infos) => useQuery({
|
|
9
9
|
queryKey: [QUERY_KEYS.GET_UNSUBSCRIBE_LIST, args, options, infos],
|
|
10
|
-
queryFn: async () =>
|
|
11
|
-
|
|
10
|
+
queryFn: async () => {
|
|
11
|
+
const data = await unsubscribeServices.getUnsubscribeList(args, infos);
|
|
12
12
|
if (!data)
|
|
13
13
|
return [];
|
|
14
14
|
const unsubscribedList = data?.entries[0] || [];
|
|
@@ -2,7 +2,7 @@ import { UseQueryOptions } from '@tanstack/react-query';
|
|
|
2
2
|
import { TGetUnsubscribeListByIdentifierArgs, TUnsubscribePayloadInfo } from '../../services/Unsubscribe';
|
|
3
3
|
interface UseGetUnsubscribeListByIdentifierProps {
|
|
4
4
|
args: TGetUnsubscribeListByIdentifierArgs;
|
|
5
|
-
options?: UseQueryOptions<any, Error, any>;
|
|
5
|
+
options?: Omit<UseQueryOptions<any, Error, any>, 'queryKey' | 'queryFn'>;
|
|
6
6
|
}
|
|
7
7
|
export declare const useGetUnsubscribeListByIdentifier: ({ args, options }: UseGetUnsubscribeListByIdentifierProps, infos: TUnsubscribePayloadInfo) => import("@tanstack/react-query").UseQueryResult<any, Error>;
|
|
8
8
|
export {};
|
|
@@ -2,7 +2,7 @@ import { UseQueryOptions } from '@tanstack/react-query';
|
|
|
2
2
|
import { TGetUnsubscribeListPermissionArgs, TUnsubscribePayloadInfo } from '../../services/Unsubscribe';
|
|
3
3
|
interface UseGetUnsubscribeListPermissionProps {
|
|
4
4
|
args: TGetUnsubscribeListPermissionArgs;
|
|
5
|
-
options?: UseQueryOptions<any, Error, any>;
|
|
5
|
+
options?: Omit<UseQueryOptions<any, Error, any>, 'queryKey' | 'queryFn'>;
|
|
6
6
|
}
|
|
7
7
|
export declare const useGetUnsubscribeListPermission: ({ args, options }: UseGetUnsubscribeListPermissionProps, infos: TUnsubscribePayloadInfo) => import("@tanstack/react-query").UseQueryResult<any, Error>;
|
|
8
8
|
export {};
|
|
@@ -6,8 +6,8 @@ import { unsubscribeServices, } from '../../services/Unsubscribe';
|
|
|
6
6
|
import { QUERY_KEYS } from '../../constants';
|
|
7
7
|
export const useGetUnsubscribeListPermission = ({ args, options }, infos) => useQuery({
|
|
8
8
|
queryKey: [QUERY_KEYS.GET_UNSUBSCRIBE_LIST_PERMISSION, args, options, infos],
|
|
9
|
-
queryFn: async () =>
|
|
10
|
-
|
|
9
|
+
queryFn: async () => {
|
|
10
|
+
const data = await unsubscribeServices.getUnsubscribeListPermission(args, infos);
|
|
11
11
|
if (!data)
|
|
12
12
|
return [];
|
|
13
13
|
const unsubscribedList = data?.entries[0] || [];
|
|
@@ -2,7 +2,7 @@ import { UseQueryOptions } from '@tanstack/react-query';
|
|
|
2
2
|
import { GetUnsubscribePreferencesArgs, TUnsubscribePayloadInfo } from '../../services/Unsubscribe';
|
|
3
3
|
interface UseGetUnsubscribePreferencesProps {
|
|
4
4
|
args: GetUnsubscribePreferencesArgs;
|
|
5
|
-
options?: UseQueryOptions<any, Error, any>;
|
|
5
|
+
options?: Omit<UseQueryOptions<any, Error, any>, 'queryKey' | 'queryFn'>;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* React Query hook to get unsubscribe preferences by given identifier
|
|
@@ -5,4 +5,4 @@ export type TUseGetLoggedUser = {
|
|
|
5
5
|
args: TGetLoggedUserArgs;
|
|
6
6
|
options?: UseQueryOptions<LoggedUser, any, LoggedUser, any[]>;
|
|
7
7
|
};
|
|
8
|
-
export declare const useGetLoggedUser: (params: TUseGetLoggedUser) => import("@tanstack/react-query").UseQueryResult<LoggedUser
|
|
8
|
+
export declare const useGetLoggedUser: (params: TUseGetLoggedUser) => import("@tanstack/react-query").UseQueryResult<NoInfer<LoggedUser>, any>;
|
package/es/queries/User/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
1
2
|
import { useQuery } from '@tanstack/react-query';
|
|
2
3
|
import i18next from '@antscorp/antsomi-ui/es/locales/i18n';
|
|
3
4
|
// Services
|
|
@@ -6,15 +7,18 @@ import { PORTAL_KEYS, QUERY_KEYS } from '../../constants';
|
|
|
6
7
|
import { UserAndPortalDefaultConfig } from '../../utils/portal';
|
|
7
8
|
export const useGetLoggedUser = (params) => {
|
|
8
9
|
const { args, options } = params;
|
|
9
|
-
|
|
10
|
+
const query = useQuery({
|
|
10
11
|
queryKey: [QUERY_KEYS.GET_LOGGED_USER, args],
|
|
11
12
|
queryFn: () => userServices.getLoggedUser(args),
|
|
12
|
-
onSuccess(data) {
|
|
13
|
-
UserAndPortalDefaultConfig.setPartial({
|
|
14
|
-
[PORTAL_KEYS.USER_LANGUAGE]: data.language,
|
|
15
|
-
});
|
|
16
|
-
i18next.changeLanguage(`${data.language || 'en'}`.toLowerCase());
|
|
17
|
-
},
|
|
18
13
|
...options,
|
|
19
14
|
});
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (query.data) {
|
|
17
|
+
UserAndPortalDefaultConfig.setPartial({
|
|
18
|
+
[PORTAL_KEYS.USER_LANGUAGE]: query.data.language,
|
|
19
|
+
});
|
|
20
|
+
i18next.changeLanguage(`${query.data.language || 'en'}`.toLowerCase());
|
|
21
|
+
}
|
|
22
|
+
}, [query.data]);
|
|
23
|
+
return query;
|
|
20
24
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
1
2
|
import { useQuery } from '@tanstack/react-query';
|
|
2
3
|
import { getUserInfo } from '../../services/User';
|
|
3
4
|
import { UserAndPortalDefaultConfig } from '../../utils/portal';
|
|
@@ -19,10 +20,12 @@ export const useGetUserInfo = (appConfig) => {
|
|
|
19
20
|
enabled,
|
|
20
21
|
queryKey,
|
|
21
22
|
queryFn: () => getUserInfo(getUserInfoParams),
|
|
22
|
-
onSuccess: data => {
|
|
23
|
-
UserAndPortalDefaultConfig.set(data.portal, data.user);
|
|
24
|
-
},
|
|
25
23
|
});
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (query.data) {
|
|
26
|
+
UserAndPortalDefaultConfig.set(query.data.portal, query.data.user);
|
|
27
|
+
}
|
|
28
|
+
}, [query.data]);
|
|
26
29
|
return {
|
|
27
30
|
data: query.data,
|
|
28
31
|
isLoading: query.isFetching,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antscorp/antsomi-ui",
|
|
3
|
-
"version": "1.3.7-beta.
|
|
3
|
+
"version": "1.3.7-beta.55",
|
|
4
4
|
"description": "An enterprise-class UI design language and React UI library.",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"dist/*",
|
|
@@ -77,8 +77,8 @@
|
|
|
77
77
|
"@fortawesome/free-solid-svg-icons": "6.1.1",
|
|
78
78
|
"@fortawesome/react-fontawesome": "0.2.0",
|
|
79
79
|
"@swiper/core": "^0.0.21",
|
|
80
|
-
"@tanstack/react-query": "
|
|
81
|
-
"@tanstack/react-query-devtools": "
|
|
80
|
+
"@tanstack/react-query": "^5",
|
|
81
|
+
"@tanstack/react-query-devtools": "^5",
|
|
82
82
|
"@tanstack/react-table": "^8.20.5",
|
|
83
83
|
"@tinymce/tinymce-react": "^3.7.0",
|
|
84
84
|
"@tiptap/core": "3.10.2",
|