@antscorp/antsomi-ui 1.3.5-beta.31 → 1.3.5-beta.33
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/TemplateSaveAs/TemplateSaveAs.d.ts +1 -0
- package/es/components/molecules/TemplateSaveAs/TemplateSaveAs.js +6 -4
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/ImageSlider.d.ts +1 -0
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/ImageSlider.js +3 -3
- package/es/components/molecules/TemplateSaveAs/hooks/useTemplateSave.js +2 -2
- package/es/components/organism/Help/Help.js +7 -0
- package/es/components/template/TemplateListing/hooks/useTemplateListing.js +2 -1
- package/es/constants/variables.d.ts +6 -0
- package/es/constants/variables.js +6 -0
- package/es/services/TemplateListing/index.d.ts +2 -1
- package/es/test.js +3 -0
- package/es/types/templateListing.d.ts +2 -0
- package/es/types/variables.d.ts +2 -0
- package/package.json +1 -1
|
@@ -24,7 +24,7 @@ export const TemplateSaveAs = props => {
|
|
|
24
24
|
// onNamePopupScroll,
|
|
25
25
|
} = props;
|
|
26
26
|
const { show: isShowShareAccess } = shareAccess, shareAccessProps = __rest(shareAccess, ["show"]);
|
|
27
|
-
const { thumbnails, skeleton, previewNavigation, slidesPerView, hideThumbnailsList, label: imageReviewLabel, } = imageReview;
|
|
27
|
+
const { thumbnails, skeleton, previewNavigation, slidesPerView, hideThumbnailsList, hideDefaultButton, label: imageReviewLabel, } = imageReview;
|
|
28
28
|
const { isLoading, searchValue, label: templateLabel, defaultNewTemplateName, onSearch, onNamePopupScroll, } = templateNamesOptions || {};
|
|
29
29
|
const { label: descriptionLabel, placeholder: descriptionPlaceholder } = descriptionOptions || {};
|
|
30
30
|
const { saveNewText = 'Save as a new media Template', saveExistText = 'Save as an existing media Template', saveNewValue = 'save-new', saveExistValue = 'save-exist', } = saveOptions || {};
|
|
@@ -52,8 +52,10 @@ export const TemplateSaveAs = props => {
|
|
|
52
52
|
const newCategory = [...newCategoryList, currCategory];
|
|
53
53
|
handleChangeValue({ categories: newCategory });
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
else {
|
|
56
|
+
const newCategory = [...categoriesValue, { label: parent, key: parentKey, children: [item] }];
|
|
57
|
+
handleChangeValue({ categories: newCategory });
|
|
58
|
+
}
|
|
57
59
|
};
|
|
58
60
|
const handleRemoveCategory = ({ parent, item, }) => {
|
|
59
61
|
const currCategory = categoriesValue.find(category => category.label === parent);
|
|
@@ -116,7 +118,7 @@ export const TemplateSaveAs = props => {
|
|
|
116
118
|
imageReviewLabel || 'Thumbnail template',
|
|
117
119
|
" ",
|
|
118
120
|
React.createElement("span", null, "*")),
|
|
119
|
-
React.createElement(ImageSlider, { thumbnails: thumbnails, skeleton: skeleton, previewNavigation: previewNavigation, slidesPerView: slidesPerView, defaultThumbnail: defaultThumbnail, onSelectDefault: value => handleChangeValue({ defaultThumbnail: value }), hideThumbnailsList: hideThumbnailsList })), categories === null || categories === void 0 ? void 0 :
|
|
121
|
+
React.createElement(ImageSlider, { thumbnails: thumbnails, skeleton: skeleton, previewNavigation: previewNavigation, slidesPerView: slidesPerView, defaultThumbnail: defaultThumbnail, onSelectDefault: value => handleChangeValue({ defaultThumbnail: value }), hideThumbnailsList: hideThumbnailsList, hideDefaultButton: hideDefaultButton })), categories === null || categories === void 0 ? void 0 :
|
|
120
122
|
categories.map(parentCategory => {
|
|
121
123
|
var _a, _b, _c;
|
|
122
124
|
const selectedChildren = (_a = categoriesValue
|
|
@@ -9,7 +9,7 @@ import { ImageSliderStyled } from './styled';
|
|
|
9
9
|
import clsx from 'clsx';
|
|
10
10
|
export const ImageSlider = props => {
|
|
11
11
|
var _a, _b;
|
|
12
|
-
const { thumbnails, className, skeleton, previewNavigation, slidesPerView = 3, hideThumbnailsList, defaultThumbnail, onSelectDefault, } = props;
|
|
12
|
+
const { thumbnails, className, skeleton, previewNavigation, slidesPerView = 3, hideThumbnailsList, hideDefaultButton, defaultThumbnail, onSelectDefault, } = props;
|
|
13
13
|
const sliderContainerRef = useRef(null);
|
|
14
14
|
const thumbnailSelectedRef = useRef(null);
|
|
15
15
|
const [selectedThumbnail, setSelectedThumbnail] = useState(0);
|
|
@@ -38,14 +38,14 @@ export const ImageSlider = props => {
|
|
|
38
38
|
// 'image-container--default': isSelectedDefault,
|
|
39
39
|
}) },
|
|
40
40
|
url ? (React.createElement(Image, { preview: false, width: "80%", height: "96%", src: thumbnails[index] })) : null,
|
|
41
|
-
React.createElement(Button, { className: "set-default-button", onClick: () => {
|
|
41
|
+
hideDefaultButton ? null : (React.createElement(Button, { className: "set-default-button", onClick: () => {
|
|
42
42
|
setDefaultThumbnailInternal(selectedThumbnail);
|
|
43
43
|
if (onSelectDefault) {
|
|
44
44
|
onSelectDefault(selectedThumbnail);
|
|
45
45
|
}
|
|
46
46
|
} },
|
|
47
47
|
defaultThumbnailInternal === index ? (React.createElement(Icon, { type: "icon-ants-check", style: { fontSize: '12px' } })) : null,
|
|
48
|
-
defaultThumbnailInternal === index ? 'Default thumbnail' : 'Set as default'))))),
|
|
48
|
+
defaultThumbnailInternal === index ? 'Default thumbnail' : 'Set as default')))))),
|
|
49
49
|
hideThumbnailsList ? null : (React.createElement(Flex, { gap: 10, className: "thumbnail-slider-container", ref: sliderContainerRef }, thumbnails.map((url, index) => (React.createElement("div", { key: `${url}_${index * 2}`, className: clsx('image-container--small', {
|
|
50
50
|
'image-container--selected': index === selectedThumbnail,
|
|
51
51
|
}), onClick: () => setSelectedThumbnail(index) }, url ? React.createElement(Image, { key: url, preview: false, width: "80%", height: "96%", src: url }) : null))))),
|
|
@@ -30,7 +30,7 @@ import { CATEGORY_SPLIT_KEY } from '@antscorp/antsomi-ui/es/constants';
|
|
|
30
30
|
*/
|
|
31
31
|
export const useTemplateSave = (options) => {
|
|
32
32
|
const { service, config } = options;
|
|
33
|
-
const { objectType, categoryCodes, publicLevel, limitListPerPage = 10, filter } = config;
|
|
33
|
+
const { objectType, categoryCodes, publicLevel, limitListPerPage = 10, getListType, filter, } = config;
|
|
34
34
|
// const { message } = App.useApp();
|
|
35
35
|
// State
|
|
36
36
|
const [state, setState] = useState({
|
|
@@ -52,7 +52,7 @@ export const useTemplateSave = (options) => {
|
|
|
52
52
|
const { data: infiniteObjectTemplate, isFetchingNextPage, isFetching, hasNextPage, fetchNextPage, refetch: refetchTemplateList, } = useGetObjectTemplateList({
|
|
53
53
|
args: {
|
|
54
54
|
auth: service,
|
|
55
|
-
params: Object.assign({ object_type: objectType, public_level: publicLevel, limit: limitListPerPage }, (filter ? { filter } : {})),
|
|
55
|
+
params: Object.assign({ get_list_type: getListType, object_type: objectType, public_level: publicLevel, limit: limitListPerPage }, (filter ? { filter } : {})),
|
|
56
56
|
},
|
|
57
57
|
});
|
|
58
58
|
// Variables
|
|
@@ -100,6 +100,7 @@ const Help = props => {
|
|
|
100
100
|
const [isLoadingListHelp, setIsLoadingHelp] = useState(true);
|
|
101
101
|
const recorderRef = useRef();
|
|
102
102
|
const streamTracks = useRef();
|
|
103
|
+
const allAppOptionsRef = useRef([]);
|
|
103
104
|
// const showModal = (captureKey: CaptureTypeProps) => {
|
|
104
105
|
// setOpen(true);
|
|
105
106
|
// setCaptureType(captureKey);
|
|
@@ -218,6 +219,7 @@ const Help = props => {
|
|
|
218
219
|
}));
|
|
219
220
|
setAppTargeting(temp[0]);
|
|
220
221
|
setAllAppOptions(temp);
|
|
222
|
+
allAppOptionsRef.current = temp;
|
|
221
223
|
}
|
|
222
224
|
}
|
|
223
225
|
}
|
|
@@ -542,6 +544,11 @@ const Help = props => {
|
|
|
542
544
|
setIsShowPopup(true);
|
|
543
545
|
callback(REPORT_TYPES[helpType]);
|
|
544
546
|
setValueInput(prev => (Object.assign(Object.assign({}, prev), helpInfo)));
|
|
547
|
+
if (helpInfo.feature && Array.isArray(allAppOptions)) {
|
|
548
|
+
const targetApp = allAppOptionsRef.current.find(item => item.value === helpInfo.feature);
|
|
549
|
+
if (targetApp)
|
|
550
|
+
setAppTargeting(targetApp);
|
|
551
|
+
}
|
|
545
552
|
}
|
|
546
553
|
break;
|
|
547
554
|
default:
|
|
@@ -36,7 +36,7 @@ import { getShuffleArray } from '@antscorp/antsomi-ui/es/utils';
|
|
|
36
36
|
*/
|
|
37
37
|
export const useTemplateListing = (options) => {
|
|
38
38
|
const { serviceAuth, config, checkedCategoriesDefault } = options;
|
|
39
|
-
const { objectType, categoryCodes, publicLevel, limitListPerPage = 10 } = config;
|
|
39
|
+
const { objectType, categoryCodes, publicLevel, getListType, limitListPerPage = 10 } = config;
|
|
40
40
|
const { message } = App.useApp();
|
|
41
41
|
// Locales
|
|
42
42
|
const { t } = i18nInstance;
|
|
@@ -79,6 +79,7 @@ export const useTemplateListing = (options) => {
|
|
|
79
79
|
params: {
|
|
80
80
|
object_type: objectType,
|
|
81
81
|
public_level: publicLevel,
|
|
82
|
+
get_list_type: getListType,
|
|
82
83
|
limit: limitListPerPage,
|
|
83
84
|
filter: JSON.stringify(filter),
|
|
84
85
|
},
|
|
@@ -11,3 +11,9 @@ export declare const OBJECT_TYPES: {
|
|
|
11
11
|
readonly JOURNEY_TEMPLATE: 10;
|
|
12
12
|
readonly RICH_MENU_TEMPLATE: 11;
|
|
13
13
|
};
|
|
14
|
+
export declare const GET_LIST_TYPE: {
|
|
15
|
+
readonly OWNER: 1;
|
|
16
|
+
readonly SHARE_WITH_ME: 2;
|
|
17
|
+
readonly HAVE_ACCESS: 3;
|
|
18
|
+
readonly SELECTOR: 4;
|
|
19
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PaginationRequest, PayloadInfo, ResponseCheckNameExist, ResponseListing, TServiceAuth } from '../../types';
|
|
1
|
+
import { PaginationRequest, PayloadInfo, ResponseCheckNameExist, ResponseListing, TGetListType, TServiceAuth } from '../../types';
|
|
2
2
|
import { TObjectType, TPublicLevel } from '../../types/templateListing';
|
|
3
3
|
import { TThumbnailCardId } from '../../components/molecules/ThumbnailCard';
|
|
4
4
|
import { TemplateCategory } from '../../models/TemplateCategory';
|
|
@@ -23,6 +23,7 @@ export type TGetObjectTemplateListArgs = {
|
|
|
23
23
|
params: {
|
|
24
24
|
object_type: TObjectType;
|
|
25
25
|
public_level: TPublicLevel;
|
|
26
|
+
get_list_type: TGetListType;
|
|
26
27
|
} & PaginationRequest;
|
|
27
28
|
auth: TServiceAuth;
|
|
28
29
|
};
|
package/es/test.js
CHANGED
|
@@ -3,6 +3,8 @@ import React, { useState } from 'react';
|
|
|
3
3
|
import { createRoot } from 'react-dom/client';
|
|
4
4
|
import '@antscorp/icons/main.css';
|
|
5
5
|
import { ConfigProvider, InputDynamic, SettingWrapper, UploadImage, useTemplateListing, } from './components';
|
|
6
|
+
// Constants
|
|
7
|
+
import { GET_LIST_TYPE } from './constants';
|
|
6
8
|
// Queries configs
|
|
7
9
|
import { queryClientAntsomiUI, QueryClientProviderAntsomiUI } from './queries';
|
|
8
10
|
export const BACKGROUND_COLOR_STYLE = {
|
|
@@ -74,6 +76,7 @@ export const App = () => {
|
|
|
74
76
|
accountId: '1600080515',
|
|
75
77
|
},
|
|
76
78
|
config: {
|
|
79
|
+
getListType: GET_LIST_TYPE.OWNER,
|
|
77
80
|
objectType: 1,
|
|
78
81
|
publicLevel: 0,
|
|
79
82
|
limitListPerPage: 10,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TEMPLATE_CATEGORY_KEYS, OBJECT_TYPES, PUBLIC_LEVEL, TEMPLATE_STATUS } from '../constants';
|
|
2
|
+
import { TGetListType } from './variables';
|
|
2
3
|
export type TObjectType = (typeof OBJECT_TYPES)[keyof typeof OBJECT_TYPES];
|
|
3
4
|
export type TPublicLevel = (typeof PUBLIC_LEVEL)[keyof typeof PUBLIC_LEVEL];
|
|
4
5
|
export type TTemplateStatus = (typeof TEMPLATE_STATUS)[keyof typeof TEMPLATE_STATUS];
|
|
@@ -6,6 +7,7 @@ export type TObjectTemplateCategory = (typeof TEMPLATE_CATEGORY_KEYS)[keyof type
|
|
|
6
7
|
export type TTemplateListingConfig = {
|
|
7
8
|
objectType: TObjectType;
|
|
8
9
|
publicLevel: TPublicLevel;
|
|
10
|
+
getListType: TGetListType;
|
|
9
11
|
categoryCodes?: string[];
|
|
10
12
|
limitListPerPage?: number;
|
|
11
13
|
};
|
package/es/types/variables.d.ts
CHANGED