@capillarytech/creatives-library 2.0.74 → 2.0.75
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/v2Containers/TemplatesV2/index.js +1 -1
- package/components/EmailPreview/assets/images/iPad.svg +0 -10
- package/components/EmailPreview/assets/images/mobile.png +0 -0
- package/components/FormBuilder/test +0 -1845
- package/containers/CallTask/_callTask.scss +0 -5
- package/containers/CallTask/actions.js +0 -15
- package/containers/CallTask/constants.js +0 -7
- package/containers/CallTask/index.js +0 -141
- package/containers/CallTask/messages.js +0 -21
- package/containers/CallTask/reducer.js +0 -23
- package/containers/CallTask/sagas.js +0 -11
- package/containers/CallTask/selectors.js +0 -25
- package/containers/CallTask/tests/actions.test.js +0 -18
- package/containers/CallTask/tests/index.test.js +0 -10
- package/containers/CallTask/tests/reducer.test.js +0 -9
- package/containers/CallTask/tests/sagas.test.js +0 -15
- package/containers/CallTask/tests/selectors.test.js +0 -10
- package/containers/ChannelTemplates/actions.js +0 -20
- package/containers/ChannelTemplates/constants.js +0 -8
- package/containers/ChannelTemplates/index.js +0 -48
- package/containers/ChannelTemplates/messages.js +0 -13
- package/containers/ChannelTemplates/reducer.js +0 -34
- package/containers/ChannelTemplates/sagas.js +0 -32
- package/containers/ChannelTemplates/selectors.js +0 -25
- package/containers/ChannelTemplates/tests/actions.test.js +0 -18
- package/containers/ChannelTemplates/tests/index.test.js +0 -10
- package/containers/ChannelTemplates/tests/reducer.test.js +0 -9
- package/containers/ChannelTemplates/tests/sagas.test.js +0 -15
- package/containers/ChannelTemplates/tests/selectors.test.js +0 -10
- package/containers/CreativesContainer/SlideBoxContent.js +0 -248
- package/containers/CreativesContainer/SlideBoxFooter.js +0 -38
- package/containers/CreativesContainer/SlideBoxHeader.js +0 -65
- package/containers/CreativesContainer/actions.js +0 -27
- package/containers/CreativesContainer/constants.js +0 -13
- package/containers/CreativesContainer/index.js +0 -418
- package/containers/CreativesContainer/index.scss +0 -27
- package/containers/CreativesContainer/messages.js +0 -17
- package/containers/CreativesContainer/reducer.js +0 -29
- package/containers/CreativesContainer/sagas.js +0 -11
- package/containers/CreativesContainer/selectors.js +0 -30
- package/containers/CreativesContainer/tests/actions.test.js +0 -18
- package/containers/CreativesContainer/tests/index.test.js +0 -10
- package/containers/CreativesContainer/tests/reducer.test.js +0 -9
- package/containers/CreativesContainer/tests/sagas.test.js +0 -15
- package/containers/CreativesContainer/tests/selectors.test.js +0 -10
- package/containers/EmailWrapper/actions.js +0 -15
- package/containers/EmailWrapper/constants.js +0 -7
- package/containers/EmailWrapper/index.js +0 -238
- package/containers/EmailWrapper/messages.js +0 -57
- package/containers/EmailWrapper/reducer.js +0 -23
- package/containers/EmailWrapper/sagas.js +0 -11
- package/containers/EmailWrapper/selectors.js +0 -25
- package/containers/EmailWrapper/tests/actions.test.js +0 -18
- package/containers/EmailWrapper/tests/index.test.js +0 -10
- package/containers/EmailWrapper/tests/reducer.test.js +0 -9
- package/containers/EmailWrapper/tests/sagas.test.js +0 -15
- package/containers/EmailWrapper/tests/selectors.test.js +0 -10
- package/containers/MobilePush/commonMethods.js +0 -249
- package/containers/MobilePush/eventsMap.js +0 -127
- package/containers/MobilePush/initialSchema.js +0 -1739
- package/containers/MobilepushWrapper/_mobilepushWrapper.scss +0 -18
- package/containers/MobilepushWrapper/index.js +0 -97
- package/containers/MobilepushWrapper/messages.js +0 -25
- package/containers/MobilepushWrapper/tests/index.test.js +0 -10
- package/containers/TemplatesV2/_templatesV2.scss +0 -5
- package/containers/TemplatesV2/actions.js +0 -16
- package/containers/TemplatesV2/constants.js +0 -10
- package/containers/TemplatesV2/index.js +0 -207
- package/containers/TemplatesV2/messages.js +0 -29
- package/containers/TemplatesV2/selectors.js +0 -25
- package/containers/TemplatesV2/tests/actions.test.js +0 -18
- package/containers/TemplatesV2/tests/index.test.js +0 -10
- package/containers/TemplatesV2/tests/reducer.test.js +0 -9
- package/containers/TemplatesV2/tests/sagas.test.js +0 -15
- package/containers/TemplatesV2/tests/selectors.test.js +0 -10
- package/containers/WeChat/RichmediaTemplates/Create/testschema.js +0 -379
- package/containers/WeChat/_wechat.scss +0 -8
- package/containers/WeChat/actions.js +0 -52
- package/containers/WeChat/constants.js +0 -28
- package/containers/WeChat/index.js +0 -1635
- package/containers/WeChat/messages.js +0 -73
- package/containers/WeChat/reducer.js +0 -74
- package/containers/WeChat/sagas.js +0 -86
- package/containers/WeChat/selectors.js +0 -25
- package/containers/WeChat/tests/actions.test.js +0 -18
- package/containers/WeChat/tests/index.test.js +0 -10
- package/containers/WeChat/tests/reducer.test.js +0 -9
- package/containers/WeChat/tests/sagas.test.js +0 -15
- package/containers/WeChat/tests/selectors.test.js +0 -10
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* EmailWrapper
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { connect } from 'react-redux';
|
|
9
|
-
import { FormattedMessage, injectIntl, intlShape } from 'react-intl';
|
|
10
|
-
import { createStructuredSelector } from 'reselect';
|
|
11
|
-
import { bindActionCreators } from 'redux';
|
|
12
|
-
import _ from 'lodash';
|
|
13
|
-
import { CapRadioCard, CapHeader, CapNotification, CapInput, CapUploader, CapSpin, CapButton} from '@capillarytech/cap-ui-library';
|
|
14
|
-
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
15
|
-
import {selectEmailLayout, selectCmsTemplates, selectEdmEditor, uploadSelector} from '../Templates/selectors';
|
|
16
|
-
import * as templatesActionsCreators from '../Templates/actions';
|
|
17
|
-
import Email from '../Email';
|
|
18
|
-
import CmsTemplatesComponent from '../../components/CmsTemplatesComponent';
|
|
19
|
-
import messages from './messages';
|
|
20
|
-
export class EmailWrapper extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
21
|
-
constructor(props) {
|
|
22
|
-
super(props);
|
|
23
|
-
this.emailUploader = React.createRef();
|
|
24
|
-
this.state = {
|
|
25
|
-
templateName: '',
|
|
26
|
-
routeParams: {
|
|
27
|
-
pathname: `/email/create`,
|
|
28
|
-
query: { module: 'library', type: 'embedded'},
|
|
29
|
-
},
|
|
30
|
-
modeContent: {
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
// selectedCreateMode: '',
|
|
34
|
-
|
|
35
|
-
};
|
|
36
|
-
this.modes = [
|
|
37
|
-
{
|
|
38
|
-
title: <FormattedMessage {...messages.zipUpload}/>,
|
|
39
|
-
content: <FormattedMessage {...messages.zipUploadDesc}/>,
|
|
40
|
-
value: 'upload',
|
|
41
|
-
// onClick: () => {
|
|
42
|
-
// this.emailUploader.current.click();
|
|
43
|
-
// },
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
title: <FormattedMessage {...messages.useEditor}/>,
|
|
47
|
-
content: <FormattedMessage {...messages.useEditorDesc}/>,
|
|
48
|
-
value: 'editor',
|
|
49
|
-
},
|
|
50
|
-
];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
componentDidUpdate() {
|
|
54
|
-
const {modeContent} = this.state;
|
|
55
|
-
// const isValid = this.isValid();
|
|
56
|
-
const {emailCreateMode, EmailLayout, CmsTemplates, step, SelectedEdmDefaultTemplate, templatesActions} = this.props;
|
|
57
|
-
if (step === "modeSelection" && !this.state.selectedCreateMode && emailCreateMode === 'upload' && !EmailLayout) {
|
|
58
|
-
//document.getElementById('upload-email-template').click();
|
|
59
|
-
} else if (step === "templateSelection" && !this.state.selectedCreateMode) {
|
|
60
|
-
if (emailCreateMode === "editor" && !CmsTemplates) {
|
|
61
|
-
templatesActions.getEdmDefaultTemplates();
|
|
62
|
-
}
|
|
63
|
-
} else if (step === "createTemplateContent" && !this.state.selectedCreateMode) {
|
|
64
|
-
if (emailCreateMode === 'upload' && !_.isEmpty(EmailLayout)) {
|
|
65
|
-
this.setCreateMode('upload');
|
|
66
|
-
} else if (emailCreateMode === "editor" && _.isEmpty(SelectedEdmDefaultTemplate)) {
|
|
67
|
-
this.handleEdmDefaultTemplateSelection(modeContent.id);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
componentWillUnmount() {
|
|
74
|
-
this.props.onResetStep();
|
|
75
|
-
this.props.templatesActions.resetTemplateData();
|
|
76
|
-
}
|
|
77
|
-
onTemplateNameChange = (ev) => {
|
|
78
|
-
this.setState({templateName: ev.target.value});
|
|
79
|
-
}
|
|
80
|
-
onChange = (e) => {
|
|
81
|
-
this.props.onEmailModeChange( e.target.value );
|
|
82
|
-
};
|
|
83
|
-
//isValid = () => !_.isEmpty(this.state.templateName)
|
|
84
|
-
setCreateMode = (emailCreateMode) => {
|
|
85
|
-
this.setState({selectedCreateMode: emailCreateMode});
|
|
86
|
-
}
|
|
87
|
-
handleZipUploadError = () => {
|
|
88
|
-
const message = {
|
|
89
|
-
key: "email-upload-error",
|
|
90
|
-
message: this.props.intl.formatMessage(messages.invalidUploadFileError2),
|
|
91
|
-
description: this.props.intl.formatMessage(messages.invalidUploadFileErrorDesc2),
|
|
92
|
-
};
|
|
93
|
-
CapNotification.error(message);
|
|
94
|
-
}
|
|
95
|
-
handleFileUpload = (file) => {
|
|
96
|
-
const { templatesActions, intl, showNextStep, isUploading } = this.props;
|
|
97
|
-
if (!isUploading) {
|
|
98
|
-
const fileExtension = file.name.split('.').pop();
|
|
99
|
-
const supportedZipFormats = ['zip'];
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (supportedZipFormats.indexOf(fileExtension.toLowerCase()) !== -1) {
|
|
103
|
-
templatesActions.handleZipUpload(file.originFileObj, () => { //handle upload success
|
|
104
|
-
this.setState({modeContent: { file}}, showNextStep);
|
|
105
|
-
}, this.handleZipUploadError);
|
|
106
|
-
} else if (fileExtension === 'html' || fileExtension === 'htm') {
|
|
107
|
-
const reader = new FileReader();
|
|
108
|
-
reader.onload = () => {
|
|
109
|
-
const text = reader.result;
|
|
110
|
-
this.setState({modeContent: { file}}, () => {
|
|
111
|
-
templatesActions.handleHtmlUpload(text);
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
// showNextStep();
|
|
115
|
-
};
|
|
116
|
-
reader.readAsText(file.originFileObj);
|
|
117
|
-
} else {
|
|
118
|
-
const message = {
|
|
119
|
-
key: "email-upload-error",
|
|
120
|
-
message: intl.formatMessage(messages.invalidUploadFileError),
|
|
121
|
-
description: intl.formatMessage(messages.invalidUploadFileErrorDesc),
|
|
122
|
-
};
|
|
123
|
-
CapNotification.error(message);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
handleEdmDefaultTemplateSelection = (id) => {
|
|
129
|
-
const {CmsTemplates, templatesActions } = this.props;
|
|
130
|
-
const data = _.find(CmsTemplates, {_id: id});
|
|
131
|
-
|
|
132
|
-
templatesActions.setEdmTemplate(data);
|
|
133
|
-
this.setState({
|
|
134
|
-
selectedCreateMode: 'editor'});
|
|
135
|
-
};
|
|
136
|
-
useFileUpload = ({file}) => {
|
|
137
|
-
this.setState({modeContent: {}}, () => {
|
|
138
|
-
this.handleFileUpload(file);
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
useEditor = (id) => {
|
|
142
|
-
this.setState({modeContent: {id}}, this.props.showNextStep);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
isShowEmailCreate = () => !_.isEmpty(this.state.selectedCreateMode) && (!_.isEmpty(this.props.EmailLayout) || this.props.SelectedEdmDefaultTemplate)
|
|
146
|
-
render() {
|
|
147
|
-
const {emailCreateMode, isGetFormData, getFormdata, type, CmsTemplates, step, cap, isFullMode, EmailLayout, setIsLoadingContent} = this.props;
|
|
148
|
-
const {templateName, modeContent} = this.state;
|
|
149
|
-
const isShowEmailCreate = this.isShowEmailCreate();
|
|
150
|
-
return (
|
|
151
|
-
<div>
|
|
152
|
-
<CapSpin spinning={emailCreateMode === "upload" ? this.props.isUploading : false} >
|
|
153
|
-
{step === "modeSelection" || (step === "templateSelection" && emailCreateMode === "upload") ?
|
|
154
|
-
<div>
|
|
155
|
-
{isFullMode &&
|
|
156
|
-
<CapInput
|
|
157
|
-
label={<FormattedMessage {...messages.creativeName}/>}
|
|
158
|
-
onChange={this.onTemplateNameChange}
|
|
159
|
-
value={templateName}
|
|
160
|
-
labelPosition="top"/>
|
|
161
|
-
}
|
|
162
|
-
<CapHeader size="small" title={<FormattedMessage {...messages.createMode}/>}/>
|
|
163
|
-
<CapRadioCard
|
|
164
|
-
panes={this.modes}
|
|
165
|
-
onChange={this.onChange}
|
|
166
|
-
selected={emailCreateMode}
|
|
167
|
-
/>
|
|
168
|
-
<div>
|
|
169
|
-
{emailCreateMode === "upload" &&
|
|
170
|
-
<div style={{ marginLeft: '8px'}}>
|
|
171
|
-
<CapUploader onChange={this.useFileUpload} accept=".zip, .html, .htm" showUploadList={false}>
|
|
172
|
-
<CapButton>Upload</CapButton>
|
|
173
|
-
</CapUploader>
|
|
174
|
-
{!_.isEmpty(EmailLayout) &&
|
|
175
|
-
<div>{_.get(modeContent, "file.name")}</div>
|
|
176
|
-
}
|
|
177
|
-
</div>
|
|
178
|
-
}
|
|
179
|
-
</div>
|
|
180
|
-
</div>
|
|
181
|
-
:
|
|
182
|
-
<div>
|
|
183
|
-
{isShowEmailCreate && <Email
|
|
184
|
-
setIsLoadingContent={setIsLoadingContent}
|
|
185
|
-
key="email-create-template"
|
|
186
|
-
location={this.state.routeParams}
|
|
187
|
-
route={{ name: 'email' }}
|
|
188
|
-
params={{}}
|
|
189
|
-
isGetFormData={isGetFormData}
|
|
190
|
-
getFormdata={getFormdata}
|
|
191
|
-
getFormSubscriptionData={getFormdata}
|
|
192
|
-
getDefaultTags={type}
|
|
193
|
-
defaultData={{templateName}}
|
|
194
|
-
cap={cap}
|
|
195
|
-
/>}
|
|
196
|
-
{CmsTemplates && !isShowEmailCreate && <CmsTemplatesComponent cmsTemplates={CmsTemplates} handleEdmDefaultTemplateSelection={this.useEditor}/>}
|
|
197
|
-
</div>
|
|
198
|
-
}
|
|
199
|
-
</CapSpin>
|
|
200
|
-
</div>
|
|
201
|
-
);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
EmailWrapper.propTypes = {
|
|
206
|
-
onEmailModeChange: PropTypes.func.isRequired,
|
|
207
|
-
isGetFormData: PropTypes.bool,
|
|
208
|
-
type: PropTypes.string,
|
|
209
|
-
emailCreateMode: PropTypes.string,
|
|
210
|
-
EmailLayout: PropTypes.object,
|
|
211
|
-
templatesActions: PropTypes.object,
|
|
212
|
-
CmsTemplates: PropTypes.arrayOf(PropTypes.object),
|
|
213
|
-
SelectedEdmDefaultTemplate: PropTypes.object,
|
|
214
|
-
step: PropTypes.string,
|
|
215
|
-
showNextStep: PropTypes.func,
|
|
216
|
-
getFormdata: PropTypes.func,
|
|
217
|
-
intl: intlShape,
|
|
218
|
-
cap: PropTypes.object,
|
|
219
|
-
onResetStep: PropTypes.func,
|
|
220
|
-
isFullMode: PropTypes.bool,
|
|
221
|
-
isUploading: PropTypes.bool,
|
|
222
|
-
setIsLoadingContent: PropTypes.func,
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
const mapStateToProps = createStructuredSelector({
|
|
226
|
-
EmailLayout: selectEmailLayout(),
|
|
227
|
-
CmsTemplates: selectCmsTemplates(),
|
|
228
|
-
SelectedEdmDefaultTemplate: selectEdmEditor(),
|
|
229
|
-
isUploading: uploadSelector(),
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
function mapDispatchToProps(dispatch) {
|
|
233
|
-
return {
|
|
234
|
-
templatesActions: bindActionCreators(templatesActionsCreators, dispatch),
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(injectIntl(EmailWrapper)));
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* EmailWrapper Messages
|
|
3
|
-
*
|
|
4
|
-
* This contains all the text for the EmailWrapper component.
|
|
5
|
-
*/
|
|
6
|
-
import { defineMessages } from 'react-intl';
|
|
7
|
-
|
|
8
|
-
export default defineMessages({
|
|
9
|
-
header: {
|
|
10
|
-
id: 'app.containers.EmailWrapper.header',
|
|
11
|
-
defaultMessage: 'This is EmailWrapper container !',
|
|
12
|
-
},
|
|
13
|
-
useEditor: {
|
|
14
|
-
id: 'app.containers.EmailWrapper.useEditor',
|
|
15
|
-
defaultMessage: 'Create using editor',
|
|
16
|
-
},
|
|
17
|
-
useEditorDesc: {
|
|
18
|
-
id: 'app.containers.EmailWrapper.useEditorDesc',
|
|
19
|
-
defaultMessage: 'Create using in-built template',
|
|
20
|
-
},
|
|
21
|
-
zipUpload: {
|
|
22
|
-
id: 'app.containers.EmailWrapper.zipUpload',
|
|
23
|
-
defaultMessage: 'Upload zip file',
|
|
24
|
-
},
|
|
25
|
-
zipUploadDesc: {
|
|
26
|
-
id: 'app.containers.EmailWrapper.zipUploadDesc',
|
|
27
|
-
defaultMessage: 'Upload compressed file (Zip) containing HTML & images',
|
|
28
|
-
},
|
|
29
|
-
creativeName: {
|
|
30
|
-
id: 'app.containers.EmailWrapper.creativeName',
|
|
31
|
-
defaultMessage: 'Creative name',
|
|
32
|
-
},
|
|
33
|
-
createMode: {
|
|
34
|
-
id: 'app.containers.EmailWrapper.createMode',
|
|
35
|
-
defaultMessage: 'How do you want to create ?',
|
|
36
|
-
},
|
|
37
|
-
invalidUploadFileError: {
|
|
38
|
-
id: `app.containers.EmailWrapper.invalidUploadFileError`,
|
|
39
|
-
defaultMessage: `File cannot be uploaded.`,
|
|
40
|
-
},
|
|
41
|
-
invalidUploadFileErrorDesc: {
|
|
42
|
-
id: `app.containers.EmailWrapper.invalidUploadFileDesc`,
|
|
43
|
-
defaultMessage: `Please select another file with valid file format.`,
|
|
44
|
-
},
|
|
45
|
-
invalidUploadFileError2: {
|
|
46
|
-
id: `app.containers.EmailWrapper.invalidUploadFileError`,
|
|
47
|
-
defaultMessage: `File upload failed`,
|
|
48
|
-
},
|
|
49
|
-
invalidUploadFileErrorDesc2: {
|
|
50
|
-
id: `app.containers.EmailWrapper.invalidUploadFileDesc`,
|
|
51
|
-
defaultMessage: `Please select another file with valid file contents`,
|
|
52
|
-
},
|
|
53
|
-
upload: {
|
|
54
|
-
id: `app.containers.EmailWrapper.upload`,
|
|
55
|
-
defaultMessage: `Upload`,
|
|
56
|
-
},
|
|
57
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* EmailWrapper reducer
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { fromJS } from 'immutable';
|
|
8
|
-
import {
|
|
9
|
-
DEFAULT_ACTION,
|
|
10
|
-
} from './constants';
|
|
11
|
-
|
|
12
|
-
const initialState = fromJS({});
|
|
13
|
-
|
|
14
|
-
function emailWrapperReducer(state = initialState, action) {
|
|
15
|
-
switch (action.type) {
|
|
16
|
-
case DEFAULT_ACTION:
|
|
17
|
-
return state;
|
|
18
|
-
default:
|
|
19
|
-
return state;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default emailWrapperReducer;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// import { take, call, put, select } from 'redux-saga/effects';
|
|
2
|
-
|
|
3
|
-
// Individual exports for testing
|
|
4
|
-
export function* defaultSaga() {
|
|
5
|
-
// See example in containers/HomePage/sagas.js
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// All sagas to be loaded
|
|
9
|
-
export default [
|
|
10
|
-
defaultSaga,
|
|
11
|
-
];
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { createSelector } from 'reselect';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Direct selector to the emailWrapper state domain
|
|
5
|
-
*/
|
|
6
|
-
const selectEmailWrapperDomain = () => (state) => state.get('emailWrapper');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Other specific selectors
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Default selector used by EmailWrapper
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const makeSelectEmailWrapper = () => createSelector(
|
|
18
|
-
selectEmailWrapperDomain(),
|
|
19
|
-
(substate) => substate.toJS()
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
export default makeSelectEmailWrapper;
|
|
23
|
-
export {
|
|
24
|
-
selectEmailWrapperDomain,
|
|
25
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
defaultAction,
|
|
4
|
-
} from '../actions';
|
|
5
|
-
import {
|
|
6
|
-
DEFAULT_ACTION,
|
|
7
|
-
} from '../constants';
|
|
8
|
-
|
|
9
|
-
describe('EmailWrapper actions', () => {
|
|
10
|
-
describe('Default Action', () => {
|
|
11
|
-
it('has a type of DEFAULT_ACTION', () => {
|
|
12
|
-
const expected = {
|
|
13
|
-
type: DEFAULT_ACTION,
|
|
14
|
-
};
|
|
15
|
-
expect(defaultAction()).toEqual(expected);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test sagas
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/* eslint-disable redux-saga/yield-effects */
|
|
6
|
-
// import { take, call, put, select } from 'redux-saga/effects';
|
|
7
|
-
// import { defaultSaga } from '../sagas';
|
|
8
|
-
|
|
9
|
-
// const generator = defaultSaga();
|
|
10
|
-
|
|
11
|
-
describe('defaultSaga Saga', () => {
|
|
12
|
-
it('Expect to have unit tests specified', () => {
|
|
13
|
-
expect(true).toEqual(false);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// import { fromJS } from 'immutable';
|
|
2
|
-
// import { makeSelectEmailWrapperDomain } from '../selectors';
|
|
3
|
-
|
|
4
|
-
// const selector = makeSelectEmailWrapperDomain();
|
|
5
|
-
|
|
6
|
-
describe('makeSelectEmailWrapperDomain', () => {
|
|
7
|
-
it('Expect to have unit tests specified', () => {
|
|
8
|
-
expect(true).toEqual(false);
|
|
9
|
-
});
|
|
10
|
-
});
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import {get, filter, cloneDeep} from 'lodash';
|
|
2
|
-
|
|
3
|
-
function getPrimaryCtaFields({inputFields, fieldIndex, deepLinkOptions}) {
|
|
4
|
-
const newInputFields = cloneDeep(inputFields);
|
|
5
|
-
newInputFields.splice(fieldIndex + 1, 0, {
|
|
6
|
-
rowClassName: 'mobile-push-row',
|
|
7
|
-
identifier: `cta-deeplink${this.state.currentTab > 1 ? this.state.currentTab : ''}`,
|
|
8
|
-
|
|
9
|
-
cols: [
|
|
10
|
-
{
|
|
11
|
-
id: `cta-deeplink${this.state.currentTab > 1 ? this.state.currentTab : ''}`,
|
|
12
|
-
type: "radioGroup", //Resembles component to be used
|
|
13
|
-
metaType: "text",
|
|
14
|
-
datatype: "string",
|
|
15
|
-
options: ["Deeplink", "External Link"],
|
|
16
|
-
inductiveText: ["A page within mobile app", "An external web page"],
|
|
17
|
-
value: "Deeplink",
|
|
18
|
-
required: true,
|
|
19
|
-
width: 18,
|
|
20
|
-
offset: 1,
|
|
21
|
-
errorMessage: "Please select link type",
|
|
22
|
-
fluid: true,
|
|
23
|
-
styling: "semantic",
|
|
24
|
-
order: 1,
|
|
25
|
-
customComponent: false,
|
|
26
|
-
supportedEvents: ["onChange"],
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
],
|
|
30
|
-
});
|
|
31
|
-
newInputFields.splice(fieldIndex + 2, 0, {
|
|
32
|
-
rowClassName: 'mobile-push-row',
|
|
33
|
-
id: 'cta-deeplink-select-section',
|
|
34
|
-
identifier: `cta-deeplink${this.state.currentTab > 1 ? this.state.currentTab : ''}-select`,
|
|
35
|
-
|
|
36
|
-
cols: [
|
|
37
|
-
|
|
38
|
-
{
|
|
39
|
-
id: `cta-deeplink${this.state.currentTab > 1 ? this.state.currentTab : ''}-select`,
|
|
40
|
-
placeholder: "Select DeepLink",
|
|
41
|
-
type: "select", //Resembles component to be used
|
|
42
|
-
options: deepLinkOptions,
|
|
43
|
-
metaType: "text",
|
|
44
|
-
datatype: "string",
|
|
45
|
-
required: true,
|
|
46
|
-
errorMessage: "Select a deeplink",
|
|
47
|
-
fluid: true,
|
|
48
|
-
width: 18,
|
|
49
|
-
offset: 1,
|
|
50
|
-
style: {
|
|
51
|
-
width: '100%',
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
marginBottom: '16px',
|
|
55
|
-
},
|
|
56
|
-
styling: "semantic",
|
|
57
|
-
order: 1,
|
|
58
|
-
customComponent: false,
|
|
59
|
-
supportedEvents: [
|
|
60
|
-
'onSelect',
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
});
|
|
65
|
-
return newInputFields;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function getSecondaryCtaFields({inputFields, fieldIndex, deepLinkOptions}) {
|
|
69
|
-
const inputId = `secondary-cta-${get(inputFields[fieldIndex], 'cols[0]').fieldsCount}`;
|
|
70
|
-
const newInputFields = cloneDeep(inputFields);
|
|
71
|
-
newInputFields.splice(fieldIndex + 1, 0, {
|
|
72
|
-
rowClassName: 'mobile-push-row',
|
|
73
|
-
cols: [
|
|
74
|
-
|
|
75
|
-
{
|
|
76
|
-
id: `${inputId}-label`,
|
|
77
|
-
label: "Button label",
|
|
78
|
-
type: "input", //Resembles component to be used
|
|
79
|
-
metaType: "text",
|
|
80
|
-
datatype: "string",
|
|
81
|
-
required: true,
|
|
82
|
-
width: 18,
|
|
83
|
-
offset: 1,
|
|
84
|
-
placeholder: "Enter CTA Label here",
|
|
85
|
-
fluid: true,
|
|
86
|
-
styling: "semantic",
|
|
87
|
-
order: 1,
|
|
88
|
-
customComponent: false,
|
|
89
|
-
errorMessage: "CTA label cannot be empty.",
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
],
|
|
93
|
-
});
|
|
94
|
-
newInputFields.splice(fieldIndex + 2, 0, {
|
|
95
|
-
rowClassName: 'mobile-push-row',
|
|
96
|
-
identifier: `cta-deeplink-${inputId}`,
|
|
97
|
-
cols: [
|
|
98
|
-
|
|
99
|
-
{
|
|
100
|
-
id: `cta-deeplink-${inputId}`,
|
|
101
|
-
type: "radioGroup", //Resembles component to be used
|
|
102
|
-
metaType: "text",
|
|
103
|
-
datatype: "string",
|
|
104
|
-
options: ["Deeplink", "External Link"],
|
|
105
|
-
inductiveText: ["A page within mobile app", "An external web page"],
|
|
106
|
-
value: "Deeplink",
|
|
107
|
-
required: true,
|
|
108
|
-
width: 18,
|
|
109
|
-
offset: 1,
|
|
110
|
-
errorMessage: "Please select link type",
|
|
111
|
-
fluid: true,
|
|
112
|
-
styling: "semantic",
|
|
113
|
-
order: 1,
|
|
114
|
-
|
|
115
|
-
customComponent: false,
|
|
116
|
-
supportedEvents: ["onChange"],
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
});
|
|
120
|
-
newInputFields.splice(fieldIndex + 3, 0, {
|
|
121
|
-
rowClassName: 'mobile-push-row',
|
|
122
|
-
id: 'cta-deeplink-select-section',
|
|
123
|
-
identifier: `cta-deeplink-${inputId}-select`,
|
|
124
|
-
cols: [
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
{
|
|
128
|
-
id: `cta-deeplink-${inputId}-select`,
|
|
129
|
-
placeholder: "Select DeepLink",
|
|
130
|
-
type: "select", //Resembles component to be used
|
|
131
|
-
options: deepLinkOptions,
|
|
132
|
-
errorMessage: "Select a deeplink",
|
|
133
|
-
metaType: "text",
|
|
134
|
-
datatype: "string",
|
|
135
|
-
required: true,
|
|
136
|
-
fluid: true,
|
|
137
|
-
width: 18,
|
|
138
|
-
offset: 1,
|
|
139
|
-
style: {
|
|
140
|
-
width: '100%',
|
|
141
|
-
marginBottom: '16px',
|
|
142
|
-
},
|
|
143
|
-
styling: "semantic",
|
|
144
|
-
order: 1,
|
|
145
|
-
customComponent: false,
|
|
146
|
-
supportedEvents: [
|
|
147
|
-
'onSelect',
|
|
148
|
-
],
|
|
149
|
-
},
|
|
150
|
-
],
|
|
151
|
-
});
|
|
152
|
-
return newInputFields;
|
|
153
|
-
}
|
|
154
|
-
function getLinkTypeFields({inputFieldsArgs, fieldIndex, deepLinkOptions, formData, field}) {
|
|
155
|
-
const inputFields = cloneDeep(inputFieldsArgs);
|
|
156
|
-
const deeplinks = this.props.Templates.selectedWeChatAccount && this.props.Templates.selectedWeChatAccount.configs && !!this.props.Templates.selectedWeChatAccount.configs.deeplink ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
157
|
-
const deeplinkValue = formData[this.state.currentTab - 1][field.id];
|
|
158
|
-
const componentIndex = fieldIndex + 1;
|
|
159
|
-
const inputId = deeplinkValue && deeplinkValue.toLowerCase() === "deeplink" ? `${field.id}-select` : `${field.id}-text`;
|
|
160
|
-
if ( deeplinkValue && deeplinkValue.toLowerCase() === "deeplink" && (fieldIndex === inputFields.length - 1 || inputFields[componentIndex].id !== "cta-deeplink-select-section")) {
|
|
161
|
-
const deleteCount = get(inputFields, `[${componentIndex}].id`) === "cta-external-link" ? 1 : 0;
|
|
162
|
-
inputFields.splice(componentIndex, deleteCount, {
|
|
163
|
-
rowClassName: 'mobile-push-row',
|
|
164
|
-
id: 'cta-deeplink-select-section',
|
|
165
|
-
identifier: inputId,
|
|
166
|
-
cols: [
|
|
167
|
-
|
|
168
|
-
{
|
|
169
|
-
id: inputId,
|
|
170
|
-
placeholder: "Select DeepLink",
|
|
171
|
-
type: "select", //Resembles component to be used
|
|
172
|
-
options: deepLinkOptions,
|
|
173
|
-
metaType: "text",
|
|
174
|
-
datatype: "string",
|
|
175
|
-
errorMessage: "Select a deeplink",
|
|
176
|
-
required: true,
|
|
177
|
-
fluid: true,
|
|
178
|
-
width: 18,
|
|
179
|
-
offset: 1,
|
|
180
|
-
style: {
|
|
181
|
-
width: '100%',
|
|
182
|
-
|
|
183
|
-
marginBottom: '16px',
|
|
184
|
-
},
|
|
185
|
-
styling: "semantic",
|
|
186
|
-
order: 1,
|
|
187
|
-
customComponent: false,
|
|
188
|
-
supportedEvents: [
|
|
189
|
-
'onSelect',
|
|
190
|
-
],
|
|
191
|
-
},
|
|
192
|
-
],
|
|
193
|
-
});
|
|
194
|
-
} else if ( deeplinkValue && deeplinkValue.toLowerCase() === "external link") {
|
|
195
|
-
const row = {
|
|
196
|
-
rowClassName: 'mobile-push-row',
|
|
197
|
-
id: 'cta-external-link',
|
|
198
|
-
identifier: inputId,
|
|
199
|
-
|
|
200
|
-
cols: [
|
|
201
|
-
|
|
202
|
-
{
|
|
203
|
-
id: inputId,
|
|
204
|
-
placeholder: "External Link",
|
|
205
|
-
type: "input", //Resembles component to be used
|
|
206
|
-
metaType: "text",
|
|
207
|
-
datatype: "string",
|
|
208
|
-
errorMessage: "External Link cannot be empty",
|
|
209
|
-
required: true,
|
|
210
|
-
fluid: true,
|
|
211
|
-
width: 18,
|
|
212
|
-
offset: 1,
|
|
213
|
-
style: {
|
|
214
|
-
width: '100%',
|
|
215
|
-
|
|
216
|
-
marginBottom: '16px',
|
|
217
|
-
},
|
|
218
|
-
styling: "semantic",
|
|
219
|
-
order: 1,
|
|
220
|
-
customComponent: false,
|
|
221
|
-
standalone: false,
|
|
222
|
-
},
|
|
223
|
-
],
|
|
224
|
-
};
|
|
225
|
-
if (!inputFields[fieldIndex + 1] || inputFields[componentIndex].id === "cta-deeplink-select-section") {
|
|
226
|
-
inputFields[componentIndex] = row;
|
|
227
|
-
if (inputFields[componentIndex + 1] && inputFields[componentIndex + 1].id === "show-cta-deeplink-keys-label") {
|
|
228
|
-
inputFields.splice(componentIndex + 1, 1);
|
|
229
|
-
}
|
|
230
|
-
if (inputFields[componentIndex + 1] && inputFields[componentIndex + 1].id === "cta-deeplink-keys") {
|
|
231
|
-
let configkeys = filter(JSON.parse(deeplinks), (dl) => dl.link === formData[this.state.currentTab - 1][`${field.id}-select`]);
|
|
232
|
-
if (configkeys[0]) {
|
|
233
|
-
configkeys = configkeys[0].keys;
|
|
234
|
-
}
|
|
235
|
-
if (configkeys.length) {
|
|
236
|
-
//inputFields = inputFields.slice(0, componentIndex + 1).concat(inputFields.slice( componentIndex + 1 + configkeys.length, inputFields.length));
|
|
237
|
-
|
|
238
|
-
inputFields.splice(componentIndex + 1, configkeys.length);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
} else {
|
|
242
|
-
inputFields.splice(componentIndex, 0, row);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
return inputFields;
|
|
246
|
-
}
|
|
247
|
-
export {
|
|
248
|
-
getPrimaryCtaFields, getSecondaryCtaFields, getLinkTypeFields,
|
|
249
|
-
};
|