@capillarytech/creatives-library 3.2.3 → 3.2.4
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/config/app.js +1 -3
- package/containers/Cap/index.js +0 -1
- package/containers/LanguageProvider/index.js +3 -26
- package/index.js +0 -6
- package/package.json +4 -1
- package/reducers.js +1 -1
- package/routes.js +1 -2
- package/services/api.js +2 -11
- package/translations/en.json +3 -3
- package/v2Components/FormBuilder/index.js +2 -2
- package/v2Containers/CreativesContainer/SlideBoxContent.js +0 -3
- package/v2Containers/CreativesContainer/index.js +1 -3
- package/v2Containers/Email/index.js +5 -5
- package/v2Containers/EmailWrapper/index.js +9 -9
- package/v2Containers/LanguageProvider/actions.js +4 -9
- package/v2Containers/LanguageProvider/constants.js +0 -7
- package/v2Containers/LanguageProvider/index.js +12 -47
- package/v2Containers/LanguageProvider/reducer.js +4 -12
- package/v2Containers/LanguageProvider/selectors.js +1 -1
- package/v2Containers/TemplatesV2/index.js +54 -53
- package/v2Containers/WeChat/MapTemplates/messages.js +1 -1
- package/containers/Cap/messsages.js +0 -63
- package/v2Components/Header/index.js +0 -46
- package/v2Components/Header/tests/index.test.js +0 -10
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';
|
package/config/app.js
CHANGED
|
@@ -5,17 +5,15 @@ 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',
|
|
12
|
-
subscription_api_endpoint: '/arya/api/v1/subscription',
|
|
11
|
+
subscription_api_endpoint: '/arya/api/v1/org-settings/subscription',
|
|
13
12
|
accountConfig: (strs, accountId) => `${window.location.origin}/org/config/AccountAdd?q=a&channelId=2&accountId=${accountId}&edit=1`,
|
|
14
13
|
},
|
|
15
14
|
development: {
|
|
16
15
|
api_endpoint: 'https://nightly.capillary.in/arya/api/v1/creatives',
|
|
17
16
|
auth_endpoint: 'https://nightly.capillary.in/arya/api/v1/auth',
|
|
18
|
-
arya_endpoint: 'https://nightly.capillary.in/arya/api/v1',
|
|
19
17
|
subscription_api_endpoint: 'https://nightly.capillary.in/arya/api/v1/org-settings/subscription',
|
|
20
18
|
login_url: 'auth/login',
|
|
21
19
|
dashboard_url: '/sms',
|
package/containers/Cap/index.js
CHANGED
|
@@ -9,9 +9,6 @@
|
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
|
|
11
11
|
import React from 'react';
|
|
12
|
-
import { ConfigProvider } from 'antd';
|
|
13
|
-
import enUS from 'antd/es/locale-provider/en_US';
|
|
14
|
-
import zhCN from 'antd/es/locale-provider/zh_CN';
|
|
15
12
|
import { connect } from 'react-redux';
|
|
16
13
|
import { createSelector } from 'reselect';
|
|
17
14
|
import { IntlProvider } from 'react-intl';
|
|
@@ -19,31 +16,11 @@ import { IntlProvider } from 'react-intl';
|
|
|
19
16
|
import { makeSelectLocale } from './selectors';
|
|
20
17
|
|
|
21
18
|
export class LanguageProvider extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
|
|
22
|
-
getMappedLocale = (locale) => {
|
|
23
|
-
const map = {
|
|
24
|
-
'en': 'en-US',
|
|
25
|
-
'zh-cn': 'zh',
|
|
26
|
-
'en-US': 'en-US',
|
|
27
|
-
'zh': 'zh',
|
|
28
|
-
};
|
|
29
|
-
return map[locale];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
19
|
render() {
|
|
33
|
-
const mappedLocale = {
|
|
34
|
-
'en': enUS,
|
|
35
|
-
'zh-cn': zhCN,
|
|
36
|
-
'en-US': enUS,
|
|
37
|
-
zh: zhCN,
|
|
38
|
-
};
|
|
39
|
-
const jLocale = localStorage.getItem('jlocale') || 'en';
|
|
40
|
-
const file = mappedLocale[jLocale];
|
|
41
20
|
return (
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
</IntlProvider>
|
|
46
|
-
</ConfigProvider>
|
|
21
|
+
<IntlProvider locale={this.props.locale} key={this.props.locale} messages={this.props.messages[this.props.locale]}>
|
|
22
|
+
{React.Children.only(this.props.children)}
|
|
23
|
+
</IntlProvider>
|
|
47
24
|
);
|
|
48
25
|
}
|
|
49
26
|
}
|
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';
|
|
@@ -67,7 +63,6 @@ export {default as EbillSaga} from './v2Containers/Ebill/sagas';
|
|
|
67
63
|
|
|
68
64
|
|
|
69
65
|
const CapContainer = {Cap, capReducer, capSaga};
|
|
70
|
-
const LanguageProviderContainer = {LanguageProvider, LanguageProviderReducer, LanguageProviderSaga};
|
|
71
66
|
const TemplatesContainer = {Templates, templateReducer, templateSaga};
|
|
72
67
|
const SmsCreateContainer = {SmsCreate, smsCreateReducer, smsCreateSaga};
|
|
73
68
|
const SmsEditContainer = {SmsEdit, smsEditReducer, smsEditSaga};
|
|
@@ -96,7 +91,6 @@ export {default as WechatRichmediaTemplatePreview} from './v2Components/Template
|
|
|
96
91
|
CreativesContainer.CreativesContainerReducer = CreativesContainerReducer;
|
|
97
92
|
|
|
98
93
|
export { CapContainer,
|
|
99
|
-
LanguageProviderContainer,
|
|
100
94
|
TemplatesContainer,
|
|
101
95
|
SmsCreateContainer,
|
|
102
96
|
SmsEditContainer,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capillarytech/creatives-library",
|
|
3
3
|
"author": "meharaj",
|
|
4
|
-
"version": "3.2.
|
|
4
|
+
"version": "3.2.4",
|
|
5
5
|
"description": "Capillary creatives ui",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"module": "./index.es.js",
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
"jquery": "^3.3.1",
|
|
19
19
|
"load-script": "^1.0.0",
|
|
20
20
|
"normalizr": "^3.2.3",
|
|
21
|
+
"perfect-scrollbar": "^0.7.0",
|
|
21
22
|
"react-datepicker": "^0.46.0",
|
|
23
|
+
"react-grid-layout": "^0.14.6",
|
|
22
24
|
"react-router": "^3.2.0",
|
|
23
25
|
"react-router-dom": "^4.2.2",
|
|
24
26
|
"redux": "3.6.0",
|
|
@@ -27,6 +29,7 @@
|
|
|
27
29
|
"redux-immutable": "3.0.8",
|
|
28
30
|
"reselect": "2.5.4",
|
|
29
31
|
"styled-components": "^3.2.1",
|
|
32
|
+
"warning": "3.0.0",
|
|
30
33
|
"whatwg-fetch": "2.0.1"
|
|
31
34
|
}
|
|
32
35
|
}
|
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,8 +11,8 @@ 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
|
import {updateCharCount} from './utils/smsCharCountV2';
|
|
15
|
+
|
|
16
16
|
const errorLoading = (err) => {
|
|
17
17
|
console.error('Dynamic page loading failed', err); // eslint-disable-line no-console
|
|
18
18
|
};
|
|
@@ -26,7 +26,6 @@ export default function createRoutes(store) {
|
|
|
26
26
|
updateCharCount("", false); // calling here to get unsubscribeurl from api.
|
|
27
27
|
const { injectReducer, injectSagas } = getAsyncInjectors(store); // eslint-disable-line no-unused-vars
|
|
28
28
|
injectSagas(rootSaga.default);
|
|
29
|
-
injectSagas(languageSaga.default);
|
|
30
29
|
return [
|
|
31
30
|
{
|
|
32
31
|
path: '/',
|
package/services/api.js
CHANGED
|
@@ -9,12 +9,10 @@ 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
|
let SUBSCRIPTION_API_ENDPOINT = config.development.subscription_api_endpoint;
|
|
14
13
|
if (process.env.NODE_ENV === 'production') {
|
|
15
14
|
API_ENDPOINT = config.production.api_endpoint;
|
|
16
15
|
API_AUTH_ENDPOINT = config.production.auth_endpoint;
|
|
17
|
-
ARYA_ENDPOINT = config.production.arya_endpoint;
|
|
18
16
|
SUBSCRIPTION_API_ENDPOINT = config.production.subscription_api_endpoint;
|
|
19
17
|
}
|
|
20
18
|
|
|
@@ -60,8 +58,8 @@ function checkStatus(response) {
|
|
|
60
58
|
if ((response.status >= 200 && response.status < 300) || response.status === 500) {
|
|
61
59
|
return response;
|
|
62
60
|
}
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
|
|
62
|
+
redirectIfUnauthenticated(response);
|
|
65
63
|
|
|
66
64
|
const error = new Error(response.statusText);
|
|
67
65
|
error.response = response;
|
|
@@ -321,13 +319,6 @@ export const createLineTemplate = ({template}) => {
|
|
|
321
319
|
return request(url, getAPICallObject('POST', template));
|
|
322
320
|
};
|
|
323
321
|
|
|
324
|
-
export const getLocizMessage = async (locale) => {
|
|
325
|
-
const appName = 'creatives_v2';
|
|
326
|
-
const url = `${ARYA_ENDPOINT}/translations/${appName}/${locale}`;
|
|
327
|
-
const response = await request(url, getAPICallObject('GET'));
|
|
328
|
-
return response;
|
|
329
|
-
};
|
|
330
|
-
|
|
331
322
|
export const getUnsubscribeUrl = () => {
|
|
332
323
|
const body = {
|
|
333
324
|
orgUnitId: -1,
|
package/translations/en.json
CHANGED
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"creatives.componentsV2.CallTaskPreview.header": "This is the CallTaskPreview component !",
|
|
74
74
|
"creatives.componentsV2.CapTagList.Cancel": "Cancel",
|
|
75
75
|
"creatives.componentsV2.CapTagList.Ok": "Ok",
|
|
76
|
-
"creatives.componentsV2.CapTagList.all": "
|
|
76
|
+
"creatives.componentsV2.CapTagList.all": "Dynamic days before expiry",
|
|
77
77
|
"creatives.componentsV2.CapTagList.dynamic_days_before_expiry": "Dynamic days before expiry",
|
|
78
78
|
"creatives.componentsV2.CapTagList.gettingTags": "Getting tags...",
|
|
79
79
|
"creatives.componentsV2.CapTagList.loyalty": "Loyalty",
|
|
@@ -684,7 +684,7 @@
|
|
|
684
684
|
"creatives.containers.WeChat.template": "Template",
|
|
685
685
|
"creatives.containers.WeChat.templateMapping": "Template mapping",
|
|
686
686
|
"creatives.containers.WeChat.wechatCreateSuccess": "WeChat template mapped successfully",
|
|
687
|
-
"creatives.containers.WeChat.wechatEditSuccess": "WeChat template
|
|
687
|
+
"creatives.containers.WeChat.wechatEditSuccess": "WeChat template unmapped successfully",
|
|
688
688
|
"creatives.containersV2.Assets.Gallery.addImages": "Add images",
|
|
689
689
|
"creatives.containersV2.Assets.Gallery.alphabetically": "Alphabetically",
|
|
690
690
|
"creatives.containersV2.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -1350,7 +1350,7 @@
|
|
|
1350
1350
|
"creatives.containersV2.WeChat.template": "Template",
|
|
1351
1351
|
"creatives.containersV2.WeChat.templateMapping": "Template mapping",
|
|
1352
1352
|
"creatives.containersV2.WeChat.wechatCreateSuccess": "WeChat template mapped successfully",
|
|
1353
|
-
"creatives.containersV2.WeChat.wechatEditSuccess": "WeChat template
|
|
1353
|
+
"creatives.containersV2.WeChat.wechatEditSuccess": "WeChat template unmapped successfully",
|
|
1354
1354
|
"creatives.containersV2.appName": "App Name",
|
|
1355
1355
|
"creatives.containersV2.audience": "Audience",
|
|
1356
1356
|
"creatives.containersV2.campaigns": "Campaigns",
|
|
@@ -1887,8 +1887,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1887
1887
|
|
|
1888
1888
|
for (let i = 0; i < elems.length; i += 1) {
|
|
1889
1889
|
if (elems.item(i).classList.contains("ant-tabs-tab-active")) {
|
|
1890
|
-
|
|
1891
|
-
|
|
1890
|
+
activeTabIndex = i + 1;
|
|
1891
|
+
}
|
|
1892
1892
|
}
|
|
1893
1893
|
if (this.props.isNewVersionFlow) {
|
|
1894
1894
|
const formData = _.cloneDeep(this.state.formData);
|
|
@@ -60,7 +60,6 @@ function SlideBoxContent(props) {
|
|
|
60
60
|
onValidationFail,
|
|
61
61
|
channelsToHide,
|
|
62
62
|
forwardedTags,
|
|
63
|
-
channelsToDisable,
|
|
64
63
|
weChatTemplateType,
|
|
65
64
|
onWechatTemplateChange,
|
|
66
65
|
selectedWeChatAccount,
|
|
@@ -114,7 +113,6 @@ function SlideBoxContent(props) {
|
|
|
114
113
|
cap={cap}
|
|
115
114
|
channelsToHide={channelsToHide}
|
|
116
115
|
forwardedTags={forwardedTags}
|
|
117
|
-
channelsToDisable={channelsToDisable}
|
|
118
116
|
/>
|
|
119
117
|
)}
|
|
120
118
|
{isPreview && (
|
|
@@ -325,7 +323,6 @@ SlideBoxContent.propTypes = {
|
|
|
325
323
|
onValidationFail: PropTypes.func,
|
|
326
324
|
channelsToHide: PropTypes.array,
|
|
327
325
|
forwardedTags: PropTypes.object,
|
|
328
|
-
channelsToDisable: PropTypes.array,
|
|
329
326
|
weChatTemplateType: PropTypes.string,
|
|
330
327
|
onWechatTemplateChange: PropTypes.func,
|
|
331
328
|
selectedWeChatAccount: PropTypes.object,
|
|
@@ -465,7 +465,7 @@ class Creatives extends React.Component {
|
|
|
465
465
|
}
|
|
466
466
|
render() {
|
|
467
467
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
|
|
468
|
-
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags
|
|
468
|
+
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags} = this.props;
|
|
469
469
|
const mapTemplateCreate = slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
470
470
|
return (
|
|
471
471
|
<SlideBoxWrapper className={classnames(`${classPrefix} ${isFullMode ? 'creatives-full-mode' : 'creatives-library-mode'} ${mapTemplateCreate ? 'map-template-create' : ''}`)}>
|
|
@@ -522,7 +522,6 @@ class Creatives extends React.Component {
|
|
|
522
522
|
onValidationFail={this.onValidationFail}
|
|
523
523
|
channelsToHide={channelsToHide}
|
|
524
524
|
forwardedTags={forwardedTags}
|
|
525
|
-
channelsToDisable={channelsToDisable}
|
|
526
525
|
weChatTemplateType={weChatTemplateType}
|
|
527
526
|
onWechatTemplateChange={this.onWechatTemplateChange}
|
|
528
527
|
weChatMaptemplateStep={weChatMaptemplateStep}
|
|
@@ -574,7 +573,6 @@ Creatives.propTypes = {
|
|
|
574
573
|
EmailLayout: PropTypes.string,
|
|
575
574
|
channelsToHide: PropTypes.array,
|
|
576
575
|
forwardedTags: PropTypes.object,
|
|
577
|
-
channelsToDisable: PropTypes.array,
|
|
578
576
|
selectedWeChatAccount: PropTypes.object,
|
|
579
577
|
};
|
|
580
578
|
const mapStatesToProps = () => createStructuredSelector({
|
|
@@ -58,7 +58,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
58
58
|
showImageSelectionBox: false,
|
|
59
59
|
isDragDrop: false,
|
|
60
60
|
showConfirmationModal: false,
|
|
61
|
-
modalContent: {title: this.props.intl.formatMessage(messages.
|
|
61
|
+
modalContent: {title: this.props.intl.formatMessage(messages.alertMessage), body: this.props.intl.formatMessage(messages.deleteLanguageConfirmation), type: 'confirm', id: 'email-language-delete-modal'},
|
|
62
62
|
showModal: false,
|
|
63
63
|
page: 1,
|
|
64
64
|
perPageLimit: 25,
|
|
@@ -906,14 +906,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
906
906
|
let modalContent = {};
|
|
907
907
|
if (type === 'delete-version') {
|
|
908
908
|
modalContent = {
|
|
909
|
-
title: this.props.intl.formatMessage(messages.
|
|
909
|
+
title: this.props.intl.formatMessage(messages.alertMessage),
|
|
910
910
|
body: this.props.intl.formatMessage(messages.deleteVersionConfirmation),
|
|
911
911
|
type: 'confirm',
|
|
912
912
|
id: 'email-version-delete-modal',
|
|
913
913
|
};
|
|
914
914
|
} else if (type === 'delete-language') {
|
|
915
915
|
modalContent = {
|
|
916
|
-
title: this.props.intl.formatMessage(messages.
|
|
916
|
+
title: this.props.intl.formatMessage(messages.alertMessage),
|
|
917
917
|
body: this.props.intl.formatMessage(messages.deleteLanguageConfirmation),
|
|
918
918
|
type: 'confirm',
|
|
919
919
|
id: 'email-language-delete-modal',
|
|
@@ -1001,7 +1001,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1001
1001
|
showImageSelectionBox: false,
|
|
1002
1002
|
isDragDrop: false,
|
|
1003
1003
|
showConfirmationModal: false,
|
|
1004
|
-
modalContent: {title: this.props.intl.formatMessage(messages.
|
|
1004
|
+
modalContent: {title: this.props.intl.formatMessage(messages.alertMessage), body: this.props.intl.formatMessage(messages.deleteLanguageConfirmation), type: 'confirm', id: 'email-language-delete-modal'},
|
|
1005
1005
|
showModal: false,
|
|
1006
1006
|
page: 1,
|
|
1007
1007
|
perPageLimit: 25,
|
|
@@ -1823,7 +1823,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1823
1823
|
|
|
1824
1824
|
moveToTemplates = () => {
|
|
1825
1825
|
const modalContent = {
|
|
1826
|
-
title: this.props.intl.formatMessage(messages.
|
|
1826
|
+
title: this.props.intl.formatMessage(messages.alertMessage),
|
|
1827
1827
|
body: this.props.intl.formatMessage(messages.goBackTemporaryChangesLost),
|
|
1828
1828
|
type: 'confirm',
|
|
1829
1829
|
id: 'template-back-confirm-modal',
|
|
@@ -203,15 +203,15 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
203
203
|
</CardContainer>
|
|
204
204
|
<div>
|
|
205
205
|
{emailCreateMode === "upload" &&
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
206
|
+
<div style={{ marginLeft: '8px'}}>
|
|
207
|
+
<CapUploader onChange={this.useFileUpload} accept=".zip, .html, .htm" showUploadList={false}>
|
|
208
|
+
<CapButton>{this.props.intl.formatMessage(messages.upload)}</CapButton>
|
|
209
|
+
</CapUploader>
|
|
210
|
+
{!_.isEmpty(EmailLayout) &&
|
|
211
|
+
<div>{_.get(modeContent, "file.name")}</div>
|
|
212
|
+
}
|
|
213
|
+
</div>
|
|
214
|
+
}
|
|
215
215
|
</div>
|
|
216
216
|
</div>
|
|
217
217
|
:
|
|
@@ -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';
|
|
@@ -9,72 +9,37 @@
|
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
|
|
11
11
|
import React from 'react';
|
|
12
|
-
import { ConfigProvider } from 'antd';
|
|
13
|
-
import enUS from 'antd/es/locale-provider/en_US';
|
|
14
|
-
import zhCN from 'antd/es/locale-provider/zh_CN';
|
|
15
12
|
import { connect } from 'react-redux';
|
|
16
|
-
import {
|
|
13
|
+
import { createSelector } from 'reselect';
|
|
17
14
|
import { IntlProvider } from 'react-intl';
|
|
18
|
-
import { bindActionCreators } from 'redux';
|
|
19
|
-
import * as actions from './actions';
|
|
20
|
-
import { makeSelectLocale } from './selectors';
|
|
21
15
|
|
|
16
|
+
import { makeSelectLocale } from './selectors';
|
|
22
17
|
|
|
23
18
|
export class LanguageProvider extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
|
|
24
|
-
componentDidMount() {
|
|
25
|
-
const user = localStorage.getItem('user');
|
|
26
|
-
let locale = localStorage.getItem('jlocale') || 'en';
|
|
27
|
-
if (user) {
|
|
28
|
-
locale = JSON.parse(user).lang;
|
|
29
|
-
}
|
|
30
|
-
locale = this.getMappedLocale(locale);
|
|
31
|
-
this.props.actions.getLocizMessage(locale);
|
|
32
|
-
}
|
|
33
|
-
/*global getMappedLocale */
|
|
34
|
-
getMappedLocale = (locale) => {
|
|
35
|
-
const map = {
|
|
36
|
-
'en': 'en-US',
|
|
37
|
-
'zh-cn': 'zh',
|
|
38
|
-
'zh': 'zh',
|
|
39
|
-
'en-US': 'en-US',
|
|
40
|
-
};
|
|
41
|
-
return map[locale];
|
|
42
|
-
};
|
|
43
|
-
|
|
44
19
|
render() {
|
|
45
|
-
const { locale, messages} = this.props.language;
|
|
46
|
-
const mappedLocale = {
|
|
47
|
-
'en': enUS,
|
|
48
|
-
'zh-cn': zhCN,
|
|
49
|
-
'en-US': enUS,
|
|
50
|
-
'zh': zhCN,
|
|
51
|
-
};
|
|
52
|
-
const jLocale = localStorage.getItem('jlocale') || 'en';
|
|
53
|
-
const file = mappedLocale[jLocale];
|
|
54
20
|
return (
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
</IntlProvider>
|
|
59
|
-
</ConfigProvider>
|
|
21
|
+
<IntlProvider locale={this.props.locale} key={this.props.locale} messages={this.props.messages[this.props.locale]}>
|
|
22
|
+
{React.Children.only(this.props.children)}
|
|
23
|
+
</IntlProvider>
|
|
60
24
|
);
|
|
61
25
|
}
|
|
62
26
|
}
|
|
63
27
|
|
|
64
28
|
LanguageProvider.propTypes = {
|
|
65
|
-
|
|
66
|
-
|
|
29
|
+
locale: PropTypes.string,
|
|
30
|
+
messages: PropTypes.object,
|
|
67
31
|
children: PropTypes.element.isRequired,
|
|
68
32
|
};
|
|
69
33
|
|
|
70
34
|
|
|
71
|
-
const mapStateToProps =
|
|
72
|
-
|
|
73
|
-
})
|
|
35
|
+
const mapStateToProps = createSelector(
|
|
36
|
+
makeSelectLocale(),
|
|
37
|
+
(locale) => ({ locale })
|
|
38
|
+
);
|
|
74
39
|
|
|
75
40
|
function mapDispatchToProps(dispatch) {
|
|
76
41
|
return {
|
|
77
|
-
|
|
42
|
+
dispatch,
|
|
78
43
|
};
|
|
79
44
|
}
|
|
80
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
|
}
|
|
@@ -5,16 +5,18 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
+
|
|
8
9
|
import React from 'react';
|
|
9
10
|
import { connect } from 'react-redux';
|
|
10
11
|
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
11
12
|
import { createStructuredSelector } from 'reselect';
|
|
12
13
|
import { bindActionCreators } from 'redux';
|
|
14
|
+
import styled from 'styled-components';
|
|
13
15
|
import { CapTab, CapCustomCard, CapButton, CapHeader, CapSpin, CapIcon } from '@capillarytech/cap-ui-library';
|
|
14
16
|
import { find, get } from 'lodash';
|
|
15
|
-
import isEmpty from 'lodash/isEmpty';
|
|
16
17
|
import Helmet from 'react-helmet';
|
|
17
18
|
|
|
19
|
+
import {CAP_SPACE_24, CAP_SPACE_16} from '@capillarytech/cap-ui-library/styled/variables';
|
|
18
20
|
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
19
21
|
import { makeSelectTemplates, makeSelectTemplatesResponse } from '../Templates/selectors';
|
|
20
22
|
import messages from './messages';
|
|
@@ -22,17 +24,33 @@ import * as actions from './actions';
|
|
|
22
24
|
import Templates from '../Templates';
|
|
23
25
|
import CallTask from '../CallTask';
|
|
24
26
|
import Gallery from '../Assets/Gallery';
|
|
25
|
-
import
|
|
26
|
-
import styles, { CapTabStyle } from './TemplatesV2.style';
|
|
27
|
+
import './_templatesV2.scss';
|
|
27
28
|
|
|
28
29
|
const {CapCustomCardList} = CapCustomCard;
|
|
29
30
|
|
|
30
|
-
const
|
|
31
|
-
|
|
31
|
+
const ComponentWrapper = styled.div`
|
|
32
|
+
${(props) => props.isFullMode ? `
|
|
33
|
+
max-width: 1140px;
|
|
34
|
+
margin: 0 auto;
|
|
35
|
+
width: 100%;
|
|
36
|
+
padding: ${CAP_SPACE_24} 0;
|
|
37
|
+
.ant-tabs-content{
|
|
38
|
+
margin-top: ${CAP_SPACE_16}
|
|
39
|
+
}
|
|
40
|
+
` : `.cap-tab-v2 {
|
|
41
|
+
height: calc(100vh - 118px);
|
|
42
|
+
} `}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
`;
|
|
46
|
+
const MarginTop = styled.div`
|
|
47
|
+
${(props) => props.isFullMode ? `margin-top: ${CAP_SPACE_24}` : ``
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
32
50
|
export class TemplatesV2 extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
33
51
|
constructor(props) {
|
|
34
52
|
super(props);
|
|
35
|
-
|
|
53
|
+
const defaultChannel = get(this, 'props.channel') || get(this, 'props.params.channel') || 'sms';
|
|
36
54
|
const defaultPanes = {
|
|
37
55
|
sms: {content: <div></div>, tab: props.intl.formatMessage(messages.sms), key: 'sms'},
|
|
38
56
|
email: {content: <div></div>, tab: props.intl.formatMessage(messages.email), key: 'email'},
|
|
@@ -41,8 +59,8 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
41
59
|
mPush: {content: <div></div>, tab: props.intl.formatMessage(messages.pushNotification), key: 'mobilepush'},
|
|
42
60
|
};
|
|
43
61
|
const channelsToHide = this.props.channelsToHide || [];
|
|
44
|
-
|
|
45
|
-
|
|
62
|
+
|
|
63
|
+
const filteredPanes = Object.keys(defaultPanes)
|
|
46
64
|
.filter((key) => !channelsToHide.includes(key)).reduce((obj = [], key) => {
|
|
47
65
|
obj.push(defaultPanes[key]);
|
|
48
66
|
return obj;
|
|
@@ -54,26 +72,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
54
72
|
filteredPanes.push({content: <div></div>, tab: props.intl.formatMessage(messages.callTask), key: 'call_task'});
|
|
55
73
|
}
|
|
56
74
|
|
|
57
|
-
filteredPanes = filteredPanes.map( (pane) => {
|
|
58
|
-
if (channelsToDisable.includes(pane.key)) {
|
|
59
|
-
pane.disabled = true;
|
|
60
|
-
}
|
|
61
|
-
return pane;
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
const channel = ['sms', 'email', 'mobilepush', 'call_task'];
|
|
65
|
-
if (!isEmpty(channelsToDisable)) {
|
|
66
|
-
channel.some((ch) => {
|
|
67
|
-
if (!channelsToDisable.includes(ch)) {
|
|
68
|
-
defaultChannel = ch;
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
return false;
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
75
|
const panes = this.setChannelContent(defaultChannel, filteredPanes);
|
|
76
|
-
|
|
77
76
|
this.state = {
|
|
78
77
|
selectedChannel: defaultChannel,
|
|
79
78
|
panes,
|
|
@@ -148,20 +147,21 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
148
147
|
}
|
|
149
148
|
}
|
|
150
149
|
|
|
151
|
-
setChannelContent = (selectedChannel, argsPanes) =>
|
|
152
|
-
argsPanes.map((
|
|
153
|
-
|
|
150
|
+
setChannelContent = (selectedChannel, argsPanes) => {
|
|
151
|
+
const panes = argsPanes.map((p) => {
|
|
152
|
+
const pane = p;
|
|
154
153
|
if (pane.key === selectedChannel) {
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
let channel = selectedChannel;
|
|
155
|
+
if (channel === "mpush") {
|
|
156
|
+
channel = "mobilepush";
|
|
157
|
+
}
|
|
158
|
+
pane.content = this.getTemplatesComponent(channel);
|
|
159
|
+
return pane;
|
|
157
160
|
}
|
|
158
|
-
return {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
})
|
|
163
|
-
);
|
|
164
|
-
|
|
161
|
+
return {...pane, content: <div></div>};
|
|
162
|
+
});
|
|
163
|
+
return panes;
|
|
164
|
+
}
|
|
165
165
|
channelChange = (selectedChannel) => {
|
|
166
166
|
const panes = this.setChannelContent(selectedChannel, this.state.panes);
|
|
167
167
|
this.setState({panes, selectedChannel}, () => { if (!this.props.isFullMode) this.props.onChannelChange(selectedChannel); });
|
|
@@ -172,25 +172,28 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
172
172
|
return this.props.Templates.loadingTemplates;
|
|
173
173
|
}
|
|
174
174
|
render() {
|
|
175
|
-
const {
|
|
175
|
+
const {isFullMode} = this.props;
|
|
176
176
|
return (
|
|
177
|
-
<div className={
|
|
177
|
+
<div className={`creatives-templates-container ${isFullMode ? 'fullmode' : 'library-mode'}`}>
|
|
178
178
|
{isFullMode && <Helmet
|
|
179
179
|
title={this.props.intl.formatMessage(messages.creatives)}
|
|
180
180
|
meta={[
|
|
181
181
|
{ name: 'description', content: this.props.intl.formatMessage(messages.creativesDesc) },
|
|
182
182
|
]}
|
|
183
183
|
/>}
|
|
184
|
-
<
|
|
184
|
+
<ComponentWrapper isFullMode={isFullMode}>
|
|
185
|
+
|
|
185
186
|
{isFullMode && <CapHeader title={<FormattedMessage {...messages.creatives}/>} description={<FormattedMessage {...messages.creativesDesc}/>}/>}
|
|
186
|
-
<
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
187
|
+
<MarginTop isFullMode={isFullMode}>
|
|
188
|
+
<CapTab
|
|
189
|
+
panes={this.state.panes}
|
|
190
|
+
onChange={this.channelChange}
|
|
191
|
+
activeKey={this.state.selectedChannel}
|
|
192
|
+
defaultActiveKey={this.state.selectedChannel}/>
|
|
193
|
+
</MarginTop>
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
</ComponentWrapper>
|
|
194
197
|
</div>
|
|
195
198
|
|
|
196
199
|
);
|
|
@@ -210,8 +213,6 @@ TemplatesV2.propTypes = {
|
|
|
210
213
|
intl: intlShape,
|
|
211
214
|
onChannelChange: PropTypes.func,
|
|
212
215
|
channelsToHide: PropTypes.array,
|
|
213
|
-
className: PropTypes.string.isRequired,
|
|
214
|
-
channelsToDisable: PropTypes.array,
|
|
215
216
|
};
|
|
216
217
|
|
|
217
218
|
TemplatesV2.defaultProps = {
|
|
@@ -229,4 +230,4 @@ function mapDispatchToProps(dispatch) {
|
|
|
229
230
|
};
|
|
230
231
|
}
|
|
231
232
|
|
|
232
|
-
export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(injectIntl(
|
|
233
|
+
export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(injectIntl(TemplatesV2)));
|
|
@@ -60,7 +60,7 @@ export default defineMessages({
|
|
|
60
60
|
},
|
|
61
61
|
"wechatEditSuccess": {
|
|
62
62
|
id: 'creatives.containersV2.WeChat.wechatEditSuccess',
|
|
63
|
-
defaultMessage: "WeChat template
|
|
63
|
+
defaultMessage: "WeChat template unmapped successfully",
|
|
64
64
|
},
|
|
65
65
|
"wechatCreateSuccess": {
|
|
66
66
|
id: 'creatives.containersV2.WeChat.wechatCreateSuccess',
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { defineMessages } from 'react-intl';
|
|
2
|
-
export default defineMessages({
|
|
3
|
-
"sms": {
|
|
4
|
-
id: 'reon.components.Cap.sms',
|
|
5
|
-
defaultMessage: 'SMS',
|
|
6
|
-
},
|
|
7
|
-
"wechat": {
|
|
8
|
-
id: 'reon.components.Cap.wechat',
|
|
9
|
-
defaultMessage: 'WeChat',
|
|
10
|
-
},
|
|
11
|
-
"gallery": {
|
|
12
|
-
id: 'reon.components.Cap.gallery',
|
|
13
|
-
defaultMessage: 'Gallery',
|
|
14
|
-
},
|
|
15
|
-
"creativesDashboard": {
|
|
16
|
-
id: 'reon.components.Cap.creativesDashboard',
|
|
17
|
-
defaultMessage: 'Creatives',
|
|
18
|
-
},
|
|
19
|
-
"creatives": {
|
|
20
|
-
id: 'reon.components.Cap.creatives',
|
|
21
|
-
defaultMessage: 'Creatives',
|
|
22
|
-
},
|
|
23
|
-
"campaigns": {
|
|
24
|
-
id: 'reon.components.Cap.campaigns',
|
|
25
|
-
defaultMessage: 'Campaigns',
|
|
26
|
-
},
|
|
27
|
-
"loyalty": {
|
|
28
|
-
id: 'reon.components.Cap.loyalty',
|
|
29
|
-
defaultMessage: 'Loyalty',
|
|
30
|
-
},
|
|
31
|
-
"member care": {
|
|
32
|
-
id: 'reon.components.Cap.memberCare',
|
|
33
|
-
defaultMessage: 'Member Care',
|
|
34
|
-
},
|
|
35
|
-
"workbench": {
|
|
36
|
-
id: 'reon.components.Cap.Workbench',
|
|
37
|
-
defaultMessage: 'WorkBench',
|
|
38
|
-
},
|
|
39
|
-
"store care": {
|
|
40
|
-
id: 'reon.components.Cap.storeCare',
|
|
41
|
-
defaultMessage: 'Store Care',
|
|
42
|
-
},
|
|
43
|
-
"store performance": {
|
|
44
|
-
id: 'reon.components.Cap.storePerformance',
|
|
45
|
-
defaultMessage: 'Store Performance',
|
|
46
|
-
},
|
|
47
|
-
"email": {
|
|
48
|
-
id: 'reon.components.Cap.email',
|
|
49
|
-
defaultMessage: 'Email',
|
|
50
|
-
},
|
|
51
|
-
"ebill": {
|
|
52
|
-
id: 'reon.components.Cap.ebill',
|
|
53
|
-
defaultMessage: 'Ebill',
|
|
54
|
-
},
|
|
55
|
-
"campaignsDashboard": {
|
|
56
|
-
id: 'reon.components.campaignsDashboard',
|
|
57
|
-
defaultMessage: 'Campaigns',
|
|
58
|
-
},
|
|
59
|
-
"campaignsHome": {
|
|
60
|
-
id: 'reon.components.campaignsHome',
|
|
61
|
-
defaultMessage: "Campaigns Home",
|
|
62
|
-
},
|
|
63
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* Header
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
9
|
-
import React from 'react';
|
|
10
|
-
// import styled from 'styled-components';
|
|
11
|
-
import { FormattedMessage } from 'react-intl';
|
|
12
|
-
|
|
13
|
-
import { CapRow, CapColumn, CapInput, CapButton } from '@capillarytech/cap-ui-library';
|
|
14
|
-
import messages from './messages';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function Header(props) {
|
|
18
|
-
return (
|
|
19
|
-
<div>
|
|
20
|
-
<CapRow className="template-form-header">
|
|
21
|
-
<CapColumn span={10}>
|
|
22
|
-
<CapInput id="template-name" placeholder="Enter template name*" defaultValue={props.templateName} type="input" onChange={props.templateNameHandler}/>
|
|
23
|
-
</CapColumn>
|
|
24
|
-
<CapColumn span={2} offset={8}>
|
|
25
|
-
<CapButton id="preview-button" type="cancel" onClick={props.previewHandler}> <FormattedMessage {...messages.preview} /> </CapButton>
|
|
26
|
-
</CapColumn>
|
|
27
|
-
<CapColumn span={2}>
|
|
28
|
-
<CapButton id="cancel-button" type="cancel" onClick={props.cancelHandler}> <FormattedMessage {...messages.cancel} /> </CapButton>
|
|
29
|
-
</CapColumn>
|
|
30
|
-
<CapColumn span={2}>
|
|
31
|
-
<CapButton id="save-button" type="primary" onClick={props.saveHandler}> <FormattedMessage {...messages.save} /> </CapButton>
|
|
32
|
-
</CapColumn>
|
|
33
|
-
</CapRow>
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
Header.propTypes = {
|
|
39
|
-
templateNameHandler: PropTypes.func,
|
|
40
|
-
previewHandler: PropTypes.func,
|
|
41
|
-
cancelHandler: PropTypes.func,
|
|
42
|
-
saveHandler: PropTypes.func,
|
|
43
|
-
templateName: PropTypes.string,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export default Header;
|