@capillarytech/creatives-library 2.0.66 → 2.0.68
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/Ckeditor/index.js +30 -3
- package/components/FormBuilder/index.js +50 -27
- package/components/FormBuilder/test +1845 -0
- package/components/Header/index.js +7 -4
- package/components/Header/messages.js +12 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +42 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +104 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +21 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/tests/index.test.js +10 -0
- package/containers/Cap/actions.js +6 -0
- package/containers/Cap/constants.js +2 -0
- package/containers/Cap/reducer.js +4 -2
- package/containers/Cap/selectors.js +13 -0
- package/containers/CreativesContainer/SlideBoxContent.js +2 -1
- package/containers/Ebill/index.js +4 -21
- package/containers/Email/index.js +9 -24
- package/containers/Line/Create/index.js +5 -17
- package/containers/Line/Edit/index.js +5 -25
- package/containers/MobilePush/Create/index.js +5 -22
- package/containers/MobilePush/Create/selectors.js +1 -1
- package/containers/MobilePush/Edit/index.js +9 -30
- package/containers/MobilePush/Edit/selectors.js +2 -2
- package/containers/MobilepushWrapper/index.js +3 -2
- package/containers/Sms/Create/index.js +17 -31
- package/containers/Sms/Edit/index.js +6 -20
- package/containers/Templates/index.js +60 -67
- package/containers/Templates/reducer.js +3 -3
- package/containers/WeChat/MapTemplates/index.js +6 -22
- package/containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +46 -2
- package/containers/WeChat/RichmediaTemplates/Create/actions.js +4 -3
- package/containers/WeChat/RichmediaTemplates/Create/constants.js +1 -0
- package/containers/WeChat/RichmediaTemplates/Create/index.js +525 -165
- package/containers/WeChat/RichmediaTemplates/Create/messages.js +125 -1
- package/containers/WeChat/RichmediaTemplates/Create/reducer.js +15 -4
- package/containers/WeChat/RichmediaTemplates/Create/richmediaschema.js +497 -0
- package/containers/WeChat/RichmediaTemplates/Create/sagas.js +7 -3
- package/containers/WeChat/RichmediaTemplates/Create/selectors.js +5 -0
- package/containers/WeChat/RichmediaTemplates/Edit/index.js +24 -8
- package/containers/WeChat/RichmediaTemplates/Edit/selectors.js +6 -1
- package/initialState.js +1 -0
- package/package.json +2 -2
- package/routes.js +22 -4
|
@@ -6,24 +6,27 @@
|
|
|
6
6
|
|
|
7
7
|
import React, { PropTypes } from 'react';
|
|
8
8
|
// import styled from 'styled-components';
|
|
9
|
+
import { FormattedMessage } from 'react-intl';
|
|
9
10
|
|
|
10
11
|
import { CapRow, CapColumn, CapInput, CapButton } from '@capillarytech/cap-ui-library';
|
|
12
|
+
import messages from './messages';
|
|
13
|
+
|
|
11
14
|
|
|
12
15
|
function Header(props) {
|
|
13
16
|
return (
|
|
14
17
|
<div>
|
|
15
18
|
<CapRow className="template-form-header">
|
|
16
19
|
<CapColumn span={10}>
|
|
17
|
-
<CapInput id="template-name"
|
|
20
|
+
<CapInput id="template-name" placeholder="Enter template name*" defaultValue={props.templateName} type="input" onChange={props.templateNameHandler}/>
|
|
18
21
|
</CapColumn>
|
|
19
22
|
<CapColumn span={2} offset={8}>
|
|
20
|
-
<CapButton id="preview-button" type="cancel" onClick={props.previewHandler}>
|
|
23
|
+
<CapButton id="preview-button" type="cancel" onClick={props.previewHandler}> <FormattedMessage {...messages.preview} /> </CapButton>
|
|
21
24
|
</CapColumn>
|
|
22
25
|
<CapColumn span={2}>
|
|
23
|
-
<CapButton id="cancel-button" type="cancel" onClick={props.cancelHandler}>
|
|
26
|
+
<CapButton id="cancel-button" type="cancel" onClick={props.cancelHandler}> <FormattedMessage {...messages.cancel} /> </CapButton>
|
|
24
27
|
</CapColumn>
|
|
25
28
|
<CapColumn span={2}>
|
|
26
|
-
<CapButton id="save-button" type="primary" onClick={props.saveHandler}>
|
|
29
|
+
<CapButton id="save-button" type="primary" onClick={props.saveHandler}> <FormattedMessage {...messages.save} /> </CapButton>
|
|
27
30
|
</CapColumn>
|
|
28
31
|
</CapRow>
|
|
29
32
|
</div>
|
|
@@ -10,4 +10,16 @@ export default defineMessages({
|
|
|
10
10
|
id: 'app.components.Header.header',
|
|
11
11
|
defaultMessage: 'This is the Header component !',
|
|
12
12
|
},
|
|
13
|
+
preview: {
|
|
14
|
+
id: 'app.components.Header.preview',
|
|
15
|
+
defaultMessage: 'Preview',
|
|
16
|
+
},
|
|
17
|
+
cancel: {
|
|
18
|
+
id: 'app.components.Header.cancel',
|
|
19
|
+
defaultMessage: 'Cancel',
|
|
20
|
+
},
|
|
21
|
+
save: {
|
|
22
|
+
id: 'app.components.Header.save',
|
|
23
|
+
defaultMessage: 'Save',
|
|
24
|
+
},
|
|
13
25
|
});
|
package/components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.wechatMsgContainer{
|
|
2
|
+
position: absolute;
|
|
3
|
+
left: 30%;
|
|
4
|
+
top: 20%;
|
|
5
|
+
background: white;
|
|
6
|
+
width: 40%;
|
|
7
|
+
text-align: left;
|
|
8
|
+
}
|
|
9
|
+
.wechatMsgContainerOutbound{
|
|
10
|
+
position: absolute;
|
|
11
|
+
left: 35%;
|
|
12
|
+
top: 20%;
|
|
13
|
+
background: white;
|
|
14
|
+
width: 30%;
|
|
15
|
+
text-align: left;
|
|
16
|
+
}
|
|
17
|
+
.wechatMsgContainerCardLayout {
|
|
18
|
+
position: absolute;
|
|
19
|
+
left: 20%;
|
|
20
|
+
top: 20%;
|
|
21
|
+
background: white;
|
|
22
|
+
width: 60%;
|
|
23
|
+
text-align: left;
|
|
24
|
+
}
|
|
25
|
+
.overflow-handle-preview {
|
|
26
|
+
height: 430px;
|
|
27
|
+
overflow-y: auto;
|
|
28
|
+
}
|
|
29
|
+
.overflow-handle-preview-outbound {
|
|
30
|
+
height: 330px;
|
|
31
|
+
overflow-y: auto;
|
|
32
|
+
}
|
|
33
|
+
.preview-overflow-wrap-fields {
|
|
34
|
+
text-overflow: ellipsis;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
overflow-wrap: break-word;
|
|
37
|
+
display: -webkit-box !important;
|
|
38
|
+
-webkit-box-orient: vertical;
|
|
39
|
+
-webkit-line-clamp: 2;
|
|
40
|
+
text-align: left;
|
|
41
|
+
width: 200px;
|
|
42
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* WechatRichmediaTemplatePreview
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { CapRow, CapColumn, CapButton } from '@capillarytech/cap-ui-library/';
|
|
10
|
+
import { FormattedMessage } from 'react-intl';
|
|
11
|
+
import _ from 'lodash';
|
|
12
|
+
import SlideBox from '../../SlideBox';
|
|
13
|
+
import './_wechatRichmediaTemplatePrev.scss';
|
|
14
|
+
import messages from './messages';
|
|
15
|
+
const wechatBody = require('./../assets/images/WECHAT_5x.png');
|
|
16
|
+
|
|
17
|
+
class WechatRichmediaTemplatePreview extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
|
|
18
|
+
preparePreviewData = (mediaList) => {
|
|
19
|
+
const returnObj = [];
|
|
20
|
+
_.forEach(mediaList, (contentData, contentIndex) => {
|
|
21
|
+
const id = parseInt(contentIndex, 10);
|
|
22
|
+
if (id === 0) {
|
|
23
|
+
returnObj.push(
|
|
24
|
+
<div style={{ width: "100%", height: 116, position: "relative" }}>
|
|
25
|
+
<CapRow>
|
|
26
|
+
<img alt="default" width="100%" height="110px" src={contentData.image_url} />
|
|
27
|
+
<div className="preview-overflow-wrap-fields" style={{ position: "absolute", bottom: "5%", left: "5%" }}>{contentData.title ? contentData.title : ""}</div>
|
|
28
|
+
</CapRow>
|
|
29
|
+
{Object.keys(mediaList).length === 1 ?
|
|
30
|
+
<CapRow style={{ height: 32, left: "5%" }}>
|
|
31
|
+
{contentData.digest ? contentData.digest : ""}
|
|
32
|
+
</CapRow>
|
|
33
|
+
:
|
|
34
|
+
""
|
|
35
|
+
}
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
} else {
|
|
39
|
+
returnObj.push(
|
|
40
|
+
<CapRow style={{ "width": "100%", "height": 64, "border-bottom": "0.5px solid lightgrey" }}>
|
|
41
|
+
<CapColumn className="preview-overflow-wrap-fields" style={{ padding: "5% 0% 0% 5%", float: "left" }}>
|
|
42
|
+
{contentData.title}
|
|
43
|
+
</CapColumn>
|
|
44
|
+
<CapColumn style={{ float: "right" }}>
|
|
45
|
+
<img alt="default" width="60px" height="60px" src={contentData.image_url} style={{ "padding-right": "10%", "float": "left" }}/>
|
|
46
|
+
</CapColumn>
|
|
47
|
+
</CapRow>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return returnObj;
|
|
52
|
+
}
|
|
53
|
+
goToEdit(e, path) {
|
|
54
|
+
this.props.onEditClick(e, this.props.templateId, this.props.modeType, path);
|
|
55
|
+
}
|
|
56
|
+
render() {
|
|
57
|
+
return (
|
|
58
|
+
this.props.showSlidebox ?
|
|
59
|
+
<SlideBox
|
|
60
|
+
show={this.props.show}
|
|
61
|
+
handleClose={this.props.closeSlideBox}
|
|
62
|
+
header={this.props.templateName}
|
|
63
|
+
width={50}
|
|
64
|
+
content={
|
|
65
|
+
<div className={`preview-container ${this.props.type === 'embedded' ? 'embedded-preview' : ''}`}>
|
|
66
|
+
<div className="shell align-center" id="sms-preview">
|
|
67
|
+
<img className="preview-image" src={wechatBody} alt="Preview is being generated"/>
|
|
68
|
+
<div className={this.props.type === 'embedded' ? "wechatMsgContainerOutbound" : "wechatMsgContainer"}>
|
|
69
|
+
<div className={this.props.type === 'embedded' ? "overflow-handle-preview-outbound" : "overflow-handle-preview"}>{this.preparePreviewData(this.props.content)}
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
{this.props.showEdit ? <CapButton onClick={(e) => this.goToEdit(e, this.props.path)} className="preview-buttons" type="primary">{this.props.type === 'embedded' ? <FormattedMessage {...messages.select} /> : <FormattedMessage {...messages.edit} /> }</CapButton> : ""}
|
|
74
|
+
</div>
|
|
75
|
+
}
|
|
76
|
+
/>
|
|
77
|
+
:
|
|
78
|
+
<div className={`preview-container ${this.props.type === 'embedded' ? 'embedded-preview' : ''}`}>
|
|
79
|
+
<div className="shell align-center" id="sms-preview">
|
|
80
|
+
<div className="wechatMsgContainerCardLayout">
|
|
81
|
+
<div>{this.preparePreviewData(this.props.content)}
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
WechatRichmediaTemplatePreview.propTypes = {
|
|
91
|
+
showSlidebox: PropTypes.bool,
|
|
92
|
+
show: PropTypes.bool,
|
|
93
|
+
closeSlideBox: PropTypes.function,
|
|
94
|
+
templateName: PropTypes.string,
|
|
95
|
+
type: PropTypes.string,
|
|
96
|
+
content: PropTypes.array,
|
|
97
|
+
onEditClick: PropTypes.func,
|
|
98
|
+
showEdit: PropTypes.bool,
|
|
99
|
+
path: PropTypes.string,
|
|
100
|
+
templateId: PropTypes.string,
|
|
101
|
+
modeType: PropTypes.string,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export default WechatRichmediaTemplatePreview;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* WechatRichmediaTemplatePreview Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the WechatRichmediaTemplatePreview component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
header: {
|
|
10
|
+
id: 'app.components.WechatRichmediaTemplatePreview.header',
|
|
11
|
+
defaultMessage: 'This is the WechatRichmediaTemplatePreview component !',
|
|
12
|
+
},
|
|
13
|
+
select: {
|
|
14
|
+
id: 'app.components.WechatRichmediaTemplatePreview.select',
|
|
15
|
+
defaultMessage: 'Select',
|
|
16
|
+
},
|
|
17
|
+
edit: {
|
|
18
|
+
id: 'app.components.WechatRichmediaTemplatePreview.edit',
|
|
19
|
+
defaultMessage: 'Edit',
|
|
20
|
+
},
|
|
21
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// import React from 'react';
|
|
2
|
+
// import { shallow } from 'enzyme';
|
|
3
|
+
|
|
4
|
+
// import WechatRichmediaTemplatePreview from '../index';
|
|
5
|
+
|
|
6
|
+
describe('<WechatRichmediaTemplatePreview />', () => {
|
|
7
|
+
it('Expect to have unit tests specified', () => {
|
|
8
|
+
expect(true).toEqual(false);
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -20,3 +20,5 @@ export const GET_SCHEMA_FOR_ENTITY_REQUEST = 'cap/GET_SCHEMA_FOR_ENTITY_REQUEST'
|
|
|
20
20
|
export const GET_SCHEMA_FOR_ENTITY_SUCCESS = 'cap/GET_SCHEMA_FOR_ENTITY_SUCCESS';
|
|
21
21
|
export const CLEAR_META_ENTITIES = 'cap/CLEAR_META_ENTITIES';
|
|
22
22
|
export const HIDE_TAGS = 'cap/HIDE_TAGS';
|
|
23
|
+
|
|
24
|
+
export const SET_INJECTED_TAGS = 'cap/SET_INJECTED_TAGS';
|
|
@@ -95,12 +95,14 @@ function capReducer(state = fromJS(initialState.cap), action) {
|
|
|
95
95
|
layouts: [],
|
|
96
96
|
tags: [],
|
|
97
97
|
});
|
|
98
|
-
|
|
98
|
+
// eslint-disable-next-line no-case-declarations
|
|
99
|
+
case types.HIDE_TAGS:
|
|
99
100
|
const metaEntities = {tags: {}, layouts: state.get('metaEntities').layouts};
|
|
100
101
|
metaEntities.tags.standard = _.filter(state.get('metaEntities').tags.standard, (tag) => action.tagList.indexOf(tag.definition.value) === -1);
|
|
101
102
|
metaEntities.tags.custom = _.filter(state.get('metaEntities').tags.custom, (tag) => action.tagList.indexOf(tag.name) === -1);
|
|
102
103
|
return state.setIn(['metaEntities'], metaEntities);
|
|
103
|
-
|
|
104
|
+
case types.SET_INJECTED_TAGS:
|
|
105
|
+
return state.set('injectedTags', action.injectedTags);
|
|
104
106
|
default:
|
|
105
107
|
return state;
|
|
106
108
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// makeSelectLocationState expects a plain JS object for the routing state
|
|
2
2
|
import { createSelector } from 'reselect';
|
|
3
|
+
import _ from 'lodash';
|
|
3
4
|
const selectCapDomain = (state) => state.get('cap');
|
|
4
5
|
|
|
5
6
|
const makeSelectAuthenticated = () => createSelector(
|
|
@@ -21,6 +22,17 @@ const isLoadingMetaEntities = () => createSelector(
|
|
|
21
22
|
selectCapDomain,
|
|
22
23
|
(globalState) => globalState.get('fetchingSchema')
|
|
23
24
|
);
|
|
25
|
+
const setInjectedTags = () => createSelector(
|
|
26
|
+
selectCapDomain,
|
|
27
|
+
(globalState) => {
|
|
28
|
+
let injectedTags = globalState.get('injectedTags') || {};
|
|
29
|
+
const metaEntities = globalState.get('metaEntities') || {};
|
|
30
|
+
const customTags = metaEntities.tags && metaEntities.tags.custom ? metaEntities.tags.custom : {};
|
|
31
|
+
console.log("selector cap: ", injectedTags, customTags, metaEntities);
|
|
32
|
+
return (injectedTags = _.merge({}, injectedTags, customTags));
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
|
|
24
36
|
const makeSelectLocationState = () => {
|
|
25
37
|
let prevRoutingState;
|
|
26
38
|
let prevRoutingStateJS;
|
|
@@ -69,4 +81,5 @@ export {
|
|
|
69
81
|
selectCurrentOrgDetails,
|
|
70
82
|
isLoadingMetaEntities,
|
|
71
83
|
makeSelectFetchingSchema,
|
|
84
|
+
setInjectedTags,
|
|
72
85
|
};
|
|
@@ -193,7 +193,8 @@ function SlideBoxContent(props) {
|
|
|
193
193
|
pathname: `/mobilepush/edit/`,
|
|
194
194
|
query,
|
|
195
195
|
}}
|
|
196
|
-
|
|
196
|
+
params={{id: templateData._id}}
|
|
197
|
+
isFullMode={isFullMode}
|
|
197
198
|
isGetFormData={isGetFormData}
|
|
198
199
|
route={{ name: 'mobilepush' }}
|
|
199
200
|
templateData={templateData}
|
|
@@ -16,7 +16,7 @@ import _ from 'lodash';
|
|
|
16
16
|
import { createStructuredSelector } from 'reselect';
|
|
17
17
|
import * as actions from './actions';
|
|
18
18
|
import FormBuilder from '../../components/FormBuilder';
|
|
19
|
-
import { makeSelectMetaEntities, makeSelectAuthenticated } from '../Cap/selectors';
|
|
19
|
+
import { makeSelectMetaEntities, makeSelectAuthenticated, setInjectedTags } from '../Cap/selectors';
|
|
20
20
|
import * as globalActions from '../../containers/Cap/actions';
|
|
21
21
|
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
22
22
|
import { makeSelectTemplates } from '../Templates/selectors';
|
|
@@ -629,25 +629,6 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
|
|
|
629
629
|
this.props.globalActions.addMessageToQueue(message);
|
|
630
630
|
}
|
|
631
631
|
|
|
632
|
-
if (nextProps.metaEntities && nextProps.metaEntities.tags && nextProps.metaEntities.tags.custom && !_.isEqual(this.props.metaEntities.tags, nextProps.metaEntities.tags)) {
|
|
633
|
-
let injectedTags = _.cloneDeep(this.state.injectedTags);
|
|
634
|
-
delete injectedTags["Registration custom fields"];
|
|
635
|
-
delete injectedTags["Store custom fields"];
|
|
636
|
-
delete injectedTags["Transaction custom fields"];
|
|
637
|
-
injectedTags = _.merge({}, injectedTags, nextProps.metaEntities.tags.custom);
|
|
638
|
-
console.log('new injected tags', nextProps.metaEntities.tags.custom);
|
|
639
|
-
if (!_.has(nextProps.metaEntities.tags.custom, "Registration custom fields")) {
|
|
640
|
-
delete injectedTags["Registration custom fields"];
|
|
641
|
-
}
|
|
642
|
-
if (!_.has(nextProps.metaEntities.tags.custom, "Store custom fields")) {
|
|
643
|
-
delete injectedTags["Store custom fields"];
|
|
644
|
-
}
|
|
645
|
-
if (!_.has(nextProps.metaEntities.tags.custom, "Transaction custom fields")) {
|
|
646
|
-
delete injectedTags["Transaction custom fields"];
|
|
647
|
-
}
|
|
648
|
-
this.setState({injectedTags});
|
|
649
|
-
}
|
|
650
|
-
|
|
651
632
|
console.log('Form Data After ', nextProps.Ebill.cmsData, this.props.Ebill.cmsData);
|
|
652
633
|
if (nextProps.Ebill.cmsData !== '' && !_.isEqual(nextProps.Ebill.cmsData, this.props.Ebill.cmsData)) {
|
|
653
634
|
const formData = _.cloneDeep(this.state.formData);
|
|
@@ -1209,7 +1190,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
|
|
|
1209
1190
|
location={this.props.location}
|
|
1210
1191
|
tabKey={this.state.tabKey}
|
|
1211
1192
|
tags={this.props.metaEntities && this.props.metaEntities.tags ? this.props.metaEntities.tags.standard : []}
|
|
1212
|
-
injectedTags={this.
|
|
1193
|
+
injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
|
|
1213
1194
|
onFormValidityChange={this.setFormValidity}
|
|
1214
1195
|
handleCancelModal={this.handleCancelModal}
|
|
1215
1196
|
usingTabContainer
|
|
@@ -1259,6 +1240,7 @@ Ebill.propTypes = {
|
|
|
1259
1240
|
intl: intlShape.isRequired,
|
|
1260
1241
|
metaEntities: PropTypes.object,
|
|
1261
1242
|
// Global: PropTypes.object,
|
|
1243
|
+
injectedTags: PropTypes.object,
|
|
1262
1244
|
};
|
|
1263
1245
|
|
|
1264
1246
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -1266,6 +1248,7 @@ const mapStateToProps = createStructuredSelector({
|
|
|
1266
1248
|
Templates: makeSelectTemplates(),
|
|
1267
1249
|
metaEntities: makeSelectMetaEntities(),
|
|
1268
1250
|
Global: makeSelectAuthenticated(),
|
|
1251
|
+
injectedTags: setInjectedTags(),
|
|
1269
1252
|
});
|
|
1270
1253
|
|
|
1271
1254
|
function mapDispatchToProps(dispatch) {
|
|
@@ -16,7 +16,7 @@ import { createStructuredSelector } from 'reselect';
|
|
|
16
16
|
import _ from 'lodash';
|
|
17
17
|
import moment from "moment";
|
|
18
18
|
import FormBuilder from '../../components/FormBuilder';
|
|
19
|
-
import { makeSelectMetaEntities, selectCurrentOrgDetails, isLoadingMetaEntities } from '../Cap/selectors';
|
|
19
|
+
import { makeSelectMetaEntities, selectCurrentOrgDetails, isLoadingMetaEntities, makeSelectAuthenticated, setInjectedTags } from '../Cap/selectors';
|
|
20
20
|
import * as actions from './actions';
|
|
21
21
|
import * as templatesActions from '../Templates/actions';
|
|
22
22
|
import * as globalActions from '../../containers/Cap/actions';
|
|
@@ -234,7 +234,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
234
234
|
if (this.props.getDefaultTags) {
|
|
235
235
|
query.context = this.props.getDefaultTags;
|
|
236
236
|
}
|
|
237
|
-
this.props.
|
|
237
|
+
if (_.isEmpty(this.props.metaEntities.tags)) {
|
|
238
|
+
this.props.globalActions.fetchSchemaForEntity(query);
|
|
239
|
+
}
|
|
238
240
|
}
|
|
239
241
|
setTimeout(() => {
|
|
240
242
|
this.showSubject();
|
|
@@ -436,27 +438,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
436
438
|
});
|
|
437
439
|
}
|
|
438
440
|
|
|
439
|
-
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)) {
|
|
440
|
-
let injectedTags = _.cloneDeep(this.state.injectedTags);
|
|
441
|
-
if (!_.isEmpty(injectedTags)) {
|
|
442
|
-
delete injectedTags["Registration custom fields"];
|
|
443
|
-
delete injectedTags["Store custom fields"];
|
|
444
|
-
delete injectedTags["Transaction custom fields"];
|
|
445
|
-
injectedTags = _.merge({}, injectedTags, nextProps.metaEntities.tags.custom);
|
|
446
|
-
|
|
447
|
-
if (!_.has(nextProps.metaEntities.tags.custom, "Registration custom fields")) {
|
|
448
|
-
delete injectedTags["Registration custom fields"];
|
|
449
|
-
}
|
|
450
|
-
if (!_.has(nextProps.metaEntities.tags.custom, "Store custom fields")) {
|
|
451
|
-
delete injectedTags["Store custom fields"];
|
|
452
|
-
}
|
|
453
|
-
if (!_.has(nextProps.metaEntities.tags.custom, "Transaction custom fields")) {
|
|
454
|
-
delete injectedTags["Transaction custom fields"];
|
|
455
|
-
}
|
|
456
|
-
this.setState({injectedTags});
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
|
|
460
441
|
if ( !_.isEqual(nextProps.Email.uploadAssetSuccess, this.props.Email.uploadAssetSuccess) && nextProps.Email.uploadAssetSuccess) {
|
|
461
442
|
const isDragDrop = this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].is_drag_drop;
|
|
462
443
|
const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
|
|
@@ -2113,6 +2094,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2113
2094
|
} else {
|
|
2114
2095
|
this.setState({injectedTags: data.tags});
|
|
2115
2096
|
}
|
|
2097
|
+
this.props.globalActions.setInjectedTags(data.tags);
|
|
2116
2098
|
}
|
|
2117
2099
|
|
|
2118
2100
|
startLoading = (ifEdit) => {
|
|
@@ -2579,7 +2561,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2579
2561
|
tabKey={this.state.tabKey}
|
|
2580
2562
|
tags={tags}
|
|
2581
2563
|
tagModule={this.props.getDefaultTags}
|
|
2582
|
-
injectedTags={this.
|
|
2564
|
+
injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
|
|
2583
2565
|
onFormValidityChange={this.setFormValidity}
|
|
2584
2566
|
handleCancelModal={this.handleCancelModal}
|
|
2585
2567
|
usingTabContainer
|
|
@@ -2653,6 +2635,7 @@ Email.propTypes = {
|
|
|
2653
2635
|
// creativesContainerActions: PropTypes.object,
|
|
2654
2636
|
isFullMode: PropTypes.bool,
|
|
2655
2637
|
setIsLoadingContent: PropTypes.func,
|
|
2638
|
+
injectedTags: PropTypes.object,
|
|
2656
2639
|
};
|
|
2657
2640
|
|
|
2658
2641
|
const mapStateToProps = (state, props) => createStructuredSelector({
|
|
@@ -2661,6 +2644,8 @@ const mapStateToProps = (state, props) => createStructuredSelector({
|
|
|
2661
2644
|
metaEntities: makeSelectMetaEntities(),
|
|
2662
2645
|
currentOrgDetails: props.cap ? () => props.cap.currentOrgDetails : selectCurrentOrgDetails(),
|
|
2663
2646
|
isLoadingMetaEntities: isLoadingMetaEntities(),
|
|
2647
|
+
Global: makeSelectAuthenticated(),
|
|
2648
|
+
injectedTags: setInjectedTags(),
|
|
2664
2649
|
});
|
|
2665
2650
|
|
|
2666
2651
|
function mapDispatchToProps(dispatch) {
|
|
@@ -13,7 +13,7 @@ import { UserIsAuthenticated } from '../../../utils/authWrapper';
|
|
|
13
13
|
import * as globalActions from '../../../containers/Cap/actions';
|
|
14
14
|
//import { makeSelectCreate, makeSelectCreateResponse, makeSelectEdit, makeSelectEditResponse, makeSelectTemplateDetailsResponse } from './selectors';
|
|
15
15
|
import {makeSelectCreateLine} from './selectors';
|
|
16
|
-
import { makeSelectMetaEntities } from '../../Cap/selectors';
|
|
16
|
+
import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
|
|
17
17
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
18
18
|
import { makeSelectTemplates } from '../../Templates/selectors';
|
|
19
19
|
import './_lineCreate.scss';
|
|
@@ -218,21 +218,6 @@ export class Line extends Component {
|
|
|
218
218
|
console.log("ooo", this.state.formData);
|
|
219
219
|
this.props.actions.clearAsset();
|
|
220
220
|
}
|
|
221
|
-
if (nextProps.metaEntities && nextProps.metaEntities.tags && nextProps.metaEntities.tags.custom && this.props.metaEntities.tags !== nextProps.metaEntities.tags) {
|
|
222
|
-
let injectedTags = _.cloneDeep(this.state.injectedTags);
|
|
223
|
-
injectedTags = _.merge({}, injectedTags, nextProps.metaEntities.tags.custom);
|
|
224
|
-
console.log('new injected tags', nextProps.metaEntities.tags.custom);
|
|
225
|
-
if (!_.has(nextProps.metaEntities.tags.custom, "Registration custom fields")) {
|
|
226
|
-
delete injectedTags["Registration custom fields"];
|
|
227
|
-
}
|
|
228
|
-
if (!_.has(nextProps.metaEntities.tags.custom, "Store custom fields")) {
|
|
229
|
-
delete injectedTags["Store custom fields"];
|
|
230
|
-
}
|
|
231
|
-
if (!_.has(nextProps.metaEntities.tags.custom, "Transaction custom fields")) {
|
|
232
|
-
delete injectedTags["Transaction custom fields"];
|
|
233
|
-
}
|
|
234
|
-
this.setState({injectedTags});
|
|
235
|
-
}
|
|
236
221
|
}
|
|
237
222
|
|
|
238
223
|
componentWillUnmount() {
|
|
@@ -579,6 +564,7 @@ export class Line extends Component {
|
|
|
579
564
|
obj['0'].image = content;
|
|
580
565
|
}
|
|
581
566
|
this.setState({formData: obj, loading: false, injectedTags: data.tags});
|
|
567
|
+
this.props.globalActions.setInjectedTags(data.tags);
|
|
582
568
|
};
|
|
583
569
|
|
|
584
570
|
startLoading = (ifEdit) => {
|
|
@@ -781,7 +767,7 @@ export class Line extends Component {
|
|
|
781
767
|
formData={_.cloneDeep(this.state.formData)}
|
|
782
768
|
location={this.props.location}
|
|
783
769
|
tags={tags}
|
|
784
|
-
injectedTags={this.
|
|
770
|
+
injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
|
|
785
771
|
onFormValidityChange={this.setFormValidity}
|
|
786
772
|
usingTabContainer
|
|
787
773
|
checkValidation={this.state.checkValidation}
|
|
@@ -816,12 +802,14 @@ Line.propTypes = {
|
|
|
816
802
|
Line: PropTypes.object,
|
|
817
803
|
supportedTags: PropTypes.any,
|
|
818
804
|
getDefaultTags: PropTypes.string,
|
|
805
|
+
injectedTags: PropTypes.object,
|
|
819
806
|
};
|
|
820
807
|
|
|
821
808
|
const mapStateToProps = createStructuredSelector({
|
|
822
809
|
Line: makeSelectCreateLine(),
|
|
823
810
|
Templates: makeSelectTemplates(),
|
|
824
811
|
metaEntities: makeSelectMetaEntities(),
|
|
812
|
+
injectedTags: setInjectedTags(),
|
|
825
813
|
});
|
|
826
814
|
|
|
827
815
|
function mapDispatchToProps(dispatch) {
|
|
@@ -15,7 +15,7 @@ import { createStructuredSelector } from 'reselect';
|
|
|
15
15
|
import { injectIntl, intlShape } from 'react-intl';
|
|
16
16
|
import _ from 'lodash';
|
|
17
17
|
import {makeSelectEdit, makeSelectEditResponse, makeSelectTemplateDetailsResponse} from "../../MobilePush/Edit/selectors";
|
|
18
|
-
import {makeSelectMetaEntities} from "../../Cap/selectors";
|
|
18
|
+
import {makeSelectMetaEntities, setInjectedTags} from "../../Cap/selectors";
|
|
19
19
|
import {getMessageObject} from "../../../utils/messageUtils";
|
|
20
20
|
import FormBuilder from '../../../components/FormBuilder';
|
|
21
21
|
import * as globalActions from "../../Cap/actions";
|
|
@@ -200,29 +200,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
200
200
|
const message = getMessageObject('error', (nextProps.Edit.editTemplateErrorMessage && nextProps.Edit.editTemplateErrorMessage !== '') ? nextProps.Edit.editTemplateErrorMessage : this.props.intl.formatMessage(messages.somethingWentWrong), true);
|
|
201
201
|
this.props.globalActions.addMessageToQueue(message);
|
|
202
202
|
}
|
|
203
|
-
// if (nextProps.metaEntities && nextProps.metaEntities.tags && nextProps.metaEntities.tags.custom && this.props.metaEntities.tags !== nextProps.metaEntities.tags) {
|
|
204
|
-
// let injectedTags = _.cloneDeep(this.state.injectedTags);
|
|
205
|
-
// injectedTags = _.merge({}, injectedTags, nextProps.metaEntities.tags.custom);
|
|
206
|
-
// this.setState({injectedTags});
|
|
207
|
-
// }
|
|
208
|
-
if (nextProps.metaEntities && nextProps.metaEntities.tags && nextProps.metaEntities.tags.custom && !_.isEqual(this.props.metaEntities.tags, nextProps.metaEntities.tags)) {
|
|
209
|
-
let injectedTags = _.cloneDeep(this.state.injectedTags);
|
|
210
|
-
delete injectedTags["Registration custom fields"];
|
|
211
|
-
delete injectedTags["Store custom fields"];
|
|
212
|
-
delete injectedTags["Transaction custom fields"];
|
|
213
|
-
injectedTags = _.merge({}, injectedTags, nextProps.metaEntities.tags.custom);
|
|
214
|
-
console.log('new injected tags', nextProps.metaEntities.tags.custom);
|
|
215
|
-
if (!_.has(nextProps.metaEntities.tags.custom, "Registration custom fields")) {
|
|
216
|
-
delete injectedTags["Registration custom fields"];
|
|
217
|
-
}
|
|
218
|
-
if (!_.has(nextProps.metaEntities.tags.custom, "Store custom fields")) {
|
|
219
|
-
delete injectedTags["Store custom fields"];
|
|
220
|
-
}
|
|
221
|
-
if (!_.has(nextProps.metaEntities.tags.custom, "Transaction custom fields")) {
|
|
222
|
-
delete injectedTags["Transaction custom fields"];
|
|
223
|
-
}
|
|
224
|
-
this.setState({injectedTags});
|
|
225
|
-
}
|
|
226
203
|
}
|
|
227
204
|
|
|
228
205
|
componentWillUnmount() {
|
|
@@ -752,6 +729,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
752
729
|
console.log('startTemplateCreation', data);
|
|
753
730
|
if (!data.edit) {
|
|
754
731
|
this.setState({injectedTags: data.tags});
|
|
732
|
+
this.props.globalActions.setInjectedTags(data.tags);
|
|
755
733
|
}
|
|
756
734
|
};
|
|
757
735
|
|
|
@@ -1013,7 +991,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1013
991
|
tabCount={2}
|
|
1014
992
|
iosCtasData={this.state.iosCtasData}
|
|
1015
993
|
tags={tags}
|
|
1016
|
-
injectedTags={this.
|
|
994
|
+
injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
|
|
1017
995
|
onFormValidityChange={this.setFormValidity}
|
|
1018
996
|
usingTabContainer
|
|
1019
997
|
checkValidation={this.state.checkValidation}
|
|
@@ -1049,6 +1027,7 @@ Edit.propTypes = {
|
|
|
1049
1027
|
templateData: PropTypes.object,
|
|
1050
1028
|
getDefaultTags: PropTypes.string,
|
|
1051
1029
|
supportedTags: PropTypes.array,
|
|
1030
|
+
injectedTags: PropTypes.object,
|
|
1052
1031
|
};
|
|
1053
1032
|
|
|
1054
1033
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -1057,6 +1036,7 @@ const mapStateToProps = createStructuredSelector({
|
|
|
1057
1036
|
templateDetails: makeSelectTemplateDetailsResponse(),
|
|
1058
1037
|
metaEntities: makeSelectMetaEntities(),
|
|
1059
1038
|
Templates: makeSelectTemplates(),
|
|
1039
|
+
injectedTags: setInjectedTags(),
|
|
1060
1040
|
});
|
|
1061
1041
|
|
|
1062
1042
|
function mapDispatchToProps(dispatch) {
|
|
@@ -10,13 +10,13 @@ import React from 'react';
|
|
|
10
10
|
import { connect } from 'react-redux';
|
|
11
11
|
import { bindActionCreators } from 'redux';
|
|
12
12
|
import { Row, Col, Spin, Breadcrumb, notification } from 'antd';
|
|
13
|
-
import {get, set, filter, isEmpty, map, forEach, uniqueId, cloneDeep, isEqual,
|
|
13
|
+
import {get, set, filter, isEmpty, map, forEach, uniqueId, cloneDeep, isEqual, findIndex} from 'lodash';
|
|
14
14
|
import { createStructuredSelector } from 'reselect';
|
|
15
15
|
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
16
16
|
import styled from 'styled-components';
|
|
17
17
|
import { CapSlideBox, CapHeader, CapTable, CapLink, CapRow, CapColumn, CapIcons} from '@capillarytech/cap-ui-library';
|
|
18
18
|
import { makeSelectCreate, makeSelectCreateResponse, makeSelectIosCta } from './selectors';
|
|
19
|
-
import { makeSelectMetaEntities } from '../../Cap/selectors';
|
|
19
|
+
import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
|
|
20
20
|
import * as globalActions from '../../../containers/Cap/actions';
|
|
21
21
|
import FormBuilder from '../../../components/FormBuilder';
|
|
22
22
|
import './_mobilePushCreate.scss';
|
|
@@ -146,25 +146,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
146
146
|
this.showNext();
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
|
|
150
|
-
if (nextProps.metaEntities && nextProps.metaEntities.tags && nextProps.metaEntities.tags.custom && !isEqual(this.props.metaEntities.tags, nextProps.metaEntities.tags)) {
|
|
151
|
-
let injectedTags = cloneDeep(this.state.injectedTags);
|
|
152
|
-
delete injectedTags["Registration custom fields"];
|
|
153
|
-
delete injectedTags["Store custom fields"];
|
|
154
|
-
delete injectedTags["Transaction custom fields"];
|
|
155
|
-
injectedTags = merge({}, injectedTags, nextProps.metaEntities.tags.custom);
|
|
156
|
-
|
|
157
|
-
if (!has(nextProps.metaEntities.tags.custom, "Registration custom fields")) {
|
|
158
|
-
delete injectedTags["Registration custom fields"];
|
|
159
|
-
}
|
|
160
|
-
if (!has(nextProps.metaEntities.tags.custom, "Store custom fields")) {
|
|
161
|
-
delete injectedTags["Store custom fields"];
|
|
162
|
-
}
|
|
163
|
-
if (!has(nextProps.metaEntities.tags.custom, "Transaction custom fields")) {
|
|
164
|
-
delete injectedTags["Transaction custom fields"];
|
|
165
|
-
}
|
|
166
|
-
this.setState({injectedTags});
|
|
167
|
-
}
|
|
168
149
|
};
|
|
169
150
|
componentWillUnmount = () => {
|
|
170
151
|
this.props.actions.resetStore();
|
|
@@ -1655,7 +1636,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1655
1636
|
formData={cloneDeep(this.state.formData)}
|
|
1656
1637
|
location={this.props.location}
|
|
1657
1638
|
tags={tags}
|
|
1658
|
-
injectedTags={this.
|
|
1639
|
+
injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
|
|
1659
1640
|
onFormValidityChange={this.setFormValidity}
|
|
1660
1641
|
usingTabContainer
|
|
1661
1642
|
checkValidation={this.state.checkValidation}
|
|
@@ -1752,6 +1733,7 @@ Create.propTypes = {
|
|
|
1752
1733
|
supportedTags: PropTypes.array,
|
|
1753
1734
|
getDefaultTags: PropTypes.string,
|
|
1754
1735
|
iosCtasData: PropTypes.array,
|
|
1736
|
+
injectedTags: PropTypes.object,
|
|
1755
1737
|
};
|
|
1756
1738
|
|
|
1757
1739
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -1760,6 +1742,7 @@ const mapStateToProps = createStructuredSelector({
|
|
|
1760
1742
|
metaEntities: makeSelectMetaEntities(),
|
|
1761
1743
|
Templates: makeSelectTemplates(),
|
|
1762
1744
|
iosCtasData: makeSelectIosCta(),
|
|
1745
|
+
injectedTags: setInjectedTags(),
|
|
1763
1746
|
});
|
|
1764
1747
|
|
|
1765
1748
|
function mapDispatchToProps(dispatch) {
|
|
@@ -3,7 +3,7 @@ import { createSelector } from 'reselect';
|
|
|
3
3
|
/**
|
|
4
4
|
* Direct selector to the create state domain
|
|
5
5
|
*/
|
|
6
|
-
const selectPushMessageCreateDomain = () => (state
|
|
6
|
+
const selectPushMessageCreateDomain = () => (state) => state.get('mobileCreate');
|
|
7
7
|
/**
|
|
8
8
|
* Other specific selectors
|
|
9
9
|
*/
|