@antscorp/antsomi-ui 1.3.7-beta.53 → 1.3.7-beta.54

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.
Files changed (51) hide show
  1. package/es/components/molecules/AddDynamicContent/AddDynamicContent.js +123 -114
  2. package/es/components/molecules/SelectAccount/hook/useGetAbstractUsers.d.ts +2 -2
  3. package/es/components/molecules/TemplateSaveAs/hooks/useTemplateSave.d.ts +2 -2
  4. package/es/components/molecules/UploadImage/index.js +3 -2
  5. package/es/components/organism/ContentSources/Settings.js +40 -41
  6. package/es/components/organism/DataTable/hooks/useDataTableListing/useDataTableListing.js +7 -5
  7. package/es/components/organism/Help/queries/useGetListUser.js +4 -1
  8. package/es/components/organism/LeftMenu/components/HomeMenu/useHomeMenu.js +1 -1
  9. package/es/components/organism/LeftMenu/hooks/usePermission.d.ts +1 -1
  10. package/es/components/organism/TicketEditorV2/queries/useFetchAccountPermission.js +4 -1
  11. package/es/components/organism/TicketEditorV2/queries/useGetDetailTicket.d.ts +1 -1
  12. package/es/components/organism/TicketEditorV2/queries/useGetListComments.d.ts +1 -1
  13. package/es/components/organism/TicketEditorV2/queries/useGetListUser.js +4 -1
  14. package/es/components/template/TemplateListing/hooks/useTemplateListing.d.ts +2 -3
  15. package/es/providers/ConfigProvider/ConfigProvider.js +1 -1
  16. package/es/queries/AI/index.d.ts +3 -3
  17. package/es/queries/AI/useSqlGeneration.d.ts +3 -3
  18. package/es/queries/AI/useSqlGeneration.js +2 -2
  19. package/es/queries/Account/useGetAccountList.d.ts +3 -3
  20. package/es/queries/Account/useGetAccountList.js +2 -1
  21. package/es/queries/BusinessObject/useGetBODetail.d.ts +1 -1
  22. package/es/queries/BusinessObject/useGetListAllEvents.d.ts +1 -1
  23. package/es/queries/BusinessObject/useGetListBO.d.ts +1 -1
  24. package/es/queries/BusinessObject/useGetListEventAttr.d.ts +1 -1
  25. package/es/queries/BusinessObject/useGetListPromotionCodeAttr.d.ts +1 -1
  26. package/es/queries/BusinessObject/useGetListSourceByEvent.d.ts +1 -1
  27. package/es/queries/CustomFunction/useCustomFunction.d.ts +3 -3
  28. package/es/queries/CustomFunction/useCustomFunction.js +8 -4
  29. package/es/queries/DataTable/index.d.ts +25 -25
  30. package/es/queries/DataTable/index.js +26 -19
  31. package/es/queries/DynamicContentAttribute/useGetDynamicContentAttr.d.ts +1 -1
  32. package/es/queries/LeftMenu/index.d.ts +9 -9
  33. package/es/queries/LeftMenu/index.js +4 -6
  34. package/es/queries/Permission/index.d.ts +2 -2
  35. package/es/queries/PromotionPool/useGetListPromotionPool.d.ts +1 -1
  36. package/es/queries/TemplateListing/index.d.ts +5 -5
  37. package/es/queries/TemplateListing/index.js +28 -14
  38. package/es/queries/ThirdParty/useGetEventTrackingAttributes.d.ts +1 -1
  39. package/es/queries/ThirdParty/useGetListFallbackBO.d.ts +1 -1
  40. package/es/queries/ThirdParty/useStoreSavedMedia.d.ts +1 -1
  41. package/es/queries/ThirdParty/useStoreSavedMedia.js +1 -0
  42. package/es/queries/Unsubscribe/useGetUnsubscribeList.d.ts +1 -1
  43. package/es/queries/Unsubscribe/useGetUnsubscribeList.js +2 -2
  44. package/es/queries/Unsubscribe/useGetUnsubscribeListByIdentifier.d.ts +1 -1
  45. package/es/queries/Unsubscribe/useGetUnsubscribeListPermission.d.ts +1 -1
  46. package/es/queries/Unsubscribe/useGetUnsubscribeListPermission.js +2 -2
  47. package/es/queries/Unsubscribe/useGetUnsubscribePreferences.d.ts +1 -1
  48. package/es/queries/User/index.d.ts +1 -1
  49. package/es/queries/User/index.js +11 -7
  50. package/es/queries/User/userGetUserInfo.js +6 -3
  51. package/package.json +3 -3
