@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
|
@@ -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
|
-
|
|
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,
|
|
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:
|
|
69
|
-
refetchTemplateList:
|
|
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(
|
|
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(
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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(
|
|
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,
|
|
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(
|
|
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:
|
|
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:
|
|
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(
|
|
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:
|
|
73
|
-
refetchTemplateList:
|
|
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
|
|
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;
|