@capillarytech/creatives-library 7.14.7 → 7.14.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.
@@ -0,0 +1,9 @@
1
+ <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2
+ <rect width="32" height="32" fill="url(#pattern0)"/>
3
+ <defs>
4
+ <pattern id="pattern0" patternContentUnits="objectBoundingBox" width="1" height="1">
5
+ <use xlink:href="#image0_21_60903" transform="scale(0.0078125)"/>
6
+ </pattern>
7
+ <image id="image0_21_60903" width="128" height="128" xlink:href="data:image/png;base64,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"/>
8
+ </defs>
9
+ </svg>
package/config/app.js CHANGED
@@ -17,6 +17,7 @@ const config = {
17
17
  },
18
18
  development: {
19
19
  api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/creatives',
20
+ //api_endpoint: "http://localhost:2022/arya/api/v1/creatives",
20
21
  campaigns_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/campaigns',
21
22
  campaigns_api_org_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/org/campaign',
22
23
  auth_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/auth',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.14.7",
4
+ "version": "7.14.8",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -0,0 +1,211 @@
1
+ /* eslint-disable camelcase */
2
+ import React, { useState, useEffect, useCallback } from 'react';
3
+ import PropTypes from "prop-types";
4
+ import "@react-pdf-viewer/core/lib/styles/index.css";
5
+ import "@react-pdf-viewer/default-layout/lib/styles/index.css";
6
+ import LabelHOC from '@capillarytech/cap-ui-library/assets/HOCs/ComponentWithLabelHOC';
7
+ import {
8
+ CapUploader,
9
+ CapHeading,
10
+ CapButton,
11
+ } from '@capillarytech/cap-ui-library';
12
+ import { injectIntl, FormattedMessage, intlShape} from 'react-intl';
13
+ import { isEmpty, get } from 'lodash';
14
+ import './index.scss';
15
+ import { WHATSAPP } from "../../v2Containers/CreativesContainer/constants";
16
+ import messages from './messages';
17
+
18
+ function CapDocumentUpload(props) {
19
+ const {
20
+ intl,
21
+ allowedExtensionsRegex,
22
+ documentSize,
23
+ uploadAsset,
24
+ supportedExtensions,
25
+ style,
26
+ documentSrc,
27
+ updateDocumentSrc,
28
+ updateOnReUpload,
29
+ index,
30
+ className,
31
+ documentData,
32
+ channel,
33
+ channelSpecificStyle,
34
+ whatsappDocParams,
35
+ setWhatsappDocParams,
36
+ docPreview,
37
+ } = props;
38
+ const {
39
+ formatMessage,
40
+ } = intl || {};
41
+
42
+
43
+ useEffect(() => {
44
+ const docDataObj = documentData[`uploadedAssetData${index}`];
45
+ if (!isEmpty(docDataObj)) {
46
+ const { secure_file_path = '', karixFileHandle = '', name = '', file_size = '' } = get(docDataObj, 'metaInfo', {});
47
+ setWhatsappDocParams({
48
+ ...whatsappDocParams,
49
+ whatsappDocName: name,
50
+ whatsappDocSize: file_size,
51
+ whatsappDocPages: 2,
52
+ whatsappDocImg: 'https://play-lh.googleusercontent.com/BkRfMfIRPR9hUnmIYGDgHHKjow-g18-ouP6B2ko__VnyUHSi1spcc78UtZ4sVUtBH4g',
53
+ });
54
+ updateDocumentSrc(secure_file_path, karixFileHandle);
55
+ }
56
+ }, [documentData[`uploadedAssetData${index}`]]);
57
+
58
+ const [isDocError, updateDocErrorMessage] = useState(false);
59
+
60
+ const {CapHeadingSpan} = CapHeading;
61
+
62
+ const DocComponent = useCallback(
63
+ () => (
64
+ <div className={`upload uploaded-container ${props.ifError ? 'error' : ''}`}>
65
+ {docPreview}
66
+ </div>
67
+ ),
68
+ [documentSrc],
69
+ );
70
+
71
+ const WithLabel = LabelHOC(DocComponent);
72
+
73
+ const uploadDocuments = useCallback((e, {files}) => {
74
+ if (e) {
75
+ e.preventDefault();
76
+ }
77
+ const _URL = window.URL || window.webkitURL;
78
+ let incorrectFile = false;
79
+ const file = files[0];
80
+ if (!allowedExtensionsRegex.test(file.name)) {
81
+ incorrectFile = true;
82
+ }
83
+ const doc = new FileReader();
84
+ doc.src = _URL.createObjectURL(file);
85
+ const fileParams = {
86
+ error: false, // checking error based on file size
87
+ };
88
+ submitAction({file, type: 'document', fileParams}, incorrectFile);
89
+ if (e) {
90
+ const event = e;
91
+ event.target.value = null;
92
+ }
93
+ }, []);
94
+
95
+ const submitAction = useCallback((data, incorrectFile) => {
96
+ const {
97
+ file,
98
+ fileParams,
99
+ } = data || {};
100
+ const { size } = file || {};
101
+ const { error } = fileParams || {};
102
+ if (incorrectFile || size > documentSize || error) {
103
+ updateDocErrorMessage(formatMessage(messages.docErrorDesc));
104
+ } else {
105
+ updateDocErrorMessage('');
106
+ uploadAsset(
107
+ data.file,
108
+ data.type,
109
+ data.fileParams,
110
+ index,
111
+ );
112
+ }
113
+ }, [isDocError]);
114
+
115
+ const capUploaderCustomRequest = useCallback((uploadData) => {
116
+ uploadDocuments(undefined, {files: [uploadData.file]});
117
+ }, []);
118
+
119
+ const onReUpload = useCallback(() => {
120
+ updateDocumentSrc('');
121
+ updateOnReUpload();
122
+ }, []);
123
+
124
+ const getDocumentSection = useCallback(() => {
125
+ if (documentSrc === "") {
126
+ return (<>
127
+ <CapUploader.CapDragger
128
+ customRequest={capUploaderCustomRequest}
129
+ className="form-builder-dragger whatsapp-background"
130
+ showUploadList={!isDocError}
131
+ >
132
+ <CapHeading className="dragger-title" type="h7">
133
+ <FormattedMessage {...messages.dragAndDrop} />
134
+ </CapHeading>
135
+ <CapHeading className="dragger-or" type="label6">
136
+ <FormattedMessage {...messages.or} />
137
+ </CapHeading>
138
+ <CapButton className="dragger-button upload-doc" type="secondary">
139
+ <FormattedMessage {...messages.uploadComputer} />
140
+ </CapButton>
141
+ </CapUploader.CapDragger>
142
+ </>
143
+ );
144
+ }
145
+ return (
146
+ <CapButton
147
+ className="dragger-button re-upload"
148
+ type="flat"
149
+ onClick={onReUpload}
150
+ style={channelSpecificStyle ? { marginTop: '-16px'} : {}}
151
+ >
152
+ <FormattedMessage {...messages.docReUpload} />
153
+ </CapButton>
154
+ );
155
+ }, [isDocError, documentSrc]);
156
+
157
+ return (
158
+ <div style={style} className="cap-custom-document-upload">
159
+ <WithLabel
160
+ key={`with-label`}
161
+ errorMessage={isDocError} ifError={!!isDocError}
162
+
163
+ />
164
+ <form encType="multipart/form-data" id={`form`} className={className}>
165
+ <input
166
+ key={`docFile`}
167
+ style={{ display: 'none' }}
168
+ id="fileName"
169
+ type="file"
170
+ onChange={(e) => uploadDocuments(e, { files: e.target.files })}
171
+ accept={supportedExtensions || ".pdf"}
172
+ />
173
+ {getDocumentSection()}
174
+ </form>
175
+ <div className="image-info-wrapper">
176
+ {channel === WHATSAPP && (
177
+ <>
178
+ <CapHeadingSpan type="label2">
179
+ <FormattedMessage {...messages.whatsappDocSize} />
180
+ </CapHeadingSpan>
181
+ </>
182
+ )}
183
+ <CapHeadingSpan type="label2" className="image-format">
184
+ <FormattedMessage {...messages.format} />
185
+ </CapHeadingSpan>
186
+ </div>
187
+ </div>
188
+ );
189
+ }
190
+
191
+ CapDocumentUpload.propTypes = {
192
+ allowedExtensionsRegex: PropTypes.any,
193
+ documentSize: PropTypes.number,
194
+ uploadAsset: PropTypes.func,
195
+ supportedExtensions: PropTypes.any,
196
+ style: PropTypes.any,
197
+ documentSrc: PropTypes.string,
198
+ updateDocumentSrc: PropTypes.func,
199
+ intl: intlShape,
200
+ className: PropTypes.string,
201
+ updateOnReUpload: PropTypes.func,
202
+ documentData: PropTypes.object,
203
+ index: PropTypes.number,
204
+ channel: PropTypes.string,
205
+ whatsappDocParams: PropTypes.string,
206
+ setWhatsappDocParams: PropTypes.func,
207
+ channelSpecificStyle: PropTypes.bool,
208
+ docPreview: PropTypes.any,
209
+ };
210
+
211
+ export default injectIntl(CapDocumentUpload);
@@ -0,0 +1,63 @@
1
+ @import '~@capillarytech/cap-ui-library/styles/_variables.scss';
2
+
3
+ $classPrefix: cap-custom-document-upload;
4
+
5
+ .#{$classPrefix} {
6
+ .upload-doc {
7
+ margin-right: $CAP_SPACE_08;
8
+ }
9
+ .image-info-wrapper {
10
+ display: flex;
11
+ justify-content: space-between;
12
+ margin-top: 8px;
13
+ }
14
+ .whatsapp-background div {
15
+ background: #FAFBFC;
16
+ .ant-upload-list-item .ant-upload-list-item-progress {
17
+ display: none;
18
+ }
19
+ }
20
+ .uploaded-container {
21
+ width: 162px;
22
+ margin: auto;
23
+ }
24
+ .pdf-img-box {
25
+ width: 162px;
26
+ height: 80px;
27
+ overflow: hidden;
28
+ }
29
+ .pdf-preview-img {
30
+ width: 162px;
31
+ }
32
+ .pdf-label {
33
+ width: 162px;
34
+ height: 44px;
35
+ background-color: #F4F5F7;
36
+ display: flex;
37
+ .cap-image-v2 {
38
+ margin: 6px 4px;
39
+ width: 32px;
40
+ height: 32px;
41
+ }
42
+ .pdf-info {
43
+ margin: 8px 4px;
44
+ max-width: 114px;
45
+ .pdf-info-sec {
46
+ color: #5f6d85;
47
+ font-size: 8px;
48
+ font-weight: 400;
49
+ line-height: 12px;
50
+ }
51
+ .pdf-name-div {
52
+ display: flex;
53
+ .pdf-name{
54
+ max-width: 112px;
55
+ text-overflow: ellipsis;
56
+ overflow: hidden;
57
+ white-space: nowrap;
58
+ }
59
+ }
60
+ }
61
+ }
62
+
63
+ }
@@ -0,0 +1,38 @@
1
+ import { defineMessages } from 'react-intl';
2
+ const scope = `creatives.componentsV2.CapDocumentUpload`;
3
+
4
+ export default defineMessages({
5
+ whatsappDocSize: {
6
+ id: `${scope}.whatsappDocSize`,
7
+ defaultMessage: 'Size upto: 16MB',
8
+ },
9
+ uploadComputer: {
10
+ id: `${scope}.uploadComputer`,
11
+ defaultMessage: 'Select from computer',
12
+ },
13
+ or: {
14
+ id: `${scope}.or`,
15
+ defaultMessage: 'OR',
16
+ },
17
+ dragAndDrop: {
18
+ id: `${scope}.dragAndDrop`,
19
+ defaultMessage: 'Drag and drop document here',
20
+ },
21
+ docReUpload: {
22
+ id: `${scope}.docReUpload`,
23
+ defaultMessage: 'Reupload',
24
+ },
25
+ imageDimenstionDescription: {
26
+ id: `${scope}.imageDimenstionDescription`,
27
+ defaultMessage: 'Dimensions upto: {width}px x {height}px',
28
+ },
29
+ format: {
30
+ id: `${scope}.format`,
31
+ defaultMessage: 'Format: PDF',
32
+ },
33
+ docErrorDesc: {
34
+ id: `${scope}.docErrorDesc`,
35
+ defaultMessage:
36
+ 'Please upload the document with allowed file extension, size, dimension and aspect ratio',
37
+ },
38
+ });
@@ -0,0 +1 @@
1
+ export const WHATSAPP = 'WHATSAPP';
@@ -20,6 +20,7 @@ import {
20
20
  CapNotification,
21
21
  } from '@capillarytech/cap-ui-library';
