@capillarytech/creatives-library 3.1.47 → 3.2.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 +3 -4
- package/components/Header/messages.js +0 -4
- package/config/app.js +2 -4
- package/containers/Assets/Gallery/index.js +1 -1
- package/containers/Cap/index.js +5 -4
- package/containers/Email/index.js +2 -2
- package/containers/Email/messages.js +0 -8
- package/containers/LanguageProvider/index.js +4 -28
- package/containers/Templates/index.js +2 -2
- package/containers/Templates/messages.js +4 -24
- package/containers/WeChat/MapTemplates/messages.js +0 -4
- package/containers/WeChat/RichmediaTemplates/Create/messages.js +0 -24
- package/i18n.js +9 -16
- 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 +56 -110
- package/translations/zh.json +53 -107
- package/utils/smsCharCountV2.js +1 -1
- package/v2Components/CapTagList/index.js +2 -2
- package/v2Components/FormBuilder/index.js +4 -7
- package/v2Components/NavigationBar/index.js +10 -9
- package/v2Components/NewCallTask/index.js +1 -3
- package/v2Components/TopBar/index.js +0 -3
- package/v2Components/TopBar/messages.js +0 -8
- package/v2Containers/Assets/Gallery/index.js +1 -1
- package/v2Containers/Assets/Gallery/messages.js +0 -4
- package/v2Containers/CallTask/index.js +1 -3
- package/v2Containers/Cap/index.js +2 -3
- package/v2Containers/CreativesContainer/SlideBoxContent.js +1 -14
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +1 -2
- package/v2Containers/CreativesContainer/index.js +2 -10
- package/v2Containers/CreativesContainer/index.scss +3 -6
- package/v2Containers/Email/index.js +7 -10
- package/v2Containers/Email/messages.js +0 -8
- package/v2Containers/EmailWrapper/index.js +9 -12
- package/v2Containers/LanguageProvider/actions.js +4 -9
- package/v2Containers/LanguageProvider/constants.js +1 -7
- package/v2Containers/LanguageProvider/index.js +12 -49
- package/v2Containers/LanguageProvider/reducer.js +9 -11
- package/v2Containers/LanguageProvider/selectors.js +1 -1
- package/v2Containers/MobilePush/Create/index.js +1 -2
- package/v2Containers/MobilePush/Create/messages.js +0 -4
- package/v2Containers/MobilePush/Edit/index.js +1 -2
- package/v2Containers/MobilePush/Edit/messages.js +0 -4
- package/v2Containers/Sms/Create/index.js +1 -3
- package/v2Containers/Sms/Create/messages.js +0 -16
- package/v2Containers/Sms/Edit/index.js +1 -3
- package/v2Containers/Sms/Edit/messages.js +0 -16
- package/v2Containers/TagList/index.js +0 -43
- package/v2Containers/Templates/_templates.scss +1 -9
- package/v2Containers/Templates/index.js +52 -65
- package/v2Containers/TemplatesV2/_templatesV2.scss +5 -0
- package/v2Containers/TemplatesV2/index.js +54 -54
- package/v2Containers/WeChat/MapTemplates/index.js +7 -2
- package/v2Containers/WeChat/MapTemplates/messages.js +5 -9
- package/v2Containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +0 -10
- package/v2Containers/WeChat/RichmediaTemplates/Create/actions.js +0 -9
- package/v2Containers/WeChat/RichmediaTemplates/Create/constants.js +0 -3
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +21 -154
- package/v2Containers/WeChat/RichmediaTemplates/Create/messages.js +46 -119
- package/v2Containers/WeChat/RichmediaTemplates/Create/reducer.js +1 -24
- package/v2Containers/WeChat/RichmediaTemplates/Create/sagas.js +1 -46
- package/v2Containers/WeChat/RichmediaTemplates/Edit/constants.js +0 -4
- package/v2Containers/WeChat/RichmediaTemplates/Edit/index.js +1 -8
- package/v2Containers/WeChat/RichmediaTemplates/View/index.js +7 -0
- package/v2Containers/WeChat/Wrapper/_wrapper.scss +1 -9
- package/v2Containers/WeChat/Wrapper/messages.js +5 -5
- package/hoc/withStyles.js +0 -12
- package/v2Containers/LanguageProvider/sagas.js +0 -39
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +0 -29
|
@@ -60,8 +60,6 @@ function SlideBoxContent(props) {
|
|
|
60
60
|
onValidationFail,
|
|
61
61
|
channelsToHide,
|
|
62
62
|
forwardedTags,
|
|
63
|
-
selectedOfferDetails,
|
|
64
|
-
channelsToDisable,
|
|
65
63
|
weChatTemplateType,
|
|
66
64
|
onWechatTemplateChange,
|
|
67
65
|
selectedWeChatAccount,
|
|
@@ -115,7 +113,6 @@ function SlideBoxContent(props) {
|
|
|
115
113
|
cap={cap}
|
|
116
114
|
channelsToHide={channelsToHide}
|
|
117
115
|
forwardedTags={forwardedTags}
|
|
118
|
-
channelsToDisable={channelsToDisable}
|
|
119
116
|
/>
|
|
120
117
|
)}
|
|
121
118
|
{isPreview && (
|
|
@@ -177,7 +174,6 @@ function SlideBoxContent(props) {
|
|
|
177
174
|
getDefaultTags={type}
|
|
178
175
|
templateData={templateData}
|
|
179
176
|
forwardedTags={forwardedTags}
|
|
180
|
-
selectedOfferDetails={selectedOfferDetails}
|
|
181
177
|
/>
|
|
182
178
|
)}
|
|
183
179
|
{
|
|
@@ -187,7 +183,6 @@ function SlideBoxContent(props) {
|
|
|
187
183
|
templateData={templateData}
|
|
188
184
|
onCallTaskSubmit={onCallTaskSubmit}
|
|
189
185
|
forwardedTags={forwardedTags}
|
|
190
|
-
selectedOfferDetails={selectedOfferDetails}
|
|
191
186
|
/>
|
|
192
187
|
}
|
|
193
188
|
{
|
|
@@ -196,7 +191,6 @@ function SlideBoxContent(props) {
|
|
|
196
191
|
mode={'create'}
|
|
197
192
|
onCallTaskSubmit={onCallTaskSubmit}
|
|
198
193
|
forwardedTags={forwardedTags}
|
|
199
|
-
selectedOfferDetails={selectedOfferDetails}
|
|
200
194
|
/>
|
|
201
195
|
}
|
|
202
196
|
{isCreateSms && (
|
|
@@ -210,7 +204,6 @@ function SlideBoxContent(props) {
|
|
|
210
204
|
getDefaultTags={type}
|
|
211
205
|
isFullMode={isFullMode}
|
|
212
206
|
forwardedTags={forwardedTags}
|
|
213
|
-
selectedOfferDetails={selectedOfferDetails}
|
|
214
207
|
/>
|
|
215
208
|
)}
|
|
216
209
|
{isEmailCreate && (
|
|
@@ -232,7 +225,6 @@ function SlideBoxContent(props) {
|
|
|
232
225
|
showTemplateName={showTemplateName}
|
|
233
226
|
onValidationFail={onValidationFail}
|
|
234
227
|
forwardedTags={forwardedTags}
|
|
235
|
-
selectedOfferDetails={selectedOfferDetails}
|
|
236
228
|
/>
|
|
237
229
|
)}
|
|
238
230
|
{(isEditEmailWithId || isEmailEditWithContent) && (
|
|
@@ -255,7 +247,6 @@ function SlideBoxContent(props) {
|
|
|
255
247
|
showTemplateName={showTemplateName}
|
|
256
248
|
onValidationFail={onValidationFail}
|
|
257
249
|
forwardedTags={forwardedTags}
|
|
258
|
-
selectedOfferDetails={selectedOfferDetails}
|
|
259
250
|
/>
|
|
260
251
|
)}
|
|
261
252
|
{isEditMPush &&
|
|
@@ -275,7 +266,6 @@ function SlideBoxContent(props) {
|
|
|
275
266
|
getDefaultTags={type}
|
|
276
267
|
onValidationFail={onValidationFail}
|
|
277
268
|
forwardedTags={forwardedTags}
|
|
278
|
-
selectedOfferDetails={selectedOfferDetails}
|
|
279
269
|
/>
|
|
280
270
|
}
|
|
281
271
|
{isCreateMPush &&
|
|
@@ -299,8 +289,7 @@ function SlideBoxContent(props) {
|
|
|
299
289
|
showTemplateName={showTemplateName}
|
|
300
290
|
query={query}
|
|
301
291
|
forwardedTags={forwardedTags}
|
|
302
|
-
onValidationFail={onValidationFail}
|
|
303
|
-
selectedOfferDetails={selectedOfferDetails}/>
|
|
292
|
+
onValidationFail={onValidationFail}/>
|
|
304
293
|
}
|
|
305
294
|
</CreativesWrapper>
|
|
306
295
|
);
|
|
@@ -334,8 +323,6 @@ SlideBoxContent.propTypes = {
|
|
|
334
323
|
onValidationFail: PropTypes.func,
|
|
335
324
|
channelsToHide: PropTypes.array,
|
|
336
325
|
forwardedTags: PropTypes.object,
|
|
337
|
-
selectedOfferDetails: PropTypes.array,
|
|
338
|
-
channelsToDisable: PropTypes.array,
|
|
339
326
|
weChatTemplateType: PropTypes.string,
|
|
340
327
|
onWechatTemplateChange: PropTypes.func,
|
|
341
328
|
selectedWeChatAccount: PropTypes.object,
|
|
@@ -21,7 +21,6 @@ function getChannelLabel(channel) {
|
|
|
21
21
|
function SlideBoxHeader(props) {
|
|
22
22
|
const { slidBoxContent, templateData, onShowTemplates, creativesMode, isFullMode, showPrefix, shouldShowTemplateName, channel, templateNameRenderProp, weChatTemplateType, onWeChatMaptemplateStepChange, weChatMaptemplateStep, templateStep } = props;
|
|
23
23
|
const showTemplateNameHeader = isFullMode && shouldShowTemplateName;
|
|
24
|
-
const mapTemplateCreate = !showTemplateNameHeader && slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
25
24
|
return (
|
|
26
25
|
<div key="creatives-container-slidebox-header-content">
|
|
27
26
|
{slidBoxContent === 'templates' && !showTemplateNameHeader && (
|
|
@@ -66,7 +65,7 @@ function SlideBoxHeader(props) {
|
|
|
66
65
|
}
|
|
67
66
|
/>
|
|
68
67
|
)}
|
|
69
|
-
{
|
|
68
|
+
{!showTemplateNameHeader && slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection' && (
|
|
70
69
|
<CapSteps
|
|
71
70
|
onChange={onWeChatMaptemplateStepChange}
|
|
72
71
|
current={weChatMaptemplateStep}
|
|
@@ -24,8 +24,6 @@ import * as templateActions from '../Templates/actions';
|
|
|
24
24
|
import * as globalActions from '../Cap/actions';
|
|
25
25
|
import {isLoading as isLoadingSelector} from './selectors';
|
|
26
26
|
import messages from './messages';
|
|
27
|
-
import { MAP_TEMPLATE } from '../WeChat/Wrapper/constants';
|
|
28
|
-
|
|
29
27
|
const classPrefix = 'add-creatives-section';
|
|
30
28
|
|
|
31
29
|
const SlideBoxWrapper = styled.div`
|
|
@@ -465,11 +463,9 @@ class Creatives extends React.Component {
|
|
|
465
463
|
}
|
|
466
464
|
render() {
|
|
467
465
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
|
|
468
|
-
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags
|
|
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 */
|
|
466
|
+
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags} = this.props;
|
|
471
467
|
return (
|
|
472
|
-
<SlideBoxWrapper className={classnames(`${classPrefix} ${isFullMode ? 'creatives-full-mode' : 'creatives-library-mode'}
|
|
468
|
+
<SlideBoxWrapper className={classnames(`${classPrefix} ${isFullMode ? 'creatives-full-mode' : 'creatives-library-mode'}`)}>
|
|
473
469
|
<CapSlideBox
|
|
474
470
|
header={
|
|
475
471
|
<SlideBoxHeader
|
|
@@ -523,8 +519,6 @@ class Creatives extends React.Component {
|
|
|
523
519
|
onValidationFail={this.onValidationFail}
|
|
524
520
|
channelsToHide={channelsToHide}
|
|
525
521
|
forwardedTags={forwardedTags}
|
|
526
|
-
selectedOfferDetails={selectedOfferDetails}
|
|
527
|
-
channelsToDisable={channelsToDisable}
|
|
528
522
|
weChatTemplateType={weChatTemplateType}
|
|
529
523
|
onWechatTemplateChange={this.onWechatTemplateChange}
|
|
530
524
|
weChatMaptemplateStep={weChatMaptemplateStep}
|
|
@@ -576,8 +570,6 @@ Creatives.propTypes = {
|
|
|
576
570
|
EmailLayout: PropTypes.string,
|
|
577
571
|
channelsToHide: PropTypes.array,
|
|
578
572
|
forwardedTags: PropTypes.object,
|
|
579
|
-
selectedOfferDetails: PropTypes.array,
|
|
580
|
-
channelsToDisable: PropTypes.array,
|
|
581
573
|
selectedWeChatAccount: PropTypes.object,
|
|
582
574
|
};
|
|
583
575
|
const mapStatesToProps = () => createStructuredSelector({
|
|
@@ -24,6 +24,9 @@ $classPrefix: add-creatives-section;
|
|
|
24
24
|
width: 100%;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
+
.slidebox-header div:first-child {
|
|
28
|
+
width: 100%;
|
|
29
|
+
}
|
|
27
30
|
.wechat-steps {
|
|
28
31
|
width: 40% !important;
|
|
29
32
|
left: 20%;
|
|
@@ -36,10 +39,4 @@ $classPrefix: add-creatives-section;
|
|
|
36
39
|
padding-top: 4px;
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.map-template-create {
|
|
42
|
-
.slidebox-header div:first-child {
|
|
43
|
-
width: 100%;
|
|
44
|
-
}
|
|
45
42
|
}
|
|
@@ -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',
|
|
@@ -2559,10 +2559,9 @@ 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>Email Preview</h3>);
|
|
2563
|
+
const imagePreviewHeader = (<h3>Image Selection</h3>);
|
|
2564
2564
|
const imagePreviewContent = this.getImagePreviewContent();
|
|
2565
|
-
const { selectedOfferDetails } = this.props;
|
|
2566
2565
|
if (!this.props.currentOrgDetails || !this.props.currentOrgDetails.basic_details) {
|
|
2567
2566
|
return (<div>Loading...</div>);
|
|
2568
2567
|
}
|
|
@@ -2618,7 +2617,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2618
2617
|
getValidationData={this.saveValidationData}
|
|
2619
2618
|
saveForm={this.state.saveForm}
|
|
2620
2619
|
stopValidation={this.stopValidation}
|
|
2621
|
-
selectedOfferDetails={selectedOfferDetails}
|
|
2622
2620
|
/> : ''}
|
|
2623
2621
|
</Col>
|
|
2624
2622
|
</Row>
|
|
@@ -2671,7 +2669,6 @@ Email.propTypes = {
|
|
|
2671
2669
|
defaultData: PropTypes.object,
|
|
2672
2670
|
showTemplateName: PropTypes.func,
|
|
2673
2671
|
onValidationFail: PropTypes.func,
|
|
2674
|
-
selectedOfferDetails: PropTypes.array,
|
|
2675
2672
|
};
|
|
2676
2673
|
|
|
2677
2674
|
const mapStateToProps = (state, props) => createStructuredSelector({
|
|
@@ -278,12 +278,4 @@ 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
|
-
},
|
|
289
281
|
});
|
|
@@ -173,7 +173,6 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
173
173
|
setIsLoadingContent,
|
|
174
174
|
onValidationFail,
|
|
175
175
|
forwardedTags,
|
|
176
|
-
selectedOfferDetails,
|
|
177
176
|
} = this.props;
|
|
178
177
|
const {
|
|
179
178
|
templateName,
|
|
@@ -204,15 +203,15 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
204
203
|
</CardContainer>
|
|
205
204
|
<div>
|
|
206
205
|
{emailCreateMode === "upload" &&
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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
|
+
}
|
|
216
215
|
</div>
|
|
217
216
|
</div>
|
|
218
217
|
:
|
|
@@ -233,7 +232,6 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
233
232
|
showTemplateName={showTemplateName}
|
|
234
233
|
onValidationFail={onValidationFail}
|
|
235
234
|
forwardedTags={forwardedTags}
|
|
236
|
-
selectedOfferDetails={selectedOfferDetails}
|
|
237
235
|
/>}
|
|
238
236
|
{CmsTemplates && !isShowEmailCreate && <CmsTemplatesComponent cmsTemplates={CmsTemplates} handleEdmDefaultTemplateSelection={this.useEditor} />}
|
|
239
237
|
</div>
|
|
@@ -265,7 +263,6 @@ EmailWrapper.propTypes = {
|
|
|
265
263
|
showTemplateName: PropTypes.func,
|
|
266
264
|
onValidationFail: PropTypes.func,
|
|
267
265
|
forwardedTags: PropTypes.object,
|
|
268
|
-
selectedOfferDetails: PropTypes.array,
|
|
269
266
|
};
|
|
270
267
|
|
|
271
268
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -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
|
-
}
|
|
@@ -4,11 +4,5 @@
|
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
export const CHANGE_LOCALE = 'app/LanguageToggle/CHANGE_LOCALE';
|
|
7
8
|
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,74 +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 moment from 'moment';
|
|
19
|
-
import { bindActionCreators } from 'redux';
|
|
20
|
-
import * as actions from './actions';
|
|
21
|
-
import { makeSelectLocale } from './selectors';
|
|
22
15
|
|
|
16
|
+
import { makeSelectLocale } from './selectors';
|
|
23
17
|
|
|
24
18
|
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
|
-
|
|
46
19
|
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];
|
|
56
20
|
return (
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
</IntlProvider>
|
|
61
|
-
</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>
|
|
62
24
|
);
|
|
63
25
|
}
|
|
64
26
|
}
|
|
65
27
|
|
|
66
28
|
LanguageProvider.propTypes = {
|
|
67
|
-
|
|
68
|
-
|
|
29
|
+
locale: PropTypes.string,
|
|
30
|
+
messages: PropTypes.object,
|
|
69
31
|
children: PropTypes.element.isRequired,
|
|
70
32
|
};
|
|
71
33
|
|
|
72
34
|
|
|
73
|
-
const mapStateToProps =
|
|
74
|
-
|
|
75
|
-
})
|
|
35
|
+
const mapStateToProps = createSelector(
|
|
36
|
+
makeSelectLocale(),
|
|
37
|
+
(locale) => ({ locale })
|
|
38
|
+
);
|
|
76
39
|
|
|
77
40
|
function mapDispatchToProps(dispatch) {
|
|
78
41
|
return {
|
|
79
|
-
|
|
42
|
+
dispatch,
|
|
80
43
|
};
|
|
81
44
|
}
|
|
82
45
|
|
|
@@ -6,24 +6,22 @@
|
|
|
6
6
|
|
|
7
7
|
import { fromJS } from 'immutable';
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import {
|
|
10
|
+
CHANGE_LOCALE,
|
|
11
|
+
} from './constants';
|
|
12
|
+
import {
|
|
13
|
+
DEFAULT_LOCALE,
|
|
14
|
+
} from '../Cap/constants'; // eslint-disable-line
|
|
10
15
|
|
|
11
16
|
const initialState = fromJS({
|
|
12
|
-
locale:
|
|
13
|
-
messages: {},
|
|
14
|
-
localeLoading: false,
|
|
17
|
+
locale: DEFAULT_LOCALE,
|
|
15
18
|
});
|
|
16
19
|
|
|
17
20
|
function languageProviderReducer(state = initialState, action) {
|
|
18
21
|
switch (action.type) {
|
|
19
|
-
case
|
|
20
|
-
return state.set('localeLoading', true);
|
|
21
|
-
case types.GET_LOCIZ_MESSAGE_SUCCESS:
|
|
22
|
+
case CHANGE_LOCALE:
|
|
22
23
|
return state
|
|
23
|
-
.set('
|
|
24
|
-
.set('messages', fromJS(action.data));
|
|
25
|
-
case types.GET_LOCIZ_MESSAGE_FAILURE:
|
|
26
|
-
return state.set('localeLoading', false);
|
|
24
|
+
.set('locale', action.locale);
|
|
27
25
|
default:
|
|
28
26
|
return state;
|
|
29
27
|
}
|
|
@@ -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="change" onClick={() => this.addSecondoryCtaIos(true, this.state.formData, {id: "add-sec-cta-ios"})}/>
|
|
982
982
|
</CapColumn>
|
|
983
983
|
</CapRow>,
|
|
984
984
|
primitive: true,
|
|
@@ -1705,7 +1705,6 @@ 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}
|
|
1709
1708
|
/>
|
|
1710
1709
|
</CapColumn>
|
|
1711
1710
|
{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="change" onClick={() => this.addSecondoryCtaIos(true, this.state.formData, {id: "add-sec-cta-ios"})}/>
|
|
971
971
|
</CapColumn>
|
|
972
972
|
</CapRow>,
|
|
973
973
|
primitive: true,
|
|
@@ -1792,7 +1792,6 @@ 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}
|
|
1796
1795
|
/>}
|
|
1797
1796
|
</CapColumn>
|
|
1798
1797
|
{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}SMS (${smsDetails.chars_used} characters)`;
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
|
|
@@ -970,7 +970,6 @@ 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}
|
|
974
973
|
/>
|
|
975
974
|
</CapColumn>
|
|
976
975
|
</CapRow>
|
|
@@ -996,7 +995,6 @@ Create.propTypes = {
|
|
|
996
995
|
isFullMode: PropTypes.bool,
|
|
997
996
|
getFormSubscriptionData: PropTypes.func,
|
|
998
997
|
isLoadingMetaEntities: PropTypes.bool,
|
|
999
|
-
selectedOfferDetails: PropTypes.array,
|
|
1000
998
|
};
|
|
1001
999
|
|
|
1002
1000
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -110,20 +110,4 @@ 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
|
-
},
|
|
129
113
|
});
|
|
@@ -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}SMS (${smsDetails.chars_used} characters)`;
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
|
|
@@ -966,7 +966,6 @@ 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}
|
|
970
969
|
/>
|
|
971
970
|
</CapColumn>
|
|
972
971
|
</CapRow>
|
|
@@ -995,7 +994,6 @@ Edit.propTypes = {
|
|
|
995
994
|
setIsLoadingContent: PropTypes.func,
|
|
996
995
|
// route: PropTypes.object,
|
|
997
996
|
injectedTags: PropTypes.object,
|
|
998
|
-
selectedOfferDetails: PropTypes.array,
|
|
999
997
|
};
|
|
1000
998
|
|
|
1001
999
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -102,20 +102,4 @@ 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
|
-
},
|
|
121
105
|
});
|