@capillarytech/creatives-library 3.0.35 → 3.1.0
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/assets/noImage.png +0 -0
- package/components/BreadCrumbs/messages.js +1 -1
- package/components/CapTagList/index.js +3 -3
- package/components/CapTagList/messages.js +4 -16
- package/components/Ckeditor/messages.js +1 -1
- package/components/CustomPopOver/index.js +4 -3
- package/components/CustomPopOver/messages.js +1 -5
- package/components/DateFilter/index.js +12 -12
- package/components/DateFilter/messages.js +0 -40
- package/components/DateRange/index.js +4 -5
- package/components/DateRange/messages.js +1 -13
- package/components/Edmeditor/messages.js +1 -1
- package/components/EmailPreview/index.js +4 -4
- package/components/EmailPreview/messages.js +2 -18
- package/components/Footer/messages.js +1 -1
- package/components/FormBuilder/index.js +19 -15
- package/components/FormBuilder/messages.js +1 -33
- package/components/Header/messages.js +4 -4
- package/components/ImagePreview/index.js +1 -1
- package/components/ImagePreview/messages.js +1 -5
- package/components/PageHeader/messages.js +1 -1
- package/components/PreviewSideBar/index.js +2 -2
- package/components/PreviewSideBar/messages.js +6 -14
- package/components/Sidebar/messages.js +3 -3
- package/components/SmsTest/index.js +4 -6
- package/components/SmsTest/messages.js +1 -9
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +3 -3
- package/components/TemplatePreview/index.js +10 -11
- package/components/TemplatePreview/messages.js +7 -23
- package/components/Toastr/messages.js +1 -1
- package/components/ToastrMessage/index.js +1 -4
- package/components/ToastrMessage/messages.js +1 -5
- package/components/TopBar/messages.js +1 -1
- package/config/app.js +0 -2
- package/containers/Assets/Gallery/messages.js +20 -20
- package/containers/Cap/index.js +5 -5
- package/containers/Dashboard/index.js +2 -2
- package/containers/Dashboard/messages.js +1 -1
- package/containers/Ebill/index.js +1 -1
- package/containers/Ebill/messages.js +16 -20
- package/containers/Email/index.js +24 -24
- package/containers/Email/messages.js +59 -107
- package/containers/Line/Create/index.js +7 -7
- package/containers/Line/Create/messages.js +42 -58
- package/containers/Line/Edit/index.js +14 -14
- package/containers/Line/Edit/messages.js +38 -58
- package/containers/Login/components/LoginForm/index.js +7 -10
- package/containers/Login/components/LoginForm/messages.js +3 -15
- package/containers/Login/index.js +1 -1
- package/containers/Login/messages.js +3 -7
- package/containers/MobilePush/Create/index.js +45 -45
- package/containers/MobilePush/Create/messages.js +75 -111
- package/containers/MobilePush/Edit/index.js +45 -45
- package/containers/MobilePush/Edit/messages.js +83 -100
- package/containers/NotFoundPage/messages.js +1 -1
- package/containers/Sms/Create/index.js +8 -7
- package/containers/Sms/Create/messages.js +19 -43
- package/containers/Sms/Edit/index.js +4 -4
- package/containers/Sms/Edit/messages.js +20 -36
- package/containers/TagList/messages.js +1 -1
- package/containers/Templates/index.js +19 -20
- package/containers/Templates/messages.js +64 -136
- package/containers/TestPage/messages.js +1 -1
- package/containers/Testv2/index.js +2 -2
- package/containers/Testv2/messages.js +1 -9
- package/containers/WeChat/MapTemplates/index.js +10 -10
- package/containers/WeChat/MapTemplates/messages.js +17 -49
- package/containers/WeChat/RichmediaTemplates/Create/messages.js +33 -33
- package/containers/WeChat/RichmediaTemplates/Edit/messages.js +1 -1
- package/containers/WeChat/RichmediaTemplates/View/index.js +2 -2
- package/containers/WeChat/RichmediaTemplates/View/messages.js +1 -9
- package/index.js +20 -8
- package/package.json +4 -1
- package/routes.js +16 -2
- package/services/api.js +2 -17
- package/services/getSchema.js +4 -1
- package/translations/en.json +360 -1396
- package/translations/zh.json +381 -1417
- package/utils/smsCharCountV2.js +10 -26
- package/v2Components/BreadCrumbs/messages.js +1 -1
- package/v2Components/CallTaskPreview/messages.js +1 -1
- package/v2Components/CapTagList/index.js +5 -6
- package/v2Components/CapTagList/messages.js +4 -24
- package/v2Components/Ckeditor/index.js +0 -1
- package/v2Components/Ckeditor/messages.js +1 -1
- package/v2Components/CmsTemplatesComponent/messages.js +2 -2
- package/v2Components/CustomPopOver/index.js +2 -4
- package/v2Components/CustomPopOver/messages.js +1 -5
- package/v2Components/DateFilter/index.js +349 -0
- package/v2Components/DateFilter/messages.js +17 -0
- package/v2Components/DateFilter/tests/index.test.js +15 -0
- package/v2Components/DateRange/index.js +113 -0
- package/v2Components/DateRange/messages.js +13 -0
- package/v2Components/DateRange/tests/index.test.js +10 -0
- package/v2Components/Edmeditor/messages.js +1 -1
- package/v2Components/EmailPreview/index.js +2 -2
- package/v2Components/EmailPreview/messages.js +3 -11
- package/v2Components/EmailPreviewV2/index.js +1 -1
- package/v2Components/EmailPreviewV2/messages.js +9 -13
- package/v2Components/Footer/messages.js +1 -1
- package/v2Components/FormBuilder/_formBuilder.scss +19 -0
- package/v2Components/FormBuilder/index.js +58 -27
- package/v2Components/FormBuilder/messages.js +1 -49
- package/v2Components/Header/index.js +2 -2
- package/v2Components/Header/messages.js +4 -4
- package/v2Components/ImagePreview/index.js +2 -3
- package/v2Components/ImagePreview/messages.js +1 -5
- package/v2Components/MobilePushPreviewV2/index.js +5 -2
- package/v2Components/MobilePushPreviewV2/messages.js +1 -9
- package/v2Components/NavigationBar/messages.js +1 -1
- package/v2Components/NewCallTask/messages.js +5 -5
- package/v2Components/PageHeader/_pageHeader.scss +22 -0
- package/v2Components/PageHeader/index.js +37 -0
- package/v2Components/PageHeader/messages.js +13 -0
- package/v2Components/PageHeader/tests/index.test.js +10 -0
- package/v2Components/PreviewSideBar/messages.js +6 -6
- package/v2Components/Sidebar/_sidebar.scss +115 -0
- package/v2Components/Sidebar/index.js +208 -0
- package/v2Components/Sidebar/messages.js +21 -0
- package/v2Components/Sidebar/tests/index.test.js +10 -0
- package/v2Components/SmsEditor/index.js +55 -0
- package/v2Components/SmsEditor/tests/index.test.js +10 -0
- package/v2Components/SmsTest/index.js +4 -6
- package/v2Components/SmsTest/messages.js +1 -9
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +2 -0
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +18 -28
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +3 -3
- package/v2Components/TemplatePreview/_templatePreview.scss +0 -9
- package/v2Components/TemplatePreview/index.js +16 -35
- package/v2Components/TemplatePreview/messages.js +7 -23
- package/v2Components/Toastr/messages.js +1 -1
- package/v2Components/ToastrMessage/index.js +2 -3
- package/v2Components/ToastrMessage/messages.js +1 -5
- package/v2Components/TopBar/_topbar.scss +46 -0
- package/v2Components/TopBar/messages.js +7 -7
- package/v2Containers/App/constants.js +0 -11
- package/v2Containers/Assets/Gallery/messages.js +24 -24
- package/v2Containers/CallTask/messages.js +6 -6
- package/v2Containers/Cap/actions.js +0 -1
- package/v2Containers/Cap/index.js +9 -6
- package/v2Containers/Cap/messsages.js +15 -19
- package/v2Containers/Cap/sagas.js +8 -1
- package/v2Containers/ChannelTemplates/messages.js +1 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +39 -1
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +7 -1
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +21 -3
- package/v2Containers/CreativesContainer/index.js +95 -50
- package/v2Containers/CreativesContainer/index.scss +15 -0
- package/v2Containers/CreativesContainer/messages.js +12 -16
- package/v2Containers/Dashboard/index.js +1 -2
- package/v2Containers/Dashboard/messages.js +1 -1
- package/v2Containers/Ebill/index.js +1 -1
- package/v2Containers/Ebill/messages.js +16 -20
- package/v2Containers/Email/index.js +20 -20
- package/v2Containers/Email/messages.js +61 -101
- package/v2Containers/EmailWrapper/index.js +44 -64
- package/v2Containers/EmailWrapper/messages.js +12 -12
- package/v2Containers/Line/Create/index.js +3 -3
- package/v2Containers/Line/Create/messages.js +41 -53
- package/v2Containers/Line/Edit/index.js +10 -10
- package/v2Containers/Line/Edit/messages.js +39 -55
- package/v2Containers/Login/components/LoginForm/index.js +6 -9
- package/v2Containers/Login/components/LoginForm/messages.js +3 -15
- package/v2Containers/Login/index.js +1 -1
- package/v2Containers/Login/messages.js +3 -7
- package/v2Containers/MobilePush/Create/_mobilePushCreate.scss +3 -0
- package/v2Containers/MobilePush/Create/index.js +33 -33
- package/v2Containers/MobilePush/Create/messages.js +81 -109
- package/v2Containers/MobilePush/Edit/_mobilePushCreate.scss +3 -0
- package/v2Containers/MobilePush/Edit/index.js +22 -22
- package/v2Containers/MobilePush/Edit/messages.js +79 -95
- package/v2Containers/MobilePush/initialSchema.js +1 -2
- package/v2Containers/MobilepushWrapper/messages.js +5 -5
- package/v2Containers/NotFoundPage/messages.js +1 -1
- package/v2Containers/Sms/Create/index.js +6 -6
- package/v2Containers/Sms/Create/messages.js +21 -41
- package/v2Containers/Sms/Edit/index.js +6 -6
- package/v2Containers/Sms/Edit/messages.js +20 -36
- package/v2Containers/TagList/messages.js +1 -1
- package/v2Containers/Templates/_templates.scss +31 -5
- package/v2Containers/Templates/index.js +243 -248
- package/v2Containers/Templates/messages.js +7 -15
- package/v2Containers/Templates/sagas.js +0 -1
- package/v2Containers/TemplatesV2/_templatesV2.scss +5 -0
- package/v2Containers/TemplatesV2/index.js +4 -1
- package/v2Containers/TemplatesV2/messages.js +5 -29
- package/v2Containers/TestPage/messages.js +1 -1
- package/v2Containers/Testv2/index.js +2 -2
- package/v2Containers/Testv2/messages.js +1 -9
- package/v2Containers/WeChat/MapTemplates/_mapTemplates.scss +16 -0
- package/v2Containers/WeChat/MapTemplates/actions.js +4 -2
- package/v2Containers/WeChat/MapTemplates/index.js +800 -872
- package/v2Containers/WeChat/MapTemplates/initialSchema.js +184 -0
- package/v2Containers/WeChat/MapTemplates/messages.js +19 -43
- package/v2Containers/WeChat/MapTemplates/sagas.js +6 -2
- package/v2Containers/WeChat/MapTemplates/selectors.js +1 -1
- package/v2Containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +118 -28
- package/v2Containers/WeChat/RichmediaTemplates/Create/actions.js +3 -1
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +262 -306
- package/v2Containers/WeChat/RichmediaTemplates/Create/messages.js +43 -95
- package/v2Containers/WeChat/RichmediaTemplates/Create/reducer.js +2 -1
- package/v2Containers/WeChat/RichmediaTemplates/Create/richmediaschema.js +113 -246
- package/v2Containers/WeChat/RichmediaTemplates/Create/sagas.js +5 -2
- package/v2Containers/WeChat/RichmediaTemplates/Create/selectors.js +1 -1
- package/v2Containers/WeChat/RichmediaTemplates/Edit/actions.js +2 -2
- package/v2Containers/WeChat/RichmediaTemplates/Edit/index.js +11 -10
- package/v2Containers/WeChat/RichmediaTemplates/Edit/messages.js +1 -1
- package/v2Containers/WeChat/RichmediaTemplates/Edit/reducer.js +1 -0
- package/v2Containers/WeChat/RichmediaTemplates/Edit/sagas.js +4 -2
- package/v2Containers/WeChat/RichmediaTemplates/Edit/selectors.js +1 -1
- package/v2Containers/WeChat/RichmediaTemplates/View/messages.js +1 -9
- package/v2Containers/WeChat/Wrapper/_wrapper.scss +0 -0
- package/v2Containers/WeChat/Wrapper/constants.js +5 -0
- package/v2Containers/WeChat/Wrapper/index.js +194 -0
- package/v2Containers/WeChat/Wrapper/messages.js +21 -0
- package/v2Containers/WeChat/helper.js +12 -0
- package/containers/Cap/messages.js +0 -75
- package/v2Containers/Cap/messages.js +0 -75
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
/*
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
*
|
|
3
|
+
* WeChat
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
6
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { bindActionCreators } from 'redux';
|
|
11
11
|
import Helmet from 'react-helmet';
|
|
12
|
-
import { intlShape } from 'react-intl';
|
|
12
|
+
import { intlShape, FormattedMessage } from 'react-intl';
|
|
13
13
|
import { createStructuredSelector } from 'reselect';
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
14
|
+
import { CapRow, CapColumn, CapSpin, CapCustomCard, CapButton, CapHeading } from '@capillarytech/cap-ui-library';
|
|
15
|
+
import isEmpty from 'lodash/isEmpty';
|
|
16
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
17
|
+
import forEach from 'lodash/forEach';
|
|
18
|
+
import isEqual from 'lodash/isEqual';
|
|
19
|
+
import findIndex from 'lodash/findIndex';
|
|
20
|
+
import map from 'lodash/map';
|
|
21
|
+
import set from 'lodash/set';
|
|
22
|
+
import get from 'lodash/get';
|
|
16
23
|
import { makeSelectTemplates } from '../../Templates/selectors';
|
|
17
24
|
import { makeSelectMetaEntities, makeSelectFetchingSchema, setInjectedTags } from '../../Cap/selectors';
|
|
18
25
|
import makeSelectWeChat from './selectors';
|
|
@@ -24,6 +31,10 @@ import * as templateActions from '../../Templates/actions';
|
|
|
24
31
|
import './_mapTemplates.scss';
|
|
25
32
|
import withCreatives from '../../../hoc/withCreatives';
|
|
26
33
|
|
|
34
|
+
const SELECT_TEMPLATE_MODE = "selectTemplate";
|
|
35
|
+
const MAP_TEMPLATE_MODE = "mapTemplateMode";
|
|
36
|
+
const { CapCustomCardList } = CapCustomCard;
|
|
37
|
+
|
|
27
38
|
export class MapTemplates extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
28
39
|
constructor(props) {
|
|
29
40
|
super(props);
|
|
@@ -31,6 +42,7 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
31
42
|
schema: {},
|
|
32
43
|
baseSchema: {},
|
|
33
44
|
formData: {},
|
|
45
|
+
activeMode: SELECT_TEMPLATE_MODE,
|
|
34
46
|
map: {
|
|
35
47
|
"discard-button": {
|
|
36
48
|
discardValues: this.discardValues,
|
|
@@ -59,12 +71,13 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
59
71
|
editTemplateData: {},
|
|
60
72
|
isFormValid: true,
|
|
61
73
|
checkValidation: false,
|
|
74
|
+
startValidation: false,
|
|
62
75
|
injectedTags: {},
|
|
63
76
|
isLoading: true,
|
|
64
77
|
showModal: false,
|
|
65
78
|
modalContent: {
|
|
66
|
-
title:
|
|
67
|
-
body:
|
|
79
|
+
title: "Alert",
|
|
80
|
+
body: "Do you really want to go back? All your temporary changes will be lost!",
|
|
68
81
|
type: 'confirm',
|
|
69
82
|
id: 'template-back-confirm-modal',
|
|
70
83
|
},
|
|
@@ -88,7 +101,6 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
88
101
|
this.unMaskTemplateUrl = this.unMaskTemplateUrl.bind(this);
|
|
89
102
|
this.resetState = this.resetState.bind(this);
|
|
90
103
|
this.resetSchema = this.resetSchema.bind(this);
|
|
91
|
-
this.handleFrameTasks = this.handleFrameTasks.bind(this);
|
|
92
104
|
this.getCurrentWindow = this.getCurrentWindow.bind(this);
|
|
93
105
|
this.startLoading = this.startLoading.bind(this);
|
|
94
106
|
this.startTemplateCreation = this.startTemplateCreation.bind(this);
|
|
@@ -96,7 +108,6 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
96
108
|
this.removeActionButtons = this.removeActionButtons.bind(this);
|
|
97
109
|
this.setWechatAccountOptions = this.setWechatAccountOptions.bind(this);
|
|
98
110
|
this.selectWechatAccount = this.selectWechatAccount.bind(this);
|
|
99
|
-
this.moveToTemplates = this.moveToTemplates.bind(this);
|
|
100
111
|
this.injectMessages = this.injectMessages.bind(this);
|
|
101
112
|
this.hideSchemaElementsByModule = this.hideSchemaElementsByModule.bind(this);
|
|
102
113
|
|
|
@@ -108,24 +119,24 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
108
119
|
this.injectMultiColSection = this.injectMultiColSection.bind(this);
|
|
109
120
|
this.getMappedEvent = this.getMappedEvent.bind(this);
|
|
110
121
|
this.showNext = this.showNext.bind(this);
|
|
122
|
+
this.getFormData = this.getFormData.bind(this);
|
|
111
123
|
this.updateSchema = false;
|
|
112
124
|
this.fetchedWeCrmAccount = false;
|
|
113
125
|
this.isAccountChange = false;
|
|
114
126
|
}
|
|
115
|
-
|
|
116
127
|
componentWillMount() {
|
|
117
128
|
const query = {
|
|
118
129
|
layout: 'WECHAT',
|
|
119
130
|
type: 'LAYOUT',
|
|
131
|
+
version: 'v2', //gets initial schema when v2 is specified
|
|
120
132
|
context: this.props.location.query.type === 'embedded' ? this.props.location.query.module : 'default',
|
|
121
133
|
};
|
|
122
134
|
this.props.globalActions.fetchSchemaForEntity(query);
|
|
123
135
|
this.props.actions.getWeCrmAccounts();
|
|
124
|
-
if (this.props
|
|
136
|
+
if (get(this.props, 'params.id', false)) {
|
|
125
137
|
this.props.actions.getTemplateDetails(this.props.params.id);
|
|
126
138
|
this.setState({isEdit: true});
|
|
127
139
|
}
|
|
128
|
-
console.log("Mount Params ", this.props.Templates.selectedWeChatAccount, this.props.location.query.type);
|
|
129
140
|
if (this.props.Templates.selectedWeChatAccount || (this.props.location.query.type === 'embedded' && this.props.location.query.module === 'loyalty')) {
|
|
130
141
|
if (this.props.Templates.selectedWeChatAccount) {
|
|
131
142
|
const params = {
|
|
@@ -139,42 +150,35 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
139
150
|
} else {
|
|
140
151
|
this.setWechatAccountOptions(this.props.WeChat.weCrmAccounts);
|
|
141
152
|
}
|
|
142
|
-
window.addEventListener("message", this.handleFrameTasks);
|
|
143
|
-
} else if (this.props.location.query.type === 'embedded' && this.props.location.query.module === 'outbound') {
|
|
144
|
-
console.log('Inside embedded Outbound');
|
|
145
|
-
} else {
|
|
146
|
-
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
147
|
-
const type = this.props.location.query.type;
|
|
148
|
-
this.props.router.push({
|
|
149
|
-
pathname: `/wechat`,
|
|
150
|
-
query: type === 'embedded' ? {type: 'embedded', module} : {module},
|
|
151
|
-
});
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
componentDidMount() {
|
|
156
|
-
console.log('added listener create,', this.props);
|
|
157
157
|
const query = {
|
|
158
158
|
layout: 'WECHAT',
|
|
159
159
|
type: 'LAYOUT',
|
|
160
|
+
version: 'v2', //gets initial schema when v2 is specified
|
|
160
161
|
context: this.props.location.query.type === 'embedded' ? this.props.location.query.module : 'default',
|
|
161
162
|
embedded: this.props.location.query.type === 'embedded' ? this.props.location.query.type : 'full',
|
|
162
163
|
};
|
|
163
164
|
this.props.globalActions.fetchSchemaForEntity(query);
|
|
164
|
-
|
|
165
|
-
window.addEventListener("message", this.handleFrameTasks);
|
|
166
165
|
}
|
|
167
166
|
|
|
168
167
|
componentWillReceiveProps(nextProps) {
|
|
169
|
-
if (nextProps.isGetFormData) {
|
|
170
|
-
this.getFormData();
|
|
168
|
+
if (nextProps.isGetFormData && !this.props.isFullMode && this.state.isEdit) {
|
|
169
|
+
this.props.getFormData(this.getFormData());
|
|
170
|
+
} else if (nextProps.isGetFormData && this.props.isGetFormData !== nextProps.isGetFormData && (this.props.isFullMode || !this.state.isEdit)) {
|
|
171
|
+
this.setState({startValidation: true});
|
|
172
|
+
}
|
|
173
|
+
if (!isEqual(nextProps.weChatMaptemplateStep, this.props.weChatMaptemplateStep)) {
|
|
174
|
+
this.setState({ activeMode: nextProps.weChatMaptemplateStep === 0 ? SELECT_TEMPLATE_MODE : MAP_TEMPLATE_MODE });
|
|
171
175
|
}
|
|
172
|
-
|
|
173
|
-
if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && _.isEmpty(this.state.schema) && !nextProps.WeChat.getTemplateDetailsInProgress) {
|
|
176
|
+
if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && isEmpty(this.state.schema) && !nextProps.WeChat.getTemplateDetailsInProgress) {
|
|
174
177
|
this.injectEvents(nextProps.metaEntities.layouts[0].definition);
|
|
175
178
|
const query = {
|
|
176
179
|
layout: 'WECHAT',
|
|
177
180
|
type: 'TAG',
|
|
181
|
+
version: 'v2', //gets initial schema when v2 is specified
|
|
178
182
|
context: this.props.location.query.type === 'embedded' ? this.props.location.query.module : 'default',
|
|
179
183
|
embedded: this.props.location.query.type === 'embedded' ? this.props.location.query.type : 'full',
|
|
180
184
|
};
|
|
@@ -183,8 +187,8 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
183
187
|
}
|
|
184
188
|
this.props.globalActions.fetchSchemaForEntity(query);
|
|
185
189
|
}
|
|
186
|
-
if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && !
|
|
187
|
-
if (nextProps.WeChat.weChatDefaultTemplate && !
|
|
190
|
+
if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && !isEmpty(this.state.schema)) {
|
|
191
|
+
if (nextProps.WeChat.weChatDefaultTemplate && !isEqual(nextProps.WeChat.weChatDefaultTemplate, this.props.WeChat.weChatDefaultTemplate)) {
|
|
188
192
|
this.injectEvents(this.state.schema);
|
|
189
193
|
if (nextProps.location.query.type === 'embedded' && nextProps.location.query.module === 'loyalty') {
|
|
190
194
|
this.setTemplateOptions(nextProps.WeChat.weChatTemplates);
|
|
@@ -192,12 +196,12 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
192
196
|
this.setTemplateOptions(nextProps.WeChat.weChatDefaultTemplate);
|
|
193
197
|
}
|
|
194
198
|
}
|
|
195
|
-
if ((this.props.location.query.type === 'embedded' && (this.props.location.query.module === 'loyalty' || this.props.location.query.module === 'outbound')) && !
|
|
199
|
+
if ((this.props.location.query.type === 'embedded' && (this.props.location.query.module === 'loyalty' || this.props.location.query.module === 'outbound')) && !isEmpty(nextProps.WeChat.templateDetails) && !isEqual(this.props.WeChat.templateDetails, this.state.editTemplateData) && this.isAccountChange === false) {
|
|
196
200
|
this.setState({editTemplateData: nextProps.WeChat.templateDetails}, () => {
|
|
197
|
-
if ( !
|
|
201
|
+
if ( !isEmpty(this.state.baseSchema)) {
|
|
198
202
|
this.setEditData();
|
|
199
203
|
} else {
|
|
200
|
-
this.setState({baseSchema:
|
|
204
|
+
this.setState({baseSchema: cloneDeep(this.state.schema)}, () => {
|
|
201
205
|
this.setEditData();
|
|
202
206
|
});
|
|
203
207
|
}
|
|
@@ -209,15 +213,15 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
209
213
|
// this.setEditData();
|
|
210
214
|
// });
|
|
211
215
|
// }
|
|
212
|
-
if (nextProps.params.id && !
|
|
216
|
+
if (nextProps.params.id && !isEqual(nextProps.params.id, this.props.params.id)) {
|
|
213
217
|
this.setState({isEdit: true});
|
|
214
218
|
}
|
|
215
|
-
if (this.state.isEdit &&
|
|
216
|
-
const templateIndex =
|
|
219
|
+
if (this.state.isEdit && isEmpty(this.state.editTemplateData) && !isEmpty(nextProps.WeChat.weChatTemplates)) {
|
|
220
|
+
const templateIndex = findIndex(nextProps.WeChat.weChatTemplates, {_id: nextProps.params.id});
|
|
217
221
|
if (templateIndex > -1) {
|
|
218
222
|
this.setState({editTemplateData: nextProps.WeChat.weChatTemplates[templateIndex]}, () => {
|
|
219
|
-
if (
|
|
220
|
-
this.setState({ baseSchema:
|
|
223
|
+
if (isEmpty(this.state.baseSchema)) {
|
|
224
|
+
this.setState({ baseSchema: cloneDeep(this.state.schema)}, () => {
|
|
221
225
|
this.setEditData();
|
|
222
226
|
});
|
|
223
227
|
} else {
|
|
@@ -226,11 +230,12 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
226
230
|
});
|
|
227
231
|
}
|
|
228
232
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
}
|
|
233
|
+
//To do => Uncomment in loyalty mode
|
|
234
|
+
// if (nextProps.location.query.type === 'embedded') {
|
|
235
|
+
// if (this.props.location.query.module !== 'loyalty') {
|
|
236
|
+
// this.removeActionButtons();
|
|
237
|
+
// }
|
|
238
|
+
// }
|
|
234
239
|
|
|
235
240
|
if (nextProps.WeChat.createResponse && nextProps.WeChat.createResponse.templateId) {
|
|
236
241
|
// this.resetSchema();
|
|
@@ -242,14 +247,8 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
242
247
|
}
|
|
243
248
|
this.props.globalActions.addMessageToQueue(message);
|
|
244
249
|
this.props.actions.clearCreateResponse();
|
|
245
|
-
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
246
|
-
const type = this.props.location.query.type;
|
|
247
|
-
this.props.router.push({
|
|
248
|
-
pathname: `/wechat`,
|
|
249
|
-
query: type === 'embedded' ? {type: 'embedded', module} : {module},
|
|
250
|
-
});
|
|
251
250
|
}
|
|
252
|
-
if (nextProps.WeChat.createTemplateError && !
|
|
251
|
+
if (nextProps.WeChat.createTemplateError && !isEqual(nextProps.WeChat.createTemplateError, this.props.WeChat.createTemplateError)) {
|
|
253
252
|
const message = getMessageObject('error', this.props.intl.formatMessage(messages.somethingWentWrong), true);
|
|
254
253
|
this.props.globalActions.addMessageToQueue(message);
|
|
255
254
|
}
|
|
@@ -266,12 +265,12 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
266
265
|
this.showNext();
|
|
267
266
|
}
|
|
268
267
|
|
|
269
|
-
if (!this.fetchedWeCrmAccount && !
|
|
268
|
+
if (!this.fetchedWeCrmAccount && !isEmpty(this.props.WeChat.weCrmAccounts) && (this.props.location.query.type === 'embedded' && this.props.location.query.module === 'loyalty')) {
|
|
270
269
|
this.injectEvents(this.state.schema);
|
|
271
270
|
this.setWechatAccountOptions(nextProps.WeChat.weCrmAccounts);
|
|
272
271
|
this.fetchedWeCrmAccount = true;
|
|
273
272
|
}
|
|
274
|
-
if (!
|
|
273
|
+
if (!isEmpty(nextProps.WeChat.selectedWeChatAccount) && !isEqual(this.props.WeChat.selectedWeChatAccount, nextProps.WeChat.selectedWeChatAccount) && (this.props.location.query.type === 'embedded')) {
|
|
275
274
|
const params = {
|
|
276
275
|
name: '',
|
|
277
276
|
sortBy: 'Most Recent',
|
|
@@ -282,16 +281,16 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
282
281
|
this.props.actions.getDefaultWeChatTemplates('wechat', params);
|
|
283
282
|
}
|
|
284
283
|
|
|
285
|
-
if (
|
|
284
|
+
if (isEmpty(nextProps.WeChat.selectedWeChatAccount) && (this.props.location.query.type === 'embedded')) {
|
|
286
285
|
let selectedAccount = {};
|
|
287
|
-
|
|
286
|
+
forEach(nextProps.WeChat.weCrmAccounts, (account) => {
|
|
288
287
|
if (account.configs && account.configs.is_wecrm_enabled) {
|
|
289
288
|
if (account.sourceAccountIdentifier === this.props.location.query.source_account_id) {
|
|
290
289
|
selectedAccount = account;
|
|
291
290
|
}
|
|
292
291
|
}
|
|
293
292
|
});
|
|
294
|
-
if (!
|
|
293
|
+
if (!isEmpty(selectedAccount)) {
|
|
295
294
|
this.props.actions.setWeChatAccount(selectedAccount);
|
|
296
295
|
}
|
|
297
296
|
}
|
|
@@ -301,7 +300,7 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
301
300
|
if (!nextProps.WeChat.fetchingDefaultTemplates && nextProps.location.query.module === 'outbound' && nextProps.params.id !== undefined) {
|
|
302
301
|
this.setState({ isLoading: false});
|
|
303
302
|
}
|
|
304
|
-
if (((!nextProps.WeChat.fetchingDefaultTemplates && !
|
|
303
|
+
if (((!nextProps.WeChat.fetchingDefaultTemplates && !isEqual(nextProps.WeChat.fetchingDefaultTemplates, this.props.WeChat.fetchingDefaultTemplates) && nextProps.location.query.module !== 'loyalty') || (nextProps.location.query.module === 'loyalty'))) {
|
|
305
304
|
this.setState({ isLoading: false});
|
|
306
305
|
}
|
|
307
306
|
|
|
@@ -312,9 +311,6 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
312
311
|
}
|
|
313
312
|
|
|
314
313
|
componentWillUnmount() {
|
|
315
|
-
console.log('removed listener create');
|
|
316
|
-
window.removeEventListener("message", this.handleFrameTasks);
|
|
317
|
-
this.props.templateActions.resetTemplate();
|
|
318
314
|
this.resetState();
|
|
319
315
|
}
|
|
320
316
|
|
|
@@ -323,8 +319,8 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
323
319
|
let selectedTemplate = {};
|
|
324
320
|
let selectedTemplateData = {};
|
|
325
321
|
if (this.props.location.query.type === 'embedded' && (this.props.location.query.module === 'loyalty')) {
|
|
326
|
-
|
|
327
|
-
|
|
322
|
+
selectedTemplateData = this.state.editTemplateData;
|
|
323
|
+
if (get(this.props, 'params.id', false) && isEmpty(this.props.WeChat.weChatTemplates) && isEqual(formData['wechat-template'], this.state.formData['wechat-template'])) {
|
|
328
324
|
selectedTemplate = {
|
|
329
325
|
template_id: this.props.WeChat.templateDetails.versions.base.template_id,
|
|
330
326
|
title: this.props.WeChat.templateDetails.versions.base.Title,
|
|
@@ -332,9 +328,9 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
332
328
|
};
|
|
333
329
|
selectedTemplateData = this.props.WeChat.templateDetails;
|
|
334
330
|
} else {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
if (template.versions.base.template_id === formData['wechat-template']) {
|
|
331
|
+
const editTemplateData = this.state.editTemplateData;
|
|
332
|
+
forEach(this.props.WeChat.weChatTemplates, (template) => {
|
|
333
|
+
if (template.versions.base.template_id === formData['wechat-template'] && formData['wechat-template'] !== get(editTemplateData, 'versions.base.template_id') ) { // not changing if already selected templates comes
|
|
338
334
|
selectedTemplate = {
|
|
339
335
|
template_id: template.versions.base.template_id,
|
|
340
336
|
title: template.versions.base.Title,
|
|
@@ -346,75 +342,80 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
346
342
|
});
|
|
347
343
|
}
|
|
348
344
|
} else if (this.state.isEdit && this.state.editTemplateData.versions) {
|
|
349
|
-
|
|
350
|
-
selectedTemplateData = _.cloneDeep(this.state.editTemplateData);
|
|
345
|
+
selectedTemplateData = cloneDeep(this.state.editTemplateData);
|
|
351
346
|
selectedTemplate = {
|
|
352
347
|
template_id: selectedTemplateData.versions.base.template_id,
|
|
353
348
|
title: selectedTemplateData.versions.base.Title,
|
|
354
349
|
content: selectedTemplateData.versions.base.content,
|
|
355
350
|
};
|
|
356
351
|
} else if (!this.state.isEdit) {
|
|
357
|
-
selectedWechatTemplateIndex =
|
|
352
|
+
selectedWechatTemplateIndex = findIndex(this.props.WeChat.weChatDefaultTemplate, {template_id: formData['wechat-template']});
|
|
358
353
|
selectedTemplate = this.props.WeChat.weChatDefaultTemplate[selectedWechatTemplateIndex];
|
|
359
354
|
}
|
|
360
355
|
|
|
361
|
-
if (!
|
|
356
|
+
if (!isEqual(formData['wechat-template'], this.state.formData['wechat-template'])) {
|
|
362
357
|
this.updateSchema = true;
|
|
363
358
|
}
|
|
364
359
|
if (this.isAccountChange) {
|
|
365
360
|
selectedTemplateData = {};
|
|
366
361
|
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
362
|
+
const newState = {formData};
|
|
363
|
+
if (!isEqual(this.state.editTemplateData, selectedTemplateData)) {
|
|
364
|
+
newState.editTemplateData = selectedTemplateData;
|
|
365
|
+
}
|
|
366
|
+
if (!isEqual(this.state.formData, formData)) {
|
|
367
|
+
this.setState(newState, () => {
|
|
368
|
+
if (!isEmpty(this.state.editTemplateData) && this.props.location.query.type === 'embedded' && this.props.location.query.module === 'loyalty') {
|
|
369
|
+
this.setEditData();
|
|
370
|
+
}
|
|
371
|
+
if (this.props.WeChat.selectedWeChatAccount && !isEqual(this.props.WeChat.selectedWeChatAccount.name, formData['wechat-accounts']) && this.props.location.query.type === 'embedded' && this.props.location.query.module === 'loyalty') {
|
|
372
|
+
let selectedAccount = {};
|
|
373
|
+
forEach(this.props.WeChat.weCrmAccounts, (account) => {
|
|
374
|
+
if (account.configs && account.configs.is_wecrm_enabled) {
|
|
375
|
+
if (account.name === formData['wechat-accounts']) {
|
|
376
|
+
selectedAccount = account;
|
|
377
|
+
}
|
|
377
378
|
}
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
379
|
+
});
|
|
380
|
+
this.props.actions.setWeChatAccount(selectedAccount);
|
|
381
|
+
this.setSelectedTemplateData({});
|
|
382
|
+
}
|
|
383
|
+
if ((selectedWechatTemplateIndex !== -1 || this.state.isEdit) && !isEmpty(selectedTemplate)) {
|
|
384
|
+
let templateData = {};
|
|
385
|
+
if (this.state.isEdit && !isEmpty(this.state.editTemplateData)) {
|
|
386
|
+
templateData = {
|
|
387
|
+
template_id: this.state.editTemplateData.versions.base.template_id,
|
|
388
|
+
title: this.state.editTemplateData.versions.base.Title,
|
|
389
|
+
content: this.state.editTemplateData.versions.base.content,
|
|
390
|
+
};
|
|
391
|
+
if (this.props.location.query.type === 'embedded' && this.props.location.query.module === 'loyalty') {
|
|
392
|
+
if (isEqual(this.props.WeChat.selectedWeChatAccount.name, formData['wechat-accounts'])) {
|
|
393
|
+
this.setSelectedTemplateData(selectedTemplate);
|
|
394
|
+
}
|
|
395
|
+
} else {
|
|
396
|
+
const templateTags = this.getTagsFromContent(templateData.content);
|
|
397
|
+
this.prepareWeChatPreviewData(templateData, templateTags);
|
|
394
398
|
}
|
|
399
|
+
} else if (!this.updateSchema) {
|
|
400
|
+
const templateTags = this.getTagsFromContent(selectedTemplate.content);
|
|
401
|
+
this.prepareWeChatPreviewData(selectedTemplate, templateTags);
|
|
395
402
|
} else {
|
|
396
|
-
|
|
397
|
-
this.
|
|
403
|
+
this.updateSchema = false;
|
|
404
|
+
this.setSelectedTemplateData(selectedTemplate);
|
|
398
405
|
}
|
|
399
|
-
} else if (!this.updateSchema) {
|
|
400
|
-
const templateTags = this.getTagsFromContent(selectedTemplate.content);
|
|
401
|
-
this.prepareWeChatPreviewData(selectedTemplate, templateTags);
|
|
402
406
|
} else {
|
|
403
|
-
|
|
404
|
-
this.
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
if (account.configs && account.configs.is_wecrm_enabled) {
|
|
410
|
-
if (account.name === formData['wechat-accounts']) {
|
|
411
|
-
selectedAccount = account;
|
|
407
|
+
let selectedAccount = {};
|
|
408
|
+
forEach(this.props.WeChat.weCrmAccounts, (account) => {
|
|
409
|
+
if (account.configs && account.configs.is_wecrm_enabled) {
|
|
410
|
+
if (account.name === formData['wechat-accounts']) {
|
|
411
|
+
selectedAccount = account;
|
|
412
|
+
}
|
|
412
413
|
}
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
}
|
|
414
|
+
});
|
|
415
|
+
this.props.actions.setWeChatAccount(selectedAccount);
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
}
|
|
418
419
|
}
|
|
419
420
|
|
|
420
421
|
onTagSelect(data, currentTab, value) {
|
|
@@ -423,25 +424,30 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
423
424
|
document.getElementById(editorId).focus();
|
|
424
425
|
}
|
|
425
426
|
|
|
426
|
-
getFormData(
|
|
427
|
-
|
|
428
|
-
const
|
|
427
|
+
getFormData(formData) {
|
|
428
|
+
let { editTemplateData} = this.state;
|
|
429
|
+
const { formData: stateFormData } = this.state;
|
|
430
|
+
const selectedWeChatAccount = (!isEmpty(this.props.Templates.selectedWeChatAccount) ? this.props.Templates.selectedWeChatAccount : this.props.WeChat.selectedWeChatAccount);
|
|
431
|
+
if (isEmpty(editTemplateData)) {
|
|
432
|
+
editTemplateData = formData;
|
|
433
|
+
}
|
|
429
434
|
const data = {
|
|
430
|
-
|
|
431
|
-
|
|
435
|
+
accountId: selectedWeChatAccount.id,
|
|
436
|
+
template_id: editTemplateData.versions.base.template_id,
|
|
437
|
+
Title: editTemplateData.versions.base.Title,
|
|
432
438
|
Tag: [],
|
|
433
439
|
url: this.state.formData['is-internal-url'] ? this.maskTemplateUrl(this.state.formData['template-link']) : this.state.formData['template-link'],
|
|
434
440
|
TopColor: "#000000",
|
|
435
441
|
data: {},
|
|
436
|
-
|
|
442
|
+
previewContent: stateFormData['sms-preview'],
|
|
437
443
|
BrandId: (selectedWeChatAccount.configs.brand_id ? selectedWeChatAccount.configs.brand_id : ''),
|
|
438
444
|
OriginalId: selectedWeChatAccount.sourceAccountIdentifier,
|
|
439
|
-
content:
|
|
445
|
+
content: editTemplateData.versions.base.content,
|
|
440
446
|
isInternalUrl: this.state.formData['is-internal-url'],
|
|
441
|
-
creative_template_id:
|
|
447
|
+
creative_template_id: editTemplateData._id,
|
|
442
448
|
touser: "{{wechat_open_id}}",
|
|
443
449
|
};
|
|
444
|
-
|
|
450
|
+
forEach(this.state.selectedTemplateTags, (templateTag) => {
|
|
445
451
|
const tagName = templateTag.substr(0, templateTag.indexOf('.'));
|
|
446
452
|
let newTagname = tagName;
|
|
447
453
|
data.Tag.push(tagName);
|
|
@@ -461,18 +467,12 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
461
467
|
action: "getFormData",
|
|
462
468
|
value: data,
|
|
463
469
|
validity: this.state.isFormValid,
|
|
470
|
+
type: "WECHAT",
|
|
464
471
|
};
|
|
465
|
-
|
|
466
|
-
this.setState({checkValidation: true});
|
|
467
|
-
if (this.props.location.query.module === 'library') {
|
|
468
|
-
this.props.getLibraryFormData(response);
|
|
469
|
-
} else {
|
|
470
|
-
e.source.postMessage(JSON.stringify(response), e.origin);
|
|
471
|
-
}
|
|
472
|
+
return response;
|
|
472
473
|
}
|
|
473
474
|
|
|
474
475
|
getCurrentWindow(e) {
|
|
475
|
-
console.log('in sms create', e);
|
|
476
476
|
const response = {
|
|
477
477
|
action: e.action,
|
|
478
478
|
value: 'edit',
|
|
@@ -491,69 +491,14 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
491
491
|
}
|
|
492
492
|
return foundTags;
|
|
493
493
|
}
|
|
494
|
-
|
|
494
|
+
|
|
495
495
|
startLoading(ifEdit) {
|
|
496
496
|
console.log('startLoading', ifEdit);
|
|
497
497
|
if (ifEdit) {
|
|
498
498
|
this.setState({loading: true});
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
|
-
|
|
502
|
-
handleFrameTasks = (e) => {
|
|
503
|
-
// console.log('data listened to is', e.data);
|
|
504
|
-
const type = e.data;
|
|
505
|
-
// console.log('data type', typeof type);
|
|
506
|
-
if (typeof type === 'object') {
|
|
507
|
-
// console.log('received something', type);
|
|
508
|
-
const action = type.action;
|
|
509
|
-
switch (action) {
|
|
510
|
-
case "startTemplateCreation":
|
|
511
|
-
this.startTemplateCreation(type.value);
|
|
512
|
-
break;
|
|
513
|
-
case "startLoading":
|
|
514
|
-
this.startLoading(type.edit);
|
|
515
|
-
break;
|
|
516
|
-
case "getCurrentWindow":
|
|
517
|
-
this.getCurrentWindow(type);
|
|
518
|
-
break;
|
|
519
|
-
default:
|
|
520
|
-
break;
|
|
521
|
-
}
|
|
522
|
-
} else {
|
|
523
|
-
switch (type) {
|
|
524
|
-
case "getFormData":
|
|
525
|
-
this.getFormData(e);
|
|
526
|
-
break;
|
|
527
|
-
case "startTemplateCreation":
|
|
528
|
-
console.log('Starting to create template');
|
|
529
|
-
//this.getFormData(e);
|
|
530
|
-
break;
|
|
531
|
-
case "moveToTemplates":
|
|
532
|
-
console.log('moving to templates');
|
|
533
|
-
this.moveToTemplates();
|
|
534
|
-
break;
|
|
535
|
-
case "validateContent":
|
|
536
|
-
console.log('validating Content');
|
|
537
|
-
this.validateContent(e);
|
|
538
|
-
break;
|
|
539
|
-
default:
|
|
540
|
-
break;
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
moveToTemplates() {
|
|
546
|
-
console.log('in move to Templates');
|
|
547
|
-
const modalContent = {
|
|
548
|
-
title: this.props.intl.formatMessage(messages.alertMessage),
|
|
549
|
-
body: this.props.intl.formatMessage(messages.goBackTemporaryChangesLost),
|
|
550
|
-
type: 'confirm',
|
|
551
|
-
id: 'template-back-confirm-modal',
|
|
552
|
-
show: true,
|
|
553
|
-
};
|
|
554
|
-
this.setState({modalContent, showModal: true});
|
|
555
|
-
}
|
|
556
|
-
|
|
501
|
+
|
|
557
502
|
injectMessages(elem) {
|
|
558
503
|
const temp = elem;
|
|
559
504
|
if (temp.value && messages[temp.value]) {
|
|
@@ -570,26 +515,27 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
570
515
|
}
|
|
571
516
|
return temp;
|
|
572
517
|
}
|
|
573
|
-
|
|
518
|
+
|
|
574
519
|
setSelectedTemplateData(weChatData) {
|
|
575
|
-
let schema =
|
|
576
|
-
schema.standalone.sections[0].childSections[1].childSections[0].childSections[1].inputFields = [];
|
|
577
|
-
if (
|
|
520
|
+
let schema = cloneDeep(this.state.baseSchema);
|
|
521
|
+
// schema.standalone.sections[0].childSections[1].childSections[0].childSections[1].inputFields = [];
|
|
522
|
+
if (isEmpty(weChatData)) {
|
|
578
523
|
// schema.standalone.sections[0].childSections[1].childSections[0].childSections[1].inputFields = [];
|
|
579
|
-
const formData=
|
|
524
|
+
const formData=cloneDeep(this.state.formData);
|
|
580
525
|
formData['wechat-template']="";
|
|
581
526
|
this.setState({schema,formData});
|
|
582
527
|
this.isAccountChange = true;
|
|
583
528
|
return;
|
|
584
529
|
}
|
|
585
530
|
console.log('Setting Data ', weChatData, this.state.baseSchema);
|
|
586
|
-
const {map} =
|
|
531
|
+
const {map} = cloneDeep(this.state);
|
|
587
532
|
const templateTags = this.getTagsFromContent(weChatData.content);
|
|
588
|
-
const formData =
|
|
589
|
-
|
|
533
|
+
const formData = cloneDeep(this.state.formData);
|
|
534
|
+
formData['wechat-template'] = weChatData.template_id;
|
|
535
|
+
forEach(templateTags, (tag) => {
|
|
590
536
|
const tagTitle = tag.substr(0, tag.indexOf('.'));
|
|
591
537
|
let title = tagTitle;
|
|
592
|
-
|
|
538
|
+
|
|
593
539
|
if (tagTitle.match(/first/i)) {
|
|
594
540
|
title = "Header";
|
|
595
541
|
}
|
|
@@ -597,750 +543,728 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
597
543
|
title = "Footer";
|
|
598
544
|
}
|
|
599
545
|
|
|
600
|
-
const colsData =
|
|
601
|
-
cols: [
|
|
602
|
-
{
|
|
603
|
-
id: `template-label-${title}`,
|
|
604
|
-
metaType: "label",
|
|
605
|
-
value: `${title}`,
|
|
606
|
-
primitive: true,
|
|
607
|
-
type: "div",
|
|
608
|
-
width: 4,
|
|
609
|
-
offset: 0,
|
|
610
|
-
onlyDisplay: true,
|
|
611
|
-
colStyle: {
|
|
612
|
-
flex: 1,
|
|
613
|
-
textAlign: 'left',
|
|
614
|
-
color: '#333333',
|
|
615
|
-
lineHeight: '24px',
|
|
616
|
-
fontSize: '14px',
|
|
617
|
-
fontWeight: '400',
|
|
618
|
-
fontFamily: 'open-sans',
|
|
619
|
-
fontStyle: 'normal',
|
|
620
|
-
textTransform: 'capitalize',
|
|
621
|
-
padding: '1em .833em',
|
|
622
|
-
},
|
|
623
|
-
},
|
|
624
|
-
{
|
|
625
|
-
id: `template-${title}`,
|
|
626
|
-
placeholder: `${title}`,
|
|
627
|
-
type: "input", //Resembles component to be used
|
|
628
|
-
metaType: "text",
|
|
629
|
-
datatype: "string",
|
|
630
|
-
errorMessage: `${title} ${this.props.intl.formatMessage(messages.hasValidContent)}`,
|
|
631
|
-
required: true,
|
|
632
|
-
fluid: true,
|
|
633
|
-
disabled: (this.props.location.query.type === 'embedded'),
|
|
634
|
-
style: {
|
|
635
|
-
fontSize: '14px',
|
|
636
|
-
fontFamily: 'open-sans',
|
|
637
|
-
fontStyle: 'normal',
|
|
638
|
-
// fontWeight: 600,
|
|
639
|
-
marginBottom: '16px',
|
|
640
|
-
},
|
|
641
|
-
styling: "semantic",
|
|
642
|
-
order: 1,
|
|
643
|
-
width: 15,
|
|
644
|
-
// offSet: 2,
|
|
645
|
-
customComponent: false,
|
|
646
|
-
standalone: true,
|
|
647
|
-
supportedEvents: [
|
|
648
|
-
'onChange',
|
|
649
|
-
],
|
|
650
|
-
},
|
|
651
|
-
],
|
|
652
|
-
};
|
|
653
|
-
|
|
546
|
+
const colsData = [];
|
|
654
547
|
if(this.props.location.query.type !== 'embedded') {
|
|
655
|
-
colsData.
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
548
|
+
colsData.push({
|
|
549
|
+
type: "multicols",
|
|
550
|
+
inputFields: [
|
|
551
|
+
{
|
|
552
|
+
rowClassName: 'tag-container',
|
|
553
|
+
cols: [{
|
|
554
|
+
width: 23,
|
|
555
|
+
id: `tagList-${title}`,
|
|
556
|
+
label: "Tags",
|
|
557
|
+
type: "tag-list", //Resembles component to be used
|
|
558
|
+
metaType: "List",
|
|
559
|
+
datatype: "select",
|
|
560
|
+
required: true,
|
|
561
|
+
fluid: true,
|
|
562
|
+
onlyDisplay: true,
|
|
563
|
+
styling: "semantic",
|
|
564
|
+
order: 1,
|
|
565
|
+
customComponent: true,
|
|
566
|
+
supportedEvents: [
|
|
567
|
+
'onTagSelect',
|
|
568
|
+
],
|
|
569
|
+
style: {marginBottom: 'unset', height: '24px', },
|
|
570
|
+
className: 'add-label',
|
|
571
|
+
}],
|
|
572
|
+
}
|
|
670
573
|
],
|
|
671
|
-
}
|
|
574
|
+
});
|
|
672
575
|
}
|
|
673
|
-
|
|
576
|
+
|
|
674
577
|
map[`tagList-${title}`] = {
|
|
675
578
|
onTagSelect: this.onTagSelect,
|
|
676
579
|
};
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
580
|
+
|
|
581
|
+
colsData.push({
|
|
582
|
+
type: "multicols",
|
|
583
|
+
inputFields: [
|
|
584
|
+
{
|
|
585
|
+
cols: [
|
|
586
|
+
{
|
|
587
|
+
id: `template-${title}`,
|
|
588
|
+
placeholder: `${title}`,
|
|
589
|
+
type: "input", //Resembles component to be used
|
|
590
|
+
metaType: "text",
|
|
591
|
+
datatype: "string",
|
|
592
|
+
errorMessage: `${title} has invalid content.`,
|
|
593
|
+
required: true,
|
|
594
|
+
fluid: true,
|
|
595
|
+
disabled: (this.props.location.query.type === 'embedded' && this.state.isEdit),
|
|
596
|
+
label: title,
|
|
597
|
+
styling: "semantic",
|
|
598
|
+
order: 1,
|
|
599
|
+
width: 23,
|
|
600
|
+
// offSet: 2,
|
|
601
|
+
customComponent: false,
|
|
602
|
+
standalone: true,
|
|
603
|
+
supportedEvents: [
|
|
604
|
+
'onChange',
|
|
605
|
+
],
|
|
606
|
+
size: "large",
|
|
607
|
+
},
|
|
608
|
+
],
|
|
609
|
+
}
|
|
610
|
+
],
|
|
611
|
+
});
|
|
612
|
+
|
|
701
613
|
map[`template-${title}`] = {
|
|
702
614
|
onChange: this.setContent,
|
|
703
615
|
};
|
|
704
|
-
|
|
705
|
-
schema.standalone.sections[0].childSections[1].childSections[0].childSections
|
|
616
|
+
|
|
617
|
+
schema.standalone.sections[0].childSections[1].childSections[0].childSections.push(...colsData);
|
|
706
618
|
});
|
|
707
|
-
|
|
708
|
-
schema.standalone.sections[0].childSections[1].childSections[0].childSections
|
|
709
|
-
{
|
|
710
|
-
cols: [
|
|
711
|
-
{
|
|
712
|
-
id: "template-label-link",
|
|
713
|
-
metaType: "label",
|
|
714
|
-
value: this.props.intl.formatMessage(messages.Link),
|
|
715
|
-
primitive: true,
|
|
716
|
-
type: "div",
|
|
717
|
-
width: 4,
|
|
718
|
-
offset: 0,
|
|
719
|
-
onlyDisplay: true,
|
|
720
|
-
colStyle: {
|
|
721
|
-
flex: 1,
|
|
722
|
-
textAlign: 'left',
|
|
723
|
-
color: '#333333',
|
|
724
|
-
lineHeight: '24px',
|
|
725
|
-
fontSize: '14px',
|
|
726
|
-
fontWeight: '400',
|
|
727
|
-
fontFamily: 'open-sans',
|
|
728
|
-
fontStyle: 'normal',
|
|
729
|
-
textTransform: 'capitalize',
|
|
730
|
-
padding: '.5em .833em',
|
|
731
|
-
},
|
|
732
|
-
},
|
|
733
|
-
{
|
|
734
|
-
id: 'template-link',
|
|
735
|
-
placeholder: this.props.intl.formatMessage(messages.Link),
|
|
736
|
-
type: "input", //Resembles component to be used
|
|
737
|
-
metaType: "text",
|
|
738
|
-
datatype: "string",
|
|
739
|
-
errorMessage: this.props.intl.formatMessage(messages.linkCantEmpty),
|
|
740
|
-
required: true,
|
|
741
|
-
fluid: true,
|
|
742
|
-
disabled: (this.props.location.query.type === 'embedded'),
|
|
743
|
-
style: {
|
|
744
|
-
fontSize: '14px',
|
|
745
|
-
fontFamily: 'open-sans',
|
|
746
|
-
fontStyle: 'normal',
|
|
747
|
-
// fontWeight: 600,
|
|
748
|
-
// marginBottom: '16px',
|
|
749
|
-
},
|
|
750
|
-
styling: "semantic",
|
|
751
|
-
order: 1,
|
|
752
|
-
width: 15,
|
|
753
|
-
// offSet: 6,
|
|
754
|
-
customComponent: false,
|
|
755
|
-
standalone: true,
|
|
756
|
-
supportedEvents: [
|
|
757
|
-
'onChange',
|
|
758
|
-
],
|
|
759
|
-
},
|
|
760
|
-
],
|
|
761
|
-
},
|
|
619
|
+
|
|
620
|
+
schema.standalone.sections[0].childSections[1].childSections[0].childSections.push(
|
|
762
621
|
{
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
622
|
+
type: "multicols",
|
|
623
|
+
inputFields: [{
|
|
624
|
+
rowClassName: 'link-row',
|
|
625
|
+
cols: [
|
|
626
|
+
{
|
|
627
|
+
id: 'template-link',
|
|
628
|
+
placeholder: this.props.intl.formatMessage(messages.Link),
|
|
629
|
+
label: 'Link',
|
|
630
|
+
type: "input", //Resembles component to be used
|
|
631
|
+
metaType: "text",
|
|
632
|
+
datatype: "string",
|
|
633
|
+
errorMessage: `Link cannot be empty.`,
|
|
634
|
+
required: true,
|
|
635
|
+
fluid: true,
|
|
636
|
+
disabled: (this.props.location.query.type === 'embedded' && this.state.isEdit),
|
|
637
|
+
style: {
|
|
638
|
+
fontSize: '14px',
|
|
639
|
+
fontStyle: 'normal',
|
|
640
|
+
},
|
|
641
|
+
styling: "semantic",
|
|
642
|
+
order: 1,
|
|
643
|
+
width: 23,
|
|
644
|
+
// offSet: 6,
|
|
645
|
+
customComponent: false,
|
|
646
|
+
standalone: true,
|
|
647
|
+
supportedEvents: [
|
|
648
|
+
'onChange',
|
|
649
|
+
],
|
|
650
|
+
size: "large",
|
|
770
651
|
},
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
652
|
+
],
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
cols: [
|
|
656
|
+
{
|
|
657
|
+
id: "is-internal-url",
|
|
658
|
+
label: 'Is this internal url',
|
|
659
|
+
standalone: true,
|
|
660
|
+
labelStyle: {
|
|
661
|
+
backgroundColor: "white",
|
|
662
|
+
},
|
|
663
|
+
colStyle: {
|
|
664
|
+
marginBottom: '24px',
|
|
665
|
+
},
|
|
666
|
+
style: {
|
|
667
|
+
textAlign: 'left',
|
|
668
|
+
color: '#262626',
|
|
669
|
+
fontFamily: 'Open-Sans',
|
|
670
|
+
lineHeight: '24px',
|
|
671
|
+
fontSize: '14px',
|
|
672
|
+
padding: '.5833em .833em',
|
|
673
|
+
marginBottom: '24px',
|
|
674
|
+
paddingLeft: '0',
|
|
675
|
+
},
|
|
676
|
+
type: "checkbox",
|
|
677
|
+
disabled: (this.props.location.query.type === 'embedded' && this.state.isEdit),
|
|
678
|
+
metaType: "text",
|
|
679
|
+
datatype: "boolean",
|
|
680
|
+
required: true,
|
|
681
|
+
fluid: true,
|
|
682
|
+
styling: "semantic",
|
|
683
|
+
order: 1,
|
|
684
|
+
width: 10,
|
|
685
|
+
onlyDisplay: false,
|
|
686
|
+
customComponent: false,
|
|
687
|
+
supportedEvents: [
|
|
688
|
+
'onChange',
|
|
689
|
+
],
|
|
783
690
|
},
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
metaType: "text",
|
|
787
|
-
datatype: "boolean",
|
|
788
|
-
required: true,
|
|
789
|
-
fluid: true,
|
|
790
|
-
styling: "semantic",
|
|
791
|
-
order: 1,
|
|
792
|
-
width: 10,
|
|
793
|
-
offset: 4,
|
|
794
|
-
onlyDisplay: false,
|
|
795
|
-
customComponent: false,
|
|
796
|
-
supportedEvents: [
|
|
797
|
-
'onChange',
|
|
798
|
-
],
|
|
799
|
-
},
|
|
800
|
-
],
|
|
691
|
+
],
|
|
692
|
+
}],
|
|
801
693
|
}
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
694
|
+
);
|
|
695
|
+
if (this.state.isEdit) {
|
|
696
|
+
forEach(this.state.editTemplateData.versions.base.Tag, (tag) => {
|
|
697
|
+
let tagName = tag;
|
|
698
|
+
if (tag.match(/first/i)) {
|
|
699
|
+
tagName = "Header";
|
|
700
|
+
}
|
|
701
|
+
if (tag.match(/remark/i)) {
|
|
702
|
+
tagName = "Footer";
|
|
703
|
+
}
|
|
704
|
+
formData[`template-${tagName}`] = this.state.editTemplateData.versions.base.data[tag].value;
|
|
705
|
+
});
|
|
706
|
+
if (this.state.editTemplateData.versions.base.url) {
|
|
707
|
+
formData[`template-link`] = this.state.editTemplateData.versions.base.isInternalUrl ? this.unMaskTemplateUrl(this.state.editTemplateData.versions.base.url) : this.state.editTemplateData.versions.base.url;
|
|
808
708
|
}
|
|
809
|
-
if (
|
|
810
|
-
|
|
709
|
+
if (this.state.editTemplateData.versions.base.isInternalUrl) {
|
|
710
|
+
formData['is-internal-url'] = this.state.editTemplateData.versions.base.isInternalUrl;
|
|
811
711
|
}
|
|
812
|
-
|
|
712
|
+
// schema.standalone.sections[0].childSections[1].childSections[1].inputFields[0].cols[0].content = weChatData.content;
|
|
713
|
+
} else {
|
|
714
|
+
// schema.standalone.sections[0].childSections[1].childSections[1].inputFields[0].cols[0].content = weChatData.content;
|
|
715
|
+
}
|
|
716
|
+
// schema.standalone.sections[0].childSections[1].childSections[1].inputFields[0].cols[0].content = weChatData.content;
|
|
717
|
+
|
|
718
|
+
this.setState({schema, map, selectedTemplateTags: templateTags, formData, activeMode: MAP_TEMPLATE_MODE, weChatData}, () => {
|
|
719
|
+
console.log('Is internal URL ', this.state.schema, formData);
|
|
720
|
+
this.prepareWeChatPreviewData(weChatData, templateTags);
|
|
721
|
+
this.props.onWeChatMaptemplateStepChange(1);
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
resetState() {
|
|
726
|
+
this.setState({
|
|
727
|
+
formData: {},
|
|
728
|
+
schema: {},
|
|
729
|
+
baseSchema: {},
|
|
730
|
+
selectedTemplateTags: [],
|
|
731
|
+
isEdit: false,
|
|
732
|
+
editTemplateData: {},
|
|
733
|
+
isFormValid: true,
|
|
734
|
+
checkValidation: false,
|
|
735
|
+
startValidation: false,
|
|
736
|
+
injectedTags: {},
|
|
737
|
+
isLoading: true,
|
|
813
738
|
});
|
|
814
|
-
|
|
815
|
-
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
resetSchema() {
|
|
742
|
+
const formData = cloneDeep(this.state.formData);
|
|
743
|
+
if (this.state.isEdit) {
|
|
744
|
+
const templateData = {
|
|
745
|
+
template_id: this.state.editTemplateData.versions.base.template_id,
|
|
746
|
+
title: this.state.editTemplateData.versions.base.Title,
|
|
747
|
+
content: this.state.editTemplateData.versions.base.content,
|
|
748
|
+
};
|
|
749
|
+
this.setSelectedTemplateData(templateData);
|
|
750
|
+
} else {
|
|
751
|
+
this.setState({ schema: this.state.baseSchema, formData: {'wechat-template': "" }});
|
|
752
|
+
// this.setState({ schema: this.props.metaEntities.layouts[0].definition });
|
|
816
753
|
}
|
|
817
|
-
|
|
818
|
-
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
setWechatAccountOptions(weCrmAccounts) {
|
|
757
|
+
console.log("inside setWechatAccountOptions");
|
|
758
|
+
const schema = cloneDeep(this.state.schema);
|
|
759
|
+
const formData = cloneDeep(this.state.formData);
|
|
760
|
+
if (!isEmpty(weCrmAccounts)) {
|
|
761
|
+
forEach(weCrmAccounts, (account) => {
|
|
762
|
+
if (account.configs && account.configs.is_wecrm_enabled) {
|
|
763
|
+
schema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[0].options.push({
|
|
764
|
+
key: account.uuid,
|
|
765
|
+
label: account.name,
|
|
766
|
+
value: account.name,
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
if (this.props.WeChat.templateDetails && this.props.WeChat.templateDetails.versions.base.OriginalId === account.sourceAccountIdentifier) {
|
|
771
|
+
formData['wechat-accounts'] = account.name;
|
|
772
|
+
this.props.actions.setWeChatAccount(account);
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
this.setState({schema, formData, baseSchema: schema});
|
|
819
776
|
}
|
|
820
|
-
// schema.standalone.sections[0].childSections[1].childSections[1].inputFields[0].cols[0].content = weChatData.content;
|
|
821
|
-
} else {
|
|
822
|
-
// schema.standalone.sections[0].childSections[1].childSections[1].inputFields[0].cols[0].content = weChatData.content;
|
|
823
777
|
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
this.prepareWeChatPreviewData(weChatData, templateTags);
|
|
829
|
-
});
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
resetState() {
|
|
833
|
-
this.setState({
|
|
834
|
-
formData: {},
|
|
835
|
-
schema: {},
|
|
836
|
-
baseSchema: {},
|
|
837
|
-
selectedTemplateTags: [],
|
|
838
|
-
isEdit: false,
|
|
839
|
-
editTemplateData: {},
|
|
840
|
-
isFormValid: true,
|
|
841
|
-
checkValidation: false,
|
|
842
|
-
injectedTags: {},
|
|
843
|
-
isLoading: true,
|
|
844
|
-
});
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
resetSchema() {
|
|
848
|
-
const formData = _.cloneDeep(this.state.formData);
|
|
849
|
-
if (this.state.isEdit) {
|
|
850
|
-
const templateData = {
|
|
851
|
-
template_id: this.state.editTemplateData.versions.base.template_id,
|
|
852
|
-
title: this.state.editTemplateData.versions.base.Title,
|
|
853
|
-
content: this.state.editTemplateData.versions.base.content,
|
|
854
|
-
};
|
|
855
|
-
this.setSelectedTemplateData(templateData);
|
|
856
|
-
} else {
|
|
857
|
-
this.setState({ schema: this.state.baseSchema, formData: {'wechat-template': "" }});
|
|
858
|
-
// this.setState({ schema: this.props.metaEntities.layouts[0].definition });
|
|
778
|
+
|
|
779
|
+
selectWechatAccount(value, option) {
|
|
780
|
+
// console.log('Test ', value, option);
|
|
781
|
+
// templateActions.setWeChatAccount();
|
|
859
782
|
}
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
783
|
+
|
|
784
|
+
setTemplateOptions(weChatData) {
|
|
785
|
+
console.log('Set Templates ', weChatData);
|
|
786
|
+
//const {schema, baseSchema} = this.state;
|
|
787
|
+
const schema = cloneDeep(this.state.schema);
|
|
788
|
+
const baseSchema = cloneDeep(this.state.schema);
|
|
789
|
+
const baseSchemaTemplateOptionEmpty = (!isEmpty(baseSchema) && isEmpty(baseSchema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[1].options));
|
|
790
|
+
schema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[1].options = [];
|
|
791
|
+
if (!isEmpty(baseSchema)) {
|
|
792
|
+
baseSchema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[1].options = [];
|
|
793
|
+
|
|
794
|
+
}
|
|
795
|
+
forEach(weChatData, (template) => {
|
|
796
|
+
schema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[1].options.push({
|
|
797
|
+
key: (template.versions) ? template.versions.base.template_id : template.template_id,
|
|
798
|
+
label: (template.versions) ? template.name : `${template.title} : ${template.template_id}`,
|
|
799
|
+
value: (template.versions) ? template.versions.base.template_id : template.template_id,
|
|
800
|
+
});
|
|
801
|
+
if ((!isEmpty(baseSchema) && this.props.location.query.module === 'loyalty') || (baseSchemaTemplateOptionEmpty)) {
|
|
802
|
+
baseSchema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[1].options.push({
|
|
803
|
+
key: (template.versions) ? template.versions.base.template_id : template.template_id,
|
|
804
|
+
label: (template.versions) ? template.name : `${template.title} : ${template.template_id}`,
|
|
805
|
+
value: (template.versions) ? template.versions.base.template_id : template.template_id,
|
|
872
806
|
});
|
|
873
807
|
}
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
808
|
+
});
|
|
809
|
+
this.setState({schema, baseSchema: cloneDeep(baseSchema)}, () => {
|
|
810
|
+
console.log('setTemplateOptions', this.state.baseSchema, schema);
|
|
811
|
+
if (isEmpty(this.state.baseSchema)) {
|
|
812
|
+
this.setState({baseSchema: cloneDeep(schema)});
|
|
878
813
|
}
|
|
879
814
|
});
|
|
880
|
-
this.setState({schema, formData, baseSchema: schema});
|
|
881
815
|
}
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
selectWechatAccount(value, option) {
|
|
885
|
-
// console.log('Test ', value, option);
|
|
886
|
-
// templateActions.setWeChatAccount();
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
setTemplateOptions(weChatData) {
|
|
890
|
-
console.log('Set Templates ', weChatData);
|
|
891
|
-
//const {schema, baseSchema} = this.state;
|
|
892
|
-
const schema = _.cloneDeep(this.state.schema);
|
|
893
|
-
const baseSchema = _.cloneDeep(this.state.schema);
|
|
894
|
-
const baseSchemaTemplateOptionEmpty = (!_.isEmpty(baseSchema) && _.isEmpty(baseSchema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[1].options));
|
|
895
|
-
schema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[1].options = [];
|
|
896
|
-
if (!_.isEmpty(baseSchema)) {
|
|
897
|
-
baseSchema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[1].options = [];
|
|
898
816
|
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
label: (template.versions) ? template.name : `${template.title} : ${template.template_id}`,
|
|
904
|
-
value: (template.versions) ? template.versions.base.template_id : template.template_id,
|
|
817
|
+
setFormValidity(isFormValid) {
|
|
818
|
+
this.setState({
|
|
819
|
+
isFormValid,
|
|
820
|
+
startValidation: false,
|
|
905
821
|
});
|
|
906
|
-
if
|
|
907
|
-
|
|
908
|
-
key: (template.versions) ? template.versions.base.template_id : template.template_id,
|
|
909
|
-
label: (template.versions) ? template.name : `${template.title} : ${template.template_id}`,
|
|
910
|
-
value: (template.versions) ? template.versions.base.template_id : template.template_id,
|
|
911
|
-
});
|
|
822
|
+
if(!isFormValid) {
|
|
823
|
+
this.props.onValidationFail();
|
|
912
824
|
}
|
|
913
|
-
});
|
|
914
|
-
this.setState({schema, baseSchema: _.cloneDeep(baseSchema)}, () => {
|
|
915
|
-
console.log('setTemplateOptions', this.state.baseSchema, schema);
|
|
916
|
-
if (_.isEmpty(this.state.baseSchema)) {
|
|
917
|
-
this.setState({baseSchema: _.cloneDeep(schema)});
|
|
918
|
-
}
|
|
919
|
-
});
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
setFormValidity(isFormValid) {
|
|
923
|
-
this.setState({isFormValid});
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
setContent(content) {
|
|
927
|
-
console.log('Template content changed to ', content);
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
setEditData() {
|
|
931
|
-
console.log('Inside Edit Data ', this.state.editTemplateData);
|
|
932
|
-
const formData = _.cloneDeep(this.state.formData);
|
|
933
|
-
const baseSchema = _.cloneDeep(this.state.baseSchema);
|
|
934
|
-
if (_.isEmpty(baseSchema)) {
|
|
935
|
-
return;
|
|
936
825
|
}
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
baseSchema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[1].options.push({
|
|
941
|
-
key: this.state.editTemplateData.versions.base.template_id,
|
|
942
|
-
label: this.state.editTemplateData.name,
|
|
943
|
-
value: this.state.editTemplateData.versions.base.template_id,
|
|
944
|
-
});
|
|
945
|
-
}
|
|
946
|
-
const templateData = {
|
|
947
|
-
'template_id': this.state.editTemplateData.versions.base.template_id,
|
|
948
|
-
'title': this.state.editTemplateData.versions.base.Title,
|
|
949
|
-
'content': this.state.editTemplateData.versions.base.content,
|
|
950
|
-
};
|
|
951
|
-
|
|
952
|
-
this.setState({baseSchema, formData, isEdit: true}, () => {
|
|
953
|
-
this.setSelectedTemplateData(templateData);
|
|
954
|
-
})
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
maskTemplateUrl(url) {
|
|
958
|
-
const selectedWeChatAccount = (!_.isEmpty(this.props.Templates.selectedWeChatAccount) ? this.props.Templates.selectedWeChatAccount : this.props.WeChat.selectedWeChatAccount);
|
|
959
|
-
console.log('wecrm url', selectedWeChatAccount.configs.wecrm_app_id);
|
|
960
|
-
|
|
961
|
-
const appid = selectedWeChatAccount.configs.wecrm_app_id;
|
|
962
|
-
const domain = selectedWeChatAccount.configs.domain;
|
|
963
|
-
const maskedUrl = `${domain}/web?appid=${appid}&redirect_uri=${escape(url)}&response_type=code&scope=snsapi_base&state=STATE`;
|
|
964
|
-
console.log('wecrm masked url', maskedUrl);
|
|
965
|
-
return maskedUrl;
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
unMaskTemplateUrl(url) {
|
|
969
|
-
let startIndex, endIndex;
|
|
970
|
-
startIndex = url.indexOf('&redirect_uri=') + 14;
|
|
971
|
-
endIndex = url.indexOf('&response_type');
|
|
972
|
-
return decodeURIComponent(url.substring(startIndex, endIndex));
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
getMappedEvent(id, event) {
|
|
976
|
-
return this.state.map[id][event];
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
handleOnTagsContextChange = (data) => {
|
|
980
|
-
console.log('parent tags context', data);
|
|
981
|
-
const query = {
|
|
982
|
-
layout: 'WECHAT',
|
|
983
|
-
type: 'TAG',
|
|
984
|
-
context: data.toLowerCase() === 'all' ? 'default' : data.toLowerCase(),
|
|
985
|
-
embedded: this.props.location.query.type === 'embedded' ? this.props.location.query.type : 'full',
|
|
986
|
-
};
|
|
987
|
-
this.props.globalActions.fetchSchemaForEntity(query);
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
startTemplateCreation(data) {
|
|
991
|
-
console.log('startTemplateCreation');
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
selectWechatTemplate() {
|
|
995
|
-
console.log('Updated data');
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
removeActionButtons() {
|
|
999
|
-
const schema = _.cloneDeep(this.state.schema);
|
|
1000
|
-
const headerCols = schema.standalone.sections[0].childSections[0].inputFields[0].cols;
|
|
1001
|
-
_.forEach(headerCols, (col) => {
|
|
1002
|
-
col.colStyle.display = 'none';
|
|
1003
|
-
});
|
|
1004
|
-
this.setState({schema});
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
showNext() {
|
|
1008
|
-
const response = {
|
|
1009
|
-
action: "showNext",
|
|
1010
|
-
value: true,
|
|
1011
|
-
};
|
|
1012
|
-
parent.postMessage(JSON.stringify(response), '*');
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
insertAtCursor(field, myValue, currentTab) {
|
|
1016
|
-
//IE support
|
|
1017
|
-
const myField = field;
|
|
1018
|
-
if (document.selection) {
|
|
1019
|
-
myField.focus();
|
|
1020
|
-
const sel = document.selection.createRange();
|
|
1021
|
-
sel.text = myValue;
|
|
1022
|
-
} else if (myField.selectionStart || myField.selectionStart === '0') { //MOZILLA and others
|
|
1023
|
-
const startPos = myField.selectionStart;
|
|
1024
|
-
const endPos = myField.selectionEnd;
|
|
1025
|
-
myField.value = myField.value.substring(0, startPos)
|
|
1026
|
-
+ myValue
|
|
1027
|
-
+ myField.value.substring(endPos, myField.value.length);
|
|
1028
|
-
myField.selectionStart = startPos + myValue.length;
|
|
1029
|
-
myField.selectionEnd = startPos + myValue.length;
|
|
1030
|
-
} else {
|
|
1031
|
-
myField.value += myValue;
|
|
826
|
+
|
|
827
|
+
setContent(content) {
|
|
828
|
+
console.log('Template content changed to ', content);
|
|
1032
829
|
}
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
pathname: `/wechat`,
|
|
1052
|
-
query: type === 'embedded' ? {type: 'embedded'} : {},
|
|
1053
|
-
});
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
saveFormData(formData) {
|
|
1057
|
-
const obj = {};
|
|
1058
|
-
let selectedWechatData = {};
|
|
1059
|
-
if (this.state.isEdit) {
|
|
1060
|
-
obj['_id'] = this.state.editTemplateData._id;
|
|
1061
|
-
selectedWechatData = {
|
|
830
|
+
|
|
831
|
+
setEditData() {
|
|
832
|
+
console.log('Inside Edit Data ', this.state.editTemplateData);
|
|
833
|
+
const formData = cloneDeep(this.state.formData);
|
|
834
|
+
const baseSchema = cloneDeep(this.state.baseSchema);
|
|
835
|
+
if (isEmpty(baseSchema)) {
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
formData['wechat-template'] = this.state.editTemplateData.versions.base.template_id;
|
|
839
|
+
if (this.props.location.query.module !== 'loyalty' && !isEmpty(baseSchema)) {
|
|
840
|
+
baseSchema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[1].options = [];
|
|
841
|
+
baseSchema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[1].options.push({
|
|
842
|
+
key: this.state.editTemplateData.versions.base.template_id,
|
|
843
|
+
label: this.state.editTemplateData.name,
|
|
844
|
+
value: this.state.editTemplateData.versions.base.template_id,
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
const templateData = {
|
|
1062
848
|
'template_id': this.state.editTemplateData.versions.base.template_id,
|
|
1063
849
|
'title': this.state.editTemplateData.versions.base.Title,
|
|
1064
850
|
'content': this.state.editTemplateData.versions.base.content,
|
|
1065
851
|
};
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
852
|
+
|
|
853
|
+
this.setState({baseSchema, formData, isEdit: true}, () => {
|
|
854
|
+
this.setSelectedTemplateData(templateData);
|
|
855
|
+
})
|
|
1069
856
|
}
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
url: this.state.formData['is-internal-url'] ? this.maskTemplateUrl(this.state.formData['template-link']) : this.state.formData['template-link'],
|
|
1081
|
-
TopColor: "#000000",
|
|
1082
|
-
data: {},
|
|
1083
|
-
preview: '',
|
|
1084
|
-
BrandId: (this.props.Templates.selectedWeChatAccount.configs.brand_id ? this.props.Templates.selectedWeChatAccount.configs.brand_id : ''),
|
|
1085
|
-
OriginalId: this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier,
|
|
1086
|
-
content: selectedWechatData.content,
|
|
1087
|
-
isInternalUrl: this.state.formData['is-internal-url'],
|
|
857
|
+
|
|
858
|
+
maskTemplateUrl(url) {
|
|
859
|
+
const selectedWeChatAccount = (!isEmpty(this.props.Templates.selectedWeChatAccount) ? this.props.Templates.selectedWeChatAccount : this.props.WeChat.selectedWeChatAccount);
|
|
860
|
+
console.log('wecrm url', selectedWeChatAccount.configs.wecrm_app_id);
|
|
861
|
+
|
|
862
|
+
const appid = selectedWeChatAccount.configs.wecrm_app_id;
|
|
863
|
+
const domain = selectedWeChatAccount.configs.domain;
|
|
864
|
+
const maskedUrl = `${domain}/web?appid=${appid}&redirect_uri=${escape(url)}&response_type=code&scope=snsapi_base&state=STATE`;
|
|
865
|
+
console.log('wecrm masked url', maskedUrl);
|
|
866
|
+
return maskedUrl;
|
|
1088
867
|
}
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
let
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
868
|
+
|
|
869
|
+
unMaskTemplateUrl(url) {
|
|
870
|
+
let startIndex, endIndex;
|
|
871
|
+
startIndex = url.indexOf('&redirect_uri=') + 14;
|
|
872
|
+
endIndex = url.indexOf('&response_type');
|
|
873
|
+
return decodeURIComponent(url.substring(startIndex, endIndex));
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
getMappedEvent(id, event) {
|
|
877
|
+
return this.state.map[id][event];
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
handleOnTagsContextChange = (data) => {
|
|
881
|
+
console.log('parent tags context', data);
|
|
882
|
+
const query = {
|
|
883
|
+
layout: 'WECHAT',
|
|
884
|
+
type: 'TAG',
|
|
885
|
+
context: data.toLowerCase() === 'all' ? 'default' : data.toLowerCase(),
|
|
886
|
+
embedded: this.props.location.query.type === 'embedded' ? this.props.location.query.type : 'full',
|
|
887
|
+
};
|
|
888
|
+
this.props.globalActions.fetchSchemaForEntity(query);
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
startTemplateCreation(data) {
|
|
892
|
+
console.log('startTemplateCreation');
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
selectWechatTemplate() {
|
|
896
|
+
console.log('Updated data');
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
removeActionButtons() {
|
|
900
|
+
const schema = cloneDeep(this.state.schema);
|
|
901
|
+
const headerCols = schema.standalone.sections[0].childSections[0].inputFields[0].cols;
|
|
902
|
+
forEach(headerCols, (col) => {
|
|
903
|
+
col.colStyle.display = 'none';
|
|
904
|
+
});
|
|
905
|
+
this.setState({schema});
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
showNext() {
|
|
909
|
+
const response = {
|
|
910
|
+
action: "showNext",
|
|
911
|
+
value: true,
|
|
912
|
+
};
|
|
913
|
+
parent.postMessage(JSON.stringify(response), '*');
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
insertAtCursor(field, myValue, currentTab) {
|
|
917
|
+
//IE support
|
|
918
|
+
const myField = field;
|
|
919
|
+
if (document.selection) {
|
|
920
|
+
myField.focus();
|
|
921
|
+
const sel = document.selection.createRange();
|
|
922
|
+
sel.text = myValue;
|
|
923
|
+
} else if (myField.selectionStart || myField.selectionStart === '0') { //MOZILLA and others
|
|
924
|
+
const startPos = myField.selectionStart;
|
|
925
|
+
const endPos = myField.selectionEnd;
|
|
926
|
+
myField.value = myField.value.substring(0, startPos)
|
|
927
|
+
+ myValue
|
|
928
|
+
+ myField.value.substring(endPos, myField.value.length);
|
|
929
|
+
myField.selectionStart = startPos + myValue.length;
|
|
930
|
+
myField.selectionEnd = startPos + myValue.length;
|
|
931
|
+
} else {
|
|
932
|
+
myField.value += myValue;
|
|
1098
933
|
}
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
934
|
+
const formData = cloneDeep(this.state.formData);
|
|
935
|
+
formData[field.id] = myField.value;
|
|
936
|
+
this.onFormDataChange(formData);
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
internalUrlChecked() {
|
|
940
|
+
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
discardValues() {
|
|
944
|
+
// this.setState({ schema: this.state.baseSchema, formData: {}});
|
|
945
|
+
this.resetSchema();
|
|
946
|
+
// this.resetState();
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
cancelTemplate() {
|
|
950
|
+
const type = this.props.location.query.type;
|
|
951
|
+
this.props.router.push({
|
|
952
|
+
pathname: `/wechat`,
|
|
953
|
+
query: type === 'embedded' ? {type: 'embedded'} : {},
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
saveFormData(formData) {
|
|
958
|
+
const obj = {};
|
|
959
|
+
let selectedWechatData = {};
|
|
960
|
+
const { getFormData } = this.props;
|
|
961
|
+
if (this.state.isEdit) {
|
|
962
|
+
obj['_id'] = this.state.editTemplateData._id;
|
|
963
|
+
selectedWechatData = {
|
|
964
|
+
'template_id': this.state.editTemplateData.versions.base.template_id,
|
|
965
|
+
'title': this.state.editTemplateData.versions.base.Title,
|
|
966
|
+
'content': this.state.editTemplateData.versions.base.content,
|
|
967
|
+
};
|
|
968
|
+
} else {
|
|
969
|
+
const selectedWechatTemplateIndex = findIndex(this.props.WeChat.weChatDefaultTemplate, {template_id: formData['wechat-template']});
|
|
970
|
+
selectedWechatData = this.props.WeChat.weChatDefaultTemplate[selectedWechatTemplateIndex];
|
|
1103
971
|
}
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
972
|
+
obj.name = `${selectedWechatData.title}: ${selectedWechatData.template_id}`;
|
|
973
|
+
obj.type = 'WECHAT';
|
|
974
|
+
obj.versions = {
|
|
975
|
+
base: {},
|
|
976
|
+
history: [],
|
|
977
|
+
};
|
|
978
|
+
obj.versions.base = {
|
|
979
|
+
"template_id": selectedWechatData.template_id,
|
|
980
|
+
"Title": selectedWechatData.title,
|
|
981
|
+
Tag: [],
|
|
982
|
+
url: this.state.formData['is-internal-url'] ? this.maskTemplateUrl(this.state.formData['template-link']) : this.state.formData['template-link'],
|
|
983
|
+
TopColor: "#000000",
|
|
984
|
+
data: {},
|
|
985
|
+
preview: '',
|
|
986
|
+
BrandId: (this.props.Templates.selectedWeChatAccount.configs.brand_id ? this.props.Templates.selectedWeChatAccount.configs.brand_id : ''),
|
|
987
|
+
OriginalId: this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier,
|
|
988
|
+
content: selectedWechatData.content,
|
|
989
|
+
isInternalUrl: this.state.formData['is-internal-url'],
|
|
1116
990
|
}
|
|
1117
|
-
|
|
1118
|
-
tagName =
|
|
991
|
+
forEach(this.state.selectedTemplateTags, (templateTag) => {
|
|
992
|
+
const tagName = templateTag.substr(0, templateTag.indexOf('.'));
|
|
993
|
+
let newTagname = tagName;
|
|
994
|
+
obj.versions.base.Tag.push(tagName);
|
|
995
|
+
if (tagName.match(/first/i)) {
|
|
996
|
+
newTagname = "Header";
|
|
997
|
+
}
|
|
998
|
+
if (tagName.match(/remark/i)) {
|
|
999
|
+
newTagname = "Footer";
|
|
1000
|
+
}
|
|
1001
|
+
obj.versions.base.data[tagName] = {};
|
|
1002
|
+
obj.versions.base.data[tagName] = {
|
|
1003
|
+
value: this.state.formData[`template-${newTagname}`],
|
|
1004
|
+
color: "#00000",
|
|
1005
|
+
}
|
|
1006
|
+
});
|
|
1007
|
+
console.log("Final Object ", obj);
|
|
1008
|
+
this.props.actions.createTemplate(obj, (response) => {
|
|
1009
|
+
obj._id = response.templateID;
|
|
1010
|
+
if(getFormData) {
|
|
1011
|
+
setTimeout(() => {
|
|
1012
|
+
getFormData(this.getFormData(obj));
|
|
1013
|
+
}, 0);
|
|
1014
|
+
}
|
|
1015
|
+
console.log("Template created successfully", response, obj);
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
prepareWeChatPreviewData(wechatData, templateTags) {
|
|
1020
|
+
let content = cloneDeep(wechatData.content);
|
|
1021
|
+
const {formData} = cloneDeep(this.state);
|
|
1022
|
+
forEach(templateTags, (tag) => {
|
|
1023
|
+
let tagName = tag.substr(0, tag.indexOf('.'));
|
|
1024
|
+
if (tagName.match(/first/i)) {
|
|
1025
|
+
tagName = "Header";
|
|
1026
|
+
}
|
|
1027
|
+
if (tagName.match(/remark/i)) {
|
|
1028
|
+
tagName = "Footer";
|
|
1029
|
+
}
|
|
1030
|
+
if(this.state.formData[`template-${tagName}`] !== undefined && this.state.formData[`template-${tagName}`] !== '') {
|
|
1031
|
+
content = content.replace(`{{${tag}}}`, this.state.formData[`template-${tagName}`]);
|
|
1032
|
+
}
|
|
1033
|
+
})
|
|
1034
|
+
formData['sms-preview'] = content;
|
|
1035
|
+
// schema.standalone.sections[0].childSections[1].childSections[1].inputFields[0].cols[0].content = content;
|
|
1036
|
+
this.setState({formData}, () => {
|
|
1037
|
+
this.injectEvents(this.state.schema);
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
injectEvents(schema) {
|
|
1042
|
+
console.log('injecting events', schema);
|
|
1043
|
+
if (isEmpty(schema)) {
|
|
1044
|
+
return false;
|
|
1119
1045
|
}
|
|
1120
|
-
|
|
1121
|
-
|
|
1046
|
+
const temp = schema;
|
|
1047
|
+
let newSchema = cloneDeep(schema);
|
|
1048
|
+
temp.standalone.sections = this.injectSections(temp.standalone.sections);
|
|
1049
|
+
forEach(temp.containers, (container) => {
|
|
1050
|
+
let tempContainer = container;
|
|
1051
|
+
tempContainer = this.injectContainer(tempContainer);
|
|
1052
|
+
return tempContainer;
|
|
1053
|
+
});
|
|
1054
|
+
newSchema = this.hideSchemaElementsByModule(schema);
|
|
1055
|
+
this.setState({schema: newSchema});
|
|
1056
|
+
return schema;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
hideSchemaElementsByModule(schema) {
|
|
1060
|
+
set(schema, 'standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[0].labelStyle.display', this.props.location.query.module === 'loyalty' ? 'block' : 'none');
|
|
1061
|
+
set(schema, 'standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[0].style.display', this.props.location.query.module === 'loyalty' ? 'block' : 'none');
|
|
1062
|
+
set(schema, 'standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[1].disabled', get(this.props, 'params.id', false) && this.props.location.query.module !== 'loyalty');
|
|
1063
|
+
return schema;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
injectContainer(container) {
|
|
1067
|
+
const temp = container;
|
|
1068
|
+
if (temp.type === 'tabs') {
|
|
1069
|
+
temp.tabContent.sections = this.injectSections(temp.tabContent.sections);
|
|
1070
|
+
temp.tabBarExtraContent.sections = this.injectSections(temp.tabBarExtraContent.sections);
|
|
1071
|
+
temp.tabContent.sections = this.injectSections(temp.tabContent.sections);
|
|
1072
|
+
temp.injectedEvents = {};
|
|
1073
|
+
forEach(temp.supportedEvents, (event) => {
|
|
1074
|
+
temp.injectedEvents[event] = this.getMappedEvent(temp.id, event);
|
|
1075
|
+
});
|
|
1076
|
+
forEach(temp.panes, (pane) => {
|
|
1077
|
+
const tempPane = pane;
|
|
1078
|
+
tempPane.sections = this.injectSections(tempPane.sections);
|
|
1079
|
+
});
|
|
1122
1080
|
}
|
|
1123
|
-
|
|
1124
|
-
formData['sms-preview'] = content;
|
|
1125
|
-
// schema.standalone.sections[0].childSections[1].childSections[1].inputFields[0].cols[0].content = content;
|
|
1126
|
-
this.setState({formData}, () => {
|
|
1127
|
-
this.injectEvents(this.state.schema);
|
|
1128
|
-
});
|
|
1129
|
-
}
|
|
1130
|
-
|
|
1131
|
-
injectEvents(schema) {
|
|
1132
|
-
console.log('injecting events', schema);
|
|
1133
|
-
if (_.isEmpty(schema)) {
|
|
1134
|
-
return false;
|
|
1081
|
+
return temp;
|
|
1135
1082
|
}
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
schema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[0].labelStyle.display = (this.props.location.query.module === 'loyalty' ? 'block' : 'none');
|
|
1156
|
-
schema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[0].style.display = (this.props.location.query.module === 'loyalty' ? 'block' : 'none');
|
|
1157
|
-
|
|
1158
|
-
schema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[1].disabled = (this.props.params.id && this.props.location.query.module !== 'loyalty');
|
|
1159
|
-
return schema;
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
injectContainer(container) {
|
|
1163
|
-
const temp = container;
|
|
1164
|
-
if (temp.type === 'tabs') {
|
|
1165
|
-
temp.tabContent.sections = this.injectSections(temp.tabContent.sections);
|
|
1166
|
-
temp.tabBarExtraContent.sections = this.injectSections(temp.tabBarExtraContent.sections);
|
|
1167
|
-
temp.tabContent.sections = this.injectSections(temp.tabContent.sections);
|
|
1168
|
-
temp.injectedEvents = {};
|
|
1169
|
-
_.forEach(temp.supportedEvents, (event) => {
|
|
1170
|
-
temp.injectedEvents[event] = this.getMappedEvent(temp.id, event);
|
|
1083
|
+
|
|
1084
|
+
injectMultiColSection(section) {
|
|
1085
|
+
forEach(section.inputFields, (inputField) => {
|
|
1086
|
+
forEach(inputField.cols, (col) => {
|
|
1087
|
+
console.log('injecting for col', col);
|
|
1088
|
+
let temp = col;
|
|
1089
|
+
if (temp.type === 'popover') {
|
|
1090
|
+
temp.content.sections = this.injectSections(temp.content.sections);
|
|
1091
|
+
temp.value.sections = this.injectSections(temp.value.sections);
|
|
1092
|
+
return true;
|
|
1093
|
+
}
|
|
1094
|
+
temp.injectedEvents = {};
|
|
1095
|
+
forEach(col.supportedEvents, (event) => {
|
|
1096
|
+
temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
|
|
1097
|
+
});
|
|
1098
|
+
temp = this.injectMessages(temp);
|
|
1099
|
+
return true;
|
|
1100
|
+
});
|
|
1171
1101
|
});
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1102
|
+
forEach(section.actionFields, (actionField) => {
|
|
1103
|
+
forEach(actionField.cols, (col) => {
|
|
1104
|
+
let temp = col;
|
|
1105
|
+
if (temp.type === 'popover') {
|
|
1106
|
+
temp.content.sections = this.injectSections(temp.content.sections);
|
|
1107
|
+
temp.value.sections = this.injectSections(temp.value.sections);
|
|
1108
|
+
return true;
|
|
1109
|
+
}
|
|
1110
|
+
temp.injectedEvents = {};
|
|
1111
|
+
forEach(col.supportedEvents, (event) => {
|
|
1112
|
+
temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
|
|
1113
|
+
});
|
|
1114
|
+
temp = this.injectMessages(temp);
|
|
1115
|
+
return true;
|
|
1116
|
+
});
|
|
1175
1117
|
});
|
|
1118
|
+
return section;
|
|
1176
1119
|
}
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
_.forEach(section.inputFields, (inputField) => {
|
|
1182
|
-
_.forEach(inputField.cols, (col) => {
|
|
1183
|
-
console.log('injecting for col', col);
|
|
1184
|
-
let temp = col;
|
|
1120
|
+
|
|
1121
|
+
injectColLabelSection(section) {
|
|
1122
|
+
forEach(section.inputFields, (inputField) => {
|
|
1123
|
+
let temp = inputField;
|
|
1185
1124
|
if (temp.type === 'popover') {
|
|
1186
1125
|
temp.content.sections = this.injectSections(temp.content.sections);
|
|
1187
1126
|
temp.value.sections = this.injectSections(temp.value.sections);
|
|
1188
1127
|
return true;
|
|
1189
1128
|
}
|
|
1190
1129
|
temp.injectedEvents = {};
|
|
1191
|
-
|
|
1192
|
-
temp.injectedEvents[event] = this.getMappedEvent(
|
|
1130
|
+
forEach(inputField.supportedEvents, (event) => {
|
|
1131
|
+
temp.injectedEvents[event] = this.getMappedEvent(inputField.id, event);
|
|
1193
1132
|
});
|
|
1194
1133
|
temp = this.injectMessages(temp);
|
|
1195
1134
|
return true;
|
|
1196
1135
|
});
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
_.forEach(actionField.cols, (col) => {
|
|
1200
|
-
let temp = col;
|
|
1136
|
+
forEach(section.actionFields, (actionField) => {
|
|
1137
|
+
let temp = actionField;
|
|
1201
1138
|
if (temp.type === 'popover') {
|
|
1202
1139
|
temp.content.sections = this.injectSections(temp.content.sections);
|
|
1203
1140
|
temp.value.sections = this.injectSections(temp.value.sections);
|
|
1204
1141
|
return true;
|
|
1205
1142
|
}
|
|
1206
1143
|
temp.injectedEvents = {};
|
|
1207
|
-
|
|
1208
|
-
temp.injectedEvents[event] = this.getMappedEvent(
|
|
1144
|
+
forEach(actionField.supportedEvents, (event) => {
|
|
1145
|
+
temp.injectedEvents[event] = this.getMappedEvent(actionField.id, event);
|
|
1209
1146
|
});
|
|
1210
1147
|
temp = this.injectMessages(temp);
|
|
1211
1148
|
return true;
|
|
1212
1149
|
});
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
_.forEach(inputField.supportedEvents, (event) => {
|
|
1227
|
-
temp.injectedEvents[event] = this.getMappedEvent(inputField.id, event);
|
|
1150
|
+
return section;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
injectSections(sections) {
|
|
1154
|
+
forEach(sections, (section) => {
|
|
1155
|
+
let temp = section;
|
|
1156
|
+
if (temp.type === 'col-label') {
|
|
1157
|
+
temp = this.injectColLabelSection(temp);
|
|
1158
|
+
} else if (section.type === 'multicols') {
|
|
1159
|
+
temp = this.injectMultiColSection(temp);
|
|
1160
|
+
} else if (section.type === 'parent') {
|
|
1161
|
+
temp = this.injectSections(temp.childSections);
|
|
1162
|
+
}
|
|
1228
1163
|
});
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1164
|
+
return sections;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
handleCancelModal = () => {
|
|
1168
|
+
this.setState({showModal: false});
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
injectParentSection(section) {
|
|
1172
|
+
forEach(section.childSections, (childSection) => {
|
|
1173
|
+
let temp = childSection;
|
|
1174
|
+
if (temp.type === 'col-label') {
|
|
1175
|
+
temp = this.injectColLabelSection(temp);
|
|
1176
|
+
} else if (section.type === 'multicols') {
|
|
1177
|
+
temp = this.injectMultiColSection(temp);
|
|
1178
|
+
} else if (section.type === 'parent') {
|
|
1179
|
+
temp = this.injectParentSection(temp);
|
|
1180
|
+
}
|
|
1242
1181
|
});
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
});
|
|
1246
|
-
return section;
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
injectSections(sections) {
|
|
1250
|
-
_.forEach(sections, (section) => {
|
|
1251
|
-
let temp = section;
|
|
1252
|
-
if (temp.type === 'col-label') {
|
|
1253
|
-
temp = this.injectColLabelSection(temp);
|
|
1254
|
-
} else if (section.type === 'multicols') {
|
|
1255
|
-
temp = this.injectMultiColSection(temp);
|
|
1256
|
-
} else if (section.type === 'parent') {
|
|
1257
|
-
temp = this.injectSections(temp.childSections);
|
|
1258
|
-
}
|
|
1259
|
-
});
|
|
1260
|
-
return sections;
|
|
1261
|
-
}
|
|
1182
|
+
return section;
|
|
1183
|
+
}
|
|
1262
1184
|
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1185
|
+
setTemplateMode = () => {
|
|
1186
|
+
this.setState({activeMode: SELECT_TEMPLATE_MODE});
|
|
1187
|
+
}
|
|
1266
1188
|
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1189
|
+
renderSelectTemplate() {
|
|
1190
|
+
const { WeChat = {} } = this.props;
|
|
1191
|
+
const { weChatDefaultTemplate ={} } = WeChat;
|
|
1192
|
+
const cardList = map(weChatDefaultTemplate, (template) => {
|
|
1193
|
+
return {
|
|
1194
|
+
key: `wechat-card-${template.name}`,
|
|
1195
|
+
title: <span title={template.title} >{template.title}</span>,
|
|
1196
|
+
content: template.content,
|
|
1197
|
+
hoverOption: <CapButton onClick={(e) => this.setSelectedTemplateData(template)}>{this.props.intl.formatMessage(messages.select)}</CapButton>,
|
|
1198
|
+
};
|
|
1199
|
+
});
|
|
1200
|
+
return (
|
|
1201
|
+
<CapSpin
|
|
1202
|
+
spinning={isEmpty(weChatDefaultTemplate)}
|
|
1203
|
+
tip={this.props.intl.formatMessage(messages.gettingTemplateData)}
|
|
1204
|
+
>
|
|
1205
|
+
<CapCustomCardList
|
|
1206
|
+
type="WECHAT"
|
|
1207
|
+
cardList={cardList}
|
|
1208
|
+
/>
|
|
1209
|
+
</CapSpin>
|
|
1210
|
+
);
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
render() {
|
|
1214
|
+
const { activeMode, weChatData, isEdit } = this.state;
|
|
1215
|
+
let tags = this.props.metaEntities && this.props.metaEntities.tags ? this.props.metaEntities.tags.standard : [];
|
|
1216
|
+
if (this.props.supportedTags) {
|
|
1217
|
+
tags = this.props.supportedTags;
|
|
1218
|
+
}
|
|
1219
|
+
return (
|
|
1220
|
+
<div>
|
|
1221
|
+
{!isEdit && <CapHeading type="h1" style={{marginBottom: '32px'}}><FormattedMessage {...messages.newWechat}/></CapHeading>}
|
|
1222
|
+
{activeMode === SELECT_TEMPLATE_MODE ?
|
|
1223
|
+
this.renderSelectTemplate() :
|
|
1224
|
+
<CapSpin
|
|
1225
|
+
tip={this.props.intl.formatMessage(messages.gettingTemplateData)}
|
|
1226
|
+
spinning={this.state.isLoading || this.props.fetchingSchema || (this.props.WeChat.getTemplateDetailsInProgress ? true : false)}>
|
|
1227
|
+
<div>
|
|
1228
|
+
<Helmet
|
|
1229
|
+
title="WeChat"
|
|
1230
|
+
/>
|
|
1231
|
+
<CapHeading type="h5">Template name</CapHeading>
|
|
1232
|
+
<CapHeading type="h3">{weChatData.title}</CapHeading>
|
|
1233
|
+
<CapRow className="wechat-container">
|
|
1234
|
+
<CapColumn>
|
|
1235
|
+
<FormBuilder
|
|
1236
|
+
schema={this.state.schema}
|
|
1237
|
+
onSubmit={this.saveFormData}
|
|
1238
|
+
onChange={this.onFormDataChange}
|
|
1239
|
+
parent={this}
|
|
1240
|
+
modal={this.state.modalContent}
|
|
1241
|
+
showModal={this.state.showModal}
|
|
1242
|
+
iframeParent={parent}
|
|
1243
|
+
formData={cloneDeep(this.state.formData)}
|
|
1244
|
+
onFormValidityChange={this.setFormValidity}
|
|
1245
|
+
location= {this.props.location}
|
|
1246
|
+
tags={tags}
|
|
1247
|
+
tagModule={this.props.getDefaultTags}
|
|
1248
|
+
injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
|
|
1249
|
+
isEdit={this.state.isEdit}
|
|
1250
|
+
usingTabContainer={false}
|
|
1251
|
+
router={this.props.router}
|
|
1252
|
+
checkValidation={this.state.checkValidation}
|
|
1253
|
+
startValidation={this.state.startValidation}
|
|
1254
|
+
handleCancelModal={this.handleCancelModal}
|
|
1255
|
+
onContextChange={this.handleOnTagsContextChange}
|
|
1256
|
+
stopValidation={() => this.setFormValidity(false)}
|
|
1257
|
+
/>
|
|
1258
|
+
</CapColumn>
|
|
1259
|
+
</CapRow>
|
|
1260
|
+
</div>
|
|
1261
|
+
</CapSpin>
|
|
1262
|
+
}
|
|
1263
|
+
</div>
|
|
1264
|
+
);
|
|
1276
1265
|
}
|
|
1277
|
-
});
|
|
1278
|
-
return section;
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
|
-
render() {
|
|
1282
|
-
// const schema = this.state.schema;
|
|
1283
|
-
// const options = [
|
|
1284
|
-
// {
|
|
1285
|
-
// label: 'Test',
|
|
1286
|
-
// value: 'Test',
|
|
1287
|
-
// },
|
|
1288
|
-
// {
|
|
1289
|
-
// label: 'Test1',
|
|
1290
|
-
// value: 'Test1',
|
|
1291
|
-
// },
|
|
1292
|
-
// {
|
|
1293
|
-
// label: 'Test2',
|
|
1294
|
-
// value: 'Test2',
|
|
1295
|
-
// },
|
|
1296
|
-
// {
|
|
1297
|
-
// label: 'Test3',
|
|
1298
|
-
// value: 'Test3',
|
|
1299
|
-
// },
|
|
1300
|
-
// ];
|
|
1301
|
-
let tags = this.props.metaEntities && this.props.metaEntities.tags ? this.props.metaEntities.tags.standard : [];
|
|
1302
|
-
if (this.props.supportedTags) {
|
|
1303
|
-
tags = this.props.supportedTags;
|
|
1304
1266
|
}
|
|
1305
|
-
|
|
1306
|
-
<Spin
|
|
1307
|
-
tip={this.props.intl.formatMessage(messages.gettingTemplateData)}
|
|
1308
|
-
spinning={this.state.isLoading || this.props.fetchingSchema || (this.props.WeChat.getTemplateDetailsInProgress ? true : false)}>
|
|
1309
|
-
<div>
|
|
1310
|
-
<Helmet
|
|
1311
|
-
title="WeChat"
|
|
1312
|
-
/>
|
|
1313
|
-
<Row className="wechat-container">
|
|
1314
|
-
<Col>
|
|
1315
|
-
<FormBuilder
|
|
1316
|
-
schema={this.state.schema}
|
|
1317
|
-
onSubmit={this.saveFormData}
|
|
1318
|
-
onChange={this.onFormDataChange}
|
|
1319
|
-
parent={this}
|
|
1320
|
-
modal={this.state.modalContent}
|
|
1321
|
-
showModal={this.state.showModal}
|
|
1322
|
-
iframeParent={parent}
|
|
1323
|
-
formData={_.cloneDeep(this.state.formData)}
|
|
1324
|
-
onFormValidityChange={this.setFormValidity}
|
|
1325
|
-
location= {this.props.location}
|
|
1326
|
-
tags={tags}
|
|
1327
|
-
tagModule={this.props.getDefaultTags}
|
|
1328
|
-
injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
|
|
1329
|
-
isEdit={this.state.isEdit}
|
|
1330
|
-
usingTabContainer={false}
|
|
1331
|
-
router={this.props.router}
|
|
1332
|
-
checkValidation={this.state.checkValidation}
|
|
1333
|
-
handleCancelModal={this.handleCancelModal}
|
|
1334
|
-
onContextChange={this.handleOnTagsContextChange}
|
|
1335
|
-
/>
|
|
1336
|
-
</Col>
|
|
1337
|
-
</Row>
|
|
1338
|
-
</div>
|
|
1339
|
-
</Spin>
|
|
1340
|
-
);
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1267
|
+
|
|
1344
1268
|
MapTemplates.propTypes = {
|
|
1345
1269
|
actions: PropTypes.object.isRequired,
|
|
1346
1270
|
WeChat: PropTypes.object,
|
|
@@ -1357,6 +1281,9 @@ MapTemplates.propTypes = {
|
|
|
1357
1281
|
templateData: PropTypes.object,
|
|
1358
1282
|
templateActions: PropTypes.object,
|
|
1359
1283
|
injectedTags: PropTypes.object,
|
|
1284
|
+
isFullMode: PropTypes.bool,
|
|
1285
|
+
getFormData: PropTypes.func,
|
|
1286
|
+
weChatMaptemplateStep: PropTypes.bool,
|
|
1360
1287
|
};
|
|
1361
1288
|
|
|
1362
1289
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -1379,4 +1306,5 @@ export default withCreatives({
|
|
|
1379
1306
|
mapStateToProps,
|
|
1380
1307
|
mapDispatchToProps,
|
|
1381
1308
|
userAuth: true,
|
|
1382
|
-
});
|
|
1309
|
+
});
|
|
1310
|
+
|