@capillarytech/creatives-library 6.8.6 → 6.8.8

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 (81) hide show
  1. package/app.js +0 -1
  2. package/components/TemplatePreview/_templatePreview.scss +6 -0
  3. package/components/TemplatePreview/index.js +35 -28
  4. package/config/app.js +1 -1
  5. package/package.json +1 -1
  6. package/v2Components/Carousel/index.js +120 -0
  7. package/v2Components/Carousel/style.scss +40 -0
  8. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +151 -151
  9. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +33 -33
  10. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/tests/index.test.js +10 -10
  11. package/v2Components/TemplatePreview/_templatePreview.scss +1 -0
  12. package/v2Components/TemplatePreview/assets/images/androidPushMessage.svg +44 -44
  13. package/v2Components/TemplatePreview/assets/images/home-screen-android.svg +21 -21
  14. package/v2Components/TemplatePreview/assets/images/home-screen-ios.svg +16 -16
  15. package/v2Components/TemplatePreview/assets/images/iPhonePushMessage.svg +134 -134
  16. package/v2Components/TemplatePreview/assets/images/mobile.svg +23 -23
  17. package/v2Components/TemplatePreview/assets/images/sms_mobile_android.svg +22 -22
  18. package/v2Components/TemplatePreview/assets/images/user-icon.svg +18 -18
  19. package/v2Components/TemplatePreview/assets/images/wechat-home-screen-android.svg +21 -21
  20. package/v2Components/TemplatePreview/assets/images/wechat-mobile.svg +77 -77
  21. package/v2Components/TemplatePreview/assets/images/wechat_mobile_android.svg +20 -20
  22. package/v2Components/TemplatePreview/index.js +36 -29
  23. package/v2Components/TemplatePreview/tests/index.test.js +10 -10
  24. package/v2Containers/CreativesContainer/SlideBoxContent.js +7 -1
  25. package/v2Containers/CreativesContainer/SlideBoxFooter.js +51 -51
  26. package/v2Containers/CreativesContainer/actions.js +27 -27
  27. package/v2Containers/CreativesContainer/constants.js +17 -17
  28. package/v2Containers/CreativesContainer/index.scss +44 -44
  29. package/v2Containers/CreativesContainer/messages.js +305 -305
  30. package/v2Containers/CreativesContainer/reducer.js +29 -29
  31. package/v2Containers/CreativesContainer/sagas.js +11 -11
  32. package/v2Containers/CreativesContainer/selectors.js +30 -30
  33. package/v2Containers/CreativesContainer/tests/actions.test.js +18 -18
  34. package/v2Containers/CreativesContainer/tests/index.test.js +10 -10
  35. package/v2Containers/CreativesContainer/tests/reducer.test.js +9 -9
  36. package/v2Containers/CreativesContainer/tests/sagas.test.js +15 -15
  37. package/v2Containers/CreativesContainer/tests/selectors.test.js +10 -10
  38. package/v2Containers/Line/Container/Image/constants.js +2 -1
  39. package/v2Containers/Line/Container/Image/index.js +41 -37
  40. package/v2Containers/Line/Container/Image/messages.js +1 -1
  41. package/v2Containers/Line/Container/ImageCarousel/Content.js +554 -0
  42. package/v2Containers/Line/Container/ImageCarousel/constants.js +10 -0
  43. package/v2Containers/Line/Container/ImageCarousel/index.js +526 -0
  44. package/v2Containers/Line/Container/ImageCarousel/messages.js +178 -0
  45. package/v2Containers/Line/Container/ImageCarousel/style.js +61 -0
  46. package/v2Containers/Line/Container/ImageMap/constants.js +2 -1
  47. package/v2Containers/Line/Container/ImageMap/index.js +32 -7
  48. package/v2Containers/Line/Container/ImageMap/messages.js +12 -0
  49. package/v2Containers/Line/Container/Wrapper/index.js +8 -4
  50. package/v2Containers/Line/Container/Wrapper/messages.js +5 -1
  51. package/v2Containers/Line/Container/Wrapper/utils.js +16 -15
  52. package/v2Containers/Line/Container/_lineCreate.scss +2 -2
  53. package/v2Containers/Line/Container/actions.js +4 -2
  54. package/v2Containers/Line/Container/constants.js +3 -0
  55. package/v2Containers/Line/Container/index.js +64 -20
  56. package/v2Containers/Line/Container/reducer.js +2 -2
  57. package/v2Containers/Line/Container/sagas.js +2 -2
  58. package/v2Containers/Line/Container/style.js +2 -1
  59. package/v2Containers/Templates/_templates.scss +9 -0
  60. package/v2Containers/Templates/actions.js +117 -117
  61. package/v2Containers/Templates/constants.js +47 -47
  62. package/v2Containers/Templates/index.js +29 -6
  63. package/v2Containers/Templates/messages.js +5 -5
  64. package/v2Containers/Templates/reducer.js +145 -145
  65. package/v2Containers/Templates/sagas.js +179 -179
  66. package/v2Containers/Templates/tests/actions.test.js +18 -18
  67. package/v2Containers/Templates/tests/index.test.js +10 -10
  68. package/v2Containers/Templates/tests/reducer.test.js +9 -9
  69. package/v2Containers/Templates/tests/sagas.test.js +15 -15
  70. package/v2Containers/Templates/tests/selectors.test.js +10 -10
  71. package/v2Containers/TemplatesV2/TemplatesV2.style.js +29 -29
  72. package/v2Containers/TemplatesV2/actions.js +16 -16
  73. package/v2Containers/TemplatesV2/constants.js +10 -10
  74. package/v2Containers/TemplatesV2/messages.js +61 -61
  75. package/v2Containers/TemplatesV2/selectors.js +25 -25
  76. package/v2Containers/TemplatesV2/tests/actions.test.js +18 -18
  77. package/v2Containers/TemplatesV2/tests/index.test.js +10 -10
  78. package/v2Containers/TemplatesV2/tests/reducer.test.js +9 -9
  79. package/v2Containers/TemplatesV2/tests/sagas.test.js +15 -15
  80. package/v2Containers/TemplatesV2/tests/selectors.test.js +10 -10
  81. 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 = ({
@@ -72,7 +72,7 @@ export const LineImage = ({
72
72
  useEffect(() => {
73
73
  if (imageSrc && (isFullMode ? messageTitle: true) && imagePreview) {
74
74
  updateMessageState({
75
- isError: !imageSrc || !(isFullMode ? messageTitle : true) || (isImageError && errorMessageTitle),
75
+ isError: !imageSrc || !(isFullMode ? messageTitle : true) || isImageError || errorMessageTitle,
76
76
  originalContentUrl: imageSrc,
77
77
  previewImageUrl: imagePreview,
78
78
  messageTitle,
@@ -87,14 +87,16 @@ export const LineImage = ({
87
87
  if (Line.uploadedAssetData && Object.keys(Line.uploadedAssetData).length) {
88
88
  const imgSrc = get(Line, 'uploadedAssetData.metaInfo.secure_file_path', '');
89
89
  const imgPreview = get(Line, 'uploadedAssetData.metaInfo.secure_file_path_preview', '');
90
- updateUploadedAssetList({
91
- ...uploadedAssetList,
92
- [index]: {
93
- imgPreview,
94
- imgSrc,
95
- },
96
- });
97
- actions.clearAsset();
90
+ if (imsSrc) {
91
+ updateUploadedAssetList({
92
+ ...uploadedAssetList,
93
+ [index]: {
94
+ imgPreview,
95
+ imgSrc,
96
+ },
97
+ });
98
+ actions.clearAsset();
99
+ }
98
100
  }
99
101
  }, [Line.uploadedAssetData]);
100
102
 
@@ -148,16 +150,16 @@ export const LineImage = ({
148
150
  let errorMessage = false;
149
151
  if (value === '') {
150
152
  errorMessage = formatMessage(messages.emptyTitleErrorMessage);
151
- updateMessageState({
152
- isError: true,
153
- originalContentUrl: imageSrc,
154
- previewImageUrl: imagePreview,
155
- messageTitle: '',
156
- index,
157
- type: 'image',
158
- messageType: 'originalContentUrl',
159
- });
160
153
  }
154
+ updateMessageState({
155
+ isError: !imageSrc || !(isFullMode ? value : true) || isImageError || !value,
156
+ originalContentUrl: imageSrc,
157
+ previewImageUrl: imagePreview,
158
+ messageTitle: value,
159
+ index,
160
+ type: 'image',
161
+ messageType: 'originalContentUrl',
162
+ });
161
163
  updateErrorMessageTitle(errorMessage);
162
164
  }
163
165
 
@@ -168,11 +170,8 @@ export const LineImage = ({
168
170
  const _URL = window.URL || window.webkitURL;
169
171
  let incorrectFile = false;
170
172
  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
- }
173
+ if (!ALLOWED_EXTENSIONS_REGEX.test(file.name)) {
174
+ incorrectFile = true;
176
175
  }
177
176
  const img = new Image();
178
177
  img.src = _URL.createObjectURL(file);
@@ -402,18 +401,23 @@ export const LineImage = ({
402
401
  const image = get(imageTemplate, 'metaInfo.secure_file_path');
403
402
  const imagePreview = get(imageTemplate, 'metaInfo.secure_file_path_preview');
404
403
  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
- });
404
+ if (!ALLOWED_EXTENSIONS_REGEX.test(image)) {
405
+ updateImageErrorMessage(formatMessage(messages.lineImageIncorrectSize));
406
+ } else {
407
+ updateImageErrorMessage('');
408
+ updateImageStatus(true);
409
+ updateImageSrc(image);
410
+ updateImagePreview(imagePreview);
411
+ updateMessageState({
412
+ isError: !image || !(isFullMode ? messageTitle : true) || isImageError || errorMessageTitle,
413
+ originalContentUrl: image,
414
+ previewImageUrl: imagePreview,
415
+ messageTitle,
416
+ index,
417
+ type: 'image',
418
+ messageType: 'originalContentUrl',
419
+ });
420
+ }
417
421
  }
418
422
 
419
423
  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`,