@@ -123,60 +123,16 @@ export const AddDynamicContent = props => {
123
123
  // Template Custom
124
124
  const [templateId, settemplateId] = useState();
125
125
  const queryClient = useQueryClient();
126
- const { data: listBoAttributes = [], isFetching: isFetchingListBoAttr, isError: isErrorBoAttr, } = useGetListAttributeBO({
126
+ const { data: listBoAttributes = [], isFetching: isFetchingListBoAttr, isError: isErrorBoAttr, error: listBoAttributesError, } = useGetListAttributeBO({
127
127
  url,
128
128
  itemTypeIds: itemTypeId ? [itemTypeId] : [],
129
129
  options: {
130
- onSuccess: (data) => {
131
- setHasError({
132
- [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: false,
133
- [DYNAMIC_CONTENT_SETTING_KEY.INDEX]: false,
134
- });
135
- if (data.length &&
136
- selectedDynamicContentType &&
137
- regexCSType.test(selectedDynamicContentType)) {
138
- if (form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE) &&
139
- form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.INDEX))
140
- return;
141
- form.setFieldsValue({
142
- [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: data[0],
143
- [DYNAMIC_CONTENT_SETTING_KEY.INDEX]: defaultDynamicIndex,
144
- });
145
- }
146
- },
147
130
  select: (data) => serilizeBOAttr(data, additionalAttrProperties),
148
- onError: (error) => {
149
- setHasError({
150
- [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: true,
151
- [DYNAMIC_CONTENT_SETTING_KEY.INDEX]: true,
152
- });
153
- handleError(error, {
154
- path: PATH,
155
- name: 'useGetListAttributeBO',
156
- args: error?.message,
157
- });
158
- },
159
131
  enabled: !!itemTypeId,
160
132
  },
161
133
  }, infos);
162
- const { data: dynamicContentAttr, isFetching: isFetchingDynamicContentAttr, isError: isErrorDynamicContentAttr, } = useGetDynamicContentAttr({ url }, infos, {
163
- onSuccess: () => {
164
- setHasError({
165
- [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: false,
166
- });
167
- },
168
- onError: (error) => {
169
- setHasError({
170
- [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: true,
171
- });
172
- handleError(error, {
173
- path: PATH,
174
- name: 'useGetDynamicContentAttr',
175
- args: error?.message,
176
- });
177
- },
178
- });
179
- const { data: listSources, isFetching: isFetchingSourceBO } = useGetListSourceByEvent({
134
+ const { data: dynamicContentAttr, isFetching: isFetchingDynamicContentAttr, isError: isErrorDynamicContentAttr, error: dynamicContentAttrError, } = useGetDynamicContentAttr({ url }, infos);
135
+ const { data: listSources, isFetching: isFetchingSourceBO, isError: isErrorListSources, error: listSourcesError, } = useGetListSourceByEvent({
180
136
  apiConfig: {
181
137
  url,
182
138
  },
@@ -184,9 +140,6 @@ export const AddDynamicContent = props => {
184
140
  eventActionId,
185
141
  eventCategoryId,
186
142
  options: {
187
- onSuccess: () => {
188
- setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.SOURCE]: false });
189
- },
190
143
  select: (data) => {
191
144
  const { rows } = data || {};
192
145
  return rows.map((row) => ({
@@ -194,39 +147,14 @@ export const AddDynamicContent = props => {
194
147
  value: row.value,
195
148
  }));
196
149
  },
197
- onError: (error) => {
198
- setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.SOURCE]: true });
199
- handleError(error, {
200
- path: PATH,
201
- name: 'useGetListSourceBO',
202
- args: error?.message,
203
- });
204
- },
205
150
  },
206
151
  });
207
- const { data: listEvents, isFetching: isFetchingEventBySource } = useGetListAllEvents({
152
+ const { data: listEvents, isFetching: isFetchingEventBySource, isError: isErrorListEvents, error: listEventsError, } = useGetListAllEvents({
208
153
  apiConfig: {
209
154
  url,
210
155
  },
211
156
  infos,
212
157
  options: {
213
- onSuccess: (data) => {
214
- setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.EVENT]: false });
215
- if (!isEmpty(data) &&
216
- selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
217
- form.setFieldsValue({
218
- [DYNAMIC_CONTENT_SETTING_KEY.EVENT]: data[0].value,
219
- });
220
- }
221
- },
222
- onError: (error) => {
223
- setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.EVENT]: true });
224
- handleError(error, {
225
- path: PATH,
226
- name: 'useGetListEventBySource',
227
- args: error?.message,
228
- });
229
- },
230
158
  select: (data) => {
231
159
  const { rows = [] } = data || {};
232
160
  return rows.map((event) => ({
@@ -236,38 +164,13 @@ export const AddDynamicContent = props => {
236
164
  },
237
165
  },
238
166
  });
239
- const { data: listEventAttributes, isFetching: isFetchingEventAttr, isError: isErrorEventAttr, } = useGetListEventAttr({ url }, infos, selectedEventSource || '', Array.isArray(selectedSource) ? selectedSource.join(',') : selectedSource || '', {
240
- onSuccess: () => setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: false }),
241
- onError: (error) => {
242
- setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: true });
243
- handleError(error, {
244
- path: PATH,
245
- name: 'useGetListEventAttr',
246
- args: error?.message,
247
- });
248
- },
167
+ const { data: listEventAttributes, isFetching: isFetchingEventAttr, isError: isErrorEventAttr, error: listEventAttributesError, } = useGetListEventAttr({ url }, infos, selectedEventSource || '', Array.isArray(selectedSource) ? selectedSource.join(',') : selectedSource || '', {
249
168
  select: (data) => serilizeEventAttr(data, language, additionalAttrProperties),
250
169
  });
251
- const { data: listPromotionPools, isFetching: isFetchingPromotionPool } = useGetListPromotionPool({ url }, infos, {
252
- onSuccess: () => {
253
- setHasError({
254
- [DYNAMIC_CONTENT_SETTING_KEY.PROMOTION_POOL]: false,
255
- });
256
- },
170
+ const { data: listPromotionPools, isFetching: isFetchingPromotionPool, isError: isErrorListPromotionPools, error: listPromotionPoolsError, } = useGetListPromotionPool({ url }, infos, {
257
171
  select: (data) => serilizePromotionPool(data, additionalAttrProperties),
258
- onError: (error) => {
259
- setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: true });
260
- handleError(error, {
261
- path: PATH,
262
- name: 'useGetListPromotionPool',
263
- args: error?.message,
264
- });
265
- },
266
172
  });
267
- const { data: listPromotionCodeAttributes, isFetching: isFetchingPromotionCodeAttr, isError: isErrorListPromotionCodeAttr, } = useGetListPromotionCodeAttr({ url }, infos, {
268
- onSuccess: () => {
269
- setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: false });
270
- },
173
+ const { data: listPromotionCodeAttributes, isFetching: isFetchingPromotionCodeAttr, isError: isErrorListPromotionCodeAttr, error: listPromotionCodeAttributesError, } = useGetListPromotionCodeAttr({ url }, infos, {
271
174
  select: (data) => data
272
175
  .filter((attr) => +attr?.status === 1)
273
176
  .map((attr) => ({
@@ -278,16 +181,6 @@ export const AddDynamicContent = props => {
278
181
  disabled: parseInt(attr.status) === 4,
279
182
  status: attr.status,
280
183
  })),
281
- onError: (error) => {
282
- setHasError({
283
- [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: true,
284
- });
285
- handleError(error, {
286
- path: PATH,
287
- name: 'useGetPromotionCodeAttr',
288
- args: error?.message,
289
- });
290
- },
291
184
  });
292
185
  const { data: eventTrackingAttributes } = useGetEventTrackingAttributes({
293
186
  apiConfig: { url },
@@ -295,6 +188,122 @@ export const AddDynamicContent = props => {
295
188
  eventActionId,
296
189
  eventCategoryId,
297
190
  });
191
+ // Handle success/error side effects (TanStack Query v5 removed onSuccess/onError on useQuery)
192
+ useEffect(() => {
193
+ if (isErrorBoAttr) {
194
+ setHasError({
195
+ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: true,
196
+ [DYNAMIC_CONTENT_SETTING_KEY.INDEX]: true,
197
+ });
198
+ handleError(listBoAttributesError, {
199
+ path: PATH,
200
+ name: 'useGetListAttributeBO',
201
+ args: listBoAttributesError?.message,
202
+ });
203
+ return;
204
+ }
205
+ if (listBoAttributes) {
206
+ setHasError({
207
+ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: false,
208
+ [DYNAMIC_CONTENT_SETTING_KEY.INDEX]: false,
209
+ });
210
+ if (listBoAttributes.length &&
211
+ selectedDynamicContentType &&
212
+ regexCSType.test(selectedDynamicContentType)) {
213
+ if (form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE) &&
214
+ form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.INDEX))
215
+ return;
216
+ form.setFieldsValue({
217
+ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: listBoAttributes[0],
218
+ [DYNAMIC_CONTENT_SETTING_KEY.INDEX]: defaultDynamicIndex,
219
+ });
220
+ }
221
+ }
222
+ }, [listBoAttributes, isErrorBoAttr, selectedDynamicContentType, defaultDynamicIndex]);
223
+ useEffect(() => {
224
+ if (isErrorDynamicContentAttr) {
225
+ setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: true });
226
+ handleError(dynamicContentAttrError, {
227
+ path: PATH,
228
+ name: 'useGetDynamicContentAttr',
229
+ args: dynamicContentAttrError?.message,
230
+ });
231
+ }
232
+ else if (dynamicContentAttr) {
233
+ setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: false });
234
+ }
235
+ }, [dynamicContentAttr, isErrorDynamicContentAttr]);
236
+ useEffect(() => {
237
+ if (isErrorListSources) {
238
+ setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.SOURCE]: true });
239
+ handleError(listSourcesError, {
240
+ path: PATH,
241
+ name: 'useGetListSourceBO',
242
+ args: listSourcesError?.message,
243
+ });
244
+ }
245
+ else if (listSources) {
246
+ setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.SOURCE]: false });
247
+ }
248
+ }, [listSources, isErrorListSources]);
249
+ useEffect(() => {
250
+ if (isErrorListEvents) {
251
+ setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.EVENT]: true });
252
+ handleError(listEventsError, {
253
+ path: PATH,
254
+ name: 'useGetListEventBySource',
255
+ args: listEventsError?.message,
256
+ });
257
+ return;
258
+ }
259
+ if (listEvents &&
260
+ !isEmpty(listEvents) &&
261
+ selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
262
+ setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.EVENT]: false });
263
+ form.setFieldsValue({
264
+ [DYNAMIC_CONTENT_SETTING_KEY.EVENT]: listEvents[0].value,
265
+ });
266
+ }
267
+ }, [listEvents, isErrorListEvents, selectedDynamicContentType]);
268
+ useEffect(() => {
269
+ if (isErrorEventAttr) {
270
+ setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: true });
271
+ handleError(listEventAttributesError, {
272
+ path: PATH,
273
+ name: 'useGetListEventAttr',
274
+ args: listEventAttributesError?.message,
275
+ });
276
+ }
277
+ else if (listEventAttributes) {
278
+ setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: false });
279
+ }
280
+ }, [listEventAttributes, isErrorEventAttr]);
281
+ useEffect(() => {
282
+ if (isErrorListPromotionPools) {
283
+ setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: true });
284
+ handleError(listPromotionPoolsError, {
285
+ path: PATH,
286
+ name: 'useGetListPromotionPool',
287
+ args: listPromotionPoolsError?.message,
288
+ });
289
+ }
290
+ else if (listPromotionPools) {
291
+ setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.PROMOTION_POOL]: false });
292
+ }
293
+ }, [listPromotionPools, isErrorListPromotionPools]);
294
+ useEffect(() => {
295
+ if (isErrorListPromotionCodeAttr) {
296
+ setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: true });
297
+ handleError(listPromotionCodeAttributesError, {
298
+ path: PATH,
299
+ name: 'useGetPromotionCodeAttr',
300
+ args: listPromotionCodeAttributesError?.message,
301
+ });
302
+ }
303
+ else if (listPromotionCodeAttributes) {
304
+ setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: false });
305
+ }
306
+ }, [listPromotionCodeAttributes, isErrorListPromotionCodeAttr]);
298
307
  // Memo
