@capillarytech/creatives-library 7.12.1 → 7.12.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/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 +13 -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/Cap/messages.js +20 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +57 -11
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +1 -0
- package/v2Containers/CreativesContainer/constants.js +1 -0
- 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/Rcs/actions.js +57 -0
- package/v2Containers/Rcs/constants.js +50 -0
- package/v2Containers/Rcs/index.js +1064 -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 +145080 -0
- package/v2Containers/Rcs/tests/index.test.js +226 -0
- package/v2Containers/Rcs/tests/mockData.js +169 -0
- package/v2Containers/Rcs/utils.js +40 -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 +2 -1
- 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 +567 -1588
|
@@ -57,6 +57,7 @@ export function SlideBoxHeader(props) {
|
|
|
57
57
|
no_communication: 'NO_COMMUNICATION',
|
|
58
58
|
ftp: 'FTP',
|
|
59
59
|
whatsapp: <FormattedMessage {...messages.whatsappTemplate} />,
|
|
60
|
+
rcs: <FormattedMessage {...messages.rcsCreative} />,
|
|
60
61
|
};
|
|
61
62
|
return labels[currentChannel.toLowerCase()];
|
|
62
63
|
};
|
|
@@ -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";
|
|
@@ -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
|
}
|
|
@@ -1,5 +1,103 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`Test SlideBoxHeader container Should render correct component for rcs channel create mode 1`] = `
|
|
4
|
+
<div
|
|
5
|
+
key="creatives-container-slidebox-header-content"
|
|
6
|
+
/>
|
|
7
|
+
`;
|
|
8
|
+
|
|
9
|
+
exports[`Test SlideBoxHeader container Should render correct component for rcs channel edit mode 1`] = `
|
|
10
|
+
<div
|
|
11
|
+
key="creatives-container-slidebox-header-content"
|
|
12
|
+
>
|
|
13
|
+
<CapHeader
|
|
14
|
+
description={false}
|
|
15
|
+
descriptionClass=""
|
|
16
|
+
inline={false}
|
|
17
|
+
prefix={false}
|
|
18
|
+
size="large"
|
|
19
|
+
title={
|
|
20
|
+
<FormattedMessage
|
|
21
|
+
defaultMessage="Edit {channel}"
|
|
22
|
+
id="creatives.containersV2.Creatives.editMessageContent"
|
|
23
|
+
values={
|
|
24
|
+
Object {
|
|
25
|
+
"channel": <FormattedMessage
|
|
26
|
+
defaultMessage="RCS creative"
|
|
27
|
+
id="creatives.containersV2.Creatives.rcsCreative"
|
|
28
|
+
values={Object {}}
|
|
29
|
+
/>,
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/>
|
|
33
|
+
}
|
|
34
|
+
titleClass=""
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
exports[`Test SlideBoxHeader container Should render correct component for rcs channel preview mode 1`] = `
|
|
40
|
+
<div
|
|
41
|
+
key="creatives-container-slidebox-header-content"
|
|
42
|
+
>
|
|
43
|
+
<CapHeader
|
|
44
|
+
description={
|
|
45
|
+
<CapLabel
|
|
46
|
+
type="label3"
|
|
47
|
+
>
|
|
48
|
+
<FormattedMessage
|
|
49
|
+
defaultMessage="Last updated: {date} by {user}"
|
|
50
|
+
id="creatives.containersV2.Creatives.lastUpdated"
|
|
51
|
+
values={
|
|
52
|
+
Object {
|
|
53
|
+
"date": "17 Feb 2022",
|
|
54
|
+
"user": "Ashish Karan fd",
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/>
|
|
58
|
+
</CapLabel>
|
|
59
|
+
}
|
|
60
|
+
descriptionClass=""
|
|
61
|
+
inline={false}
|
|
62
|
+
prefix={
|
|
63
|
+
<SlideBoxHeader__PrefixWrapper>
|
|
64
|
+
<SvgBack />
|
|
65
|
+
</SlideBoxHeader__PrefixWrapper>
|
|
66
|
+
}
|
|
67
|
+
size="large"
|
|
68
|
+
title="amit123456"
|
|
69
|
+
titleClass=""
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
exports[`Test SlideBoxHeader container Should render correct component for rcs channel templates mode 1`] = `
|
|
75
|
+
<div
|
|
76
|
+
key="creatives-container-slidebox-header-content"
|
|
77
|
+
>
|
|
78
|
+
<CapHeader
|
|
79
|
+
description={
|
|
80
|
+
<FormattedMessage
|
|
81
|
+
defaultMessage="Select only one creative"
|
|
82
|
+
id="creatives.containersV2.Creatives.creativeTemplatesDesc"
|
|
83
|
+
values={Object {}}
|
|
84
|
+
/>
|
|
85
|
+
}
|
|
86
|
+
descriptionClass=""
|
|
87
|
+
inline={false}
|
|
88
|
+
size="large"
|
|
89
|
+
title={
|
|
90
|
+
<FormattedMessage
|
|
91
|
+
defaultMessage="Creative templates"
|
|
92
|
+
id="creatives.containersV2.Creatives.creativeTemplates"
|
|
93
|
+
values={Object {}}
|
|
94
|
+
/>
|
|
95
|
+
}
|
|
96
|
+
titleClass=""
|
|
97
|
+
/>
|
|
98
|
+
</div>
|
|
99
|
+
`;
|
|
100
|
+
|
|
3
101
|
exports[`Test SlideBoxHeader container Should render correct component for whatsapp channel create mode 1`] = `
|
|
4
102
|
<div
|
|
5
103
|
key="creatives-container-slidebox-header-content"
|
|
@@ -1,5 +1,76 @@
|
|
|
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
|
+
<CreativesContainer__SlideBoxWrapper
|
|
5
|
+
className="add-creatives-section creatives-library-mode "
|
|
6
|
+
>
|
|
7
|
+
<CapSlideBox
|
|
8
|
+
closeIconSize="m"
|
|
9
|
+
content={
|
|
10
|
+
<SlideBoxContent
|
|
11
|
+
currentChannel="RCS"
|
|
12
|
+
getFormData={[Function]}
|
|
13
|
+
handleClose={[Function]}
|
|
14
|
+
onCallTaskSubmit={[Function]}
|
|
15
|
+
onChannelChange={[Function]}
|
|
16
|
+
onCreateComplete={[MockFunction]}
|
|
17
|
+
onCreateNew={[Function]}
|
|
18
|
+
onCreateNextStep={[Function]}
|
|
19
|
+
onEmailModeChange={[Function]}
|
|
20
|
+
onEnterTemplateName={[Function]}
|
|
21
|
+
onFTPSubmit={[MockFunction]}
|
|
22
|
+
onFacebookSubmit={[MockFunction]}
|
|
23
|
+
onMobilepushModeChange={[Function]}
|
|
24
|
+
onPreviewTemplate={[Function]}
|
|
25
|
+
onRemoveTemplateName={[Function]}
|
|
26
|
+
onResetStep={[Function]}
|
|
27
|
+
onSelectTemplate={[Function]}
|
|
28
|
+
onShowTemplates={[Function]}
|
|
29
|
+
onValidationFail={[Function]}
|
|
30
|
+
onWeChatMaptemplateStepChange={[Function]}
|
|
31
|
+
onWechatTemplateChange={[Function]}
|
|
32
|
+
saveMessage={[Function]}
|
|
33
|
+
setIsLoadingContent={[Function]}
|
|
34
|
+
showTemplateName={[Function]}
|
|
35
|
+
slidBoxContent="templates"
|
|
36
|
+
templateData={
|
|
37
|
+
Object {
|
|
38
|
+
"type": undefined,
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
templateStep="modeSelection"
|
|
42
|
+
weChatMaptemplateStep={0}
|
|
43
|
+
weChatTemplateType=""
|
|
44
|
+
/>
|
|
45
|
+
}
|
|
46
|
+
footer={false}
|
|
47
|
+
handleClose={[Function]}
|
|
48
|
+
header={
|
|
49
|
+
<SlideBoxHeader
|
|
50
|
+
channel="RCS"
|
|
51
|
+
isLoadingContent={true}
|
|
52
|
+
onShowTemplates={[Function]}
|
|
53
|
+
onWeChatMaptemplateStepChange={[Function]}
|
|
54
|
+
showPrefix={true}
|
|
55
|
+
slidBoxContent="templates"
|
|
56
|
+
templateData={
|
|
57
|
+
Object {
|
|
58
|
+
"type": undefined,
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
templateNameRenderProp={[Function]}
|
|
62
|
+
templateStep="modeSelection"
|
|
63
|
+
weChatMaptemplateStep={0}
|
|
64
|
+
weChatTemplateType=""
|
|
65
|
+
/>
|
|
66
|
+
}
|
|
67
|
+
position="right"
|
|
68
|
+
show={true}
|
|
69
|
+
size="size-xl"
|
|
70
|
+
/>
|
|
71
|
+
</CreativesContainer__SlideBoxWrapper>
|
|
72
|
+
`;
|
|
73
|
+
|
|
3
74
|
exports[`Test SlideBoxContent container Should render correct component for whatsapp channel create mode 1`] = `
|
|
4
75
|
<CreativesContainer__SlideBoxWrapper
|
|
5
76
|
className="add-creatives-section creatives-library-mode "
|
|
@@ -4,7 +4,7 @@ import { shallowWithIntl } from '../../../helpers/intl-enzym-test-helpers';
|
|
|
4
4
|
import { Creatives } from '../index';
|
|
5
5
|
import mockdata from '../../mockdata';
|
|
6
6
|
|
|
7
|
-
const {
|
|
7
|
+
const { whatsappTemplates, rcsTemplates, whatsappEditTemplateData, rcsEditTemplateData } = mockdata;
|
|
8
8
|
|
|
9
9
|
jest.mock("../../../v2Components/FormBuilder", () => ({
|
|
10
10
|
__esModule: true,
|
|
@@ -20,10 +20,10 @@ describe('Test SlideBoxContent container', () => {
|
|
|
20
20
|
jest.clearAllMocks();
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
const renderFunction = (channel, mode, templateData) => {
|
|
23
|
+
const renderFunction = (channel, mode, templates, templateData) => {
|
|
24
24
|
renderedComponent = shallowWithIntl(
|
|
25
25
|
<Creatives
|
|
26
|
-
Templates={
|
|
26
|
+
Templates={templates}
|
|
27
27
|
channel={channel}
|
|
28
28
|
slidBoxContent={mode}
|
|
29
29
|
templateData={templateData}
|
|
@@ -34,12 +34,12 @@ describe('Test SlideBoxContent container', () => {
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
it('Should render correct component for whatsapp channel create mode', () => {
|
|
37
|
-
renderFunction("WHATSAPP", "createTemplate", { mode: "create" });
|
|
37
|
+
renderFunction("WHATSAPP", "createTemplate", whatsappTemplates, { mode: "create" });
|
|
38
38
|
expect(renderedComponent).toMatchSnapshot();
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
it('Should render correct component for whatsapp channel edit mode', () => {
|
|
42
|
-
renderFunction("WHATSAPP", "editTemplate",
|
|
42
|
+
renderFunction("WHATSAPP", "editTemplate", whatsappTemplates, whatsappEditTemplateData);
|
|
43
43
|
renderedComponent.instance().onEditTemplate();
|
|
44
44
|
renderedComponent.find('CapSlideBox').props().content.props.handleClose();
|
|
45
45
|
expect(renderedComponent).toMatchSnapshot();
|
|
@@ -47,12 +47,24 @@ describe('Test SlideBoxContent container', () => {
|
|
|
47
47
|
expect(handleCloseCreatives).toHaveBeenCalledWith(true);
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
renderFunction("WHATSAPP", "editTemplate", editTemplateData);
|
|
50
|
+
it('Text getCreatives data for whatsapp', () => {
|
|
51
|
+
renderFunction("WHATSAPP", "editTemplate", whatsappTemplates, whatsappEditTemplateData);
|
|
53
52
|
renderedComponent.instance().onEditTemplate();
|
|
54
|
-
renderedComponent.find('CapSlideBox').props().content.props.getFormData(
|
|
53
|
+
renderedComponent.find('CapSlideBox').props().content.props.getFormData(whatsappEditTemplateData);
|
|
55
54
|
expect(getCreativesData).toHaveBeenCalledTimes(1);
|
|
56
55
|
expect(getCreativesData).toHaveBeenCalledWith({ channel: "WHATSAPP" });
|
|
57
56
|
});
|
|
57
|
+
|
|
58
|
+
it('Should render correct component for rcs channel create mode', () => {
|
|
59
|
+
renderFunction("RCS", "createTemplate", rcsTemplates, { mode: "create" });
|
|
60
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('Text getCreatives data for rcs', () => {
|
|
64
|
+
renderFunction("RCS", "editTemplate", rcsTemplates, rcsEditTemplateData);
|
|
65
|
+
renderedComponent.instance().onEditTemplate();
|
|
66
|
+
renderedComponent.find('CapSlideBox').props().content.props.getFormData(rcsEditTemplateData);
|
|
67
|
+
expect(getCreativesData).toHaveBeenCalledTimes(1);
|
|
68
|
+
expect(getCreativesData).toHaveBeenCalledWith({ channel: "RCS" });
|
|
69
|
+
});
|
|
58
70
|
});
|
|
@@ -60,6 +60,7 @@ import {
|
|
|
60
60
|
NO_CALL_TO_ACTION,
|
|
61
61
|
} from './constant';
|
|
62
62
|
import cloneDeep from 'lodash/cloneDeep';
|
|
63
|
+
import { FACEBOOK } from "../../CreativesContainer/constants";
|
|
63
64
|
export const Advertisement = (props) => {
|
|
64
65
|
const CarouselContainer = styled.div`
|
|
65
66
|
width: ${(styledProps) => styledProps.width || '22px'};
|
|
@@ -366,7 +367,7 @@ export const Advertisement = (props) => {
|
|
|
366
367
|
},
|
|
367
368
|
},
|
|
368
369
|
},
|
|
369
|
-
type:
|
|
370
|
+
type: FACEBOOK,
|
|
370
371
|
name: messageTitle,
|
|
371
372
|
};
|
|
372
373
|
if (!isFullMode) {
|
|
@@ -441,7 +442,7 @@ export const Advertisement = (props) => {
|
|
|
441
442
|
value: formatSubmitPayload(),
|
|
442
443
|
_id: params && params.id,
|
|
443
444
|
validity: true,
|
|
444
|
-
type:
|
|
445
|
+
type: FACEBOOK,
|
|
445
446
|
});
|
|
446
447
|
}, [carouselData,
|
|
447
448
|
pageId,
|
|
@@ -558,6 +559,7 @@ export const Advertisement = (props) => {
|
|
|
558
559
|
className={`cap-image-upload-${selectedAd}`}
|
|
559
560
|
key={`${index}-fb-image-upload`}
|
|
560
561
|
imageData={fbADData}
|
|
562
|
+
channel={FACEBOOK}
|
|
561
563
|
/> :
|
|
562
564
|
<CapVideoUpload
|
|
563
565
|
style={{paddingBottom: '21px'}}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RCS,
|
|
3
|
+
UPLOAD_RCS_ASSET_REQUEST,
|
|
4
|
+
CLEAR_RCS_ASSET,
|
|
5
|
+
CREATE_RCS_TEMPLATE_REQUEST,
|
|
6
|
+
CLEAR_CREATE_RESPONSE_REQUEST,
|
|
7
|
+
GET_RCS_TEMPLATE_DETAILS_REQUEST,
|
|
8
|
+
CLEAR_EDIT_RESPONSE_REQUEST,
|
|
9
|
+
EDIT_RCS_TEMPLATE_REQUEST,
|
|
10
|
+
} from './constants';
|
|
11
|
+
|
|
12
|
+
export const uploadRcsAsset = (file, assetType, fileParams, templateType) => ({
|
|
13
|
+
type: UPLOAD_RCS_ASSET_REQUEST,
|
|
14
|
+
file,
|
|
15
|
+
assetType,
|
|
16
|
+
fileParams,
|
|
17
|
+
templateType,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const clearRcsAsset = (templateType) => ({
|
|
21
|
+
type: CLEAR_RCS_ASSET,
|
|
22
|
+
templateType,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const clearCreateResponse = () => ({
|
|
26
|
+
type: CLEAR_CREATE_RESPONSE_REQUEST,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const createTemplate = (template, callback) => ({
|
|
30
|
+
type: CREATE_RCS_TEMPLATE_REQUEST,
|
|
31
|
+
template,
|
|
32
|
+
callback,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// FOR EDIT
|
|
36
|
+
export function getTemplateDetails(id, callback) {
|
|
37
|
+
return {
|
|
38
|
+
type: GET_RCS_TEMPLATE_DETAILS_REQUEST,
|
|
39
|
+
id,
|
|
40
|
+
channel: RCS,
|
|
41
|
+
callback,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function editTemplate(template, callback) {
|
|
46
|
+
return {
|
|
47
|
+
type: EDIT_RCS_TEMPLATE_REQUEST,
|
|
48
|
+
template,
|
|
49
|
+
callback,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function clearEditResponse() {
|
|
54
|
+
return {
|
|
55
|
+
type: CLEAR_EDIT_RESPONSE_REQUEST,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export const RCS = 'RCS';
|
|
2
|
+
export const SMS = 'SMS';
|
|
3
|
+
export const MEDIUM = 'MEDIUM';
|
|
4
|
+
export const VERTICAL = 'VERTICAL';
|
|
5
|
+
export const RIGHT = 'RIGHT';
|
|
6
|
+
export const STANDALONE = 'STANDALONE';
|
|
7
|
+
export const RICHCARD = 'RICHCARD';
|
|
8
|
+
export const RCS_MEDIA_TYPES = {
|
|
9
|
+
NONE: 'NONE',
|
|
10
|
+
IMAGE: 'IMAGE',
|
|
11
|
+
VIDEO: 'VIDEO',
|
|
12
|
+
};
|
|
13
|
+
export const RCS_DLT_MODE = {
|
|
14
|
+
TEMPLATES: 'templates',
|
|
15
|
+
EDIT: 'editTemplate',
|
|
16
|
+
};
|
|
17
|
+
export const TEMPLATE_MESSAGE_MAX_LENGTH = 1000;
|
|
18
|
+
export const FALLBACK_MESSAGE_MAX_LENGTH = 160;
|
|
19
|
+
export const TAG = 'TAG';
|
|
20
|
+
export const EMBEDDED = 'embedded';
|
|
21
|
+
export const DEFAULT = 'default';
|
|
22
|
+
export const FULL = 'full';
|
|
23
|
+
export const ALL = 'all';
|
|
24
|
+
export const LIBRARY = 'library';
|
|
25
|
+
export const ALLOWED_IMAGE_EXTENSIONS_REGEX = /\.(jpe?g|png)$/i;
|
|
26
|
+
export const RCS_IMG_WIDTH = 1440;
|
|
27
|
+
export const RCS_IMG_HEIGHT = 720;
|
|
28
|
+
export const RCS_IMG_SIZE = 2000000; // 2MB
|
|
29
|
+
|
|
30
|
+
const prefix = 'app/v2Containers/Rcs';
|
|
31
|
+
export const UPLOAD_RCS_ASSET_REQUEST = `${prefix}/UPLOAD_RCS_ASSET_REQUEST`;
|
|
32
|
+
export const UPLOAD_RCS_ASSET_SUCCESS = `${prefix}/UPLOAD_RCS_ASSET_SUCCESS`;
|
|
33
|
+
export const UPLOAD_RCS_ASSET_FAILURE = `${prefix}/UPLOAD_RCS_ASSET_FAILURE`;
|
|
34
|
+
export const CLEAR_RCS_ASSET = `${prefix}/CLEAR_RCS_ASSET`;
|
|
35
|
+
|
|
36
|
+
export const CREATE_RCS_TEMPLATE_REQUEST = `${prefix}/CREATE_RCS_TEMPLATE_REQUEST`;
|
|
37
|
+
export const CREATE_RCS_TEMPLATE_SUCCESS = `${prefix}/CREATE_RCS_TEMPLATE_SUCCESS`;
|
|
38
|
+
export const CREATE_RCS_TEMPLATE_FAILURE = `${prefix}/CREATE_RCS_TEMPLATE_FAILURE`;
|
|
39
|
+
export const CLEAR_CREATE_RESPONSE_REQUEST = `${prefix}/Create/CLEAR_CREATE_RESPONSE_REQUEST`;
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
export const GET_RCS_TEMPLATE_DETAILS_REQUEST = `${prefix}/GET_RCS_TEMPLATE_DETAILS_REQUEST`;
|
|
43
|
+
export const GET_RCS_TEMPLATE_DETAILS_SUCCESS = `${prefix}/GET_RCS_TEMPLATE_DETAILS_SUCCESS`;
|
|
44
|
+
export const GET_RCS_TEMPLATE_DETAILS_FAILURE = `${prefix}/GET_RCS_TEMPLATE_DETAILS_FAILURE`;
|
|
45
|
+
|
|
46
|
+
export const EDIT_RCS_TEMPLATE_REQUEST = `${prefix}/EDIT_RCS_TEMPLATE_REQUEST`;
|
|
47
|
+
export const EDIT_RCS_TEMPLATE_SUCCESS = `${prefix}/EDIT_RCS_TEMPLATE_SUCCESS`;
|
|
48
|
+
export const EDIT_RCS_TEMPLATE_FAILURE = `${prefix}/EDIT_RCS_TEMPLATE_FAILURE`;
|
|
49
|
+
export const CLEAR_EDIT_RESPONSE_REQUEST = `${prefix}/Edit/CLEAR_EDIT_RESPONSE_REQUEST`;
|
|
50
|
+
|