@capillarytech/creatives-library 6.8.6 → 6.8.7

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 (62) hide show
  1. package/app.js +0 -1
  2. package/config/app.js +1 -1
  3. package/package.json +1 -1
  4. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +151 -151
  5. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +33 -33
  6. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/tests/index.test.js +10 -10
  7. package/v2Components/TemplatePreview/_templatePreview.scss +380 -380
  8. package/v2Components/TemplatePreview/assets/images/androidPushMessage.svg +44 -44
  9. package/v2Components/TemplatePreview/assets/images/home-screen-android.svg +21 -21
  10. package/v2Components/TemplatePreview/assets/images/home-screen-ios.svg +16 -16
  11. package/v2Components/TemplatePreview/assets/images/iPhonePushMessage.svg +134 -134
  12. package/v2Components/TemplatePreview/assets/images/mobile.svg +23 -23
  13. package/v2Components/TemplatePreview/assets/images/sms_mobile_android.svg +22 -22
  14. package/v2Components/TemplatePreview/assets/images/user-icon.svg +18 -18
  15. package/v2Components/TemplatePreview/assets/images/wechat-home-screen-android.svg +21 -21
  16. package/v2Components/TemplatePreview/assets/images/wechat-mobile.svg +77 -77
  17. package/v2Components/TemplatePreview/assets/images/wechat_mobile_android.svg +20 -20
  18. package/v2Components/TemplatePreview/tests/index.test.js +10 -10
  19. package/v2Containers/CreativesContainer/SlideBoxFooter.js +51 -51
  20. package/v2Containers/CreativesContainer/actions.js +27 -27
  21. package/v2Containers/CreativesContainer/constants.js +17 -17
  22. package/v2Containers/CreativesContainer/index.scss +44 -44
  23. package/v2Containers/CreativesContainer/messages.js +305 -305
  24. package/v2Containers/CreativesContainer/reducer.js +29 -29
  25. package/v2Containers/CreativesContainer/sagas.js +11 -11
  26. package/v2Containers/CreativesContainer/selectors.js +30 -30
  27. package/v2Containers/CreativesContainer/tests/actions.test.js +18 -18
  28. package/v2Containers/CreativesContainer/tests/index.test.js +10 -10
  29. package/v2Containers/CreativesContainer/tests/reducer.test.js +9 -9
  30. package/v2Containers/CreativesContainer/tests/sagas.test.js +15 -15
  31. package/v2Containers/CreativesContainer/tests/selectors.test.js +10 -10
  32. package/v2Containers/Line/Container/Image/constants.js +2 -1
  33. package/v2Containers/Line/Container/Image/index.js +21 -19
  34. package/v2Containers/Line/Container/Image/messages.js +1 -1
  35. package/v2Containers/Line/Container/ImageMap/index.js +1 -1
  36. package/v2Containers/Line/Container/Wrapper/index.js +3 -3
  37. package/v2Containers/Line/Container/Wrapper/messages.js +1 -1
  38. package/v2Containers/Line/Container/Wrapper/utils.js +4 -2
  39. package/v2Containers/Line/Container/index.js +15 -9
  40. package/v2Containers/Templates/_templates.scss +405 -405
  41. package/v2Containers/Templates/actions.js +117 -117
  42. package/v2Containers/Templates/constants.js +47 -47
  43. package/v2Containers/Templates/index.js +0 -4
  44. package/v2Containers/Templates/messages.js +1 -5
  45. package/v2Containers/Templates/reducer.js +145 -145
  46. package/v2Containers/Templates/sagas.js +179 -179
  47. package/v2Containers/Templates/tests/actions.test.js +18 -18
  48. package/v2Containers/Templates/tests/index.test.js +10 -10
  49. package/v2Containers/Templates/tests/reducer.test.js +9 -9
  50. package/v2Containers/Templates/tests/sagas.test.js +15 -15
  51. package/v2Containers/Templates/tests/selectors.test.js +10 -10
  52. package/v2Containers/TemplatesV2/TemplatesV2.style.js +29 -29
  53. package/v2Containers/TemplatesV2/actions.js +16 -16
  54. package/v2Containers/TemplatesV2/constants.js +10 -10
  55. package/v2Containers/TemplatesV2/messages.js +61 -61
  56. package/v2Containers/TemplatesV2/selectors.js +25 -25
  57. package/v2Containers/TemplatesV2/tests/actions.test.js +18 -18
  58. package/v2Containers/TemplatesV2/tests/index.test.js +10 -10
  59. package/v2Containers/TemplatesV2/tests/reducer.test.js +9 -9
  60. package/v2Containers/TemplatesV2/tests/sagas.test.js +15 -15
  61. package/v2Containers/TemplatesV2/tests/selectors.test.js +10 -10
  62. package/v2Components/TemplatePreview/assets/images/WECHAT_5x.png +0 -0
