@capillarytech/creatives-library 6.11.8 → 6.11.9
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/TemplatePreview/index.js +2 -1
- package/containers/Cap/actions.js +2 -1
- package/containers/Cap/index.js +12 -5
- package/containers/Cap/sagas.js +4 -1
- package/global-styles.js +4 -0
- package/package.json +1 -1
- package/v2Components/AccessForbidden/index.js +20 -0
- package/v2Components/AccessForbidden/messages.js +14 -0
- package/v2Components/NavigationBar/messages.js +13 -13
- package/v2Components/TemplatePreview/index.js +2 -1
- package/v2Containers/App/constants.js +2 -0
- package/v2Containers/Cap/index.js +8 -2
- package/v2Containers/Line/Container/Video/index.js +4 -1
- package/v2Containers/TemplatesV2/index.js +27 -17
|
@@ -217,6 +217,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
217
217
|
alignItems: 'center',
|
|
218
218
|
backgroundColor: !video ? 'transparent' : CAP_G06,
|
|
219
219
|
marginTop: 0,
|
|
220
|
+
padding: 0,
|
|
220
221
|
}}
|
|
221
222
|
key={video}
|
|
222
223
|
>
|
|
@@ -224,7 +225,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
224
225
|
video
|
|
225
226
|
? (
|
|
226
227
|
<>
|
|
227
|
-
<video
|
|
228
|
+
<video style={{ opacity: 0.5, width: '100%' }}>
|
|
228
229
|
<source src={video} type="video/mp4" />
|
|
229
230
|
</video>
|
|
230
231
|
<div
|
package/containers/Cap/index.js
CHANGED
|
@@ -22,6 +22,9 @@ import config from '../../config/app';
|
|
|
22
22
|
import Toastr from '../../components/Toastr';
|
|
23
23
|
import messages from './messages';
|
|
24
24
|
import { makeSelectLocale } from '../../v2Containers/LanguageProvider/selectors';
|
|
25
|
+
import { CREATIVES_UI_VIEW } from '../../v2Containers/App/constants';
|
|
26
|
+
import AccessForbidden from '../../v2Components/AccessForbidden';
|
|
27
|
+
|
|
25
28
|
const gtm = window.dataLayer || [];
|
|
26
29
|
|
|
27
30
|
const CapWrapper = styled.div`
|
|
@@ -39,6 +42,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
39
42
|
this.state = {
|
|
40
43
|
menuData: [],
|
|
41
44
|
switchedOrg: false,
|
|
45
|
+
isCreativesAccessible: true,
|
|
42
46
|
};
|
|
43
47
|
this.changeOrg = this.changeOrg.bind(this);
|
|
44
48
|
this.logout = this.logout.bind(this);
|
|
@@ -47,7 +51,11 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
componentWillMount() {
|
|
50
|
-
this.props.actions.getUserData()
|
|
54
|
+
this.props.actions.getUserData((userData) => {
|
|
55
|
+
if (!userData.accessiblePermissions.includes(CREATIVES_UI_VIEW)) {
|
|
56
|
+
this.setState({ isCreativesAccessible: false });
|
|
57
|
+
}
|
|
58
|
+
});
|
|
51
59
|
if (this.props.Global.user) {
|
|
52
60
|
const userGtmData = this.getUserGtmData(this.props);
|
|
53
61
|
gtm.push(userGtmData);
|
|
@@ -195,14 +203,12 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
195
203
|
const type = this.props.location.query.type;
|
|
196
204
|
// const changeOrg = this.props.actions.changeOrg;
|
|
197
205
|
// const logout = this.props.actions.logout;
|
|
198
|
-
console.log('props', this.props);
|
|
199
206
|
const proxyOrgList = [];
|
|
200
207
|
let defaultOrgName = '';
|
|
201
208
|
let defaultOrgId = '';
|
|
202
209
|
let userName = '';
|
|
203
210
|
const navigateToDashboard = this.navigateToDashboard;
|
|
204
211
|
if (userData && userData.user && userData.user !== '') {
|
|
205
|
-
console.log('Org name ', userData.user.orgName, userData.user.orgID);
|
|
206
212
|
defaultOrgName = userData.user.orgName;
|
|
207
213
|
defaultOrgId = userData.user.orgID;
|
|
208
214
|
proxyOrgList.push({ text: defaultOrgName, value: defaultOrgId });
|
|
@@ -272,6 +278,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
272
278
|
],
|
|
273
279
|
},
|
|
274
280
|
];
|
|
281
|
+
const { isCreativesAccessible } = this.state;
|
|
275
282
|
return (
|
|
276
283
|
<CapWrapper>
|
|
277
284
|
{ this.props.loader.localeLoading || this.props.Global.fetching_userdata ?
|
|
@@ -301,7 +308,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
301
308
|
logout={this.logout}
|
|
302
309
|
/> : ''}
|
|
303
310
|
<div className="main">
|
|
304
|
-
{loggedIn && type !== 'embedded' && this.props.location.pathname.indexOf('v2') === -1 ? <div id="cap-sidebar" className={'sidebar'}>
|
|
311
|
+
{isCreativesAccessible && loggedIn && type !== 'embedded' && this.props.location.pathname.indexOf('v2') === -1 ? <div id="cap-sidebar" className={'sidebar'}>
|
|
305
312
|
<Sidebar
|
|
306
313
|
menuData={menuData}
|
|
307
314
|
actionComponents={actionComponents}
|
|
@@ -309,7 +316,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
309
316
|
/>
|
|
310
317
|
</div> : '' }
|
|
311
318
|
<div className="main-content">
|
|
312
|
-
{React.Children.toArray(this.props.children)}
|
|
319
|
+
{!isCreativesAccessible ? <AccessForbidden /> : React.Children.toArray(this.props.children)}
|
|
313
320
|
</div>
|
|
314
321
|
</div>
|
|
315
322
|
</div>
|
package/containers/Cap/sagas.js
CHANGED
|
@@ -68,7 +68,7 @@ function* logoutFlow() {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
export function* fetchUserInfo() {
|
|
71
|
+
export function* fetchUserInfo({ callback }) {
|
|
72
72
|
try {
|
|
73
73
|
const result = yield call(Api.getUserData);
|
|
74
74
|
const userData = result.user;
|
|
@@ -87,6 +87,9 @@ export function* fetchUserInfo() {
|
|
|
87
87
|
},
|
|
88
88
|
];
|
|
89
89
|
}
|
|
90
|
+
if (callback) {
|
|
91
|
+
callback(userData);
|
|
92
|
+
}
|
|
90
93
|
yield call(LocalStorage.saveItem, 'orgID', result.currentOrgId);
|
|
91
94
|
yield call(LocalStorage.saveItem, 'user', userData);
|
|
92
95
|
yield put({type: types.GET_USER_DATA_SUCCESS, userData, currentOrgId: result.currentOrgId, currentOrgDetails});
|
package/global-styles.js
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormattedMessage } from 'react-intl';
|
|
3
|
+
import { CapRow, CapHeading } from '@capillarytech/cap-ui-library';
|
|
4
|
+
import messages from './messages';
|
|
5
|
+
|
|
6
|
+
const AccessForbidden = () => {
|
|
7
|
+
console.log('NIKHIL access');
|
|
8
|
+
return (
|
|
9
|
+
<CapRow className="margin-t-32 text-align-center">
|
|
10
|
+
<CapHeading type="h2">
|
|
11
|
+
<FormattedMessage {...messages.forbiddenHeader} />
|
|
12
|
+
</CapHeading>
|
|
13
|
+
<CapHeading type="h3" className="margin-t-24">
|
|
14
|
+
<FormattedMessage {...messages.forbiddenDesc} />
|
|
15
|
+
</CapHeading>
|
|
16
|
+
</CapRow>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default AccessForbidden;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl';
|
|
2
|
+
|
|
3
|
+
const prefix = 'creatives.components.AccessForbidden';
|
|
4
|
+
|
|
5
|
+
export default defineMessages({
|
|
6
|
+
forbiddenHeader: {
|
|
7
|
+
id: `${prefix}.forbiddenHeader`,
|
|
8
|
+
defaultMessage: 'Access Forbidden',
|
|
9
|
+
},
|
|
10
|
+
forbiddenDesc: {
|
|
11
|
+
id: `${prefix}.forbiddenDesc`,
|
|
12
|
+
defaultMessage: 'This page access has not been provided to you.',
|
|
13
|
+
},
|
|
14
|
+
});
|
|
@@ -9,51 +9,51 @@ import { defineMessages } from 'react-intl';
|
|
|
9
9
|
export const scope = 'creatives.componentsV2.NavigationBar';
|
|
10
10
|
|
|
11
11
|
export default defineMessages({
|
|
12
|
-
header: {
|
|
12
|
+
"header": {
|
|
13
13
|
id: `${scope}.header`,
|
|
14
14
|
defaultMessage: 'This is the NavigationBar component!',
|
|
15
15
|
},
|
|
16
|
-
selectedProductDefault: {
|
|
16
|
+
"selectedProductDefault": {
|
|
17
17
|
id: `${scope}.selectedProductDefault`,
|
|
18
18
|
defaultMessage: 'Engage+',
|
|
19
19
|
},
|
|
20
|
-
insights: {
|
|
20
|
+
"insights": {
|
|
21
21
|
id: `${scope}.insights`,
|
|
22
22
|
defaultMessage: 'Insights+',
|
|
23
23
|
},
|
|
24
|
-
orgSettings: {
|
|
24
|
+
"orgSettings": {
|
|
25
25
|
id: `${scope}.orgSettings`,
|
|
26
26
|
defaultMessage: 'Organisation settings',
|
|
27
27
|
},
|
|
28
|
-
logout: {
|
|
28
|
+
"logout": {
|
|
29
29
|
id: `${scope}.logout`,
|
|
30
30
|
defaultMessage: 'Logout',
|
|
31
31
|
},
|
|
32
|
-
businessProcesses: {
|
|
32
|
+
"businessProcesses": {
|
|
33
33
|
id: `${scope}.businessProcesses`,
|
|
34
34
|
defaultMessage: 'Workbench',
|
|
35
35
|
},
|
|
36
|
-
|
|
37
|
-
id: `${scope}.
|
|
36
|
+
'campaigns/ui/list': {
|
|
37
|
+
id: `${scope}.campaigns/ui/list`,
|
|
38
38
|
defaultMessage: 'Engage+',
|
|
39
39
|
},
|
|
40
|
-
wecrm: {
|
|
40
|
+
"wecrm": {
|
|
41
41
|
id: `${scope}.wecrm`,
|
|
42
42
|
defaultMessage: 'Wecrm',
|
|
43
43
|
},
|
|
44
|
-
loyaltyProgram: {
|
|
44
|
+
"loyaltyProgram": {
|
|
45
45
|
id: `${scope}.loyaltyProgram`,
|
|
46
46
|
defaultMessage: 'Loyalty+',
|
|
47
47
|
},
|
|
48
|
-
storePerformance: {
|
|
48
|
+
"storePerformance": {
|
|
49
49
|
id: `${scope}.storePerformance`,
|
|
50
50
|
defaultMessage: 'Store Performance',
|
|
51
51
|
},
|
|
52
|
-
memberCare: {
|
|
52
|
+
"memberCare": {
|
|
53
53
|
id: `${scope}.memberCare`,
|
|
54
54
|
defaultMessage: 'Member Care',
|
|
55
55
|
},
|
|
56
|
-
storeCare: {
|
|
56
|
+
"storeCare": {
|
|
57
57
|
id: `${scope}.storeCare`,
|
|
58
58
|
defaultMessage: 'Store Care',
|
|
59
59
|
},
|
|
@@ -191,6 +191,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
191
191
|
alignItems: 'center',
|
|
192
192
|
backgroundColor: !video ? 'transparent' : CAP_G06,
|
|
193
193
|
marginTop: 0,
|
|
194
|
+
padding: 0,
|
|
194
195
|
}}
|
|
195
196
|
key={video}
|
|
196
197
|
>
|
|
@@ -198,7 +199,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
198
199
|
video
|
|
199
200
|
? (
|
|
200
201
|
<>
|
|
201
|
-
<video
|
|
202
|
+
<video style={{ opacity: 0.5, width: '100%' }}>
|
|
202
203
|
<source src={video} type="video/mp4" />
|
|
203
204
|
</video>
|
|
204
205
|
<div
|
|
@@ -19,7 +19,7 @@ import * as appActions from '../App/actions';
|
|
|
19
19
|
import config from '../../config/app';
|
|
20
20
|
import NavigationBar from '../../v2Components/NavigationBar';
|
|
21
21
|
import { engagePlusPublicPath } from '../../config/path';
|
|
22
|
-
import { GTM_TRACKING_ID } from '../App/constants';
|
|
22
|
+
import { GTM_TRACKING_ID, CREATIVES_UI_VIEW } from '../App/constants';
|
|
23
23
|
import { makeSelectLocale } from '../../v2Containers/LanguageProvider/selectors';
|
|
24
24
|
import {
|
|
25
25
|
HELP_URL,
|
|
@@ -44,6 +44,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
44
44
|
super(props);
|
|
45
45
|
this.state = {
|
|
46
46
|
switchedOrg: false,
|
|
47
|
+
isCreativesAccessible: true,
|
|
47
48
|
};
|
|
48
49
|
this.changeOrg = this.changeOrg.bind(this);
|
|
49
50
|
this.logout = this.logout.bind(this);
|
|
@@ -52,7 +53,10 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
componentWillMount() {
|
|
55
|
-
this.props.actions.getUserData(() => {
|
|
56
|
+
this.props.actions.getUserData((userData) => {
|
|
57
|
+
if (!userData.accessiblePermissions.includes(CREATIVES_UI_VIEW)) {
|
|
58
|
+
this.setState({ isCreativesAccessible: false });
|
|
59
|
+
}
|
|
56
60
|
this.setDimensionData();
|
|
57
61
|
});
|
|
58
62
|
this.props.actions.getTopbarMenuData();
|
|
@@ -178,6 +182,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
178
182
|
const topbarMenuDataOptions = topbarMenuData && topbarMenuData.data ? topbarMenuData.data : [];
|
|
179
183
|
const type = this.props.location.query.type;
|
|
180
184
|
const toastMessages = this.props.Global.messages;
|
|
185
|
+
const { isCreativesAccessible } = this.state;
|
|
181
186
|
console.log('v2 locale loading', this.props.loader.localeLoading);
|
|
182
187
|
return (
|
|
183
188
|
<CapWrapper>
|
|
@@ -200,6 +205,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
200
205
|
<NavigationBar
|
|
201
206
|
userData={Global}
|
|
202
207
|
changeOrg={this.changeOrg}
|
|
208
|
+
isCreativesAccessible={isCreativesAccessible}
|
|
203
209
|
logout={this.logout}
|
|
204
210
|
settingsUrl={`${engagePlusPublicPath}${CAMPAIGN_SETTINGS_URL}`}
|
|
205
211
|
orgSettingsUrl={ORG_SETTINGS_URL}
|
|
@@ -105,12 +105,12 @@ export const LineVideo = ({
|
|
|
105
105
|
} = content;
|
|
106
106
|
const videoUrl = originalContentUrl || videoSrc;
|
|
107
107
|
const videoActionLabel = label || actionLabel;
|
|
108
|
+
const videoPreviewUrl = previewImageUrl || rootPreviewImageUrl;
|
|
108
109
|
if (videoUrl && type === 'video') {
|
|
109
110
|
updateVideoStatus(true);
|
|
110
111
|
updateCreateNew(true);
|
|
111
112
|
updateVideoSrc(videoUrl);
|
|
112
113
|
updateTextMessageTitle(messageTitle);
|
|
113
|
-
updateImagePreview(previewImageUrl || rootPreviewImageUrl);
|
|
114
114
|
updateVideoName(videoName);
|
|
115
115
|
updateVideoWidth(width || videoWidth);
|
|
116
116
|
updateVideoHeight(height || videoHeight);
|
|
@@ -119,6 +119,9 @@ export const LineVideo = ({
|
|
|
119
119
|
updateActionLabel(videoActionLabel);
|
|
120
120
|
updateSelectedAction(selectedAction || (!!videoActionLabel ? DISPLAY_ACTION_BUTTON : HIDE_ACTION_BUTTON));
|
|
121
121
|
updateTitle(altText);
|
|
122
|
+
if (videoPreviewUrl) {
|
|
123
|
+
updateImagePreview(videoPreviewUrl);
|
|
124
|
+
}
|
|
122
125
|
}
|
|
123
126
|
}, [content]);
|
|
124
127
|
|
|
@@ -26,6 +26,8 @@ import Line from '../Line/Container';
|
|
|
26
26
|
import Gallery from '../Assets/Gallery';
|
|
27
27
|
import withStyles from '../../hoc/withStyles';
|
|
28
28
|
import styles, { CapTabStyle } from './TemplatesV2.style';
|
|
29
|
+
import { CREATIVES_UI_VIEW } from '../App/constants';
|
|
30
|
+
import AccessForbidden from '../../v2Components/AccessForbidden';
|
|
29
31
|
|
|
30
32
|
const {CapCustomCardList} = CapCustomCard;
|
|
31
33
|
|
|
@@ -215,27 +217,34 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
215
217
|
return this.props.Templates.loadingTemplates;
|
|
216
218
|
}
|
|
217
219
|
render() {
|
|
218
|
-
const { isFullMode, className } = this.props;
|
|
220
|
+
const { isFullMode, className, authData = {}} = this.props;
|
|
221
|
+
const { accessiblePermissions = []} = authData.user || {};
|
|
222
|
+
let isCreativeAccessible = true;
|
|
223
|
+
if (!accessiblePermissions.includes(CREATIVES_UI_VIEW)) {
|
|
224
|
+
isCreativeAccessible = false;
|
|
225
|
+
}
|
|
226
|
+
|
|
219
227
|
return (
|
|
220
|
-
|
|
221
|
-
{isFullMode
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
{
|
|
225
|
-
|
|
226
|
-
|
|
228
|
+
!isCreativeAccessible ? <AccessForbidden /> : (
|
|
229
|
+
<div className={`${className} creatives-templates-container ${isFullMode ? 'fullmode' : 'library-mode'}`}>
|
|
230
|
+
{isFullMode && <Helmet
|
|
231
|
+
title={this.props.intl.formatMessage(messages.creatives)}
|
|
232
|
+
meta={[
|
|
233
|
+
{ name: 'description', content: this.props.intl.formatMessage(messages.creativesDesc) },
|
|
234
|
+
]}
|
|
235
|
+
/>}
|
|
227
236
|
<div className="component-wrapper">
|
|
228
237
|
{isFullMode && <CapHeader title={<FormattedMessage {...messages.creatives}/>} description={<FormattedMessage {...messages.creativesDesc}/>}/>}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
238
|
+
<StyledCapTab
|
|
239
|
+
panes={this.state.panes}
|
|
240
|
+
onChange={this.channelChange}
|
|
241
|
+
activeKey={this.state.selectedChannel}
|
|
242
|
+
defaultActiveKey={this.state.selectedChannel}
|
|
243
|
+
isFullMode={isFullMode}
|
|
244
|
+
/>
|
|
236
245
|
</div>
|
|
237
|
-
|
|
238
|
-
|
|
246
|
+
</div>
|
|
247
|
+
)
|
|
239
248
|
);
|
|
240
249
|
}
|
|
241
250
|
}
|
|
@@ -258,6 +267,7 @@ TemplatesV2.propTypes = {
|
|
|
258
267
|
onFacebookSubmit: PropTypes.func,
|
|
259
268
|
messageDetails: PropTypes.object,
|
|
260
269
|
cap: PropTypes.object,
|
|
270
|
+
authData: PropTypes.object,
|
|
261
271
|
};
|
|
262
272
|
|
|
263
273
|
TemplatesV2.defaultProps = {
|