@capillarytech/creatives-library 6.9.2 → 6.9.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 (32) hide show
  1. package/components/TemplatePreview/_templatePreview.scss +6 -0
  2. package/components/TemplatePreview/index.js +35 -28
  3. package/config/app.js +1 -1
  4. package/index.html +0 -2
  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/_templatePreview.scss +1 -0
  9. package/v2Components/TemplatePreview/index.js +36 -29
  10. package/v2Containers/CreativesContainer/SlideBoxContent.js +7 -1
  11. package/v2Containers/Line/Container/Image/index.js +21 -19
  12. package/v2Containers/Line/Container/ImageCarousel/Content.js +554 -0
  13. package/v2Containers/Line/Container/ImageCarousel/constants.js +10 -0
  14. package/v2Containers/Line/Container/ImageCarousel/index.js +526 -0
  15. package/v2Containers/Line/Container/ImageCarousel/messages.js +178 -0
  16. package/v2Containers/Line/Container/ImageCarousel/style.js +61 -0
  17. package/v2Containers/Line/Container/ImageMap/constants.js +2 -1
  18. package/v2Containers/Line/Container/ImageMap/index.js +31 -6
  19. package/v2Containers/Line/Container/ImageMap/messages.js +12 -0
  20. package/v2Containers/Line/Container/Wrapper/index.js +5 -1
  21. package/v2Containers/Line/Container/Wrapper/messages.js +4 -0
  22. package/v2Containers/Line/Container/Wrapper/utils.js +15 -16
  23. package/v2Containers/Line/Container/_lineCreate.scss +2 -2
  24. package/v2Containers/Line/Container/actions.js +4 -2
  25. package/v2Containers/Line/Container/constants.js +3 -0
  26. package/v2Containers/Line/Container/index.js +49 -11
  27. package/v2Containers/Line/Container/reducer.js +2 -2
  28. package/v2Containers/Line/Container/sagas.js +2 -2
  29. package/v2Containers/Line/Container/style.js +2 -1
  30. package/v2Containers/Templates/_templates.scss +9 -0
  31. package/v2Containers/Templates/index.js +28 -1
  32. package/v2Containers/Templates/messages.js +4 -0
@@ -616,4 +616,10 @@
616
616
  display: inline-block;
617
617
  background-color: #333333;
618
618
  margin-right: 4px;
619
+ }
620
+
621
+ .template-carousel.single-img {
622
+ .slick-track {
623
+ margin-left: 0;
624
+ }
619
625
  }
@@ -11,6 +11,7 @@ import _ from 'lodash';
11
11
  import { injectIntl, intlShape, FormattedMessage} from 'react-intl';
12
12
  import {CapColumn, CapTab, CapIcon, CapLabel, CapImage, CapTooltip} from '@capillarytech/cap-ui-library';
13
13
  import './_templatePreview.scss';
14
+ import Carousel from '../../v2Components/Carousel';
14
15
  import {updateCharCount} from '../../utils/smsCharCountV2';
15
16
  import messages from './messages';
16
17
  const smsIcon = require('./assets/images/user-icon.svg');
@@ -27,6 +28,7 @@ const smsBody = require('./assets/images/mobile.svg');
27
28
  const androidPushMessagePhone = require('./assets/images/androidPushMessage.svg');
28
29
  const iPhonePushMessagePhone = require('./assets/images/iPhonePushMessage.svg');
29
30
  import { CAP_COLOR_03, CAP_WHITE, FONT_COLOR_01, CAP_G08 } from '@capillarytech/cap-ui-library/styled/variables';
31
+ import { TEMPLATE, IMAGE_CAROUSEL, IMAGE_MAP_CAMEL_CASE, IMAGE, STICKER, TEXT } from '../../v2Containers/Line/Container/constants';
30
32
 
