@capillarytech/creatives-library 6.10.0 → 6.10.2
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/components/CapTagList/index.js +1 -1
- package/components/Edmeditor/index.js +1 -1
- package/components/FormBuilder/index.js +0 -1
- package/containers/TagList/index.js +3 -3
- package/index.html +3 -0
- package/package.json +2 -1
- package/services/api.js +19 -4
- package/translations/en.json +117 -4
- package/translations/zh.json +113 -0
- package/v2Components/BeeEditor/index.js +263 -0
- package/v2Components/BeeEditor/index.scss +11 -0
- package/v2Components/BeeEditor/messages.js +71 -0
- package/v2Components/BeeEditor/tests/index.test.js +10 -0
- package/v2Components/CapTagList/index.js +55 -26
- package/v2Components/CmsTemplatesComponent/index.js +4 -4
- package/v2Components/Edmeditor/index.js +1 -1
- package/v2Components/EmailPreview/_emailPreview.scss +2 -2
- package/v2Components/FormBuilder/index.js +78 -43
- package/v2Containers/App/constants.js +1 -0
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +2 -2
- package/v2Containers/CreativesContainer/index.js +7 -2
- package/v2Containers/Email/constants.js +1 -0
- package/v2Containers/Email/index.js +170 -116
- package/v2Containers/Email/initialSchema.js +18 -3
- package/v2Containers/Email/sagas.js +2 -2
- package/v2Containers/Email/selectors.js +5 -0
- package/v2Containers/EmailWrapper/index.js +19 -3
- package/v2Containers/Line/Container/Image/index.js +1 -1
- package/v2Containers/TagList/index.js +13 -6
- package/v2Containers/Templates/actions.js +8 -3
- package/v2Containers/Templates/constants.js +6 -4
- package/v2Containers/Templates/index.js +36 -20
- package/v2Containers/Templates/messages.js +8 -0
- package/v2Containers/Templates/reducer.js +13 -5
- package/v2Containers/Templates/sagas.js +7 -7
- package/v2Containers/Templates/selectors.js +19 -1
|
@@ -11,7 +11,7 @@ import PropTypes from 'prop-types';
|
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import _ from 'lodash';
|
|
13
13
|
import { Tabs, Table, Modal} from 'antd';
|
|
14
|
-
import { CapDrawer, CapButton, CapInput, CapPopover, CapImage, CapCheckbox, CapRadio, CapSelect, CapTable, CapRow, CapColumn, CapNotification, CapUploader, CapHeading, CapIcon} from '@capillarytech/cap-ui-library';
|
|
14
|
+
import { CapSpin, CapDrawer, CapButton, CapInput, CapPopover, CapImage, CapCheckbox, CapRadio, CapSelect, CapTable, CapRow, CapColumn, CapNotification, CapUploader, CapHeading, CapIcon} from '@capillarytech/cap-ui-library';
|
|
15
15
|
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
16
16
|
import LabelHOC from '@capillarytech/cap-ui-library/assets/HOCs/ComponentWithLabelHOC';
|
|
17
17
|
import { CAP_SPACE_12, CAP_SPACE_08, FONT_COLOR_05, FONT_COLOR_04 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
@@ -21,6 +21,7 @@ import SlideBox from '../SlideBox';
|
|
|
21
21
|
import CardGrid from '../CardGrid';
|
|
22
22
|
import CKEditor from "../Ckeditor/";
|
|
23
23
|
import EDMEditor from "../Edmeditor";
|
|
24
|
+
import BeeEditor from '../BeeEditor';
|
|
24
25
|
import CustomPopOver from '../CustomPopOver';
|
|
25
26
|
import messages from './messages';
|
|
26
27
|
import './_formBuilder.scss';
|
|
@@ -275,7 +276,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
275
276
|
onEdit() {
|
|
276
277
|
|
|
277
278
|
}
|
|
278
|
-
|
|
279
279
|
getModal = () => {
|
|
280
280
|
let modal;
|
|
281
281
|
if (this.state.modal) {
|
|
@@ -925,7 +925,10 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
925
925
|
for (var i = 0; i < data.selectedLanguages.length; i+= 1) {
|
|
926
926
|
const currentLang = data.selectedLanguages[i];
|
|
927
927
|
const content = data[currentLang]['template-content'];
|
|
928
|
-
|
|
928
|
+
if (!content) {
|
|
929
|
+
return false;
|
|
930
|
+
}
|
|
931
|
+
const tagValidationResponse = this.validateTags(content, tags, injectedTags);;
|
|
929
932
|
if (errorData[index][currentLang] === undefined) {
|
|
930
933
|
errorData[index][currentLang] = {};
|
|
931
934
|
}
|
|
@@ -2953,24 +2956,28 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2953
2956
|
if (channel === 'EMAIL') {
|
|
2954
2957
|
moduleFilterEnabled = this.props.isFullMode;
|
|
2955
2958
|
}
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2959
|
+
const langIndex = 0;
|
|
2960
|
+
const currentLang = (!_.isEmpty(this.state.formData) && !_.isEmpty(this.state.formData[`${this.state.currentTab - 1}`]) && !_.isEmpty(this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages) && this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages[langIndex]) ? this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages[langIndex] : this.props.baseLanguage;
|
|
2961
|
+
if (!(_.get(this.state, `formData[${this.state.currentTab - 1}][${currentLang}].is_drag_drop`, false)) || channel !== 'EMAIL') {
|
|
2962
|
+
columns.push(
|
|
2963
|
+
<CapColumn key={`input-${val.id}`} offset={val.offset} span={val.width ? val.width : ''} style={val.style ? val.style : {marginBottom: '16px'}}>
|
|
2964
|
+
<TagList
|
|
2965
|
+
key={`input-${val.id}`}
|
|
2966
|
+
moduleFilterEnabled={moduleFilterEnabled}
|
|
2967
|
+
label={val.label ? val.label : ''}
|
|
2968
|
+
onTagSelect={(data) => this.callChildEvent(data, val, 'onTagSelect')}
|
|
2969
|
+
onContextChange={this.props.onContextChange}
|
|
2970
|
+
location={this.props.location}
|
|
2971
|
+
tags={this.props.tags ? this.props.tags : []}
|
|
2972
|
+
injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
|
|
2973
|
+
className={val.className ? val.className : ''}
|
|
2974
|
+
id={val.id}
|
|
2975
|
+
userLocale={this.props.userLocale}
|
|
2976
|
+
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
2977
|
+
/>
|
|
2978
|
+
</CapColumn>
|
|
2979
|
+
);
|
|
2980
|
+
}
|
|
2974
2981
|
break;
|
|
2975
2982
|
case "button":
|
|
2976
2983
|
if (styling === 'semantic' && val.metaType === 'submit-button') {
|
|
@@ -3191,38 +3198,53 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3191
3198
|
}
|
|
3192
3199
|
}
|
|
3193
3200
|
break;
|
|
3194
|
-
case "
|
|
3195
|
-
// if (!this.state.formData[`${this.state.currentTab - 1}`]) {
|
|
3196
|
-
// return true;
|
|
3197
|
-
// }
|
|
3201
|
+
case "BEEeditor": {
|
|
3198
3202
|
let langTab = 1;
|
|
3199
|
-
if (val.id.match(/
|
|
3203
|
+
if (val.id.match(/BEEeditor/g)) {
|
|
3200
3204
|
if (val.id.length > 9 && val.id.charAt(9)) {
|
|
3201
3205
|
langTab = val.id.charAt(9);
|
|
3202
3206
|
}
|
|
3203
3207
|
}
|
|
3204
|
-
const
|
|
3205
|
-
|
|
3206
|
-
// if (val.id.indexOf('edmeditor') > -1 && val.id !== 'edmeditorsrc') {
|
|
3207
|
-
// const test = val.id.replace('src', '');
|
|
3208
|
-
// langIndex = parseInt(test.replace('edmeditor', ''), 10) - 1;
|
|
3209
|
-
// }
|
|
3210
|
-
// const currentLang = (!_.isEmpty(this.state.formData) && !_.isEmpty(this.state.formData[`${this.state.currentTab - 1}`]) && !_.isEmpty(this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages) && this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages[langIndex]) ? this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages[langIndex] : this.props.baseLanguage;
|
|
3208
|
+
const { currentTab, formData } = this.state;
|
|
3209
|
+
const supportedLanguages = formData[currentTab - 1].selectedLanguages;
|
|
3211
3210
|
const currentLang = supportedLanguages[langTab - 1];
|
|
3212
|
-
const edmSrc = this.state.formData[`${this.state.currentTab - 1}`][currentLang] && this.state.formData[`${this.state.currentTab - 1}`][currentLang][`edmeditor${this.state.currentTab > 1 ? this.state.currentTab : ''}src`];
|
|
3213
|
-
|
|
3214
3211
|
|
|
3215
|
-
|
|
3212
|
+
let beeJson = '',
|
|
3213
|
+
beeToken = '',
|
|
3214
|
+
uuid = '';
|
|
3215
|
+
const data = formData[`${currentTab - 1}`][currentLang];
|
|
3216
|
+
if (data) {
|
|
3217
|
+
beeJson = data[`BEEeditor${currentTab > 1 ? currentTab : ''}json`];
|
|
3218
|
+
beeToken = data[`BEEeditor${currentTab > 1 ? currentTab : ''}token`];
|
|
3219
|
+
uuid = this.props.uuid;
|
|
3220
|
+
}
|
|
3221
|
+
if (!beeJson || !beeToken) {
|
|
3216
3222
|
return false;
|
|
3217
3223
|
}
|
|
3218
|
-
|
|
3219
|
-
|
|
3224
|
+
let isModuleFilterEnabled = _.get(this.props.location, 'query.type', '') !== 'embedded';
|
|
3225
|
+
const schemaChannel = _.get(this.props.schema, 'channel', "");
|
|
3226
|
+
if (schemaChannel === 'EMAIL') {
|
|
3227
|
+
isModuleFilterEnabled = this.props.isFullMode;
|
|
3228
|
+
}
|
|
3220
3229
|
columns.push(
|
|
3221
3230
|
<CapColumn style={val.colStyle ? val.colStyle : {}} span={val.width}>
|
|
3222
|
-
<
|
|
3231
|
+
<BeeEditor
|
|
3232
|
+
uid={uuid}
|
|
3233
|
+
tokenData={beeToken}
|
|
3223
3234
|
id={val.id}
|
|
3224
|
-
|
|
3225
|
-
|
|
3235
|
+
beeJson={beeJson}
|
|
3236
|
+
showTagsPopover={this.showTagsPopover}
|
|
3237
|
+
location={this.props.location}
|
|
3238
|
+
label={val.label || ''}
|
|
3239
|
+
className={val.className || ''}
|
|
3240
|
+
userLocale={this.props.userLocale}
|
|
3241
|
+
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
3242
|
+
tags={this.props.tags || []}
|
|
3243
|
+
injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
|
|
3244
|
+
saveBeeInstance={this.props.saveBeeInstance}
|
|
3245
|
+
saveBeeData={this.props.saveBeeData}
|
|
3246
|
+
onContextChange={this.props.onContextChange}
|
|
3247
|
+
moduleFilterEnabled={isModuleFilterEnabled}
|
|
3226
3248
|
/>
|
|
3227
3249
|
</CapColumn>
|
|
3228
3250
|
);
|
|
@@ -3263,7 +3285,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3263
3285
|
}
|
|
3264
3286
|
</CapRow>
|
|
3265
3287
|
);
|
|
3266
|
-
|
|
3288
|
+
if (columns.length) {
|
|
3289
|
+
fields.push(row);
|
|
3290
|
+
}
|
|
3267
3291
|
});
|
|
3268
3292
|
|
|
3269
3293
|
_.forEach(section.actionFields, (field) => {
|
|
@@ -3303,8 +3327,18 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3303
3327
|
}
|
|
3304
3328
|
</CapRow>
|
|
3305
3329
|
);
|
|
3306
|
-
|
|
3330
|
+
if (columns.length) {
|
|
3331
|
+
fields.push(row);
|
|
3332
|
+
}
|
|
3333
|
+
|
|
3307
3334
|
});
|
|
3335
|
+
if(!this.props.isEmailLoading && this.props.schema.channel.toUpperCase() === 'EMAIL' && !fields.length) {
|
|
3336
|
+
return (
|
|
3337
|
+
<div style={{ textAlign: 'center' }}>
|
|
3338
|
+
<CapSpin spinning />
|
|
3339
|
+
</div>
|
|
3340
|
+
);
|
|
3341
|
+
}
|
|
3308
3342
|
return fields;
|
|
3309
3343
|
}
|
|
3310
3344
|
|
|
@@ -3538,6 +3572,7 @@ FormBuilder.propTypes = {
|
|
|
3538
3572
|
setDrawerVisibility: PropTypes.bool,
|
|
3539
3573
|
capDrawerContent: PropTypes.array,
|
|
3540
3574
|
isFullMode: PropTypes.bool,
|
|
3575
|
+
|
|
3541
3576
|
};
|
|
3542
3577
|
|
|
3543
3578
|
export default injectIntl(FormBuilder);
|
|
@@ -10,13 +10,13 @@ function getFullModeSaveBtn(slidBoxContent) {
|
|
|
10
10
|
<FormattedMessage {...messages.creativesTemplatesSaveFullMode}/>;
|
|
11
11
|
}
|
|
12
12
|
function SlideBoxFooter(props) {
|
|
13
|
-
const { slidBoxContent, onSave, onEditTemplate, onCreateNextStep, isFullMode} = props;
|
|
13
|
+
const { slidBoxContent, onSave, onEditTemplate, onCreateNextStep, isFullMode, fetchingCmsData} = props;
|
|
14
14
|
return (
|
|
15
15
|
<div>
|
|
16
16
|
<div>
|
|
17
17
|
{props.shouldShowDoneFooter() && (
|
|
18
18
|
<div>
|
|
19
|
-
<CapButton onClick={onSave}>
|
|
19
|
+
<CapButton onClick={onSave} disabled={fetchingCmsData || false}>
|
|
20
20
|
{isFullMode ?
|
|
21
21
|
getFullModeSaveBtn(slidBoxContent)
|
|
22
22
|
:
|
|
@@ -25,6 +25,7 @@ import * as globalActions from '../Cap/actions';
|
|
|
25
25
|
import {isLoading as isLoadingSelector} from './selectors';
|
|
26
26
|
import messages from './messages';
|
|
27
27
|
import { MAP_TEMPLATE } from '../WeChat/Wrapper/constants';
|
|
28
|
+
import { makeSelectFetchingCmsData } from '../Email/selectors';
|
|
28
29
|
|
|
29
30
|
const classPrefix = 'add-creatives-section';
|
|
30
31
|
|
|
@@ -165,6 +166,8 @@ class Creatives extends React.Component {
|
|
|
165
166
|
iso_code: templateData.iso_code,
|
|
166
167
|
language: templateData.language,
|
|
167
168
|
drag_drop_id: templateData.drag_drop_id,
|
|
169
|
+
json_content: templateData.json_content,
|
|
170
|
+
id: templateData.id,
|
|
168
171
|
};
|
|
169
172
|
creativesTemplateData = {
|
|
170
173
|
base: formData,
|
|
@@ -528,7 +531,7 @@ class Creatives extends React.Component {
|
|
|
528
531
|
}
|
|
529
532
|
render() {
|
|
530
533
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
|
|
531
|
-
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails, onTestContentClicked, onPreviewContentClicked, getCreativesData} = this.props;
|
|
534
|
+
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails, onTestContentClicked, onPreviewContentClicked, getCreativesData, fetchingCmsData} = this.props;
|
|
532
535
|
const mapTemplateCreate = slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
533
536
|
/* TODO: Instead of passing down same props separately to each component down, write common function to these props and pass it accordingly */
|
|
534
537
|
return (
|
|
@@ -617,11 +620,12 @@ class Creatives extends React.Component {
|
|
|
617
620
|
emailCreateMode={emailCreateMode}
|
|
618
621
|
shouldShowContinueFooter={this.shouldShowContinueFooter}
|
|
619
622
|
shouldShowDoneFooter={this.shouldShowDoneFooter}
|
|
623
|
+
fetchingCmsData={fetchingCmsData}
|
|
620
624
|
/>
|
|
621
625
|
}
|
|
622
626
|
handleClose={this.handleCloseSlideBox}
|
|
623
627
|
show={showSlideBox}
|
|
624
|
-
size="size-
|
|
628
|
+
size="size-xl"
|
|
625
629
|
/>
|
|
626
630
|
</SlideBoxWrapper>
|
|
627
631
|
);
|
|
@@ -659,6 +663,7 @@ const mapStatesToProps = () => createStructuredSelector({
|
|
|
659
663
|
EmailLayout: selectEmailLayout(),
|
|
660
664
|
isUploading: uploadSelector(),
|
|
661
665
|
Templates: makeSelectTemplates(),
|
|
666
|
+
fetchingCmsData: makeSelectFetchingCmsData(),
|
|
662
667
|
});
|
|
663
668
|
function mapDispatchToProps(dispatch) {
|
|
664
669
|
return {
|
|
@@ -35,3 +35,4 @@ export const CLEAR_ALL_VALUES = "app/v2Containers/Email/CLEAR_ALL_VALUES";
|
|
|
35
35
|
export const DUPLICATE_TEMPLATE_REQUEST = 'app/v2Containers/Email/DUPLICATE_TEMPLATE_REQUEST';
|
|
36
36
|
export const DUPLICATE_TEMPLATE_SUCCESS = 'app/v2Containers/Email/DUPLICATE_TEMPLATE_SUCCESS';
|
|
37
37
|
export const DUPLICATE_TEMPLATE_FAILURE = 'app/v2Containers/Email/DUPLICATE_TEMPLATE_FAILURE';
|
|
38
|
+
|