@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,2303 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* Create
|
|
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 { Row, Col, Spin, Breadcrumb, notification } from 'antd';
|
|
13
|
-
import _ from 'lodash';
|
|
14
|
-
import { createStructuredSelector } from 'reselect';
|
|
15
|
-
import { injectIntl, intlShape } from 'react-intl';
|
|
16
|
-
import { makeSelectCreate, makeSelectCreateResponse } from './selectors';
|
|
17
|
-
import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
|
|
18
|
-
import * as globalActions from '../../../containers/Cap/actions';
|
|
19
|
-
import FormBuilder from '../../../components/FormBuilder';
|
|
20
|
-
import './_mobilePushCreate.scss';
|
|
21
|
-
import * as actions from './actions';
|
|
22
|
-
import {getMessageObject} from '../../../utils/messageUtils';
|
|
23
|
-
import { makeSelectTemplates } from '../../Templates/selectors';
|
|
24
|
-
import messages from './messages';
|
|
25
|
-
import injectReducer from '../../../utils/injectReducer';
|
|
26
|
-
import injectSaga from '../../../utils/injectSaga';
|
|
27
|
-
import reducer from './reducer';
|
|
28
|
-
import { createMPushSaga } from './sagas';
|
|
29
|
-
import { UserIsAuthenticated } from '../../../utils/authWrapper';
|
|
30
|
-
import { createQueryString } from '../../../utils/common';
|
|
31
|
-
|
|
32
|
-
const BreadcrumbItem = Breadcrumb.Item;
|
|
33
|
-
export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
34
|
-
constructor(props) {
|
|
35
|
-
super(props);
|
|
36
|
-
if (this.props.Templates.selectedWeChatAccount) {
|
|
37
|
-
const map = {
|
|
38
|
-
"template-name": {
|
|
39
|
-
onChange: this.onTemplateNameChange,
|
|
40
|
-
},
|
|
41
|
-
"cta-deeplink-secondary-cta-0": {
|
|
42
|
-
onChange: this.onLinkTypeChange,
|
|
43
|
-
},
|
|
44
|
-
"cta-deeplink-secondary-cta-1": {
|
|
45
|
-
onChange: this.onLinkTypeChange,
|
|
46
|
-
},
|
|
47
|
-
"cta-deeplink-secondary-cta-12": {
|
|
48
|
-
onChange: this.onLinkTypeChange,
|
|
49
|
-
},
|
|
50
|
-
"cta-deeplink-delete": {
|
|
51
|
-
onDelete: this.deletePrimaryCTA,
|
|
52
|
-
},
|
|
53
|
-
"cta-deeplink2-delete": {
|
|
54
|
-
onDelete: this.deletePrimaryCTA,
|
|
55
|
-
},
|
|
56
|
-
"secondary-cta-0-delete": {
|
|
57
|
-
onDelete: this.deleteSecondaryCTA,
|
|
58
|
-
},
|
|
59
|
-
"secondary-cta-1-delete": {
|
|
60
|
-
onDelete: this.deleteSecondaryCTA,
|
|
61
|
-
},
|
|
62
|
-
"secondary-cta-1-delete-ios": {
|
|
63
|
-
onDelete: this.deleteSecondaryCtaIos,
|
|
64
|
-
},
|
|
65
|
-
"discard-button": {
|
|
66
|
-
discardValues: this.discardValues,
|
|
67
|
-
},
|
|
68
|
-
"cancel-button": {
|
|
69
|
-
cancelTemplate: this.cancelTemplate,
|
|
70
|
-
},
|
|
71
|
-
"copy-android-content": {
|
|
72
|
-
onClick: this.copyAndroidContent,
|
|
73
|
-
},
|
|
74
|
-
"copy-iphone-content": {
|
|
75
|
-
onClick: this.copyIphoneContent,
|
|
76
|
-
},
|
|
77
|
-
"save-button": {
|
|
78
|
-
saveFormData: this.saveFormData,
|
|
79
|
-
},
|
|
80
|
-
"message-editor": {
|
|
81
|
-
onChange: this.onTemplateContentChange,
|
|
82
|
-
},
|
|
83
|
-
"message-editor2": {
|
|
84
|
-
onChange: this.onTemplateContentChange,
|
|
85
|
-
},
|
|
86
|
-
"message-tagList": {
|
|
87
|
-
onTagSelect: this.onTagSelect,
|
|
88
|
-
},
|
|
89
|
-
"message-tagList2": {
|
|
90
|
-
onTagSelect: this.onTagSelect,
|
|
91
|
-
},
|
|
92
|
-
"title-tagList": {
|
|
93
|
-
onTagSelect: this.onTagSelect,
|
|
94
|
-
},
|
|
95
|
-
"title-tagList2": {
|
|
96
|
-
onTagSelect: this.onTagSelect,
|
|
97
|
-
},
|
|
98
|
-
"pane": {
|
|
99
|
-
onTabChange: this.onTabChange,
|
|
100
|
-
},
|
|
101
|
-
"cta-deeplink": {
|
|
102
|
-
onChange: this.onLinkTypeChange,
|
|
103
|
-
},
|
|
104
|
-
"cta-deeplink2": {
|
|
105
|
-
onChange: this.onLinkTypeChange,
|
|
106
|
-
},
|
|
107
|
-
"cta-deeplink-secondary-cta-1-select": {
|
|
108
|
-
onSelect: this.showCtaKeys,
|
|
109
|
-
},
|
|
110
|
-
"cta-deeplink-secondary-cta-0-select": {
|
|
111
|
-
onSelect: this.showCtaKeys,
|
|
112
|
-
},
|
|
113
|
-
"cta-deeplink-secondary-cta-1-select2": {
|
|
114
|
-
onSelect: this.showCtaKeys,
|
|
115
|
-
},
|
|
116
|
-
"cta-deeplink-select": {
|
|
117
|
-
onSelect: this.showCtaKeys,
|
|
118
|
-
},
|
|
119
|
-
"cta-deeplink2-select": {
|
|
120
|
-
onSelect: this.showCtaKeys,
|
|
121
|
-
},
|
|
122
|
-
"add-pri-cta": {
|
|
123
|
-
addPrimaryCta: this.addPrimaryCta,
|
|
124
|
-
},
|
|
125
|
-
"add-pri-cta-ios": {
|
|
126
|
-
addPrimaryCta: this.addPrimaryCta,
|
|
127
|
-
},
|
|
128
|
-
"add-sec-cta": {
|
|
129
|
-
addSecondaryCta: this.addSecondoryCta,
|
|
130
|
-
},
|
|
131
|
-
"add-sec-cta-ios": {
|
|
132
|
-
addSecondaryCtaIos: this.addSecondoryCtaIos,
|
|
133
|
-
},
|
|
134
|
-
"image-upload-android": {
|
|
135
|
-
onUpload: this.uploadImage,
|
|
136
|
-
},
|
|
137
|
-
"image-upload-ios": {
|
|
138
|
-
onUpload: this.uploadImage,
|
|
139
|
-
},
|
|
140
|
-
"secondary-cta-1-table": {
|
|
141
|
-
onRowClick: this.selectCtaIos,
|
|
142
|
-
},
|
|
143
|
-
"cta-deeplink-select-show-keys": {
|
|
144
|
-
onShowCtaKeys: this.showCtaKeys,
|
|
145
|
-
},
|
|
146
|
-
"cta-deeplink-secondary-cta-0-select-show-keys": {
|
|
147
|
-
onShowCtaKeys: this.showCtaKeys,
|
|
148
|
-
},
|
|
149
|
-
"cta-deeplink-secondary-cta-1-select-show-keys": {
|
|
150
|
-
onShowCtaKeys: this.showCtaKeys,
|
|
151
|
-
},
|
|
152
|
-
"wechat-template": {
|
|
153
|
-
onSelect: this.onTemplateChange,
|
|
154
|
-
},
|
|
155
|
-
};
|
|
156
|
-
this.state = {
|
|
157
|
-
formData: {},
|
|
158
|
-
tabCount: 1,
|
|
159
|
-
currentTab: 1,
|
|
160
|
-
loading: false,
|
|
161
|
-
isFormValid: true,
|
|
162
|
-
tabKey: '',
|
|
163
|
-
checkValidation: false,
|
|
164
|
-
schema: {},
|
|
165
|
-
eventsMap: map,
|
|
166
|
-
errorData: {},
|
|
167
|
-
displayProps: {},
|
|
168
|
-
modalContent: {title: this.props.intl.formatMessage(messages.alertMessage), body: this.props.intl.formatMessage(messages.templateNotConfigured), type: 'confirm'},
|
|
169
|
-
injectedTags: {},
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
componentWillMount = () => {
|
|
174
|
-
if (this.props.route.name === 'view') {
|
|
175
|
-
this.setState({loading: false});
|
|
176
|
-
this.removeStandAlone();
|
|
177
|
-
}
|
|
178
|
-
if (this.props.params.mode) {
|
|
179
|
-
this.setState({mode: this.props.params.mode});
|
|
180
|
-
}
|
|
181
|
-
if (!this.props.Templates.selectedWeChatAccount) {
|
|
182
|
-
const type = this.props.location.query.type;
|
|
183
|
-
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
184
|
-
this.props.router.push({
|
|
185
|
-
pathname: `/MOBILEPUSH/`,
|
|
186
|
-
search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
this.props.globalActions.removeEntitySchema();
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
componentDidMount = () => {
|
|
193
|
-
|
|
194
|
-
const query = {
|
|
195
|
-
layout: 'MOBILEPUSH',
|
|
196
|
-
type: 'LAYOUT',
|
|
197
|
-
};
|
|
198
|
-
this.props.globalActions.fetchSchemaForEntity(query);
|
|
199
|
-
window.addEventListener("message", this.handleFrameTasks);
|
|
200
|
-
const type = this.props.location.query.type;
|
|
201
|
-
if (type === 'embedded') {
|
|
202
|
-
const response = {
|
|
203
|
-
action: 'startTemplateCreation',
|
|
204
|
-
};
|
|
205
|
-
parent.postMessage(JSON.stringify(response), '*');
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
componentWillReceiveProps = (nextProps) => {
|
|
210
|
-
|
|
211
|
-
if (nextProps.isGetFormData) {
|
|
212
|
-
nextProps.getFormLibraryData(this.getFormData());
|
|
213
|
-
}
|
|
214
|
-
if (nextProps.Create.uploadedAssetData) {
|
|
215
|
-
const formData = _.cloneDeep(this.state.formData);
|
|
216
|
-
formData[this.state.currentTab - 1].image = nextProps.Create.uploadedAssetData.metaInfo.public_url;
|
|
217
|
-
this.setState({formData});
|
|
218
|
-
this.props.actions.clearAsset();
|
|
219
|
-
}
|
|
220
|
-
if (nextProps.createResponse && nextProps.createResponse.templateId) {
|
|
221
|
-
|
|
222
|
-
this.discardValues();
|
|
223
|
-
const message = getMessageObject('success', this.props.intl.formatMessage(messages["Mobile Push Template Created Successfully"]), true);
|
|
224
|
-
this.props.globalActions.addMessageToQueue(message);
|
|
225
|
-
this.props.actions.clearCreateResponse();
|
|
226
|
-
const type = this.props.location.query.type;
|
|
227
|
-
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
228
|
-
this.props.router.push({
|
|
229
|
-
pathname: `/mobilepush/`,
|
|
230
|
-
search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
if (nextProps.params.mode) {
|
|
234
|
-
this.setState({mode: nextProps.params.mode});
|
|
235
|
-
}
|
|
236
|
-
if (nextProps.Create.createTemplateError && !_.isEqual(nextProps.Create.createTemplateError, this.props.Create.createTemplateError)) {
|
|
237
|
-
const message = getMessageObject('error', (nextProps.Create.createTemplateErrorMessage && nextProps.Create.createTemplateErrorMessage !== '') ? nextProps.Create.createTemplateErrorMessage : this.props.intl.formatMessage(messages.somethingWentWrong), true);
|
|
238
|
-
this.props.globalActions.addMessageToQueue(message);
|
|
239
|
-
}
|
|
240
|
-
if (nextProps.Create.iosCtasData) {
|
|
241
|
-
this.setState({iosCtasData: nextProps.Create.iosCtasData});
|
|
242
|
-
}
|
|
243
|
-
if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && _.isEmpty(this.state.schema)) {
|
|
244
|
-
|
|
245
|
-
const schema = this.props.params.mode === "text" ? nextProps.metaEntities.layouts[0].definition.textSchema : nextProps.metaEntities.layouts[0].definition.imageSchema;
|
|
246
|
-
schema.standalone.sections.splice(1, 1);
|
|
247
|
-
this.injectEvents(schema);
|
|
248
|
-
const query = {
|
|
249
|
-
layout: 'mobilepush',
|
|
250
|
-
type: 'TAG',
|
|
251
|
-
context: this.props.location.query.type === 'embedded' ? this.props.location.query.module : 'default',
|
|
252
|
-
embedded: this.props.location.query.type === 'embedded' ? this.props.location.query.type : 'full',
|
|
253
|
-
};
|
|
254
|
-
if (this.props.getDefaultTags) {
|
|
255
|
-
query.context = this.props.getDefaultTags;
|
|
256
|
-
}
|
|
257
|
-
this.props.globalActions.fetchSchemaForEntity(query);
|
|
258
|
-
if (this.props.location.query.type === 'embedded') {
|
|
259
|
-
this.showNext();
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
};
|
|
263
|
-
componentWillUnmount = () => {
|
|
264
|
-
|
|
265
|
-
window.removeEventListener("message", this.handleFrameTasks);
|
|
266
|
-
};
|
|
267
|
-
onTemplateChange = () => {
|
|
268
|
-
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
onFormDataChange = (formData, tabCount, currentTab) => {
|
|
272
|
-
|
|
273
|
-
const newFormData = _.cloneDeep(formData);
|
|
274
|
-
if (newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-table`]) {
|
|
275
|
-
newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-label`] = newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-table`].name;
|
|
276
|
-
newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-action`] = newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-table`].ctaTemplateDetails[0].buttonText;
|
|
277
|
-
delete newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-action2`];
|
|
278
|
-
if (newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-table`].ctaTemplateDetails[1]) {
|
|
279
|
-
newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-action2`] = newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-table`].ctaTemplateDetails[1].buttonText;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
if (this.state.isSchemaChanged) {
|
|
283
|
-
this.setState({isSchemaChanged: false});
|
|
284
|
-
}
|
|
285
|
-
// copy content code
|
|
286
|
-
// if (newFormData[0]['copy-iphone-content'] === "") {
|
|
287
|
-
//
|
|
288
|
-
// if(!!formData[1]['message-editor2'] && !!formData[1]['message-title2']){
|
|
289
|
-
// dispplayProps[0]['copy-iphone-content'] = true;
|
|
290
|
-
// }
|
|
291
|
-
// } else {
|
|
292
|
-
// if(formData[1]['message-editor2'] === "" || formData[1]['message-title2'] === ""){
|
|
293
|
-
// newFormData[0]['copy-iphone-content'] = "";
|
|
294
|
-
// }
|
|
295
|
-
// }
|
|
296
|
-
// if (newFormData[1]['copy-android-content'] === "") {
|
|
297
|
-
//
|
|
298
|
-
// if(!!formData[0]['message-editor'] && !!formData[0]['message-title']){
|
|
299
|
-
// newFormData[1]['copy-android-content'] = true;
|
|
300
|
-
// }
|
|
301
|
-
// } else {
|
|
302
|
-
// if(formData[0]['message-editor'] === "" || formData[0]['message-title'] === ""){
|
|
303
|
-
// newFormData[1]['copy-android-content'] = "";
|
|
304
|
-
// }
|
|
305
|
-
// }
|
|
306
|
-
this.setState({formData: newFormData, tabCount});
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
onTagSelect = (data, currentTab, srcComp) => {
|
|
310
|
-
|
|
311
|
-
const editorId = srcComp.target;
|
|
312
|
-
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}`, currentTab);
|
|
313
|
-
document.getElementById(editorId).focus();
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
onTabChange = (data) => {
|
|
317
|
-
|
|
318
|
-
this.setState({currentTab: data});
|
|
319
|
-
};
|
|
320
|
-
onTemplateNameChange = (name) => {
|
|
321
|
-
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
onLinkTypeChange = (eventTriggered, formData, field) => {
|
|
326
|
-
const schema = _.cloneDeep(this.state.schema);
|
|
327
|
-
_.forEach(schema.containers, (container) => {
|
|
328
|
-
_.forEach(container.panes, (pane, paneIndex) => {
|
|
329
|
-
_.forEach(pane.sections, (section) => {
|
|
330
|
-
_.forEach(section.childSections, (childeSection) => {
|
|
331
|
-
_.forEach(childeSection.childSections, (child) => {
|
|
332
|
-
const formChaild = child;
|
|
333
|
-
if (child.type === 'multicols') {
|
|
334
|
-
_.forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
335
|
-
if (inputField) {
|
|
336
|
-
_.forEach(inputField.cols, (col) => {
|
|
337
|
-
if (col.id === field.id && paneIndex === this.state.currentTab - 1) {
|
|
338
|
-
|
|
339
|
-
const deeplinks = this.props.Templates.selectedWeChatAccount && this.props.Templates.selectedWeChatAccount.configs && !!this.props.Templates.selectedWeChatAccount.configs.deeplink ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
340
|
-
const deepLinkOptions = this.props.Templates.selectedWeChatAccount ? _.map(JSON.parse(deeplinks), (link) => ({label: link.name, value: link.link, title: link.link }) ) : [];
|
|
341
|
-
const deeplinkValue = formData[this.state.currentTab - 1][field.id];
|
|
342
|
-
const componentIndex = fieldIndex + 1;
|
|
343
|
-
const inputId = deeplinkValue && deeplinkValue.toLowerCase() === "deeplink" ? `${col.id}-select` : `${col.id}-text`;
|
|
344
|
-
if ( deeplinkValue && deeplinkValue.toLowerCase() === "deeplink" && (fieldIndex === child.inputFields.length - 1 || child.inputFields[componentIndex].id !== "cta-deeplink-select-section")) {
|
|
345
|
-
const row = {
|
|
346
|
-
rowClassName: 'mobile-push-row',
|
|
347
|
-
id: 'cta-deeplink-select-section',
|
|
348
|
-
cols: [
|
|
349
|
-
{
|
|
350
|
-
id: "cta-label",
|
|
351
|
-
metaType: "label",
|
|
352
|
-
value: "",
|
|
353
|
-
primitive: true,
|
|
354
|
-
dynamicTab: false,
|
|
355
|
-
type: "div",
|
|
356
|
-
width: 4,
|
|
357
|
-
onlyDisplay: true,
|
|
358
|
-
colStyle: {
|
|
359
|
-
flex: 1,
|
|
360
|
-
},
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
id: inputId,
|
|
364
|
-
placeholder: this.props.intl.formatMessage(messages.selectDeepLink),
|
|
365
|
-
type: "select", //Resembles component to be used
|
|
366
|
-
options: deepLinkOptions,
|
|
367
|
-
metaType: "text",
|
|
368
|
-
datatype: "string",
|
|
369
|
-
errorMessage: this.props.intl.formatMessage(messages.selectADeeplink),
|
|
370
|
-
required: true,
|
|
371
|
-
fluid: true,
|
|
372
|
-
width: 19,
|
|
373
|
-
style: {
|
|
374
|
-
fontSize: '14px',
|
|
375
|
-
fontFamily: 'open-sans',
|
|
376
|
-
fontStyle: 'normal',
|
|
377
|
-
// fontWeight: 600,
|
|
378
|
-
marginBottom: '16px',
|
|
379
|
-
},
|
|
380
|
-
styling: "semantic",
|
|
381
|
-
order: 1,
|
|
382
|
-
customComponent: false,
|
|
383
|
-
supportedEvents: [
|
|
384
|
-
'onSelect',
|
|
385
|
-
],
|
|
386
|
-
},
|
|
387
|
-
],
|
|
388
|
-
};
|
|
389
|
-
if (!child.inputFields[fieldIndex + 1] || child.inputFields[componentIndex].id === "cta-external-link") {
|
|
390
|
-
formChaild.inputFields[componentIndex] = row;
|
|
391
|
-
} else {
|
|
392
|
-
formChaild.inputFields.splice(componentIndex, 0, row);
|
|
393
|
-
}
|
|
394
|
-
} else if ( deeplinkValue && deeplinkValue.toLowerCase() === "external link") {
|
|
395
|
-
const row = {
|
|
396
|
-
rowClassName: 'mobile-push-row',
|
|
397
|
-
id: 'cta-external-link',
|
|
398
|
-
cols: [
|
|
399
|
-
{
|
|
400
|
-
id: "cta-label",
|
|
401
|
-
metaType: "label",
|
|
402
|
-
value: "",
|
|
403
|
-
primitive: true,
|
|
404
|
-
dynamicTab: false,
|
|
405
|
-
type: "div",
|
|
406
|
-
width: 4,
|
|
407
|
-
offset: 0,
|
|
408
|
-
onlyDisplay: true,
|
|
409
|
-
},
|
|
410
|
-
{
|
|
411
|
-
id: inputId,
|
|
412
|
-
placeholder: this.props.intl.formatMessage(messages.externalLink),
|
|
413
|
-
type: "input", //Resembles component to be used
|
|
414
|
-
metaType: "text",
|
|
415
|
-
datatype: "string",
|
|
416
|
-
errorMessage: this.props.intl.formatMessage(messages.externalLinkCantEmpty),
|
|
417
|
-
required: true,
|
|
418
|
-
fluid: true,
|
|
419
|
-
width: 19,
|
|
420
|
-
style: {
|
|
421
|
-
fontSize: '14px',
|
|
422
|
-
fontFamily: 'open-sans',
|
|
423
|
-
fontStyle: 'normal',
|
|
424
|
-
// fontWeight: 600,
|
|
425
|
-
marginBottom: '16px',
|
|
426
|
-
},
|
|
427
|
-
styling: "semantic",
|
|
428
|
-
order: 1,
|
|
429
|
-
offSet: 4,
|
|
430
|
-
customComponent: false,
|
|
431
|
-
standalone: false,
|
|
432
|
-
},
|
|
433
|
-
],
|
|
434
|
-
};
|
|
435
|
-
if (!child.inputFields[fieldIndex + 1] || child.inputFields[componentIndex].id === "cta-deeplink-select-section") {
|
|
436
|
-
formChaild.inputFields[componentIndex] = row;
|
|
437
|
-
if (child.inputFields[componentIndex + 1] && child.inputFields[componentIndex + 1].id === "show-cta-deeplink-keys-label") {
|
|
438
|
-
formChaild.inputFields.splice(componentIndex + 1, 1);
|
|
439
|
-
}
|
|
440
|
-
if (child.inputFields[componentIndex + 1] && child.inputFields[componentIndex + 1].id === "cta-deeplink-keys") {
|
|
441
|
-
let configkeys = _.filter(JSON.parse(deeplinks), (dl) => dl.link === formData[this.state.currentTab - 1][`${col.id}-select`]);
|
|
442
|
-
if (configkeys[0]) {
|
|
443
|
-
configkeys = configkeys[0].keys;
|
|
444
|
-
}
|
|
445
|
-
if (configkeys.length) {
|
|
446
|
-
formChaild.inputFields = formChaild.inputFields.slice(0, componentIndex + 1).concat(formChaild.inputFields.slice( componentIndex + 1 + configkeys.length, formChaild.inputFields.length));
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
} else {
|
|
450
|
-
formChaild.inputFields.splice(componentIndex, 0, row);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
});
|
|
460
|
-
});
|
|
461
|
-
});
|
|
462
|
-
});
|
|
463
|
-
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, isSchemaChanged: true});
|
|
464
|
-
this.injectEvents(schema);
|
|
465
|
-
};
|
|
466
|
-
onTemplateContentChange = (content) => {
|
|
467
|
-
|
|
468
|
-
};
|
|
469
|
-
onModalCancel = () => {
|
|
470
|
-
if (this.state.modalContent && this.state.modalContent.show) {
|
|
471
|
-
this.setState({modalContent: {...this.state.modalContent, show: false}});
|
|
472
|
-
}
|
|
473
|
-
};
|
|
474
|
-
getLinkName = (link) => {
|
|
475
|
-
const ck = this.props.Templates.selectedWeChatAccount.configs ? !!this.props.Templates.selectedWeChatAccount.configs.deeplink : false;
|
|
476
|
-
const deeplinks = ck ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
477
|
-
const deepLinkOptions = _.filter(JSON.parse(deeplinks), (l) => l.link === link);
|
|
478
|
-
if (deepLinkOptions[0]) {
|
|
479
|
-
return deepLinkOptions[0].name;
|
|
480
|
-
}
|
|
481
|
-
return undefined;
|
|
482
|
-
};
|
|
483
|
-
|
|
484
|
-
getMappedEvent = (id, event) => {
|
|
485
|
-
const map = this.state.eventsMap;
|
|
486
|
-
if (!map[id] || !map[id][event]) {
|
|
487
|
-
|
|
488
|
-
}
|
|
489
|
-
return map[id][event];
|
|
490
|
-
};
|
|
491
|
-
getCurrentWindow = (e) => {
|
|
492
|
-
const response = {
|
|
493
|
-
action: e.action,
|
|
494
|
-
value: 'edit',
|
|
495
|
-
direction: e.value,
|
|
496
|
-
};
|
|
497
|
-
parent.postMessage(JSON.stringify(response), '*');
|
|
498
|
-
};
|
|
499
|
-
getFormData = (e) => {
|
|
500
|
-
|
|
501
|
-
const response = {
|
|
502
|
-
action: "getFormData",
|
|
503
|
-
value: this.getTransformedData(this.state.formData),
|
|
504
|
-
validity: this.state.isFormValid,
|
|
505
|
-
};
|
|
506
|
-
this.setState({checkValidation: true});
|
|
507
|
-
if (e) {
|
|
508
|
-
e.source.postMessage(JSON.stringify(response), e.origin);
|
|
509
|
-
}
|
|
510
|
-
return response;
|
|
511
|
-
};
|
|
512
|
-
setFormValidity = (isFormValid) => {
|
|
513
|
-
this.setState({isFormValid});
|
|
514
|
-
};
|
|
515
|
-
getTransformedData = (formData) => {
|
|
516
|
-
const obj = {};
|
|
517
|
-
obj.versions = {
|
|
518
|
-
base: {},
|
|
519
|
-
};
|
|
520
|
-
obj.type = 'MOBILEPUSH';
|
|
521
|
-
obj.name = formData['template-name'];
|
|
522
|
-
obj.definition = {
|
|
523
|
-
accountId: this.props.Templates.selectedWeChatAccount.id,
|
|
524
|
-
mode: this.props.params.mode,
|
|
525
|
-
};
|
|
526
|
-
const android = {};
|
|
527
|
-
Object.keys((formData[0] || {})).forEach((data) => {
|
|
528
|
-
if (!!formData[0][data] && data !== "tabKey") {
|
|
529
|
-
android[data] = formData[0][data];
|
|
530
|
-
}
|
|
531
|
-
});
|
|
532
|
-
const ios = {};
|
|
533
|
-
Object.keys((formData[1] || {})).forEach((data) => {
|
|
534
|
-
if (!!formData[1][data] && data !== "tabKey") {
|
|
535
|
-
ios[data] = formData[1][data];
|
|
536
|
-
}
|
|
537
|
-
});
|
|
538
|
-
obj.versions.base = {};
|
|
539
|
-
delete android.base;
|
|
540
|
-
if (!_.isEmpty(android)) {
|
|
541
|
-
obj.versions.base.ANDROID = {
|
|
542
|
-
luid: "{{luid}}",
|
|
543
|
-
cuid: "{{cuid}}",
|
|
544
|
-
communicationId: "{{communicationId}}",
|
|
545
|
-
title: android['message-title'],
|
|
546
|
-
message: android['message-editor'],
|
|
547
|
-
expandableDetails: {
|
|
548
|
-
style: "BIG_TEXT",
|
|
549
|
-
message: android['message-editor'],
|
|
550
|
-
},
|
|
551
|
-
custom: _.map(android, (field, key) => {
|
|
552
|
-
if (key.indexOf('custom-value') > -1) {
|
|
553
|
-
return field !== "" ? {key: key.replace('custom-value-', "").replace('-cta-deeplink-select', '').replace('-cta-deeplink-secondary-cta-0-select', '').replace('-cta-deeplink-secondary-cta-1-select', ''), value: field} : undefined;
|
|
554
|
-
}
|
|
555
|
-
return undefined;
|
|
556
|
-
}).filter((custom) => custom),
|
|
557
|
-
};
|
|
558
|
-
}
|
|
559
|
-
if (android['cta-deeplink'] && android['cta-deeplink'] !== "") {
|
|
560
|
-
obj.versions.base.ANDROID.cta = {
|
|
561
|
-
type: android['cta-deeplink'] && android['cta-deeplink'].toLowerCase() === "deeplink" ? "DEEP_LINK" : "EXTERNAL_URL",
|
|
562
|
-
actionLink: android['cta-deeplink'] && android['cta-deeplink'].toLowerCase() === "deeplink" ? android['cta-deeplink-select'] : android['cta-deeplink-text'],
|
|
563
|
-
deepLinkName: android['cta-deeplink'] && android['cta-deeplink'].toLowerCase() === "deeplink" ? this.getLinkName(android['cta-deeplink-select']) : undefined,
|
|
564
|
-
};
|
|
565
|
-
if (this.props.location.query.type === 'embedded') {
|
|
566
|
-
delete obj.versions.base.ANDROID.cta.deepLinkName;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
if (!_.isEmpty(ios)) {
|
|
570
|
-
obj.versions.base.IOS = {
|
|
571
|
-
luid: "{{luid}}",
|
|
572
|
-
cuid: "{{cuid}}",
|
|
573
|
-
communicationId: "{{communicationId}}",
|
|
574
|
-
title: ios['message-title2'],
|
|
575
|
-
message: ios['message-editor2'],
|
|
576
|
-
expandableDetails: {
|
|
577
|
-
style: "BIG_TEXT",
|
|
578
|
-
message: ios['message-editor2'],
|
|
579
|
-
ctas: [
|
|
580
|
-
],
|
|
581
|
-
categoryId: ios['secondary-cta-1-table'] ? ios['secondary-cta-1-table'].id : undefined,
|
|
582
|
-
},
|
|
583
|
-
custom: _.map(ios, (field, key) => {
|
|
584
|
-
if (key.indexOf('custom-value') > -1) {
|
|
585
|
-
return field !== "" ? {key: key.replace('custom-value-', "").replace('-cta-deeplink2-select', '').replace('-cta-deeplink-secondary-cta-0-select', '').replace('-cta-deeplink-secondary-cta-1-select2', ''), value: field} : undefined;
|
|
586
|
-
}
|
|
587
|
-
return undefined;
|
|
588
|
-
}).filter((custom) => custom),
|
|
589
|
-
};
|
|
590
|
-
}
|
|
591
|
-
if (ios['cta-deeplink2'] && ios['cta-deeplink2'] !== "") {
|
|
592
|
-
obj.versions.base.IOS.cta = {
|
|
593
|
-
type: ios['cta-deeplink2'] && ios['cta-deeplink2'].toLowerCase() === "deeplink" ? "DEEP_LINK" : "EXTERNAL_URL",
|
|
594
|
-
actionLink: ios['cta-deeplink2'] && ios['cta-deeplink2'].toLowerCase() === "deeplink" ? ios['cta-deeplink2-select'] : ios['cta-deeplink2-text'],
|
|
595
|
-
deepLinkName: ios['cta-deeplink2'] && ios['cta-deeplink2'].toLowerCase() === "deeplink" ? this.getLinkName(ios['cta-deeplink2-select']) : undefined,
|
|
596
|
-
};
|
|
597
|
-
if (this.props.location.query.type === 'embedded') {
|
|
598
|
-
delete obj.versions.base.IOS.cta.deepLinkName;
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
if (obj.versions.base.ANDROID) {
|
|
602
|
-
if (obj.versions.base.ANDROID.cta && obj.versions.base.ANDROID.cta.type === "DEEP_LINK") {
|
|
603
|
-
const params = _.map(android, (field, key) => {
|
|
604
|
-
let actionLink;
|
|
605
|
-
if (key.indexOf('custom-value') > -1 && key.indexOf('cta-deeplink-select') > -1) {
|
|
606
|
-
const param = key.replace('custom-value-', "").replace('-cta-deeplink-select', '');
|
|
607
|
-
actionLink = field !== "" ? `${param}=${field}` : undefined;
|
|
608
|
-
}
|
|
609
|
-
return actionLink;
|
|
610
|
-
}).filter((actionLink) => actionLink);
|
|
611
|
-
if (params.length) {
|
|
612
|
-
obj.versions.base.ANDROID.cta.actionLink = `${obj.versions.base.ANDROID.cta.actionLink}?${params.join('&')}`;
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
const secondaryCta1 = !!android["cta-deeplink-secondary-cta-0-select"] || !!android['secondary-cta-0-label'];
|
|
616
|
-
const secondaryCta2 = !!android['cta-deeplink-secondary-cta-1-select'] || !!android['secondary-cta-1-label'];
|
|
617
|
-
const imageLink = android.image;
|
|
618
|
-
if (imageLink) {
|
|
619
|
-
obj.versions.base.ANDROID.expandableDetails.image = imageLink;
|
|
620
|
-
obj.versions.base.ANDROID.expandableDetails.style = "BIG_PICTURE";
|
|
621
|
-
}
|
|
622
|
-
if (secondaryCta1 || secondaryCta2 ) {
|
|
623
|
-
obj.versions.base.ANDROID.expandableDetails.ctas = [];
|
|
624
|
-
if (secondaryCta1) {
|
|
625
|
-
const cta = {
|
|
626
|
-
actionText: android['secondary-cta-0-label'],
|
|
627
|
-
type: (android['cta-deeplink-secondary-cta-0'] || '').toLowerCase() === "deeplink" ? "DEEP_LINK" : "EXTERNAL_URL",
|
|
628
|
-
actionLink: (android['cta-deeplink-secondary-cta-0'] || '').toLowerCase() === "deeplink" ? android['cta-deeplink-secondary-cta-0-select'] : android['cta-deeplink-secondary-cta-0-text'],
|
|
629
|
-
seccdeepLinkName: this.getLinkName(android['cta-deeplink-secondary-cta-0-select']),
|
|
630
|
-
};
|
|
631
|
-
if (this.props.location.query.type === 'embedded') {
|
|
632
|
-
delete cta.seccdeepLinkName;
|
|
633
|
-
}
|
|
634
|
-
obj.versions.base.ANDROID.expandableDetails.ctas.push(cta);
|
|
635
|
-
if (obj.versions.base.ANDROID.expandableDetails.ctas[obj.versions.base.ANDROID.expandableDetails.ctas.length - 1].type === "DEEP_LINK") {
|
|
636
|
-
const params = _.map(android, (field, key) => {
|
|
637
|
-
let actionLink;
|
|
638
|
-
if (key.indexOf('custom-value') > -1 && key.indexOf('cta-deeplink-secondary-cta-0-select') > -1) {
|
|
639
|
-
const param = key.replace('custom-value-', "").replace('-cta-deeplink-secondary-cta-0-select', '');
|
|
640
|
-
actionLink = field !== "" ? `${param}=${field}` : undefined;
|
|
641
|
-
}
|
|
642
|
-
return actionLink;
|
|
643
|
-
}).filter((actionLink) => actionLink);
|
|
644
|
-
if (params.length) {
|
|
645
|
-
obj.versions.base.ANDROID.expandableDetails.ctas[obj.versions.base.ANDROID.expandableDetails.ctas.length - 1].actionLink = `${obj.versions.base.ANDROID.expandableDetails.ctas[obj.versions.base.ANDROID.expandableDetails.ctas.length - 1].actionLink}?${params.join('&')}`;
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
if (secondaryCta2) {
|
|
650
|
-
const cta = {
|
|
651
|
-
actionText: android['secondary-cta-1-label'],
|
|
652
|
-
type: (android['cta-deeplink-secondary-cta-1'] || '').toLowerCase() === "deeplink" ? "DEEP_LINK" : "EXTERNAL_URL",
|
|
653
|
-
actionLink: (android['cta-deeplink-secondary-cta-1'] || '').toLowerCase() === "deeplink" ? android['cta-deeplink-secondary-cta-1-select'] : android['cta-deeplink-secondary-cta-1-text'],
|
|
654
|
-
seccdeepLinkName: this.getLinkName(android['cta-deeplink-secondary-cta-1-select']),
|
|
655
|
-
};
|
|
656
|
-
if (this.props.location.query.type === 'embedded') {
|
|
657
|
-
delete cta.seccdeepLinkName;
|
|
658
|
-
}
|
|
659
|
-
obj.versions.base.ANDROID.expandableDetails.ctas.push(cta);
|
|
660
|
-
if (obj.versions.base.ANDROID.expandableDetails.ctas[obj.versions.base.ANDROID.expandableDetails.ctas.length - 1].type === "DEEP_LINK") {
|
|
661
|
-
const params = _.map(android, (field, key) => {
|
|
662
|
-
let actionLink;
|
|
663
|
-
if (key.indexOf('custom-value') > -1 && key.indexOf('cta-deeplink-secondary-cta-1-select') > -1) {
|
|
664
|
-
const param = key.replace('custom-value-', "").replace('-cta-deeplink-secondary-cta-1-select', '');
|
|
665
|
-
actionLink = field !== "" ? `${param}=${field}` : undefined;
|
|
666
|
-
}
|
|
667
|
-
return actionLink;
|
|
668
|
-
}).filter((actionLink) => actionLink);
|
|
669
|
-
if (params.length) {
|
|
670
|
-
obj.versions.base.ANDROID.expandableDetails.ctas[obj.versions.base.ANDROID.expandableDetails.ctas.length - 1].actionLink = `${obj.versions.base.ANDROID.expandableDetails.ctas[obj.versions.base.ANDROID.expandableDetails.ctas.length - 1].actionLink}?${params.join('&')}`;
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
if (obj.versions.base.IOS) {
|
|
677
|
-
if (obj.versions.base.IOS.cta && obj.versions.base.IOS.cta.type === "DEEP_LINK") {
|
|
678
|
-
const params = _.map(ios, (field, key) => {
|
|
679
|
-
let actionLink;
|
|
680
|
-
if (key.indexOf('custom-value') > -1 && key.indexOf('cta-deeplink2-select') > -1) {
|
|
681
|
-
const param = key.replace('custom-value-', "").replace('-cta-deeplink2-select', '');
|
|
682
|
-
actionLink = field !== "" ? `${param}=${field}` : undefined;
|
|
683
|
-
}
|
|
684
|
-
return actionLink;
|
|
685
|
-
}).filter((actionLink) => actionLink);
|
|
686
|
-
if (params.length) {
|
|
687
|
-
obj.versions.base.IOS.cta.actionLink = `${obj.versions.base.IOS.cta.actionLink}?${params.join('&')}`;
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
const imageLinkIos = ios.image;
|
|
691
|
-
const secondaryCtaIos = !!ios['cta-deeplink-secondary-cta-1-select'] || !!ios['secondary-cta-1-label'];
|
|
692
|
-
if (imageLinkIos) {
|
|
693
|
-
obj.versions.base.IOS.expandableDetails.image = imageLinkIos;
|
|
694
|
-
obj.versions.base.IOS.expandableDetails.style = "BIG_PICTURE";
|
|
695
|
-
}
|
|
696
|
-
if (secondaryCtaIos) {
|
|
697
|
-
obj.versions.base.IOS.expandableDetails.ctas = [];
|
|
698
|
-
const cta = {
|
|
699
|
-
actionText: ios['secondary-cta-1-label'],
|
|
700
|
-
actionLabel: ios['secondary-cta-1-action'],
|
|
701
|
-
actionLabel2: ios['secondary-cta-1-action2'],
|
|
702
|
-
type: ios['cta-deeplink-secondary-cta-1'] && (ios['cta-deeplink-secondary-cta-1'].toLowerCase() === "deeplink" ? "DEEP_LINK" : "EXTERNAL_URL"),
|
|
703
|
-
actionLink: ios['cta-deeplink-secondary-cta-1'] && (ios['cta-deeplink-secondary-cta-1'].toLowerCase() === "deeplink" ? (ios['cta-deeplink-secondary-cta-1-select2'] || ios['cta-deeplink-secondary-cta-1-select']) : ios['cta-deeplink-secondary-cta-1-text']),
|
|
704
|
-
ioscdeepLinkName: this.getLinkName(ios['cta-deeplink-secondary-cta-1-select']),
|
|
705
|
-
templateCtaId: ios['secondary-cta-1-table'] ? ios['secondary-cta-1-table'].ctaTemplateDetails[0].id : undefined,
|
|
706
|
-
};
|
|
707
|
-
if (this.props.location.query.type === 'embedded') {
|
|
708
|
-
delete cta.ioscdeepLinkName;
|
|
709
|
-
}
|
|
710
|
-
obj.versions.base.IOS.expandableDetails.ctas.push(cta);
|
|
711
|
-
if (obj.versions.base.IOS.expandableDetails.ctas[obj.versions.base.IOS.expandableDetails.ctas.length - 1].type === "DEEP_LINK") {
|
|
712
|
-
const params = _.map(ios, (field, key) => {
|
|
713
|
-
let actionLink;
|
|
714
|
-
if (key.indexOf('custom-value') > -1 && key.indexOf('cta-deeplink-secondary-cta-1-select') > -1) {
|
|
715
|
-
const param = key.replace('custom-value-', "").replace('-cta-deeplink-secondary-cta-1-select2', '');
|
|
716
|
-
actionLink = field !== "" ? `${param}=${field}` : undefined;
|
|
717
|
-
}
|
|
718
|
-
return actionLink;
|
|
719
|
-
}).filter((actionLink) => actionLink);
|
|
720
|
-
if (params.length) {
|
|
721
|
-
obj.versions.base.IOS.expandableDetails.ctas[obj.versions.base.IOS.expandableDetails.ctas.length - 1].actionLink = `${obj.versions.base.IOS.expandableDetails.ctas[obj.versions.base.IOS.expandableDetails.ctas.length - 1].actionLink}?${params.join('&')}`;
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
return obj;
|
|
727
|
-
};
|
|
728
|
-
|
|
729
|
-
setModalContent = (type) => {
|
|
730
|
-
if (type === 'ios') {
|
|
731
|
-
const modalContent = {
|
|
732
|
-
title: this.props.intl.formatMessage(messages.alertMessage),
|
|
733
|
-
body: this.props.intl.formatMessage(messages.androidNotConfigured),
|
|
734
|
-
type: 'confirm',
|
|
735
|
-
id: 'ios',
|
|
736
|
-
};
|
|
737
|
-
this.setState({modalContent, showModal: true});
|
|
738
|
-
} else if (type === 'android') {
|
|
739
|
-
const modalContent = {
|
|
740
|
-
title: this.props.intl.formatMessage(messages.alertMessage),
|
|
741
|
-
body: this.props.intl.formatMessage(messages.iosNotConfigured),
|
|
742
|
-
type: 'confirm',
|
|
743
|
-
id: 'android',
|
|
744
|
-
};
|
|
745
|
-
this.setState({modalContent, showModal: true});
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
openNotificationWithIcon = (type, message) => {
|
|
750
|
-
const dur = (type === 'error' || type === 'warning') ? null : 5;
|
|
751
|
-
notification[type]({
|
|
752
|
-
message: (`${type.toUpperCase()} ! ! ! `),
|
|
753
|
-
description: message, //'This is the content of the notification. This is the content of the notification. This is the content of the notification.',
|
|
754
|
-
duration: dur,
|
|
755
|
-
});
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
handleCancelModal = () => {
|
|
759
|
-
this.setState({showModal: false});
|
|
760
|
-
};
|
|
761
|
-
|
|
762
|
-
moveToTemplates = () => {
|
|
763
|
-
|
|
764
|
-
const modalContent = {
|
|
765
|
-
title: this.props.intl.formatMessage(messages.alertMessage),
|
|
766
|
-
body: this.props.intl.formatMessage(messages.goBackConfirmation),
|
|
767
|
-
type: 'confirm',
|
|
768
|
-
id: 'template-back-confirm-modal',
|
|
769
|
-
show: true,
|
|
770
|
-
};
|
|
771
|
-
this.setState({modalContent, showModal: true});
|
|
772
|
-
};
|
|
773
|
-
|
|
774
|
-
cancelTemplate = () => {
|
|
775
|
-
const type = this.props.location.query.type;
|
|
776
|
-
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
777
|
-
this.props.router.push({
|
|
778
|
-
pathname: `/MOBILEPUSH/`,
|
|
779
|
-
search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
|
|
780
|
-
});
|
|
781
|
-
};
|
|
782
|
-
|
|
783
|
-
injectEvents = (schema) => {
|
|
784
|
-
const temp = schema;
|
|
785
|
-
if (temp.standalone) {
|
|
786
|
-
temp.standalone.sections = this.injectSections(temp.standalone.sections);
|
|
787
|
-
}
|
|
788
|
-
_.forEach(temp.containers, (container) => {
|
|
789
|
-
let tempContainer = container;
|
|
790
|
-
tempContainer = this.injectContainer(tempContainer);
|
|
791
|
-
return tempContainer;
|
|
792
|
-
});
|
|
793
|
-
|
|
794
|
-
this.setState({schema, isSchemaChanged: true}, () => {
|
|
795
|
-
this.removeStandAlone();
|
|
796
|
-
});
|
|
797
|
-
return schema;
|
|
798
|
-
};
|
|
799
|
-
|
|
800
|
-
injectContainer = (container) => {
|
|
801
|
-
const temp = container;
|
|
802
|
-
if (temp.type === 'tabs') {
|
|
803
|
-
temp.injectedEvents = {};
|
|
804
|
-
_.forEach(temp.supportedEvents, (event) => {
|
|
805
|
-
temp.injectedEvents[event] = this.getMappedEvent(temp.id, event);
|
|
806
|
-
});
|
|
807
|
-
_.forEach(temp.panes, (pane) => {
|
|
808
|
-
const tempPane = pane;
|
|
809
|
-
tempPane.sectionsHeaders = this.injectSections(tempPane.sectionsHeaders);
|
|
810
|
-
tempPane.sections = this.injectSections(tempPane.sections);
|
|
811
|
-
});
|
|
812
|
-
}
|
|
813
|
-
return temp;
|
|
814
|
-
};
|
|
815
|
-
|
|
816
|
-
injectMultiColSection = (section) => {
|
|
817
|
-
const { formatMessage } = this.props.intl;
|
|
818
|
-
_.forEach(section.inputFields, (inputField) => {
|
|
819
|
-
_.forEach(inputField.cols, (col) => {
|
|
820
|
-
const temp = col;
|
|
821
|
-
if (temp.type === 'popover') {
|
|
822
|
-
temp.content.sections = this.injectSections(temp.content.sections);
|
|
823
|
-
temp.value.sections = this.injectSections(temp.value.sections);
|
|
824
|
-
return true;
|
|
825
|
-
}
|
|
826
|
-
if (temp.id === "discard-button") {
|
|
827
|
-
temp.colStyle = {...temp.colStyle, display: 'none'};
|
|
828
|
-
}
|
|
829
|
-
if (temp.id === "cancel-button") {
|
|
830
|
-
temp.offset = 11;
|
|
831
|
-
}
|
|
832
|
-
if (temp.id === "mobile-push-preview") {
|
|
833
|
-
temp.content.appName = this.props.Templates.selectedWeChatAccount.name;
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
if (messages?.[temp?.value]) {
|
|
837
|
-
temp.value = formatMessage(messages[temp.value]);
|
|
838
|
-
}
|
|
839
|
-
if (messages?.[temp?.label]) {
|
|
840
|
-
temp.label = formatMessage(messages[temp.label]);
|
|
841
|
-
}
|
|
842
|
-
if (messages?.[temp?.errorMessage]) {
|
|
843
|
-
temp.errorMessage = formatMessage(messages[temp.errorMessage]);
|
|
844
|
-
}
|
|
845
|
-
if (messages?.[temp?.placeholder]) {
|
|
846
|
-
temp.placeholder = formatMessage(messages[temp.placeholder]);
|
|
847
|
-
}
|
|
848
|
-
if (messages?.[temp?.hoverText]) {
|
|
849
|
-
temp.hoverText = formatMessage(messages[temp.hoverText]);
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
temp.injectedEvents = {};
|
|
853
|
-
|
|
854
|
-
_.forEach(col.supportedEvents, (event) => {
|
|
855
|
-
|
|
856
|
-
temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
|
|
857
|
-
});
|
|
858
|
-
return true;
|
|
859
|
-
});
|
|
860
|
-
});
|
|
861
|
-
_.forEach(section.actionFields, (actionField) => {
|
|
862
|
-
_.forEach(actionField.cols, (col) => {
|
|
863
|
-
const temp = col;
|
|
864
|
-
if (temp.type === 'popover') {
|
|
865
|
-
temp.content.sections = this.injectSections(temp.content.sections);
|
|
866
|
-
temp.value.sections = this.injectSections(temp.value.sections);
|
|
867
|
-
return true;
|
|
868
|
-
}
|
|
869
|
-
temp.injectedEvents = {};
|
|
870
|
-
_.forEach(col.supportedEvents, (event) => {
|
|
871
|
-
temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
|
|
872
|
-
});
|
|
873
|
-
return true;
|
|
874
|
-
});
|
|
875
|
-
});
|
|
876
|
-
return section;
|
|
877
|
-
};
|
|
878
|
-
|
|
879
|
-
injectColLabelSection = (section) => {
|
|
880
|
-
_.forEach(section.inputFields, (inputField) => {
|
|
881
|
-
const temp = inputField;
|
|
882
|
-
if (temp.type === 'popover') {
|
|
883
|
-
temp.content.sections = this.injectSections(temp.content.sections);
|
|
884
|
-
temp.value.sections = this.injectSections(temp.value.sections);
|
|
885
|
-
return true;
|
|
886
|
-
}
|
|
887
|
-
temp.injectedEvents = {};
|
|
888
|
-
_.forEach(inputField.supportedEvents, (event) => {
|
|
889
|
-
temp.injectedEvents[event] = this.getMappedEvent(inputField.id, event);
|
|
890
|
-
});
|
|
891
|
-
return true;
|
|
892
|
-
});
|
|
893
|
-
_.forEach(section.actionFields, (actionField) => {
|
|
894
|
-
const temp = actionField;
|
|
895
|
-
if (temp.type === 'popover') {
|
|
896
|
-
temp.content.sections = this.injectSections(temp.content.sections);
|
|
897
|
-
temp.value.sections = this.injectSections(temp.value.sections);
|
|
898
|
-
return true;
|
|
899
|
-
}
|
|
900
|
-
temp.injectedEvents = {};
|
|
901
|
-
_.forEach(actionField.supportedEvents, (event) => {
|
|
902
|
-
temp.injectedEvents[event] = this.getMappedEvent(actionField.id, event);
|
|
903
|
-
});
|
|
904
|
-
return true;
|
|
905
|
-
});
|
|
906
|
-
return section;
|
|
907
|
-
};
|
|
908
|
-
|
|
909
|
-
injectSections = (sections) => {
|
|
910
|
-
_.forEach(sections, (section) => {
|
|
911
|
-
let temp = section;
|
|
912
|
-
if (temp.type === 'col-label') {
|
|
913
|
-
temp = this.injectColLabelSection(temp);
|
|
914
|
-
} else if (section.type === 'multicols') {
|
|
915
|
-
temp = this.injectMultiColSection(temp);
|
|
916
|
-
} else if (section.type === 'parent') {
|
|
917
|
-
temp = this.injectSections(temp.childSections);
|
|
918
|
-
}
|
|
919
|
-
});
|
|
920
|
-
return sections;
|
|
921
|
-
};
|
|
922
|
-
|
|
923
|
-
injectParentSection = (section) => {
|
|
924
|
-
_.forEach(section.childSections, (childSection) => {
|
|
925
|
-
let temp = childSection;
|
|
926
|
-
if (temp.type === 'col-label') {
|
|
927
|
-
temp = this.injectColLabelSection(temp);
|
|
928
|
-
} else if (section.type === 'multicols') {
|
|
929
|
-
temp = this.injectMultiColSection(temp);
|
|
930
|
-
} else if (section.type === 'parent') {
|
|
931
|
-
temp = this.injectParentSection(temp);
|
|
932
|
-
}
|
|
933
|
-
});
|
|
934
|
-
return section;
|
|
935
|
-
};
|
|
936
|
-
insertAtCursor = (field, myValue, currentTab) => {
|
|
937
|
-
//IE support
|
|
938
|
-
const myField = field;
|
|
939
|
-
if (document.selection) {
|
|
940
|
-
myField.focus();
|
|
941
|
-
const sel = document.selection.createRange();
|
|
942
|
-
sel.text = myValue;
|
|
943
|
-
} else if (myField.selectionStart || myField.selectionStart === '0') { //MOZILLA and others
|
|
944
|
-
const startPos = myField.selectionStart;
|
|
945
|
-
const endPos = myField.selectionEnd;
|
|
946
|
-
myField.value = myField.value.substring(0, startPos)
|
|
947
|
-
+ myValue
|
|
948
|
-
+ myField.value.substring(endPos, myField.value.length);
|
|
949
|
-
myField.selectionStart = startPos + myValue.length;
|
|
950
|
-
myField.selectionEnd = startPos + myValue.length;
|
|
951
|
-
} else {
|
|
952
|
-
myField.value += myValue;
|
|
953
|
-
}
|
|
954
|
-
const formData = _.cloneDeep(this.state.formData);
|
|
955
|
-
formData[currentTab - 1][field.id] = myField.value;
|
|
956
|
-
this.setState({formData});
|
|
957
|
-
};
|
|
958
|
-
|
|
959
|
-
startTemplateCreation = (data) => {
|
|
960
|
-
|
|
961
|
-
const content = data.content;
|
|
962
|
-
const id = _.uniqueId();
|
|
963
|
-
const tempData = {
|
|
964
|
-
'message-editor': content,
|
|
965
|
-
'base': true,
|
|
966
|
-
'tabKey': id,
|
|
967
|
-
};
|
|
968
|
-
const formData = {};
|
|
969
|
-
formData[0] = tempData;
|
|
970
|
-
formData.base = tempData;
|
|
971
|
-
this.setState({formData, loading: false});
|
|
972
|
-
if (data.tags) {
|
|
973
|
-
this.props.globalActions.setInjectedTags(data.tags);
|
|
974
|
-
}
|
|
975
|
-
};
|
|
976
|
-
|
|
977
|
-
startLoading = (ifEdit) => {
|
|
978
|
-
|
|
979
|
-
if (ifEdit) {
|
|
980
|
-
this.setState({loading: true});
|
|
981
|
-
}
|
|
982
|
-
};
|
|
983
|
-
|
|
984
|
-
handleFrameTasks = (e) => {
|
|
985
|
-
|
|
986
|
-
const type = e.data;
|
|
987
|
-
|
|
988
|
-
if (typeof type === 'object') {
|
|
989
|
-
|
|
990
|
-
const action = type.action;
|
|
991
|
-
switch (action) {
|
|
992
|
-
case "startTemplateCreation":
|
|
993
|
-
this.startTemplateCreation(type.value);
|
|
994
|
-
break;
|
|
995
|
-
case "startLoading":
|
|
996
|
-
this.startLoading(type.edit);
|
|
997
|
-
break;
|
|
998
|
-
case "getCurrentWindow":
|
|
999
|
-
this.getCurrentWindow(type);
|
|
1000
|
-
break;
|
|
1001
|
-
default:
|
|
1002
|
-
break;
|
|
1003
|
-
}
|
|
1004
|
-
} else {
|
|
1005
|
-
switch (type) {
|
|
1006
|
-
case "getFormData":
|
|
1007
|
-
this.getFormData(e);
|
|
1008
|
-
break;
|
|
1009
|
-
case "startTemplateCreation":
|
|
1010
|
-
|
|
1011
|
-
//this.getFormData(e);
|
|
1012
|
-
break;
|
|
1013
|
-
case "moveToTemplates":
|
|
1014
|
-
|
|
1015
|
-
this.moveToTemplates();
|
|
1016
|
-
break;
|
|
1017
|
-
case "validateContent":
|
|
1018
|
-
|
|
1019
|
-
this.validateContent(e);
|
|
1020
|
-
break;
|
|
1021
|
-
default:
|
|
1022
|
-
break;
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
};
|
|
1026
|
-
|
|
1027
|
-
removeStandAlone = () => {
|
|
1028
|
-
const schema = _.cloneDeep(this.state.schema);
|
|
1029
|
-
if (this.props.location.query.type === 'embedded' && this.props.location.query.module === 'loyalty') {
|
|
1030
|
-
schema.standalone.sections.splice(0, 1);
|
|
1031
|
-
} else if (this.props.location.query.type === 'embedded' && typeof this.props.location.query.module !== 'undefined') {
|
|
1032
|
-
delete schema.standalone;
|
|
1033
|
-
} else {
|
|
1034
|
-
schema.standalone.sections.splice(1, 1);
|
|
1035
|
-
}
|
|
1036
|
-
this.setState({ schema });
|
|
1037
|
-
};
|
|
1038
|
-
|
|
1039
|
-
validateContent = (e) => {
|
|
1040
|
-
|
|
1041
|
-
const response = {
|
|
1042
|
-
action: "validateContent",
|
|
1043
|
-
value: this.state.isFormValid,
|
|
1044
|
-
};
|
|
1045
|
-
e.source.postMessage(JSON.stringify(response), e.origin);
|
|
1046
|
-
};
|
|
1047
|
-
|
|
1048
|
-
discardValues = () => {
|
|
1049
|
-
this.resetSchema();
|
|
1050
|
-
this.resetState();
|
|
1051
|
-
};
|
|
1052
|
-
|
|
1053
|
-
resetState = () => {
|
|
1054
|
-
this.setState({
|
|
1055
|
-
formData: {},
|
|
1056
|
-
tabCount: 1,
|
|
1057
|
-
currentTab: 1,
|
|
1058
|
-
});
|
|
1059
|
-
};
|
|
1060
|
-
resetSchema = () => {
|
|
1061
|
-
this.setState({ schema: this.state.initialState ? this.state.initialState : this.state.schema});
|
|
1062
|
-
};
|
|
1063
|
-
showNext = () => {
|
|
1064
|
-
const response = {
|
|
1065
|
-
action: "showNext",
|
|
1066
|
-
value: true,
|
|
1067
|
-
};
|
|
1068
|
-
parent.postMessage(JSON.stringify(response), '*');
|
|
1069
|
-
};
|
|
1070
|
-
copyContent = () => {
|
|
1071
|
-
|
|
1072
|
-
};
|
|
1073
|
-
addSecondoryCtaIos = (ev) => {
|
|
1074
|
-
const id = ev.target.id;
|
|
1075
|
-
const schema = _.cloneDeep(this.state.schema);
|
|
1076
|
-
_.forEach(schema.containers, (container) => {
|
|
1077
|
-
_.forEach(container.panes, (pane, paneIndex) => {
|
|
1078
|
-
_.forEach(pane.sections, (section) => {
|
|
1079
|
-
_.forEach(section.childSections, (childeSection) => {
|
|
1080
|
-
_.forEach(childeSection.childSections, (child) => {
|
|
1081
|
-
if (child.type === 'multicols') {
|
|
1082
|
-
_.forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
1083
|
-
_.forEach(inputField.cols, (col) => {
|
|
1084
|
-
const colId = (paneIndex + 1) > 1 ? col.id + (paneIndex + 1) : col.id;
|
|
1085
|
-
if (colId === id) {
|
|
1086
|
-
const inputId = `secondary-cta-${paneIndex}`;
|
|
1087
|
-
|
|
1088
|
-
child.inputFields.splice(fieldIndex, 1, {
|
|
1089
|
-
rowClassName: 'mobile-push-row',
|
|
1090
|
-
cols: [
|
|
1091
|
-
{
|
|
1092
|
-
id: `${inputId}-label`,
|
|
1093
|
-
metaType: "label",
|
|
1094
|
-
value: this.props.intl.formatMessage(messages.secondaryCTA),
|
|
1095
|
-
primitive: true,
|
|
1096
|
-
dynamicTab: false,
|
|
1097
|
-
type: "div",
|
|
1098
|
-
width: 4,
|
|
1099
|
-
style: {
|
|
1100
|
-
backgroundColor: 'white',
|
|
1101
|
-
textAlign: 'left',
|
|
1102
|
-
color: '#333333',
|
|
1103
|
-
lineHeight: '24px',
|
|
1104
|
-
fontSize: '14px',
|
|
1105
|
-
fontFamily: 'open-sans',
|
|
1106
|
-
fontStyle: 'normal',
|
|
1107
|
-
paddingTop: '8px',
|
|
1108
|
-
},
|
|
1109
|
-
offset: 0,
|
|
1110
|
-
onlyDisplay: true,
|
|
1111
|
-
colStyle: {
|
|
1112
|
-
flex: 1,
|
|
1113
|
-
},
|
|
1114
|
-
},
|
|
1115
|
-
{
|
|
1116
|
-
id: `${inputId}-table`,
|
|
1117
|
-
type: "table", //Resembles component to be used
|
|
1118
|
-
metaType: "text",
|
|
1119
|
-
datatype: "string",
|
|
1120
|
-
pagination: false,
|
|
1121
|
-
columns: [
|
|
1122
|
-
{
|
|
1123
|
-
title: this.props.intl.formatMessage(messages.nameAndDescription),
|
|
1124
|
-
dataIndex: "name",
|
|
1125
|
-
key: "name",
|
|
1126
|
-
width: 200,
|
|
1127
|
-
render: (text, record) => (
|
|
1128
|
-
<div>
|
|
1129
|
-
<div>{record.name}</div>
|
|
1130
|
-
<div>{record.description}</div>
|
|
1131
|
-
</div>),
|
|
1132
|
-
},
|
|
1133
|
-
{
|
|
1134
|
-
title: this.props.intl.formatMessage(messages.button1),
|
|
1135
|
-
dataIndex: "description",
|
|
1136
|
-
key: "button1",
|
|
1137
|
-
width: 100,
|
|
1138
|
-
render: (text, record) => (
|
|
1139
|
-
<div>
|
|
1140
|
-
{record.ctaTemplateDetails[0] && record.ctaTemplateDetails[0].buttonText}
|
|
1141
|
-
</div>),
|
|
1142
|
-
},
|
|
1143
|
-
{
|
|
1144
|
-
title: this.props.intl.formatMessage(messages.button2),
|
|
1145
|
-
dataIndex: "description",
|
|
1146
|
-
key: "button2",
|
|
1147
|
-
width: 100,
|
|
1148
|
-
render: (text, record) => (
|
|
1149
|
-
<div>
|
|
1150
|
-
{record.ctaTemplateDetails[1] ? record.ctaTemplateDetails[1].buttonText : ''}
|
|
1151
|
-
</div>
|
|
1152
|
-
),
|
|
1153
|
-
},
|
|
1154
|
-
],
|
|
1155
|
-
required: true,
|
|
1156
|
-
width: 16,
|
|
1157
|
-
fluid: true,
|
|
1158
|
-
styling: "semantic",
|
|
1159
|
-
order: 1,
|
|
1160
|
-
customComponent: false,
|
|
1161
|
-
supportedEvents: ["onRowClick"],
|
|
1162
|
-
},
|
|
1163
|
-
],
|
|
1164
|
-
});
|
|
1165
|
-
|
|
1166
|
-
const colField = col;
|
|
1167
|
-
colField.value = this.props.intl.formatMessage(messages.addAnotherCTA);
|
|
1168
|
-
colField.fieldsCount += 1;
|
|
1169
|
-
if (col.fieldsCount === col.fieldsLimit) {
|
|
1170
|
-
child.inputFields.pop();
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
});
|
|
1174
|
-
});
|
|
1175
|
-
}
|
|
1176
|
-
});
|
|
1177
|
-
});
|
|
1178
|
-
});
|
|
1179
|
-
});
|
|
1180
|
-
});
|
|
1181
|
-
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, isSchemaChanged: true});
|
|
1182
|
-
this.injectEvents(schema);
|
|
1183
|
-
this.props.actions.getIosCtas(this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier);//TODO: need to get license code of accoutn and send as arg
|
|
1184
|
-
};
|
|
1185
|
-
showSelectedIosCta = (selectedConfig) => {
|
|
1186
|
-
const currentTab = this.state.currentTab;
|
|
1187
|
-
const schema = _.cloneDeep(this.state.schema);
|
|
1188
|
-
const deeplinks = this.props.Templates.selectedWeChatAccount && this.props.Templates.selectedWeChatAccount.configs && !!this.props.Templates.selectedWeChatAccount.configs.deeplink ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
1189
|
-
const deepLinkOptions = this.props.Templates.selectedWeChatAccount ? _.map(JSON.parse(deeplinks), (link) => ({label: link.name, value: link.link, title: link.link }) ) : [];
|
|
1190
|
-
_.forEach(schema.containers, (container) => {
|
|
1191
|
-
_.forEach(container.panes, (pane, paneIndex) => {
|
|
1192
|
-
_.forEach(pane.sections, (section) => {
|
|
1193
|
-
_.forEach(section.childSections, (childeSection) => {
|
|
1194
|
-
_.forEach(childeSection.childSections, (child) => {
|
|
1195
|
-
const formChaild = child;
|
|
1196
|
-
if (child.type === 'multicols') {
|
|
1197
|
-
_.forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
1198
|
-
_.forEach(inputField.cols, (col) => {
|
|
1199
|
-
if (col.id.indexOf(`secondary-cta-${currentTab - 1}-table`) > -1) {
|
|
1200
|
-
|
|
1201
|
-
const inputId = `secondary-cta-${paneIndex}`;
|
|
1202
|
-
|
|
1203
|
-
formChaild.inputFields[fieldIndex] = {
|
|
1204
|
-
rowClassName: 'mobile-push-row',
|
|
1205
|
-
cols: [
|
|
1206
|
-
{
|
|
1207
|
-
id: `${inputId}-action-label`,
|
|
1208
|
-
metaType: "label",
|
|
1209
|
-
value: this.props.intl.formatMessage(messages.secondaryCTA),
|
|
1210
|
-
primitive: true,
|
|
1211
|
-
dynamicTab: false,
|
|
1212
|
-
type: "div",
|
|
1213
|
-
width: 4,
|
|
1214
|
-
style: {
|
|
1215
|
-
backgroundColor: 'white',
|
|
1216
|
-
textAlign: 'left',
|
|
1217
|
-
color: '#333333',
|
|
1218
|
-
lineHeight: '24px',
|
|
1219
|
-
fontSize: '14px',
|
|
1220
|
-
fontFamily: 'open-sans',
|
|
1221
|
-
fontStyle: 'normal',
|
|
1222
|
-
paddingTop: '8px',
|
|
1223
|
-
},
|
|
1224
|
-
offset: 0,
|
|
1225
|
-
onlyDisplay: true,
|
|
1226
|
-
colStyle: {
|
|
1227
|
-
flex: 1,
|
|
1228
|
-
},
|
|
1229
|
-
},
|
|
1230
|
-
{
|
|
1231
|
-
id: `${inputId}-label`,
|
|
1232
|
-
metaType: "label",
|
|
1233
|
-
value: "",
|
|
1234
|
-
primitive: true,
|
|
1235
|
-
dynamicTab: false,
|
|
1236
|
-
type: "div",
|
|
1237
|
-
width: 16,
|
|
1238
|
-
style: {
|
|
1239
|
-
backgroundColor: 'white',
|
|
1240
|
-
textAlign: 'left',
|
|
1241
|
-
color: '#333333',
|
|
1242
|
-
lineHeight: '24px',
|
|
1243
|
-
fontSize: '14px',
|
|
1244
|
-
fontFamily: 'open-sans',
|
|
1245
|
-
fontStyle: 'normal',
|
|
1246
|
-
paddingTop: '8px',
|
|
1247
|
-
},
|
|
1248
|
-
offset: 0,
|
|
1249
|
-
colStyle: {
|
|
1250
|
-
flex: 1,
|
|
1251
|
-
},
|
|
1252
|
-
},
|
|
1253
|
-
{
|
|
1254
|
-
id: `${inputId}-delete-ios`,
|
|
1255
|
-
type: "icon",
|
|
1256
|
-
value: 'delete',
|
|
1257
|
-
width: 4,
|
|
1258
|
-
submitAction: "onDelete",
|
|
1259
|
-
supportedEvents: ["onDelete"],
|
|
1260
|
-
},
|
|
1261
|
-
],
|
|
1262
|
-
};
|
|
1263
|
-
formChaild.inputFields[fieldIndex + 1] = {
|
|
1264
|
-
rowClassName: 'mobile-push-row',
|
|
1265
|
-
cols: [
|
|
1266
|
-
{
|
|
1267
|
-
id: `${inputId}-action-label-empty`,
|
|
1268
|
-
metaType: "label",
|
|
1269
|
-
value: "",
|
|
1270
|
-
primitive: true,
|
|
1271
|
-
dynamicTab: false,
|
|
1272
|
-
type: "div",
|
|
1273
|
-
width: 4,
|
|
1274
|
-
onlyDisplay: true,
|
|
1275
|
-
colStyle: {
|
|
1276
|
-
flex: 1,
|
|
1277
|
-
},
|
|
1278
|
-
},
|
|
1279
|
-
{
|
|
1280
|
-
id: `${inputId}-action`,
|
|
1281
|
-
metaType: "label",
|
|
1282
|
-
value: "",
|
|
1283
|
-
primitive: true,
|
|
1284
|
-
dynamicTab: false,
|
|
1285
|
-
type: "div",
|
|
1286
|
-
width: 8,
|
|
1287
|
-
offset: 0,
|
|
1288
|
-
},
|
|
1289
|
-
{
|
|
1290
|
-
id: `${inputId}-action2`,
|
|
1291
|
-
metaType: "label",
|
|
1292
|
-
value: "",
|
|
1293
|
-
primitive: true,
|
|
1294
|
-
dynamicTab: false,
|
|
1295
|
-
type: "div",
|
|
1296
|
-
width: 8,
|
|
1297
|
-
offset: 0,
|
|
1298
|
-
style: {display: 'none'},
|
|
1299
|
-
},
|
|
1300
|
-
],
|
|
1301
|
-
};
|
|
1302
|
-
if (selectedConfig && (selectedConfig.id !== "16589g0g" && selectedConfig.id !== "17543720" && selectedConfig.id !== "1a491g56")) {
|
|
1303
|
-
formChaild.inputFields[fieldIndex + 2] = {
|
|
1304
|
-
rowClassName: "mobile-push-row",
|
|
1305
|
-
cols: [
|
|
1306
|
-
{
|
|
1307
|
-
id: `${inputId}-action-label-empty`,
|
|
1308
|
-
metaType: "label",
|
|
1309
|
-
value: "",
|
|
1310
|
-
primitive: true,
|
|
1311
|
-
dynamicTab: false,
|
|
1312
|
-
type: "div",
|
|
1313
|
-
width: 4,
|
|
1314
|
-
offset: 0,
|
|
1315
|
-
onlyDisplay: true,
|
|
1316
|
-
},
|
|
1317
|
-
{
|
|
1318
|
-
id: `cta-deeplink-${inputId}`,
|
|
1319
|
-
type: "radioGroup", //Resembles component to be used
|
|
1320
|
-
metaType: "text",
|
|
1321
|
-
datatype: "string",
|
|
1322
|
-
options: ["Deeplink", "External Link"],
|
|
1323
|
-
value: "Deeplink",
|
|
1324
|
-
required: true,
|
|
1325
|
-
width: 16,
|
|
1326
|
-
offSet: 4,
|
|
1327
|
-
errorMessage: this.props.intl.formatMessage(messages.selectLinkType),
|
|
1328
|
-
fluid: true,
|
|
1329
|
-
style: {
|
|
1330
|
-
fontFamily: 'open-sans',
|
|
1331
|
-
fontSize: '14px',
|
|
1332
|
-
lineHeight: '24px',
|
|
1333
|
-
},
|
|
1334
|
-
styling: "semantic",
|
|
1335
|
-
order: 1,
|
|
1336
|
-
supportedEvents: ["onChange"],
|
|
1337
|
-
customComponent: false,
|
|
1338
|
-
},
|
|
1339
|
-
],
|
|
1340
|
-
};
|
|
1341
|
-
formChaild.inputFields[fieldIndex + 3] = {
|
|
1342
|
-
rowClassName: 'mobile-push-row',
|
|
1343
|
-
id: 'cta-deeplink-select-section',
|
|
1344
|
-
cols: [
|
|
1345
|
-
{
|
|
1346
|
-
id: "cta-label",
|
|
1347
|
-
metaType: "label",
|
|
1348
|
-
value: "",
|
|
1349
|
-
primitive: true,
|
|
1350
|
-
dynamicTab: false,
|
|
1351
|
-
type: "div",
|
|
1352
|
-
width: 4,
|
|
1353
|
-
onlyDisplay: true,
|
|
1354
|
-
colStyle: {
|
|
1355
|
-
flex: 1,
|
|
1356
|
-
},
|
|
1357
|
-
},
|
|
1358
|
-
{
|
|
1359
|
-
id: `cta-deeplink-${inputId}-select2`,
|
|
1360
|
-
placeholder: this.props.intl.formatMessage(messages.selectDeeplink),
|
|
1361
|
-
type: "select", //Resembles component to be used
|
|
1362
|
-
options: deepLinkOptions,
|
|
1363
|
-
metaType: "text",
|
|
1364
|
-
datatype: "string",
|
|
1365
|
-
errorMessage: this.props.intl.formatMessage(messages.selectADeeplink),
|
|
1366
|
-
required: true,
|
|
1367
|
-
fluid: true,
|
|
1368
|
-
width: 19,
|
|
1369
|
-
style: {
|
|
1370
|
-
fontSize: '14px',
|
|
1371
|
-
fontFamily: 'open-sans',
|
|
1372
|
-
fontStyle: 'normal',
|
|
1373
|
-
// fontWeight: 600,
|
|
1374
|
-
marginBottom: '16px',
|
|
1375
|
-
},
|
|
1376
|
-
styling: "semantic",
|
|
1377
|
-
order: 1,
|
|
1378
|
-
customComponent: false,
|
|
1379
|
-
supportedEvents: [
|
|
1380
|
-
'onSelect',
|
|
1381
|
-
],
|
|
1382
|
-
},
|
|
1383
|
-
],
|
|
1384
|
-
};
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
});
|
|
1388
|
-
});
|
|
1389
|
-
}
|
|
1390
|
-
});
|
|
1391
|
-
});
|
|
1392
|
-
});
|
|
1393
|
-
});
|
|
1394
|
-
});
|
|
1395
|
-
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, isSchemaChanged: true});
|
|
1396
|
-
this.injectEvents(schema);
|
|
1397
|
-
};
|
|
1398
|
-
addPrimaryCta = (ev) => {
|
|
1399
|
-
const id = ev.target.id;
|
|
1400
|
-
const schema = _.cloneDeep(this.state.schema);
|
|
1401
|
-
const deeplinks = this.props.Templates.selectedWeChatAccount && this.props.Templates.selectedWeChatAccount.configs && !!this.props.Templates.selectedWeChatAccount.configs.deeplink ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
1402
|
-
const deepLinkOptions = this.props.Templates.selectedWeChatAccount ? _.map(JSON.parse(deeplinks), (link) => ({label: link.name, value: link.link, title: link.link }) ) : [];
|
|
1403
|
-
// const eventsMap = _.cloneDeep(this.state.eventsMap);
|
|
1404
|
-
_.forEach(schema.containers, (container) => {
|
|
1405
|
-
_.forEach(container.panes, (pane) => {
|
|
1406
|
-
_.forEach(pane.sections, (section) => {
|
|
1407
|
-
_.forEach(section.childSections, (childeSection) => {
|
|
1408
|
-
_.forEach(childeSection.childSections, (child) => {
|
|
1409
|
-
if (child.type === 'multicols') {
|
|
1410
|
-
_.forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
1411
|
-
_.forEach(inputField.cols, (col) => {
|
|
1412
|
-
const colId = `${col.id}${this.state.currentTab > 1 ? this.state.currentTab : ''}`;
|
|
1413
|
-
if (colId === id) {
|
|
1414
|
-
|
|
1415
|
-
child.inputFields.splice(fieldIndex, 1, {
|
|
1416
|
-
rowClassName: 'mobile-push-row',
|
|
1417
|
-
cols: [
|
|
1418
|
-
{
|
|
1419
|
-
id: "cta-label",
|
|
1420
|
-
metaType: "label",
|
|
1421
|
-
value: this.props.intl.formatMessage(messages.primaryCTA),
|
|
1422
|
-
primitive: true,
|
|
1423
|
-
dynamicTab: false,
|
|
1424
|
-
type: "div",
|
|
1425
|
-
width: 4,
|
|
1426
|
-
style: {
|
|
1427
|
-
backgroundColor: 'white',
|
|
1428
|
-
textAlign: 'left',
|
|
1429
|
-
color: '#333333',
|
|
1430
|
-
lineHeight: '24px',
|
|
1431
|
-
fontSize: '14px',
|
|
1432
|
-
fontFamily: 'open-sans',
|
|
1433
|
-
fontStyle: 'normal',
|
|
1434
|
-
marginTop: '16px',
|
|
1435
|
-
},
|
|
1436
|
-
offset: 0,
|
|
1437
|
-
onlyDisplay: true,
|
|
1438
|
-
colStyle: {
|
|
1439
|
-
flex: 1,
|
|
1440
|
-
},
|
|
1441
|
-
},
|
|
1442
|
-
{
|
|
1443
|
-
id: `cta-deeplink${this.state.currentTab > 1 ? this.state.currentTab : ''}`,
|
|
1444
|
-
type: "radioGroup", //Resembles component to be used
|
|
1445
|
-
metaType: "text",
|
|
1446
|
-
datatype: "string",
|
|
1447
|
-
options: ["Deeplink", "External Link"],
|
|
1448
|
-
value: "Deeplink",
|
|
1449
|
-
required: true,
|
|
1450
|
-
width: 18,
|
|
1451
|
-
errorMessage: this.props.intl.formatMessage(messages.selectLinkType),
|
|
1452
|
-
fluid: true,
|
|
1453
|
-
styling: "semantic",
|
|
1454
|
-
order: 1,
|
|
1455
|
-
customComponent: false,
|
|
1456
|
-
supportedEvents: ["onChange"],
|
|
1457
|
-
style: {
|
|
1458
|
-
marginTop: '16px',
|
|
1459
|
-
}
|
|
1460
|
-
},
|
|
1461
|
-
{
|
|
1462
|
-
id: `cta-deeplink${this.state.currentTab > 1 ? this.state.currentTab : ''}-delete`,
|
|
1463
|
-
type: "icon",
|
|
1464
|
-
value: 'delete',
|
|
1465
|
-
width: 1,
|
|
1466
|
-
submitAction: "onDelete",
|
|
1467
|
-
supportedEvents: ["onDelete"],
|
|
1468
|
-
style: {
|
|
1469
|
-
marginTop: '16px',
|
|
1470
|
-
}
|
|
1471
|
-
},
|
|
1472
|
-
],
|
|
1473
|
-
});
|
|
1474
|
-
child.inputFields.splice(fieldIndex + 1, 0, {
|
|
1475
|
-
rowClassName: 'mobile-push-row',
|
|
1476
|
-
id: 'cta-deeplink-select-section',
|
|
1477
|
-
cols: [
|
|
1478
|
-
{
|
|
1479
|
-
id: "cta-label",
|
|
1480
|
-
metaType: "label",
|
|
1481
|
-
value: "",
|
|
1482
|
-
primitive: true,
|
|
1483
|
-
dynamicTab: false,
|
|
1484
|
-
type: "div",
|
|
1485
|
-
width: 4,
|
|
1486
|
-
onlyDisplay: true,
|
|
1487
|
-
colStyle: {
|
|
1488
|
-
flex: 1,
|
|
1489
|
-
},
|
|
1490
|
-
},
|
|
1491
|
-
{
|
|
1492
|
-
id: `cta-deeplink${this.state.currentTab > 1 ? this.state.currentTab : ''}-select`,
|
|
1493
|
-
placeholder: this.props.intl.formatMessage(messages.selectDeeplink),
|
|
1494
|
-
type: "select", //Resembles component to be used
|
|
1495
|
-
options: deepLinkOptions,
|
|
1496
|
-
metaType: "text",
|
|
1497
|
-
datatype: "string",
|
|
1498
|
-
required: true,
|
|
1499
|
-
errorMessage: this.props.intl.formatMessage(messages.selectADeeplink),
|
|
1500
|
-
fluid: true,
|
|
1501
|
-
width: 19,
|
|
1502
|
-
style: {
|
|
1503
|
-
fontSize: '14px',
|
|
1504
|
-
fontFamily: 'open-sans',
|
|
1505
|
-
fontStyle: 'normal',
|
|
1506
|
-
// fontWeight: 600,
|
|
1507
|
-
marginBottom: '16px',
|
|
1508
|
-
},
|
|
1509
|
-
styling: "semantic",
|
|
1510
|
-
order: 1,
|
|
1511
|
-
customComponent: false,
|
|
1512
|
-
supportedEvents: [
|
|
1513
|
-
'onSelect',
|
|
1514
|
-
],
|
|
1515
|
-
},
|
|
1516
|
-
],
|
|
1517
|
-
});
|
|
1518
|
-
}
|
|
1519
|
-
});
|
|
1520
|
-
});
|
|
1521
|
-
}
|
|
1522
|
-
});
|
|
1523
|
-
});
|
|
1524
|
-
});
|
|
1525
|
-
});
|
|
1526
|
-
});
|
|
1527
|
-
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, isSchemaChanged: true});
|
|
1528
|
-
this.injectEvents(schema);
|
|
1529
|
-
};
|
|
1530
|
-
addSecondoryCta = (ev) => {
|
|
1531
|
-
const id = ev.target.id;
|
|
1532
|
-
const schema = _.cloneDeep(this.state.schema);
|
|
1533
|
-
const ck = this.props.Templates.selectedWeChatAccount.configs ? !!this.props.Templates.selectedWeChatAccount.configs.deeplink : false;
|
|
1534
|
-
const deeplinks = ck ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
1535
|
-
const deepLinkOptions = this.props.Templates.selectedWeChatAccount ? _.map(JSON.parse(deeplinks), (link) => ({label: link.name, value: link.link, title: link.link }) ) : [];
|
|
1536
|
-
// const eventsMap = _.cloneDeep(this.state.eventsMap);
|
|
1537
|
-
_.forEach(schema.containers, (container) => {
|
|
1538
|
-
_.forEach(container.panes, (pane) => {
|
|
1539
|
-
_.forEach(pane.sections, (section) => {
|
|
1540
|
-
_.forEach(section.childSections, (childeSection) => {
|
|
1541
|
-
_.forEach(childeSection.childSections, (child) => {
|
|
1542
|
-
if (child.type === 'multicols') {
|
|
1543
|
-
_.forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
1544
|
-
_.forEach(inputField.cols, (col) => {
|
|
1545
|
-
if (col.id === id) {
|
|
1546
|
-
if (col.fieldsCount < col.fieldsLimit) {
|
|
1547
|
-
const inputId = `secondary-cta-${col.fieldsCount}`;
|
|
1548
|
-
|
|
1549
|
-
child.inputFields.splice(fieldIndex, 0, {
|
|
1550
|
-
rowClassName: 'mobile-push-row',
|
|
1551
|
-
cols: [
|
|
1552
|
-
{
|
|
1553
|
-
id: `${inputId}-space`,
|
|
1554
|
-
metaType: "label",
|
|
1555
|
-
value: this.props.intl.formatMessage(messages.secondaryCTA),
|
|
1556
|
-
primitive: true,
|
|
1557
|
-
dynamicTab: false,
|
|
1558
|
-
type: "div",
|
|
1559
|
-
width: 4,
|
|
1560
|
-
style: {
|
|
1561
|
-
backgroundColor: 'white',
|
|
1562
|
-
textAlign: 'left',
|
|
1563
|
-
color: '#333333',
|
|
1564
|
-
lineHeight: '24px',
|
|
1565
|
-
fontSize: '14px',
|
|
1566
|
-
fontFamily: 'open-sans',
|
|
1567
|
-
fontStyle: 'normal',
|
|
1568
|
-
paddingTop: '8px',
|
|
1569
|
-
},
|
|
1570
|
-
offset: 0,
|
|
1571
|
-
onlyDisplay: true,
|
|
1572
|
-
colStyle: {
|
|
1573
|
-
flex: 1,
|
|
1574
|
-
},
|
|
1575
|
-
},
|
|
1576
|
-
{
|
|
1577
|
-
id: `${inputId}-label`,
|
|
1578
|
-
label: "link",
|
|
1579
|
-
type: "input", //Resembles component to be used
|
|
1580
|
-
metaType: "text",
|
|
1581
|
-
datatype: "string",
|
|
1582
|
-
required: true,
|
|
1583
|
-
width: 18,
|
|
1584
|
-
offset: 4,
|
|
1585
|
-
placeholder: this.props.intl.formatMessage(messages.enterCTALabel),
|
|
1586
|
-
fluid: true,
|
|
1587
|
-
styling: "semantic",
|
|
1588
|
-
order: 1,
|
|
1589
|
-
customComponent: false,
|
|
1590
|
-
errorMessage: this.props.intl.formatMessage(messages.ctaLabelCantEmpty),
|
|
1591
|
-
},
|
|
1592
|
-
{
|
|
1593
|
-
id: `${inputId}-delete`,
|
|
1594
|
-
type: "icon",
|
|
1595
|
-
value: 'delete',
|
|
1596
|
-
width: 1,
|
|
1597
|
-
submitAction: "onDelete",
|
|
1598
|
-
supportedEvents: ["onDelete"],
|
|
1599
|
-
},
|
|
1600
|
-
],
|
|
1601
|
-
});
|
|
1602
|
-
child.inputFields.splice(fieldIndex + 1, 0, {
|
|
1603
|
-
rowClassName: 'mobile-push-row',
|
|
1604
|
-
cols: [
|
|
1605
|
-
{
|
|
1606
|
-
id: `${inputId}-label-space`,
|
|
1607
|
-
metaType: "label",
|
|
1608
|
-
value: "",
|
|
1609
|
-
primitive: true,
|
|
1610
|
-
dynamicTab: false,
|
|
1611
|
-
type: "div",
|
|
1612
|
-
width: 4,
|
|
1613
|
-
style: {
|
|
1614
|
-
backgroundColor: 'white',
|
|
1615
|
-
textAlign: 'left',
|
|
1616
|
-
color: '#333333',
|
|
1617
|
-
lineHeight: '24px',
|
|
1618
|
-
fontSize: '14px',
|
|
1619
|
-
fontFamily: 'open-sans',
|
|
1620
|
-
fontStyle: 'normal',
|
|
1621
|
-
paddingTop: '8px',
|
|
1622
|
-
},
|
|
1623
|
-
offset: 0,
|
|
1624
|
-
onlyDisplay: true,
|
|
1625
|
-
colStyle: {
|
|
1626
|
-
flex: 1,
|
|
1627
|
-
},
|
|
1628
|
-
},
|
|
1629
|
-
{
|
|
1630
|
-
id: `cta-deeplink-${inputId}`,
|
|
1631
|
-
type: "radioGroup", //Resembles component to be used
|
|
1632
|
-
metaType: "text",
|
|
1633
|
-
datatype: "string",
|
|
1634
|
-
options: ["Deeplink", "External Link"],
|
|
1635
|
-
value: "Deeplink",
|
|
1636
|
-
required: true,
|
|
1637
|
-
width: 16,
|
|
1638
|
-
errorMessage: this.props.intl.formatMessage(messages.selectLinkType),
|
|
1639
|
-
fluid: true,
|
|
1640
|
-
styling: "semantic",
|
|
1641
|
-
order: 1,
|
|
1642
|
-
style: {
|
|
1643
|
-
lineHeight: '24px',
|
|
1644
|
-
fontSize: '14px',
|
|
1645
|
-
},
|
|
1646
|
-
customComponent: false,
|
|
1647
|
-
supportedEvents: ["onChange"],
|
|
1648
|
-
},
|
|
1649
|
-
],
|
|
1650
|
-
});
|
|
1651
|
-
child.inputFields.splice(fieldIndex + 2, 0, {
|
|
1652
|
-
rowClassName: 'mobile-push-row',
|
|
1653
|
-
id: 'cta-deeplink-select-section',
|
|
1654
|
-
cols: [
|
|
1655
|
-
{
|
|
1656
|
-
id: "cta-label",
|
|
1657
|
-
metaType: "label",
|
|
1658
|
-
value: "",
|
|
1659
|
-
primitive: true,
|
|
1660
|
-
dynamicTab: false,
|
|
1661
|
-
type: "div",
|
|
1662
|
-
width: 4,
|
|
1663
|
-
onlyDisplay: true,
|
|
1664
|
-
colStyle: {
|
|
1665
|
-
flex: 1,
|
|
1666
|
-
},
|
|
1667
|
-
},
|
|
1668
|
-
{
|
|
1669
|
-
id: `cta-deeplink-${inputId}-select`,
|
|
1670
|
-
placeholder: this.props.intl.formatMessage(messages.selectDeeplink),
|
|
1671
|
-
type: "select", //Resembles component to be used
|
|
1672
|
-
options: deepLinkOptions,
|
|
1673
|
-
errorMessage: this.props.intl.formatMessage(messages.selectADeeplink),
|
|
1674
|
-
metaType: "text",
|
|
1675
|
-
datatype: "string",
|
|
1676
|
-
required: true,
|
|
1677
|
-
fluid: true,
|
|
1678
|
-
width: 19,
|
|
1679
|
-
style: {
|
|
1680
|
-
fontSize: '14px',
|
|
1681
|
-
fontFamily: 'open-sans',
|
|
1682
|
-
fontStyle: 'normal',
|
|
1683
|
-
// fontWeight: 600,
|
|
1684
|
-
marginBottom: '16px',
|
|
1685
|
-
},
|
|
1686
|
-
styling: "semantic",
|
|
1687
|
-
order: 1,
|
|
1688
|
-
customComponent: false,
|
|
1689
|
-
supportedEvents: [
|
|
1690
|
-
'onSelect',
|
|
1691
|
-
],
|
|
1692
|
-
},
|
|
1693
|
-
],
|
|
1694
|
-
});
|
|
1695
|
-
const colField = col;
|
|
1696
|
-
colField.value = this.props.intl.formatMessage(messages.addAnotherCTA);
|
|
1697
|
-
colField.fieldsCount += 1;
|
|
1698
|
-
if (col.fieldsCount === col.fieldsLimit) {
|
|
1699
|
-
child.inputFields.pop();
|
|
1700
|
-
}
|
|
1701
|
-
// eventsMap[`cta-deeplink-${inputId}`] = {"onChange": this.onLinkTypeChange};
|
|
1702
|
-
}
|
|
1703
|
-
}
|
|
1704
|
-
});
|
|
1705
|
-
});
|
|
1706
|
-
}
|
|
1707
|
-
});
|
|
1708
|
-
});
|
|
1709
|
-
});
|
|
1710
|
-
});
|
|
1711
|
-
});
|
|
1712
|
-
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, isSchemaChanged: true});
|
|
1713
|
-
this.injectEvents(schema);
|
|
1714
|
-
};
|
|
1715
|
-
copyIphoneContent = () => {
|
|
1716
|
-
const formData = _.cloneDeep(this.state.formData);
|
|
1717
|
-
if (!!formData[1]['message-title2'] && !!formData[1]['message-editor2']) {
|
|
1718
|
-
formData[0]['message-title'] = formData[1]['message-title2'];
|
|
1719
|
-
formData[0]['message-editor'] = formData[1]['message-editor2'];
|
|
1720
|
-
this.setState({formData});
|
|
1721
|
-
} else {
|
|
1722
|
-
this.openNotificationWithIcon('warning', this.props.intl.formatMessage(messages.cantCopyEmptyField));
|
|
1723
|
-
}
|
|
1724
|
-
};
|
|
1725
|
-
copyAndroidContent = () => {
|
|
1726
|
-
const formData = _.cloneDeep(this.state.formData);
|
|
1727
|
-
if (!!formData[0]['message-title'] && !!formData[0]['message-editor']) {
|
|
1728
|
-
formData[1]['message-title2'] = formData[0]['message-title'];
|
|
1729
|
-
formData[1]['message-editor2'] = formData[0]['message-editor'];
|
|
1730
|
-
this.setState({formData});
|
|
1731
|
-
} else {
|
|
1732
|
-
this.openNotificationWithIcon('warning', this.props.intl.formatMessage(messages.cantCopyEmptyField));
|
|
1733
|
-
}
|
|
1734
|
-
};
|
|
1735
|
-
uploadImage = (data) => {
|
|
1736
|
-
if (data.fileParams.error) {
|
|
1737
|
-
const message = getMessageObject('error', this.props.intl.formatMessage(messages["File size cannot be more than 5mb"]), true);
|
|
1738
|
-
this.props.globalActions.addMessageToQueue(message);
|
|
1739
|
-
} else {
|
|
1740
|
-
const name = data.file.name.split('.');
|
|
1741
|
-
// const blob = data.file.slice(0, -1, 'image');
|
|
1742
|
-
const newFile = new File([data.file], `${name[0]}${Date.now()}.${name[1]}`, {type: 'image'});
|
|
1743
|
-
this.props.actions.uploadAsset(newFile, data.type, data.fileParams);
|
|
1744
|
-
}
|
|
1745
|
-
};
|
|
1746
|
-
selectCtaIos = (selectedConfig) => {
|
|
1747
|
-
this.showSelectedIosCta(selectedConfig);
|
|
1748
|
-
};
|
|
1749
|
-
|
|
1750
|
-
showCtaKeys = (eventTriggered, formData, field) => {
|
|
1751
|
-
|
|
1752
|
-
const schema = _.cloneDeep(this.state.schema);
|
|
1753
|
-
const eventsMap = _.cloneDeep(this.state.eventsMap);
|
|
1754
|
-
_.forEach(schema.containers, (container) => {
|
|
1755
|
-
_.forEach(container.panes, (pane) => {
|
|
1756
|
-
_.forEach(pane.sections, (section) => {
|
|
1757
|
-
_.forEach(section.childSections, (childeSection) => {
|
|
1758
|
-
_.forEach(childeSection.childSections, (child) => {
|
|
1759
|
-
const formChaild = child;
|
|
1760
|
-
if (child.type === 'multicols') {
|
|
1761
|
-
_.forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
1762
|
-
_.forEach(inputField.cols, (col) => {
|
|
1763
|
-
if (col.id === field.id) {
|
|
1764
|
-
const formDataKey = col.id.replace("-show-keys", "");
|
|
1765
|
-
const deeplinks = this.props.Templates.selectedWeChatAccount && this.props.Templates.selectedWeChatAccount.configs && !!this.props.Templates.selectedWeChatAccount.configs.deeplink ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
1766
|
-
let keys = this.props.Templates.selectedWeChatAccount ? _.filter(JSON.parse(deeplinks), (dl) => dl.link === formData[this.state.currentTab - 1][formDataKey]) : [];
|
|
1767
|
-
if (keys[0]) {
|
|
1768
|
-
keys = keys[0].keys;
|
|
1769
|
-
}
|
|
1770
|
-
let rows = _.map(keys, (key) => {
|
|
1771
|
-
const row = {
|
|
1772
|
-
rowClassName: 'mobile-push-row',
|
|
1773
|
-
id: 'cta-deeplink-keys',
|
|
1774
|
-
cols: [
|
|
1775
|
-
{
|
|
1776
|
-
id: `${key}-space`,
|
|
1777
|
-
metaType: "label",
|
|
1778
|
-
value: "",
|
|
1779
|
-
primitive: true,
|
|
1780
|
-
dynamicTab: false,
|
|
1781
|
-
type: "div",
|
|
1782
|
-
width: 4,
|
|
1783
|
-
offset: 0,
|
|
1784
|
-
onlyDisplay: true,
|
|
1785
|
-
colStyle: {
|
|
1786
|
-
flex: 1,
|
|
1787
|
-
},
|
|
1788
|
-
},
|
|
1789
|
-
{
|
|
1790
|
-
id: `${key}-label`,
|
|
1791
|
-
metaType: "label",
|
|
1792
|
-
value: key.replace('_', " "),
|
|
1793
|
-
primitive: true,
|
|
1794
|
-
dynamicTab: false,
|
|
1795
|
-
type: "div",
|
|
1796
|
-
width: 5,
|
|
1797
|
-
style: {
|
|
1798
|
-
backgroundColor: 'white',
|
|
1799
|
-
textAlign: 'left',
|
|
1800
|
-
lineHeight: '24px',
|
|
1801
|
-
fontSize: '14px',
|
|
1802
|
-
fontFamily: 'open-sans',
|
|
1803
|
-
fontStyle: 'normal',
|
|
1804
|
-
cursor: 'pointer',
|
|
1805
|
-
paddingTop: '8px',
|
|
1806
|
-
},
|
|
1807
|
-
offset: 0,
|
|
1808
|
-
onlyDisplay: true,
|
|
1809
|
-
colStyle: {
|
|
1810
|
-
flex: 1,
|
|
1811
|
-
},
|
|
1812
|
-
},
|
|
1813
|
-
{
|
|
1814
|
-
id: `custom-value-${key}-${col.id}`,
|
|
1815
|
-
label: "value",
|
|
1816
|
-
type: "input", //Resembles component to be used
|
|
1817
|
-
metaType: "text",
|
|
1818
|
-
datatype: "string",
|
|
1819
|
-
required: true,
|
|
1820
|
-
width: 14,
|
|
1821
|
-
placeholder: `${this.props.intl.formatMessage(messages.pleaseInput)} ${key.replace('_', " ")} ${this.props.intl.formatMessage(messages.here)}`,
|
|
1822
|
-
fluid: true,
|
|
1823
|
-
styling: "semantic",
|
|
1824
|
-
order: 1,
|
|
1825
|
-
customComponent: false,
|
|
1826
|
-
errorMessage: this.props.intl.formatMessage(messages.valueCantEmpty),
|
|
1827
|
-
},
|
|
1828
|
-
],
|
|
1829
|
-
};
|
|
1830
|
-
//eventsMap[`custome-${key}`] = {"onChange": this.onMessageTitleChange};
|
|
1831
|
-
return row;
|
|
1832
|
-
// formChaild.inputFields[fieldIndex + index] = field;
|
|
1833
|
-
});
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
const configkeys = _.filter(JSON.parse(deeplinks), (dl) => dl.link === this.state.formData[this.state.currentTab - 1][field.id]);
|
|
1837
|
-
if (configkeys.length) {
|
|
1838
|
-
const options = configkeys[0].keys;
|
|
1839
|
-
formChaild.inputFields = formChaild.inputFields.slice(0, fieldIndex + 1).concat(formChaild.inputFields.slice( fieldIndex + options.length + 1, formChaild.inputFields.length));
|
|
1840
|
-
// delete formData[self.state.currentTab - 1][`cta-deeplink-${id.replace('delete', 'select')}`];
|
|
1841
|
-
// delete formData[self.state.currentTab - 1][`cta-deeplink-${id.replace('-delete', '')}`];
|
|
1842
|
-
}
|
|
1843
|
-
if (formChaild.inputFields[fieldIndex + 1] && formChaild.inputFields[fieldIndex + 1].id === "cta-deeplink-keys") {
|
|
1844
|
-
rows = formChaild.inputFields.slice(0, fieldIndex + 1).concat(rows).concat(formChaild.inputFields.slice(fieldIndex + 1, formChaild.inputFields.length));
|
|
1845
|
-
formChaild.inputFields = rows;
|
|
1846
|
-
} else {
|
|
1847
|
-
rows = formChaild.inputFields.slice(0, fieldIndex + 1).concat(rows).concat(formChaild.inputFields.slice(fieldIndex + 1, formChaild.inputFields.length));
|
|
1848
|
-
formChaild.inputFields = rows;
|
|
1849
|
-
}
|
|
1850
|
-
}
|
|
1851
|
-
});
|
|
1852
|
-
});
|
|
1853
|
-
}
|
|
1854
|
-
});
|
|
1855
|
-
});
|
|
1856
|
-
});
|
|
1857
|
-
});
|
|
1858
|
-
});
|
|
1859
|
-
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, eventsMap, isSchemaChanged: true});
|
|
1860
|
-
this.injectEvents(schema);
|
|
1861
|
-
};
|
|
1862
|
-
saveFormData = (formData) => {
|
|
1863
|
-
|
|
1864
|
-
const obj = this.getTransformedData(formData);
|
|
1865
|
-
|
|
1866
|
-
this.props.actions.createTemplate(obj);
|
|
1867
|
-
};
|
|
1868
|
-
deleteSecondaryCtaIos = (event) => {
|
|
1869
|
-
const id = event.currentTarget.id;
|
|
1870
|
-
const schema = _.cloneDeep(this.state.schema);
|
|
1871
|
-
// const eventsMap = _.cloneDeep(this.state.eventsMap);
|
|
1872
|
-
const selectedDeeplink = this.state.formData[this.state.currentTab - 1][`cta-deeplink-${id.replace('delete-ios', 'select2')}`];
|
|
1873
|
-
const formData = _.cloneDeep(this.state.formData);
|
|
1874
|
-
const self = this;
|
|
1875
|
-
const device = this.state.currentTab === 1 ? 'android' : 'ios';
|
|
1876
|
-
_.forEach(schema.containers, (container) => {
|
|
1877
|
-
_.forEach(container.panes, (pane) => {
|
|
1878
|
-
_.forEach(pane.sections, (section) => {
|
|
1879
|
-
_.forEach(section.childSections, (childeSection) => {
|
|
1880
|
-
_.forEach(childeSection.childSections, (formChild) => {
|
|
1881
|
-
const child = formChild;
|
|
1882
|
-
if (child.type === 'multicols') {
|
|
1883
|
-
_.forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
1884
|
-
if (inputField) {
|
|
1885
|
-
_.forEach(inputField.cols, (col) => {
|
|
1886
|
-
if (col.id === id) {
|
|
1887
|
-
child.inputFields.splice(fieldIndex, 3);
|
|
1888
|
-
if (child.inputFields[fieldIndex] && child.inputFields[fieldIndex].id === "cta-external-link") {
|
|
1889
|
-
child.inputFields.splice(fieldIndex, 1);
|
|
1890
|
-
}
|
|
1891
|
-
if (child.inputFields[fieldIndex] && child.inputFields[fieldIndex].id === "cta-deeplink-select-section") {
|
|
1892
|
-
const deeplinks = this.props.Templates.selectedWeChatAccount && this.props.Templates.selectedWeChatAccount.configs && !!this.props.Templates.selectedWeChatAccount.configs.deeplink ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
1893
|
-
const configkeys = this.props.Templates.selectedWeChatAccount ? _.filter(JSON.parse(deeplinks), (dl) => dl.link === selectedDeeplink) : [];
|
|
1894
|
-
if (configkeys.length) {
|
|
1895
|
-
const options = configkeys[0].keys;
|
|
1896
|
-
child.inputFields = child.inputFields.slice(0, fieldIndex).concat(child.inputFields.slice( fieldIndex + options.length + 1, child.inputFields.length));
|
|
1897
|
-
delete formData[self.state.currentTab - 1][`cta-deeplink-${id.replace('delete', 'select')}`];
|
|
1898
|
-
delete formData[self.state.currentTab - 1][`cta-deeplink-${id.replace('-delete', '')}`];
|
|
1899
|
-
} else {
|
|
1900
|
-
child.inputFields.splice(fieldIndex, 1);
|
|
1901
|
-
}
|
|
1902
|
-
}
|
|
1903
|
-
if (device === 'ios') {
|
|
1904
|
-
child.inputFields[fieldIndex] = {
|
|
1905
|
-
cols: [
|
|
1906
|
-
{
|
|
1907
|
-
id: "add-sec-cta-ios",
|
|
1908
|
-
metaType: "label",
|
|
1909
|
-
value: this.props.intl.formatMessage(messages.addSecondaryCTA),
|
|
1910
|
-
primitive: true,
|
|
1911
|
-
dynamicTab: false,
|
|
1912
|
-
type: "div",
|
|
1913
|
-
style: {
|
|
1914
|
-
backgroundColor: 'white',
|
|
1915
|
-
textAlign: 'left',
|
|
1916
|
-
color: '#2673D7',
|
|
1917
|
-
lineHeight: '24px',
|
|
1918
|
-
marginTop: '16px',
|
|
1919
|
-
fontSize: '14px',
|
|
1920
|
-
fontWeight: '600',
|
|
1921
|
-
fontFamily: 'open-sans',
|
|
1922
|
-
fontStyle: 'normal',
|
|
1923
|
-
cursor: 'pointer',
|
|
1924
|
-
},
|
|
1925
|
-
offset: 0,
|
|
1926
|
-
onlyDisplay: true,
|
|
1927
|
-
colStyle: {
|
|
1928
|
-
flex: 1,
|
|
1929
|
-
},
|
|
1930
|
-
submitAction: "addSecondaryCtaIos",
|
|
1931
|
-
supportedEvents: ["addSecondaryCtaIos"],
|
|
1932
|
-
},
|
|
1933
|
-
],
|
|
1934
|
-
};
|
|
1935
|
-
}
|
|
1936
|
-
}
|
|
1937
|
-
});
|
|
1938
|
-
}
|
|
1939
|
-
});
|
|
1940
|
-
}
|
|
1941
|
-
});
|
|
1942
|
-
});
|
|
1943
|
-
});
|
|
1944
|
-
});
|
|
1945
|
-
});
|
|
1946
|
-
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, formData, isSchemaChanged: true});
|
|
1947
|
-
this.injectEvents(schema);
|
|
1948
|
-
};
|
|
1949
|
-
deletePrimaryCTA = (event) => {
|
|
1950
|
-
const id = event.currentTarget.id;
|
|
1951
|
-
const schema = _.cloneDeep(this.state.schema);
|
|
1952
|
-
// const eventsMap = _.cloneDeep(this.state.eventsMap);
|
|
1953
|
-
const selectedDeeplink = this.state.formData[this.state.currentTab - 1][`${id.replace('delete', 'select')}`];
|
|
1954
|
-
const formData = _.cloneDeep(this.state.formData);
|
|
1955
|
-
const self = this;
|
|
1956
|
-
_.forEach(schema.containers, (container) => {
|
|
1957
|
-
_.forEach(container.panes, (pane) => {
|
|
1958
|
-
_.forEach(pane.sections, (section) => {
|
|
1959
|
-
_.forEach(section.childSections, (childeSection) => {
|
|
1960
|
-
_.forEach(childeSection.childSections, (formChild) => {
|
|
1961
|
-
const child = formChild;
|
|
1962
|
-
if (child.type === 'multicols') {
|
|
1963
|
-
_.forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
1964
|
-
if (inputField) {
|
|
1965
|
-
_.forEach(inputField.cols, (col) => {
|
|
1966
|
-
if (col.id === id) {
|
|
1967
|
-
child.inputFields.splice(fieldIndex, 1);
|
|
1968
|
-
if (child.inputFields[fieldIndex] && child.inputFields[fieldIndex].id === "cta-external-link") {
|
|
1969
|
-
child.inputFields.splice(fieldIndex, 1);
|
|
1970
|
-
}
|
|
1971
|
-
if (child.inputFields[fieldIndex] && child.inputFields[fieldIndex].id === "cta-deeplink-select-section") {
|
|
1972
|
-
const deeplinks = this.props.Templates.selectedWeChatAccount && this.props.Templates.selectedWeChatAccount.configs && !!this.props.Templates.selectedWeChatAccount.configs.deeplink ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
1973
|
-
const configkeys = this.props.Templates.selectedWeChatAccount ? _.filter(JSON.parse(deeplinks), (dl) => dl.link === selectedDeeplink) : [];
|
|
1974
|
-
if (configkeys.length) {
|
|
1975
|
-
const options = configkeys[0].keys;
|
|
1976
|
-
child.inputFields = child.inputFields.slice(0, fieldIndex).concat(child.inputFields.slice( fieldIndex + options.length + 1, child.inputFields.length));
|
|
1977
|
-
delete formData[self.state.currentTab - 1][`${id.replace('delete', 'select')}`];
|
|
1978
|
-
delete formData[self.state.currentTab - 1][`${id.replace('-delete', '')}`];
|
|
1979
|
-
} else {
|
|
1980
|
-
child.inputFields.splice(fieldIndex, 1);
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
child.inputFields.splice(fieldIndex, 0, {
|
|
1984
|
-
cols: [
|
|
1985
|
-
{
|
|
1986
|
-
id: `${this.state.currentTab === 1 ? "add-pri-cta" : "add-pri-cta-ios"}`,
|
|
1987
|
-
metaType: "label",
|
|
1988
|
-
value: this.props.intl.formatMessage(messages.addPrimaryCTA),
|
|
1989
|
-
primitive: true,
|
|
1990
|
-
dynamicTab: false,
|
|
1991
|
-
type: "div",
|
|
1992
|
-
style: {
|
|
1993
|
-
backgroundColor: 'white',
|
|
1994
|
-
textAlign: 'left',
|
|
1995
|
-
color: '#2673D7',
|
|
1996
|
-
lineHeight: '24px',
|
|
1997
|
-
fontSize: '14px',
|
|
1998
|
-
fontWeight: '600',
|
|
1999
|
-
fontFamily: 'open-sans',
|
|
2000
|
-
fontStyle: 'normal',
|
|
2001
|
-
cursor: 'pointer',
|
|
2002
|
-
},
|
|
2003
|
-
offset: 0,
|
|
2004
|
-
onlyDisplay: true,
|
|
2005
|
-
colStyle: {
|
|
2006
|
-
flex: 1,
|
|
2007
|
-
},
|
|
2008
|
-
submitAction: "addPrimaryCta",
|
|
2009
|
-
supportedEvents: ["addPrimaryCta"],
|
|
2010
|
-
},
|
|
2011
|
-
],
|
|
2012
|
-
});
|
|
2013
|
-
}
|
|
2014
|
-
});
|
|
2015
|
-
}
|
|
2016
|
-
});
|
|
2017
|
-
}
|
|
2018
|
-
});
|
|
2019
|
-
});
|
|
2020
|
-
});
|
|
2021
|
-
});
|
|
2022
|
-
});
|
|
2023
|
-
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, formData, isSchemaChanged: true});
|
|
2024
|
-
this.injectEvents(schema);
|
|
2025
|
-
};
|
|
2026
|
-
|
|
2027
|
-
deleteSecondaryCTA = (event) => {
|
|
2028
|
-
const id = event.currentTarget.id;
|
|
2029
|
-
if (id === "secondary-cta-0-delete") {
|
|
2030
|
-
const secCta2 = document.getElementById("secondary-cta-1-delete");
|
|
2031
|
-
if (secCta2) {
|
|
2032
|
-
const modalContent = {title: this.props.intl.formatMessage(messages.alertMessage), body: this.props.intl.formatMessage(messages.deleteSecondCTAFirst), type: 'info', show: true, onCancel: this.onModalCancel};
|
|
2033
|
-
this.setState({modalContent, showModal: true});
|
|
2034
|
-
return;
|
|
2035
|
-
}
|
|
2036
|
-
}
|
|
2037
|
-
const schema = _.cloneDeep(this.state.schema);
|
|
2038
|
-
// const eventsMap = _.cloneDeep(this.state.eventsMap);
|
|
2039
|
-
const selectedDeeplink = this.state.formData[this.state.currentTab - 1][`cta-deeplink-${id.replace('delete', 'select')}`];
|
|
2040
|
-
const formData = _.cloneDeep(this.state.formData);
|
|
2041
|
-
const device = this.state.currentTab === 1 ? 'android' : 'ios';
|
|
2042
|
-
_.forEach(schema.containers, (container) => {
|
|
2043
|
-
_.forEach(container.panes, (pane) => {
|
|
2044
|
-
_.forEach(pane.sections, (section) => {
|
|
2045
|
-
_.forEach(section.childSections, (childeSection) => {
|
|
2046
|
-
_.forEach(childeSection.childSections, (formChild) => {
|
|
2047
|
-
const child = formChild;
|
|
2048
|
-
if (child.type === 'multicols') {
|
|
2049
|
-
_.forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
2050
|
-
if (inputField) {
|
|
2051
|
-
_.forEach(inputField.cols, (col) => {
|
|
2052
|
-
if (col.id === id) {
|
|
2053
|
-
if (device === 'ios') {
|
|
2054
|
-
child.inputFields.splice(fieldIndex, 3);
|
|
2055
|
-
} else {
|
|
2056
|
-
child.inputFields.splice(fieldIndex, 2);
|
|
2057
|
-
}
|
|
2058
|
-
if (child.inputFields[fieldIndex] && child.inputFields[fieldIndex].id === "cta-external-link") {
|
|
2059
|
-
child.inputFields.splice(fieldIndex, 1);
|
|
2060
|
-
}
|
|
2061
|
-
if (child.inputFields[fieldIndex] && child.inputFields[fieldIndex].id === "cta-deeplink-select-section") {
|
|
2062
|
-
const ck = this.props.Templates.selectedWeChatAccount.configs ? !!this.props.Templates.selectedWeChatAccount.configs.deeplink : false;
|
|
2063
|
-
const deeplinks = ck ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
2064
|
-
const configkeys = this.props.Templates.selectedWeChatAccount ? _.filter(JSON.parse(deeplinks), (dl) => dl.link === selectedDeeplink) : [];
|
|
2065
|
-
if (configkeys.length) {
|
|
2066
|
-
const options = configkeys[0].keys;
|
|
2067
|
-
child.inputFields = child.inputFields.slice(0, fieldIndex).concat(child.inputFields.slice( fieldIndex + options.length + 1, child.inputFields.length));
|
|
2068
|
-
} else {
|
|
2069
|
-
child.inputFields.splice(fieldIndex, 1);
|
|
2070
|
-
}
|
|
2071
|
-
}
|
|
2072
|
-
if (device === 'ios') {
|
|
2073
|
-
child.inputFields[fieldIndex] = {
|
|
2074
|
-
cols: [
|
|
2075
|
-
{
|
|
2076
|
-
id: "add-sec-cta-ios",
|
|
2077
|
-
metaType: "label",
|
|
2078
|
-
value: this.props.intl.formatMessage(messages.addSecondaryCTA),
|
|
2079
|
-
primitive: true,
|
|
2080
|
-
dynamicTab: false,
|
|
2081
|
-
type: "div",
|
|
2082
|
-
style: {
|
|
2083
|
-
backgroundColor: 'white',
|
|
2084
|
-
textAlign: 'left',
|
|
2085
|
-
color: '#2673D7',
|
|
2086
|
-
lineHeight: '24px',
|
|
2087
|
-
fontSize: '14px',
|
|
2088
|
-
marginTop: '16px',
|
|
2089
|
-
fontWeight: '600',
|
|
2090
|
-
fontFamily: 'open-sans',
|
|
2091
|
-
fontStyle: 'normal',
|
|
2092
|
-
cursor: 'pointer',
|
|
2093
|
-
},
|
|
2094
|
-
offset: 0,
|
|
2095
|
-
onlyDisplay: true,
|
|
2096
|
-
colStyle: {
|
|
2097
|
-
flex: 1,
|
|
2098
|
-
},
|
|
2099
|
-
submitAction: "addSecondaryCtaIos",
|
|
2100
|
-
supportedEvents: ["addSecondaryCtaIos"],
|
|
2101
|
-
},
|
|
2102
|
-
],
|
|
2103
|
-
};
|
|
2104
|
-
} else {
|
|
2105
|
-
if (child.inputFields[fieldIndex] && child.inputFields[fieldIndex].cols[0] && child.inputFields[fieldIndex].cols[0].id === "add-sec-cta") {
|
|
2106
|
-
child.inputFields[fieldIndex] = {
|
|
2107
|
-
cols: [
|
|
2108
|
-
{
|
|
2109
|
-
id: "add-sec-cta",
|
|
2110
|
-
metaType: "label",
|
|
2111
|
-
value: this.props.intl.formatMessage(messages.addSecondaryCTA),
|
|
2112
|
-
primitive: true,
|
|
2113
|
-
dynamicTab: false,
|
|
2114
|
-
type: "div",
|
|
2115
|
-
style: {
|
|
2116
|
-
backgroundColor: 'white',
|
|
2117
|
-
textAlign: 'left',
|
|
2118
|
-
color: '#2673D7',
|
|
2119
|
-
lineHeight: '24px',
|
|
2120
|
-
fontSize: '14px',
|
|
2121
|
-
fontWeight: '600',
|
|
2122
|
-
marginTop: '16px',
|
|
2123
|
-
fontFamily: 'open-sans',
|
|
2124
|
-
fontStyle: 'normal',
|
|
2125
|
-
cursor: 'pointer',
|
|
2126
|
-
},
|
|
2127
|
-
offset: 0,
|
|
2128
|
-
onlyDisplay: true,
|
|
2129
|
-
colStyle: {
|
|
2130
|
-
flex: 1,
|
|
2131
|
-
},
|
|
2132
|
-
submitAction: "addSecondaryCta",
|
|
2133
|
-
supportedEvents: ['addSecondaryCta'],
|
|
2134
|
-
fieldsLimit: 2,
|
|
2135
|
-
fieldsCount: 0,
|
|
2136
|
-
},
|
|
2137
|
-
],
|
|
2138
|
-
};
|
|
2139
|
-
}
|
|
2140
|
-
if (id === "secondary-cta-1-delete" || child.inputFields[fieldIndex].cols[0].id === "cta-label" || child.inputFields[fieldIndex].cols[0].id === "secondary-cta-1-space") {
|
|
2141
|
-
let nextFieldIndex = fieldIndex;
|
|
2142
|
-
if (id === "secondary-cta-1-delete" || child.inputFields[fieldIndex].cols[0].id === "secondary-cta-1-space") {
|
|
2143
|
-
nextFieldIndex = child.inputFields.length;
|
|
2144
|
-
}
|
|
2145
|
-
child.inputFields[nextFieldIndex] = {
|
|
2146
|
-
cols: [
|
|
2147
|
-
{
|
|
2148
|
-
id: "add-sec-cta",
|
|
2149
|
-
metaType: "label",
|
|
2150
|
-
value: this.props.intl.formatMessage(messages.addAnotherCTA),
|
|
2151
|
-
primitive: true,
|
|
2152
|
-
dynamicTab: false,
|
|
2153
|
-
type: "div",
|
|
2154
|
-
style: {
|
|
2155
|
-
backgroundColor: 'white',
|
|
2156
|
-
textAlign: 'left',
|
|
2157
|
-
color: '#2673D7',
|
|
2158
|
-
lineHeight: '24px',
|
|
2159
|
-
fontSize: '14px',
|
|
2160
|
-
fontWeight: '600',
|
|
2161
|
-
fontFamily: 'open-sans',
|
|
2162
|
-
fontStyle: 'normal',
|
|
2163
|
-
cursor: 'pointer',
|
|
2164
|
-
},
|
|
2165
|
-
offset: 0,
|
|
2166
|
-
onlyDisplay: true,
|
|
2167
|
-
colStyle: {
|
|
2168
|
-
flex: 1,
|
|
2169
|
-
},
|
|
2170
|
-
submitAction: "addSecondaryCta",
|
|
2171
|
-
supportedEvents: ['addSecondaryCta'],
|
|
2172
|
-
fieldsLimit: 2,
|
|
2173
|
-
fieldsCount: 1,
|
|
2174
|
-
},
|
|
2175
|
-
],
|
|
2176
|
-
};
|
|
2177
|
-
}
|
|
2178
|
-
}
|
|
2179
|
-
}
|
|
2180
|
-
});
|
|
2181
|
-
}
|
|
2182
|
-
});
|
|
2183
|
-
}
|
|
2184
|
-
});
|
|
2185
|
-
});
|
|
2186
|
-
});
|
|
2187
|
-
});
|
|
2188
|
-
});
|
|
2189
|
-
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, formData, isSchemaChanged: true});
|
|
2190
|
-
this.injectEvents(schema);
|
|
2191
|
-
};
|
|
2192
|
-
handleOnTagsContextChange = (data) => {
|
|
2193
|
-
|
|
2194
|
-
const query = {
|
|
2195
|
-
layout: 'mobilepush',
|
|
2196
|
-
type: 'TAG',
|
|
2197
|
-
context: (data || '').toLowerCase() === 'all' ? 'default' : (data || '').toLowerCase(),
|
|
2198
|
-
embedded: this.props.location.query.type === 'embedded' ? this.props.location.query.type : 'full',
|
|
2199
|
-
};
|
|
2200
|
-
this.props.globalActions.fetchSchemaForEntity(query);
|
|
2201
|
-
};
|
|
2202
|
-
render() {
|
|
2203
|
-
let tipText = this.props.Create.createTemplateInProgress ? this.props.intl.formatMessage(messages.savingTemplate) : "";
|
|
2204
|
-
let loading = this.props.Create.createTemplateInProgress ? this.props.Create.createTemplateInProgress : false;
|
|
2205
|
-
if (this.props.Create.assetUploading) {
|
|
2206
|
-
tipText = this.props.intl.formatMessage(messages.gettingTemplate);
|
|
2207
|
-
loading = true;
|
|
2208
|
-
}
|
|
2209
|
-
let tags = this.props.metaEntities && this.props.metaEntities.tags ? this.props.metaEntities.tags.standard : [];
|
|
2210
|
-
if (this.props.supportedTags) {
|
|
2211
|
-
tags = this.props.supportedTags; // if get default tags is not present and supported tags is present use that inlbrary mode
|
|
2212
|
-
}
|
|
2213
|
-
return (
|
|
2214
|
-
<div>
|
|
2215
|
-
<Spin tip={tipText} spinning={loading}>
|
|
2216
|
-
<Row style={{marginLeft: '-48px'}}>
|
|
2217
|
-
<Col offset={1}>
|
|
2218
|
-
{this.props.location.query.type !== "embedded" &&
|
|
2219
|
-
<Breadcrumb>
|
|
2220
|
-
<BreadcrumbItem>{this.props.intl.formatMessage(messages.Campaigns)}</BreadcrumbItem>
|
|
2221
|
-
<BreadcrumbItem>{this.props.intl.formatMessage(messages.Creatives)}</BreadcrumbItem>
|
|
2222
|
-
<BreadcrumbItem>{this.props.intl.formatMessage(messages["Mobile Push"])}</BreadcrumbItem>
|
|
2223
|
-
</Breadcrumb>
|
|
2224
|
-
}
|
|
2225
|
-
</Col>
|
|
2226
|
-
</Row>
|
|
2227
|
-
<Row>
|
|
2228
|
-
<Col>
|
|
2229
|
-
<FormBuilder
|
|
2230
|
-
key={"form builder"}
|
|
2231
|
-
schema={this.state.schema}
|
|
2232
|
-
onSubmit={this.saveFormData}
|
|
2233
|
-
onChange={this.onFormDataChange}
|
|
2234
|
-
currentTab={this.state.currentTab}
|
|
2235
|
-
parent={this}
|
|
2236
|
-
formData={_.cloneDeep(this.state.formData)}
|
|
2237
|
-
location={this.props.location}
|
|
2238
|
-
tags={tags}
|
|
2239
|
-
injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
|
|
2240
|
-
onFormValidityChange={this.setFormValidity}
|
|
2241
|
-
usingTabContainer
|
|
2242
|
-
checkValidation={false}
|
|
2243
|
-
iosCtasData={this.state.iosCtasData}
|
|
2244
|
-
tabKey={this.state.tabKey}
|
|
2245
|
-
tabCount={2}
|
|
2246
|
-
showModal={this.state.showModal}
|
|
2247
|
-
isSchemaChanged={this.state.isSchemaChanged}
|
|
2248
|
-
modal={this.state.modalContent}
|
|
2249
|
-
handleCancelModal={this.handleCancelModal}
|
|
2250
|
-
iframeParent={parent}
|
|
2251
|
-
router={this.props.router}
|
|
2252
|
-
onContextChange={this.handleOnTagsContextChange}
|
|
2253
|
-
setModalContent={this.setModalContent}
|
|
2254
|
-
/>
|
|
2255
|
-
</Col>
|
|
2256
|
-
</Row>
|
|
2257
|
-
</Spin>
|
|
2258
|
-
</div>
|
|
2259
|
-
);
|
|
2260
|
-
}
|
|
2261
|
-
}
|
|
2262
|
-
|
|
2263
|
-
Create.propTypes = {
|
|
2264
|
-
actions: PropTypes.object.isRequired,
|
|
2265
|
-
Create: PropTypes.object,
|
|
2266
|
-
router: PropTypes.object,
|
|
2267
|
-
location: PropTypes.object,
|
|
2268
|
-
route: PropTypes.object,
|
|
2269
|
-
globalActions: PropTypes.object,
|
|
2270
|
-
metaEntities: PropTypes.object,
|
|
2271
|
-
params: PropTypes.object,
|
|
2272
|
-
Templates: PropTypes.object,
|
|
2273
|
-
intl: intlShape.isRequired,
|
|
2274
|
-
supportedTags: PropTypes.array,
|
|
2275
|
-
getDefaultTags: PropTypes.string,
|
|
2276
|
-
injectedTags: PropTypes.object,
|
|
2277
|
-
};
|
|
2278
|
-
|
|
2279
|
-
const mapStateToProps = createStructuredSelector({
|
|
2280
|
-
Create: makeSelectCreate(),
|
|
2281
|
-
createResponse: makeSelectCreateResponse(),
|
|
2282
|
-
metaEntities: makeSelectMetaEntities(),
|
|
2283
|
-
Templates: makeSelectTemplates(),
|
|
2284
|
-
injectedTags: setInjectedTags(),
|
|
2285
|
-
});
|
|
2286
|
-
|
|
2287
|
-
function mapDispatchToProps(dispatch) {
|
|
2288
|
-
return {
|
|
2289
|
-
actions: bindActionCreators(actions, dispatch),
|
|
2290
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
2291
|
-
};
|
|
2292
|
-
}
|
|
2293
|
-
|
|
2294
|
-
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
|
2295
|
-
const withReducer = injectReducer({ key: 'mobileCreate', reducer });
|
|
2296
|
-
const withSaga = injectSaga({ key: 'mobileCreate', saga: createMPushSaga });
|
|
2297
|
-
|
|
2298
|
-
export default compose(
|
|
2299
|
-
UserIsAuthenticated,
|
|
2300
|
-
withReducer,
|
|
2301
|
-
withSaga,
|
|
2302
|
-
withConnect,
|
|
2303
|
-
)(injectIntl(Create));
|