@antscorp/antsomi-ui 1.3.7-beta.57 → 1.3.7-beta.59
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 +114 -123
- 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 +2 -3
- package/es/components/organism/ContentSources/Settings.js +41 -40
- package/es/components/organism/DataTable/hooks/useDataTableListing/useDataTableListing.js +5 -7
- package/es/components/organism/Help/queries/useGetListUser.js +1 -4
- 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 +1 -4
- 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 +1 -4
- package/es/components/template/TemplateListing/hooks/useTemplateListing.d.ts +3 -2
- 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 +1 -2
- 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 +4 -8
- package/es/queries/DataTable/index.d.ts +25 -25
- package/es/queries/DataTable/index.js +19 -26
- package/es/queries/DynamicContentAttribute/useGetDynamicContentAttr.d.ts +1 -1
- package/es/queries/LeftMenu/index.d.ts +9 -9
- package/es/queries/LeftMenu/index.js +6 -4
- 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 +14 -28
- 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 +0 -1
- 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 +7 -11
- package/es/queries/User/userGetUserInfo.js +3 -6
- package/package.json +3 -3
|
@@ -123,16 +123,60 @@ 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,
|
|
126
|
+
const { data: listBoAttributes = [], isFetching: isFetchingListBoAttr, isError: isErrorBoAttr, } = 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
|
+
},
|
|
130
147
|
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
|
+
},
|
|
131
159
|
enabled: !!itemTypeId,
|
|
132
160
|
},
|
|
133
161
|
}, infos);
|
|
134
|
-
const { data: dynamicContentAttr, isFetching: isFetchingDynamicContentAttr, isError: isErrorDynamicContentAttr,
|
|
135
|
-
|
|
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({
|
|
136
180
|
apiConfig: {
|
|
137
181
|
url,
|
|
138
182
|
},
|
|
@@ -140,6 +184,9 @@ export const AddDynamicContent = props => {
|
|
|
140
184
|
eventActionId,
|
|
141
185
|
eventCategoryId,
|
|
142
186
|
options: {
|
|
187
|
+
onSuccess: () => {
|
|
188
|
+
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.SOURCE]: false });
|
|
189
|
+
},
|
|
143
190
|
select: (data) => {
|
|
144
191
|
const { rows } = data || {};
|
|
145
192
|
return rows.map((row) => ({
|
|
@@ -147,14 +194,39 @@ export const AddDynamicContent = props => {
|
|
|
147
194
|
value: row.value,
|
|
148
195
|
}));
|
|
149
196
|
},
|
|
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
|
+
},
|
|
150
205
|
},
|
|
151
206
|
});
|
|
152
|
-
const { data: listEvents, isFetching: isFetchingEventBySource
|
|
207
|
+
const { data: listEvents, isFetching: isFetchingEventBySource } = useGetListAllEvents({
|
|
153
208
|
apiConfig: {
|
|
154
209
|
url,
|
|
155
210
|
},
|
|
156
211
|
infos,
|
|
157
212
|
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
|
+
},
|
|
158
230
|
select: (data) => {
|
|
159
231
|
const { rows = [] } = data || {};
|
|
160
232
|
return rows.map((event) => ({
|
|
@@ -164,13 +236,38 @@ export const AddDynamicContent = props => {
|
|
|
164
236
|
},
|
|
165
237
|
},
|
|
166
238
|
});
|
|
167
|
-
const { data: listEventAttributes, isFetching: isFetchingEventAttr, isError: isErrorEventAttr,
|
|
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
|
+
},
|
|
168
249
|
select: (data) => serilizeEventAttr(data, language, additionalAttrProperties),
|
|
169
250
|
});
|
|
170
|
-
const { data: listPromotionPools, isFetching: isFetchingPromotionPool
|
|
251
|
+
const { data: listPromotionPools, isFetching: isFetchingPromotionPool } = useGetListPromotionPool({ url }, infos, {
|
|
252
|
+
onSuccess: () => {
|
|
253
|
+
setHasError({
|
|
254
|
+
[DYNAMIC_CONTENT_SETTING_KEY.PROMOTION_POOL]: false,
|
|
255
|
+
});
|
|
256
|
+
},
|
|
171
257
|
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
|
+
},
|
|
172
266
|
});
|
|
173
|
-
const { data: listPromotionCodeAttributes, isFetching: isFetchingPromotionCodeAttr, isError: isErrorListPromotionCodeAttr,
|
|
267
|
+
const { data: listPromotionCodeAttributes, isFetching: isFetchingPromotionCodeAttr, isError: isErrorListPromotionCodeAttr, } = useGetListPromotionCodeAttr({ url }, infos, {
|
|
268
|
+
onSuccess: () => {
|
|
269
|
+
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: false });
|
|
270
|
+
},
|
|
174
271
|
select: (data) => data
|
|
175
272
|
.filter((attr) => +attr?.status === 1)
|
|
176
273
|
.map((attr) => ({
|
|
@@ -181,6 +278,16 @@ export const AddDynamicContent = props => {
|
|
|
181
278
|
disabled: parseInt(attr.status) === 4,
|
|
182
279
|
status: attr.status,
|
|
183
280
|
})),
|
|
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
|
+
},
|
|
184
291
|
});
|
|
185
292
|
const { data: eventTrackingAttributes } = useGetEventTrackingAttributes({
|
|
186
293
|
apiConfig: { url },
|
|
@@ -188,122 +295,6 @@ export const AddDynamicContent = props => {
|
|
|
188
295
|
eventActionId,
|
|
189
296
|
eventCategoryId,
|
|
190
297
|
});
|
|
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]);
|
|
307
298
|
// Memo
|
|
308
299
|
const isShowEventIndexField = useDeepCompareMemo(() => {
|
|
309
300
|
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?:
|
|
3
|
+
queryOptions?: UseQueryOptions;
|
|
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,
|
|
10
|
+
export declare const useGetAbstractUsers: ({ queryOptions, params, search, queryFn, }: Props) => import("@tanstack/react-query").UseQueryResult<unknown, unknown>;
|
|
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: (options?: import("@tanstack/react-query").RefetchOptions | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<
|
|
69
|
-
refetchTemplateList: (options?: import("@tanstack/react-query").RefetchOptions | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<any
|
|
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>>;
|
|
70
70
|
onLoadMore: () => void;
|
|
71
71
|
onChange: (newValue: Partial<TemplateValueOptions>) => void;
|
|
72
72
|
};
|
|
@@ -134,8 +134,7 @@ 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({
|
|
138
|
-
queryKey: [QUERY_KEYS.GET_LIST_SAVED_MEDIA, domainMedia, slug, paramsMemo],
|
|
137
|
+
queryClient.invalidateQueries([QUERY_KEYS.GET_LIST_SAVED_MEDIA, domainMedia, slug, paramsMemo], {
|
|
139
138
|
exact: false,
|
|
140
139
|
});
|
|
141
140
|
}
|
|
@@ -211,7 +210,7 @@ export const UploadImage = props => {
|
|
|
211
210
|
})));
|
|
212
211
|
await Promise.all(arrPromise);
|
|
213
212
|
setLoading(false);
|
|
214
|
-
refetch();
|
|
213
|
+
refetch({ refetchPage: (_page, index) => index === 0 });
|
|
215
214
|
}
|
|
216
215
|
else {
|
|
217
216
|
setLoading(false);
|
|
@@ -45,49 +45,50 @@ const Settings = (props) => {
|
|
|
45
45
|
token,
|
|
46
46
|
userId,
|
|
47
47
|
accountId,
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
67
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
68
|
+
else if (itemTypeName === ITEM_TYPE_NAME.ARTICLE) {
|
|
69
|
+
valueRanking = ARTICLE_RANKING_DEFAULT;
|
|
70
|
+
}
|
|
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
|
+
},
|
|
84
85
|
},
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
});
|
|
87
|
+
setIsInitDataCDPDone(true);
|
|
88
|
+
}
|
|
88
89
|
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
90
|
+
},
|
|
91
|
+
});
|
|
91
92
|
const { data: listFallbackBO } = useGetListFallbackBO({
|
|
92
93
|
serviceAuth,
|
|
93
94
|
});
|
|
@@ -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 {
|
|
7
|
+
import { useQueryClient } from '@tanstack/react-query';
|
|
8
8
|
// Types
|
|
9
9
|
import { useAppConfigContext } from '@antscorp/antsomi-ui/es/providers';
|
|
10
10
|
// Components
|
|
@@ -181,8 +181,7 @@ export function useDataTableListing(props) {
|
|
|
181
181
|
},
|
|
182
182
|
options: {
|
|
183
183
|
enabled: isEnabledFetchMatchesAny,
|
|
184
|
-
|
|
185
|
-
placeholderData: keepPreviousData,
|
|
184
|
+
keepPreviousData: true,
|
|
186
185
|
retry: false,
|
|
187
186
|
getNextPageParam(lastPage, allPages) {
|
|
188
187
|
// Extract the total number of items from the last fetched page
|
|
@@ -226,7 +225,7 @@ export function useDataTableListing(props) {
|
|
|
226
225
|
},
|
|
227
226
|
options: {
|
|
228
227
|
queryKey: [name],
|
|
229
|
-
|
|
228
|
+
keepPreviousData: true,
|
|
230
229
|
enabled: !!listingAuth?.url && !!listingAuth?.token && enabledApiListing,
|
|
231
230
|
...queryOptions?.getTableListing,
|
|
232
231
|
},
|
|
@@ -240,7 +239,7 @@ export function useDataTableListing(props) {
|
|
|
240
239
|
request: restOfApiSearchRequest,
|
|
241
240
|
},
|
|
242
241
|
options: {
|
|
243
|
-
|
|
242
|
+
keepPreviousData: true,
|
|
244
243
|
enabled: !!searchAuth?.url && !!searchAuth?.token && enabledApiSearch,
|
|
245
244
|
...queryOptions?.getSearchListing,
|
|
246
245
|
},
|
|
@@ -849,8 +848,7 @@ export function useDataTableListing(props) {
|
|
|
849
848
|
}, [mainColumnKey, tableData]);
|
|
850
849
|
/** Refetch */
|
|
851
850
|
const refetchTableListing = useCallback(() => {
|
|
852
|
-
queryClient.invalidateQueries({
|
|
853
|
-
queryKey: [QUERY_KEYS.GET_DATA_TABLE_LISTING, name],
|
|
851
|
+
queryClient.invalidateQueries([QUERY_KEYS.GET_DATA_TABLE_LISTING, name], {
|
|
854
852
|
exact: false,
|
|
855
853
|
});
|
|
856
854
|
}, [name, queryClient]);
|
|
@@ -6,10 +6,7 @@ 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({
|
|
10
|
-
queryKey: [QUERY_KEY, domain, token, config, userId],
|
|
11
|
-
queryFn: () => getListUserServices({}, domain, token, config, userId),
|
|
12
|
-
});
|
|
9
|
+
const { data, isFetching } = useQuery([QUERY_KEY, domain, token, config, userId], () => getListUserServices({}, domain, token, config, userId));
|
|
13
10
|
return {
|
|
14
11
|
listUsers: data || [],
|
|
15
12
|
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,
|
|
38
|
+
const { mutateAsync: removeDashboard, isLoading: 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:
|
|
5
|
+
menuListPermission: import("@antscorp/antsomi-ui/es/models/LeftMenu").FeatureMenuPermission[] | undefined;
|
|
6
6
|
flattenMenuPermission: import("@antscorp/antsomi-ui/es/models/LeftMenu").FeatureMenuPermission[];
|
|
7
7
|
};
|
|
@@ -2,10 +2,7 @@ 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(
|
|
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
|
-
});
|
|
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));
|
|
9
6
|
if (data?.code === 200) {
|
|
10
7
|
return {
|
|
11
8
|
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: (options?: import("@tanstack/react-query").RefetchOptions | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<any,
|
|
11
|
+
refetchTicket: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<any, unknown>>;
|
|
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: (options?: import("@tanstack/react-query").RefetchOptions | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<any,
|
|
12
|
+
refetchComments: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<any, unknown>>;
|
|
13
13
|
};
|
|
14
14
|
export {};
|
|
@@ -6,10 +6,7 @@ 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({
|
|
10
|
-
queryKey: [QUERY_KEYS.GET_LIST_USER, domainTicket, '', config, userId],
|
|
11
|
-
queryFn: () => getListUserServices({}, domainTicket, '', config, userId),
|
|
12
|
-
});
|
|
9
|
+
const { data, isFetching } = useQuery([QUERY_KEYS.GET_LIST_USER, domainTicket, '', config, userId], () => getListUserServices({}, domainTicket, '', config, userId));
|
|
13
10
|
return {
|
|
14
11
|
listUsers: data || [],
|
|
15
12
|
isFetchingUsers: isFetching,
|
|
@@ -3,6 +3,7 @@ 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';
|
|
6
7
|
import { TemplateCategory } from '@antscorp/antsomi-ui/es/models/TemplateCategory';
|
|
7
8
|
interface TemplateListingOptions {
|
|
8
9
|
serviceAuth: TServiceAuth;
|
|
@@ -68,8 +69,8 @@ export declare const useTemplateListing: <T = undefined>(options: TemplateListin
|
|
|
68
69
|
isLoadingCategoryList: boolean;
|
|
69
70
|
isLoadingTemplateList: boolean;
|
|
70
71
|
isLoadingTemplateDetail: boolean;
|
|
71
|
-
refetchCategoryList: (options?: import("@tanstack/react-query").RefetchOptions | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<
|
|
72
|
-
refetchTemplateList: (options?: import("@tanstack/react-query").RefetchOptions | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<any
|
|
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>>;
|
|
73
74
|
onChangeCheckedCategories: (checkedCategories: TCheckedCategories) => void;
|
|
74
75
|
onChangeOpenCategoryKeys: (openKeys: string[]) => void;
|
|
75
76
|
onRemoveObjectTemplate: (id: TThumbnailCardId) => void;
|
package/es/queries/AI/index.d.ts
CHANGED
|
@@ -9,15 +9,15 @@ export declare const AntsomiAIQueries: {
|
|
|
9
9
|
refine_prompt: string;
|
|
10
10
|
sql_suggestion: string;
|
|
11
11
|
summary: string;
|
|
12
|
-
},
|
|
12
|
+
}, unknown, 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
|
-
},
|
|
20
|
-
|
|
19
|
+
}, unknown, Record<string, unknown>, unknown>;
|
|
20
|
+
isLoading: 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
|
-
},
|
|
14
|
+
}, unknown, 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
|
-
},
|
|
22
|
-
|
|
21
|
+
}, unknown, Record<string, unknown>, unknown>;
|
|
22
|
+
isLoading: 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,
|
|
5
|
+
const { mutate: generateSQL, mutateAsync: generateSQLAsync, isLoading, 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,
|
|
12
|
+
return { generateSQL, generateSQLAsync, isLoading, isError };
|
|
13
13
|
};
|