@antscorp/antsomi-ui 1.3.5-beta.267 → 1.3.5-beta.268
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/AlgorithmsSetting/index.d.ts +1 -0
- package/es/components/organism/AlgorithmsSetting/index.js +7 -4
- package/es/components/organism/ContentSources/Content.d.ts +2 -1
- package/es/components/organism/ContentSources/Content.js +2 -2
- package/es/components/organism/ContentSources/Group.d.ts +2 -1
- package/es/components/organism/ContentSources/Group.js +9 -5
- package/es/components/organism/ContentSources/Settings.d.ts +2 -1
- package/es/components/organism/ContentSources/Settings.js +2 -2
- package/es/components/organism/ContentSources/index.d.ts +2 -1
- package/es/components/organism/ContentSources/index.js +8 -3
- package/es/components/organism/ContentSources/types.d.ts +5 -0
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { TRanking } from '../../atoms/InputDynamic/types';
|
|
3
3
|
interface AlgorithmsSettingProps {
|
|
4
4
|
isShowErrorAlert: boolean;
|
|
5
|
+
isHideRanking?: boolean;
|
|
5
6
|
journeySettings: Record<string, any>;
|
|
6
7
|
contentSourceGroupId: string;
|
|
7
8
|
itemTypeId: number;
|
|
@@ -73,7 +73,7 @@ const styleGrid = {
|
|
|
73
73
|
};
|
|
74
74
|
export const AlgorithmsSetting = (props) => {
|
|
75
75
|
var _a;
|
|
76
|
-
const { data, itemTypeId, itemTypeName, isShowErrorAlert, journeySettings, onChange } = props;
|
|
76
|
+
const { data, itemTypeId, isHideRanking, itemTypeName, isShowErrorAlert, journeySettings, onChange, } = props;
|
|
77
77
|
// Translations
|
|
78
78
|
const { t } = i18nInstance;
|
|
79
79
|
// Selectors
|
|
@@ -757,9 +757,12 @@ export const AlgorithmsSetting = (props) => {
|
|
|
757
757
|
});
|
|
758
758
|
}
|
|
759
759
|
};
|
|
760
|
-
return (React.createElement(AlgorithmsSettingWrapper,
|
|
761
|
-
React.createElement(SettingWrapper, { containerStyle: isCDP ? { justifyContent: 'flex-start' } : {}, label: t(translations.ranking.title), labelStyle: {
|
|
762
|
-
|
|
760
|
+
return (React.createElement(AlgorithmsSettingWrapper, { style: { marginTop: isHideRanking ? -20 : 0 } },
|
|
761
|
+
!isHideRanking && (React.createElement(SettingWrapper, { containerStyle: isCDP ? { justifyContent: 'flex-start' } : {}, label: t(translations.ranking.title), labelStyle: {
|
|
762
|
+
fontWeight: isCDP ? 'normal' : 'bold',
|
|
763
|
+
width: isCDP ? LABEL_WIDTH : 'auto',
|
|
764
|
+
}, labelColor: isCDP ? (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.colorText : undefined },
|
|
765
|
+
React.createElement(RadioGroup, { options: Object.values(RANKING_TYPE), value: ranking.type, onChange: onChangeType }))),
|
|
763
766
|
ranking.type === RANKING_TYPE.ALGORITHMS.value ? (React.createElement(StyledTabs, { defaultActiveKey: activeTab, activeKey: activeTab, onChange: onChangeTabs, destroyInactiveTabPane: true }, Object.values(ALGORITHM_TABS)
|
|
764
767
|
.filter(({ value }) => {
|
|
765
768
|
if (itemTypeId === PRODUCT_ITEM_TYPE_ID || itemTypeName === ITEM_TYPE_NAME.ARTICLE) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TContentSourceGroup, UpdateGroupAction } from './types';
|
|
2
|
+
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
6
|
isLoadingListBO: boolean;
|
|
7
7
|
listBO: any;
|
|
8
|
+
hideOptionTypes?: HideOptionTypes;
|
|
8
9
|
onChange?: (contentSources: TContentSourceGroup[]) => void;
|
|
9
10
|
expanded?: string[];
|
|
10
11
|
onDeleteGroup?: (groupId: string) => void;
|
|
@@ -25,7 +25,7 @@ const defaultProps = {
|
|
|
25
25
|
};
|
|
26
26
|
const Content = (props = defaultProps) => {
|
|
27
27
|
// prettier-ignore
|
|
28
|
-
const { groups, isLoadingListBO, listBO, onChangeGroup, onChangeExpand, expanded, isShowErrorAlert, listFallbackBO, journeySettings, onDeleteGroup } = props;
|
|
28
|
+
const { groups, isLoadingListBO, listBO, onChangeGroup, onChangeExpand, expanded, isShowErrorAlert, hideOptionTypes, listFallbackBO, journeySettings, onDeleteGroup } = props;
|
|
29
29
|
const { t } = i18nInstance;
|
|
30
30
|
const mode = useSelectModeView();
|
|
31
31
|
const isCDP = mode === 'CDP';
|
|
@@ -69,7 +69,7 @@ const Content = (props = defaultProps) => {
|
|
|
69
69
|
}, onClick: (e) => handleOnDeleteGroup(e, group.groupId), type: "icon-ants-outline-delete", size: 20 })));
|
|
70
70
|
};
|
|
71
71
|
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, groupNames: groupNames, isLoadingSelectBO: isLoadingListBO, listBO: listBO, onChange: onChangeGroup, isShowErrorAlert: isShowErrorAlert, journeySettings: journeySettings, listFallbackBO: listFallbackBO }));
|
|
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
73
|
if (isCDP) {
|
|
74
74
|
return React.createElement(React.Fragment, { key: group.groupId }, groupNode);
|
|
75
75
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TContentSourceGroup, UpdateGroupAction } from './types';
|
|
2
|
+
import { HideOptionTypes, TContentSourceGroup, UpdateGroupAction } from './types';
|
|
3
3
|
import { FallbackBO } from '@antscorp/antsomi-ui/es/models/FallbackBO';
|
|
4
4
|
type TProps = {
|
|
5
5
|
data: TContentSourceGroup;
|
|
6
6
|
listBO: any[];
|
|
7
|
+
hideOptionTypes?: HideOptionTypes;
|
|
7
8
|
isLoadingSelectBO: boolean;
|
|
8
9
|
onChange?: (groupId: string, action: UpdateGroupAction) => void;
|
|
9
10
|
isShowErrorAlert: boolean;
|
|
@@ -31,7 +31,7 @@ const cdpStyle = {
|
|
|
31
31
|
};
|
|
32
32
|
const Group = (props) => {
|
|
33
33
|
var _a, _b;
|
|
34
|
-
const { data, isLoadingSelectBO, listBO, listFallbackBO, isShowErrorAlert, journeySettings, onChange, } = props;
|
|
34
|
+
const { data, isLoadingSelectBO, listBO, listFallbackBO, hideOptionTypes, isShowErrorAlert, journeySettings, onChange, } = props;
|
|
35
35
|
const { itemTypeId, filters, level, itemTypeName } = data;
|
|
36
36
|
const mode = useSelectModeView();
|
|
37
37
|
const isCDP = mode === 'CDP';
|
|
@@ -78,6 +78,10 @@ const Group = (props) => {
|
|
|
78
78
|
return listFallback;
|
|
79
79
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
80
80
|
}, [listFallbackBO, itemTypeName]);
|
|
81
|
+
const isShowLevelSetting = useMemo(() => itemTypeId === PRODUCT_ITEM_TYPE_ID &&
|
|
82
|
+
relationship &&
|
|
83
|
+
!!(relationship === null || relationship === void 0 ? void 0 : relationship.enabled) &&
|
|
84
|
+
!(hideOptionTypes === null || hideOptionTypes === void 0 ? void 0 : hideOptionTypes.level), [hideOptionTypes === null || hideOptionTypes === void 0 ? void 0 : hideOptionTypes.level, itemTypeId, relationship]);
|
|
81
85
|
useDeepCompareEffect(() => {
|
|
82
86
|
var _a;
|
|
83
87
|
if (!isEmpty(relationship)) {
|
|
@@ -105,18 +109,18 @@ const Group = (props) => {
|
|
|
105
109
|
type: 'BO_TYPE',
|
|
106
110
|
payload: { itemTypeId: value },
|
|
107
111
|
}), errorArchive: isCheckBOArchiveDelete(listBO, itemTypeId) }),
|
|
108
|
-
|
|
112
|
+
isShowLevelSetting && (React.createElement(LevelSetting, { value: level || 'parent', levelOption: relationship.recommendation_level, onChange: e => {
|
|
109
113
|
handleChange({
|
|
110
114
|
type: 'LEVEL',
|
|
111
115
|
payload: { level: e.target.value },
|
|
112
116
|
});
|
|
113
117
|
} })),
|
|
114
118
|
itemTypeId && (React.createElement(React.Fragment, null,
|
|
115
|
-
React.createElement(FilterSetting, { boId: itemTypeId, filters: filters, onOKChangeFilter: (conditions) => handleChange({
|
|
119
|
+
!(hideOptionTypes === null || hideOptionTypes === void 0 ? void 0 : hideOptionTypes.filter) && (React.createElement(FilterSetting, { boId: itemTypeId, filters: filters, onOKChangeFilter: (conditions) => handleChange({
|
|
116
120
|
type: 'FILTER',
|
|
117
121
|
payload: { conditions },
|
|
118
|
-
}) }),
|
|
119
|
-
React.createElement(AlgorithmsSetting, { journeySettings: journeySettings, contentSourceGroupId: data.groupId, isShowErrorAlert: isShowErrorAlert, itemTypeId: itemTypeId, data: data.ranking, onChange: (value) => handleChange({
|
|
122
|
+
}) })),
|
|
123
|
+
React.createElement(AlgorithmsSetting, { journeySettings: journeySettings, contentSourceGroupId: data.groupId, isHideRanking: hideOptionTypes === null || hideOptionTypes === void 0 ? void 0 : hideOptionTypes.ranking, isShowErrorAlert: isShowErrorAlert, itemTypeId: itemTypeId, data: data.ranking, onChange: (value) => handleChange({
|
|
120
124
|
type: 'ALGORITHMS',
|
|
121
125
|
payload: { ranking: value },
|
|
122
126
|
}), itemTypeName: itemTypeName }),
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { TServiceAuth } from '@antscorp/antsomi-ui/es/types';
|
|
3
|
-
import type { ContentSourceModeView, JourneySettings, TContentSourceSettings } from './types';
|
|
3
|
+
import type { ContentSourceModeView, HideOptionTypes, JourneySettings, TContentSourceSettings } from './types';
|
|
4
4
|
interface SettingsProps {
|
|
5
5
|
serviceAuth: TServiceAuth;
|
|
6
6
|
mode: ContentSourceModeView;
|
|
7
|
+
hideOptionTypes?: HideOptionTypes;
|
|
7
8
|
onChange: (contentSource: TContentSourceSettings) => void;
|
|
8
9
|
initValue?: TContentSourceSettings;
|
|
9
10
|
isShowErrorAlert: boolean;
|
|
@@ -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, onChange } = props;
|
|
39
|
+
const { serviceAuth, mode, isShowErrorAlert, initValue, journeySettings, hideOptionTypes, onChange, } = props;
|
|
40
40
|
const { url = '', userId, token, accountId } = serviceAuth;
|
|
41
41
|
const { t } = i18nInstance;
|
|
42
42
|
const boIdByGroupCS = useSelectBoIdByGroupFromCS();
|
|
@@ -280,7 +280,7 @@ const Settings = (props) => {
|
|
|
280
280
|
}
|
|
281
281
|
}, [contentSourcesDebounce]);
|
|
282
282
|
return (React.createElement(ContentContainer, { className: "contentsource-container" },
|
|
283
|
-
React.createElement(Content, { isLoadingListBO: isLoadingListBO || isLoadingDataTableBO, listBO: listBO, groups: groups, expanded: expanded, onChangeExpand: expanded => {
|
|
283
|
+
React.createElement(Content, { isLoadingListBO: isLoadingListBO || isLoadingDataTableBO, hideOptionTypes: hideOptionTypes, listBO: listBO, groups: groups, expanded: expanded, onChangeExpand: expanded => {
|
|
284
284
|
contentSourceDispatch({
|
|
285
285
|
type: 'EXPANDED',
|
|
286
286
|
payload: {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TServiceAuth } from '@antscorp/antsomi-ui/es/types';
|
|
3
|
-
import { ContentSourceModeView, JourneySettings, TContentSourceSettings } from './types';
|
|
3
|
+
import { ContentSourceModeView, HideOptionTypes, JourneySettings, TContentSourceSettings } from './types';
|
|
4
4
|
export interface ContentSourceProps {
|
|
5
5
|
useQueryClient: boolean;
|
|
6
6
|
serviceAuth: TServiceAuth;
|
|
7
7
|
isShowErrorAlert: boolean;
|
|
8
|
+
hideOptionTypes?: HideOptionTypes;
|
|
8
9
|
mode: ContentSourceModeView;
|
|
9
10
|
initValue?: TContentSourceSettings;
|
|
10
11
|
onChange: (contentSource: TContentSourceSettings) => void;
|
|
@@ -11,6 +11,11 @@ import { JOURNEY_SETTINGS_DEFAULT } from './constants';
|
|
|
11
11
|
const defaultProps = {
|
|
12
12
|
useQueryClient: true,
|
|
13
13
|
isShowErrorAlert: false,
|
|
14
|
+
hideOptionTypes: {
|
|
15
|
+
filter: false,
|
|
16
|
+
level: false,
|
|
17
|
+
ranking: false,
|
|
18
|
+
},
|
|
14
19
|
journeySettings: JOURNEY_SETTINGS_DEFAULT,
|
|
15
20
|
mode: 'CDP',
|
|
16
21
|
onChange: () => { },
|
|
@@ -22,12 +27,12 @@ const defaultProps = {
|
|
|
22
27
|
},
|
|
23
28
|
};
|
|
24
29
|
const ContentSource = (props) => {
|
|
25
|
-
const { useQueryClient, serviceAuth, mode, isShowErrorAlert, initValue, journeySettings, onChange, } = props;
|
|
30
|
+
const { useQueryClient, serviceAuth, mode, isShowErrorAlert, initValue, hideOptionTypes, journeySettings, onChange, } = props;
|
|
26
31
|
if (!useQueryClient)
|
|
27
|
-
return (React.createElement(Settings, { mode: mode, initValue: initValue, serviceAuth: serviceAuth, isShowErrorAlert: isShowErrorAlert, journeySettings: journeySettings, onChange: onChange }));
|
|
32
|
+
return (React.createElement(Settings, { mode: mode, initValue: initValue, hideOptionTypes: hideOptionTypes, serviceAuth: serviceAuth, isShowErrorAlert: isShowErrorAlert, journeySettings: journeySettings, onChange: onChange }));
|
|
28
33
|
return (React.createElement(QueryClientProviderAntsomiUI, { client: queryClientAntsomiUI },
|
|
29
34
|
React.createElement(ContentSourceProvider, null,
|
|
30
|
-
React.createElement(Settings, { mode: mode, initValue: initValue, serviceAuth: serviceAuth, isShowErrorAlert: isShowErrorAlert, journeySettings: journeySettings, onChange: onChange }))));
|
|
35
|
+
React.createElement(Settings, { mode: mode, initValue: initValue, hideOptionTypes: hideOptionTypes, serviceAuth: serviceAuth, isShowErrorAlert: isShowErrorAlert, journeySettings: journeySettings, onChange: onChange }))));
|
|
31
36
|
};
|
|
32
37
|
ContentSource.defaultProps = defaultProps;
|
|
33
38
|
export default memo(ContentSource);
|
|
@@ -44,6 +44,11 @@ export type TContentSourceSettings = {
|
|
|
44
44
|
expanded: string[];
|
|
45
45
|
isLoadingDataBO: boolean;
|
|
46
46
|
};
|
|
47
|
+
export interface HideOptionTypes {
|
|
48
|
+
filter?: boolean;
|
|
49
|
+
level?: boolean;
|
|
50
|
+
ranking?: boolean;
|
|
51
|
+
}
|
|
47
52
|
export type TRelationship = {
|
|
48
53
|
enabled: 1 | 0;
|
|
49
54
|
parent_attr: string;
|