@capillarytech/creatives-library 2.0.44 → 2.0.46
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/CmsTemplatesComponent/index.js +1 -0
- package/components/EmailMobilePreview/index.js +108 -0
- package/components/EmailMobilePreview/index.scss +66 -0
- package/components/FormBuilder/_formBuilder.scss +2 -14
- package/components/FormBuilder/index.js +106 -93
- package/components/Header/index.js +41 -0
- package/components/Header/messages.js +13 -0
- package/components/Header/tests/index.test.js +10 -0
- package/components/PreviewSideBar/index.js +7 -3
- package/components/TemplatePreview/index.js +6 -7
- package/config/app.js +2 -2
- package/containers/Cap/index.js +1 -1
- package/containers/Cap/selectors.js +11 -1
- package/containers/CreativesContainer/SlideBoxContent.js +5 -1
- package/containers/CreativesContainer/SlideBoxFooter.js +5 -9
- package/containers/CreativesContainer/index.js +59 -16
- package/containers/Email/actions.js +2 -3
- package/containers/Email/index.js +32 -26
- package/containers/Email/sagas.js +1 -0
- package/containers/EmailWrapper/index.js +43 -13
- package/containers/EmailWrapper/messages.js +8 -0
- package/containers/MobilePush/Create/index.js +1 -1
- package/containers/Sms/Create/actions.js +4 -4
- package/containers/Sms/Create/index.js +28 -17
- package/containers/Sms/Create/sagas.js +1 -2
- package/containers/Sms/Edit/actions.js +4 -5
- package/containers/Sms/Edit/index.js +31 -5
- package/containers/Sms/Edit/sagas.js +1 -3
- package/containers/Templates/actions.js +3 -1
- package/containers/Templates/index.js +219 -84
- package/containers/Templates/messages.js +8 -0
- package/containers/Templates/sagas.js +16 -4
- package/containers/Templates/selectors.js +2 -0
- package/containers/TemplatesV2/index.js +9 -4
- package/containers/TemplatesV2/reducer.js +34 -0
- package/containers/TemplatesV2/sagas.js +32 -0
- package/containers/WeChat/MapTemplates/_mapTemplates.scss +8 -0
- package/containers/WeChat/MapTemplates/actions.js +52 -0
- package/containers/WeChat/MapTemplates/constants.js +28 -0
- package/containers/WeChat/MapTemplates/index.js +1401 -0
- package/containers/WeChat/MapTemplates/messages.js +73 -0
- package/containers/WeChat/MapTemplates/reducer.js +74 -0
- package/containers/WeChat/MapTemplates/sagas.js +86 -0
- package/containers/WeChat/MapTemplates/selectors.js +25 -0
- package/containers/WeChat/MapTemplates/tests/actions.test.js +18 -0
- package/containers/WeChat/MapTemplates/tests/index.test.js +10 -0
- package/containers/WeChat/MapTemplates/tests/reducer.test.js +9 -0
- package/containers/WeChat/MapTemplates/tests/sagas.test.js +15 -0
- package/containers/WeChat/MapTemplates/tests/selectors.test.js +10 -0
- package/containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +13 -0
- package/containers/WeChat/RichmediaTemplates/Create/actions.js +35 -0
- package/containers/WeChat/RichmediaTemplates/Create/constants.js +14 -0
- package/containers/WeChat/RichmediaTemplates/Create/index.js +679 -0
- package/containers/WeChat/RichmediaTemplates/Create/messages.js +13 -0
- package/containers/WeChat/RichmediaTemplates/Create/reducer.js +49 -0
- package/containers/WeChat/RichmediaTemplates/Create/sagas.js +44 -0
- package/containers/WeChat/RichmediaTemplates/Create/selectors.js +32 -0
- package/containers/WeChat/RichmediaTemplates/Create/tests/actions.test.js +18 -0
- package/containers/WeChat/RichmediaTemplates/Create/tests/index.test.js +10 -0
- package/containers/WeChat/RichmediaTemplates/Create/tests/reducer.test.js +9 -0
- package/containers/WeChat/RichmediaTemplates/Create/tests/sagas.test.js +15 -0
- package/containers/WeChat/RichmediaTemplates/Create/tests/selectors.test.js +10 -0
- package/containers/WeChat/RichmediaTemplates/Create/testschema.js +379 -0
- package/containers/WeChat/RichmediaTemplates/Edit/actions.js +20 -0
- package/containers/WeChat/RichmediaTemplates/Edit/constants.js +10 -0
- package/containers/WeChat/RichmediaTemplates/Edit/index.js +98 -0
- package/containers/WeChat/RichmediaTemplates/Edit/messages.js +13 -0
- package/containers/WeChat/RichmediaTemplates/Edit/reducer.js +28 -0
- package/containers/WeChat/RichmediaTemplates/Edit/sagas.js +32 -0
- package/containers/WeChat/RichmediaTemplates/Edit/selectors.js +25 -0
- package/containers/WeChat/RichmediaTemplates/Edit/tests/actions.test.js +18 -0
- package/containers/WeChat/RichmediaTemplates/Edit/tests/index.test.js +10 -0
- package/containers/WeChat/RichmediaTemplates/Edit/tests/reducer.test.js +9 -0
- package/containers/WeChat/RichmediaTemplates/Edit/tests/sagas.test.js +15 -0
- package/containers/WeChat/RichmediaTemplates/Edit/tests/selectors.test.js +10 -0
- package/containers/WeChat/RichmediaTemplates/View/actions.js +15 -0
- package/containers/WeChat/RichmediaTemplates/View/constants.js +7 -0
- package/containers/WeChat/RichmediaTemplates/View/index.js +45 -0
- package/containers/WeChat/RichmediaTemplates/View/messages.js +13 -0
- package/containers/WeChat/RichmediaTemplates/View/reducer.js +23 -0
- package/containers/WeChat/RichmediaTemplates/View/sagas.js +11 -0
- package/containers/WeChat/RichmediaTemplates/View/selectors.js +25 -0
- package/containers/WeChat/RichmediaTemplates/View/tests/actions.test.js +18 -0
- package/containers/WeChat/RichmediaTemplates/View/tests/index.test.js +10 -0
- package/containers/WeChat/RichmediaTemplates/View/tests/reducer.test.js +9 -0
- package/containers/WeChat/RichmediaTemplates/View/tests/sagas.test.js +15 -0
- package/containers/WeChat/RichmediaTemplates/View/tests/selectors.test.js +10 -0
- package/index.js +3 -3
- package/package.json +1 -1
- package/routes.js +53 -13
- package/services/api.js +6 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Header
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React, { PropTypes } from 'react';
|
|
8
|
+
// import styled from 'styled-components';
|
|
9
|
+
|
|
10
|
+
import { CapRow, CapColumn, CapInput, CapButton } from '@capillarytech/cap-ui-library';
|
|
11
|
+
|
|
12
|
+
function Header(props) {
|
|
13
|
+
return (
|
|
14
|
+
<div>
|
|
15
|
+
<CapRow className="template-form-header">
|
|
16
|
+
<CapColumn span={10}>
|
|
17
|
+
<CapInput id="template-name" errorMessage="Template name cannot be empty" placeholder="Enter template name*" defaultValue={props.templateName} type="input" onChange={props.templateNameHandler}/>
|
|
18
|
+
</CapColumn>
|
|
19
|
+
<CapColumn span={2} offset={8}>
|
|
20
|
+
<CapButton id="preview-button" type="cancel" onClick={props.previewHandler}> Preview </CapButton>
|
|
21
|
+
</CapColumn>
|
|
22
|
+
<CapColumn span={2}>
|
|
23
|
+
<CapButton id="cancel-button" type="cancel" onClick={props.cancelHandler}> Cancel </CapButton>
|
|
24
|
+
</CapColumn>
|
|
25
|
+
<CapColumn span={2}>
|
|
26
|
+
<CapButton id="save-button" type="primary" onClick={props.saveHandler}> Save </CapButton>
|
|
27
|
+
</CapColumn>
|
|
28
|
+
</CapRow>
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
Header.propTypes = {
|
|
34
|
+
templateNameHandler: PropTypes.func,
|
|
35
|
+
previewHandler: PropTypes.func,
|
|
36
|
+
cancelHandler: PropTypes.func,
|
|
37
|
+
saveHandler: PropTypes.func,
|
|
38
|
+
templateName: PropTypes.string,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default Header;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Header Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the Header component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
header: {
|
|
10
|
+
id: 'app.components.Header.header',
|
|
11
|
+
defaultMessage: 'This is the Header component !',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -43,8 +43,8 @@ class PreviewSideBar extends React.Component { // eslint-disable-line react/pref
|
|
|
43
43
|
changeDevice(ev) {
|
|
44
44
|
this.setState({device: ev.target.value});
|
|
45
45
|
}
|
|
46
|
-
goToEdit(e) {
|
|
47
|
-
this.props.onEditClick(e, this.props.templateData._id, this.props.templateData.modeType);
|
|
46
|
+
goToEdit(e, path) {
|
|
47
|
+
this.props.onEditClick(e, this.props.templateData._id, this.props.templateData.modeType, path);
|
|
48
48
|
}
|
|
49
49
|
render() {
|
|
50
50
|
console.log('preview sidebar', this.props);
|
|
@@ -84,6 +84,10 @@ class PreviewSideBar extends React.Component { // eslint-disable-line react/pref
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
+
let path = '';
|
|
88
|
+
if (this.props.channel.toLowerCase() === 'wechat') {
|
|
89
|
+
path = this.props.templateData && this.props.templateData.definition && this.props.templateData.definition.msgcontent === "RICH_MEDIA_WECHAT" ? `/wechat/richmedia/edit/${this.props.templateData._id}` : `/wechat/edit/${this.props.templateData._id}`;
|
|
90
|
+
}
|
|
87
91
|
console.log('final content is', content);
|
|
88
92
|
return (
|
|
89
93
|
<SlideBox
|
|
@@ -119,7 +123,7 @@ class PreviewSideBar extends React.Component { // eslint-disable-line react/pref
|
|
|
119
123
|
<hr className="seperator-line" />
|
|
120
124
|
<div className="preview-action-container" style={{margin: '16px'}}>
|
|
121
125
|
{this.props.channel.toLowerCase() === 'sms' && !this.props.embedded && <CapButton onClick={() => this.goToDuplicate()}className="preview-buttons" style={{marginRight: '8px'}} type="secondary"><FormattedMessage {...messages.duplicate} /></CapButton>}
|
|
122
|
-
<CapButton onClick={(e) => this.goToEdit(e)}className="preview-buttons" type="primary">{this.props.location.query.type === 'embedded' ? <FormattedMessage {...messages.select} /> : <FormattedMessage {...messages.edit} />}</CapButton>
|
|
126
|
+
<CapButton onClick={(e) => this.goToEdit(e, path)} className="preview-buttons" type="primary">{this.props.location.query.type === 'embedded' ? <FormattedMessage {...messages.select} /> : <FormattedMessage {...messages.edit} />}</CapButton>
|
|
123
127
|
</div>
|
|
124
128
|
</div>
|
|
125
129
|
}
|
|
@@ -23,7 +23,6 @@ const iPhonePushMessagePhone = require('./assets/images/iPhonePushMessage.svg');
|
|
|
23
23
|
|
|
24
24
|
class TemplatePreview extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
25
25
|
render() {
|
|
26
|
-
console.log('preview props', this.props);
|
|
27
26
|
let content = channel && channel.toLowerCase() === 'sms' ? [this.props.content] : this.props.content;
|
|
28
27
|
const channel = this.props.channel;
|
|
29
28
|
let smsDetails = {};
|
|
@@ -45,7 +44,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
45
44
|
if (channel.toLowerCase() === "mobilepush") {
|
|
46
45
|
iosActions = _.map(content.actions, (action) => {
|
|
47
46
|
if (action.label) {
|
|
48
|
-
return (<div className="actions">
|
|
47
|
+
return (<div className="actions" key={`action-${action.label}`}>
|
|
49
48
|
<span className="action">{action.label.toUpperCase()}</span>
|
|
50
49
|
</div>);
|
|
51
50
|
}
|
|
@@ -60,8 +59,8 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
60
59
|
<div className="msgContainer sms">
|
|
61
60
|
<img className="sms-icon" src={smsIcon} alt="Sms icon" />
|
|
62
61
|
<div className={"message-pop sms"}>
|
|
63
|
-
{content && content.length && content.map((msg) =>
|
|
64
|
-
<CapColumn className="message-pop-item align-left" style={{ background: '#3F51B5', color: '#ffffff'}}>
|
|
62
|
+
{content && content.length && content.map((msg, index) =>
|
|
63
|
+
<CapColumn key={`"message-pop-content-${index}`} className="message-pop-item align-left" style={{ background: '#3F51B5', color: '#ffffff'}}>
|
|
65
64
|
{msg}
|
|
66
65
|
</CapColumn>)
|
|
67
66
|
}
|
|
@@ -102,7 +101,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
102
101
|
{content.actions.filter((action) => action.label).length &&
|
|
103
102
|
<div className="actions">
|
|
104
103
|
{_.map(content.actions, (action) => !!action.label &&
|
|
105
|
-
<span className="action">{action.label && action.label.toUpperCase()}</span>)}
|
|
104
|
+
<span className="action" key={`action-${action.label}`}>{action.label && action.label.toUpperCase()}</span>)}
|
|
106
105
|
</div>
|
|
107
106
|
}
|
|
108
107
|
</div>
|
|
@@ -157,8 +156,8 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
157
156
|
: ''
|
|
158
157
|
}
|
|
159
158
|
{this.props.templateData &&
|
|
160
|
-
[<p className="preview-info"><FormattedMessage {...messages.lastModified} />: {moment(this.props.templateData.updatedAt).format('MM-DD-YYYY')}</p>,
|
|
161
|
-
<p style={{marginBottom: '8px'}} className="preview-info"><FormattedMessage {...messages.uploadedBy} /> : {this.props.templateData.updatedByName}</p>,
|
|
159
|
+
[<p className="preview-info" key="preview-info-modified"><FormattedMessage {...messages.lastModified} />: {moment(this.props.templateData.updatedAt).format('MM-DD-YYYY')}</p>,
|
|
160
|
+
<p style={{marginBottom: '8px'}} className="preview-info" key="preview-info-updated"><FormattedMessage {...messages.uploadedBy} /> : {this.props.templateData.updatedByName}</p>,
|
|
162
161
|
]
|
|
163
162
|
}
|
|
164
163
|
</div>
|
package/config/app.js
CHANGED
|
@@ -7,14 +7,14 @@ const config = {
|
|
|
7
7
|
auth_endpoint: '/arya/api/v1/auth',
|
|
8
8
|
login_url: 'auth/login',
|
|
9
9
|
//dashboard_url: '/sms',
|
|
10
|
-
dashboard_url: '/
|
|
10
|
+
dashboard_url: '/v2',
|
|
11
11
|
},
|
|
12
12
|
development: {
|
|
13
13
|
api_endpoint: 'https://nightly.capillary.in/arya/api/v1/creatives',
|
|
14
14
|
auth_endpoint: 'https://nightly.capillary.in/arya/api/v1/auth',
|
|
15
15
|
login_url: 'auth/login',
|
|
16
16
|
// dashboard_url: '/sms',
|
|
17
|
-
dashboard_url: '/
|
|
17
|
+
dashboard_url: '/v2',
|
|
18
18
|
},
|
|
19
19
|
testing: {
|
|
20
20
|
api_endpoint: '',
|
package/containers/Cap/index.js
CHANGED
|
@@ -314,7 +314,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
314
314
|
logout={this.logout}
|
|
315
315
|
/> : ''}
|
|
316
316
|
<div className="main">
|
|
317
|
-
{loggedIn && type !== 'embedded' && this.props.location.pathname
|
|
317
|
+
{loggedIn && type !== 'embedded' && this.props.location.pathname.indexOf('v2') === -1 ? <div id="cap-sidebar" className={'sidebar'}>
|
|
318
318
|
<Sidebar
|
|
319
319
|
menuData={menuData}
|
|
320
320
|
productMenuData={productMenuData}
|
|
@@ -48,8 +48,17 @@ const makeSelectUser = () => createSelector(
|
|
|
48
48
|
);
|
|
49
49
|
const selectCurrentOrgDetails = () => createSelector(
|
|
50
50
|
selectCapDomain,
|
|
51
|
-
(globalState) =>
|
|
51
|
+
(globalState) => {
|
|
52
|
+
const currentOrgDetails = globalState.get('currentOrgDetails');
|
|
53
|
+
return currentOrgDetails ? currentOrgDetails.toJS() : null;
|
|
54
|
+
}
|
|
52
55
|
);
|
|
56
|
+
|
|
57
|
+
const makeSelectFetchingSchema = () => createSelector(
|
|
58
|
+
selectCapDomain,
|
|
59
|
+
(globalState) => globalState.get('fetchingSchema')
|
|
60
|
+
);
|
|
61
|
+
|
|
53
62
|
export {
|
|
54
63
|
makeSelectLocationState,
|
|
55
64
|
makeSelectAuthenticated,
|
|
@@ -59,4 +68,5 @@ export {
|
|
|
59
68
|
makeSelectUser,
|
|
60
69
|
selectCurrentOrgDetails,
|
|
61
70
|
isLoadingMetaEntities,
|
|
71
|
+
makeSelectFetchingSchema,
|
|
62
72
|
};
|
|
@@ -92,11 +92,13 @@ function SlideBoxContent(props) {
|
|
|
92
92
|
{isEditSms && (
|
|
93
93
|
<SmsEdit
|
|
94
94
|
location={creativesLocationProps}
|
|
95
|
+
isFullMode={isFullMode}
|
|
95
96
|
route={{ name: 'sms' }}
|
|
97
|
+
params={{id: templateData._id}}
|
|
96
98
|
isGetFormData={isGetFormData}
|
|
97
99
|
getFormSubscriptionData={getFormData}
|
|
98
100
|
getDefaultTags={type}
|
|
99
|
-
subscriptionTemplateDetails={templateData}
|
|
101
|
+
subscriptionTemplateDetails={templateData} // used only in library mode
|
|
100
102
|
/>
|
|
101
103
|
)}
|
|
102
104
|
{isCreateSms && (
|
|
@@ -107,6 +109,7 @@ function SlideBoxContent(props) {
|
|
|
107
109
|
isGetFormData={isGetFormData}
|
|
108
110
|
getFormSubscriptionData={getFormData}
|
|
109
111
|
getDefaultTags={type}
|
|
112
|
+
isFullMode={isFullMode}
|
|
110
113
|
/>
|
|
111
114
|
)}
|
|
112
115
|
{isEmailCreate && (
|
|
@@ -137,6 +140,7 @@ function SlideBoxContent(props) {
|
|
|
137
140
|
templateData={templateData}
|
|
138
141
|
getFormSubscriptionData={getFormData}
|
|
139
142
|
getDefaultTags={type}
|
|
143
|
+
isFullMode={isFullMode}
|
|
140
144
|
cap={cap}
|
|
141
145
|
/>
|
|
142
146
|
)}
|
|
@@ -2,20 +2,17 @@ import React from 'react';
|
|
|
2
2
|
import { FormattedMessage } from 'react-intl';
|
|
3
3
|
import { CapButton } from '@capillarytech/cap-ui-library';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import * as constants from './constants';
|
|
6
5
|
function SlideBoxFooter(props) {
|
|
7
|
-
const { slidBoxContent, onSave, messages, onEditTemplate,
|
|
8
|
-
const isEmailCreate = slidBoxContent === 'createTemplate' && currentChannel === constants.EMAIL && templateStep !== 'createTemplate';
|
|
9
|
-
const isCreate = (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate') && !isEmailCreate;
|
|
6
|
+
const { slidBoxContent, onSave, messages, onEditTemplate, onEmailNextStep} = props;
|
|
10
7
|
return (
|
|
11
8
|
<div>
|
|
12
9
|
<div>
|
|
13
|
-
{(
|
|
10
|
+
{props.shouldShowDoneFooter() && (
|
|
14
11
|
<CapButton onClick={onSave}>
|
|
15
12
|
<FormattedMessage {...messages.creativesTemplatesSave} />
|
|
16
13
|
</CapButton>
|
|
17
14
|
)}
|
|
18
|
-
{
|
|
15
|
+
{props.shouldShowContinueFooter() &&
|
|
19
16
|
<CapButton onClick={onEmailNextStep}>
|
|
20
17
|
<FormattedMessage {...messages.continue} />
|
|
21
18
|
</CapButton>
|
|
@@ -34,9 +31,8 @@ SlideBoxFooter.propTypes = {
|
|
|
34
31
|
onSave: PropTypes.func,
|
|
35
32
|
messages: PropTypes.object,
|
|
36
33
|
onEditTemplate: PropTypes.func,
|
|
37
|
-
currentChannel: PropTypes.string,
|
|
38
34
|
onEmailNextStep: PropTypes.func,
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
shouldShowContinueFooter: PropTypes.func,
|
|
36
|
+
shouldShowDoneFooter: PropTypes.func,
|
|
41
37
|
};
|
|
42
38
|
export default SlideBoxFooter;
|
|
@@ -10,6 +10,7 @@ import { connect } from 'react-redux';
|
|
|
10
10
|
import { createStructuredSelector } from 'reselect';
|
|
11
11
|
import { bindActionCreators } from 'redux';
|
|
12
12
|
import * as actions from './actions';
|
|
13
|
+
import {selectEmailLayout, uploadSelector, templateUserList} from '../Templates/selectors';
|
|
13
14
|
import SlideBoxContent from './SlideBoxContent';
|
|
14
15
|
import SlideBoxHeader from './SlideBoxHeader';
|
|
15
16
|
import SlideBoxFooter from './SlideBoxFooter';
|
|
@@ -20,7 +21,6 @@ import './index.scss';
|
|
|
20
21
|
import * as templateActions from '../Templates/actions';
|
|
21
22
|
import * as globalActions from '../Cap/actions';
|
|
22
23
|
import {isLoading as isLoadingSelector} from './selectors';
|
|
23
|
-
import {templateUserList} from '../Templates/selectors';
|
|
24
24
|
|
|
25
25
|
const classPrefix = 'add-creatives-section';
|
|
26
26
|
class Creatives extends React.Component {
|
|
@@ -36,13 +36,14 @@ class Creatives extends React.Component {
|
|
|
36
36
|
this.creativesTemplateSteps = {
|
|
37
37
|
1: 'modeSelection',
|
|
38
38
|
2: 'templateSelection', // only for email in current flows wil be used for mpush, line and wechat as well.
|
|
39
|
-
3: '
|
|
39
|
+
3: 'createTemplateContent',
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
componentWillUnmount() {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
if (!this.props.isFullMode) {
|
|
44
|
+
this.props.templateActions.resetTemplateStoreData();
|
|
45
|
+
this.props.globalActions.clearMetaEntities();
|
|
46
|
+
}
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
|
|
@@ -112,7 +113,7 @@ class Creatives extends React.Component {
|
|
|
112
113
|
}
|
|
113
114
|
return creativesTeplateData;
|
|
114
115
|
}
|
|
115
|
-
return null;
|
|
116
|
+
return templateData || null;
|
|
116
117
|
}
|
|
117
118
|
|
|
118
119
|
getCreativesData = (channel, template) => { //from creatives to consumers
|
|
@@ -152,23 +153,61 @@ class Creatives extends React.Component {
|
|
|
152
153
|
}
|
|
153
154
|
};
|
|
154
155
|
resetStep = () => {
|
|
155
|
-
this.setState({
|
|
156
|
+
this.setState(prevState => {
|
|
157
|
+
let newState = {
|
|
158
|
+
templateStep: 1,
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (prevState.currentChannel.toUpperCase() === constants.EMAIL) {
|
|
162
|
+
newState= { ...newState, emailCreateMode: null };
|
|
163
|
+
}
|
|
164
|
+
return newState;
|
|
165
|
+
});
|
|
156
166
|
}
|
|
157
|
-
|
|
167
|
+
handleClodeSlideBox = () => {
|
|
158
168
|
this.setState((prevState) => ({
|
|
159
169
|
...prevState,
|
|
160
170
|
templateData: undefined,
|
|
171
|
+
showSlideBox: false,
|
|
161
172
|
}), this.props.handleCloseCreatives);
|
|
162
173
|
};
|
|
163
174
|
saveMessage = () => {
|
|
164
175
|
this.setState({ isGetFormData: true });
|
|
165
176
|
};
|
|
166
|
-
|
|
177
|
+
shouldShowFooter = () => {
|
|
178
|
+
const {isFullMode} = this.props;
|
|
167
179
|
const {slidBoxContent, currentChannel, emailCreateMode, templateStep} = this.state;
|
|
168
|
-
|
|
169
|
-
|
|
180
|
+
let showFooter = false;
|
|
181
|
+
if (!isFullMode ) {
|
|
182
|
+
const isEmailCreate = slidBoxContent === 'createTemplate' && currentChannel === constants.EMAIL && templateStep !== 'createTemplateContent';
|
|
183
|
+
const isCreate = (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate') && !isEmailCreate;
|
|
184
|
+
showFooter = (isCreate || (isEmailCreate && emailCreateMode) || slidBoxContent === 'preview');
|
|
185
|
+
} else if (currentChannel === constants.EMAIL && isFullMode) {
|
|
186
|
+
const isEmailCreate = slidBoxContent === 'createTemplate' && currentChannel === constants.EMAIL && templateStep !== 'createTemplateContent';
|
|
187
|
+
showFooter = isEmailCreate && emailCreateMode;
|
|
188
|
+
}
|
|
189
|
+
if (currentChannel.toUpperCase() === constants.EMAIL && emailCreateMode === "upload") {
|
|
190
|
+
showFooter = showFooter && !this.props.isUploading;
|
|
191
|
+
}
|
|
192
|
+
return showFooter;
|
|
193
|
+
}
|
|
194
|
+
shouldShowDoneFooter = () => {
|
|
195
|
+
const {slidBoxContent, templateStep, currentChannel} = this.state;
|
|
196
|
+
const currentStep = this.creativesTemplateSteps[templateStep];
|
|
197
|
+
const isEmailCreate = slidBoxContent === 'createTemplate' && currentChannel.toUpperCase() === constants.EMAIL && currentStep !== 'createTemplateContent';
|
|
170
198
|
const isCreate = (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate') && !isEmailCreate;
|
|
171
|
-
return
|
|
199
|
+
return isCreate;
|
|
200
|
+
}
|
|
201
|
+
shouldShowContinueFooter = () => { // only for email for now, has to be modified according to channel
|
|
202
|
+
const {slidBoxContent, templateStep, currentChannel, emailCreateMode} = this.state;
|
|
203
|
+
let isShowContinueFooter = false;
|
|
204
|
+
if (this.props.EmailLayout !== null) {
|
|
205
|
+
const currentStep = this.creativesTemplateSteps[templateStep];
|
|
206
|
+
let isEmailCreate = slidBoxContent === 'createTemplate';
|
|
207
|
+
isEmailCreate = currentChannel.toUpperCase() === constants.EMAIL && ((emailCreateMode === "upload" && currentStep !== 'createTemplateContent') || ( emailCreateMode === "editor" && currentStep !== 'createTemplateContent' && currentStep !== "templateSelection"));
|
|
208
|
+
isShowContinueFooter = isEmailCreate && emailCreateMode;
|
|
209
|
+
}
|
|
210
|
+
return isShowContinueFooter;
|
|
172
211
|
}
|
|
173
212
|
render() {
|
|
174
213
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep} = this.state;
|
|
@@ -197,8 +236,6 @@ class Creatives extends React.Component {
|
|
|
197
236
|
getFormData={this.getFormData}
|
|
198
237
|
onCreateNew={this.onCreateNew}
|
|
199
238
|
isGetFormData={isGetFormData}
|
|
200
|
-
toggleShowSlideBox={this.toggleShowSlideBox}
|
|
201
|
-
showSlideBox={showSlideBox}
|
|
202
239
|
isFullMode={isFullMode}
|
|
203
240
|
currentChannel={currentChannel.toUpperCase()}
|
|
204
241
|
onChannelChange={this.onChannelChange}
|
|
@@ -210,7 +247,7 @@ class Creatives extends React.Component {
|
|
|
210
247
|
cap={cap}
|
|
211
248
|
/>
|
|
212
249
|
}
|
|
213
|
-
footer={
|
|
250
|
+
footer={this.shouldShowFooter() &&
|
|
214
251
|
<SlideBoxFooter
|
|
215
252
|
messages={this.props.messages}
|
|
216
253
|
onSave={this.saveMessage}
|
|
@@ -220,9 +257,11 @@ class Creatives extends React.Component {
|
|
|
220
257
|
currentChannel={currentChannel.toUpperCase()}
|
|
221
258
|
templateStep={this.creativesTemplateSteps[templateStep]}
|
|
222
259
|
emailCreateMode={emailCreateMode}
|
|
260
|
+
shouldShowContinueFooter={this.shouldShowContinueFooter}
|
|
261
|
+
shouldShowDoneFooter={this.shouldShowDoneFooter}
|
|
223
262
|
/>
|
|
224
263
|
}
|
|
225
|
-
handleClose={this.
|
|
264
|
+
handleClose={this.handleClodeSlideBox}
|
|
226
265
|
show={showSlideBox}
|
|
227
266
|
size="size-l"
|
|
228
267
|
/>
|
|
@@ -246,10 +285,14 @@ Creatives.propTypes = {
|
|
|
246
285
|
cap: PropTypes.object,
|
|
247
286
|
// isLoading: PropTypes.bool,
|
|
248
287
|
templateUserList: PropTypes.array,
|
|
288
|
+
isUploading: PropTypes.bool,
|
|
289
|
+
EmailLayout: PropTypes.string,
|
|
249
290
|
};
|
|
250
291
|
const mapStatesToProps = () => createStructuredSelector({
|
|
251
292
|
isLoading: isLoadingSelector(),
|
|
252
293
|
templateUserList: templateUserList(),
|
|
294
|
+
EmailLayout: selectEmailLayout(),
|
|
295
|
+
isUploading: uploadSelector(),
|
|
253
296
|
});
|
|
254
297
|
function mapDispatchToProps(dispatch) {
|
|
255
298
|
return {
|
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
import * as types from './constants';
|
|
8
8
|
|
|
9
|
-
export function createTemplate(template) {
|
|
9
|
+
export function createTemplate(template, onCreateTemplateComplete) {
|
|
10
10
|
return {
|
|
11
11
|
type: types.CREATE_TEMPLATE_REQUEST,
|
|
12
12
|
template,
|
|
13
|
+
onCreateTemplateComplete,
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
16
|
|
|
@@ -22,7 +23,6 @@ export function duplicateTemplate(id, channel) {
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
export function getTemplateDetails(id, channel) {
|
|
25
|
-
console.log('getting template', id, channel);
|
|
26
26
|
return {
|
|
27
27
|
type: types.GET_TEMPLATE_DETAILS_REQUEST,
|
|
28
28
|
id,
|
|
@@ -39,7 +39,6 @@ export function getAllAssets(assetType, queryParams) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export function getCmsSetting(cmsType, projectId, cmsMode, langId, isEdmSupport) {
|
|
42
|
-
console.log('cms actions', langId, isEdmSupport);
|
|
43
42
|
return {
|
|
44
43
|
type: types.GET_CMS_EDITOR_DETAILS_REQUEST,
|
|
45
44
|
cmsType,
|
|
@@ -383,26 +383,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
383
383
|
this.hideEdmOptions(nextProps.Email.CmsSettings.isDragDrop);
|
|
384
384
|
});
|
|
385
385
|
}
|
|
386
|
-
|
|
387
|
-
if (nextProps.Email.createResponse && nextProps.Email.createResponse.templateId) {
|
|
388
|
-
// this.resetSchema();
|
|
389
|
-
let message;
|
|
390
|
-
if (this.state.isEdit) {
|
|
391
|
-
message = getMessageObject('success', this.props.intl.formatMessage(messages.emailEditSuccess), true);
|
|
392
|
-
} else {
|
|
393
|
-
message = getMessageObject('success', this.props.intl.formatMessage(messages.emailCreateSuccess), true);
|
|
394
|
-
}
|
|
395
|
-
this.props.globalActions.addMessageToQueue(message);
|
|
396
|
-
this.props.actions.clearCRUDResponse();
|
|
397
|
-
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
398
|
-
const type = this.props.location.query.type;
|
|
399
|
-
const isLanguageSupport = this.props.location.query.isLanguageSupport || false;
|
|
400
|
-
const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
|
|
401
|
-
this.props.router.push({
|
|
402
|
-
pathname: `/email`,
|
|
403
|
-
query: type === 'embedded' ? {type: 'embedded', module, isLanguageSupport, isEdmSupport} : {module, isLanguageSupport, isEdmSupport},
|
|
404
|
-
});
|
|
405
|
-
}
|
|
406
386
|
if (nextProps.Email.createTemplateError && !_.isEqual(nextProps.Email.createTemplateError, this.props.Email.createTemplateError)) {
|
|
407
387
|
const message = getMessageObject('error', (nextProps.Email.createTemplateErrorMessage && nextProps.Email.createTemplateErrorMessage !== '') ? nextProps.Email.createTemplateErrorMessage : this.props.intl.formatMessage(messages.somethingWentWrong), true);
|
|
408
388
|
this.props.globalActions.addMessageToQueue(message);
|
|
@@ -453,7 +433,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
453
433
|
});
|
|
454
434
|
}
|
|
455
435
|
|
|
456
|
-
if (nextProps.metaEntities && nextProps.metaEntities.tags && nextProps.metaEntities.tags.custom && !_.isEqual(this.props.metaEntities.tags, nextProps.metaEntities.tags)) {
|
|
436
|
+
if (nextProps.metaEntities && nextProps.metaEntities.tags && nextProps.metaEntities.tags.custom && this.props.metaEntities.tags && this.props.metaEntities.tags.standard && !_.isEqual(this.props.metaEntities.tags, nextProps.metaEntities.tags)) {
|
|
457
437
|
let injectedTags = _.cloneDeep(this.state.injectedTags);
|
|
458
438
|
if (!_.isEmpty(injectedTags)) {
|
|
459
439
|
delete injectedTags["Registration custom fields"];
|
|
@@ -635,6 +615,33 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
635
615
|
// this.props.actions.getAllAssets("image", params);
|
|
636
616
|
});
|
|
637
617
|
}
|
|
618
|
+
onUpdateTemplateComplete = (createResponse) => {
|
|
619
|
+
if (createResponse && createResponse.templateId) {
|
|
620
|
+
// this.resetSchema();
|
|
621
|
+
let message;
|
|
622
|
+
if (this.state.isEdit) {
|
|
623
|
+
message = getMessageObject('success', this.props.intl.formatMessage(messages.emailEditSuccess), true);
|
|
624
|
+
} else {
|
|
625
|
+
message = getMessageObject('success', this.props.intl.formatMessage(messages.emailCreateSuccess), true);
|
|
626
|
+
}
|
|
627
|
+
this.props.globalActions.addMessageToQueue(message);
|
|
628
|
+
this.props.actions.clearCRUDResponse();
|
|
629
|
+
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
630
|
+
const type = this.props.location.query.type;
|
|
631
|
+
const isLanguageSupport = this.props.location.query.isLanguageSupport || false;
|
|
632
|
+
const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
|
|
633
|
+
if (this.props.isFullMode) {
|
|
634
|
+
const {versions, ...rest} = createResponse.templateId;
|
|
635
|
+
this.props.getFormSubscriptionData({ value: versions, ...rest, validity: true});
|
|
636
|
+
} else {
|
|
637
|
+
this.props.router.push({
|
|
638
|
+
pathname: `/email`,
|
|
639
|
+
query: type === 'embedded' ? {type: 'embedded', module, isLanguageSupport, isEdmSupport} : {module, isLanguageSupport, isEdmSupport},
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
|
|
638
645
|
getSupportedLanguages = (props) => {
|
|
639
646
|
const {currentOrgDetails} = props;
|
|
640
647
|
let supportedLanguages = [];
|
|
@@ -657,7 +664,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
657
664
|
}
|
|
658
665
|
});
|
|
659
666
|
}
|
|
660
|
-
|
|
661
667
|
setNewLanguageContent = (data) => {
|
|
662
668
|
const content = _.cloneDeep(data);
|
|
663
669
|
const formData = _.cloneDeep(this.state.formData);
|
|
@@ -1652,7 +1658,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1652
1658
|
langTab = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(newActiveTab);
|
|
1653
1659
|
}
|
|
1654
1660
|
const selectedLanguage = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(data.iso_code);
|
|
1655
|
-
tabKey = formData[`${this.state.currentTab - 1}`][data.iso_code].tabKey;
|
|
1661
|
+
tabKey = formData[`${this.state.currentTab - 1}`][data.iso_code].tabKey;
|
|
1656
1662
|
const tabIndex = (selectedLanguage) + 1;
|
|
1657
1663
|
const containers = schema.containers.slice();
|
|
1658
1664
|
const tabContent = _.cloneDeep(containers[0].tabContent.sections[0]);
|
|
@@ -2362,7 +2368,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2362
2368
|
|
|
2363
2369
|
// if (saveCount === 0) {
|
|
2364
2370
|
|
|
2365
|
-
this.props.actions.createTemplate(obj);
|
|
2371
|
+
this.props.actions.createTemplate(obj, this.onUpdateTemplateComplete);
|
|
2366
2372
|
// } else {
|
|
2367
2373
|
// this.setState({saveObj: obj, targetSaveCount: saveCount, mode: "save", saveEdmDataMode: 'save'}, () => {
|
|
2368
2374
|
// _.forEach(data.selectedLanguages, (language, langIndex) => {
|
|
@@ -2375,7 +2381,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2375
2381
|
// });
|
|
2376
2382
|
// }
|
|
2377
2383
|
}
|
|
2378
|
-
|
|
2379
2384
|
handleOk = () => {
|
|
2380
2385
|
const formData = _.cloneDeep(this.state.formData);
|
|
2381
2386
|
const activeLangTab = formData[`${this.state.currentTab - 1}`].activeTab;
|
|
@@ -2632,7 +2637,8 @@ Email.propTypes = {
|
|
|
2632
2637
|
getDefaultTags: PropTypes.string,
|
|
2633
2638
|
currentOrgDetails: PropTypes.object,
|
|
2634
2639
|
isLoadingMetaEntities: PropTypes.bool,
|
|
2635
|
-
creativesContainerActions: PropTypes.object,
|
|
2640
|
+
// creativesContainerActions: PropTypes.object,
|
|
2641
|
+
isFullMode: PropTypes.bool,
|
|
2636
2642
|
};
|
|
2637
2643
|
|
|
2638
2644
|
const mapStateToProps = (state, props) => createStructuredSelector({
|
|
@@ -12,6 +12,7 @@ export function* createTemplate(template) {
|
|
|
12
12
|
errorMsg = result.message;
|
|
13
13
|
}
|
|
14
14
|
yield put({ type: types.CREATE_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg });
|
|
15
|
+
yield template.onCreateTemplateComplete(result.response);
|
|
15
16
|
} catch (error) {
|
|
16
17
|
yield put({ type: types.CREATE_TEMPLATE_FAILURE, error, errorMsg });
|
|
17
18
|
}
|