@capillarytech/creatives-library 6.11.8 → 6.12.0

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.
Files changed (59) hide show
  1. package/components/TemplatePreview/index.js +2 -1
  2. package/containers/Cap/actions.js +2 -1
  3. package/containers/Cap/index.js +12 -5
  4. package/containers/Cap/sagas.js +4 -1
  5. package/global-styles.js +4 -0
  6. package/package.json +1 -1
  7. package/v2Components/AccessForbidden/index.js +20 -0
  8. package/v2Components/AccessForbidden/messages.js +14 -0
  9. package/v2Components/NavigationBar/messages.js +13 -13
  10. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +151 -151
  11. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +33 -33
  12. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/tests/index.test.js +10 -10
  13. package/v2Components/TemplatePreview/assets/images/androidPushMessage.svg +44 -44
  14. package/v2Components/TemplatePreview/assets/images/home-screen-android.svg +21 -21
  15. package/v2Components/TemplatePreview/assets/images/home-screen-ios.svg +16 -16
  16. package/v2Components/TemplatePreview/assets/images/iPhonePushMessage.svg +134 -134
  17. package/v2Components/TemplatePreview/assets/images/mobile.svg +23 -23
  18. package/v2Components/TemplatePreview/assets/images/sms_mobile_android.svg +22 -22
  19. package/v2Components/TemplatePreview/assets/images/user-icon.svg +18 -18
  20. package/v2Components/TemplatePreview/assets/images/wechat-home-screen-android.svg +21 -21
  21. package/v2Components/TemplatePreview/assets/images/wechat-mobile.svg +77 -77
  22. package/v2Components/TemplatePreview/assets/images/wechat_mobile_android.svg +20 -20
  23. package/v2Components/TemplatePreview/index.js +2 -1
  24. package/v2Components/TemplatePreview/tests/index.test.js +10 -10
  25. package/v2Containers/App/constants.js +2 -0
  26. package/v2Containers/Cap/index.js +8 -2
  27. package/v2Containers/CreativesContainer/actions.js +27 -27
  28. package/v2Containers/CreativesContainer/constants.js +17 -17
  29. package/v2Containers/CreativesContainer/index.scss +44 -44
  30. package/v2Containers/CreativesContainer/messages.js +305 -305
  31. package/v2Containers/CreativesContainer/reducer.js +29 -29
  32. package/v2Containers/CreativesContainer/sagas.js +11 -11
  33. package/v2Containers/CreativesContainer/selectors.js +30 -30
  34. package/v2Containers/CreativesContainer/tests/actions.test.js +18 -18
  35. package/v2Containers/CreativesContainer/tests/index.test.js +10 -10
  36. package/v2Containers/CreativesContainer/tests/reducer.test.js +9 -9
  37. package/v2Containers/CreativesContainer/tests/sagas.test.js +15 -15
  38. package/v2Containers/CreativesContainer/tests/selectors.test.js +10 -10
  39. package/v2Containers/Line/Container/Video/index.js +4 -1
  40. package/v2Containers/Templates/tests/actions.test.js +18 -18
  41. package/v2Containers/Templates/tests/index.test.js +10 -10
  42. package/v2Containers/Templates/tests/reducer.test.js +9 -9
  43. package/v2Containers/Templates/tests/sagas.test.js +15 -15
  44. package/v2Containers/Templates/tests/selectors.test.js +10 -10
  45. package/v2Containers/TemplatesV2/TemplatesV2.style.js +29 -29
  46. package/v2Containers/TemplatesV2/actions.js +16 -16
  47. package/v2Containers/TemplatesV2/constants.js +10 -10
  48. package/v2Containers/TemplatesV2/index.js +27 -17
  49. package/v2Containers/TemplatesV2/messages.js +61 -61
  50. package/v2Containers/TemplatesV2/selectors.js +25 -25
  51. package/v2Containers/TemplatesV2/tests/actions.test.js +18 -18
  52. package/v2Containers/TemplatesV2/tests/index.test.js +10 -10
  53. package/v2Containers/TemplatesV2/tests/reducer.test.js +9 -9
  54. package/v2Containers/TemplatesV2/tests/sagas.test.js +15 -15
  55. package/v2Containers/TemplatesV2/tests/selectors.test.js +10 -10
  56. package/v2Components/BeeEditor/index.js +0 -263
  57. package/v2Components/BeeEditor/index.scss +0 -11
  58. package/v2Components/BeeEditor/messages.js +0 -71
  59. package/v2Components/BeeEditor/tests/index.test.js +0 -10
