@capillarytech/creatives-library 6.8.7 → 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 (30) hide show
  1. package/components/TemplatePreview/_templatePreview.scss +6 -0
  2. package/components/TemplatePreview/index.js +35 -28
  3. package/package.json +1 -1
  4. package/v2Components/Carousel/index.js +120 -0
  5. package/v2Components/Carousel/style.scss +40 -0
  6. package/v2Components/TemplatePreview/_templatePreview.scss +381 -380
  7. package/v2Components/TemplatePreview/index.js +36 -29
  8. package/v2Containers/CreativesContainer/SlideBoxContent.js +7 -1
  9. package/v2Containers/Line/Container/Image/index.js +21 -19
  10. package/v2Containers/Line/Container/ImageCarousel/Content.js +554 -0
  11. package/v2Containers/Line/Container/ImageCarousel/constants.js +10 -0
  12. package/v2Containers/Line/Container/ImageCarousel/index.js +526 -0
  13. package/v2Containers/Line/Container/ImageCarousel/messages.js +178 -0
  14. package/v2Containers/Line/Container/ImageCarousel/style.js +61 -0
  15. package/v2Containers/Line/Container/ImageMap/constants.js +2 -1
  16. package/v2Containers/Line/Container/ImageMap/index.js +31 -6
  17. package/v2Containers/Line/Container/ImageMap/messages.js +12 -0
  18. package/v2Containers/Line/Container/Wrapper/index.js +5 -1
  19. package/v2Containers/Line/Container/Wrapper/messages.js +4 -0
  20. package/v2Containers/Line/Container/Wrapper/utils.js +15 -16
  21. package/v2Containers/Line/Container/_lineCreate.scss +2 -2
  22. package/v2Containers/Line/Container/actions.js +4 -2
  23. package/v2Containers/Line/Container/constants.js +3 -0
  24. package/v2Containers/Line/Container/index.js +49 -11
  25. package/v2Containers/Line/Container/reducer.js +2 -2
  26. package/v2Containers/Line/Container/sagas.js +2 -2
  27. package/v2Containers/Line/Container/style.js +2 -1
  28. package/v2Containers/Templates/_templates.scss +414 -405
  29. package/v2Containers/Templates/index.js +29 -2
  30. package/v2Containers/Templates/messages.js +4 -0
@@ -15,6 +15,7 @@ import './_templatePreview.scss';
15
15
  import {updateCharCount} from '../../utils/smsCharCountV2';
16
16
  import messages from './messages';
17
17
  import { WECHAT } from '../../v2Containers/CreativesContainer/constants';
18
+ import Carousel from '../Carousel';
18
19
  const wechatBodyNew = require('./assets/images/wechat_mobile_android.svg');
19
20
  const smsMobileAndroid = require('./assets/images/sms_mobile_android.svg');
20
21
  const lineMobileAndroid = require('../../assets/line.png');
@@ -23,6 +24,7 @@ const lineStickerPlaceholder = require('../../assets/smiley-placeholder.svg');
23
24
  const androidPushMessagePhone = require('./assets/images/androidPushMessage.svg');
24
25
  const iPhonePushMessagePhone = require('./assets/images/iPhonePushMessage.svg');
25
26
  import { CAP_COLOR_03, CAP_WHITE, FONT_COLOR_01, CAP_G08 } from '@capillarytech/cap-ui-library/styled/variables';
27
+ import { TEMPLATE, IMAGE_CAROUSEL, IMAGE, STICKER, TEXT, IMAGE_MAP } from '../../v2Containers/Line/Container/constants';
26
28
 
