@capillarytech/creatives-library 7.14.9 → 7.14.11

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.
@@ -0,0 +1,3 @@
1
+ <svg width="34" height="34" viewBox="0 0 34 34" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M17.0026 0.333496C7.8026 0.333496 0.335938 7.80016 0.335938 17.0002C0.335938 26.2002 7.8026 33.6668 17.0026 33.6668C26.2026 33.6668 33.6693 26.2002 33.6693 17.0002C33.6693 7.80016 26.2026 0.333496 17.0026 0.333496ZM12.8359 21.4502V12.5502C12.8359 11.2335 14.3026 10.4335 15.4026 11.1502L22.3193 15.6002C23.3359 16.2502 23.3359 17.7502 22.3193 18.4002L15.4026 22.8502C14.3026 23.5668 12.8359 22.7668 12.8359 21.4502Z" fill="#091E42"/>
3
+ </svg>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.14.9",
4
+ "version": "7.14.11",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -10,7 +10,6 @@ import {
10
10
  import { injectIntl, FormattedMessage, intlShape} from 'react-intl';
11
11
  import { isEmpty, get } from 'lodash';
12
12
  import './index.scss';
13
- import { WHATSAPP } from "../../v2Containers/CreativesContainer/constants";
14
13
  import messages from './messages';
15
14
 
16
15
  function CapDocumentUpload(props) {
@@ -20,18 +19,17 @@ function CapDocumentUpload(props) {
20
19
  documentSize,
21
20
  uploadAsset,
22
21
  supportedExtensions,
23
- style,
24
22
  documentSrc,
25
23
  updateDocumentSrc,
26
24
  updateOnReUpload,
27
25
  index,
28
26
  className,
29
27
  documentData,
30
- channel,
31
- channelSpecificStyle,
32
28
  whatsappDocParams,
33
29
  setWhatsappDocParams,
34
30
  docPreview,
31
+ supportedFormat,
32
+ supportedMaxSize,
35
33
  } = props;
36
34
  const {
37
35
  formatMessage,
@@ -57,7 +55,7 @@ function CapDocumentUpload(props) {
57
55
 
58
56
  const {CapHeadingSpan} = CapHeading;
59
57
 
60
- const DocComponent = useCallback(
58
+ const DocPreviewComponent = useCallback(
61
59
  () => (
62
60
  <div className={`upload uploaded-container ${props.ifError ? 'error' : ''}`}>
63
61
  {docPreview}
@@ -66,7 +64,7 @@ function CapDocumentUpload(props) {
66
64
  [documentSrc],
67
65
  );
68
66
 
69
- const WithLabel = LabelHOC(DocComponent);
67
+ const WithLabel = LabelHOC(DocPreviewComponent);
70
68
 
71
69
  const uploadDocuments = useCallback((e, {files}) => {
72
70
  if (e) {
@@ -146,7 +144,6 @@ function CapDocumentUpload(props) {
146
144
  className="dragger-button re-upload"
147
145
  type="flat"
148
146
  onClick={onReUpload}
149
- style={channelSpecificStyle ? { marginTop: '-16px'} : {}}
150
147
  >
151
148
  <FormattedMessage {...messages.docReUpload} />
152
149
  </CapButton>
@@ -154,7 +151,7 @@ function CapDocumentUpload(props) {
154
151
  }, [isDocError, documentSrc]);
155
152
 
156
153
  return (
157
- <div style={style} className="cap-custom-document-upload">
154
+ <div className="cap-custom-document-upload document-div">
158
155
  <WithLabel
159
156
  key={`with-label`}
160
157
  errorMessage={isDocError} ifError={!!isDocError}
@@ -162,7 +159,7 @@ function CapDocumentUpload(props) {
162
159
  <form encType="multipart/form-data" id={`form`} className={className}>
163
160
  <input
164
161
  key={`docFile`}
165
- style={{ display: 'none' }}
162
+ className="input-div"
166
163
  id="fileName"
167
164
  type="file"
168
165
  onChange={(e) => uploadDocuments(e, { files: e.target.files })}
@@ -171,15 +168,21 @@ function CapDocumentUpload(props) {
171
168
  {getDocumentSection()}
172
169
  </form>
173
170
  <div className="image-info-wrapper">
174
- {channel === WHATSAPP && (
175
- <>
176
- <CapHeadingSpan type="label2">
177
- <FormattedMessage {...messages.whatsappDocSize} />
178
- </CapHeadingSpan>
179
- </>
180
- )}
171
+ <CapHeadingSpan type="label2">
172
+ <FormattedMessage
173
+ {...messages.whatsappDocSize}
174
+ values={{
175
+ size: supportedMaxSize,
176
+ }}
177
+ />
178
+ </CapHeadingSpan>
181
179
  <CapHeadingSpan type="label2" className="image-format">
182
- <FormattedMessage {...messages.format} />
180
+ <FormattedMessage
181
+ {...messages.format}
182
+ values={{
183
+ format: supportedFormat,
184
+ }}
185
+ />
183
186
  </CapHeadingSpan>
184
187
  </div>
185
188
  </div>
@@ -191,7 +194,6 @@ CapDocumentUpload.propTypes = {
191
194
  documentSize: PropTypes.number,
192
195
  uploadAsset: PropTypes.func,
193
196
  supportedExtensions: PropTypes.any,
194
- style: PropTypes.any,
195
197
  documentSrc: PropTypes.string,
196
198
  updateDocumentSrc: PropTypes.func,
197
199
  intl: intlShape,
@@ -199,10 +201,10 @@ CapDocumentUpload.propTypes = {
199
201
  updateOnReUpload: PropTypes.func,
200
202
  documentData: PropTypes.object,
201
203
  index: PropTypes.number,
202
- channel: PropTypes.string,
204
+ supportedFormat: PropTypes.string,
205
+ supportedMaxSize: PropTypes.string,
203
206
  whatsappDocParams: PropTypes.string,
204
207
  setWhatsappDocParams: PropTypes.func,
205
- channelSpecificStyle: PropTypes.bool,
206
208
  docPreview: PropTypes.any,
207
209
  };
208
210
 
@@ -6,13 +6,16 @@ $classPrefix: cap-custom-document-upload;
6
6
  .upload-doc {
7
7
  margin-right: $CAP_SPACE_08;
8
8
  }
9
+ .input-div {
10
+ display: none;
11
+ }
9
12
  .image-info-wrapper {
10
13
  display: flex;
11
14
  justify-content: space-between;
12
15
  margin-top: 8px;
13
16
  }
14
17
  .whatsapp-background div {
15
- background: #FAFBFC;
18
+ background: $CAP_G10;
16
19
  .ant-upload-list-item .ant-upload-list-item-progress {
17
20
  display: none;
18
21
  }
@@ -32,7 +35,7 @@ $classPrefix: cap-custom-document-upload;
32
35
  .pdf-label {
33
36
  width: 162px;
34
37
  height: 44px;
35
- background-color: #F4F5F7;
38
+ background-color: $CAP_G09;
36
39
  display: flex;
37
40
  .cap-image-v2 {
38
41
  margin: 6px 4px;
@@ -61,3 +64,6 @@ $classPrefix: cap-custom-document-upload;
61
64
  }
62
65
 
63
66
  }
67
+ .document-div {
68
+ padding-top: '20px';
69
+ }
@@ -4,7 +4,7 @@ const scope = `creatives.componentsV2.CapDocumentUpload`;
4
4
  export default defineMessages({
5
5
  whatsappDocSize: {
6
6
  id: `${scope}.whatsappDocSize`,
7
- defaultMessage: 'Size upto: 16MB',
7
+ defaultMessage: 'Size upto: {size}',
8
8
  },
9
9
  uploadComputer: {
10
10
  id: `${scope}.uploadComputer`,
@@ -28,11 +28,11 @@ export default defineMessages({
28
28
  },
29
29
  format: {
30
30
  id: `${scope}.format`,
31
- defaultMessage: 'Format: PDF',
31
+ defaultMessage: 'Format: {format}',
32
32
  },
33
33
  docErrorDesc: {
34
34
  id: `${scope}.docErrorDesc`,
35
35
  defaultMessage:
36
- 'Please upload the document with allowed file extension, size, dimension and aspect ratio',
36
+ 'Please upload the document with allowed file extension and size',
37
37
  },
38
38
  });
@@ -1,11 +1,10 @@
1
1
  import React from 'react';
2
2
  import { injectIntl } from 'react-intl';
3
3
  import '@testing-library/jest-dom';
4
+ import userEvent from '@testing-library/user-event';
4
5
  import {
5
6
  render,
6
7
  screen,
7
- fireEvent,
8
- waitFor,
9
8
  } from '../../../utils/test-utils';
10
9
  import CapDocumentUpload from '../index';
11
10
 
@@ -33,7 +32,19 @@ describe("test for document upload", () => {
33
32
  };
34
33
  it("test for cap document upload", () => {
35
34
  renderComponent(props);
36
- expect(true).toBe(true);
35
+ expect(
36
+ screen.getByText(/size upto:/i)
37
+ ).toBeInTheDocument();
38
+ expect(
39
+ screen.getByText(/format:/i)
40
+ ).toBeInTheDocument();
41
+ expect(
42
+ screen.getByText(/drag and drop document here/i)
43
+ ).toBeInTheDocument();
44
+ const button = screen.getByRole('button', {
45
+ name: /drag and drop document here or select from computer/i,
46
+ });
47
+ userEvent.click(button);
37
48
  });
38
49
  it("test for cap document upload 1", () => {
39
50
  const props1 = {
@@ -55,6 +66,5 @@ describe("test for document upload", () => {
55
66
  },
56
67
  };
57
68
  renderComponent(props1);
58
- expect(true).toBe(true);
59
69
  });
60
70
  });
@@ -10,15 +10,14 @@ import CapDrawer from '@capillarytech/cap-ui-library/CapDrawer';
10
10
  import { injectIntl, FormattedMessage, intlShape } from 'react-intl';
11
11
  import moment from 'moment';
12
12
  import isEmpty from 'lodash/isEmpty';
13
- import messages from './messages';
14
13
  import {
15
14
  CapHeading,
16
15
  CapButton,
17
16
  CapError,
18
17
  CapUploader,
19
18
  CapSpin,
20
- CapNotification,
21
19
  } from '@capillarytech/cap-ui-library';
20
+ import messages from './messages';
22
21
  import {bytes2Size} from '../../utils/common';
23
22
  import { WHATSAPP } from './constants';
24
23
  import './index.scss';
@@ -35,8 +34,8 @@ function CapVideoUpload(props) {
35
34
  onVideoUploadUpdateAssestList,
36
35
  index,
37
36
  videoData,
38
- className,
39
37
  channel,
38
+ errorMessage,
40
39
  } = props;
41
40
  const [isVideoError, updateVideoErrorMessage] = useState(false);
42
41
  const [isVideo, updateVideoStatus] = useState(false);
@@ -132,8 +131,8 @@ function CapVideoUpload(props) {
132
131
  type,
133
132
  } = data;
134
133
  if (incorrectFile || size > videoSize) {
135
- if (channel === WHATSAPP) {
136
- updateVideoErrorMessage(formatMessage(messages.whatsappErrorMessage));
134
+ if (errorMessage) {
135
+ updateVideoErrorMessage(errorMessage);
137
136
  } else {
138
137
  updateVideoErrorMessage(formatMessage(messages.videoIncorrectSize));
139
138
  }
@@ -173,11 +172,6 @@ function CapVideoUpload(props) {
173
172
  return (
174
173
  (
175
174
  <>
176
- {channel === WHATSAPP &&
177
- <CapError type="error" className="upload-video-error">
178
- {isVideoError}
179
- </CapError>
180
- }
181
175
  <CapUploader.CapDragger
182
176
  customRequest={(data) => capUploaderCustomVideoRequest(data)}
183
177
  className="form-builder-dragger whatsapp-background"
@@ -192,11 +186,9 @@ function CapVideoUpload(props) {
192
186
  <FormattedMessage {...messages.selectFromComputer} />
193
187
  </CapButton>
194
188
  </CapUploader.CapDragger>
195
- {channel !== WHATSAPP &&
196
- <CapError type="error" className="upload-video-error">
197
- {isVideoError}
198
- </CapError>
199
- }
189
+ <CapError type="error" className="upload-video-error">
190
+ {isVideoError}
191
+ </CapError>
200
192
  </>
201
193
  )
202
194
  );
@@ -250,9 +242,9 @@ function CapVideoUpload(props) {
250
242
  <FormattedMessage {...messages.imageReUpload} />
251
243
  </CapButton>
252
244
  </div>
253
- <div style={{ display: 'flex', justifyContent: 'center', margin: '4px' }}>
245
+ <div className={channel === WHATSAPP ? 'video-panel-wp' : 'video-panel'}>
254
246
  <video
255
- width={channel === WHATSAPP ? "300" : "230"}
247
+ width="230"
256
248
  poster={previewUrl}
257
249
  className="line-image-src"
258
250
  key={`${index}-video`}
@@ -281,8 +273,8 @@ function CapVideoUpload(props) {
281
273
  };
282
274
  return (
283
275
  <CapSpin spinning={isSpinning}>
284
- <div style={style} className={className}>
285
- <form encType="multipart/form-data" id={`form`} className={channel !== WHATSAPP && "video-form"}>
276
+ <div style={style} className="cap-custom-video-upload">
277
+ <form encType="multipart/form-data" id={`form`} className={channel !== WHATSAPP ? "video-form" : ""}>
286
278
  <input
287
279
  key={`videoFile`}
288
280
  style={{ display: 'none' }}
@@ -337,7 +329,7 @@ CapVideoUpload.propTypes = {
337
329
  index: PropTypes.number,
338
330
  videoData: PropTypes.object,
339
331
  channel: PropTypes.string,
340
- className: PropTypes.string,
332
+ errorMessage: PropTypes.string,
341
333
  };
342
334
 
343
335
  export default injectIntl(CapVideoUpload);
@@ -30,13 +30,20 @@ $classPrefix: cap-custom-video-upload;
30
30
  padding-left:9%;
31
31
  }
32
32
  .whatsapp-background div {
33
- background: #FAFBFC;
33
+ background: $CAP_G10;
34
34
  .ant-upload-list-item .ant-upload-list-item-progress {
35
35
  display: none;
36
36
  }
37
- }
37
+ }
38
38
  }
39
-
40
39
  .whatsapp-format {
41
40
  float: right;
42
- }
41
+ }
42
+ .video-panel-wp {
43
+ display: flex;
44
+ justify-content: center;
45
+ margin: 4px;
46
+ }
47
+ .video-panel {
48
+ display: flex;
49
+ }
@@ -41,7 +41,7 @@ export default defineMessages({
41
41
  },
42
42
  whatsappErrorMessage: {
43
43
  id: `${scope}.whatsappErrorMessage`,
44
- defaultMessage: 'Please upload the document with allowed file extension and size',
44
+ defaultMessage: 'Please upload the video with allowed file extension, size, dimension and aspect ratio',
45
45
  },
46
46
  videoRatioDescription: {
47
47
  id: `${scope}.videoRatioDescription`,
@@ -1,11 +1,10 @@
1
1
  import React from 'react';
2
2
  import { injectIntl } from 'react-intl';
3
+ import userEvent from '@testing-library/user-event';
3
4
  import '@testing-library/jest-dom';
4
5
  import {
5
6
  render,
6
7
  screen,
7
- fireEvent,
8
- waitFor,
9
8
  } from '../../../utils/test-utils';
10
9
  import CapVideoUpload from '../index';
11
10
 
@@ -20,7 +19,6 @@ describe("test for document upload", () => {
20
19
  videoSize: 16000000,
21
20
  uploadAsset: jest.fn(),
22
21
  supportedExtensions: '',
23
- videoSrc: '',
24
22
  uploadedAssetList: {},
25
23
  updateDocumentSrc: jest.fn(),
26
24
  updateOnReUpload: jest.fn(),
@@ -32,28 +30,61 @@ describe("test for document upload", () => {
32
30
  };
33
31
  it("test for cap document upload", () => {
34
32
  renderComponent(props);
35
- expect(true).toBe(true);
33
+ expect(
34
+ screen.getByText(/file size: up to 16 mb/i)
35
+ ).toBeInTheDocument();
36
+ expect(
37
+ screen.getByText(
38
+ /format: mp4 and 3gpp \(h\.264 video codec and aac audio codec\)/i)
39
+ ).toBeInTheDocument();
40
+ expect(
41
+ screen.getByText(/drag and drop video here/i)
42
+ ).toBeInTheDocument();
43
+ const button = screen.getByRole('button', {
44
+ name: /drag and drop video here or select from computer/i,
45
+ });
46
+ userEvent.click(button);
36
47
  });
37
48
  it("test for cap document upload 1", () => {
38
49
  const props1 = {
39
50
  ...props,
40
- documentData: {
51
+ videoData: {
41
52
  uploadedAssetData0: {
42
- file_size: 134532,
43
- name: 'sample.pdf',
44
- secure_file_path: "https://www.africau.edu/images/default/sample.pdf",
45
- karixFileHandle: 'abcd',
53
+ _id: "63f3126a8f9d2d85450a99d3",
54
+ type: "VIDEO",
55
+ isActive: true,
56
+ name: "sample_960x540_Xs2E4anK.mp4",
57
+ createdBy: "15000449",
58
+ updatedBy: "15000449",
59
+ orgId: 50074,
60
+ metaInfo: {
61
+ file_handle: null,
62
+ name: "sample_960x540_Xs2E4anK.mp4",
63
+ content_type: null,
64
+ file_size: 1320775,
65
+ added_on: 1676874342000,
66
+ last_modified_on: 1676874342000,
67
+ acl: null,
68
+ secure_file_path: "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/69d66812-291f-4658-9da8-c6d30eef.mp4",
69
+ public_url: "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/69d66812-291f-4658-9da8-c6d30eef.mp4",
70
+ video_file_path_preview: "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/video_screenshot_assets__1676874342082.png/1040"
71
+ },
72
+ createdAt: "2023-02-20T06:25:46.637Z",
73
+ updatedAt: "2023-02-20T06:25:46.637Z",
74
+ __v: 0,
46
75
  },
47
76
  },
48
- documentSrc: "https://www.africau.edu/images/default/sample.pdf",
49
- whatsappDocParams: {
50
- whatsappDocName: 'sample.pdf',
51
- whatsappDocSize: 134532,
52
- whatsappDocPages: 2,
53
- whatsappDocImg: 'https://play-lh.googleusercontent.com/BkRfMfIRPR9hUnmIYGDgHHKjow-g18-ouP6B2ko__VnyUHSi1spcc78UtZ4sVUtBH4g',
77
+ uploadedAssetList: {
78
+ videoSrc: "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/69d66812-291f-4658-9da8-c6d30eef.mp4",
79
+ videoId: "",
80
+ videoName: "sample_960x540_Xs2E4anK.mp4",
81
+ videoHeight: 540,
82
+ videoWidth: 960,
83
+ previewUrl: "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/video_screenshot_assets__1676874342082.png/1040"
54
84
  },
55
85
  };
56
86
  renderComponent(props1);
57
- expect(true).toBe(true);
87
+ const reUploadBtn = screen.getByRole('button', {name: /re upload/i});
88
+ userEvent.click(reUploadBtn);
58
89
  });
59
90
  });
@@ -457,4 +457,20 @@
457
457
  span {
458
458
  font-size: $FONT_SIZE_VS;
459
459
  }
460
+ }
461
+
462
+ .video-preview {
463
+ position: relative;
464
+ }
465
+ .icon-position {
466
+ width: 50%;
467
+ height: 50%;
468
+ position: absolute;
469
+ left: 0;
470
+ top: 0;
471
+ }
472
+ .video-icon {
473
+ position: absolute;
474
+ right: -17px;
475
+ bottom: -17px;
460
476
  }
@@ -22,6 +22,7 @@ import {
22
22
  import Carousel from '../Carousel';
23
23
  import { VIBER, FACEBOOK } from '../../v2Containers/App/constants';
24
24
  import whatsappMobileAndroid from './assets/images/whatsapp_mobile_android.svg';
25
+ import videoPlay from '../../assets/videoPlay.svg';
25
26
  const wechatBodyNew = require('./assets/images/wechat_mobile_android.svg');
26
27
  const smsMobileAndroid = require('./assets/images/sms_mobile_android.svg');
27
28
  const smsMobileIos = require('./assets/images/sms_mobile_ios.svg');
@@ -741,11 +742,16 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
741
742
  />
742
743
  )}
743
744
  {content?.whatsappVideoPreviewImg && (
744
- <CapImage
745
- src={content.whatsappVideoPreviewImg}
746
- className="whatsapp-image"
747
- alt={formatMessage(messages.previewGenerated)}
748
- />
745
+ <div className="video-preview">
746
+ <CapImage
747
+ src={content.whatsappVideoPreviewImg}
748
+ className="whatsapp-image"
749
+ alt={formatMessage(messages.previewGenerated)}
750
+ />
751
+ <div className="icon-position">
752
+ <CapImage className="video-icon" src={videoPlay} />
753
+ </div>
754
+ </div>
749
755
  )}
750
756
  {content?.docPreview && (
751
757
  <div className="whatsapp-image">
@@ -385,20 +385,26 @@ export class Creatives extends React.Component {
385
385
  } = {},
386
386
  } = templateData;
387
387
  let mediaParams = {};
388
- if (mediaType === WHATSAPP_MEDIA_TYPES.IMAGE) {
389
- mediaParams = {
390
- imageUrl: whatsappMedia?.url,
391
- };
392
- } else if (mediaType === WHATSAPP_MEDIA_TYPES.VIDEO) {
393
- mediaParams = {
394
- videoUrl: whatsappMedia?.url,
395
- videoPreviewImg: whatsappMedia?.previewUrl,
396
- };
397
- } else if (mediaType === WHATSAPP_MEDIA_TYPES.DOCUMENT) {
398
- mediaParams = {
399
- documentUrl: whatsappMedia?.url,
400
- whatsappDocParams: whatsappMedia?.docParams,
401
- };
388
+ switch (mediaType) {
389
+ case (WHATSAPP_MEDIA_TYPES.IMAGE):
390
+ mediaParams = {
391
+ imageUrl: whatsappMedia?.url,
392
+ };
393
+ break;
394
+ case (WHATSAPP_MEDIA_TYPES.VIDEO):
395
+ mediaParams = {
396
+ videoUrl: whatsappMedia?.url,
397
+ videoPreviewImg: whatsappMedia?.previewUrl,
398
+ };
399
+ break;
400
+ case (WHATSAPP_MEDIA_TYPES.DOCUMENT):
401
+ mediaParams = {
402
+ documentUrl: whatsappMedia?.url,
403
+ whatsappDocParams: whatsappMedia?.docParams,
404
+ };
405
+ break;
406
+ default:
407
+ break;
402
408
  }
403
409
  const modifiedButtons = cloneDeep(buttons).map((btn) => {
404
410
  if (btn.type === 'PHONE_NUMBER') {
@@ -650,21 +656,27 @@ export class Creatives extends React.Component {
650
656
  varMapped[`{{${Object.keys(varMapped).length + 1}}}_unsubscribe`] =
651
657
  "{{unsubscribe}}";
652
658
  }
653
- let whatsappMedia;
654
- if (mediaType === WHATSAPP_MEDIA_TYPES.IMAGE) {
655
- whatsappMedia = {
656
- url: imageUrl,
657
- };
658
- } else if (mediaType === WHATSAPP_MEDIA_TYPES.VIDEO) {
659
- whatsappMedia = {
660
- url: videoUrl,
661
- previewUrl: videoPreviewImg,
662
- };
663
- } else if (mediaType === WHATSAPP_MEDIA_TYPES.DOCUMENT) {
664
- whatsappMedia = {
665
- url: documentUrl,
666
- docParams: whatsappDocParams,
667
- };
659
+ let whatsappMedia = {};
660
+ switch (mediaType) {
661
+ case (WHATSAPP_MEDIA_TYPES.IMAGE):
662
+ whatsappMedia = {
663
+ url: imageUrl,
664
+ };
665
+ break;
666
+ case (WHATSAPP_MEDIA_TYPES.VIDEO):
667
+ whatsappMedia = {
668
+ url: videoUrl,
669
+ previewUrl: videoPreviewImg,
670
+ };
671
+ break;
672
+ case (WHATSAPP_MEDIA_TYPES.DOCUMENT):
673
+ whatsappMedia = {
674
+ url: documentUrl,
675
+ docParams: whatsappDocParams,
676
+ };
677
+ break;
678
+ default:
679
+ break;
668
680
  }
669
681
  templateData = {
670
682
  channel,
@@ -628,4 +628,20 @@
628
628
  -webkit-line-clamp: 10;
629
629
  -webkit-box-orient: vertical;
630
630
  overflow: hidden;
631
+ }
632
+
633
+ .video-preview {
634
+ position: relative;
635
+ }
636
+ .icon-position {
637
+ width: 50%;
638
+ height: 50%;
639
+ position: absolute;
640
+ left: 0;
641
+ top: 0;
642
+ }
643
+ .video-icon {
644
+ position: absolute;
645
+ right: -17px;
646
+ bottom: -17px;
631
647
  }
@@ -106,7 +106,7 @@ import { getRCSContent } from '../Rcs/utils';
106
106
  import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE, VIBER, FACEBOOK, WHATSAPP, RCS } from '../CreativesContainer/constants';
107
107
 
108
108
  import {CREATIVE} from '../Facebook/constants';
109
-
109
+ import videoPlay from '../../assets/videoPlay.svg';
110
110
  import emailIllustration from '../Assets/images/emailIllustration.svg';
111
111
  import smsIllustration from '../Assets/images/smsIllustration.svg';
112
112
  import pushIllustration from '../Assets/images/pushIllustration.svg';
@@ -1067,7 +1067,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1067
1067
  break;
1068
1068
  }
1069
1069
  case WHATSAPP: {
1070
- const { whatsappImageSrc = '', templateMsg, docPreview} = getWhatsappContent(template);
1070
+ const { whatsappImageSrc = '', templateMsg, docPreview, whatsappVideoSrc = ''} = getWhatsappContent(template);
1071
1071
  templateData.title = (
1072
1072
  <CapRow>
1073
1073
  <CapLabel className="whatsapp-rcs-template-name">{template?.name}</CapLabel>
@@ -1079,6 +1079,18 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1079
1079
  {whatsappImageSrc && (
1080
1080
  <CapImage src={whatsappImageSrc} className="whatsapp-image" />
1081
1081
  )}
1082
+ {whatsappVideoSrc && (
1083
+ <div className="video-preview">
1084
+ <CapImage
1085
+ src={whatsappVideoSrc}
1086
+ className="whatsapp-image"
1087
+ />
1088
+ <div className="icon-position">
1089
+ <CapImage className="video-icon" src={videoPlay} />
1090
+ </div>
1091
+ </div>
1092
+ // <CapImage src={whatsappVideoSrc} className="whatsapp-image" />
1093
+ )}
1082
1094
  <div className="whatsapp-doc">{docPreview}</div>
1083
1095
  <span
1084
1096
  className={`${