@capillarytech/creatives-library 6.11.5 → 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/app.js +3 -3
- 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/config/app.js +2 -2
- package/containers/Cap/sagas.js +2 -3
- package/index.js +0 -5
- package/package.json +4 -4
- package/services/getSchema.js +0 -3
- package/translations/en.json +14 -15
- package/translations/zh.json +14 -15
- 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/BeeEditor/index.js +1 -1
- package/v2Containers/Cap/actions.js +1 -1
- package/v2Containers/Cap/constants.js +3 -3
- package/v2Containers/Cap/reducer.js +3 -3
- package/v2Containers/Cap/sagas.js +8 -8
- 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/LanguageProvider/index.js +1 -1
- 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
package/app.js
CHANGED
|
@@ -37,7 +37,7 @@ const history = syncHistoryWithStore(browserHistory, store, {
|
|
|
37
37
|
selectLocationState: makeSelectLocationState(),
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
const bugSnagErrorCallback = event => {
|
|
40
|
+
const bugSnagErrorCallback = (event) => {
|
|
41
41
|
let userId;
|
|
42
42
|
let userName;
|
|
43
43
|
let userEmail;
|
|
@@ -66,7 +66,7 @@ const bugSnagErrorCallback = event => {
|
|
|
66
66
|
event.addMetadata('org', {
|
|
67
67
|
name: orgName,
|
|
68
68
|
id: orgId,
|
|
69
|
-
})
|
|
69
|
+
});
|
|
70
70
|
event.setUser(userId, userEmail, userName);
|
|
71
71
|
};
|
|
72
72
|
|
|
@@ -87,7 +87,7 @@ export const BugsnagClient = Bugsnag;
|
|
|
87
87
|
const rootRoute = {
|
|
88
88
|
component: (props) => {
|
|
89
89
|
// eslint-disable-next-line react/prop-types
|
|
90
|
-
if (props.location.pathname === 'v2') {
|
|
90
|
+
if (props.location.pathname === 'v2' || props.location.pathname === 'v2/') {
|
|
91
91
|
return <CapV2 {...props} />;
|
|
92
92
|
}
|
|
93
93
|
return <Cap {...props} />;
|
|
@@ -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/config/app.js
CHANGED
|
@@ -7,7 +7,7 @@ const config = {
|
|
|
7
7
|
campaigns_api_endpoint: '/iris/v2/campaigns',
|
|
8
8
|
auth_endpoint: '/arya/api/v1/auth',
|
|
9
9
|
arya_endpoint: '/arya/api/v1',
|
|
10
|
-
login_url: 'auth/login',
|
|
10
|
+
login_url: '/auth/login',
|
|
11
11
|
dashboard_url: '/sms',
|
|
12
12
|
dashboard_url_v2: '/v2',
|
|
13
13
|
subscription_api_endpoint: '/arya/api/v1/org-settings/subscription',
|
|
@@ -19,7 +19,7 @@ const config = {
|
|
|
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',
|
|
21
21
|
subscription_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/org-settings/subscription',
|
|
22
|
-
login_url: 'auth/login',
|
|
22
|
+
login_url: '/auth/login',
|
|
23
23
|
dashboard_url: '/sms',
|
|
24
24
|
dashboard_url_v2: '/v2',
|
|
25
25
|
},
|
package/containers/Cap/sagas.js
CHANGED
|
@@ -5,7 +5,6 @@ import * as Api from '../../services/api';
|
|
|
5
5
|
import * as LocalStorage from '../../services/localStorageApi';
|
|
6
6
|
import * as types from './constants';
|
|
7
7
|
import config from '../../config/app';
|
|
8
|
-
import pathConfig from '../../config/path';
|
|
9
8
|
// import {makeSelectOrgId} from './selectors';
|
|
10
9
|
|
|
11
10
|
function* authorize(user) {
|
|
@@ -56,13 +55,13 @@ function* logoutFlow() {
|
|
|
56
55
|
const serverLogout = yield call(Api.logout);
|
|
57
56
|
if (serverLogout.success && serverLogout.success === true) {
|
|
58
57
|
const loginUrl = (process.env.NODE_ENV === 'production') ?
|
|
59
|
-
`${
|
|
58
|
+
`${config.production.login_url}` : `${config.development.login_url}`;
|
|
60
59
|
yield [put({type: types.LOGOUT_SUCCESS})];
|
|
61
60
|
yield call(LocalStorage.clearItem, 'token');
|
|
62
61
|
yield call(LocalStorage.clearItem, 'orgID');
|
|
63
62
|
yield call(LocalStorage.clearItem, 'user');
|
|
64
63
|
yield call(LocalStorage.clearItem, 'isLoggedIn');
|
|
65
|
-
window.location.href = loginUrl
|
|
64
|
+
window.location.href = `${window.location.origin}${loginUrl}`;
|
|
66
65
|
}
|
|
67
66
|
} catch (error) {
|
|
68
67
|
yield put({ type: types.LOGOUT_FAILURE, error });
|
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
|
}
|
package/translations/en.json
CHANGED
|
@@ -86,21 +86,6 @@
|
|
|
86
86
|
"creatives.components.WechatRichmediaTemplatePreview.header": "This is the WechatRichmediaTemplatePreview component !",
|
|
87
87
|
"creatives.components.WechatRichmediaTemplatePreview.reply": "Reply",
|
|
88
88
|
"creatives.components.WechatRichmediaTemplatePreview.select": "Select",
|
|
89
|
-
"creatives.componentsV2.BeeEditor.addLabel": "Add label",
|
|
90
|
-
"creatives.componentsV2.BeeEditor.cancel": "Cancel",
|
|
91
|
-
"creatives.componentsV2.BeeEditor.cta": "CTA",
|
|
92
|
-
"creatives.componentsV2.BeeEditor.customRows": "Custom rows",
|
|
93
|
-
"creatives.componentsV2.BeeEditor.footer": "Footer",
|
|
94
|
-
"creatives.componentsV2.BeeEditor.header": "Header",
|
|
95
|
-
"creatives.componentsV2.BeeEditor.others": "Others",
|
|
96
|
-
"creatives.componentsV2.BeeEditor.rowName": "Row name",
|
|
97
|
-
"creatives.componentsV2.BeeEditor.rowPlaceHolder": "Enter Row name",
|
|
98
|
-
"creatives.componentsV2.BeeEditor.save": "Save",
|
|
99
|
-
"creatives.componentsV2.BeeEditor.select": "Select",
|
|
100
|
-
"creatives.componentsV2.BeeEditor.selectCategoyPlaceholder": "Select category",
|
|
101
|
-
"creatives.componentsV2.BeeEditor.socialPlatform": "Social platform",
|
|
102
|
-
"creatives.componentsV2.BeeEditor.tagPlaceHolder": "Enter tags",
|
|
103
|
-
"creatives.componentsV2.BeeEditor.tags": "Tags (optional)",
|
|
104
89
|
"creatives.componentsV2.BreadCrumbs.header": "This is the BreadCrumbs component !",
|
|
105
90
|
"creatives.componentsV2.CallTaskPreview.header": "This is the CallTaskPreview component !",
|
|
106
91
|
"creatives.componentsV2.CapTagList.Cancel": "Cancel",
|
|
@@ -793,6 +778,20 @@
|
|
|
793
778
|
"creatives.containersV2.Assets.Gallery.uploadedAt": "Uploaded at",
|
|
794
779
|
"creatives.containersV2.Assets.Gallery.uploadedBy": "Uploaded by",
|
|
795
780
|
"creatives.containersV2.Assets.Gallery.uploadedOn": "Uploaded on",
|
|
781
|
+
"creatives.containersV2.BeeEditor.addLabel": "Add label",
|
|
782
|
+
"creatives.containersV2.BeeEditor.cta": "CTA",
|
|
783
|
+
"creatives.containersV2.BeeEditor.customRows": "Create new row",
|
|
784
|
+
"creatives.containersV2.BeeEditor.done": "Done",
|
|
785
|
+
"creatives.containersV2.BeeEditor.footer": "Footer",
|
|
786
|
+
"creatives.containersV2.BeeEditor.header": "Header",
|
|
787
|
+
"creatives.containersV2.BeeEditor.others": "Others",
|
|
788
|
+
"creatives.containersV2.BeeEditor.rowCreationFailureMgs": "Error in row creation",
|
|
789
|
+
"creatives.containersV2.BeeEditor.rowCreationSuccessMgs": "Row created successfully",
|
|
790
|
+
"creatives.containersV2.BeeEditor.rowName": "Row name",
|
|
791
|
+
"creatives.containersV2.BeeEditor.rowPlaceHolder": "Enter Row name",
|
|
792
|
+
"creatives.containersV2.BeeEditor.select": "Select",
|
|
793
|
+
"creatives.containersV2.BeeEditor.selectCategoyPlaceholder": "Select category",
|
|
794
|
+
"creatives.containersV2.BeeEditor.socialPlatform": "Social platform",
|
|
796
795
|
"creatives.containersV2.CallTask.addNewCallTask": "Add new call task",
|
|
797
796
|
"creatives.containersV2.CallTask.callTaskInfo": "Call Tasks are message sent to store staff. The messages are displayed on the Point of Sale (POS) machines for store staff to take action.",
|
|
798
797
|
"creatives.containersV2.CallTask.callTaskTitleIllustartion": "Create a Call Task {templateText}",
|
package/translations/zh.json
CHANGED
|
@@ -86,21 +86,6 @@
|
|
|
86
86
|
"creatives.components.WechatRichmediaTemplatePreview.header": "",
|
|
87
87
|
"creatives.components.WechatRichmediaTemplatePreview.reply": "",
|
|
88
88
|
"creatives.components.WechatRichmediaTemplatePreview.select": "",
|
|
89
|
-
"creatives.componentsV2.BeeEditor.addLabel": "",
|
|
90
|
-
"creatives.componentsV2.BeeEditor.cancel": "",
|
|
91
|
-
"creatives.componentsV2.BeeEditor.cta": "",
|
|
92
|
-
"creatives.componentsV2.BeeEditor.customRows": "",
|
|
93
|
-
"creatives.componentsV2.BeeEditor.footer": "",
|
|
94
|
-
"creatives.componentsV2.BeeEditor.header": "",
|
|
95
|
-
"creatives.componentsV2.BeeEditor.others": "",
|
|
96
|
-
"creatives.componentsV2.BeeEditor.rowName": "",
|
|
97
|
-
"creatives.componentsV2.BeeEditor.rowPlaceHolder": "",
|
|
98
|
-
"creatives.componentsV2.BeeEditor.save": "",
|
|
99
|
-
"creatives.componentsV2.BeeEditor.select": "",
|
|
100
|
-
"creatives.componentsV2.BeeEditor.selectCategoyPlaceholder": "",
|
|
101
|
-
"creatives.componentsV2.BeeEditor.socialPlatform": "",
|
|
102
|
-
"creatives.componentsV2.BeeEditor.tagPlaceHolder": "",
|
|
103
|
-
"creatives.componentsV2.BeeEditor.tags": "",
|
|
104
89
|
"creatives.componentsV2.BreadCrumbs.header": "",
|
|
105
90
|
"creatives.componentsV2.CallTaskPreview.header": "",
|
|
106
91
|
"creatives.componentsV2.CapTagList.Cancel": "",
|
|
@@ -793,6 +778,20 @@
|
|
|
793
778
|
"creatives.containersV2.Assets.Gallery.uploadedAt": "",
|
|
794
779
|
"creatives.containersV2.Assets.Gallery.uploadedBy": "",
|
|
795
780
|
"creatives.containersV2.Assets.Gallery.uploadedOn": "",
|
|
781
|
+
"creatives.containersV2.BeeEditor.addLabel": "",
|
|
782
|
+
"creatives.containersV2.BeeEditor.cta": "",
|
|
783
|
+
"creatives.containersV2.BeeEditor.customRows": "",
|
|
784
|
+
"creatives.containersV2.BeeEditor.done": "",
|
|
785
|
+
"creatives.containersV2.BeeEditor.footer": "",
|
|
786
|
+
"creatives.containersV2.BeeEditor.header": "",
|
|
787
|
+
"creatives.containersV2.BeeEditor.others": "",
|
|
788
|
+
"creatives.containersV2.BeeEditor.rowCreationFailureMgs": "",
|
|
789
|
+
"creatives.containersV2.BeeEditor.rowCreationSuccessMgs": "",
|
|
790
|
+
"creatives.containersV2.BeeEditor.rowName": "",
|
|
791
|
+
"creatives.containersV2.BeeEditor.rowPlaceHolder": "",
|
|
792
|
+
"creatives.containersV2.BeeEditor.select": "",
|
|
793
|
+
"creatives.containersV2.BeeEditor.selectCategoyPlaceholder": "",
|
|
794
|
+
"creatives.containersV2.BeeEditor.socialPlatform": "",
|
|
796
795
|
"creatives.containersV2.CallTask.addNewCallTask": "",
|
|
797
796
|
"creatives.containersV2.CallTask.callTaskInfo": "",
|
|
798
797
|
"creatives.containersV2.CallTask.callTaskTitleIllustartion": "",
|
|
@@ -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);
|