@capillarytech/creatives-library 8.0.136 → 8.0.137-alpha.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/constants/unified.js +189 -0
- package/package.json +1 -1
- package/services/getSchema.js +1 -1
- package/services/localStorageApi.js +1 -0
- package/tests/i18n.test.js +1 -1
- package/utils/common.js +2 -2
- package/utils/tagValidations.js +1 -1
- package/utils/tests/checkStore.test.js +1 -1
- package/utils/tests/customAuth.test.js +1 -1
- package/utils/transformerUtils.js +1 -1
- package/v2Components/CapTagList/index.js +9 -14
- package/v2Components/Carousel/style.scss +1 -1
- package/v2Components/EmailMobilePreview/index.js +2 -2
- package/v2Components/FormBuilder/index.js +2 -2
- package/v2Components/TemplatePreview/index.js +2 -1
- package/v2Containers/Cap/tests/saga.test.js +1 -1
- package/v2Containers/Email/index.js +1 -1
- package/v2Containers/FTP/index.js +1 -1
- package/v2Containers/Line/Container/Text/index.js +1 -1
- package/v2Containers/MobilePushNew/components/MediaUploaders.js +0 -1
- package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +271 -0
- package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +189 -0
- package/v2Containers/MobilePushNew/index.scss +0 -7
- package/v2Containers/Sms/Create/index.js +2 -2
- package/v2Containers/Sms/Edit/index.js +1 -1
- package/v2Containers/TagList/index.js +1 -1
- package/v2Containers/TagList/utils.js +1 -1
- package/v2Containers/Templates/index.js +1 -1
- package/v2Containers/Templates/sagas.js +1 -1
- package/components/BreadCrumbs/index.js +0 -65
- package/components/BreadCrumbs/messages.js +0 -13
- package/components/CapTagList/index.js +0 -235
- package/components/CapTagList/messages.js +0 -45
- package/components/Card/_customCard.scss +0 -40
- package/components/Card/index.js +0 -78
- package/components/Card/tests/__snapshots__/index.test.js.snap +0 -22
- package/components/Card/tests/index.test.js +0 -20
- package/components/CardGrid/index.js +0 -71
- package/components/Ckeditor/index.js +0 -238
- package/components/Ckeditor/messages.js +0 -13
- package/components/Ckeditor/style.scss +0 -3
- package/components/Component/index.js +0 -29
- package/components/CustomPopOver/index.js +0 -81
- package/components/CustomPopOver/messages.js +0 -17
- package/components/DateFilter/index.js +0 -349
- package/components/DateFilter/messages.js +0 -57
- package/components/DateRange/index.js +0 -114
- package/components/DateRange/messages.js +0 -25
- package/components/Edmeditor/index.js +0 -65
- package/components/Edmeditor/messages.js +0 -13
- package/components/EmailPreview/_emailPreview.scss +0 -119
- package/components/EmailPreview/assets/images/iPad.svg +0 -10
- package/components/EmailPreview/assets/images/mobile.png +0 -0
- package/components/EmailPreview/index.js +0 -107
- package/components/EmailPreview/messages.js +0 -33
- package/components/Footer/index.js +0 -27
- package/components/Footer/messages.js +0 -13
- package/components/FormBuilder/_formBuilder.scss +0 -83
- package/components/FormBuilder/index.js +0 -3279
- package/components/FormBuilder/messages.js +0 -61
- package/components/Header/index.js +0 -44
- package/components/Header/messages.js +0 -29
- package/components/ImagePreview/_imagePreview.scss +0 -63
- package/components/ImagePreview/index.js +0 -52
- package/components/ImagePreview/messages.js +0 -17
- package/components/PageHeader/_pageHeader.scss +0 -22
- package/components/PageHeader/index.js +0 -37
- package/components/PageHeader/messages.js +0 -13
- package/components/Pagination/_pagination.scss +0 -5
- package/components/Pagination/index.js +0 -49
- package/components/PreviewSideBar/_previewsidebar.scss +0 -28
- package/components/PreviewSideBar/index.js +0 -152
- package/components/PreviewSideBar/messages.js +0 -41
- package/components/Sidebar/_sidebar.scss +0 -115
- package/components/Sidebar/index.js +0 -214
- package/components/Sidebar/messages.js +0 -21
- package/components/SlideBox/_slideBox.scss +0 -63
- package/components/SlideBox/index.js +0 -47
- package/components/SlideBox/tests/index.test.js +0 -103
- package/components/SmsEditor/index.js +0 -55
- package/components/SmsTest/index.js +0 -117
- package/components/SmsTest/messages.js +0 -21
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +0 -42
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +0 -141
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +0 -21
- package/components/TemplatePreview/_templatePreview.scss +0 -642
- package/components/TemplatePreview/assets/images/WECHAT_5x.png +0 -0
- package/components/TemplatePreview/assets/images/androidPushMessage.svg +0 -45
- package/components/TemplatePreview/assets/images/home-screen-android.svg +0 -21
- package/components/TemplatePreview/assets/images/home-screen-ios.svg +0 -16
- package/components/TemplatePreview/assets/images/iPhonePushMessage.svg +0 -135
- package/components/TemplatePreview/assets/images/mobile.svg +0 -24
- package/components/TemplatePreview/assets/images/sms-body.png +0 -0
- package/components/TemplatePreview/assets/images/sms-icon.png +0 -0
- package/components/TemplatePreview/assets/images/sms_mobile.png +0 -0
- package/components/TemplatePreview/assets/images/sms_mobile_android.svg +0 -22
- package/components/TemplatePreview/assets/images/sms_mobile_ios.svg +0 -16
- package/components/TemplatePreview/assets/images/user-icon.svg +0 -19
- package/components/TemplatePreview/assets/images/wechat-mobile.svg +0 -78
- package/components/TemplatePreview/assets/images/wechat_mobile_android.svg +0 -20
- package/components/TemplatePreview/index.js +0 -617
- package/components/TemplatePreview/messages.js +0 -78
- package/components/Toastr/index.js +0 -60
- package/components/Toastr/messages.js +0 -13
- package/components/ToastrMessage/index.js +0 -113
- package/components/ToastrMessage/messages.js +0 -17
- package/components/TopBar/_topbar.scss +0 -46
- package/components/TopBar/assets/images/capillary_logo.png +0 -0
- package/components/TopBar/assets/images/old_capillary_logo.png +0 -0
- package/components/TopBar/index.js +0 -113
- package/components/TopBar/messages.js +0 -29
- package/containers/App/actions.js +0 -7
- package/containers/App/constants.js +0 -114
- package/containers/App/index.js +0 -52
- package/containers/App/reducer.js +0 -19
- package/containers/App/sagas.js +0 -31
- package/containers/App/selectors.js +0 -25
- package/containers/App/test/saga.test.js +0 -11
- package/containers/Assets/Gallery/_gallery.scss +0 -126
- package/containers/Assets/Gallery/actions.js +0 -37
- package/containers/Assets/Gallery/constants.js +0 -23
- package/containers/Assets/Gallery/index.js +0 -473
- package/containers/Assets/Gallery/messages.js +0 -93
- package/containers/Assets/Gallery/reducer.js +0 -81
- package/containers/Assets/Gallery/sagas.js +0 -80
- package/containers/Assets/Gallery/selectors.js +0 -25
- package/containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +0 -9
- package/containers/Assets/Gallery/tests/actions.test.js +0 -25
- package/containers/Assets/Gallery/tests/reducer.test.js +0 -96
- package/containers/Assets/Gallery/tests/saga.test.js +0 -157
- package/containers/Cap/actions.js +0 -66
- package/containers/Cap/constants.js +0 -25
- package/containers/Cap/index.js +0 -402
- package/containers/Cap/messages.js +0 -75
- package/containers/Cap/reducer.js +0 -113
- package/containers/Cap/sagas.js +0 -159
- package/containers/Cap/selectors.js +0 -75
- package/containers/Cap/tests/__snapshots__/index.test.js.snap +0 -2269
- package/containers/Cap/tests/index.test.js +0 -22
- package/containers/Cap/tests/saga.test.js +0 -284
- package/containers/Dashboard/actions.js +0 -15
- package/containers/Dashboard/constants.js +0 -7
- package/containers/Dashboard/index.js +0 -76
- package/containers/Dashboard/messages.js +0 -13
- package/containers/Dashboard/reducer.js +0 -21
- package/containers/Dashboard/sagas.js +0 -17
- package/containers/Dashboard/selectors.js +0 -25
- package/containers/Dashboard/test/saga.test.js +0 -9
- package/containers/Ebill/_ebill.scss +0 -5
- package/containers/Ebill/actions.js +0 -43
- package/containers/Ebill/constants.js +0 -20
- package/containers/Ebill/index.js +0 -1278
- package/containers/Ebill/messages.js +0 -77
- package/containers/Ebill/reducer.js +0 -72
- package/containers/Ebill/sagas.js +0 -74
- package/containers/Ebill/selectors.js +0 -25
- package/containers/Ebill/test/saga.test.js +0 -11
- package/containers/Email/_email.scss +0 -141
- package/containers/Email/actions.js +0 -81
- package/containers/Email/constants.js +0 -36
- package/containers/Email/index.js +0 -3325
- package/containers/Email/messages.js +0 -289
- package/containers/Email/reducer.js +0 -142
- package/containers/Email/sagas.js +0 -135
- package/containers/Email/selectors.js +0 -31
- package/containers/Email/test/saga.test.js +0 -671
- package/containers/LanguageProvider/actions.js +0 -17
- package/containers/LanguageProvider/constants.js +0 -8
- package/containers/LanguageProvider/index.js +0 -80
- package/containers/LanguageProvider/reducer.js +0 -30
- package/containers/LanguageProvider/selectors.js +0 -20
- package/containers/LanguageProvider/tests/actions.test.js +0 -19
- package/containers/LanguageProvider/tests/index.test.js +0 -78
- package/containers/LanguageProvider/tests/reducer.test.js +0 -20
- package/containers/LanguageProvider/tests/selectors.test.js +0 -15
- package/containers/Line/Create/_lineCreate.scss +0 -54
- package/containers/Line/Create/actions.js +0 -90
- package/containers/Line/Create/constants.js +0 -39
- package/containers/Line/Create/index.js +0 -836
- package/containers/Line/Create/messages.js +0 -189
- package/containers/Line/Create/reducer.js +0 -99
- package/containers/Line/Create/sagas.js +0 -121
- package/containers/Line/Create/selectors.js +0 -36
- package/containers/Line/Create/tests/saga.test.js +0 -202
- package/containers/Line/Edit/_lineEdit.scss +0 -35
- package/containers/Line/Edit/actions.js +0 -79
- package/containers/Line/Edit/constants.js +0 -27
- package/containers/Line/Edit/index.js +0 -1050
- package/containers/Line/Edit/messages.js +0 -177
- package/containers/Line/Edit/reducer.js +0 -83
- package/containers/Line/Edit/sagas.js +0 -80
- package/containers/Line/Edit/selectors.js +0 -29
- package/containers/Line/Edit/test/saga.test.js +0 -160
- package/containers/Login/assets/images/capillary_logo.png +0 -0
- package/containers/Login/components/LoginForm/index.js +0 -62
- package/containers/Login/components/LoginForm/messages.js +0 -33
- package/containers/Login/index.js +0 -130
- package/containers/Login/messages.js +0 -25
- package/containers/Login/selectors.js +0 -25
- package/containers/MobilePush/Create/_mobilePushCreate.scss +0 -39
- package/containers/MobilePush/Create/actions.js +0 -46
- package/containers/MobilePush/Create/constants.js +0 -23
- package/containers/MobilePush/Create/index.js +0 -2303
- package/containers/MobilePush/Create/messages.js +0 -269
- package/containers/MobilePush/Create/reducer.js +0 -70
- package/containers/MobilePush/Create/sagas.js +0 -74
- package/containers/MobilePush/Create/selectors.js +0 -28
- package/containers/MobilePush/Create/test/saga.test.js +0 -19
- package/containers/MobilePush/Edit/_mobilePushCreate.scss +0 -39
- package/containers/MobilePush/Edit/actions.js +0 -91
- package/containers/MobilePush/Edit/constants.js +0 -35
- package/containers/MobilePush/Edit/index.js +0 -2601
- package/containers/MobilePush/Edit/messages.js +0 -266
- package/containers/MobilePush/Edit/reducer.js +0 -112
- package/containers/MobilePush/Edit/sagas.js +0 -126
- package/containers/MobilePush/Edit/selectors.js +0 -29
- package/containers/MobilePush/Edit/tests/saga.test.js +0 -255
- package/containers/NotFoundPage/index.js +0 -25
- package/containers/NotFoundPage/messages.js +0 -13
- package/containers/NotFoundPage/tests/index.test.js +0 -17
- package/containers/Sms/Create/_smsCreate.scss +0 -42
- package/containers/Sms/Create/actions.js +0 -27
- package/containers/Sms/Create/constants.js +0 -16
- package/containers/Sms/Create/index.js +0 -1488
- package/containers/Sms/Create/messages.js +0 -109
- package/containers/Sms/Create/reducer.js +0 -41
- package/containers/Sms/Create/sagas.js +0 -40
- package/containers/Sms/Create/selectors.js +0 -28
- package/containers/Sms/Create/test/saga.test.js +0 -11
- package/containers/Sms/Edit/actions.js +0 -40
- package/containers/Sms/Edit/constants.js +0 -17
- package/containers/Sms/Edit/index.js +0 -1472
- package/containers/Sms/Edit/messages.js +0 -105
- package/containers/Sms/Edit/reducer.js +0 -50
- package/containers/Sms/Edit/sagas.js +0 -60
- package/containers/Sms/Edit/selectors.js +0 -32
- package/containers/Sms/Edit/test/saga.test.js +0 -13
- package/containers/TagList/_tagList.scss +0 -8
- package/containers/TagList/actions.js +0 -15
- package/containers/TagList/constants.js +0 -32
- package/containers/TagList/index.js +0 -236
- package/containers/TagList/messages.js +0 -13
- package/containers/TagList/reducer.js +0 -23
- package/containers/TagList/sagas.js +0 -11
- package/containers/TagList/selectors.js +0 -25
- package/containers/Templates/_templates.scss +0 -333
- package/containers/Templates/actions.js +0 -103
- package/containers/Templates/constants.js +0 -60
- package/containers/Templates/index.js +0 -1756
- package/containers/Templates/messages.js +0 -337
- package/containers/Templates/reducer.js +0 -142
- package/containers/Templates/sagas.js +0 -163
- package/containers/Templates/selectors.js +0 -28
- package/containers/Templates/test/saga.test.js +0 -241
- package/containers/WeChat/MapTemplates/_mapTemplates.scss +0 -8
- package/containers/WeChat/MapTemplates/actions.js +0 -52
- package/containers/WeChat/MapTemplates/constants.js +0 -28
- package/containers/WeChat/MapTemplates/index.js +0 -1610
- package/containers/WeChat/MapTemplates/messages.js +0 -157
- package/containers/WeChat/MapTemplates/reducer.js +0 -74
- package/containers/WeChat/MapTemplates/sagas.js +0 -84
- package/containers/WeChat/MapTemplates/selectors.js +0 -25
- package/containers/WeChat/MapTemplates/test/saga.test.js +0 -155
- package/containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +0 -57
- package/containers/WeChat/RichmediaTemplates/Create/actions.js +0 -36
- package/containers/WeChat/RichmediaTemplates/Create/constants.js +0 -15
- package/containers/WeChat/RichmediaTemplates/Create/index.js +0 -1071
- package/containers/WeChat/RichmediaTemplates/Create/messages.js +0 -165
- package/containers/WeChat/RichmediaTemplates/Create/reducer.js +0 -60
- package/containers/WeChat/RichmediaTemplates/Create/richmediaschema.js +0 -497
- package/containers/WeChat/RichmediaTemplates/Create/sagas.js +0 -51
- package/containers/WeChat/RichmediaTemplates/Create/selectors.js +0 -37
- package/containers/WeChat/RichmediaTemplates/Create/test/saga.test.js +0 -13
- package/containers/WeChat/RichmediaTemplates/Edit/actions.js +0 -20
- package/containers/WeChat/RichmediaTemplates/Edit/constants.js +0 -10
- package/containers/WeChat/RichmediaTemplates/Edit/index.js +0 -136
- package/containers/WeChat/RichmediaTemplates/Edit/messages.js +0 -13
- package/containers/WeChat/RichmediaTemplates/Edit/reducer.js +0 -28
- package/containers/WeChat/RichmediaTemplates/Edit/sagas.js +0 -36
- package/containers/WeChat/RichmediaTemplates/Edit/selectors.js +0 -30
- package/containers/WeChat/RichmediaTemplates/Edit/test/saga.test.js +0 -12
- package/containers/WeChat/RichmediaTemplates/View/actions.js +0 -15
- package/containers/WeChat/RichmediaTemplates/View/constants.js +0 -7
- package/containers/WeChat/RichmediaTemplates/View/index.js +0 -47
- package/containers/WeChat/RichmediaTemplates/View/messages.js +0 -21
- package/containers/WeChat/RichmediaTemplates/View/reducer.js +0 -23
- package/containers/WeChat/RichmediaTemplates/View/sagas.js +0 -11
- package/containers/WeChat/RichmediaTemplates/View/selectors.js +0 -25
- package/utils/asyncInjectors.js +0 -78
- package/utils/callNativeEvent.js +0 -16
- package/utils/checkStore.js +0 -21
- package/utils/customAuthWrapper.js +0 -62
- package/utils/customConnectedAuthWrapper.js +0 -26
- package/utils/jed.js +0 -1497
- package/utils/smsCharCount.js +0 -351
|
@@ -1,1278 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* Ebill
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import { connect } from 'react-redux';
|
|
11
|
-
import { bindActionCreators, compose } from 'redux';
|
|
12
|
-
import { Spin, Row, Col, Breadcrumb } from 'antd';
|
|
13
|
-
import Helmet from 'react-helmet';
|
|
14
|
-
import { injectIntl, intlShape } from 'react-intl';
|
|
15
|
-
import _ from 'lodash';
|
|
16
|
-
import { createStructuredSelector } from 'reselect';
|
|
17
|
-
import * as actions from './actions';
|
|
18
|
-
import FormBuilder from '../../components/FormBuilder';
|
|
19
|
-
import { makeSelectMetaEntities, makeSelectAuthenticated, setInjectedTags } from '../Cap/selectors';
|
|
20
|
-
import * as globalActions from '../../containers/Cap/actions';
|
|
21
|
-
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
22
|
-
import { makeSelectTemplates } from '../Templates/selectors';
|
|
23
|
-
import {getMessageObject} from '../../utils/messageUtils';
|
|
24
|
-
import makeSelectEbill from './selectors';
|
|
25
|
-
import messages from './messages';
|
|
26
|
-
import EmailPreview from '../../components/EmailPreview';
|
|
27
|
-
import './_ebill.scss';
|
|
28
|
-
import injectSaga from '../../utils/injectSaga';
|
|
29
|
-
import injectReducer from '../../utils/injectReducer';
|
|
30
|
-
import reducer from './reducer';
|
|
31
|
-
import { ebillSaga } from './sagas';
|
|
32
|
-
import { createQueryString } from '../../utils/common';
|
|
33
|
-
|
|
34
|
-
const BreadcrumbItem = Breadcrumb.Item;
|
|
35
|
-
|
|
36
|
-
export class Ebill extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
37
|
-
constructor(props) {
|
|
38
|
-
super(props);
|
|
39
|
-
this.state = {
|
|
40
|
-
formData: {},
|
|
41
|
-
tabCount: 1,
|
|
42
|
-
currentTab: 1,
|
|
43
|
-
isEdit: false,
|
|
44
|
-
loading: false,
|
|
45
|
-
isFormValid: true,
|
|
46
|
-
injectedTags: {},
|
|
47
|
-
checkValidation: false,
|
|
48
|
-
tabKey: '',
|
|
49
|
-
showEbillPreview: false,
|
|
50
|
-
device: 'desktop',
|
|
51
|
-
schema: {},
|
|
52
|
-
// schema: {
|
|
53
|
-
// standalone: {
|
|
54
|
-
// sections: [
|
|
55
|
-
// {
|
|
56
|
-
// type: "multicols",
|
|
57
|
-
// inputFields: [
|
|
58
|
-
// {
|
|
59
|
-
// cols: [
|
|
60
|
-
// {
|
|
61
|
-
// id: "template-name",
|
|
62
|
-
// placeholder: "Enter template name",
|
|
63
|
-
// type: "input",
|
|
64
|
-
// metaType: "text",
|
|
65
|
-
// datatype: "string",
|
|
66
|
-
// required: true,
|
|
67
|
-
// style: {
|
|
68
|
-
// fontSize: "20px",
|
|
69
|
-
// fontFamily: "proxima-nova,sans-serif",
|
|
70
|
-
// fontStyle: "normal",
|
|
71
|
-
// fontWeight: 600,
|
|
72
|
-
// },
|
|
73
|
-
// styling: "semantic",
|
|
74
|
-
// order: 1,
|
|
75
|
-
// width: 9,
|
|
76
|
-
// customComponent: false,
|
|
77
|
-
// standalone: true,
|
|
78
|
-
// onlyDisplay: false,
|
|
79
|
-
// errorMessage: "Template name cannot be empty.",
|
|
80
|
-
// supportedEvents: [
|
|
81
|
-
// "onChange",
|
|
82
|
-
// ],
|
|
83
|
-
// },
|
|
84
|
-
// // {
|
|
85
|
-
// // id: "template-version",
|
|
86
|
-
// // type: "select", //Resembles component to be used
|
|
87
|
-
// // options: [],
|
|
88
|
-
// // metaType: "text",
|
|
89
|
-
// // datatype: "string",
|
|
90
|
-
// // required: true,
|
|
91
|
-
// // fluid: true,
|
|
92
|
-
// // style: {
|
|
93
|
-
// // fontSize: '14px',
|
|
94
|
-
// // fontFamily: 'open-sans',
|
|
95
|
-
// // fontStyle: 'normal',
|
|
96
|
-
// // marginBottom: '16px',
|
|
97
|
-
// // },
|
|
98
|
-
// // styling: "semantic",
|
|
99
|
-
// // order: 1,
|
|
100
|
-
// // width: 5,
|
|
101
|
-
// // customComponent: false,
|
|
102
|
-
// // standalone: true,
|
|
103
|
-
// // supportedEvents: [
|
|
104
|
-
// // 'onSelect',
|
|
105
|
-
// // 'addVersion',
|
|
106
|
-
// // ],
|
|
107
|
-
// // },
|
|
108
|
-
// {
|
|
109
|
-
// id: "preview-button",
|
|
110
|
-
// width: 3,
|
|
111
|
-
// offset: 8,
|
|
112
|
-
// metaType: "submit-button",
|
|
113
|
-
// colStyle: {
|
|
114
|
-
// textAlign: "right",
|
|
115
|
-
// paddingRight: "12px",
|
|
116
|
-
// },
|
|
117
|
-
// type: "button",
|
|
118
|
-
// buttonType: "cancel",
|
|
119
|
-
// value: "Preview",
|
|
120
|
-
// customComponent: false,
|
|
121
|
-
// standalone: true,
|
|
122
|
-
// styling: "semantic",
|
|
123
|
-
// order: 3,
|
|
124
|
-
// fluid: false,
|
|
125
|
-
// submitAction: "previewTemplate",
|
|
126
|
-
// onlyDisplay: true,
|
|
127
|
-
// supportedEvents: [
|
|
128
|
-
// "previewTemplate",
|
|
129
|
-
// ],
|
|
130
|
-
// },
|
|
131
|
-
// {
|
|
132
|
-
// id: "cancel-button",
|
|
133
|
-
// width: 2,
|
|
134
|
-
// metaType: "submit-button",
|
|
135
|
-
// colStyle: {
|
|
136
|
-
// textAlign: "right",
|
|
137
|
-
// width: "9%",
|
|
138
|
-
// },
|
|
139
|
-
// type: "button",
|
|
140
|
-
// buttonType: "cancel",
|
|
141
|
-
// value: "Cancel",
|
|
142
|
-
// customComponent: false,
|
|
143
|
-
// standalone: true,
|
|
144
|
-
// styling: "semantic",
|
|
145
|
-
// order: 3,
|
|
146
|
-
// fluid: false,
|
|
147
|
-
// onlyDisplay: true,
|
|
148
|
-
// submitAction: "cancelTemplate",
|
|
149
|
-
// supportedEvents: [
|
|
150
|
-
// "cancelTemplate",
|
|
151
|
-
// ],
|
|
152
|
-
// },
|
|
153
|
-
// {
|
|
154
|
-
// id: "save-button",
|
|
155
|
-
// width: 2,
|
|
156
|
-
// metaType: "submit-button",
|
|
157
|
-
// colStyle: {
|
|
158
|
-
// textAlign: "right",
|
|
159
|
-
// width: "7%",
|
|
160
|
-
// },
|
|
161
|
-
// type: "button",
|
|
162
|
-
// buttonType: "primary",
|
|
163
|
-
// value: "Save",
|
|
164
|
-
// customComponent: false,
|
|
165
|
-
// styling: "semantic",
|
|
166
|
-
// order: 3,
|
|
167
|
-
// fluid: false,
|
|
168
|
-
// standalone: true,
|
|
169
|
-
// onlyDisplay: true,
|
|
170
|
-
// submitAction: "saveFormData",
|
|
171
|
-
// supportedEvents: [
|
|
172
|
-
// "saveFormData",
|
|
173
|
-
// ],
|
|
174
|
-
// },
|
|
175
|
-
// ],
|
|
176
|
-
// },
|
|
177
|
-
// ],
|
|
178
|
-
// actionFields: [],
|
|
179
|
-
// },
|
|
180
|
-
// ],
|
|
181
|
-
// },
|
|
182
|
-
// containers: [
|
|
183
|
-
// {
|
|
184
|
-
// panes: [
|
|
185
|
-
// {
|
|
186
|
-
// sections: [
|
|
187
|
-
// {
|
|
188
|
-
// type: "parent",
|
|
189
|
-
// width: 24,
|
|
190
|
-
// rowStyle: {
|
|
191
|
-
// height: "calc(100vh - 142px)",
|
|
192
|
-
// },
|
|
193
|
-
// childSections: [
|
|
194
|
-
// {
|
|
195
|
-
// colStyle: {
|
|
196
|
-
// paddingBottom: "16px",
|
|
197
|
-
// height: "100%",
|
|
198
|
-
// },
|
|
199
|
-
// width: 24,
|
|
200
|
-
// type: "parent",
|
|
201
|
-
// childSections: [
|
|
202
|
-
// {
|
|
203
|
-
// type: "multicols",
|
|
204
|
-
// inputFields: [
|
|
205
|
-
// {
|
|
206
|
-
// cols: [
|
|
207
|
-
// {
|
|
208
|
-
// id: "ebill-editor",
|
|
209
|
-
// style: {
|
|
210
|
-
// background: '#efefef',
|
|
211
|
-
// resize: 'none',
|
|
212
|
-
// float: 'left',
|
|
213
|
-
// border: '1px solid #efefef',
|
|
214
|
-
// width: "100%",
|
|
215
|
-
// height: '100%',
|
|
216
|
-
// },
|
|
217
|
-
// type: "textarea",
|
|
218
|
-
// metaType: "text",
|
|
219
|
-
// datatype: "string",
|
|
220
|
-
// required: true,
|
|
221
|
-
// errorMessage: "Template content has unsupported/missing tags!",
|
|
222
|
-
// fluid: false,
|
|
223
|
-
// styling: "semantic",
|
|
224
|
-
// onlyDisplay: false,
|
|
225
|
-
// width: 24,
|
|
226
|
-
// // autosize: true,
|
|
227
|
-
// // autosizeParams: {
|
|
228
|
-
// // maxRows: 18,
|
|
229
|
-
// // minRows: 3,
|
|
230
|
-
// // },
|
|
231
|
-
// order: 2,
|
|
232
|
-
// customComponent: true,
|
|
233
|
-
// supportedEvents: [
|
|
234
|
-
// "onChange",
|
|
235
|
-
// ],
|
|
236
|
-
// },
|
|
237
|
-
// ],
|
|
238
|
-
// },
|
|
239
|
-
|
|
240
|
-
// ],
|
|
241
|
-
// actionFields: [],
|
|
242
|
-
// },
|
|
243
|
-
// // {
|
|
244
|
-
// // type: "multicols",
|
|
245
|
-
// // inputFields: [
|
|
246
|
-
// // {
|
|
247
|
-
// // cols: [
|
|
248
|
-
// // {
|
|
249
|
-
// // offset: 19,
|
|
250
|
-
// // id: "tagList",
|
|
251
|
-
// // label: "Tags",
|
|
252
|
-
// // type: "tag-list",
|
|
253
|
-
// // metaType: "List",
|
|
254
|
-
// // datatype: "select",
|
|
255
|
-
// // required: true,
|
|
256
|
-
// // fluid: true,
|
|
257
|
-
// // onlyDisplay: true,
|
|
258
|
-
// // styling: "semantic",
|
|
259
|
-
// // order: 1,
|
|
260
|
-
// // customComponent: true,
|
|
261
|
-
// // supportedEvents: [
|
|
262
|
-
// // "onTagSelect",
|
|
263
|
-
// // ],
|
|
264
|
-
// // },
|
|
265
|
-
// // ],
|
|
266
|
-
// // },
|
|
267
|
-
// // ],
|
|
268
|
-
// // actionFields: [],
|
|
269
|
-
// // },
|
|
270
|
-
// ],
|
|
271
|
-
// },
|
|
272
|
-
// ],
|
|
273
|
-
// },
|
|
274
|
-
// ],
|
|
275
|
-
// },
|
|
276
|
-
// ],
|
|
277
|
-
// type: "tabs",
|
|
278
|
-
// defaultPanes: 1,
|
|
279
|
-
// additionalPanes: 0,
|
|
280
|
-
// id: "pane",
|
|
281
|
-
// tabBarExtraContent: {
|
|
282
|
-
// sections: [
|
|
283
|
-
// {
|
|
284
|
-
// type: "multicols",
|
|
285
|
-
// actionFields: [
|
|
286
|
-
// {
|
|
287
|
-
// cols: [
|
|
288
|
-
// // {
|
|
289
|
-
// // id: "add-version-button",
|
|
290
|
-
// // metaType: "submit-button",
|
|
291
|
-
// // type: "button",
|
|
292
|
-
// // buttonType: "cancel",
|
|
293
|
-
// // icon: "plus-circle-o",
|
|
294
|
-
// // value: "New Version",
|
|
295
|
-
// // customComponent: false,
|
|
296
|
-
// // onlyDisplay: true,
|
|
297
|
-
// // styling: "semantic",
|
|
298
|
-
// // order: 3,
|
|
299
|
-
// // fluid: false,
|
|
300
|
-
// // submitAction: "addVersion",
|
|
301
|
-
// // supportedEvents: [
|
|
302
|
-
// // "addVersion",
|
|
303
|
-
// // ],
|
|
304
|
-
// // },
|
|
305
|
-
// {
|
|
306
|
-
// offset: 6,
|
|
307
|
-
// id: "tagList",
|
|
308
|
-
// label: "Tags",
|
|
309
|
-
// type: "tag-list",
|
|
310
|
-
// metaType: "List",
|
|
311
|
-
// datatype: "select",
|
|
312
|
-
// required: true,
|
|
313
|
-
// fluid: true,
|
|
314
|
-
// onlyDisplay: true,
|
|
315
|
-
// styling: "semantic",
|
|
316
|
-
// order: 1,
|
|
317
|
-
// customComponent: true,
|
|
318
|
-
// supportedEvents: [
|
|
319
|
-
// "onTagSelect",
|
|
320
|
-
// ],
|
|
321
|
-
// },
|
|
322
|
-
// ],
|
|
323
|
-
// },
|
|
324
|
-
// ],
|
|
325
|
-
// inputFields: [],
|
|
326
|
-
// },
|
|
327
|
-
// ],
|
|
328
|
-
// },
|
|
329
|
-
// tabContent: {
|
|
330
|
-
// sections: [
|
|
331
|
-
// {
|
|
332
|
-
// type: "multicols",
|
|
333
|
-
// inputFields: [
|
|
334
|
-
// {
|
|
335
|
-
// rowStyle: {
|
|
336
|
-
// display: "flex",
|
|
337
|
-
// flex: 1,
|
|
338
|
-
// },
|
|
339
|
-
// cols: [
|
|
340
|
-
// {
|
|
341
|
-
// id: "base-version-icon",
|
|
342
|
-
// metaType: "display",
|
|
343
|
-
// type: "icon",
|
|
344
|
-
// onlyDisplay: true,
|
|
345
|
-
// primitive: false,
|
|
346
|
-
// value: "chat",
|
|
347
|
-
// customComponent: false,
|
|
348
|
-
// order: 3,
|
|
349
|
-
// fluid: false,
|
|
350
|
-
// style: {
|
|
351
|
-
// color: "#2E89DF",
|
|
352
|
-
// },
|
|
353
|
-
// },
|
|
354
|
-
// {
|
|
355
|
-
// id: "tab-header",
|
|
356
|
-
// metaType: "label",
|
|
357
|
-
// value: "English",
|
|
358
|
-
// primitive: true,
|
|
359
|
-
// dynamicTab: false,
|
|
360
|
-
// type: "div",
|
|
361
|
-
// width: 5,
|
|
362
|
-
// offset: 0,
|
|
363
|
-
// onlyDisplay: true,
|
|
364
|
-
// colStyle: {
|
|
365
|
-
// flex: 1,
|
|
366
|
-
// },
|
|
367
|
-
// supportedEvents: [
|
|
368
|
-
// "onChange",
|
|
369
|
-
// ],
|
|
370
|
-
// },
|
|
371
|
-
// {
|
|
372
|
-
// id: "tab-options-popover",
|
|
373
|
-
// metaType: "display",
|
|
374
|
-
// colStyle: {
|
|
375
|
-
// flex: 0,
|
|
376
|
-
// display: 'none',
|
|
377
|
-
// },
|
|
378
|
-
// type: "popover",
|
|
379
|
-
// customComponent: false,
|
|
380
|
-
// styling: "semantic",
|
|
381
|
-
// order: 3,
|
|
382
|
-
// fluid: false,
|
|
383
|
-
// onlyDisplay: true,
|
|
384
|
-
// submitAction: "onTabOptionSelect",
|
|
385
|
-
// supportedEvents: [
|
|
386
|
-
// "onTabOptionSelect",
|
|
387
|
-
// ],
|
|
388
|
-
// content: {
|
|
389
|
-
// sections: [
|
|
390
|
-
// {
|
|
391
|
-
// type: "multicols",
|
|
392
|
-
// inputFields: [
|
|
393
|
-
// {
|
|
394
|
-
// cols: [
|
|
395
|
-
// {
|
|
396
|
-
// id: "mark-final-version-label",
|
|
397
|
-
// metaType: "label",
|
|
398
|
-
// type: "div",
|
|
399
|
-
// primitive: true,
|
|
400
|
-
// value: "Mark as Final",
|
|
401
|
-
// onlyDisplay: true,
|
|
402
|
-
// customComponent: false,
|
|
403
|
-
// order: 3,
|
|
404
|
-
// fluid: false,
|
|
405
|
-
// className: "version-popover",
|
|
406
|
-
// submitAction: "markFinalVersion",
|
|
407
|
-
// supportedEvents: [
|
|
408
|
-
// "markFinalVersion",
|
|
409
|
-
// ],
|
|
410
|
-
// },
|
|
411
|
-
// ],
|
|
412
|
-
// },
|
|
413
|
-
// {
|
|
414
|
-
// cols: [
|
|
415
|
-
// {
|
|
416
|
-
// id: "duplicate-version-label",
|
|
417
|
-
// metaType: "label",
|
|
418
|
-
// type: "div",
|
|
419
|
-
// primitive: true,
|
|
420
|
-
// value: "Duplicate",
|
|
421
|
-
// onlyDisplay: true,
|
|
422
|
-
// customComponent: false,
|
|
423
|
-
// order: 3,
|
|
424
|
-
// fluid: false,
|
|
425
|
-
// className: "version-popover",
|
|
426
|
-
// submitAction: "duplicateVersion",
|
|
427
|
-
// supportedEvents: [
|
|
428
|
-
// "duplicateVersion",
|
|
429
|
-
// ],
|
|
430
|
-
// },
|
|
431
|
-
// ],
|
|
432
|
-
// },
|
|
433
|
-
// {
|
|
434
|
-
// cols: [
|
|
435
|
-
// {
|
|
436
|
-
// id: "rename-version-label",
|
|
437
|
-
// metaType: "label",
|
|
438
|
-
// type: "div",
|
|
439
|
-
// primitive: true,
|
|
440
|
-
// value: "Rename",
|
|
441
|
-
// onlyDisplay: true,
|
|
442
|
-
// customComponent: false,
|
|
443
|
-
// order: 3,
|
|
444
|
-
// fluid: false,
|
|
445
|
-
// className: "version-popover",
|
|
446
|
-
// submitAction: "renameVersion",
|
|
447
|
-
// supportedEvents: [
|
|
448
|
-
// "renameVersion",
|
|
449
|
-
// ],
|
|
450
|
-
// },
|
|
451
|
-
// ],
|
|
452
|
-
// },
|
|
453
|
-
// {
|
|
454
|
-
// cols: [
|
|
455
|
-
// {
|
|
456
|
-
// id: "delete-version-label",
|
|
457
|
-
// metaType: "label",
|
|
458
|
-
// type: "div",
|
|
459
|
-
// primitive: true,
|
|
460
|
-
// value: "Delete",
|
|
461
|
-
// onlyDisplay: true,
|
|
462
|
-
// customComponent: false,
|
|
463
|
-
// order: 3,
|
|
464
|
-
// fluid: false,
|
|
465
|
-
// className: "version-popover",
|
|
466
|
-
// submitAction: "deleteVersion",
|
|
467
|
-
// supportedEvents: [
|
|
468
|
-
// "deleteVersion",
|
|
469
|
-
// ],
|
|
470
|
-
// },
|
|
471
|
-
// ],
|
|
472
|
-
// },
|
|
473
|
-
// ],
|
|
474
|
-
// actionFields: [],
|
|
475
|
-
// },
|
|
476
|
-
// ],
|
|
477
|
-
// },
|
|
478
|
-
// value: {
|
|
479
|
-
// sections: [
|
|
480
|
-
// {
|
|
481
|
-
// type: "multicols",
|
|
482
|
-
// inputFields: [
|
|
483
|
-
// {
|
|
484
|
-
// cols: [
|
|
485
|
-
// {
|
|
486
|
-
// id: "tab-option-icon",
|
|
487
|
-
// metaType: "display",
|
|
488
|
-
// type: "icon",
|
|
489
|
-
// onlyDisplay: true,
|
|
490
|
-
// primitive: false,
|
|
491
|
-
// value: "",
|
|
492
|
-
// customComponent: false,
|
|
493
|
-
// order: 3,
|
|
494
|
-
// fluid: false,
|
|
495
|
-
// },
|
|
496
|
-
// ],
|
|
497
|
-
// },
|
|
498
|
-
// ],
|
|
499
|
-
// actionFields: [],
|
|
500
|
-
// },
|
|
501
|
-
// ],
|
|
502
|
-
// },
|
|
503
|
-
// trigger: "click",
|
|
504
|
-
// placement: "bottomRight",
|
|
505
|
-
// },
|
|
506
|
-
// ],
|
|
507
|
-
// },
|
|
508
|
-
// ],
|
|
509
|
-
// actionFields: [],
|
|
510
|
-
// },
|
|
511
|
-
// ],
|
|
512
|
-
// },
|
|
513
|
-
// label: "Version",
|
|
514
|
-
// onlyDisplay: true,
|
|
515
|
-
// supportedEvents: [
|
|
516
|
-
// "onTabChange",
|
|
517
|
-
// ],
|
|
518
|
-
// },
|
|
519
|
-
// ],
|
|
520
|
-
// channel: "EBILL",
|
|
521
|
-
// },
|
|
522
|
-
};
|
|
523
|
-
|
|
524
|
-
this.map = {
|
|
525
|
-
"template-name": {
|
|
526
|
-
onChange: this.onTemplateNameChange,
|
|
527
|
-
},
|
|
528
|
-
"template-version": {
|
|
529
|
-
onSelect: this.handleVersionSelect,
|
|
530
|
-
addVersion: this.addVersion,
|
|
531
|
-
},
|
|
532
|
-
"preview-button": {
|
|
533
|
-
previewTemplate: this.toggleEmailPreview,
|
|
534
|
-
},
|
|
535
|
-
"cancel-button": {
|
|
536
|
-
cancelTemplate: this.cancelTemplate,
|
|
537
|
-
},
|
|
538
|
-
"save-button": {
|
|
539
|
-
saveFormData: this.saveFormData,
|
|
540
|
-
},
|
|
541
|
-
"ebill-editor": {
|
|
542
|
-
onChange: this.onTemplateContentChange,
|
|
543
|
-
},
|
|
544
|
-
"tagList": {
|
|
545
|
-
onTagSelect: this.onTagSelect,
|
|
546
|
-
},
|
|
547
|
-
"add-language-button": {
|
|
548
|
-
addLanguage: this.addLanguage,
|
|
549
|
-
},
|
|
550
|
-
"tab-header": {
|
|
551
|
-
onChange: this.onVersionNameChange,
|
|
552
|
-
},
|
|
553
|
-
"tab-options-popover": {
|
|
554
|
-
onTabOptionSelect: this.onTabOptionSelect,
|
|
555
|
-
},
|
|
556
|
-
"mark-final-version-label": {
|
|
557
|
-
markFinalVersion: this.markFinalVersion,
|
|
558
|
-
},
|
|
559
|
-
"duplicate-version-label": {
|
|
560
|
-
duplicateVersion: this.duplicateVersion,
|
|
561
|
-
},
|
|
562
|
-
"rename-version-label": {
|
|
563
|
-
renameVersion: this.renameVersion,
|
|
564
|
-
},
|
|
565
|
-
"delete-version-label": {
|
|
566
|
-
deleteVersion: this.deleteVersion,
|
|
567
|
-
},
|
|
568
|
-
"pane": {
|
|
569
|
-
onTabChange: this.onTabChange,
|
|
570
|
-
},
|
|
571
|
-
"delete-language-label": {
|
|
572
|
-
deleteLanguage: this.deleteLanguage,
|
|
573
|
-
},
|
|
574
|
-
};
|
|
575
|
-
this.isTagLoaded = false;
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
componentWillMount() {
|
|
579
|
-
if (this.props.params.id) {
|
|
580
|
-
this.props.actions.getTemplateDetails(this.props.params.id, 'ebill');
|
|
581
|
-
this.setState({isEdit: true});
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
if (!_.isEmpty(this.props.Templates.edmTemplate) && this.props.Templates.edmTemplate.versions.base.is_drag_drop) {
|
|
585
|
-
this.props.actions.getCmsData('edm', this.props.Templates.edmTemplate.versions.base.drag_drop_id);
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
componentDidMount() {
|
|
590
|
-
const query = {
|
|
591
|
-
layout: 'EBILL',
|
|
592
|
-
type: 'LAYOUT',
|
|
593
|
-
};
|
|
594
|
-
this.props.globalActions.fetchSchemaForEntity(query);
|
|
595
|
-
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
componentWillReceiveProps(nextProps) {
|
|
599
|
-
if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && _.isEmpty(this.state.schema)) {
|
|
600
|
-
this.injectEvents(nextProps.metaEntities.layouts[0].definition);
|
|
601
|
-
|
|
602
|
-
const query = {
|
|
603
|
-
layout: 'EBILL',
|
|
604
|
-
type: 'TAG',
|
|
605
|
-
context: this.props.location.query.type === 'embedded' ? this.props.location.query.module : 'default',
|
|
606
|
-
embedded: this.props.location.query.type === 'embedded' ? this.props.location.query.type : 'full',
|
|
607
|
-
};
|
|
608
|
-
this.props.globalActions.fetchSchemaForEntity(query);
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
if (this.state.isEdit && !_.isEmpty(nextProps.Ebill.templateDetails) && !_.isEqual(nextProps.Ebill.templateDetails, this.props.Ebill.templateDetails)) {
|
|
612
|
-
this.setEditState(nextProps.Ebill.templateDetails);
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
if (nextProps.Ebill.createResponse && nextProps.Ebill.createResponse.templateId) {
|
|
616
|
-
let message;
|
|
617
|
-
if (this.state.isEdit) {
|
|
618
|
-
message = getMessageObject('success', this.props.intl.formatMessage(messages.ebillEditSuccess), true);
|
|
619
|
-
} else {
|
|
620
|
-
message = getMessageObject('success', this.props.intl.formatMessage(messages.ebillCreateSuccess), true);
|
|
621
|
-
}
|
|
622
|
-
this.props.globalActions.addMessageToQueue(message);
|
|
623
|
-
this.props.actions.clearCRUDResponse();
|
|
624
|
-
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
625
|
-
const type = this.props.location.query.type;
|
|
626
|
-
this.props.router.push({
|
|
627
|
-
pathname: `/ebill`,
|
|
628
|
-
search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
if (nextProps.Ebill.createTemplateError && !_.isEqual(nextProps.Ebill.createTemplateError, this.props.Ebill.createTemplateError)) {
|
|
633
|
-
const message = getMessageObject('error', (nextProps.Ebill.createTemplateErrorMessage && nextProps.Ebill.createTemplateErrorMessage !== '') ? nextProps.Ebill.createTemplateErrorMessage : this.props.intl.formatMessage(messages.somethingWentWrong), true);
|
|
634
|
-
this.props.globalActions.addMessageToQueue(message);
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
if (nextProps.Ebill.cmsData !== '' && !_.isEqual(nextProps.Ebill.cmsData, this.props.Ebill.cmsData)) {
|
|
639
|
-
const formData = _.cloneDeep(this.state.formData);
|
|
640
|
-
formData[this.state.currentTab - 1][`ebill-editor${this.state.currentTab > 1 ? this.state.currentTab : ''}`] = nextProps.Ebill.cmsData.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\\"/g, "\"");
|
|
641
|
-
|
|
642
|
-
this.setState({formData});
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
if (nextProps.Templates.selectedEmailLayout && nextProps.Templates.selectedEmailLayout !== '' && this.state.formData[this.state.currentTab - 1] && this.state.formData[this.state.currentTab - 1][`ebill-editor${this.state.currentTab > 1 ? this.state.currentTab : ''}`] !== '') {
|
|
646
|
-
const formData = _.cloneDeep(this.state.formData);
|
|
647
|
-
formData[this.state.currentTab - 1][`ebill-editor${this.state.currentTab > 1 ? this.state.currentTab : ''}`] = nextProps.Templates.selectedEmailLayout;
|
|
648
|
-
|
|
649
|
-
this.setState({formData});
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
if (nextProps.Templates.selectedEmailLayout && !_.isEqual(nextProps.Templates.selectedEmailLayout, this.props.Templates.selectedEmailLayout) && !_.isEmpty(this.state.schema)) {
|
|
653
|
-
this.setState({ content: (this.props.Templates.selectedEmailLayout ? this.props.Templates.selectedEmailLayout : '')}, () => {
|
|
654
|
-
// this.injectEvents(this.state.schema);
|
|
655
|
-
});
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
componentWillUnmount() {
|
|
660
|
-
this.props.actions.clearStoreValues();
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
onTagSelect = (data, currentTab, value) => {
|
|
664
|
-
|
|
665
|
-
if (this.state.isDragDrop) {
|
|
666
|
-
const msg = {
|
|
667
|
-
action: "InsertToCursor",
|
|
668
|
-
content: `{{${data}}}`,
|
|
669
|
-
};
|
|
670
|
-
const msgString = JSON.stringify(msg);
|
|
671
|
-
const win = document.getElementById(`edmeditor${this.state.currentTab > 1 ? this.state.currentTab : ''}`).contentWindow;
|
|
672
|
-
win.postMessage(msgString, '*');
|
|
673
|
-
} else if (this.state.editorInstanse) {
|
|
674
|
-
this.state.editorInstanse.insertHtml(`{{${data}}}`);
|
|
675
|
-
}
|
|
676
|
-
};
|
|
677
|
-
|
|
678
|
-
onTabChange = (data, formData) => {
|
|
679
|
-
|
|
680
|
-
this.setState({currentTab: data, formData});
|
|
681
|
-
};
|
|
682
|
-
|
|
683
|
-
onFormDataChange = (formData, tabCount, currentTab) => {
|
|
684
|
-
|
|
685
|
-
const tmpFormData = _.cloneDeep(formData);
|
|
686
|
-
if (this.props.Templates.selectedEmailLayout !== '' && tmpFormData['0']['ebill-editor'] === '') {
|
|
687
|
-
tmpFormData['0']['ebill-editor'] = this.props.Templates.selectedEmailLayout;
|
|
688
|
-
tmpFormData.base['ebill-editor'] = this.props.Templates.selectedEmailLayout;
|
|
689
|
-
}
|
|
690
|
-
this.setState({formData: tmpFormData, tabCount});
|
|
691
|
-
if (currentTab) {
|
|
692
|
-
this.setState({currentTab});
|
|
693
|
-
}
|
|
694
|
-
};
|
|
695
|
-
|
|
696
|
-
onTagSelect = (data, currentTab) => {
|
|
697
|
-
|
|
698
|
-
const editorId = currentTab > 1 ? `ebill-editor${currentTab}` : 'ebill-editor';
|
|
699
|
-
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}`, currentTab);
|
|
700
|
-
document.getElementById(editorId).focus();
|
|
701
|
-
};
|
|
702
|
-
|
|
703
|
-
onTemplateNameChange = (name) => {
|
|
704
|
-
|
|
705
|
-
};
|
|
706
|
-
|
|
707
|
-
onTemplateContentChange = (content) => {
|
|
708
|
-
|
|
709
|
-
};
|
|
710
|
-
|
|
711
|
-
setEditState = (data) => {
|
|
712
|
-
const that = this;
|
|
713
|
-
const tabCount = data.versions.history.length;
|
|
714
|
-
const formData = {};
|
|
715
|
-
formData['template-name'] = data.name;
|
|
716
|
-
const type = this.props.location.query.type;
|
|
717
|
-
let ifBase = false;
|
|
718
|
-
for (let count = 0; count < tabCount; count += 1) {
|
|
719
|
-
formData[count] = _.cloneDeep(data.versions.history[count]);
|
|
720
|
-
if (data.versions && data.versions.history && data.versions.history[count] && data.versions.history[count].base) {
|
|
721
|
-
if (!formData[count]) {
|
|
722
|
-
formData[count] = {};
|
|
723
|
-
}
|
|
724
|
-
formData[count].base = true;
|
|
725
|
-
ifBase = true;
|
|
726
|
-
}
|
|
727
|
-
if (type === 'embedded' || count > 0) {
|
|
728
|
-
setTimeout( () => {
|
|
729
|
-
|
|
730
|
-
if (type === 'embedded') {
|
|
731
|
-
that.removeStandAlone();
|
|
732
|
-
} else {
|
|
733
|
-
that.addVersion(count, tabCount);
|
|
734
|
-
}
|
|
735
|
-
}, 0 );
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
if (!ifBase) {
|
|
739
|
-
if (!formData[0]) {
|
|
740
|
-
formData[0] = {};
|
|
741
|
-
}
|
|
742
|
-
formData[0].base = true;
|
|
743
|
-
}
|
|
744
|
-
formData.base = data.versions.base;
|
|
745
|
-
|
|
746
|
-
this.setState({tabCount, formData, editData: data, currentTab: 1}, () => {
|
|
747
|
-
});
|
|
748
|
-
};
|
|
749
|
-
|
|
750
|
-
getMappedEvent = (id, event) => {
|
|
751
|
-
|
|
752
|
-
return this.map[id][event];
|
|
753
|
-
};
|
|
754
|
-
|
|
755
|
-
setFormValidity = (isFormValid) => {
|
|
756
|
-
this.setState({isFormValid});
|
|
757
|
-
};
|
|
758
|
-
|
|
759
|
-
changePreviewDevice = (device) => {
|
|
760
|
-
this.setState({ device });
|
|
761
|
-
};
|
|
762
|
-
|
|
763
|
-
toggleEmailPreview = () => {
|
|
764
|
-
this.setState({ showEbillPreview: !this.state.showEbillPreview });
|
|
765
|
-
};
|
|
766
|
-
|
|
767
|
-
cancelTemplate = () => {
|
|
768
|
-
const type = this.props.location.query.type;
|
|
769
|
-
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
770
|
-
this.props.router.push({
|
|
771
|
-
pathname: `/ebill/`,
|
|
772
|
-
search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
|
|
773
|
-
});
|
|
774
|
-
};
|
|
775
|
-
|
|
776
|
-
saveFormData = (formData) => {
|
|
777
|
-
//Logic to save in db etc
|
|
778
|
-
// const isValidated = this.validateFormData(formData);
|
|
779
|
-
//
|
|
780
|
-
// if (!isValidated) {
|
|
781
|
-
// return;
|
|
782
|
-
// }
|
|
783
|
-
|
|
784
|
-
const obj = {};
|
|
785
|
-
obj.versions = {
|
|
786
|
-
base: {},
|
|
787
|
-
history: [],
|
|
788
|
-
};
|
|
789
|
-
if (this.state.isEdit) {
|
|
790
|
-
obj._id = this.props.Ebill.templateDetails._id;
|
|
791
|
-
}
|
|
792
|
-
obj.type = 'EBILL';
|
|
793
|
-
_.forEach(formData, (data, index) => {
|
|
794
|
-
if (!isNaN(index) && data) {
|
|
795
|
-
obj.versions.history.push(data);
|
|
796
|
-
}
|
|
797
|
-
});
|
|
798
|
-
obj.name = formData['template-name'];
|
|
799
|
-
obj.versions.base = formData.base;
|
|
800
|
-
|
|
801
|
-
_.forEach(obj.versions.history, (index, version) => {
|
|
802
|
-
|
|
803
|
-
});
|
|
804
|
-
|
|
805
|
-
this.props.actions.createTemplate(obj);
|
|
806
|
-
};
|
|
807
|
-
|
|
808
|
-
validateFormData = (formData) => {
|
|
809
|
-
const tabCount = this.state.tabCount;
|
|
810
|
-
let isValid = true;
|
|
811
|
-
for (let cnt = 0; cnt < tabCount; cnt += 1) {
|
|
812
|
-
const index = cnt + 1;
|
|
813
|
-
if (formData[cnt]) {
|
|
814
|
-
const text = formData[cnt][`sms-editor${index > 1 ? index : ''}`];
|
|
815
|
-
if (text.indexOf('{{optout}}') === -1) {
|
|
816
|
-
isValid = false;
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
if (isValid) {
|
|
821
|
-
|
|
822
|
-
return true;
|
|
823
|
-
}
|
|
824
|
-
const message = getMessageObject('error', this.props.intl.formatMessage(messages.templateNotValid), true);
|
|
825
|
-
this.props.globalActions.addMessageToQueue(message);
|
|
826
|
-
|
|
827
|
-
return false;
|
|
828
|
-
};
|
|
829
|
-
|
|
830
|
-
handleOnTagsContextChange = (data) => {
|
|
831
|
-
|
|
832
|
-
const query = {
|
|
833
|
-
layout: 'EBILL',
|
|
834
|
-
type: 'TAG',
|
|
835
|
-
context: (data || '').toLowerCase() === 'all' ? 'default' : (data || '').toLowerCase(),
|
|
836
|
-
embedded: this.props.location.query.type === 'embedded' ? this.props.location.query.type : 'full',
|
|
837
|
-
};
|
|
838
|
-
this.props.globalActions.fetchSchemaForEntity(query);
|
|
839
|
-
};
|
|
840
|
-
|
|
841
|
-
removeStandAlone = () => {
|
|
842
|
-
const schema = _.cloneDeep(this.state.schema);
|
|
843
|
-
delete schema.standalone;
|
|
844
|
-
schema.standalone = {};
|
|
845
|
-
schema.standalone.sections = [];
|
|
846
|
-
_.forEach(schema.containers, (container) => {
|
|
847
|
-
const temp = container;
|
|
848
|
-
if (temp.type === 'tabs') {
|
|
849
|
-
temp.tabBarExtraContent = {};
|
|
850
|
-
temp.tabBarExtraContent.sections = [];
|
|
851
|
-
const basePane = _.cloneDeep(temp.panes[0]);
|
|
852
|
-
temp.tabContent = {};
|
|
853
|
-
temp.tabContent.sections = [];
|
|
854
|
-
temp.panes = [];
|
|
855
|
-
temp.panes.push(basePane);
|
|
856
|
-
}
|
|
857
|
-
});
|
|
858
|
-
this.setState({ schema });
|
|
859
|
-
};
|
|
860
|
-
|
|
861
|
-
resetState = () => {
|
|
862
|
-
this.setState({
|
|
863
|
-
formData: {},
|
|
864
|
-
tabCount: 1,
|
|
865
|
-
currentTab: 1,
|
|
866
|
-
});
|
|
867
|
-
};
|
|
868
|
-
|
|
869
|
-
resetSchema = () => {
|
|
870
|
-
|
|
871
|
-
};
|
|
872
|
-
|
|
873
|
-
insertAtCursor = (field, myValue, currentTab) => {
|
|
874
|
-
//IE support
|
|
875
|
-
const myField = field;
|
|
876
|
-
if (document.selection) {
|
|
877
|
-
myField.focus();
|
|
878
|
-
const sel = document.selection.createRange();
|
|
879
|
-
sel.text = myValue;
|
|
880
|
-
} else if (myField.selectionStart || myField.selectionStart === '0') { //MOZILLA and others
|
|
881
|
-
const startPos = myField.selectionStart;
|
|
882
|
-
const endPos = myField.selectionEnd;
|
|
883
|
-
myField.value = myField.value.substring(0, startPos)
|
|
884
|
-
+ myValue
|
|
885
|
-
+ myField.value.substring(endPos, myField.value.length);
|
|
886
|
-
myField.selectionStart = startPos + myValue.length;
|
|
887
|
-
myField.selectionEnd = startPos + myValue.length;
|
|
888
|
-
} else {
|
|
889
|
-
myField.value += myValue;
|
|
890
|
-
}
|
|
891
|
-
const formData = _.cloneDeep(this.state.formData);
|
|
892
|
-
formData[currentTab - 1][field.id] = myField.value;
|
|
893
|
-
this.setState({formData});
|
|
894
|
-
};
|
|
895
|
-
|
|
896
|
-
injectMessages(elem) {
|
|
897
|
-
const temp = elem;
|
|
898
|
-
if (temp.value && messages[temp.value]) {
|
|
899
|
-
temp.value = this.props.intl.formatMessage(messages[temp.value]);
|
|
900
|
-
}
|
|
901
|
-
if (temp.label && messages[temp.label]) {
|
|
902
|
-
temp.label = this.props.intl.formatMessage(messages[temp.label]);
|
|
903
|
-
}
|
|
904
|
-
if (temp.errorMessage && messages[temp.errorMessage]) {
|
|
905
|
-
temp.errorMessage = this.props.intl.formatMessage(messages[temp.errorMessage]);
|
|
906
|
-
}
|
|
907
|
-
if (temp.placeholder && messages[temp.placeholder]) {
|
|
908
|
-
temp.placeholder = this.props.intl.formatMessage(messages[temp.placeholder]);
|
|
909
|
-
}
|
|
910
|
-
return temp;
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
injectEvents(schema) {
|
|
915
|
-
|
|
916
|
-
const temp = schema;
|
|
917
|
-
if (!temp.standalone) {
|
|
918
|
-
temp.standalone = {};
|
|
919
|
-
}
|
|
920
|
-
temp.standalone.sections = this.injectSections(temp.standalone.sections);
|
|
921
|
-
_.forEach(temp.containers, (container) => {
|
|
922
|
-
let tempContainer = container;
|
|
923
|
-
tempContainer = this.injectContainer(tempContainer);
|
|
924
|
-
return tempContainer;
|
|
925
|
-
});
|
|
926
|
-
|
|
927
|
-
this.setState({schema}, () => {
|
|
928
|
-
const type = this.props.location.query.type;
|
|
929
|
-
if (type === 'embedded') {
|
|
930
|
-
this.removeStandAlone();
|
|
931
|
-
}
|
|
932
|
-
});
|
|
933
|
-
return schema;
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
injectContainer(container) {
|
|
937
|
-
const temp = container;
|
|
938
|
-
if (temp.type === 'tabs') {
|
|
939
|
-
temp.tabContent.sections = this.injectSections(temp.tabContent.sections);
|
|
940
|
-
temp.tabBarExtraContent.sections = this.injectSections(temp.tabBarExtraContent.sections);
|
|
941
|
-
temp.tabContent.sections = this.injectSections(temp.tabContent.sections);
|
|
942
|
-
temp.injectedEvents = {};
|
|
943
|
-
_.forEach(temp.supportedEvents, (event) => {
|
|
944
|
-
temp.injectedEvents[event] = this.getMappedEvent(temp.id, event);
|
|
945
|
-
});
|
|
946
|
-
_.forEach(temp.panes, (pane) => {
|
|
947
|
-
const tempPane = pane;
|
|
948
|
-
tempPane.sections = this.injectSections(tempPane.sections);
|
|
949
|
-
});
|
|
950
|
-
}
|
|
951
|
-
return temp;
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
injectMultiColSection(section) {
|
|
955
|
-
_.forEach(section.inputFields, (inputField) => {
|
|
956
|
-
_.forEach(inputField.cols, (col) => {
|
|
957
|
-
const temp = col;
|
|
958
|
-
if (temp.type === 'popover') {
|
|
959
|
-
temp.content.sections = this.injectSections(temp.content.sections);
|
|
960
|
-
temp.value.sections = this.injectSections(temp.value.sections);
|
|
961
|
-
return true;
|
|
962
|
-
}
|
|
963
|
-
temp.injectedEvents = {};
|
|
964
|
-
_.forEach(col.supportedEvents, (event) => {
|
|
965
|
-
temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
|
|
966
|
-
});
|
|
967
|
-
|
|
968
|
-
if (temp.type === 'icon') {
|
|
969
|
-
return true;
|
|
970
|
-
}
|
|
971
|
-
if (temp.value && messages[temp.value]) {
|
|
972
|
-
temp.value = this.props.intl.formatMessage(messages[temp.value]);
|
|
973
|
-
}
|
|
974
|
-
if (temp.label && messages[temp.label]) {
|
|
975
|
-
temp.label = this.props.intl.formatMessage(messages[temp.label]);
|
|
976
|
-
}
|
|
977
|
-
if (temp.errorMessage && messages[temp.errorMessage]) {
|
|
978
|
-
temp.errorMessage = this.props.intl.formatMessage(messages[temp.errorMessage]);
|
|
979
|
-
}
|
|
980
|
-
if (temp.placeholder && messages[temp.placeholder]) {
|
|
981
|
-
temp.placeholder = this.props.intl.formatMessage(messages[temp.placeholder]);
|
|
982
|
-
}
|
|
983
|
-
return true;
|
|
984
|
-
});
|
|
985
|
-
});
|
|
986
|
-
_.forEach(section.actionFields, (actionField) => {
|
|
987
|
-
_.forEach(actionField.cols, (col) => {
|
|
988
|
-
const temp = col;
|
|
989
|
-
if (temp.type === 'popover') {
|
|
990
|
-
temp.content.sections = this.injectSections(temp.content.sections);
|
|
991
|
-
temp.value.sections = this.injectSections(temp.value.sections);
|
|
992
|
-
return true;
|
|
993
|
-
}
|
|
994
|
-
temp.injectedEvents = {};
|
|
995
|
-
_.forEach(col.supportedEvents, (event) => {
|
|
996
|
-
temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
|
|
997
|
-
});
|
|
998
|
-
|
|
999
|
-
if (temp.type === 'icon') {
|
|
1000
|
-
return true;
|
|
1001
|
-
}
|
|
1002
|
-
if (temp.value && messages[temp.value]) {
|
|
1003
|
-
temp.value = this.props.intl.formatMessage(messages[temp.value]);
|
|
1004
|
-
}
|
|
1005
|
-
if (temp.label && messages[temp.label]) {
|
|
1006
|
-
temp.label = this.props.intl.formatMessage(messages[temp.label]);
|
|
1007
|
-
}
|
|
1008
|
-
if (temp.errorMessage && messages[temp.errorMessage]) {
|
|
1009
|
-
temp.errorMessage = this.props.intl.formatMessage(messages[temp.errorMessage]);
|
|
1010
|
-
}
|
|
1011
|
-
if (temp.placeholder && messages[temp.placeholder]) {
|
|
1012
|
-
temp.placeholder = this.props.intl.formatMessage(messages[temp.placeholder]);
|
|
1013
|
-
}
|
|
1014
|
-
return true;
|
|
1015
|
-
});
|
|
1016
|
-
});
|
|
1017
|
-
return section;
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
injectColLabelSection(section) {
|
|
1021
|
-
_.forEach(section.inputFields, (inputField) => {
|
|
1022
|
-
const temp = inputField;
|
|
1023
|
-
if (temp.type === 'popover') {
|
|
1024
|
-
temp.content.sections = this.injectSections(temp.content.sections);
|
|
1025
|
-
temp.value.sections = this.injectSections(temp.value.sections);
|
|
1026
|
-
return true;
|
|
1027
|
-
}
|
|
1028
|
-
temp.injectedEvents = {};
|
|
1029
|
-
_.forEach(inputField.supportedEvents, (event) => {
|
|
1030
|
-
temp.injectedEvents[event] = this.getMappedEvent(inputField.id, event);
|
|
1031
|
-
});
|
|
1032
|
-
|
|
1033
|
-
if (temp.type === 'icon') {
|
|
1034
|
-
return true;
|
|
1035
|
-
}
|
|
1036
|
-
if (temp.value && messages[temp.value]) {
|
|
1037
|
-
temp.value = this.props.intl.formatMessage(messages[temp.value]);
|
|
1038
|
-
}
|
|
1039
|
-
if (temp.label && messages[temp.label]) {
|
|
1040
|
-
temp.label = this.props.intl.formatMessage(messages[temp.label]);
|
|
1041
|
-
}
|
|
1042
|
-
if (temp.errorMessage && messages[temp.errorMessage]) {
|
|
1043
|
-
temp.errorMessage = this.props.intl.formatMessage(messages[temp.errorMessage]);
|
|
1044
|
-
}
|
|
1045
|
-
if (temp.placeholder && messages[temp.placeholder]) {
|
|
1046
|
-
temp.placeholder = this.props.intl.formatMessage(messages[temp.placeholder]);
|
|
1047
|
-
}
|
|
1048
|
-
return true;
|
|
1049
|
-
});
|
|
1050
|
-
_.forEach(section.actionFields, (actionField) => {
|
|
1051
|
-
const temp = actionField;
|
|
1052
|
-
if (temp.type === 'popover') {
|
|
1053
|
-
temp.content.sections = this.injectSections(temp.content.sections);
|
|
1054
|
-
temp.value.sections = this.injectSections(temp.value.sections);
|
|
1055
|
-
return true;
|
|
1056
|
-
}
|
|
1057
|
-
temp.injectedEvents = {};
|
|
1058
|
-
_.forEach(actionField.supportedEvents, (event) => {
|
|
1059
|
-
temp.injectedEvents[event] = this.getMappedEvent(actionField.id, event);
|
|
1060
|
-
});
|
|
1061
|
-
|
|
1062
|
-
if (temp.type === 'icon') {
|
|
1063
|
-
return true;
|
|
1064
|
-
}
|
|
1065
|
-
if (temp.value && messages[temp.value]) {
|
|
1066
|
-
temp.value = this.props.intl.formatMessage(messages[temp.value]);
|
|
1067
|
-
}
|
|
1068
|
-
if (temp.label && messages[temp.label]) {
|
|
1069
|
-
temp.label = this.props.intl.formatMessage(messages[temp.label]);
|
|
1070
|
-
}
|
|
1071
|
-
if (temp.errorMessage && messages[temp.errorMessage]) {
|
|
1072
|
-
temp.errorMessage = this.props.intl.formatMessage(messages[temp.errorMessage]);
|
|
1073
|
-
}
|
|
1074
|
-
if (temp.placeholder && messages[temp.placeholder]) {
|
|
1075
|
-
temp.placeholder = this.props.intl.formatMessage(messages[temp.placeholder]);
|
|
1076
|
-
}
|
|
1077
|
-
return true;
|
|
1078
|
-
});
|
|
1079
|
-
return section;
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
injectSections(sections) {
|
|
1083
|
-
_.forEach(sections, (section) => {
|
|
1084
|
-
let temp = section;
|
|
1085
|
-
if (temp.type === 'col-label') {
|
|
1086
|
-
temp = this.injectColLabelSection(temp);
|
|
1087
|
-
} else if (section.type === 'multicols') {
|
|
1088
|
-
temp = this.injectMultiColSection(temp);
|
|
1089
|
-
} else if (section.type === 'parent') {
|
|
1090
|
-
temp = this.injectSections(temp.childSections);
|
|
1091
|
-
}
|
|
1092
|
-
});
|
|
1093
|
-
return sections;
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
injectParentSection(section) {
|
|
1097
|
-
_.forEach(section.childSections, (childSection) => {
|
|
1098
|
-
let temp = childSection;
|
|
1099
|
-
if (temp.type === 'col-label') {
|
|
1100
|
-
temp = this.injectColLabelSection(temp);
|
|
1101
|
-
} else if (section.type === 'multicols') {
|
|
1102
|
-
temp = this.injectMultiColSection(temp);
|
|
1103
|
-
} else if (section.type === 'parent') {
|
|
1104
|
-
temp = this.injectParentSection(temp);
|
|
1105
|
-
}
|
|
1106
|
-
});
|
|
1107
|
-
return section;
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
cloneColLabel(sectionObj, tabIndex) {
|
|
1111
|
-
|
|
1112
|
-
const section = _.cloneDeep(sectionObj);
|
|
1113
|
-
const inputFields = _.forEach(section.inputFields, (inputField) => {
|
|
1114
|
-
const inputF = inputField;
|
|
1115
|
-
inputF.id = `${inputField.id}${tabIndex}`;
|
|
1116
|
-
inputF.paneIndex = tabIndex;
|
|
1117
|
-
return inputF;
|
|
1118
|
-
});
|
|
1119
|
-
section.inputFields = inputFields;
|
|
1120
|
-
|
|
1121
|
-
return section;
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
cloneMultiCol(sectionObj, tabIndex) {
|
|
1125
|
-
|
|
1126
|
-
const section = _.cloneDeep(sectionObj);
|
|
1127
|
-
const inputFields = _.forEach(section.inputFields, (inputField) => {
|
|
1128
|
-
const inputF = inputField;
|
|
1129
|
-
const cols = _.forEach(inputF.cols, (col) => {
|
|
1130
|
-
const colTemp = col;
|
|
1131
|
-
colTemp.id = `${col.id}${tabIndex}`;
|
|
1132
|
-
colTemp.paneIndex = tabIndex;
|
|
1133
|
-
return colTemp;
|
|
1134
|
-
});
|
|
1135
|
-
inputF.cols = cols;
|
|
1136
|
-
return inputF;
|
|
1137
|
-
});
|
|
1138
|
-
section.inputFields = inputFields;
|
|
1139
|
-
|
|
1140
|
-
return section;
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
cloneParent(section, tabIndex) {
|
|
1144
|
-
console.log('trying to clone', JSON.stringify(section), tabIndex);
|
|
1145
|
-
const parentsect = section;
|
|
1146
|
-
const childSectionsBeforeCloning = parentsect.childSections.slice();
|
|
1147
|
-
const childSections = [];
|
|
1148
|
-
_.forEach(childSectionsBeforeCloning, (childSection) => {
|
|
1149
|
-
let sect = {};
|
|
1150
|
-
if (childSection.type === 'col-label') {
|
|
1151
|
-
sect = this.cloneColLabel(childSection, tabIndex);
|
|
1152
|
-
} else if (childSection.type === 'multicols') {
|
|
1153
|
-
sect = this.cloneMultiCol(childSection, tabIndex);
|
|
1154
|
-
} else if (childSection.type === 'parent') {
|
|
1155
|
-
sect = this.cloneParent(childSection, tabIndex);
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
childSections.push(sect);
|
|
1159
|
-
return true;
|
|
1160
|
-
});
|
|
1161
|
-
console.log('returning cloned parent section final 1', JSON.stringify(childSections));
|
|
1162
|
-
parentsect.childSections = childSections;
|
|
1163
|
-
|
|
1164
|
-
return _.cloneDeep(parentsect);
|
|
1165
|
-
}
|
|
1166
|
-
|
|
1167
|
-
render() {
|
|
1168
|
-
const previewHeader = (<h3>{this.props.intl.formatMessage(messages.ebillPreview)}</h3>);
|
|
1169
|
-
const loaderText = this.props.intl.formatMessage(messages.loading);
|
|
1170
|
-
const spinning = false;
|
|
1171
|
-
const schema = this.state.schema;
|
|
1172
|
-
return (
|
|
1173
|
-
<div className="ebill-container">
|
|
1174
|
-
<Helmet
|
|
1175
|
-
title="Ebill"
|
|
1176
|
-
/>
|
|
1177
|
-
<Spin tip={loaderText} spinning={spinning}>
|
|
1178
|
-
{this.props.location.query.type !== 'embedded' && <Row>
|
|
1179
|
-
<Col span={24}>
|
|
1180
|
-
{this.props.location.query.type !== "embedded" &&
|
|
1181
|
-
<Breadcrumb>
|
|
1182
|
-
<BreadcrumbItem>{this.props.intl.formatMessage(messages.campaigns)}</BreadcrumbItem>
|
|
1183
|
-
<BreadcrumbItem>{this.props.intl.formatMessage(messages.creatives)}</BreadcrumbItem>
|
|
1184
|
-
<BreadcrumbItem>{this.props.intl.formatMessage(messages.ebill)}</BreadcrumbItem>
|
|
1185
|
-
</Breadcrumb>
|
|
1186
|
-
}
|
|
1187
|
-
</Col>
|
|
1188
|
-
</Row>}
|
|
1189
|
-
<Row>
|
|
1190
|
-
<Col>
|
|
1191
|
-
<FormBuilder
|
|
1192
|
-
schema={schema}
|
|
1193
|
-
onSubmit={this.saveFormData}
|
|
1194
|
-
onChange={this.onFormDataChange}
|
|
1195
|
-
currentTab={this.state.currentTab}
|
|
1196
|
-
parent={this}
|
|
1197
|
-
formData={_.cloneDeep(this.state.formData)}
|
|
1198
|
-
location={this.props.location}
|
|
1199
|
-
tabKey={this.state.tabKey}
|
|
1200
|
-
tags={this.props.metaEntities && this.props.metaEntities.tags ? this.props.metaEntities.tags.standard : []}
|
|
1201
|
-
injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
|
|
1202
|
-
onFormValidityChange={this.setFormValidity}
|
|
1203
|
-
handleCancelModal={this.handleCancelModal}
|
|
1204
|
-
usingTabContainer
|
|
1205
|
-
checkValidation={this.state.checkValidation}
|
|
1206
|
-
onContextChange={this.handleOnTagsContextChange}
|
|
1207
|
-
tabCount={this.state.tabCount}
|
|
1208
|
-
// isNewVersionFlow
|
|
1209
|
-
modal={this.state.modalContent}
|
|
1210
|
-
showModal={this.state.showModal}
|
|
1211
|
-
isEdit={this.state.isEdit}
|
|
1212
|
-
iframeParent={parent}
|
|
1213
|
-
router={this.props.router}
|
|
1214
|
-
// baseLanguage={this.props.Global.currentOrgDetails.basic_details.base_language}
|
|
1215
|
-
// supportedLanguages={this.props.Global.currentOrgDetails.basic_details.supported_languages}
|
|
1216
|
-
// isSchemaChanged={this.state.isSchemaChanged}
|
|
1217
|
-
/>
|
|
1218
|
-
</Col>
|
|
1219
|
-
</Row>
|
|
1220
|
-
</Spin>
|
|
1221
|
-
{/* <div style={{display: 'inline-block', verticalAlign: 'top', width: '100%', height: '450px', borderLeft: '1px solid #b7b7b7'}}>
|
|
1222
|
-
<div style={{width: "100%", height: '100%'}}>
|
|
1223
|
-
<textarea style={{background: '#efefef', resize: 'none', float: 'left', border: '1px solid #efefef', width: "100%", height: '100%'}} value={this.props.Templates.selectedEmailLayout}>
|
|
1224
|
-
</textarea>
|
|
1225
|
-
</div>
|
|
1226
|
-
</div> */}
|
|
1227
|
-
{this.state.formData[this.state.currentTab - 1] && <EmailPreview
|
|
1228
|
-
header={previewHeader}
|
|
1229
|
-
content={this.state.formData[this.state.currentTab - 1][`ebill-editor${this.state.currentTab > 1 ? this.state.currentTab : ''}`]}
|
|
1230
|
-
show={this.state.showEbillPreview}
|
|
1231
|
-
device={this.state.device}
|
|
1232
|
-
handleClose={this.toggleEmailPreview}
|
|
1233
|
-
changePreviewDevice={this.changePreviewDevice}
|
|
1234
|
-
/>}
|
|
1235
|
-
</div>
|
|
1236
|
-
);
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
Ebill.propTypes = {
|
|
1241
|
-
Ebill: PropTypes.object.isRequired,
|
|
1242
|
-
actions: PropTypes.object.isRequired,
|
|
1243
|
-
params: PropTypes.object,
|
|
1244
|
-
router: PropTypes.object,
|
|
1245
|
-
Templates: PropTypes.object,
|
|
1246
|
-
globalActions: PropTypes.object,
|
|
1247
|
-
location: PropTypes.object,
|
|
1248
|
-
intl: intlShape.isRequired,
|
|
1249
|
-
metaEntities: PropTypes.object,
|
|
1250
|
-
// Global: PropTypes.object,
|
|
1251
|
-
injectedTags: PropTypes.object,
|
|
1252
|
-
};
|
|
1253
|
-
|
|
1254
|
-
const mapStateToProps = createStructuredSelector({
|
|
1255
|
-
Ebill: makeSelectEbill(),
|
|
1256
|
-
Templates: makeSelectTemplates(),
|
|
1257
|
-
metaEntities: makeSelectMetaEntities(),
|
|
1258
|
-
Global: makeSelectAuthenticated(),
|
|
1259
|
-
injectedTags: setInjectedTags(),
|
|
1260
|
-
});
|
|
1261
|
-
|
|
1262
|
-
function mapDispatchToProps(dispatch) {
|
|
1263
|
-
return {
|
|
1264
|
-
actions: bindActionCreators(actions, dispatch),
|
|
1265
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
1266
|
-
};
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
|
1270
|
-
const withReducer = injectReducer({ key: 'ebill', reducer });
|
|
1271
|
-
const withSaga = injectSaga({ key: 'ebill', saga: ebillSaga });
|
|
1272
|
-
|
|
1273
|
-
export default compose(
|
|
1274
|
-
UserIsAuthenticated,
|
|
1275
|
-
withReducer,
|
|
1276
|
-
withSaga,
|
|
1277
|
-
withConnect,
|
|
1278
|
-
)(injectIntl(Ebill));
|