22
22
  import {bytes2Size} from '../../utils/common';
23
+ import { WHATSAPP } from './constants';
23
24
  import './index.scss';
24
25
 
25
26
  function CapVideoUpload(props) {
@@ -34,6 +35,8 @@ function CapVideoUpload(props) {
34
35
  onVideoUploadUpdateAssestList,
35
36
  index,
36
37
  videoData,
38
+ className,
39
+ channel,
37
40
  } = props;
38
41
  const [isVideoError, updateVideoErrorMessage] = useState(false);
39
42
  const [isVideo, updateVideoStatus] = useState(false);
@@ -53,7 +56,6 @@ function CapVideoUpload(props) {
53
56
  } = uploadedAssetList;
54
57
 
55
58
  const [isTemplateDrawerRequired, updateTemplateDrawerRequirement] = useState(false);
56
-
57
59
  const uploadVideo = useCallback((e, { files }) => {
58
60
  if (e) {
59
61
  e.preventDefault();
@@ -80,11 +82,12 @@ function CapVideoUpload(props) {
80
82
  }, []);
81
83
 
82
84
  useEffect(() => {
83
- if (videoData[`uploadedAssetDataVideo_${index}`] && Object.keys(videoData[`uploadedAssetDataVideo_${index}`]).length) {
84
- const metaVideoSrc = get(videoData, `uploadedAssetDataVideo_${index}.metaInfo.secure_file_path`, '');
85
- const previewImgUrl = get(videoData, `uploadedAssetDataVideo_${index}.metaInfo.video_file_path_preview`, '');
86
- const metaVideoName = get(videoData, `uploadedAssetDataVideo_${index}.metaInfo.name`, '');
87
- const metaVideoId = get(videoData, `uploadedAssetDataVideo_${index}.videoIdResponse.fbVideo.id`, '');
85
+ if (videoData[`uploadedAssetData${index}`] && Object.keys(videoData[`uploadedAssetData${index}`]).length) {
86
+ const metaVideoSrc = get(videoData, `uploadedAssetData${index}.metaInfo.secure_file_path`, '');
87
+ const previewImgUrl = get(videoData, `uploadedAssetData${index}.metaInfo.video_file_path_preview`, '');
88
+ const metaVideoName = get(videoData, `uploadedAssetData${index}.metaInfo.name`, '');
89
+ const metaVideoId = get(videoData, `uploadedAssetData${index}.videoIdResponse.fbVideo.id`, '');
90
+ const karixFileHandle = get(videoData, `uploadedAssetData${index}.metaInfo.karixFileHandle`, '');
88
91
 
89
92
  if (metaVideoSrc && videoSrc === "") {
90
93
  onVideoUploadUpdateAssestList(index, {
@@ -92,11 +95,12 @@ function CapVideoUpload(props) {
92
95
  videoSrc: metaVideoSrc,
93
96
  videoName: metaVideoName,
94
97
  videoId: metaVideoId,
98
+ fileHandle: karixFileHandle,
95
99
  },
96
100
  );
97
101
  }
98
102
  }
99
- }, [videoData[`uploadedAssetDataVideo_${index}`]]);
103
+ }, [videoData[`uploadedAssetData${index}`]]);
100
104
 
101
105
  useEffect(() => {
102
106
  if (videoData[`assetUploadingVideo_${index}`] && videoData[`assetUploading`] !== false) {
@@ -127,14 +131,18 @@ function CapVideoUpload(props) {
127
131
  type,
128
132
  } = data;
129
133
  if (incorrectFile || size > videoSize) {
130
- updateVideoErrorMessage(formatMessage(messages.videoIncorrectSize));
134
+ if (channel === WHATSAPP) {
135
+ updateVideoErrorMessage(formatMessage(messages.whatsappErrorMessage));
136
+ } else {
137
+ updateVideoErrorMessage(formatMessage(messages.videoIncorrectSize));
138
+ }
131
139
  } else {
132
140
  updateVideoErrorMessage('');
133
141
  uploadAsset(
134
142
  file,
135
143
  type,
136
144
  fileParams,
137
- `Video_${index}`,
145
+ index,
138
146
  );
139
147
  }
140
148
  }, [isVideoError]);
@@ -157,16 +165,21 @@ function CapVideoUpload(props) {
157
165
  if (!e.target.paused && isPlaying) {
158
166
  e.target.pause();
159
167
  }
160
- }, []);
168
+ }, [isPlaying]);
161
169
 
162
170
  const getVideoSection = () => {
163
171
  if (!isVideo) {
164
172
  return (
165
173
  (
166
174
  <>
175
+ {channel === WHATSAPP &&
176
+ <CapError type="error" className="upload-video-error">
177
+ {isVideoError}
178
+ </CapError>
179
+ }
167
180
  <CapUploader.CapDragger
168
181
  customRequest={(data) => capUploaderCustomVideoRequest(data)}
169
- className="form-builder-dragger"
182
+ className="form-builder-dragger whatsapp-background"
170
183
  >
171
184
  <CapHeading className="dragger-title" type="h7">
172
185
  <FormattedMessage {...messages.dragAndDrop} />
@@ -175,12 +188,14 @@ function CapVideoUpload(props) {
175
188
  <FormattedMessage {...messages.or} />
176
189
  </CapHeading>
177
190
  <CapButton className="dragger-button upload-video" type="secondary">
178
- <FormattedMessage {...messages.uploadComputer} />
191
+ <FormattedMessage {...messages.selectFromComputer} />
179
192
  </CapButton>
180
193
  </CapUploader.CapDragger>
181
- <CapError type="error" className="upload-video-error">
182
- {isVideoError}
183
- </CapError>
194
+ {channel !== WHATSAPP &&
195
+ <CapError type="error" className="upload-video-error">
196
+ {isVideoError}
197
+ </CapError>
198
+ }
184
199
  </>
185
200
  )
186
201
  );
@@ -197,6 +212,7 @@ function CapVideoUpload(props) {
197
212
  videoSrc: "",
198
213
  videoDuration: "",
199
214
  videoId: "",
215
+ fileHandle: "",
200
216
  }
201
217
  );
202
218
  };
@@ -233,9 +249,9 @@ function CapVideoUpload(props) {
233
249
  <FormattedMessage {...messages.imageReUpload} />
234
250
  </CapButton>
235
251
  </div>
236
- <div style={{ display: 'flex' }}>
252
+ <div style={{ display: 'flex', justifyContent: 'center', margin: '4px' }}>
237
253
  <video
238
- width="230"
254
+ width={channel === WHATSAPP ? "300" : "230"}
239
255
  poster={previewUrl}
240
256
  className="line-image-src"
241
257
  key={`${index}-video`}
@@ -248,22 +264,24 @@ function CapVideoUpload(props) {
248
264
  >
249
265
  <source src={videoSrc} type="video/mp4" />
250
266
  </video>
251
- <div className="video-info">
252
- <CapHeading type="h6">
253
- {videoName}
254
- </CapHeading>
255
- <CapHeading type="h6">
256
- {videoDuration}
257
- </CapHeading>
258
- </div>
267
+ { channel !== WHATSAPP &&
268
+ <div className="video-info">
269
+ <CapHeading type="h6">
270
+ {videoName}
271
+ </CapHeading>
272
+ <CapHeading type="h6">
273
+ {videoDuration}
274
+ </CapHeading>
275
+ </div>
276
+ }
259
277
  </div>
260
278
  </Fragment>
261
279
  );
262
280
  };
263
281
  return (
264
282
  <CapSpin spinning={isSpinning}>
265
- <div style={style} className="cap-custom-video-upload">
266
- <form encType="multipart/form-data" id={`form`} className="video-form">
283
+ <div style={style} className={className}>
284
+ <form encType="multipart/form-data" id={`form`} className={channel !== WHATSAPP && "video-form"}>
267
285
  <input
268
286
  key={`videoFile`}
269
287
  style={{ display: 'none' }}
@@ -279,18 +297,28 @@ function CapVideoUpload(props) {
279
297
  onClose={() => updateTemplateDrawerRequirement(false)}
280
298
  />
281
299
  </form>
282
- <CapHeading.CapHeadingSpan type="h6" className="video-description">
283
- <FormattedMessage {...messages.videoRatioDescription} />
284
-
285
- </CapHeading.CapHeadingSpan>
286
- {' '}
287
- <CapHeading.CapHeadingSpan type="h6" className="video-description file-format">
288
- <FormattedMessage {...messages.fileFormat} />
300
+ {channel !== WHATSAPP ?
301
+ <>
302
+ <CapHeading.CapHeadingSpan type="h6" className="video-description">
303
+ <FormattedMessage {...messages.videoRatioDescription} />
304
+ </CapHeading.CapHeadingSpan>
305
+ {' '}
306
+ <CapHeading.CapHeadingSpan type="h6" className="video-description file-format">
307
+ <FormattedMessage {...messages.fileFormat} />
289
308
 
290
- </CapHeading.CapHeadingSpan>
291
- <CapHeading.CapHeadingSpan type="h6" className="video-description video-details">
292
- <FormattedMessage {...messages.videoSizeDescription} values={{size: bytes2Size(videoSize)}} />
293
- </CapHeading.CapHeadingSpan>
309
+ </CapHeading.CapHeadingSpan>
310
+ <CapHeading.CapHeadingSpan type="h6" className="video-description video-details">
311
+ <FormattedMessage {...messages.videoSizeDescription} values={{size: bytes2Size(videoSize)}} />
312
+ </CapHeading.CapHeadingSpan>
313
+ </> :
314
+ <>
315
+ <CapHeading.CapHeadingSpan type="label2" className="">
316
+ <FormattedMessage {...messages.videoSizeDescription} values={{size: bytes2Size(videoSize)}} />
317
+ </CapHeading.CapHeadingSpan>
318
+ <CapHeading.CapHeadingSpan type="label2" className="whatsapp-format">
319
+ <FormattedMessage {...messages.whatsappFileFormat} />
320
+ </CapHeading.CapHeadingSpan>
321
+ </>}
294
322
  </div>
295
323
  </CapSpin>
296
324
  );
@@ -307,6 +335,8 @@ CapVideoUpload.propTypes = {
307
335
  onVideoUploadUpdateAssestList: PropTypes.func,
308
336
  index: PropTypes.number,
309
337
  videoData: PropTypes.object,
338
+ channel: PropTypes.string,
339
+ className: PropTypes.string,
310
340
  };
311
341
 
312
342
  export default injectIntl(CapVideoUpload);
@@ -29,4 +29,14 @@ $classPrefix: cap-custom-video-upload;
29
29
  .file-format{
30
30
  padding-left:9%;
31
31
  }
32
+ .whatsapp-background div {
33
+ background: #FAFBFC;
34
+ .ant-upload-list-item .ant-upload-list-item-progress {
35
+ display: none;
36
+ }
37
+ }
38
+ }
39
+
40
+ .whatsapp-format {
41
+ float: right;
32
42
  }
@@ -23,9 +23,9 @@ export default defineMessages({
23
23
  id: `${scope}.textMessageORLabel`,
24
24
  defaultMessage: 'OR',
25
25
  },
26
- uploadComputer: {
27
- id: `${scope}.uploadComputer`,
28
- defaultMessage: 'Your computer',
26
+ selectFromComputer: {
27
+ id: `${scope}.selectFromComputer`,
28
+ defaultMessage: 'Select from computer',
29
29
  },
30
30
  or: {
31
31
  id: `${scope}.or`,
@@ -39,6 +39,10 @@ export default defineMessages({
39
39
  id: `${scope}.videoIncorrectSize`,
40
40
  defaultMessage: 'This file format/size is not supported.',
41
41
  },
42
+ whatsappErrorMessage: {
43
+ id: `${scope}.whatsappErrorMessage`,
44
+ defaultMessage: 'Please upload the document with allowed file extension and size',
45
+ },
42
46
  videoRatioDescription: {
43
47
  id: `${scope}.videoRatioDescription`,
44
48
  defaultMessage: 'Video ratio: 9:16 to 16:9',
@@ -55,4 +59,8 @@ export default defineMessages({
55
59
  id: `${scope}.fileFormat`,
56
60
  defaultMessage: 'Format: MP4',
57
61
  },
62
+ whatsappFileFormat: {
63
+ id: `${scope}.whatsappFileFormat`,
64
+ defaultMessage: 'Format: MP4 and 3gpp (H.264 video codec and AAC audio codec)',
65
+ },
58
66
  });
@@ -289,6 +289,12 @@
289
289
  width: 100%;
290
290
  max-height: 123px;
291
291
  margin-bottom: 4px;
292
+ .pdf-img-box {
293
+ width: 153px;
294
+ }
295
+ .pdf-label{
296
+ width: 153px;
297
+ }
292
298
  }
293
299
  }
294
300
 
@@ -740,6 +740,18 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
740
740
  alt={formatMessage(messages.previewGenerated)}
741
741
  />
742
742
  )}
743
+ {content?.whatsappVideoPreviewImg && (
744
+ <CapImage
745
+ src={content.whatsappVideoPreviewImg}
746
+ className="whatsapp-image"
747
+ alt={formatMessage(messages.previewGenerated)}
748
+ />
749
+ )}
750
+ {content?.docPreview && (
751
+ <div className="whatsapp-image">
752
+ {content?.docPreview}
753
+ </div>
754
+ )}
743
755
  {content?.templateMsg || ''}
744
756
  {renderWhatsappCtaPreview()}
745
757
  </div>
@@ -308,7 +308,7 @@ export const Advertisement = (props) => {
308
308
  newCarouselData[activeIndex].subType = value;
309
309
  newCarouselData[activeIndex].imageData = {};
310
310
  updateCarouselData(newCarouselData);
311
- actions.clearFbAdAsset(`Video_${activeIndex}`);
311
+ actions.clearFbAdAsset(activeIndex);
312
312
  }, [carouselData, activeIndex]);
313
313
 
314
314