@capillarytech/creatives-library 7.12.67 → 7.12.68
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/services/tests/api.test.js +26 -0
- package/v2Components/CapWhatsappCTA/index.js +1 -2
- package/v2Components/CapWhatsappCTA/index.scss +1 -0
- package/v2Components/CapWhatsappCTA/tests/index.test.js +11 -8
- package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +13 -6
- package/v2Components/TemplatePreview/tests/index.test.js +5 -3
- package/v2Components/WhatsappStatusContainer/tests/__snapshots__/index.test.js.snap +55 -2
- package/v2Components/WhatsappStatusContainer/tests/index.test.js +8 -4
- package/v2Components/mockdata.js +94 -37
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +27 -25
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +3 -3
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +76 -3
- package/v2Containers/CreativesContainer/tests/index.test.js +26 -12
- package/v2Containers/Templates/_templates.scss +20 -0
- package/v2Containers/Templates/index.js +15 -5
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +39 -265
- package/v2Containers/Templates/tests/index.test.js +35 -25
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +60103 -4850
- package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +28 -21
- package/v2Containers/Whatsapp/tests/index.test.js +18 -4
- package/v2Containers/Whatsapp/tests/mockData.js +15 -1
- package/v2Containers/Whatsapp/tests/utils.test.js +11 -5
- package/v2Containers/mockdata.js +262 -227
|
@@ -6,11 +6,12 @@ import mockdata from '../../mockdata';
|
|
|
6
6
|
|
|
7
7
|
const {
|
|
8
8
|
whatsappTemplates,
|
|
9
|
+
whatsappGetCreativeData1,
|
|
10
|
+
whatsappGetCreativeData2,
|
|
11
|
+
whatsappGetTemplateData1,
|
|
12
|
+
whatsappGetTemplateData2,
|
|
9
13
|
rcsTemplates,
|
|
10
|
-
whatsappGetCreativeData,
|
|
11
|
-
whatsappGetTemplateData,
|
|
12
14
|
rcsEditTemplateData,
|
|
13
|
-
whatsappGetCreativeData2,
|
|
14
15
|
} = mockdata;
|
|
15
16
|
|
|
16
17
|
jest.mock('../../../v2Components/FormBuilder', () => ({
|
|
@@ -44,19 +45,33 @@ describe('Test SlideBoxContent container', () => {
|
|
|
44
45
|
);
|
|
45
46
|
};
|
|
46
47
|
|
|
47
|
-
it('
|
|
48
|
+
it('campaign message, add creative click whatsapp', () => {
|
|
48
49
|
renderFunction('WHATSAPP', 'createTemplate', whatsappTemplates, {
|
|
49
50
|
mode: 'create',
|
|
50
51
|
});
|
|
51
52
|
expect(renderedComponent).toMatchSnapshot();
|
|
52
53
|
});
|
|
53
54
|
|
|
54
|
-
it('
|
|
55
|
+
it('campaign message, whatsapp edit min data', () => {
|
|
56
|
+
renderFunction(
|
|
57
|
+
'WHATSAPP',
|
|
58
|
+
'editTemplate',
|
|
59
|
+
whatsappTemplates,
|
|
60
|
+
whatsappGetTemplateData1,
|
|
61
|
+
);
|
|
62
|
+
renderedComponent.instance().onEditTemplate();
|
|
63
|
+
renderedComponent.find('CapSlideBox').props().content.props.handleClose();
|
|
64
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
65
|
+
expect(handleCloseCreatives).toHaveBeenCalledTimes(1);
|
|
66
|
+
expect(handleCloseCreatives).toHaveBeenCalledWith(true);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('campaign message, whatsapp edit all data', () => {
|
|
55
70
|
renderFunction(
|
|
56
71
|
'WHATSAPP',
|
|
57
72
|
'editTemplate',
|
|
58
73
|
whatsappTemplates,
|
|
59
|
-
|
|
74
|
+
whatsappGetTemplateData2,
|
|
60
75
|
);
|
|
61
76
|
renderedComponent.instance().onEditTemplate();
|
|
62
77
|
renderedComponent.find('CapSlideBox').props().content.props.handleClose();
|
|
@@ -65,19 +80,18 @@ describe('Test SlideBoxContent container', () => {
|
|
|
65
80
|
expect(handleCloseCreatives).toHaveBeenCalledWith(true);
|
|
66
81
|
});
|
|
67
82
|
|
|
68
|
-
it('Text getCreatives data for whatsapp', () => {
|
|
69
|
-
console.log('abcRcb');
|
|
83
|
+
it('Text getCreatives data for whatsapp, data from creatives done to campaigns', () => {
|
|
70
84
|
renderFunction(
|
|
71
85
|
'WHATSAPP',
|
|
72
86
|
'editTemplate',
|
|
73
87
|
whatsappTemplates,
|
|
74
|
-
|
|
88
|
+
whatsappGetCreativeData1,
|
|
75
89
|
);
|
|
76
90
|
renderedComponent.instance().onEditTemplate();
|
|
77
91
|
renderedComponent
|
|
78
92
|
.find('CapSlideBox')
|
|
79
93
|
.props()
|
|
80
|
-
.content.props.getFormData(
|
|
94
|
+
.content.props.getFormData(whatsappGetCreativeData1);
|
|
81
95
|
renderedComponent
|
|
82
96
|
.find('CapSlideBox')
|
|
83
97
|
.props()
|
|
@@ -85,12 +99,12 @@ describe('Test SlideBoxContent container', () => {
|
|
|
85
99
|
expect(getCreativesData).toHaveBeenCalledTimes(2);
|
|
86
100
|
});
|
|
87
101
|
|
|
88
|
-
it('
|
|
102
|
+
it('campaign message, add creative click rcs', () => {
|
|
89
103
|
renderFunction('RCS', 'createTemplate', rcsTemplates, { mode: 'create' });
|
|
90
104
|
expect(renderedComponent).toMatchSnapshot();
|
|
91
105
|
});
|
|
92
106
|
|
|
93
|
-
it('Text getCreatives data for rcs', () => {
|
|
107
|
+
it('Text getCreatives data for rcs, data from creatives done to campaigns', () => {
|
|
94
108
|
renderFunction('RCS', 'editTemplate', rcsTemplates, rcsEditTemplateData);
|
|
95
109
|
renderedComponent.instance().onEditTemplate();
|
|
96
110
|
renderedComponent
|
|
@@ -592,4 +592,24 @@
|
|
|
592
592
|
width: 100%;
|
|
593
593
|
max-height: 123px;
|
|
594
594
|
margin-bottom: 4px;
|
|
595
|
+
}
|
|
596
|
+
.whatsapp-rcs-template-name {
|
|
597
|
+
max-width: 170px;
|
|
598
|
+
overflow: hidden;
|
|
599
|
+
white-space: nowrap;
|
|
600
|
+
text-overflow: ellipsis;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
.whatsapp-message-with-image {
|
|
604
|
+
display: -webkit-box;
|
|
605
|
+
-webkit-line-clamp: 3;
|
|
606
|
+
-webkit-box-orient: vertical;
|
|
607
|
+
overflow: hidden;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
.whatsapp-message-without-image {
|
|
611
|
+
display: -webkit-box;
|
|
612
|
+
-webkit-line-clamp: 10;
|
|
613
|
+
-webkit-box-orient: vertical;
|
|
614
|
+
overflow: hidden;
|
|
595
615
|
}
|
|
@@ -1069,22 +1069,32 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1069
1069
|
case WHATSAPP: {
|
|
1070
1070
|
const { whatsappImageSrc = '', templateMsg} = getWhatsappContent(template);
|
|
1071
1071
|
templateData.title = (
|
|
1072
|
-
<CapRow
|
|
1073
|
-
<CapLabel>{template.name}</CapLabel>
|
|
1072
|
+
<CapRow>
|
|
1073
|
+
<CapLabel className="whatsapp-rcs-template-name">{template.name}</CapLabel>
|
|
1074
1074
|
<WhatsappStatusContainer template={template} />
|
|
1075
1075
|
</CapRow>
|
|
1076
1076
|
);
|
|
1077
1077
|
templateData.content = (
|
|
1078
1078
|
<>
|
|
1079
|
-
{whatsappImageSrc &&
|
|
1080
|
-
|
|
1079
|
+
{whatsappImageSrc && (
|
|
1080
|
+
<CapImage src={whatsappImageSrc} className="whatsapp-image" />
|
|
1081
|
+
)}
|
|
1082
|
+
<span
|
|
1083
|
+
className={`${
|
|
1084
|
+
whatsappImageSrc
|
|
1085
|
+
? 'whatsapp-message-with-image'
|
|
1086
|
+
: 'whatsapp-message-without-image'
|
|
1087
|
+
}`}
|
|
1088
|
+
>
|
|
1089
|
+
{templateMsg}
|
|
1090
|
+
</span>
|
|
1081
1091
|
{getWhatsappCta(template)}
|
|
1082
1092
|
</>
|
|
1083
1093
|
);
|
|
1084
1094
|
break;
|
|
1085
1095
|
}
|
|
1086
1096
|
case RCS: {
|
|
1087
|
-
templateData.title = template.name
|
|
1097
|
+
templateData.title = <CapLabel className="whatsapp-rcs-template-name">{template.name}</CapLabel>;
|
|
1088
1098
|
templateData.content = getRCSContent(template);
|
|
1089
1099
|
break;
|
|
1090
1100
|
}
|
|
@@ -13,250 +13,15 @@ exports[`Test Templates container Should render correct component for whatsapp c
|
|
|
13
13
|
`;
|
|
14
14
|
|
|
15
15
|
exports[`Test Templates container Should render illustration when no templates are passed 1`] = `
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Object {
|
|
26
|
-
"display": "none",
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
type="file"
|
|
30
|
-
/>
|
|
31
|
-
<CapRow>
|
|
32
|
-
<Pagination
|
|
33
|
-
onPageChange={[Function]}
|
|
34
|
-
paginationContainer="pagination-container"
|
|
35
|
-
paginationSelector="pagination-container"
|
|
36
|
-
>
|
|
37
|
-
<div>
|
|
38
|
-
<div
|
|
39
|
-
className="action-container"
|
|
40
|
-
>
|
|
41
|
-
<_class
|
|
42
|
-
className="search-text"
|
|
43
|
-
disabled={false}
|
|
44
|
-
labelPosition="top"
|
|
45
|
-
onChange={[Function]}
|
|
46
|
-
onClear={[Function]}
|
|
47
|
-
onScroll={[Function]}
|
|
48
|
-
placeholder="Search"
|
|
49
|
-
style={
|
|
50
|
-
Object {
|
|
51
|
-
"width": "210px",
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
value=""
|
|
55
|
-
/>
|
|
56
|
-
<div
|
|
57
|
-
className="whatsapp-filters"
|
|
58
|
-
>
|
|
59
|
-
<CapSelectFilter
|
|
60
|
-
data={
|
|
61
|
-
Array [
|
|
62
|
-
Object {
|
|
63
|
-
"key": "transactional",
|
|
64
|
-
"label": <FormattedMessage
|
|
65
|
-
defaultMessage="Transactional"
|
|
66
|
-
id="creatives.containersV2.Whatsapp.transactional"
|
|
67
|
-
values={Object {}}
|
|
68
|
-
/>,
|
|
69
|
-
"tagColor": "#f2e7fe",
|
|
70
|
-
"tagTextColor": "#a451ff",
|
|
71
|
-
"tooltipLabel": <FormattedMessage
|
|
72
|
-
defaultMessage="Send account updates, order updates, alerts, and more to share important information."
|
|
73
|
-
id="creatives.containersV2.Whatsapp.transactionalTooltip"
|
|
74
|
-
values={Object {}}
|
|
75
|
-
/>,
|
|
76
|
-
"value": "TRANSACTIONAL",
|
|
77
|
-
},
|
|
78
|
-
Object {
|
|
79
|
-
"key": "marketing",
|
|
80
|
-
"label": <FormattedMessage
|
|
81
|
-
defaultMessage="Marketing"
|
|
82
|
-
id="creatives.containersV2.Whatsapp.marketing"
|
|
83
|
-
values={Object {}}
|
|
84
|
-
/>,
|
|
85
|
-
"tagColor": "#ffe5d2",
|
|
86
|
-
"tagTextColor": "#f87d23",
|
|
87
|
-
"tooltipLabel": <FormattedMessage
|
|
88
|
-
defaultMessage="Send promotional offers, product announcements, and more to increase awareness and engagement."
|
|
89
|
-
id="creatives.containersV2.Whatsapp.marketingTooltip"
|
|
90
|
-
values={Object {}}
|
|
91
|
-
/>,
|
|
92
|
-
"value": "MARKETING",
|
|
93
|
-
},
|
|
94
|
-
Object {
|
|
95
|
-
"key": "otp",
|
|
96
|
-
"label": <FormattedMessage
|
|
97
|
-
defaultMessage="Otp"
|
|
98
|
-
id="creatives.containersV2.Whatsapp.otp"
|
|
99
|
-
values={Object {}}
|
|
100
|
-
/>,
|
|
101
|
-
"tagColor": "#ecf7ec",
|
|
102
|
-
"tagTextColor": "#6bb56b",
|
|
103
|
-
"tooltipLabel": <FormattedMessage
|
|
104
|
-
defaultMessage="Send codes that allow your customers to securely access their accounts."
|
|
105
|
-
id="creatives.containersV2.Whatsapp.otpTooltip"
|
|
106
|
-
values={Object {}}
|
|
107
|
-
/>,
|
|
108
|
-
"value": "OTP",
|
|
109
|
-
},
|
|
110
|
-
]
|
|
111
|
-
}
|
|
112
|
-
dropdownMaxHeight="320px"
|
|
113
|
-
dropdownWidth="228px"
|
|
114
|
-
onSelect={[Function]}
|
|
115
|
-
overlayStyle={
|
|
116
|
-
Object {
|
|
117
|
-
"overflowY": "hidden",
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
placeholder="Category"
|
|
121
|
-
placement="bottomLeft"
|
|
122
|
-
selectedValue=""
|
|
123
|
-
showBadge={true}
|
|
124
|
-
width="105px"
|
|
125
|
-
/>
|
|
126
|
-
</div>
|
|
127
|
-
<Component />
|
|
128
|
-
<Component />
|
|
129
|
-
<div
|
|
130
|
-
style={
|
|
131
|
-
Object {
|
|
132
|
-
"alignItems": "center",
|
|
133
|
-
"display": "flex",
|
|
134
|
-
"justifyContent": "space-between",
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
>
|
|
138
|
-
<CapLink
|
|
139
|
-
className="create-new-link"
|
|
140
|
-
disabled={false}
|
|
141
|
-
onClick={[Function]}
|
|
142
|
-
suffix={
|
|
143
|
-
<CapIcon
|
|
144
|
-
size="s"
|
|
145
|
-
type="open-in-new"
|
|
146
|
-
/>
|
|
147
|
-
}
|
|
148
|
-
title="Create new template"
|
|
149
|
-
/>
|
|
150
|
-
</div>
|
|
151
|
-
</div>
|
|
152
|
-
<CapRow
|
|
153
|
-
align="middle"
|
|
154
|
-
className="selected-whatsapp-filters"
|
|
155
|
-
type="flex"
|
|
156
|
-
/>
|
|
157
|
-
<CapSpin
|
|
158
|
-
spinning={false}
|
|
159
|
-
style={
|
|
160
|
-
Object {
|
|
161
|
-
"width": "100%",
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
tip="Getting all templates..."
|
|
165
|
-
>
|
|
166
|
-
<div>
|
|
167
|
-
<div
|
|
168
|
-
style={
|
|
169
|
-
Object {
|
|
170
|
-
"height": "calc(100vh - 325px)",
|
|
171
|
-
"overflow": "auto",
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
>
|
|
175
|
-
<Wrapper
|
|
176
|
-
buttonClassName="create-new-whatsapp"
|
|
177
|
-
buttonLabel={
|
|
178
|
-
<FormattedMessage
|
|
179
|
-
defaultMessage="Add new Whatsapp {template}"
|
|
180
|
-
id="creatives.containersV2.Templates.newWhatsappTemplate"
|
|
181
|
-
values={
|
|
182
|
-
Object {
|
|
183
|
-
"template": "",
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
/>
|
|
187
|
-
}
|
|
188
|
-
description={
|
|
189
|
-
<FormattedMessage
|
|
190
|
-
defaultMessage="These templates can be reused when creating a
|
|
191
|
-
new message content."
|
|
192
|
-
id="creatives.containersV2.Templates.whatsappDescIllustration"
|
|
193
|
-
values={Object {}}
|
|
194
|
-
/>
|
|
195
|
-
}
|
|
196
|
-
descriptionClassName="illustration-desc"
|
|
197
|
-
descriptionPosition="bottom"
|
|
198
|
-
illustrationImage="test-file-stub"
|
|
199
|
-
onClick={[Function]}
|
|
200
|
-
title={
|
|
201
|
-
<FormattedMessage
|
|
202
|
-
defaultMessage="Add a new Whatsapp creative {template}"
|
|
203
|
-
id="creatives.containersV2.Templates.whatsappTitleIllustration"
|
|
204
|
-
values={
|
|
205
|
-
Object {
|
|
206
|
-
"template": "",
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
/>
|
|
210
|
-
}
|
|
211
|
-
/>
|
|
212
|
-
</div>
|
|
213
|
-
</div>
|
|
214
|
-
</CapSpin>
|
|
215
|
-
</div>
|
|
216
|
-
</Pagination>
|
|
217
|
-
</CapRow>
|
|
218
|
-
<CapRow />
|
|
219
|
-
<CapRow>
|
|
220
|
-
<CapSlideBox
|
|
221
|
-
closeIconSize="m"
|
|
222
|
-
content={
|
|
223
|
-
<CardGrid
|
|
224
|
-
className=""
|
|
225
|
-
colNumber={2}
|
|
226
|
-
gutterSize={16}
|
|
227
|
-
isLoading={false}
|
|
228
|
-
listItem={Array []}
|
|
229
|
-
onHoverItem={[Function]}
|
|
230
|
-
onItemClick={[Function]}
|
|
231
|
-
/>
|
|
232
|
-
}
|
|
233
|
-
handleClose={[Function]}
|
|
234
|
-
header={
|
|
235
|
-
<h3>
|
|
236
|
-
Select layout
|
|
237
|
-
</h3>
|
|
238
|
-
}
|
|
239
|
-
loadingText="Loading EDM Templates"
|
|
240
|
-
position="right"
|
|
241
|
-
show={false}
|
|
242
|
-
size="size-r"
|
|
243
|
-
width={60}
|
|
244
|
-
/>
|
|
245
|
-
<Wrapper
|
|
246
|
-
centered={true}
|
|
247
|
-
className="delete-template-confirm"
|
|
248
|
-
closeText="Cancel"
|
|
249
|
-
okText="Yes, delete"
|
|
250
|
-
onCancel={[Function]}
|
|
251
|
-
onOk={[Function]}
|
|
252
|
-
title="Confirm delete template"
|
|
253
|
-
visible={false}
|
|
254
|
-
>
|
|
255
|
-
Are you sure you wish to delete this template?
|
|
256
|
-
</Wrapper>
|
|
257
|
-
</CapRow>
|
|
258
|
-
</div>
|
|
259
|
-
</Fragment>
|
|
16
|
+
<CapSpin
|
|
17
|
+
spinning={false}
|
|
18
|
+
>
|
|
19
|
+
<FormattedMessage
|
|
20
|
+
defaultMessage="Whatsapp accounts are not setup for your brand"
|
|
21
|
+
id="creatives.containersV2.Templates.noAccountsPresentWhatsapp"
|
|
22
|
+
values={Object {}}
|
|
23
|
+
/>
|
|
24
|
+
</CapSpin>
|
|
260
25
|
`;
|
|
261
26
|
|
|
262
27
|
exports[`Test Templates container Should render temlates when whatsapp templates are passed 1`] = `
|
|
@@ -1021,12 +786,16 @@ exports[`Test Templates container Test max templates exceeded 1`] = `
|
|
|
1021
786
|
className="whatsapp-image"
|
|
1022
787
|
src="https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/c9edc114-923b-4ac7-82d0-d6682213.jpg"
|
|
1023
788
|
/>
|
|
1024
|
-
<
|
|
1025
|
-
|
|
789
|
+
<span
|
|
790
|
+
className="whatsapp-message-with-image"
|
|
1026
791
|
>
|
|
1027
|
-
|
|
792
|
+
<CapLabel
|
|
793
|
+
type="label9"
|
|
794
|
+
>
|
|
795
|
+
Hey {{1}}, Easier implementation, tracking, reporting and planning of promotions is now live! Check it out at {{2}}
|
|
1028
796
|
Click {{unsubscribe}} to unsubscribe
|
|
1029
|
-
|
|
797
|
+
</CapLabel>
|
|
798
|
+
</span>
|
|
1030
799
|
<CapLabel
|
|
1031
800
|
style={
|
|
1032
801
|
Object {
|
|
@@ -1113,10 +882,9 @@ Click {{unsubscribe}} to unsubscribe
|
|
|
1113
882
|
Overview
|
|
1114
883
|
</CapButton>,
|
|
1115
884
|
"key": "WHATSAPP-card-creatives_whatsapp6",
|
|
1116
|
-
"title": <CapRow
|
|
1117
|
-
className="whatsapp-card-title"
|
|
1118
|
-
>
|
|
885
|
+
"title": <CapRow>
|
|
1119
886
|
<CapLabel
|
|
887
|
+
className="whatsapp-rcs-template-name"
|
|
1120
888
|
type="label1"
|
|
1121
889
|
>
|
|
1122
890
|
creatives_whatsapp6
|
|
@@ -1452,12 +1220,16 @@ exports[`Test Templates container Test max templates not exceeded 1`] = `
|
|
|
1452
1220
|
className="whatsapp-image"
|
|
1453
1221
|
src="https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/c9edc114-923b-4ac7-82d0-d6682213.jpg"
|
|
1454
1222
|
/>
|
|
1455
|
-
<
|
|
1456
|
-
|
|
1223
|
+
<span
|
|
1224
|
+
className="whatsapp-message-with-image"
|
|
1457
1225
|
>
|
|
1458
|
-
|
|
1226
|
+
<CapLabel
|
|
1227
|
+
type="label9"
|
|
1228
|
+
>
|
|
1229
|
+
Hey {{1}}, Easier implementation, tracking, reporting and planning of promotions is now live! Check it out at {{2}}
|
|
1459
1230
|
Click {{unsubscribe}} to unsubscribe
|
|
1460
|
-
|
|
1231
|
+
</CapLabel>
|
|
1232
|
+
</span>
|
|
1461
1233
|
<CapLabel
|
|
1462
1234
|
style={
|
|
1463
1235
|
Object {
|
|
@@ -1544,10 +1316,9 @@ Click {{unsubscribe}} to unsubscribe
|
|
|
1544
1316
|
Overview
|
|
1545
1317
|
</CapButton>,
|
|
1546
1318
|
"key": "WHATSAPP-card-creatives_whatsapp6",
|
|
1547
|
-
"title": <CapRow
|
|
1548
|
-
className="whatsapp-card-title"
|
|
1549
|
-
>
|
|
1319
|
+
"title": <CapRow>
|
|
1550
1320
|
<CapLabel
|
|
1321
|
+
className="whatsapp-rcs-template-name"
|
|
1551
1322
|
type="label1"
|
|
1552
1323
|
>
|
|
1553
1324
|
creatives_whatsapp6
|
|
@@ -1883,12 +1654,16 @@ exports[`Test Templates container Test max templates warning 1`] = `
|
|
|
1883
1654
|
className="whatsapp-image"
|
|
1884
1655
|
src="https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/c9edc114-923b-4ac7-82d0-d6682213.jpg"
|
|
1885
1656
|
/>
|
|
1886
|
-
<
|
|
1887
|
-
|
|
1657
|
+
<span
|
|
1658
|
+
className="whatsapp-message-with-image"
|
|
1888
1659
|
>
|
|
1889
|
-
|
|
1660
|
+
<CapLabel
|
|
1661
|
+
type="label9"
|
|
1662
|
+
>
|
|
1663
|
+
Hey {{1}}, Easier implementation, tracking, reporting and planning of promotions is now live! Check it out at {{2}}
|
|
1890
1664
|
Click {{unsubscribe}} to unsubscribe
|
|
1891
|
-
|
|
1665
|
+
</CapLabel>
|
|
1666
|
+
</span>
|
|
1892
1667
|
<CapLabel
|
|
1893
1668
|
style={
|
|
1894
1669
|
Object {
|
|
@@ -1975,10 +1750,9 @@ Click {{unsubscribe}} to unsubscribe
|
|
|
1975
1750
|
Overview
|
|
1976
1751
|
</CapButton>,
|
|
1977
1752
|
"key": "WHATSAPP-card-creatives_whatsapp6",
|
|
1978
|
-
"title": <CapRow
|
|
1979
|
-
className="whatsapp-card-title"
|
|
1980
|
-
>
|
|
1753
|
+
"title": <CapRow>
|
|
1981
1754
|
<CapLabel
|
|
1755
|
+
className="whatsapp-rcs-template-name"
|
|
1982
1756
|
type="label1"
|
|
1983
1757
|
>
|
|
1984
1758
|
creatives_whatsapp6
|
|
@@ -6,12 +6,15 @@ import mockdata from '../../mockdata';
|
|
|
6
6
|
|
|
7
7
|
const { whatsappTemplates: TemplatesProp, getCreativesParamsOutput } = mockdata;
|
|
8
8
|
|
|
9
|
-
jest.mock(
|
|
9
|
+
jest.mock('../../CreativesContainer', () => ({
|
|
10
10
|
__esModule: true,
|
|
11
|
-
default: (props) =>
|
|
11
|
+
default: (props) => (
|
|
12
|
+
<div className="creatives-container-mock" {...props}>
|
|
13
|
+
CreativesContainer
|
|
14
|
+
</div>
|
|
15
|
+
),
|
|
12
16
|
}));
|
|
13
17
|
|
|
14
|
-
|
|
15
18
|
describe('Test Templates container', () => {
|
|
16
19
|
const getWeCrmAccounts = jest.fn();
|
|
17
20
|
const setChannelAccount = jest.fn();
|
|
@@ -39,7 +42,7 @@ describe('Test Templates container', () => {
|
|
|
39
42
|
getSenderDetails,
|
|
40
43
|
}}
|
|
41
44
|
location={{
|
|
42
|
-
pathname:
|
|
45
|
+
pathname: '/whatsapp',
|
|
43
46
|
query: {},
|
|
44
47
|
search: '',
|
|
45
48
|
}}
|
|
@@ -50,14 +53,13 @@ describe('Test Templates container', () => {
|
|
|
50
53
|
intl={{
|
|
51
54
|
formatMessage: () => {},
|
|
52
55
|
}}
|
|
53
|
-
|
|
56
|
+
/>,
|
|
54
57
|
);
|
|
55
58
|
};
|
|
56
59
|
|
|
57
60
|
it('Should render correct component for whatsapp channel', () => {
|
|
58
61
|
renderFunction();
|
|
59
62
|
expect(renderedComponent).toMatchSnapshot();
|
|
60
|
-
|
|
61
63
|
expect(getSenderDetails).toHaveBeenCalledTimes(1);
|
|
62
64
|
expect(getSenderDetails).toHaveBeenCalledWith({
|
|
63
65
|
channel: 'WHATSAPP',
|
|
@@ -65,54 +67,56 @@ describe('Test Templates container', () => {
|
|
|
65
67
|
});
|
|
66
68
|
});
|
|
67
69
|
|
|
68
|
-
|
|
69
70
|
it('Should render temlates when whatsapp templates are passed', () => {
|
|
70
71
|
renderFunction();
|
|
71
|
-
renderedComponent.setProps({TemplatesList: TemplatesProp.templates});
|
|
72
|
+
renderedComponent.setProps({ TemplatesList: TemplatesProp.templates });
|
|
72
73
|
expect(renderedComponent).toMatchSnapshot();
|
|
73
74
|
});
|
|
74
75
|
|
|
75
|
-
|
|
76
76
|
it('Should render illustration when no templates are passed', () => {
|
|
77
77
|
renderFunction();
|
|
78
|
-
renderedComponent.setProps({
|
|
78
|
+
renderedComponent.setProps({
|
|
79
|
+
TemplatesList: [],
|
|
80
|
+
Templates: {},
|
|
81
|
+
});
|
|
79
82
|
expect(renderedComponent).toMatchSnapshot();
|
|
80
83
|
});
|
|
81
84
|
|
|
82
85
|
it('Should render temlates when whatsapp templates are passed in full mode', () => {
|
|
83
86
|
renderFunction(true);
|
|
84
|
-
renderedComponent.setProps({TemplatesList: TemplatesProp.templates});
|
|
85
|
-
renderedComponent.setState({selectedWhatsappStatus: 'approved'});
|
|
87
|
+
renderedComponent.setProps({ TemplatesList: TemplatesProp.templates });
|
|
88
|
+
renderedComponent.setState({ selectedWhatsappStatus: 'approved' });
|
|
86
89
|
expect(renderedComponent).toMatchSnapshot();
|
|
87
90
|
});
|
|
88
91
|
|
|
89
92
|
it('Test getCreatives params in edit mode', () => {
|
|
90
93
|
renderFunction();
|
|
91
|
-
renderedComponent.setProps({TemplatesList: TemplatesProp.templates});
|
|
92
|
-
renderedComponent.setState({routeParams: { pathname: '/edit'}});
|
|
93
|
-
expect(renderedComponent.instance().getCreativesParams()).toEqual(
|
|
94
|
+
renderedComponent.setProps({ TemplatesList: TemplatesProp.templates });
|
|
95
|
+
renderedComponent.setState({ routeParams: { pathname: '/edit' } });
|
|
96
|
+
expect(renderedComponent.instance().getCreativesParams()).toEqual(
|
|
97
|
+
getCreativesParamsOutput,
|
|
98
|
+
);
|
|
94
99
|
});
|
|
95
100
|
|
|
96
101
|
const getFilterContainer = () => {
|
|
97
102
|
const FilterContainer = () =>
|
|
98
|
-
renderedComponent.find(
|
|
103
|
+
renderedComponent.find('.selected-whatsapp-filters').props().children;
|
|
99
104
|
return shallowWithIntl(<FilterContainer />);
|
|
100
105
|
};
|
|
101
106
|
it('Test removing single filter', () => {
|
|
102
107
|
renderFunction();
|
|
103
|
-
renderedComponent.setProps({TemplatesList: TemplatesProp.templates});
|
|
104
|
-
renderedComponent.setState({selectedWhatsappStatus: 'approved'});
|
|
108
|
+
renderedComponent.setProps({ TemplatesList: TemplatesProp.templates });
|
|
109
|
+
renderedComponent.setState({ selectedWhatsappStatus: 'approved' });
|
|
105
110
|
getFilterContainer().find('CapTag').props().onClose();
|
|
106
111
|
expect(renderedComponent).toMatchSnapshot();
|
|
107
112
|
});
|
|
108
113
|
|
|
109
|
-
|
|
110
114
|
it('Test removing all whatsapp filterss', () => {
|
|
111
115
|
renderFunction();
|
|
112
|
-
renderedComponent.setProps({TemplatesList: TemplatesProp.templates});
|
|
116
|
+
renderedComponent.setProps({ TemplatesList: TemplatesProp.templates });
|
|
113
117
|
|
|
114
|
-
renderedComponent.setState({selectedWhatsappStatus: 'approved'});
|
|
115
|
-
renderedComponent.setState({selectedWhatsappCategory: 'ALERT_UPDATE'});
|
|
118
|
+
renderedComponent.setState({ selectedWhatsappStatus: 'approved' });
|
|
119
|
+
renderedComponent.setState({ selectedWhatsappCategory: 'ALERT_UPDATE' });
|
|
116
120
|
expect(renderedComponent).toMatchSnapshot();
|
|
117
121
|
|
|
118
122
|
//remove all filters
|
|
@@ -122,19 +126,25 @@ describe('Test Templates container', () => {
|
|
|
122
126
|
|
|
123
127
|
it('Test max templates not exceeded', () => {
|
|
124
128
|
renderFunction(true);
|
|
125
|
-
renderedComponent.setProps({
|
|
129
|
+
renderedComponent.setProps({
|
|
130
|
+
TemplatesList: [{ ...TemplatesProp.templates[0], totalCount: 260 }],
|
|
131
|
+
});
|
|
126
132
|
expect(renderedComponent).toMatchSnapshot();
|
|
127
133
|
});
|
|
128
134
|
|
|
129
135
|
it('Test max templates exceeded', () => {
|
|
130
136
|
renderFunction(true);
|
|
131
|
-
renderedComponent.setProps({
|
|
137
|
+
renderedComponent.setProps({
|
|
138
|
+
TemplatesList: [{ ...TemplatesProp.templates[0], totalCount: 1510 }],
|
|
139
|
+
});
|
|
132
140
|
expect(renderedComponent).toMatchSnapshot();
|
|
133
141
|
});
|
|
134
142
|
|
|
135
143
|
it('Test max templates warning', () => {
|
|
136
144
|
renderFunction(true);
|
|
137
|
-
renderedComponent.setProps({
|
|
145
|
+
renderedComponent.setProps({
|
|
146
|
+
TemplatesList: [{ ...TemplatesProp.templates[0], totalCount: 248 }],
|
|
147
|
+
});
|
|
138
148
|
expect(renderedComponent).toMatchSnapshot();
|
|
139
149
|
});
|
|
140
150
|
});
|