@capillarytech/creatives-library 7.12.40 → 7.12.41
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/CapWhatsappCTA/constants.js +0 -5
- package/v2Components/CapWhatsappCTA/index.js +13 -12
- package/v2Components/CapWhatsappCTA/index.scss +15 -0
- package/v2Components/CapWhatsappCTA/messages.js +0 -4
- package/v2Components/CapWhatsappCTA/tests/index.test.js +152 -0
- package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +191 -19
- package/v2Components/TemplatePreview/tests/index.test.js +52 -5
- package/v2Containers/CreativesContainer/index.js +7 -2
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +29 -0
- package/v2Containers/CreativesContainer/tests/index.test.js +47 -14
- package/v2Containers/Whatsapp/constants.js +10 -7
- package/v2Containers/Whatsapp/index.js +52 -47
- package/v2Containers/Whatsapp/messages.js +6 -2
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +84338 -18311
- package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +100 -0
- package/v2Containers/Whatsapp/tests/index.test.js +159 -18
- package/v2Containers/Whatsapp/tests/mockData.js +150 -89
- package/v2Containers/Whatsapp/tests/utils.test.js +8 -0
- package/v2Containers/Whatsapp/utils.js +16 -14
- package/v2Containers/mockdata.js +177 -5
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
exports[`Test utils test getWhatsappContent 1`] = `
|
|
4
4
|
Object {
|
|
5
5
|
"charCount": 46,
|
|
6
|
+
"ctaData": Array [
|
|
7
|
+
Object {
|
|
8
|
+
"index": 0,
|
|
9
|
+
"phone_number": "+919738752617",
|
|
10
|
+
"text": "Call",
|
|
11
|
+
"type": "PHONE_NUMBER",
|
|
12
|
+
},
|
|
13
|
+
Object {
|
|
14
|
+
"index": 1,
|
|
15
|
+
"text": "More info",
|
|
16
|
+
"type": "STATIC_URL",
|
|
17
|
+
"url": "https://fast.com/",
|
|
18
|
+
},
|
|
19
|
+
],
|
|
6
20
|
"templateMsg": <React.Fragment>
|
|
7
21
|
<CapLabel
|
|
8
22
|
type="label9"
|
|
@@ -14,9 +28,44 @@ Click {{unsubscribe}} to unsubscribe
|
|
|
14
28
|
}
|
|
15
29
|
`;
|
|
16
30
|
|
|
31
|
+
exports[`Test utils test getWhatsappContent 2`] = `
|
|
32
|
+
Object {
|
|
33
|
+
"charCount": 3,
|
|
34
|
+
"ctaData": Array [
|
|
35
|
+
Object {
|
|
36
|
+
"index": 0,
|
|
37
|
+
"phone_number": "",
|
|
38
|
+
"text": "",
|
|
39
|
+
"type": "PHONE_NUMBER",
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
"templateMsg": <React.Fragment>
|
|
43
|
+
<CapLabel
|
|
44
|
+
type="label9"
|
|
45
|
+
>
|
|
46
|
+
test
|
|
47
|
+
</CapLabel>
|
|
48
|
+
</React.Fragment>,
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
|
|
17
52
|
exports[`Test utils test getWhatsappContent for preview 1`] = `
|
|
18
53
|
Object {
|
|
19
54
|
"charCount": 46,
|
|
55
|
+
"ctaData": Array [
|
|
56
|
+
Object {
|
|
57
|
+
"index": 0,
|
|
58
|
+
"phone_number": "+919738752617",
|
|
59
|
+
"text": "Call",
|
|
60
|
+
"type": "PHONE_NUMBER",
|
|
61
|
+
},
|
|
62
|
+
Object {
|
|
63
|
+
"index": 1,
|
|
64
|
+
"text": "More info",
|
|
65
|
+
"type": "STATIC_URL",
|
|
66
|
+
"url": "https://fast.com/",
|
|
67
|
+
},
|
|
68
|
+
],
|
|
20
69
|
"templateMsg": <React.Fragment>
|
|
21
70
|
<CapLabel
|
|
22
71
|
type="label5"
|
|
@@ -27,3 +76,54 @@ Click {{unsubscribe}} to unsubscribe
|
|
|
27
76
|
</React.Fragment>,
|
|
28
77
|
}
|
|
29
78
|
`;
|
|
79
|
+
|
|
80
|
+
exports[`Test utils test getWhatsappCta 1`] = `
|
|
81
|
+
Array [
|
|
82
|
+
<CapLabel
|
|
83
|
+
style={
|
|
84
|
+
Object {
|
|
85
|
+
"marginTop": "12px",
|
|
86
|
+
"textAlign": "center",
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
type="label21"
|
|
90
|
+
>
|
|
91
|
+
<CapIcon
|
|
92
|
+
size="xs"
|
|
93
|
+
svgProps={
|
|
94
|
+
Object {
|
|
95
|
+
"style": Object {
|
|
96
|
+
"marginRight": "4px",
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
type="call"
|
|
101
|
+
/>
|
|
102
|
+
Call
|
|
103
|
+
</CapLabel>,
|
|
104
|
+
<CapLabel
|
|
105
|
+
style={
|
|
106
|
+
Object {
|
|
107
|
+
"marginTop": "12px",
|
|
108
|
+
"textAlign": "center",
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
type="label21"
|
|
112
|
+
>
|
|
113
|
+
<CapIcon
|
|
114
|
+
size="xs"
|
|
115
|
+
svgProps={
|
|
116
|
+
Object {
|
|
117
|
+
"style": Object {
|
|
118
|
+
"marginRight": "4px",
|
|
119
|
+
},
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
type="launch"
|
|
123
|
+
/>
|
|
124
|
+
More info
|
|
125
|
+
</CapLabel>,
|
|
126
|
+
]
|
|
127
|
+
`;
|
|
128
|
+
|
|
129
|
+
exports[`Test utils test getWhatsappCta 2`] = `Array []`;
|
|
@@ -11,9 +11,10 @@ beforeAll(() => {
|
|
|
11
11
|
store = configureStore({}, browserHistory);
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
describe('Creatives Whatsapp
|
|
14
|
+
describe('Creatives Whatsapp test1/>', () => {
|
|
15
15
|
let renderedComponent;
|
|
16
16
|
const createWhatsappTemplate = jest.fn();
|
|
17
|
+
const getFormData = jest.fn();
|
|
17
18
|
const clearCreateResponse = jest.fn();
|
|
18
19
|
const getTemplateDetails = jest.fn();
|
|
19
20
|
const resetEditTemplate = jest.fn();
|
|
@@ -28,9 +29,10 @@ describe('Creatives Whatsapp test/>', () => {
|
|
|
28
29
|
const editData1 = mockData.editData1;
|
|
29
30
|
const editData2 = mockData.editData2;
|
|
30
31
|
const editData3 = mockData.editData3;
|
|
32
|
+
const editdata4 = mockData.editdata4;
|
|
31
33
|
const accountData = mockData.accountData;
|
|
32
34
|
|
|
33
|
-
const renderHelper = (args) => {
|
|
35
|
+
const renderHelper = (args,isFullMode = true) => {
|
|
34
36
|
renderedComponent = mountWithIntl(
|
|
35
37
|
<Provider store={store}>
|
|
36
38
|
<Whatsapp
|
|
@@ -43,12 +45,14 @@ describe('Creatives Whatsapp test/>', () => {
|
|
|
43
45
|
globalActions={{ fetchSchemaForEntity }}
|
|
44
46
|
onCreateComplete={onCreateComplete}
|
|
45
47
|
handleClose={handleClose}
|
|
48
|
+
getFormData={getFormData}
|
|
46
49
|
params={args.params}
|
|
47
50
|
editData={args.editData}
|
|
51
|
+
templateData={args.templateData}
|
|
48
52
|
accountData={accountData}
|
|
49
53
|
location={location}
|
|
50
54
|
intl={{ formatMessage }}
|
|
51
|
-
isFullMode={
|
|
55
|
+
isFullMode={isFullMode}
|
|
52
56
|
isEditFlow={args.isEditFlow || false}
|
|
53
57
|
loadingTags={args.loadingTags}
|
|
54
58
|
metaEntities={[]}
|
|
@@ -56,22 +60,13 @@ describe('Creatives Whatsapp test/>', () => {
|
|
|
56
60
|
/>
|
|
57
61
|
</Provider>,
|
|
58
62
|
);
|
|
59
|
-
}
|
|
63
|
+
};
|
|
60
64
|
|
|
61
65
|
it('should render create mode', () => {
|
|
62
66
|
renderHelper({});
|
|
63
67
|
expect(renderedComponent).toMatchSnapshot();
|
|
64
68
|
});
|
|
65
69
|
|
|
66
|
-
it('test addVariable in create mode', () => {
|
|
67
|
-
renderHelper({});
|
|
68
|
-
renderedComponent
|
|
69
|
-
.find('CapHeader').at(1)
|
|
70
|
-
.props().suffix
|
|
71
|
-
.props.onClick();
|
|
72
|
-
expect(renderedComponent).toMatchSnapshot();
|
|
73
|
-
});
|
|
74
|
-
|
|
75
70
|
it('template name change', () => {
|
|
76
71
|
renderHelper({});
|
|
77
72
|
const templateNameRenderHelper = (val) => {
|
|
@@ -161,6 +156,30 @@ describe('Creatives Whatsapp test/>', () => {
|
|
|
161
156
|
createWhatsappTemplate.mockImplementation((obj, callback) => {
|
|
162
157
|
callback();
|
|
163
158
|
});
|
|
159
|
+
const handleClick = jest.spyOn(React, 'useState');
|
|
160
|
+
handleClick.mockImplementation((ctaData) => [
|
|
161
|
+
ctaData,
|
|
162
|
+
[
|
|
163
|
+
{
|
|
164
|
+
index: 0,
|
|
165
|
+
ctaType: 'WEBSITE',
|
|
166
|
+
text: 'Visit',
|
|
167
|
+
phone_number: '',
|
|
168
|
+
urlType: 'STATIC_URL',
|
|
169
|
+
url: 'https://www.google.com',
|
|
170
|
+
isSaved: true,
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
index: 1,
|
|
174
|
+
ctaType: 'PHONE_NUMBER',
|
|
175
|
+
text: 'Call us',
|
|
176
|
+
phone_number: '9112345',
|
|
177
|
+
urlType: 'STATIC_URL',
|
|
178
|
+
url: '',
|
|
179
|
+
isSaved: true,
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
]);
|
|
164
183
|
renderedComponent
|
|
165
184
|
.find('#whatsapp_template_name_input')
|
|
166
185
|
.at(3)
|
|
@@ -178,21 +197,143 @@ describe('Creatives Whatsapp test/>', () => {
|
|
|
178
197
|
.find('TextArea#whatsapp-create-template-message-input')
|
|
179
198
|
.at(1)
|
|
180
199
|
.simulate('change', event);
|
|
200
|
+
event = { target: { checked: true } };
|
|
201
|
+
renderedComponent
|
|
202
|
+
.find('CapCheckbox.whatsapp-unsubscribe-checkbox')
|
|
203
|
+
.props()
|
|
204
|
+
.onChange(event);
|
|
205
|
+
renderedComponent.update();
|
|
206
|
+
event = { target: { value: 'CTA' } };
|
|
207
|
+
renderedComponent
|
|
208
|
+
.find('CapRadioGroup.whatsapp-btn-radio-group')
|
|
209
|
+
.props()
|
|
210
|
+
.onChange(event);
|
|
211
|
+
renderedComponent.update();
|
|
181
212
|
renderedComponent.find('CapButton.whatsapp-create-btn').props().onClick();
|
|
213
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
182
214
|
});
|
|
183
215
|
|
|
184
216
|
it('should render edit mode in various cases', () => {
|
|
185
217
|
let event = { target: { value: '5454', id: '{{1}}_1' } };
|
|
186
|
-
renderHelper({
|
|
218
|
+
renderHelper({
|
|
219
|
+
params,
|
|
220
|
+
editData: editData1,
|
|
221
|
+
isEditFlow: true,
|
|
222
|
+
loadingTags: false,
|
|
223
|
+
});
|
|
187
224
|
expect(renderedComponent).toMatchSnapshot();
|
|
188
|
-
renderHelper({
|
|
225
|
+
renderHelper({
|
|
226
|
+
params,
|
|
227
|
+
editData: editData2,
|
|
228
|
+
isEditFlow: true,
|
|
229
|
+
loadingTags: false,
|
|
230
|
+
});
|
|
189
231
|
expect(renderedComponent).toMatchSnapshot();
|
|
190
|
-
renderHelper({
|
|
232
|
+
renderHelper({
|
|
233
|
+
params,
|
|
234
|
+
editData: editData3,
|
|
235
|
+
isEditFlow: true,
|
|
236
|
+
loadingTags: false,
|
|
237
|
+
});
|
|
191
238
|
expect(renderedComponent).toMatchSnapshot();
|
|
192
|
-
renderHelper({
|
|
193
|
-
|
|
239
|
+
renderHelper({
|
|
240
|
+
params,
|
|
241
|
+
editData: editData1,
|
|
242
|
+
isEditFlow: true,
|
|
243
|
+
loadingTags: false,
|
|
244
|
+
});
|
|
245
|
+
renderedComponent
|
|
246
|
+
.find('textarea.TextArea__StyledTextArea-sc-177dfyt-2')
|
|
194
247
|
.at(1)
|
|
195
248
|
.simulate('change', event);
|
|
196
249
|
expect(renderedComponent).toMatchSnapshot();
|
|
250
|
+
renderHelper({
|
|
251
|
+
params,
|
|
252
|
+
templateData: editdata4,
|
|
253
|
+
isEditFlow: true,
|
|
254
|
+
loadingTags: false,
|
|
255
|
+
},false);
|
|
256
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
257
|
+
renderedComponent.find('CapButton.whatsapp-create-btn').props().onClick();
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
describe('Creatives Whatsapp test2/>', () => {
|
|
262
|
+
let renderedComponent;
|
|
263
|
+
const createWhatsappTemplate = jest.fn();
|
|
264
|
+
const clearCreateResponse = jest.fn();
|
|
265
|
+
const getTemplateDetails = jest.fn();
|
|
266
|
+
const resetEditTemplate = jest.fn();
|
|
267
|
+
const fetchSchemaForEntity = jest.fn();
|
|
268
|
+
const handleClose = jest.fn();
|
|
269
|
+
const onCreateComplete = jest.fn();
|
|
270
|
+
const formatMessage = jest.fn();
|
|
271
|
+
const location = mockData.location;
|
|
272
|
+
const params = {
|
|
273
|
+
id: mockData.editData1.templateDetails._id,
|
|
274
|
+
};
|
|
275
|
+
const editData1 = mockData.editData1;
|
|
276
|
+
const editData2 = mockData.editData2;
|
|
277
|
+
const editData3 = mockData.editData3;
|
|
278
|
+
const editdata4 = mockData.editdata4;
|
|
279
|
+
const accountData = mockData.accountData;
|
|
280
|
+
|
|
281
|
+
const renderHelper = (args,isFullMode = true) => {
|
|
282
|
+
renderedComponent = mountWithIntl(
|
|
283
|
+
<Provider store={store}>
|
|
284
|
+
<Whatsapp
|
|
285
|
+
actions={{
|
|
286
|
+
createWhatsappTemplate,
|
|
287
|
+
clearCreateResponse,
|
|
288
|
+
getTemplateDetails,
|
|
289
|
+
resetEditTemplate,
|
|
290
|
+
}}
|
|
291
|
+
globalActions={{ fetchSchemaForEntity }}
|
|
292
|
+
onCreateComplete={onCreateComplete}
|
|
293
|
+
handleClose={handleClose}
|
|
294
|
+
params={args.params}
|
|
295
|
+
editData={args.editData}
|
|
296
|
+
accountData={accountData}
|
|
297
|
+
location={location}
|
|
298
|
+
intl={{ formatMessage }}
|
|
299
|
+
isFullMode={isFullMode}
|
|
300
|
+
isEditFlow={args.isEditFlow || false}
|
|
301
|
+
loadingTags={args.loadingTags}
|
|
302
|
+
metaEntities={[]}
|
|
303
|
+
getDefaultTags={true}
|
|
304
|
+
/>
|
|
305
|
+
</Provider>,
|
|
306
|
+
);
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
it('test addVariable in create mode', () => {
|
|
310
|
+
renderHelper({});
|
|
311
|
+
renderedComponent.find('CapHeader').at(1).props().suffix.props.onClick();
|
|
312
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
it('add cta', () => {
|
|
316
|
+
renderHelper({});
|
|
317
|
+
let event = { target: { value: 'CTA' } };
|
|
318
|
+
renderedComponent
|
|
319
|
+
.find('CapRadioGroup.whatsapp-btn-radio-group')
|
|
320
|
+
.props()
|
|
321
|
+
.onChange(event);
|
|
322
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
323
|
+
});
|
|
324
|
+
it('check unsubscribe', () => {
|
|
325
|
+
renderHelper({});
|
|
326
|
+
let event = { target: { checked: true } };
|
|
327
|
+
renderedComponent
|
|
328
|
+
.find('CapCheckbox.whatsapp-unsubscribe-checkbox')
|
|
329
|
+
.props()
|
|
330
|
+
.onChange(event);
|
|
331
|
+
renderedComponent.update();
|
|
332
|
+
expect(
|
|
333
|
+
renderedComponent
|
|
334
|
+
.find('CapCheckbox.whatsapp-unsubscribe-checkbox')
|
|
335
|
+
.props().checked,
|
|
336
|
+
).toBe(true);
|
|
337
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
197
338
|
});
|
|
198
339
|
});
|
|
@@ -8,114 +8,175 @@ export const mockData = {
|
|
|
8
8
|
},
|
|
9
9
|
editData1: {
|
|
10
10
|
templateDetails: {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
_id: '62034b4683c75608cf2404ec',
|
|
12
|
+
name: 'points_update',
|
|
13
|
+
type: 'WHATSAPP',
|
|
14
|
+
versions: {
|
|
15
|
+
history: [],
|
|
16
|
+
base: {
|
|
17
|
+
content: {
|
|
18
|
+
whatsapp: {
|
|
19
|
+
status: 'approved',
|
|
20
|
+
templateId: 'HT9bb4d61eea1699d2dbcaecd1cb558345',
|
|
21
|
+
accountName: 'WhatsppTest',
|
|
22
|
+
accessToken: '4676323eb5d1f975b0987070c03a8efc',
|
|
23
|
+
accountId: 'AC41030cebba9e2f1ce37c78235da0ee18',
|
|
24
|
+
mediaType: 'text',
|
|
25
|
+
languages: [
|
|
26
26
|
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
content:
|
|
28
|
+
"$'Dear Customer, your{{1}} points are about to expire. Redeem before {{2}} at nearest Vishal Mega Mart and SHOP FOR FREE!\nT&C\nClick {{3}} to unsubscribe'",
|
|
29
|
+
language: 'en',
|
|
30
|
+
},
|
|
30
31
|
],
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
buttonType: 'CTA',
|
|
33
|
+
buttons: [
|
|
34
|
+
{
|
|
35
|
+
phone_number: '+919738752617',
|
|
36
|
+
text: 'Call us',
|
|
37
|
+
type: 'PHONE_NUMBER',
|
|
38
|
+
index: 0,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
url: 'https://fast.com/',
|
|
42
|
+
text: 'Visit us',
|
|
43
|
+
type: 'STATIC_URL',
|
|
44
|
+
index: 1,
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
category: 'ACCOUNT_UPDATE',
|
|
48
|
+
rejection_reason: null,
|
|
49
|
+
varMapped: {
|
|
34
50
|
'{{1}}_1': '500',
|
|
35
51
|
'{{2}}_3': 'tomorrow',
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
40
56
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
57
|
+
isActive: true,
|
|
58
|
+
orgId: 50146,
|
|
59
|
+
createdBy: '15000449',
|
|
60
|
+
updatedBy: '15000449',
|
|
61
|
+
createdAt: '2022-02-09T05:04:06.579Z',
|
|
62
|
+
updatedAt: '2022-02-09T05:04:06.579Z',
|
|
47
63
|
},
|
|
48
64
|
},
|
|
49
65
|
editData2: {
|
|
50
66
|
templateDetails: {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
_id: '62034b4683c75608cf2404ec',
|
|
68
|
+
name: 'points_update',
|
|
69
|
+
type: 'WHATSAPP',
|
|
70
|
+
versions: {
|
|
71
|
+
history: [],
|
|
72
|
+
base: {
|
|
73
|
+
content: {
|
|
74
|
+
whatsapp: {
|
|
75
|
+
status: 'rejected',
|
|
76
|
+
templateId: 'HT9bb4d61eea1699d2dbcaecd1cb558345',
|
|
77
|
+
accountName: 'WhatsppTest',
|
|
78
|
+
accessToken: '4676323eb5d1f975b0987070c03a8efc',
|
|
79
|
+
accountId: 'AC41030cebba9e2f1ce37c78235da0ee18',
|
|
80
|
+
mediaType: 'text',
|
|
81
|
+
languages: [
|
|
66
82
|
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
83
|
+
content:
|
|
84
|
+
"$'Dear Customer, your{{1}} points are about to expire. Redeem before {{2}} at nearest Vishal Mega Mart and SHOP FOR FREE!\nT&C'",
|
|
85
|
+
language: 'en',
|
|
86
|
+
},
|
|
70
87
|
],
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
88
|
+
buttonType: 'NONE',
|
|
89
|
+
buttons: [],
|
|
90
|
+
category: 'ACCOUNT_UPDATE',
|
|
91
|
+
rejection_reason: 'INVALID_FORMAT',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
76
95
|
},
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
96
|
+
isActive: true,
|
|
97
|
+
orgId: 50146,
|
|
98
|
+
createdBy: '15000449',
|
|
99
|
+
updatedBy: '15000449',
|
|
100
|
+
createdAt: '2022-02-09T05:04:06.579Z',
|
|
101
|
+
updatedAt: '2022-02-09T05:04:06.579Z',
|
|
83
102
|
},
|
|
84
103
|
},
|
|
85
104
|
editData3: {
|
|
86
105
|
templateDetails: {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
106
|
+
_id: '62034b4683c75608cf2404ec',
|
|
107
|
+
name: 'points_update',
|
|
108
|
+
type: 'WHATSAPP',
|
|
109
|
+
versions: {
|
|
110
|
+
history: [],
|
|
111
|
+
base: {
|
|
112
|
+
content: {
|
|
113
|
+
whatsapp: {
|
|
114
|
+
status: 'rejected',
|
|
115
|
+
templateId: 'HT9bb4d61eea1699d2dbcaecd1cb558345',
|
|
116
|
+
accountName: 'WhatsppTest',
|
|
117
|
+
accessToken: '4676323eb5d1f975b0987070c03a8efc',
|
|
118
|
+
accountId: 'AC41030cebba9e2f1ce37c78235da0ee18',
|
|
119
|
+
mediaType: 'text',
|
|
120
|
+
languages: [
|
|
102
121
|
{
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
122
|
+
content: 'test',
|
|
123
|
+
language: 'en',
|
|
124
|
+
},
|
|
106
125
|
],
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
126
|
+
category: 'ACCOUNT_UPDATE',
|
|
127
|
+
rejection_reason: 'TAG_CONTENT_MISMATCH',
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
isActive: true,
|
|
133
|
+
orgId: 50146,
|
|
134
|
+
createdBy: '15000449',
|
|
135
|
+
updatedBy: '15000449',
|
|
136
|
+
createdAt: '2022-02-09T05:04:06.579Z',
|
|
137
|
+
updatedAt: '2022-02-09T05:04:06.579Z',
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
editdata4: {
|
|
141
|
+
_id: '62988c2f7d11ed69168252a6',
|
|
142
|
+
type: 'WHATSAPP',
|
|
143
|
+
edit: true,
|
|
144
|
+
name: 'test_206',
|
|
145
|
+
versions: {
|
|
146
|
+
base: {
|
|
147
|
+
content: {
|
|
148
|
+
whatsapp: {
|
|
149
|
+
status: 'approved',
|
|
150
|
+
category: 'ALERT_UPDATE',
|
|
151
|
+
varMapped: {
|
|
152
|
+
'{{1}}_1': '50',
|
|
153
|
+
},
|
|
154
|
+
mediaType: 'TEXT',
|
|
155
|
+
buttonType: 'CTA',
|
|
156
|
+
buttons: [
|
|
157
|
+
{
|
|
158
|
+
index: 0,
|
|
159
|
+
type: 'PHONE_NUMBER',
|
|
160
|
+
text: 'Call',
|
|
161
|
+
phone_number: '+919738752617',
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
index: 1,
|
|
165
|
+
type: 'STATIC_URL',
|
|
166
|
+
text: 'More info',
|
|
167
|
+
url: 'https://fast.com/',
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
languages: [
|
|
171
|
+
{
|
|
172
|
+
language: 'en',
|
|
173
|
+
content:
|
|
174
|
+
'You have received {{1}} points\nClick {{unsubscribe}} to unsubscribe',
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
},
|
|
112
179
|
},
|
|
113
|
-
"isActive": true,
|
|
114
|
-
"orgId": 50146,
|
|
115
|
-
"createdBy": "15000449",
|
|
116
|
-
"updatedBy": "15000449",
|
|
117
|
-
"createdAt": "2022-02-09T05:04:06.579Z",
|
|
118
|
-
"updatedAt": "2022-02-09T05:04:06.579Z"
|
|
119
180
|
},
|
|
120
181
|
},
|
|
121
182
|
location: {
|
|
@@ -2,11 +2,13 @@ import {
|
|
|
2
2
|
getWhatsappContent,
|
|
3
3
|
getWhatsappStatus,
|
|
4
4
|
getWhatsappCategory,
|
|
5
|
+
getWhatsappCta,
|
|
5
6
|
} from '../utils';
|
|
6
7
|
import mockdata from '../../mockdata';
|
|
7
8
|
|
|
8
9
|
const {
|
|
9
10
|
whatsappPreviewTemplateData,
|
|
11
|
+
whatsappPreviewTemplateData2,
|
|
10
12
|
getWhatsappStatusOutput,
|
|
11
13
|
getWhatsappCategoryOutput,
|
|
12
14
|
} = mockdata;
|
|
@@ -14,6 +16,7 @@ const {
|
|
|
14
16
|
describe('Test utils', () => {
|
|
15
17
|
it('test getWhatsappContent', () => {
|
|
16
18
|
expect(getWhatsappContent(whatsappPreviewTemplateData)).toMatchSnapshot();
|
|
19
|
+
expect(getWhatsappContent(whatsappPreviewTemplateData2)).toMatchSnapshot();
|
|
17
20
|
});
|
|
18
21
|
|
|
19
22
|
it('test getWhatsappContent for preview', () => {
|
|
@@ -22,6 +25,11 @@ describe('Test utils', () => {
|
|
|
22
25
|
).toMatchSnapshot();
|
|
23
26
|
});
|
|
24
27
|
|
|
28
|
+
it('test getWhatsappCta', () => {
|
|
29
|
+
expect(getWhatsappCta(whatsappPreviewTemplateData)).toMatchSnapshot();
|
|
30
|
+
expect(getWhatsappCta(whatsappPreviewTemplateData2)).toMatchSnapshot();
|
|
31
|
+
});
|
|
32
|
+
|
|
25
33
|
it('test getWhatsappStatus', () => {
|
|
26
34
|
expect(getWhatsappStatus('approved')).toEqual(getWhatsappStatusOutput);
|
|
27
35
|
});
|