@capillarytech/creatives-library 7.10.65 → 7.10.67
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 +2 -1
- package/utils/tests/v2Common.test.js +11 -0
- package/utils/v2common.js +7 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +0 -7
- package/v2Components/TemplatePreview/index.js +4 -3
- package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +95 -0
- package/v2Components/TemplatePreview/tests/index.test.js +20 -6
- package/v2Components/WhatsappStatusContainer/tests/__snapshots__/index.test.js.snap +37 -0
- package/v2Components/WhatsappStatusContainer/tests/index.test.js +23 -0
- package/v2Components/mockdata.js +39 -0
- package/v2Containers/Cap/messages.js +5 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +1 -1
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -3
- package/v2Containers/CreativesContainer/index.js +5 -5
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +49 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +50 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +125 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +166 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +145 -0
- package/v2Containers/CreativesContainer/tests/index.test.js +54 -6
- package/v2Containers/Templates/index.js +2 -8
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +5604 -0
- package/v2Containers/Templates/tests/index.test.js +121 -6
- package/v2Containers/TemplatesV2/index.js +7 -7
- package/v2Containers/Whatsapp/constants.js +7 -1
- package/v2Containers/Whatsapp/index.js +23 -18
- package/v2Containers/Whatsapp/messages.js +0 -8
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +10594 -730
- package/v2Containers/Whatsapp/tests/index.test.js +1 -1
- package/v2Containers/Whatsapp/tests/utils.test.js +23 -0
- package/v2Containers/mockdata.js +2208 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Test SlideBoxHeader container Should render correct component for whatsapp 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 whatsapp channel edit mode 1`] = `
|
|
10
|
+
<div
|
|
11
|
+
key="creatives-container-slidebox-header-content"
|
|
12
|
+
>
|
|
13
|
+
<CapHeader
|
|
14
|
+
description={
|
|
15
|
+
<React.Fragment>
|
|
16
|
+
<SlideBoxHeader__StyledLabel
|
|
17
|
+
type="label1"
|
|
18
|
+
>
|
|
19
|
+
<FormattedMessage
|
|
20
|
+
defaultMessage="Template name"
|
|
21
|
+
id="creatives.containersV2.templateNameLabel"
|
|
22
|
+
values={Object {}}
|
|
23
|
+
/>
|
|
24
|
+
</SlideBoxHeader__StyledLabel>
|
|
25
|
+
<SlideBoxHeader__StyledLabel
|
|
26
|
+
type="label2"
|
|
27
|
+
>
|
|
28
|
+
amit123456
|
|
29
|
+
</SlideBoxHeader__StyledLabel>
|
|
30
|
+
<SlideBoxHeader__StyledLabel
|
|
31
|
+
type="label3"
|
|
32
|
+
>
|
|
33
|
+
<FormattedMessage
|
|
34
|
+
defaultMessage="|"
|
|
35
|
+
id="creatives.containersV2.Whatsapp.labelSeperator"
|
|
36
|
+
values={Object {}}
|
|
37
|
+
/>
|
|
38
|
+
</SlideBoxHeader__StyledLabel>
|
|
39
|
+
<SlideBoxHeader__StyledLabel
|
|
40
|
+
type="label1"
|
|
41
|
+
>
|
|
42
|
+
<FormattedMessage
|
|
43
|
+
defaultMessage="Template category"
|
|
44
|
+
id="creatives.containersV2.Whatsapp.templateCategoryLabel"
|
|
45
|
+
values={Object {}}
|
|
46
|
+
/>
|
|
47
|
+
</SlideBoxHeader__StyledLabel>
|
|
48
|
+
<SlideBoxHeader__StyledLabel
|
|
49
|
+
type="label2"
|
|
50
|
+
>
|
|
51
|
+
Alert Update
|
|
52
|
+
</SlideBoxHeader__StyledLabel>
|
|
53
|
+
<SlideBoxHeader__StyledLabel
|
|
54
|
+
type="label3"
|
|
55
|
+
>
|
|
56
|
+
<FormattedMessage
|
|
57
|
+
defaultMessage="|"
|
|
58
|
+
id="creatives.containersV2.Whatsapp.labelSeperator"
|
|
59
|
+
values={Object {}}
|
|
60
|
+
/>
|
|
61
|
+
</SlideBoxHeader__StyledLabel>
|
|
62
|
+
<SlideBoxHeader__StyledLabel
|
|
63
|
+
type="label1"
|
|
64
|
+
>
|
|
65
|
+
<FormattedMessage
|
|
66
|
+
defaultMessage="Language"
|
|
67
|
+
id="creatives.containersV2.Whatsapp.languageLabel"
|
|
68
|
+
values={Object {}}
|
|
69
|
+
/>
|
|
70
|
+
</SlideBoxHeader__StyledLabel>
|
|
71
|
+
<SlideBoxHeader__StyledLabel
|
|
72
|
+
type="label2"
|
|
73
|
+
>
|
|
74
|
+
<FormattedMessage
|
|
75
|
+
defaultMessage="English"
|
|
76
|
+
id="creatives.containersV2.Whatsapp.templateLanguageEnglish"
|
|
77
|
+
values={Object {}}
|
|
78
|
+
/>
|
|
79
|
+
</SlideBoxHeader__StyledLabel>
|
|
80
|
+
</React.Fragment>
|
|
81
|
+
}
|
|
82
|
+
descriptionClass=""
|
|
83
|
+
inline={false}
|
|
84
|
+
prefix={false}
|
|
85
|
+
size="large"
|
|
86
|
+
title={
|
|
87
|
+
<FormattedMessage
|
|
88
|
+
defaultMessage="WhatsApp template overview"
|
|
89
|
+
id="creatives.containersV2.Creatives.whatsappOverview"
|
|
90
|
+
values={
|
|
91
|
+
Object {
|
|
92
|
+
"channel": <FormattedMessage
|
|
93
|
+
defaultMessage="WhatsApp template"
|
|
94
|
+
id="creatives.containersV2.Creatives.whatsappTemplate"
|
|
95
|
+
values={Object {}}
|
|
96
|
+
/>,
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/>
|
|
100
|
+
}
|
|
101
|
+
titleClass=""
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
104
|
+
`;
|
|
105
|
+
|
|
106
|
+
exports[`Test SlideBoxHeader container Should render correct component for whatsapp channel preview mode 1`] = `
|
|
107
|
+
<div
|
|
108
|
+
key="creatives-container-slidebox-header-content"
|
|
109
|
+
>
|
|
110
|
+
<CapHeader
|
|
111
|
+
description={
|
|
112
|
+
<CapLabel
|
|
113
|
+
type="label3"
|
|
114
|
+
>
|
|
115
|
+
<FormattedMessage
|
|
116
|
+
defaultMessage="Last updated: {date} by {user}"
|
|
117
|
+
id="creatives.containersV2.Creatives.lastUpdated"
|
|
118
|
+
values={
|
|
119
|
+
Object {
|
|
120
|
+
"date": "17 Feb 2022",
|
|
121
|
+
"user": "Ashish Karan fd",
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/>
|
|
125
|
+
</CapLabel>
|
|
126
|
+
}
|
|
127
|
+
descriptionClass=""
|
|
128
|
+
inline={false}
|
|
129
|
+
prefix={
|
|
130
|
+
<SlideBoxHeader__PrefixWrapper>
|
|
131
|
+
<SvgBack />
|
|
132
|
+
</SlideBoxHeader__PrefixWrapper>
|
|
133
|
+
}
|
|
134
|
+
size="large"
|
|
135
|
+
title="amit123456"
|
|
136
|
+
titleClass=""
|
|
137
|
+
/>
|
|
138
|
+
</div>
|
|
139
|
+
`;
|
|
140
|
+
|
|
141
|
+
exports[`Test SlideBoxHeader container Should render correct component for whatsapp channel templates mode 1`] = `
|
|
142
|
+
<div
|
|
143
|
+
key="creatives-container-slidebox-header-content"
|
|
144
|
+
>
|
|
145
|
+
<CapHeader
|
|
146
|
+
description={
|
|
147
|
+
<FormattedMessage
|
|
148
|
+
defaultMessage="Select only one creative"
|
|
149
|
+
id="creatives.containersV2.Creatives.creativeTemplatesDesc"
|
|
150
|
+
values={Object {}}
|
|
151
|
+
/>
|
|
152
|
+
}
|
|
153
|
+
descriptionClass=""
|
|
154
|
+
inline={false}
|
|
155
|
+
size="large"
|
|
156
|
+
title={
|
|
157
|
+
<FormattedMessage
|
|
158
|
+
defaultMessage="Creative templates"
|
|
159
|
+
id="creatives.containersV2.Creatives.creativeTemplates"
|
|
160
|
+
values={Object {}}
|
|
161
|
+
/>
|
|
162
|
+
}
|
|
163
|
+
titleClass=""
|
|
164
|
+
/>
|
|
165
|
+
</div>
|
|
166
|
+
`;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Test SlideBoxContent container Should render correct component for whatsapp 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="WHATSAPP"
|
|
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="WHATSAPP"
|
|
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
|
+
|
|
74
|
+
exports[`Test SlideBoxContent container Should render correct component for whatsapp channel edit mode 1`] = `
|
|
75
|
+
<CreativesContainer__SlideBoxWrapper
|
|
76
|
+
className="add-creatives-section creatives-library-mode "
|
|
77
|
+
>
|
|
78
|
+
<CapSlideBox
|
|
79
|
+
closeIconSize="m"
|
|
80
|
+
content={
|
|
81
|
+
<SlideBoxContent
|
|
82
|
+
currentChannel="WHATSAPP"
|
|
83
|
+
getFormData={[Function]}
|
|
84
|
+
handleClose={[Function]}
|
|
85
|
+
onCallTaskSubmit={[Function]}
|
|
86
|
+
onChannelChange={[Function]}
|
|
87
|
+
onCreateComplete={[MockFunction]}
|
|
88
|
+
onCreateNew={[Function]}
|
|
89
|
+
onCreateNextStep={[Function]}
|
|
90
|
+
onEmailModeChange={[Function]}
|
|
91
|
+
onEnterTemplateName={[Function]}
|
|
92
|
+
onFTPSubmit={[MockFunction]}
|
|
93
|
+
onFacebookSubmit={[MockFunction]}
|
|
94
|
+
onMobilepushModeChange={[Function]}
|
|
95
|
+
onPreviewTemplate={[Function]}
|
|
96
|
+
onRemoveTemplateName={[Function]}
|
|
97
|
+
onResetStep={[Function]}
|
|
98
|
+
onSelectTemplate={[Function]}
|
|
99
|
+
onShowTemplates={[Function]}
|
|
100
|
+
onValidationFail={[Function]}
|
|
101
|
+
onWeChatMaptemplateStepChange={[Function]}
|
|
102
|
+
onWechatTemplateChange={[Function]}
|
|
103
|
+
saveMessage={[Function]}
|
|
104
|
+
setIsLoadingContent={[Function]}
|
|
105
|
+
showTemplateName={[Function]}
|
|
106
|
+
slidBoxContent="editTemplate"
|
|
107
|
+
templateStep="modeSelection"
|
|
108
|
+
weChatMaptemplateStep={0}
|
|
109
|
+
weChatTemplateType=""
|
|
110
|
+
/>
|
|
111
|
+
}
|
|
112
|
+
footer={
|
|
113
|
+
<SlideBoxFooter
|
|
114
|
+
currentChannel="WHATSAPP"
|
|
115
|
+
onCreateNextStep={[Function]}
|
|
116
|
+
onDiscard={[Function]}
|
|
117
|
+
onEditTemplate={[Function]}
|
|
118
|
+
onSave={[Function]}
|
|
119
|
+
shouldShowContinueFooter={[Function]}
|
|
120
|
+
shouldShowDoneFooter={[Function]}
|
|
121
|
+
slidBoxContent="editTemplate"
|
|
122
|
+
templateStep="modeSelection"
|
|
123
|
+
/>
|
|
124
|
+
}
|
|
125
|
+
handleClose={[Function]}
|
|
126
|
+
header={
|
|
127
|
+
<SlideBoxHeader
|
|
128
|
+
channel="WHATSAPP"
|
|
129
|
+
isLoadingContent={true}
|
|
130
|
+
onShowTemplates={[Function]}
|
|
131
|
+
onWeChatMaptemplateStepChange={[Function]}
|
|
132
|
+
showPrefix={true}
|
|
133
|
+
slidBoxContent="editTemplate"
|
|
134
|
+
templateNameRenderProp={[Function]}
|
|
135
|
+
templateStep="modeSelection"
|
|
136
|
+
weChatMaptemplateStep={0}
|
|
137
|
+
weChatTemplateType=""
|
|
138
|
+
/>
|
|
139
|
+
}
|
|
140
|
+
position="right"
|
|
141
|
+
show={false}
|
|
142
|
+
size="size-xl"
|
|
143
|
+
/>
|
|
144
|
+
</CreativesContainer__SlideBoxWrapper>
|
|
145
|
+
`;
|
|
@@ -1,10 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { shallowWithIntl } from '../../../helpers/intl-enzym-test-helpers';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
import { Creatives } from '../index';
|
|
5
|
+
import mockdata from '../../mockdata';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const { Templates, editTemplateData } = mockdata;
|
|
8
|
+
|
|
9
|
+
jest.mock("../../../v2Components/FormBuilder", () => ({
|
|
10
|
+
__esModule: true,
|
|
11
|
+
default: (props) => <div className="FormBuilder-mock" {...props}>FormBuilder</div>,
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
describe('Test SlideBoxContent container', () => {
|
|
15
|
+
const handleCloseCreatives = jest.fn();
|
|
16
|
+
const getCreativesData = jest.fn();
|
|
17
|
+
let renderedComponent;
|
|
18
|
+
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
jest.clearAllMocks();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const renderFunction = (channel, mode, templateData) => {
|
|
24
|
+
renderedComponent = shallowWithIntl(
|
|
25
|
+
<Creatives
|
|
26
|
+
Templates={Templates}
|
|
27
|
+
channel={channel}
|
|
28
|
+
slidBoxContent={mode}
|
|
29
|
+
templateData={templateData}
|
|
30
|
+
handleCloseCreatives={handleCloseCreatives}
|
|
31
|
+
getCreativesData={getCreativesData}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
it('Should render correct component for whatsapp channel create mode', () => {
|
|
37
|
+
renderFunction("WHATSAPP", "createTemplate", { mode: "create" });
|
|
38
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('Should render correct component for whatsapp channel edit mode', () => {
|
|
42
|
+
renderFunction("WHATSAPP", "editTemplate", editTemplateData);
|
|
43
|
+
renderedComponent.instance().onEditTemplate();
|
|
44
|
+
renderedComponent.find('CapSlideBox').props().content.props.handleClose();
|
|
45
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
46
|
+
expect(handleCloseCreatives).toHaveBeenCalledTimes(1);
|
|
47
|
+
expect(handleCloseCreatives).toHaveBeenCalledWith(true);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
it('Text getCreatives data', () => {
|
|
52
|
+
renderFunction("WHATSAPP", "editTemplate", editTemplateData);
|
|
53
|
+
renderedComponent.instance().onEditTemplate();
|
|
54
|
+
renderedComponent.find('CapSlideBox').props().content.props.getFormData(editTemplateData);
|
|
55
|
+
expect(getCreativesData).toHaveBeenCalledTimes(1);
|
|
56
|
+
expect(getCreativesData).toHaveBeenCalledWith({ channel: "WHATSAPP" });
|
|
9
57
|
});
|
|
10
58
|
});
|
|
@@ -603,7 +603,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
603
603
|
}
|
|
604
604
|
onCreateComplete = (isReloadTemplates) => {
|
|
605
605
|
this.setState({routeParams: null, previewOpen: false}, () => {
|
|
606
|
-
if (this.isFullMode() &&
|
|
606
|
+
if (this.isFullMode() && isReloadTemplates) {
|
|
607
607
|
this.getAllTemplates({params: {}}, true);
|
|
608
608
|
}
|
|
609
609
|
});
|
|
@@ -2362,10 +2362,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2362
2362
|
)
|
|
2363
2363
|
: (
|
|
2364
2364
|
<CapButton
|
|
2365
|
-
className={`create-new-${channelLowerCase}`}
|
|
2365
|
+
className={`create-new-${channelLowerCase} margin-l-8 margin-b-12`}
|
|
2366
2366
|
type={"primary"}
|
|
2367
2367
|
disabled={this.isCreateDisabled()}
|
|
2368
|
-
style={{marginLeft: '8px', marginBottom: '12px'}}
|
|
2369
2368
|
onClick={this.createTemplate}
|
|
2370
2369
|
>
|
|
2371
2370
|
{ this.props.intl.formatMessage((isTraiDltFeature && channel.toUpperCase() === SMS ) ? messages.uploadTemplate : messages.createNewActionButton) }
|
|
@@ -2552,11 +2551,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2552
2551
|
</Pagination>
|
|
2553
2552
|
{(((this.state.selectedAccount !== '' && !isEmpty(this.props.Templates.selectedWeChatAccount) && this.state.channel.toLowerCase() === 'wechat') || this.state.channel.toLowerCase() !== 'wechat') && isEmpty(this.props.TemplatesList)) && !this.props.Templates.getAllTemplatesInProgress && !isEmpty(this.state.searchText) &&
|
|
2554
2553
|
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
|
|
2555
|
-
{
|
|
2556
|
-
channel.toLowerCase() === WHATSAPP_LOWERCASE ? (
|
|
2557
|
-
<CapAlert message={whatsappCountExceedText} type="info" />
|
|
2558
|
-
) : null
|
|
2559
|
-
}
|
|
2560
2554
|
<CapHeading type="h6">{this.props.intl.formatMessage(messages.noTemplatesFound)}</CapHeading>
|
|
2561
2555
|
</div>}
|
|
2562
2556
|
</CapRow>
|