@capillarytech/creatives-library 6.8.8 → 6.9.1
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 +278 -0
- package/v2Components/BeeEditor/index.scss +11 -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/EmailPreview/_emailPreview.scss +2 -2
- 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 +210 -108
- package/v2Containers/Email/initialSchema.js +18 -3
- package/v2Containers/Email/sagas.js +2 -2
- package/v2Containers/Email/selectors.js +5 -0
- package/v2Containers/EmailWrapper/index.js +19 -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 +34 -42
- package/v2Containers/Templates/messages.js +8 -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
|
@@ -187,7 +187,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
187
187
|
{this.props.moduleFilterEnabled ? <CapSelect getPopupContainer={(triggerNode) => triggerNode.parentNode} style={{width: '250px', marginBottom: '16px', minWidth: 'initial', display: 'inherit'}} onChange={this.props.onContextChange} defaultValue="All" options={options}>
|
|
188
188
|
</CapSelect> : ''}
|
|
189
189
|
<Tree
|
|
190
|
-
styling={{
|
|
190
|
+
styling={{height: '350px', overflow: 'auto'}}
|
|
191
191
|
onSelect={this.handleOnSelect}
|
|
192
192
|
selectedKeys={this.state.tagValue}
|
|
193
193
|
expandedKeys={this.state.expandedKeys}
|
|
@@ -44,7 +44,7 @@ class Edmeditor extends React.Component { // eslint-disable-line react/prefer-st
|
|
|
44
44
|
console.log('current language edm editor loading', this.props.id, this.props.edmSrc);
|
|
45
45
|
return (
|
|
46
46
|
this.props.edmSrc ?
|
|
47
|
-
(<iframe id={this.props.id} className={this.props.activeClass} src={this.props.edmSrc} height="460" width="100%" style={{
|
|
47
|
+
(<iframe id={this.props.id} className={this.props.activeClass} src={this.props.edmSrc} height="460" width="100%" style={{height: "calc(100vh - 180px)"}}></iframe>)
|
|
48
48
|
: 'aaasass'
|
|
49
49
|
);
|
|
50
50
|
}
|
|
@@ -11,7 +11,6 @@ import _ from 'lodash';
|
|
|
11
11
|
import { injectIntl, intlShape, FormattedMessage} from 'react-intl';
|
|
12
12
|
import {CapColumn, CapTab, CapIcon, CapLabel, CapImage, CapTooltip} from '@capillarytech/cap-ui-library';
|
|
13
13
|
import './_templatePreview.scss';
|
|
14
|
-
import Carousel from '../../v2Components/Carousel';
|
|
15
14
|
import {updateCharCount} from '../../utils/smsCharCountV2';
|
|
16
15
|
import messages from './messages';
|
|
17
16
|
const smsIcon = require('./assets/images/user-icon.svg');
|
|
@@ -28,7 +27,6 @@ const smsBody = require('./assets/images/mobile.svg');
|
|
|
28
27
|
const androidPushMessagePhone = require('./assets/images/androidPushMessage.svg');
|
|
29
28
|
const iPhonePushMessagePhone = require('./assets/images/iPhonePushMessage.svg');
|
|
30
29
|
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';
|
|
32
30
|
|
|
33
31
|
class TemplatePreview extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
34
32
|
getWechatAndroidPreview = (content) => (
|
|
@@ -351,36 +349,35 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
351
349
|
selectedSticker = {
|
|
352
350
|
stickerUrl: lineStickerPlaceholder,
|
|
353
351
|
},
|
|
354
|
-
imageCarousel = [lineImgPlaceholder],
|
|
355
352
|
} = item || {};
|
|
356
|
-
|
|
357
|
-
background: CAP_WHITE,
|
|
358
|
-
color: FONT_COLOR_01,
|
|
359
|
-
borderRadius: 8,
|
|
360
|
-
position: 'static',
|
|
361
|
-
margin: '6px 0 20px 28px',
|
|
362
|
-
height: 'auto',
|
|
363
|
-
minHeight: 'auto',
|
|
364
|
-
overflow: 'initial',
|
|
365
|
-
maxHeight: 'initial',
|
|
366
|
-
};
|
|
367
|
-
if (type === TEXT) {
|
|
353
|
+
if (type === 'text') {
|
|
368
354
|
return (
|
|
369
355
|
<div
|
|
370
356
|
className="message-pop align-left"
|
|
371
|
-
style={
|
|
357
|
+
style={{
|
|
358
|
+
background: CAP_WHITE,
|
|
359
|
+
color: FONT_COLOR_01,
|
|
360
|
+
borderRadius: 8,
|
|
361
|
+
position: 'static',
|
|
362
|
+
margin: '6px 0 20px 28px',
|
|
363
|
+
height: 'auto'
|
|
364
|
+
}}
|
|
372
365
|
>
|
|
373
366
|
<p style={{ marginBottom: 5 }}>{messageContent || ''}</p>
|
|
374
367
|
</div>
|
|
375
368
|
);
|
|
376
369
|
}
|
|
377
|
-
if ((type ===
|
|
370
|
+
if ((type === 'image' && previewImageUrl)) {
|
|
378
371
|
return (
|
|
379
372
|
<div
|
|
380
373
|
className="message-pop align-left"
|
|
381
374
|
style={{
|
|
382
|
-
|
|
383
|
-
|
|
375
|
+
background: CAP_G08,
|
|
376
|
+
color: FONT_COLOR_01,
|
|
377
|
+
borderRadius: 8,
|
|
378
|
+
position: 'static',
|
|
379
|
+
margin: '6px 0 20px 28px',
|
|
380
|
+
height: 184,
|
|
384
381
|
display: 'flex',
|
|
385
382
|
justifyContent: 'center',
|
|
386
383
|
alignItems: 'center',
|
|
@@ -399,13 +396,17 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
399
396
|
</div>
|
|
400
397
|
);
|
|
401
398
|
}
|
|
402
|
-
if ((type ===
|
|
399
|
+
if ((type === 'imageMap' && baseUrl)) {
|
|
403
400
|
return (
|
|
404
401
|
<div
|
|
405
402
|
className="message-pop align-left"
|
|
406
403
|
style={{
|
|
407
|
-
|
|
408
|
-
|
|
404
|
+
background: CAP_G08,
|
|
405
|
+
color: FONT_COLOR_01,
|
|
406
|
+
borderRadius: 8,
|
|
407
|
+
position: 'static',
|
|
408
|
+
margin: '6px 0 20px 28px',
|
|
409
|
+
height: 184,
|
|
409
410
|
display: 'flex',
|
|
410
411
|
justifyContent: 'center',
|
|
411
412
|
alignItems: 'center',
|
|
@@ -424,13 +425,16 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
424
425
|
</div>
|
|
425
426
|
);
|
|
426
427
|
}
|
|
427
|
-
if (type ===
|
|
428
|
+
if (type === 'sticker' && selectedSticker) {
|
|
428
429
|
return (
|
|
429
430
|
<div
|
|
430
431
|
className="message-pop align-left"
|
|
431
432
|
style={{
|
|
432
|
-
...sectionStyle,
|
|
433
433
|
background: 'transparent',
|
|
434
|
+
color: FONT_COLOR_01,
|
|
435
|
+
color: FONT_COLOR_01,
|
|
436
|
+
position: 'static',
|
|
437
|
+
margin: '6px 0 20px 28px',
|
|
434
438
|
display: 'flex',
|
|
435
439
|
justifyContent: 'center',
|
|
436
440
|
alignItems: 'center',
|
|
@@ -452,17 +456,6 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
452
456
|
</div>
|
|
453
457
|
);
|
|
454
458
|
}
|
|
455
|
-
if ((type === IMAGE_CAROUSEL || type === TEMPLATE) && imageCarousel) {
|
|
456
|
-
return (
|
|
457
|
-
<div
|
|
458
|
-
style={{
|
|
459
|
-
margin: '40px 0 8px',
|
|
460
|
-
}}
|
|
461
|
-
>
|
|
462
|
-
<Carousel imageCarousel={imageCarousel}/>
|
|
463
|
-
</div>
|
|
464
|
-
)
|
|
465
|
-
}
|
|
466
459
|
return null;
|
|
467
460
|
})
|
|
468
461
|
}
|
package/config/app.js
CHANGED
|
@@ -14,7 +14,7 @@ const config = {
|
|
|
14
14
|
accountConfig: (strs, accountId) => `${window.location.origin}/org/config/AccountAdd?q=a&channelId=2&accountId=${accountId}&edit=1`,
|
|
15
15
|
},
|
|
16
16
|
development: {
|
|
17
|
-
api_endpoint: '
|
|
17
|
+
api_endpoint: 'http://localhost:2022/arya/api/v1/creatives',
|
|
18
18
|
campaigns_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/campaigns',
|
|
19
19
|
auth_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/auth',
|
|
20
20
|
arya_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1',
|
|
@@ -82,9 +82,9 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
82
82
|
console.log('Inside ', tag.label);
|
|
83
83
|
mainTags[tag.value] = {
|
|
84
84
|
'tag-header': true,
|
|
85
|
-
name: tag.label[this.props.userLocale] ? tag.label[this.props.userLocale] : tag.label.en,
|
|
86
|
-
desc: tag.desc ? tag.desc : tag.label.en,
|
|
87
|
-
subtags: tag.subtags,
|
|
85
|
+
"name": tag.label[this.props.userLocale] ? tag.label[this.props.userLocale] : tag.label.en,
|
|
86
|
+
"desc": tag.desc ? tag.desc : tag.label.en,
|
|
87
|
+
"subtags": tag.subtags,
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
});
|
package/index.html
CHANGED
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
<meta http-equiv="Pragma" content="no-cache" />
|
|
12
12
|
<meta http-equiv="Expires" content="0" />
|
|
13
13
|
<script src="https://use.typekit.net/ifw1ntv.js"></script>
|
|
14
|
+
|
|
15
|
+
<script src="https://app-rsrc.getbee.io/plugin/BeePlugin.js" type="text/javascript"></script>
|
|
16
|
+
<!-- Roboto Font -->
|
|
17
|
+
<link href="https://fonts.googleapis.com/css?family=Roboto:400,500" rel="stylesheet">
|
|
18
|
+
|
|
14
19
|
<!-- Google Tag Manager -->
|
|
15
20
|
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
|
16
21
|
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capillarytech/creatives-library",
|
|
3
3
|
"author": "meharaj",
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.9.1",
|
|
5
5
|
"description": "Capillary creatives ui",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"module": "./index.es.js",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"@bugsnag/js": "^7.2.1",
|
|
17
17
|
"@bugsnag/plugin-react": "^7.2.1",
|
|
18
18
|
"@capillarytech/cap-ui-utils": "1.2.6",
|
|
19
|
+
"@mailupinc/bee-plugin": "^1.2.0",
|
|
19
20
|
"babel-cli": "^6.26.0",
|
|
20
21
|
"chalk": "1.1.3",
|
|
21
22
|
"jquery": "^3.3.1",
|
package/services/api.js
CHANGED
|
@@ -319,23 +319,38 @@ export const getCmsTemplateSettings = (cmsType, projectId, cmsMode, langId, isEd
|
|
|
319
319
|
return API.get(url);
|
|
320
320
|
};
|
|
321
321
|
|
|
322
|
+
export const getCmsTemplateSettingsV2 = (cmsType, projectId, cmsMode, langId, isEdmSupport) => {
|
|
323
|
+
const url = `${API_ENDPOINT}/cms/v2/getDetails/?type=${cmsType}&projectId=${projectId}&cmsMode=${cmsMode}&langId=${langId}&isEdmSupport=${isEdmSupport ? 1 : 0}`;
|
|
324
|
+
return API.get(url);
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
|
|
322
328
|
export const getCmsTemplateData = (cmsType, projectId, langId) => {
|
|
323
329
|
const url = `${API_ENDPOINT}/cms/getContent?type=${cmsType}&projectId=${projectId}&langId=${langId}`;
|
|
324
330
|
return API.get(url);
|
|
325
331
|
};
|
|
326
332
|
|
|
333
|
+
export const getCmsTemplateDataV2 = (cmsType, projectId, langId) => {
|
|
334
|
+
const url = `${API_ENDPOINT}/cms/v2/getContent?type=${cmsType}&projectId=${projectId}&langId=${langId}`;
|
|
335
|
+
return API.get(url);
|
|
336
|
+
};
|
|
337
|
+
|
|
327
338
|
export const getCmsData = (cmsType, projectId, langId) => {
|
|
328
339
|
const url = `${API_ENDPOINT}/cms/getCmsData?type=${cmsType}&projectId=${projectId}&langId=${langId}`;
|
|
329
340
|
return API.get(url);
|
|
330
341
|
};
|
|
331
342
|
|
|
332
|
-
|
|
333
343
|
export const getEdmTemplates = () => {
|
|
334
344
|
console.log('in api.js');
|
|
335
345
|
const url = `${API_ENDPOINT}/templates/email/default`;
|
|
336
346
|
return request(url, getAPICallObject('GET'));
|
|
337
347
|
};
|
|
338
348
|
|
|
349
|
+
export const getDefaultBeeTemplates = () => {
|
|
350
|
+
const url = `${API_ENDPOINT}/templates/v2/email/default`;
|
|
351
|
+
return request(url, getAPICallObject('GET'));
|
|
352
|
+
}
|
|
353
|
+
|
|
339
354
|
// All about line
|
|
340
355
|
|
|
341
356
|
export const createLineTemplate = ({template}) => {
|
|
@@ -0,0 +1,278 @@
|
|
|
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 = [];
|
|
44
|
+
const [visibleTaglist, setVisibleTaglist] = useState(false);
|
|
45
|
+
const [showRowMetaModal, setRowMetaModal] = useState(false);
|
|
46
|
+
const [selectedTag, setSelectedTag] = useState({});
|
|
47
|
+
const [rowMetaInfo, setRowMetaInfo] = useState({});
|
|
48
|
+
const [rowName, setRowName] = useState('');
|
|
49
|
+
const [rowTags, setRowTags] = useState('');
|
|
50
|
+
const [rowCategory, setRowCategory] = useState('');
|
|
51
|
+
|
|
52
|
+
const savedCallback = useRef();
|
|
53
|
+
const filteredTags = (tags || []).filter((obj) => obj.definition.value !== UNSUBSCRIBE);
|
|
54
|
+
let intervalTimer;
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
savedCallback.current = Object.keys(selectedTag).length > 0 ? selectedTag : rowMetaInfo;
|
|
58
|
+
}, [selectedTag, rowMetaInfo]);
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
const beeConfig = {
|
|
62
|
+
uid,
|
|
63
|
+
container: 'bee-plugin-container',
|
|
64
|
+
rowsConfiguration: {
|
|
65
|
+
emptyRows: true,
|
|
66
|
+
defaultRows: true,
|
|
67
|
+
},
|
|
68
|
+
contentDialog: {
|
|
69
|
+
specialLinks: {
|
|
70
|
+
label: UNSUBSCRIBE,
|
|
71
|
+
handler(resolve) {
|
|
72
|
+
resolve({
|
|
73
|
+
type: 'custom',
|
|
74
|
+
label: UNSUBSCRIBE,
|
|
75
|
+
link: `{{${UNSUBSCRIBE}}}`,
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
mergeTags: {
|
|
80
|
+
label: 'search',
|
|
81
|
+
handler: async (resolve, reject) => {
|
|
82
|
+
await setVisibleTaglist(true);
|
|
83
|
+
const promise = new Promise((resolveP) => {
|
|
84
|
+
intervalTimer = setInterval(() => {
|
|
85
|
+
if ((savedCallback.current || {}).close === true) {
|
|
86
|
+
reject();
|
|
87
|
+
clearInterval(intervalTimer);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (Object.keys(savedCallback.current || {}).length > 0) {
|
|
91
|
+
resolveP(savedCallback.current);
|
|
92
|
+
setSelectedTag({});
|
|
93
|
+
clearInterval(intervalTimer);
|
|
94
|
+
}
|
|
95
|
+
}, 2000);
|
|
96
|
+
});
|
|
97
|
+
const result = await promise;
|
|
98
|
+
resolve(result); // "done!"
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
saveRow: {
|
|
102
|
+
handler: async (resolve, reject, args) => {
|
|
103
|
+
await setRowMetaModal(true);
|
|
104
|
+
const promise = new Promise((resolveP) => {
|
|
105
|
+
intervalTimer = setInterval(() => {
|
|
106
|
+
if ((savedCallback.current || {}).close === true) {
|
|
107
|
+
reject();
|
|
108
|
+
clearInterval(intervalTimer);
|
|
109
|
+
setRowMetaInfo({});
|
|
110
|
+
setRowName('');
|
|
111
|
+
setRowTags('');
|
|
112
|
+
setRowCategory('');
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (Object.keys(savedCallback.current || {}).length > 0) {
|
|
116
|
+
const data = {...args, ...savedCallback.current};
|
|
117
|
+
resolveP(data);
|
|
118
|
+
}
|
|
119
|
+
}, 2000);
|
|
120
|
+
});
|
|
121
|
+
const result = await promise;
|
|
122
|
+
resolve(result); // "done!"
|
|
123
|
+
setRowMetaInfo({});
|
|
124
|
+
setRowName('');
|
|
125
|
+
setRowTags('');
|
|
126
|
+
setRowCategory('');
|
|
127
|
+
clearInterval(intervalTimer);
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
onSave: (jsonFile, htmlFile) => {
|
|
132
|
+
saveBeeData(jsonFile, htmlFile);
|
|
133
|
+
},
|
|
134
|
+
onSaveRows: (jsonFile, htmlFile) => {
|
|
135
|
+
console.log('bee-plugin-container onSaveRows', jsonFile, htmlFile);
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
window.BeePlugin.create(tokenData, beeConfig, (instance) => {
|
|
139
|
+
beePluginInstance = instance;
|
|
140
|
+
console.log('bee instance', beePluginInstance);
|
|
141
|
+
const parseJson = JSON.parse(beeJson);
|
|
142
|
+
beePluginInstance.start(parseJson);
|
|
143
|
+
saveBeeInstance(beePluginInstance);
|
|
144
|
+
});
|
|
145
|
+
return () => clearInterval(intervalTimer);
|
|
146
|
+
}, []);
|
|
147
|
+
|
|
148
|
+
const onTagSelect = (result) => {
|
|
149
|
+
const msg = {
|
|
150
|
+
name: result,
|
|
151
|
+
value: `{{${result}}}`,
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
setSelectedTag(msg);
|
|
155
|
+
setVisibleTaglist(false);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const onCancelTagList = () => {
|
|
159
|
+
setVisibleTaglist(false);
|
|
160
|
+
setSelectedTag({close: true});
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const handleCancel = () => {
|
|
164
|
+
setRowMetaModal(false);
|
|
165
|
+
setRowMetaInfo({close: true});
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const handleOk = () => {
|
|
169
|
+
console.log('handleOk');
|
|
170
|
+
const rowInfo = {};
|
|
171
|
+
if (rowTags !== '') {
|
|
172
|
+
rowInfo.tags = rowTags;
|
|
173
|
+
}
|
|
174
|
+
if (rowCategory !== '') {
|
|
175
|
+
rowInfo.category = rowCategory;
|
|
176
|
+
}
|
|
177
|
+
setRowMetaInfo({
|
|
178
|
+
name: rowName,
|
|
179
|
+
...rowInfo,
|
|
180
|
+
});
|
|
181
|
+
setRowMetaModal(false);
|
|
182
|
+
// set rowMetaInfo
|
|
183
|
+
};
|
|
184
|
+
const isDisableSave = () => rowName === '';
|
|
185
|
+
|
|
186
|
+
const onRowChange = useCallback((e) => {
|
|
187
|
+
setRowName(e.target.value);
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
const onChangeCategoy = (e) => {
|
|
191
|
+
console.log('onChangeCategoy', e);
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const onTagChange = (e) => {
|
|
195
|
+
setRowTags(e.target.value);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const contentSection = <>
|
|
199
|
+
<CapInput
|
|
200
|
+
label={<FormattedMessage {...messages.rowName} />}
|
|
201
|
+
placeholder={formatMessage(messages.rowPlaceHolder)}
|
|
202
|
+
onChange={onRowChange}
|
|
203
|
+
value={rowName}
|
|
204
|
+
maxLength={50}
|
|
205
|
+
style={{ width: '324px', paddingBottom: '16px' }}
|
|
206
|
+
/>
|
|
207
|
+
<CapSelect
|
|
208
|
+
label="Category"
|
|
209
|
+
style={{ width: 250, paddingBottom: '16px'}}
|
|
210
|
+
options={categoryOptions}
|
|
211
|
+
selectPlaceholder={formatMessage(messages.select)}
|
|
212
|
+
placeholder={
|
|
213
|
+
<FormattedMessage {...messages.selectCategoyPlaceholder} />
|
|
214
|
+
}
|
|
215
|
+
onChange={onChangeCategoy}
|
|
216
|
+
/>
|
|
217
|
+
<CapInput
|
|
218
|
+
label={<FormattedMessage {...messages.tags} />}
|
|
219
|
+
placeholder={formatMessage(messages.tagPlaceHolder)}
|
|
220
|
+
onChange={onTagChange}
|
|
221
|
+
value={rowTags}
|
|
222
|
+
maxLength={50}
|
|
223
|
+
style={{ width: '324px', paddingBottom: '16px'}}
|
|
224
|
+
/>
|
|
225
|
+
</>;
|
|
226
|
+
return (
|
|
227
|
+
<>
|
|
228
|
+
<div id="bee-plugin-container" style={{ height: '500px'}}>
|
|
229
|
+
|
|
230
|
+
</div>
|
|
231
|
+
<TagList
|
|
232
|
+
moduleFilterEnabled={moduleFilterEnabled}
|
|
233
|
+
label={label}
|
|
234
|
+
onTagSelect={onTagSelect}
|
|
235
|
+
location={location}
|
|
236
|
+
tags={filteredTags}
|
|
237
|
+
injectedTags={injectedTags}
|
|
238
|
+
className={className}
|
|
239
|
+
id={id}
|
|
240
|
+
userLocale={userLocale}
|
|
241
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
242
|
+
visibleTaglist={visibleTaglist}
|
|
243
|
+
hidePopover
|
|
244
|
+
modalProps={
|
|
245
|
+
{
|
|
246
|
+
onCancel: onCancelTagList,
|
|
247
|
+
style: { left: 200, top: 250 },
|
|
248
|
+
className: "bee-editor-tag-list"
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
onContextChange={onContextChange}
|
|
252
|
+
/>
|
|
253
|
+
<CapModal
|
|
254
|
+
visible={showRowMetaModal}
|
|
255
|
+
onCancel={handleCancel}
|
|
256
|
+
title={formatMessage(messages.customRows)}
|
|
257
|
+
footer={[
|
|
258
|
+
<CapButton key="back" onClick={handleCancel}>{formatMessage(messages.cancel)}</CapButton>,
|
|
259
|
+
<CapButton key="submit" type="primary" id="delete-version" onClick={handleOk} disabled={isDisableSave()}>
|
|
260
|
+
{formatMessage(messages.save)}
|
|
261
|
+
</CapButton>,
|
|
262
|
+
]}
|
|
263
|
+
>
|
|
264
|
+
{contentSection}
|
|
265
|
+
</CapModal>
|
|
266
|
+
</>
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
BeeEditor.propTypes = {
|
|
271
|
+
beeJson: PropTypes.object.isRequired,
|
|
272
|
+
tokenData: PropTypes.object.isRequired,
|
|
273
|
+
uid: PropTypes.string.isRequired,
|
|
274
|
+
showTagsPopover: PropTypes.func.isRequired,
|
|
275
|
+
intl: intlShape.isRequired,
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
export default injectIntl(BeeEditor);
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
});
|