@@ -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
+ });
@@ -1,3 +1,4 @@
1
1
  export const LINE_IMG_HEIGHT = 400;
2
2
  export const LINE_IMG_WIDTH = 300;
3
- export const LINE_IMG_SIZE = 30000000;
3
+ export const LINE_IMG_SIZE = 10000000;
4
+ export const ALLOWED_EXTENSIONS_REGEX = (/\.(jpe?g|png)$/i);
@@ -6,12 +6,11 @@ import CapUploader from '@capillarytech/cap-ui-library/CapUploader';
6
6
  import CapHeading from '@capillarytech/cap-ui-library/CapHeading';
7
7
  import CapButton from '@capillarytech/cap-ui-library/CapButton';
8
8
  import CapDrawer from '@capillarytech/cap-ui-library/CapDrawer';
9
- import CapLabel from '@capillarytech/cap-ui-library/CapLabel';
10
9
  import CapImage from '@capillarytech/cap-ui-library/CapImage';
11
10
  import CapHeader from '@capillarytech/cap-ui-library/CapHeader';
12
11
  import LabelHOC from '@capillarytech/cap-ui-library/assets/HOCs/ComponentWithLabelHOC';
13
12
  import LineDrawer from '../Drawer';
14
- import { CAP_SPACE_12, CAP_SPACE_08, FONT_COLOR_05, FONT_COLOR_04 } from '@capillarytech/cap-ui-library/styled/variables';
13
+ import { CAP_SPACE_12, CAP_SPACE_08, FONT_COLOR_05 } from '@capillarytech/cap-ui-library/styled/variables';
15
14
  import Gallery from '../../../Assets/Gallery';
16
15
  import style from './style';
17
16
  import { CAP_G06, CAP_G09 } from '@capillarytech/cap-ui-library/styled/variables';
@@ -22,6 +21,7 @@ import {
22
21
  LINE_IMG_HEIGHT,
23
22
  LINE_IMG_WIDTH,
24
23
  LINE_IMG_SIZE,
24
+ ALLOWED_EXTENSIONS_REGEX,
25
25
  } from './constants';
26
26
 
