@capillarytech/creatives-library 8.0.205 → 8.0.206-alpha.1
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/v2Components/FormBuilder/index.js +1 -1
- package/v2Containers/Assets/images/facebookIllustration.svg +23 -0
- package/v2Containers/Assets/images/lineIllustration.svg +87 -0
- package/v2Containers/Assets/images/viberIllustration.svg +60 -0
- package/v2Containers/Templates/ChannelTypeIllustration.js +188 -0
- package/v2Containers/Templates/index.js +9 -113
- package/v2Containers/Templates/messages.js +24 -0
- package/v2Containers/Templates/tests/ChannelTypeIllustration.test.js +323 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +130 -0
- package/v2Containers/Templates/tests/index.test.js +45 -83
|
@@ -184,6 +184,136 @@ exports[`Test Templates container Should render illustration when no templates a
|
|
|
184
184
|
</CapSkeleton>
|
|
185
185
|
`;
|
|
186
186
|
|
|
187
|
+
exports[`Test Templates container Should render sms illustration when no templates are passed 1`] = `
|
|
188
|
+
<Fragment>
|
|
189
|
+
<div
|
|
190
|
+
className="creatives-templates-list library-mode"
|
|
191
|
+
>
|
|
192
|
+
<input
|
|
193
|
+
accept=".zip, .html, .htm"
|
|
194
|
+
id="filename"
|
|
195
|
+
onChange={[Function]}
|
|
196
|
+
style={
|
|
197
|
+
Object {
|
|
198
|
+
"display": "none",
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
type="file"
|
|
202
|
+
/>
|
|
203
|
+
<CapRow>
|
|
204
|
+
<Pagination
|
|
205
|
+
onPageChange={[Function]}
|
|
206
|
+
paginationContainer="pagination-container"
|
|
207
|
+
paginationSelector="pagination-container"
|
|
208
|
+
>
|
|
209
|
+
<div>
|
|
210
|
+
<div
|
|
211
|
+
className="action-container"
|
|
212
|
+
>
|
|
213
|
+
<_Class
|
|
214
|
+
className="search-text"
|
|
215
|
+
disabled={false}
|
|
216
|
+
labelPosition="top"
|
|
217
|
+
onChange={[Function]}
|
|
218
|
+
onClear={[Function]}
|
|
219
|
+
onScroll={[Function]}
|
|
220
|
+
placeholder="Search"
|
|
221
|
+
style={
|
|
222
|
+
Object {
|
|
223
|
+
"width": "210px",
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
value=""
|
|
227
|
+
/>
|
|
228
|
+
<Component />
|
|
229
|
+
<Component />
|
|
230
|
+
<div
|
|
231
|
+
style={
|
|
232
|
+
Object {
|
|
233
|
+
"alignItems": "center",
|
|
234
|
+
"display": "flex",
|
|
235
|
+
"justifyContent": "space-between",
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
>
|
|
239
|
+
<CapButton
|
|
240
|
+
className="create-new-sms margin-l-8 margin-b-12"
|
|
241
|
+
disabled={false}
|
|
242
|
+
isAddBtn={false}
|
|
243
|
+
onClick={[Function]}
|
|
244
|
+
type="primary"
|
|
245
|
+
>
|
|
246
|
+
Create new
|
|
247
|
+
</CapButton>
|
|
248
|
+
</div>
|
|
249
|
+
</div>
|
|
250
|
+
<CapCustomSkeleton>
|
|
251
|
+
<div>
|
|
252
|
+
<div
|
|
253
|
+
style={
|
|
254
|
+
Object {
|
|
255
|
+
"height": "calc(100vh - 325px)",
|
|
256
|
+
"overflow": "auto",
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
>
|
|
260
|
+
<ChannelTypeIllustration
|
|
261
|
+
createTemplate={[Function]}
|
|
262
|
+
currentChannel="SMS"
|
|
263
|
+
hostName=""
|
|
264
|
+
/>
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
</CapCustomSkeleton>
|
|
268
|
+
</div>
|
|
269
|
+
</Pagination>
|
|
270
|
+
</CapRow>
|
|
271
|
+
<CapRow />
|
|
272
|
+
<CapRow>
|
|
273
|
+
<CapSlideBox
|
|
274
|
+
closeIconPosition="right"
|
|
275
|
+
closeIconSize="m"
|
|
276
|
+
closeIconType="close"
|
|
277
|
+
content={
|
|
278
|
+
<CardGrid
|
|
279
|
+
className=""
|
|
280
|
+
colNumber={2}
|
|
281
|
+
gutterSize={16}
|
|
282
|
+
isLoading={false}
|
|
283
|
+
listItem={Array []}
|
|
284
|
+
onHoverItem={[Function]}
|
|
285
|
+
onItemClick={[Function]}
|
|
286
|
+
/>
|
|
287
|
+
}
|
|
288
|
+
handleClose={[Function]}
|
|
289
|
+
header={
|
|
290
|
+
<h3>
|
|
291
|
+
Select layout
|
|
292
|
+
</h3>
|
|
293
|
+
}
|
|
294
|
+
loadingText="Loading EDM Templates"
|
|
295
|
+
position="right"
|
|
296
|
+
show={false}
|
|
297
|
+
size="size-r"
|
|
298
|
+
width={60}
|
|
299
|
+
/>
|
|
300
|
+
<InjectIntl(Wrapper)
|
|
301
|
+
centered={true}
|
|
302
|
+
className="delete-template-confirm"
|
|
303
|
+
closeText="Cancel"
|
|
304
|
+
okText="Yes, delete"
|
|
305
|
+
onCancel={[Function]}
|
|
306
|
+
onOk={[Function]}
|
|
307
|
+
title="Confirm delete template"
|
|
308
|
+
visible={false}
|
|
309
|
+
>
|
|
310
|
+
Are you sure you wish to delete this template?
|
|
311
|
+
</InjectIntl(Wrapper)>
|
|
312
|
+
</CapRow>
|
|
313
|
+
</div>
|
|
314
|
+
</Fragment>
|
|
315
|
+
`;
|
|
316
|
+
|
|
187
317
|
exports[`Test Templates container Should render temlates when Zalo templates are passed in full mode 1`] = `
|
|
188
318
|
<CapSkeleton
|
|
189
319
|
active={true}
|
|
@@ -28,13 +28,26 @@ describe('Test Templates container', () => {
|
|
|
28
28
|
jest.clearAllMocks();
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
const
|
|
31
|
+
const getTemplateProps =(channel)=>{
|
|
32
|
+
switch(channel){
|
|
33
|
+
case 'whatsapp':
|
|
34
|
+
return TemplatesProp;
|
|
35
|
+
case 'zalo':
|
|
36
|
+
return ZaloTemplateProp;
|
|
37
|
+
case 'rcs':
|
|
38
|
+
return rcsTemplates;
|
|
39
|
+
default:
|
|
40
|
+
return TemplatesProp;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const RenderFunctionFor = (channel, isFullMode) => {
|
|
32
45
|
renderedComponent = shallowWithIntl(
|
|
33
46
|
<Templates
|
|
34
47
|
route={{
|
|
35
|
-
name:
|
|
48
|
+
name: channel,
|
|
36
49
|
}}
|
|
37
|
-
Templates={
|
|
50
|
+
Templates={getTemplateProps(channel)}
|
|
38
51
|
actions={{
|
|
39
52
|
getWeCrmAccounts,
|
|
40
53
|
setChannelAccount,
|
|
@@ -43,67 +56,7 @@ describe('Test Templates container', () => {
|
|
|
43
56
|
getSenderDetails,
|
|
44
57
|
}}
|
|
45
58
|
location={{
|
|
46
|
-
pathname:
|
|
47
|
-
query: {},
|
|
48
|
-
search: '',
|
|
49
|
-
}}
|
|
50
|
-
EmailCreate={{
|
|
51
|
-
duplicateTemplateInProgress: false,
|
|
52
|
-
}}
|
|
53
|
-
isFullMode={isFullMode}
|
|
54
|
-
intl={{
|
|
55
|
-
formatMessage: () => {},
|
|
56
|
-
}}
|
|
57
|
-
/>,
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const renderZaloFunction = (isFullMode) => {
|
|
62
|
-
renderedComponent = shallowWithIntl(
|
|
63
|
-
<Templates
|
|
64
|
-
route={{
|
|
65
|
-
name: 'Zalo',
|
|
66
|
-
}}
|
|
67
|
-
Templates={ZaloTemplateProp}
|
|
68
|
-
actions={{
|
|
69
|
-
getWeCrmAccounts,
|
|
70
|
-
setChannelAccount,
|
|
71
|
-
getAllTemplates,
|
|
72
|
-
getUserList,
|
|
73
|
-
getSenderDetails,
|
|
74
|
-
}}
|
|
75
|
-
location={{
|
|
76
|
-
pathname: '/Zalo',
|
|
77
|
-
query: {},
|
|
78
|
-
search: '',
|
|
79
|
-
}}
|
|
80
|
-
EmailCreate={{
|
|
81
|
-
duplicateTemplateInProgress: false,
|
|
82
|
-
}}
|
|
83
|
-
isFullMode={isFullMode}
|
|
84
|
-
intl={{
|
|
85
|
-
formatMessage: () => {},
|
|
86
|
-
}}
|
|
87
|
-
/>,
|
|
88
|
-
);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const renderRcsFunction = (isFullMode) => {
|
|
92
|
-
renderedComponent = shallowWithIntl(
|
|
93
|
-
<Templates
|
|
94
|
-
route={{
|
|
95
|
-
name: 'RCS',
|
|
96
|
-
}}
|
|
97
|
-
Templates={rcsTemplates}
|
|
98
|
-
actions={{
|
|
99
|
-
getWeCrmAccounts,
|
|
100
|
-
setChannelAccount,
|
|
101
|
-
getAllTemplates,
|
|
102
|
-
getUserList,
|
|
103
|
-
getSenderDetails,
|
|
104
|
-
}}
|
|
105
|
-
location={{
|
|
106
|
-
pathname: '/rcs',
|
|
59
|
+
pathname: `/${channel}`,
|
|
107
60
|
query: {},
|
|
108
61
|
search: '',
|
|
109
62
|
}}
|
|
@@ -119,7 +72,7 @@ describe('Test Templates container', () => {
|
|
|
119
72
|
};
|
|
120
73
|
|
|
121
74
|
it('Should render correct component for whatsapp channel', () => {
|
|
122
|
-
|
|
75
|
+
RenderFunctionFor('whatsapp');
|
|
123
76
|
expect(renderedComponent).toMatchSnapshot();
|
|
124
77
|
expect(getSenderDetails).toHaveBeenCalledTimes(1);
|
|
125
78
|
expect(getSenderDetails).toHaveBeenCalledWith({
|
|
@@ -129,13 +82,22 @@ describe('Test Templates container', () => {
|
|
|
129
82
|
});
|
|
130
83
|
|
|
131
84
|
it('Should render temlates when whatsapp templates are passed', () => {
|
|
132
|
-
|
|
85
|
+
RenderFunctionFor('whatsapp');
|
|
133
86
|
renderedComponent.setProps({ TemplatesList: TemplatesProp.templates });
|
|
134
87
|
expect(renderedComponent).toMatchSnapshot();
|
|
135
88
|
});
|
|
136
89
|
|
|
137
90
|
it('Should render illustration when no templates are passed', () => {
|
|
138
|
-
|
|
91
|
+
RenderFunctionFor('whatsapp');
|
|
92
|
+
renderedComponent.setProps({
|
|
93
|
+
TemplatesList: [],
|
|
94
|
+
Templates: {},
|
|
95
|
+
});
|
|
96
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('Should render sms illustration when no templates are passed', () => {
|
|
100
|
+
RenderFunctionFor('sms');
|
|
139
101
|
renderedComponent.setProps({
|
|
140
102
|
TemplatesList: [],
|
|
141
103
|
Templates: {},
|
|
@@ -144,14 +106,14 @@ describe('Test Templates container', () => {
|
|
|
144
106
|
});
|
|
145
107
|
|
|
146
108
|
it('Should render temlates when whatsapp templates are passed in full mode', () => {
|
|
147
|
-
|
|
109
|
+
RenderFunctionFor('whatsapp',true);
|
|
148
110
|
renderedComponent.setProps({ TemplatesList: TemplatesProp.templates });
|
|
149
111
|
renderedComponent.setState({ selectedWhatsappStatus: 'approved' });
|
|
150
112
|
expect(renderedComponent).toMatchSnapshot();
|
|
151
113
|
});
|
|
152
114
|
|
|
153
115
|
it('Test getCreatives params in edit mode', () => {
|
|
154
|
-
|
|
116
|
+
RenderFunctionFor('whatsapp');
|
|
155
117
|
renderedComponent.setProps({ TemplatesList: TemplatesProp.templates });
|
|
156
118
|
renderedComponent.setState({ routeParams: { pathname: '/edit' } });
|
|
157
119
|
expect(renderedComponent.instance().getCreativesParams()).toEqual(
|
|
@@ -159,21 +121,21 @@ describe('Test Templates container', () => {
|
|
|
159
121
|
);
|
|
160
122
|
});
|
|
161
123
|
it('Should render correct component for zalo channel', () => {
|
|
162
|
-
|
|
124
|
+
RenderFunctionFor('zalo');
|
|
163
125
|
expect(renderedComponent).toMatchSnapshot();
|
|
164
126
|
});
|
|
165
127
|
it('Should render temlates when zalo templates are passed', () => {
|
|
166
|
-
|
|
128
|
+
RenderFunctionFor('zalo');
|
|
167
129
|
renderedComponent.setProps({ TemplatesList: ZaloTemplateProp.templates });
|
|
168
130
|
expect(renderedComponent).toMatchSnapshot();
|
|
169
131
|
});
|
|
170
132
|
it('Should render temlates when Zalo templates are passed in full mode', () => {
|
|
171
|
-
|
|
133
|
+
RenderFunctionFor('zalo',true);
|
|
172
134
|
renderedComponent.setProps({ TemplatesList: ZaloTemplateProp.templates });
|
|
173
135
|
expect(renderedComponent).toMatchSnapshot();
|
|
174
136
|
});
|
|
175
137
|
it('Should render illustration when no templates are passed', () => {
|
|
176
|
-
|
|
138
|
+
RenderFunctionFor('zalo');
|
|
177
139
|
renderedComponent.setProps({
|
|
178
140
|
TemplatesList: [],
|
|
179
141
|
Templates: {},
|
|
@@ -187,7 +149,7 @@ describe('Test Templates container', () => {
|
|
|
187
149
|
return shallowWithIntl(<FilterContainer />);
|
|
188
150
|
};
|
|
189
151
|
it('Test removing single filter', () => {
|
|
190
|
-
|
|
152
|
+
RenderFunctionFor('whatsapp');
|
|
191
153
|
renderedComponent.setProps({ TemplatesList: TemplatesProp.templates });
|
|
192
154
|
renderedComponent.setState({ selectedWhatsappStatus: 'approved' });
|
|
193
155
|
getFilterContainer().find('CapTag').props().onClose();
|
|
@@ -195,7 +157,7 @@ describe('Test Templates container', () => {
|
|
|
195
157
|
});
|
|
196
158
|
|
|
197
159
|
it('Test removing all whatsapp filterss', () => {
|
|
198
|
-
|
|
160
|
+
RenderFunctionFor('whatsapp');
|
|
199
161
|
renderedComponent.setProps({ TemplatesList: TemplatesProp.templates });
|
|
200
162
|
|
|
201
163
|
renderedComponent.setState({ selectedWhatsappStatus: 'approved' });
|
|
@@ -208,7 +170,7 @@ describe('Test Templates container', () => {
|
|
|
208
170
|
});
|
|
209
171
|
|
|
210
172
|
it('Test max templates not exceeded', () => {
|
|
211
|
-
|
|
173
|
+
RenderFunctionFor('whatsapp',true);
|
|
212
174
|
renderedComponent.setProps({
|
|
213
175
|
TemplatesList: [{ ...TemplatesProp.templates[0], totalCount: 260 }],
|
|
214
176
|
});
|
|
@@ -216,7 +178,7 @@ describe('Test Templates container', () => {
|
|
|
216
178
|
});
|
|
217
179
|
|
|
218
180
|
it('Test max templates exceeded', () => {
|
|
219
|
-
|
|
181
|
+
RenderFunctionFor('whatsapp',true);
|
|
220
182
|
renderedComponent.setProps({
|
|
221
183
|
TemplatesList: [{ ...TemplatesProp.templates[0], totalCount: 1510 }],
|
|
222
184
|
});
|
|
@@ -224,7 +186,7 @@ describe('Test Templates container', () => {
|
|
|
224
186
|
});
|
|
225
187
|
|
|
226
188
|
it('Test max templates warning', () => {
|
|
227
|
-
|
|
189
|
+
RenderFunctionFor('whatsapp',true);
|
|
228
190
|
renderedComponent.setProps({
|
|
229
191
|
TemplatesList: [{ ...TemplatesProp.templates[0], totalCount: 248 }],
|
|
230
192
|
});
|
|
@@ -232,7 +194,7 @@ describe('Test Templates container', () => {
|
|
|
232
194
|
});
|
|
233
195
|
|
|
234
196
|
it('Should render correct component for RCS channel', () => {
|
|
235
|
-
|
|
197
|
+
RenderFunctionFor('rcs');
|
|
236
198
|
expect(renderedComponent).toMatchSnapshot();
|
|
237
199
|
expect(getSenderDetails).toHaveBeenCalledTimes(1);
|
|
238
200
|
expect(getSenderDetails).toHaveBeenCalledWith({
|
|
@@ -242,13 +204,13 @@ describe('Test Templates container', () => {
|
|
|
242
204
|
});
|
|
243
205
|
|
|
244
206
|
it('Should render templates when RCS templates are passed', () => {
|
|
245
|
-
|
|
207
|
+
RenderFunctionFor('rcs');
|
|
246
208
|
renderedComponent.setProps({ TemplatesList: rcsTemplates.templates });
|
|
247
209
|
expect(renderedComponent).toMatchSnapshot();
|
|
248
210
|
});
|
|
249
211
|
|
|
250
212
|
it('Should render illustration when no RCS templates are passed', () => {
|
|
251
|
-
|
|
213
|
+
RenderFunctionFor('rcs');
|
|
252
214
|
renderedComponent.setProps({
|
|
253
215
|
TemplatesList: [],
|
|
254
216
|
Templates: {},
|
|
@@ -257,14 +219,14 @@ describe('Test Templates container', () => {
|
|
|
257
219
|
});
|
|
258
220
|
|
|
259
221
|
it('Should render templates when RCS templates are passed in full mode', () => {
|
|
260
|
-
|
|
222
|
+
RenderFunctionFor('rcs',true);
|
|
261
223
|
renderedComponent.setProps({ TemplatesList: rcsTemplates.templates });
|
|
262
224
|
renderedComponent.setState({ selectedRcsStatus: 'approved' });
|
|
263
225
|
expect(renderedComponent).toMatchSnapshot();
|
|
264
226
|
});
|
|
265
227
|
|
|
266
228
|
it('Test getCreatives params in edit mode for RCS', () => {
|
|
267
|
-
|
|
229
|
+
RenderFunctionFor('rcs');
|
|
268
230
|
renderedComponent.setProps({ TemplatesList: rcsTemplates.templates });
|
|
269
231
|
renderedComponent.setState({ routeParams: { pathname: '/edit' } });
|
|
270
232
|
const getCreativesParamsOutputRcs = {
|