@capillarytech/creatives-library 7.11.2 → 7.11.3
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/TemplatePreview/index.js +1 -1
- package/v2Components/TemplatePreview/messages.js +1 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +1 -1
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +16 -1
- package/v2Containers/CreativesContainer/constants.js +2 -0
- package/v2Containers/CreativesContainer/index.js +2 -0
- package/v2Containers/CreativesContainer/messages.js +4 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +15 -2
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +20 -1
- package/v2Containers/Templates/_templates.scss +23 -6
- package/v2Containers/Whatsapp/constants.js +1 -1
- package/v2Containers/Whatsapp/index.js +24 -12
- package/v2Containers/Whatsapp/index.scss +2 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +22742 -1245
- package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +33 -0
- package/v2Containers/Whatsapp/tests/index.test.js +13 -0
- package/v2Containers/Whatsapp/tests/utils.test.js +5 -1
- package/v2Containers/Whatsapp/utils.js +13 -2
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Test utils test getWhatsappContent 1`] = `
|
|
4
|
+
<React.Fragment>
|
|
5
|
+
<CapLabel
|
|
6
|
+
type="label9"
|
|
7
|
+
>
|
|
8
|
+
1234567890
|
|
9
|
+
</CapLabel>
|
|
10
|
+
<CapLabel
|
|
11
|
+
type="label1"
|
|
12
|
+
>
|
|
13
|
+
|
|
14
|
+
Click {{unsubscribe}} to unsubscribe
|
|
15
|
+
</CapLabel>
|
|
16
|
+
</React.Fragment>
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
exports[`Test utils test getWhatsappContent for preview 1`] = `
|
|
20
|
+
<React.Fragment>
|
|
21
|
+
<CapLabel
|
|
22
|
+
type="label5"
|
|
23
|
+
>
|
|
24
|
+
1234567890
|
|
25
|
+
</CapLabel>
|
|
26
|
+
<CapLabel
|
|
27
|
+
type="label11"
|
|
28
|
+
>
|
|
29
|
+
|
|
30
|
+
Click {{unsubscribe}} to unsubscribe
|
|
31
|
+
</CapLabel>
|
|
32
|
+
</React.Fragment>
|
|
33
|
+
`;
|
|
@@ -63,6 +63,15 @@ describe('Creatives Whatsapp test/>', () => {
|
|
|
63
63
|
expect(renderedComponent).toMatchSnapshot();
|
|
64
64
|
});
|
|
65
65
|
|
|
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
|
+
|
|
66
75
|
it('template name change', () => {
|
|
67
76
|
renderHelper({});
|
|
68
77
|
const templateNameRenderHelper = (val) => {
|
|
@@ -112,6 +121,10 @@ describe('Creatives Whatsapp test/>', () => {
|
|
|
112
121
|
expect(renderedComponent).toMatchSnapshot();
|
|
113
122
|
templateMessageRenderHelper('Hi {{{1}}}');
|
|
114
123
|
expect(renderedComponent).toMatchSnapshot();
|
|
124
|
+
|
|
125
|
+
//test variable autocomplete
|
|
126
|
+
templateMessageRenderHelper('Hi {{');
|
|
127
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
115
128
|
});
|
|
116
129
|
|
|
117
130
|
it('send for approval should be disabled', () => {
|
|
@@ -10,7 +10,11 @@ const {
|
|
|
10
10
|
|
|
11
11
|
describe('Test utils', () => {
|
|
12
12
|
it('test getWhatsappContent', () => {
|
|
13
|
-
expect(getWhatsappContent(previewTemplateData)).
|
|
13
|
+
expect(getWhatsappContent(previewTemplateData)).toMatchSnapshot();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('test getWhatsappContent for preview', () => {
|
|
17
|
+
expect(getWhatsappContent(previewTemplateData, true)).toMatchSnapshot();
|
|
14
18
|
});
|
|
15
19
|
|
|
16
20
|
it('test getWhatsappStatus', () => {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import CapLabel from '@capillarytech/cap-ui-library/CapLabel';
|
|
1
3
|
import { WHATSAPP } from '../CreativesContainer/constants';
|
|
2
4
|
import {
|
|
3
5
|
STATUS_OPTIONS,
|
|
@@ -5,7 +7,7 @@ import {
|
|
|
5
7
|
WHATSAPP_STATUSES,
|
|
6
8
|
} from '../Whatsapp/constants';
|
|
7
9
|
|
|
8
|
-
export const getWhatsappContent = (template) => {
|
|
10
|
+
export const getWhatsappContent = (template, isPreview) => {
|
|
9
11
|
const {
|
|
10
12
|
versions: {
|
|
11
13
|
base: {
|
|
@@ -26,7 +28,16 @@ export const getWhatsappContent = (template) => {
|
|
|
26
28
|
`${validVarArr[validVarArr.length - 1]}`,
|
|
27
29
|
'{{unsubscribe}}',
|
|
28
30
|
);
|
|
29
|
-
return
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
<CapLabel type={ isPreview ? "label5" : "label9" }>
|
|
34
|
+
{text.slice(0, text.length - 37)}
|
|
35
|
+
</CapLabel>
|
|
36
|
+
<CapLabel type={ isPreview ? "label11" : "label1" }>
|
|
37
|
+
{text.slice(-37)}
|
|
38
|
+
</CapLabel>
|
|
39
|
+
</>
|
|
40
|
+
);
|
|
30
41
|
}
|
|
31
42
|
|
|
32
43
|
export const getWhatsappCategory = (category) => {
|