@capillarytech/creatives-library 6.13.4 → 6.13.6
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/index.js +1 -8
- package/package.json +2 -2
- package/reducers.js +0 -2
- package/routes.js +1 -7
- package/services/api.js +0 -6
- package/utils/ignoredErrorMessages.js +4 -0
- package/v2Components/FormBuilder/index.js +5 -3
- package/v2Components/TemplatePreview/_templatePreview.scss +2 -8
- package/v2Components/TemplatePreview/index.js +17 -100
- package/v2Containers/Cap/index.js +30 -9
- package/v2Containers/CreativesContainer/SlideBoxContent.js +2 -65
- package/v2Containers/CreativesContainer/constants.js +0 -2
- package/v2Containers/CreativesContainer/index.js +2 -29
- package/v2Containers/Line/Create/_lineCreate.scss +64 -0
- package/v2Containers/Line/Create/actions.js +94 -0
- package/v2Containers/Line/Create/constants.js +43 -0
- package/v2Containers/Line/Create/index.js +1112 -0
- package/v2Containers/Line/Create/initialSchema.js +378 -0
- package/v2Containers/Line/Create/messages.js +229 -0
- package/v2Containers/Line/Create/reducer.js +99 -0
- package/v2Containers/Line/Create/sagas.js +113 -0
- package/v2Containers/Line/Create/selectors.js +30 -0
- package/v2Containers/Line/CreateWrapper/constants.js +2 -0
- package/v2Containers/Line/CreateWrapper/index.js +117 -0
- package/v2Containers/Line/CreateWrapper/messages.js +55 -0
- package/v2Containers/Line/Edit/_lineEdit.scss +23 -0
- package/v2Containers/Line/Edit/actions.js +79 -0
- package/v2Containers/Line/Edit/constants.js +27 -0
- package/v2Containers/Line/Edit/index.js +1051 -0
- package/v2Containers/Line/Edit/messages.js +173 -0
- package/v2Containers/Line/Edit/reducer.js +83 -0
- package/v2Containers/Line/Edit/sagas.js +81 -0
- package/v2Containers/Line/Edit/selectors.js +29 -0
- package/v2Containers/Line/Edit/tests/actions.test.js +18 -0
- package/v2Containers/Line/Edit/tests/index.test.js +10 -0
- package/v2Containers/Line/Edit/tests/reducer.test.js +9 -0
- package/v2Containers/Line/Edit/tests/sagas.test.js +15 -0
- package/v2Containers/Line/Edit/tests/selectors.test.js +10 -0
- package/v2Containers/Templates/_templates.scss +0 -57
- package/v2Containers/Templates/index.js +5 -54
- package/v2Containers/TemplatesV2/index.js +1 -12
- package/v2Containers/TemplatesV2/messages.js +0 -4
- package/v2Containers/WeChat/MapTemplates/index.js +1 -1
- package/assets/viber.png +0 -0
- package/v2Containers/Viber/_viber.scss +0 -3
- package/v2Containers/Viber/actions.js +0 -74
- package/v2Containers/Viber/constants.js +0 -30
- package/v2Containers/Viber/index.js +0 -700
- package/v2Containers/Viber/messages.js +0 -137
- package/v2Containers/Viber/reducer.js +0 -84
- package/v2Containers/Viber/sagas.js +0 -107
- package/v2Containers/Viber/selectors.js +0 -21
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/index.js
CHANGED
|
@@ -65,10 +65,6 @@ import LineCreate from './v2Containers/Line/Container';
|
|
|
65
65
|
import lineCreateReducer from './v2Containers/Line/Container/reducer';
|
|
66
66
|
import lineCreateSaga from './v2Containers/Line/Container/sagas';
|
|
67
67
|
|
|
68
|
-
import Viber from './v2Containers/Viber';
|
|
69
|
-
import viberReducer from './v2Containers/Viber/reducer';
|
|
70
|
-
import viberSaga from './v2Containers/Viber/sagas';
|
|
71
|
-
|
|
72
68
|
import TemplatesV2 from './v2Containers/TemplatesV2/index';
|
|
73
69
|
|
|
74
70
|
import CreativesContainer from './v2Containers/CreativesContainer';
|
|
@@ -86,7 +82,7 @@ const TemplatesContainer = {Templates, templateReducer, templateSaga};
|
|
|
86
82
|
const SmsCreateContainer = {SmsCreate, smsCreateReducer, smsCreateSaga};
|
|
87
83
|
const SmsEditContainer = {SmsEdit, smsEditReducer, smsEditSaga};
|
|
88
84
|
const EmailContainer = {Email, emailReducer, emailSaga};
|
|
89
|
-
const BeeContainer =
|
|
85
|
+
const BeeContainer ={ BeeEditor,beeReducer,beeSaga}
|
|
90
86
|
const CallTaskContainer = {CallTask, callTaskReducer, callTaskSaga};
|
|
91
87
|
const WeChatMapTemplateContainer = {WeChatMapTemplate, weChatMapTemplateReducer, weChatMapTemplateSaga};
|
|
92
88
|
const WeChatRichMediaCreateContainer = {WeChatRichMediaCreate, weChatRichMediaCreateReducer, weChatRichMediaCreateSaga};
|
|
@@ -96,8 +92,6 @@ const MobilePushEditContainer = {MobilepushEdit, mobilepushEditReducer, mobilepu
|
|
|
96
92
|
const LineCreateContainer = {LineCreate, lineCreateReducer, lineCreateSaga};
|
|
97
93
|
const TemplatesV2Container = {TemplatesV2, templateReducer, templateSaga};
|
|
98
94
|
const FacebookContainer = {Facebook, facebookReducer, facebookSaga};
|
|
99
|
-
const ViberContainer = {Viber, viberReducer, viberSaga};
|
|
100
|
-
|
|
101
95
|
const GalleryContainer = {Gallery, galleryReducer, gallerySagas};
|
|
102
96
|
|
|
103
97
|
export {default as TagList} from './v2Containers/TagList/index';
|
|
@@ -137,5 +131,4 @@ export { CapContainer,
|
|
|
137
131
|
updateCharCount,
|
|
138
132
|
FacebookContainer,
|
|
139
133
|
GalleryContainer,
|
|
140
|
-
ViberContainer,
|
|
141
134
|
};
|
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.6",
|
|
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",
|
package/reducers.js
CHANGED
|
@@ -9,8 +9,6 @@ import { LOCATION_CHANGE } from 'react-router-redux';
|
|
|
9
9
|
|
|
10
10
|
import languageProviderReducer from 'v2Containers/LanguageProvider/reducer';
|
|
11
11
|
import beeEditorReducer from 'v2Containers/BeeEditor/reducer';
|
|
12
|
-
|
|
13
|
-
|
|
14
12
|
import capReducer from 'containers/Cap/reducer';
|
|
15
13
|
import appReducer from 'containers/App/reducer';
|
|
16
14
|
import createSmsReducer from 'containers/Sms/Create/reducer';
|
package/routes.js
CHANGED
|
@@ -598,8 +598,7 @@ export default function createRoutes(store) {
|
|
|
598
598
|
|
|
599
599
|
importModules.catch(errorLoading);
|
|
600
600
|
},
|
|
601
|
-
},
|
|
602
|
-
{
|
|
601
|
+
}, {
|
|
603
602
|
path: '/v2(/:channel)',
|
|
604
603
|
name: 'templatesV2',
|
|
605
604
|
getComponent(nextState, cb) {
|
|
@@ -635,8 +634,6 @@ export default function createRoutes(store) {
|
|
|
635
634
|
import('v2Containers/Facebook/reducer'),
|
|
636
635
|
import('v2Containers/Line/Container/sagas'),
|
|
637
636
|
import('v2Containers/Line/Container/reducer'),
|
|
638
|
-
import('v2Containers/Viber/sagas'),
|
|
639
|
-
import('v2Containers/Viber/reducer'),
|
|
640
637
|
]);
|
|
641
638
|
|
|
642
639
|
const renderRoute = loadModule(cb);
|
|
@@ -657,7 +654,6 @@ export default function createRoutes(store) {
|
|
|
657
654
|
galleryReducer, gallerySagas,
|
|
658
655
|
facebookSagas, facebookReducer,
|
|
659
656
|
lineCreateSagas, lineCreateReducer,
|
|
660
|
-
viberSagas, viberReducer,
|
|
661
657
|
]) => {
|
|
662
658
|
injectReducer('templates', reducer.default);
|
|
663
659
|
injectReducer('cap', capReducer.default);
|
|
@@ -674,7 +670,6 @@ export default function createRoutes(store) {
|
|
|
674
670
|
injectReducer('gallery', galleryReducer.default);
|
|
675
671
|
injectReducer('facebook', facebookReducer.default);
|
|
676
672
|
injectReducer('lineCreate', lineCreateReducer.default);
|
|
677
|
-
injectReducer('viber', viberReducer.default);
|
|
678
673
|
injectSagas(gallerySagas.default);
|
|
679
674
|
injectSagas(sagas.default);
|
|
680
675
|
injectSagas(capSagas.default);
|
|
@@ -690,7 +685,6 @@ export default function createRoutes(store) {
|
|
|
690
685
|
injectSagas(weChatRichmediaTemplatesEditSagas.default);
|
|
691
686
|
injectSagas(facebookSagas.default);
|
|
692
687
|
injectSagas(lineCreateSagas.default);
|
|
693
|
-
injectSagas(viberSagas.default);
|
|
694
688
|
renderRoute(component);
|
|
695
689
|
});
|
|
696
690
|
importModules.catch(errorLoading);
|
package/services/api.js
CHANGED
|
@@ -358,12 +358,6 @@ export const createLineTemplate = ({template}) => {
|
|
|
358
358
|
return request(url, getAPICallObject('POST', template));
|
|
359
359
|
};
|
|
360
360
|
|
|
361
|
-
export const createViberTemplate = ({template}) => {
|
|
362
|
-
console.log('VIBER : in api.js', template);
|
|
363
|
-
const url = `${API_ENDPOINT}/templates/VIBER`;
|
|
364
|
-
return request(url, getAPICallObject('POST', template));
|
|
365
|
-
};
|
|
366
|
-
|
|
367
361
|
export const getLocizMessage = async (locale) => {
|
|
368
362
|
const appName = 'creatives_v2';
|
|
369
363
|
const url = `${ARYA_ENDPOINT}/translations/${appName}/${locale}`;
|
|
@@ -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 = '',
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
left: 23%;
|
|
22
22
|
width: 42%;
|
|
23
23
|
height: 336px;
|
|
24
|
+
display: -webkit-box;
|
|
25
|
+
display: -ms-flexbox;
|
|
24
26
|
display: flex;
|
|
25
27
|
|
|
26
28
|
.sms-icon{
|
|
@@ -49,14 +51,6 @@
|
|
|
49
51
|
left: 36px;
|
|
50
52
|
margin-top: -6px;
|
|
51
53
|
}
|
|
52
|
-
}
|
|
53
|
-
&.viber-preview{
|
|
54
|
-
width: 43%;
|
|
55
|
-
.message-pop {
|
|
56
|
-
width: 80%;
|
|
57
|
-
left: 36px;
|
|
58
|
-
margin-top: -6px;
|
|
59
|
-
}
|
|
60
54
|
}
|
|
61
55
|
|
|
62
56
|
.message-pop{
|
|
@@ -19,14 +19,12 @@ import Carousel from '../Carousel';
|
|
|
19
19
|
const wechatBodyNew = require('./assets/images/wechat_mobile_android.svg');
|
|
20
20
|
const smsMobileAndroid = require('./assets/images/sms_mobile_android.svg');
|
|
21
21
|
const lineMobileAndroid = require('../../assets/line.png');
|
|
22
|
-
const viberMobileAndroid = require('../../assets/viber.png');
|
|
23
|
-
|
|
24
22
|
const lineImgPlaceholder = require('../../assets/line-image-placeholder.svg');
|
|
25
23
|
const lineStickerPlaceholder = require('../../assets/smiley-placeholder.svg');
|
|
26
24
|
const lineVideoPlaceholder = require('../../assets/rich-video-placeholder.svg');
|
|
27
25
|
const androidPushMessagePhone = require('./assets/images/androidPushMessage.svg');
|
|
28
26
|
const iPhonePushMessagePhone = require('./assets/images/iPhonePushMessage.svg');
|
|
29
|
-
import { CAP_COLOR_03, CAP_WHITE, FONT_COLOR_01, CAP_G08, CAP_G06
|
|
27
|
+
import { CAP_COLOR_03, CAP_WHITE, FONT_COLOR_01, CAP_G08, CAP_G06 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
30
28
|
import { TEMPLATE, IMAGE_CAROUSEL, IMAGE, STICKER, TEXT, IMAGE_MAP, VIDEO } from '../../v2Containers/Line/Container/constants';
|
|
31
29
|
|
|
32
30
|
class TemplatePreview extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
@@ -157,11 +155,11 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
157
155
|
});
|
|
158
156
|
}
|
|
159
157
|
const disablePreviewAndTest = this.props.channel === 'MOBILEPUSH' ? !this.props.content.header : (this.props.channel === 'SMS' ? !this.props.content : false);
|
|
160
|
-
const showTestAndPreview = showTestAndPreviewIcon &&
|
|
158
|
+
const showTestAndPreview = showTestAndPreviewIcon &&
|
|
161
159
|
channel !== WECHAT &&
|
|
162
160
|
['outbound', 'library'].includes(module);
|
|
163
161
|
|
|
164
|
-
const renderLineMultiText = (content)
|
|
162
|
+
const renderLineMultiText = (content) => {
|
|
165
163
|
let textCount = 0;
|
|
166
164
|
return content.map((item) => {
|
|
167
165
|
const { type, messageContent = '' } = item || {};
|
|
@@ -172,17 +170,12 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
172
170
|
{this.props.intl.formatMessage(messages.textMessageLabel)}
|
|
173
171
|
{textCount}: ({messageContent.length}/{1600} {this.props.intl.formatMessage(messages.textMessageCharacter)})
|
|
174
172
|
</p>
|
|
175
|
-
)
|
|
173
|
+
)
|
|
176
174
|
}
|
|
177
|
-
return null
|
|
175
|
+
return null
|
|
178
176
|
});
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
"padding": '3.5px 0 0',
|
|
182
|
-
'border-radius': '8px',
|
|
183
|
-
'background-color': CAP_G15,
|
|
184
|
-
'width': '79%',
|
|
185
|
-
};
|
|
177
|
+
}
|
|
178
|
+
|
|
186
179
|
const getVideoContent = ({
|
|
187
180
|
video,
|
|
188
181
|
actionUrl,
|
|
@@ -252,7 +245,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
252
245
|
/>
|
|
253
246
|
)
|
|
254
247
|
}
|
|
255
|
-
</div>
|
|
248
|
+
</div>
|
|
256
249
|
);
|
|
257
250
|
|
|
258
251
|
return (
|
|
@@ -400,8 +393,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
400
393
|
marginLeft: 40,
|
|
401
394
|
}}
|
|
402
395
|
>
|
|
403
|
-
<div
|
|
404
|
-
className="sms-icon"
|
|
396
|
+
<div className="sms-icon"
|
|
405
397
|
style={{
|
|
406
398
|
left: 0,
|
|
407
399
|
top: 8,
|
|
@@ -409,7 +401,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
409
401
|
width: 20,
|
|
410
402
|
height: 20,
|
|
411
403
|
background: CAP_COLOR_03,
|
|
412
|
-
paddingRight: 5
|
|
404
|
+
paddingRight: 5
|
|
413
405
|
}}
|
|
414
406
|
>
|
|
415
407
|
{this.props.LineAccountName}
|
|
@@ -472,7 +464,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
472
464
|
},
|
|
473
465
|
}}
|
|
474
466
|
/>
|
|
475
|
-
</div>
|
|
467
|
+
</div>
|
|
476
468
|
);
|
|
477
469
|
}
|
|
478
470
|
if (type === VIDEO) {
|
|
@@ -503,7 +495,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
503
495
|
},
|
|
504
496
|
}}
|
|
505
497
|
/>
|
|
506
|
-
</div>
|
|
498
|
+
</div>
|
|
507
499
|
);
|
|
508
500
|
}
|
|
509
501
|
if (type === STICKER && selectedSticker) {
|
|
@@ -518,7 +510,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
518
510
|
alignItems: 'center',
|
|
519
511
|
}}
|
|
520
512
|
>
|
|
521
|
-
<CapImage
|
|
513
|
+
<CapImage
|
|
522
514
|
src={selectedSticker.stickerUrl}
|
|
523
515
|
style={{maxWidth: '100%', marginBottom: 5 }}
|
|
524
516
|
rest={{
|
|
@@ -527,11 +519,11 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
527
519
|
marginBottom: 5,
|
|
528
520
|
},
|
|
529
521
|
height: 70,
|
|
530
|
-
onMouseOut:
|
|
531
|
-
onMouseOver:
|
|
522
|
+
onMouseOut: e => (e.currentTarget.src = selectedSticker.stickerUrl),
|
|
523
|
+
onMouseOver: e => (e.currentTarget.src = selectedSticker.animatedStickerUrl || selectedSticker.stickerUrl),
|
|
532
524
|
}}
|
|
533
525
|
/>
|
|
534
|
-
</div>
|
|
526
|
+
</div>
|
|
535
527
|
);
|
|
536
528
|
}
|
|
537
529
|
if ((type === IMAGE_CAROUSEL || type === TEMPLATE) && imageCarousel) {
|
|
@@ -543,7 +535,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
543
535
|
>
|
|
544
536
|
<Carousel imageCarousel={imageCarousel}/>
|
|
545
537
|
</div>
|
|
546
|
-
)
|
|
538
|
+
)
|
|
547
539
|
}
|
|
548
540
|
return null;
|
|
549
541
|
})
|
|
@@ -554,82 +546,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
554
546
|
</div>
|
|
555
547
|
) : ''
|
|
556
548
|
}
|
|
557
|
-
{
|
|
558
|
-
channel && channel.toLowerCase() === 'viber' ? (
|
|
559
|
-
<div className="shell-v2 align-center" id="sms-preview">
|
|
560
|
-
<CapImage className="preview-image" src={viberMobileAndroid} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
|
|
561
|
-
<div
|
|
562
|
-
className="msgContainer viber-preview"
|
|
563
|
-
style={{
|
|
564
|
-
maxHeight: 292,
|
|
565
|
-
marginLeft: 28,
|
|
566
|
-
}}
|
|
567
|
-
>
|
|
568
|
-
<div
|
|
569
|
-
className="sms-icon"
|
|
570
|
-
style={{
|
|
571
|
-
"width": 20,
|
|
572
|
-
"height": 20,
|
|
573
|
-
"margin": '0 4px 277px 0',
|
|
574
|
-
"padding": '6px 2px 7px 3px',
|
|
575
|
-
'border-radius': '4px',
|
|
576
|
-
'background-color': CAP_PURPLE01,
|
|
577
|
-
'font-size': '6px',
|
|
578
|
-
'font-weight': 900,
|
|
579
|
-
"color": CAP_WHITE,
|
|
580
|
-
}}
|
|
581
|
-
>
|
|
582
|
-
{this.props.viberAccountName}
|
|
583
|
-
</div>
|
|
584
|
-
<div
|
|
585
|
-
className="message-pop align-left"
|
|
586
|
-
style={viberSectionStyle}>
|
|
587
|
-
{/* Text Viber preview */}
|
|
588
|
-
<p
|
|
589
|
-
style={{
|
|
590
|
-
'font-size': '10px',
|
|
591
|
-
"color": CAP_G16,
|
|
592
|
-
"margin": '1.5px 6px 1px 7px',
|
|
593
|
-
}}>{this.props.content.messageContent || ''}
|
|
594
|
-
</p>
|
|
595
|
-
{/* Image Viber preview */}
|
|
596
|
-
{this.props.content.imageURL && <CapImage
|
|
597
|
-
src={this.props.content.imageURL}
|
|
598
|
-
alt="brand-name"
|
|
599
|
-
rest={{
|
|
600
|
-
style: {
|
|
601
|
-
maxWidth: '100%',
|
|
602
|
-
marginBottom: 5,
|
|
603
|
-
},
|
|
604
|
-
}}
|
|
605
|
-
/>
|
|
606
|
-
}
|
|
607
|
-
{/* button viber preview */}
|
|
608
|
-
{this.props.content.buttonText && <div
|
|
609
|
-
style={{
|
|
610
|
-
'border-radius': '16px',
|
|
611
|
-
'background-color': CAP_PURPLE01,
|
|
612
|
-
"margin-top": '14px',
|
|
613
|
-
'text-align': 'center',
|
|
614
|
-
"width": '132px',
|
|
615
|
-
"height": '20px',
|
|
616
|
-
"margin-left": "5px",
|
|
617
|
-
}}>
|
|
618
|
-
<p
|
|
619
|
-
style={{ 'font-size': '12px',
|
|
620
|
-
'font-weight': '500',
|
|
621
|
-
"color": CAP_WHITE }}
|
|
622
|
-
>
|
|
623
|
-
{this.props.content.buttonText || ''}</p>
|
|
624
|
-
</div>
|
|
625
|
-
}
|
|
626
|
-
<div style={{ paddingBottom: 32}}></div>
|
|
627
|
-
</div>
|
|
628
549
|
|
|
629
|
-
</div>
|
|
630
|
-
</div>
|
|
631
|
-
) : ''
|
|
632
|
-
}
|
|
633
550
|
</div>
|
|
634
551
|
|
|
635
552
|
</CapColumn>
|
|
@@ -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"
|