@antscorp/antsomi-ui 1.3.5-beta.266 → 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/molecules/AccountSelection/AccountListing.js +6 -5
- package/es/components/molecules/AccountSelection/AccountSelection.js +1 -1
- package/es/components/molecules/AccountSelection/styled.js +8 -4
- 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
|
@@ -58,12 +58,13 @@ export const AccountListing = props => {
|
|
|
58
58
|
}, [onChange]);
|
|
59
59
|
return (React.createElement(AccountSelectionStyled, { className: className },
|
|
60
60
|
React.createElement(Input, { placeholder: "Search", suffix: React.createElement(Icon, { type: "icon-ants-search-2", style: { fontSize: '24px' } }), value: searchValue, onChange: event => setSearchValue(event.target.value) }),
|
|
61
|
-
!!(recentData === null || recentData === void 0 ? void 0 : recentData.value) && (React.createElement(React.Fragment, null,
|
|
62
|
-
React.createElement(Text, { className: "recent-text" }, "Recent"),
|
|
63
|
-
React.createElement("ul", null, recentData === null || recentData === void 0 ? void 0 : recentData.value.map(accountId => accountData === null || accountData === void 0 ? void 0 : accountData.find(account => account.userId === accountId)).filter(Boolean).map(account => (React.createElement(AccountItem, { key: account.userId, userName: account.userName, userId: account.userId, onClick: handleSelectAccount, isSelected: +currentAccount === account.userId })))))),
|
|
64
61
|
React.createElement("div", { className: "antsomi-scroll-box account-list" },
|
|
65
|
-
React.createElement("ul", { className: "scroll-content" },
|
|
66
|
-
|
|
62
|
+
React.createElement("ul", { className: "scroll-content" },
|
|
63
|
+
!!(recentData === null || recentData === void 0 ? void 0 : recentData.value) && (React.createElement(React.Fragment, null,
|
|
64
|
+
React.createElement(Text, { className: "recent-text" }, "Recent"), recentData === null || recentData === void 0 ? void 0 :
|
|
65
|
+
recentData.value.map(accountId => accountData === null || accountData === void 0 ? void 0 : accountData.find(account => account.userId === accountId)).filter(Boolean).map(account => (React.createElement(AccountItem, { key: account.userId, userName: account.userName, userId: account.userId, onClick: handleSelectAccount, isSelected: +currentAccount === account.userId }))))), accountData === null || accountData === void 0 ? void 0 :
|
|
66
|
+
accountData.filter(account => !(recentData === null || recentData === void 0 ? void 0 : recentData.value.includes(account.userId)) &&
|
|
67
|
+
searchStringQuery(account.userName, searchValue)).map(account => (React.createElement(AccountItem, { key: account.userId, userName: account.userName, userId: account.userId, onClick: handleSelectAccount, isSelected: +currentAccount === account.userId }))))),
|
|
67
68
|
showAllAccount ? (React.createElement(Text, { className: `all-account ${isAllAccount ? 'is-selected' : ''}`, onClick: () => handleSelectAccount('') },
|
|
68
69
|
React.createElement("strong", null, "All account"))) : null));
|
|
69
70
|
};
|
|
@@ -79,5 +79,5 @@ export const AccountSelection = props => {
|
|
|
79
79
|
React.createElement(PopoverFieldStyled, { className: `${inputStyle || ''} ${inputClassName || ''}` },
|
|
80
80
|
React.createElement(Tooltip, { title: inputLabel },
|
|
81
81
|
React.createElement("span", { className: !inputLabel ? 'is-placeholder' : '' }, inputLabel || 'Select an account')),
|
|
82
|
-
React.createElement(Icon, { type: "icon-ants-angle-
|
|
82
|
+
React.createElement(Icon, { type: "icon-ants-angle-right", style: { width: '20px', textAlign: 'center', transform: 'rotate(90deg)' } })))));
|
|
83
83
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2
2
|
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
export const AccountSelectionStyled = styled.div `
|
|
@@ -83,18 +83,22 @@ export const PopoverFieldStyled = styled.div `
|
|
|
83
83
|
text-overflow: ellipsis;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
i {
|
|
87
|
+
color: ${(_f = THEME.token) === null || _f === void 0 ? void 0 : _f.bw8};
|
|
88
|
+
}
|
|
89
|
+
|
|
86
90
|
&.select {
|
|
87
|
-
border: 1px solid ${(
|
|
91
|
+
border: 1px solid ${(_g = THEME.token) === null || _g === void 0 ? void 0 : _g.bw3};
|
|
88
92
|
border-radius: 999px;
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
&.input {
|
|
92
|
-
border-bottom: 1px solid ${(
|
|
96
|
+
border-bottom: 1px solid ${(_h = THEME.token) === null || _h === void 0 ? void 0 : _h.colorPrimary};
|
|
93
97
|
width: 300px;
|
|
94
98
|
}
|
|
95
99
|
|
|
96
100
|
& .is-placeholder {
|
|
97
|
-
color: ${(
|
|
101
|
+
color: ${(_j = THEME.token) === null || _j === void 0 ? void 0 : _j.bw6};
|
|
98
102
|
font-weight: normal;
|
|
99
103
|
}
|
|
100
104
|
`;
|
|
@@ -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;
|