@antscorp/antsomi-ui 1.3.5-beta.707 → 1.3.5-beta.709
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/organism/ContentSources/Content.d.ts +1 -0
- package/es/components/organism/ContentSources/Content.js +4 -3
- package/es/components/organism/ContentSources/Group.d.ts +1 -0
- package/es/components/organism/ContentSources/Group.js +4 -3
- package/es/components/organism/ContentSources/Settings.d.ts +1 -0
- package/es/components/organism/ContentSources/Settings.js +11 -11
- package/es/components/organism/ContentSources/components/LevelSetting/index.js +4 -1
- package/es/components/organism/ContentSources/index.d.ts +1 -0
- package/es/components/organism/ContentSources/index.js +4 -3
- package/es/components/organism/LeftMenu/utils/index.js +8 -5
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import { HideOptionTypes, TContentSourceGroup, UpdateGroupAction } from './types
|
|
|
3
3
|
import { FallbackBO } from '@antscorp/antsomi-ui/es/models/FallbackBO';
|
|
4
4
|
export type TProps = {
|
|
5
5
|
groups: TContentSourceGroup[];
|
|
6
|
+
justOneGroup?: boolean;
|
|
6
7
|
isLoadingListBO: boolean;
|
|
7
8
|
listBO: any;
|
|
8
9
|
hideOptionTypes?: HideOptionTypes;
|
|
@@ -18,6 +18,7 @@ import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
|
18
18
|
const defaultProps = {
|
|
19
19
|
groups: [],
|
|
20
20
|
isShowErrorAlert: false,
|
|
21
|
+
justOneGroup: false,
|
|
21
22
|
journeySettings: {},
|
|
22
23
|
isLoadingListBO: true,
|
|
23
24
|
listFallbackBO: [],
|
|
@@ -25,7 +26,7 @@ const defaultProps = {
|
|
|
25
26
|
};
|
|
26
27
|
const Content = (props = defaultProps) => {
|
|
27
28
|
// prettier-ignore
|
|
28
|
-
const { groups, isLoadingListBO, listBO, onChangeGroup, onChangeExpand, expanded, isShowErrorAlert, hideOptionTypes, listFallbackBO, journeySettings, onDeleteGroup } = props;
|
|
29
|
+
const { groups, isLoadingListBO, listBO, onChangeGroup, onChangeExpand, expanded, isShowErrorAlert, hideOptionTypes, listFallbackBO, journeySettings, justOneGroup, onDeleteGroup } = props;
|
|
29
30
|
const { t } = i18nInstance;
|
|
30
31
|
const mode = useSelectModeView();
|
|
31
32
|
const isCDP = mode === 'CDP';
|
|
@@ -69,8 +70,8 @@ const Content = (props = defaultProps) => {
|
|
|
69
70
|
}, onClick: (e) => handleOnDeleteGroup(e, group.groupId), type: "icon-ants-outline-delete", size: 20 })));
|
|
70
71
|
};
|
|
71
72
|
return (React.createElement(Collapse, { ghost: true, bordered: true, activeKey: expanded, expandIconPosition: "end", onChange: handleOnChangeExpand, destroyInactivePanel: true, rootClassName: "no-border-top" }, groups.map((group, index) => {
|
|
72
|
-
const groupNode = (React.createElement(Group, { data: group, hideOptionTypes: hideOptionTypes, groupNames: groupNames, isLoadingSelectBO: isLoadingListBO, listBO: listBO, onChange: onChangeGroup, isShowErrorAlert: isShowErrorAlert, journeySettings: journeySettings, listFallbackBO: listFallbackBO }));
|
|
73
|
-
if (isCDP) {
|
|
73
|
+
const groupNode = (React.createElement(Group, { data: group, justOneGroup: justOneGroup, hideOptionTypes: hideOptionTypes, groupNames: groupNames, isLoadingSelectBO: isLoadingListBO, listBO: listBO, onChange: onChangeGroup, isShowErrorAlert: isShowErrorAlert, journeySettings: journeySettings, listFallbackBO: listFallbackBO }));
|
|
74
|
+
if (isCDP || justOneGroup) {
|
|
74
75
|
return React.createElement(React.Fragment, { key: group.groupId }, groupNode);
|
|
75
76
|
}
|
|
76
77
|
return (React.createElement(React.Fragment, { key: group.groupId },
|
|
@@ -4,6 +4,7 @@ import { FallbackBO } from '@antscorp/antsomi-ui/es/models/FallbackBO';
|
|
|
4
4
|
type TProps = {
|
|
5
5
|
data: TContentSourceGroup;
|
|
6
6
|
listBO: any[];
|
|
7
|
+
justOneGroup?: boolean;
|
|
7
8
|
hideOptionTypes?: HideOptionTypes;
|
|
8
9
|
isLoadingSelectBO: boolean;
|
|
9
10
|
onChange?: (groupId: string, action: UpdateGroupAction) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { cloneDeep, get, isEmpty } from 'lodash';
|
|
3
3
|
// Molecules
|
|
4
|
-
import { Space, Text } from '../../atoms';
|
|
4
|
+
import { Divider, Space, Text } from '../../atoms';
|
|
5
5
|
import { SelectV2 as Select } from '../../molecules';
|
|
6
6
|
// Styled
|
|
7
7
|
import { WrapperFallback } from './styled';
|
|
@@ -31,7 +31,7 @@ const cdpStyle = {
|
|
|
31
31
|
};
|
|
32
32
|
const Group = (props) => {
|
|
33
33
|
var _a, _b;
|
|
34
|
-
const { data, isLoadingSelectBO, listBO, listFallbackBO, hideOptionTypes, isShowErrorAlert, journeySettings, onChange, } = props;
|
|
34
|
+
const { data, isLoadingSelectBO, listBO, listFallbackBO, hideOptionTypes, isShowErrorAlert, journeySettings, justOneGroup = false, onChange, } = props;
|
|
35
35
|
const { itemTypeId, filters, level, itemTypeName } = data;
|
|
36
36
|
const mode = useSelectModeView();
|
|
37
37
|
const isCDP = mode === 'CDP';
|
|
@@ -105,10 +105,11 @@ const Group = (props) => {
|
|
|
105
105
|
}
|
|
106
106
|
}, [level, relationship]);
|
|
107
107
|
return (React.createElement(Space, { size: 20, direction: "vertical" },
|
|
108
|
-
React.createElement(Select, { showSearch: true, loading: isLoadingSelectBO, required: isCDP, isReverseMask: isCDP, labelStyle: isCDP ? cdpStyle : {}, style: isCDP ? { width: '100%' } : {}, containerStyle: isCDP ? { flexDirection: 'row', alignItems: 'baseline' } : {}, label: React.createElement(Text, { type: "secondary", color: (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.colorText },
|
|
108
|
+
React.createElement(Select, { showSearch: true, loading: isLoadingSelectBO, required: isCDP, isReverseMask: isCDP, labelStyle: isCDP ? cdpStyle : {}, style: isCDP ? { width: '100%' } : {}, containerStyle: isCDP ? { flexDirection: 'row', alignItems: 'baseline' } : {}, label: React.createElement(Text, { type: "secondary", color: (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.colorText }, TRANSLATE_TEXT.csTitle), options: options, placeholder: TRANSLATE_TEXT.selectAnItem, value: convertValue(listBO, itemTypeId), onChange: value => handleChange({
|
|
109
109
|
type: 'BO_TYPE',
|
|
110
110
|
payload: { itemTypeId: value },
|
|
111
111
|
}), errorArchive: isCheckBOArchiveDelete(listBO, itemTypeId) }),
|
|
112
|
+
justOneGroup && (React.createElement(Divider, { type: "horizontal", style: { margin: 0 }, rootClassName: "root-divider-bottom-cs", className: "divider-bottom-cs" })),
|
|
112
113
|
isShowLevelSetting && (React.createElement(LevelSetting, { value: level || 'parent', levelOption: relationship.recommendation_level, onChange: e => {
|
|
113
114
|
handleChange({
|
|
114
115
|
type: 'LEVEL',
|
|
@@ -4,6 +4,7 @@ import type { ContentSourceModeView, HideOptionTypes, JourneySettings, TContentS
|
|
|
4
4
|
interface SettingsProps {
|
|
5
5
|
serviceAuth: TServiceAuth;
|
|
6
6
|
mode: ContentSourceModeView;
|
|
7
|
+
justOneGroup?: boolean;
|
|
7
8
|
hideOptionTypes?: HideOptionTypes;
|
|
8
9
|
onChange: (contentSource: TContentSourceSettings) => void;
|
|
9
10
|
onBOChange?: (item: {
|
|
@@ -36,7 +36,7 @@ import { deleteContentSourceGroup, setContentSourceGroup, setContentSourceGroupB
|
|
|
36
36
|
import { handleError } from '@antscorp/antsomi-ui/es/utils';
|
|
37
37
|
const PATH = 'src/components/organism/ContentSources/Settings.tsx';
|
|
38
38
|
const Settings = (props) => {
|
|
39
|
-
const { serviceAuth, mode, isShowErrorAlert, initValue, journeySettings, hideOptionTypes, onChange, onBOChange, } = props;
|
|
39
|
+
const { serviceAuth, mode, isShowErrorAlert, initValue, justOneGroup = false, journeySettings, hideOptionTypes, onChange, onBOChange, } = props;
|
|
40
40
|
const { url = '', userId, token, accountId } = serviceAuth;
|
|
41
41
|
const { t } = i18nInstance;
|
|
42
42
|
const boIdByGroupCS = useSelectBoIdByGroupFromCS();
|
|
@@ -56,7 +56,7 @@ const Settings = (props) => {
|
|
|
56
56
|
}, {
|
|
57
57
|
onSuccess(data) {
|
|
58
58
|
if (!isInitDataCDPDone &&
|
|
59
|
-
isCDP &&
|
|
59
|
+
(isCDP || justOneGroup) &&
|
|
60
60
|
isArray(data) &&
|
|
61
61
|
contentSources.groups.length === 1 &&
|
|
62
62
|
contentSources.groups[0] &&
|
|
@@ -69,7 +69,7 @@ const Settings = (props) => {
|
|
|
69
69
|
let valueRanking = GET_TOP_RANKING_DEFAULT;
|
|
70
70
|
if (itemTypeId === PRODUCT_ITEM_TYPE_ID) {
|
|
71
71
|
valueRanking = PRODUCT_RANKING_DEFAULT;
|
|
72
|
-
if (isCDP) {
|
|
72
|
+
if (isCDP || justOneGroup) {
|
|
73
73
|
set(valueRanking, 'algorithms.sort', 'order');
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -109,7 +109,7 @@ const Settings = (props) => {
|
|
|
109
109
|
let valueRanking = GET_TOP_RANKING_DEFAULT;
|
|
110
110
|
if (id === PRODUCT_ITEM_TYPE_ID) {
|
|
111
111
|
valueRanking = PRODUCT_RANKING_DEFAULT;
|
|
112
|
-
if (isCDP) {
|
|
112
|
+
if (isCDP || justOneGroup) {
|
|
113
113
|
set(valueRanking, 'algorithms.sort', 'order');
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -224,28 +224,28 @@ const Settings = (props) => {
|
|
|
224
224
|
}, [mode, contentSourceDispatch]);
|
|
225
225
|
// INIT group in case using CDP mode
|
|
226
226
|
useLayoutEffect(() => {
|
|
227
|
-
if (isCDP && groups.length === 0) {
|
|
227
|
+
if ((isCDP || justOneGroup) && groups.length === 0) {
|
|
228
228
|
contentSourceDispatch({
|
|
229
229
|
type: 'ADD_CONTENT_SOURCE',
|
|
230
230
|
payload: {},
|
|
231
231
|
});
|
|
232
232
|
}
|
|
233
|
-
}, [isCDP, contentSourceDispatch, groups.length]);
|
|
233
|
+
}, [isCDP, justOneGroup, contentSourceDispatch, groups.length]);
|
|
234
234
|
// init data
|
|
235
235
|
useDeepCompareEffect(() => {
|
|
236
236
|
if (!isEmpty(initValue)) {
|
|
237
237
|
contentSourceDispatch(updateContentSourceSettings(initValue));
|
|
238
|
-
if (isCDP) {
|
|
238
|
+
if (isCDP || justOneGroup) {
|
|
239
239
|
setIsInitDataCDPDone(true);
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
else {
|
|
243
|
-
if (isCDP) {
|
|
243
|
+
if (isCDP || justOneGroup) {
|
|
244
244
|
refetchListBO();
|
|
245
245
|
setIsInitDataCDPDone(false);
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
}, [initValue, contentSourceDispatch, isCDP]);
|
|
248
|
+
}, [initValue, contentSourceDispatch, isCDP, justOneGroup]);
|
|
249
249
|
useDeepCompareEffect(() => {
|
|
250
250
|
let ignore = false;
|
|
251
251
|
if (!isEmpty(boIdByGroupCS) && !isEmpty(serviceAuth)) {
|
|
@@ -284,7 +284,7 @@ const Settings = (props) => {
|
|
|
284
284
|
}
|
|
285
285
|
}, [contentSourcesDebounce]);
|
|
286
286
|
return (React.createElement(ContentContainer, { className: "contentsource-container" },
|
|
287
|
-
React.createElement(Content, { isLoadingListBO: isLoadingListBO || isLoadingDataTableBO, hideOptionTypes: hideOptionTypes, listBO: listBO, groups: groups, expanded: expanded, onChangeExpand: expanded => {
|
|
287
|
+
React.createElement(Content, { isLoadingListBO: isLoadingListBO || isLoadingDataTableBO, hideOptionTypes: hideOptionTypes, justOneGroup: justOneGroup, listBO: listBO, groups: groups, expanded: expanded, onChangeExpand: expanded => {
|
|
288
288
|
contentSourceDispatch({
|
|
289
289
|
type: 'EXPANDED',
|
|
290
290
|
payload: {
|
|
@@ -294,7 +294,7 @@ const Settings = (props) => {
|
|
|
294
294
|
}, onChangeGroup: (groupId, action) => {
|
|
295
295
|
handleChangeContentSourceGroup(groupId, action);
|
|
296
296
|
}, onDeleteGroup: groupId => handleDeleteContentSourceGroup(groupId), journeySettings: journeySettings, isShowErrorAlert: isShowErrorAlert, listFallbackBO: listFallbackBO || [] }),
|
|
297
|
-
groups.length < MAX_NUM_OF_CONTENT_SOURCE && !isCDP && (React.createElement(Button, { type: "text", onClick: () => contentSourceDispatch({
|
|
297
|
+
groups.length < MAX_NUM_OF_CONTENT_SOURCE && !isCDP && !justOneGroup && (React.createElement(Button, { type: "text", onClick: () => contentSourceDispatch({
|
|
298
298
|
type: 'ADD_CONTENT_SOURCE',
|
|
299
299
|
payload: {},
|
|
300
300
|
}) },
|
|
@@ -17,7 +17,10 @@ const LevelSetting = (props) => {
|
|
|
17
17
|
const { onChange, levelOption, value } = props;
|
|
18
18
|
const mode = useSelectModeView();
|
|
19
19
|
const isCDP = mode === 'CDP';
|
|
20
|
-
return (React.createElement(SettingWrapper, { label: t(translations.level.title).toString(), labelStyle: {
|
|
20
|
+
return (React.createElement(SettingWrapper, { label: t(translations.level.title).toString(), labelStyle: {
|
|
21
|
+
fontWeight: isCDP ? 'normal' : 'bold',
|
|
22
|
+
width: isCDP ? LABEL_WIDTH : 'auto',
|
|
23
|
+
}, labelColor: isCDP ? (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.colorText : undefined, containerStyle: isCDP ? { justifyContent: 'flex-start' } : {} },
|
|
21
24
|
React.createElement(RadioGroup, { options: LEVEL_OPTIONS[levelOption], defaultValue: value, value: value, onChange: onChange })));
|
|
22
25
|
};
|
|
23
26
|
export default React.memo(LevelSetting);
|
|
@@ -11,6 +11,7 @@ import { JOURNEY_SETTINGS_DEFAULT } from './constants';
|
|
|
11
11
|
const defaultProps = {
|
|
12
12
|
useQueryClient: true,
|
|
13
13
|
isShowErrorAlert: false,
|
|
14
|
+
justOneGroup: false,
|
|
14
15
|
hideOptionTypes: {
|
|
15
16
|
filter: false,
|
|
16
17
|
level: false,
|
|
@@ -28,12 +29,12 @@ const defaultProps = {
|
|
|
28
29
|
},
|
|
29
30
|
};
|
|
30
31
|
const ContentSource = (props) => {
|
|
31
|
-
const { useQueryClient, serviceAuth, mode, isShowErrorAlert, initValue, hideOptionTypes, journeySettings, onChange, onBOChange, } = props;
|
|
32
|
+
const { useQueryClient, serviceAuth, mode, isShowErrorAlert, justOneGroup, initValue, hideOptionTypes, journeySettings, onChange, onBOChange, } = props;
|
|
32
33
|
if (!useQueryClient)
|
|
33
|
-
return (React.createElement(Settings, { mode: mode, initValue: initValue, hideOptionTypes: hideOptionTypes, serviceAuth: serviceAuth, isShowErrorAlert: isShowErrorAlert, journeySettings: journeySettings, onChange: onChange, onBOChange: onBOChange }));
|
|
34
|
+
return (React.createElement(Settings, { mode: mode, initValue: initValue, hideOptionTypes: hideOptionTypes, justOneGroup: justOneGroup, serviceAuth: serviceAuth, isShowErrorAlert: isShowErrorAlert, journeySettings: journeySettings, onChange: onChange, onBOChange: onBOChange }));
|
|
34
35
|
return (React.createElement(QueryClientProviderAntsomiUI, { client: queryClientAntsomiUI },
|
|
35
36
|
React.createElement(ContentSourceProvider, null,
|
|
36
|
-
React.createElement(Settings, { mode: mode, initValue: initValue, hideOptionTypes: hideOptionTypes, serviceAuth: serviceAuth, isShowErrorAlert: isShowErrorAlert, journeySettings: journeySettings, onChange: onChange, onBOChange: onBOChange }))));
|
|
37
|
+
React.createElement(Settings, { mode: mode, initValue: initValue, justOneGroup: justOneGroup, hideOptionTypes: hideOptionTypes, serviceAuth: serviceAuth, isShowErrorAlert: isShowErrorAlert, journeySettings: journeySettings, onChange: onChange, onBOChange: onBOChange }))));
|
|
37
38
|
};
|
|
38
39
|
ContentSource.defaultProps = defaultProps;
|
|
39
40
|
export default memo(ContentSource);
|
|
@@ -10,12 +10,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
// Libraries
|
|
13
|
-
import React
|
|
13
|
+
import React from 'react';
|
|
14
14
|
import { cloneDeep, isArray, isEmpty, isNil, sortBy } from 'lodash';
|
|
15
15
|
// Components
|
|
16
|
-
import { LazyIcon as Icons } from '@antscorp/antsomi-ui/es/components/icons/LazyIcon';
|
|
16
|
+
// import { LazyIcon as Icons } from '@antscorp/antsomi-ui/es/components/icons/LazyIcon';
|
|
17
17
|
/** Use this Icons for test storybook */
|
|
18
|
-
|
|
18
|
+
import * as Icons from '@antscorp/antsomi-ui/es/components/icons';
|
|
19
19
|
import { Icon } from '@antscorp/antsomi-ui/es/components/atoms/Icon';
|
|
20
20
|
// Constants
|
|
21
21
|
import { APP_KEYS, MARKETING_CHANNEL_KEY, HOME_MENU_ITEMS, MARKETING_ROUTES, MENU_ITEM_TYPE, RENDER_OPTION, HOME_REPORT_ROUTES, SETTING_APP, APP_EXCLUDED_KEYS, MAP_MENU_TO_PARENT_APP_CODE, } from '../constants';
|
|
@@ -522,8 +522,11 @@ export const renderMenuIcon = (iconName) => {
|
|
|
522
522
|
try {
|
|
523
523
|
// const ComponentIcon = iconName && Icons[iconName];
|
|
524
524
|
const ComponentIcon = iconName && Icons[iconName];
|
|
525
|
-
return ComponentIcon ? (
|
|
526
|
-
|
|
525
|
+
return ComponentIcon ? (
|
|
526
|
+
// <Suspense fallback={null}>
|
|
527
|
+
React.createElement(ComponentIcon, { className: "menu-item__icon", size: 30 })) : (
|
|
528
|
+
// </Suspense>
|
|
529
|
+
React.createElement(IconWrapper, null, isNil(iconName) ? null : React.createElement(Icon, { type: iconName })));
|
|
527
530
|
}
|
|
528
531
|
catch (error) {
|
|
529
532
|
return React.createElement(IconWrapper, null, isNil(iconName) ? null : React.createElement(Icon, { type: iconName }));
|