27
27
  export const LineImage = ({
@@ -168,11 +168,8 @@ export const LineImage = ({
168
168
  const _URL = window.URL || window.webkitURL;
169
169
  let incorrectFile = false;
170
170
  const file = files[0];
171
- if (supportedExtensions) {
172
- const allowedExtensions = /(\.bmp|\.jpeg|\.png|\.gif|\.jpg)$/i;
173
- if (!allowedExtensions.exec(file.name)) {
174
- incorrectFile = true;
175
- }
171
+ if (!ALLOWED_EXTENSIONS_REGEX.test(file.name)) {
172
+ incorrectFile = true;
176
173
  }
177
174
  const img = new Image();
178
175
  img.src = _URL.createObjectURL(file);
@@ -402,18 +399,23 @@ export const LineImage = ({
402
399
  const image = get(imageTemplate, 'metaInfo.secure_file_path');
403
400
  const imagePreview = get(imageTemplate, 'metaInfo.secure_file_path_preview');
404
401
  updateDrawerRequirement(false);
405
- updateImageStatus(true);
406
- updateImageSrc(image);
407
- updateImagePreview(imagePreview);
408
- updateMessageState({
409
- isError: !image || !(isFullMode ? messageTitle : true) || (isImageError && errorMessageTitle),
410
- originalContentUrl: image,
411
- previewImageUrl: imagePreview,
412
- messageTitle,
413
- index,
414
- type: 'image',
415
- messageType: 'originalContentUrl',
416
- });
402
+ if (!ALLOWED_EXTENSIONS_REGEX.test(image)) {
403
+ updateImageErrorMessage(formatMessage(messages.lineImageIncorrectSize));
404
+ } else {
405
+ updateImageErrorMessage('');
406
+ updateImageStatus(true);
407
+ updateImageSrc(image);
408
+ updateImagePreview(imagePreview);
409
+ updateMessageState({
410
+ isError: !image || !(isFullMode ? messageTitle : true) || (isImageError && errorMessageTitle),
411
+ originalContentUrl: image,
412
+ previewImageUrl: imagePreview,
413
+ messageTitle,
414
+ index,
415
+ type: 'image',
416
+ messageType: 'originalContentUrl',
417
+ });
418
+ }
417
419
  }
418
420
 
419
421
  const getGalleryDrawerContent = () => {
@@ -37,7 +37,7 @@ export default defineMessages({
37
37
  },
38
38
  "imageDimenstionDescription": {
39
39
  id: `${scope}.imageDimenstionDescription`,
40
- defaultMessage: 'Dimensions: 300px x 400px Size: 30mb',
40
+ defaultMessage: 'Dimensions: 300px x 400px Size: 10mb',
41
41
  },
42
42
  "imageReUpload": {
43
43
  id: `${scope}.imageReUpload`,
@@ -435,7 +435,7 @@ export const LineImageMap = ({
435
435
  }] = [{}],
436
436
  } = {},
437
437
  } = template.versions.base;
438
- templateData.url = baseUrl;
438
+ templateData.url = `${baseUrl}/1040`;
439
439
  templateData.title = template.name;
440
440
  templateData.key = template.name;
441
441
  templateData.hoverOption = (
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect } from 'react';
1
+ import React, { useState, useEffect, Fragment } from 'react';
2
2
  import { injectIntl, FormattedMessage } from 'react-intl';
3
3
  import CapTab from '@capillarytech/cap-ui-library/CapTab';
4
4
  import CapButton from '@capillarytech/cap-ui-library/CapButton';
@@ -126,9 +126,9 @@ export const LineWrapper = ({
126
126
  <CapTab
127
127
  defaultActiveKey={TEXT}
128
128
  activeKey={activeKey}
129
- tabBarExtraContent={operations}
129
+ tabBarExtraContent={rest.isFullMode ? <Fragment /> : operations}
130
130
  onChange={onTabChange}
131
- panes={getTabPanes({ ...rest, index, activeKey, formatMessage: intl.formatMessage })}
131
+ panes={getTabPanes({ ...rest, index, activeKey, formatMessage: intl.formatMessage, isFullMode: rest.isFullMode })}
132
132
  />
133
133
  <StyledCapModal
134
134
  title={intl.formatMessage(messages.changeModalTitle)}
@@ -41,6 +41,6 @@ export default defineMessages({
41
41
  },
42
42
  "imagemapLabel": {
43
43
  id: `${scope}.imagemapLabel`,
44
- defaultMessage: 'Image Map',
44
+ defaultMessage: 'Rich message',
45
45
  },
46
46
  });
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
3
3
  import CapTooltip from '@capillarytech/cap-ui-library/CapTooltip';
4
- import { CAP_WHITE } from '@capillarytech/cap-ui-library/styled/variables';
4
+ import { CAP_WHITE, FONT_SIZE_VL } from '@capillarytech/cap-ui-library/styled/variables';
5
5
 
6
6
  import { TEXT, IMAGE, IMAGE_MAP, STICKER } from '../constants';
7
7
  import LineText from '../Text';
@@ -37,7 +37,8 @@ export const itemIcons = {
37
37
 
38
38
  export const getTabPanes = (props) => {
39
39
  const tableKeys = [TEXT, IMAGE, STICKER, IMAGE_MAP];
40
- return tableKeys.map((item) => {
40
+ const tableKeysCreatives = [TEXT, IMAGE, IMAGE_MAP];
41
+ return (props.isFullMode ? tableKeysCreatives : tableKeys).map((item) => {
41
42
  const isSelected = props.activeKey === item;
42
43
  return {
43
44
  key: item,
@@ -48,6 +49,7 @@ export const getTabPanes = (props) => {
48
49
  <CapIcon
49
50
  type={itemIcons[item]}
50
51
  size="s"
52
+ style={{ fontSize: FONT_SIZE_VL }}
51
53
  theme={isSelected ? 'filled' : ''}
52
54
  svgProps={{
53
55
  fill: isSelected ? '#000' : CAP_WHITE,
@@ -544,15 +544,21 @@ export const LineContainer = ({
544
544
  description={formatMessage(messages.lineCreativeDescription)}
545
545
  />
546
546
  {getLineWrappers()}
547
- <CapButton
548
- onClick={addLineWrappers}
549
- disabled={lineWrapperContents.length === (isFullMode ? MAX_LINE_WRAPPER_LIMIT_FULL_MODE : MAX_LINE_WRAPPER_LIMIT)}
550
- type="flat"
551
- isAddBtn
552
- className="add-msg"
553
- >
554
- <FormattedMessage {...messages.addMessageButtonLabel} />
555
- </CapButton>
547
+ {
548
+ !isFullMode
549
+ ? (
550
+ <CapButton
551
+ onClick={addLineWrappers}
552
+ disabled={lineWrapperContents.length === (isFullMode ? MAX_LINE_WRAPPER_LIMIT_FULL_MODE : MAX_LINE_WRAPPER_LIMIT)}
553
+ type="flat"
554
+ isAddBtn
555
+ className="add-msg"
556
+ >
557
+ <FormattedMessage {...messages.addMessageButtonLabel} />
558
+ </CapButton>
559
+ )
560
+ : null
561
+ }
556
562
  </CapColumn>
557
563
  <CapColumn span={6}>
558
564
  <CapRow>