@capillarytech/creatives-library 3.8.7 → 3.8.9
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/assets/lineImageTemplate.png +0 -0
- package/package.json +1 -1
- package/routes.js +5 -0
- package/services/getSchema.js +4 -1
- package/translations/en.json +23 -1
- package/translations/zh.json +23 -1
- package/v2Components/FormBuilder/index.js +164 -31
- package/v2Components/FormBuilder/messages.js +16 -0
- package/v2Components/TemplatePreview/index.js +13 -4
- package/v2Containers/Assets/Gallery/index.js +40 -29
- package/v2Containers/CreativesContainer/SlideBoxContent.js +58 -3
- package/v2Containers/CreativesContainer/index.js +1 -0
- package/v2Containers/EmailWrapper/index.js +3 -5
- package/v2Containers/Line/Create/_lineCreate.scss +40 -19
- package/v2Containers/Line/Create/actions.js +11 -8
- package/v2Containers/Line/Create/index.js +405 -215
- package/v2Containers/Line/Create/initialSchema.js +378 -0
- package/v2Containers/Line/Create/messages.js +42 -2
- package/v2Containers/Line/Create/sagas.js +10 -4
- package/v2Containers/Line/Create/selectors.js +1 -2
- package/v2Containers/Line/CreateWrapper/constants.js +2 -0
- package/v2Containers/Line/CreateWrapper/index.js +114 -0
- package/v2Containers/Line/CreateWrapper/messages.js +43 -0
- package/v2Containers/Templates/_templates.scss +20 -1
- package/v2Containers/Templates/index.js +59 -5
- package/v2Containers/TemplatesV2/index.js +5 -4
- package/v2Containers/TemplatesV2/messages.js +4 -0
|
Binary file
|
package/package.json
CHANGED
package/routes.js
CHANGED
|
@@ -630,6 +630,8 @@ export default function createRoutes(store) {
|
|
|
630
630
|
import('v2Containers/Assets/Gallery/sagas'),
|
|
631
631
|
import('v2Containers/Facebook/sagas'),
|
|
632
632
|
import('v2Containers/Facebook/reducer'),
|
|
633
|
+
import('v2Containers/Line/Create/sagas'),
|
|
634
|
+
import('v2Containers/Line/Create/reducer'),
|
|
633
635
|
]);
|
|
634
636
|
|
|
635
637
|
const renderRoute = loadModule(cb);
|
|
@@ -648,6 +650,7 @@ export default function createRoutes(store) {
|
|
|
648
650
|
weChatRichmediaTemplatesEditSagas, weChatRichmediaTemplatesEditReducer,
|
|
649
651
|
galleryReducer, gallerySagas,
|
|
650
652
|
facebookSagas, facebookReducer,
|
|
653
|
+
lineCreateSagas, lineCreateReducer,
|
|
651
654
|
]) => {
|
|
652
655
|
injectReducer('templates', reducer.default);
|
|
653
656
|
injectReducer('cap', capReducer.default);
|
|
@@ -663,6 +666,7 @@ export default function createRoutes(store) {
|
|
|
663
666
|
injectReducer('weChatRichmediaEdit', weChatRichmediaTemplatesEditReducer.default);
|
|
664
667
|
injectReducer('gallery', galleryReducer.default);
|
|
665
668
|
injectReducer('facebook', facebookReducer.default);
|
|
669
|
+
injectReducer('lineCreate', lineCreateReducer.default);
|
|
666
670
|
injectSagas(gallerySagas.default);
|
|
667
671
|
injectSagas(sagas.default);
|
|
668
672
|
injectSagas(capSagas.default);
|
|
@@ -676,6 +680,7 @@ export default function createRoutes(store) {
|
|
|
676
680
|
injectSagas(weChatRichmediaTemplatesCreateSagas.default);
|
|
677
681
|
injectSagas(weChatRichmediaTemplatesEditSagas.default);
|
|
678
682
|
injectSagas(facebookSagas.default);
|
|
683
|
+
injectSagas(lineCreateSagas.default);
|
|
679
684
|
renderRoute(component);
|
|
680
685
|
});
|
|
681
686
|
importModules.catch(errorLoading);
|
package/services/getSchema.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {SMS, EMAIL, MOBILE_PUSH, WECHAT} from '../v2Containers/CreativesContainer/constants';
|
|
1
|
+
import {SMS, EMAIL, MOBILE_PUSH, WECHAT, LINE} from '../v2Containers/CreativesContainer/constants';
|
|
2
2
|
export default function getSchema(channel) {
|
|
3
3
|
let schemaPath = '../containers/';
|
|
4
4
|
switch (channel.toUpperCase()) {
|
|
@@ -14,6 +14,9 @@ export default function getSchema(channel) {
|
|
|
14
14
|
case WECHAT:
|
|
15
15
|
schemaPath = import(`../v2Containers/WeChat/MapTemplates/initialSchema`);
|
|
16
16
|
break;
|
|
17
|
+
case LINE:
|
|
18
|
+
schemaPath = import(`../v2Containers/Line/Create/initialSchema`);
|
|
19
|
+
break;
|
|
17
20
|
default:
|
|
18
21
|
schemaPath = import(`../v2Containers/Sms/initialSchema`);
|
|
19
22
|
}
|
package/translations/en.json
CHANGED
|
@@ -112,6 +112,8 @@
|
|
|
112
112
|
"creatives.componentsV2.FormBuilder.contentNotValidLanguage": "Content is not valid for language:",
|
|
113
113
|
"creatives.componentsV2.FormBuilder.dragAndDrop": "Drag and drop image here",
|
|
114
114
|
"creatives.componentsV2.FormBuilder.header": "This is the FormBuilder component !",
|
|
115
|
+
"creatives.componentsV2.FormBuilder.imageDimenstionDescription": "Dimensions: 300px x 400px Size: 30mb",
|
|
116
|
+
"creatives.componentsV2.FormBuilder.imageReUpload": "Re upload",
|
|
115
117
|
"creatives.componentsV2.FormBuilder.layoutSelection": "Layout Selection",
|
|
116
118
|
"creatives.componentsV2.FormBuilder.loadingEDMTemplates": "Loading EDM Templates",
|
|
117
119
|
"creatives.componentsV2.FormBuilder.missingTags": "Missing tags are:",
|
|
@@ -120,6 +122,8 @@
|
|
|
120
122
|
"creatives.componentsV2.FormBuilder.selectAFile": "Select a file from your computer",
|
|
121
123
|
"creatives.componentsV2.FormBuilder.unsupportedTags": "Unsupported tags are:",
|
|
122
124
|
"creatives.componentsV2.FormBuilder.upload": "Upload",
|
|
125
|
+
"creatives.componentsV2.FormBuilder.uploadComputer": "Your computer",
|
|
126
|
+
"creatives.componentsV2.FormBuilder.uploadGallery": "Gallery",
|
|
123
127
|
"creatives.componentsV2.FormBuilder.yes": "Yes",
|
|
124
128
|
"creatives.componentsV2.Header.cancel": "Cancel",
|
|
125
129
|
"creatives.componentsV2.Header.header": "This is the Header component !",
|
|
@@ -229,6 +233,7 @@
|
|
|
229
233
|
"creatives.containers.Create.graphic_details_page": "Whether to display the graphic cover on the graphic details page",
|
|
230
234
|
"creatives.containers.Create.header": "This is Create container !",
|
|
231
235
|
"creatives.containers.Create.http_example": "Example: http://example.com",
|
|
236
|
+
"creatives.containers.Create.imageGallery": "Gallery",
|
|
232
237
|
"creatives.containers.Create.markFinalVersionLabel": "Mark as final",
|
|
233
238
|
"creatives.containers.Create.maxContentCount": "You have reached the maximum template size",
|
|
234
239
|
"creatives.containers.Create.messageLabel": "Message",
|
|
@@ -246,9 +251,17 @@
|
|
|
246
251
|
"creatives.containers.Create.sourceLinkEmpty": "Cannot leave source link field empty",
|
|
247
252
|
"creatives.containers.Create.tagsErrorMessage": "\"Optout\" label is mandatory. Please add \"Optout\" label to this message",
|
|
248
253
|
"creatives.containers.Create.tagsLabel": "Tags",
|
|
254
|
+
"creatives.containers.Create.templateAddTag": "Add tag",
|
|
249
255
|
"creatives.containers.Create.templateDataNotValid": "Template data is not valid",
|
|
250
256
|
"creatives.containers.Create.templateMarkedFinal": "Template Marked as Final Successfully",
|
|
257
|
+
"creatives.containers.Create.templateMessageError": "Template content cannot be empty!",
|
|
258
|
+
"creatives.containers.Create.templateMessagePlaceholder": "Please input line template content.",
|
|
259
|
+
"creatives.containers.Create.templateMessagePreviewPropsError": "Please upload image",
|
|
260
|
+
"creatives.containers.Create.templateMessagePreviewPropsInductiveText": "The relevant image that complements the message context.",
|
|
261
|
+
"creatives.containers.Create.templateMessagePreviewPropsLabel": "Upload image content",
|
|
262
|
+
"creatives.containers.Create.templateNameErrorPlaceholder": "Template name cannot be empty.",
|
|
251
263
|
"creatives.containers.Create.templateNamePlaceHolder": "Enter template name",
|
|
264
|
+
"creatives.containers.Create.templatePlaceholder": "Enter template name",
|
|
252
265
|
"creatives.containers.Create.titleCharacterCount": "Title exceeds character count limit by",
|
|
253
266
|
"creatives.containers.Create.titleEmpty": "Cannot leave title field empty",
|
|
254
267
|
"creatives.containers.Create.titleNameRepeated": "Title name cannot be repeated",
|
|
@@ -1051,6 +1064,7 @@
|
|
|
1051
1064
|
"creatives.containersV2.Line.Create.image": "Please upload an image to proceed",
|
|
1052
1065
|
"creatives.containersV2.Line.Create.inputLineTemplateContent": "Please enter the message content",
|
|
1053
1066
|
"creatives.containersV2.Line.Create.line": "Line",
|
|
1067
|
+
"creatives.containersV2.Line.Create.lineTemplateCreatedSuccessfully": "Line template created successfully",
|
|
1054
1068
|
"creatives.containersV2.Line.Create.maxUploadFileSize": "Max file size acceptable is 5mb",
|
|
1055
1069
|
"creatives.containersV2.Line.Create.maximumCharacterLengthExceeds": "Maximum characters length exceeds",
|
|
1056
1070
|
"creatives.containersV2.Line.Create.message": "Message",
|
|
@@ -1065,7 +1079,6 @@
|
|
|
1065
1079
|
"creatives.containersV2.Line.Create.somethingWentWrong": "Something went wrong!!",
|
|
1066
1080
|
"creatives.containersV2.Line.Create.template": "Template",
|
|
1067
1081
|
"creatives.containersV2.Line.Create.templateCantEmpty": "Template name cannot be empty",
|
|
1068
|
-
"creatives.containersV2.Line.Create.templateCreatedSuccessfully": "Line template created successfully",
|
|
1069
1082
|
"creatives.containersV2.Line.Create.templateEditedSuccessfully": "Line template edited successfully",
|
|
1070
1083
|
"creatives.containersV2.Line.Create.templateNameNotEmpty": "Please provide a template name",
|
|
1071
1084
|
"creatives.containersV2.Line.Create.templateNotConfigured": "template not configured,",
|
|
@@ -1078,6 +1091,14 @@
|
|
|
1078
1091
|
"creatives.containersV2.Line.Create.uploadSuccess": "Photo uploaded successfully",
|
|
1079
1092
|
"creatives.containersV2.Line.Create.uploadingImage": "Uploading image...",
|
|
1080
1093
|
"creatives.containersV2.Line.Create.valueCantEmpty": "value cannot be empty.",
|
|
1094
|
+
"creatives.containersV2.Line.CreateWrapper.continue": "Continue",
|
|
1095
|
+
"creatives.containersV2.Line.CreateWrapper.hybridTemplateDescription": "Used to create combined text & image or video content",
|
|
1096
|
+
"creatives.containersV2.Line.CreateWrapper.hybridTemplateTitle": "Hybrid",
|
|
1097
|
+
"creatives.containersV2.Line.CreateWrapper.imageTemplateDescription": "Used for creating image or video content",
|
|
1098
|
+
"creatives.containersV2.Line.CreateWrapper.imageTemplateTitle": "Image/video template",
|
|
1099
|
+
"creatives.containersV2.Line.CreateWrapper.templateType": "Select the type of content",
|
|
1100
|
+
"creatives.containersV2.Line.CreateWrapper.textTemplateDescription": "Used for announcing offers and transaction related information",
|
|
1101
|
+
"creatives.containersV2.Line.CreateWrapper.textTemplateTitle": "Text template",
|
|
1081
1102
|
"creatives.containersV2.Line.Edit.Campaigns": "Campaigns",
|
|
1082
1103
|
"creatives.containersV2.Line.Edit.Creatives": "Creatives",
|
|
1083
1104
|
"creatives.containersV2.Line.Edit.Image": "Image",
|
|
@@ -1363,6 +1384,7 @@
|
|
|
1363
1384
|
"creatives.containersV2.TemplatesV2.facebook": "Facebook",
|
|
1364
1385
|
"creatives.containersV2.TemplatesV2.gallery": "Gallery",
|
|
1365
1386
|
"creatives.containersV2.TemplatesV2.header": "This is TemplatesV2 container !",
|
|
1387
|
+
"creatives.containersV2.TemplatesV2.line": "Line",
|
|
1366
1388
|
"creatives.containersV2.TemplatesV2.pushNotification": "Push notification",
|
|
1367
1389
|
"creatives.containersV2.TemplatesV2.select": "Select",
|
|
1368
1390
|
"creatives.containersV2.TemplatesV2.sms": "SMS",
|
package/translations/zh.json
CHANGED
|
@@ -112,6 +112,8 @@
|
|
|
112
112
|
"creatives.componentsV2.FormBuilder.contentNotValidLanguage": "",
|
|
113
113
|
"creatives.componentsV2.FormBuilder.dragAndDrop": "",
|
|
114
114
|
"creatives.componentsV2.FormBuilder.header": "",
|
|
115
|
+
"creatives.componentsV2.FormBuilder.imageDimenstionDescription": "",
|
|
116
|
+
"creatives.componentsV2.FormBuilder.imageReUpload": "",
|
|
115
117
|
"creatives.componentsV2.FormBuilder.layoutSelection": "",
|
|
116
118
|
"creatives.componentsV2.FormBuilder.loadingEDMTemplates": "",
|
|
117
119
|
"creatives.componentsV2.FormBuilder.missingTags": "",
|
|
@@ -120,6 +122,8 @@
|
|
|
120
122
|
"creatives.componentsV2.FormBuilder.selectAFile": "",
|
|
121
123
|
"creatives.componentsV2.FormBuilder.unsupportedTags": "",
|
|
122
124
|
"creatives.componentsV2.FormBuilder.upload": "",
|
|
125
|
+
"creatives.componentsV2.FormBuilder.uploadComputer": "",
|
|
126
|
+
"creatives.componentsV2.FormBuilder.uploadGallery": "",
|
|
123
127
|
"creatives.componentsV2.FormBuilder.yes": "",
|
|
124
128
|
"creatives.componentsV2.Header.cancel": "",
|
|
125
129
|
"creatives.componentsV2.Header.header": "",
|
|
@@ -229,6 +233,7 @@
|
|
|
229
233
|
"creatives.containers.Create.graphic_details_page": "",
|
|
230
234
|
"creatives.containers.Create.header": "",
|
|
231
235
|
"creatives.containers.Create.http_example": "",
|
|
236
|
+
"creatives.containers.Create.imageGallery": "",
|
|
232
237
|
"creatives.containers.Create.markFinalVersionLabel": "",
|
|
233
238
|
"creatives.containers.Create.maxContentCount": "",
|
|
234
239
|
"creatives.containers.Create.messageLabel": "",
|
|
@@ -246,9 +251,17 @@
|
|
|
246
251
|
"creatives.containers.Create.sourceLinkEmpty": "",
|
|
247
252
|
"creatives.containers.Create.tagsErrorMessage": "",
|
|
248
253
|
"creatives.containers.Create.tagsLabel": "",
|
|
254
|
+
"creatives.containers.Create.templateAddTag": "",
|
|
249
255
|
"creatives.containers.Create.templateDataNotValid": "",
|
|
250
256
|
"creatives.containers.Create.templateMarkedFinal": "",
|
|
257
|
+
"creatives.containers.Create.templateMessageError": "",
|
|
258
|
+
"creatives.containers.Create.templateMessagePlaceholder": "",
|
|
259
|
+
"creatives.containers.Create.templateMessagePreviewPropsError": "",
|
|
260
|
+
"creatives.containers.Create.templateMessagePreviewPropsInductiveText": "",
|
|
261
|
+
"creatives.containers.Create.templateMessagePreviewPropsLabel": "",
|
|
262
|
+
"creatives.containers.Create.templateNameErrorPlaceholder": "",
|
|
251
263
|
"creatives.containers.Create.templateNamePlaceHolder": "",
|
|
264
|
+
"creatives.containers.Create.templatePlaceholder": "",
|
|
252
265
|
"creatives.containers.Create.titleCharacterCount": "",
|
|
253
266
|
"creatives.containers.Create.titleEmpty": "",
|
|
254
267
|
"creatives.containers.Create.titleNameRepeated": "",
|
|
@@ -1051,6 +1064,7 @@
|
|
|
1051
1064
|
"creatives.containersV2.Line.Create.image": "",
|
|
1052
1065
|
"creatives.containersV2.Line.Create.inputLineTemplateContent": "",
|
|
1053
1066
|
"creatives.containersV2.Line.Create.line": "",
|
|
1067
|
+
"creatives.containersV2.Line.Create.lineTemplateCreatedSuccessfully": "",
|
|
1054
1068
|
"creatives.containersV2.Line.Create.maxUploadFileSize": "",
|
|
1055
1069
|
"creatives.containersV2.Line.Create.maximumCharacterLengthExceeds": "",
|
|
1056
1070
|
"creatives.containersV2.Line.Create.message": "",
|
|
@@ -1065,7 +1079,6 @@
|
|
|
1065
1079
|
"creatives.containersV2.Line.Create.somethingWentWrong": "",
|
|
1066
1080
|
"creatives.containersV2.Line.Create.template": "",
|
|
1067
1081
|
"creatives.containersV2.Line.Create.templateCantEmpty": "",
|
|
1068
|
-
"creatives.containersV2.Line.Create.templateCreatedSuccessfully": "",
|
|
1069
1082
|
"creatives.containersV2.Line.Create.templateEditedSuccessfully": "",
|
|
1070
1083
|
"creatives.containersV2.Line.Create.templateNameNotEmpty": "",
|
|
1071
1084
|
"creatives.containersV2.Line.Create.templateNotConfigured": "",
|
|
@@ -1078,6 +1091,14 @@
|
|
|
1078
1091
|
"creatives.containersV2.Line.Create.uploadSuccess": "",
|
|
1079
1092
|
"creatives.containersV2.Line.Create.uploadingImage": "",
|
|
1080
1093
|
"creatives.containersV2.Line.Create.valueCantEmpty": "",
|
|
1094
|
+
"creatives.containersV2.Line.CreateWrapper.continue": "",
|
|
1095
|
+
"creatives.containersV2.Line.CreateWrapper.hybridTemplateDescription": "",
|
|
1096
|
+
"creatives.containersV2.Line.CreateWrapper.hybridTemplateTitle": "",
|
|
1097
|
+
"creatives.containersV2.Line.CreateWrapper.imageTemplateDescription": "",
|
|
1098
|
+
"creatives.containersV2.Line.CreateWrapper.imageTemplateTitle": "",
|
|
1099
|
+
"creatives.containersV2.Line.CreateWrapper.templateType": "",
|
|
1100
|
+
"creatives.containersV2.Line.CreateWrapper.textTemplateDescription": "",
|
|
1101
|
+
"creatives.containersV2.Line.CreateWrapper.textTemplateTitle": "",
|
|
1081
1102
|
"creatives.containersV2.Line.Edit.Campaigns": "",
|
|
1082
1103
|
"creatives.containersV2.Line.Edit.Creatives": "",
|
|
1083
1104
|
"creatives.containersV2.Line.Edit.Image": "",
|
|
@@ -1363,6 +1384,7 @@
|
|
|
1363
1384
|
"creatives.containersV2.TemplatesV2.facebook": "",
|
|
1364
1385
|
"creatives.containersV2.TemplatesV2.gallery": "",
|
|
1365
1386
|
"creatives.containersV2.TemplatesV2.header": "",
|
|
1387
|
+
"creatives.containersV2.TemplatesV2.line": "",
|
|
1366
1388
|
"creatives.containersV2.TemplatesV2.pushNotification": "",
|
|
1367
1389
|
"creatives.containersV2.TemplatesV2.select": "",
|
|
1368
1390
|
"creatives.containersV2.TemplatesV2.sms": "",
|
|
@@ -11,9 +11,10 @@ import PropTypes from 'prop-types';
|
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import _ from 'lodash';
|
|
13
13
|
import { Tabs, Table, Modal} from 'antd';
|
|
14
|
-
import { CapButton, CapInput, CapPopover, CapCheckbox, CapRadio, CapSelect, CapTable, CapRow, CapColumn, CapNotification, CapUploader, CapHeading, CapIcon} from '@capillarytech/cap-ui-library';
|
|
14
|
+
import { CapDrawer, CapButton, CapInput, CapPopover, CapCheckbox, CapRadio, CapSelect, CapTable, CapRow, CapColumn, CapNotification, CapUploader, CapHeading, CapIcon} from '@capillarytech/cap-ui-library';
|
|
15
15
|
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
16
16
|
import LabelHOC from '@capillarytech/cap-ui-library/assets/HOCs/ComponentWithLabelHOC';
|
|
17
|
+
import { CAP_SPACE_12, CAP_SPACE_08, FONT_COLOR_05, FONT_COLOR_04 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
17
18
|
import TemplatePreview from '../TemplatePreview';
|
|
18
19
|
import TagList from '../../v2Containers/TagList';
|
|
19
20
|
import SlideBox from '../SlideBox';
|
|
@@ -24,7 +25,7 @@ import CustomPopOver from '../CustomPopOver';
|
|
|
24
25
|
import messages from './messages';
|
|
25
26
|
import './_formBuilder.scss';
|
|
26
27
|
import {updateCharCount, checkUnicode} from "../../utils/smsCharCountV2";
|
|
27
|
-
import {SMS} from '../../v2Containers/CreativesContainer/constants';
|
|
28
|
+
import { SMS, LINE } from '../../v2Containers/CreativesContainer/constants';
|
|
28
29
|
const TabPane = Tabs.TabPane;
|
|
29
30
|
const {Column} = Table;
|
|
30
31
|
const {TextArea} = CapInput;
|
|
@@ -55,6 +56,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
55
56
|
currentEventData: {},
|
|
56
57
|
popoverVisible: false,
|
|
57
58
|
customPopoverVisible: false,
|
|
59
|
+
isDrawerVisible: false,
|
|
58
60
|
};
|
|
59
61
|
this.renderForm = this.renderForm.bind(this);
|
|
60
62
|
this.updateFormData = this.updateFormData.bind(this);
|
|
@@ -207,7 +209,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
207
209
|
if (nextProps.isNewVersionFlow && !this.state.formData[this.state.currentTab - 1][this.state.formData[this.state.currentTab - 1].activeTab].tabKey) {
|
|
208
210
|
this.resetTabKeys(nextProps.formData, nextProps.tabCount, false, true);
|
|
209
211
|
}
|
|
210
|
-
if (type === 'embedded' || this.props.schema.channel.toUpperCase() === 'EMAIL') {
|
|
212
|
+
if (type === 'embedded' || ( this.props.schema.channel && this.props.schema.channel.toUpperCase() === 'EMAIL')) {
|
|
211
213
|
this.validateForm();
|
|
212
214
|
}
|
|
213
215
|
if ((this.props.schema && this.props.schema.channel && this.props.schema.channel.toUpperCase() === 'MOBILEPUSH')) {
|
|
@@ -253,6 +255,11 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
253
255
|
if (nextProps.modal && (!_.isEqual(nextProps.modal, this.props.modal) || _.isEmpty(this.state.modal))) {
|
|
254
256
|
this.setState({modal: nextProps.modal});
|
|
255
257
|
}
|
|
258
|
+
if (nextProps.isDrawerRequired !== this.props.isDrawerRequired) {
|
|
259
|
+
this.setState({
|
|
260
|
+
isDrawerVisible: nextProps.isDrawerRequired,
|
|
261
|
+
});
|
|
262
|
+
}
|
|
256
263
|
}
|
|
257
264
|
|
|
258
265
|
onEdit() {
|
|
@@ -484,38 +491,74 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
484
491
|
}
|
|
485
492
|
|
|
486
493
|
//validation for LINE
|
|
487
|
-
if (
|
|
494
|
+
if (channel === LINE) {
|
|
488
495
|
|
|
489
|
-
if (this.state.formData['
|
|
490
|
-
const content = this.state.formData['0']['message-editor'];
|
|
496
|
+
if (this.state.formData['message-editor'] !== undefined ) {
|
|
497
|
+
const content = this.state.formData['0']['message-editor'] || '';
|
|
491
498
|
|
|
492
|
-
const tagValidationResponse = this.validateTags(content, tags, injectedTags);
|
|
499
|
+
const tagValidationResponse = this.validateTags((content), tags, injectedTags);
|
|
493
500
|
|
|
494
501
|
if (tagValidationResponse.valid) {
|
|
495
|
-
errorData
|
|
502
|
+
errorData = {
|
|
503
|
+
...errorData,
|
|
504
|
+
0: {
|
|
505
|
+
...errorData[0],
|
|
506
|
+
'message-editor': false,
|
|
507
|
+
}
|
|
508
|
+
};
|
|
496
509
|
} else {
|
|
497
|
-
|
|
498
|
-
|
|
510
|
+
errorData = {
|
|
511
|
+
...errorData,
|
|
512
|
+
0: {
|
|
513
|
+
...errorData[0],
|
|
514
|
+
'message-editor': true,
|
|
515
|
+
}
|
|
516
|
+
};
|
|
499
517
|
isValid = false;
|
|
500
518
|
}
|
|
501
519
|
if (content.trim() === '') {
|
|
502
|
-
|
|
503
|
-
|
|
520
|
+
errorData = {
|
|
521
|
+
...errorData,
|
|
522
|
+
0: {
|
|
523
|
+
...errorData[0],
|
|
524
|
+
'message-editor': true,
|
|
525
|
+
}
|
|
526
|
+
};
|
|
504
527
|
isValid = false;
|
|
505
528
|
}
|
|
506
529
|
}
|
|
507
530
|
|
|
508
|
-
if (
|
|
509
|
-
const
|
|
510
|
-
|
|
531
|
+
if (this.state.formData['image-upload-line'] !== undefined) {
|
|
532
|
+
const {
|
|
533
|
+
formData: {
|
|
534
|
+
0: {
|
|
535
|
+
image,
|
|
536
|
+
imagePreview,
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
} = this.state;
|
|
540
|
+
const imgContentLength = image ? image.length : 0;
|
|
541
|
+
const imgContentLengthPreview = imagePreview ? imagePreview.length : 0;
|
|
511
542
|
if ( (imgContentLength < 1) && (imgContentLengthPreview < 1) ) {
|
|
512
543
|
|
|
513
|
-
errorData
|
|
514
|
-
|
|
544
|
+
errorData = {
|
|
545
|
+
...errorData,
|
|
546
|
+
0: {
|
|
547
|
+
...errorData[0],
|
|
548
|
+
image: true,
|
|
549
|
+
imagePreview: true,
|
|
550
|
+
}
|
|
551
|
+
};
|
|
515
552
|
isValid = false;
|
|
516
553
|
}else{
|
|
517
|
-
errorData
|
|
518
|
-
|
|
554
|
+
errorData = {
|
|
555
|
+
...errorData,
|
|
556
|
+
0: {
|
|
557
|
+
...errorData[0],
|
|
558
|
+
image: false,
|
|
559
|
+
imagePreview: false,
|
|
560
|
+
}
|
|
561
|
+
};
|
|
519
562
|
}
|
|
520
563
|
}
|
|
521
564
|
if(type !== 'embedded' && (!this.state.formData['template-name'] || this.state.formData['template-name'] === '')) {
|
|
@@ -1149,7 +1192,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1149
1192
|
// this.formElements.push(col.id);
|
|
1150
1193
|
// }
|
|
1151
1194
|
if (!col.onlyDisplay && !ifError) {
|
|
1152
|
-
if (col.id.indexOf('tagList-') === -1) {
|
|
1195
|
+
if (col.id && col.id.indexOf('tagList-') === -1) {
|
|
1153
1196
|
this.formElements.push(col.id);
|
|
1154
1197
|
}
|
|
1155
1198
|
|
|
@@ -1349,7 +1392,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1349
1392
|
delete tempFormData[key];
|
|
1350
1393
|
} else if (typeof element === "object") {
|
|
1351
1394
|
_.forEach(element, (innerElement, innerKey) => {
|
|
1352
|
-
if (innerKey !== "tabKey" && innerKey !== "base" && innerKey !== 'name' && innerKey !== 'imagePreview' && this.formElements.indexOf(innerKey) === -1) {
|
|
1395
|
+
if (innerKey !== "tabKey" && innerKey !== "base" && innerKey !== 'name' && innerKey !== 'imagePreview' && innerKey !== 'image' && this.formElements.indexOf(innerKey) === -1) {
|
|
1353
1396
|
delete tempFormData[key][innerKey];
|
|
1354
1397
|
}
|
|
1355
1398
|
});
|
|
@@ -1921,7 +1964,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1921
1964
|
return;
|
|
1922
1965
|
} else if (event === 'markFinalVersion' || event === 'duplicateVersion' || event === 'deleteVersion' || event === 'renameVersion') {
|
|
1923
1966
|
this.setState({ popoverVisible: false });
|
|
1924
|
-
if ((event !== 'deleteVersion' && !this.props.isNewVersionFlow) || ((event === 'deleteVersion') && this.props.schema.channel.toUpperCase() === 'EMAIL')) {
|
|
1967
|
+
if ((event !== 'deleteVersion' && !this.props.isNewVersionFlow) || ((event === 'deleteVersion') && this.props.schema.channel && this.props.schema.channel.toUpperCase() === 'EMAIL')) {
|
|
1925
1968
|
val.injectedEvents[event].call(this.props.parent, data, this.state.currentTab);
|
|
1926
1969
|
} else {
|
|
1927
1970
|
this.setState({currentEvent: val.injectedEvents[event], currentEventData: data});
|
|
@@ -2100,8 +2143,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2100
2143
|
img.src = _URL.createObjectURL(file);
|
|
2101
2144
|
img.onload = () => {
|
|
2102
2145
|
const fileParams = {
|
|
2103
|
-
width: this.width,
|
|
2104
|
-
height: this.height,
|
|
2146
|
+
width: this.width || img.width,
|
|
2147
|
+
height: this.height || img.height,
|
|
2105
2148
|
error: file.size / (1e+6) > 3,
|
|
2106
2149
|
};
|
|
2107
2150
|
this.callChildEvent({file, type: 'image', fileParams}, val, val.submitAction);
|
|
@@ -2532,6 +2575,80 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2532
2575
|
}
|
|
2533
2576
|
}
|
|
2534
2577
|
|
|
2578
|
+
onGalleryClick = (event) => {
|
|
2579
|
+
event.stopPropagation();
|
|
2580
|
+
this.props.setDrawerVisibility(true);
|
|
2581
|
+
}
|
|
2582
|
+
|
|
2583
|
+
onReUpload = () => {
|
|
2584
|
+
const { formData } = this.state;
|
|
2585
|
+
this.props.onChange({
|
|
2586
|
+
...formData,
|
|
2587
|
+
0: {
|
|
2588
|
+
...formData[0],
|
|
2589
|
+
image: undefined,
|
|
2590
|
+
imagePreview: undefined,
|
|
2591
|
+
},
|
|
2592
|
+
base: {
|
|
2593
|
+
...formData.base,
|
|
2594
|
+
image: undefined,
|
|
2595
|
+
imagePreview: undefined,
|
|
2596
|
+
},
|
|
2597
|
+
});
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2600
|
+
getUploadVariants = (isImage, val) => {
|
|
2601
|
+
if (this.props.schema && this.props.schema.channel === 'LINE') {
|
|
2602
|
+
if (!isImage) {
|
|
2603
|
+
return (
|
|
2604
|
+
<>
|
|
2605
|
+
<CapUploader.CapDragger
|
|
2606
|
+
customRequest={(data) => this.capUploaderCustomRequest(data, val)}
|
|
2607
|
+
{...val.componentProps}
|
|
2608
|
+
className="form-builder-dragger"
|
|
2609
|
+
>
|
|
2610
|
+
<CapHeading className="dragger-title" type="h7">
|
|
2611
|
+
<FormattedMessage {...messages.dragAndDrop} />
|
|
2612
|
+
</CapHeading>
|
|
2613
|
+
<CapHeading className="dragger-or" type="label6">
|
|
2614
|
+
<FormattedMessage {...messages.or} />
|
|
2615
|
+
</CapHeading>
|
|
2616
|
+
<CapButton className="dragger-button" type="secondary" style={{marginRight: CAP_SPACE_08}}>
|
|
2617
|
+
<FormattedMessage {...messages.uploadComputer} />
|
|
2618
|
+
</CapButton>
|
|
2619
|
+
<CapButton
|
|
2620
|
+
className="dragger-button"
|
|
2621
|
+
type="secondary"
|
|
2622
|
+
style={{marginLeft: CAP_SPACE_08}}
|
|
2623
|
+
onClick={this.onGalleryClick}
|
|
2624
|
+
>
|
|
2625
|
+
<FormattedMessage {...messages.uploadGallery} />
|
|
2626
|
+
</CapButton>
|
|
2627
|
+
</CapUploader.CapDragger>
|
|
2628
|
+
<CapHeading type="h6" style={{marginTop: CAP_SPACE_12 }}>
|
|
2629
|
+
<FormattedMessage {...messages.imageDimenstionDescription} />
|
|
2630
|
+
</CapHeading>
|
|
2631
|
+
</>
|
|
2632
|
+
);
|
|
2633
|
+
}
|
|
2634
|
+
return (
|
|
2635
|
+
<CapButton
|
|
2636
|
+
className="dragger-button"
|
|
2637
|
+
type="flat"
|
|
2638
|
+
style={{top: 0, position: 'absolute', right: 0, color: FONT_COLOR_05 }}
|
|
2639
|
+
onClick={this.onReUpload}
|
|
2640
|
+
>
|
|
2641
|
+
<FormattedMessage {...messages.imageReUpload} />
|
|
2642
|
+
</CapButton>
|
|
2643
|
+
);
|
|
2644
|
+
}
|
|
2645
|
+
return (
|
|
2646
|
+
<CapButton disabled={val.disabled ? val.disabled : false} type="flat" prefix={<CapIcon size="s" type="add-photo" />} onClick={(e) => this.openFileDialog(e, val.id)} style={{float: 'right', color: `${val.disabled ? FONT_COLOR_04 : FONT_COLOR_05}`}}>
|
|
2647
|
+
{val.label}
|
|
2648
|
+
</CapButton>
|
|
2649
|
+
);
|
|
2650
|
+
}
|
|
2651
|
+
|
|
2535
2652
|
renderMultiColSection(section, childIndex) {
|
|
2536
2653
|
const fields = [];
|
|
2537
2654
|
let contentSections = [];
|
|
@@ -2578,7 +2695,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2578
2695
|
);
|
|
2579
2696
|
return true;
|
|
2580
2697
|
}
|
|
2581
|
-
|
|
2582
2698
|
switch (type) {
|
|
2583
2699
|
case "input":
|
|
2584
2700
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
@@ -2717,11 +2833,12 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2717
2833
|
);
|
|
2718
2834
|
break;
|
|
2719
2835
|
case 'upload':
|
|
2836
|
+
const isImage = self.state && !!self.state.formData[`${self.state.currentTab - 1}`].image;
|
|
2720
2837
|
ifError = (this.state.checkValidation || this.props.startValidation) && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2721
2838
|
const ImageComponent = (props) => (
|
|
2722
2839
|
<div key={`${val.id}-${this.state.currentTab}`}>
|
|
2723
2840
|
<div className={`image-container ${props.ifError ? 'error' : ''}`}>
|
|
2724
|
-
{
|
|
2841
|
+
{isImage ?
|
|
2725
2842
|
<img src={self.state.formData[`${self.state.currentTab - 1}`].image} alt={props.alt} style={props.style}/>
|
|
2726
2843
|
:
|
|
2727
2844
|
<div style={{width: "100%", textAlign: "center"}}><span className="image-placeholder">{props.placeholder}</span></div>
|
|
@@ -2736,9 +2853,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2736
2853
|
{val.showPreview && <WithLabel key={`${val.id}-with-label`} {...rest} errorMessage={ifError && errorMessage} ifError={ifError}/>}
|
|
2737
2854
|
<form encType="multipart/form-data" id={val.id}>
|
|
2738
2855
|
<input key={val.id} style={{ display: 'none'}} id="fileName" type="file" onChange={(e) => this.uploadImages(e, {files: e.target.files}, val)} accept={val.supportedExtensions ? val.supportedExtensions : "image/*"} />
|
|
2739
|
-
|
|
2740
|
-
{val.label}
|
|
2741
|
-
</CapButton>
|
|
2856
|
+
{this.getUploadVariants(isImage, val)}
|
|
2742
2857
|
</form>
|
|
2743
2858
|
</CapColumn>
|
|
2744
2859
|
);
|
|
@@ -2783,11 +2898,16 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2783
2898
|
);
|
|
2784
2899
|
break;
|
|
2785
2900
|
case "tag-list":
|
|
2901
|
+
let moduleFilterEnabled = this.props.location && this.props.location.query && this.props.location.query.type !== 'embedded';
|
|
2902
|
+
const channel = _.get(this.props, 'schema.channel', "");
|
|
2903
|
+
if (channel === 'EMAIL') {
|
|
2904
|
+
moduleFilterEnabled = this.props.isFullMode;
|
|
2905
|
+
}
|
|
2786
2906
|
columns.push(
|
|
2787
2907
|
<CapColumn key={`input-${val.id}`} offset={val.offset} span={val.width ? val.width : ''} style={val.style ? val.style : {marginBottom: '16px'}}>
|
|
2788
2908
|
<TagList
|
|
2789
2909
|
key={`input-${val.id}`}
|
|
2790
|
-
moduleFilterEnabled={
|
|
2910
|
+
moduleFilterEnabled={moduleFilterEnabled}
|
|
2791
2911
|
label={val.label ? val.label : ''}
|
|
2792
2912
|
onTagSelect={(data) => this.callChildEvent(data, val, 'onTagSelect')}
|
|
2793
2913
|
onContextChange={this.props.onContextChange}
|
|
@@ -2810,7 +2930,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2810
2930
|
type={val.buttonType}
|
|
2811
2931
|
icon={val.icon}
|
|
2812
2932
|
disabled={val.disabled ? val.disabled : false}
|
|
2813
|
-
onClick={(data) => this.callChildEvent(data, val, val.submitAction)}>
|
|
2933
|
+
onClick={(data) => val.id === 'save-button' ? this.saveForm() : this.callChildEvent(data, val, val.submitAction)}>
|
|
2814
2934
|
{val.value}
|
|
2815
2935
|
</CapButton>
|
|
2816
2936
|
</CapColumn>
|
|
@@ -3296,6 +3416,16 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3296
3416
|
loadingText={this.props.intl.formatMessage(messages.loadingEDMTemplates)}
|
|
3297
3417
|
isLoading={this.props.getCmsTemplatesInProgress}
|
|
3298
3418
|
/>
|
|
3419
|
+
{
|
|
3420
|
+
this.props.capDrawerContent && (
|
|
3421
|
+
<CapDrawer
|
|
3422
|
+
content={this.props.capDrawerContent}
|
|
3423
|
+
visible={this.state.isDrawerVisible}
|
|
3424
|
+
width={380}
|
|
3425
|
+
onClose={() => this.props.setDrawerVisibility(false)}
|
|
3426
|
+
/>
|
|
3427
|
+
)
|
|
3428
|
+
}
|
|
3299
3429
|
</CapRow>
|
|
3300
3430
|
);
|
|
3301
3431
|
}
|
|
@@ -3346,6 +3476,9 @@ FormBuilder.propTypes = {
|
|
|
3346
3476
|
handleDelete: PropTypes.func,
|
|
3347
3477
|
intl: intlShape.isRequired,
|
|
3348
3478
|
selectedOfferDetails: PropTypes.array,
|
|
3479
|
+
setDrawerVisibility: PropTypes.bool,
|
|
3480
|
+
capDrawerContent: PropTypes.array,
|
|
3481
|
+
isFullMode: PropTypes.bool,
|
|
3349
3482
|
};
|
|
3350
3483
|
|
|
3351
3484
|
export default injectIntl(FormBuilder);
|
|
@@ -58,4 +58,20 @@ export default defineMessages({
|
|
|
58
58
|
id: 'creatives.componentsV2.FormBuilder.loadingEDMTemplates',
|
|
59
59
|
defaultMessage: 'Loading EDM Templates',
|
|
60
60
|
},
|
|
61
|
+
uploadComputer: {
|
|
62
|
+
id: 'creatives.componentsV2.FormBuilder.uploadComputer',
|
|
63
|
+
defaultMessage: 'Your computer',
|
|
64
|
+
},
|
|
65
|
+
uploadGallery: {
|
|
66
|
+
id: 'creatives.componentsV2.FormBuilder.uploadGallery',
|
|
67
|
+
defaultMessage: 'Gallery',
|
|
68
|
+
},
|
|
69
|
+
imageDimenstionDescription: {
|
|
70
|
+
id: 'creatives.componentsV2.FormBuilder.imageDimenstionDescription',
|
|
71
|
+
defaultMessage: 'Dimensions: 300px x 400px Size: 30mb',
|
|
72
|
+
},
|
|
73
|
+
imageReUpload: {
|
|
74
|
+
id: 'creatives.componentsV2.FormBuilder.imageReUpload',
|
|
75
|
+
defaultMessage: 'Re upload',
|
|
76
|
+
},
|
|
61
77
|
});
|
|
@@ -157,12 +157,21 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
157
157
|
{
|
|
158
158
|
channel && channel.toLowerCase() === 'line' ? (
|
|
159
159
|
<div className="shell align-center" id="sms-preview">
|
|
160
|
-
<img className="preview-image" src={wechatBody} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
|
|
160
|
+
<img className="preview-image sms" src={wechatBody} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
|
|
161
161
|
<div className="msgContainer">
|
|
162
|
-
<div className="sms-icon" style={{ width: '
|
|
162
|
+
<div className="sms-icon" style={{ left: 10, borderRadius: '50%', width: '20px', height: '20px', background: '#2E89DF' }}></div>
|
|
163
163
|
<div className="message-pop align-left" style={{ background: '#ffffff', color: '#333333' }}>
|
|
164
|
-
{
|
|
165
|
-
|
|
164
|
+
{
|
|
165
|
+
content && Object.keys(content).map((item) => {
|
|
166
|
+
if (item === 'bodyText' && content[item]) {
|
|
167
|
+
return content[item];
|
|
168
|
+
}
|
|
169
|
+
if (item === 'bodyImage' && content[item]) {
|
|
170
|
+
return <img src={content[item]} alt="brand-name" style={{maxWidth: '100%'}}/>;
|
|
171
|
+
}
|
|
172
|
+
return null;
|
|
173
|
+
})
|
|
174
|
+
}
|
|
166
175
|
</div>
|
|
167
176
|
</div>
|
|
168
177
|
{ (content && content.bodyText) ? <p style={{fontSize: 16, fontWeight: "bold"}}>Chars Count: {content.bodyText.length} / (1600)</p> : '' }
|