@capillarytech/creatives-library 2.0.54 → 2.0.57
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/components/CallTaskPreview/_callTaskPreview.scss +17 -0
- package/components/CallTaskPreview/images/Footer.png +0 -0
- package/components/CallTaskPreview/images/Header.png +0 -0
- package/components/CallTaskPreview/index.js +37 -0
- package/components/CallTaskPreview/messages.js +13 -0
- package/components/CallTaskPreview/tests/index.test.js +15 -0
- package/components/CapTagList/index.js +1 -1
- package/components/EmailPreviewV2/index.js +3 -1
- package/components/FormBuilder/index.js +10 -7
- package/components/NewCallTask/_newCallTask.scss +9 -0
- package/components/NewCallTask/index.js +152 -0
- package/components/NewCallTask/messages.js +29 -0
- package/components/NewCallTask/tests/index.test.js +10 -0
- package/containers/CallTask/_callTask.scss +5 -0
- package/containers/CallTask/actions.js +15 -0
- package/containers/CallTask/constants.js +7 -0
- package/containers/CallTask/index.js +141 -0
- package/containers/CallTask/messages.js +21 -0
- package/containers/CallTask/reducer.js +23 -0
- package/containers/CallTask/sagas.js +11 -0
- package/containers/CallTask/selectors.js +25 -0
- package/containers/CallTask/tests/actions.test.js +18 -0
- package/containers/CallTask/tests/index.test.js +10 -0
- package/containers/CallTask/tests/reducer.test.js +9 -0
- package/containers/CallTask/tests/sagas.test.js +15 -0
- package/containers/CallTask/tests/selectors.test.js +10 -0
- package/containers/CreativesContainer/SlideBoxContent.js +66 -3
- package/containers/CreativesContainer/SlideBoxFooter.js +3 -3
- package/containers/CreativesContainer/constants.js +2 -0
- package/containers/CreativesContainer/index.js +105 -21
- package/containers/Email/_email.scss +0 -1
- package/containers/Email/index.js +2 -0
- package/containers/Line/Edit/_lineEdit.scss +0 -4
- package/containers/MobilePush/Create/_mobilePushCreate.scss +0 -4
- package/containers/MobilePush/Create/index.js +4 -2
- package/containers/MobilePush/Edit/_mobilePushCreate.scss +0 -4
- package/containers/MobilePush/Edit/index.js +11 -8
- package/containers/MobilePush/Edit/selectors.js +2 -1
- package/containers/MobilepushWrapper/index.js +92 -0
- package/containers/MobilepushWrapper/messages.js +25 -0
- package/containers/MobilepushWrapper/tests/index.test.js +10 -0
- package/containers/Sms/Create/_smsCreate.scss +0 -1
- package/containers/Sms/Edit/actions.js +6 -0
- package/containers/Sms/Edit/constants.js +1 -0
- package/containers/Sms/Edit/index.js +1 -0
- package/containers/Sms/Edit/reducer.js +2 -0
- package/containers/TagList/index.js +3 -3
- package/containers/Templates/index.js +35 -17
- package/containers/TemplatesV2/index.js +22 -11
- package/index.js +7 -0
- package/package.json +2 -2
- package/routes.js +7 -2
- package/styles/containers/layout/_layoutPage.scss +1 -2
|
@@ -0,0 +1,15 @@
|
|
|
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(false).toEqual(false);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// import { fromJS } from 'immutable';
|
|
2
|
+
// import { makeSelectCallTaskDomain } from '../selectors';
|
|
3
|
+
|
|
4
|
+
// const selector = makeSelectCallTaskDomain();
|
|
5
|
+
|
|
6
|
+
describe('makeSelectCallTaskDomain', () => {
|
|
7
|
+
it('Expect to have unit tests specified', () => {
|
|
8
|
+
expect(false).toEqual(false);
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -7,7 +7,10 @@ import SmsCreate from '../Sms/Create';
|
|
|
7
7
|
import SmsEdit from '../Sms/Edit';
|
|
8
8
|
import Email from '../Email';
|
|
9
9
|
import EmailWrapper from '../EmailWrapper';
|
|
10
|
+
import MobilepusWrapper from '../MobilepushWrapper';
|
|
10
11
|
import EmailPreviewV2 from '../../components/EmailPreviewV2';
|
|
12
|
+
import CallTask from '../CallTask';
|
|
13
|
+
import MobliPushEdit from '../MobilePush/Edit';
|
|
11
14
|
import * as constants from './constants';
|
|
12
15
|
const CreativesWrapper = styled.div`
|
|
13
16
|
.ant-popover,
|
|
@@ -31,11 +34,14 @@ function SlideBoxContent(props) {
|
|
|
31
34
|
onChannelChange,
|
|
32
35
|
onEmailModeChange,
|
|
33
36
|
emailCreateMode,
|
|
37
|
+
onMobilepushModeChange,
|
|
38
|
+
mobilePushCreateMode,
|
|
34
39
|
templateStep,
|
|
35
|
-
|
|
40
|
+
onCreateNextStep,
|
|
36
41
|
cap,
|
|
37
42
|
onResetStep,
|
|
38
43
|
isFullMode,
|
|
44
|
+
onCallTaskSubmit,
|
|
39
45
|
setIsLoadingContent,
|
|
40
46
|
} = props;
|
|
41
47
|
const type = messageDetails.type.toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
@@ -47,15 +53,21 @@ function SlideBoxContent(props) {
|
|
|
47
53
|
};
|
|
48
54
|
let channel = currentChannel;//for create mode
|
|
49
55
|
const isCreateSms = slidBoxContent === 'createTemplate' && channel === constants.SMS;
|
|
56
|
+
const isCreateMPush = slidBoxContent === 'createTemplate' && channel === constants.MOBILE_PUSH;
|
|
57
|
+
const isCreateCallTask = slidBoxContent === 'createTemplate' && channel === 'CALLTASK';
|
|
50
58
|
let isEditSms = false;
|
|
51
59
|
let isEditEmailWithId = false;
|
|
52
60
|
let isEmailEditWithContent = false;
|
|
53
61
|
let isPreview = false;
|
|
54
62
|
let isEmailPreview = false;
|
|
63
|
+
let isEditCallTask = false;
|
|
64
|
+
let isEditMPush = false;
|
|
55
65
|
const isEmailCreate = slidBoxContent === 'createTemplate' && channel === constants.EMAIL;
|
|
56
66
|
if (templateData && channel) {
|
|
57
67
|
channel = templateData.type;// for edit mode with template data
|
|
58
68
|
isEditSms = slidBoxContent === 'editTemplate' && channel === constants.SMS;
|
|
69
|
+
isEditCallTask = slidBoxContent === 'editTemplate' && channel === constants.CALL_TASK;
|
|
70
|
+
isEditMPush = slidBoxContent === 'editTemplate' && channel === constants.MOBILE_PUSH;
|
|
59
71
|
isEditEmailWithId = slidBoxContent === 'editTemplate' && channel === constants.EMAIL && templateData._id;
|
|
60
72
|
isEmailEditWithContent = slidBoxContent === 'editTemplate' && channel === constants.EMAIL && !templateData._id;
|
|
61
73
|
isPreview = slidBoxContent === 'preview' && channel !== constants.EMAIL;
|
|
@@ -73,6 +85,7 @@ function SlideBoxContent(props) {
|
|
|
73
85
|
createNew={onCreateNew}
|
|
74
86
|
channel={channel.toLowerCase()}
|
|
75
87
|
onChannelChange={onChannelChange}
|
|
88
|
+
onCallTaskSubmit={onCallTaskSubmit}
|
|
76
89
|
cap={cap}
|
|
77
90
|
/>
|
|
78
91
|
)}
|
|
@@ -103,6 +116,21 @@ function SlideBoxContent(props) {
|
|
|
103
116
|
subscriptionTemplateDetails={templateData} // used only in library mode
|
|
104
117
|
/>
|
|
105
118
|
)}
|
|
119
|
+
{
|
|
120
|
+
isEditCallTask &&
|
|
121
|
+
<CallTask
|
|
122
|
+
mode={'edit'}
|
|
123
|
+
templateData={templateData}
|
|
124
|
+
onCallTaskSubmit={onCallTaskSubmit}
|
|
125
|
+
/>
|
|
126
|
+
}
|
|
127
|
+
{
|
|
128
|
+
isCreateCallTask &&
|
|
129
|
+
<CallTask
|
|
130
|
+
mode={'create'}
|
|
131
|
+
onCallTaskSubmit={onCallTaskSubmit}
|
|
132
|
+
/>
|
|
133
|
+
}
|
|
106
134
|
{isCreateSms && (
|
|
107
135
|
<SmsCreate
|
|
108
136
|
setIsLoadingContent={setIsLoadingContent}
|
|
@@ -127,7 +155,7 @@ function SlideBoxContent(props) {
|
|
|
127
155
|
templateData={templateData}
|
|
128
156
|
type={type}
|
|
129
157
|
step={templateStep}
|
|
130
|
-
showNextStep={
|
|
158
|
+
showNextStep={onCreateNextStep}
|
|
131
159
|
isFullMode={isFullMode}
|
|
132
160
|
cap={cap}
|
|
133
161
|
onResetStep={onResetStep}
|
|
@@ -151,6 +179,38 @@ function SlideBoxContent(props) {
|
|
|
151
179
|
cap={cap}
|
|
152
180
|
/>
|
|
153
181
|
)}
|
|
182
|
+
{isEditMPush &&
|
|
183
|
+
<MobliPushEdit
|
|
184
|
+
getFormLibraryData={getFormData}
|
|
185
|
+
setIsLoadingContent={setIsLoadingContent}
|
|
186
|
+
location={{
|
|
187
|
+
pathname: `/mobilepush/edit/`,
|
|
188
|
+
query,
|
|
189
|
+
}}
|
|
190
|
+
isFullMode={false}
|
|
191
|
+
isGetFormData={isGetFormData}
|
|
192
|
+
route={{ name: 'mobilepush' }}
|
|
193
|
+
templateData={templateData}
|
|
194
|
+
/>
|
|
195
|
+
}
|
|
196
|
+
{isCreateMPush &&
|
|
197
|
+
<MobilepusWrapper
|
|
198
|
+
key="creatives-mobilepush-wrapper"
|
|
199
|
+
date={new Date().getMilliseconds()}
|
|
200
|
+
setIsLoadingContent={setIsLoadingContent}
|
|
201
|
+
onMobilepushModeChange={onMobilepushModeChange}
|
|
202
|
+
mobilePushCreateMode={mobilePushCreateMode}
|
|
203
|
+
isGetFormData={isGetFormData}
|
|
204
|
+
getFormData={getFormData}
|
|
205
|
+
templateData={templateData}
|
|
206
|
+
type={type}
|
|
207
|
+
step={templateStep}
|
|
208
|
+
showNextStep={onCreateNextStep}
|
|
209
|
+
isFullMode={isFullMode}
|
|
210
|
+
cap={cap}
|
|
211
|
+
onResetStep={onResetStep}
|
|
212
|
+
query={query}/>
|
|
213
|
+
}
|
|
154
214
|
</CreativesWrapper>
|
|
155
215
|
);
|
|
156
216
|
}
|
|
@@ -169,10 +229,13 @@ SlideBoxContent.propTypes = {
|
|
|
169
229
|
onEmailModeChange: PropTypes.func,
|
|
170
230
|
emailCreateMode: PropTypes.string,
|
|
171
231
|
templateStep: PropTypes.string,
|
|
172
|
-
|
|
232
|
+
onCreateNextStep: PropTypes.func,
|
|
173
233
|
cap: PropTypes.object,
|
|
174
234
|
onResetStep: PropTypes.func,
|
|
235
|
+
onCallTaskSubmit: PropTypes.func,
|
|
175
236
|
isFullMode: PropTypes.bool,
|
|
176
237
|
setIsLoadingContent: PropTypes.func,
|
|
238
|
+
onMobilepushModeChange: PropTypes.func,
|
|
239
|
+
mobilePushCreateMode: PropTypes.string,
|
|
177
240
|
};
|
|
178
241
|
export default SlideBoxContent;
|
|
@@ -3,7 +3,7 @@ import { FormattedMessage } from 'react-intl';
|
|
|
3
3
|
import { CapButton } from '@capillarytech/cap-ui-library';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
function SlideBoxFooter(props) {
|
|
6
|
-
const { slidBoxContent, onSave, messages, onEditTemplate,
|
|
6
|
+
const { slidBoxContent, onSave, messages, onEditTemplate, onCreateNextStep} = props;
|
|
7
7
|
return (
|
|
8
8
|
<div>
|
|
9
9
|
<div>
|
|
@@ -13,7 +13,7 @@ function SlideBoxFooter(props) {
|
|
|
13
13
|
</CapButton>
|
|
14
14
|
)}
|
|
15
15
|
{props.shouldShowContinueFooter() &&
|
|
16
|
-
<CapButton onClick={
|
|
16
|
+
<CapButton onClick={onCreateNextStep}>
|
|
17
17
|
<FormattedMessage {...messages.continue} />
|
|
18
18
|
</CapButton>
|
|
19
19
|
}
|
|
@@ -31,7 +31,7 @@ SlideBoxFooter.propTypes = {
|
|
|
31
31
|
onSave: PropTypes.func,
|
|
32
32
|
messages: PropTypes.object,
|
|
33
33
|
onEditTemplate: PropTypes.func,
|
|
34
|
-
|
|
34
|
+
onCreateNextStep: PropTypes.func,
|
|
35
35
|
shouldShowContinueFooter: PropTypes.func,
|
|
36
36
|
shouldShowDoneFooter: PropTypes.func,
|
|
37
37
|
};
|
|
@@ -7,5 +7,7 @@
|
|
|
7
7
|
export const DEFAULT_ACTION = 'app/CreativesContainer/DEFAULT_ACTION';
|
|
8
8
|
export const EMAIL = "EMAIL";
|
|
9
9
|
export const SMS = "SMS";
|
|
10
|
+
export const CALL_TASK = "CALL_TASK";
|
|
11
|
+
export const MOBILE_PUSH = "MOBILEPUSH";
|
|
10
12
|
export const SHOW_CONTANER_LOADER = "app/CreativesContainer/SHOW_CONTANER_LOADER";
|
|
11
13
|
export const HIDE_CONTAINER_LOADER = "app/CreativesContainer/HIDE_CONTAINER_LOADER";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from '@capillarytech/cap-ui-library';
|
|
6
6
|
import { injectIntl } from 'react-intl';
|
|
7
7
|
import classnames from 'classnames';
|
|
8
|
-
import {isEmpty} from 'lodash';
|
|
8
|
+
import {isEmpty, get} from 'lodash';
|
|
9
9
|
import { connect } from 'react-redux';
|
|
10
10
|
import { createStructuredSelector } from 'reselect';
|
|
11
11
|
import { bindActionCreators } from 'redux';
|
|
@@ -66,20 +66,39 @@ class Creatives extends React.Component {
|
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
onShowTemplates = () => {
|
|
69
|
-
this.setState({ slidBoxContent: 'templates', showSlideBox: true });
|
|
69
|
+
this.setState({ slidBoxContent: 'templates', showSlideBox: true, isGetFormData: false });
|
|
70
70
|
};
|
|
71
71
|
onChannelChange = (channel) => {
|
|
72
72
|
this.setState({currentChannel: channel});
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
this.setState((prevState) =>
|
|
76
|
-
templateStep
|
|
77
|
-
|
|
74
|
+
onCreateNextStep = () => {
|
|
75
|
+
this.setState((prevState) => {
|
|
76
|
+
let templateStep = prevState.templateStep + 1;
|
|
77
|
+
const {emailCreateMode, currentChannel} = prevState;
|
|
78
|
+
if ((currentChannel.toUpperCase() === constants.EMAIL && emailCreateMode === "upload") || currentChannel.toUpperCase() === constants.MOBILE_PUSH) {
|
|
79
|
+
templateStep = prevState.templateStep + 2;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
templateStep,
|
|
84
|
+
};
|
|
85
|
+
});
|
|
78
86
|
}
|
|
79
87
|
|
|
80
88
|
onEmailModeChange = (mode) => {
|
|
81
89
|
this.setState({ emailCreateMode: mode});
|
|
82
90
|
}
|
|
91
|
+
onMobilepushModeChange = (mode) => {
|
|
92
|
+
this.setState({ mobilePushCreateMode: mode});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
onCallTaskSubmit = (data) => {
|
|
96
|
+
this.props.getCreativesData({
|
|
97
|
+
channel: 'CALL_TASK',
|
|
98
|
+
...data,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
83
102
|
getTemplateData = (templateData) => { //from consumers to creatives
|
|
84
103
|
const {isFullMode} = this.props;
|
|
85
104
|
if (!isFullMode && templateData) { // for component mode
|
|
@@ -111,6 +130,27 @@ class Creatives extends React.Component {
|
|
|
111
130
|
edit: true,
|
|
112
131
|
type: channel,
|
|
113
132
|
};
|
|
133
|
+
} else if (channel === constants.CALL_TASK) {
|
|
134
|
+
creativesTeplateData = {
|
|
135
|
+
subject: templateData.subject,
|
|
136
|
+
messageBody: templateData.messageBody,
|
|
137
|
+
description: templateData.description,
|
|
138
|
+
edit: true,
|
|
139
|
+
type: channel,
|
|
140
|
+
};
|
|
141
|
+
} else if (channel === constants.MOBILE_PUSH) {
|
|
142
|
+
const mode = get(templateData, 'androidContent.type') || get(templateData, 'iosContent.type');
|
|
143
|
+
creativesTeplateData = {
|
|
144
|
+
type: channel,
|
|
145
|
+
name: templateData.messageSubject,
|
|
146
|
+
versions: {
|
|
147
|
+
base: {
|
|
148
|
+
ANDROID: templateData.androidContent,
|
|
149
|
+
IOS: templateData.iosContent,
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
definition: {accountId: templateData.accountId, mode: mode.toLowerCase()},
|
|
153
|
+
};
|
|
114
154
|
}
|
|
115
155
|
return creativesTeplateData;
|
|
116
156
|
}
|
|
@@ -124,6 +164,28 @@ class Creatives extends React.Component {
|
|
|
124
164
|
} else if (channel === constants.EMAIL && template.value.base) {
|
|
125
165
|
templateData.emailBody = template.value.base.html_content;
|
|
126
166
|
templateData.emailSubject = template.value.base.subject;
|
|
167
|
+
} else if (channel === constants.MOBILE_PUSH && get(template, "value.versions.base")) {
|
|
168
|
+
const mobilpushTemplate = template.value;
|
|
169
|
+
templateData.accountId = get(mobilpushTemplate, 'definition.accountId');
|
|
170
|
+
const androidContent = get(mobilpushTemplate, 'versions.base.ANDROID');
|
|
171
|
+
if (!isEmpty(androidContent)) {
|
|
172
|
+
delete androidContent.cuid;
|
|
173
|
+
delete androidContent.luid;
|
|
174
|
+
delete androidContent.communicationId;
|
|
175
|
+
templateData.androidContent = androidContent;
|
|
176
|
+
templateData.androidContent.type = get(mobilpushTemplate, 'definition.mode').toUpperCase();
|
|
177
|
+
templateData.androidContent.deviceType = 'ANDROID';
|
|
178
|
+
}
|
|
179
|
+
const iosContent = get(mobilpushTemplate, 'versions.base.IOS');
|
|
180
|
+
if (!isEmpty(iosContent)) {
|
|
181
|
+
delete iosContent.cuid;
|
|
182
|
+
delete iosContent.luid;
|
|
183
|
+
delete iosContent.communicationId;
|
|
184
|
+
templateData.iosContent = iosContent;
|
|
185
|
+
templateData.iosContent.type = get(mobilpushTemplate, 'definition.mode').toUpperCase();
|
|
186
|
+
templateData.iosContent.deviceType = 'IOS';
|
|
187
|
+
}
|
|
188
|
+
templateData.messageSubject = mobilpushTemplate.name;
|
|
127
189
|
}
|
|
128
190
|
return templateData;
|
|
129
191
|
};
|
|
@@ -138,6 +200,7 @@ class Creatives extends React.Component {
|
|
|
138
200
|
}
|
|
139
201
|
return creativesMode;
|
|
140
202
|
}
|
|
203
|
+
|
|
141
204
|
getFormData = (template) => {
|
|
142
205
|
if (template.validity) {
|
|
143
206
|
this.setState(
|
|
@@ -180,15 +243,20 @@ class Creatives extends React.Component {
|
|
|
180
243
|
this.setState({ isGetFormData: true });
|
|
181
244
|
};
|
|
182
245
|
shouldShowFooter = () => {
|
|
183
|
-
const {isFullMode} = this.props;
|
|
184
|
-
const {slidBoxContent, currentChannel, emailCreateMode, templateStep} = this.state;
|
|
246
|
+
const {isFullMode } = this.props;
|
|
247
|
+
const {slidBoxContent, currentChannel, emailCreateMode, templateStep, mobilePushCreateMode} = this.state;
|
|
185
248
|
const channel = currentChannel.toUpperCase();
|
|
186
249
|
const currentStep = this.creativesTemplateSteps[templateStep];
|
|
187
250
|
let showFooter = false;
|
|
251
|
+
const isMobilepush = channel === constants.MOBILE_PUSH;
|
|
188
252
|
if (!isFullMode ) {
|
|
189
253
|
const isEmailCreate = slidBoxContent === 'createTemplate' && channel === constants.EMAIL && currentStep !== 'createTemplateContent';
|
|
190
254
|
const isCreate = (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate') && !isEmailCreate;
|
|
191
|
-
|
|
255
|
+
const isCallTask = channel === 'CALLTASK';
|
|
256
|
+
showFooter = (isCreate || (isEmailCreate && emailCreateMode) || slidBoxContent === 'preview') && !isCallTask;
|
|
257
|
+
if (isMobilepush) {
|
|
258
|
+
showFooter = currentStep === "modeSelection" || (currentStep === 'createTemplateContent' && !isEmpty(mobilePushCreateMode));
|
|
259
|
+
}
|
|
192
260
|
} else if (channel === constants.EMAIL && isFullMode) {
|
|
193
261
|
const isEmailCreate = slidBoxContent === 'createTemplate' && channel === constants.EMAIL && currentStep !== 'createTemplateContent';
|
|
194
262
|
showFooter = isEmailCreate && emailCreateMode;
|
|
@@ -208,23 +276,36 @@ class Creatives extends React.Component {
|
|
|
208
276
|
shouldShowDoneFooter = () => {
|
|
209
277
|
const {slidBoxContent, templateStep, currentChannel} = this.state;
|
|
210
278
|
const currentStep = this.creativesTemplateSteps[templateStep];
|
|
211
|
-
|
|
212
|
-
const
|
|
213
|
-
|
|
279
|
+
let showDone = false;
|
|
280
|
+
const channel = currentChannel.toUpperCase();
|
|
281
|
+
if (channel === constants.EMAIL || channel === constants.SMS) {
|
|
282
|
+
const isEmailCreate = slidBoxContent === 'createTemplate' && currentChannel.toUpperCase() === constants.EMAIL && currentStep !== 'createTemplateContent';
|
|
283
|
+
showDone = (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate') && !isEmailCreate;
|
|
284
|
+
} else if (channel === constants.MOBILE_PUSH) {
|
|
285
|
+
showDone = currentStep === "createTemplateContent" || slidBoxContent === "editTemplate";
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return showDone;
|
|
214
289
|
}
|
|
215
290
|
shouldShowContinueFooter = () => { // only for email for now, has to be modified according to channel
|
|
216
|
-
const {slidBoxContent, templateStep, currentChannel, emailCreateMode} = this.state;
|
|
291
|
+
const {slidBoxContent, templateStep, currentChannel, emailCreateMode, mobilePushCreateMode} = this.state;
|
|
217
292
|
let isShowContinueFooter = false;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
293
|
+
const currentStep = this.creativesTemplateSteps[templateStep];
|
|
294
|
+
const channel = currentChannel.toUpperCase();
|
|
295
|
+
if (channel === constants.EMAIL || channel === constants.SMS) {
|
|
296
|
+
if ((emailCreateMode === "upload" && !isEmpty(this.props.EmailLayout)) || emailCreateMode === "editor") {
|
|
297
|
+
let isEmailCreate = slidBoxContent === 'createTemplate';
|
|
298
|
+
isEmailCreate = currentChannel.toUpperCase() === constants.EMAIL && ((emailCreateMode === "upload" && currentStep !== 'createTemplateContent') || ( emailCreateMode === "editor" && currentStep !== 'createTemplateContent' && currentStep !== "templateSelection"));
|
|
299
|
+
isShowContinueFooter = isEmailCreate && emailCreateMode;
|
|
300
|
+
}
|
|
301
|
+
} else if (currentChannel.toUpperCase() === constants.MOBILE_PUSH) {
|
|
302
|
+
isShowContinueFooter = !isEmpty(mobilePushCreateMode) && currentStep === "modeSelection";
|
|
223
303
|
}
|
|
304
|
+
|
|
224
305
|
return isShowContinueFooter;
|
|
225
306
|
}
|
|
226
307
|
render() {
|
|
227
|
-
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent} = this.state;
|
|
308
|
+
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode} = this.state;
|
|
228
309
|
const {isFullMode, creativesMode, cap, isUploading} = this.props;
|
|
229
310
|
return (
|
|
230
311
|
<div className={classnames(`${classPrefix} ${isFullMode ? 'creatives-full-mode' : 'creatives-library-mode'}`)}>
|
|
@@ -250,6 +331,7 @@ class Creatives extends React.Component {
|
|
|
250
331
|
location={this.props.location}
|
|
251
332
|
messageDetails={this.props.messageDetails}
|
|
252
333
|
getFormData={this.getFormData}
|
|
334
|
+
onCallTaskSubmit={this.onCallTaskSubmit}
|
|
253
335
|
onCreateNew={this.onCreateNew}
|
|
254
336
|
isGetFormData={isGetFormData}
|
|
255
337
|
isFullMode={isFullMode}
|
|
@@ -258,10 +340,12 @@ class Creatives extends React.Component {
|
|
|
258
340
|
onEmailModeChange={this.onEmailModeChange}//used when create is clicked in email
|
|
259
341
|
emailCreateMode={emailCreateMode}// upload zip || use editor are values
|
|
260
342
|
templateStep={this.creativesTemplateSteps[templateStep]}
|
|
261
|
-
|
|
343
|
+
onCreateNextStep={this.onCreateNextStep}
|
|
262
344
|
onResetStep={this.resetStep}
|
|
263
345
|
cap={cap}
|
|
264
346
|
setIsLoadingContent={this.setIsLoadingContent}
|
|
347
|
+
onMobilepushModeChange={this.onMobilepushModeChange}
|
|
348
|
+
mobilePushCreateMode={mobilePushCreateMode}
|
|
265
349
|
/>
|
|
266
350
|
}
|
|
267
351
|
footer={this.shouldShowFooter() &&
|
|
@@ -270,7 +354,7 @@ class Creatives extends React.Component {
|
|
|
270
354
|
onSave={this.saveMessage}
|
|
271
355
|
onEditTemplate={this.onEditTemplate}
|
|
272
356
|
slidBoxContent={slidBoxContent}
|
|
273
|
-
|
|
357
|
+
onCreateNextStep={this.onCreateNextStep}
|
|
274
358
|
currentChannel={currentChannel.toUpperCase()}
|
|
275
359
|
templateStep={this.creativesTemplateSteps[templateStep]}
|
|
276
360
|
emailCreateMode={emailCreateMode}
|
|
@@ -2540,6 +2540,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2540
2540
|
onItemClick={this.handleOnItemClick}
|
|
2541
2541
|
colNumber={2}
|
|
2542
2542
|
enablePagination
|
|
2543
|
+
isLoading={this.props.Email.fetchingAllAssets}
|
|
2543
2544
|
/>
|
|
2544
2545
|
</Pagination>
|
|
2545
2546
|
</div>
|
|
@@ -2672,3 +2673,4 @@ function mapDispatchToProps(dispatch) {
|
|
|
2672
2673
|
}
|
|
2673
2674
|
|
|
2674
2675
|
export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(injectIntl(Email)));
|
|
2676
|
+
|
|
@@ -504,10 +504,12 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
504
504
|
};
|
|
505
505
|
getFormData = (e) => {
|
|
506
506
|
console.log('posting final result', this.state.formData);
|
|
507
|
+
const templateData = this.getTransformedData(this.state.formData);
|
|
507
508
|
const response = {
|
|
508
509
|
action: "getFormData",
|
|
509
|
-
value:
|
|
510
|
+
value: templateData,
|
|
510
511
|
validity: this.state.isFormValid,
|
|
512
|
+
type: templateData.type,
|
|
511
513
|
};
|
|
512
514
|
this.setState({checkValidation: true});
|
|
513
515
|
if (e) {
|
|
@@ -2216,7 +2218,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
2216
2218
|
injectedTags={this.state.injectedTags ? this.state.injectedTags : {}}
|
|
2217
2219
|
onFormValidityChange={this.setFormValidity}
|
|
2218
2220
|
usingTabContainer
|
|
2219
|
-
checkValidation={
|
|
2221
|
+
checkValidation={this.state.checkValidation}
|
|
2220
2222
|
iosCtasData={this.state.iosCtasData}
|
|
2221
2223
|
tabKey={this.state.tabKey}
|
|
2222
2224
|
tabCount={2}
|
|
@@ -13,7 +13,7 @@ import { connect } from 'react-redux';
|
|
|
13
13
|
import { Row, Col, Spin, Breadcrumb, notification } from 'antd';
|
|
14
14
|
import { createStructuredSelector } from 'reselect';
|
|
15
15
|
import { injectIntl, intlShape } from 'react-intl';
|
|
16
|
-
import _ from 'lodash';
|
|
16
|
+
import _, {get} from 'lodash';
|
|
17
17
|
import {makeSelectEdit, makeSelectEditResponse, makeSelectTemplateDetailsResponse} from "../../MobilePush/Edit/selectors";
|
|
18
18
|
import {makeSelectMetaEntities} from "../../Cap/selectors";
|
|
19
19
|
import {getMessageObject} from "../../../utils/messageUtils";
|
|
@@ -186,9 +186,10 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
186
186
|
if (!_.isEmpty(this.state.schema)) {
|
|
187
187
|
this.injectEvents(this.state.schema);
|
|
188
188
|
}
|
|
189
|
-
if (this.props.location.query && typeof this.props.location.query.module === 'undefined') { // when this containers is imported from creatives library
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
if (this.props.location.query && (typeof this.props.location.query.module === 'undefined' || this.props.isFullMode === false)) { // when this containers is imported from creatives library
|
|
190
|
+
const templateId = get(this, "props.params.id");
|
|
191
|
+
if (templateId) {
|
|
192
|
+
this.props.actions.getTemplateDetails(templateId);
|
|
192
193
|
} else {
|
|
193
194
|
this.props.actions.setTemplateDetails(this.props.templateData);
|
|
194
195
|
}
|
|
@@ -213,11 +214,12 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
213
214
|
}
|
|
214
215
|
if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && _.isEmpty(this.state.fullSchema)) {
|
|
215
216
|
this.setState({fullSchema: nextProps.metaEntities.layouts[0].definition, schema: (nextProps.location.query.module === 'loyalty') ? nextProps.metaEntities.layouts[0].definition.textSchema : {}}, () => {
|
|
216
|
-
|
|
217
|
-
|
|
217
|
+
const templateId = get(this, "props.params.id");
|
|
218
|
+
if (nextProps.location.query.module !== 'loyalty' && templateId && templateId !== 'temp') {
|
|
219
|
+
this.props.actions.getTemplateDetails(templateId);
|
|
218
220
|
}
|
|
219
221
|
const type = this.props.location.query.type;
|
|
220
|
-
if (type === 'embedded' &&
|
|
222
|
+
if (type === 'embedded' && templateId === 'temp' && _.isEmpty(this.state.formData)) { // when his.props.params.id is temp that means mobile push template content will be passed from post message from parent with startTemplateCreation action
|
|
221
223
|
const response = {
|
|
222
224
|
action: 'startTemplateCreation',
|
|
223
225
|
};
|
|
@@ -595,7 +597,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
595
597
|
licenseCode: selectedWeChatAccount.sourceAccountIdentifier,
|
|
596
598
|
};
|
|
597
599
|
if (this.props.location.query && this.props.location.query.module !== 'dvs') {
|
|
598
|
-
obj.definition.mode = this.props.Edit.templateDetails.mode;
|
|
600
|
+
obj.definition.mode = this.props.Edit.templateDetails.mode || get(this, 'props.Edit.templateDetails.definition.mode');
|
|
599
601
|
}
|
|
600
602
|
const android = {};
|
|
601
603
|
Object.keys(formData[0]).forEach((data) => {
|
|
@@ -2549,6 +2551,7 @@ Edit.propTypes = {
|
|
|
2549
2551
|
supportedTags: PropTypes.array,
|
|
2550
2552
|
getDefaultTags: PropTypes.string,
|
|
2551
2553
|
templateData: PropTypes.object,
|
|
2554
|
+
isFullMode: PropTypes.bool,
|
|
2552
2555
|
};
|
|
2553
2556
|
|
|
2554
2557
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -3,7 +3,8 @@ import { createSelector } from 'reselect';
|
|
|
3
3
|
/**
|
|
4
4
|
* Direct selector to the create state domain
|
|
5
5
|
*/
|
|
6
|
-
const selectMobilePushEditDomain = () => (state) => state.get('edit');
|
|
6
|
+
const selectMobilePushEditDomain = () => (state, props) => props.isFullMode === false ? state.get('mobileEdit') : state.get('edit'); // reducer injected as mobileEdit in library mode.
|
|
7
|
+
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Other specific selectors
|