@capillarytech/creatives-library 6.8.8 → 6.9.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/components/CapTagList/index.js +1 -1
- package/components/Edmeditor/index.js +1 -1
- package/components/FormBuilder/index.js +0 -1
- package/components/TemplatePreview/_templatePreview.scss +0 -6
- package/components/TemplatePreview/index.js +28 -35
- package/config/app.js +1 -1
- package/containers/TagList/index.js +3 -3
- package/index.html +5 -0
- package/package.json +2 -1
- package/services/api.js +16 -1
- package/v2Components/BeeEditor/index.js +272 -0
- package/v2Components/BeeEditor/messages.js +47 -0
- package/v2Components/BeeEditor/tests/index.test.js +10 -0
- package/v2Components/CapTagList/index.js +55 -26
- package/v2Components/CmsTemplatesComponent/index.js +4 -4
- package/v2Components/Edmeditor/index.js +1 -1
- package/v2Components/FormBuilder/index.js +117 -43
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +151 -151
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +33 -33
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/tests/index.test.js +10 -10
- package/v2Components/TemplatePreview/_templatePreview.scss +0 -1
- package/v2Components/TemplatePreview/assets/images/androidPushMessage.svg +44 -44
- package/v2Components/TemplatePreview/assets/images/home-screen-android.svg +21 -21
- package/v2Components/TemplatePreview/assets/images/home-screen-ios.svg +16 -16
- package/v2Components/TemplatePreview/assets/images/iPhonePushMessage.svg +134 -134
- package/v2Components/TemplatePreview/assets/images/mobile.svg +23 -23
- package/v2Components/TemplatePreview/assets/images/sms_mobile_android.svg +22 -22
- package/v2Components/TemplatePreview/assets/images/user-icon.svg +18 -18
- package/v2Components/TemplatePreview/assets/images/wechat-home-screen-android.svg +21 -21
- package/v2Components/TemplatePreview/assets/images/wechat-mobile.svg +77 -77
- package/v2Components/TemplatePreview/assets/images/wechat_mobile_android.svg +20 -20
- package/v2Components/TemplatePreview/index.js +29 -36
- package/v2Components/TemplatePreview/tests/index.test.js +10 -10
- package/v2Containers/CreativesContainer/SlideBoxContent.js +1 -7
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +51 -51
- package/v2Containers/CreativesContainer/actions.js +27 -27
- package/v2Containers/CreativesContainer/constants.js +17 -17
- package/v2Containers/CreativesContainer/index.js +7 -2
- package/v2Containers/CreativesContainer/index.scss +44 -44
- package/v2Containers/CreativesContainer/messages.js +305 -305
- package/v2Containers/CreativesContainer/reducer.js +29 -29
- package/v2Containers/CreativesContainer/sagas.js +11 -11
- package/v2Containers/CreativesContainer/selectors.js +30 -30
- package/v2Containers/CreativesContainer/tests/actions.test.js +18 -18
- package/v2Containers/CreativesContainer/tests/index.test.js +10 -10
- package/v2Containers/CreativesContainer/tests/reducer.test.js +9 -9
- package/v2Containers/CreativesContainer/tests/sagas.test.js +15 -15
- package/v2Containers/CreativesContainer/tests/selectors.test.js +10 -10
- package/v2Containers/Email/constants.js +1 -0
- package/v2Containers/Email/index.js +209 -107
- package/v2Containers/Email/initialSchema.js +17 -2
- package/v2Containers/Email/sagas.js +2 -2
- package/v2Containers/Email/selectors.js +5 -0
- package/v2Containers/EmailWrapper/index.js +18 -3
- package/v2Containers/Line/Container/Image/index.js +19 -21
- package/v2Containers/Line/Container/ImageMap/constants.js +1 -2
- package/v2Containers/Line/Container/ImageMap/index.js +6 -31
- package/v2Containers/Line/Container/ImageMap/messages.js +0 -12
- package/v2Containers/Line/Container/Wrapper/index.js +1 -5
- package/v2Containers/Line/Container/Wrapper/messages.js +0 -4
- package/v2Containers/Line/Container/Wrapper/utils.js +16 -15
- package/v2Containers/Line/Container/_lineCreate.scss +2 -2
- package/v2Containers/Line/Container/actions.js +2 -4
- package/v2Containers/Line/Container/constants.js +0 -3
- package/v2Containers/Line/Container/index.js +11 -49
- package/v2Containers/Line/Container/reducer.js +2 -2
- package/v2Containers/Line/Container/sagas.js +2 -2
- package/v2Containers/Line/Container/style.js +1 -2
- package/v2Containers/TagList/index.js +6 -0
- package/v2Containers/Templates/_templates.scss +0 -9
- package/v2Containers/Templates/actions.js +122 -117
- package/v2Containers/Templates/constants.js +49 -47
- package/v2Containers/Templates/index.js +4 -35
- package/v2Containers/Templates/messages.js +0 -4
- package/v2Containers/Templates/reducer.js +153 -145
- package/v2Containers/Templates/sagas.js +179 -179
- package/v2Containers/Templates/selectors.js +19 -1
- package/v2Containers/Templates/tests/actions.test.js +18 -18
- package/v2Containers/Templates/tests/index.test.js +10 -10
- package/v2Containers/Templates/tests/reducer.test.js +9 -9
- package/v2Containers/Templates/tests/sagas.test.js +15 -15
- package/v2Containers/Templates/tests/selectors.test.js +10 -10
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +29 -29
- package/v2Containers/TemplatesV2/actions.js +16 -16
- package/v2Containers/TemplatesV2/constants.js +10 -10
- package/v2Containers/TemplatesV2/messages.js +61 -61
- package/v2Containers/TemplatesV2/selectors.js +25 -25
- package/v2Containers/TemplatesV2/tests/actions.test.js +18 -18
- package/v2Containers/TemplatesV2/tests/index.test.js +10 -10
- package/v2Containers/TemplatesV2/tests/reducer.test.js +9 -9
- package/v2Containers/TemplatesV2/tests/sagas.test.js +15 -15
- package/v2Containers/TemplatesV2/tests/selectors.test.js +10 -10
- package/v2Components/Carousel/index.js +0 -120
- package/v2Components/Carousel/style.scss +0 -40
- package/v2Containers/Line/Container/ImageCarousel/Content.js +0 -554
- package/v2Containers/Line/Container/ImageCarousel/constants.js +0 -10
- package/v2Containers/Line/Container/ImageCarousel/index.js +0 -526
- package/v2Containers/Line/Container/ImageCarousel/messages.js +0 -178
- package/v2Containers/Line/Container/ImageCarousel/style.js +0 -61
|
@@ -199,9 +199,24 @@ export const response = {
|
|
|
199
199
|
"getEditorInstanse",
|
|
200
200
|
],
|
|
201
201
|
},
|
|
202
|
+
// will remove once bee gets tested end to end
|
|
203
|
+
// {
|
|
204
|
+
// id: "edmeditor",
|
|
205
|
+
// type: "edmeditor",
|
|
206
|
+
// metaType: "text",
|
|
207
|
+
// datatype: "string",
|
|
208
|
+
// required: true,
|
|
209
|
+
// onlyDisplay: true,
|
|
210
|
+
// standalone: false,
|
|
211
|
+
// width: 24,
|
|
212
|
+
// order: 2,
|
|
213
|
+
// customComponent: true,
|
|
214
|
+
// colStyle: { display: "none" },
|
|
215
|
+
// supportedEvents: [],
|
|
216
|
+
// },
|
|
202
217
|
{
|
|
203
|
-
id: "
|
|
204
|
-
type: "
|
|
218
|
+
id: "BEEeditor",
|
|
219
|
+
type: "BEEeditor",
|
|
205
220
|
metaType: "text",
|
|
206
221
|
datatype: "string",
|
|
207
222
|
required: true,
|
|
@@ -53,7 +53,7 @@ export function* getAllAssets(assetType, queryParams) {
|
|
|
53
53
|
|
|
54
54
|
export function* getCmsSetting({cmsType, projectId, cmsMode, langId, isEdmSupport}) {
|
|
55
55
|
try {
|
|
56
|
-
const result = yield call(Api.
|
|
56
|
+
const result = yield call(Api.getCmsTemplateSettingsV2, cmsType, projectId, cmsMode, langId, isEdmSupport);
|
|
57
57
|
|
|
58
58
|
yield put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: result.data.response.cmsDetails });
|
|
59
59
|
} catch (error) {
|
|
@@ -63,7 +63,7 @@ export function* getCmsSetting({cmsType, projectId, cmsMode, langId, isEdmSuppor
|
|
|
63
63
|
|
|
64
64
|
export function* getCmsData({cmsType, projectId, langId}) {
|
|
65
65
|
try {
|
|
66
|
-
const result = yield call(Api.
|
|
66
|
+
const result = yield call(Api.getCmsTemplateDataV2, cmsType, projectId, langId);
|
|
67
67
|
|
|
68
68
|
yield put({ type: types.GET_CMS_EDITOR_DATA_SUCCESS, data: result.data.response.data, langId: result.data.response.langId });
|
|
69
69
|
} catch (error) {
|
|
@@ -26,9 +26,14 @@ const selectLoadingStatus = () => createSelector(
|
|
|
26
26
|
selectEmailDomain(), (email) => email.createTemplateInProgress || (email.assetUploading !== undefined && email.assetUploading)
|
|
27
27
|
);
|
|
28
28
|
|
|
29
|
+
const makeSelectFetchingCmsData = () => createSelector(
|
|
30
|
+
selectEmailDomain(), (state) => state.get('fetchingCmsData')
|
|
31
|
+
);
|
|
32
|
+
|
|
29
33
|
export default makeSelectEmail;
|
|
30
34
|
export {
|
|
31
35
|
makeSelectEmail,
|
|
32
36
|
makeSelectCreateResponse,
|
|
33
37
|
selectLoadingStatus,
|
|
38
|
+
makeSelectFetchingCmsData,
|
|
34
39
|
};
|
|
@@ -15,7 +15,13 @@ import styled from 'styled-components';
|
|
|
15
15
|
import { CapRadioCard, CapNotification, CapInput, CapUploader, CapSpin, CapButton } from '@capillarytech/cap-ui-library';
|
|
16
16
|
import ComponentWithLabelHOC from '@capillarytech/cap-ui-library/assets/HOCs/ComponentWithLabelHOC';
|
|
17
17
|
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
selectEmailLayout,
|
|
20
|
+
selectCmsTemplates,
|
|
21
|
+
selectEdmEditor,
|
|
22
|
+
uploadSelector,
|
|
23
|
+
selectCmsTemplatesLoader,
|
|
24
|
+
} from '../Templates/selectors';
|
|
19
25
|
import * as templatesActionsCreators from '../Templates/actions';
|
|
20
26
|
import Email from '../Email';
|
|
21
27
|
import CmsTemplatesComponent from '../../v2Components/CmsTemplatesComponent';
|
|
@@ -76,7 +82,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
76
82
|
//document.getElementById('upload-email-template').click();
|
|
77
83
|
} else if (step === "templateSelection" && !this.state.selectedCreateMode) {
|
|
78
84
|
if (emailCreateMode === "editor" && !CmsTemplates) {
|
|
79
|
-
templatesActions.
|
|
85
|
+
templatesActions.getDefaultBeeTemplates();
|
|
80
86
|
}
|
|
81
87
|
} else if (step === "createTemplateContent" && !this.state.selectedCreateMode) {
|
|
82
88
|
if (emailCreateMode === 'upload' && !_.isEmpty(EmailLayout)) {
|
|
@@ -156,6 +162,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
156
162
|
const data = _.find(CmsTemplates, { _id: id });
|
|
157
163
|
|
|
158
164
|
templatesActions.setEdmTemplate(data);
|
|
165
|
+
templatesActions.setBEETemplate(data);
|
|
159
166
|
this.setState({
|
|
160
167
|
selectedCreateMode: 'editor',
|
|
161
168
|
});
|
|
@@ -188,6 +195,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
188
195
|
selectedOfferDetails,
|
|
189
196
|
onPreviewContentClicked,
|
|
190
197
|
onTestContentClicked,
|
|
198
|
+
cmsTemplatesLoader,
|
|
191
199
|
} = this.props;
|
|
192
200
|
const {
|
|
193
201
|
templateName,
|
|
@@ -251,7 +259,13 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
251
259
|
onPreviewContentClicked={onPreviewContentClicked}
|
|
252
260
|
onTestContentClicked={onTestContentClicked}
|
|
253
261
|
/>}
|
|
254
|
-
{
|
|
262
|
+
{!isShowEmailCreate && (
|
|
263
|
+
<CmsTemplatesComponent
|
|
264
|
+
cmsTemplates={CmsTemplates}
|
|
265
|
+
handleEdmDefaultTemplateSelection={this.useEditor}
|
|
266
|
+
cmsTemplatesLoader={cmsTemplatesLoader}
|
|
267
|
+
/>
|
|
268
|
+
)}
|
|
255
269
|
</div>
|
|
256
270
|
}
|
|
257
271
|
</CapSpin>
|
|
@@ -289,6 +303,7 @@ const mapStateToProps = createStructuredSelector({
|
|
|
289
303
|
CmsTemplates: selectCmsTemplates(),
|
|
290
304
|
SelectedEdmDefaultTemplate: selectEdmEditor(),
|
|
291
305
|
isUploading: uploadSelector(),
|
|
306
|
+
cmsTemplatesLoader: selectCmsTemplatesLoader(),
|
|
292
307
|
});
|
|
293
308
|
|
|
294
309
|
function mapDispatchToProps(dispatch) {
|
|
@@ -72,7 +72,7 @@ export const LineImage = ({
|
|
|
72
72
|
useEffect(() => {
|
|
73
73
|
if (imageSrc && (isFullMode ? messageTitle: true) && imagePreview) {
|
|
74
74
|
updateMessageState({
|
|
75
|
-
isError: !imageSrc || !(isFullMode ? messageTitle : true) || isImageError
|
|
75
|
+
isError: !imageSrc || !(isFullMode ? messageTitle : true) || (isImageError && errorMessageTitle),
|
|
76
76
|
originalContentUrl: imageSrc,
|
|
77
77
|
previewImageUrl: imagePreview,
|
|
78
78
|
messageTitle,
|
|
@@ -87,16 +87,14 @@ export const LineImage = ({
|
|
|
87
87
|
if (Line.uploadedAssetData && Object.keys(Line.uploadedAssetData).length) {
|
|
88
88
|
const imgSrc = get(Line, 'uploadedAssetData.metaInfo.secure_file_path', '');
|
|
89
89
|
const imgPreview = get(Line, 'uploadedAssetData.metaInfo.secure_file_path_preview', '');
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
actions.clearAsset();
|
|
99
|
-
}
|
|
90
|
+
updateUploadedAssetList({
|
|
91
|
+
...uploadedAssetList,
|
|
92
|
+
[index]: {
|
|
93
|
+
imgPreview,
|
|
94
|
+
imgSrc,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
actions.clearAsset();
|
|
100
98
|
}
|
|
101
99
|
}, [Line.uploadedAssetData]);
|
|
102
100
|
|
|
@@ -150,16 +148,16 @@ export const LineImage = ({
|
|
|
150
148
|
let errorMessage = false;
|
|
151
149
|
if (value === '') {
|
|
152
150
|
errorMessage = formatMessage(messages.emptyTitleErrorMessage);
|
|
151
|
+
updateMessageState({
|
|
152
|
+
isError: true,
|
|
153
|
+
originalContentUrl: imageSrc,
|
|
154
|
+
previewImageUrl: imagePreview,
|
|
155
|
+
messageTitle: '',
|
|
156
|
+
index,
|
|
157
|
+
type: 'image',
|
|
158
|
+
messageType: 'originalContentUrl',
|
|
159
|
+
});
|
|
153
160
|
}
|
|
154
|
-
updateMessageState({
|
|
155
|
-
isError: !imageSrc || !(isFullMode ? value : true) || isImageError || !value,
|
|
156
|
-
originalContentUrl: imageSrc,
|
|
157
|
-
previewImageUrl: imagePreview,
|
|
158
|
-
messageTitle: value,
|
|
159
|
-
index,
|
|
160
|
-
type: 'image',
|
|
161
|
-
messageType: 'originalContentUrl',
|
|
162
|
-
});
|
|
163
161
|
updateErrorMessageTitle(errorMessage);
|
|
164
162
|
}
|
|
165
163
|
|
|
@@ -409,7 +407,7 @@ export const LineImage = ({
|
|
|
409
407
|
updateImageSrc(image);
|
|
410
408
|
updateImagePreview(imagePreview);
|
|
411
409
|
updateMessageState({
|
|
412
|
-
isError: !image || !(isFullMode ? messageTitle : true) || isImageError
|
|
410
|
+
isError: !image || !(isFullMode ? messageTitle : true) || (isImageError && errorMessageTitle),
|
|
413
411
|
originalContentUrl: image,
|
|
414
412
|
previewImageUrl: imagePreview,
|
|
415
413
|
messageTitle,
|
|
@@ -26,7 +26,7 @@ import messages from './messages';
|
|
|
26
26
|
import {
|
|
27
27
|
LINE_ASSET_WIDTH,
|
|
28
28
|
LINE_ASSET_HEIGHT,
|
|
29
|
-
|
|
29
|
+
LINE_IMG_SIZE,
|
|
30
30
|
CUSTOM_ASSET_TYPE,
|
|
31
31
|
DEFAULT_ASSET_TYPE,
|
|
32
32
|
DEFAULT_TEMPLATES,
|
|
@@ -80,8 +80,6 @@ export const LineImageMap = ({
|
|
|
80
80
|
const [isImageError, updateImageErrorMessage] = useState(false);
|
|
81
81
|
const [templateSchema, updateTemplateSchema] = useState([]);
|
|
82
82
|
const [isTemplateDrawerRequired, updateTemplateDrawerRequirement] = useState(false);
|
|
83
|
-
const [altText, updateTitle] = useState('');
|
|
84
|
-
const [errorTitle, updateErrorTitle] = useState(false);
|
|
85
83
|
|
|
86
84
|
useEffect(() => {
|
|
87
85
|
const { messageTitle = '',
|
|
@@ -90,8 +88,7 @@ export const LineImageMap = ({
|
|
|
90
88
|
baseSize = {},
|
|
91
89
|
selectedTemplate,
|
|
92
90
|
assetType,
|
|
93
|
-
actionLinks
|
|
94
|
-
altText,
|
|
91
|
+
actionLinks
|
|
95
92
|
} = content;
|
|
96
93
|
if ( baseUrl && type === IMAGE_MAP) {
|
|
97
94
|
updateImageStatus(true);
|
|
@@ -103,14 +100,13 @@ export const LineImageMap = ({
|
|
|
103
100
|
updateActionLinks(actionLinks);
|
|
104
101
|
updateTemplateSchema(TEMPLATES_JSON[selectedTemplate]);
|
|
105
102
|
updateBaseSize(baseSize);
|
|
106
|
-
updateTitle(altText);
|
|
107
103
|
}
|
|
108
104
|
}, [content]);
|
|
109
105
|
|
|
110
106
|
useEffect(() => {
|
|
111
107
|
if (imageSrc && (isFullMode ? messageTitle: true) && imageMapTemplate && actionLinks) {
|
|
112
108
|
updateMessageState({
|
|
113
|
-
isError: !imageSrc || !(isFullMode ? messageTitle : true) || !imageMapTemplate || (isImageError && errorMessageTitle)
|
|
109
|
+
isError: !imageSrc || !(isFullMode ? messageTitle : true) || !imageMapTemplate || (isImageError && errorMessageTitle),
|
|
114
110
|
baseUrl: imageSrc,
|
|
115
111
|
messageTitle,
|
|
116
112
|
index,
|
|
@@ -120,11 +116,10 @@ export const LineImageMap = ({
|
|
|
120
116
|
messageContent: getActions(),
|
|
121
117
|
selectedTemplate: imageMapTemplate,
|
|
122
118
|
assetType,
|
|
123
|
-
actionLinks
|
|
124
|
-
altText,
|
|
119
|
+
actionLinks
|
|
125
120
|
});
|
|
126
121
|
}
|
|
127
|
-
}, [errorMessageTitle, imageSrc, messageTitle, isImageError, imageMapTemplate, actionLinks, assetType, isImage, templateSchema
|
|
122
|
+
}, [errorMessageTitle, imageSrc, messageTitle, isImageError, imageMapTemplate, actionLinks, assetType, isImage, templateSchema]);
|
|
128
123
|
|
|
129
124
|
useEffect(() => {
|
|
130
125
|
const imgSrc = get(Line, 'uploadedAssetData', false);
|
|
@@ -200,15 +195,6 @@ export const LineImageMap = ({
|
|
|
200
195
|
updateErrorMessageTitle(errorMessage);
|
|
201
196
|
}
|
|
202
197
|
|
|
203
|
-
const onTitleChange = ({ target: { value } }) => {
|
|
204
|
-
updateTitle(value);
|
|
205
|
-
let errorMessage = false;
|
|
206
|
-
if (value === '') {
|
|
207
|
-
errorMessage = formatMessage(messages.emptyAltTextErrorMessage);
|
|
208
|
-
}
|
|
209
|
-
updateErrorTitle(errorMessage);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
198
|
const uploadImages = (e, {files}) => {
|
|
213
199
|
if (e) {
|
|
214
200
|
e.preventDefault();
|
|
@@ -481,12 +467,10 @@ export const LineImageMap = ({
|
|
|
481
467
|
const baseSize = get(template, 'versions.base.content.messages[0].baseSize', '');
|
|
482
468
|
const selectedTemplate = get(template, 'definition.selectedTemplate', '');
|
|
483
469
|
const assetType = get(template, 'definition.assetType', '');
|
|
484
|
-
const altText = get(template, 'versions.base.content.messages[0].altText', '');
|
|
485
470
|
const actionLinks = get(template, 'definition.actionLinks', {});
|
|
486
471
|
updateImageStatus(true);
|
|
487
472
|
updateCreateNew(true);
|
|
488
473
|
updateImageSrc(baseUrl);
|
|
489
|
-
updateTitle(altText);
|
|
490
474
|
updateBaseSize(baseSize);
|
|
491
475
|
updateImageMapTemplate(selectedTemplate);
|
|
492
476
|
updateAssetType(assetType);
|
|
@@ -518,20 +502,11 @@ export const LineImageMap = ({
|
|
|
518
502
|
<CapButton
|
|
519
503
|
className="dragger-button"
|
|
520
504
|
type="flat"
|
|
521
|
-
style={{ top:
|
|
505
|
+
style={{ top:'-12px', position: 'absolute', right: 0, color: FONT_COLOR_05 }}
|
|
522
506
|
onClick={onReUpload}
|
|
523
507
|
>
|
|
524
508
|
<FormattedMessage {...messages.imageReUpload} />
|
|
525
509
|
</CapButton>}
|
|
526
|
-
<CapInput.TextArea
|
|
527
|
-
maxLength={MAX_ALLOWED_TITLE_LENGTH}
|
|
528
|
-
label={<FormattedMessage {...messages.titleLabel} />}
|
|
529
|
-
inductiveText={<FormattedMessage {...messages.titleDescription} />}
|
|
530
|
-
onChange={onTitleChange}
|
|
531
|
-
value={altText}
|
|
532
|
-
errorMessage={errorTitle}
|
|
533
|
-
className="title-textarea"
|
|
534
|
-
/>
|
|
535
510
|
<CapHeading type="h4">{formatMessage(messages.uploadImageLabel)}</CapHeading>
|
|
536
511
|
<CapLabel type="label1" style={{paddingTop: CAP_SPACE_12, paddingBottom: CAP_SPACE_08}}>{formatMessage(messages.uploadImageDesc)}</CapLabel>
|
|
537
512
|
<CapError key={`${id}-with-label`}>{isImageError}</CapError>
|
|
@@ -27,10 +27,6 @@ export default defineMessages({
|
|
|
27
27
|
id: `${scope}.emptyTitleErrorMessage`,
|
|
28
28
|
defaultMessage: 'Template title can not be empty',
|
|
29
29
|
},
|
|
30
|
-
"emptyAltTextErrorMessage": {
|
|
31
|
-
id: `${scope}.emptyAltTextErrorMessage`,
|
|
32
|
-
defaultMessage: 'Title can not be empty',
|
|
33
|
-
},
|
|
34
30
|
"imageDimenstionDescription": {
|
|
35
31
|
id: `${scope}.imageDimenstionDescription`,
|
|
36
32
|
defaultMessage: 'Dimensions: {dimensions} Size: Up to 10MB',
|
|
@@ -127,12 +123,4 @@ export default defineMessages({
|
|
|
127
123
|
id: `${scope}.select`,
|
|
128
124
|
defaultMessage: 'Select',
|
|
129
125
|
},
|
|
130
|
-
"titleLabel": {
|
|
131
|
-
id: `${scope}.titleLabel`,
|
|
132
|
-
defaultMessage: 'Title',
|
|
133
|
-
},
|
|
134
|
-
"titleDescription": {
|
|
135
|
-
id: `${scope}.titleDescription`,
|
|
136
|
-
defaultMessage: 'The title is shown in push notifications and in the user\'s chat list.',
|
|
137
|
-
},
|
|
138
126
|
});
|
|
@@ -46,9 +46,7 @@ export const LineWrapper = ({
|
|
|
46
46
|
messageContent,
|
|
47
47
|
messageTitle,
|
|
48
48
|
baseUrl,
|
|
49
|
-
selectedTemplate
|
|
50
|
-
template,
|
|
51
|
-
altText,
|
|
49
|
+
selectedTemplate
|
|
52
50
|
} = content;
|
|
53
51
|
|
|
54
52
|
const isTouched = (
|
|
@@ -63,8 +61,6 @@ export const LineWrapper = ({
|
|
|
63
61
|
|| messageContent
|
|
64
62
|
|| baseUrl
|
|
65
63
|
|| selectedTemplate
|
|
66
|
-
|| template
|
|
67
|
-
|| altText
|
|
68
64
|
);
|
|
69
65
|
if (!isTouched) {
|
|
70
66
|
updateActiveKey(type);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
|
|
3
3
|
import CapTooltip from '@capillarytech/cap-ui-library/CapTooltip';
|
|
4
|
+
import { CAP_WHITE, FONT_SIZE_VL } from '@capillarytech/cap-ui-library/styled/variables';
|
|
4
5
|
|
|
5
|
-
import { TEXT, IMAGE, IMAGE_MAP, STICKER
|
|
6
|
+
import { TEXT, IMAGE, IMAGE_MAP, STICKER } from '../constants';
|
|
6
7
|
import LineText from '../Text';
|
|
7
8
|
import LineImage from '../Image';
|
|
8
9
|
import LineSticker from '../Sticker';
|
|
9
10
|
import LineImageMap from '../ImageMap';
|
|
10
|
-
import LineImageCarousel from '../ImageCarousel';
|
|
11
11
|
import messages from './messages';
|
|
12
12
|
|
|
13
13
|
export const getTabContent = ({ item, props }) => {
|
|
@@ -24,24 +24,20 @@ export const getTabContent = ({ item, props }) => {
|
|
|
24
24
|
case IMAGE_MAP: {
|
|
25
25
|
return <LineImageMap {...props} />;
|
|
26
26
|
}
|
|
27
|
-
case TEMPLATE: {
|
|
28
|
-
return <LineImageCarousel {...props} />;
|
|
29
|
-
}
|
|
30
27
|
}
|
|
31
28
|
};
|
|
32
29
|
|
|
33
30
|
export const itemIcons = {
|
|
34
|
-
[TEXT]: '
|
|
35
|
-
[IMAGE]: '
|
|
36
|
-
[STICKER]: '
|
|
37
|
-
[IMAGE_MAP]: '
|
|
38
|
-
[TEMPLATE]: 'carousel-message',
|
|
31
|
+
[TEXT]: 'chat-bubble',
|
|
32
|
+
[IMAGE]: 'picture',
|
|
33
|
+
[STICKER]: 'smile',
|
|
34
|
+
[IMAGE_MAP]: 'add-media', // to change
|
|
39
35
|
};
|
|
40
36
|
|
|
41
37
|
|
|
42
38
|
export const getTabPanes = (props) => {
|
|
43
|
-
const tableKeys = [TEXT, IMAGE, STICKER, IMAGE_MAP
|
|
44
|
-
const tableKeysCreatives = [TEXT, IMAGE, IMAGE_MAP
|
|
39
|
+
const tableKeys = [TEXT, IMAGE, STICKER, IMAGE_MAP];
|
|
40
|
+
const tableKeysCreatives = [TEXT, IMAGE, IMAGE_MAP];
|
|
45
41
|
return (props.isFullMode ? tableKeysCreatives : tableKeys).map((item) => {
|
|
46
42
|
const isSelected = props.activeKey === item;
|
|
47
43
|
return {
|
|
@@ -51,9 +47,14 @@ export const getTabPanes = (props) => {
|
|
|
51
47
|
title={props.formatMessage(messages[`${item}Label`])}
|
|
52
48
|
>
|
|
53
49
|
<CapIcon
|
|
54
|
-
type={
|
|
55
|
-
size="
|
|
56
|
-
style={{
|
|
50
|
+
type={itemIcons[item]}
|
|
51
|
+
size="s"
|
|
52
|
+
style={{ fontSize: FONT_SIZE_VL }}
|
|
53
|
+
theme={isSelected ? 'filled' : ''}
|
|
54
|
+
svgProps={{
|
|
55
|
+
fill: isSelected ? '#000' : CAP_WHITE,
|
|
56
|
+
stroke: isSelected ? CAP_WHITE : '#000',
|
|
57
|
+
}}
|
|
57
58
|
/>
|
|
58
59
|
</CapTooltip>
|
|
59
60
|
),
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
bottom: 20px;
|
|
38
38
|
}
|
|
39
39
|
.cancel-msg {
|
|
40
|
-
margin-left:
|
|
40
|
+
margin-left: 120px;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.image-container {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
object-fit: cover;
|
|
54
54
|
max-width: 100%;
|
|
55
55
|
max-height: 100%;
|
|
56
|
-
height:
|
|
56
|
+
height: auto !important;
|
|
57
57
|
width: auto !important;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -28,20 +28,18 @@ export function defaultAction() {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export function uploadAsset(file, assetType, fileParams
|
|
31
|
+
export function uploadAsset(file, assetType, fileParams) {
|
|
32
32
|
return {
|
|
33
33
|
type: types.UPLOAD_ASSET_REQUEST,
|
|
34
34
|
file,
|
|
35
35
|
assetType,
|
|
36
36
|
fileParams,
|
|
37
|
-
templateType,
|
|
38
37
|
};
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
export function clearAsset(
|
|
40
|
+
export function clearAsset() {
|
|
42
41
|
return {
|
|
43
42
|
type: types.CLEAR_ASSET,
|
|
44
|
-
templateType,
|
|
45
43
|
};
|
|
46
44
|
}
|
|
47
45
|
|
|
@@ -2,11 +2,8 @@ export const TEXT = 'text';
|
|
|
2
2
|
export const STICKER = 'sticker';
|
|
3
3
|
export const IMAGE = 'image';
|
|
4
4
|
export const IMAGE_MAP = 'imagemap';
|
|
5
|
-
export const IMAGE_CAROUSEL = 'image_carousel';
|
|
6
|
-
export const TEMPLATE = 'template';
|
|
7
5
|
export const MAX_LINE_WRAPPER_LIMIT = 5;
|
|
8
6
|
export const MAX_LINE_WRAPPER_LIMIT_FULL_MODE = 1;
|
|
9
|
-
export const IMAGE_MAP_CAMEL_CASE = 'imageMap';
|
|
10
7
|
|
|
11
8
|
/*
|
|
12
9
|
*
|
|
@@ -16,13 +16,9 @@ import CapColumn from '@capillarytech/cap-ui-library/CapColumn';
|
|
|
16
16
|
import CapRadioCard from '@capillarytech/cap-ui-library/CapRadioCard';
|
|
17
17
|
import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
|
|
18
18
|
import CapHeader from '@capillarytech/cap-ui-library/CapHeader';
|
|
19
|
-
// GA
|
|
20
|
-
import { GA } from '@capillarytech/cap-ui-utils';
|
|
21
|
-
import { TRACK_CREATE_LINE, TRACK_EDIT_LINE } from '../../App/constants';
|
|
22
|
-
|
|
23
19
|
import LineWrapper from './Wrapper';
|
|
24
20
|
import messages from './messages';
|
|
25
|
-
import { TEXT, IMAGE, IMAGE_MAP,
|
|
21
|
+
import { TEXT, IMAGE, IMAGE_MAP, STICKER, MAX_LINE_WRAPPER_LIMIT, MAX_LINE_WRAPPER_LIMIT_FULL_MODE } from './constants';
|
|
26
22
|
import { FONT_COLOR_05 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
27
23
|
|
|
28
24
|
import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
|
|
@@ -33,7 +29,7 @@ import * as compActions from './actions';
|
|
|
33
29
|
import * as templateActionsConfig from '../../Templates/actions';
|
|
34
30
|
import withCreatives from '../../../hoc/withCreatives';
|
|
35
31
|
|
|
36
|
-
|
|
32
|
+
|
|
37
33
|
|
|
38
34
|
export const LineContainer = ({
|
|
39
35
|
isFullMode,
|
|
@@ -109,11 +105,9 @@ export const LineContainer = ({
|
|
|
109
105
|
const messageTitle = get(Line, 'templateDetails.name');
|
|
110
106
|
const baseUrl = get(Line, `templateDetails.versions.base.content.messages.0.baseUrl`);
|
|
111
107
|
const baseSize = get(Line, `templateDetails.versions.base.content.messages.0.baseSize`);
|
|
112
|
-
const altText = get(Line, `templateDetails.versions.base.content.messages.0.altText`);
|
|
113
108
|
const selectedTemplate = get(Line, 'templateDetails.selectedTemplate');
|
|
114
109
|
const assetType = get(Line, 'templateDetails.assetType');
|
|
115
110
|
const actionLinks = get(Line, 'templateDetails.actionLinks');
|
|
116
|
-
const template = get(Line, `templateDetails.versions.base.content.messages.0.template`);
|
|
117
111
|
const lineContent = {
|
|
118
112
|
type,
|
|
119
113
|
messageContent,
|
|
@@ -131,8 +125,6 @@ export const LineContainer = ({
|
|
|
131
125
|
baseUrl,
|
|
132
126
|
actionLinks,
|
|
133
127
|
baseSize,
|
|
134
|
-
template,
|
|
135
|
-
altText,
|
|
136
128
|
};
|
|
137
129
|
updateLineWrapperContent([lineContent]);
|
|
138
130
|
}
|
|
@@ -156,9 +148,7 @@ export const LineContainer = ({
|
|
|
156
148
|
baseSize,
|
|
157
149
|
actionLinks,
|
|
158
150
|
assetType,
|
|
159
|
-
selectedTemplate
|
|
160
|
-
template,
|
|
161
|
-
altText,
|
|
151
|
+
selectedTemplate
|
|
162
152
|
}) => {
|
|
163
153
|
const obj = {
|
|
164
154
|
type,
|
|
@@ -170,9 +160,7 @@ export const LineContainer = ({
|
|
|
170
160
|
baseSize,
|
|
171
161
|
actionLinks,
|
|
172
162
|
assetType,
|
|
173
|
-
selectedTemplate
|
|
174
|
-
template,
|
|
175
|
-
altText,
|
|
163
|
+
selectedTemplate
|
|
176
164
|
};
|
|
177
165
|
if (stickerUrl) {
|
|
178
166
|
obj.selectedSticker = {
|
|
@@ -334,9 +322,7 @@ export const LineContainer = ({
|
|
|
334
322
|
baseSize,
|
|
335
323
|
selectedTemplate,
|
|
336
324
|
assetType,
|
|
337
|
-
actionLinks
|
|
338
|
-
template,
|
|
339
|
-
altText,
|
|
325
|
+
actionLinks
|
|
340
326
|
} = {}] = lineWrapperContents;
|
|
341
327
|
let messageData = { type };
|
|
342
328
|
messageData[messageType] = messageContent;
|
|
@@ -354,15 +340,11 @@ export const LineContainer = ({
|
|
|
354
340
|
}
|
|
355
341
|
if (baseUrl) {
|
|
356
342
|
messageData.baseUrl = baseUrl;
|
|
357
|
-
messageData.altText =
|
|
343
|
+
messageData.altText = IMAGE_MAP;
|
|
358
344
|
}
|
|
359
345
|
if (baseSize) {
|
|
360
346
|
messageData.baseSize = baseSize;
|
|
361
347
|
}
|
|
362
|
-
if (template) {
|
|
363
|
-
messageData.template = template;
|
|
364
|
-
messageData.altText = altText;
|
|
365
|
-
}
|
|
366
348
|
return {
|
|
367
349
|
versions: {
|
|
368
350
|
base: {
|
|
@@ -395,9 +377,7 @@ export const LineContainer = ({
|
|
|
395
377
|
baseSize,
|
|
396
378
|
selectedTemplate,
|
|
397
379
|
assetType,
|
|
398
|
-
actionLinks
|
|
399
|
-
template,
|
|
400
|
-
altText,
|
|
380
|
+
actionLinks
|
|
401
381
|
}) => {
|
|
402
382
|
let messageData = { type };
|
|
403
383
|
messageData[messageType] = messageContent;
|
|
@@ -415,16 +395,12 @@ export const LineContainer = ({
|
|
|
415
395
|
}
|
|
416
396
|
if (baseUrl) {
|
|
417
397
|
messageData.baseUrl = baseUrl;
|
|
418
|
-
messageData.altText =
|
|
398
|
+
messageData.altText = IMAGE_MAP;
|
|
419
399
|
messageData.baseSize = baseSize;
|
|
420
400
|
messageData.selectedTemplate = selectedTemplate;
|
|
421
401
|
messageData.assetType = assetType;
|
|
422
402
|
messageData.actionLinks = actionLinks;
|
|
423
403
|
}
|
|
424
|
-
if (template) {
|
|
425
|
-
messageData.template = template;
|
|
426
|
-
messageData.altText = altText;
|
|
427
|
-
}
|
|
428
404
|
return messageData;
|
|
429
405
|
});
|
|
430
406
|
return ({
|
|
@@ -439,18 +415,10 @@ export const LineContainer = ({
|
|
|
439
415
|
});
|
|
440
416
|
}
|
|
441
417
|
|
|
442
|
-
const getLineType = lineWrapperContents => get(lineWrapperContents, '0.type', TEXT);
|
|
443
|
-
|
|
444
418
|
const onCreateLine = () => {
|
|
445
419
|
actions.createTemplate(
|
|
446
420
|
formatSubmitPayload(lineWrapperContents),
|
|
447
421
|
() => {
|
|
448
|
-
// stop timer for create line
|
|
449
|
-
stopTimer(TRACK_CREATE_LINE, {
|
|
450
|
-
category: 'Creatives',
|
|
451
|
-
action: TRACK_CREATE_LINE,
|
|
452
|
-
label: getLineType(lineWrapperContents),
|
|
453
|
-
});
|
|
454
422
|
createCallback();
|
|
455
423
|
onCreateComplete();
|
|
456
424
|
}
|
|
@@ -459,17 +427,17 @@ export const LineContainer = ({
|
|
|
459
427
|
|
|
460
428
|
const getPreviewSection = () => {
|
|
461
429
|
const accountName = get(lineData, 'selectedLineAccount.name', '');
|
|
462
|
-
const templateContent = lineWrapperContents.map(({ messageContent, type, previewImageUrl, selectedSticker, baseUrl
|
|
430
|
+
const templateContent = lineWrapperContents.map(({ messageContent, type, previewImageUrl, selectedSticker, baseUrl }) => ({
|
|
463
431
|
messageContent,
|
|
464
432
|
previewImageUrl,
|
|
465
433
|
selectedSticker,
|
|
466
434
|
type,
|
|
467
|
-
baseUrl
|
|
468
|
-
imageCarousel: get(template, 'columns', [{}]).map(({ imageUrl, action: { label: actionLabel } = {} }) => ({ imageUrl, actionLabel }) ),
|
|
435
|
+
baseUrl
|
|
469
436
|
}));
|
|
470
437
|
|
|
471
438
|
return (
|
|
472
439
|
<TemplatePreview
|
|
440
|
+
// style={val.customStyling ? val.customStyling : {}}
|
|
473
441
|
channel="LINE"
|
|
474
442
|
content={templateContent}
|
|
475
443
|
LineAccountName={accountName[0]}
|
|
@@ -484,12 +452,6 @@ export const LineContainer = ({
|
|
|
484
452
|
_id: params.id,
|
|
485
453
|
},
|
|
486
454
|
() => {
|
|
487
|
-
// stop timer for edit line
|
|
488
|
-
stopTimer(TRACK_EDIT_LINE, {
|
|
489
|
-
category: 'Creatives',
|
|
490
|
-
action: TRACK_EDIT_LINE,
|
|
491
|
-
label: getLineType(lineWrapperContents),
|
|
492
|
-
});
|
|
493
455
|
editCallback();
|
|
494
456
|
onCreateComplete();
|
|
495
457
|
});
|