@capillarytech/creatives-library 3.2.4 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app.js +1 -1
- package/components/FormBuilder/index.js +1 -1
- package/components/Header/index.js +4 -3
- package/components/Header/messages.js +4 -0
- package/config/app.js +2 -0
- package/containers/Assets/Gallery/index.js +1 -1
- package/containers/Cap/index.js +4 -5
- package/containers/Email/index.js +2 -2
- package/containers/Email/messages.js +8 -0
- package/containers/LanguageProvider/index.js +28 -4
- package/containers/Templates/index.js +2 -2
- package/containers/Templates/messages.js +24 -4
- package/containers/WeChat/RichmediaTemplates/Create/messages.js +24 -0
- package/i18n.js +16 -9
- package/index.js +6 -0
- package/package.json +1 -4
- package/reducers.js +1 -1
- package/routes.js +2 -1
- package/services/api.js +11 -2
- package/translations/en.json +111 -63
- package/translations/zh.json +108 -60
- package/utils/smsCharCountV2.js +1 -1
- package/v2Components/CapTagList/index.js +2 -2
- package/v2Components/FormBuilder/index.js +7 -4
- package/v2Components/NavigationBar/index.js +9 -10
- package/v2Components/NewCallTask/index.js +3 -1
- package/v2Components/TopBar/index.js +3 -0
- package/v2Components/TopBar/messages.js +8 -0
- package/v2Containers/Assets/Gallery/index.js +1 -1
- package/v2Containers/Assets/Gallery/messages.js +4 -0
- package/v2Containers/CallTask/index.js +3 -1
- package/v2Containers/Cap/index.js +3 -2
- package/v2Containers/CreativesContainer/SlideBoxContent.js +14 -1
- package/v2Containers/CreativesContainer/index.js +6 -1
- package/v2Containers/Email/index.js +10 -7
- package/v2Containers/Email/messages.js +8 -0
- package/v2Containers/EmailWrapper/index.js +12 -9
- package/v2Containers/LanguageProvider/actions.js +9 -4
- package/v2Containers/LanguageProvider/constants.js +7 -1
- package/v2Containers/LanguageProvider/index.js +49 -12
- package/v2Containers/LanguageProvider/reducer.js +11 -9
- package/v2Containers/LanguageProvider/selectors.js +1 -1
- package/v2Containers/MobilePush/Create/index.js +2 -1
- package/v2Containers/MobilePush/Create/messages.js +4 -0
- package/v2Containers/MobilePush/Edit/index.js +2 -1
- package/v2Containers/MobilePush/Edit/messages.js +4 -0
- package/v2Containers/Sms/Create/index.js +3 -1
- package/v2Containers/Sms/Create/messages.js +16 -0
- package/v2Containers/Sms/Edit/index.js +3 -1
- package/v2Containers/Sms/Edit/messages.js +16 -0
- package/v2Containers/TagList/index.js +43 -0
- package/v2Containers/Templates/_templates.scss +9 -1
- package/v2Containers/Templates/index.js +65 -52
- package/v2Containers/TemplatesV2/index.js +54 -54
- package/v2Containers/WeChat/MapTemplates/index.js +0 -1
- package/v2Containers/WeChat/MapTemplates/messages.js +1 -1
- package/v2Containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +10 -0
- package/v2Containers/WeChat/RichmediaTemplates/Create/actions.js +9 -0
- package/v2Containers/WeChat/RichmediaTemplates/Create/constants.js +3 -0
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +146 -4
- package/v2Containers/WeChat/RichmediaTemplates/Create/messages.js +86 -57
- package/v2Containers/WeChat/RichmediaTemplates/Create/reducer.js +24 -1
- package/v2Containers/WeChat/RichmediaTemplates/Create/sagas.js +45 -0
- package/v2Containers/WeChat/RichmediaTemplates/Edit/constants.js +4 -0
- package/v2Containers/WeChat/RichmediaTemplates/Edit/index.js +8 -1
- package/v2Containers/WeChat/Wrapper/_wrapper.scss +9 -1
- package/v2Containers/WeChat/Wrapper/messages.js +5 -5
- package/v2Containers/TemplatesV2/_templatesV2.scss +0 -5
|
@@ -60,6 +60,8 @@ function SlideBoxContent(props) {
|
|
|
60
60
|
onValidationFail,
|
|
61
61
|
channelsToHide,
|
|
62
62
|
forwardedTags,
|
|
63
|
+
selectedOfferDetails,
|
|
64
|
+
channelsToDisable,
|
|
63
65
|
weChatTemplateType,
|
|
64
66
|
onWechatTemplateChange,
|
|
65
67
|
selectedWeChatAccount,
|
|
@@ -113,6 +115,7 @@ function SlideBoxContent(props) {
|
|
|
113
115
|
cap={cap}
|
|
114
116
|
channelsToHide={channelsToHide}
|
|
115
117
|
forwardedTags={forwardedTags}
|
|
118
|
+
channelsToDisable={channelsToDisable}
|
|
116
119
|
/>
|
|
117
120
|
)}
|
|
118
121
|
{isPreview && (
|
|
@@ -174,6 +177,7 @@ function SlideBoxContent(props) {
|
|
|
174
177
|
getDefaultTags={type}
|
|
175
178
|
templateData={templateData}
|
|
176
179
|
forwardedTags={forwardedTags}
|
|
180
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
177
181
|
/>
|
|
178
182
|
)}
|
|
179
183
|
{
|
|
@@ -183,6 +187,7 @@ function SlideBoxContent(props) {
|
|
|
183
187
|
templateData={templateData}
|
|
184
188
|
onCallTaskSubmit={onCallTaskSubmit}
|
|
185
189
|
forwardedTags={forwardedTags}
|
|
190
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
186
191
|
/>
|
|
187
192
|
}
|
|
188
193
|
{
|
|
@@ -191,6 +196,7 @@ function SlideBoxContent(props) {
|
|
|
191
196
|
mode={'create'}
|
|
192
197
|
onCallTaskSubmit={onCallTaskSubmit}
|
|
193
198
|
forwardedTags={forwardedTags}
|
|
199
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
194
200
|
/>
|
|
195
201
|
}
|
|
196
202
|
{isCreateSms && (
|
|
@@ -204,6 +210,7 @@ function SlideBoxContent(props) {
|
|
|
204
210
|
getDefaultTags={type}
|
|
205
211
|
isFullMode={isFullMode}
|
|
206
212
|
forwardedTags={forwardedTags}
|
|
213
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
207
214
|
/>
|
|
208
215
|
)}
|
|
209
216
|
{isEmailCreate && (
|
|
@@ -225,6 +232,7 @@ function SlideBoxContent(props) {
|
|
|
225
232
|
showTemplateName={showTemplateName}
|
|
226
233
|
onValidationFail={onValidationFail}
|
|
227
234
|
forwardedTags={forwardedTags}
|
|
235
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
228
236
|
/>
|
|
229
237
|
)}
|
|
230
238
|
{(isEditEmailWithId || isEmailEditWithContent) && (
|
|
@@ -247,6 +255,7 @@ function SlideBoxContent(props) {
|
|
|
247
255
|
showTemplateName={showTemplateName}
|
|
248
256
|
onValidationFail={onValidationFail}
|
|
249
257
|
forwardedTags={forwardedTags}
|
|
258
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
250
259
|
/>
|
|
251
260
|
)}
|
|
252
261
|
{isEditMPush &&
|
|
@@ -266,6 +275,7 @@ function SlideBoxContent(props) {
|
|
|
266
275
|
getDefaultTags={type}
|
|
267
276
|
onValidationFail={onValidationFail}
|
|
268
277
|
forwardedTags={forwardedTags}
|
|
278
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
269
279
|
/>
|
|
270
280
|
}
|
|
271
281
|
{isCreateMPush &&
|
|
@@ -289,7 +299,8 @@ function SlideBoxContent(props) {
|
|
|
289
299
|
showTemplateName={showTemplateName}
|
|
290
300
|
query={query}
|
|
291
301
|
forwardedTags={forwardedTags}
|
|
292
|
-
onValidationFail={onValidationFail}
|
|
302
|
+
onValidationFail={onValidationFail}
|
|
303
|
+
selectedOfferDetails={selectedOfferDetails}/>
|
|
293
304
|
}
|
|
294
305
|
</CreativesWrapper>
|
|
295
306
|
);
|
|
@@ -323,6 +334,8 @@ SlideBoxContent.propTypes = {
|
|
|
323
334
|
onValidationFail: PropTypes.func,
|
|
324
335
|
channelsToHide: PropTypes.array,
|
|
325
336
|
forwardedTags: PropTypes.object,
|
|
337
|
+
selectedOfferDetails: PropTypes.array,
|
|
338
|
+
channelsToDisable: PropTypes.array,
|
|
326
339
|
weChatTemplateType: PropTypes.string,
|
|
327
340
|
onWechatTemplateChange: PropTypes.func,
|
|
328
341
|
selectedWeChatAccount: PropTypes.object,
|
|
@@ -465,8 +465,9 @@ 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} = this.props;
|
|
468
|
+
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails} = this.props;
|
|
469
469
|
const mapTemplateCreate = slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
470
|
+
/* TODO: Instead of passing down same props separately to each component down, write common function to these props and pass it accordingly */
|
|
470
471
|
return (
|
|
471
472
|
<SlideBoxWrapper className={classnames(`${classPrefix} ${isFullMode ? 'creatives-full-mode' : 'creatives-library-mode'} ${mapTemplateCreate ? 'map-template-create' : ''}`)}>
|
|
472
473
|
<CapSlideBox
|
|
@@ -522,6 +523,8 @@ class Creatives extends React.Component {
|
|
|
522
523
|
onValidationFail={this.onValidationFail}
|
|
523
524
|
channelsToHide={channelsToHide}
|
|
524
525
|
forwardedTags={forwardedTags}
|
|
526
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
527
|
+
channelsToDisable={channelsToDisable}
|
|
525
528
|
weChatTemplateType={weChatTemplateType}
|
|
526
529
|
onWechatTemplateChange={this.onWechatTemplateChange}
|
|
527
530
|
weChatMaptemplateStep={weChatMaptemplateStep}
|
|
@@ -573,6 +576,8 @@ Creatives.propTypes = {
|
|
|
573
576
|
EmailLayout: PropTypes.string,
|
|
574
577
|
channelsToHide: PropTypes.array,
|
|
575
578
|
forwardedTags: PropTypes.object,
|
|
579
|
+
selectedOfferDetails: PropTypes.array,
|
|
580
|
+
channelsToDisable: PropTypes.array,
|
|
576
581
|
selectedWeChatAccount: PropTypes.object,
|
|
577
582
|
};
|
|
578
583
|
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.alert), 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.alert),
|
|
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.alert),
|
|
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.alert), 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.alert),
|
|
1827
1827
|
body: this.props.intl.formatMessage(messages.goBackTemporaryChangesLost),
|
|
1828
1828
|
type: 'confirm',
|
|
1829
1829
|
id: 'template-back-confirm-modal',
|
|
@@ -2559,9 +2559,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2559
2559
|
// const actionComponents = '';
|
|
2560
2560
|
const schema = this.state.schema;
|
|
2561
2561
|
const isLoading = this.isEmailLoading();
|
|
2562
|
-
const previewHeader = (<h3>
|
|
2563
|
-
const imagePreviewHeader = (<h3>
|
|
2562
|
+
const previewHeader = (<h3>{this.props.intl.formatMessage(messages.h3emailPreview)}</h3>);
|
|
2563
|
+
const imagePreviewHeader = (<h3>{this.props.intl.formatMessage(messages.h3imageSelection)}</h3>);
|
|
2564
2564
|
const imagePreviewContent = this.getImagePreviewContent();
|
|
2565
|
+
const { selectedOfferDetails } = this.props;
|
|
2565
2566
|
if (!this.props.currentOrgDetails || !this.props.currentOrgDetails.basic_details) {
|
|
2566
2567
|
return (<div>Loading...</div>);
|
|
2567
2568
|
}
|
|
@@ -2617,6 +2618,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2617
2618
|
getValidationData={this.saveValidationData}
|
|
2618
2619
|
saveForm={this.state.saveForm}
|
|
2619
2620
|
stopValidation={this.stopValidation}
|
|
2621
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
2620
2622
|
/> : ''}
|
|
2621
2623
|
</Col>
|
|
2622
2624
|
</Row>
|
|
@@ -2669,6 +2671,7 @@ Email.propTypes = {
|
|
|
2669
2671
|
defaultData: PropTypes.object,
|
|
2670
2672
|
showTemplateName: PropTypes.func,
|
|
2671
2673
|
onValidationFail: PropTypes.func,
|
|
2674
|
+
selectedOfferDetails: PropTypes.array,
|
|
2672
2675
|
};
|
|
2673
2676
|
|
|
2674
2677
|
const mapStateToProps = (state, props) => createStructuredSelector({
|
|
@@ -278,4 +278,12 @@ export default defineMessages({
|
|
|
278
278
|
id: 'creatives.containersV2.Email.alertMessage',
|
|
279
279
|
defaultMessage: 'Alert',
|
|
280
280
|
},
|
|
281
|
+
"h3emailPreview": {
|
|
282
|
+
id: 'creatives.containersV2.Email.h3emailPreview',
|
|
283
|
+
defaultMessage: 'Email preview',
|
|
284
|
+
},
|
|
285
|
+
"h3imageSelection": {
|
|
286
|
+
id: 'creatives.containersV2.Email.h3imageSelection',
|
|
287
|
+
defaultMessage: 'Image selection',
|
|
288
|
+
},
|
|
281
289
|
});
|
|
@@ -173,6 +173,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
173
173
|
setIsLoadingContent,
|
|
174
174
|
onValidationFail,
|
|
175
175
|
forwardedTags,
|
|
176
|
+
selectedOfferDetails,
|
|
176
177
|
} = this.props;
|
|
177
178
|
const {
|
|
178
179
|
templateName,
|
|
@@ -203,15 +204,15 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
203
204
|
</CardContainer>
|
|
204
205
|
<div>
|
|
205
206
|
{emailCreateMode === "upload" &&
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
207
|
+
<div style={{ marginLeft: '8px' }}>
|
|
208
|
+
<CapUploader onChange={this.useFileUpload} accept=".zip, .html, .htm" showUploadList={false}>
|
|
209
|
+
<CapButton>{this.props.intl.formatMessage(messages.upload)}</CapButton>
|
|
210
|
+
</CapUploader>
|
|
211
|
+
{!_.isEmpty(EmailLayout) &&
|
|
212
|
+
<div>{_.get(modeContent, "file.name")}</div>
|
|
213
|
+
}
|
|
214
|
+
</div>
|
|
215
|
+
}
|
|
215
216
|
</div>
|
|
216
217
|
</div>
|
|
217
218
|
:
|
|
@@ -232,6 +233,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
232
233
|
showTemplateName={showTemplateName}
|
|
233
234
|
onValidationFail={onValidationFail}
|
|
234
235
|
forwardedTags={forwardedTags}
|
|
236
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
235
237
|
/>}
|
|
236
238
|
{CmsTemplates && !isShowEmailCreate && <CmsTemplatesComponent cmsTemplates={CmsTemplates} handleEdmDefaultTemplateSelection={this.useEditor} />}
|
|
237
239
|
</div>
|
|
@@ -263,6 +265,7 @@ EmailWrapper.propTypes = {
|
|
|
263
265
|
showTemplateName: PropTypes.func,
|
|
264
266
|
onValidationFail: PropTypes.func,
|
|
265
267
|
forwardedTags: PropTypes.object,
|
|
268
|
+
selectedOfferDetails: PropTypes.array,
|
|
266
269
|
};
|
|
267
270
|
|
|
268
271
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -4,14 +4,19 @@
|
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
CHANGE_LOCALE,
|
|
9
|
-
} from './constants';
|
|
7
|
+
import * as types from './constants';
|
|
10
8
|
|
|
11
9
|
export function changeLocale(languageLocale) {
|
|
12
10
|
console.log('trying to change locale', languageLocale);
|
|
13
11
|
return {
|
|
14
|
-
type: CHANGE_LOCALE,
|
|
12
|
+
type: types.CHANGE_LOCALE,
|
|
15
13
|
locale: languageLocale,
|
|
16
14
|
};
|
|
17
15
|
}
|
|
16
|
+
|
|
17
|
+
export function getLocizMessage(locale) {
|
|
18
|
+
return {
|
|
19
|
+
type: types.GET_LOCIZ_MESSAGE_REQUEST,
|
|
20
|
+
locale,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -4,5 +4,11 @@
|
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
export const CHANGE_LOCALE = 'app/LanguageToggle/CHANGE_LOCALE';
|
|
8
7
|
export const DEFAULT_LOCALE = 'en';
|
|
8
|
+
|
|
9
|
+
export const GET_LOCIZ_MESSAGE_REQUEST =
|
|
10
|
+
'app/LanguageProvider/GET_LOCIZ_MESSAGE_REQUEST';
|
|
11
|
+
export const GET_LOCIZ_MESSAGE_SUCCESS =
|
|
12
|
+
'app/LanguageProvider/GET_LOCIZ_MESSAGE_SUCCESS';
|
|
13
|
+
export const GET_LOCIZ_MESSAGE_FAILURE =
|
|
14
|
+
'app/LanguageProvider/GET_LOCIZ_MESSAGE_FAILURE';
|
|
@@ -9,37 +9,74 @@
|
|
|
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
|
-
import {
|
|
16
|
+
import { createStructuredSelector } from 'reselect';
|
|
14
17
|
import { IntlProvider } from 'react-intl';
|
|
15
|
-
|
|
18
|
+
import moment from 'moment';
|
|
19
|
+
import { bindActionCreators } from 'redux';
|
|
20
|
+
import * as actions from './actions';
|
|
16
21
|
import { makeSelectLocale } from './selectors';
|
|
17
22
|
|
|
23
|
+
|
|
18
24
|
export class LanguageProvider extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
|
|
25
|
+
componentDidMount() {
|
|
26
|
+
const user = localStorage.getItem('user');
|
|
27
|
+
let locale = localStorage.getItem('jlocale') || 'en';
|
|
28
|
+
moment.locale(locale);
|
|
29
|
+
if (user) {
|
|
30
|
+
locale = JSON.parse(user).lang;
|
|
31
|
+
}
|
|
32
|
+
locale = this.getMappedLocale(locale);
|
|
33
|
+
this.props.actions.getLocizMessage(locale);
|
|
34
|
+
}
|
|
35
|
+
/*global getMappedLocale */
|
|
36
|
+
getMappedLocale = (locale) => {
|
|
37
|
+
const map = {
|
|
38
|
+
'en': 'en-US',
|
|
39
|
+
'zh-cn': 'zh',
|
|
40
|
+
'zh': 'zh',
|
|
41
|
+
'en-US': 'en-US',
|
|
42
|
+
};
|
|
43
|
+
return map[locale];
|
|
44
|
+
};
|
|
45
|
+
|
|
19
46
|
render() {
|
|
47
|
+
const { locale, messages} = this.props.language;
|
|
48
|
+
const mappedLocale = {
|
|
49
|
+
'en': enUS,
|
|
50
|
+
'zh-cn': zhCN,
|
|
51
|
+
'en-US': enUS,
|
|
52
|
+
'zh': zhCN,
|
|
53
|
+
};
|
|
54
|
+
const jLocale = localStorage.getItem('jlocale') || 'en';
|
|
55
|
+
const file = mappedLocale[jLocale];
|
|
20
56
|
return (
|
|
21
|
-
<
|
|
22
|
-
{
|
|
23
|
-
|
|
57
|
+
<ConfigProvider locale={file}>
|
|
58
|
+
<IntlProvider locale={locale} key={locale} messages={messages}>
|
|
59
|
+
{React.Children.only(this.props.children)}
|
|
60
|
+
</IntlProvider>
|
|
61
|
+
</ConfigProvider>
|
|
24
62
|
);
|
|
25
63
|
}
|
|
26
64
|
}
|
|
27
65
|
|
|
28
66
|
LanguageProvider.propTypes = {
|
|
29
|
-
|
|
30
|
-
|
|
67
|
+
language: PropTypes.object,
|
|
68
|
+
actions: PropTypes.object,
|
|
31
69
|
children: PropTypes.element.isRequired,
|
|
32
70
|
};
|
|
33
71
|
|
|
34
72
|
|
|
35
|
-
const mapStateToProps =
|
|
36
|
-
makeSelectLocale(),
|
|
37
|
-
|
|
38
|
-
);
|
|
73
|
+
const mapStateToProps = createStructuredSelector({
|
|
74
|
+
language: makeSelectLocale(),
|
|
75
|
+
});
|
|
39
76
|
|
|
40
77
|
function mapDispatchToProps(dispatch) {
|
|
41
78
|
return {
|
|
42
|
-
dispatch,
|
|
79
|
+
actions: bindActionCreators(actions, dispatch),
|
|
43
80
|
};
|
|
44
81
|
}
|
|
45
82
|
|
|
@@ -6,22 +6,24 @@
|
|
|
6
6
|
|
|
7
7
|
import { fromJS } from 'immutable';
|
|
8
8
|
|
|
9
|
-
import
|
|
10
|
-
CHANGE_LOCALE,
|
|
11
|
-
} from './constants';
|
|
12
|
-
import {
|
|
13
|
-
DEFAULT_LOCALE,
|
|
14
|
-
} from '../Cap/constants'; // eslint-disable-line
|
|
9
|
+
import * as types from './constants';
|
|
15
10
|
|
|
16
11
|
const initialState = fromJS({
|
|
17
|
-
locale: DEFAULT_LOCALE,
|
|
12
|
+
locale: types.DEFAULT_LOCALE,
|
|
13
|
+
messages: {},
|
|
14
|
+
localeLoading: false,
|
|
18
15
|
});
|
|
19
16
|
|
|
20
17
|
function languageProviderReducer(state = initialState, action) {
|
|
21
18
|
switch (action.type) {
|
|
22
|
-
case
|
|
19
|
+
case types.GET_LOCIZ_MESSAGE_REQUEST:
|
|
20
|
+
return state.set('localeLoading', true);
|
|
21
|
+
case types.GET_LOCIZ_MESSAGE_SUCCESS:
|
|
23
22
|
return state
|
|
24
|
-
.set('
|
|
23
|
+
.set('localeLoading', false)
|
|
24
|
+
.set('messages', fromJS(action.data));
|
|
25
|
+
case types.GET_LOCIZ_MESSAGE_FAILURE:
|
|
26
|
+
return state.set('localeLoading', false);
|
|
25
27
|
default:
|
|
26
28
|
return state;
|
|
27
29
|
}
|
|
@@ -978,7 +978,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
978
978
|
size={"label"}/>
|
|
979
979
|
</CapColumn>
|
|
980
980
|
<CapColumn span={6}>
|
|
981
|
-
<CapLink title=
|
|
981
|
+
<CapLink title={this.props.intl.formatMessage(messages.change)} onClick={() => this.addSecondoryCtaIos(true, this.state.formData, {id: "add-sec-cta-ios"})}/>
|
|
982
982
|
</CapColumn>
|
|
983
983
|
</CapRow>,
|
|
984
984
|
primitive: true,
|
|
@@ -1705,6 +1705,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1705
1705
|
setModalContent={this.setModalContent}
|
|
1706
1706
|
startValidation={this.state.startValidation}
|
|
1707
1707
|
stopValidation={this.stopValidation}
|
|
1708
|
+
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
1708
1709
|
/>
|
|
1709
1710
|
</CapColumn>
|
|
1710
1711
|
{this.props.iosCtasData && this.state.showIosCtaTable &&
|
|
@@ -967,7 +967,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
967
967
|
size={"label"}/>
|
|
968
968
|
</CapColumn>
|
|
969
969
|
<CapColumn span={6}>
|
|
970
|
-
<CapLink title=
|
|
970
|
+
<CapLink title={this.props.intl.formatMessage(messages.change)} onClick={() => this.addSecondoryCtaIos(true, this.state.formData, {id: "add-sec-cta-ios"})}/>
|
|
971
971
|
</CapColumn>
|
|
972
972
|
</CapRow>,
|
|
973
973
|
primitive: true,
|
|
@@ -1792,6 +1792,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1792
1792
|
setModalContent={this.setModalContent}
|
|
1793
1793
|
startValidation={this.state.startValidation}
|
|
1794
1794
|
stopValidation={this.stopValidation}
|
|
1795
|
+
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
1795
1796
|
/>}
|
|
1796
1797
|
</CapColumn>
|
|
1797
1798
|
{this.props.iosCtasData && this.state.showIosCtaTable &&
|
|
@@ -176,7 +176,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
176
176
|
const unicodeEnabled = _.get(this.state, `formData[0]['unicode-validity']`);
|
|
177
177
|
const smsDetails = updateCharCount(content || "", unicodeEnabled || false);
|
|
178
178
|
if (this.smsCount.current) {
|
|
179
|
-
this.smsCount.current.innerText = `${smsDetails.parts}
|
|
179
|
+
this.smsCount.current.innerText = `${smsDetails.parts}${this.props.intl.formatMessage(messages.sms)} (${smsDetails.chars_used} ${this.props.intl.formatMessage(messages.characters)})`;
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
|
|
@@ -970,6 +970,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
970
970
|
router={this.props.router}
|
|
971
971
|
startValidation={this.state.startValidation}
|
|
972
972
|
stopValidation={this.stopValidation}
|
|
973
|
+
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
973
974
|
/>
|
|
974
975
|
</CapColumn>
|
|
975
976
|
</CapRow>
|
|
@@ -995,6 +996,7 @@ Create.propTypes = {
|
|
|
995
996
|
isFullMode: PropTypes.bool,
|
|
996
997
|
getFormSubscriptionData: PropTypes.func,
|
|
997
998
|
isLoadingMetaEntities: PropTypes.bool,
|
|
999
|
+
selectedOfferDetails: PropTypes.array,
|
|
998
1000
|
};
|
|
999
1001
|
|
|
1000
1002
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -110,4 +110,20 @@ export default defineMessages({
|
|
|
110
110
|
id: 'creatives.containersV2.Create.templateNotValid',
|
|
111
111
|
defaultMessage: 'Template data is not valid',
|
|
112
112
|
},
|
|
113
|
+
"Creative name": {
|
|
114
|
+
id: 'creatives.containersV2.Create.creativeName',
|
|
115
|
+
defaultMessage: 'Creative name',
|
|
116
|
+
},
|
|
117
|
+
"Add label": {
|
|
118
|
+
id: 'creatives.containersV2.Create.addLabel',
|
|
119
|
+
defaultMessage: 'Add label',
|
|
120
|
+
},
|
|
121
|
+
"sms": {
|
|
122
|
+
id: 'creatives.containersV2.Create.sms',
|
|
123
|
+
defaultMessage: 'SMS',
|
|
124
|
+
},
|
|
125
|
+
"characters" : {
|
|
126
|
+
id: 'creatives.containersV2.Create.characters',
|
|
127
|
+
defaultMessage: 'characters',
|
|
128
|
+
},
|
|
113
129
|
});
|
|
@@ -194,7 +194,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
194
194
|
const unicodeEnabled = _.get(this.state, `formData[0]['unicode-validity']`);
|
|
195
195
|
const smsDetails = updateCharCount(content || "", unicodeEnabled || false);
|
|
196
196
|
if (this.smsCount.current) {
|
|
197
|
-
this.smsCount.current.innerText = `${smsDetails.parts}
|
|
197
|
+
this.smsCount.current.innerText = `${smsDetails.parts}${this.props.intl.formatMessage(messages.sms)} (${smsDetails.chars_used} ${this.props.intl.formatMessage(messages.characters)})`;
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
|
|
@@ -966,6 +966,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
966
966
|
router={this.props.router}
|
|
967
967
|
startValidation={this.state.startValidation}
|
|
968
968
|
stopValidation={this.stopValidation}
|
|
969
|
+
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
969
970
|
/>
|
|
970
971
|
</CapColumn>
|
|
971
972
|
</CapRow>
|
|
@@ -994,6 +995,7 @@ Edit.propTypes = {
|
|
|
994
995
|
setIsLoadingContent: PropTypes.func,
|
|
995
996
|
// route: PropTypes.object,
|
|
996
997
|
injectedTags: PropTypes.object,
|
|
998
|
+
selectedOfferDetails: PropTypes.array,
|
|
997
999
|
};
|
|
998
1000
|
|
|
999
1001
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -102,4 +102,20 @@ export default defineMessages({
|
|
|
102
102
|
id: 'creatives.containersV2.Edit.templateMarkedSuccessfully',
|
|
103
103
|
defaultMessage: "Template Marked as Final Successfully",
|
|
104
104
|
},
|
|
105
|
+
"Creative name": {
|
|
106
|
+
id: 'creatives.containersV2.Edit.creativeName',
|
|
107
|
+
defaultMessage: 'Creative name',
|
|
108
|
+
},
|
|
109
|
+
"Add label": {
|
|
110
|
+
id: 'creatives.containersV2.Edit.addLabel',
|
|
111
|
+
defaultMessage: 'Add label',
|
|
112
|
+
},
|
|
113
|
+
"sms": {
|
|
114
|
+
id: 'creatives.containersV2.Edit.sms',
|
|
115
|
+
defaultMessage: 'SMS',
|
|
116
|
+
},
|
|
117
|
+
"characters" : {
|
|
118
|
+
id: 'creatives.containersV2.Edit.characters',
|
|
119
|
+
defaultMessage: 'characters',
|
|
120
|
+
},
|
|
105
121
|
});
|
|
@@ -31,6 +31,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
31
31
|
this.populateTags = this.populateTags.bind(this);
|
|
32
32
|
this.populateTagForChildren = this.populateTagForChildren.bind(this);
|
|
33
33
|
this.transformInjectedTags = this.transformInjectedTags.bind(this);
|
|
34
|
+
this.transformCouponTags = this.transformCouponTags.bind(this);
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
componentDidMount() {
|
|
@@ -138,6 +139,44 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
138
139
|
return tagsObject[tagValue];
|
|
139
140
|
}
|
|
140
141
|
|
|
142
|
+
transformCouponTags(offerDetails, allTags) {
|
|
143
|
+
const couponTags = {};
|
|
144
|
+
const couponTagsKeys = Object.keys(_.get(allTags, 'coupon.subtags', []));
|
|
145
|
+
const withCouponId = (obj, id) => {
|
|
146
|
+
const tempObj = {};
|
|
147
|
+
if (obj.subtags) {
|
|
148
|
+
tempObj.subtags = _.mapValues(obj.subtags, (tag) => ({
|
|
149
|
+
...withCouponId(tag, id),
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
...obj,
|
|
154
|
+
...tempObj,
|
|
155
|
+
couponSeriesId: id,
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
offerDetails.forEach((offer) => {
|
|
159
|
+
const { id, couponName } = offer;
|
|
160
|
+
const couponSubTags = {};
|
|
161
|
+
couponTagsKeys.forEach((couponTagKey) => {
|
|
162
|
+
const couponSubTagsObj = withCouponId(allTags.coupon.subtags[couponTagKey], id);
|
|
163
|
+
couponSubTags[couponTagKey] = couponSubTagsObj;
|
|
164
|
+
});
|
|
165
|
+
const key = couponName || id;
|
|
166
|
+
couponTags[key] = {
|
|
167
|
+
'tag-header': true,
|
|
168
|
+
'name': couponName || id,
|
|
169
|
+
'desc': couponName || id,
|
|
170
|
+
'couponSeriesId': id,
|
|
171
|
+
'subtags': couponSubTags,
|
|
172
|
+
'resolved': true,
|
|
173
|
+
'couponTags': true,
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
// eslint-disable-next-line no-param-reassign
|
|
177
|
+
allTags.coupon.subtags = couponTags;
|
|
178
|
+
}
|
|
179
|
+
|
|
141
180
|
transformInjectedTags(tags) {
|
|
142
181
|
_.forEach(tags, (tag) => {
|
|
143
182
|
const temp = tag;
|
|
@@ -189,6 +228,9 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
189
228
|
tags = this.populateTags(this.props.tags);
|
|
190
229
|
console.log('populating tags', tags);
|
|
191
230
|
}
|
|
231
|
+
if (this.props.selectedOfferDetails && !_.isEmpty(this.props.selectedOfferDetails) && (tags && tags.coupon)) {
|
|
232
|
+
this.transformCouponTags(this.props.selectedOfferDetails, tags);
|
|
233
|
+
}
|
|
192
234
|
tags = _.merge( {}, tags, injectedTags);
|
|
193
235
|
console.log('merged tags', tags);
|
|
194
236
|
return (
|
|
@@ -220,6 +262,7 @@ TagList.propTypes = {
|
|
|
220
262
|
moduleFilterEnabled: PropTypes.bool,
|
|
221
263
|
className: PropTypes.string,
|
|
222
264
|
userLocale: PropTypes.string,
|
|
265
|
+
selectedOfferDetails: PropTypes.array,
|
|
223
266
|
};
|
|
224
267
|
|
|
225
268
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
@import '~@capillarytech/cap-ui-library/styles/_variables.scss';
|
|
2
|
+
|
|
3
|
+
.ant-tabs-content{
|
|
2
4
|
margin-top: 16px;
|
|
3
5
|
.ant-tabs-tabpane-active{
|
|
4
6
|
padding: unset;
|
|
@@ -16,6 +18,12 @@
|
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
|
|
21
|
+
.ant-radio-group.#{cap-radioCard-v2} {
|
|
22
|
+
.ant-radio-button-wrapper {
|
|
23
|
+
border: 1px solid $CAP_G07;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
19
27
|
.card-title {
|
|
20
28
|
line-height: 24px;
|
|
21
29
|
font-size: 14px;
|