@capillarytech/creatives-library 7.14.10 → 7.14.12
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.
- package/config/app.js +2 -1
- package/package.json +2 -1
- package/v2Components/CapDocumentUpload/index.js +56 -16
- package/v2Components/CapDocumentUpload/index.scss +3 -3
- package/v2Components/CapDocumentUpload/messages.js +2 -2
- package/v2Components/CapDocumentUpload/tests/index.test.js +2 -3
- package/v2Components/CapVideoUpload/index.js +19 -28
- package/v2Components/CapVideoUpload/index.scss +11 -4
- package/v2Components/CapVideoUpload/messages.js +1 -1
- package/v2Components/TemplatePreview/index.js +1 -1
- package/v2Containers/CreativesContainer/index.js +49 -29
- package/v2Containers/Templates/_templates.scss +16 -0
- package/v2Containers/Templates/index.js +14 -2
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +3 -0
- package/v2Containers/Whatsapp/constants.js +3 -0
- package/v2Containers/Whatsapp/index.js +104 -69
- package/v2Containers/Whatsapp/messages.js +4 -0
- package/v2Containers/Whatsapp/styles.scss +4 -3
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +2058 -4188
- package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +93 -0
- package/v2Containers/Whatsapp/tests/utils.test.js +4 -0
- package/v2Containers/Whatsapp/utils.js +24 -11
- package/v2Containers/mockdata.js +118 -0
package/config/app.js
CHANGED
|
@@ -16,7 +16,8 @@ const config = {
|
|
|
16
16
|
accountConfig: (strs, accountId) => `${window.location.origin}/org/config/AccountAdd?q=a&channelId=2&accountId=${accountId}&edit=1`,
|
|
17
17
|
},
|
|
18
18
|
development: {
|
|
19
|
-
api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/creatives',
|
|
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.
|
|
4
|
+
"version": "7.14.12",
|
|
5
5
|
"description": "Capillary creatives ui",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"module": "./index.es.js",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"node-html-parser": "^5.4.2-0",
|
|
29
29
|
"normalizr": "^3.2.3",
|
|
30
30
|
"papaparse": "^5.3.1",
|
|
31
|
+
"pdfjs-dist": "^2.3.200",
|
|
31
32
|
"pre-push": "^0.1.2",
|
|
32
33
|
"react-datepicker": "^0.46.0",
|
|
33
34
|
"react-dropzone": "^11.3.4",
|
|
@@ -10,8 +10,8 @@ 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';
|
|
14
|
+
const PDFJS = require("pdfjs-dist");
|
|
15
15
|
|
|
16
16
|
function CapDocumentUpload(props) {
|
|
17
17
|
const {
|
|
@@ -26,10 +26,11 @@ function CapDocumentUpload(props) {
|
|
|
26
26
|
index,
|
|
27
27
|
className,
|
|
28
28
|
documentData,
|
|
29
|
-
channel,
|
|
30
29
|
whatsappDocParams,
|
|
31
30
|
setWhatsappDocParams,
|
|
32
31
|
docPreview,
|
|
32
|
+
supportedFormat,
|
|
33
|
+
supportedMaxSize,
|
|
33
34
|
} = props;
|
|
34
35
|
const {
|
|
35
36
|
formatMessage,
|
|
@@ -39,13 +40,11 @@ function CapDocumentUpload(props) {
|
|
|
39
40
|
useEffect(() => {
|
|
40
41
|
const docDataObj = documentData[`uploadedAssetData${index}`];
|
|
41
42
|
if (!isEmpty(docDataObj)) {
|
|
42
|
-
const { secure_file_path = '', karixFileHandle = '', name = '', file_size = ''
|
|
43
|
+
const { secure_file_path = '', karixFileHandle = '', name = '', file_size = ''} = get(docDataObj, 'metaInfo', {});
|
|
43
44
|
setWhatsappDocParams({
|
|
44
45
|
...whatsappDocParams,
|
|
45
46
|
whatsappDocName: name,
|
|
46
47
|
whatsappDocSize: file_size,
|
|
47
|
-
whatsappDocPages: 2,
|
|
48
|
-
whatsappDocImg: 'https://play-lh.googleusercontent.com/BkRfMfIRPR9hUnmIYGDgHHKjow-g18-ouP6B2ko__VnyUHSi1spcc78UtZ4sVUtBH4g',
|
|
49
48
|
});
|
|
50
49
|
updateDocumentSrc(secure_file_path, karixFileHandle);
|
|
51
50
|
}
|
|
@@ -55,7 +54,7 @@ function CapDocumentUpload(props) {
|
|
|
55
54
|
|
|
56
55
|
const {CapHeadingSpan} = CapHeading;
|
|
57
56
|
|
|
58
|
-
const
|
|
57
|
+
const DocPreviewComponent = useCallback(
|
|
59
58
|
() => (
|
|
60
59
|
<div className={`upload uploaded-container ${props.ifError ? 'error' : ''}`}>
|
|
61
60
|
{docPreview}
|
|
@@ -64,7 +63,7 @@ function CapDocumentUpload(props) {
|
|
|
64
63
|
[documentSrc],
|
|
65
64
|
);
|
|
66
65
|
|
|
67
|
-
const WithLabel = LabelHOC(
|
|
66
|
+
const WithLabel = LabelHOC(DocPreviewComponent);
|
|
68
67
|
|
|
69
68
|
const uploadDocuments = useCallback((e, {files}) => {
|
|
70
69
|
if (e) {
|
|
@@ -81,12 +80,46 @@ function CapDocumentUpload(props) {
|
|
|
81
80
|
const fileParams = {
|
|
82
81
|
error: false, // checking error based on file size
|
|
83
82
|
};
|
|
83
|
+
convertPdfToImages(file);
|
|
84
84
|
submitAction({file, type: 'document', fileParams}, incorrectFile);
|
|
85
85
|
if (e) {
|
|
86
86
|
const event = e;
|
|
87
87
|
event.target.value = null;
|
|
88
88
|
}
|
|
89
89
|
}, []);
|
|
90
|
+
const readFileData = (file) => new Promise((resolve, reject) => {
|
|
91
|
+
const reader = new FileReader();
|
|
92
|
+
reader.onload = (e) => {
|
|
93
|
+
resolve(e.target.result);
|
|
94
|
+
};
|
|
95
|
+
reader.onerror = (err) => {
|
|
96
|
+
reject(err);
|
|
97
|
+
};
|
|
98
|
+
reader.readAsDataURL(file);
|
|
99
|
+
});
|
|
100
|
+
const convertPdfToImages = async (file) => {
|
|
101
|
+
const data = await readFileData(file);
|
|
102
|
+
return PDFJS.getDocument(data)
|
|
103
|
+
.then(async function (pdf) {
|
|
104
|
+
const numberOfPages = pdf.numPages;
|
|
105
|
+
const canvas = document.createElement("canvas");
|
|
106
|
+
const page = await pdf.getPage(1);
|
|
107
|
+
const viewport = page.getViewport({ scale: 1 });
|
|
108
|
+
const context = canvas.getContext("2d");
|
|
109
|
+
canvas.height = viewport.height;
|
|
110
|
+
canvas.width = viewport.width;
|
|
111
|
+
await page.render({ canvasContext: context, viewport: viewport }).promise;
|
|
112
|
+
const image = (canvas.toDataURL('image/jpeg', 1.0));
|
|
113
|
+
canvas.remove();
|
|
114
|
+
setWhatsappDocParams({
|
|
115
|
+
...whatsappDocParams,
|
|
116
|
+
whatsappDocImg: image,
|
|
117
|
+
whatsappDocPages: numberOfPages,
|
|
118
|
+
});
|
|
119
|
+
return image;
|
|
120
|
+
})
|
|
121
|
+
.catch((error) => Promise.reject(error));
|
|
122
|
+
};
|
|
90
123
|
|
|
91
124
|
const submitAction = useCallback((data, incorrectFile) => {
|
|
92
125
|
const {
|
|
@@ -168,15 +201,21 @@ function CapDocumentUpload(props) {
|
|
|
168
201
|
{getDocumentSection()}
|
|
169
202
|
</form>
|
|
170
203
|
<div className="image-info-wrapper">
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
204
|
+
<CapHeadingSpan type="label2">
|
|
205
|
+
<FormattedMessage
|
|
206
|
+
{...messages.whatsappDocSize}
|
|
207
|
+
values={{
|
|
208
|
+
size: supportedMaxSize,
|
|
209
|
+
}}
|
|
210
|
+
/>
|
|
211
|
+
</CapHeadingSpan>
|
|
178
212
|
<CapHeadingSpan type="label2" className="image-format">
|
|
179
|
-
<FormattedMessage
|
|
213
|
+
<FormattedMessage
|
|
214
|
+
{...messages.format}
|
|
215
|
+
values={{
|
|
216
|
+
format: supportedFormat,
|
|
217
|
+
}}
|
|
218
|
+
/>
|
|
180
219
|
</CapHeadingSpan>
|
|
181
220
|
</div>
|
|
182
221
|
</div>
|
|
@@ -195,7 +234,8 @@ CapDocumentUpload.propTypes = {
|
|
|
195
234
|
updateOnReUpload: PropTypes.func,
|
|
196
235
|
documentData: PropTypes.object,
|
|
197
236
|
index: PropTypes.number,
|
|
198
|
-
|
|
237
|
+
supportedFormat: PropTypes.string,
|
|
238
|
+
supportedMaxSize: PropTypes.string,
|
|
199
239
|
whatsappDocParams: PropTypes.string,
|
|
200
240
|
setWhatsappDocParams: PropTypes.func,
|
|
201
241
|
docPreview: PropTypes.any,
|
|
@@ -15,7 +15,7 @@ $classPrefix: cap-custom-document-upload;
|
|
|
15
15
|
margin-top: 8px;
|
|
16
16
|
}
|
|
17
17
|
.whatsapp-background div {
|
|
18
|
-
background:
|
|
18
|
+
background: $CAP_G10;
|
|
19
19
|
.ant-upload-list-item .ant-upload-list-item-progress {
|
|
20
20
|
display: none;
|
|
21
21
|
}
|
|
@@ -35,7 +35,7 @@ $classPrefix: cap-custom-document-upload;
|
|
|
35
35
|
.pdf-label {
|
|
36
36
|
width: 162px;
|
|
37
37
|
height: 44px;
|
|
38
|
-
background-color:
|
|
38
|
+
background-color: $CAP_G09;
|
|
39
39
|
display: flex;
|
|
40
40
|
.cap-image-v2 {
|
|
41
41
|
margin: 6px 4px;
|
|
@@ -65,5 +65,5 @@ $classPrefix: cap-custom-document-upload;
|
|
|
65
65
|
|
|
66
66
|
}
|
|
67
67
|
.document-div {
|
|
68
|
-
padding-top:
|
|
68
|
+
padding-top: 20px;
|
|
69
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:
|
|
7
|
+
defaultMessage: 'Size upto: {size}',
|
|
8
8
|
},
|
|
9
9
|
uploadComputer: {
|
|
10
10
|
id: `${scope}.uploadComputer`,
|
|
@@ -28,7 +28,7 @@ export default defineMessages({
|
|
|
28
28
|
},
|
|
29
29
|
format: {
|
|
30
30
|
id: `${scope}.format`,
|
|
31
|
-
defaultMessage: 'Format:
|
|
31
|
+
defaultMessage: 'Format: {format}',
|
|
32
32
|
},
|
|
33
33
|
docErrorDesc: {
|
|
34
34
|
id: `${scope}.docErrorDesc`,
|
|
@@ -33,10 +33,10 @@ describe("test for document upload", () => {
|
|
|
33
33
|
it("test for cap document upload", () => {
|
|
34
34
|
renderComponent(props);
|
|
35
35
|
expect(
|
|
36
|
-
screen.getByText(/size upto
|
|
36
|
+
screen.getByText(/size upto:/i)
|
|
37
37
|
).toBeInTheDocument();
|
|
38
38
|
expect(
|
|
39
|
-
screen.getByText(/format
|
|
39
|
+
screen.getByText(/format:/i)
|
|
40
40
|
).toBeInTheDocument();
|
|
41
41
|
expect(
|
|
42
42
|
screen.getByText(/drag and drop document here/i)
|
|
@@ -66,6 +66,5 @@ describe("test for document upload", () => {
|
|
|
66
66
|
},
|
|
67
67
|
};
|
|
68
68
|
renderComponent(props1);
|
|
69
|
-
expect(true).toBe(true);
|
|
70
69
|
});
|
|
71
70
|
});
|
|
@@ -34,8 +34,8 @@ function CapVideoUpload(props) {
|
|
|
34
34
|
onVideoUploadUpdateAssestList,
|
|
35
35
|
index,
|
|
36
36
|
videoData,
|
|
37
|
-
className,
|
|
38
37
|
channel,
|
|
38
|
+
errorMessage,
|
|
39
39
|
} = props;
|
|
40
40
|
const [isVideoError, updateVideoErrorMessage] = useState(false);
|
|
41
41
|
const [isVideo, updateVideoStatus] = useState(false);
|
|
@@ -131,8 +131,8 @@ function CapVideoUpload(props) {
|
|
|
131
131
|
type,
|
|
132
132
|
} = data;
|
|
133
133
|
if (incorrectFile || size > videoSize) {
|
|
134
|
-
if (
|
|
135
|
-
updateVideoErrorMessage(
|
|
134
|
+
if (errorMessage) {
|
|
135
|
+
updateVideoErrorMessage(errorMessage);
|
|
136
136
|
} else {
|
|
137
137
|
updateVideoErrorMessage(formatMessage(messages.videoIncorrectSize));
|
|
138
138
|
}
|
|
@@ -172,11 +172,6 @@ function CapVideoUpload(props) {
|
|
|
172
172
|
return (
|
|
173
173
|
(
|
|
174
174
|
<>
|
|
175
|
-
{channel === WHATSAPP &&
|
|
176
|
-
<CapError type="error" className="upload-video-error">
|
|
177
|
-
{isVideoError}
|
|
178
|
-
</CapError>
|
|
179
|
-
}
|
|
180
175
|
<CapUploader.CapDragger
|
|
181
176
|
customRequest={(data) => capUploaderCustomVideoRequest(data)}
|
|
182
177
|
className="form-builder-dragger whatsapp-background"
|
|
@@ -191,11 +186,9 @@ function CapVideoUpload(props) {
|
|
|
191
186
|
<FormattedMessage {...messages.selectFromComputer} />
|
|
192
187
|
</CapButton>
|
|
193
188
|
</CapUploader.CapDragger>
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
</CapError>
|
|
198
|
-
}
|
|
189
|
+
<CapError type="error" className="upload-video-error">
|
|
190
|
+
{isVideoError}
|
|
191
|
+
</CapError>
|
|
199
192
|
</>
|
|
200
193
|
)
|
|
201
194
|
);
|
|
@@ -249,9 +242,9 @@ function CapVideoUpload(props) {
|
|
|
249
242
|
<FormattedMessage {...messages.imageReUpload} />
|
|
250
243
|
</CapButton>
|
|
251
244
|
</div>
|
|
252
|
-
<div
|
|
245
|
+
<div className="video-panel">
|
|
253
246
|
<video
|
|
254
|
-
width=
|
|
247
|
+
width="230"
|
|
255
248
|
poster={previewUrl}
|
|
256
249
|
className="line-image-src"
|
|
257
250
|
key={`${index}-video`}
|
|
@@ -264,24 +257,22 @@ function CapVideoUpload(props) {
|
|
|
264
257
|
>
|
|
265
258
|
<source src={videoSrc} type="video/mp4" />
|
|
266
259
|
</video>
|
|
267
|
-
|
|
268
|
-
<
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
</div>
|
|
276
|
-
}
|
|
260
|
+
<div className="video-info">
|
|
261
|
+
<CapHeading type="h6">
|
|
262
|
+
{videoName}
|
|
263
|
+
</CapHeading>
|
|
264
|
+
<CapHeading type="h6">
|
|
265
|
+
{videoDuration}
|
|
266
|
+
</CapHeading>
|
|
267
|
+
</div>
|
|
277
268
|
</div>
|
|
278
269
|
</Fragment>
|
|
279
270
|
);
|
|
280
271
|
};
|
|
281
272
|
return (
|
|
282
273
|
<CapSpin spinning={isSpinning}>
|
|
283
|
-
<div style={style} className=
|
|
284
|
-
<form encType="multipart/form-data" id={`form`} className={channel !== WHATSAPP
|
|
274
|
+
<div style={style} className="cap-custom-video-upload">
|
|
275
|
+
<form encType="multipart/form-data" id={`form`} className={channel !== WHATSAPP ? "video-form" : ""}>
|
|
285
276
|
<input
|
|
286
277
|
key={`videoFile`}
|
|
287
278
|
style={{ display: 'none' }}
|
|
@@ -336,7 +327,7 @@ CapVideoUpload.propTypes = {
|
|
|
336
327
|
index: PropTypes.number,
|
|
337
328
|
videoData: PropTypes.object,
|
|
338
329
|
channel: PropTypes.string,
|
|
339
|
-
|
|
330
|
+
errorMessage: PropTypes.string,
|
|
340
331
|
};
|
|
341
332
|
|
|
342
333
|
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:
|
|
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
|
|
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`,
|
|
@@ -22,7 +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
|
+
import videoPlay from '../../assets/videoPlay.svg';
|
|
26
26
|
const wechatBodyNew = require('./assets/images/wechat_mobile_android.svg');
|
|
27
27
|
const smsMobileAndroid = require('./assets/images/sms_mobile_android.svg');
|
|
28
28
|
const smsMobileIos = require('./assets/images/sms_mobile_ios.svg');
|
|
@@ -385,20 +385,29 @@ export class Creatives extends React.Component {
|
|
|
385
385
|
} = {},
|
|
386
386
|
} = templateData;
|
|
387
387
|
let mediaParams = {};
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
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: {
|
|
404
|
+
...whatsappMedia?.docParams,
|
|
405
|
+
whatsappDocImg: whatsappMedia?.previewUrl,
|
|
406
|
+
},
|
|
407
|
+
};
|
|
408
|
+
break;
|
|
409
|
+
default:
|
|
410
|
+
break;
|
|
402
411
|
}
|
|
403
412
|
const modifiedButtons = cloneDeep(buttons).map((btn) => {
|
|
404
413
|
if (btn.type === 'PHONE_NUMBER') {
|
|
@@ -650,21 +659,32 @@ export class Creatives extends React.Component {
|
|
|
650
659
|
varMapped[`{{${Object.keys(varMapped).length + 1}}}_unsubscribe`] =
|
|
651
660
|
"{{unsubscribe}}";
|
|
652
661
|
}
|
|
653
|
-
let whatsappMedia;
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
662
|
+
let whatsappMedia = {};
|
|
663
|
+
switch (mediaType) {
|
|
664
|
+
case (WHATSAPP_MEDIA_TYPES.IMAGE):
|
|
665
|
+
whatsappMedia = {
|
|
666
|
+
url: imageUrl,
|
|
667
|
+
};
|
|
668
|
+
break;
|
|
669
|
+
case (WHATSAPP_MEDIA_TYPES.VIDEO):
|
|
670
|
+
whatsappMedia = {
|
|
671
|
+
url: videoUrl,
|
|
672
|
+
previewUrl: videoPreviewImg,
|
|
673
|
+
};
|
|
674
|
+
break;
|
|
675
|
+
case (WHATSAPP_MEDIA_TYPES.DOCUMENT):
|
|
676
|
+
whatsappMedia = {
|
|
677
|
+
url: documentUrl,
|
|
678
|
+
previewUrl: whatsappDocParams?.whatsappDocImg,
|
|
679
|
+
docParams: {
|
|
680
|
+
whatsappDocName: whatsappDocParams?.whatsappDocName,
|
|
681
|
+
whatsappDocSize: whatsappDocParams?.whatsappDocSize,
|
|
682
|
+
whatsappDocPages: whatsappDocParams?.whatsappDocPages,
|
|
683
|
+
},
|
|
684
|
+
};
|
|
685
|
+
break;
|
|
686
|
+
default:
|
|
687
|
+
break;
|
|
668
688
|
}
|
|
669
689
|
templateData = {
|
|
670
690
|
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={`${
|
|
@@ -786,6 +786,7 @@ exports[`Test Templates container Test max templates exceeded 1`] = `
|
|
|
786
786
|
className="whatsapp-image"
|
|
787
787
|
src="https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/c9edc114-923b-4ac7-82d0-d6682213.jpg"
|
|
788
788
|
/>
|
|
789
|
+
|
|
789
790
|
<div
|
|
790
791
|
className="whatsapp-doc"
|
|
791
792
|
/>
|
|
@@ -1223,6 +1224,7 @@ exports[`Test Templates container Test max templates not exceeded 1`] = `
|
|
|
1223
1224
|
className="whatsapp-image"
|
|
1224
1225
|
src="https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/c9edc114-923b-4ac7-82d0-d6682213.jpg"
|
|
1225
1226
|
/>
|
|
1227
|
+
|
|
1226
1228
|
<div
|
|
1227
1229
|
className="whatsapp-doc"
|
|
1228
1230
|
/>
|
|
@@ -1660,6 +1662,7 @@ exports[`Test Templates container Test max templates warning 1`] = `
|
|
|
1660
1662
|
className="whatsapp-image"
|
|
1661
1663
|
src="https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/c9edc114-923b-4ac7-82d0-d6682213.jpg"
|
|
1662
1664
|
/>
|
|
1665
|
+
|
|
1663
1666
|
<div
|
|
1664
1667
|
className="whatsapp-doc"
|
|
1665
1668
|
/>
|
|
@@ -187,6 +187,9 @@ export const WHATSAPP_DOCUMENT_SIZE = 16000000; // 16MB
|
|
|
187
187
|
export const HOST_TWILIO = 'twiliowhatsapptrans';
|
|
188
188
|
export const HOST_KARIX = 'karixwhatsappbulk';
|
|
189
189
|
export const SIZE_UNITS = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
190
|
+
export const PAGES = "pages";
|
|
191
|
+
export const PAGE = "page";
|
|
192
|
+
export const PDF = "PDF";
|
|
190
193
|
|
|
191
194
|
export const LANGUAGE_OPTIONS = [
|
|
192
195
|
{
|