@capillarytech/creatives-library 7.12.15 → 7.12.16
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/index.js +6 -0
- package/package.json +1 -1
- package/routes.js +7 -2
- package/services/api.js +8 -2
- package/v2Components/CapImageUpload/index.js +24 -11
- package/v2Components/CapImageUpload/index.scss +12 -27
- package/v2Components/CapImageUpload/messages.js +10 -5
- package/v2Components/TemplatePreview/_templatePreview.scss +10 -0
- package/v2Components/TemplatePreview/assets/images/sms_mobile_ios.svg +18 -0
- package/v2Components/TemplatePreview/index.js +41 -1
- package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +33 -1
- package/v2Components/TemplatePreview/tests/index.test.js +7 -7
- package/v2Containers/App/constants.js +2 -1
- package/v2Containers/Assets/images/addCreativesIllustration.svg +30 -0
- package/v2Containers/Assets/images/rcsIllustration.png +0 -0
- package/v2Containers/Cap/messages.js +20 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +58 -11
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +41 -32
- package/v2Containers/CreativesContainer/constants.js +1 -0
- package/v2Containers/CreativesContainer/index.js +53 -1
- package/v2Containers/CreativesContainer/messages.js +4 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +24 -4
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +23 -4
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +147 -2
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +98 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +71 -0
- package/v2Containers/CreativesContainer/tests/index.test.js +21 -9
- package/v2Containers/Facebook/Advertisement/index.js +4 -2
- package/v2Containers/MobilePush/Edit/index.js +21 -34
- package/v2Containers/Rcs/actions.js +57 -0
- package/v2Containers/Rcs/constants.js +51 -0
- package/v2Containers/Rcs/index.js +1075 -0
- package/v2Containers/Rcs/index.scss +72 -0
- package/v2Containers/Rcs/messages.js +122 -0
- package/v2Containers/Rcs/reducer.js +107 -0
- package/v2Containers/Rcs/sagas.js +141 -0
- package/v2Containers/Rcs/selectors.js +8 -0
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +144496 -0
- package/v2Containers/Rcs/tests/index.test.js +226 -0
- package/v2Containers/Rcs/tests/mockData.js +166 -0
- package/v2Containers/Rcs/utils.js +40 -0
- package/v2Containers/SmsTrai/Edit/index.js +2 -0
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -4
- package/v2Containers/Templates/_templates.scss +9 -1
- package/v2Containers/Templates/actions.js +2 -1
- package/v2Containers/Templates/constants.js +1 -0
- package/v2Containers/Templates/index.js +234 -174
- package/v2Containers/Templates/messages.js +20 -0
- package/v2Containers/Templates/reducer.js +2 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +520 -80
- package/v2Containers/TemplatesV2/index.js +13 -4
- package/v2Containers/TemplatesV2/messages.js +4 -0
- package/v2Containers/Whatsapp/index.js +4 -2
- package/v2Containers/Whatsapp/messages.js +0 -13
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +13 -13
- package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +32 -26
- package/v2Containers/mockdata.js +1 -1
|
@@ -22,6 +22,7 @@ import LineContainer from '../Line/Container';
|
|
|
22
22
|
import FTP from '../FTP';
|
|
23
23
|
import Viber from '../Viber';
|
|
24
24
|
import Whatsapp from '../Whatsapp';
|
|
25
|
+
import Rcs from '../Rcs';
|
|
25
26
|
import { getWhatsappContent } from '../Whatsapp/utils';
|
|
26
27
|
import * as commonUtil from '../../utils/common';
|
|
27
28
|
const CreativesWrapper = styled.div`
|
|
@@ -174,9 +175,11 @@ export function SlideBoxContent(props) {
|
|
|
174
175
|
|
|
175
176
|
|
|
176
177
|
const isCreate = slidBoxContent === 'createTemplate';
|
|
178
|
+
const isEdit = slidBoxContent === 'editTemplate';
|
|
177
179
|
const isCreateSms = isCreate && channel === constants.SMS;
|
|
178
180
|
const isCreateFacebook = isCreate && channel === constants.FACEBOOK;
|
|
179
181
|
const isCreateWhatsapp = isCreate && channel === constants.WHATSAPP;
|
|
182
|
+
const isCreateRcs = isCreate && channel === constants.RCS;
|
|
180
183
|
const isCreateMPush = isCreate && channel === constants.MOBILE_PUSH;
|
|
181
184
|
const isCreateCallTask = isCreate && channel === constants.CALL_TASK;
|
|
182
185
|
let isEditSms = false;
|
|
@@ -190,32 +193,34 @@ export function SlideBoxContent(props) {
|
|
|
190
193
|
let isEditFacebook = false;
|
|
191
194
|
let isEditFTP = false;
|
|
192
195
|
let isEditWhatsapp = false;
|
|
196
|
+
let isEditRcs = false;
|
|
193
197
|
const isEmailCreate = isCreate && channel === constants.EMAIL;
|
|
194
198
|
if (templateData && channel) {
|
|
195
199
|
channel = templateData.type;// for edit mode with template data
|
|
196
|
-
isEditSms =
|
|
197
|
-
isEditCallTask =
|
|
198
|
-
isEditMPush =
|
|
199
|
-
isEditEmailWithId =
|
|
200
|
-
isEmailEditWithContent =
|
|
201
|
-
isEditFacebook =
|
|
202
|
-
isEditWhatsapp =
|
|
203
|
-
|
|
200
|
+
isEditSms = isEdit && channel === constants.SMS;
|
|
201
|
+
isEditCallTask = isEdit && channel === constants.CALL_TASK;
|
|
202
|
+
isEditMPush = isEdit && channel === constants.MOBILE_PUSH;
|
|
203
|
+
isEditEmailWithId = isEdit && channel === constants.EMAIL && templateData._id;
|
|
204
|
+
isEmailEditWithContent = isEdit && channel === constants.EMAIL && !templateData._id;
|
|
205
|
+
isEditFacebook = isEdit && channel === constants.FACEBOOK;
|
|
206
|
+
isEditWhatsapp = isEdit && channel === constants.WHATSAPP;
|
|
207
|
+
isEditRcs = isEdit && channel === constants.RCS;
|
|
208
|
+
isPreview = slidBoxContent === 'preview' && [constants.SMS, constants.LINE, constants.WHATSAPP, constants.FACEBOOK, constants.VIBER, constants.RCS].includes(channel);
|
|
204
209
|
isEmailPreview = slidBoxContent === 'preview' && channel === constants.EMAIL;
|
|
205
210
|
isMpushPreview = slidBoxContent === 'preview' && channel === constants.MOBILE_PUSH;
|
|
206
|
-
isEditFTP =
|
|
211
|
+
isEditFTP = isEdit && [constants.NO_COMMUNICATION, constants.FTP].includes(channel);
|
|
207
212
|
}
|
|
213
|
+
const isDltEnabled = commonUtil.isTraiDLTEnable(isFullMode, smsRegister);
|
|
208
214
|
|
|
209
215
|
const getChannelPreviewContent = (templateDataObject) => {
|
|
210
216
|
switch (templateDataObject.type.toUpperCase()) {
|
|
211
217
|
case constants.SMS: {
|
|
212
|
-
const isTraiDlt = commonUtil.isTraiDLTEnable(isFullMode, smsRegister);
|
|
213
218
|
const updatedSmsEditor = get(
|
|
214
219
|
templateDataObject,
|
|
215
220
|
`versions.base['updated-sms-editor']`,
|
|
216
221
|
'',
|
|
217
222
|
);
|
|
218
|
-
if (!
|
|
223
|
+
if (!isDltEnabled || updatedSmsEditor === '') {
|
|
219
224
|
return get(templateDataObject, `versions.base['sms-editor']`);
|
|
220
225
|
}
|
|
221
226
|
return updatedSmsEditor.join('');
|
|
@@ -332,11 +337,32 @@ export function SlideBoxContent(props) {
|
|
|
332
337
|
...getWhatsappContent(templateDataObject, true),
|
|
333
338
|
};
|
|
334
339
|
}
|
|
340
|
+
case constants.RCS: {
|
|
341
|
+
const template = cloneDeep(templateDataObject);
|
|
342
|
+
const { description = "", media: { mediaUrl = "" } = {}, title = "" } = get(template, 'versions.base.content.RCS.cardContent[0]', {});
|
|
343
|
+
return {
|
|
344
|
+
rcsPreviewContent: {
|
|
345
|
+
rcsImageSrc: mediaUrl,
|
|
346
|
+
rcsTitle: title,
|
|
347
|
+
rcsDesc: description,
|
|
348
|
+
},
|
|
349
|
+
};
|
|
350
|
+
}
|
|
335
351
|
default:
|
|
336
352
|
return get(templateDataObject, `versions.base.content`);
|
|
337
353
|
}
|
|
338
354
|
};
|
|
339
355
|
|
|
356
|
+
const rcsCommonProps = {
|
|
357
|
+
isFullMode,
|
|
358
|
+
isDltEnabled,
|
|
359
|
+
smsRegister,
|
|
360
|
+
getDefaultTags: type,
|
|
361
|
+
onCreateComplete,
|
|
362
|
+
selectedOfferDetails,
|
|
363
|
+
getFormData,
|
|
364
|
+
};
|
|
365
|
+
|
|
340
366
|
return (
|
|
341
367
|
<CreativesWrapper>
|
|
342
368
|
{!isFullMode && slidBoxContent === 'templates' && (
|
|
@@ -715,6 +741,27 @@ export function SlideBoxContent(props) {
|
|
|
715
741
|
}}/>
|
|
716
742
|
)}
|
|
717
743
|
|
|
744
|
+
{isCreateRcs && (<Rcs
|
|
745
|
+
{...rcsCommonProps}
|
|
746
|
+
location={{
|
|
747
|
+
pathname: `/rcs/create`,
|
|
748
|
+
query,
|
|
749
|
+
search: '',
|
|
750
|
+
}} />
|
|
751
|
+
)}
|
|
752
|
+
{isEditRcs && (<Rcs
|
|
753
|
+
{...rcsCommonProps}
|
|
754
|
+
templateData={templateData}
|
|
755
|
+
params={{
|
|
756
|
+
id: templateData._id,
|
|
757
|
+
}}
|
|
758
|
+
location={{
|
|
759
|
+
pathname: `/rcs/edit`,
|
|
760
|
+
query,
|
|
761
|
+
search: '',
|
|
762
|
+
}} />
|
|
763
|
+
)}
|
|
764
|
+
|
|
718
765
|
</CreativesWrapper>
|
|
719
766
|
);
|
|
720
767
|
}
|
|
@@ -7,10 +7,10 @@ import moment from 'moment';
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import messages from './messages';
|
|
9
9
|
import whatsppMsg from '../Whatsapp/messages';
|
|
10
|
-
import { LANGUAGE_OPTIONS } from '../Whatsapp/constants'
|
|
11
|
-
import globalMessages from '../Cap/messages'
|
|
10
|
+
import { LANGUAGE_OPTIONS } from '../Whatsapp/constants';
|
|
11
|
+
import globalMessages from '../Cap/messages';
|
|
12
12
|
import { MAP_TEMPLATE } from '../WeChat/Wrapper/constants';
|
|
13
|
-
import { NO_COMMUNICATION, FTP, WHATSAPP } from '../App/constants';
|
|
13
|
+
import { NO_COMMUNICATION, FTP, WHATSAPP, RCS } from '../App/constants';
|
|
14
14
|
import { isTraiDLTEnable } from '../../utils/common';
|
|
15
15
|
import { formatString } from '../../utils/Formatter';
|
|
16
16
|
import {
|
|
@@ -37,6 +37,7 @@ export function SlideBoxHeader(props) {
|
|
|
37
37
|
const mapTemplateCreate = !showTemplateNameHeader && slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
38
38
|
const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
|
|
39
39
|
const showCreateTraiSMSHeader = isTraiDlt && channel.toLowerCase() === "sms";
|
|
40
|
+
const showTemplateName = [WHATSAPP, RCS].includes(channel.toLowerCase()) & slidBoxContent === 'editTemplate' & !isFullMode;
|
|
40
41
|
const isWhatsappEdit = channel.toLowerCase() === WHATSAPP && slidBoxContent === 'editTemplate';
|
|
41
42
|
const isWhatsappCreate = channel.toLowerCase() === WHATSAPP && slidBoxContent === 'createTemplate';
|
|
42
43
|
const whatsappOverview = isWhatsappEdit && isFullMode;
|
|
@@ -46,7 +47,7 @@ export function SlideBoxHeader(props) {
|
|
|
46
47
|
whatsappTemplateCategory,
|
|
47
48
|
whatsappTemplateLanguageCode,
|
|
48
49
|
} = templateData || {};
|
|
49
|
-
const
|
|
50
|
+
const templateName = whatsappTemplateName || templateData?.name;
|
|
50
51
|
const whatsappCategory = whatsappTemplateCategory || get(templateData, `versions.base.content.whatsapp.category`, '');
|
|
51
52
|
const whatsappLanguageCode = whatsappTemplateLanguageCode || get(templateData, `versions.base.content.whatsapp.languages[0].language`, '');
|
|
52
53
|
|
|
@@ -59,13 +60,14 @@ export function SlideBoxHeader(props) {
|
|
|
59
60
|
no_communication: 'NO_COMMUNICATION',
|
|
60
61
|
ftp: 'FTP',
|
|
61
62
|
whatsapp: <FormattedMessage {...messages.whatsappTemplate} />,
|
|
63
|
+
rcs: <FormattedMessage {...messages.rcsCreative} />,
|
|
62
64
|
};
|
|
63
65
|
return labels[currentChannel.toLowerCase()];
|
|
64
66
|
};
|
|
65
67
|
|
|
66
68
|
const openWhatsappHelpDoc = () => {
|
|
67
|
-
window.open(WHATSAPP_HELP_DOC_LINK, '_blank')
|
|
68
|
-
}
|
|
69
|
+
window.open(WHATSAPP_HELP_DOC_LINK, '_blank');
|
|
70
|
+
};
|
|
69
71
|
|
|
70
72
|
return (
|
|
71
73
|
<div key="creatives-container-slidebox-header-content">
|
|
@@ -92,28 +94,35 @@ export function SlideBoxHeader(props) {
|
|
|
92
94
|
/>
|
|
93
95
|
)}
|
|
94
96
|
{!showTemplateNameHeader && slidBoxContent === 'editTemplate' && (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
<CapHeader
|
|
98
|
+
title={<FormattedMessage {...headerMessage} values={{ channel: getChannelLabel(channel) }} />}
|
|
97
99
|
description={
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
100
|
+
<>
|
|
101
|
+
{showTemplateName ? (
|
|
102
|
+
<>
|
|
103
|
+
{renderWhatsappData("label1", <FormattedMessage {...globalMessages.templateNameLabel} />)}
|
|
104
|
+
{renderWhatsappData("label2", templateName)}
|
|
105
|
+
</>
|
|
106
|
+
) : ""}
|
|
107
|
+
{isWhatsappEdit && (
|
|
108
|
+
<>
|
|
109
|
+
{renderWhatsappData("label3", <FormattedMessage {...whatsppMsg.labelSeperator} />)}
|
|
110
|
+
{renderWhatsappData("label1", <FormattedMessage {...whatsppMsg.templateCategoryLabel} />)}
|
|
111
|
+
{renderWhatsappData("label2", formatString(whatsappCategory))}
|
|
112
|
+
{renderWhatsappData("label3", <FormattedMessage {...whatsppMsg.labelSeperator} />)}
|
|
113
|
+
{renderWhatsappData("label1", <FormattedMessage {...whatsppMsg.languageLabel} />)}
|
|
114
|
+
{renderWhatsappData("label2", LANGUAGE_OPTIONS?.find((option) => option.value === whatsappLanguageCode)?.label)}
|
|
115
|
+
</>)
|
|
116
|
+
}
|
|
117
|
+
</>
|
|
109
118
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
119
|
+
prefix={creativesMode !== 'edit' && !isFullMode && showPrefix &&
|
|
120
|
+
<PrefixWrapper>
|
|
121
|
+
<CapIcons.backIcon onClick={onShowTemplates} />
|
|
122
|
+
</PrefixWrapper>
|
|
123
|
+
}
|
|
124
|
+
/>
|
|
125
|
+
)}
|
|
117
126
|
{!showTemplateNameHeader && slidBoxContent === 'createTemplate' && ( templateStep === 'modeSelection' || (templateStep === "createTemplateContent" && weChatTemplateType !== MAP_TEMPLATE) ) && (
|
|
118
127
|
<CapHeader
|
|
119
128
|
title={<FormattedMessage {...(showCreateTraiSMSHeader ? messages.UploadSMStemplates : messages.createMessageContent)} values={{channel: getChannelLabel(channel)}}/>}
|
|
@@ -124,12 +133,12 @@ export function SlideBoxHeader(props) {
|
|
|
124
133
|
}
|
|
125
134
|
/>
|
|
126
135
|
)}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
136
|
+
{isWhatsappCreate && (
|
|
137
|
+
<CapLink
|
|
138
|
+
onClick={openWhatsappHelpDoc}
|
|
139
|
+
title={<FormattedMessage {...messages.learnTips} />}
|
|
140
|
+
suffix={<CapIcon type="open-in-new" size="s" />}
|
|
141
|
+
className="learn-tips-link"
|
|
133
142
|
/>
|
|
134
143
|
)}
|
|
135
144
|
{mapTemplateCreate && (
|
|
@@ -17,6 +17,7 @@ export const FTP = "FTP";
|
|
|
17
17
|
export const NO_COMMUNICATION = "NO_COMMUNICATION";
|
|
18
18
|
export const VIBER = "VIBER";
|
|
19
19
|
export const WHATSAPP = "WHATSAPP";
|
|
20
|
+
export const RCS = "RCS";
|
|
20
21
|
|
|
21
22
|
export const SHOW_CONTANER_LOADER = "app/CreativesContainer/SHOW_CONTANER_LOADER";
|
|
22
23
|
export const HIDE_CONTAINER_LOADER = "app/CreativesContainer/HIDE_CONTAINER_LOADER";
|
|
@@ -366,7 +366,7 @@ export class Creatives extends React.Component {
|
|
|
366
366
|
break;
|
|
367
367
|
}
|
|
368
368
|
case constants.WHATSAPP: {
|
|
369
|
-
const {
|
|
369
|
+
const {
|
|
370
370
|
templateConfigs: {
|
|
371
371
|
id,
|
|
372
372
|
name,
|
|
@@ -403,6 +403,29 @@ export class Creatives extends React.Component {
|
|
|
403
403
|
};
|
|
404
404
|
break;
|
|
405
405
|
}
|
|
406
|
+
case constants.RCS: {
|
|
407
|
+
const {
|
|
408
|
+
rcsContent = {},
|
|
409
|
+
smsFallBackContent = {},
|
|
410
|
+
creativeName = "",
|
|
411
|
+
channel = constants.RCS,
|
|
412
|
+
} = templateData || {};
|
|
413
|
+
creativesTemplateData = {
|
|
414
|
+
type: channel,
|
|
415
|
+
edit: true,
|
|
416
|
+
name: creativeName,
|
|
417
|
+
versions: {
|
|
418
|
+
base: {
|
|
419
|
+
content: {
|
|
420
|
+
RCS: {
|
|
421
|
+
...rcsContent,
|
|
422
|
+
smsFallBackContent,
|
|
423
|
+
},
|
|
424
|
+
},
|
|
425
|
+
},
|
|
426
|
+
},
|
|
427
|
+
};
|
|
428
|
+
}
|
|
406
429
|
default:
|
|
407
430
|
break;
|
|
408
431
|
}
|
|
@@ -615,6 +638,35 @@ export class Creatives extends React.Component {
|
|
|
615
638
|
}
|
|
616
639
|
}
|
|
617
640
|
break;
|
|
641
|
+
case constants.RCS: {
|
|
642
|
+
if (template.value) {
|
|
643
|
+
const {name = "", versions = {}, type = ""} = {
|
|
644
|
+
} = template.value || {};
|
|
645
|
+
const {
|
|
646
|
+
cardContent = [],
|
|
647
|
+
cardSettings = {},
|
|
648
|
+
smsFallBackContent = {},
|
|
649
|
+
contentType = "",
|
|
650
|
+
cardType = "",
|
|
651
|
+
} = get(versions, 'base.content.RCS');
|
|
652
|
+
const rcsContent = {
|
|
653
|
+
contentType,
|
|
654
|
+
cardType,
|
|
655
|
+
cardSettings,
|
|
656
|
+
cardContent,
|
|
657
|
+
};
|
|
658
|
+
templateData = {
|
|
659
|
+
channel,
|
|
660
|
+
creativeName: name,
|
|
661
|
+
rcsContent,
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
if (smsFallBackContent.message) {
|
|
665
|
+
templateData.smsFallBackContent = smsFallBackContent;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
break;
|
|
618
670
|
default:
|
|
619
671
|
break;
|
|
620
672
|
}
|
|
@@ -4,7 +4,7 @@ import { shallowWithIntl } from '../../../helpers/intl-enzym-test-helpers';
|
|
|
4
4
|
import { SlideBoxContent } from '../SlideBoxContent';
|
|
5
5
|
import mockdata from '../../mockdata';
|
|
6
6
|
|
|
7
|
-
const {
|
|
7
|
+
const { whatsappEditTemplateData, whatsappPreviewTemplateData, rcsEditTemplateData, rcsPreviewTemplateData } = mockdata;
|
|
8
8
|
|
|
9
9
|
jest.mock("../../../v2Components/FormBuilder", () => ({
|
|
10
10
|
__esModule: true,
|
|
@@ -31,14 +31,13 @@ describe('Test SlideBoxContent container', () => {
|
|
|
31
31
|
expect(renderedComponent).toMatchSnapshot();
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
|
|
35
34
|
it('Should render correct component for whatsapp channel edit mode', () => {
|
|
36
|
-
renderFunction("WHATSAPP", "editTemplate",
|
|
35
|
+
renderFunction("WHATSAPP", "editTemplate", whatsappEditTemplateData);
|
|
37
36
|
expect(renderedComponent).toMatchSnapshot();
|
|
38
37
|
});
|
|
39
38
|
|
|
40
39
|
it('Should render correct component for whatsapp channel preview mode', () => {
|
|
41
|
-
renderFunction("WHATSAPP", "preview",
|
|
40
|
+
renderFunction("WHATSAPP", "preview", whatsappPreviewTemplateData);
|
|
42
41
|
expect(renderedComponent).toMatchSnapshot();
|
|
43
42
|
});
|
|
44
43
|
|
|
@@ -46,4 +45,25 @@ describe('Test SlideBoxContent container', () => {
|
|
|
46
45
|
renderFunction("WHATSAPP", "templates");
|
|
47
46
|
expect(renderedComponent).toMatchSnapshot();
|
|
48
47
|
});
|
|
48
|
+
|
|
49
|
+
it('Should render correct component for rcs channel create mode', () => {
|
|
50
|
+
renderFunction("RCS", "createTemplate", { mode: "create" });
|
|
51
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('Should render correct component for rcs channel edit mode', () => {
|
|
55
|
+
renderFunction("RCs", "editTemplate", rcsEditTemplateData);
|
|
56
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('Should render correct component for rcs channel preview mode', () => {
|
|
60
|
+
renderFunction("RCS", "preview", rcsPreviewTemplateData);
|
|
61
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('Should render correct component for rcs channel templates mode', () => {
|
|
65
|
+
renderFunction("RCS", "templates");
|
|
66
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
67
|
+
});
|
|
68
|
+
|
|
49
69
|
});
|
|
@@ -4,7 +4,7 @@ import { shallowWithIntl } from '../../../helpers/intl-enzym-test-helpers';
|
|
|
4
4
|
import { SlideBoxHeader } from '../SlideBoxHeader';
|
|
5
5
|
import mockdata from '../../mockdata';
|
|
6
6
|
|
|
7
|
-
const {
|
|
7
|
+
const { whatsappEditTemplateData, rcsEditTemplateData, whatsappPreviewTemplateData, rcsPreviewTemplateData } = mockdata;
|
|
8
8
|
|
|
9
9
|
jest.mock("../../../v2Components/FormBuilder", () => ({
|
|
10
10
|
__esModule: true,
|
|
@@ -32,14 +32,13 @@ describe('Test SlideBoxHeader container', () => {
|
|
|
32
32
|
expect(renderedComponent).toMatchSnapshot();
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
|
|
36
35
|
it('Should render correct component for whatsapp channel edit mode', () => {
|
|
37
|
-
renderFunction("WHATSAPP", "editTemplate",
|
|
36
|
+
renderFunction("WHATSAPP", "editTemplate", whatsappEditTemplateData, true);
|
|
38
37
|
expect(renderedComponent).toMatchSnapshot();
|
|
39
38
|
});
|
|
40
39
|
|
|
41
40
|
it('Should render correct component for whatsapp channel preview mode', () => {
|
|
42
|
-
renderFunction("WHATSAPP", "preview",
|
|
41
|
+
renderFunction("WHATSAPP", "preview", whatsappPreviewTemplateData);
|
|
43
42
|
expect(renderedComponent).toMatchSnapshot();
|
|
44
43
|
});
|
|
45
44
|
|
|
@@ -47,4 +46,24 @@ describe('Test SlideBoxHeader container', () => {
|
|
|
47
46
|
renderFunction("WHATSAPP", "templates");
|
|
48
47
|
expect(renderedComponent).toMatchSnapshot();
|
|
49
48
|
});
|
|
49
|
+
|
|
50
|
+
it('Should render correct component for rcs channel create mode', () => {
|
|
51
|
+
renderFunction("RCS", "createTemplate", { mode: "create" });
|
|
52
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('Should render correct component for rcs channel edit mode', () => {
|
|
56
|
+
renderFunction("RCS", "editTemplate", rcsEditTemplateData, true);
|
|
57
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('Should render correct component for rcs channel preview mode', () => {
|
|
61
|
+
renderFunction("RCS", "preview", rcsPreviewTemplateData);
|
|
62
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('Should render correct component for rcs channel templates mode', () => {
|
|
66
|
+
renderFunction("RCS", "templates");
|
|
67
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
68
|
+
});
|
|
50
69
|
});
|
|
@@ -1,5 +1,149 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`Test SlideBoxContent container Should render correct component for rcs channel create mode 1`] = `
|
|
4
|
+
<SlideBoxContent__CreativesWrapper>
|
|
5
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(CreativesCommon))))
|
|
6
|
+
getDefaultTags=""
|
|
7
|
+
location={
|
|
8
|
+
Object {
|
|
9
|
+
"pathname": "/rcs/create",
|
|
10
|
+
"query": Object {
|
|
11
|
+
"isEditFromCampaigns": undefined,
|
|
12
|
+
"module": "library",
|
|
13
|
+
"type": "embedded",
|
|
14
|
+
},
|
|
15
|
+
"search": "",
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
onCreateComplete={[MockFunction]}
|
|
19
|
+
/>
|
|
20
|
+
</SlideBoxContent__CreativesWrapper>
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
exports[`Test SlideBoxContent container Should render correct component for rcs channel edit mode 1`] = `
|
|
24
|
+
<SlideBoxContent__CreativesWrapper>
|
|
25
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(CreativesCommon))))
|
|
26
|
+
getDefaultTags=""
|
|
27
|
+
location={
|
|
28
|
+
Object {
|
|
29
|
+
"pathname": "/rcs/edit",
|
|
30
|
+
"query": Object {
|
|
31
|
+
"isEditFromCampaigns": undefined,
|
|
32
|
+
"module": "library",
|
|
33
|
+
"type": "embedded",
|
|
34
|
+
},
|
|
35
|
+
"search": "",
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
onCreateComplete={[MockFunction]}
|
|
39
|
+
params={
|
|
40
|
+
Object {
|
|
41
|
+
"id": "620e213d39bd394c58aeaaca",
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
templateData={
|
|
45
|
+
Object {
|
|
46
|
+
"_id": "620e213d39bd394c58aeaaca",
|
|
47
|
+
"channel": "RCS",
|
|
48
|
+
"mode": "edit",
|
|
49
|
+
"modeType": "",
|
|
50
|
+
"type": "RCS",
|
|
51
|
+
"validity": true,
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/>
|
|
55
|
+
</SlideBoxContent__CreativesWrapper>
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
exports[`Test SlideBoxContent container Should render correct component for rcs channel preview mode 1`] = `
|
|
59
|
+
<SlideBoxContent__CreativesWrapper>
|
|
60
|
+
<InjectIntl(TemplatePreview)
|
|
61
|
+
channel="rcs"
|
|
62
|
+
charCounterEnabled={false}
|
|
63
|
+
content={
|
|
64
|
+
Object {
|
|
65
|
+
"rcsPreviewContent": Object {
|
|
66
|
+
"rcsDesc": "Desc",
|
|
67
|
+
"rcsImageSrc": "",
|
|
68
|
+
"rcsTitle": "title",
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
showCount={true}
|
|
73
|
+
templateData={
|
|
74
|
+
Object {
|
|
75
|
+
"_id": "620e213d39bd394c58aeaaca",
|
|
76
|
+
"createdAt": "2022-02-17T10:19:42.211Z",
|
|
77
|
+
"createdBy": "15000449",
|
|
78
|
+
"isActive": true,
|
|
79
|
+
"mode": "preview",
|
|
80
|
+
"name": "amit123456",
|
|
81
|
+
"orgId": 50371,
|
|
82
|
+
"totalCount": 12,
|
|
83
|
+
"type": "RCS",
|
|
84
|
+
"updatedAt": "2022-02-17T10:19:42.211Z",
|
|
85
|
+
"updatedBy": "15000449",
|
|
86
|
+
"updatedByName": "Ashish Karan fd",
|
|
87
|
+
"versions": Object {
|
|
88
|
+
"$init": true,
|
|
89
|
+
"base": Object {
|
|
90
|
+
"content": Object {
|
|
91
|
+
"RCS": Object {
|
|
92
|
+
"cardContent": Array [
|
|
93
|
+
Object {
|
|
94
|
+
"description": "Desc",
|
|
95
|
+
"media": Object {
|
|
96
|
+
"height": "MEDIUM",
|
|
97
|
+
"mediaUrl": "",
|
|
98
|
+
},
|
|
99
|
+
"mediaType": "NONE",
|
|
100
|
+
"title": "title",
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
"cardSettings": Object {
|
|
104
|
+
"cardOrientation": "VERTICAL",
|
|
105
|
+
"mediaAlignment": "RIGHT",
|
|
106
|
+
},
|
|
107
|
+
"cardType": "STANDALONE",
|
|
108
|
+
"contentType": "RICHCARD",
|
|
109
|
+
"smsFallBackContent": Object {
|
|
110
|
+
"message": "123",
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
"history": Array [],
|
|
116
|
+
},
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
viberBrandName=""
|
|
120
|
+
/>
|
|
121
|
+
</SlideBoxContent__CreativesWrapper>
|
|
122
|
+
`;
|
|
123
|
+
|
|
124
|
+
exports[`Test SlideBoxContent container Should render correct component for rcs channel templates mode 1`] = `
|
|
125
|
+
<SlideBoxContent__CreativesWrapper>
|
|
126
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(withStyles__StyledComponent))))
|
|
127
|
+
FTPMode="create"
|
|
128
|
+
channel="rcs"
|
|
129
|
+
location={
|
|
130
|
+
Object {
|
|
131
|
+
"pathname": "/sms/edit",
|
|
132
|
+
"query": Object {
|
|
133
|
+
"isEditFromCampaigns": undefined,
|
|
134
|
+
"module": "library",
|
|
135
|
+
"type": "embedded",
|
|
136
|
+
},
|
|
137
|
+
"search": "",
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
messageDetails={Object {}}
|
|
141
|
+
onCreateComplete={[MockFunction]}
|
|
142
|
+
slidBoxContent="templates"
|
|
143
|
+
/>
|
|
144
|
+
</SlideBoxContent__CreativesWrapper>
|
|
145
|
+
`;
|
|
146
|
+
|
|
3
147
|
exports[`Test SlideBoxContent container Should render correct component for whatsapp channel create mode 1`] = `
|
|
4
148
|
<SlideBoxContent__CreativesWrapper>
|
|
5
149
|
<Connect(UserIsAuthenticated(Connect(InjectIntl(CreativesCommon))))
|
|
@@ -51,17 +195,18 @@ exports[`Test SlideBoxContent container Should render correct component for what
|
|
|
51
195
|
charCounterEnabled={false}
|
|
52
196
|
content={
|
|
53
197
|
Object {
|
|
198
|
+
"charCount": 46,
|
|
54
199
|
"templateMsg": <React.Fragment>
|
|
55
200
|
<CapLabel
|
|
56
201
|
type="label5"
|
|
57
202
|
>
|
|
58
203
|
1234567890
|
|
204
|
+
|
|
59
205
|
</CapLabel>
|
|
60
206
|
<CapLabel
|
|
61
207
|
type="label11"
|
|
62
208
|
>
|
|
63
|
-
|
|
64
|
-
Click {{unsubscribe}} to unsubscribe
|
|
209
|
+
Click {{unsubscribe}} to unsubscribe
|
|
65
210
|
</CapLabel>
|
|
66
211
|
</React.Fragment>,
|
|
67
212
|
}
|