@capillarytech/creatives-library 7.17.118-alpha.0 → 7.17.118
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/package.json +1 -1
- package/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +12 -16
- package/v2Components/CapImageUpload/index.js +16 -15
- package/v2Components/CapImageUpload/messages.js +5 -1
- package/v2Components/CapVideoUpload/constants.js +0 -5
- package/v2Components/CapVideoUpload/index.js +8 -28
- package/v2Components/CapVideoUpload/index.scss +1 -4
- package/v2Components/CapVideoUpload/messages.js +4 -4
- package/v2Components/FormBuilder/constants.js +1 -0
- package/v2Components/FormBuilder/index.js +2 -2
- package/v2Components/TemplatePreview/_templatePreview.scss +0 -21
- package/v2Components/TemplatePreview/index.js +45 -56
- package/v2Containers/CreativesContainer/SlideBoxContent.js +8 -10
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +0 -1
- package/v2Containers/CreativesContainer/index.js +1 -0
- package/v2Containers/CreativesContainer/messages.js +0 -4
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +0 -11
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +0 -225
- package/v2Containers/Email/index.js +3 -1
- package/v2Containers/EmailWrapper/index.js +3 -0
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +20 -35
- package/v2Containers/Templates/_templates.scss +4 -9
- package/v2Containers/Templates/index.js +8 -29
- package/v2Containers/Viber/constants.js +0 -58
- package/v2Containers/Viber/index.js +421 -409
- package/v2Containers/Viber/messages.js +0 -68
- package/v2Components/CapImageUpload/constants.js +0 -6
- package/v2Containers/Viber/index.scss +0 -113
- package/v2Containers/Viber/style.js +0 -20
- package/v2Containers/Viber/tests/index.test.js +0 -297
- package/v2Containers/Viber/tests/mockData.js +0 -134
package/package.json
CHANGED
|
@@ -273,8 +273,12 @@ describe("Creatives testing template creation", () => {
|
|
|
273
273
|
fireEvent.change(templateNameInput, {
|
|
274
274
|
target: { value: 'viber_test_template' },
|
|
275
275
|
});
|
|
276
|
-
|
|
277
|
-
|
|
276
|
+
|
|
277
|
+
const templateTextInput = await creativesScreen.getByText(
|
|
278
|
+
/Text message/,
|
|
279
|
+
{},
|
|
280
|
+
);
|
|
281
|
+
const msgBox = templateTextInput.parentElement.nextSibling.firstChild;
|
|
278
282
|
//Enter a template text message
|
|
279
283
|
fireEvent.change(msgBox, {
|
|
280
284
|
target: { value: 'viber_template_message' },
|
|
@@ -302,32 +306,24 @@ describe("Creatives testing template creation", () => {
|
|
|
302
306
|
// first click opens the popup, and second click closes it, clicking twice is intentional
|
|
303
307
|
userEvent.click(addLabel);
|
|
304
308
|
userEvent.click(addLabel);
|
|
305
|
-
const imageRadio = creativesScreen.getByRole('radio', {name: /image/i});
|
|
306
|
-
fireEvent.click(imageRadio);
|
|
307
309
|
const imageUploader = creativesScreen.getByRole('button', {
|
|
308
|
-
name: /drag and drop image here or
|
|
310
|
+
name: /drag and drop image here or your computer gallery/i,
|
|
309
311
|
});
|
|
310
312
|
expect(within(imageUploader).getByRole('button', {
|
|
311
|
-
name: /
|
|
313
|
+
name: /your computer/i,
|
|
312
314
|
})).toBeInTheDocument();
|
|
313
315
|
const galleryBtn = within(imageUploader).getByRole('button', {
|
|
314
316
|
name: globalMessages.gallery.defaultMessage,
|
|
315
317
|
});
|
|
316
318
|
|
|
317
319
|
//configuring CTA button
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
});
|
|
321
|
-
fireEvent.click(ctaRadioBtn);
|
|
322
|
-
const btnTextBox = await creativesScreen.findByPlaceholderText(
|
|
323
|
-
'Enter button text',
|
|
324
|
-
);
|
|
320
|
+
const btnText = creativesScreen.getByText(/button text/i);
|
|
321
|
+
const btnTextBox = btnText.nextSibling.firstChild;
|
|
325
322
|
fireEvent.change(btnTextBox, {
|
|
326
323
|
target: { value: 'button' },
|
|
327
324
|
});
|
|
328
|
-
const
|
|
329
|
-
|
|
330
|
-
);
|
|
325
|
+
const btnUrl = creativesScreen.getByText(/button url/i);
|
|
326
|
+
const btnUrlBox = btnUrl.nextSibling.firstChild;
|
|
331
327
|
fireEvent.change(btnUrlBox, {
|
|
332
328
|
target: { value: 'button' },
|
|
333
329
|
});
|
|
@@ -20,8 +20,7 @@ import { injectIntl, FormattedMessage, intlShape} from 'react-intl';
|
|
|
20
20
|
import { isEmpty, get } from 'lodash';
|
|
21
21
|
import './index.scss';
|
|
22
22
|
import Gallery from '../../v2Containers/Assets/Gallery';
|
|
23
|
-
import {
|
|
24
|
-
import { FACEBOOK, INAPP, RCS, WHATSAPP, VIBER } from "../../v2Containers/CreativesContainer/constants";
|
|
23
|
+
import { FACEBOOK, INAPP, RCS, WHATSAPP } from "../../v2Containers/CreativesContainer/constants";
|
|
25
24
|
|
|
26
25
|
import messages from './messages';
|
|
27
26
|
function CapImageUpload(props) {
|
|
@@ -174,17 +173,6 @@ function CapImageUpload(props) {
|
|
|
174
173
|
);
|
|
175
174
|
}, []);
|
|
176
175
|
|
|
177
|
-
const getImageSizeLabel = () => (
|
|
178
|
-
<CapHeadingSpan type="label2">
|
|
179
|
-
<FormattedMessage
|
|
180
|
-
{...messages.imageSize}
|
|
181
|
-
values={{
|
|
182
|
-
size: MAX_SUPPORTED_IMAGE_SIZE[channel],
|
|
183
|
-
}}
|
|
184
|
-
/>
|
|
185
|
-
</CapHeadingSpan>
|
|
186
|
-
);
|
|
187
|
-
|
|
188
176
|
const getImageSection = useCallback(() => {
|
|
189
177
|
if (imageSrc === "") {
|
|
190
178
|
return (<>
|
|
@@ -256,7 +244,9 @@ function CapImageUpload(props) {
|
|
|
256
244
|
<div className="image-info-wrapper">
|
|
257
245
|
{channel === WHATSAPP && (
|
|
258
246
|
<>
|
|
259
|
-
|
|
247
|
+
<CapHeadingSpan type="label2">
|
|
248
|
+
<FormattedMessage {...messages.maxImageSize} />
|
|
249
|
+
</CapHeadingSpan>
|
|
260
250
|
<CapHeadingSpan type="label2">
|
|
261
251
|
<FormattedMessage {...messages.whatsappAspectRatio} />
|
|
262
252
|
</CapHeadingSpan>
|
|
@@ -272,7 +262,18 @@ function CapImageUpload(props) {
|
|
|
272
262
|
<FormattedMessage {...messages.aspectRatio} />
|
|
273
263
|
</CapHeadingSpan>
|
|
274
264
|
)}
|
|
275
|
-
{
|
|
265
|
+
{channel === RCS && (
|
|
266
|
+
<CapHeadingSpan type="label2" className="image-size">
|
|
267
|
+
<FormattedMessage {...messages.imageSize} />
|
|
268
|
+
</CapHeadingSpan>
|
|
269
|
+
)}
|
|
270
|
+
{
|
|
271
|
+
channel === INAPP && (
|
|
272
|
+
<CapHeadingSpan type="label2" className="image-size">
|
|
273
|
+
<FormattedMessage {...messages.maxImageSize} />
|
|
274
|
+
</CapHeadingSpan>
|
|
275
|
+
)
|
|
276
|
+
}
|
|
276
277
|
<CapHeadingSpan type="label2" className="image-format">
|
|
277
278
|
{channel === INAPP ? <FormattedMessage {...messages.format2} /> : <FormattedMessage {...messages.format} />}
|
|
278
279
|
</CapHeadingSpan>
|
|
@@ -2,6 +2,10 @@ import { defineMessages } from 'react-intl';
|
|
|
2
2
|
const scope = `creatives.componentsV2.CapImageUpload`;
|
|
3
3
|
|
|
4
4
|
export default defineMessages({
|
|
5
|
+
maxImageSize: {
|
|
6
|
+
id: `${scope}.maxImageSize`,
|
|
7
|
+
defaultMessage: 'Size upto: 5MB',
|
|
8
|
+
},
|
|
5
9
|
whatsappAspectRatio: {
|
|
6
10
|
id: `${scope}.whatsappAspectRatio`,
|
|
7
11
|
defaultMessage: 'Max aspect ratio: 1.91:1',
|
|
@@ -57,6 +61,6 @@ export default defineMessages({
|
|
|
57
61
|
},
|
|
58
62
|
imageSize: {
|
|
59
63
|
id: `${scope}.imageSize`,
|
|
60
|
-
defaultMessage: 'Size upto:
|
|
64
|
+
defaultMessage: 'Size upto: 2MB',
|
|
61
65
|
},
|
|
62
66
|
});
|
|
@@ -19,9 +19,8 @@ import {
|
|
|
19
19
|
} from '@capillarytech/cap-ui-library';
|
|
20
20
|
import messages from './messages';
|
|
21
21
|
import {bytes2Size, getDecodedFileName} from '../../utils/common';
|
|
22
|
-
import {
|
|
22
|
+
import { WHATSAPP } from './constants';
|
|
23
23
|
import './index.scss';
|
|
24
|
-
import { VIBER } from '../../v2Containers/CreativesContainer/constants';
|
|
25
24
|
|
|
26
25
|
function CapVideoUpload(props) {
|
|
27
26
|
const {
|
|
@@ -231,7 +230,6 @@ function CapVideoUpload(props) {
|
|
|
231
230
|
videoWidth: metaVideoWidth,
|
|
232
231
|
previewUrl,
|
|
233
232
|
fileHandle,
|
|
234
|
-
videoDuration,
|
|
235
233
|
}
|
|
236
234
|
);
|
|
237
235
|
}
|
|
@@ -278,16 +276,6 @@ function CapVideoUpload(props) {
|
|
|
278
276
|
</Fragment>
|
|
279
277
|
);
|
|
280
278
|
};
|
|
281
|
-
|
|
282
|
-
const getVideoSizeDescription = () => (
|
|
283
|
-
<CapHeading.CapHeadingSpan type="label2">
|
|
284
|
-
<FormattedMessage
|
|
285
|
-
{...messages.videoSizeDescription}
|
|
286
|
-
values={{ size: bytes2Size(videoSize) }}
|
|
287
|
-
/>
|
|
288
|
-
</CapHeading.CapHeadingSpan>
|
|
289
|
-
);
|
|
290
|
-
|
|
291
279
|
return (
|
|
292
280
|
<CapSpin spinning={isSpinning}>
|
|
293
281
|
<div style={style} className="cap-custom-video-upload">
|
|
@@ -307,34 +295,26 @@ function CapVideoUpload(props) {
|
|
|
307
295
|
onClose={() => updateTemplateDrawerRequirement(false)}
|
|
308
296
|
/>
|
|
309
297
|
</form>
|
|
310
|
-
{
|
|
298
|
+
{channel !== WHATSAPP ?
|
|
311
299
|
<>
|
|
312
300
|
<CapHeading.CapHeadingSpan type="h6" className="video-description">
|
|
313
301
|
<FormattedMessage {...messages.videoRatioDescription} />
|
|
314
302
|
</CapHeading.CapHeadingSpan>
|
|
315
303
|
{' '}
|
|
316
304
|
<CapHeading.CapHeadingSpan type="h6" className="video-description file-format">
|
|
317
|
-
<FormattedMessage {...messages.fileFormat}
|
|
305
|
+
<FormattedMessage {...messages.fileFormat} />
|
|
306
|
+
|
|
318
307
|
</CapHeading.CapHeadingSpan>
|
|
319
308
|
<CapHeading.CapHeadingSpan type="h6" className="video-description video-details">
|
|
320
309
|
<FormattedMessage {...messages.videoSizeDescription} values={{size: bytes2Size(videoSize)}} />
|
|
321
310
|
</CapHeading.CapHeadingSpan>
|
|
322
|
-
</>
|
|
323
|
-
{channel === WHATSAPP &&
|
|
311
|
+
</> :
|
|
324
312
|
<>
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
<FormattedMessage {...messages.fileFormat} values={{ format: SUPPORTED_FILE_FORMATS[DEFAULT] }} />
|
|
313
|
+
<CapHeading.CapHeadingSpan type="label2" className="">
|
|
314
|
+
<FormattedMessage {...messages.videoSizeDescription} values={{size: bytes2Size(videoSize)}} />
|
|
328
315
|
</CapHeading.CapHeadingSpan>
|
|
329
|
-
</>}
|
|
330
|
-
{channel === VIBER &&
|
|
331
|
-
<>
|
|
332
|
-
{getVideoSizeDescription()}
|
|
333
316
|
<CapHeading.CapHeadingSpan type="label2" className="whatsapp-format">
|
|
334
|
-
<FormattedMessage {...messages.
|
|
335
|
-
</CapHeading.CapHeadingSpan>
|
|
336
|
-
<CapHeading.CapHeadingSpan type="label2" className="video-duration">
|
|
337
|
-
<FormattedMessage {...messages.viberMaxDuration} />
|
|
317
|
+
<FormattedMessage {...messages.whatsappFileFormat} />
|
|
338
318
|
</CapHeading.CapHeadingSpan>
|
|
339
319
|
</>}
|
|
340
320
|
</div>
|
|
@@ -57,10 +57,10 @@ export default defineMessages({
|
|
|
57
57
|
},
|
|
58
58
|
fileFormat: {
|
|
59
59
|
id: `${scope}.fileFormat`,
|
|
60
|
-
defaultMessage: 'Format:
|
|
60
|
+
defaultMessage: 'Format: MP4',
|
|
61
61
|
},
|
|
62
|
-
|
|
63
|
-
id: `${scope}.
|
|
64
|
-
defaultMessage: '
|
|
62
|
+
whatsappFileFormat: {
|
|
63
|
+
id: `${scope}.whatsappFileFormat`,
|
|
64
|
+
defaultMessage: 'Format: MP4',
|
|
65
65
|
},
|
|
66
66
|
});
|
|
@@ -51,7 +51,7 @@ import { SMS, MOBILE_PUSH, LINE, ENABLE_AI_SUGGESTIONS } from '../../v2Container
|
|
|
51
51
|
import { validateIfTagClosed } from '../../utils/tagValidations';
|
|
52
52
|
import globalMessages from '../../v2Containers/Cap/messages';
|
|
53
53
|
import { convert } from 'html-to-text';
|
|
54
|
-
import { AI_SUGGESTION_API_URL, CONTENT_RECOMMENDATION_BOT } from './constants';
|
|
54
|
+
import { AI_SUGGESTION_API_URL, CONTENT_RECOMMENDATION_BOT, OUTBOUND } from './constants';
|
|
55
55
|
import { GET_TRANSLATION_MAPPED } from '../../containers/TagList/constants';
|
|
56
56
|
import moment from 'moment';
|
|
57
57
|
import { CUSTOMER_BARCODE_TAG , COPY_OF} from '../../containers/App/constants';
|
|
@@ -1152,7 +1152,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1152
1152
|
let matchCustomerBarcode = regexCustomerBarcode.exec(content);
|
|
1153
1153
|
// \S matches anything other than a space, a tab, a newline, or a carriage return.
|
|
1154
1154
|
const validString= /\S/.test(contentForValidation);
|
|
1155
|
-
if (isEmailUnsubscribeTagMandatory() && isEmail) {
|
|
1155
|
+
if (isEmailUnsubscribeTagMandatory() && isEmail && this.props?.moduleType === OUTBOUND) {
|
|
1156
1156
|
const missingTagIndex = response?.missingTags?.indexOf("unsubscribe");
|
|
1157
1157
|
if(missingTagIndex != -1) { //skip regex tags for mandatory tags also
|
|
1158
1158
|
response?.missingTags?.splice(missingTagIndex, 1);
|
|
@@ -991,25 +991,4 @@
|
|
|
991
991
|
.media-img-inapp {
|
|
992
992
|
width: 100%;
|
|
993
993
|
height: 100%;
|
|
994
|
-
}
|
|
995
|
-
.empty-placeholder {
|
|
996
|
-
padding-bottom: $CAP_SPACE_16;
|
|
997
|
-
}
|
|
998
|
-
.viber-button-base {
|
|
999
|
-
border-radius: $CAP_SPACE_16;
|
|
1000
|
-
background-color: $CAP_PURPLE01;
|
|
1001
|
-
margin-top: $CAP_SPACE_12;
|
|
1002
|
-
text-align: center;
|
|
1003
|
-
width: 8.75rem;
|
|
1004
|
-
height: $CAP_SPACE_20;
|
|
1005
|
-
margin-left: $CAP_SPACE_08;
|
|
1006
|
-
}
|
|
1007
|
-
.viber-button-card-text {
|
|
1008
|
-
font-size: $CAP_SPACE_12;
|
|
1009
|
-
font-weight: 500;
|
|
1010
|
-
display: -webkit-box;
|
|
1011
|
-
-webkit-line-clamp: 1;
|
|
1012
|
-
-webkit-box-orient: vertical;
|
|
1013
|
-
overflow: hidden;
|
|
1014
|
-
color: $CAP_WHITE;
|
|
1015
994
|
}
|
|
@@ -11,17 +11,7 @@ import _ from 'lodash';
|
|
|
11
11
|
import { injectIntl, FormattedMessage, intlShape } from 'react-intl';
|
|
12
12
|
// import styled from 'styled-components';
|
|
13
13
|
import { CapColumn, CapRow, CapHeading, CapIcon, CapButton, CapImage, CapLabel, CapDivider, CapTooltip } from '@capillarytech/cap-ui-library';
|
|
14
|
-
import {
|
|
15
|
-
CAP_COLOR_03,
|
|
16
|
-
CAP_WHITE,
|
|
17
|
-
FONT_COLOR_01,
|
|
18
|
-
CAP_G06,
|
|
19
|
-
CAP_G15,
|
|
20
|
-
CAP_PURPLE01,
|
|
21
|
-
CAP_G16,
|
|
22
|
-
CAP_SPACE_08,
|
|
23
|
-
} from '@capillarytech/cap-ui-library/styled/variables';
|
|
24
|
-
import isEmpty from 'lodash/isEmpty';
|
|
14
|
+
import { isEmpty } from 'lodash';
|
|
25
15
|
import './_templatePreview.scss';
|
|
26
16
|
import {updateCharCount} from '../../utils/smsCharCountV2';
|
|
27
17
|
import messages from './messages';
|
|
@@ -46,13 +36,6 @@ import inAppMobileIOSFull from './assets/images/inapp_mobile_ios_full.svg';
|
|
|
46
36
|
import videoPlay from '../../assets/videoPlay.svg';
|
|
47
37
|
import zaloMessage from '../../v2Containers/Zalo/messages';
|
|
48
38
|
import { handlePreviewInNewTab } from '../../utils/common';
|
|
49
|
-
import { TEMPLATE, IMAGE_CAROUSEL, IMAGE, STICKER, TEXT, IMAGE_MAP, VIDEO } from '../../v2Containers/Line/Container/constants';
|
|
50
|
-
import CapFacebookPreview from '../../v2Containers/CapFacebookPreview';
|
|
51
|
-
import WhatsappStatusContainer from '../WhatsappStatusContainer';
|
|
52
|
-
import { getWhatsappQuickReply } from '../../v2Containers/Whatsapp/utils';
|
|
53
|
-
import { QUICK_REPLY } from '../../v2Containers/Whatsapp/constants';
|
|
54
|
-
import { ANDROID, INAPP_MESSAGE_LAYOUT_TYPES } from '../../v2Containers/InApp/constants';
|
|
55
|
-
|
|
56
39
|
const wechatBodyNew = require('./assets/images/wechat_mobile_android.svg');
|
|
57
40
|
const smsMobileAndroid = require('./assets/images/sms_mobile_android.svg');
|
|
58
41
|
const smsMobileIos = require('./assets/images/sms_mobile_ios.svg');
|
|
@@ -66,6 +49,23 @@ const lineVideoPlaceholder = require('../../assets/rich-video-placeholder.svg');
|
|
|
66
49
|
const androidPushMessagePhone = require('./assets/images/androidPushMessage.svg');
|
|
67
50
|
const iPhonePushMessagePhone = require('./assets/images/iPhonePushMessage.svg');
|
|
68
51
|
|
|
52
|
+
import {
|
|
53
|
+
CAP_COLOR_03,
|
|
54
|
+
CAP_WHITE,
|
|
55
|
+
FONT_COLOR_01,
|
|
56
|
+
CAP_G06,
|
|
57
|
+
CAP_G15,
|
|
58
|
+
CAP_PURPLE01,
|
|
59
|
+
CAP_G16,
|
|
60
|
+
CAP_SPACE_08,
|
|
61
|
+
} from '@capillarytech/cap-ui-library/styled/variables';
|
|
62
|
+
import { TEMPLATE, IMAGE_CAROUSEL, IMAGE, STICKER, TEXT, IMAGE_MAP, VIDEO } from '../../v2Containers/Line/Container/constants';
|
|
63
|
+
import CapFacebookPreview from '../../v2Containers/CapFacebookPreview';
|
|
64
|
+
import WhatsappStatusContainer from '../WhatsappStatusContainer';
|
|
65
|
+
import { getWhatsappQuickReply } from '../../v2Containers/Whatsapp/utils';
|
|
66
|
+
import { QUICK_REPLY } from '../../v2Containers/Whatsapp/constants';
|
|
67
|
+
import { ANDROID, INAPP_MESSAGE_LAYOUT_TYPES } from '../../v2Containers/InApp/constants';
|
|
68
|
+
|
|
69
69
|
export class TemplatePreview extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
70
70
|
onPreviewContentClicked = (channel) => {
|
|
71
71
|
const IOSContent = (this.props.templateDataRaw && this.props.templateDataRaw.versions.base.IOS) ||
|
|
@@ -184,14 +184,8 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
184
184
|
} = this.props;
|
|
185
185
|
let content = channel && channel.toLowerCase() === 'sms' ? [this.props.content] : this.props.content;
|
|
186
186
|
const { formatMessage } = intl;
|
|
187
|
-
const { rcsPreviewContent, inAppPreviewContent,
|
|
187
|
+
const { buttonText, imageURL, rcsPreviewContent, inAppPreviewContent, messageContent: viberMessageContent } = content || {};
|
|
188
188
|
const { rcsImageSrc, rcsTitle, rcsDesc, buttonText: rcsButtonText } = rcsPreviewContent || {};
|
|
189
|
-
const {
|
|
190
|
-
videoParams,
|
|
191
|
-
imageURL,
|
|
192
|
-
buttonText: viberButtonText,
|
|
193
|
-
messageContent: viberMessageContent,
|
|
194
|
-
} = viberPreviewContent || {};
|
|
195
189
|
const {mediaPreview = {}, templateTitle = "", templateMsg = "", ctaData} = inAppPreviewContent || {};
|
|
196
190
|
let smsDetails = {};
|
|
197
191
|
// let smsText = '';
|
|
@@ -926,40 +920,35 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
926
920
|
}}
|
|
927
921
|
/>
|
|
928
922
|
)}
|
|
929
|
-
{/* Video Viber preview */}
|
|
930
|
-
{videoParams?.viberVideoSrc && (
|
|
931
|
-
<CapTooltip
|
|
932
|
-
title={formatMessage(messages.videoPreviewTooltip)}
|
|
933
|
-
>
|
|
934
|
-
<div className="video-preview">
|
|
935
|
-
<CapImage
|
|
936
|
-
src={videoParams?.viberVideoPreviewImg}
|
|
937
|
-
className="whatsapp-image"
|
|
938
|
-
alt={formatMessage(messages.previewGenerated)}
|
|
939
|
-
rest={{
|
|
940
|
-
style: {
|
|
941
|
-
maxWidth: "100%",
|
|
942
|
-
marginBottom: 5,
|
|
943
|
-
},
|
|
944
|
-
}}
|
|
945
|
-
/>
|
|
946
|
-
<div className="icon-position">
|
|
947
|
-
<CapImage
|
|
948
|
-
className="video-icon"
|
|
949
|
-
src={videoPlay} />
|
|
950
|
-
</div>
|
|
951
|
-
</div>
|
|
952
|
-
</CapTooltip>
|
|
953
|
-
)}
|
|
954
923
|
{/* button viber preview */}
|
|
955
|
-
{
|
|
956
|
-
<
|
|
957
|
-
|
|
958
|
-
|
|
924
|
+
{buttonText && (
|
|
925
|
+
<div
|
|
926
|
+
style={{
|
|
927
|
+
"border-radius": "16px",
|
|
928
|
+
"background-color": CAP_PURPLE01,
|
|
929
|
+
"margin-top": "14px",
|
|
930
|
+
"text-align": "center",
|
|
931
|
+
width: "140px",
|
|
932
|
+
height: "20px",
|
|
933
|
+
"margin-left": "8px",
|
|
934
|
+
}}
|
|
935
|
+
>
|
|
936
|
+
<p
|
|
937
|
+
style={{
|
|
938
|
+
"font-size": "12px",
|
|
939
|
+
"font-weight": "500",
|
|
940
|
+
display: "-webkit-box",
|
|
941
|
+
"-webkit-line-clamp": "1",
|
|
942
|
+
"-webkit-box-orient": "vertical",
|
|
943
|
+
overflow: "hidden",
|
|
944
|
+
color: CAP_WHITE,
|
|
945
|
+
}}
|
|
946
|
+
>
|
|
947
|
+
{buttonText || ""}
|
|
959
948
|
</p>
|
|
960
|
-
</
|
|
949
|
+
</div>
|
|
961
950
|
)}
|
|
962
|
-
<div
|
|
951
|
+
<div style={{ paddingBottom: 32 }}></div>
|
|
963
952
|
</div>
|
|
964
953
|
</div>
|
|
965
954
|
</div>
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import get from 'lodash/get';
|
|
5
|
-
import isEmpty from 'lodash/isEmpty';
|
|
6
5
|
import cloneDeep from 'lodash/cloneDeep';
|
|
7
6
|
import TemplatesV2 from '../TemplatesV2';
|
|
8
7
|
import TemplatePreview from '../../v2Components/TemplatePreview';
|
|
@@ -152,6 +151,7 @@ export function SlideBoxContent(props) {
|
|
|
152
151
|
enableNewChannels,
|
|
153
152
|
hideTestAndPreviewBtn,
|
|
154
153
|
getCmsTemplatesInProgress = false,
|
|
154
|
+
moduleType,
|
|
155
155
|
} = props;
|
|
156
156
|
const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
157
157
|
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
|
|
@@ -309,16 +309,11 @@ export function SlideBoxContent(props) {
|
|
|
309
309
|
}
|
|
310
310
|
case constants.VIBER: {
|
|
311
311
|
const template = cloneDeep(templateDataObject);
|
|
312
|
-
const { text = "",
|
|
313
|
-
const { url: viberImageUrl = "" } = image;
|
|
314
|
-
const { url: viberVideoUrl = "", thumbnailUrl = '' } = video;
|
|
312
|
+
const { text = "", imageURL = "", buttonText = "" } = get(template, 'versions.base.content.viber', {});
|
|
315
313
|
template.content = {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
buttonText: button?.text,
|
|
320
|
-
messageContent: text,
|
|
321
|
-
},
|
|
314
|
+
messageContent: text,
|
|
315
|
+
imageURL,
|
|
316
|
+
buttonText,
|
|
322
317
|
};
|
|
323
318
|
return template.content;
|
|
324
319
|
}
|
|
@@ -597,6 +592,7 @@ export function SlideBoxContent(props) {
|
|
|
597
592
|
onPreviewContentClicked={onPreviewContentClicked}
|
|
598
593
|
onTestContentClicked={onTestContentClicked}
|
|
599
594
|
getCmsTemplatesInProgress={getCmsTemplatesInProgress}
|
|
595
|
+
moduleType={moduleType}
|
|
600
596
|
/>
|
|
601
597
|
)}
|
|
602
598
|
{(isEditEmailWithId || isEmailEditWithContent) && (
|
|
@@ -623,6 +619,7 @@ export function SlideBoxContent(props) {
|
|
|
623
619
|
selectedOfferDetails={selectedOfferDetails}
|
|
624
620
|
onPreviewContentClicked={onPreviewContentClicked}
|
|
625
621
|
onTestContentClicked={onTestContentClicked}
|
|
622
|
+
moduleType={moduleType}
|
|
626
623
|
/>
|
|
627
624
|
)}
|
|
628
625
|
{isEditMPush &&
|
|
@@ -911,5 +908,6 @@ SlideBoxContent.propTypes = {
|
|
|
911
908
|
orgUnitId: PropTypes.any,
|
|
912
909
|
smsRegister: PropTypes.any,
|
|
913
910
|
getCmsTemplatesInProgress: PropTypes.bool,
|
|
911
|
+
moduleType: PropTypes.string,
|
|
914
912
|
};
|
|
915
913
|
export default SlideBoxContent;
|
|
@@ -70,7 +70,6 @@ export function SlideBoxHeader(props) {
|
|
|
70
70
|
whatsapp: <FormattedMessage {...messages.whatsappTemplate} />,
|
|
71
71
|
rcs: <FormattedMessage {...messages.rcsCreative} />,
|
|
72
72
|
zalo: <FormattedMessage {...messages.zaloTemplate} />,
|
|
73
|
-
viber: <FormattedMessage {...messages.viberTemplate} />,
|
|
74
73
|
};
|
|
75
74
|
return labels[currentChannel.toLowerCase()];
|
|
76
75
|
};
|
|
@@ -1260,6 +1260,7 @@ export class Creatives extends React.Component {
|
|
|
1260
1260
|
enableNewChannels={enableNewChannels}
|
|
1261
1261
|
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
1262
1262
|
getCmsTemplatesInProgress={this.props.Templates?.getCmsTemplatesInProgress}
|
|
1263
|
+
moduleType={this.props.messageDetails?.type}
|
|
1263
1264
|
/>
|
|
1264
1265
|
}
|
|
1265
1266
|
footer={this.shouldShowFooter() &&
|
|
@@ -322,10 +322,6 @@ export default defineMessages({
|
|
|
322
322
|
id: `${scope}.zaloTemplate`,
|
|
323
323
|
defaultMessage: `Zalo template`,
|
|
324
324
|
},
|
|
325
|
-
"viberTemplate": {
|
|
326
|
-
id: `${scope}.viberTemplate`,
|
|
327
|
-
defaultMessage: `Viber template`,
|
|
328
|
-
},
|
|
329
325
|
"learnTips": {
|
|
330
326
|
id: `${scope}.learnTips`,
|
|
331
327
|
defaultMessage: `Learn tips to get approved`,
|
|
@@ -3,7 +3,6 @@ import { shallowWithIntl } from '../../../helpers/intl-enzym-test-helpers';
|
|
|
3
3
|
|
|
4
4
|
import { SlideBoxContent } from '../SlideBoxContent';
|
|
5
5
|
import mockdata from '../../mockdata';
|
|
6
|
-
import { templateDetailsImage, templateDetailsVideo, templateDetailsText, templateDetails_ } from '../../Viber/tests/mockData';
|
|
7
6
|
|
|
8
7
|
const {
|
|
9
8
|
whatsappEditTemplateData,
|
|
@@ -87,14 +86,4 @@ describe('Test SlideBoxContent container', () => {
|
|
|
87
86
|
renderFunction('LINE', 'preview', linePreviewTemplateData2);
|
|
88
87
|
expect(renderedComponent).toMatchSnapshot();
|
|
89
88
|
});
|
|
90
|
-
it('Should render correct component for viber channel preview mode', () => {
|
|
91
|
-
renderFunction('VIBER', 'preview', templateDetails_);
|
|
92
|
-
expect(renderedComponent).toMatchSnapshot();
|
|
93
|
-
renderFunction('VIBER', 'preview', templateDetailsImage);
|
|
94
|
-
expect(renderedComponent).toMatchSnapshot();
|
|
95
|
-
renderFunction('VIBER', 'preview', templateDetailsVideo);
|
|
96
|
-
expect(renderedComponent).toMatchSnapshot();
|
|
97
|
-
renderFunction('VIBER', 'preview', templateDetailsText);
|
|
98
|
-
expect(renderedComponent).toMatchSnapshot();
|
|
99
|
-
});
|
|
100
89
|
});
|