27
29
  class TemplatePreview extends React.Component { // eslint-disable-line react/prefer-stateless-function
28
30
  onPreviewContentClicked = (channel) => {
@@ -313,7 +315,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
313
315
  <div
314
316
  className="msgContainer line-preview"
315
317
  style={{
316
- maxHeight: 300,
318
+ maxHeight: 330,
317
319
  overflow: 'scroll',
318
320
  flexDirection: 'column',
319
321
  marginLeft: 40,
@@ -343,35 +345,36 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
343
345
  selectedSticker = {
344
346
  stickerUrl: lineStickerPlaceholder,
345
347
  },
348
+ imageCarousel = [lineImgPlaceholder],
346
349
  } = item || {};
347
- if (type === 'text') {
350
+ const sectionStyle = {
351
+ background: CAP_WHITE,
352
+ color: FONT_COLOR_01,
353
+ borderRadius: 8,
354
+ position: 'static',
355
+ margin: '6px 0 20px 28px',
356
+ height: 'auto',
357
+ minHeight: 'auto',
358
+ overflow: 'initial',
359
+ maxHeight: 'initial',
360
+ };
361
+ if (type === TEXT) {
348
362
  return (
349
363
  <div
350
364
  className="message-pop align-left"
351
- style={{
352
- background: CAP_WHITE,
353
- color: FONT_COLOR_01,
354
- borderRadius: 8,
355
- position: 'static',
356
- margin: '6px 0 20px 28px',
357
- height: 'auto'
358
- }}
365
+ style={sectionStyle}
359
366
  >
360
367
  <p style={{ marginBottom: 5 }}>{messageContent || ''}</p>
361
368
  </div>
362
369
  );
363
370
  }
364
- if ((type === 'image' && previewImageUrl)) {
371
+ if ((type === IMAGE && previewImageUrl)) {
365
372
  return (
366
373
  <div
367
374
  className="message-pop align-left"
368
375
  style={{
369
- background: CAP_G08,
370
- color: FONT_COLOR_01,
371
- borderRadius: 8,
372
- position: 'static',
373
- margin: '6px 0 20px 28px',
374
- height: 184,
376
+ ...sectionStyle,
377
+ minHeight: 184,
375
378
  display: 'flex',
376
379
  justifyContent: 'center',
377
380
  alignItems: 'center',
@@ -390,17 +393,13 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
390
393
  </div>
391
394
  );
392
395
  }
393
- if ((type === 'imagemap' && baseUrl)) {
396
+ if ((type === IMAGE_MAP && baseUrl)) {
394
397
  return (
395
398
  <div
396
399
  className="message-pop align-left"
397
400
  style={{
398
- background: CAP_G08,
399
- color: FONT_COLOR_01,
400
- borderRadius: 8,
401
- position: 'static',
402
- margin: '6px 0 20px 28px',
403
- height: 184,
401
+ ...sectionStyle,
402
+ minHeight: 184,
404
403
  display: 'flex',
405
404
  justifyContent: 'center',
406
405
  alignItems: 'center',
@@ -419,16 +418,13 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
419
418
  </div>
420
419
  );
421
420
  }
422
- if (type === 'sticker' && selectedSticker) {
421
+ if (type === STICKER && selectedSticker) {
423
422
  return (
424
423
  <div
425
424
  className="message-pop align-left"
426
425
  style={{
426
+ ...sectionStyle,
427
427
  background: 'transparent',
428
- color: FONT_COLOR_01,
429
- color: FONT_COLOR_01,
430
- position: 'static',
431
- margin: '6px 0 20px 10px',
432
428
  display: 'flex',
433
429
  justifyContent: 'center',
434
430
  alignItems: 'center',
@@ -450,6 +446,17 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
450
446
  </div>
451
447
  );
452
448
  }
449
+ if ((type === IMAGE_CAROUSEL || type === TEMPLATE) && imageCarousel) {
450
+ return (
451
+ <div
452
+ style={{
453
+ margin: '32px 0',
454
+ }}
455
+ >
456
+ <Carousel imageCarousel={imageCarousel}/>
457
+ </div>
458
+ )
459
+ }
453
460
  return null;
454
461
  })
455
462
  }
@@ -175,7 +175,8 @@ function SlideBoxContent(props) {
175
175
  animatedStickerUrl,
176
176
  stickerId,
177
177
  packageId,
178
- baseUrl
178
+ baseUrl,
179
+ template,
179
180
  }) => {
180
181
  let previewContent = {};
181
182
  previewContent.messageContent = text;
@@ -187,6 +188,8 @@ function SlideBoxContent(props) {
187
188
  packageId,
188
189
  };
189
190
  previewContent.baseUrl = baseUrl;
191
+ previewContent.imageCarousel = get(template, 'columns', [{}]).map(({ imageUrl, action: { label: actionLabel } = {} }) => ({ imageUrl, actionLabel }) );
192
+
190
193
  const getType = () => {
191
194
  if (text) {
192
195
  return 'text';
@@ -200,6 +203,9 @@ function SlideBoxContent(props) {
200
203
  if (baseUrl) {
201
204
  return 'imagemap';
202
205
  }
206
+ if (template) {
207
+ return 'image_carousel';
208
+ }
203
209
  };
204
210
  previewContent.type = getType();
205
211
  return previewContent;
@@ -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
 
@@ -407,7 +409,7 @@ export const LineImage = ({
407
409
  updateImageSrc(image);
408
410
  updateImagePreview(imagePreview);
409
411
  updateMessageState({
410
- isError: !image || !(isFullMode ? messageTitle : true) || (isImageError && errorMessageTitle),
412
+ isError: !image || !(isFullMode ? messageTitle : true) || isImageError || errorMessageTitle,
411
413
  originalContentUrl: image,
412
414
  previewImageUrl: imagePreview,
413
415
  messageTitle,