31
33
  class TemplatePreview extends React.Component { // eslint-disable-line react/prefer-stateless-function
32
34
  getWechatAndroidPreview = (content) => (
@@ -349,35 +351,36 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
349
351
  selectedSticker = {
350
352
  stickerUrl: lineStickerPlaceholder,
351
353
  },
354
+ imageCarousel = [lineImgPlaceholder],
352
355
  } = item || {};
353
- if (type === 'text') {
356
+ const sectionStyle = {
357
+ background: CAP_WHITE,
358
+ color: FONT_COLOR_01,
359
+ borderRadius: 8,
360
+ position: 'static',
361
+ margin: '6px 0 20px 28px',
362
+ height: 'auto',
363
+ minHeight: 'auto',
364
+ overflow: 'initial',
365
+ maxHeight: 'initial',
366
+ };
367
+ if (type === TEXT) {
354
368
  return (
355
369
  <div
356
370
  className="message-pop align-left"
357
- style={{
358
- background: CAP_WHITE,
359
- color: FONT_COLOR_01,
360
- borderRadius: 8,
361
- position: 'static',
362
- margin: '6px 0 20px 28px',
363
- height: 'auto'
364
- }}
371
+ style={sectionStyle}
365
372
  >
366
373
  <p style={{ marginBottom: 5 }}>{messageContent || ''}</p>
367
374
  </div>
368
375
  );
369
376
  }
370
- if ((type === 'image' && previewImageUrl)) {
377
+ if ((type === IMAGE && previewImageUrl)) {
371
378
  return (
372
379
  <div
373
380
  className="message-pop align-left"
374
381
  style={{
375
- background: CAP_G08,
376
- color: FONT_COLOR_01,
377
- borderRadius: 8,
378
- position: 'static',
379
- margin: '6px 0 20px 28px',
380
- height: 184,
382
+ ...sectionStyle,
383
+ minHeight: 184,
381
384
  display: 'flex',
382
385
  justifyContent: 'center',
383
386
  alignItems: 'center',
@@ -396,17 +399,13 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
396
399
  </div>
397
400
  );
398
401
  }
399
- if ((type === 'imageMap' && baseUrl)) {
402
+ if ((type === IMAGE_MAP_CAMEL_CASE && baseUrl)) {
400
403
  return (
401
404
  <div
402
405
  className="message-pop align-left"
403
406
  style={{
404
- background: CAP_G08,
405
- color: FONT_COLOR_01,
406
- borderRadius: 8,
407
- position: 'static',
408
- margin: '6px 0 20px 28px',
409
- height: 184,
407
+ ...sectionStyle,
408
+ minHeight: 184,
410
409
  display: 'flex',
411
410
  justifyContent: 'center',
412
411
  alignItems: 'center',
@@ -425,16 +424,13 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
425
424
  </div>
426
425
  );
427
426
  }
428
- if (type === 'sticker' && selectedSticker) {
427
+ if (type === STICKER && selectedSticker) {
429
428
  return (
430
429
  <div
431
430
  className="message-pop align-left"
432
431
  style={{
432
+ ...sectionStyle,
433
433
  background: 'transparent',
434
- color: FONT_COLOR_01,
435
- color: FONT_COLOR_01,
436
- position: 'static',
437
- margin: '6px 0 20px 28px',
438
434
  display: 'flex',
439
435
  justifyContent: 'center',
440
436
  alignItems: 'center',
@@ -456,6 +452,17 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
456
452
  </div>
457
453
  );
458
454
  }
455
+ if ((type === IMAGE_CAROUSEL || type === TEMPLATE) && imageCarousel) {
456
+ return (
457
+ <div
458
+ style={{
459
+ margin: '40px 0 8px',
460
+ }}
461
+ >
462
+ <Carousel imageCarousel={imageCarousel}/>
463
+ </div>
464
+ )
465
+ }
459
466
  return null;
460
467
  })
461
468
  }
package/config/app.js CHANGED
@@ -14,7 +14,7 @@ const config = {
14
14
  accountConfig: (strs, accountId) => `${window.location.origin}/org/config/AccountAdd?q=a&channelId=2&accountId=${accountId}&edit=1`,
15
15
  },
16
16
  development: {
17
- api_endpoint: 'http://localhost:2022/arya/api/v1/creatives',
17
+ api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/creatives',
18
18
  campaigns_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/campaigns',
19
19
  auth_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/auth',
20
20
  arya_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1',
package/index.html CHANGED
@@ -13,8 +13,6 @@
13
13
  <script src="https://use.typekit.net/ifw1ntv.js"></script>
14
14
 
15
15
  <script src="https://app-rsrc.getbee.io/plugin/BeePlugin.js" type="text/javascript"></script>
16
- <!-- Roboto Font -->
17
- <link href="https://fonts.googleapis.com/css?family=Roboto:400,500" rel="stylesheet">
18
16
 
19
17
  <!-- Google Tag Manager -->
20
18
  <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "6.9.2",
4
+ "version": "6.9.7",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -0,0 +1,120 @@
1
+ import React, { Component } from "react";
2
+ import { Carousel, Icon } from 'antd';
3
+ import './style.scss';
4
+ import CapImage from '@capillarytech/cap-ui-library/CapImage';
5
+ import CapButton from '@capillarytech/cap-ui-library/CapButton';
6
+ import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
7
+ const lineImgPlaceholder = require('../../assets/line-image-placeholder.svg');
8
+ import { CAP_WHITE, CAP_G08 } from '@capillarytech/cap-ui-library/styled/variables';
9
+
10
+ const arrowStyle = {
11
+ background: 'rgba(0, 0, 0, 0.1)',
12
+ display: 'block',
13
+ position: 'absolute',
14
+ color: CAP_WHITE,
15
+ padding: 0,
16
+ height: 24,
17
+ width: 24,
18
+ borderRadius: '50%',
19
+ }
20
+
21
+ const Arrow = props => {
22
+ const { className, style, onClick, extraStyle, type } = props
23
+ return (
24
+ <CapButton
25
+ className={className}
26
+ onClick={onClick}
27
+ type="flat"
28
+ style={{
29
+ ...style,
30
+ ...arrowStyle,
31
+ ...extraStyle,
32
+ }}
33
+ >
34
+ <CapIcon
35
+ type={type}
36
+ />
37
+ </CapButton>
38
+ )
39
+ }
40
+
41
+ const settings = {
42
+ nextArrow: (
43
+ <Arrow
44
+ extraStyle={{
45
+ right: 10,
46
+ }}
47
+ type="chevron-right"
48
+ />
49
+ ),
50
+ prevArrow: (
51
+ <Arrow
52
+ extraStyle={{
53
+ left: 8,
54
+ zIndex: 1,
55
+ }}
56
+ type="chevron-left"
57
+ />
58
+ ),
59
+ }
60
+
61
+ const CarouselComponent = ({
62
+ imageCarousel,
63
+ }) => {
64
+ let carousel = React.createRef();
65
+ const next = () => carousel.next();
66
+ const previous = () => carousel.prev();
67
+
68
+ const prop = {
69
+ dots: false,
70
+ infinite: true,
71
+ speed: 500,
72
+ slidesToShow: 1,
73
+ slidesToScroll: 0.5,
74
+ arrows: true,
75
+ swipeToSlide: true,
76
+ focusOnSelect: true,
77
+ rows: 1,
78
+ };
79
+
80
+ const imageCarouselLength = imageCarousel.length;
81
+
82
+ return (
83
+ <div style={{ position: 'relative' }} className={`template-carousel ${imageCarouselLength ? 'single-img' : ''}`}>
84
+ <Carousel ref={node => (carousel = node)} {...prop} {...settings}>
85
+ {
86
+ imageCarousel.map(({
87
+ actionLabel,
88
+ imageUrl = lineImgPlaceholder
89
+ }) => (
90
+ <div className="carousel-section">
91
+ <CapImage
92
+ src={imageUrl}
93
+ alt="brand-name"
94
+ rest={{
95
+ style: {
96
+ maxWidth: '100%',
97
+ },
98
+ }}
99
+ />
100
+ <span
101
+ style={{
102
+ position: 'relative',
103
+ bottom: 90,
104
+ background: 'rgba(94, 108, 132, 0.33)',
105
+ borderRadius: '42%',
106
+ padding: '0 12px',
107
+ color: CAP_WHITE,
108
+ }}
109
+ >
110
+ {actionLabel}
111
+ </span>
112
+ </div>
113
+ ))
114
+ }
115
+ </Carousel>
116
+ </div>
117
+ );
118
+ }
119
+
120
+ export default CarouselComponent;
@@ -0,0 +1,40 @@
1
+ @import '~@capillarytech/cap-ui-library/styles/_variables.scss';
2
+
3
+ .template-carousel {
4
+ .slick-slide {
5
+ width: 120px !important;
6
+ margin-right: 6px;
7
+ }
8
+
9
+ .slick-track {
10
+ margin-left: 56px;
11
+ }
12
+
13
+ &.single-img {
14
+ .slick-track {
15
+ margin-left: 0;
16
+ }
17
+ }
18
+
19
+ .slick-list {
20
+ height: 180px;
21
+ }
22
+
23
+ .carousel-section {
24
+ height: 160px;
25
+ line-height: 160px;
26
+ text-align: center;
27
+ width: 120px !important;
28
+ border-radius: 12px;
29
+ background-color: $CAP_G09,
30
+ }
31
+
32
+ .ant-carousel .slick-slide {
33
+ .carousel-section {
34
+ img {
35
+ display: inline-block;
36
+ padding: 0 4px;
37
+ }
38
+ }
39
+ }
40
+ }
@@ -44,6 +44,7 @@
44
44
  }
45
45
  &.line-preview {
46
46
  margin-left: $CAP_SPACE_16;
47
+ width: 40%;
47
48
 
48
49
  .message-pop {
49
50
  width: 80%;
@@ -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,