@capillarytech/creatives-library 8.0.125-alpha.6 → 8.0.126
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 +6 -0
- package/containers/App/constants.js +0 -1
- package/containers/Email/index.js +5 -5
- package/containers/WeChat/RichmediaTemplates/Create/index.js +1 -1
- package/initialReducer.js +2 -0
- package/package.json +1 -1
- package/services/api.js +94 -1
- package/services/tests/api.test.js +191 -0
- package/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +3 -8
- package/tests/integration/TemplateCreation/api-response.js +0 -5
- package/tests/integration/TemplateCreation/msw-handler.js +63 -42
- package/utils/common.js +0 -7
- package/utils/commonUtils.js +6 -2
- package/v2Components/CapImageUpload/index.js +45 -51
- package/v2Components/CapInAppCTA/index.js +0 -1
- package/v2Components/CapTagList/index.js +120 -177
- package/v2Components/CapVideoUpload/constants.js +0 -3
- package/v2Components/CapVideoUpload/index.js +110 -167
- package/v2Components/CapVideoUpload/messages.js +0 -16
- package/v2Components/Carousel/index.js +13 -15
- package/v2Components/CustomerSearchSection/_customerSearch.scss +309 -0
- package/v2Components/CustomerSearchSection/constants.js +5 -0
- package/v2Components/CustomerSearchSection/index.js +362 -0
- package/v2Components/CustomerSearchSection/messages.js +20 -0
- package/v2Components/CustomerSearchSection/tests/utils.test.js +334 -0
- package/v2Components/CustomerSearchSection/utils.js +49 -0
- package/v2Components/ErrorInfoNote/style.scss +0 -1
- package/v2Components/MobilePushPreviewV2/index.js +5 -37
- package/v2Components/TemplatePreview/_templatePreview.scss +72 -114
- package/v2Components/TemplatePreview/index.js +50 -178
- package/v2Components/TemplatePreview/messages.js +0 -4
- package/v2Components/TestAndPreviewSlidebox/_testAndPreviewSlidebox.scss +543 -0
- package/v2Components/TestAndPreviewSlidebox/actions.js +67 -0
- package/v2Components/TestAndPreviewSlidebox/constants.js +67 -0
- package/v2Components/TestAndPreviewSlidebox/index.js +771 -0
- package/v2Components/TestAndPreviewSlidebox/messages.js +147 -0
- package/v2Components/TestAndPreviewSlidebox/reducer.js +233 -0
- package/v2Components/TestAndPreviewSlidebox/sagas.js +258 -0
- package/v2Components/TestAndPreviewSlidebox/selectors.js +142 -0
- package/v2Components/TestAndPreviewSlidebox/tests/actions.test.js +80 -0
- package/v2Components/TestAndPreviewSlidebox/tests/reducer.test.js +367 -0
- package/v2Components/TestAndPreviewSlidebox/tests/saga.rtl.test.js +192 -0
- package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +652 -0
- package/v2Components/TestAndPreviewSlidebox/tests/selector.test.js +182 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +21 -9
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +23 -2
- package/v2Containers/CreativesContainer/index.js +160 -195
- package/v2Containers/CreativesContainer/messages.js +4 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +21 -0
- package/v2Containers/Email/index.js +18 -6
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +10 -0
- package/v2Containers/EmailWrapper/index.js +6 -0
- package/v2Containers/InApp/constants.js +0 -1
- package/v2Containers/InApp/index.js +13 -13
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +3 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -0
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +2 -0
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +9 -0
- package/v2Containers/MobilePush/Create/index.js +0 -1
- package/v2Containers/MobilePush/commonMethods.js +14 -7
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +23 -5
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -0
- package/v2Containers/TagList/index.js +10 -56
- package/v2Containers/Templates/_templates.scss +1 -101
- package/v2Containers/Templates/index.js +35 -147
- package/v2Containers/Templates/messages.js +0 -8
- package/v2Containers/Templates/sagas.js +0 -2
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +1 -1
- package/v2Containers/Whatsapp/constants.js +0 -1
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +35 -0
- package/utils/createPayload.js +0 -270
- package/utils/tests/createPayload.test.js +0 -761
- package/v2Components/CapMpushCTA/constants.js +0 -25
- package/v2Components/CapMpushCTA/index.js +0 -332
- package/v2Components/CapMpushCTA/index.scss +0 -95
- package/v2Components/CapMpushCTA/messages.js +0 -89
- package/v2Components/TemplatePreview/assets/images/Android _ With date and time.svg +0 -29
- package/v2Components/TemplatePreview/assets/images/android.svg +0 -9
- package/v2Components/TemplatePreview/assets/images/iOS _ With date and time.svg +0 -26
- package/v2Components/TemplatePreview/assets/images/ios.svg +0 -9
- package/v2Containers/Email/tests/index.test.js +0 -35
- package/v2Containers/MobilePushNew/actions.js +0 -116
- package/v2Containers/MobilePushNew/components/CtaButtons.js +0 -170
- package/v2Containers/MobilePushNew/components/MediaUploaders.js +0 -686
- package/v2Containers/MobilePushNew/components/PlatformContentFields.js +0 -279
- package/v2Containers/MobilePushNew/components/index.js +0 -5
- package/v2Containers/MobilePushNew/components/tests/CtaButtons.test.js +0 -779
- package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +0 -2114
- package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +0 -343
- package/v2Containers/MobilePushNew/constants.js +0 -115
- package/v2Containers/MobilePushNew/hooks/tests/usePlatformSync.test.js +0 -1299
- package/v2Containers/MobilePushNew/hooks/tests/useUpload.test.js +0 -1223
- package/v2Containers/MobilePushNew/hooks/usePlatformSync.js +0 -246
- package/v2Containers/MobilePushNew/hooks/useUpload.js +0 -709
- package/v2Containers/MobilePushNew/index.js +0 -2170
- package/v2Containers/MobilePushNew/index.scss +0 -308
- package/v2Containers/MobilePushNew/messages.js +0 -226
- package/v2Containers/MobilePushNew/reducer.js +0 -160
- package/v2Containers/MobilePushNew/sagas.js +0 -198
- package/v2Containers/MobilePushNew/selectors.js +0 -55
- package/v2Containers/MobilePushNew/tests/reducer.test.js +0 -741
- package/v2Containers/MobilePushNew/tests/sagas.test.js +0 -863
- package/v2Containers/MobilePushNew/tests/selectors.test.js +0 -425
- package/v2Containers/MobilePushNew/tests/utils.test.js +0 -322
- package/v2Containers/MobilePushNew/utils.js +0 -33
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
* CapVideoUpload
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
|
-
import React, {
|
|
7
|
-
useCallback, useState, Fragment, useRef, useEffect,
|
|
8
|
-
} from 'react';
|
|
6
|
+
import React, { useCallback, useState, Fragment, useRef, useEffect } from 'react';
|
|
9
7
|
import PropTypes from "prop-types";
|
|
10
8
|
import get from 'lodash/get';
|
|
11
9
|
import CapDrawer from '@capillarytech/cap-ui-library/CapDrawer';
|
|
@@ -21,12 +19,9 @@ import {
|
|
|
21
19
|
} from '@capillarytech/cap-ui-library';
|
|
22
20
|
import messages from './messages';
|
|
23
21
|
import {bytes2Size, getDecodedFileName} from '../../utils/common';
|
|
24
|
-
import {
|
|
25
|
-
SUPPORTED_FILE_FORMATS, WHATSAPP, DEFAULT, MAX_DURATION, MOBILEPUSH,
|
|
26
|
-
} from './constants';
|
|
22
|
+
import { SUPPORTED_FILE_FORMATS, WHATSAPP, DEFAULT, VIBER_MAX_DURATION } from './constants';
|
|
27
23
|
import './index.scss';
|
|
28
24
|
import { VIBER } from '../../v2Containers/CreativesContainer/constants';
|
|
29
|
-
import { GIF, VIDEO } from '../../v2Containers/MobilePushNew/constants';
|
|
30
25
|
|
|
31
26
|
function CapVideoUpload(props) {
|
|
32
27
|
const {
|
|
@@ -45,7 +40,6 @@ function CapVideoUpload(props) {
|
|
|
45
40
|
showVideoNameAndDuration = true,
|
|
46
41
|
formClassName = 'video-form',
|
|
47
42
|
showReUploadButton = true,
|
|
48
|
-
mediaType = VIDEO.toLowerCase(),
|
|
49
43
|
} = props;
|
|
50
44
|
const [isVideoError, updateVideoErrorMessage] = useState(false);
|
|
51
45
|
const [isVideo, updateVideoStatus] = useState(false);
|
|
@@ -74,7 +68,6 @@ function CapVideoUpload(props) {
|
|
|
74
68
|
const _URL = window.URL || window.webkitURL;
|
|
75
69
|
let incorrectFile = false;
|
|
76
70
|
const file = files[0];
|
|
77
|
-
|
|
78
71
|
if (!allowedExtensionsRegex.test(file.name)) {
|
|
79
72
|
incorrectFile = true;
|
|
80
73
|
}
|
|
@@ -86,7 +79,7 @@ function CapVideoUpload(props) {
|
|
|
86
79
|
error: false,
|
|
87
80
|
isGenerateVideoThumbnail: true,
|
|
88
81
|
};
|
|
89
|
-
submitVideoAction({ file, type:
|
|
82
|
+
submitVideoAction({ file, type: 'video', fileParams }, incorrectFile);
|
|
90
83
|
if (e) {
|
|
91
84
|
const event = e;
|
|
92
85
|
event.target.value = null;
|
|
@@ -94,18 +87,10 @@ function CapVideoUpload(props) {
|
|
|
94
87
|
}, []);
|
|
95
88
|
|
|
96
89
|
useEffect(() => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const {
|
|
102
|
-
metaInfo: {
|
|
103
|
-
secure_file_path: metaVideoSrc = '',
|
|
104
|
-
file_name: metaVideoName = '',
|
|
105
|
-
preview_image_url: previewImgUrl = '',
|
|
106
|
-
} = {},
|
|
107
|
-
} = videoData[`uploadedAssetData${index}`] || {};
|
|
108
|
-
|
|
90
|
+
if (videoData[`uploadedAssetData${index}`] && Object.keys(videoData[`uploadedAssetData${index}`]).length) {
|
|
91
|
+
const metaVideoSrc = get(videoData, `uploadedAssetData${index}.metaInfo.secure_file_path`, '');
|
|
92
|
+
const previewImgUrl = get(videoData, `uploadedAssetData${index}.metaInfo.video_file_path_preview`, '');
|
|
93
|
+
const metaVideoName = get(videoData, `uploadedAssetData${index}.metaInfo.name`, '');
|
|
109
94
|
const metaVideoId = get(videoData, `uploadedAssetData${index}.videoIdResponse.fbVideo.id`, '');
|
|
110
95
|
const karixFileHandle = get(videoData, `uploadedAssetData${index}.metaInfo.karixFileHandle`, '');
|
|
111
96
|
|
|
@@ -117,13 +102,14 @@ function CapVideoUpload(props) {
|
|
|
117
102
|
videoId: metaVideoId,
|
|
118
103
|
fileHandle: karixFileHandle,
|
|
119
104
|
videoDuration: null,
|
|
120
|
-
}
|
|
105
|
+
},
|
|
106
|
+
);
|
|
121
107
|
}
|
|
122
108
|
}
|
|
123
|
-
}, [videoData
|
|
109
|
+
}, [videoData[`uploadedAssetData${index}`]]);
|
|
124
110
|
|
|
125
111
|
useEffect(() => {
|
|
126
|
-
if (videoData[`assetUploadingVideo_${index}`] && videoData
|
|
112
|
+
if (videoData[`assetUploadingVideo_${index}`] && videoData[`assetUploading`] !== false) {
|
|
127
113
|
const isSpinner = get(videoData, `assetUploadingVideo_${index}`, false);
|
|
128
114
|
setSpinning(isSpinner);
|
|
129
115
|
}
|
|
@@ -137,12 +123,7 @@ function CapVideoUpload(props) {
|
|
|
137
123
|
} = uploadedAssetList || {};
|
|
138
124
|
if (metaVideoSrc) {
|
|
139
125
|
updateVideoStatus(true);
|
|
140
|
-
} else {
|
|
141
|
-
updateVideoStatus(false);
|
|
142
126
|
}
|
|
143
|
-
} else {
|
|
144
|
-
// When uploadedAssetList is empty, reset video status to show upload interface
|
|
145
|
-
updateVideoStatus(false);
|
|
146
127
|
}
|
|
147
128
|
}, [uploadedAssetList]);
|
|
148
129
|
|
|
@@ -155,7 +136,6 @@ function CapVideoUpload(props) {
|
|
|
155
136
|
fileParams,
|
|
156
137
|
type,
|
|
157
138
|
} = data;
|
|
158
|
-
|
|
159
139
|
if (incorrectFile || size > videoSize) {
|
|
160
140
|
if (errorMessage) {
|
|
161
141
|
updateVideoErrorMessage(errorMessage);
|
|
@@ -175,7 +155,11 @@ function CapVideoUpload(props) {
|
|
|
175
155
|
|
|
176
156
|
const {
|
|
177
157
|
formatMessage,
|
|
178
|
-
|
|
158
|
+
} = intl || {};
|
|
159
|
+
|
|
160
|
+
const capUploaderCustomVideoRequest = useCallback((uploadData) => {
|
|
161
|
+
uploadVideo(undefined, { files: [uploadData.file] });
|
|
162
|
+
}, []);
|
|
179
163
|
|
|
180
164
|
const playVideo = useCallback((e) => {
|
|
181
165
|
if (e.target.paused && !isPlaying) {
|
|
@@ -189,86 +173,78 @@ function CapVideoUpload(props) {
|
|
|
189
173
|
}
|
|
190
174
|
}, [isPlaying]);
|
|
191
175
|
|
|
192
|
-
const onReUpload = useCallback(() => {
|
|
193
|
-
updateVideoStatus(false);
|
|
194
|
-
updateVideoDuration(null);
|
|
195
|
-
onVideoUploadUpdateAssestList(
|
|
196
|
-
index,
|
|
197
|
-
{
|
|
198
|
-
previewUrl: "",
|
|
199
|
-
videoName: "",
|
|
200
|
-
videoHeight: "",
|
|
201
|
-
videoWidth: "",
|
|
202
|
-
videoSrc: "",
|
|
203
|
-
videoDuration: null,
|
|
204
|
-
videoId: "",
|
|
205
|
-
fileHandle: "",
|
|
206
|
-
}
|
|
207
|
-
);
|
|
208
|
-
setTimeout(() => {
|
|
209
|
-
const fileInput = document.getElementById("videoFileName");
|
|
210
|
-
if (fileInput) {
|
|
211
|
-
fileInput.click();
|
|
212
|
-
}
|
|
213
|
-
}, 100);
|
|
214
|
-
}, [index, onVideoUploadUpdateAssestList]);
|
|
215
|
-
|
|
216
|
-
const updateMetadataLoaded = useCallback(() => {
|
|
217
|
-
const { current: { duration, videoHeight: metaVideoHeight, videoWidth: metaVideoWidth } = {} } = videoEl;
|
|
218
|
-
if (duration) {
|
|
219
|
-
updateVideoDuration(duration);
|
|
220
|
-
if (videoWidth === undefined && videoHeight === undefined) {
|
|
221
|
-
if (duration <= MAX_DURATION) {
|
|
222
|
-
onVideoUploadUpdateAssestList(index, {
|
|
223
|
-
videoSrc,
|
|
224
|
-
videoId,
|
|
225
|
-
videoName,
|
|
226
|
-
videoHeight: metaVideoHeight,
|
|
227
|
-
videoWidth: metaVideoWidth,
|
|
228
|
-
previewUrl,
|
|
229
|
-
fileHandle,
|
|
230
|
-
videoDuration: duration,
|
|
231
|
-
});
|
|
232
|
-
} else {
|
|
233
|
-
onReUpload();
|
|
234
|
-
updateVideoErrorMessage(formatMessage(messages.videoDurationError));
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}, [videoSrc, videoId, videoName, previewUrl, fileHandle, videoWidth, videoHeight, index, onVideoUploadUpdateAssestList, formatMessage, onReUpload]);
|
|
239
|
-
|
|
240
|
-
const videoDurationValue = videoDuration ? moment('1900-01-01 00:00:00').add(videoDuration, 'seconds').format("HH.mm.ss") : '';
|
|
241
|
-
|
|
242
|
-
const capUploaderCustomVideoRequest = useCallback((uploadData) => {
|
|
243
|
-
uploadVideo(undefined, { files: [uploadData.file] });
|
|
244
|
-
}, [uploadVideo]);
|
|
245
|
-
|
|
246
176
|
const getVideoSection = () => {
|
|
247
177
|
if (!isVideo) {
|
|
248
178
|
return (
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
<
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
<
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
<
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
179
|
+
(
|
|
180
|
+
<>
|
|
181
|
+
<CapUploader.CapDragger
|
|
182
|
+
customRequest={(data) => capUploaderCustomVideoRequest(data)}
|
|
183
|
+
className="form-builder-dragger whatsapp-background"
|
|
184
|
+
showUploadList={!isVideoError}
|
|
185
|
+
>
|
|
186
|
+
<CapHeading className="dragger-title" type="h7">
|
|
187
|
+
<FormattedMessage {...messages.dragAndDrop} />
|
|
188
|
+
</CapHeading>
|
|
189
|
+
<CapHeading className="dragger-or" type="label6">
|
|
190
|
+
<FormattedMessage {...messages.or} />
|
|
191
|
+
</CapHeading>
|
|
192
|
+
<CapButton className="dragger-button upload-video" type="secondary">
|
|
193
|
+
<FormattedMessage {...messages.selectFromComputer} />
|
|
194
|
+
</CapButton>
|
|
195
|
+
</CapUploader.CapDragger>
|
|
196
|
+
<CapError type="error" className="upload-video-error">
|
|
197
|
+
{isVideoError}
|
|
198
|
+
</CapError>
|
|
199
|
+
</>
|
|
200
|
+
)
|
|
269
201
|
);
|
|
270
202
|
}
|
|
203
|
+
const onReUpload = () => {
|
|
204
|
+
updateVideoStatus(false);
|
|
205
|
+
updateVideoDuration(null);
|
|
206
|
+
onVideoUploadUpdateAssestList(
|
|
207
|
+
index,
|
|
208
|
+
{
|
|
209
|
+
previewUrl: "",
|
|
210
|
+
videoName: "",
|
|
211
|
+
videoHeight: "",
|
|
212
|
+
videoWidth: "",
|
|
213
|
+
videoSrc: "",
|
|
214
|
+
videoDuration: null,
|
|
215
|
+
videoId: "",
|
|
216
|
+
fileHandle: "",
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
};
|
|
271
220
|
|
|
221
|
+
const updateMetadataLoaded = () => {
|
|
222
|
+
const { current: { duration, videoHeight: metaVideoHeight, videoWidth: metaVideoWidth } = {} } = videoEl;
|
|
223
|
+
if (duration) {
|
|
224
|
+
updateVideoDuration(duration);
|
|
225
|
+
if (videoWidth === undefined && videoHeight === undefined) {
|
|
226
|
+
if (
|
|
227
|
+
channel !== VIBER ||
|
|
228
|
+
(channel === VIBER && duration <= VIBER_MAX_DURATION)
|
|
229
|
+
) {
|
|
230
|
+
onVideoUploadUpdateAssestList(index, {
|
|
231
|
+
videoSrc,
|
|
232
|
+
videoId,
|
|
233
|
+
videoName,
|
|
234
|
+
videoHeight: metaVideoHeight,
|
|
235
|
+
videoWidth: metaVideoWidth,
|
|
236
|
+
previewUrl,
|
|
237
|
+
fileHandle,
|
|
238
|
+
videoDuration: duration,
|
|
239
|
+
});
|
|
240
|
+
} else {
|
|
241
|
+
onReUpload();
|
|
242
|
+
updateVideoErrorMessage(formatMessage(messages.videoDurationError));
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
const videoDurationValue = moment('1900-01-01 00:00:00').add(videoDuration, 'seconds').format("HH.mm.ss"); // to get the duration of video
|
|
272
248
|
return (
|
|
273
249
|
<Fragment key={videoSrc}>
|
|
274
250
|
{showReUploadButton && (
|
|
@@ -283,35 +259,21 @@ function CapVideoUpload(props) {
|
|
|
283
259
|
</div>
|
|
284
260
|
)}
|
|
285
261
|
<div className={showVideoNameAndDuration ? 'video-panel' : 'video-panel-wp'}>
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
onLoadedMetadata={updateMetadataLoaded}
|
|
302
|
-
onPlaying={() => updateIsPlaying(true)}
|
|
303
|
-
onPause={() => updateIsPlaying(false)}
|
|
304
|
-
onMouseOver={playVideo}
|
|
305
|
-
onMouseOut={pauseVideo}
|
|
306
|
-
onFocus={playVideo}
|
|
307
|
-
onBlur={pauseVideo}
|
|
308
|
-
ref={videoEl}
|
|
309
|
-
>
|
|
310
|
-
<source src={videoSrc} type="video/mp4" />
|
|
311
|
-
<track kind="captions" />
|
|
312
|
-
</video>
|
|
313
|
-
)}
|
|
314
|
-
{showVideoNameAndDuration && (
|
|
262
|
+
<video
|
|
263
|
+
width="230"
|
|
264
|
+
poster={previewUrl}
|
|
265
|
+
className="line-image-src"
|
|
266
|
+
key={`${index}-video`}
|
|
267
|
+
onLoadedMetadata={() => updateMetadataLoaded()}
|
|
268
|
+
onPlaying={() => updateIsPlaying(true)}
|
|
269
|
+
onPause={() => updateIsPlaying(false)}
|
|
270
|
+
onMouseOver={playVideo}
|
|
271
|
+
onMouseOut={pauseVideo}
|
|
272
|
+
ref={videoEl}
|
|
273
|
+
>
|
|
274
|
+
<source src={videoSrc} type="video/mp4" />
|
|
275
|
+
</video>
|
|
276
|
+
{showVideoNameAndDuration &&
|
|
315
277
|
<div className="video-info">
|
|
316
278
|
<CapHeading type="h4">
|
|
317
279
|
{getDecodedFileName(videoName)}
|
|
@@ -320,7 +282,7 @@ function CapVideoUpload(props) {
|
|
|
320
282
|
{videoDurationValue}
|
|
321
283
|
</CapHeading>
|
|
322
284
|
</div>
|
|
323
|
-
|
|
285
|
+
}
|
|
324
286
|
</div>
|
|
325
287
|
</Fragment>
|
|
326
288
|
);
|
|
@@ -338,24 +300,23 @@ function CapVideoUpload(props) {
|
|
|
338
300
|
return (
|
|
339
301
|
<CapSpin spinning={isSpinning}>
|
|
340
302
|
<div style={style} className="cap-custom-video-upload">
|
|
341
|
-
<form encType="multipart/form-data" id=
|
|
303
|
+
<form encType="multipart/form-data" id={`form`} className={formClassName}>
|
|
342
304
|
<input
|
|
343
|
-
key=
|
|
305
|
+
key={`videoFile`}
|
|
344
306
|
style={{ display: 'none' }}
|
|
345
|
-
id="
|
|
307
|
+
id="fileName"
|
|
346
308
|
type="file"
|
|
347
309
|
onChange={(e) => uploadVideo(e, { files: e.target.files })}
|
|
348
|
-
accept={
|
|
349
|
-
|
|
310
|
+
accept={supportedExtensions || "video/*"}
|
|
311
|
+
/>
|
|
350
312
|
{getVideoSection()}
|
|
351
313
|
<CapDrawer
|
|
352
314
|
visible={isTemplateDrawerRequired}
|
|
353
315
|
width={624}
|
|
354
316
|
onClose={() => updateTemplateDrawerRequirement(false)}
|
|
355
|
-
|
|
317
|
+
/>
|
|
356
318
|
</form>
|
|
357
|
-
{![WHATSAPP, VIBER
|
|
358
|
-
&& (
|
|
319
|
+
{![WHATSAPP, VIBER].includes(channel) &&
|
|
359
320
|
<>
|
|
360
321
|
<CapHeading.CapHeadingSpan type="h6" className="video-description">
|
|
361
322
|
<FormattedMessage {...messages.videoRatioDescription} />
|
|
@@ -367,18 +328,15 @@ function CapVideoUpload(props) {
|
|
|
367
328
|
<CapHeading.CapHeadingSpan type="h6" className="video-description video-details">
|
|
368
329
|
<FormattedMessage {...messages.videoSizeDescription} values={{size: bytes2Size(videoSize)}} />
|
|
369
330
|
</CapHeading.CapHeadingSpan>
|
|
370
|
-
</>
|
|
371
|
-
|
|
372
|
-
{channel === WHATSAPP
|
|
373
|
-
&& (
|
|
331
|
+
</>}
|
|
332
|
+
{channel === WHATSAPP &&
|
|
374
333
|
<>
|
|
375
334
|
{getVideoSizeDescription()}
|
|
376
335
|
<CapHeading.CapHeadingSpan type="label2" className="whatsapp-format">
|
|
377
336
|
<FormattedMessage {...messages.channelFileFormat} values={{ format: SUPPORTED_FILE_FORMATS[DEFAULT] }} />
|
|
378
337
|
</CapHeading.CapHeadingSpan>
|
|
379
|
-
</>
|
|
380
|
-
|
|
381
|
-
{channel === VIBER && (
|
|
338
|
+
</>}
|
|
339
|
+
{channel === VIBER &&
|
|
382
340
|
<>
|
|
383
341
|
{getVideoSizeDescription()}
|
|
384
342
|
<CapHeading.CapHeadingSpan type="label2" className="whatsapp-format">
|
|
@@ -387,20 +345,7 @@ function CapVideoUpload(props) {
|
|
|
387
345
|
<CapHeading.CapHeadingSpan type="label2" className="video-duration">
|
|
388
346
|
<FormattedMessage {...messages.viberMaxDuration} />
|
|
389
347
|
</CapHeading.CapHeadingSpan>
|
|
390
|
-
</>
|
|
391
|
-
)}
|
|
392
|
-
{channel === MOBILEPUSH
|
|
393
|
-
&& (
|
|
394
|
-
<>
|
|
395
|
-
{getVideoSizeDescription()}
|
|
396
|
-
<CapHeading.CapHeadingSpan type="label2" className="whatsapp-format">
|
|
397
|
-
<FormattedMessage {...messages.channelFileFormat} values={{ format: SUPPORTED_FILE_FORMATS.MOBILEPUSH }} />
|
|
398
|
-
</CapHeading.CapHeadingSpan>
|
|
399
|
-
<CapHeading.CapHeadingSpan type="label2" className="video-duration">
|
|
400
|
-
<FormattedMessage {...messages.maxDuration} />
|
|
401
|
-
</CapHeading.CapHeadingSpan>
|
|
402
|
-
</>
|
|
403
|
-
)}
|
|
348
|
+
</>}
|
|
404
349
|
</div>
|
|
405
350
|
</CapSpin>
|
|
406
351
|
);
|
|
@@ -421,8 +366,6 @@ CapVideoUpload.propTypes = {
|
|
|
421
366
|
channel: PropTypes.string,
|
|
422
367
|
errorMessage: PropTypes.string,
|
|
423
368
|
formClassName: PropTypes.string,
|
|
424
|
-
showReUploadButton: PropTypes.bool,
|
|
425
|
-
mediaType: PropTypes.string,
|
|
426
369
|
};
|
|
427
370
|
|
|
428
371
|
export default injectIntl(CapVideoUpload);
|
|
@@ -63,24 +63,8 @@ export default defineMessages({
|
|
|
63
63
|
id: `${scope}.viberMaxDuration`,
|
|
64
64
|
defaultMessage: 'Max Duration: 600 seconds',
|
|
65
65
|
},
|
|
66
|
-
maxDuration: {
|
|
67
|
-
id: `${scope}.maxDuration`,
|
|
68
|
-
defaultMessage: 'Max duration: 600 seconds',
|
|
69
|
-
},
|
|
70
66
|
videoDurationError: {
|
|
71
67
|
id: `${scope}.videoDurationError`,
|
|
72
68
|
defaultMessage: 'Video duration should not exceed 600 seconds',
|
|
73
69
|
},
|
|
74
|
-
uploadVideo: {
|
|
75
|
-
id: `${scope}.uploadVideo`,
|
|
76
|
-
defaultMessage: 'Upload Video',
|
|
77
|
-
},
|
|
78
|
-
reUpload: {
|
|
79
|
-
id: `${scope}.reUpload`,
|
|
80
|
-
defaultMessage: 'Re-upload',
|
|
81
|
-
},
|
|
82
|
-
videoDuration: {
|
|
83
|
-
id: `${scope}.videoDuration`,
|
|
84
|
-
defaultMessage: 'Duration: {duration}',
|
|
85
|
-
},
|
|
86
70
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Carousel } from 'antd';
|
|
1
|
+
import React, { Component } from "react";
|
|
2
|
+
import { Carousel, Icon } from 'antd';
|
|
3
3
|
import './style.scss';
|
|
4
4
|
import CapImage from '@capillarytech/cap-ui-library/CapImage';
|
|
5
5
|
import CapButton from '@capillarytech/cap-ui-library/CapButton';
|
|
6
6
|
import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
|
|
7
|
-
import { CAP_WHITE } from '@capillarytech/cap-ui-library/styled/variables';
|
|
8
7
|
const lineImgPlaceholder = require('../../assets/line-image-placeholder.svg');
|
|
8
|
+
import { CAP_WHITE, CAP_G08 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
9
9
|
|
|
10
10
|
const arrowStyle = {
|
|
11
11
|
background: 'rgba(0, 0, 0, 0.1)',
|
|
@@ -16,12 +16,10 @@ const arrowStyle = {
|
|
|
16
16
|
height: 24,
|
|
17
17
|
width: 24,
|
|
18
18
|
borderRadius: '50%',
|
|
19
|
-
}
|
|
19
|
+
}
|
|
20
20
|
|
|
21
|
-
const Arrow =
|
|
22
|
-
const {
|
|
23
|
-
className, style, onClick, extraStyle, type,
|
|
24
|
-
} = props;
|
|
21
|
+
const Arrow = props => {
|
|
22
|
+
const { className, style, onClick, extraStyle, type } = props
|
|
25
23
|
return (
|
|
26
24
|
<CapButton
|
|
27
25
|
className={className}
|
|
@@ -37,8 +35,8 @@ const Arrow = (props) => {
|
|
|
37
35
|
type={type}
|
|
38
36
|
/>
|
|
39
37
|
</CapButton>
|
|
40
|
-
)
|
|
41
|
-
}
|
|
38
|
+
)
|
|
39
|
+
}
|
|
42
40
|
|
|
43
41
|
const settings = {
|
|
44
42
|
nextArrow: (
|
|
@@ -58,7 +56,7 @@ const settings = {
|
|
|
58
56
|
type="chevron-left"
|
|
59
57
|
/>
|
|
60
58
|
),
|
|
61
|
-
}
|
|
59
|
+
}
|
|
62
60
|
|
|
63
61
|
const CarouselComponent = ({
|
|
64
62
|
imageCarousel,
|
|
@@ -83,11 +81,11 @@ const CarouselComponent = ({
|
|
|
83
81
|
|
|
84
82
|
return (
|
|
85
83
|
<div style={{ position: 'relative' }} className={`template-carousel ${imageCarouselLength ? 'single-img' : ''}`}>
|
|
86
|
-
<Carousel ref={
|
|
84
|
+
<Carousel ref={node => (carousel = node)} {...prop} {...settings}>
|
|
87
85
|
{
|
|
88
86
|
imageCarousel.map(({
|
|
89
87
|
actionLabel,
|
|
90
|
-
imageUrl = lineImgPlaceholder
|
|
88
|
+
imageUrl = lineImgPlaceholder
|
|
91
89
|
}) => (
|
|
92
90
|
<div className="carousel-section">
|
|
93
91
|
<CapImage
|
|
@@ -117,6 +115,6 @@ const CarouselComponent = ({
|
|
|
117
115
|
</Carousel>
|
|
118
116
|
</div>
|
|
119
117
|
);
|
|
120
|
-
}
|
|
118
|
+
}
|
|
121
119
|
|
|
122
|
-
export default CarouselComponent;
|
|
120
|
+
export default CarouselComponent;
|