@capillarytech/creatives-library 3.0.29 → 3.0.31
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/app.js +1 -1
- package/components/FormBuilder/index.js +2 -2
- package/config/app.js +0 -2
- package/containers/Line/Create/index.js +2 -2
- package/containers/Line/Edit/index.js +2 -2
- package/containers/MobilePush/Create/index.js +2 -2
- package/containers/MobilePush/Edit/index.js +2 -2
- package/containers/Templates/index.js +9 -7
- package/hoc/withCreatives.js +46 -0
- package/index.js +0 -6
- package/package.json +1 -1
- package/reducers.js +1 -1
- package/routes.js +0 -2
- package/services/api.js +2 -10
- package/v2Containers/CreativesContainer/SlideBoxContent.js +36 -20
- package/v2Containers/CreativesContainer/index.js +9 -6
- package/v2Containers/Ebill/index.js +9 -6
- package/v2Containers/Email/index.js +10 -7
- package/v2Containers/LanguageProvider/actions.js +4 -9
- package/v2Containers/LanguageProvider/constants.js +0 -7
- package/v2Containers/LanguageProvider/index.js +10 -30
- package/v2Containers/LanguageProvider/reducer.js +4 -12
- package/v2Containers/LanguageProvider/selectors.js +1 -1
- package/v2Containers/Line/Create/index.js +8 -6
- package/v2Containers/Line/Edit/index.js +8 -5
- package/v2Containers/MobilePush/Create/index.js +8 -5
- package/v2Containers/MobilePush/Edit/index.js +8 -5
- package/v2Containers/Sms/Create/index.js +9 -6
- package/v2Containers/Sms/Edit/index.js +9 -6
- package/v2Containers/WeChat/MapTemplates/index.js +8 -10
- package/v2Containers/LanguageProvider/sagas.js +0 -39
package/app.js
CHANGED
|
@@ -10,7 +10,7 @@ import CapV2 from 'v2Containers/Cap';
|
|
|
10
10
|
import Cap from 'containers/Cap';
|
|
11
11
|
import { LocaleProvider } from 'antd';
|
|
12
12
|
import { makeSelectLocationState } from 'containers/Cap/selectors';
|
|
13
|
-
import LanguageProvider from '
|
|
13
|
+
import LanguageProvider from 'containers/LanguageProvider';
|
|
14
14
|
import FontFaceObserver from 'fontfaceobserver';
|
|
15
15
|
/* eslint-disable import/no-unresolved, import/extensions */
|
|
16
16
|
import '!file-loader?name=[name].[ext]!./favicon.ico';
|
|
@@ -2037,8 +2037,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2037
2037
|
img.src = _URL.createObjectURL(file);
|
|
2038
2038
|
img.onload = () => {
|
|
2039
2039
|
const fileParams = {
|
|
2040
|
-
width:
|
|
2041
|
-
height:
|
|
2040
|
+
width: img.width,
|
|
2041
|
+
height: img.height,
|
|
2042
2042
|
error: file.size / (1e+6) > 5,
|
|
2043
2043
|
};
|
|
2044
2044
|
this.callChildEvent({file, type: 'image', fileParams}, val, val.submitAction);
|
package/config/app.js
CHANGED
|
@@ -5,7 +5,6 @@ const config = {
|
|
|
5
5
|
production: {
|
|
6
6
|
api_endpoint: '/arya/api/v1/creatives',
|
|
7
7
|
auth_endpoint: '/arya/api/v1/auth',
|
|
8
|
-
arya_endpoint: '/arya/api/v1',
|
|
9
8
|
login_url: 'auth/login',
|
|
10
9
|
dashboard_url: '/sms',
|
|
11
10
|
dashboard_url_v2: '/v2',
|
|
@@ -14,7 +13,6 @@ const config = {
|
|
|
14
13
|
development: {
|
|
15
14
|
api_endpoint: 'https://nightly.capillary.in/arya/api/v1/creatives',
|
|
16
15
|
auth_endpoint: 'https://nightly.capillary.in/arya/api/v1/auth',
|
|
17
|
-
arya_endpoint: 'https://nightly.capillary.in/arya/api/v1',
|
|
18
16
|
login_url: 'auth/login',
|
|
19
17
|
dashboard_url: '/sms',
|
|
20
18
|
dashboard_url_v2: '/v2',
|
|
@@ -717,8 +717,8 @@ export class Line extends Component {
|
|
|
717
717
|
} else {
|
|
718
718
|
data.fileParams.isGeneratePreview = true;
|
|
719
719
|
const name = data.file.name.split('.');
|
|
720
|
-
const blob = data.file.slice(0, -1, 'image');
|
|
721
|
-
const newFile = new File([
|
|
720
|
+
// const blob = data.file.slice(0, -1, 'image');
|
|
721
|
+
const newFile = new File([data.file], `${name[0]}${Date.now()}.${name[1]}`, {type: 'image/jpeg'});
|
|
722
722
|
this.props.actions.uploadAsset(newFile, data.type, data.fileParams);
|
|
723
723
|
}
|
|
724
724
|
};
|
|
@@ -718,8 +718,8 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
718
718
|
this.props.globalActions.addMessageToQueue(message);
|
|
719
719
|
} else {
|
|
720
720
|
const name = data.file.name.split('.');
|
|
721
|
-
const blob = data.file.slice(0, -1, 'image');
|
|
722
|
-
const newFile = new File([
|
|
721
|
+
// const blob = data.file.slice(0, -1, 'image');
|
|
722
|
+
const newFile = new File([data.file], `${name[0]}${Date.now()}.${name[1]}`, {type: 'image'});
|
|
723
723
|
this.props.actions.uploadAsset(newFile, data.type, data.fileParams);
|
|
724
724
|
}
|
|
725
725
|
};
|
|
@@ -1706,8 +1706,8 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1706
1706
|
this.props.globalActions.addMessageToQueue(message);
|
|
1707
1707
|
} else {
|
|
1708
1708
|
const name = data.file.name.split('.');
|
|
1709
|
-
const blob = data.file.slice(0, -1, 'image');
|
|
1710
|
-
const newFile = new File([
|
|
1709
|
+
// const blob = data.file.slice(0, -1, 'image');
|
|
1710
|
+
const newFile = new File([data.file], `${name[0]}${Date.now()}.${name[1]}`, {type: 'image'});
|
|
1711
1711
|
this.props.actions.uploadAsset(newFile, data.type, data.fileParams);
|
|
1712
1712
|
}
|
|
1713
1713
|
};
|
|
@@ -1064,8 +1064,8 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1064
1064
|
this.props.globalActions.addMessageToQueue(message);
|
|
1065
1065
|
} else {
|
|
1066
1066
|
const name = data.file.name.split('.');
|
|
1067
|
-
const blob = data.file.slice(0, -1, 'image');
|
|
1068
|
-
const newFile = new File([
|
|
1067
|
+
// const blob = data.file.slice(0, -1, 'image');
|
|
1068
|
+
const newFile = new File([data.file], `${name[0]}${Date.now()}.${name[1]}`, {type: 'image'});
|
|
1069
1069
|
this.props.actions.uploadAsset(newFile, data.type, data.fileParams);
|
|
1070
1070
|
}
|
|
1071
1071
|
};
|
|
@@ -222,13 +222,15 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
});
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
225
|
+
if (!_.isEmpty(selectedAccount)) {
|
|
226
|
+
this.setState({selectedAccount: selectedAccount.name}, () => {
|
|
227
|
+
params.wecrmId = selectedAccount.configs.wecrm_app_id;
|
|
228
|
+
params.wecrmToken = selectedAccount.configs.wecrm_token;
|
|
229
|
+
params.originalId = selectedAccount.sourceAccountIdentifier;
|
|
230
|
+
nextProps.actions.setWeChatAccount(selectedAccount);
|
|
231
|
+
this.getAllTemplates({params});
|
|
232
|
+
});
|
|
233
|
+
}
|
|
232
234
|
} else if (this.state.channel.toLowerCase() === 'mobilepush' && (nextProps.location.query.account_id || nextProps.location.query.source_account_id)) {
|
|
233
235
|
_.forEach(nextProps.Templates.weCrmAccounts, (account) => {
|
|
234
236
|
if ((nextProps.location.query.account_id && account.id === Number(nextProps.location.query.account_id)) || (nextProps.location.query.source_account_id && account.sourceAccountIdentifier && account.sourceAccountIdentifier === nextProps.location.query.source_account_id)) {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { connect } from 'react-redux';
|
|
3
|
+
import { bindActionCreators } from 'redux';
|
|
4
|
+
import { injectIntl } from 'react-intl';
|
|
5
|
+
import * as globalActions from '../v2Containers/Cap/actions';
|
|
6
|
+
import * as creativesContainerActions from '../v2Containers/CreativesContainer/actions';
|
|
7
|
+
import { UserIsAuthenticated } from '../utils/authWrapper';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Higher Order Component to common out creatives channel logic
|
|
11
|
+
* @param {*} WrappedComponent
|
|
12
|
+
* @returns {*} modified wrapped component
|
|
13
|
+
*/
|
|
14
|
+
export default ({
|
|
15
|
+
WrappedComponent,
|
|
16
|
+
mapStateToProps,
|
|
17
|
+
mapDispatchToProps,
|
|
18
|
+
userAuth,
|
|
19
|
+
}) => {
|
|
20
|
+
const CreativesCommon = (props) => {
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const {
|
|
23
|
+
globalActions: {
|
|
24
|
+
setInjectedTags,
|
|
25
|
+
},
|
|
26
|
+
forwardedTags = {},
|
|
27
|
+
} = props;
|
|
28
|
+
// setting the passed tags from parent in Cap store
|
|
29
|
+
setInjectedTags(forwardedTags);
|
|
30
|
+
}, []);
|
|
31
|
+
|
|
32
|
+
return <WrappedComponent {...props} />;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const hocMapDispatchToProps = (dispatch) => {
|
|
36
|
+
const passedMapDispatchToProps = mapDispatchToProps(dispatch);
|
|
37
|
+
return {
|
|
38
|
+
...passedMapDispatchToProps,
|
|
39
|
+
globalActions: bindActionCreators(globalActions, dispatch),
|
|
40
|
+
creativesContainerActions: bindActionCreators(creativesContainerActions, dispatch),
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const CreativeComponent = connect(mapStateToProps, hocMapDispatchToProps)(injectIntl(CreativesCommon));
|
|
45
|
+
return userAuth ? UserIsAuthenticated(CreativeComponent) : CreativeComponent;
|
|
46
|
+
};
|
package/index.js
CHANGED
|
@@ -3,10 +3,6 @@ import capReducer from './v2Containers/Cap/reducer';
|
|
|
3
3
|
import capSaga from './v2Containers/Cap/sagas';
|
|
4
4
|
import Cap from './v2Containers/Cap/index';
|
|
5
5
|
|
|
6
|
-
import LanguageProvider from './v2Containers/LanguageProvider';
|
|
7
|
-
import LanguageProviderReducer from './v2Containers/LanguageProvider/reducer';
|
|
8
|
-
import LanguageProviderSaga from './v2Containers/LanguageProvider/sagas';
|
|
9
|
-
|
|
10
6
|
import templateReducer from './v2Containers/Templates/reducer';
|
|
11
7
|
import templateSaga from './v2Containers/Templates/sagas';
|
|
12
8
|
import Templates from './v2Containers/Templates/index';
|
|
@@ -59,7 +55,6 @@ export {default as EbillSaga} from './v2Containers/Ebill/sagas';
|
|
|
59
55
|
|
|
60
56
|
|
|
61
57
|
const CapContainer = {Cap, capReducer, capSaga};
|
|
62
|
-
const LanguageProviderContainer = {LanguageProvider, LanguageProviderReducer, LanguageProviderSaga};
|
|
63
58
|
const TemplatesContainer = {Templates, templateReducer, templateSaga};
|
|
64
59
|
const SmsCreateContainer = {SmsCreate, smsCreateReducer, smsCreateSaga};
|
|
65
60
|
const SmsEditContainer = {SmsEdit, smsEditReducer, smsEditSaga};
|
|
@@ -84,7 +79,6 @@ export {default as MobilePushPreview} from './v2Components/MobilePushPreviewV2';
|
|
|
84
79
|
CreativesContainer.CreativesContainerReducer = CreativesContainerReducer;
|
|
85
80
|
|
|
86
81
|
export { CapContainer,
|
|
87
|
-
LanguageProviderContainer,
|
|
88
82
|
TemplatesContainer,
|
|
89
83
|
SmsCreateContainer,
|
|
90
84
|
SmsEditContainer,
|
package/package.json
CHANGED
package/reducers.js
CHANGED
|
@@ -7,7 +7,7 @@ import { combineReducers } from 'redux-immutable';
|
|
|
7
7
|
import { fromJS } from 'immutable';
|
|
8
8
|
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
9
9
|
|
|
10
|
-
import languageProviderReducer from '
|
|
10
|
+
import languageProviderReducer from 'containers/LanguageProvider/reducer';
|
|
11
11
|
import capReducer from 'containers/Cap/reducer';
|
|
12
12
|
import appReducer from 'containers/App/reducer';
|
|
13
13
|
import createSmsReducer from 'containers/Sms/Create/reducer';
|
package/routes.js
CHANGED
|
@@ -11,7 +11,6 @@ import * as ebillSagas from 'containers/Ebill/sagas';
|
|
|
11
11
|
import * as emailSagas from 'containers/Email/sagas';
|
|
12
12
|
import * as templateSagas from 'containers/Templates/sagas';
|
|
13
13
|
import * as lineSagas from 'containers/Line/Create/sagas';
|
|
14
|
-
import * as languageSaga from './v2Containers/LanguageProvider/sagas';
|
|
15
14
|
|
|
16
15
|
const errorLoading = (err) => {
|
|
17
16
|
console.error('Dynamic page loading failed', err); // eslint-disable-line no-console
|
|
@@ -25,7 +24,6 @@ export default function createRoutes(store) {
|
|
|
25
24
|
// Create reusable async injectors using getAsyncInjectors factory
|
|
26
25
|
const { injectReducer, injectSagas } = getAsyncInjectors(store); // eslint-disable-line no-unused-vars
|
|
27
26
|
injectSagas(rootSaga.default);
|
|
28
|
-
injectSagas(languageSaga.default);
|
|
29
27
|
return [
|
|
30
28
|
{
|
|
31
29
|
path: '/',
|
package/services/api.js
CHANGED
|
@@ -9,11 +9,9 @@ import getSchema from './getSchema';
|
|
|
9
9
|
import * as API from '../utils/ApiCaller';
|
|
10
10
|
let API_ENDPOINT = config.development.api_endpoint;
|
|
11
11
|
let API_AUTH_ENDPOINT = config.development.auth_endpoint;
|
|
12
|
-
let ARYA_ENDPOINT = config.development.arya_endpoint;
|
|
13
12
|
if (process.env.NODE_ENV === 'production') {
|
|
14
13
|
API_ENDPOINT = config.production.api_endpoint;
|
|
15
14
|
API_AUTH_ENDPOINT = config.production.auth_endpoint;
|
|
16
|
-
ARYA_ENDPOINT = config.production.arya_endpoint;
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
const isProd = process.env.NODE_ENV === 'production';
|
|
@@ -58,8 +56,8 @@ function checkStatus(response) {
|
|
|
58
56
|
if ((response.status >= 200 && response.status < 300) || response.status === 500) {
|
|
59
57
|
return response;
|
|
60
58
|
}
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
|
|
60
|
+
redirectIfUnauthenticated(response);
|
|
63
61
|
|
|
64
62
|
const error = new Error(response.statusText);
|
|
65
63
|
error.response = response;
|
|
@@ -318,9 +316,3 @@ export const createLineTemplate = ({template}) => {
|
|
|
318
316
|
const url = `${API_ENDPOINT}/templates/LINE`;
|
|
319
317
|
return request(url, getAPICallObject('POST', template));
|
|
320
318
|
};
|
|
321
|
-
|
|
322
|
-
export const getLocizMessage = (locale) => {
|
|
323
|
-
const appName = 'creatives_v2';
|
|
324
|
-
const url = `${ARYA_ENDPOINT}/translations/${appName}/${locale}`;
|
|
325
|
-
return request(url, getAPICallObject('GET'));
|
|
326
|
-
};
|
|
@@ -50,6 +50,7 @@ function SlideBoxContent(props) {
|
|
|
50
50
|
showTemplateName,
|
|
51
51
|
onValidationFail,
|
|
52
52
|
channelsToHide,
|
|
53
|
+
forwardedTags,
|
|
53
54
|
} = props;
|
|
54
55
|
const type = messageDetails.type.toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
55
56
|
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'defualt' : 'library'};
|
|
@@ -97,6 +98,7 @@ function SlideBoxContent(props) {
|
|
|
97
98
|
onCallTaskSubmit={onCallTaskSubmit}
|
|
98
99
|
cap={cap}
|
|
99
100
|
channelsToHide={channelsToHide}
|
|
101
|
+
forwardedTags={forwardedTags}
|
|
100
102
|
/>
|
|
101
103
|
)}
|
|
102
104
|
{isPreview && (
|
|
@@ -107,44 +109,52 @@ function SlideBoxContent(props) {
|
|
|
107
109
|
charCounterEnabled
|
|
108
110
|
templateData={templateData}
|
|
109
111
|
showCount
|
|
112
|
+
forwardedTags={forwardedTags}
|
|
110
113
|
/>
|
|
111
114
|
)}
|
|
112
115
|
{isEmailPreview && (
|
|
113
116
|
<EmailPreviewV2
|
|
114
117
|
templateData={templateData}
|
|
115
|
-
|
|
118
|
+
forwardedTags={forwardedTags}
|
|
119
|
+
/>
|
|
116
120
|
)
|
|
117
121
|
}
|
|
118
|
-
{isMpushPreview &&
|
|
119
|
-
<MobilePushPreview
|
|
120
|
-
|
|
122
|
+
{isMpushPreview && (
|
|
123
|
+
<MobilePushPreview
|
|
124
|
+
templateData={templateData}
|
|
125
|
+
channel={channel}
|
|
126
|
+
forwardedTags={forwardedTags}
|
|
127
|
+
/>
|
|
128
|
+
)}
|
|
121
129
|
{isEditSms && (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
130
|
+
<SmsEdit
|
|
131
|
+
setIsLoadingContent={setIsLoadingContent}
|
|
132
|
+
location={creativesLocationProps}
|
|
133
|
+
isFullMode={isFullMode}
|
|
134
|
+
route={{ name: 'sms' }}
|
|
135
|
+
params={{id: templateData._id}}
|
|
136
|
+
isGetFormData={isGetFormData}
|
|
137
|
+
getFormSubscriptionData={getFormData}
|
|
138
|
+
getDefaultTags={type}
|
|
139
|
+
templateData={templateData}
|
|
140
|
+
forwardedTags={forwardedTags}
|
|
141
|
+
/>
|
|
142
|
+
)}
|
|
135
143
|
{
|
|
136
144
|
isEditCallTask &&
|
|
137
145
|
<CallTask
|
|
138
146
|
mode={'edit'}
|
|
139
147
|
templateData={templateData}
|
|
140
148
|
onCallTaskSubmit={onCallTaskSubmit}
|
|
141
|
-
|
|
149
|
+
forwardedTags={forwardedTags}
|
|
150
|
+
/>
|
|
142
151
|
}
|
|
143
152
|
{
|
|
144
153
|
isCreateCallTask &&
|
|
145
154
|
<CallTask
|
|
146
155
|
mode={'create'}
|
|
147
156
|
onCallTaskSubmit={onCallTaskSubmit}
|
|
157
|
+
forwardedTags={forwardedTags}
|
|
148
158
|
/>
|
|
149
159
|
}
|
|
150
160
|
{isCreateSms && (
|
|
@@ -157,7 +167,8 @@ function SlideBoxContent(props) {
|
|
|
157
167
|
getFormSubscriptionData={getFormData}
|
|
158
168
|
getDefaultTags={type}
|
|
159
169
|
isFullMode={isFullMode}
|
|
160
|
-
|
|
170
|
+
forwardedTags={forwardedTags}
|
|
171
|
+
/>
|
|
161
172
|
)}
|
|
162
173
|
{isEmailCreate && (
|
|
163
174
|
<EmailWrapper
|
|
@@ -177,6 +188,7 @@ function SlideBoxContent(props) {
|
|
|
177
188
|
onResetStep={onResetStep}
|
|
178
189
|
showTemplateName={showTemplateName}
|
|
179
190
|
onValidationFail={onValidationFail}
|
|
191
|
+
forwardedTags={forwardedTags}
|
|
180
192
|
/>
|
|
181
193
|
)}
|
|
182
194
|
{(isEditEmailWithId || isEmailEditWithContent) && (
|
|
@@ -198,7 +210,8 @@ function SlideBoxContent(props) {
|
|
|
198
210
|
cap={cap}
|
|
199
211
|
showTemplateName={showTemplateName}
|
|
200
212
|
onValidationFail={onValidationFail}
|
|
201
|
-
|
|
213
|
+
forwardedTags={forwardedTags}
|
|
214
|
+
/>
|
|
202
215
|
)}
|
|
203
216
|
{isEditMPush &&
|
|
204
217
|
<MobliPushEdit
|
|
@@ -216,6 +229,7 @@ function SlideBoxContent(props) {
|
|
|
216
229
|
showTemplateName={showTemplateName}
|
|
217
230
|
getDefaultTags={type}
|
|
218
231
|
onValidationFail={onValidationFail}
|
|
232
|
+
forwardedTags={forwardedTags}
|
|
219
233
|
/>
|
|
220
234
|
}
|
|
221
235
|
{isCreateMPush &&
|
|
@@ -238,6 +252,7 @@ function SlideBoxContent(props) {
|
|
|
238
252
|
onResetStep={onResetStep}
|
|
239
253
|
showTemplateName={showTemplateName}
|
|
240
254
|
query={query}
|
|
255
|
+
forwardedTags={forwardedTags}
|
|
241
256
|
onValidationFail={onValidationFail}/>
|
|
242
257
|
}
|
|
243
258
|
</CreativesWrapper>
|
|
@@ -271,5 +286,6 @@ SlideBoxContent.propTypes = {
|
|
|
271
286
|
showTemplateName: PropTypes.func,
|
|
272
287
|
onValidationFail: PropTypes.func,
|
|
273
288
|
channelsToHide: PropTypes.array,
|
|
289
|
+
forwardedTags: PropTypes.object,
|
|
274
290
|
};
|
|
275
291
|
export default SlideBoxContent;
|
|
@@ -119,8 +119,11 @@ class Creatives extends React.Component {
|
|
|
119
119
|
channel: 'CALL_TASK',
|
|
120
120
|
...data,
|
|
121
121
|
});
|
|
122
|
-
}
|
|
122
|
+
};
|
|
123
123
|
|
|
124
|
+
onValidationFail = () => {
|
|
125
|
+
this.setState({ isGetFormData: false });
|
|
126
|
+
};
|
|
124
127
|
getTemplateData = (templateData) => { //from consumers to creatives
|
|
125
128
|
const {isFullMode} = this.props;
|
|
126
129
|
if (!isFullMode && templateData) { // for component mode
|
|
@@ -224,6 +227,7 @@ class Creatives extends React.Component {
|
|
|
224
227
|
}
|
|
225
228
|
return templateData;
|
|
226
229
|
};
|
|
230
|
+
|
|
227
231
|
getSlideBocContent({mode, templateData, isFullMode}) {
|
|
228
232
|
let creativesMode = isFullMode ? 'createTemplate' : 'templates';// for library mode templates page is initial mode and for full mode createTemplates
|
|
229
233
|
if (mode === 'create' && isFullMode) {
|
|
@@ -253,7 +257,6 @@ class Creatives extends React.Component {
|
|
|
253
257
|
);
|
|
254
258
|
}
|
|
255
259
|
};
|
|
256
|
-
|
|
257
260
|
setIsLoadingContent = (isLoadingContent) => {
|
|
258
261
|
if (this.state.isLoadingContent !== isLoadingContent) {
|
|
259
262
|
this.setState({isLoadingContent });
|
|
@@ -280,9 +283,6 @@ class Creatives extends React.Component {
|
|
|
280
283
|
saveMessage = () => {
|
|
281
284
|
this.setState({ isGetFormData: true });
|
|
282
285
|
};
|
|
283
|
-
onValidationFail = () => {
|
|
284
|
-
this.setState({ isGetFormData: false });
|
|
285
|
-
}
|
|
286
286
|
discardMessage = () => {
|
|
287
287
|
this.setState({ isDiscardMessage: true });
|
|
288
288
|
}
|
|
@@ -404,10 +404,11 @@ class Creatives extends React.Component {
|
|
|
404
404
|
const name = get(formData, 'template-name');
|
|
405
405
|
return showTemplateNameComponentEdit ? this.templateNameComponentInput({formData, onFormDataChange, name}) : this.templateNameComponentHeader({formData, onFormDataChange, name});
|
|
406
406
|
}
|
|
407
|
+
return false;
|
|
407
408
|
}
|
|
408
409
|
render() {
|
|
409
410
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage} = this.state;
|
|
410
|
-
const {isFullMode, creativesMode, cap, isUploading, channelsToHide} = this.props;
|
|
411
|
+
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, forwardedTags} = this.props;
|
|
411
412
|
return (
|
|
412
413
|
<SlideBoxWrapper className={classnames(`${classPrefix} ${isFullMode ? 'creatives-full-mode' : 'creatives-library-mode'}`)}>
|
|
413
414
|
<CapSlideBox
|
|
@@ -458,6 +459,7 @@ class Creatives extends React.Component {
|
|
|
458
459
|
showTemplateName={this.showTemplateName}
|
|
459
460
|
onValidationFail={this.onValidationFail}
|
|
460
461
|
channelsToHide={channelsToHide}
|
|
462
|
+
forwardedTags={forwardedTags}
|
|
461
463
|
/>
|
|
462
464
|
}
|
|
463
465
|
footer={this.shouldShowFooter() &&
|
|
@@ -503,6 +505,7 @@ Creatives.propTypes = {
|
|
|
503
505
|
isUploading: PropTypes.bool,
|
|
504
506
|
EmailLayout: PropTypes.string,
|
|
505
507
|
channelsToHide: PropTypes.array,
|
|
508
|
+
forwardedTags: PropTypes.object,
|
|
506
509
|
};
|
|
507
510
|
const mapStatesToProps = () => createStructuredSelector({
|
|
508
511
|
isLoading: isLoadingSelector(),
|
|
@@ -7,24 +7,23 @@
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { connect } from 'react-redux';
|
|
11
10
|
import { bindActionCreators } from 'redux';
|
|
12
11
|
import { Spin, Row, Col, Breadcrumb } from 'antd';
|
|
13
12
|
import Helmet from 'react-helmet';
|
|
14
|
-
import {
|
|
13
|
+
import { intlShape } from 'react-intl';
|
|
15
14
|
import _ from 'lodash';
|
|
16
15
|
import { createStructuredSelector } from 'reselect';
|
|
17
16
|
import * as actions from './actions';
|
|
18
17
|
import FormBuilder from '../../v2Components/FormBuilder';
|
|
19
18
|
import { makeSelectMetaEntities, makeSelectAuthenticated, setInjectedTags } from '../Cap/selectors';
|
|
20
|
-
import * as globalActions from '../Cap/actions';
|
|
21
|
-
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
22
19
|
import { makeSelectTemplates } from '../Templates/selectors';
|
|
23
20
|
import {getMessageObject} from '../../utils/messageUtils';
|
|
24
21
|
import makeSelectEbill from './selectors';
|
|
25
22
|
import messages from './messages';
|
|
26
23
|
import EmailPreview from '../../v2Components/EmailPreview';
|
|
27
24
|
import './_ebill.scss';
|
|
25
|
+
import withCreatives from '../../hoc/withCreatives';
|
|
26
|
+
|
|
28
27
|
const BreadcrumbItem = Breadcrumb.Item;
|
|
29
28
|
|
|
30
29
|
export class Ebill extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
@@ -1253,8 +1252,12 @@ const mapStateToProps = createStructuredSelector({
|
|
|
1253
1252
|
function mapDispatchToProps(dispatch) {
|
|
1254
1253
|
return {
|
|
1255
1254
|
actions: bindActionCreators(actions, dispatch),
|
|
1256
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
1257
1255
|
};
|
|
1258
1256
|
}
|
|
1259
1257
|
|
|
1260
|
-
export default
|
|
1258
|
+
export default withCreatives({
|
|
1259
|
+
WrappedComponent: Ebill,
|
|
1260
|
+
mapStateToProps,
|
|
1261
|
+
mapDispatchToProps,
|
|
1262
|
+
userAuth: true,
|
|
1263
|
+
});
|
|
@@ -7,10 +7,9 @@
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { connect } from 'react-redux';
|
|
11
10
|
import { bindActionCreators } from 'redux';
|
|
12
11
|
import { Row, Col, Popover, Modal } from 'antd';
|
|
13
|
-
import {
|
|
12
|
+
import { intlShape, FormattedMessage } from 'react-intl';
|
|
14
13
|
import { CapButton, CapInput, CapSpin, CapSlideBox, CapCustomCard, CapNotification } from '@capillarytech/cap-ui-library';
|
|
15
14
|
import { createStructuredSelector } from 'reselect';
|
|
16
15
|
import _ from 'lodash';
|
|
@@ -19,8 +18,6 @@ import FormBuilder from '../../v2Components/FormBuilder';
|
|
|
19
18
|
import { makeSelectMetaEntities, selectCurrentOrgDetails, isLoadingMetaEntities, makeSelectAuthenticated, setInjectedTags } from '../Cap/selectors';
|
|
20
19
|
import * as actions from './actions';
|
|
21
20
|
import * as templatesActions from '../Templates/actions';
|
|
22
|
-
import * as globalActions from '../Cap/actions';
|
|
23
|
-
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
24
21
|
import {makeSelectEmail} from './selectors';
|
|
25
22
|
import { makeSelectTemplates } from '../Templates/selectors';
|
|
26
23
|
import messages from './messages';
|
|
@@ -31,6 +28,8 @@ import EmailPreview from '../../v2Components/EmailPreview';
|
|
|
31
28
|
|
|
32
29
|
import Pagination from '../../v2Components/Pagination';
|
|
33
30
|
import * as creativesContainerActions from '../CreativesContainer/actions';
|
|
31
|
+
import withCreatives from '../../hoc/withCreatives';
|
|
32
|
+
|
|
34
33
|
const {CapCustomCardList} = CapCustomCard;
|
|
35
34
|
export class Email extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
36
35
|
constructor(props) {
|
|
@@ -1421,6 +1420,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1421
1420
|
newContainerInputFieldCol.style.display = isDragDrop ? "none" : '';
|
|
1422
1421
|
}
|
|
1423
1422
|
if (containerInputFieldCol.id === 'tab-options-popover') {
|
|
1423
|
+
// eslint-disable-next-line no-param-reassign
|
|
1424
1424
|
containerInputFieldCol.colStyle.display = isDragDrop ? "flex" : "none";
|
|
1425
1425
|
_.forEach(containerInputFieldCol.content.sections[0].inputFields, (tabPopoverSection) => {
|
|
1426
1426
|
if (tabPopoverSection.cols[0].id === 'switch-editor-label') {
|
|
@@ -2684,11 +2684,14 @@ const mapStateToProps = (state, props) => createStructuredSelector({
|
|
|
2684
2684
|
function mapDispatchToProps(dispatch) {
|
|
2685
2685
|
return {
|
|
2686
2686
|
actions: bindActionCreators(actions, dispatch),
|
|
2687
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
2688
2687
|
templatesActions: bindActionCreators(templatesActions, dispatch),
|
|
2689
2688
|
creativesContainerActions: bindActionCreators(creativesContainerActions, dispatch),
|
|
2690
2689
|
};
|
|
2691
2690
|
}
|
|
2692
2691
|
|
|
2693
|
-
export default
|
|
2694
|
-
|
|
2692
|
+
export default withCreatives({
|
|
2693
|
+
WrappedComponent: Email,
|
|
2694
|
+
mapStateToProps,
|
|
2695
|
+
mapDispatchToProps,
|
|
2696
|
+
userAuth: true,
|
|
2697
|
+
});
|
|
@@ -4,19 +4,14 @@
|
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import {
|
|
8
|
+
CHANGE_LOCALE,
|
|
9
|
+
} from './constants';
|
|
8
10
|
|
|
9
11
|
export function changeLocale(languageLocale) {
|
|
10
12
|
console.log('trying to change locale', languageLocale);
|
|
11
13
|
return {
|
|
12
|
-
type:
|
|
14
|
+
type: CHANGE_LOCALE,
|
|
13
15
|
locale: languageLocale,
|
|
14
16
|
};
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
export function getLocizMessage(locale) {
|
|
18
|
-
return {
|
|
19
|
-
type: types.GET_LOCIZ_MESSAGE_REQUEST,
|
|
20
|
-
locale,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
@@ -6,10 +6,3 @@
|
|
|
6
6
|
|
|
7
7
|
export const CHANGE_LOCALE = 'app/LanguageToggle/CHANGE_LOCALE';
|
|
8
8
|
export const DEFAULT_LOCALE = 'en';
|
|
9
|
-
|
|
10
|
-
export const GET_LOCIZ_MESSAGE_REQUEST =
|
|
11
|
-
'app/LanguageProvider/GET_LOCIZ_MESSAGE_REQUEST';
|
|
12
|
-
export const GET_LOCIZ_MESSAGE_SUCCESS =
|
|
13
|
-
'app/LanguageProvider/GET_LOCIZ_MESSAGE_SUCCESS';
|
|
14
|
-
export const GET_LOCIZ_MESSAGE_FAILURE =
|
|
15
|
-
'app/LanguageProvider/GET_LOCIZ_MESSAGE_FAILURE';
|
|
@@ -10,36 +10,15 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import { connect } from 'react-redux';
|
|
13
|
-
import {
|
|
13
|
+
import { createSelector } from 'reselect';
|
|
14
14
|
import { IntlProvider } from 'react-intl';
|
|
15
|
-
import { bindActionCreators } from 'redux';
|
|
16
|
-
import * as actions from './actions';
|
|
17
|
-
import { makeSelectLocale } from './selectors';
|
|
18
15
|
|
|
16
|
+
import { makeSelectLocale } from './selectors';
|
|
19
17
|
|
|
20
18
|
export class LanguageProvider extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
|
|
21
|
-
componentDidMount() {
|
|
22
|
-
const user = localStorage.getItem('user');
|
|
23
|
-
let locale = localStorage.getItem('jlocale') || 'en';
|
|
24
|
-
if (user) {
|
|
25
|
-
locale = JSON.parse(user).lang;
|
|
26
|
-
}
|
|
27
|
-
locale = this.getMappedLocale(locale);
|
|
28
|
-
this.props.actions.getLocizMessage(locale);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
getMappedLocale = (locale) => {
|
|
32
|
-
const map = {
|
|
33
|
-
'en': 'en-US',
|
|
34
|
-
'zh-cn': 'zh',
|
|
35
|
-
};
|
|
36
|
-
return map[locale];
|
|
37
|
-
};
|
|
38
|
-
|
|
39
19
|
render() {
|
|
40
|
-
const { locale, messages} = this.props.language;
|
|
41
20
|
return (
|
|
42
|
-
<IntlProvider locale={locale} key={locale} messages={messages}>
|
|
21
|
+
<IntlProvider locale={this.props.locale} key={this.props.locale} messages={this.props.messages[this.props.locale]}>
|
|
43
22
|
{React.Children.only(this.props.children)}
|
|
44
23
|
</IntlProvider>
|
|
45
24
|
);
|
|
@@ -47,19 +26,20 @@ export class LanguageProvider extends React.PureComponent { // eslint-disable-li
|
|
|
47
26
|
}
|
|
48
27
|
|
|
49
28
|
LanguageProvider.propTypes = {
|
|
50
|
-
|
|
51
|
-
|
|
29
|
+
locale: PropTypes.string,
|
|
30
|
+
messages: PropTypes.object,
|
|
52
31
|
children: PropTypes.element.isRequired,
|
|
53
32
|
};
|
|
54
33
|
|
|
55
34
|
|
|
56
|
-
const mapStateToProps =
|
|
57
|
-
|
|
58
|
-
})
|
|
35
|
+
const mapStateToProps = createSelector(
|
|
36
|
+
makeSelectLocale(),
|
|
37
|
+
(locale) => ({ locale })
|
|
38
|
+
);
|
|
59
39
|
|
|
60
40
|
function mapDispatchToProps(dispatch) {
|
|
61
41
|
return {
|
|
62
|
-
|
|
42
|
+
dispatch,
|
|
63
43
|
};
|
|
64
44
|
}
|
|
65
45
|
|
|
@@ -6,30 +6,22 @@
|
|
|
6
6
|
|
|
7
7
|
import { fromJS } from 'immutable';
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import {
|
|
10
|
+
CHANGE_LOCALE,
|
|
11
|
+
} from './constants';
|
|
10
12
|
import {
|
|
11
13
|
DEFAULT_LOCALE,
|
|
12
14
|
} from '../Cap/constants'; // eslint-disable-line
|
|
13
15
|
|
|
14
16
|
const initialState = fromJS({
|
|
15
17
|
locale: DEFAULT_LOCALE,
|
|
16
|
-
messages: [],
|
|
17
|
-
localeLoading: false,
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
function languageProviderReducer(state = initialState, action) {
|
|
21
21
|
switch (action.type) {
|
|
22
|
-
case
|
|
22
|
+
case CHANGE_LOCALE:
|
|
23
23
|
return state
|
|
24
24
|
.set('locale', action.locale);
|
|
25
|
-
case types.GET_LOCIZ_MESSAGE_REQUEST:
|
|
26
|
-
return state.set('localeLoading', true);
|
|
27
|
-
case types.GET_LOCIZ_MESSAGE_SUCCESS:
|
|
28
|
-
return state
|
|
29
|
-
.set('localeLoading', false)
|
|
30
|
-
.set('messages', fromJS(action.data));
|
|
31
|
-
case types.GET_LOCIZ_MESSAGE_FAILURE:
|
|
32
|
-
return state.set('localeLoading', false);
|
|
33
25
|
default:
|
|
34
26
|
return state;
|
|
35
27
|
}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React, { Component } from 'react';
|
|
3
|
-
import {connect} from 'react-redux';
|
|
4
3
|
import { bindActionCreators } from 'redux';
|
|
5
|
-
import {
|
|
4
|
+
import { intlShape } from 'react-intl';
|
|
6
5
|
import { createStructuredSelector } from 'reselect';
|
|
7
6
|
import { Row, Col, Spin, Breadcrumb } from 'antd';
|
|
8
7
|
import _ from 'lodash';
|
|
9
8
|
import messages from './messages';
|
|
10
9
|
import * as actions from './actions';
|
|
11
10
|
import FormBuilder from '../../../v2Components/FormBuilder';
|
|
12
|
-
import { UserIsAuthenticated } from '../../../utils/authWrapper';
|
|
13
|
-
import * as globalActions from '../../Cap/actions';
|
|
14
11
|
//import { makeSelectCreate, makeSelectCreateResponse, makeSelectEdit, makeSelectEditResponse, makeSelectTemplateDetailsResponse } from './selectors';
|
|
15
12
|
import {makeSelectCreateLine} from './selectors';
|
|
16
13
|
import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
|
|
17
14
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
18
15
|
import { makeSelectTemplates } from '../../Templates/selectors';
|
|
19
16
|
import './_lineCreate.scss';
|
|
17
|
+
import withCreatives from '../../../hoc/withCreatives';
|
|
20
18
|
|
|
21
19
|
const BreadcrumbItem = Breadcrumb.Item;
|
|
22
20
|
|
|
@@ -813,8 +811,12 @@ const mapStateToProps = createStructuredSelector({
|
|
|
813
811
|
function mapDispatchToProps(dispatch) {
|
|
814
812
|
return {
|
|
815
813
|
actions: bindActionCreators(actions, dispatch),
|
|
816
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
817
814
|
};
|
|
818
815
|
}
|
|
819
816
|
|
|
820
|
-
export default
|
|
817
|
+
export default withCreatives({
|
|
818
|
+
WrappedComponent: Line,
|
|
819
|
+
mapStateToProps,
|
|
820
|
+
mapDispatchToProps,
|
|
821
|
+
userAuth: true,
|
|
822
|
+
});
|
|
@@ -9,21 +9,20 @@ import PropTypes from 'prop-types';
|
|
|
9
9
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import {bindActionCreators} from "redux";
|
|
12
|
-
import { connect } from 'react-redux';
|
|
13
12
|
import { Row, Col, Spin, Breadcrumb, notification } from 'antd';
|
|
14
13
|
import { createStructuredSelector } from 'reselect';
|
|
15
|
-
import {
|
|
14
|
+
import { intlShape } from 'react-intl';
|
|
16
15
|
import _ from 'lodash';
|
|
17
16
|
import {makeSelectEdit, makeSelectEditResponse, makeSelectTemplateDetailsResponse} from "../../MobilePush/Edit/selectors";
|
|
18
17
|
import {makeSelectMetaEntities, setInjectedTags} from "../../Cap/selectors";
|
|
19
18
|
import {getMessageObject} from "../../../utils/messageUtils";
|
|
20
19
|
import FormBuilder from '../../../v2Components/FormBuilder';
|
|
21
|
-
import * as globalActions from "../../Cap/actions";
|
|
22
20
|
import * as actions from "../../MobilePush/Edit/actions";
|
|
23
21
|
import * as templatesActions from "../../Templates/actions";
|
|
24
22
|
import {makeSelectTemplates} from "../../Templates/selectors";
|
|
25
23
|
import messages from './messages';
|
|
26
24
|
import './_lineEdit.scss';
|
|
25
|
+
import withCreatives from '../../../hoc/withCreatives';
|
|
27
26
|
|
|
28
27
|
const BreadcrumbItem = Breadcrumb.Item;
|
|
29
28
|
|
|
@@ -1040,9 +1039,13 @@ const mapStateToProps = createStructuredSelector({
|
|
|
1040
1039
|
function mapDispatchToProps(dispatch) {
|
|
1041
1040
|
return {
|
|
1042
1041
|
actions: bindActionCreators(actions, dispatch),
|
|
1043
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
1044
1042
|
templatesActions: bindActionCreators(templatesActions, dispatch),
|
|
1045
1043
|
};
|
|
1046
1044
|
}
|
|
1047
1045
|
|
|
1048
|
-
export default
|
|
1046
|
+
export default withCreatives({
|
|
1047
|
+
WrappedComponent: Edit,
|
|
1048
|
+
mapStateToProps,
|
|
1049
|
+
mapDispatchToProps,
|
|
1050
|
+
userAuth: false,
|
|
1051
|
+
});
|
|
@@ -7,20 +7,19 @@
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { connect } from 'react-redux';
|
|
11
10
|
import { bindActionCreators } from 'redux';
|
|
12
11
|
import { notification } from 'antd';
|
|
13
12
|
import {get, set, filter, isEmpty, map, forEach, uniqueId, cloneDeep, isEqual, findIndex} from 'lodash';
|
|
14
13
|
import { createStructuredSelector } from 'reselect';
|
|
15
|
-
import {
|
|
14
|
+
import { intlShape, FormattedMessage } from 'react-intl';
|
|
16
15
|
import styled from 'styled-components';
|
|
17
16
|
import { CapSlideBox, CapHeader, CapTable, CapLink, CapRow, CapColumn, CapIcons, CapSpin, CapNotification } from '@capillarytech/cap-ui-library';
|
|
18
17
|
import { makeSelectCreate, makeSelectCreateResponse, makeSelectIosCta } from './selectors';
|
|
19
18
|
import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
|
|
20
|
-
import * as globalActions from '../../Cap/actions';
|
|
21
19
|
import FormBuilder from '../../../v2Components/FormBuilder';
|
|
22
20
|
import './_mobilePushCreate.scss';
|
|
23
21
|
import * as actions from './actions';
|
|
22
|
+
import withCreatives from '../../../hoc/withCreatives';
|
|
24
23
|
|
|
25
24
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
26
25
|
import { makeSelectTemplates } from '../../Templates/selectors';
|
|
@@ -1809,8 +1808,12 @@ const mapStateToProps = createStructuredSelector({
|
|
|
1809
1808
|
function mapDispatchToProps(dispatch) {
|
|
1810
1809
|
return {
|
|
1811
1810
|
actions: bindActionCreators(actions, dispatch),
|
|
1812
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
1813
1811
|
};
|
|
1814
1812
|
}
|
|
1815
1813
|
|
|
1816
|
-
export default
|
|
1814
|
+
export default withCreatives({
|
|
1815
|
+
WrappedComponent: Create,
|
|
1816
|
+
mapStateToProps,
|
|
1817
|
+
mapDispatchToProps,
|
|
1818
|
+
userAuth: false,
|
|
1819
|
+
});
|
|
@@ -9,10 +9,9 @@ import PropTypes from 'prop-types';
|
|
|
9
9
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import {bindActionCreators} from "redux";
|
|
12
|
-
import { connect } from 'react-redux';
|
|
13
12
|
import { notification } from 'antd';
|
|
14
13
|
import { createStructuredSelector } from 'reselect';
|
|
15
|
-
import {
|
|
14
|
+
import { intlShape, FormattedMessage } from 'react-intl';
|
|
16
15
|
import _, {get, findIndex, set, forEach, cloneDeep} from 'lodash';
|
|
17
16
|
import { CapSpin, CapSlideBox, CapHeader, CapTable, CapLink, CapRow, CapColumn, CapIcons, CapNotification} from '@capillarytech/cap-ui-library';
|
|
18
17
|
import styled from 'styled-components';
|
|
@@ -20,13 +19,13 @@ import {makeSelectEdit, makeSelectEditResponse, makeSelectTemplateDetailsRespons
|
|
|
20
19
|
import {makeSelectMetaEntities, setInjectedTags, isLoadingMetaEntities} from "../../Cap/selectors";
|
|
21
20
|
import {getMessageObject} from "../../../utils/messageUtils";
|
|
22
21
|
import FormBuilder from '../../../v2Components/FormBuilder';
|
|
23
|
-
import * as globalActions from "../../Cap/actions";
|
|
24
22
|
import * as actions from "../../MobilePush/Edit/actions";
|
|
25
23
|
import * as templatesActions from "../../Templates/actions";
|
|
26
24
|
import {makeSelectTemplates} from "../../Templates/selectors";
|
|
27
25
|
import messages from './messages';
|
|
28
26
|
import './_mobilePushCreate.scss';
|
|
29
27
|
import {makeSelectCreate} from "../Create/selectors";
|
|
28
|
+
import withCreatives from '../../../hoc/withCreatives';
|
|
30
29
|
|
|
31
30
|
import getEventsMap from '../eventsMap';
|
|
32
31
|
import {getPrimaryCtaFields, getSecondaryCtaFields, getLinkTypeFields} from '../commonMethods';
|
|
@@ -1902,9 +1901,13 @@ const mapStateToProps = createStructuredSelector({
|
|
|
1902
1901
|
function mapDispatchToProps(dispatch) {
|
|
1903
1902
|
return {
|
|
1904
1903
|
actions: bindActionCreators(actions, dispatch),
|
|
1905
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
1906
1904
|
templatesActions: bindActionCreators(templatesActions, dispatch),
|
|
1907
1905
|
};
|
|
1908
1906
|
}
|
|
1909
1907
|
|
|
1910
|
-
export default
|
|
1908
|
+
export default withCreatives({
|
|
1909
|
+
WrappedComponent: Edit,
|
|
1910
|
+
mapStateToProps,
|
|
1911
|
+
mapDispatchToProps,
|
|
1912
|
+
userAuth: false,
|
|
1913
|
+
});
|
|
@@ -7,27 +7,26 @@
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { connect } from 'react-redux';
|
|
11
10
|
import { CapRow, CapColumn, CapSpin, CapNotification } from '@capillarytech/cap-ui-library';
|
|
12
|
-
import {
|
|
11
|
+
import { intlShape } from 'react-intl';
|
|
13
12
|
import { createStructuredSelector } from 'reselect';
|
|
14
13
|
import _ from 'lodash';
|
|
15
14
|
import { bindActionCreators } from 'redux';
|
|
16
15
|
import { makeSelectCreate, makeSelectCreateResponse } from './selectors';
|
|
17
16
|
import { makeSelectMetaEntities, isLoadingMetaEntities, setInjectedTags } from '../../Cap/selectors';
|
|
18
|
-
import { UserIsAuthenticated } from '../../../utils/authWrapper';
|
|
19
17
|
import './_smsCreate.scss';
|
|
20
18
|
import FormBuilder from '../../../v2Components/FormBuilder';
|
|
21
19
|
import * as actions from './actions';
|
|
22
20
|
import messages from './messages';
|
|
23
21
|
import * as charCount from '../../../utils/smsCharCount';
|
|
24
22
|
import {checkUnicode, updateCharCount} from '../../../utils/smsCharCountV2';
|
|
25
|
-
import * as globalActions from '../../Cap/actions';
|
|
26
23
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
27
24
|
import * as creativesContainerActions from '../../CreativesContainer/actions';
|
|
28
25
|
import {SMS} from '../../CreativesContainer/constants';
|
|
29
26
|
// import callNativeEvent from '../../../utils/callNativeEvent';
|
|
30
27
|
import {showError} from '../commonMethods';
|
|
28
|
+
import withCreatives from '../../../hoc/withCreatives';
|
|
29
|
+
|
|
31
30
|
export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
32
31
|
constructor(props) {
|
|
33
32
|
super(props);
|
|
@@ -1009,9 +1008,13 @@ const mapStateToProps = createStructuredSelector({
|
|
|
1009
1008
|
function mapDispatchToProps(dispatch) {
|
|
1010
1009
|
return {
|
|
1011
1010
|
actions: bindActionCreators(actions, dispatch),
|
|
1012
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
1013
1011
|
creativesContainerActions: bindActionCreators(creativesContainerActions, dispatch),
|
|
1014
1012
|
};
|
|
1015
1013
|
}
|
|
1016
1014
|
|
|
1017
|
-
export default
|
|
1015
|
+
export default withCreatives({
|
|
1016
|
+
WrappedComponent: Create,
|
|
1017
|
+
mapStateToProps,
|
|
1018
|
+
mapDispatchToProps,
|
|
1019
|
+
userAuth: true,
|
|
1020
|
+
});
|
|
@@ -8,25 +8,24 @@
|
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
|
|
10
10
|
import React from 'react';
|
|
11
|
-
import { connect } from 'react-redux';
|
|
12
11
|
import { CapRow, CapColumn, CapSpin, CapNotification } from '@capillarytech/cap-ui-library';
|
|
13
|
-
import {
|
|
12
|
+
import { intlShape } from 'react-intl';
|
|
14
13
|
import { createStructuredSelector } from 'reselect';
|
|
15
14
|
import _ from 'lodash';
|
|
16
15
|
import { bindActionCreators } from 'redux';
|
|
17
16
|
import { makeSelectEdit, makeSelectEditResponse, makeSelectTemplateDetailsResponse } from './selectors';
|
|
18
17
|
import { makeSelectMetaEntities, isLoadingMetaEntities, setInjectedTags } from '../../Cap/selectors';
|
|
19
|
-
import { UserIsAuthenticated } from '../../../utils/authWrapper';
|
|
20
18
|
import FormBuilder from '../../../v2Components/FormBuilder';
|
|
21
19
|
import * as actions from './actions';
|
|
22
20
|
import {checkUnicode, updateCharCount} from '../../../utils/smsCharCountV2';
|
|
23
21
|
import '../Create/_smsCreate.scss';
|
|
24
22
|
import messages from './messages';
|
|
25
|
-
import * as globalActions from '../../Cap/actions';
|
|
26
23
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
27
24
|
import * as creativesContainerActions from '../../CreativesContainer/actions';
|
|
28
25
|
// import callNativeEvent from '../../../utils/callNativeEvent';
|
|
29
26
|
import {showError} from '../commonMethods';
|
|
27
|
+
import withCreatives from '../../../hoc/withCreatives';
|
|
28
|
+
|
|
30
29
|
export class Edit extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
31
30
|
constructor(props) {
|
|
32
31
|
super(props);
|
|
@@ -1009,9 +1008,13 @@ const mapStateToProps = createStructuredSelector({
|
|
|
1009
1008
|
function mapDispatchToProps(dispatch) {
|
|
1010
1009
|
return {
|
|
1011
1010
|
actions: bindActionCreators(actions, dispatch),
|
|
1012
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
1013
1011
|
creativesContainerActions: bindActionCreators(creativesContainerActions, dispatch),
|
|
1014
1012
|
};
|
|
1015
1013
|
}
|
|
1016
1014
|
|
|
1017
|
-
export default
|
|
1015
|
+
export default withCreatives({
|
|
1016
|
+
WrappedComponent: Edit,
|
|
1017
|
+
mapStateToProps,
|
|
1018
|
+
mapDispatchToProps,
|
|
1019
|
+
userAuth: true,
|
|
1020
|
+
});
|
|
@@ -7,10 +7,9 @@
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { connect } from 'react-redux';
|
|
11
10
|
import { bindActionCreators } from 'redux';
|
|
12
11
|
import Helmet from 'react-helmet';
|
|
13
|
-
import {
|
|
12
|
+
import { intlShape } from 'react-intl';
|
|
14
13
|
import { createStructuredSelector } from 'reselect';
|
|
15
14
|
import { Row, Col, Spin } from 'antd';
|
|
16
15
|
import _ from 'lodash';
|
|
@@ -20,15 +19,10 @@ import makeSelectWeChat from './selectors';
|
|
|
20
19
|
import messages from './messages';
|
|
21
20
|
import * as actions from './actions';
|
|
22
21
|
import FormBuilder from '../../../v2Components/FormBuilder';
|
|
23
|
-
import { UserIsAuthenticated } from '../../../utils/authWrapper';
|
|
24
|
-
import * as globalActions from '../../Cap/actions';
|
|
25
22
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
26
23
|
import * as templateActions from '../../Templates/actions';
|
|
27
|
-
// import SlideBox from '../../v2Components/SlideBox';
|
|
28
|
-
// import PageHeader from '../../v2Components/PageHeader';
|
|
29
24
|
import './_mapTemplates.scss';
|
|
30
|
-
|
|
31
|
-
// const Option = Select.Option;
|
|
25
|
+
import withCreatives from '../../../hoc/withCreatives';
|
|
32
26
|
|
|
33
27
|
export class MapTemplates extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
34
28
|
constructor(props) {
|
|
@@ -1376,9 +1370,13 @@ const mapStateToProps = createStructuredSelector({
|
|
|
1376
1370
|
function mapDispatchToProps(dispatch) {
|
|
1377
1371
|
return {
|
|
1378
1372
|
actions: bindActionCreators(actions, dispatch),
|
|
1379
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
1380
1373
|
templateActions: bindActionCreators(templateActions, dispatch),
|
|
1381
1374
|
};
|
|
1382
1375
|
}
|
|
1383
1376
|
|
|
1384
|
-
export default
|
|
1377
|
+
export default withCreatives({
|
|
1378
|
+
WrappedComponent: MapTemplates,
|
|
1379
|
+
mapStateToProps,
|
|
1380
|
+
mapDispatchToProps,
|
|
1381
|
+
userAuth: true,
|
|
1382
|
+
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { takeLatest, take, all, cancel, call, put } from 'redux-saga/effects';
|
|
2
|
-
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
3
|
-
import * as Api from '../../services/api';
|
|
4
|
-
import * as types from './constants';
|
|
5
|
-
|
|
6
|
-
function* getLocizMessage(action) {
|
|
7
|
-
try {
|
|
8
|
-
const result = yield call(Api.getLocizMessage, action.locale);
|
|
9
|
-
yield [
|
|
10
|
-
put({
|
|
11
|
-
type: types.GET_LOCIZ_MESSAGE_SUCCESS,
|
|
12
|
-
data: result,
|
|
13
|
-
}),
|
|
14
|
-
];
|
|
15
|
-
} catch (error) {
|
|
16
|
-
yield [
|
|
17
|
-
put({
|
|
18
|
-
type: types.GET_LOCIZ_MESSAGE_FAILURE,
|
|
19
|
-
data: error,
|
|
20
|
-
}),
|
|
21
|
-
];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export function* watchGetLocizMessage() {
|
|
25
|
-
const watcher = yield takeLatest(
|
|
26
|
-
types.GET_LOCIZ_MESSAGE_REQUEST,
|
|
27
|
-
getLocizMessage,
|
|
28
|
-
);
|
|
29
|
-
yield take(LOCATION_CHANGE);
|
|
30
|
-
yield cancel(watcher);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default [watchGetLocizMessage];
|
|
34
|
-
|
|
35
|
-
export function* LanguageProviderRootSaga() {
|
|
36
|
-
yield all([
|
|
37
|
-
watchGetLocizMessage(),
|
|
38
|
-
]);
|
|
39
|
-
}
|