@capillarytech/creatives-library 7.17.37-alpha.0 → 7.17.37-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -23,6 +23,7 @@ import { gtmPush } from '../../utils/gtmTrackers';
|
|
|
23
23
|
import './index.scss';
|
|
24
24
|
import * as templateActions from '../Templates/actions';
|
|
25
25
|
import * as globalActions from '../Cap/actions';
|
|
26
|
+
import * as zaloActions from '../Zalo/actions';
|
|
26
27
|
import {isLoading as isLoadingSelector} from './selectors';
|
|
27
28
|
import messages from './messages';
|
|
28
29
|
import { MAP_TEMPLATE } from '../WeChat/Wrapper/constants';
|
|
@@ -98,11 +99,26 @@ export class Creatives extends React.Component {
|
|
|
98
99
|
this.setState(data);
|
|
99
100
|
};
|
|
100
101
|
onPreviewTemplate = (template) => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
if (template.type !== constants.ZALO.toLowerCase()) {
|
|
103
|
+
const templateData = template;
|
|
104
|
+
const usersList = commonUtil.getMergedUserList(this.props.templateUserList);
|
|
105
|
+
const userId = parseInt(template.updatedBy, 10);
|
|
106
|
+
templateData.updatedByName = commonUtil.getUserNameById(userId, usersList );
|
|
107
|
+
this.setState({ slidBoxContent: 'preview', templateData });
|
|
108
|
+
} else {
|
|
109
|
+
const {
|
|
110
|
+
name = "",
|
|
111
|
+
sourceAccountIdentifier = "",
|
|
112
|
+
configs: { token = "" } = {},
|
|
113
|
+
} = get(this.props, "Templates.weCrmAccounts[0]", {});
|
|
114
|
+
this.props.zaloActions.getTemplateInfoById({
|
|
115
|
+
username: name,
|
|
116
|
+
oa_id: sourceAccountIdentifier,
|
|
117
|
+
token,
|
|
118
|
+
id: template?._id,
|
|
119
|
+
preview: true,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
106
122
|
};
|
|
107
123
|
onEditTemplate = () => {
|
|
108
124
|
this.setState({ slidBoxContent: 'editTemplate', showSlideBox: true, templateNameExists: true });
|
|
@@ -1202,6 +1218,7 @@ Creatives.propTypes = {
|
|
|
1202
1218
|
channel: PropTypes.string,
|
|
1203
1219
|
templateActions: PropTypes.object,
|
|
1204
1220
|
globalActions: PropTypes.object,
|
|
1221
|
+
zaloActions: PropTypes.object,
|
|
1205
1222
|
cap: PropTypes.object,
|
|
1206
1223
|
// isLoading: PropTypes.bool,
|
|
1207
1224
|
templateUserList: PropTypes.array,
|
|
@@ -1230,6 +1247,7 @@ function mapDispatchToProps(dispatch) {
|
|
|
1230
1247
|
templateActions: bindActionCreators(templateActions, dispatch),
|
|
1231
1248
|
globalActions: bindActionCreators(globalActions, dispatch),
|
|
1232
1249
|
actions: bindActionCreators(actions, dispatch),
|
|
1250
|
+
zaloActions: bindActionCreators(zaloActions, dispatch),
|
|
1233
1251
|
};
|
|
1234
1252
|
}
|
|
1235
1253
|
export default connect(mapStatesToProps, mapDispatchToProps)(injectIntl(Creatives));
|