@capillarytech/creatives-library 6.11.6 → 6.11.7
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/rich-video-placeholder.svg +20 -0
- package/components/TemplatePreview/_templatePreview.scss +14 -0
- package/components/TemplatePreview/index.js +83 -3
- package/components/TemplatePreview/messages.js +8 -0
- package/index.js +0 -5
- package/package.json +4 -4
- package/services/getSchema.js +0 -3
- package/v2Components/BeeEditor/index.js +263 -0
- package/v2Components/BeeEditor/index.scss +11 -0
- package/v2Components/BeeEditor/messages.js +71 -0
- package/v2Components/BeeEditor/tests/index.test.js +10 -0
- 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 +14 -0
- 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 +81 -2
- package/v2Components/TemplatePreview/messages.js +8 -0
- package/v2Components/TemplatePreview/tests/index.test.js +10 -10
- package/v2Containers/CreativesContainer/SlideBoxContent.js +11 -0
- package/v2Containers/CreativesContainer/actions.js +27 -27
- package/v2Containers/CreativesContainer/constants.js +17 -17
- 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/Line/Container/ImageMap/index.js +2 -1
- package/v2Containers/Line/Container/Video/constants.js +10 -0
- package/v2Containers/Line/Container/Video/index.js +767 -0
- package/v2Containers/Line/Container/Video/messages.js +142 -0
- package/v2Containers/Line/Container/Video/style.js +61 -0
- package/v2Containers/Line/Container/Wrapper/index.js +2 -0
- package/v2Containers/Line/Container/Wrapper/messages.js +4 -0
- package/v2Containers/Line/Container/Wrapper/utils.js +8 -3
- package/v2Containers/Line/Container/constants.js +2 -0
- package/v2Containers/Line/Container/index.js +109 -2
- package/v2Containers/Line/Container/messages.js +4 -0
- package/v2Containers/Templates/index.js +15 -1
- package/v2Containers/Templates/messages.js +4 -0
- 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
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="140" height="184" viewBox="0 0 140 184">
|
|
2
|
+
<g fill="none" fill-rule="evenodd">
|
|
3
|
+
<g>
|
|
4
|
+
<g>
|
|
5
|
+
<g transform="translate(-1199 -210) translate(1199 210)">
|
|
6
|
+
<rect width="140" height="184" fill="#EBECF0" rx="12"/>
|
|
7
|
+
<g>
|
|
8
|
+
<path d="M0 0L40 0 40 40 0 40z" transform="translate(50 64)"/>
|
|
9
|
+
<path fill="#B3BAC5" fill-rule="nonzero" d="M16.333 27.167l10-7.5-10-7.5v15zM19.667 3C10.467 3 3 10.467 3 19.667c0 9.2 7.467 16.666 16.667 16.666 9.2 0 16.666-7.466 16.666-16.666S28.867 3 19.667 3zm0 30c-7.35 0-13.334-5.983-13.334-13.333 0-7.35 5.984-13.334 13.334-13.334S33 12.317 33 19.667 27.017 33 19.667 33z" transform="translate(50 64)"/>
|
|
10
|
+
</g>
|
|
11
|
+
<g transform="matrix(-1 0 0 1 82 112)">
|
|
12
|
+
<circle cx="12" cy="12" r="12" stroke="#B3BAC5" stroke-width="3"/>
|
|
13
|
+
<path d="M1.714 1.714L22.286 1.714 22.286 22.286 1.714 22.286z"/>
|
|
14
|
+
<path fill="#B3BAC5" fill-rule="nonzero" d="M9.936 8.223V6.861c0-.763-.925-1.149-1.465-.609l-3.935 3.934c-.334.335-.334.875 0 1.209l3.935 3.934c.54.54 1.465.163 1.465-.6v-1.448c4.286 0 7.286 1.371 9.429 4.371-.857-4.286-3.429-8.571-9.429-9.429z"/>
|
|
15
|
+
</g>
|
|
16
|
+
</g>
|
|
17
|
+
</g>
|
|
18
|
+
</g>
|
|
19
|
+
</g>
|
|
20
|
+
</svg>
|
|
@@ -622,4 +622,18 @@
|
|
|
622
622
|
.slick-track {
|
|
623
623
|
margin-left: 0;
|
|
624
624
|
}
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
.ant-btn.cap-button-v2.flat-btn.preview-video-btn {
|
|
628
|
+
padding: 0;
|
|
629
|
+
background-color: transparent;
|
|
630
|
+
height: auto;
|
|
631
|
+
|
|
632
|
+
i {
|
|
633
|
+
vertical-align: middle;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
span {
|
|
637
|
+
font-size: $FONT_SIZE_VS;
|
|
638
|
+
}
|
|
625
639
|
}
|
|
@@ -9,7 +9,7 @@ import PropTypes from 'prop-types';
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import _ from 'lodash';
|
|
11
11
|
import { injectIntl, intlShape, FormattedMessage} from 'react-intl';
|
|
12
|
-
import {CapColumn, CapTab, CapIcon, CapLabel, CapImage, CapTooltip} from '@capillarytech/cap-ui-library';
|
|
12
|
+
import {CapColumn, CapTab, CapIcon, CapLabel, CapImage, CapTooltip, CapButton } from '@capillarytech/cap-ui-library';
|
|
13
13
|
import './_templatePreview.scss';
|
|
14
14
|
import Carousel from '../../v2Components/Carousel';
|
|
15
15
|
import {updateCharCount} from '../../utils/smsCharCountV2';
|
|
@@ -27,8 +27,8 @@ const wechatBody = require('./assets/images/WECHAT_5x.png');
|
|
|
27
27
|
const smsBody = require('./assets/images/mobile.svg');
|
|
28
28
|
const androidPushMessagePhone = require('./assets/images/androidPushMessage.svg');
|
|
29
29
|
const iPhonePushMessagePhone = require('./assets/images/iPhonePushMessage.svg');
|
|
30
|
-
import { CAP_COLOR_03, CAP_WHITE, FONT_COLOR_01, CAP_G08 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
31
|
-
import { TEMPLATE, IMAGE_CAROUSEL, IMAGE_MAP_CAMEL_CASE, IMAGE, STICKER, TEXT } from '../../v2Containers/Line/Container/constants';
|
|
30
|
+
import { CAP_COLOR_03, CAP_WHITE, FONT_COLOR_01, CAP_G08, CAP_G06 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
31
|
+
import { TEMPLATE, IMAGE_CAROUSEL, IMAGE_MAP_CAMEL_CASE, IMAGE, STICKER, TEXT, VIDEO } from '../../v2Containers/Line/Container/constants';
|
|
32
32
|
|
|
33
33
|
class TemplatePreview extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
34
34
|
getWechatAndroidPreview = (content) => (
|
|
@@ -201,6 +201,78 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
201
201
|
return undefined;
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
|
+
|
|
205
|
+
const getVideoContent = ({
|
|
206
|
+
video,
|
|
207
|
+
actionUrl,
|
|
208
|
+
sectionStyle,
|
|
209
|
+
}) => (
|
|
210
|
+
<div
|
|
211
|
+
className="message-pop align-left"
|
|
212
|
+
style={{
|
|
213
|
+
...sectionStyle,
|
|
214
|
+
minHeight: 184,
|
|
215
|
+
display: 'flex',
|
|
216
|
+
justifyContent: 'center',
|
|
217
|
+
alignItems: 'center',
|
|
218
|
+
backgroundColor: !video ? 'transparent' : CAP_G06,
|
|
219
|
+
marginTop: 0,
|
|
220
|
+
}}
|
|
221
|
+
key={video}
|
|
222
|
+
>
|
|
223
|
+
{
|
|
224
|
+
video
|
|
225
|
+
? (
|
|
226
|
+
<>
|
|
227
|
+
<video width="150" style={{ opacity: 0.5 }}>
|
|
228
|
+
<source src={video} type="video/mp4" />
|
|
229
|
+
</video>
|
|
230
|
+
<div
|
|
231
|
+
style={{
|
|
232
|
+
position: 'absolute',
|
|
233
|
+
display: 'flex',
|
|
234
|
+
flexDirection: 'column',
|
|
235
|
+
}}
|
|
236
|
+
>
|
|
237
|
+
<CapButton
|
|
238
|
+
className="preview-video-btn"
|
|
239
|
+
type="flat"
|
|
240
|
+
>
|
|
241
|
+
<CapIcon type="play"/>
|
|
242
|
+
<FormattedMessage {...messages.playVideo} />
|
|
243
|
+
</CapButton>
|
|
244
|
+
{
|
|
245
|
+
actionUrl
|
|
246
|
+
? (
|
|
247
|
+
<CapButton
|
|
248
|
+
className="preview-video-btn"
|
|
249
|
+
type="flat"
|
|
250
|
+
>
|
|
251
|
+
<CapIcon type="reply" style={{ fontSize: 18 }}/>
|
|
252
|
+
<FormattedMessage {...messages.showDetails} />
|
|
253
|
+
</CapButton>
|
|
254
|
+
)
|
|
255
|
+
: null
|
|
256
|
+
}
|
|
257
|
+
</div>
|
|
258
|
+
</>
|
|
259
|
+
)
|
|
260
|
+
: (
|
|
261
|
+
<CapImage
|
|
262
|
+
src={lineVideoPlaceholder}
|
|
263
|
+
alt="brand-name"
|
|
264
|
+
rest={{
|
|
265
|
+
style: {
|
|
266
|
+
width: 126,
|
|
267
|
+
marginBottom: 5,
|
|
268
|
+
},
|
|
269
|
+
}}
|
|
270
|
+
/>
|
|
271
|
+
)
|
|
272
|
+
}
|
|
273
|
+
</div>
|
|
274
|
+
);
|
|
275
|
+
|
|
204
276
|
return (
|
|
205
277
|
<div className={`preview-container ${type === 'embedded' ? 'embedded-preview' : ''}`}>
|
|
206
278
|
{ (channel || '').toLowerCase() === 'sms' &&
|
|
@@ -352,6 +424,8 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
352
424
|
stickerUrl: lineStickerPlaceholder,
|
|
353
425
|
},
|
|
354
426
|
imageCarousel = [lineImgPlaceholder],
|
|
427
|
+
video,
|
|
428
|
+
actionUrl,
|
|
355
429
|
} = item || {};
|
|
356
430
|
const sectionStyle = {
|
|
357
431
|
background: CAP_WHITE,
|
|
@@ -399,7 +473,13 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
399
473
|
</div>
|
|
400
474
|
);
|
|
401
475
|
}
|
|
476
|
+
if (type === VIDEO) {
|
|
477
|
+
return getVideoContent({ video, actionUrl, sectionStyle });
|
|
478
|
+
}
|
|
402
479
|
if ((type === IMAGE_MAP_CAMEL_CASE && baseUrl)) {
|
|
480
|
+
if (video) {
|
|
481
|
+
return getVideoContent({ video, actionUrl, sectionStyle });
|
|
482
|
+
}
|
|
403
483
|
return (
|
|
404
484
|
<div
|
|
405
485
|
className="message-pop align-left"
|
|
@@ -67,4 +67,12 @@ export default defineMessages({
|
|
|
67
67
|
defaultMessage:
|
|
68
68
|
'This message has unicode characters. This may affect the cost per message.',
|
|
69
69
|
},
|
|
70
|
+
playVideo: {
|
|
71
|
+
id: 'creatives.componentsV2.TemplatePreview.playVideo',
|
|
72
|
+
defaultMessage: 'Play',
|
|
73
|
+
},
|
|
74
|
+
showDetails: {
|
|
75
|
+
id: 'creatives.componentsV2.TemplatePreview.showDetails',
|
|
76
|
+
defaultMessage: 'Show details',
|
|
77
|
+
},
|
|
70
78
|
});
|
package/index.js
CHANGED
|
@@ -65,9 +65,6 @@ import LineCreate from './v2Containers/Line/Container';
|
|
|
65
65
|
import lineCreateReducer from './v2Containers/Line/Container/reducer';
|
|
66
66
|
import lineCreateSaga from './v2Containers/Line/Container/sagas';
|
|
67
67
|
|
|
68
|
-
import LineEdit from './v2Containers/Line/Edit';
|
|
69
|
-
import lineEditReducer from './v2Containers/Line/Edit/reducer';
|
|
70
|
-
import lineEditSaga from './v2Containers/Line/Edit/sagas';
|
|
71
68
|
import TemplatesV2 from './v2Containers/TemplatesV2/index';
|
|
72
69
|
|
|
73
70
|
import CreativesContainer from './v2Containers/CreativesContainer';
|
|
@@ -93,7 +90,6 @@ const WeChatRichMediaEditContainer = {WeChatRichMediaEdit, weChatRichMediaEditRe
|
|
|
93
90
|
const MobilePushCreateContainer = {MobilepushCreate, mobilepushCreateReducer, mobilepushCreateSaga};
|
|
94
91
|
const MobilePushEditContainer = {MobilepushEdit, mobilepushEditReducer, mobilepushEditSaga};
|
|
95
92
|
const LineCreateContainer = {LineCreate, lineCreateReducer, lineCreateSaga};
|
|
96
|
-
const LineEditContainer = {LineEdit, lineEditReducer, lineEditSaga};
|
|
97
93
|
const TemplatesV2Container = {TemplatesV2, templateReducer, templateSaga};
|
|
98
94
|
const FacebookContainer = {Facebook, facebookReducer, facebookSaga};
|
|
99
95
|
const GalleryContainer = {Gallery, galleryReducer, gallerySagas};
|
|
@@ -128,7 +124,6 @@ export { CapContainer,
|
|
|
128
124
|
SmsEdit,
|
|
129
125
|
Email,
|
|
130
126
|
LineCreateContainer,
|
|
131
|
-
LineEditContainer,
|
|
132
127
|
MobilePushCreateContainer,
|
|
133
128
|
MobilePushEditContainer,
|
|
134
129
|
TemplatesV2Container,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capillarytech/creatives-library",
|
|
3
3
|
"author": "meharaj",
|
|
4
|
-
"version": "6.11.
|
|
4
|
+
"version": "6.11.7",
|
|
5
5
|
"description": "Capillary creatives ui",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"module": "./index.es.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"redux-immutable": "3.0.8",
|
|
32
32
|
"reselect": "2.5.4",
|
|
33
33
|
"styled-components": "^3.2.1",
|
|
34
|
-
"
|
|
35
|
-
"
|
|
34
|
+
"webpack-bugsnag-plugins": "^1.4.3",
|
|
35
|
+
"whatwg-fetch": "2.0.1"
|
|
36
36
|
}
|
|
37
|
-
}
|
|
37
|
+
}
|
package/services/getSchema.js
CHANGED
|
@@ -14,9 +14,6 @@ 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;
|
|
20
17
|
default:
|
|
21
18
|
schemaPath = import(`../v2Containers/Sms/initialSchema`);
|
|
22
19
|
}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Beeeditor
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
import React, { useEffect, useState, useRef, useCallback } from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
9
|
+
import TagList from '../../v2Containers/TagList';
|
|
10
|
+
import
|
|
11
|
+
{
|
|
12
|
+
CapModal,
|
|
13
|
+
CapButton,
|
|
14
|
+
CapInput,
|
|
15
|
+
CapSelect,
|
|
16
|
+
}
|
|
17
|
+
from '@capillarytech/cap-ui-library';
|
|
18
|
+
import messages from './messages';
|
|
19
|
+
import './index.scss';
|
|
20
|
+
|
|
21
|
+
function BeeEditor(props) {
|
|
22
|
+
const {
|
|
23
|
+
uid,
|
|
24
|
+
beeJson,
|
|
25
|
+
tokenData,
|
|
26
|
+
id,
|
|
27
|
+
location = {},
|
|
28
|
+
moduleFilterEnabled,
|
|
29
|
+
label,
|
|
30
|
+
className,
|
|
31
|
+
userLocale,
|
|
32
|
+
selectedOfferDetails,
|
|
33
|
+
tags,
|
|
34
|
+
injectedTags,
|
|
35
|
+
saveBeeInstance,
|
|
36
|
+
saveBeeData,
|
|
37
|
+
intl,
|
|
38
|
+
onContextChange,
|
|
39
|
+
} = props;
|
|
40
|
+
const {formatMessage} = intl;
|
|
41
|
+
const UNSUBSCRIBE = 'unsubscribe';
|
|
42
|
+
let beePluginInstance = null;
|
|
43
|
+
const categoryOptions = [{key: 'cta', value: 'cta', label: formatMessage(messages.cta)},
|
|
44
|
+
{key: 'footer', value: 'footer', label: formatMessage(messages.footer)},
|
|
45
|
+
{key: 'header', value: 'header', label: formatMessage(messages.header)},
|
|
46
|
+
{key: 'sp', value: 'sp', label: formatMessage(messages.socialPlatform)},
|
|
47
|
+
{key: 'others', value: 'others', label: formatMessage(messages.others)},
|
|
48
|
+
];
|
|
49
|
+
const [visibleTaglist, setVisibleTaglist] = useState(false);
|
|
50
|
+
const [showRowMetaModal, setRowMetaModal] = useState(false);
|
|
51
|
+
const [selectedTag, setSelectedTag] = useState({});
|
|
52
|
+
const [rowMetaInfo, setRowMetaInfo] = useState({});
|
|
53
|
+
const [rowName, setRowName] = useState('');
|
|
54
|
+
const [rowCategory, setRowCategory] = useState('');
|
|
55
|
+
|
|
56
|
+
const savedCallback = useRef();
|
|
57
|
+
const filteredTags = (tags || []).filter((obj) => obj.definition.value !== UNSUBSCRIBE);
|
|
58
|
+
let intervalTimer;
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
savedCallback.current = Object.keys(selectedTag).length > 0 ? selectedTag : rowMetaInfo;
|
|
62
|
+
}, [selectedTag, rowMetaInfo]);
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
const beeConfig = {
|
|
66
|
+
uid,
|
|
67
|
+
container: 'bee-plugin-container',
|
|
68
|
+
rowsConfiguration: {
|
|
69
|
+
emptyRows: true,
|
|
70
|
+
defaultRows: true,
|
|
71
|
+
},
|
|
72
|
+
contentDialog: {
|
|
73
|
+
specialLinks: {
|
|
74
|
+
label: UNSUBSCRIBE,
|
|
75
|
+
handler(resolve) {
|
|
76
|
+
resolve({
|
|
77
|
+
type: 'custom',
|
|
78
|
+
label: UNSUBSCRIBE,
|
|
79
|
+
link: `{{${UNSUBSCRIBE}}}`,
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
mergeTags: {
|
|
84
|
+
label: formatMessage(messages.addLabel),
|
|
85
|
+
handler: async (resolve, reject) => {
|
|
86
|
+
// this will open tag modal
|
|
87
|
+
await setVisibleTaglist(true);
|
|
88
|
+
// until tag modal will not open promise will not execute
|
|
89
|
+
// once tag modal is opened it will start 2 sec interval to wait use has selected any tag or cancel the tag selection
|
|
90
|
+
const promise = new Promise((resolveP) => {
|
|
91
|
+
intervalTimer = setInterval(() => {
|
|
92
|
+
// this will execute, if user cancel the tag selection
|
|
93
|
+
if ((savedCallback.current || {}).close === true) {
|
|
94
|
+
reject();
|
|
95
|
+
clearInterval(intervalTimer);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
// this block is checking use has selected any tag or not
|
|
99
|
+
if (Object.keys(savedCallback.current || {}).length > 0) {
|
|
100
|
+
resolveP(savedCallback.current);
|
|
101
|
+
setSelectedTag({});
|
|
102
|
+
clearInterval(intervalTimer);
|
|
103
|
+
}
|
|
104
|
+
}, 2000);
|
|
105
|
+
});
|
|
106
|
+
// once prmise will resolve , pass the resolve data to handler to show tags in bee edior
|
|
107
|
+
const result = await promise;
|
|
108
|
+
resolve(result);
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
saveRow: {
|
|
112
|
+
handler: async (resolve, reject) => {
|
|
113
|
+
await setRowMetaModal(true);
|
|
114
|
+
const promise = new Promise((resolveP) => {
|
|
115
|
+
intervalTimer = setInterval(() => {
|
|
116
|
+
if ((savedCallback.current || {}).close === true) {
|
|
117
|
+
reject();
|
|
118
|
+
clearInterval(intervalTimer);
|
|
119
|
+
setRowMetaInfo({});
|
|
120
|
+
setRowName('');
|
|
121
|
+
setRowCategory('');
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (Object.keys(savedCallback.current || {}).length > 0) {
|
|
125
|
+
resolveP(savedCallback.current);
|
|
126
|
+
}
|
|
127
|
+
}, 2000);
|
|
128
|
+
});
|
|
129
|
+
const result = await promise;
|
|
130
|
+
resolve(result); // "done!"
|
|
131
|
+
setRowMetaInfo({});
|
|
132
|
+
setRowName('');
|
|
133
|
+
setRowCategory('');
|
|
134
|
+
clearInterval(intervalTimer);
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
onSave: (jsonFile, htmlFile) => {
|
|
139
|
+
saveBeeData(jsonFile, htmlFile);
|
|
140
|
+
},
|
|
141
|
+
// will use this function on save row feature
|
|
142
|
+
onSaveRow: (rowJSON) => {
|
|
143
|
+
console.log('bee-plugin-container onSaveRows', rowJSON);
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
window.BeePlugin.create(tokenData, beeConfig, (instance) => {
|
|
147
|
+
beePluginInstance = instance;
|
|
148
|
+
const parseJson = JSON.parse(beeJson);
|
|
149
|
+
beePluginInstance.start(parseJson);
|
|
150
|
+
saveBeeInstance(beePluginInstance);
|
|
151
|
+
});
|
|
152
|
+
return () => clearInterval(intervalTimer);
|
|
153
|
+
}, []);
|
|
154
|
+
|
|
155
|
+
const onTagSelect = (result) => {
|
|
156
|
+
const msg = {
|
|
157
|
+
name: result,
|
|
158
|
+
value: `{{${result}}}`,
|
|
159
|
+
};
|
|
160
|
+
setSelectedTag(msg);
|
|
161
|
+
setVisibleTaglist(false);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const onCancelTagList = () => {
|
|
165
|
+
setVisibleTaglist(false);
|
|
166
|
+
setSelectedTag({close: true});
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const handleCancel = () => {
|
|
170
|
+
setRowMetaModal(false);
|
|
171
|
+
setRowMetaInfo({close: true});
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const handleOk = () => {
|
|
175
|
+
const rowInfo = {};
|
|
176
|
+
if (rowCategory !== '') {
|
|
177
|
+
rowInfo.category = rowCategory;
|
|
178
|
+
}
|
|
179
|
+
setRowMetaInfo({
|
|
180
|
+
name: rowName,
|
|
181
|
+
...rowInfo,
|
|
182
|
+
});
|
|
183
|
+
setRowMetaModal(false);
|
|
184
|
+
};
|
|
185
|
+
const isDisableSave = () => rowName === '';
|
|
186
|
+
|
|
187
|
+
const onRowChange = useCallback((e) => {
|
|
188
|
+
setRowName(e.target.value);
|
|
189
|
+
});
|
|
190
|
+
const onChangeCategoy = (e) => {
|
|
191
|
+
setRowCategory(e);
|
|
192
|
+
};
|
|
193
|
+
const contentSection = <>
|
|
194
|
+
<CapInput
|
|
195
|
+
label={<FormattedMessage {...messages.rowName} />}
|
|
196
|
+
placeholder={formatMessage(messages.rowPlaceHolder)}
|
|
197
|
+
onChange={onRowChange}
|
|
198
|
+
value={rowName}
|
|
199
|
+
maxLength={50}
|
|
200
|
+
style={{ width: '324px', paddingBottom: '16px' }}
|
|
201
|
+
/>
|
|
202
|
+
<CapSelect
|
|
203
|
+
label="Category"
|
|
204
|
+
style={{ width: 250, paddingBottom: '16px'}}
|
|
205
|
+
options={categoryOptions}
|
|
206
|
+
selectPlaceholder={formatMessage(messages.select)}
|
|
207
|
+
placeholder={
|
|
208
|
+
<FormattedMessage {...messages.selectCategoyPlaceholder} />
|
|
209
|
+
}
|
|
210
|
+
onChange={onChangeCategoy}
|
|
211
|
+
/>
|
|
212
|
+
|
|
213
|
+
</>;
|
|
214
|
+
return (
|
|
215
|
+
<>
|
|
216
|
+
<div id="bee-plugin-container" style={{ height: '500px'}}>
|
|
217
|
+
</div>
|
|
218
|
+
<TagList
|
|
219
|
+
moduleFilterEnabled={moduleFilterEnabled}
|
|
220
|
+
label={label}
|
|
221
|
+
onTagSelect={onTagSelect}
|
|
222
|
+
location={location}
|
|
223
|
+
tags={filteredTags}
|
|
224
|
+
injectedTags={injectedTags}
|
|
225
|
+
className={className}
|
|
226
|
+
id={id}
|
|
227
|
+
userLocale={userLocale}
|
|
228
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
229
|
+
visibleTaglist={visibleTaglist}
|
|
230
|
+
hidePopover
|
|
231
|
+
modalProps={{
|
|
232
|
+
onCancel: onCancelTagList,
|
|
233
|
+
style: { left: 135, top: 250 },
|
|
234
|
+
className: "bee-editor-tag-list",
|
|
235
|
+
}}
|
|
236
|
+
onContextChange={onContextChange}
|
|
237
|
+
/>
|
|
238
|
+
<CapModal
|
|
239
|
+
visible={showRowMetaModal}
|
|
240
|
+
onCancel={handleCancel}
|
|
241
|
+
title={formatMessage(messages.customRows)}
|
|
242
|
+
footer={[
|
|
243
|
+
<CapButton key="back" onClick={handleCancel}>{formatMessage(messages.cancel)}</CapButton>,
|
|
244
|
+
<CapButton key="submit" type="primary" id="delete-version" onClick={handleOk} disabled={isDisableSave()}>
|
|
245
|
+
{formatMessage(messages.save)}
|
|
246
|
+
</CapButton>,
|
|
247
|
+
]}
|
|
248
|
+
>
|
|
249
|
+
{contentSection}
|
|
250
|
+
</CapModal>
|
|
251
|
+
</>
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
BeeEditor.propTypes = {
|
|
256
|
+
beeJson: PropTypes.object.isRequired,
|
|
257
|
+
tokenData: PropTypes.object.isRequired,
|
|
258
|
+
uid: PropTypes.string.isRequired,
|
|
259
|
+
showTagsPopover: PropTypes.func.isRequired,
|
|
260
|
+
intl: intlShape.isRequired,
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
export default injectIntl(BeeEditor);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* BeeEditor Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the BeeEditor component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
const prefix = 'creatives.componentsV2.BeeEditor';
|
|
9
|
+
|
|
10
|
+
export default defineMessages({
|
|
11
|
+
cancel: {
|
|
12
|
+
id: `${prefix}.cancel`,
|
|
13
|
+
defaultMessage: 'Cancel',
|
|
14
|
+
},
|
|
15
|
+
save: {
|
|
16
|
+
id: `${prefix}.save`,
|
|
17
|
+
defaultMessage: 'Save',
|
|
18
|
+
},
|
|
19
|
+
rowPlaceHolder: {
|
|
20
|
+
id: `${prefix}.rowPlaceHolder`,
|
|
21
|
+
defaultMessage: 'Enter Row name',
|
|
22
|
+
},
|
|
23
|
+
rowName: {
|
|
24
|
+
id: `${prefix}.rowName`,
|
|
25
|
+
defaultMessage: 'Row name',
|
|
26
|
+
},
|
|
27
|
+
select: {
|
|
28
|
+
id: `${prefix}.select`,
|
|
29
|
+
defaultMessage: 'Select',
|
|
30
|
+
},
|
|
31
|
+
customRows: {
|
|
32
|
+
id: `${prefix}.customRows`,
|
|
33
|
+
defaultMessage: 'Custom rows',
|
|
34
|
+
},
|
|
35
|
+
selectCategoyPlaceholder: {
|
|
36
|
+
id: `${prefix}.selectCategoyPlaceholder`,
|
|
37
|
+
defaultMessage: 'Select category',
|
|
38
|
+
},
|
|
39
|
+
tags: {
|
|
40
|
+
id: `${prefix}.tags`,
|
|
41
|
+
defaultMessage: 'Tags (optional)',
|
|
42
|
+
},
|
|
43
|
+
tagPlaceHolder: {
|
|
44
|
+
id: `${prefix}.tagPlaceHolder`,
|
|
45
|
+
defaultMessage: 'Enter tags',
|
|
46
|
+
},
|
|
47
|
+
addLabel: {
|
|
48
|
+
id: `${prefix}.addLabel`,
|
|
49
|
+
defaultMessage: 'Add label',
|
|
50
|
+
},
|
|
51
|
+
cta: {
|
|
52
|
+
id: `${prefix}.cta`,
|
|
53
|
+
defaultMessage: 'CTA',
|
|
54
|
+
},
|
|
55
|
+
header: {
|
|
56
|
+
id: `${prefix}.header`,
|
|
57
|
+
defaultMessage: 'Header',
|
|
58
|
+
},
|
|
59
|
+
footer: {
|
|
60
|
+
id: `${prefix}.footer`,
|
|
61
|
+
defaultMessage: 'Footer',
|
|
62
|
+
},
|
|
63
|
+
others: {
|
|
64
|
+
id: `${prefix}.others`,
|
|
65
|
+
defaultMessage: 'Others',
|
|
66
|
+
},
|
|
67
|
+
socialPlatform: {
|
|
68
|
+
id: `${prefix}.socialPlatform`,
|
|
69
|
+
defaultMessage: 'Social platform',
|
|
70
|
+
},
|
|
71
|
+
});
|