@capillarytech/creatives-library 2.0.83 → 2.0.85
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/app.js +9 -2
- package/config/app.js +4 -4
- package/config/path.js +1 -0
- package/index.js +4 -4
- package/package.json +2 -2
- package/routes.js +5 -0
- package/v2Components/EmailPreviewV2/index.js +3 -3
- package/v2Components/NavigationBar/index.js +235 -0
- package/v2Components/NavigationBar/messages.js +20 -0
- package/v2Components/NavigationBar/tests/index.test.js +11 -0
- package/v2Components/TopBar/index.js +63 -106
- package/v2Components/TopBar/messages.js +8 -0
- package/v2Containers/Cap/actions.js +12 -0
- package/v2Containers/Cap/constants.js +10 -0
- package/v2Containers/Cap/index.js +26 -142
- package/v2Containers/Cap/reducer.js +14 -0
- package/v2Containers/Cap/sagas.js +24 -0
- package/components/CallTaskPreview/_callTaskPreview.scss +0 -17
- package/components/CallTaskPreview/images/Footer.png +0 -0
- package/components/CallTaskPreview/images/Header.png +0 -0
- package/components/CallTaskPreview/index.js +0 -37
- package/components/CallTaskPreview/messages.js +0 -13
- package/components/CallTaskPreview/tests/index.test.js +0 -15
- package/components/CmsTemplatesComponent/index.js +0 -33
- package/components/CmsTemplatesComponent/messages.js +0 -17
- package/components/CmsTemplatesComponent/tests/index.test.js +0 -10
- package/components/EmailMobilePreview/index.js +0 -129
- package/components/EmailMobilePreview/index.scss +0 -55
- package/components/EmailPreviewV2/_emailPreviewV2.scss +0 -69
- package/components/EmailPreviewV2/index.js +0 -132
- package/components/EmailPreviewV2/messages.js +0 -41
- package/components/EmailPreviewV2/tests/index.test.js +0 -10
- package/components/MobilePushPreviewV2/index.js +0 -120
- package/components/MobilePushPreviewV2/messages.js +0 -13
- package/components/MobilePushPreviewV2/tests/index.test.js +0 -10
- package/components/NewCallTask/_newCallTask.scss +0 -9
- package/components/NewCallTask/index.js +0 -152
- package/components/NewCallTask/messages.js +0 -29
- package/components/NewCallTask/tests/index.test.js +0 -10
package/app.js
CHANGED
|
@@ -6,7 +6,8 @@ import createHistory from 'history/lib/createBrowserHistory';
|
|
|
6
6
|
import { applyRouterMiddleware, Router, useRouterHistory } from 'react-router';
|
|
7
7
|
import { syncHistoryWithStore } from 'react-router-redux';
|
|
8
8
|
import { useScroll } from 'react-router-scroll';
|
|
9
|
-
import
|
|
9
|
+
import CapV2 from 'v2Containers/Cap';
|
|
10
|
+
import Cap from 'containers/Cap';
|
|
10
11
|
import { LocaleProvider } from 'antd';
|
|
11
12
|
import { makeSelectLocationState } from 'containers/Cap/selectors';
|
|
12
13
|
import LanguageProvider from 'containers/LanguageProvider';
|
|
@@ -35,7 +36,13 @@ const history = syncHistoryWithStore(browserHistory, store, {
|
|
|
35
36
|
});
|
|
36
37
|
|
|
37
38
|
const rootRoute = {
|
|
38
|
-
component:
|
|
39
|
+
component: (props) => {
|
|
40
|
+
// eslint-disable-next-line react/prop-types
|
|
41
|
+
if (props.location.pathname === 'v2') {
|
|
42
|
+
return <CapV2 {...props} />;
|
|
43
|
+
}
|
|
44
|
+
return <Cap {...props} />;
|
|
45
|
+
},
|
|
39
46
|
childRoutes: createRoutes(store),
|
|
40
47
|
};
|
|
41
48
|
|
package/config/app.js
CHANGED
|
@@ -6,16 +6,16 @@ const config = {
|
|
|
6
6
|
api_endpoint: '/arya/api/v1/creatives',
|
|
7
7
|
auth_endpoint: '/arya/api/v1/auth',
|
|
8
8
|
login_url: 'auth/login',
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
dashboard_url: '/sms',
|
|
10
|
+
dashboard_url_v2: '/v2',
|
|
11
11
|
accountConfig: (strs, accountId) => `org/config/AccountAdd?q=a&channelId=2&accountId=${accountId}&edit=1`,
|
|
12
12
|
},
|
|
13
13
|
development: {
|
|
14
14
|
api_endpoint: 'https://nightly.capillary.in/arya/api/v1/creatives',
|
|
15
15
|
auth_endpoint: 'https://nightly.capillary.in/arya/api/v1/auth',
|
|
16
16
|
login_url: 'auth/login',
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
dashboard_url: '/sms',
|
|
18
|
+
dashboard_url_v2: '/v2',
|
|
19
19
|
},
|
|
20
20
|
testing: {
|
|
21
21
|
api_endpoint: '',
|
package/config/path.js
CHANGED
package/index.js
CHANGED
|
@@ -72,10 +72,10 @@ export {default as TagListSaga} from './v2Containers/TagList/sagas';
|
|
|
72
72
|
export {default as TagListReducer} from './v2Containers/TagList/reducer';
|
|
73
73
|
export {default as TemplatePreview} from './components/TemplatePreview';
|
|
74
74
|
export {default as EmailPreview} from './components/EmailPreview';
|
|
75
|
-
export {default as EmailPreviewV2} from './
|
|
76
|
-
export {default as CallTaskPreview} from './
|
|
77
|
-
export {default as EmailMobilePreview} from './
|
|
78
|
-
export {default as MobilePushPreview} from './
|
|
75
|
+
export {default as EmailPreviewV2} from './v2Components/EmailPreviewV2';
|
|
76
|
+
export {default as CallTaskPreview} from './v2Components/CallTaskPreview';
|
|
77
|
+
export {default as EmailMobilePreview} from './v2Components/EmailMobilePreview';
|
|
78
|
+
export {default as MobilePushPreview} from './v2Components/MobilePushPreviewV2';
|
|
79
79
|
CreativesContainer.CreativesContainerReducer = CreativesContainerReducer;
|
|
80
80
|
|
|
81
81
|
export { CapContainer,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capillarytech/creatives-library",
|
|
3
3
|
"author": "meharaj",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.85",
|
|
5
5
|
"description": "Capillary creatives ui",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"module": "./index.es.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"license": "LicenseRef-LICENSE",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@capillarytech/cap-react-ui-library": "^1.11.14",
|
|
16
|
-
"@capillarytech/cap-ui-library": "^1.0.
|
|
16
|
+
"@capillarytech/cap-ui-library": "^1.0.168",
|
|
17
17
|
"antd": "3.19.6",
|
|
18
18
|
"axios": "^0.16.2",
|
|
19
19
|
"babel-polyfill": "6.20.0",
|
package/routes.js
CHANGED
|
@@ -602,6 +602,8 @@ export default function createRoutes(store) {
|
|
|
602
602
|
import('v2Containers/Templates/reducer'),
|
|
603
603
|
import('v2Containers/Templates/sagas'),
|
|
604
604
|
import('v2Containers/TemplatesV2'),
|
|
605
|
+
import('v2Containers/Cap/reducer'),
|
|
606
|
+
import('v2Containers/Cap/sagas'),
|
|
605
607
|
import('v2Containers/Email/sagas'),
|
|
606
608
|
import('v2Containers/CreativesContainer/reducer'),
|
|
607
609
|
import('v2Containers/Sms/Create/reducer'),
|
|
@@ -624,6 +626,7 @@ export default function createRoutes(store) {
|
|
|
624
626
|
|
|
625
627
|
importModules.then(([reducer,
|
|
626
628
|
sagas, component,
|
|
629
|
+
capReducer, capSagas,
|
|
627
630
|
emailContainerSagas, creativesContainerReducer,
|
|
628
631
|
smsCreateReducer, smsCreateSaga, smsEditReducer, smsEditSaga,
|
|
629
632
|
emailReducer, emailSaga,
|
|
@@ -633,6 +636,7 @@ export default function createRoutes(store) {
|
|
|
633
636
|
galleryReducer, gallerySagas,
|
|
634
637
|
]) => {
|
|
635
638
|
injectReducer('templates', reducer.default);
|
|
639
|
+
injectReducer('cap', capReducer.default);
|
|
636
640
|
injectReducer('create', smsCreateReducer.default);
|
|
637
641
|
injectReducer('creativesContainer', creativesContainerReducer.default);
|
|
638
642
|
injectReducer('edit', smsEditReducer.default);
|
|
@@ -643,6 +647,7 @@ export default function createRoutes(store) {
|
|
|
643
647
|
injectReducer('gallery', galleryReducer.default);
|
|
644
648
|
injectSagas(gallerySagas.default);
|
|
645
649
|
injectSagas(sagas.default);
|
|
650
|
+
injectSagas(capSagas.default);
|
|
646
651
|
injectSagas(emailContainerSagas.default);
|
|
647
652
|
injectSagas(smsCreateSaga.default);
|
|
648
653
|
injectSagas(smsEditSaga.default);
|
|
@@ -19,8 +19,8 @@ import './_emailPreviewV2.scss';
|
|
|
19
19
|
import tabletBody from '../../assets/iPad.svg';
|
|
20
20
|
import mobileBody from '../../assets/mobile.png';
|
|
21
21
|
|
|
22
|
-
import {selectTemplateContent} from '../../
|
|
23
|
-
import * as templateActions from '../../
|
|
22
|
+
import {selectTemplateContent} from '../../v2Containers/Templates/selectors';
|
|
23
|
+
import * as templateActions from '../../v2Containers/Templates/actions';
|
|
24
24
|
|
|
25
25
|
const deviceAspectRatio = {
|
|
26
26
|
desktop: {
|
|
@@ -99,7 +99,7 @@ class EmailPreviewV2 extends React.Component {
|
|
|
99
99
|
</div>
|
|
100
100
|
</div>
|
|
101
101
|
</div>
|
|
102
|
-
{this.props.templateData &&
|
|
102
|
+
{this.props.templateData && this.props.templateData.updatedByName &&
|
|
103
103
|
[
|
|
104
104
|
<p className="preview-info" key="lastModified"><FormattedMessage {...messages.lastModified} />: {moment(this.props.templateData.updatedAt).format('MM-DD-YYYY')}</p>,
|
|
105
105
|
<p style={{marginBottom: '8px'}} key="uploadedBy" className="preview-info"><FormattedMessage {...messages.uploadedBy} /> : {this.props.templateData.updatedByName}</p>,
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* NavigationBar
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import styled from 'styled-components';
|
|
10
|
+
import { isEmpty, forEach } from 'lodash';
|
|
11
|
+
import { loadItem } from 'services/localStorageApi';
|
|
12
|
+
import { intlShape, injectIntl } from 'react-intl';
|
|
13
|
+
import TopBar from '../TopBar';
|
|
14
|
+
import messages from './messages';
|
|
15
|
+
|
|
16
|
+
const EMBEDDED = 'embedded';
|
|
17
|
+
|
|
18
|
+
const CapWrapper = styled.div`
|
|
19
|
+
position: absolute;
|
|
20
|
+
padding: 0;
|
|
21
|
+
background-color: #ffffff;
|
|
22
|
+
width: 100%;
|
|
23
|
+
display: flex;
|
|
24
|
+
margin-top: ${(props) => props.isEmbedded ? '0px' : '64px'}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
const ComponentWrapper = styled.div`
|
|
28
|
+
max-width: 1140px;
|
|
29
|
+
margin: 0 auto;
|
|
30
|
+
width: 100%;
|
|
31
|
+
padding: 24px 0;
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
class NavigationBar extends React.Component {
|
|
35
|
+
constructor(props) {
|
|
36
|
+
super(props);
|
|
37
|
+
this.state = {
|
|
38
|
+
selectedProduct: '',
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
onBrandSettingsClick = () => {
|
|
43
|
+
const { brandSettingsUrl } = this.props;
|
|
44
|
+
if (brandSettingsUrl) {
|
|
45
|
+
const stateObj = {
|
|
46
|
+
page: "brand settings",
|
|
47
|
+
};
|
|
48
|
+
window.history.pushState(stateObj, 'BrandSettings', window.location.replace(brandSettingsUrl));
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
onProfileSettingsClick = () => {
|
|
53
|
+
const { profileSettingsUrl } = this.props;
|
|
54
|
+
if (profileSettingsUrl) {
|
|
55
|
+
const stateObj = {
|
|
56
|
+
page: "profile settings",
|
|
57
|
+
};
|
|
58
|
+
window.history.pushState(stateObj, 'ProfileSettings', window.location.replace(profileSettingsUrl));
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
onSettingsIconClick = () => {
|
|
63
|
+
const { settingsUrl } = this.props;
|
|
64
|
+
if (settingsUrl) {
|
|
65
|
+
const stateObj = {
|
|
66
|
+
page: "settings",
|
|
67
|
+
};
|
|
68
|
+
window.history.pushState(stateObj, 'Settings', window.location.replace(settingsUrl));
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
onHelpIconClick = () => {
|
|
73
|
+
const { helpUrl } = this.props;
|
|
74
|
+
if (helpUrl) {
|
|
75
|
+
const stateObj = {
|
|
76
|
+
page: "help",
|
|
77
|
+
};
|
|
78
|
+
window.history.pushState(stateObj, 'Help', window.location.replace(helpUrl));
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
getProxyOrgList = () => {
|
|
83
|
+
const { userData } = this.props;
|
|
84
|
+
const proxyOrgList = [];
|
|
85
|
+
if (userData && userData.user && userData.user !== '') {
|
|
86
|
+
const defaultOrgName = userData.user.orgName;
|
|
87
|
+
const defaultOrgId = userData.user.orgID;
|
|
88
|
+
proxyOrgList.push({ label: defaultOrgName, value: defaultOrgId, key: defaultOrgId });
|
|
89
|
+
const orgList = userData.user.proxyOrgList;
|
|
90
|
+
if (!isEmpty(orgList)) {
|
|
91
|
+
forEach(orgList, (item) => {
|
|
92
|
+
const id = item.orgID;
|
|
93
|
+
let name = item.orgName;
|
|
94
|
+
if (id === 486) {
|
|
95
|
+
name = 'Demo Org';
|
|
96
|
+
}
|
|
97
|
+
if (id !== defaultOrgId) {
|
|
98
|
+
proxyOrgList.push({ label: name, value: id, key: id });
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return proxyOrgList;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
getProductsList = () => {
|
|
107
|
+
const { currentOrgDetails } = this.props.userData;
|
|
108
|
+
const productsList = [];
|
|
109
|
+
if (currentOrgDetails) {
|
|
110
|
+
forEach(currentOrgDetails.module_details, (module) => {
|
|
111
|
+
if (module.name.toLowerCase() !== 'masters') {
|
|
112
|
+
productsList.push({
|
|
113
|
+
value: module.name.toLowerCase(),
|
|
114
|
+
url: module.url,
|
|
115
|
+
key: module.code,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return productsList;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
getTopbarIcons = () => [
|
|
124
|
+
{
|
|
125
|
+
iconType: 'help',
|
|
126
|
+
key: 'help',
|
|
127
|
+
onClickHandler: () => this.onHelpIconClick(),
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
iconType: 'settings',
|
|
131
|
+
key: 'settings',
|
|
132
|
+
onClickHandler: () => this.onSettingsIconClick(),
|
|
133
|
+
},
|
|
134
|
+
];
|
|
135
|
+
|
|
136
|
+
getDropdownMenu = () => [
|
|
137
|
+
{
|
|
138
|
+
label: 'Profile Settings',
|
|
139
|
+
key: 'Profile Settings',
|
|
140
|
+
onClickHandler: () => this.onProfileSettingsClick(),
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
label: 'Brand Settings',
|
|
144
|
+
key: 'Brand Settings',
|
|
145
|
+
onClickHandler: () => this.onBrandSettingsClick(),
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
label: 'Logout',
|
|
149
|
+
key: 'Logout',
|
|
150
|
+
onClickHandler: () => this.props.logout(),
|
|
151
|
+
},
|
|
152
|
+
];
|
|
153
|
+
|
|
154
|
+
handleTopbarMenuChange = (option) => {
|
|
155
|
+
window.location.pathname = option.link;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
handleOrgChange = (orgId) => {
|
|
159
|
+
const selectedOrg = loadItem('orgID');
|
|
160
|
+
if (selectedOrg !== orgId) {
|
|
161
|
+
this.props.changeOrg(orgId);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
handleProductChange = (product) => {
|
|
166
|
+
const { location } = this.props;
|
|
167
|
+
const { basename } = location;
|
|
168
|
+
this.setState({ selectedProduct: product.value }, () => {
|
|
169
|
+
if (product.url !== `${basename}/index`) {
|
|
170
|
+
window.location.pathname = product.url;
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
render() {
|
|
176
|
+
const {
|
|
177
|
+
topbarMenuData,
|
|
178
|
+
loggedIn,
|
|
179
|
+
intl,
|
|
180
|
+
type,
|
|
181
|
+
} = this.props;
|
|
182
|
+
const productsList = this.getProductsList();
|
|
183
|
+
const proxyOrgList = this.getProxyOrgList();
|
|
184
|
+
const selectedOrg = loadItem('orgID');
|
|
185
|
+
const dropdownMenuProps = this.getDropdownMenu();
|
|
186
|
+
const topbarIcons = this.getTopbarIcons();
|
|
187
|
+
const { selectedProduct } = this.state;
|
|
188
|
+
const customTopBarProps = {};
|
|
189
|
+
return (
|
|
190
|
+
<div>
|
|
191
|
+
{loggedIn && type !== EMBEDDED &&
|
|
192
|
+
<TopBar
|
|
193
|
+
productsList={productsList}
|
|
194
|
+
selectedProduct={
|
|
195
|
+
selectedProduct ||
|
|
196
|
+
intl.formatMessage(messages.selectedProductDefault)
|
|
197
|
+
}
|
|
198
|
+
handleProductChange={this.handleProductChange}
|
|
199
|
+
proxyOrgList={proxyOrgList}
|
|
200
|
+
selectedOrg={selectedOrg}
|
|
201
|
+
handleOrgChange={this.handleOrgChange}
|
|
202
|
+
topbarMenuData={topbarMenuData}
|
|
203
|
+
handleTopbarMenuChange={this.handleTopbarMenuChange}
|
|
204
|
+
dropdownMenuProps={dropdownMenuProps}
|
|
205
|
+
topbarIcons={topbarIcons}
|
|
206
|
+
{...customTopBarProps}
|
|
207
|
+
/>
|
|
208
|
+
}
|
|
209
|
+
<CapWrapper isEmbedded={type === EMBEDDED}>
|
|
210
|
+
<ComponentWrapper>
|
|
211
|
+
{React.Children.toArray(this.props.children)}
|
|
212
|
+
</ComponentWrapper>
|
|
213
|
+
</CapWrapper>
|
|
214
|
+
</div>
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
NavigationBar.propTypes = {
|
|
220
|
+
userData: PropTypes.object,
|
|
221
|
+
topbarMenuData: PropTypes.array,
|
|
222
|
+
logout: PropTypes.func,
|
|
223
|
+
changeOrg: PropTypes.func,
|
|
224
|
+
settingsUrl: PropTypes.string,
|
|
225
|
+
children: PropTypes.node,
|
|
226
|
+
helpUrl: PropTypes.string,
|
|
227
|
+
profileSettingsUrl: PropTypes.string,
|
|
228
|
+
brandSettingsUrl: PropTypes.string,
|
|
229
|
+
loggedIn: PropTypes.bool,
|
|
230
|
+
intl: intlShape.isRequired,
|
|
231
|
+
location: PropTypes.object,
|
|
232
|
+
type: PropTypes.string,
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
export default injectIntl(NavigationBar);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* NavigationBar Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the NavigationBar component.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { defineMessages } from 'react-intl';
|
|
8
|
+
|
|
9
|
+
export const scope = 'app.components.NavigationBar';
|
|
10
|
+
|
|
11
|
+
export default defineMessages({
|
|
12
|
+
header: {
|
|
13
|
+
id: `${scope}.header`,
|
|
14
|
+
defaultMessage: 'This is the NavigationBar component!',
|
|
15
|
+
},
|
|
16
|
+
selectedProductDefault: {
|
|
17
|
+
id: `${scope}.selectedProductDefault`,
|
|
18
|
+
defaultMessage: 'Campaigns',
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// import React from 'react';
|
|
2
|
+
// import { mount } from 'enzyme';
|
|
3
|
+
// import { enzymeFind } from 'styled-components/test-utils';
|
|
4
|
+
|
|
5
|
+
// import NavigationBar from '../index';
|
|
6
|
+
|
|
7
|
+
describe('<NavigationBar />', () => {
|
|
8
|
+
it('Expect to have unit tests specified', () => {
|
|
9
|
+
expect(true).toEqual(true); // this component will be replaced so just this test case
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -1,113 +1,70 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { Link } from 'react-router';
|
|
8
|
-
|
|
9
|
-
import { loadItem } from 'services/localStorageApi';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { CapTopBar, CapHeading } from '@capillarytech/cap-ui-library';
|
|
4
|
+
import { CAP_SPACE_24 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
5
|
+
import { intlShape, injectIntl } from 'react-intl';
|
|
10
6
|
import messages from './messages';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const logo = require('./assets/images/capillary_logo.png');
|
|
14
|
-
|
|
15
|
-
class TopBar extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
16
|
-
constructor(props) {
|
|
17
|
-
super(props);
|
|
18
|
-
this.state = {
|
|
19
|
-
activeItem: '',
|
|
20
|
-
orgList: [],
|
|
21
|
-
selectedOrg: loadItem('orgID'),
|
|
22
|
-
};
|
|
23
|
-
this.handleItemClick = this.handleItemClick.bind(this);
|
|
24
|
-
this.logout = this.logout.bind(this);
|
|
25
|
-
this.handleOrgChange = this.handleOrgChange.bind(this);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
componentDidUpdate(prevProps) {
|
|
29
|
-
if (prevProps.orgID !== this.props.orgID) {
|
|
30
|
-
this.props.navigateToDashboard();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
handleOrgChange(data) {
|
|
35
|
-
const orgId = data.value;
|
|
36
|
-
if (this.state.selectedOrg !== orgId) {
|
|
37
|
-
this.props.changeOrg(orgId);
|
|
38
|
-
this.setState({ selectedOrg: orgId });
|
|
39
|
-
}
|
|
40
|
-
}
|
|
7
|
+
const drawerPlacement = 'left';
|
|
41
8
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
<a href="" className="item hide"><FormattedMessage {...messages.profile} /><i className="user icon" /></a>
|
|
90
|
-
<a href="" className="item hide"><FormattedMessage {...messages.settings} /> <i className="settings icon" /></a>
|
|
91
|
-
<a href="" className="item" onClick={this.logout}><FormattedMessage {...messages.logout} />
|
|
92
|
-
<i className="sign out icon" /></a> </div >}
|
|
93
|
-
on="click" position="bottom right" offset={7}
|
|
94
|
-
/>
|
|
95
|
-
</Menu.Item>
|
|
96
|
-
</Menu.Menu>
|
|
97
|
-
</Menu>
|
|
98
|
-
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
9
|
+
const TopBar = (props) => {
|
|
10
|
+
const {
|
|
11
|
+
productsList,
|
|
12
|
+
selectedProduct,
|
|
13
|
+
handleProductChange,
|
|
14
|
+
proxyOrgList,
|
|
15
|
+
selectedOrg,
|
|
16
|
+
handleOrgChange,
|
|
17
|
+
topbarMenuData,
|
|
18
|
+
handleTopbarMenuChange,
|
|
19
|
+
dropdownMenuProps,
|
|
20
|
+
topbarIcons,
|
|
21
|
+
intl,
|
|
22
|
+
} = props;
|
|
23
|
+
return (
|
|
24
|
+
<CapTopBar
|
|
25
|
+
drawerListProps={{
|
|
26
|
+
productsList,
|
|
27
|
+
selectedProduct,
|
|
28
|
+
handleProductChange,
|
|
29
|
+
title: (
|
|
30
|
+
<CapHeading type="h5" style={{ margin: `${CAP_SPACE_24} 0` }}>
|
|
31
|
+
{intl.formatMessage(messages.selectProduct)}
|
|
32
|
+
</CapHeading>
|
|
33
|
+
),
|
|
34
|
+
closable: false,
|
|
35
|
+
placement: drawerPlacement,
|
|
36
|
+
width: 320,
|
|
37
|
+
}}
|
|
38
|
+
selectProps={{
|
|
39
|
+
items: proxyOrgList,
|
|
40
|
+
selectedItem: selectedOrg,
|
|
41
|
+
handleItemChange: handleOrgChange,
|
|
42
|
+
selectPlaceholder: intl.formatMessage(messages.selectOrganization),
|
|
43
|
+
showSearch: true,
|
|
44
|
+
showHeader: true,
|
|
45
|
+
}}
|
|
46
|
+
menuProps={{
|
|
47
|
+
items: topbarMenuData,
|
|
48
|
+
defaultSelectedKeys: ['creatives'],
|
|
49
|
+
onMenuItemClick: handleTopbarMenuChange,
|
|
50
|
+
}}
|
|
51
|
+
dropdownMenuProps={dropdownMenuProps}
|
|
52
|
+
topbarIcons={topbarIcons}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
102
56
|
|
|
103
57
|
TopBar.propTypes = {
|
|
104
|
-
|
|
58
|
+
productsList: PropTypes.array,
|
|
59
|
+
selectedProduct: PropTypes.string,
|
|
60
|
+
handleProductChange: PropTypes.func,
|
|
105
61
|
proxyOrgList: PropTypes.array,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
62
|
+
selectedOrg: PropTypes.number,
|
|
63
|
+
handleOrgChange: PropTypes.func,
|
|
64
|
+
topbarMenuData: PropTypes.array,
|
|
65
|
+
handleTopbarMenuChange: PropTypes.func,
|
|
66
|
+
topbarIcons: PropTypes.array,
|
|
67
|
+
dropdownMenuProps: PropTypes.array,
|
|
68
|
+
intl: intlShape.isRequired,
|
|
111
69
|
};
|
|
112
|
-
|
|
113
|
-
export default TopBar;
|
|
70
|
+
export default injectIntl(TopBar);
|
|
@@ -26,4 +26,12 @@ export default defineMessages({
|
|
|
26
26
|
id: 'app.components.TopBar.brand.dropdown',
|
|
27
27
|
defaultMessage: 'Hi',
|
|
28
28
|
},
|
|
29
|
+
selectOrganization: {
|
|
30
|
+
id: 'app.components.TopBar.brand.selectOrganization',
|
|
31
|
+
defaultMessage: 'Select Organization',
|
|
32
|
+
},
|
|
33
|
+
selectProduct: {
|
|
34
|
+
id: 'app.components.TopBar.brand.selectProduct',
|
|
35
|
+
defaultMessage: 'Select Product',
|
|
36
|
+
},
|
|
29
37
|
});
|
|
@@ -62,3 +62,15 @@ export function setInjectedTags(injectedTags) {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
export function getTopbarMenuData() {
|
|
66
|
+
return {
|
|
67
|
+
type: types.GET_TOPBAR_MENU_DATA_REQUEST,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function clearTopbarMenuData() {
|
|
72
|
+
return {
|
|
73
|
+
type: types.CLEAR_TOPBAR_MENU_DATA,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
@@ -22,3 +22,13 @@ export const CLEAR_META_ENTITIES = 'cap/CLEAR_META_ENTITIES';
|
|
|
22
22
|
export const HIDE_TAGS = 'cap/HIDE_TAGS';
|
|
23
23
|
|
|
24
24
|
export const SET_INJECTED_TAGS = 'cap/SET_INJECTED_TAGS';
|
|
25
|
+
|
|
26
|
+
export const GET_TOPBAR_MENU_DATA_REQUEST = 'creatives/cap/GET_TOPBAR_MENU_DATA_REQUEST';
|
|
27
|
+
export const GET_TOPBAR_MENU_DATA_SUCCESS = 'creatives/cap/GET_TOPBAR_MENU_DATA_SUCCESS';
|
|
28
|
+
export const GET_TOPBAR_MENU_DATA_FAILURE = 'creatives/cap/GET_TOPBAR_MENU_DATA_FAILURE';
|
|
29
|
+
export const CLEAR_TOPBAR_MENU_DATA = 'creatives/cap/CLEAR_TOPBAR_MENU_DATA';
|
|
30
|
+
|
|
31
|
+
export const CAMPAIGN_SETTINGS_URL = '/campaign/settings/message?from="/creatives/ui/v2/"';
|
|
32
|
+
export const BRAND_SETTINGS_URL = '/org/index';
|
|
33
|
+
export const PROFILE_SETTINGS_URL = '/org/users/NewProfile';
|
|
34
|
+
export const HELP_URL = 'https://support.capillarytech.com';
|