@@ -1,11 +1,11 @@
1
- // import { take, call, put, select } from 'redux-saga/effects';
2
-
3
- // Individual exports for testing
4
- export function* defaultSaga() {
5
- // See example in v2Containers/HomePage/sagas.js
6
- }
7
-
8
- // All sagas to be loaded
9
- export default [
10
- defaultSaga,
11
- ];
1
+ // import { take, call, put, select } from 'redux-saga/effects';
2
+
3
+ // Individual exports for testing
4
+ export function* defaultSaga() {
5
+ // See example in v2Containers/HomePage/sagas.js
6
+ }
7
+
8
+ // All sagas to be loaded
9
+ export default [
10
+ defaultSaga,
11
+ ];
@@ -1,30 +1,30 @@
1
- import { createSelector } from 'reselect';
2
-
3
- /**
4
- * Direct selector to the creativesContainer state domain
5
- */
6
- const selectCreativesContainerDomain = () => (state) => state.get('creativesContainer');
7
-
8
- /**
9
- * Other specific selectors
10
- */
11
-
12
-
13
- /**
14
- * Default selector used by CreativesContainer
15
- */
16
-
17
- const makeSelectCreativesContainer = () => createSelector(
18
- selectCreativesContainerDomain(),
19
- (substate) => substate.toJS()
20
- );
21
- const isLoading = () => createSelector(
22
- makeSelectCreativesContainer(),
23
- (substate) => substate.containerLoader
24
- );
25
-
26
- export default makeSelectCreativesContainer;
27
- export {
28
- selectCreativesContainerDomain,
29
- isLoading,
30
- };
1
+ import { createSelector } from 'reselect';
2
+
3
+ /**
4
+ * Direct selector to the creativesContainer state domain
5
+ */
6
+ const selectCreativesContainerDomain = () => (state) => state.get('creativesContainer');
7
+
8
+ /**
9
+ * Other specific selectors
10
+ */
11
+
12
+
13
+ /**
14
+ * Default selector used by CreativesContainer
15
+ */
16
+
17
+ const makeSelectCreativesContainer = () => createSelector(
18
+ selectCreativesContainerDomain(),
19
+ (substate) => substate.toJS()
20
+ );
21
+ const isLoading = () => createSelector(
22
+ makeSelectCreativesContainer(),
23
+ (substate) => substate.containerLoader
24
+ );
25
+
26
+ export default makeSelectCreativesContainer;
27
+ export {
28
+ selectCreativesContainerDomain,
29
+ isLoading,
30
+ };
@@ -1,18 +1,18 @@
1
-
2
- import {
3
- defaultAction,
4
- } from '../actions';
5
- import {
6
- DEFAULT_ACTION,
7
- } from '../constants';
8
-
9
- describe('CreativesContainer actions', () => {
10
- describe('Default Action', () => {
11
- it('has a type of DEFAULT_ACTION', () => {
12
- const expected = {
13
- type: DEFAULT_ACTION,
14
- };
15
- expect(defaultAction()).toEqual(expected);
16
- });
17
- });
18
- });
1
+
2
+ import {
3
+ defaultAction,
4
+ } from '../actions';
5
+ import {
6
+ DEFAULT_ACTION,
7
+ } from '../constants';
8
+
9
+ describe('CreativesContainer actions', () => {
10
+ describe('Default Action', () => {
11
+ it('has a type of DEFAULT_ACTION', () => {
12
+ const expected = {
13
+ type: DEFAULT_ACTION,
14
+ };
15
+ expect(defaultAction()).toEqual(expected);
16
+ });
17
+ });
18
+ });
@@ -1,10 +1,10 @@
1
- // import React from 'react';
2
- // import { shallow } from 'enzyme';
3
-
4
- // import { CreativesContainer } from '../index';
5
-
6
- describe('<CreativesContainer />', () => {
7
- it('Expect to have unit tests specified', () => {
8
- expect(true).toEqual(true);
9
- });
10
- });
1
+ // import React from 'react';
2
+ // import { shallow } from 'enzyme';
3
+
4
+ // import { CreativesContainer } from '../index';
5
+
6
+ describe('<CreativesContainer />', () => {
7
+ it('Expect to have unit tests specified', () => {
8
+ expect(true).toEqual(true);
9
+ });
10
+ });
@@ -1,9 +1,9 @@
1
-
2
- import { fromJS } from 'immutable';
3
- import creativesContainerReducer from '../reducer';
4
-
5
- describe('creativesContainerReducer', () => {
6
- it('returns the initial state', () => {
7
- expect(creativesContainerReducer(undefined, {})).toEqual(fromJS({}));
8
- });
9
- });
1
+
2
+ import { fromJS } from 'immutable';
3
+ import creativesContainerReducer from '../reducer';
4
+
5
+ describe('creativesContainerReducer', () => {
6
+ it('returns the initial state', () => {
7
+ expect(creativesContainerReducer(undefined, {})).toEqual(fromJS({}));
8
+ });
9
+ });
@@ -1,15 +1,15 @@
1
- /**
2
- * Test sagas
3
- */
4
-
5
- /* eslint-disable redux-saga/yield-effects */
6
- // import { take, call, put, select } from 'redux-saga/effects';
7
- // import { defaultSaga } from '../sagas';
8
-
9
- // const generator = defaultSaga();
10
-
11
- describe('defaultSaga Saga', () => {
12
- it('Expect to have unit tests specified', () => {
13
- expect(true).toEqual(true);
14
- });
15
- });
1
+ /**
2
+ * Test sagas
3
+ */
4
+
5
+ /* eslint-disable redux-saga/yield-effects */
6
+ // import { take, call, put, select } from 'redux-saga/effects';
7
+ // import { defaultSaga } from '../sagas';
8
+
9
+ // const generator = defaultSaga();
10
+
11
+ describe('defaultSaga Saga', () => {
12
+ it('Expect to have unit tests specified', () => {
13
+ expect(true).toEqual(true);
14
+ });
15
+ });
@@ -1,10 +1,10 @@
1
- // import { fromJS } from 'immutable';
2
- // import { makeSelectCreativesContainerDomain } from '../selectors';
3
-
4
- // const selector = makeSelectCreativesContainerDomain();
5
-
6
- describe('makeSelectCreativesContainerDomain', () => {
7
- it('Expect to have unit tests specified', () => {
8
- expect(true).toEqual(true);
9
- });
10
- });
1
+ // import { fromJS } from 'immutable';
2
+ // import { makeSelectCreativesContainerDomain } from '../selectors';
3
+
4
+ // const selector = makeSelectCreativesContainerDomain();
5
+
6
+ describe('makeSelectCreativesContainerDomain', () => {
7
+ it('Expect to have unit tests specified', () => {
8
+ expect(true).toEqual(true);
9
+ });
10
+ });
@@ -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
 
