@capillarytech/creatives-library 7.0.0 → 7.0.4
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/index.js +8 -1
- package/package.json +2 -1
- package/reducers.js +2 -0
- package/routes.js +7 -1
- package/services/api.js +5 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +8 -2
- package/v2Components/TemplatePreview/assets/images/viberMobile.svg +135 -0
- package/v2Components/TemplatePreview/index.js +104 -18
- package/v2Containers/App/constants.js +1 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +65 -2
- package/v2Containers/CreativesContainer/constants.js +2 -0
- package/v2Containers/CreativesContainer/index.js +38 -4
- package/v2Containers/Templates/_templates.scss +57 -0
- package/v2Containers/Templates/actions.js +117 -110
- package/v2Containers/Templates/constants.js +2 -0
- package/v2Containers/Templates/index.js +89 -7
- package/v2Containers/Templates/messages.js +4 -0
- package/v2Containers/Templates/reducer.js +2 -0
- package/v2Containers/TemplatesV2/index.js +9 -1
- package/v2Containers/TemplatesV2/messages.js +4 -0
- package/v2Containers/Viber/index.js +18 -6
- package/v2Containers/Viber/messages.js +8 -0
- package/v2Components/TemplatePreview/assets/images/mobile.svg +0 -24
- package/v2Containers/Viber/_viber.scss +0 -3
|
@@ -22,6 +22,7 @@ import * as actions from './actions';
|
|
|
22
22
|
import Templates from '../Templates';
|
|
23
23
|
import CallTask from '../CallTask';
|
|
24
24
|
import Facebook from '../Facebook';
|
|
25
|
+
import Viber from '../Viber';
|
|
25
26
|
import Line from '../Line/Container';
|
|
26
27
|
import Gallery from '../Assets/Gallery';
|
|
27
28
|
import withStyles from '../../hoc/withStyles';
|
|
@@ -52,6 +53,8 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
52
53
|
//'wechat': {content: this.getTemplatesComponent('wechat'), tab: 'Wechat', key: 'wechat'},
|
|
53
54
|
mPush: {content: <></>, tab: intl.formatMessage(messages.pushNotification), key: 'mobilepush'},
|
|
54
55
|
line: {content: <></>, tab: intl.formatMessage(messages.line), key: 'line'},
|
|
56
|
+
viber: {content: <></>, tab: intl.formatMessage(messages.viber), key: 'viber'},
|
|
57
|
+
|
|
55
58
|
|
|
56
59
|
};
|
|
57
60
|
let filteredPanes = Object.keys(defaultPanes)
|
|
@@ -152,7 +155,12 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
152
155
|
/>
|
|
153
156
|
);
|
|
154
157
|
}
|
|
155
|
-
|
|
158
|
+
getViberComponent =() => (
|
|
159
|
+
<Viber
|
|
160
|
+
{...this.props}
|
|
161
|
+
isCreateFlow
|
|
162
|
+
></Viber>
|
|
163
|
+
)
|
|
156
164
|
getLineComponent = () => (
|
|
157
165
|
<Line
|
|
158
166
|
{...this.props}
|
|
@@ -46,6 +46,10 @@ export default defineMessages({
|
|
|
46
46
|
id: 'creatives.containersV2.TemplatesV2.facebook',
|
|
47
47
|
defaultMessage: 'Facebook',
|
|
48
48
|
},
|
|
49
|
+
viber: {
|
|
50
|
+
id: 'creatives.containersV2.TemplatesV2.viber',
|
|
51
|
+
defaultMessage: 'Viber',
|
|
52
|
+
},
|
|
49
53
|
gallery: {
|
|
50
54
|
id: 'creatives.containersV2.TemplatesV2.gallery',
|
|
51
55
|
defaultMessage: 'Gallery',
|
|
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
|
|
|
2
2
|
import { bindActionCreators } from 'redux';
|
|
3
3
|
import { createStructuredSelector } from 'reselect';
|
|
4
4
|
import { injectIntl, FormattedMessage } from 'react-intl';
|
|
5
|
-
|
|
5
|
+
import { isUrl } from '../Line/Container/Wrapper/utils';
|
|
6
6
|
import { get } from 'lodash';
|
|
7
7
|
import withCreatives from '../../hoc/withCreatives';
|
|
8
8
|
import {
|
|
@@ -84,6 +84,7 @@ const Viber = (props) => {
|
|
|
84
84
|
const [isEditFlow, checkEditFlow] = useState(false);
|
|
85
85
|
const [messageTitle, updateTextMessageTitle] = useState('');
|
|
86
86
|
const [errorMessageTitle, updateErrorMessageTitle] = useState(false);
|
|
87
|
+
const [buttonURLErrorMessage, updateButtonURLErrorMessage] = useState(false);
|
|
87
88
|
|
|
88
89
|
const StyledHeader = styled(CapHeader)`
|
|
89
90
|
margin-bottom: 14px;
|
|
@@ -130,7 +131,7 @@ const Viber = (props) => {
|
|
|
130
131
|
}, [viber[`templateDetails`] || templateData]);
|
|
131
132
|
|
|
132
133
|
// Common container for TEXT, IMAGE and Button
|
|
133
|
-
const container = (icon, message, data) => (<CapRow
|
|
134
|
+
const container = (icon, message, data, showOptional) => (<CapRow
|
|
134
135
|
style={{
|
|
135
136
|
border: `solid 1px ${CAP_G07}`,
|
|
136
137
|
marginBottom: '20px',
|
|
@@ -138,7 +139,8 @@ const Viber = (props) => {
|
|
|
138
139
|
<CapRow style={{ padding: `${CAP_SPACE_12} ${CAP_SPACE_24} 0px` }}>
|
|
139
140
|
<CapIcon type={icon}/>
|
|
140
141
|
<CapHeading type="h4" style={{position: 'absolute', display: 'inline-block', top: '13px', paddingLeft: '10px'}}>
|
|
141
|
-
{message}
|
|
142
|
+
{message} {" "}
|
|
143
|
+
{showOptional && <CapLabel.CapLabelInline type="label14">{formatMessage(messages.optional)}</CapLabel.CapLabelInline>}
|
|
142
144
|
</CapHeading>
|
|
143
145
|
</CapRow>
|
|
144
146
|
<CapDivider className="cap-divider-margin"/>
|
|
@@ -481,7 +483,12 @@ const Viber = (props) => {
|
|
|
481
483
|
};
|
|
482
484
|
|
|
483
485
|
const onChangeButtonUrl = ({ target: { value } }) => {
|
|
486
|
+
let errorMessage = false;
|
|
484
487
|
updateButtonUrl(value);
|
|
488
|
+
if (!isUrl(value)) {
|
|
489
|
+
errorMessage = formatMessage(messages.inValidUrliErrorMessage);
|
|
490
|
+
}
|
|
491
|
+
updateButtonURLErrorMessage(errorMessage);
|
|
485
492
|
};
|
|
486
493
|
const getPreviewSection = () =>
|
|
487
494
|
// const accountName = get(lineData, 'selectedLineAccount.name', '');
|
|
@@ -509,6 +516,7 @@ const Viber = (props) => {
|
|
|
509
516
|
defaultValue={buttonURL}
|
|
510
517
|
value={buttonURL}
|
|
511
518
|
label={formatMessage(messages.buttonUrl)}
|
|
519
|
+
errorMessage={buttonURLErrorMessage}
|
|
512
520
|
/>
|
|
513
521
|
</>);
|
|
514
522
|
|
|
@@ -613,6 +621,10 @@ const Viber = (props) => {
|
|
|
613
621
|
if (( trimedButtonText === '' && trimedButtonUrl !== '') || ( trimedButtonUrl !== '' && trimedButtonUrl === '')) {
|
|
614
622
|
return true;
|
|
615
623
|
}
|
|
624
|
+
// if button url is not valid url
|
|
625
|
+
if (buttonURLErrorMessage) {
|
|
626
|
+
return true;
|
|
627
|
+
}
|
|
616
628
|
return false;
|
|
617
629
|
};
|
|
618
630
|
|
|
@@ -644,9 +656,9 @@ const Viber = (props) => {
|
|
|
644
656
|
)
|
|
645
657
|
: null
|
|
646
658
|
}
|
|
647
|
-
{container("message", <FormattedMessage {...messages.message} />, TextAreaViber)}
|
|
648
|
-
{container("image", <FormattedMessage {...messages.image} />, ImageViber)}
|
|
649
|
-
{container("button", <FormattedMessage {...messages.button} />, ButtonViber)}
|
|
659
|
+
{container("message", <FormattedMessage {...messages.message} />, TextAreaViber, false)}
|
|
660
|
+
{container("image", <FormattedMessage {...messages.image} />, ImageViber, true)}
|
|
661
|
+
{container("button", <FormattedMessage {...messages.button} />, ButtonViber, true)}
|
|
650
662
|
<div style={{marginBottom: '100px'}}/>
|
|
651
663
|
</CapColumn>
|
|
652
664
|
<CapColumn span={6}>
|
|
@@ -134,4 +134,12 @@ export default defineMessages({
|
|
|
134
134
|
id: `${scope}.emptyTitleErrorMessage`,
|
|
135
135
|
defaultMessage: 'Template title can not be empty',
|
|
136
136
|
},
|
|
137
|
+
optional: {
|
|
138
|
+
id: `${scope}.optional`,
|
|
139
|
+
defaultMessage: '(optional)',
|
|
140
|
+
},
|
|
141
|
+
inValidUrliErrorMessage: {
|
|
142
|
+
id: `${scope}.inValidUrliErrorMessage`,
|
|
143
|
+
defaultMessage: 'Button URL is not valid',
|
|
144
|
+
},
|
|
137
145
|
});
|