@capillarytech/creatives-library 3.1.33 → 3.1.34
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/containers/Cap/messsages.js +63 -0
- package/containers/LanguageProvider/index.js +26 -3
- package/containers/WeChat/MapTemplates/messages.js +4 -0
- package/package.json +1 -1
- package/translations/en.json +7 -1
- package/translations/zh.json +7 -1
- package/v2Components/Header/index.js +46 -0
- package/v2Components/Header/tests/index.test.js +10 -0
- package/v2Containers/LanguageProvider/index.js +17 -4
- package/v2Containers/TemplatesV2/_templatesV2.scss +5 -0
- package/v2Containers/TemplatesV2/index.js +1 -0
- package/v2Containers/WeChat/MapTemplates/index.js +1 -2
- package/v2Containers/WeChat/MapTemplates/messages.js +8 -4
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
});
|
|
@@ -9,6 +9,9 @@
|
|
|
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';
|
|
12
15
|
import { connect } from 'react-redux';
|
|
13
16
|
import { createSelector } from 'reselect';
|
|
14
17
|
import { IntlProvider } from 'react-intl';
|
|
@@ -16,11 +19,31 @@ import { IntlProvider } from 'react-intl';
|
|
|
16
19
|
import { makeSelectLocale } from './selectors';
|
|
17
20
|
|
|
18
21
|
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
|
+
|
|
19
32
|
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];
|
|
20
41
|
return (
|
|
21
|
-
<
|
|
22
|
-
{
|
|
23
|
-
|
|
42
|
+
<ConfigProvider locale={file}>
|
|
43
|
+
<IntlProvider locale={this.props.locale} key={this.props.locale} messages={this.props.messages[this.props.locale]}>
|
|
44
|
+
{React.Children.only(this.props.children)}
|
|
45
|
+
</IntlProvider>
|
|
46
|
+
</ConfigProvider>
|
|
24
47
|
);
|
|
25
48
|
}
|
|
26
49
|
}
|
|
@@ -102,4 +102,8 @@ export default defineMessages({
|
|
|
102
102
|
id: 'creatives.containers.WeChat.linkCantEmpty',
|
|
103
103
|
defaultMessage: "Link cannot be empty",
|
|
104
104
|
},
|
|
105
|
+
"loadingEDMTemplates": {
|
|
106
|
+
id: 'creatives.containers.WeChat.loadingEDMTemplates',
|
|
107
|
+
defaultMessage: "loading EDM Templates",
|
|
108
|
+
},
|
|
105
109
|
});
|
package/package.json
CHANGED
package/translations/en.json
CHANGED
|
@@ -1415,5 +1415,11 @@
|
|
|
1415
1415
|
"reon.modules.Login.componentsv2.LoginForm.input.invalidCredentials": "Invalid or Incorrect credentials!",
|
|
1416
1416
|
"reon.modules.Login.componentsv2.LoginForm.input.loginButton": "Login",
|
|
1417
1417
|
"reon.modules.Login.componentsv2.LoginForm.input.password": "Password",
|
|
1418
|
-
"reon.modules.Login.componentsv2.LoginForm.input.username": "Username or email"
|
|
1418
|
+
"reon.modules.Login.componentsv2.LoginForm.input.username": "Username or email",
|
|
1419
|
+
"creatives.containers.WeChat.loadingEDMTemplates": "loading EDM Templates",
|
|
1420
|
+
"creatives.containersV2.WeChat.select": "Select",
|
|
1421
|
+
"creatives.containersV2.WeChat.newWechat": "New wechat",
|
|
1422
|
+
"creatives.containersV2.WeChat.linkErrorMessage": "Link cannot be empty.",
|
|
1423
|
+
"creatives.containersV2.WeChat.hasInvalidContent": "has invalid content.",
|
|
1424
|
+
"creatives.containersV2.WeChat.templateName": "Template Name"
|
|
1419
1425
|
}
|
package/translations/zh.json
CHANGED
|
@@ -1415,5 +1415,11 @@
|
|
|
1415
1415
|
"reon.modules.Login.componentsv2.LoginForm.input.invalidCredentials": "",
|
|
1416
1416
|
"reon.modules.Login.componentsv2.LoginForm.input.loginButton": "",
|
|
1417
1417
|
"reon.modules.Login.componentsv2.LoginForm.input.password": "",
|
|
1418
|
-
"reon.modules.Login.componentsv2.LoginForm.input.username": ""
|
|
1418
|
+
"reon.modules.Login.componentsv2.LoginForm.input.username": "",
|
|
1419
|
+
"creatives.containers.WeChat.loadingEDMTemplates": "",
|
|
1420
|
+
"creatives.containersV2.WeChat.select": "",
|
|
1421
|
+
"creatives.containersV2.WeChat.newWechat": "",
|
|
1422
|
+
"creatives.containersV2.WeChat.linkErrorMessage": "",
|
|
1423
|
+
"creatives.containersV2.WeChat.hasInvalidContent": "",
|
|
1424
|
+
"creatives.containersV2.WeChat.templateName": ""
|
|
1419
1425
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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;
|
|
@@ -9,6 +9,9 @@
|
|
|
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';
|
|
12
15
|
import { connect } from 'react-redux';
|
|
13
16
|
import { createStructuredSelector } from 'reselect';
|
|
14
17
|
import { IntlProvider } from 'react-intl';
|
|
@@ -27,7 +30,7 @@ export class LanguageProvider extends React.PureComponent { // eslint-disable-li
|
|
|
27
30
|
locale = this.getMappedLocale(locale);
|
|
28
31
|
this.props.actions.getLocizMessage(locale);
|
|
29
32
|
}
|
|
30
|
-
|
|
33
|
+
/*global getMappedLocale */
|
|
31
34
|
getMappedLocale = (locale) => {
|
|
32
35
|
const map = {
|
|
33
36
|
'en': 'en-US',
|
|
@@ -40,10 +43,20 @@ export class LanguageProvider extends React.PureComponent { // eslint-disable-li
|
|
|
40
43
|
|
|
41
44
|
render() {
|
|
42
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];
|
|
43
54
|
return (
|
|
44
|
-
<
|
|
45
|
-
{
|
|
46
|
-
|
|
55
|
+
<ConfigProvider locale={file}>
|
|
56
|
+
<IntlProvider locale={locale} key={locale} messages={messages}>
|
|
57
|
+
{React.Children.only(this.props.children)}
|
|
58
|
+
</IntlProvider>
|
|
59
|
+
</ConfigProvider>
|
|
47
60
|
);
|
|
48
61
|
}
|
|
49
62
|
}
|
|
@@ -78,6 +78,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
78
78
|
selectedChannel: defaultChannel,
|
|
79
79
|
panes,
|
|
80
80
|
};
|
|
81
|
+
this.props.onChannelChange(defaultChannel);
|
|
81
82
|
}
|
|
82
83
|
componentWillReceiveProps(nextProps) {
|
|
83
84
|
if (this.props.channel !== nextProps.channel) {
|
|
@@ -426,7 +426,6 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
426
426
|
|
|
427
427
|
getFormData(formData) {
|
|
428
428
|
let { editTemplateData} = this.state;
|
|
429
|
-
const { formData: stateFormData } = this.state;
|
|
430
429
|
const selectedWeChatAccount = (!isEmpty(this.props.Templates.selectedWeChatAccount) ? this.props.Templates.selectedWeChatAccount : this.props.WeChat.selectedWeChatAccount);
|
|
431
430
|
if (isEmpty(editTemplateData)) {
|
|
432
431
|
editTemplateData = formData;
|
|
@@ -1232,7 +1231,7 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
1232
1231
|
tip={this.props.intl.formatMessage(messages.gettingTemplateData)}
|
|
1233
1232
|
spinning={spinning}>
|
|
1234
1233
|
<div>
|
|
1235
|
-
<CapHeading type="h5"
|
|
1234
|
+
<CapHeading type="h5"><FormattedMessage {...messages.templateName}/></CapHeading>
|
|
1236
1235
|
<CapHeading type="h3">{weChatData.title}</CapHeading>
|
|
1237
1236
|
<CapRow className="wechat-container">
|
|
1238
1237
|
<CapColumn>
|
|
@@ -87,19 +87,23 @@ export default defineMessages({
|
|
|
87
87
|
defaultMessage: "has valid content.",
|
|
88
88
|
},
|
|
89
89
|
"select": {
|
|
90
|
-
id: 'creatives.
|
|
90
|
+
id: 'creatives.containersV2.WeChat.select',
|
|
91
91
|
defaultMessage: 'Select',
|
|
92
92
|
},
|
|
93
93
|
"newWechat": {
|
|
94
|
-
id: 'creatives.
|
|
94
|
+
id: 'creatives.containersV2.WeChat.newWechat',
|
|
95
95
|
defaultMessage: 'New wechat',
|
|
96
96
|
},
|
|
97
97
|
"linkErrorMessage": {
|
|
98
|
-
id: 'creatives.
|
|
98
|
+
id: 'creatives.containersV2.WeChat.linkErrorMessage',
|
|
99
99
|
defaultMessage: 'Link cannot be empty.',
|
|
100
100
|
},
|
|
101
101
|
"hasInvalidContent": {
|
|
102
|
-
id: 'creatives.
|
|
102
|
+
id: 'creatives.containersV2.WeChat.hasInvalidContent',
|
|
103
103
|
defaultMessage: 'has invalid content.',
|
|
104
104
|
},
|
|
105
|
+
"templateName": {
|
|
106
|
+
id: 'creatives.containersV2.WeChat.templateName',
|
|
107
|
+
defaultMessage: 'Template Name',
|
|
108
|
+
},
|
|
105
109
|
});
|