@capillarytech/creatives-library 3.0.28 → 3.0.30
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/FormBuilder/index.js +2 -2
- package/components/TemplatePreview/index.js +5 -0
- package/components/TemplatePreview/messages.js +12 -0
- package/config/app.js +2 -0
- package/containers/Cap/index.js +1 -0
- package/containers/Line/Create/index.js +2 -2
- package/containers/Line/Edit/index.js +2 -2
- package/containers/MobilePush/Create/index.js +2 -2
- package/containers/MobilePush/Edit/index.js +2 -2
- package/containers/Sms/Create/index.js +2 -3
- package/containers/Templates/index.js +9 -7
- package/hoc/withCreatives.js +46 -0
- package/hoc/withStyles.js +12 -0
- package/index.js +2 -1
- package/package.json +1 -4
- package/routes.js +2 -1
- package/services/api.js +14 -0
- package/utils/smsCharCountV2.js +28 -6
- package/v2Components/EmailMobilePreview/index.js +3 -2
- package/v2Components/TemplatePreview/_templatePreview.scss +8 -0
- package/v2Components/TemplatePreview/index.js +29 -11
- package/v2Components/TemplatePreview/messages.js +4 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +36 -20
- package/v2Containers/CreativesContainer/index.js +9 -6
- package/v2Containers/Ebill/index.js +9 -6
- package/v2Containers/Email/index.js +10 -7
- package/v2Containers/LanguageProvider/index.js +2 -0
- package/v2Containers/LanguageProvider/reducer.js +1 -1
- package/v2Containers/Line/Create/index.js +8 -6
- package/v2Containers/Line/Edit/index.js +8 -5
- package/v2Containers/MobilePush/Create/index.js +8 -5
- package/v2Containers/MobilePush/Edit/index.js +8 -5
- package/v2Containers/Sms/Create/index.js +10 -7
- package/v2Containers/Sms/Edit/index.js +10 -7
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +29 -0
- package/v2Containers/TemplatesV2/index.js +29 -51
- package/v2Containers/WeChat/MapTemplates/index.js +8 -10
- package/v2Containers/TemplatesV2/_templatesV2.scss +0 -5
|
@@ -119,8 +119,11 @@ class Creatives extends React.Component {
|
|
|
119
119
|
channel: 'CALL_TASK',
|
|
120
120
|
...data,
|
|
121
121
|
});
|
|
122
|
-
}
|
|
122
|
+
};
|
|
123
123
|
|
|
124
|
+
onValidationFail = () => {
|
|
125
|
+
this.setState({ isGetFormData: false });
|
|
126
|
+
};
|
|
124
127
|
getTemplateData = (templateData) => { //from consumers to creatives
|
|
125
128
|
const {isFullMode} = this.props;
|
|
126
129
|
if (!isFullMode && templateData) { // for component mode
|
|
@@ -224,6 +227,7 @@ class Creatives extends React.Component {
|
|
|
224
227
|
}
|
|
225
228
|
return templateData;
|
|
226
229
|
};
|
|
230
|
+
|
|
227
231
|
getSlideBocContent({mode, templateData, isFullMode}) {
|
|
228
232
|
let creativesMode = isFullMode ? 'createTemplate' : 'templates';// for library mode templates page is initial mode and for full mode createTemplates
|
|
229
233
|
if (mode === 'create' && isFullMode) {
|
|
@@ -253,7 +257,6 @@ class Creatives extends React.Component {
|
|
|
253
257
|
);
|
|
254
258
|
}
|
|
255
259
|
};
|
|
256
|
-
|
|
257
260
|
setIsLoadingContent = (isLoadingContent) => {
|
|
258
261
|
if (this.state.isLoadingContent !== isLoadingContent) {
|
|
259
262
|
this.setState({isLoadingContent });
|
|
@@ -280,9 +283,6 @@ class Creatives extends React.Component {
|
|
|
280
283
|
saveMessage = () => {
|
|
281
284
|
this.setState({ isGetFormData: true });
|
|
282
285
|
};
|
|
283
|
-
onValidationFail = () => {
|
|
284
|
-
this.setState({ isGetFormData: false });
|
|
285
|
-
}
|
|
286
286
|
discardMessage = () => {
|
|
287
287
|
this.setState({ isDiscardMessage: true });
|
|
288
288
|
}
|
|
@@ -404,10 +404,11 @@ class Creatives extends React.Component {
|
|
|
404
404
|
const name = get(formData, 'template-name');
|
|
405
405
|
return showTemplateNameComponentEdit ? this.templateNameComponentInput({formData, onFormDataChange, name}) : this.templateNameComponentHeader({formData, onFormDataChange, name});
|
|
406
406
|
}
|
|
407
|
+
return false;
|
|
407
408
|
}
|
|
408
409
|
render() {
|
|
409
410
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage} = this.state;
|
|
410
|
-
const {isFullMode, creativesMode, cap, isUploading, channelsToHide} = this.props;
|
|
411
|
+
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, forwardedTags} = this.props;
|
|
411
412
|
return (
|
|
412
413
|
<SlideBoxWrapper className={classnames(`${classPrefix} ${isFullMode ? 'creatives-full-mode' : 'creatives-library-mode'}`)}>
|
|
413
414
|
<CapSlideBox
|
|
@@ -458,6 +459,7 @@ class Creatives extends React.Component {
|
|
|
458
459
|
showTemplateName={this.showTemplateName}
|
|
459
460
|
onValidationFail={this.onValidationFail}
|
|
460
461
|
channelsToHide={channelsToHide}
|
|
462
|
+
forwardedTags={forwardedTags}
|
|
461
463
|
/>
|
|
462
464
|
}
|
|
463
465
|
footer={this.shouldShowFooter() &&
|
|
@@ -503,6 +505,7 @@ Creatives.propTypes = {
|
|
|
503
505
|
isUploading: PropTypes.bool,
|
|
504
506
|
EmailLayout: PropTypes.string,
|
|
505
507
|
channelsToHide: PropTypes.array,
|
|
508
|
+
forwardedTags: PropTypes.object,
|
|
506
509
|
};
|
|
507
510
|
const mapStatesToProps = () => createStructuredSelector({
|
|
508
511
|
isLoading: isLoadingSelector(),
|
|
@@ -7,24 +7,23 @@
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { connect } from 'react-redux';
|
|
11
10
|
import { bindActionCreators } from 'redux';
|
|
12
11
|
import { Spin, Row, Col, Breadcrumb } from 'antd';
|
|
13
12
|
import Helmet from 'react-helmet';
|
|
14
|
-
import {
|
|
13
|
+
import { intlShape } from 'react-intl';
|
|
15
14
|
import _ from 'lodash';
|
|
16
15
|
import { createStructuredSelector } from 'reselect';
|
|
17
16
|
import * as actions from './actions';
|
|
18
17
|
import FormBuilder from '../../v2Components/FormBuilder';
|
|
19
18
|
import { makeSelectMetaEntities, makeSelectAuthenticated, setInjectedTags } from '../Cap/selectors';
|
|
20
|
-
import * as globalActions from '../Cap/actions';
|
|
21
|
-
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
22
19
|
import { makeSelectTemplates } from '../Templates/selectors';
|
|
23
20
|
import {getMessageObject} from '../../utils/messageUtils';
|
|
24
21
|
import makeSelectEbill from './selectors';
|
|
25
22
|
import messages from './messages';
|
|
26
23
|
import EmailPreview from '../../v2Components/EmailPreview';
|
|
27
24
|
import './_ebill.scss';
|
|
25
|
+
import withCreatives from '../../hoc/withCreatives';
|
|
26
|
+
|
|
28
27
|
const BreadcrumbItem = Breadcrumb.Item;
|
|
29
28
|
|
|
30
29
|
export class Ebill extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
@@ -1253,8 +1252,12 @@ const mapStateToProps = createStructuredSelector({
|
|
|
1253
1252
|
function mapDispatchToProps(dispatch) {
|
|
1254
1253
|
return {
|
|
1255
1254
|
actions: bindActionCreators(actions, dispatch),
|
|
1256
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
1257
1255
|
};
|
|
1258
1256
|
}
|
|
1259
1257
|
|
|
1260
|
-
export default
|
|
1258
|
+
export default withCreatives({
|
|
1259
|
+
WrappedComponent: Ebill,
|
|
1260
|
+
mapStateToProps,
|
|
1261
|
+
mapDispatchToProps,
|
|
1262
|
+
userAuth: true,
|
|
1263
|
+
});
|
|
@@ -7,10 +7,9 @@
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { connect } from 'react-redux';
|
|
11
10
|
import { bindActionCreators } from 'redux';
|
|
12
11
|
import { Row, Col, Popover, Modal } from 'antd';
|
|
13
|
-
import {
|
|
12
|
+
import { intlShape, FormattedMessage } from 'react-intl';
|
|
14
13
|
import { CapButton, CapInput, CapSpin, CapSlideBox, CapCustomCard, CapNotification } from '@capillarytech/cap-ui-library';
|
|
15
14
|
import { createStructuredSelector } from 'reselect';
|
|
16
15
|
import _ from 'lodash';
|
|
@@ -19,8 +18,6 @@ import FormBuilder from '../../v2Components/FormBuilder';
|
|
|
19
18
|
import { makeSelectMetaEntities, selectCurrentOrgDetails, isLoadingMetaEntities, makeSelectAuthenticated, setInjectedTags } from '../Cap/selectors';
|
|
20
19
|
import * as actions from './actions';
|
|
21
20
|
import * as templatesActions from '../Templates/actions';
|
|
22
|
-
import * as globalActions from '../Cap/actions';
|
|
23
|
-
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
24
21
|
import {makeSelectEmail} from './selectors';
|
|
25
22
|
import { makeSelectTemplates } from '../Templates/selectors';
|
|
26
23
|
import messages from './messages';
|
|
@@ -31,6 +28,8 @@ import EmailPreview from '../../v2Components/EmailPreview';
|
|
|
31
28
|
|
|
32
29
|
import Pagination from '../../v2Components/Pagination';
|
|
33
30
|
import * as creativesContainerActions from '../CreativesContainer/actions';
|
|
31
|
+
import withCreatives from '../../hoc/withCreatives';
|
|
32
|
+
|
|
34
33
|
const {CapCustomCardList} = CapCustomCard;
|
|
35
34
|
export class Email extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
36
35
|
constructor(props) {
|
|
@@ -1421,6 +1420,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1421
1420
|
newContainerInputFieldCol.style.display = isDragDrop ? "none" : '';
|
|
1422
1421
|
}
|
|
1423
1422
|
if (containerInputFieldCol.id === 'tab-options-popover') {
|
|
1423
|
+
// eslint-disable-next-line no-param-reassign
|
|
1424
1424
|
containerInputFieldCol.colStyle.display = isDragDrop ? "flex" : "none";
|
|
1425
1425
|
_.forEach(containerInputFieldCol.content.sections[0].inputFields, (tabPopoverSection) => {
|
|
1426
1426
|
if (tabPopoverSection.cols[0].id === 'switch-editor-label') {
|
|
@@ -2684,11 +2684,14 @@ const mapStateToProps = (state, props) => createStructuredSelector({
|
|
|
2684
2684
|
function mapDispatchToProps(dispatch) {
|
|
2685
2685
|
return {
|
|
2686
2686
|
actions: bindActionCreators(actions, dispatch),
|
|
2687
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
2688
2687
|
templatesActions: bindActionCreators(templatesActions, dispatch),
|
|
2689
2688
|
creativesContainerActions: bindActionCreators(creativesContainerActions, dispatch),
|
|
2690
2689
|
};
|
|
2691
2690
|
}
|
|
2692
2691
|
|
|
2693
|
-
export default
|
|
2694
|
-
|
|
2692
|
+
export default withCreatives({
|
|
2693
|
+
WrappedComponent: Email,
|
|
2694
|
+
mapStateToProps,
|
|
2695
|
+
mapDispatchToProps,
|
|
2696
|
+
userAuth: true,
|
|
2697
|
+
});
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React, { Component } from 'react';
|
|
3
|
-
import {connect} from 'react-redux';
|
|
4
3
|
import { bindActionCreators } from 'redux';
|
|
5
|
-
import {
|
|
4
|
+
import { intlShape } from 'react-intl';
|
|
6
5
|
import { createStructuredSelector } from 'reselect';
|
|
7
6
|
import { Row, Col, Spin, Breadcrumb } from 'antd';
|
|
8
7
|
import _ from 'lodash';
|
|
9
8
|
import messages from './messages';
|
|
10
9
|
import * as actions from './actions';
|
|
11
10
|
import FormBuilder from '../../../v2Components/FormBuilder';
|
|
12
|
-
import { UserIsAuthenticated } from '../../../utils/authWrapper';
|
|
13
|
-
import * as globalActions from '../../Cap/actions';
|
|
14
11
|
//import { makeSelectCreate, makeSelectCreateResponse, makeSelectEdit, makeSelectEditResponse, makeSelectTemplateDetailsResponse } from './selectors';
|
|
15
12
|
import {makeSelectCreateLine} from './selectors';
|
|
16
13
|
import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
|
|
17
14
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
18
15
|
import { makeSelectTemplates } from '../../Templates/selectors';
|
|
19
16
|
import './_lineCreate.scss';
|
|
17
|
+
import withCreatives from '../../../hoc/withCreatives';
|
|
20
18
|
|
|
21
19
|
const BreadcrumbItem = Breadcrumb.Item;
|
|
22
20
|
|
|
@@ -813,8 +811,12 @@ const mapStateToProps = createStructuredSelector({
|
|
|
813
811
|
function mapDispatchToProps(dispatch) {
|
|
814
812
|
return {
|
|
815
813
|
actions: bindActionCreators(actions, dispatch),
|
|
816
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
817
814
|
};
|
|
818
815
|
}
|
|
819
816
|
|
|
820
|
-
export default
|
|
817
|
+
export default withCreatives({
|
|
818
|
+
WrappedComponent: Line,
|
|
819
|
+
mapStateToProps,
|
|
820
|
+
mapDispatchToProps,
|
|
821
|
+
userAuth: true,
|
|
822
|
+
});
|
|
@@ -9,21 +9,20 @@ import PropTypes from 'prop-types';
|
|
|
9
9
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import {bindActionCreators} from "redux";
|
|
12
|
-
import { connect } from 'react-redux';
|
|
13
12
|
import { Row, Col, Spin, Breadcrumb, notification } from 'antd';
|
|
14
13
|
import { createStructuredSelector } from 'reselect';
|
|
15
|
-
import {
|
|
14
|
+
import { intlShape } from 'react-intl';
|
|
16
15
|
import _ from 'lodash';
|
|
17
16
|
import {makeSelectEdit, makeSelectEditResponse, makeSelectTemplateDetailsResponse} from "../../MobilePush/Edit/selectors";
|
|
18
17
|
import {makeSelectMetaEntities, setInjectedTags} from "../../Cap/selectors";
|
|
19
18
|
import {getMessageObject} from "../../../utils/messageUtils";
|
|
20
19
|
import FormBuilder from '../../../v2Components/FormBuilder';
|
|
21
|
-
import * as globalActions from "../../Cap/actions";
|
|
22
20
|
import * as actions from "../../MobilePush/Edit/actions";
|
|
23
21
|
import * as templatesActions from "../../Templates/actions";
|
|
24
22
|
import {makeSelectTemplates} from "../../Templates/selectors";
|
|
25
23
|
import messages from './messages';
|
|
26
24
|
import './_lineEdit.scss';
|
|
25
|
+
import withCreatives from '../../../hoc/withCreatives';
|
|
27
26
|
|
|
28
27
|
const BreadcrumbItem = Breadcrumb.Item;
|
|
29
28
|
|
|
@@ -1040,9 +1039,13 @@ const mapStateToProps = createStructuredSelector({
|
|
|
1040
1039
|
function mapDispatchToProps(dispatch) {
|
|
1041
1040
|
return {
|
|
1042
1041
|
actions: bindActionCreators(actions, dispatch),
|
|
1043
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
1044
1042
|
templatesActions: bindActionCreators(templatesActions, dispatch),
|
|
1045
1043
|
};
|
|
1046
1044
|
}
|
|
1047
1045
|
|
|
1048
|
-
export default
|
|
1046
|
+
export default withCreatives({
|
|
1047
|
+
WrappedComponent: Edit,
|
|
1048
|
+
mapStateToProps,
|
|
1049
|
+
mapDispatchToProps,
|
|
1050
|
+
userAuth: false,
|
|
1051
|
+
});
|
|
@@ -7,20 +7,19 @@
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { connect } from 'react-redux';
|
|
11
10
|
import { bindActionCreators } from 'redux';
|
|
12
11
|
import { notification } from 'antd';
|
|
13
12
|
import {get, set, filter, isEmpty, map, forEach, uniqueId, cloneDeep, isEqual, findIndex} from 'lodash';
|
|
14
13
|
import { createStructuredSelector } from 'reselect';
|
|
15
|
-
import {
|
|
14
|
+
import { intlShape, FormattedMessage } from 'react-intl';
|
|
16
15
|
import styled from 'styled-components';
|
|
17
16
|
import { CapSlideBox, CapHeader, CapTable, CapLink, CapRow, CapColumn, CapIcons, CapSpin, CapNotification } from '@capillarytech/cap-ui-library';
|
|
18
17
|
import { makeSelectCreate, makeSelectCreateResponse, makeSelectIosCta } from './selectors';
|
|
19
18
|
import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
|
|
20
|
-
import * as globalActions from '../../Cap/actions';
|
|
21
19
|
import FormBuilder from '../../../v2Components/FormBuilder';
|
|
22
20
|
import './_mobilePushCreate.scss';
|
|
23
21
|
import * as actions from './actions';
|
|
22
|
+
import withCreatives from '../../../hoc/withCreatives';
|
|
24
23
|
|
|
25
24
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
26
25
|
import { makeSelectTemplates } from '../../Templates/selectors';
|
|
@@ -1809,8 +1808,12 @@ const mapStateToProps = createStructuredSelector({
|
|
|
1809
1808
|
function mapDispatchToProps(dispatch) {
|
|
1810
1809
|
return {
|
|
1811
1810
|
actions: bindActionCreators(actions, dispatch),
|
|
1812
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
1813
1811
|
};
|
|
1814
1812
|
}
|
|
1815
1813
|
|
|
1816
|
-
export default
|
|
1814
|
+
export default withCreatives({
|
|
1815
|
+
WrappedComponent: Create,
|
|
1816
|
+
mapStateToProps,
|
|
1817
|
+
mapDispatchToProps,
|
|
1818
|
+
userAuth: false,
|
|
1819
|
+
});
|
|
@@ -9,10 +9,9 @@ import PropTypes from 'prop-types';
|
|
|
9
9
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import {bindActionCreators} from "redux";
|
|
12
|
-
import { connect } from 'react-redux';
|
|
13
12
|
import { notification } from 'antd';
|
|
14
13
|
import { createStructuredSelector } from 'reselect';
|
|
15
|
-
import {
|
|
14
|
+
import { intlShape, FormattedMessage } from 'react-intl';
|
|
16
15
|
import _, {get, findIndex, set, forEach, cloneDeep} from 'lodash';
|
|
17
16
|
import { CapSpin, CapSlideBox, CapHeader, CapTable, CapLink, CapRow, CapColumn, CapIcons, CapNotification} from '@capillarytech/cap-ui-library';
|
|
18
17
|
import styled from 'styled-components';
|
|
@@ -20,13 +19,13 @@ import {makeSelectEdit, makeSelectEditResponse, makeSelectTemplateDetailsRespons
|
|
|
20
19
|
import {makeSelectMetaEntities, setInjectedTags, isLoadingMetaEntities} from "../../Cap/selectors";
|
|
21
20
|
import {getMessageObject} from "../../../utils/messageUtils";
|
|
22
21
|
import FormBuilder from '../../../v2Components/FormBuilder';
|
|
23
|
-
import * as globalActions from "../../Cap/actions";
|
|
24
22
|
import * as actions from "../../MobilePush/Edit/actions";
|
|
25
23
|
import * as templatesActions from "../../Templates/actions";
|
|
26
24
|
import {makeSelectTemplates} from "../../Templates/selectors";
|
|
27
25
|
import messages from './messages';
|
|
28
26
|
import './_mobilePushCreate.scss';
|
|
29
27
|
import {makeSelectCreate} from "../Create/selectors";
|
|
28
|
+
import withCreatives from '../../../hoc/withCreatives';
|
|
30
29
|
|
|
31
30
|
import getEventsMap from '../eventsMap';
|
|
32
31
|
import {getPrimaryCtaFields, getSecondaryCtaFields, getLinkTypeFields} from '../commonMethods';
|
|
@@ -1902,9 +1901,13 @@ const mapStateToProps = createStructuredSelector({
|
|
|
1902
1901
|
function mapDispatchToProps(dispatch) {
|
|
1903
1902
|
return {
|
|
1904
1903
|
actions: bindActionCreators(actions, dispatch),
|
|
1905
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
1906
1904
|
templatesActions: bindActionCreators(templatesActions, dispatch),
|
|
1907
1905
|
};
|
|
1908
1906
|
}
|
|
1909
1907
|
|
|
1910
|
-
export default
|
|
1908
|
+
export default withCreatives({
|
|
1909
|
+
WrappedComponent: Edit,
|
|
1910
|
+
mapStateToProps,
|
|
1911
|
+
mapDispatchToProps,
|
|
1912
|
+
userAuth: false,
|
|
1913
|
+
});
|
|
@@ -7,27 +7,26 @@
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { connect } from 'react-redux';
|
|
11
10
|
import { CapRow, CapColumn, CapSpin, CapNotification } from '@capillarytech/cap-ui-library';
|
|
12
|
-
import {
|
|
11
|
+
import { intlShape } from 'react-intl';
|
|
13
12
|
import { createStructuredSelector } from 'reselect';
|
|
14
13
|
import _ from 'lodash';
|
|
15
14
|
import { bindActionCreators } from 'redux';
|
|
16
15
|
import { makeSelectCreate, makeSelectCreateResponse } from './selectors';
|
|
17
16
|
import { makeSelectMetaEntities, isLoadingMetaEntities, setInjectedTags } from '../../Cap/selectors';
|
|
18
|
-
import { UserIsAuthenticated } from '../../../utils/authWrapper';
|
|
19
17
|
import './_smsCreate.scss';
|
|
20
18
|
import FormBuilder from '../../../v2Components/FormBuilder';
|
|
21
19
|
import * as actions from './actions';
|
|
22
20
|
import messages from './messages';
|
|
23
21
|
import * as charCount from '../../../utils/smsCharCount';
|
|
24
22
|
import {checkUnicode, updateCharCount} from '../../../utils/smsCharCountV2';
|
|
25
|
-
import * as globalActions from '../../Cap/actions';
|
|
26
23
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
27
24
|
import * as creativesContainerActions from '../../CreativesContainer/actions';
|
|
28
25
|
import {SMS} from '../../CreativesContainer/constants';
|
|
29
26
|
// import callNativeEvent from '../../../utils/callNativeEvent';
|
|
30
27
|
import {showError} from '../commonMethods';
|
|
28
|
+
import withCreatives from '../../../hoc/withCreatives';
|
|
29
|
+
|
|
31
30
|
export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
32
31
|
constructor(props) {
|
|
33
32
|
super(props);
|
|
@@ -743,7 +742,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
743
742
|
}
|
|
744
743
|
const formData = _.cloneDeep(this.state.formData);
|
|
745
744
|
formData[currentTab - 1][field.id] = myField.value;
|
|
746
|
-
this.setState({formData});
|
|
745
|
+
this.setState({formData}, () => this.onTemplateContentChange());
|
|
747
746
|
}
|
|
748
747
|
|
|
749
748
|
startTemplateCreation(data) {
|
|
@@ -1009,9 +1008,13 @@ const mapStateToProps = createStructuredSelector({
|
|
|
1009
1008
|
function mapDispatchToProps(dispatch) {
|
|
1010
1009
|
return {
|
|
1011
1010
|
actions: bindActionCreators(actions, dispatch),
|
|
1012
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
1013
1011
|
creativesContainerActions: bindActionCreators(creativesContainerActions, dispatch),
|
|
1014
1012
|
};
|
|
1015
1013
|
}
|
|
1016
1014
|
|
|
1017
|
-
export default
|
|
1015
|
+
export default withCreatives({
|
|
1016
|
+
WrappedComponent: Create,
|
|
1017
|
+
mapStateToProps,
|
|
1018
|
+
mapDispatchToProps,
|
|
1019
|
+
userAuth: true,
|
|
1020
|
+
});
|
|
@@ -8,25 +8,24 @@
|
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
|
|
10
10
|
import React from 'react';
|
|
11
|
-
import { connect } from 'react-redux';
|
|
12
11
|
import { CapRow, CapColumn, CapSpin, CapNotification } from '@capillarytech/cap-ui-library';
|
|
13
|
-
import {
|
|
12
|
+
import { intlShape } from 'react-intl';
|
|
14
13
|
import { createStructuredSelector } from 'reselect';
|
|
15
14
|
import _ from 'lodash';
|
|
16
15
|
import { bindActionCreators } from 'redux';
|
|
17
16
|
import { makeSelectEdit, makeSelectEditResponse, makeSelectTemplateDetailsResponse } from './selectors';
|
|
18
17
|
import { makeSelectMetaEntities, isLoadingMetaEntities, setInjectedTags } from '../../Cap/selectors';
|
|
19
|
-
import { UserIsAuthenticated } from '../../../utils/authWrapper';
|
|
20
18
|
import FormBuilder from '../../../v2Components/FormBuilder';
|
|
21
19
|
import * as actions from './actions';
|
|
22
20
|
import {checkUnicode, updateCharCount} from '../../../utils/smsCharCountV2';
|
|
23
21
|
import '../Create/_smsCreate.scss';
|
|
24
22
|
import messages from './messages';
|
|
25
|
-
import * as globalActions from '../../Cap/actions';
|
|
26
23
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
27
24
|
import * as creativesContainerActions from '../../CreativesContainer/actions';
|
|
28
25
|
// import callNativeEvent from '../../../utils/callNativeEvent';
|
|
29
26
|
import {showError} from '../commonMethods';
|
|
27
|
+
import withCreatives from '../../../hoc/withCreatives';
|
|
28
|
+
|
|
30
29
|
export class Edit extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
31
30
|
constructor(props) {
|
|
32
31
|
super(props);
|
|
@@ -790,7 +789,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
790
789
|
const formData = _.cloneDeep(this.state.formData);
|
|
791
790
|
formData[currentTab - 1][field.id] = myField.value;
|
|
792
791
|
formData.base[field.id] = myField.value;
|
|
793
|
-
this.setState({formData});
|
|
792
|
+
this.setState({formData}, () => this.onTemplateContentChange());
|
|
794
793
|
}
|
|
795
794
|
|
|
796
795
|
handleFrameTasks = (e) => {
|
|
@@ -1009,9 +1008,13 @@ const mapStateToProps = createStructuredSelector({
|
|
|
1009
1008
|
function mapDispatchToProps(dispatch) {
|
|
1010
1009
|
return {
|
|
1011
1010
|
actions: bindActionCreators(actions, dispatch),
|
|
1012
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
1013
1011
|
creativesContainerActions: bindActionCreators(creativesContainerActions, dispatch),
|
|
1014
1012
|
};
|
|
1015
1013
|
}
|
|
1016
1014
|
|
|
1017
|
-
export default
|
|
1015
|
+
export default withCreatives({
|
|
1016
|
+
WrappedComponent: Edit,
|
|
1017
|
+
mapStateToProps,
|
|
1018
|
+
mapDispatchToProps,
|
|
1019
|
+
userAuth: true,
|
|
1020
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { css } from 'styled-components';
|
|
2
|
+
import {CAP_SPACE_24, CAP_SPACE_16} from '@capillarytech/cap-ui-library/styled/variables';
|
|
3
|
+
|
|
4
|
+
export default css`
|
|
5
|
+
.cap-tab-v2-wrapper{
|
|
6
|
+
.ant-tabs-tabpane {
|
|
7
|
+
border: none;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.component-wrapper {
|
|
12
|
+
${(props) => props.isFullMode ? `
|
|
13
|
+
max-width: 1140px;
|
|
14
|
+
margin: 0 auto;
|
|
15
|
+
width: 100%;
|
|
16
|
+
padding: ${CAP_SPACE_24} 0;
|
|
17
|
+
.ant-tabs-content{
|
|
18
|
+
margin-top: ${CAP_SPACE_16}
|
|
19
|
+
}
|
|
20
|
+
` : `.cap-tab-v2 {
|
|
21
|
+
height: calc(100vh - 118px);
|
|
22
|
+
} `}
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
export const CapTabStyle = css`
|
|
27
|
+
${(props) => props.isFullMode ? `margin-top: ${CAP_SPACE_24}` : ``
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
@@ -5,18 +5,15 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
9
8
|
import React from 'react';
|
|
10
9
|
import { connect } from 'react-redux';
|
|
11
10
|
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
12
11
|
import { createStructuredSelector } from 'reselect';
|
|
13
12
|
import { bindActionCreators } from 'redux';
|
|
14
|
-
import styled from 'styled-components';
|
|
15
13
|
import { CapTab, CapCustomCard, CapButton, CapHeader, CapSpin, CapIcon } from '@capillarytech/cap-ui-library';
|
|
16
14
|
import { find, get } from 'lodash';
|
|
17
15
|
import Helmet from 'react-helmet';
|
|
18
16
|
|
|
19
|
-
import {CAP_SPACE_24, CAP_SPACE_16} from '@capillarytech/cap-ui-library/styled/variables';
|
|
20
17
|
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
21
18
|
import { makeSelectTemplates, makeSelectTemplatesResponse } from '../Templates/selectors';
|
|
22
19
|
import messages from './messages';
|
|
@@ -24,29 +21,13 @@ import * as actions from './actions';
|
|
|
24
21
|
import Templates from '../Templates';
|
|
25
22
|
import CallTask from '../CallTask';
|
|
26
23
|
import Gallery from '../Assets/Gallery';
|
|
27
|
-
import '
|
|
24
|
+
import withStyles from '../../hoc/withStyles';
|
|
25
|
+
import styles, { CapTabStyle } from './TemplatesV2.style';
|
|
28
26
|
|
|
29
27
|
const {CapCustomCardList} = CapCustomCard;
|
|
30
28
|
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
max-width: 1140px;
|
|
34
|
-
margin: 0 auto;
|
|
35
|
-
width: 100%;
|
|
36
|
-
padding: ${CAP_SPACE_24} 0;
|
|
37
|
-
.ant-tabs-content{
|
|
38
|
-
margin-top: ${CAP_SPACE_16}
|
|
39
|
-
}
|
|
40
|
-
` : `.cap-tab-v2 {
|
|
41
|
-
height: calc(100vh - 118px);
|
|
42
|
-
} `}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
`;
|
|
46
|
-
const MarginTop = styled.div`
|
|
47
|
-
${(props) => props.isFullMode ? `margin-top: ${CAP_SPACE_24}` : ``
|
|
48
|
-
}
|
|
49
|
-
`;
|
|
29
|
+
const StyledCapTab = withStyles(CapTab, CapTabStyle);
|
|
30
|
+
|
|
50
31
|
export class TemplatesV2 extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
51
32
|
constructor(props) {
|
|
52
33
|
super(props);
|
|
@@ -146,21 +127,20 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
146
127
|
}
|
|
147
128
|
}
|
|
148
129
|
|
|
149
|
-
setChannelContent = (selectedChannel, argsPanes) =>
|
|
150
|
-
|
|
151
|
-
|
|
130
|
+
setChannelContent = (selectedChannel, argsPanes) => (
|
|
131
|
+
argsPanes.map((pane) => {
|
|
132
|
+
let content = null;
|
|
152
133
|
if (pane.key === selectedChannel) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
channel = "mobilepush";
|
|
156
|
-
}
|
|
157
|
-
pane.content = this.getTemplatesComponent(channel);
|
|
158
|
-
return pane;
|
|
134
|
+
const channel = selectedChannel === "mpush" ? "mobilepush" : selectedChannel;
|
|
135
|
+
content = this.getTemplatesComponent(channel);
|
|
159
136
|
}
|
|
160
|
-
return {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
137
|
+
return {
|
|
138
|
+
...pane,
|
|
139
|
+
content,
|
|
140
|
+
};
|
|
141
|
+
})
|
|
142
|
+
);
|
|
143
|
+
|
|
164
144
|
channelChange = (selectedChannel) => {
|
|
165
145
|
const panes = this.setChannelContent(selectedChannel, this.state.panes);
|
|
166
146
|
this.setState({panes, selectedChannel}, () => { if (!this.props.isFullMode) this.props.onChannelChange(selectedChannel); });
|
|
@@ -171,28 +151,25 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
171
151
|
return this.props.Templates.loadingTemplates;
|
|
172
152
|
}
|
|
173
153
|
render() {
|
|
174
|
-
const {isFullMode} = this.props;
|
|
154
|
+
const { isFullMode, className } = this.props;
|
|
175
155
|
return (
|
|
176
|
-
<div className={
|
|
156
|
+
<div className={`${className} creatives-templates-container ${isFullMode ? 'fullmode' : 'library-mode'}`}>
|
|
177
157
|
{isFullMode && <Helmet
|
|
178
158
|
title={this.props.intl.formatMessage(messages.creatives)}
|
|
179
159
|
meta={[
|
|
180
160
|
{ name: 'description', content: this.props.intl.formatMessage(messages.creativesDesc) },
|
|
181
161
|
]}
|
|
182
162
|
/>}
|
|
183
|
-
<
|
|
184
|
-
|
|
163
|
+
<div className="component-wrapper">
|
|
185
164
|
{isFullMode && <CapHeader title={<FormattedMessage {...messages.creatives}/>} description={<FormattedMessage {...messages.creativesDesc}/>}/>}
|
|
186
|
-
<
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
</ComponentWrapper>
|
|
165
|
+
<StyledCapTab
|
|
166
|
+
panes={this.state.panes}
|
|
167
|
+
onChange={this.channelChange}
|
|
168
|
+
activeKey={this.state.selectedChannel}
|
|
169
|
+
defaultActiveKey={this.state.selectedChannel}
|
|
170
|
+
isFullMode={isFullMode}
|
|
171
|
+
/>
|
|
172
|
+
</div>
|
|
196
173
|
</div>
|
|
197
174
|
|
|
198
175
|
);
|
|
@@ -212,6 +189,7 @@ TemplatesV2.propTypes = {
|
|
|
212
189
|
intl: intlShape,
|
|
213
190
|
onChannelChange: PropTypes.func,
|
|
214
191
|
channelsToHide: PropTypes.array,
|
|
192
|
+
className: PropTypes.string.isRequired,
|
|
215
193
|
};
|
|
216
194
|
|
|
217
195
|
TemplatesV2.defaultProps = {
|
|
@@ -229,4 +207,4 @@ function mapDispatchToProps(dispatch) {
|
|
|
229
207
|
};
|
|
230
208
|
}
|
|
231
209
|
|
|
232
|
-
export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(injectIntl(TemplatesV2)));
|
|
210
|
+
export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(injectIntl(withStyles(TemplatesV2, styles))));
|