@capillarytech/creatives-library 6.13.1 → 6.13.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/app.js +5 -2
- package/components/FormBuilder/index.js +6 -2
- package/containers/Ebill/index.js +3 -0
- package/containers/Email/index.js +16 -8
- package/containers/Sms/Create/index.js +2 -1
- package/package.json +2 -2
- package/utils/ignoredErrorMessages.js +4 -0
- package/v2Components/FormBuilder/index.js +5 -3
- package/v2Containers/Cap/index.js +30 -9
- package/v2Containers/WeChat/MapTemplates/index.js +1 -1
package/app.js
CHANGED
|
@@ -25,6 +25,7 @@ import initialState from './initialState';
|
|
|
25
25
|
import './styles/vendor/semantic/dist/semantic.min.css';
|
|
26
26
|
import './styles/main.scss';
|
|
27
27
|
import pathConfig from './config/path';
|
|
28
|
+
import ignoredErrorMessages from './utils/ignoredErrorMessages';
|
|
28
29
|
// addLocaleData([...en, ...es, ...fr, ...it, ...zh]);
|
|
29
30
|
|
|
30
31
|
const browserHistory = useRouterHistory(createHistory)({
|
|
@@ -38,10 +39,12 @@ const history = syncHistoryWithStore(browserHistory, store, {
|
|
|
38
39
|
});
|
|
39
40
|
|
|
40
41
|
const bugSnagErrorCallback = (event) => {
|
|
41
|
-
const { app: { releaseStage } = {} } = event || {};
|
|
42
|
+
const { app: { releaseStage } = {}, error } = event || {};
|
|
43
|
+
const errorMessage = error && error.message;
|
|
42
44
|
if (
|
|
43
45
|
(releaseStage || '').includes('nightly') ||
|
|
44
|
-
process.env.NODE_ENV !== 'production'
|
|
46
|
+
process.env.NODE_ENV !== 'production' ||
|
|
47
|
+
ignoredErrorMessages.include[errorMessage]
|
|
45
48
|
) {
|
|
46
49
|
return false;
|
|
47
50
|
}
|
|
@@ -204,7 +204,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
204
204
|
|
|
205
205
|
if (!_.isEmpty(nextProps.formData) && !_.isEqual(this.state.formData, nextProps.formData)) {
|
|
206
206
|
if (nextProps.isNewVersionFlow) {
|
|
207
|
-
const
|
|
207
|
+
const nextPropsFormData = nextProps.formData[nextProps.currentTab - 1];
|
|
208
|
+
const nextPropsTabKey = nextPropsFormData && nextPropsFormData.tabKey;
|
|
209
|
+
const tabKey = (this.state.tabKey !== nextPropsTabKey) ? nextPropsTabKey: this.state.tabKey;
|
|
208
210
|
|
|
209
211
|
this.setState({tabKey});
|
|
210
212
|
}
|
|
@@ -1841,7 +1843,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1841
1843
|
formData.base.tabKey = `${data}`;
|
|
1842
1844
|
}
|
|
1843
1845
|
|
|
1844
|
-
|
|
1846
|
+
const formDataActiveKey = formData[(this.state.currentTab - 1)][formData[(this.state.currentTab - 1)].activeTab];
|
|
1847
|
+
const formDataTabKey = formDataActiveKey && formDataActiveKey.tabKey;
|
|
1848
|
+
that.setState({formData, currentLangTab: formData[(this.state.currentTab - 1)].activeTab, tabKey: formDataTabKey}, () => {
|
|
1845
1849
|
val.injectedEvents[event].call(that.props.parent, this.state.currentTab, formData);
|
|
1846
1850
|
});
|
|
1847
1851
|
} else {
|
|
@@ -908,6 +908,9 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
|
|
|
908
908
|
injectEvents(schema) {
|
|
909
909
|
console.log('now injecting events', schema);
|
|
910
910
|
const temp = schema;
|
|
911
|
+
if (!temp.standalone) {
|
|
912
|
+
temp.standalone = {};
|
|
913
|
+
}
|
|
911
914
|
temp.standalone.sections = this.injectSections(temp.standalone.sections);
|
|
912
915
|
_.forEach(temp.containers, (container) => {
|
|
913
916
|
let tempContainer = container;
|
|
@@ -1155,8 +1155,11 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1155
1155
|
const msgString = JSON.stringify(msg);
|
|
1156
1156
|
const langId = formData[this.state.currentTab - 1].activeTab;
|
|
1157
1157
|
const langIndex = formData[this.state.currentTab - 1].selectedLanguages.indexOf(langId);
|
|
1158
|
-
const
|
|
1159
|
-
|
|
1158
|
+
const elementToSelect = document.getElementById(`edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`);
|
|
1159
|
+
if (elementToSelect) {
|
|
1160
|
+
const win = elementToSelect.contentWindow;
|
|
1161
|
+
win.postMessage(msgString, '*');
|
|
1162
|
+
}
|
|
1160
1163
|
} else {
|
|
1161
1164
|
console.log('tag', this.state, this.state.editorInstanse);
|
|
1162
1165
|
if (this.state.editorInstanse) {
|
|
@@ -1415,7 +1418,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1415
1418
|
|
|
1416
1419
|
getMappedEvent = (id, event) => {
|
|
1417
1420
|
console.log('Map ', this.map, id, event);
|
|
1418
|
-
|
|
1421
|
+
const mapIdObject = this.map[id];
|
|
1422
|
+
return mapIdObject && mapIdObject[event] ? mapIdObject[event] : () => {};
|
|
1419
1423
|
}
|
|
1420
1424
|
|
|
1421
1425
|
getCurrentWindow = (e) => {
|
|
@@ -1511,8 +1515,11 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1511
1515
|
_.forEach(data.selectedLanguages, (language, langIndex) => {
|
|
1512
1516
|
if (data[language].is_drag_drop) {
|
|
1513
1517
|
console.log('saving edm template', document.getElementById("edmeditor"), `edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`);
|
|
1514
|
-
const
|
|
1515
|
-
|
|
1518
|
+
const elementToSelect = document.getElementById(`edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`);
|
|
1519
|
+
if (elementToSelect) {
|
|
1520
|
+
const win = elementToSelect.contentWindow;
|
|
1521
|
+
win.postMessage("saveProject", '*');
|
|
1522
|
+
}
|
|
1516
1523
|
}
|
|
1517
1524
|
});
|
|
1518
1525
|
});
|
|
@@ -2501,7 +2508,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2501
2508
|
const tempEl = containerInputFieldCol;
|
|
2502
2509
|
if (containerInputFieldCol.id === "tab-header") {
|
|
2503
2510
|
const baseLanguage = this.props.Global.currentOrgDetails && this.props.Global.currentOrgDetails.basic_details && this.props.Global.currentOrgDetails.basic_details.base_language && this.props.Global.currentOrgDetails.basic_details.base_language !== "" ? this.props.Global.currentOrgDetails.basic_details.base_language : 'en';
|
|
2504
|
-
const supportedLanguages = this.props.Global.currentOrgDetails.basic_details.supported_languages;
|
|
2511
|
+
const supportedLanguages = this.props.Global.currentOrgDetails && this.props.Global.currentOrgDetails.basic_details && this.props.Global.currentOrgDetails.basic_details.supported_languages;
|
|
2505
2512
|
if (!supportedLanguages) {
|
|
2506
2513
|
tempEl.value = baseLanguage || 'English';
|
|
2507
2514
|
return;
|
|
@@ -2655,12 +2662,13 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2655
2662
|
if (languageIndex === -1) {
|
|
2656
2663
|
languageIndex = 0;
|
|
2657
2664
|
}
|
|
2665
|
+
const dataBase = data.base;
|
|
2658
2666
|
const tempData = {
|
|
2659
|
-
"is_drag_drop":
|
|
2667
|
+
"is_drag_drop": dataBase && dataBase.is_drag_drop,
|
|
2660
2668
|
"lang_id": this.supportedLanguages[languageIndex].lang_id,
|
|
2661
2669
|
"iso_code": this.supportedLanguages[languageIndex].iso_code,
|
|
2662
2670
|
"language": this.supportedLanguages[languageIndex].language,
|
|
2663
|
-
"template-content": !
|
|
2671
|
+
"template-content": dataBase && !dataBase.is_drag_drop && dataBase.is_drag_drop !== 1 ? dataBase.html_content : "",
|
|
2664
2672
|
};
|
|
2665
2673
|
formData[0].base = true;
|
|
2666
2674
|
formData[0].selectedLanguages.push(this.supportedLanguages[languageIndex].iso_code);
|
|
@@ -297,7 +297,8 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
297
297
|
onTabChange: this.onTabChange,
|
|
298
298
|
},
|
|
299
299
|
};
|
|
300
|
-
|
|
300
|
+
const mappedIdObject = map[id];
|
|
301
|
+
return mappedIdObject && mappedIdObject[event] ? mappedIdObject[event] : () => {};
|
|
301
302
|
}
|
|
302
303
|
|
|
303
304
|
setFormValidity(isFormValid) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capillarytech/creatives-library",
|
|
3
3
|
"author": "meharaj",
|
|
4
|
-
"version": "6.13.
|
|
4
|
+
"version": "6.13.2",
|
|
5
5
|
"description": "Capillary creatives ui",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"module": "./index.es.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@babel/polyfill": "7.4.3",
|
|
16
16
|
"@bugsnag/js": "^7.2.1",
|
|
17
17
|
"@bugsnag/plugin-react": "^7.2.1",
|
|
18
|
-
"@capillarytech/cap-ui-utils": "1.3.
|
|
18
|
+
"@capillarytech/cap-ui-utils": "1.3.3",
|
|
19
19
|
"@mailupinc/bee-plugin": "^1.2.0",
|
|
20
20
|
"babel-cli": "^6.26.0",
|
|
21
21
|
"chalk": "1.1.3",
|
|
@@ -2362,7 +2362,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2362
2362
|
this.renderTextAreaContent(styling, columns, val, isVersionEnable, rows, cols, val.offset);
|
|
2363
2363
|
break;
|
|
2364
2364
|
case "contentPreview":
|
|
2365
|
-
|
|
2365
|
+
const { formData , currentTab } = this.state || {};
|
|
2366
|
+
const tab = formData && formData[currentTab - 1];
|
|
2367
|
+
content = isVersionEnable ? tab && tab['sms-editor'] : formData && formData['sms-editor'];
|
|
2366
2368
|
charList = updateCharCount(content).char_list;
|
|
2367
2369
|
columns.push(<CapColumn id={val.id} className={"preview-chars"} span={val.width}>
|
|
2368
2370
|
{charList.map((char) => char)}
|
|
@@ -3175,7 +3177,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3175
3177
|
}
|
|
3176
3178
|
console.log('CKEditor Data 2', this.state.formData, this.state.formData[`${this.state.currentTab - 1}`], val, this.state.currentTab, this.state.currentLangTab, langIndex);
|
|
3177
3179
|
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) || 'en';
|
|
3178
|
-
const content = (!_.isEmpty(this.state.formData) && this.state.formData[`${this.state.currentTab - 1}`][
|
|
3180
|
+
const content = (!_.isEmpty(this.state.formData) && this.state.formData[`${this.state.currentTab - 1}`] && this.state.formData[`${this.state.currentTab - 1}`][currentLang] && this.state.formData[`${this.state.currentTab - 1}`][currentLang]['template-content'] || '');
|
|
3179
3181
|
columns.push(
|
|
3180
3182
|
<CapColumn style={val.colStyle ? val.colStyle : {}} span={val.width}>
|
|
3181
3183
|
<CKEditor
|
|
@@ -3198,7 +3200,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3198
3200
|
}
|
|
3199
3201
|
}
|
|
3200
3202
|
const { currentTab, formData } = this.state;
|
|
3201
|
-
const supportedLanguages = formData[currentTab - 1].selectedLanguages;
|
|
3203
|
+
const supportedLanguages = (formData[currentTab - 1] || {}).selectedLanguages || {};
|
|
3202
3204
|
const currentLang = supportedLanguages[langTab - 1];
|
|
3203
3205
|
|
|
3204
3206
|
let beeJson = '',
|
|
@@ -33,7 +33,7 @@ import './_cap.scss';
|
|
|
33
33
|
const gtm = window.dataLayer || [];
|
|
34
34
|
const {
|
|
35
35
|
logNewTab,
|
|
36
|
-
|
|
36
|
+
utilsGetOrgNameFromId,
|
|
37
37
|
tabBeforeUnloadEventHandler,
|
|
38
38
|
utilsHandleStorageChange,
|
|
39
39
|
isMultipleTabsOpen,
|
|
@@ -297,18 +297,36 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
297
297
|
}
|
|
298
298
|
};
|
|
299
299
|
|
|
300
|
+
getOrgNameFromId = orgId => {
|
|
301
|
+
const {
|
|
302
|
+
Global: {
|
|
303
|
+
user: {
|
|
304
|
+
proxyOrgList,
|
|
305
|
+
orgName: defaultOrgName,
|
|
306
|
+
orgID: defaultOrgID,
|
|
307
|
+
} = {},
|
|
308
|
+
} = {},
|
|
309
|
+
} = this.props;
|
|
310
|
+
return utilsGetOrgNameFromId(
|
|
311
|
+
orgId,
|
|
312
|
+
proxyOrgList,
|
|
313
|
+
defaultOrgID,
|
|
314
|
+
defaultOrgName,
|
|
315
|
+
);
|
|
316
|
+
};
|
|
317
|
+
|
|
300
318
|
renderOrgRefreshModal = () => {
|
|
301
319
|
const {
|
|
302
320
|
localStorageOrgInfo: { oldValue: oldOrgId, newValue: newOrgId } = {},
|
|
303
321
|
showRefreshModal,
|
|
304
322
|
refreshSeconds,
|
|
305
323
|
} = this.state;
|
|
306
|
-
const {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
324
|
+
const { intl: { formatMessage } = {} } = this.props;
|
|
325
|
+
const oldOrgName = this.getOrgNameFromId(Number(oldOrgId));
|
|
326
|
+
const newOrgName = this.getOrgNameFromId(Number(newOrgId));
|
|
327
|
+
// some users do not have entry for their default org in proxyOrgList.
|
|
328
|
+
// getOrgNameFromId returns back orgID if no matching entry is present in proxyOrgList
|
|
329
|
+
// so replacing with defaultOrgName if defaultOrgID is returned
|
|
312
330
|
const modalData = (
|
|
313
331
|
<CapModal
|
|
314
332
|
title={formatMessage(messages.orgRefreshHeading)}
|
|
@@ -339,12 +357,15 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
339
357
|
renderOrgChangeModal = () => {
|
|
340
358
|
const { selectedOrgId, showOrgChangeModal } = this.state;
|
|
341
359
|
const {
|
|
342
|
-
Global: {
|
|
360
|
+
Global: {
|
|
343
361
|
currentOrgDetails: { basic_details: { name: oldOrgName } = {} } = {},
|
|
344
362
|
},
|
|
345
363
|
intl: { formatMessage } = {},
|
|
346
364
|
} = this.props;
|
|
347
|
-
const newOrgName = getOrgNameFromId(selectedOrgId
|
|
365
|
+
const newOrgName = this.getOrgNameFromId(selectedOrgId);
|
|
366
|
+
// some users do not have entry for their default org in proxyOrgList.
|
|
367
|
+
// getOrgNameFromId returns back orgID if no matching entry is present in proxyOrgList
|
|
368
|
+
// so replacing with defaultOrgName if defaultOrgID is returned
|
|
348
369
|
return (
|
|
349
370
|
<CapModal
|
|
350
371
|
className="change-org-confirm"
|
|
@@ -876,7 +876,7 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
876
876
|
}
|
|
877
877
|
|
|
878
878
|
getMappedEvent(id, event) {
|
|
879
|
-
return this.state.map[id][event];
|
|
879
|
+
return (this.state.map[id] && this.state.map[id][event] ? this.state.map[id][event] : () => {});
|
|
880
880
|
}
|
|
881
881
|
|
|
882
882
|
handleOnTagsContextChange = (data) => {
|