@@ -1,18 +1,18 @@
1
-
2
- import {
3
- defaultAction,
4
- } from '../actions';
5
- import {
6
- DEFAULT_ACTION,
7
- } from '../constants';
8
-
9
- describe('Templates actions', () => {
10
- describe('Default Action', () => {
11
- it('has a type of DEFAULT_ACTION', () => {
12
- const expected = {
13
- type: DEFAULT_ACTION,
14
- };
15
- expect(defaultAction()).toEqual(expected);
16
- });
17
- });
18
- });
1
+
2
+ import {
3
+ defaultAction,
4
+ } from '../actions';
5
+ import {
6
+ DEFAULT_ACTION,
7
+ } from '../constants';
8
+
9
+ describe('Templates actions', () => {
10
+ describe('Default Action', () => {
11
+ it('has a type of DEFAULT_ACTION', () => {
12
+ const expected = {
13
+ type: DEFAULT_ACTION,
14
+ };
15
+ expect(defaultAction()).toEqual(expected);
16
+ });
17
+ });
18
+ });
@@ -1,10 +1,10 @@
1
- // import React from 'react';
2
- // import { shallow } from 'enzyme';
3
-
4
- // import { Templates } from '../index';
5
-
6
- describe('<Templates />', () => {
7
- it('Expect to have unit tests specified', () => {
8
- expect(true).toEqual(false);
9
- });
10
- });
1
+ // import React from 'react';
2
+ // import { shallow } from 'enzyme';
3
+
4
+ // import { Templates } from '../index';
5
+
6
+ describe('<Templates />', () => {
7
+ it('Expect to have unit tests specified', () => {
8
+ expect(true).toEqual(false);
9
+ });
10
+ });
@@ -1,9 +1,9 @@
1
-
2
- import { fromJS } from 'immutable';
3
- import templatesReducer from '../reducer';
4
-
5
- describe('templatesReducer', () => {
6
- it('returns the initial state', () => {
7
- expect(templatesReducer(undefined, {})).toEqual(fromJS({}));
8
- });
9
- });
1
+
2
+ import { fromJS } from 'immutable';
3
+ import templatesReducer from '../reducer';
4
+
5
+ describe('templatesReducer', () => {
6
+ it('returns the initial state', () => {
7
+ expect(templatesReducer(undefined, {})).toEqual(fromJS({}));
8
+ });
9
+ });
@@ -1,15 +1,15 @@
1
- /**
2
- * Test sagas
3
- */
4
-
5
- /* eslint-disable redux-saga/yield-effects */
6
- // import { take, call, put, select } from 'redux-saga/effects';
7
- // import { defaultSaga } from '../sagas';
8
-
9
- // const generator = defaultSaga();
10
-
11
- describe('defaultSaga Saga', () => {
12
- it('Expect to have unit tests specified', () => {
13
- expect(true).toEqual(false);
14
- });
15
- });
1
+ /**
2
+ * Test sagas
3
+ */
4
+
5
+ /* eslint-disable redux-saga/yield-effects */
6
+ // import { take, call, put, select } from 'redux-saga/effects';
7
+ // import { defaultSaga } from '../sagas';
8
+
9
+ // const generator = defaultSaga();
10
+
11
+ describe('defaultSaga Saga', () => {
12
+ it('Expect to have unit tests specified', () => {
13
+ expect(true).toEqual(false);
14
+ });
15
+ });
@@ -1,10 +1,10 @@
1
- // import { fromJS } from 'immutable';
2
- // import { makeSelectTemplatesDomain } from '../selectors';
3
-
4
- // const selector = makeSelectTemplatesDomain();
5
-
6
- describe('makeSelectTemplatesDomain', () => {
7
- it('Expect to have unit tests specified', () => {
8
- expect(true).toEqual(false);
9
- });
10
- });
1
+ // import { fromJS } from 'immutable';
2
+ // import { makeSelectTemplatesDomain } from '../selectors';
3
+
4
+ // const selector = makeSelectTemplatesDomain();
5
+
6
+ describe('makeSelectTemplatesDomain', () => {
7
+ it('Expect to have unit tests specified', () => {
8
+ expect(true).toEqual(false);
9
+ });
10
+ });
@@ -1,29 +1,29 @@
1
- import { css } from 'styled-components';
2
- import {CAP_SPACE_24, CAP_SPACE_16} from '@capillarytech/cap-ui-library/styled/variables';
3
-
4
- export default css`
5
- .cap-tab-v2-wrapper{
6
- .ant-tabs-tabpane {
7
- border: none;
8
- }
9
- }
10
-
11
- .component-wrapper {
12
- ${(props) => props.isFullMode ? `
13
- max-width: 1140px;
14
- margin: 0 auto;
15
- width: 100%;
16
- padding: ${CAP_SPACE_24} 0;
17
- .ant-tabs-content{
18
- margin-top: ${CAP_SPACE_16}
19
- }
20
- ` : `.cap-tab-v2 {
21
- height: calc(100vh - 118px);
22
- } `}
23
- }
24
- `;
25
-
26
- export const CapTabStyle = css`
27
- ${(props) => props.isFullMode ? `margin-top: ${CAP_SPACE_24}` : ``
28
- }
29
- `;
1
+ import { css } from 'styled-components';
2
+ import {CAP_SPACE_24, CAP_SPACE_16} from '@capillarytech/cap-ui-library/styled/variables';
3
+
4
+ export default css`
5
+ .cap-tab-v2-wrapper{
6
+ .ant-tabs-tabpane {
7
+ border: none;
8
+ }
9
+ }
10
+
11
+ .component-wrapper {
12
+ ${(props) => props.isFullMode ? `
13
+ max-width: 1140px;
14
+ margin: 0 auto;
15
+ width: 100%;
16
+ padding: ${CAP_SPACE_24} 0;
17
+ .ant-tabs-content{
18
+ margin-top: ${CAP_SPACE_16}
19
+ }
20
+ ` : `.cap-tab-v2 {
21
+ height: calc(100vh - 118px);
22
+ } `}
23
+ }
24
+ `;
25
+
26
+ export const CapTabStyle = css`
27
+ ${(props) => props.isFullMode ? `margin-top: ${CAP_SPACE_24}` : ``
28
+ }
29
+ `;
@@ -1,16 +1,16 @@
1
-
2
- import * as types from './constants';
3
-
4
- export function defaultAction() {
5
- return {
6
- type: types.DEFAULT_ACTION,
7
- };
8
- }
9
-
10
- export function getTemplates({channel, query}) {
11
- return {
12
- type: types.GET_TEMPLATES_REQUEST,
13
- channel,
14
- query,
15
- };
16
- }
1
+
2
+ import * as types from './constants';
3
+
4
+ export function defaultAction() {
5
+ return {
6
+ type: types.DEFAULT_ACTION,
7
+ };
8
+ }
9
+
10
+ export function getTemplates({channel, query}) {
11
+ return {
12
+ type: types.GET_TEMPLATES_REQUEST,
13
+ channel,
14
+ query,
15
+ };
16
+ }
@@ -1,10 +1,10 @@
1
- /*
2
- *
3
- * TemplatesV2 constants
4
- *
5
- */
6
-
7
- export const DEFAULT_ACTION = 'app/TemplatesV2/DEFAULT_ACTION';
8
- export const GET_TEMPLATES_REQUEST = 'app/TemplatesV2/GET_TEMPLATES_REQUEST';
9
- export const GET_TEMPLATES_SUCESS = 'app/TemplatesV2/GET_TEMPLATES_SUCESS';
10
- export const GET_TEMPLATES_FAILURE = 'app/TemplatesV2/GET_TEMPLATES_FAILURE';
1
+ /*
2
+ *
3
+ * TemplatesV2 constants
4
+ *
5
+ */
6
+
7
+ export const DEFAULT_ACTION = 'app/TemplatesV2/DEFAULT_ACTION';
8
+ export const GET_TEMPLATES_REQUEST = 'app/TemplatesV2/GET_TEMPLATES_REQUEST';
9
+ export const GET_TEMPLATES_SUCESS = 'app/TemplatesV2/GET_TEMPLATES_SUCESS';
10
+ export const GET_TEMPLATES_FAILURE = 'app/TemplatesV2/GET_TEMPLATES_FAILURE';
@@ -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
- <div className={`${className} creatives-templates-container ${isFullMode ? 'fullmode' : 'library-mode'}`}>
221
- {isFullMode && <Helmet
222
- title={this.props.intl.formatMessage(messages.creatives)}
223
- meta={[
224
- { name: 'description', content: this.props.intl.formatMessage(messages.creativesDesc) },
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
- <StyledCapTab
230
- panes={this.state.panes}
231
- onChange={this.channelChange}
232
- activeKey={this.state.selectedChannel}
233
- defaultActiveKey={this.state.selectedChannel}
234
- isFullMode={isFullMode}
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
- </div>
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 = {