299
308
  const isShowEventIndexField = useDeepCompareMemo(() => {
300
309
  if (selectedAttr && selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
@@ -1,11 +1,11 @@
1
1
  import { UseQueryOptions } from '@tanstack/react-query';
2
2
  type Props = {
3
- queryOptions?: UseQueryOptions;
3
+ queryOptions?: Omit<UseQueryOptions, 'queryKey' | 'queryFn'>;
4
4
  params?: Record<string, any>;
5
5
  search?: string;
6
6
  queryFn?: Function;
7
7
  enabled?: boolean;
8
8
  defaultDataSource?: any;
9
9
  };
10
- export declare const useGetAbstractUsers: ({ queryOptions, params, search, queryFn, }: Props) => import("@tanstack/react-query").UseQueryResult<unknown, unknown>;
10
+ export declare const useGetAbstractUsers: ({ queryOptions, params, search, queryFn, }: Props) => import("@tanstack/react-query").UseQueryResult<unknown, Error>;
11
11
  export {};
@@ -65,8 +65,8 @@ export declare const useTemplateSave: (options: TemplateListingOptions) => {
65
65
  };
66
66
  form: import("antd").FormInstance<FormValue>;
67
67
  errors: any[] | undefined;
68
- refetchCategoryList: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<TemplateCategory[], any>>;
69
- refetchTemplateList: <TPageData_1>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData_1>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<any>, any>>;
68
+ refetchCategoryList: (options?: import("@tanstack/react-query").RefetchOptions | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<TemplateCategory[]>, any>>;
69
+ refetchTemplateList: (options?: import("@tanstack/react-query").RefetchOptions | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<any, any>>;
70
70
  onLoadMore: () => void;
71
71
  onChange: (newValue: Partial<TemplateValueOptions>) => void;
72
72
  };
@@ -134,7 +134,8 @@ export const UploadImage = props => {
134
134
  if (res && res.data && res.data.code === 200 && res.data.data) {
135
135
  const { success_media = [] } = res.data.data;
136
136
  if (Array.isArray(success_media) && success_media.length) {
137
- queryClient.invalidateQueries([QUERY_KEYS.GET_LIST_SAVED_MEDIA, domainMedia, slug, paramsMemo], {
137
+ queryClient.invalidateQueries({
138
+ queryKey: [QUERY_KEYS.GET_LIST_SAVED_MEDIA, domainMedia, slug, paramsMemo],
138
139
  exact: false,
139
140
  });
140
141
  }
@@ -210,7 +211,7 @@ export const UploadImage = props => {
210
211
  })));
211
212
  await Promise.all(arrPromise);
212
213
  setLoading(false);
213
- refetch({ refetchPage: (_page, index) => index === 0 });
214
+ refetch();
214
215
  }
215
216
  else {
216
217
  setLoading(false);
@@ -45,50 +45,49 @@ const Settings = (props) => {
45
45
  token,
46
46
  userId,
47
47
  accountId,
48
- }, {
49
- onSuccess(data) {
50
- if (!isInitDataCDPDone &&
51
- (isCDP || justOneGroup) &&
52
- isArray(data) &&
53
- contentSources.groups.length === 1 &&
54
- contentSources.groups[0] &&
55
- !contentSources.groups[0].itemTypeId) {
56
- const BOProduct = data.find(bo => +bo.id === PRODUCT_ITEM_TYPE_ID) || {};
57
- const groupId = get(contentSources, 'groups[0].groupId', '');
58
- const itemTypeId = BOProduct?.id;
59
- const itemTypeDisplay = BOProduct?.label;
60
- const itemTypeName = BOProduct?.name;
61
- let valueRanking = GET_TOP_RANKING_DEFAULT;
62
- if (itemTypeId === PRODUCT_ITEM_TYPE_ID) {
63
- valueRanking = PRODUCT_RANKING_DEFAULT;
64
- if (isCDP || justOneGroup) {
65
- set(valueRanking, 'algorithms.sort', 'order');
66
- }
67
- }
68
- else if (itemTypeName === ITEM_TYPE_NAME.ARTICLE) {
69
- valueRanking = ARTICLE_RANKING_DEFAULT;
48
+ });
49
+ useEffect(() => {
50
+ if (listBO &&
51
+ !isInitDataCDPDone &&
52
+ (isCDP || justOneGroup) &&
53
+ isArray(listBO) &&
54
+ contentSources.groups.length === 1 &&
55
+ contentSources.groups[0] &&
56
+ !contentSources.groups[0].itemTypeId) {
57
+ const BOProduct = listBO.find(bo => +bo.id === PRODUCT_ITEM_TYPE_ID) || {};
58
+ const groupId = get(contentSources, 'groups[0].groupId', '');
59
+ const itemTypeId = BOProduct?.id;
60
+ const itemTypeDisplay = BOProduct?.label;
61
+ const itemTypeName = BOProduct?.name;
62
+ let valueRanking = GET_TOP_RANKING_DEFAULT;
63
+ if (itemTypeId === PRODUCT_ITEM_TYPE_ID) {
64
+ valueRanking = PRODUCT_RANKING_DEFAULT;
65
+ if (isCDP || justOneGroup) {
66
+ set(valueRanking, 'algorithms.sort', 'order');
70
67
  }
71
- const newRanking = valueRanking;
72
- if (groupId && itemTypeId) {
73
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
74
- contentSourceDispatch({
75
- type: 'SET_CONTENT_SOURCE_GROUP',
76
- payload: {
77
- groupId,
78
- values: {
79
- itemTypeId,
80
- itemTypeDisplay,
81
- itemTypeName,
82
- ranking: newRanking,
83
- filters: FILTERS_DEFAULT,
84
- },
68
+ }
69
+ else if (itemTypeName === ITEM_TYPE_NAME.ARTICLE) {
70
+ valueRanking = ARTICLE_RANKING_DEFAULT;
71
+ }
72
+ const newRanking = valueRanking;
73
+ if (groupId && itemTypeId) {
74
+ contentSourceDispatch({
75
+ type: 'SET_CONTENT_SOURCE_GROUP',
76
+ payload: {
77
+ groupId,
78
+ values: {
79
+ itemTypeId,
80
+ itemTypeDisplay,
81
+ itemTypeName,
82
+ ranking: newRanking,
83
+ filters: FILTERS_DEFAULT,
85
84
  },
86
- });
87
- setIsInitDataCDPDone(true);
88
- }
85
+ },
86
+ });
87
+ setIsInitDataCDPDone(true);
89
88
  }
90
- },
91
- });
89
+ }
90
+ }, [listBO, isInitDataCDPDone, isCDP, justOneGroup, contentSources.groups]);
92
91
  const { data: listFallbackBO } = useGetListFallbackBO({
93
92
  serviceAuth,
94
93
  });
@@ -4,7 +4,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  import { useCallback, useEffect, useMemo, useState } from 'react';
5
5
  import { Link } from 'react-router-dom';
6
6
  import { flatMap, isEmpty, pick, xor, groupBy as lodashGroupBy } from 'lodash';
7
- import { useQueryClient } from '@tanstack/react-query';
7
+ import { keepPreviousData, useQueryClient } from '@tanstack/react-query';
8
8
  // Types
9
9
  import { useAppConfigContext } from '@antscorp/antsomi-ui/es/providers';
10
10
  // Components
@@ -181,7 +181,8 @@ export function useDataTableListing(props) {
181
181
  },
182
182
  options: {
183
183
  enabled: isEnabledFetchMatchesAny,
184
- keepPreviousData: true,
184
+ initialPageParam: 1,
185
+ placeholderData: keepPreviousData,
185
186
  retry: false,
186
187
  getNextPageParam(lastPage, allPages) {
187
188
  // Extract the total number of items from the last fetched page
@@ -225,7 +226,7 @@ export function useDataTableListing(props) {
225
226
  },
226
227
  options: {
227
228
  queryKey: [name],
228
- keepPreviousData: true,
229
+ placeholderData: keepPreviousData,
229
230
  enabled: !!listingAuth?.url && !!listingAuth?.token && enabledApiListing,
230
231
  ...queryOptions?.getTableListing,
231
232
  },
@@ -239,7 +240,7 @@ export function useDataTableListing(props) {
239
240
  request: restOfApiSearchRequest,
240
241
  },
241
242
  options: {
242
- keepPreviousData: true,
243
+ placeholderData: keepPreviousData,
243
244
  enabled: !!searchAuth?.url && !!searchAuth?.token && enabledApiSearch,
244
245
  ...queryOptions?.getSearchListing,
245
246
  },
@@ -848,7 +849,8 @@ export function useDataTableListing(props) {
848
849
  }, [mainColumnKey, tableData]);
849
850
  /** Refetch */
850
851
  const refetchTableListing = useCallback(() => {
851
- queryClient.invalidateQueries([QUERY_KEYS.GET_DATA_TABLE_LISTING, name], {
852
+ queryClient.invalidateQueries({
853
+ queryKey: [QUERY_KEYS.GET_DATA_TABLE_LISTING, name],
852
854
  exact: false,
853
855
  });
854
856
  }, [name, queryClient]);
@@ -6,7 +6,10 @@ const getListUserServices = async (params = {}, domain, token, config, userId) =
6
6
  return res.data;
7
7
  };
8
8
  export const useGetListUser = ({ domain, config, userId, token }) => {
9
- const { data, isFetching } = useQuery([QUERY_KEY, domain, token, config, userId], () => getListUserServices({}, domain, token, config, userId));
9
+ const { data, isFetching } = useQuery({
10
+ queryKey: [QUERY_KEY, domain, token, config, userId],
11
+ queryFn: () => getListUserServices({}, domain, token, config, userId),
12
+ });
10
13
  return {
11
14
  listUsers: data || [],
12
15
  isFetchingUsers: isFetching,
@@ -35,7 +35,7 @@ export const useHomeMenu = (props) => {
35
35
  const dashboardMenu = flattenMenuPermission.find(menu => menu.menu_code === MENU_CODE.DASHBOARD);
36
36
  return !!dashboardMenu && dashboardMenu.selected_edit !== MENU_PERMISSION.NONE;
37
37
  }, [flattenMenuPermission]);
38
- const { mutateAsync: removeDashboard, isLoading: isDashboardRemoving } = useRemoveDashboard();
38
+ const { mutateAsync: removeDashboard, isPending: isDashboardRemoving } = useRemoveDashboard();
39
39
  const onOptionCallback = useCallback((args) => {
40
40
  const { optionKey, menuItemKey } = args;
41
41
  switch (optionKey) {
@@ -2,6 +2,6 @@ export declare const usePermission: () => {
2
2
  mappingChildrenMenu: import("@antscorp/antsomi-ui/es/models/LeftMenu").TFeatureMenu[];
3
3
  permissionMenu: import("@antscorp/antsomi-ui/es/models/LeftMenu").TFeatureMenu[];
4
4
  activeItemPath: import("@antscorp/antsomi-ui/es/models/LeftMenu").TFeatureMenu[];
5
- menuListPermission: import("@antscorp/antsomi-ui/es/models/LeftMenu").FeatureMenuPermission[] | undefined;
5
+ menuListPermission: NoInfer<import("@antscorp/antsomi-ui/es/models/LeftMenu").FeatureMenuPermission[]> | undefined;
6
6
  flattenMenuPermission: import("@antscorp/antsomi-ui/es/models/LeftMenu").FeatureMenuPermission[];
7
7
  };
@@ -2,7 +2,10 @@ import { useQuery } from '@tanstack/react-query';
2
2
  import { QUERY_KEYS } from '../constants';
3
3
  import Service from '../Service';
4
4
  export const useFetchAccountPermission = ({ params, domainPermission, token, config, userId, ownerId, }) => {
5
- const { data, isFetching } = useQuery([QUERY_KEYS.GET_ACCOUNT_PERMISSION, domainPermission, token, config, userId, ownerId], () => Service.permission.callApi.getList(params, domainPermission, token, config, userId, 'list-menu', ownerId));
5
+ const { data, isFetching } = useQuery({
6
+ queryKey: [QUERY_KEYS.GET_ACCOUNT_PERMISSION, domainPermission, token, config, userId, ownerId],
7
+ queryFn: () => Service.permission.callApi.getList(params, domainPermission, token, config, userId, 'list-menu', ownerId),
8
+ });
6
9
  if (data?.code === 200) {
7
10
  return {
8
11
  accountEdit: data?.data[0]?.selected_edit,
@@ -8,6 +8,6 @@ type Props = {
8
8
  export declare const useGetDetailTicket: ({ domainTicket, config, userId, ticketId, networkId, }: Props) => {
9
9
  ticketDetails: any;
10
10
  isFetching: boolean;
11
- refetchTicket: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<any, unknown>>;
11
+ refetchTicket: (options?: import("@tanstack/react-query").RefetchOptions | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<any, Error>>;
12
12
  };
13
13
  export {};
@@ -9,6 +9,6 @@ type Props = {
9
9
  export declare const useGetListComments: ({ domainTicket, config, userId, ticketId, enabled, networkId, }: Props) => {
10
10
  listComments: any;
11
11
  isFetchingComments: boolean;
12
- refetchComments: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<any, unknown>>;
12
+ refetchComments: (options?: import("@tanstack/react-query").RefetchOptions | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<any, Error>>;
13
13
  };
14
14
  export {};
@@ -6,7 +6,10 @@ const getListUserServices = async (params = {}, domain, token, config, userId) =
6
6
  return res.data;
7
7
  };
8
8
  export const useGetListUser = ({ domainTicket, config, userId }) => {
9
- const { data, isFetching } = useQuery([QUERY_KEYS.GET_LIST_USER, domainTicket, '', config, userId], () => getListUserServices({}, domainTicket, '', config, userId));
9
+ const { data, isFetching } = useQuery({
10
+ queryKey: [QUERY_KEYS.GET_LIST_USER, domainTicket, '', config, userId],
11
+ queryFn: () => getListUserServices({}, domainTicket, '', config, userId),
12
+ });
10
13
  return {
11
14
  listUsers: data || [],
12
15
  isFetchingUsers: isFetching,
@@ -3,7 +3,6 @@ import { TServiceAuth } from '@antscorp/antsomi-ui/es/types';
3
3
  import { TCategoryItem, TCheckedCategories, TSelectTemplateAction, TTemplateItem } from '../types';
4
4
  import { TTemplateListingConfig } from '@antscorp/antsomi-ui/es/types/templateListing';
5
5
  import { TThumbnailCardId } from '../../../molecules/ThumbnailCard';
6
- import { InfiniteData } from '@tanstack/react-query';
7
6
  import { TemplateCategory } from '@antscorp/antsomi-ui/es/models/TemplateCategory';
8
7
  interface TemplateListingOptions {
9
8
  serviceAuth: TServiceAuth;
@@ -69,8 +68,8 @@ export declare const useTemplateListing: <T = undefined>(options: TemplateListin
69
68
  isLoadingCategoryList: boolean;
70
69
  isLoadingTemplateList: boolean;
71
70
  isLoadingTemplateDetail: boolean;
72
- refetchCategoryList: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<TemplateCategory[], any>>;
73
- refetchTemplateList: <TPageData_1>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData_1>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<InfiniteData<any>, any>>;
71
+ refetchCategoryList: (options?: import("@tanstack/react-query").RefetchOptions | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<TemplateCategory[]>, any>>;
72
+ refetchTemplateList: (options?: import("@tanstack/react-query").RefetchOptions | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<any, any>>;
74
73
  onChangeCheckedCategories: (checkedCategories: TCheckedCategories) => void;
75
74
  onChangeOpenCategoryKeys: (openKeys: string[]) => void;
76
75
  onRemoveObjectTemplate: (id: TThumbnailCardId) => void;
@@ -82,6 +82,6 @@ const ConfigProvider = props => {
82
82
  const containers = document.getElementsByClassName('antsomi-scroll-box');
83
83
  handleScrollAction(Array.from(containers));
84
84
  }, []);
85
- return (_jsx(AntdConfigProvider, { theme: theme, prefixCls: prefixCls, ...restOfProps, children: _jsx(AppConfigProvider, { value: appConfig, children: _jsx("div", { ref: ref, children: _jsxs(App, { children: [_jsx(GlobalStyle, {}), _jsx(StyleProvider, { hashPriority: "high", children: children }), _jsx(QueryDevtoolsAntsomiUI, { position: "bottom-right" })] }) }) }) }));
85
+ return (_jsx(AntdConfigProvider, { theme: theme, prefixCls: prefixCls, ...restOfProps, children: _jsx(AppConfigProvider, { value: appConfig, children: _jsx("div", { ref: ref, children: _jsxs(App, { children: [_jsx(GlobalStyle, {}), _jsx(StyleProvider, { hashPriority: "high", children: children }), _jsx(QueryDevtoolsAntsomiUI, { position: "bottom" })] }) }) }) }));
86
86
  };
87
87
  export default ConfigProvider;
@@ -9,15 +9,15 @@ export declare const AntsomiAIQueries: {
9
9
  refine_prompt: string;
10
10
  sql_suggestion: string;
11
11
  summary: string;
12
- }, unknown, Record<string, unknown>, unknown>;
12
+ }, Error, Record<string, unknown>, unknown>;
13
13
  generateSQLAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
14
14
  key: string;
15
15
  prompt: string;
16
16
  refine_prompt: string;
17
17
  sql_suggestion: string;
18
18
  summary: string;
19
- }, unknown, Record<string, unknown>, unknown>;
20
- isLoading: boolean;
19
+ }, Error, Record<string, unknown>, unknown>;
20
+ isPending: boolean;
21
21
  isError: boolean;
22
22
  };
23
23
  };
@@ -11,15 +11,15 @@ export declare const useSqlGeneration: (params: UseSqlGenerationParams) => {
11
11
  refine_prompt: string;
12
12
  sql_suggestion: string;
13
13
  summary: string;
14
- }, unknown, Record<string, unknown>, unknown>;
14
+ }, Error, Record<string, unknown>, unknown>;
15
15
  generateSQLAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
16
16
  key: string;
17
17
  prompt: string;
18
18
  refine_prompt: string;
19
19
  sql_suggestion: string;
20
20
  summary: string;
21
- }, unknown, Record<string, unknown>, unknown>;
22
- isLoading: boolean;
21
+ }, Error, Record<string, unknown>, unknown>;
22
+ isPending: boolean;
23
23
  isError: boolean;
24
24
  };
25
25
  export {};
@@ -2,12 +2,12 @@ import { useMutation } from '@tanstack/react-query';
2
2
  import { AIServices } from '../../services/AI';
3
3
  export const useSqlGeneration = (params) => {
4
4
  const { auth, env } = params;
5
- const { mutate: generateSQL, mutateAsync: generateSQLAsync, isLoading, isError, } = useMutation({
5
+ const { mutate: generateSQL, mutateAsync: generateSQLAsync, isPending, isError, } = useMutation({
6
6
  mutationFn: async (data) => AIServices.generateSQL({
7
7
  auth,
8
8
  data,
9
9
  env,
10
10
  }),
11
11
  });
12
- return { generateSQL, generateSQLAsync, isLoading, isError };
12
+ return { generateSQL, generateSQLAsync, isPending, isError };
13
13
  };