@capillarytech/creatives-library 6.9.0 → 6.9.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/containers/TagList/index.js +3 -2
- package/package.json +1 -1
- package/v2Components/BeeEditor/index.js +9 -9
- package/v2Components/BeeEditor/index.scss +11 -0
- package/v2Components/EmailPreview/_emailPreview.scss +2 -2
- package/v2Components/FormBuilder/index.js +1 -39
- package/v2Containers/Email/index.js +7 -55
- package/v2Containers/Email/initialSchema.js +1 -1
- package/v2Containers/EmailWrapper/index.js +1 -0
- package/v2Containers/Templates/index.js +35 -15
- package/v2Containers/Templates/messages.js +8 -0
|
@@ -71,9 +71,10 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
71
71
|
//Form tags object with tag headers
|
|
72
72
|
_.forEach(tagsList, (temp) => {
|
|
73
73
|
const tag = temp.definition;
|
|
74
|
+
const userLocale = this.props.userLocale;
|
|
74
75
|
if (!tag['tag-header']) {
|
|
75
76
|
mainTags[tag.value] = {
|
|
76
|
-
name: tag.label[
|
|
77
|
+
name: tag.label[userLocale] ? tag.label[userLocale] : tag.label.en,
|
|
77
78
|
desc: tag.desc ? tag.desc : tag.label.en,
|
|
78
79
|
};
|
|
79
80
|
} else if (tag['tag-header'] && mainTags[tag.value]) {
|
|
@@ -82,7 +83,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
82
83
|
console.log('Inside ', tag.label);
|
|
83
84
|
mainTags[tag.value] = {
|
|
84
85
|
'tag-header': true,
|
|
85
|
-
"name": tag.label[
|
|
86
|
+
"name": tag.label[userLocale] ? tag.label[userLocale] : tag.label.en,
|
|
86
87
|
"desc": tag.desc ? tag.desc : tag.label.en,
|
|
87
88
|
"subtags": tag.subtags,
|
|
88
89
|
};
|
package/package.json
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import React, { useEffect, useState, useRef, useCallback } from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import get from 'lodash/get';
|
|
9
8
|
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
10
9
|
import TagList from '../../v2Containers/TagList';
|
|
11
10
|
import
|
|
@@ -17,6 +16,7 @@ import
|
|
|
17
16
|
}
|
|
18
17
|
from '@capillarytech/cap-ui-library';
|
|
19
18
|
import messages from './messages';
|
|
19
|
+
import './index.scss';
|
|
20
20
|
|
|
21
21
|
function BeeEditor(props) {
|
|
22
22
|
const {
|
|
@@ -72,7 +72,7 @@ function BeeEditor(props) {
|
|
|
72
72
|
resolve({
|
|
73
73
|
type: 'custom',
|
|
74
74
|
label: UNSUBSCRIBE,
|
|
75
|
-
link:
|
|
75
|
+
link: `{{${UNSUBSCRIBE}}}`,
|
|
76
76
|
});
|
|
77
77
|
},
|
|
78
78
|
},
|
|
@@ -131,13 +131,13 @@ function BeeEditor(props) {
|
|
|
131
131
|
onSave: (jsonFile, htmlFile) => {
|
|
132
132
|
saveBeeData(jsonFile, htmlFile);
|
|
133
133
|
},
|
|
134
|
+
// will use this function on save row feature
|
|
134
135
|
onSaveRows: (jsonFile, htmlFile) => {
|
|
135
136
|
console.log('bee-plugin-container onSaveRows', jsonFile, htmlFile);
|
|
136
137
|
},
|
|
137
138
|
};
|
|
138
139
|
window.BeePlugin.create(tokenData, beeConfig, (instance) => {
|
|
139
140
|
beePluginInstance = instance;
|
|
140
|
-
console.log('bee instance', beePluginInstance);
|
|
141
141
|
const parseJson = JSON.parse(beeJson);
|
|
142
142
|
beePluginInstance.start(parseJson);
|
|
143
143
|
saveBeeInstance(beePluginInstance);
|
|
@@ -150,7 +150,6 @@ function BeeEditor(props) {
|
|
|
150
150
|
name: result,
|
|
151
151
|
value: `{{${result}}}`,
|
|
152
152
|
};
|
|
153
|
-
|
|
154
153
|
setSelectedTag(msg);
|
|
155
154
|
setVisibleTaglist(false);
|
|
156
155
|
};
|
|
@@ -166,7 +165,6 @@ function BeeEditor(props) {
|
|
|
166
165
|
};
|
|
167
166
|
|
|
168
167
|
const handleOk = () => {
|
|
169
|
-
console.log('handleOk');
|
|
170
168
|
const rowInfo = {};
|
|
171
169
|
if (rowTags !== '') {
|
|
172
170
|
rowInfo.tags = rowTags;
|
|
@@ -179,14 +177,13 @@ function BeeEditor(props) {
|
|
|
179
177
|
...rowInfo,
|
|
180
178
|
});
|
|
181
179
|
setRowMetaModal(false);
|
|
182
|
-
// set rowMetaInfo
|
|
183
180
|
};
|
|
184
181
|
const isDisableSave = () => rowName === '';
|
|
185
182
|
|
|
186
183
|
const onRowChange = useCallback((e) => {
|
|
187
184
|
setRowName(e.target.value);
|
|
188
185
|
});
|
|
189
|
-
|
|
186
|
+
// will use this function on save row feature
|
|
190
187
|
const onChangeCategoy = (e) => {
|
|
191
188
|
console.log('onChangeCategoy', e);
|
|
192
189
|
};
|
|
@@ -226,7 +223,6 @@ function BeeEditor(props) {
|
|
|
226
223
|
return (
|
|
227
224
|
<>
|
|
228
225
|
<div id="bee-plugin-container" style={{ height: '500px'}}>
|
|
229
|
-
|
|
230
226
|
</div>
|
|
231
227
|
<TagList
|
|
232
228
|
moduleFilterEnabled={moduleFilterEnabled}
|
|
@@ -241,7 +237,11 @@ function BeeEditor(props) {
|
|
|
241
237
|
selectedOfferDetails={selectedOfferDetails}
|
|
242
238
|
visibleTaglist={visibleTaglist}
|
|
243
239
|
hidePopover
|
|
244
|
-
modalProps={{
|
|
240
|
+
modalProps={{
|
|
241
|
+
onCancel: onCancelTagList,
|
|
242
|
+
style: { left: 135, top: 250 },
|
|
243
|
+
className: "bee-editor-tag-list",
|
|
244
|
+
}}
|
|
245
245
|
onContextChange={onContextChange}
|
|
246
246
|
/>
|
|
247
247
|
<CapModal
|
|
@@ -3198,44 +3198,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3198
3198
|
}
|
|
3199
3199
|
}
|
|
3200
3200
|
break;
|
|
3201
|
-
// once bee tested completely will remove this code
|
|
3202
|
-
// case "edmeditor": {
|
|
3203
|
-
// // if (!this.state.formData[`${this.state.currentTab - 1}`]) {
|
|
3204
|
-
// // return true;
|
|
3205
|
-
// // }
|
|
3206
|
-
// let langTab = 1;
|
|
3207
|
-
// if (val.id.match(/edmeditor/g)) {
|
|
3208
|
-
// if (val.id.length > 9 && val.id.charAt(9)) {
|
|
3209
|
-
// langTab = val.id.charAt(9);
|
|
3210
|
-
// }
|
|
3211
|
-
// }
|
|
3212
|
-
// const supportedLanguages = this.state.formData[this.state.currentTab - 1].selectedLanguages;
|
|
3213
|
-
// // let langIndex = 0;
|
|
3214
|
-
// // if (val.id.indexOf('edmeditor') > -1 && val.id !== 'edmeditorsrc') {
|
|
3215
|
-
// // const test = val.id.replace('src', '');
|
|
3216
|
-
// // langIndex = parseInt(test.replace('edmeditor', ''), 10) - 1;
|
|
3217
|
-
// // }
|
|
3218
|
-
// // 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;
|
|
3219
|
-
// const currentLang = supportedLanguages[langTab - 1];
|
|
3220
|
-
// 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`];
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
// if (!edmSrc) {
|
|
3224
|
-
// return false;
|
|
3225
|
-
// }
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
// columns.push(
|
|
3229
|
-
// <CapColumn style={val.colStyle ? val.colStyle : {}} span={val.width}>
|
|
3230
|
-
// <EDMEditor
|
|
3231
|
-
// id={val.id}
|
|
3232
|
-
// getEditorInstanse={this.getEditorInstanse}
|
|
3233
|
-
// edmSrc={edmSrc}
|
|
3234
|
-
// />
|
|
3235
|
-
// </CapColumn>
|
|
3236
|
-
// );
|
|
3237
|
-
// }
|
|
3238
|
-
// break;
|
|
3239
3201
|
case "BEEeditor": {
|
|
3240
3202
|
let langTab = 1;
|
|
3241
3203
|
if (val.id.match(/BEEeditor/g)) {
|
|
@@ -3254,7 +3216,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3254
3216
|
if (data) {
|
|
3255
3217
|
beeJson = data[`BEEeditor${currentTab > 1 ? currentTab : ''}json`];
|
|
3256
3218
|
beeToken = data[`BEEeditor${currentTab > 1 ? currentTab : ''}token`];
|
|
3257
|
-
|
|
3219
|
+
uuid = this.props.uuid;
|
|
3258
3220
|
}
|
|
3259
3221
|
if (!beeJson || !beeToken) {
|
|
3260
3222
|
return false;
|
|
@@ -182,21 +182,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
182
182
|
if (this.props.location.query.module === "library" && this.props.templateData) {
|
|
183
183
|
this.props.templatesActions.resetTemplateData();
|
|
184
184
|
}
|
|
185
|
-
// const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
|
|
186
185
|
const isBEESupport = (this.props.location.query.isBEESupport !== "false") || false;
|
|
187
186
|
|
|
188
|
-
//----------------commented by sakshi------------------------
|
|
189
|
-
// if (!_.isEmpty(this.props.Templates.edmTemplate)) {
|
|
190
|
-
// if (this.props.Templates.edmTemplate.versions.base.is_drag_drop) {
|
|
191
|
-
// this.setState({isDragDrop: true});
|
|
192
|
-
// }
|
|
193
|
-
// if (this.props.params.id) {
|
|
194
|
-
// this.props.actions.getCmsSetting('edm', this.props.Templates.edmTemplate.versions.base.drag_drop_id, 'open', undefined, isEdmSupport);
|
|
195
|
-
// } else if (this.props.location.query.module !== "library" || (this.props.location.query.module === "library" && !this.props.templateData)) {
|
|
196
|
-
// this.props.actions.getCmsSetting('edm', this.props.Templates.edmTemplate.versions.base.drag_drop_id, 'create', undefined, isEdmSupport);
|
|
197
|
-
// }
|
|
198
|
-
// }
|
|
199
|
-
// --------till here commented by sakshi------------------------
|
|
200
187
|
if (!_.isEmpty(this.props.Templates.BEETemplate) ) {
|
|
201
188
|
if (this.props.Templates.BEETemplate.versions.base.is_drag_drop) {
|
|
202
189
|
this.setState({isDragDrop: true});
|
|
@@ -366,7 +353,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
366
353
|
const beeJson = `BEEeditor${currentTab > 1 ? currentTab : ''}json`;
|
|
367
354
|
const beeToken = `BEEeditor${currentTab > 1 ? currentTab : ''}token`;
|
|
368
355
|
let beeJsonValue = _.get(nextProps, 'Templates.BEETemplate.versions.base.json-content', '');
|
|
369
|
-
const selectedId = _.get(this.props, 'Email.templateDetails._id', '') || _.get(this.props, 'Templates.BEETemplate._id', '')
|
|
356
|
+
const selectedId = _.get(this.props, 'Email.templateDetails._id', '') || _.get(this.props, 'Templates.BEETemplate._id', '');
|
|
370
357
|
if (this.state.isEdit) {
|
|
371
358
|
if (this.props.location.query.module === "library") {
|
|
372
359
|
beeJsonValue = _.get(this.state, `formData[${currentTab - 1}][${langId}].json-content`, '');
|
|
@@ -709,8 +696,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
709
696
|
getValidationData = () => {
|
|
710
697
|
const that = this;
|
|
711
698
|
let id = _.get(this.props, 'Email.templateDetails._id', '') || _.get(this.props, 'Templates.BEETemplate._id', '');
|
|
712
|
-
if(!id){
|
|
713
|
-
id = _.get(formData
|
|
699
|
+
if (!id) {
|
|
700
|
+
id = _.get(formData, `base[${formData.base.activeTab}].id`, '');
|
|
714
701
|
}
|
|
715
702
|
const formData = _.cloneDeep(this.state.formData);
|
|
716
703
|
if (!this.props.Email.fetchingCmsData) {
|
|
@@ -1024,18 +1011,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1024
1011
|
//gets exicuted when ck editor is used
|
|
1025
1012
|
this.startValidation(true);
|
|
1026
1013
|
}
|
|
1027
|
-
this.setState({targetSaveCount: saveCount, mode: "save", saveCount: 0, cmsDataCount: 0}
|
|
1028
|
-
const data = this.state.formData[this.state.currentTab - 1];
|
|
1029
|
-
// will remove once bee gets tested end to end
|
|
1030
|
-
// _.forEach(data.selectedLanguages, (language, langIndex) => {
|
|
1031
|
-
// if (data[language].is_drag_drop) {
|
|
1032
|
-
// const win = document.getElementById(`edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`).contentWindow;
|
|
1033
|
-
// win.postMessage("saveProject", '*');
|
|
1034
|
-
// }
|
|
1035
|
-
// if (data[language].is_drag_drop) {
|
|
1036
|
-
// }
|
|
1037
|
-
// });
|
|
1038
|
-
});
|
|
1014
|
+
this.setState({targetSaveCount: saveCount, mode: "save", saveCount: 0, cmsDataCount: 0});
|
|
1039
1015
|
});
|
|
1040
1016
|
}
|
|
1041
1017
|
|
|
@@ -1313,8 +1289,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1313
1289
|
tmpData.lang_id = content.lang_id;
|
|
1314
1290
|
tmpData.iso_code = content.iso_code;
|
|
1315
1291
|
tmpData.language = content.language;
|
|
1316
|
-
if (content.
|
|
1317
|
-
// tmpData.drag_drop_id = (content.drag_drop_id ? content.drag_drop_id : "");
|
|
1292
|
+
if (content.id) {
|
|
1318
1293
|
tmpData.id = content.id;
|
|
1319
1294
|
}
|
|
1320
1295
|
|
|
@@ -1573,16 +1548,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1573
1548
|
toggleEmailPreview = () => {
|
|
1574
1549
|
const isDragDrop = this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].is_drag_drop;
|
|
1575
1550
|
if (isDragDrop && !this.state.showEmailPreview) {
|
|
1576
|
-
// will remove once bee gets tested end to end
|
|
1577
|
-
// const activeLangTab = this.state.formData[`${this.state.currentTab - 1}`].activeTab;
|
|
1578
|
-
// const langIndex = this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(activeLangTab);
|
|
1579
|
-
// const win = document.getElementById(`edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`).contentWindow;
|
|
1580
|
-
// win && win.postMessage("saveProject", '*');
|
|
1581
1551
|
this.handleEdmSave();
|
|
1582
1552
|
this.setState({mode: "preview", gettingPreviewData: true});
|
|
1583
|
-
// this.setState({gettingPreviewData: true}, () => {
|
|
1584
|
-
// this.props.actions.getCmsData('edm', this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].drag_drop_id);
|
|
1585
|
-
// });
|
|
1586
1553
|
} else if (this.state.showEmailPreview) {
|
|
1587
1554
|
const formData = _.cloneDeep(this.state.formData);
|
|
1588
1555
|
formData[`${this.state.currentTab - 1}`][formData[`${this.state.currentTab - 1}`].activeTab]['template-content'] = "";
|
|
@@ -1784,7 +1751,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1784
1751
|
schema.containers[`${this.state.currentTab - 1}`].panes.push(firstPane);
|
|
1785
1752
|
// schema.containers[0].tabContent.sections.push(tabContent);
|
|
1786
1753
|
}
|
|
1787
|
-
//this.props.templatesActions.getDefaultBeeTemplates();
|
|
1788
1754
|
const container = schema.containers[this.state.currentTab - 1];
|
|
1789
1755
|
const temp = container;
|
|
1790
1756
|
if (this.state.addLanguageType === "upload") {
|
|
@@ -1885,8 +1851,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1885
1851
|
action: "showNext",
|
|
1886
1852
|
value: true,
|
|
1887
1853
|
};
|
|
1888
|
-
|
|
1889
|
-
// parent && parent.postMessage(JSON.stringify(response), '*');
|
|
1854
|
+
|
|
1890
1855
|
}
|
|
1891
1856
|
|
|
1892
1857
|
moveToTemplates = () => {
|
|
@@ -2382,7 +2347,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2382
2347
|
}
|
|
2383
2348
|
|
|
2384
2349
|
saveFormData = (passedData) => {
|
|
2385
|
-
|
|
2386
2350
|
//saveFormData gets called only when validation result is true
|
|
2387
2351
|
if (this.state.gettingFormData && !this.props.isFullMode) {
|
|
2388
2352
|
const response = {
|
|
@@ -2397,7 +2361,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2397
2361
|
if (this.props.location.query.module === 'library' && this.props.isGetFormData) {
|
|
2398
2362
|
this.props.getFormSubscriptionData(response);
|
|
2399
2363
|
}
|
|
2400
|
-
// parent && parent.postMessage(JSON.stringify(response), "*");
|
|
2401
2364
|
this.setState({gettingFormData: false, startValidation: false, loading: true});
|
|
2402
2365
|
return;
|
|
2403
2366
|
}
|
|
@@ -2475,8 +2438,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2475
2438
|
|
|
2476
2439
|
this.setState({mode: "switchEditor"}, () => {
|
|
2477
2440
|
this.handleEdmSave();
|
|
2478
|
-
// const win = document.getElementById(`edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`).contentWindow;
|
|
2479
|
-
// win && win.postMessage("saveProject", '*');
|
|
2480
2441
|
});
|
|
2481
2442
|
}
|
|
2482
2443
|
|
|
@@ -2626,15 +2587,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2626
2587
|
<div key="creatives-email-add-image-container">
|
|
2627
2588
|
{this.getFilterContent()}
|
|
2628
2589
|
<Pagination onPageChange={() => { this.fetchAllAssets({getNextPage: true}); }} paginationSelector="pagination-container">
|
|
2629
|
-
{/* <CardGrid
|
|
2630
|
-
listItem={this.prepareImageData()}
|
|
2631
|
-
filterContent={filterContent}
|
|
2632
|
-
onHoverItem={this.handleOnHoverItem}
|
|
2633
|
-
onItemClick={this.handleOnItemClick}
|
|
2634
|
-
colNumber={2}
|
|
2635
|
-
enablePagination
|
|
2636
|
-
isLoading={}
|
|
2637
|
-
/> */}
|
|
2638
2590
|
{(!fetchingAllAssets && (!fetchAllAssetSuccess || (fetchAllAssetSuccess && !assetList.length))) ? (
|
|
2639
2591
|
<FormattedMessage {...messages.noImgInGallery}/>
|
|
2640
2592
|
) : this.getTemplateDataForGrid({
|
|
@@ -2791,7 +2743,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2791
2743
|
show={this.state.showImageSelectionBox}
|
|
2792
2744
|
handleClose={this.handleImagePreviewClose}
|
|
2793
2745
|
isLoading={this.props.Email.fetchingAllAssets}
|
|
2794
|
-
size="size-
|
|
2746
|
+
size="size-xl"
|
|
2795
2747
|
/>
|
|
2796
2748
|
{/* <div id="bee-plugin-container" style={{ height: '600px'}}></div> */}
|
|
2797
2749
|
{this.state.showConfirmationModal && this.renderConfirmationModal()}
|
|
@@ -81,7 +81,7 @@ const LINE_FILTERS = {
|
|
|
81
81
|
ALL: 'all',
|
|
82
82
|
TEXT: 'text',
|
|
83
83
|
IMAGE_VIDEO: 'image',
|
|
84
|
-
IMAGE_MAP: 'imagemap'
|
|
84
|
+
IMAGE_MAP: 'imagemap',
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
export class Templates extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
@@ -972,7 +972,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
972
972
|
break;
|
|
973
973
|
}
|
|
974
974
|
};
|
|
975
|
-
|
|
975
|
+
|
|
976
976
|
createTemplate(ev) {
|
|
977
977
|
const type = this.props.location.query.type;
|
|
978
978
|
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
@@ -1164,7 +1164,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1164
1164
|
let getQuery = '';
|
|
1165
1165
|
|
|
1166
1166
|
this.props.actions.setEdmTemplate(data);
|
|
1167
|
-
// this.props.actions.setBEETemplate(data);
|
|
1168
1167
|
if (this.state.channel && this.state.channel.toLowerCase() === 'email') {
|
|
1169
1168
|
getQuery = (type === 'embedded') ? {type: 'embedded', module, isLanguageSupport, isEdmSupport} : {module, isLanguageSupport, isEdmSupport};
|
|
1170
1169
|
} else {
|
|
@@ -1387,7 +1386,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1387
1386
|
//content = template.versions.base.messages[0].Text;
|
|
1388
1387
|
const lineContent = template.versions.base.content;
|
|
1389
1388
|
content = {
|
|
1390
|
-
bodyText:lineContent && lineContent.messages[0].text ? lineContent.messages[0].text : '',
|
|
1389
|
+
bodyText: lineContent && lineContent.messages[0].text ? lineContent.messages[0].text : '',
|
|
1391
1390
|
bodyImage: lineContent && lineContent.messages[0].originalContentUrl ? lineContent.messages[0].originalContentUrl : '',
|
|
1392
1391
|
};
|
|
1393
1392
|
const modeType = lineContent && lineContent.messages[0].type;
|
|
@@ -1510,12 +1509,23 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1510
1509
|
|
|
1511
1510
|
|
|
1512
1511
|
isLoading = () => {
|
|
1513
|
-
const
|
|
1514
|
-
const
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1512
|
+
const { EmailCreate, Templates } = this.props;
|
|
1513
|
+
const {
|
|
1514
|
+
getAllTemplatesInProgress,
|
|
1515
|
+
deleteTemplateInProgress,
|
|
1516
|
+
fetchingWeCrmAccounts,
|
|
1517
|
+
sendingFile,
|
|
1518
|
+
} = Templates;
|
|
1519
|
+
const lineLoader = (getAllTemplatesInProgress && this.state.channel.toLowerCase() === 'line');
|
|
1520
|
+
const smsLoader = (getAllTemplatesInProgress && this.state.channel.toLowerCase() === 'sms');
|
|
1521
|
+
const wechatLoader = (((this.state.selectedAccount !== '' && getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === 'wechat');
|
|
1522
|
+
const mobilePushLoader = (((getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === 'mobilepush');
|
|
1523
|
+
const emailLoader = (
|
|
1524
|
+
(getAllTemplatesInProgress ||
|
|
1525
|
+
sendingFile ||
|
|
1526
|
+
deleteTemplateInProgress ||
|
|
1527
|
+
EmailCreate.duplicateTemplateInProgress) && this.state.channel.toLowerCase() === 'email');
|
|
1528
|
+
const ebillLoader = ((getAllTemplatesInProgress || sendingFile) && this.state.channel.toLowerCase() === 'ebill');
|
|
1519
1529
|
const isLoading = ((wechatLoader !== undefined) ? wechatLoader : false) ||
|
|
1520
1530
|
(smsLoader !== undefined ? smsLoader : false) ||
|
|
1521
1531
|
(emailLoader !== undefined ? emailLoader : false) ||
|
|
@@ -1773,7 +1783,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1773
1783
|
</CapRadio.CapRadioGroup>
|
|
1774
1784
|
}
|
|
1775
1785
|
{
|
|
1776
|
-
channel.toUpperCase() === LINE &&
|
|
1786
|
+
channel.toUpperCase() === LINE &&
|
|
1777
1787
|
isFullMode
|
|
1778
1788
|
? (
|
|
1779
1789
|
<CapRadio.CapRadioGroup className="line-filters" defaultValue={lineFilter} onChange={this.setLineFilter}>
|
|
@@ -1800,9 +1810,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1800
1810
|
}
|
|
1801
1811
|
</CapRadio.CapRadioGroup>
|
|
1802
1812
|
)
|
|
1803
|
-
: () =>
|
|
1804
|
-
return null;
|
|
1805
|
-
}
|
|
1813
|
+
: () => null
|
|
1806
1814
|
}
|
|
1807
1815
|
<div style={{display: "flex", justifyContent: "space-between", alignItems: 'center'}}>
|
|
1808
1816
|
{isfilterContentVisisble && !isWechatEmbedded && <CapButton
|
|
@@ -1827,7 +1835,19 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1827
1835
|
const creativesParams = this.getCreativesParams();
|
|
1828
1836
|
const templates = this.props.TemplatesList || [];
|
|
1829
1837
|
const {route} = this.props;
|
|
1830
|
-
const
|
|
1838
|
+
const loadingTipMap = {
|
|
1839
|
+
sendingFile: 'uploadingFile',
|
|
1840
|
+
deleteTemplateInProgress: 'deletingTemplate',
|
|
1841
|
+
duplicateTemplateInProgress: 'duplicatingTemplate',
|
|
1842
|
+
};
|
|
1843
|
+
const { sendingFile, deleteTemplateInProgress } = this.props.Templates;
|
|
1844
|
+
const loadingTipIntl =
|
|
1845
|
+
((['email', 'ebill'].includes(this.state.channel.toLowerCase() === 'email')) && sendingFile && 'sendingFile') ||
|
|
1846
|
+
(deleteTemplateInProgress && 'deletingTemplate') ||
|
|
1847
|
+
(this.props.EmailCreate.duplicateTemplateInProgress && 'duplicatingTemplate');
|
|
1848
|
+
|
|
1849
|
+
const loadingTip = messages[loadingTipIntl] ? this.props.intl.formatMessage(messages[loadingTipIntl]) : this.props.intl.formatMessage(messages.gettingAllTemplates);
|
|
1850
|
+
|
|
1831
1851
|
return (
|
|
1832
1852
|
<>
|
|
1833
1853
|
{activeMode === ACCOUNT_CHANGE_MODE && this.renderAccountSelection()}
|
|
@@ -350,4 +350,12 @@ export default defineMessages({
|
|
|
350
350
|
id: `${scope}.richMediaTemplates`,
|
|
351
351
|
defaultMessage: 'Rich media templates',
|
|
352
352
|
},
|
|
353
|
+
deletingTemplate: {
|
|
354
|
+
id: `${scope}.deletingTemplate`,
|
|
355
|
+
defaultMessage: 'Deleting template...',
|
|
356
|
+
},
|
|
357
|
+
duplicatingTemplate: {
|
|
358
|
+
id: `${scope}.duplicatingTemplate`,
|
|
359
|
+
defaultMessage: 'Duplicating template...'
|
|
360
|
+
},
|
|
353
361
|
});
|