@capillarytech/creatives-library 8.0.147 → 8.0.149
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/components/BreadCrumbs/index.js +65 -0
- package/components/BreadCrumbs/messages.js +13 -0
- package/components/CapTagList/index.js +235 -0
- package/components/CapTagList/messages.js +45 -0
- package/components/Card/_customCard.scss +40 -0
- package/components/Card/index.js +78 -0
- package/components/Card/tests/__snapshots__/index.test.js.snap +22 -0
- package/components/Card/tests/index.test.js +20 -0
- package/components/CardGrid/index.js +71 -0
- package/components/Ckeditor/index.js +238 -0
- package/components/Ckeditor/messages.js +13 -0
- package/components/Ckeditor/style.scss +3 -0
- package/components/Component/index.js +29 -0
- package/components/CustomPopOver/index.js +81 -0
- package/components/CustomPopOver/messages.js +17 -0
- package/components/DateFilter/index.js +349 -0
- package/components/DateFilter/messages.js +57 -0
- package/components/DateRange/index.js +114 -0
- package/components/DateRange/messages.js +25 -0
- package/components/Edmeditor/index.js +65 -0
- package/components/Edmeditor/messages.js +13 -0
- package/components/EmailPreview/_emailPreview.scss +119 -0
- package/components/EmailPreview/assets/images/iPad.svg +10 -0
- package/components/EmailPreview/assets/images/mobile.png +0 -0
- package/components/EmailPreview/index.js +107 -0
- package/components/EmailPreview/messages.js +33 -0
- package/components/Footer/index.js +27 -0
- package/components/Footer/messages.js +13 -0
- package/components/FormBuilder/_formBuilder.scss +83 -0
- package/components/FormBuilder/index.js +3279 -0
- package/components/FormBuilder/messages.js +61 -0
- package/components/Header/index.js +44 -0
- package/components/Header/messages.js +29 -0
- package/components/ImagePreview/_imagePreview.scss +63 -0
- package/components/ImagePreview/index.js +52 -0
- package/components/ImagePreview/messages.js +17 -0
- package/components/PageHeader/_pageHeader.scss +22 -0
- package/components/PageHeader/index.js +37 -0
- package/components/PageHeader/messages.js +13 -0
- package/components/Pagination/_pagination.scss +5 -0
- package/components/Pagination/index.js +49 -0
- package/components/PreviewSideBar/_previewsidebar.scss +28 -0
- package/components/PreviewSideBar/index.js +152 -0
- package/components/PreviewSideBar/messages.js +41 -0
- package/components/Sidebar/_sidebar.scss +115 -0
- package/components/Sidebar/index.js +214 -0
- package/components/Sidebar/messages.js +21 -0
- package/components/SlideBox/_slideBox.scss +63 -0
- package/components/SlideBox/index.js +47 -0
- package/components/SlideBox/tests/index.test.js +103 -0
- package/components/SmsEditor/index.js +55 -0
- package/components/SmsTest/index.js +117 -0
- package/components/SmsTest/messages.js +21 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +42 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +141 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +21 -0
- package/components/TemplatePreview/_templatePreview.scss +642 -0
- package/components/TemplatePreview/assets/images/WECHAT_5x.png +0 -0
- package/components/TemplatePreview/assets/images/androidPushMessage.svg +45 -0
- package/components/TemplatePreview/assets/images/home-screen-android.svg +21 -0
- package/components/TemplatePreview/assets/images/home-screen-ios.svg +16 -0
- package/components/TemplatePreview/assets/images/iPhonePushMessage.svg +135 -0
- package/components/TemplatePreview/assets/images/mobile.svg +24 -0
- package/components/TemplatePreview/assets/images/sms-body.png +0 -0
- package/components/TemplatePreview/assets/images/sms-icon.png +0 -0
- package/components/TemplatePreview/assets/images/sms_mobile.png +0 -0
- package/components/TemplatePreview/assets/images/sms_mobile_android.svg +22 -0
- package/components/TemplatePreview/assets/images/sms_mobile_ios.svg +16 -0
- package/components/TemplatePreview/assets/images/user-icon.svg +19 -0
- package/components/TemplatePreview/assets/images/wechat-mobile.svg +78 -0
- package/components/TemplatePreview/assets/images/wechat_mobile_android.svg +20 -0
- package/components/TemplatePreview/index.js +617 -0
- package/components/TemplatePreview/messages.js +78 -0
- package/components/Toastr/index.js +60 -0
- package/components/Toastr/messages.js +13 -0
- package/components/ToastrMessage/index.js +113 -0
- package/components/ToastrMessage/messages.js +17 -0
- package/components/TopBar/_topbar.scss +46 -0
- package/components/TopBar/assets/images/capillary_logo.png +0 -0
- package/components/TopBar/assets/images/old_capillary_logo.png +0 -0
- package/components/TopBar/index.js +113 -0
- package/components/TopBar/messages.js +29 -0
- package/containers/App/actions.js +7 -0
- package/containers/App/constants.js +114 -0
- package/containers/App/index.js +52 -0
- package/containers/App/reducer.js +19 -0
- package/containers/App/sagas.js +31 -0
- package/containers/App/selectors.js +25 -0
- package/containers/App/test/saga.test.js +11 -0
- package/containers/Assets/Gallery/_gallery.scss +126 -0
- package/containers/Assets/Gallery/actions.js +37 -0
- package/containers/Assets/Gallery/constants.js +23 -0
- package/containers/Assets/Gallery/index.js +473 -0
- package/containers/Assets/Gallery/messages.js +93 -0
- package/containers/Assets/Gallery/reducer.js +81 -0
- package/containers/Assets/Gallery/sagas.js +80 -0
- package/containers/Assets/Gallery/selectors.js +25 -0
- package/containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +9 -0
- package/containers/Assets/Gallery/tests/actions.test.js +25 -0
- package/containers/Assets/Gallery/tests/reducer.test.js +96 -0
- package/containers/Assets/Gallery/tests/saga.test.js +157 -0
- package/containers/Cap/actions.js +66 -0
- package/containers/Cap/constants.js +25 -0
- package/containers/Cap/index.js +402 -0
- package/containers/Cap/messages.js +75 -0
- package/containers/Cap/reducer.js +113 -0
- package/containers/Cap/sagas.js +159 -0
- package/containers/Cap/selectors.js +75 -0
- package/containers/Cap/tests/__snapshots__/index.test.js.snap +2270 -0
- package/containers/Cap/tests/index.test.js +22 -0
- package/containers/Cap/tests/saga.test.js +284 -0
- package/containers/Dashboard/actions.js +15 -0
- package/containers/Dashboard/constants.js +7 -0
- package/containers/Dashboard/index.js +76 -0
- package/containers/Dashboard/messages.js +13 -0
- package/containers/Dashboard/reducer.js +21 -0
- package/containers/Dashboard/sagas.js +17 -0
- package/containers/Dashboard/selectors.js +25 -0
- package/containers/Dashboard/test/saga.test.js +9 -0
- package/containers/Ebill/_ebill.scss +5 -0
- package/containers/Ebill/actions.js +43 -0
- package/containers/Ebill/constants.js +20 -0
- package/containers/Ebill/index.js +1278 -0
- package/containers/Ebill/messages.js +77 -0
- package/containers/Ebill/reducer.js +72 -0
- package/containers/Ebill/sagas.js +74 -0
- package/containers/Ebill/selectors.js +25 -0
- package/containers/Ebill/test/saga.test.js +11 -0
- package/containers/Email/_email.scss +141 -0
- package/containers/Email/actions.js +81 -0
- package/containers/Email/constants.js +36 -0
- package/containers/Email/index.js +3325 -0
- package/containers/Email/messages.js +289 -0
- package/containers/Email/reducer.js +142 -0
- package/containers/Email/sagas.js +135 -0
- package/containers/Email/selectors.js +31 -0
- package/containers/Email/test/saga.test.js +671 -0
- package/containers/LanguageProvider/actions.js +17 -0
- package/containers/LanguageProvider/constants.js +8 -0
- package/containers/LanguageProvider/index.js +80 -0
- package/containers/LanguageProvider/reducer.js +30 -0
- package/containers/LanguageProvider/selectors.js +20 -0
- package/containers/LanguageProvider/tests/actions.test.js +19 -0
- package/containers/LanguageProvider/tests/index.test.js +78 -0
- package/containers/LanguageProvider/tests/reducer.test.js +20 -0
- package/containers/LanguageProvider/tests/selectors.test.js +15 -0
- package/containers/Line/Create/_lineCreate.scss +54 -0
- package/containers/Line/Create/actions.js +90 -0
- package/containers/Line/Create/constants.js +39 -0
- package/containers/Line/Create/index.js +836 -0
- package/containers/Line/Create/messages.js +189 -0
- package/containers/Line/Create/reducer.js +99 -0
- package/containers/Line/Create/sagas.js +121 -0
- package/containers/Line/Create/selectors.js +36 -0
- package/containers/Line/Create/tests/saga.test.js +202 -0
- package/containers/Line/Edit/_lineEdit.scss +35 -0
- package/containers/Line/Edit/actions.js +79 -0
- package/containers/Line/Edit/constants.js +27 -0
- package/containers/Line/Edit/index.js +1050 -0
- package/containers/Line/Edit/messages.js +177 -0
- package/containers/Line/Edit/reducer.js +83 -0
- package/containers/Line/Edit/sagas.js +80 -0
- package/containers/Line/Edit/selectors.js +29 -0
- package/containers/Line/Edit/test/saga.test.js +160 -0
- package/containers/Login/assets/images/capillary_logo.png +0 -0
- package/containers/Login/components/LoginForm/index.js +62 -0
- package/containers/Login/components/LoginForm/messages.js +33 -0
- package/containers/Login/index.js +130 -0
- package/containers/Login/messages.js +25 -0
- package/containers/Login/selectors.js +25 -0
- package/containers/MobilePush/Create/_mobilePushCreate.scss +39 -0
- package/containers/MobilePush/Create/actions.js +46 -0
- package/containers/MobilePush/Create/constants.js +23 -0
- package/containers/MobilePush/Create/index.js +2303 -0
- package/containers/MobilePush/Create/messages.js +269 -0
- package/containers/MobilePush/Create/reducer.js +70 -0
- package/containers/MobilePush/Create/sagas.js +74 -0
- package/containers/MobilePush/Create/selectors.js +28 -0
- package/containers/MobilePush/Create/test/saga.test.js +19 -0
- package/containers/MobilePush/Edit/_mobilePushCreate.scss +39 -0
- package/containers/MobilePush/Edit/actions.js +91 -0
- package/containers/MobilePush/Edit/constants.js +35 -0
- package/containers/MobilePush/Edit/index.js +2601 -0
- package/containers/MobilePush/Edit/messages.js +266 -0
- package/containers/MobilePush/Edit/reducer.js +112 -0
- package/containers/MobilePush/Edit/sagas.js +126 -0
- package/containers/MobilePush/Edit/selectors.js +29 -0
- package/containers/MobilePush/Edit/tests/saga.test.js +255 -0
- package/containers/NotFoundPage/index.js +25 -0
- package/containers/NotFoundPage/messages.js +13 -0
- package/containers/NotFoundPage/tests/index.test.js +17 -0
- package/containers/Sms/Create/_smsCreate.scss +42 -0
- package/containers/Sms/Create/actions.js +27 -0
- package/containers/Sms/Create/constants.js +16 -0
- package/containers/Sms/Create/index.js +1488 -0
- package/containers/Sms/Create/messages.js +109 -0
- package/containers/Sms/Create/reducer.js +41 -0
- package/containers/Sms/Create/sagas.js +40 -0
- package/containers/Sms/Create/selectors.js +28 -0
- package/containers/Sms/Create/test/saga.test.js +11 -0
- package/containers/Sms/Edit/actions.js +40 -0
- package/containers/Sms/Edit/constants.js +17 -0
- package/containers/Sms/Edit/index.js +1472 -0
- package/containers/Sms/Edit/messages.js +105 -0
- package/containers/Sms/Edit/reducer.js +50 -0
- package/containers/Sms/Edit/sagas.js +60 -0
- package/containers/Sms/Edit/selectors.js +32 -0
- package/containers/Sms/Edit/test/saga.test.js +13 -0
- package/containers/TagList/_tagList.scss +8 -0
- package/containers/TagList/actions.js +15 -0
- package/containers/TagList/constants.js +32 -0
- package/containers/TagList/index.js +236 -0
- package/containers/TagList/messages.js +13 -0
- package/containers/TagList/reducer.js +23 -0
- package/containers/TagList/sagas.js +11 -0
- package/containers/TagList/selectors.js +25 -0
- package/containers/Templates/_templates.scss +333 -0
- package/containers/Templates/actions.js +103 -0
- package/containers/Templates/constants.js +60 -0
- package/containers/Templates/index.js +1756 -0
- package/containers/Templates/messages.js +337 -0
- package/containers/Templates/reducer.js +142 -0
- package/containers/Templates/sagas.js +163 -0
- package/containers/Templates/selectors.js +28 -0
- package/containers/Templates/test/saga.test.js +241 -0
- package/containers/WeChat/MapTemplates/_mapTemplates.scss +8 -0
- package/containers/WeChat/MapTemplates/actions.js +52 -0
- package/containers/WeChat/MapTemplates/constants.js +28 -0
- package/containers/WeChat/MapTemplates/index.js +1610 -0
- package/containers/WeChat/MapTemplates/messages.js +157 -0
- package/containers/WeChat/MapTemplates/reducer.js +74 -0
- package/containers/WeChat/MapTemplates/sagas.js +84 -0
- package/containers/WeChat/MapTemplates/selectors.js +25 -0
- package/containers/WeChat/MapTemplates/test/saga.test.js +155 -0
- package/containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +57 -0
- package/containers/WeChat/RichmediaTemplates/Create/actions.js +36 -0
- package/containers/WeChat/RichmediaTemplates/Create/constants.js +15 -0
- package/containers/WeChat/RichmediaTemplates/Create/index.js +1071 -0
- package/containers/WeChat/RichmediaTemplates/Create/messages.js +165 -0
- package/containers/WeChat/RichmediaTemplates/Create/reducer.js +60 -0
- package/containers/WeChat/RichmediaTemplates/Create/richmediaschema.js +497 -0
- package/containers/WeChat/RichmediaTemplates/Create/sagas.js +51 -0
- package/containers/WeChat/RichmediaTemplates/Create/selectors.js +37 -0
- package/containers/WeChat/RichmediaTemplates/Create/test/saga.test.js +13 -0
- package/containers/WeChat/RichmediaTemplates/Edit/actions.js +20 -0
- package/containers/WeChat/RichmediaTemplates/Edit/constants.js +10 -0
- package/containers/WeChat/RichmediaTemplates/Edit/index.js +136 -0
- package/containers/WeChat/RichmediaTemplates/Edit/messages.js +13 -0
- package/containers/WeChat/RichmediaTemplates/Edit/reducer.js +28 -0
- package/containers/WeChat/RichmediaTemplates/Edit/sagas.js +36 -0
- package/containers/WeChat/RichmediaTemplates/Edit/selectors.js +30 -0
- package/containers/WeChat/RichmediaTemplates/Edit/test/saga.test.js +12 -0
- package/containers/WeChat/RichmediaTemplates/View/actions.js +15 -0
- package/containers/WeChat/RichmediaTemplates/View/constants.js +7 -0
- package/containers/WeChat/RichmediaTemplates/View/index.js +47 -0
- package/containers/WeChat/RichmediaTemplates/View/messages.js +21 -0
- package/containers/WeChat/RichmediaTemplates/View/reducer.js +23 -0
- package/containers/WeChat/RichmediaTemplates/View/sagas.js +11 -0
- package/containers/WeChat/RichmediaTemplates/View/selectors.js +25 -0
- package/index.js +2 -4
- package/package.json +1 -1
- package/routes.js +202 -136
- package/services/getSchema.js +1 -1
- package/services/localStorageApi.js +0 -1
- package/tests/i18n.test.js +1 -1
- package/utils/asyncInjectors.js +78 -0
- package/utils/authWrapper.js +1 -1
- package/utils/callNativeEvent.js +16 -0
- package/utils/checkStore.js +21 -0
- package/utils/common.js +2 -2
- package/utils/customAuthWrapper.js +62 -0
- package/utils/customConnectedAuthWrapper.js +26 -0
- package/utils/tagValidations.js +1 -1
- package/utils/tests/authWrapper.test.js +1 -1
- package/utils/tests/checkStore.test.js +1 -1
- package/utils/tests/customAuth.test.js +1 -1
- package/utils/tests/transformerUtils.test.js +861 -1
- package/utils/transformerUtils.js +169 -1
- package/v2Components/CapTagList/index.js +14 -9
- package/v2Components/Carousel/style.scss +1 -1
- package/v2Components/EmailMobilePreview/index.js +2 -2
- package/v2Components/FormBuilder/index.js +2 -2
- package/v2Components/TemplatePreview/index.js +1 -2
- package/v2Components/TestAndPreviewSlidebox/index.js +2 -0
- package/v2Containers/Cap/tests/saga.test.js +1 -1
- package/v2Containers/Email/index.js +1 -1
- package/v2Containers/FTP/index.js +1 -1
- package/v2Containers/Line/Container/Text/index.js +1 -1
- package/v2Containers/Sms/Create/index.js +2 -2
- package/v2Containers/Sms/Edit/index.js +1 -1
- package/v2Containers/TagList/index.js +1 -1
- package/v2Containers/TagList/utils.js +1 -1
- package/v2Containers/Templates/index.js +1 -1
- package/v2Containers/Templates/sagas.js +1 -1
- package/constants/unified.js +0 -189
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
// import styled from 'styled-components';
|
|
4
|
+
import { Link } from 'react-router';
|
|
5
|
+
import _ from 'lodash';
|
|
6
|
+
|
|
7
|
+
class BreadCrumbs extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
8
|
+
constructor(props) {
|
|
9
|
+
super(props);
|
|
10
|
+
this.prepareBreadcrumbElement = this.prepareBreadcrumbElement.bind(this);
|
|
11
|
+
this.disabledBreadcrumb = this.disabledBreadcrumb.bind(this);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
disabledBreadcrumb(e, location) {
|
|
15
|
+
if (location.disabled) {
|
|
16
|
+
e.preventDefault();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
prepareBreadcrumbElement() {
|
|
21
|
+
const breadcrumbs = [];
|
|
22
|
+
_.forEach(this.props.locations, (location) => {
|
|
23
|
+
const titleText = (typeof location.text === 'string') ? location.text : location.text.props.defaultMessage;
|
|
24
|
+
const element = (
|
|
25
|
+
<Link
|
|
26
|
+
to={location.url}
|
|
27
|
+
key={titleText}
|
|
28
|
+
title={titleText}
|
|
29
|
+
onClick={(e) => this.disabledBreadcrumb(e, location)}
|
|
30
|
+
>
|
|
31
|
+
<span
|
|
32
|
+
className={location.disabled ? 'disabled-breadcrumb' : 'active-breadcrumb'}
|
|
33
|
+
disabled={location.disabled}
|
|
34
|
+
> {location.text}
|
|
35
|
+
</span>
|
|
36
|
+
</Link>
|
|
37
|
+
);
|
|
38
|
+
if (breadcrumbs.length !== 0) {
|
|
39
|
+
breadcrumbs.push(
|
|
40
|
+
<span
|
|
41
|
+
key={`${titleText}separator`}
|
|
42
|
+
> {this.props.separator ? this.props.separator : ' / '}
|
|
43
|
+
</span>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
breadcrumbs.push(element);
|
|
47
|
+
});
|
|
48
|
+
return breadcrumbs;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
render() {
|
|
52
|
+
return (
|
|
53
|
+
<div className="breadcrumbs-wrapper">
|
|
54
|
+
{this.prepareBreadcrumbElement()}
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
BreadCrumbs.propTypes = {
|
|
61
|
+
locations: PropTypes.array.isRequired,
|
|
62
|
+
separator: PropTypes.string,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default BreadCrumbs;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* BreadCrumbs Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the BreadCrumbs component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
header: {
|
|
10
|
+
id: 'creatives.components.BreadCrumbs.header',
|
|
11
|
+
defaultMessage: 'This is the BreadCrumbs component !',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* CapTagList
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
// import styled from 'styled-components';
|
|
11
|
+
import { Tree, Input, Spin, Modal } from 'antd';
|
|
12
|
+
import _ from 'lodash';
|
|
13
|
+
// import { CapInput } from '@capillarytech/cap-react-ui-library/basic/input';
|
|
14
|
+
import { injectIntl, intlShape } from 'react-intl';
|
|
15
|
+
import { CapButton, CapPopover, CapSelect, CapInput } from '@capillarytech/cap-react-ui-library';
|
|
16
|
+
import messages from './messages';
|
|
17
|
+
const Search = Input.Search;
|
|
18
|
+
const TreeNode = Tree.TreeNode;
|
|
19
|
+
|
|
20
|
+
class CapTagList extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
21
|
+
|
|
22
|
+
constructor(props) {
|
|
23
|
+
super(props);
|
|
24
|
+
this.state = {
|
|
25
|
+
tagValue: '',
|
|
26
|
+
expandedKeys: [],
|
|
27
|
+
searchValue: '',
|
|
28
|
+
autoExpandParent: true,
|
|
29
|
+
visible: false,
|
|
30
|
+
dynamicDateValue: '',
|
|
31
|
+
showModal: false,
|
|
32
|
+
};
|
|
33
|
+
this.renderTags = this.renderTags.bind(this);
|
|
34
|
+
this.getSearchedExpandedKeys = this.getSearchedExpandedKeys.bind(this);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
onChange = (e) => {
|
|
38
|
+
const value = e.target.value;
|
|
39
|
+
let expandedKeys = this.getSearchedExpandedKeys(this.props.tags, value);
|
|
40
|
+
if (value === '') {
|
|
41
|
+
expandedKeys = [];
|
|
42
|
+
}
|
|
43
|
+
this.setState({
|
|
44
|
+
expandedKeys,
|
|
45
|
+
searchValue: value,
|
|
46
|
+
autoExpandParent: true,
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
onExpand = (expandedKeys, info) => {
|
|
50
|
+
this.handleOnExpand(info.node.props.eventKey);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
getSearchedExpandedKeys(tags, value = '') {
|
|
54
|
+
let list = [];
|
|
55
|
+
_.forEach(tags, (val, key) => {
|
|
56
|
+
if (_.has(val, 'subtags')) {
|
|
57
|
+
if ((val.name || '').toLowerCase().indexOf(value.toLowerCase()) !== -1) {
|
|
58
|
+
list.push(key);
|
|
59
|
+
}
|
|
60
|
+
const temp = this.getSearchedExpandedKeys(val.subtags, value);
|
|
61
|
+
list = list.concat(temp);
|
|
62
|
+
} else if ((val.name || '').toLowerCase().indexOf(value.toLowerCase()) !== -1) {
|
|
63
|
+
list.push(key);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return list;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
handleOnChange = (data, e) => {
|
|
70
|
+
|
|
71
|
+
this.props.onContextChange(data);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
handleDynamicDateChange = (data, e) => {
|
|
75
|
+
|
|
76
|
+
this.setState({dynamicDateValue: data.target.value});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
handleOk = () => {
|
|
80
|
+
const days = this.state.dynamicDateValue;
|
|
81
|
+
let tagValue = this.state.tagValue;
|
|
82
|
+
tagValue = tagValue.replace("(N)", `${days}`);
|
|
83
|
+
const resultArray = [];
|
|
84
|
+
resultArray.push(tagValue);
|
|
85
|
+
this.props.onSelect(resultArray);
|
|
86
|
+
this.setState({showModal: false, dynamicDateValue: ''});
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
handleCancel = () => {
|
|
90
|
+
this.setState({showModal: false, dynamicDateValue: ''});
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
checkIfDynamicTag = (tag) => {
|
|
94
|
+
const regex = /dynamic_expiry_date_after_\(N\)_days.FORMAT_\d/g;
|
|
95
|
+
const match = regex.exec(tag);
|
|
96
|
+
if (match !== null) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
return false;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
handleOnSelect = (selectedKeys, info) => {
|
|
103
|
+
if (selectedKeys.length > 0) {
|
|
104
|
+
if (info && info.selectedNodes && info.selectedNodes.length > 0 && info.selectedNodes[0].props.isLeaf) {
|
|
105
|
+
this.setState({tagValue: selectedKeys[0]});
|
|
106
|
+
const ifDynamicTag = this.checkIfDynamicTag(selectedKeys[0]);
|
|
107
|
+
if (ifDynamicTag) {
|
|
108
|
+
this.renderDynamicTagFlow();
|
|
109
|
+
} else {
|
|
110
|
+
this.props.onSelect(selectedKeys, info);
|
|
111
|
+
this.setState({visible: false});
|
|
112
|
+
}
|
|
113
|
+
} else if (info && info.selectedNodes && info.selectedNodes.length > 0 && !info.selectedNodes[0].props.isLeaf) {
|
|
114
|
+
this.handleOnExpand(selectedKeys[0]);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
handleOnExpand = (key) => {
|
|
120
|
+
const expandedKeys = this.state.expandedKeys.slice();
|
|
121
|
+
const index = _.indexOf(expandedKeys, key);
|
|
122
|
+
if (index !== -1) {
|
|
123
|
+
expandedKeys.splice(index, 1);
|
|
124
|
+
} else {
|
|
125
|
+
expandedKeys.push(key);
|
|
126
|
+
}
|
|
127
|
+
this.setState({expandedKeys, autoExpandParent: false});
|
|
128
|
+
};
|
|
129
|
+
togglePopoverVisibility = (visible) => {
|
|
130
|
+
|
|
131
|
+
this.setState({visible});
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
renderDynamicTagFlow = () => {
|
|
135
|
+
this.setState({showModal: true, visible: false});
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
renderTags(tags, searchString = '') {
|
|
139
|
+
|
|
140
|
+
const list = [];
|
|
141
|
+
_.forEach(tags, (val, key) => {
|
|
142
|
+
let supportedTagsString = '';
|
|
143
|
+
_.forEach(val.supportedTags, (supportedTag) => {
|
|
144
|
+
supportedTagsString += `${supportedTag} ,`;
|
|
145
|
+
});
|
|
146
|
+
supportedTagsString = supportedTagsString.replace(/,\s*$/, "");
|
|
147
|
+
|
|
148
|
+
if (_.has(val, 'subtags')) {
|
|
149
|
+
const temp = this.renderTags(val.subtags);
|
|
150
|
+
list.push((
|
|
151
|
+
<TreeNode title={val.name} key={key}>
|
|
152
|
+
{temp}
|
|
153
|
+
</TreeNode>
|
|
154
|
+
));
|
|
155
|
+
} else if (searchString === '' || !searchString || ((val.name || '').toLowerCase().indexOf(searchString.toLowerCase()) !== -1)) {
|
|
156
|
+
const tempNode = (<TreeNode title={val.name} isLeaf key={key}></TreeNode>);
|
|
157
|
+
list.push(tempNode);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
return list;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
render() {
|
|
164
|
+
const tg = this.props.tags;
|
|
165
|
+
const options = [
|
|
166
|
+
{
|
|
167
|
+
value: "All",
|
|
168
|
+
label: this.props.intl.formatMessage(messages.all),
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
value: "Outbound",
|
|
172
|
+
label: this.props.intl.formatMessage(messages.outbound),
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
value: "Loyalty",
|
|
176
|
+
label: this.props.intl.formatMessage(messages.loyalty),
|
|
177
|
+
},
|
|
178
|
+
];
|
|
179
|
+
return (
|
|
180
|
+
<div>
|
|
181
|
+
<CapPopover
|
|
182
|
+
visible={this.state.visible}
|
|
183
|
+
onVisibleChange={this.togglePopoverVisibility}
|
|
184
|
+
content={<div>
|
|
185
|
+
<Spin tip={this.props?.intl?.formatMessage(messages.gettingTags)} spinning={this.props.loading}>
|
|
186
|
+
<Search style={{ marginBottom: 8, width: '250px'}} placeholder={this.props?.intl?.formatMessage(messages.searchText)} onChange={this.onChange} />
|
|
187
|
+
{this.props.moduleFilterEnabled ? <CapSelect getPopupContainer={(triggerNode) => triggerNode.parentNode} style={{width: '250px', marginBottom: '16px', minWidth: 'initial', display: 'inherit'}} onChange={this.props.onContextChange} defaultValue="All" options={options}>
|
|
188
|
+
</CapSelect> : ''}
|
|
189
|
+
<Tree
|
|
190
|
+
styling={{height: '350px', overflow: 'auto'}}
|
|
191
|
+
onSelect={this.handleOnSelect}
|
|
192
|
+
selectedKeys={this.state.tagValue}
|
|
193
|
+
expandedKeys={this.state.expandedKeys}
|
|
194
|
+
autoExpandParent={this.state.autoExpandParent}
|
|
195
|
+
onExpand={this.onExpand}
|
|
196
|
+
>
|
|
197
|
+
{this.renderTags(tg, this.state.searchValue)}
|
|
198
|
+
</Tree>
|
|
199
|
+
</Spin>
|
|
200
|
+
</div>}
|
|
201
|
+
trigger="click"
|
|
202
|
+
placement="bottomRight">
|
|
203
|
+
<CapButton icon="plus-circle-o" type="secondary">{this.props.label !== '' ? this.props.label : ''}</CapButton>
|
|
204
|
+
</CapPopover>
|
|
205
|
+
<Modal
|
|
206
|
+
visible={this.state.showModal}
|
|
207
|
+
title={this.props.intl.formatMessage(messages["Dynamic Days before Expiry"])}
|
|
208
|
+
onOk={this.handleOk}
|
|
209
|
+
onCancel={this.handleCancel}
|
|
210
|
+
footer={[
|
|
211
|
+
<CapButton key="back" onClick={this.handleCancel}>{this.props.intl.formatMessage(messages.Cancel)}</CapButton>,
|
|
212
|
+
<CapButton key="submit" type="primary" id="delete-version" onClick={this.handleOk}>
|
|
213
|
+
{this.props.intl.formatMessage(messages.Ok)}
|
|
214
|
+
</CapButton>,
|
|
215
|
+
]}
|
|
216
|
+
>
|
|
217
|
+
<p>{this.props.intl.formatMessage(messages.numberOfDaysBeforeExpiry)}</p>
|
|
218
|
+
<CapInput onChange={this.handleDynamicDateChange} value={this.state.dynamicDateValue}></CapInput>
|
|
219
|
+
</Modal>
|
|
220
|
+
</div>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
CapTagList.propTypes = {
|
|
226
|
+
tags: PropTypes.object,
|
|
227
|
+
onSelect: PropTypes.func,
|
|
228
|
+
label: PropTypes.string,
|
|
229
|
+
onContextChange: PropTypes.func,
|
|
230
|
+
loading: PropTypes.bool,
|
|
231
|
+
moduleFilterEnabled: PropTypes.bool,
|
|
232
|
+
intl: intlShape.isRequired,
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
export default injectIntl(CapTagList);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* CapTagList Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the CapTagList component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
"Ok": {
|
|
10
|
+
id: 'creatives.components.CapTagList.Ok',
|
|
11
|
+
defaultMessage: 'Ok',
|
|
12
|
+
},
|
|
13
|
+
"numberOfDaysBeforeExpiry": {
|
|
14
|
+
id: 'creatives.components.CapTagList.numberOfDaysBeforeExpiry',
|
|
15
|
+
defaultMessage: 'Number of days before expiry',
|
|
16
|
+
},
|
|
17
|
+
"Cancel": {
|
|
18
|
+
id: 'creatives.components.CapTagList.Cancel',
|
|
19
|
+
defaultMessage: 'Cancel',
|
|
20
|
+
},
|
|
21
|
+
"Dynamic Days before Expiry": {
|
|
22
|
+
id: 'creatives.components.CapTagList.dynamic_days_before_expiry',
|
|
23
|
+
defaultMessage: 'Dynamic days before expiry',
|
|
24
|
+
},
|
|
25
|
+
"all": {
|
|
26
|
+
id: 'creatives.components.CapTagList.all',
|
|
27
|
+
defaultMessage: 'All',
|
|
28
|
+
},
|
|
29
|
+
"outbound": {
|
|
30
|
+
id: 'creatives.components.CapTagList.outbound',
|
|
31
|
+
defaultMessage: 'Outbound',
|
|
32
|
+
},
|
|
33
|
+
"loyalty": {
|
|
34
|
+
id: 'creatives.components.CapTagList.loyalty',
|
|
35
|
+
defaultMessage: 'Loyalty',
|
|
36
|
+
},
|
|
37
|
+
"searchText": {
|
|
38
|
+
id: 'creatives.components.CapTagList.searchText',
|
|
39
|
+
defaultMessage: 'Search',
|
|
40
|
+
},
|
|
41
|
+
"gettingTags": {
|
|
42
|
+
id: 'creatives.components.CapTagList.gettingTags',
|
|
43
|
+
defaultMessage: "Getting tags...",
|
|
44
|
+
},
|
|
45
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
.custom-card {
|
|
2
|
+
&:hover {
|
|
3
|
+
box-shadow: none !important;
|
|
4
|
+
border-color: #1D5B96 !important
|
|
5
|
+
}
|
|
6
|
+
.ant-card-body {
|
|
7
|
+
padding: 0px;
|
|
8
|
+
border-radius: 4px;
|
|
9
|
+
|
|
10
|
+
// &:hover {
|
|
11
|
+
// border: solid 2px #1D5B96;
|
|
12
|
+
// border-radius: 4px;
|
|
13
|
+
// }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.content-wrapper {
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 246px;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
// padding-left: 16px;
|
|
21
|
+
// padding-right: 8px;
|
|
22
|
+
// background-image: url('https://s3.amazonaws.com/test_files_cache_bkp/intouch_creative_assets/475c8c1b8d07cf1d5e58.png');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.footer-wrapper {
|
|
26
|
+
width: 100%;
|
|
27
|
+
// height: 64px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.seperator-line{
|
|
31
|
+
color: #e9e9e9;
|
|
32
|
+
border-style: solid;
|
|
33
|
+
border-bottom: none;
|
|
34
|
+
}
|
|
35
|
+
.footer-wrapper {
|
|
36
|
+
.footer-container {
|
|
37
|
+
margin-top: -14px;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Card
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { Card } from 'antd';
|
|
11
|
+
import './_customCard.scss';
|
|
12
|
+
|
|
13
|
+
export class CustomCard extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
14
|
+
constructor(props) {
|
|
15
|
+
super(props);
|
|
16
|
+
this.handleMouseHover = this.handleMouseHover.bind(this);
|
|
17
|
+
this.handleMouseClick = this.handleMouseClick.bind(this);
|
|
18
|
+
this.state = {
|
|
19
|
+
isHovering: false,
|
|
20
|
+
isClicked: false,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
handleMouseClick() {
|
|
25
|
+
this.setState(this.toggleClickedState);
|
|
26
|
+
this.props.onClick(!this.state.isClicked, this.props.id);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
toggleClickedState(state) {
|
|
30
|
+
return {
|
|
31
|
+
isClicked: !state.isClicked,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
handleMouseHover(data) {
|
|
36
|
+
|
|
37
|
+
this.setState({isHovering: data});
|
|
38
|
+
this.props.onHover(!this.state.isHovering, this.props.id);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
toggleHoverState(state) {
|
|
42
|
+
return {
|
|
43
|
+
isHovering: !state.isHovering,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
render() {
|
|
48
|
+
return (
|
|
49
|
+
<Card
|
|
50
|
+
className="custom-card"
|
|
51
|
+
id={this.props.id}
|
|
52
|
+
title={this.props.title}
|
|
53
|
+
style={{ width: this.props.width, height: this.props.height }}
|
|
54
|
+
onMouseEnter={() => this.handleMouseHover(true)}
|
|
55
|
+
onClick={this.handleMouseClick}
|
|
56
|
+
onMouseLeave={() => this.handleMouseHover(false)}>
|
|
57
|
+
<div>
|
|
58
|
+
<div className="content-wrapper">{this.props.content}</div>
|
|
59
|
+
{this.props.footer ? <hr className="seperator-line" /> : ''}
|
|
60
|
+
{this.props.footer ? <div className="footer-wrapper">{this.props.footer}</div> : ''}
|
|
61
|
+
</div>
|
|
62
|
+
</Card>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
CustomCard.propTypes = {
|
|
68
|
+
content: PropTypes.element.isRequired,
|
|
69
|
+
width: PropTypes.string,
|
|
70
|
+
height: PropTypes.string,
|
|
71
|
+
footer: PropTypes.element,
|
|
72
|
+
title: PropTypes.string,
|
|
73
|
+
onHover: PropTypes.func,
|
|
74
|
+
onClick: PropTypes.func,
|
|
75
|
+
id: PropTypes.string.isRequired,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export default CustomCard;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`RestrictionPlainInput test Test 1 should render default component when a retriction constant is passed 1`] = `
|
|
4
|
+
<Card
|
|
5
|
+
className="custom-card"
|
|
6
|
+
onClick={[Function]}
|
|
7
|
+
onMouseEnter={[Function]}
|
|
8
|
+
onMouseLeave={[Function]}
|
|
9
|
+
style={
|
|
10
|
+
Object {
|
|
11
|
+
"height": undefined,
|
|
12
|
+
"width": undefined,
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
>
|
|
16
|
+
<div>
|
|
17
|
+
<div
|
|
18
|
+
className="content-wrapper"
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
</Card>
|
|
22
|
+
`;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { shallowWithIntl } from '../../../helpers/intl-enzym-test-helpers';
|
|
3
|
+
import { CustomCard } from '../index';
|
|
4
|
+
|
|
5
|
+
describe('RestrictionPlainInput test', () => {
|
|
6
|
+
let renderedComponent;
|
|
7
|
+
|
|
8
|
+
const renderFunc = () => {
|
|
9
|
+
renderedComponent = shallowWithIntl(
|
|
10
|
+
<CustomCard />
|
|
11
|
+
);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
describe('Test 1', () => {
|
|
15
|
+
it('should render default component when a retriction constant is passed', () => {
|
|
16
|
+
renderFunc();
|
|
17
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* CardGrid
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { Row, Col } from 'antd';
|
|
11
|
+
import CustomCard from '../Card';
|
|
12
|
+
|
|
13
|
+
class CardGrid extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
14
|
+
constructor(props) {
|
|
15
|
+
super(props);
|
|
16
|
+
this.handleOnItemHover = this.handleOnItemHover.bind(this);
|
|
17
|
+
this.handleOnItemClick = this.handleOnItemClick.bind(this);
|
|
18
|
+
this.delayTimer = 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
handleOnItemHover(state, id) {
|
|
22
|
+
this.delay(() => {
|
|
23
|
+
this.props.onHoverItem(state, id);
|
|
24
|
+
}, 200);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
delay(callback, ms) {
|
|
28
|
+
clearTimeout(this.delayTimer);
|
|
29
|
+
this.delayTimer = setTimeout(callback, ms);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
handleOnItemClick(state, id) {
|
|
33
|
+
this.props.onItemClick(state, id);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
render() {
|
|
37
|
+
return (
|
|
38
|
+
<div className={this.props.className}>
|
|
39
|
+
<div style={{ marginBottom: '16px' }}>{this.props.filterContent}</div>
|
|
40
|
+
<div className={this.props.enablePagination ? 'pagination-container' : ''}>
|
|
41
|
+
<Row gutter={this.props.gutterSize}>
|
|
42
|
+
{ this.props.listItem.length > 0 ? this.props.listItem.map( (item) => (
|
|
43
|
+
<Col style={{ width: `${100 / this.props.colNumber}%`, paddingBottom: '16px'}} key={item.id} span={parseInt(24 / this.props.colNumber, 10)}>
|
|
44
|
+
<CustomCard id={item.id} onHover={this.handleOnItemHover} onClick={this.handleOnItemClick} content={item.content} footer={item.footer} height={item.footer ? "312px" : "258px"}></CustomCard>
|
|
45
|
+
</Col>
|
|
46
|
+
)) : ''}
|
|
47
|
+
</Row>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
CardGrid.propTypes = {
|
|
55
|
+
listItem: PropTypes.array.isRequired,
|
|
56
|
+
filterContent: PropTypes.element,
|
|
57
|
+
colNumber: PropTypes.number,
|
|
58
|
+
gutterSize: PropTypes.number,
|
|
59
|
+
onHoverItem: PropTypes.func,
|
|
60
|
+
onItemClick: PropTypes.func,
|
|
61
|
+
className: PropTypes.string,
|
|
62
|
+
enablePagination: PropTypes.bool,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
CardGrid.defaultProps = {
|
|
66
|
+
gutterSize: 16,
|
|
67
|
+
colNumber: 4,
|
|
68
|
+
className: '',
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export default CardGrid;
|