@capillarytech/creatives-library 8.0.87-alpha.21 → 8.0.87-alpha.23
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/containers/Templates/constants.js +6 -0
- package/containers/Templates/index.js +44 -24
- package/package.json +1 -1
- package/services/api.js +22 -12
- package/services/tests/api.test.js +5 -1
- package/utils/commonUtils.js +64 -10
- package/utils/tests/commonUtil.test.js +108 -3
- package/utils/tests/transformerUtils.test.js +2127 -0
- package/utils/transformerUtils.js +42 -96
- package/v2Components/CapImageUpload/index.js +13 -10
- package/v2Components/CapVideoUpload/index.js +12 -9
- package/v2Components/CapWhatsappCTA/messages.js +4 -0
- package/v2Components/CapWhatsappCarouselButton/constant.js +56 -0
- package/v2Components/CapWhatsappCarouselButton/index.js +446 -0
- package/v2Components/CapWhatsappCarouselButton/index.scss +39 -0
- package/v2Components/CapWhatsappCarouselButton/tests/index.test.js +237 -0
- package/v2Components/FormBuilder/constants.js +8 -0
- package/v2Components/FormBuilder/index.js +2 -2
- package/v2Components/TemplatePreview/_templatePreview.scss +20 -0
- package/v2Components/TemplatePreview/assets/images/empty_image_preview.svg +4 -0
- package/v2Components/TemplatePreview/assets/images/empty_video_preview.svg +4 -0
- package/v2Components/TemplatePreview/index.js +160 -105
- package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +6 -6
- package/v2Containers/Cap/tests/saga.test.js +90 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +0 -6
- package/v2Containers/CreativesContainer/constants.js +8 -1
- package/v2Containers/CreativesContainer/index.js +102 -9
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +3 -0
- package/v2Containers/Email/index.js +0 -1
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +192 -0
- package/v2Containers/EmailWrapper/constants.js +11 -1
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +343 -0
- package/v2Containers/EmailWrapper/index.js +116 -300
- package/v2Containers/EmailWrapper/mockdata/mockdata.js +119 -0
- package/v2Containers/EmailWrapper/tests/EmailWrapperView.test.js +214 -0
- package/v2Containers/EmailWrapper/tests/index.test.js +101 -0
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +601 -0
- package/v2Containers/MobilePush/Edit/index.js +0 -1
- package/v2Containers/MobilepushWrapper/index.js +1 -2
- package/v2Containers/Sms/Create/index.js +0 -1
- package/v2Containers/SmsWrapper/index.js +0 -2
- package/v2Containers/Templates/_templates.scss +47 -0
- package/v2Containers/Templates/index.js +55 -5
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +177 -156
- package/v2Containers/TemplatesV2/index.js +2 -2
- package/v2Containers/Whatsapp/constants.js +87 -1
- package/v2Containers/Whatsapp/index.js +715 -190
- package/v2Containers/Whatsapp/index.scss +52 -1
- package/v2Containers/Whatsapp/messages.js +38 -2
- package/v2Containers/Whatsapp/styles.scss +5 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +27722 -90751
- package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +6 -0
- package/v2Containers/Whatsapp/tests/mockData.js +3 -7
- package/v2Containers/Whatsapp/tests/utils.test.js +178 -1
- package/v2Containers/Whatsapp/utils.js +52 -0
- package/v2Containers/Zalo/index.js +47 -15
- package/v2Containers/Zalo/index.scss +8 -0
- package/v2Containers/Zalo/messages.js +4 -0
- package/v2Containers/mockdata.js +2 -0
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
CAP_PURPLE01,
|
|
21
21
|
CAP_G16,
|
|
22
22
|
CAP_SPACE_08,
|
|
23
|
+
CAP_SPACE_04,
|
|
23
24
|
} from '@capillarytech/cap-ui-library/styled/variables';
|
|
24
25
|
import isEmpty from 'lodash/isEmpty';
|
|
25
26
|
import './_templatePreview.scss';
|
|
@@ -43,14 +44,16 @@ import inAppMobileIOSModal from './assets/images/inapp_mobile_ios_modal.svg';
|
|
|
43
44
|
import inAppMobileIOSTop from './assets/images/inapp_mobile_ios_top.svg';
|
|
44
45
|
import inAppMobileIOSBottom from './assets/images/inapp_mobile_ios_bottom.svg';
|
|
45
46
|
import inAppMobileIOSFull from './assets/images/inapp_mobile_ios_full.svg';
|
|
47
|
+
import whatsappImageEmptyPreview from './assets/images/empty_image_preview.svg';
|
|
48
|
+
import whatsappVideoEmptyPreview from './assets/images/empty_video_preview.svg';
|
|
46
49
|
import videoPlay from '../../assets/videoPlay.svg';
|
|
47
50
|
import zaloMessage from '../../v2Containers/Zalo/messages';
|
|
48
51
|
import { handlePreviewInNewTab } from '../../utils/common';
|
|
49
52
|
import { TEMPLATE, IMAGE_CAROUSEL, IMAGE, STICKER, TEXT, IMAGE_MAP, VIDEO } from '../../v2Containers/Line/Container/constants';
|
|
50
53
|
import CapFacebookPreview from '../../v2Containers/CapFacebookPreview';
|
|
51
54
|
import WhatsappStatusContainer from '../WhatsappStatusContainer';
|
|
52
|
-
import { getWhatsappQuickReply } from '../../v2Containers/Whatsapp/utils';
|
|
53
|
-
import { QUICK_REPLY, WHATSAPP_CATEGORIES } from '../../v2Containers/Whatsapp/constants';
|
|
55
|
+
import { getWhatsappQuickReply, getWhatsappCarouselButtonView } from '../../v2Containers/Whatsapp/utils';
|
|
56
|
+
import { QUICK_REPLY, WHATSAPP_CATEGORIES, PHONE_NUMBER } from '../../v2Containers/Whatsapp/constants';
|
|
54
57
|
import { ANDROID, INAPP_MESSAGE_LAYOUT_TYPES } from '../../v2Containers/InApp/constants';
|
|
55
58
|
|
|
56
59
|
const wechatBodyNew = require('./assets/images/wechat_mobile_android.svg');
|
|
@@ -213,7 +216,7 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
213
216
|
iosActions = _.map(content.actions, (action) => {
|
|
214
217
|
if (action.label) {
|
|
215
218
|
return (<div className="actions" key={`action-${action.label}`}>
|
|
216
|
-
|
|
219
|
+
<span className="action">{action.label.toUpperCase()}</span>
|
|
217
220
|
</div>);
|
|
218
221
|
}
|
|
219
222
|
return undefined;
|
|
@@ -253,6 +256,15 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
253
256
|
'width': '88%',
|
|
254
257
|
'left': 0,
|
|
255
258
|
};
|
|
259
|
+
const carouselWhatsappSectionStyle = {
|
|
260
|
+
'padding': `${CAP_SPACE_04} 0 ${CAP_SPACE_08}`,
|
|
261
|
+
'border-radius': '0.428rem',
|
|
262
|
+
'background-color': CAP_WHITE,
|
|
263
|
+
'width': '10.4rem',
|
|
264
|
+
'cursor': 'pointer',
|
|
265
|
+
'flex-shrink': 0,
|
|
266
|
+
'left': 0,
|
|
267
|
+
};
|
|
256
268
|
const getVideoContent = ({
|
|
257
269
|
video,
|
|
258
270
|
actionUrl,
|
|
@@ -274,53 +286,53 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
274
286
|
>
|
|
275
287
|
{
|
|
276
288
|
video
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
>
|
|
289
|
-
<CapButton
|
|
290
|
-
className="preview-video-btn"
|
|
291
|
-
type="flat"
|
|
289
|
+
? (
|
|
290
|
+
<>
|
|
291
|
+
<video style={{ opacity: 0.5, width: '100%' }}>
|
|
292
|
+
<source src={video} type="video/mp4" />
|
|
293
|
+
</video>
|
|
294
|
+
<div
|
|
295
|
+
style={{
|
|
296
|
+
position: 'absolute',
|
|
297
|
+
display: 'flex',
|
|
298
|
+
flexDirection: 'column',
|
|
299
|
+
}}
|
|
292
300
|
>
|
|
301
|
+
<CapButton
|
|
302
|
+
className="preview-video-btn"
|
|
303
|
+
type="flat"
|
|
304
|
+
>
|
|
293
305
|
<CapIcon type="play"/>
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
306
|
+
<FormattedMessage {...messages.playVideo} />
|
|
307
|
+
</CapButton>
|
|
308
|
+
{
|
|
309
|
+
actionUrl
|
|
310
|
+
? (
|
|
311
|
+
<CapButton
|
|
312
|
+
className="preview-video-btn"
|
|
313
|
+
type="flat"
|
|
314
|
+
>
|
|
303
315
|
<CapIcon type="reply" style={{ fontSize: 18 }}/>
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
316
|
+
<FormattedMessage {...messages.showDetails} />
|
|
317
|
+
</CapButton>
|
|
318
|
+
)
|
|
319
|
+
: null
|
|
320
|
+
}
|
|
321
|
+
</div>
|
|
322
|
+
</>
|
|
323
|
+
)
|
|
324
|
+
: (
|
|
325
|
+
<CapImage
|
|
326
|
+
src={lineVideoPlaceholder}
|
|
327
|
+
alt="brand-name"
|
|
328
|
+
rest={{
|
|
329
|
+
style: {
|
|
330
|
+
width: 126,
|
|
331
|
+
marginBottom: 5,
|
|
332
|
+
},
|
|
333
|
+
}}
|
|
334
|
+
/>
|
|
335
|
+
)
|
|
324
336
|
}
|
|
325
337
|
</div>
|
|
326
338
|
);
|
|
@@ -336,10 +348,10 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
336
348
|
renderArray.push(
|
|
337
349
|
<CapLabel type="label21" className="whatsapp-cta-preview">
|
|
338
350
|
{type !== WHATSAPP_CATEGORIES.authentication && <CapIcon
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
351
|
+
type={
|
|
352
|
+
(ctaType || type) === PHONE_NUMBER ? 'call' : 'launch'
|
|
353
|
+
}
|
|
354
|
+
size="xs"
|
|
343
355
|
/>}
|
|
344
356
|
{text}
|
|
345
357
|
</CapLabel>,
|
|
@@ -430,42 +442,42 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
430
442
|
{this.props.showCount &&
|
|
431
443
|
channel &&
|
|
432
444
|
channel.toLowerCase() !== FACEBOOK && (
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
445
|
+
<CapColumn span={16}>
|
|
446
|
+
{channel && channel.toLowerCase() === "sms" && (
|
|
447
|
+
<CapHeading type="h3">
|
|
448
|
+
<FormattedMessage
|
|
449
|
+
{...messages.charactersTotal}
|
|
450
|
+
values={{
|
|
451
|
+
smsCount: smsDetails.parts,
|
|
452
|
+
charCount: smsDetails.chars_used,
|
|
453
|
+
}}
|
|
454
|
+
/>
|
|
455
|
+
{smsDetails.unicode && (
|
|
456
|
+
<FormattedMessage {...messages.smsFormatType} />
|
|
457
|
+
)}
|
|
458
|
+
</CapHeading>
|
|
459
|
+
)}
|
|
460
|
+
{smsDetails.optoutUrlPresent && (
|
|
461
|
+
<CapHeading type="h6">
|
|
462
|
+
<FormattedMessage
|
|
463
|
+
{...messages.optoutCharactersTotal}
|
|
464
|
+
values={{ optoutUrlLength: smsDetails.optouturlLength }}
|
|
465
|
+
/>
|
|
466
|
+
</CapHeading>
|
|
467
|
+
)}
|
|
468
|
+
{channel?.toLowerCase() === WHATSAPP.toLowerCase() ? (
|
|
469
|
+
<>
|
|
470
|
+
<WhatsappStatusContainer template={templateData} />
|
|
471
|
+
<CapHeading type="h3" className="margin-t-12">
|
|
450
472
|
<FormattedMessage
|
|
451
|
-
{...messages.
|
|
452
|
-
values={{
|
|
473
|
+
{...messages.whatsappMessageLength}
|
|
474
|
+
values={{ length: whatsappUpdatedLen }}
|
|
453
475
|
/>
|
|
454
476
|
</CapHeading>
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
<CapHeading type="h3" className="margin-t-12">
|
|
460
|
-
<FormattedMessage
|
|
461
|
-
{...messages.whatsappMessageLength}
|
|
462
|
-
values={{ length: whatsappUpdatedLen }}
|
|
463
|
-
/>
|
|
464
|
-
</CapHeading>
|
|
465
|
-
</>
|
|
466
|
-
) : null}
|
|
467
|
-
</CapColumn>
|
|
468
|
-
)}
|
|
477
|
+
</>
|
|
478
|
+
) : null}
|
|
479
|
+
</CapColumn>
|
|
480
|
+
)}
|
|
469
481
|
<CapColumn span={this.props.showCount ? 8 : 24}>
|
|
470
482
|
{showTestAndPreview && (
|
|
471
483
|
<div className="test-and-preview-container">
|
|
@@ -628,9 +640,9 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
628
640
|
)}
|
|
629
641
|
{content.actions.filter((action) => action.label)
|
|
630
642
|
.length ? (
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
643
|
+
<div className="actions">
|
|
644
|
+
{_.map(
|
|
645
|
+
content.actions,
|
|
634
646
|
(action) =>
|
|
635
647
|
!!action.label && (
|
|
636
648
|
<span
|
|
@@ -640,11 +652,11 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
640
652
|
{action.label && action.label.toUpperCase()}
|
|
641
653
|
</span>
|
|
642
654
|
)
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
655
|
+
)}
|
|
656
|
+
</div>
|
|
657
|
+
) : (
|
|
658
|
+
""
|
|
659
|
+
)}
|
|
648
660
|
</div>
|
|
649
661
|
) : (
|
|
650
662
|
<div className="message-pop align-left">
|
|
@@ -980,14 +992,14 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
980
992
|
<CapLabel className="whatsapp-brand-name">
|
|
981
993
|
{whatsappUpdatedAccountName || ""}
|
|
982
994
|
</CapLabel>
|
|
983
|
-
<div className=
|
|
995
|
+
<div className={`msg-container whatsapp-message-container ${content?.carouselData && 'msg-container-carousel'}`}>
|
|
984
996
|
<div
|
|
985
|
-
className=
|
|
997
|
+
className={`message-pop align-left ${content?.carouselData && 'message-pop-carousel'}`}
|
|
986
998
|
style={whatsappSectionStyle}
|
|
987
999
|
>
|
|
988
1000
|
<div className="whatsapp-content">
|
|
989
|
-
{content?.showUrlPreview
|
|
990
|
-
renderUrlPreview(content?.metaTagsDetails)}
|
|
1001
|
+
{content?.showUrlPreview
|
|
1002
|
+
&& renderUrlPreview(content?.metaTagsDetails)}
|
|
991
1003
|
{content?.whatsappImageSrc && (
|
|
992
1004
|
<CapImage
|
|
993
1005
|
src={content.whatsappImageSrc}
|
|
@@ -1026,6 +1038,49 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
1026
1038
|
{renderQuickReplyPreview()}
|
|
1027
1039
|
</div>
|
|
1028
1040
|
</div>
|
|
1041
|
+
{content?.carouselData && (
|
|
1042
|
+
<div className="scroll-container">
|
|
1043
|
+
{content?.carouselData?.map((data, index) => (
|
|
1044
|
+
<div
|
|
1045
|
+
key={`carousel-${index}-${data?.bodyText}`}
|
|
1046
|
+
className="message-pop align-left message-pop-carousel"
|
|
1047
|
+
style={carouselWhatsappSectionStyle}>
|
|
1048
|
+
<div className="whatsapp-content">
|
|
1049
|
+
{content?.carouselMediaType === "image" && (
|
|
1050
|
+
<CapImage
|
|
1051
|
+
src={data?.imageSrc ? data?.imageSrc : whatsappImageEmptyPreview}
|
|
1052
|
+
className="whatsapp-image"
|
|
1053
|
+
alt={formatMessage(messages.previewGenerated)}
|
|
1054
|
+
/>
|
|
1055
|
+
)}
|
|
1056
|
+
{content?.carouselMediaType === "video" && (
|
|
1057
|
+
<CapTooltip
|
|
1058
|
+
title={formatMessage(messages.videoPreviewTooltip)}
|
|
1059
|
+
>
|
|
1060
|
+
<div className="video-preview">
|
|
1061
|
+
<CapImage
|
|
1062
|
+
src={data?.videoPreviewImg ? data?.videoPreviewImg : whatsappVideoEmptyPreview}
|
|
1063
|
+
className="whatsapp-image"
|
|
1064
|
+
alt={formatMessage(messages.previewGenerated)}
|
|
1065
|
+
/>
|
|
1066
|
+
<div className="icon-position">
|
|
1067
|
+
<CapImage
|
|
1068
|
+
className="video-icon"
|
|
1069
|
+
src={videoPlay}
|
|
1070
|
+
/>
|
|
1071
|
+
</div>
|
|
1072
|
+
</div>
|
|
1073
|
+
</CapTooltip>
|
|
1074
|
+
)}
|
|
1075
|
+
<CapLabel type="label5">
|
|
1076
|
+
{content?.isEditFlow ? data?.updatedBodyText?.join("") : data?.bodyText}
|
|
1077
|
+
</CapLabel>
|
|
1078
|
+
{getWhatsappCarouselButtonView(data?.buttons, true)}
|
|
1079
|
+
</div>
|
|
1080
|
+
</div>
|
|
1081
|
+
))}
|
|
1082
|
+
</div>
|
|
1083
|
+
)}
|
|
1029
1084
|
</div>
|
|
1030
1085
|
</div>
|
|
1031
1086
|
<CapHeading
|
|
@@ -1205,21 +1260,21 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
1205
1260
|
{ctaData &&
|
|
1206
1261
|
!isEmpty(ctaData) &&
|
|
1207
1262
|
ctaData[0]?.text !== "" && (
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1263
|
+
<CapButton
|
|
1264
|
+
type="primary"
|
|
1265
|
+
className={`inapp-button-${templateLayoutType}-${device} ${
|
|
1211
1266
|
mediaPreview?.inAppImageSrcAndroid
|
|
1212
1267
|
? ""
|
|
1213
1268
|
: `without-image-button-${templateLayoutType}-android`
|
|
1214
|
-
|
|
1269
|
+
} ${
|
|
1215
1270
|
mediaPreview?.inAppImageSrcIos
|
|
1216
1271
|
? ""
|
|
1217
1272
|
: `without-image-button-${templateLayoutType}-ios`
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1273
|
+
}`}
|
|
1274
|
+
>
|
|
1275
|
+
{ctaData[0]?.text}
|
|
1276
|
+
</CapButton>
|
|
1277
|
+
)}
|
|
1223
1278
|
</div>
|
|
1224
1279
|
</div>
|
|
1225
1280
|
</div>
|
|
@@ -66,10 +66,10 @@ exports[`Test Templates container Should render correct preview component for wh
|
|
|
66
66
|
test
|
|
67
67
|
</CapLabel>
|
|
68
68
|
<div
|
|
69
|
-
className="msg-container whatsapp-message-container"
|
|
69
|
+
className="msg-container whatsapp-message-container undefined"
|
|
70
70
|
>
|
|
71
71
|
<div
|
|
72
|
-
className="message-pop align-left"
|
|
72
|
+
className="message-pop align-left undefined"
|
|
73
73
|
style={
|
|
74
74
|
Object {
|
|
75
75
|
"background-color": "#ffffff",
|
|
@@ -163,10 +163,10 @@ exports[`Test Templates container Should render correct preview component for wh
|
|
|
163
163
|
test
|
|
164
164
|
</CapLabel>
|
|
165
165
|
<div
|
|
166
|
-
className="msg-container whatsapp-message-container"
|
|
166
|
+
className="msg-container whatsapp-message-container undefined"
|
|
167
167
|
>
|
|
168
168
|
<div
|
|
169
|
-
className="message-pop align-left"
|
|
169
|
+
className="message-pop align-left undefined"
|
|
170
170
|
style={
|
|
171
171
|
Object {
|
|
172
172
|
"background-color": "#ffffff",
|
|
@@ -235,10 +235,10 @@ exports[`Test Templates container Should render correct preview component for wh
|
|
|
235
235
|
test
|
|
236
236
|
</CapLabel>
|
|
237
237
|
<div
|
|
238
|
-
className="msg-container whatsapp-message-container"
|
|
238
|
+
className="msg-container whatsapp-message-container undefined"
|
|
239
239
|
>
|
|
240
240
|
<div
|
|
241
|
-
className="message-pop align-left"
|
|
241
|
+
className="message-pop align-left undefined"
|
|
242
242
|
style={
|
|
243
243
|
Object {
|
|
244
244
|
"background-color": "#ffffff",
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import { take, fork, cancel, takeLatest } from 'redux-saga/effects';
|
|
2
2
|
import { expectSaga } from 'redux-saga-test-plan';
|
|
3
3
|
import * as matchers from 'redux-saga-test-plan/matchers';
|
|
4
|
-
import { authorize, loginFlow, fetchSchemaForEntity,v2CapSagas, getSupportVideosConfig, watchForGetVideosConfig, watchFetchSchemaForEntity,watchLiquidEntity, getLiquidTags, logoutFlow, capSagaLiquidEntity } from '../sagas';
|
|
5
4
|
import { throwError } from 'redux-saga-test-plan/providers';
|
|
5
|
+
import {
|
|
6
|
+
authorize,
|
|
7
|
+
loginFlow,
|
|
8
|
+
fetchSchemaForEntity,
|
|
9
|
+
v2CapSagas,
|
|
10
|
+
getSupportVideosConfig,
|
|
11
|
+
watchForGetVideosConfig,
|
|
12
|
+
watchFetchSchemaForEntity,
|
|
13
|
+
watchLiquidEntity,
|
|
14
|
+
getLiquidTags,
|
|
15
|
+
logoutFlow,
|
|
16
|
+
capSagaLiquidEntity,
|
|
17
|
+
createCentralCommsMetaId,
|
|
18
|
+
watchMetaId,
|
|
19
|
+
} from '../sagas';
|
|
6
20
|
import * as api from '../../../services/api';
|
|
7
21
|
import {
|
|
8
22
|
LOGIN_REQUEST,
|
|
@@ -17,6 +31,9 @@ import {
|
|
|
17
31
|
GET_LIQUID_TAGS_SUCCESS,
|
|
18
32
|
GET_LIQUID_TAGS_FAILURE,
|
|
19
33
|
GET_LIQUID_TAGS_REQUEST,
|
|
34
|
+
CREATE_CENTRAL_COMMS_META_ID_SUCCESS,
|
|
35
|
+
CREATE_CENTRAL_COMMS_META_ID_FAILURE,
|
|
36
|
+
CREATE_CENTRAL_COMMS_META_ID_REQUEST,
|
|
20
37
|
} from '../constants';
|
|
21
38
|
import { callback, error, error2, videoConfigData } from '../../mockdata';
|
|
22
39
|
import { LOGOUT_FAILURE, LOGOUT_REQUEST, LOGOUT_SUCCESS } from '../../../containers/Cap/constants';
|
|
@@ -365,4 +382,76 @@ describe('watchForGetLiquidTags saga', () => {
|
|
|
365
382
|
takeLatest(GET_LIQUID_TAGS_REQUEST, getLiquidTags),
|
|
366
383
|
);
|
|
367
384
|
});
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
describe('createCentralCommsMetaId saga', () => {
|
|
388
|
+
const mockCallback = jest.fn();
|
|
389
|
+
|
|
390
|
+
it('handles successful API response', () => {
|
|
391
|
+
const action = {
|
|
392
|
+
data: { templateId: '123456' },
|
|
393
|
+
callback: mockCallback
|
|
394
|
+
};
|
|
395
|
+
const result = {
|
|
396
|
+
status: { code: 200 },
|
|
397
|
+
data: { id: '123456' }
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
expectSaga(createCentralCommsMetaId, action)
|
|
401
|
+
.provide([
|
|
402
|
+
[matchers.call.fn(api.createCentralCommsMetaId, action.data), result],
|
|
403
|
+
])
|
|
404
|
+
.call(action.callback, result)
|
|
405
|
+
.put({
|
|
406
|
+
type: CREATE_CENTRAL_COMMS_META_ID_SUCCESS,
|
|
407
|
+
result,
|
|
408
|
+
})
|
|
409
|
+
.run();
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
it('handles unsuccessful API response', () => {
|
|
413
|
+
const action = {
|
|
414
|
+
data: { templateId: '123456' }
|
|
415
|
+
};
|
|
416
|
+
const result = {
|
|
417
|
+
status: { code: 400 },
|
|
418
|
+
message: 'Failed to create meta ID'
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
expectSaga(createCentralCommsMetaId, action)
|
|
422
|
+
.provide([
|
|
423
|
+
[matchers.call.fn(api.createCentralCommsMetaId, action.data), result],
|
|
424
|
+
])
|
|
425
|
+
.put({
|
|
426
|
+
type: CREATE_CENTRAL_COMMS_META_ID_FAILURE,
|
|
427
|
+
error: result.message,
|
|
428
|
+
})
|
|
429
|
+
.run();
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
it('handles error thrown during API call', () => {
|
|
433
|
+
const action = {
|
|
434
|
+
data: { templateId: '123456' }
|
|
435
|
+
};
|
|
436
|
+
const error = new Error('API error');
|
|
437
|
+
|
|
438
|
+
expectSaga(createCentralCommsMetaId, action)
|
|
439
|
+
.provide([
|
|
440
|
+
[matchers.call.fn(api.createCentralCommsMetaId, action.data), throwError(error)],
|
|
441
|
+
])
|
|
442
|
+
.put({
|
|
443
|
+
type: CREATE_CENTRAL_COMMS_META_ID_FAILURE,
|
|
444
|
+
error,
|
|
445
|
+
})
|
|
446
|
+
.run();
|
|
447
|
+
});
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
describe('watchMetaId saga', () => {
|
|
451
|
+
it('should watch for CREATE_CENTRAL_COMMS_META_ID_REQUEST actions', () => {
|
|
452
|
+
const generator = watchMetaId();
|
|
453
|
+
expect(generator.next().value).toEqual(
|
|
454
|
+
takeLatest(CREATE_CENTRAL_COMMS_META_ID_REQUEST, createCentralCommsMetaId),
|
|
455
|
+
);
|
|
456
|
+
});
|
|
368
457
|
});
|
|
@@ -517,7 +517,6 @@ export function SlideBoxContent(props) {
|
|
|
517
517
|
onCreateComplete={onCreateComplete}
|
|
518
518
|
smsRegister={smsRegister}
|
|
519
519
|
eventContextTags={eventContextTags}
|
|
520
|
-
messageDetails={messageDetails}
|
|
521
520
|
/>
|
|
522
521
|
)}
|
|
523
522
|
{isEditFTP && (
|
|
@@ -586,7 +585,6 @@ export function SlideBoxContent(props) {
|
|
|
586
585
|
smsRegister={smsRegister}
|
|
587
586
|
onShowTemplates={onShowTemplates}
|
|
588
587
|
eventContextTags={eventContextTags}
|
|
589
|
-
messageDetails={messageDetails}
|
|
590
588
|
/>
|
|
591
589
|
)}
|
|
592
590
|
|
|
@@ -620,7 +618,6 @@ export function SlideBoxContent(props) {
|
|
|
620
618
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
621
619
|
eventContextTags={eventContextTags}
|
|
622
620
|
isLoyaltyModule={isLoyaltyModule}
|
|
623
|
-
messageDetails={messageDetails}
|
|
624
621
|
/>
|
|
625
622
|
)}
|
|
626
623
|
{(isEditEmailWithId || isEmailEditWithContent) && (
|
|
@@ -651,7 +648,6 @@ export function SlideBoxContent(props) {
|
|
|
651
648
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
652
649
|
eventContextTags={eventContextTags}
|
|
653
650
|
isLoyaltyModule={isLoyaltyModule}
|
|
654
|
-
messageDetails={messageDetails}
|
|
655
651
|
/>
|
|
656
652
|
)}
|
|
657
653
|
{isEditMPush &&
|
|
@@ -678,7 +674,6 @@ export function SlideBoxContent(props) {
|
|
|
678
674
|
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
679
675
|
creativesMode={creativesMode}
|
|
680
676
|
eventContextTags={eventContextTags}
|
|
681
|
-
messageDetails={messageDetails}
|
|
682
677
|
/>
|
|
683
678
|
}
|
|
684
679
|
{isCreateMPush &&
|
|
@@ -708,7 +703,6 @@ export function SlideBoxContent(props) {
|
|
|
708
703
|
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
709
704
|
onTestContentClicked={onTestContentClicked}
|
|
710
705
|
eventContextTags={eventContextTags}
|
|
711
|
-
messageDetails={messageDetails}
|
|
712
706
|
/>
|
|
713
707
|
}
|
|
714
708
|
{
|
|
@@ -33,4 +33,11 @@ export const HIDE_CONTAINER_LOADER = "app/CreativesContainer/HIDE_CONTAINER_LOAD
|
|
|
33
33
|
export const WHATSAPP_HELP_DOC_LINK = "https://docs.capillarytech.com/docs/create-whatsapp-template";
|
|
34
34
|
|
|
35
35
|
export const ENABLE_AI_SUGGESTIONS = "ENABLE_AI_SUGGESTIONS";
|
|
36
|
-
export const LIQUID_SUPPORTED_CHANNELS = [EMAIL];
|
|
36
|
+
export const LIQUID_SUPPORTED_CHANNELS = [EMAIL];
|
|
37
|
+
|
|
38
|
+
export const EMF = "EMF";
|
|
39
|
+
export const VENENO = "VENENO";
|
|
40
|
+
export const TEXT = "TEXT";
|
|
41
|
+
export const IOS = "IOS";
|
|
42
|
+
export const ANDROID = "ANDROID";
|
|
43
|
+
export const EXTERNAL_URL = "EXTERNAL_URL";
|