@capillarytech/creatives-library 7.0.5 → 7.0.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/package.json +1 -1
- package/v2Components/FormBuilder/index.js +4 -5
- package/v2Components/TemplatePreview/index.js +5 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +1 -1
- package/v2Containers/CreativesContainer/index.js +5 -4
- package/v2Containers/MobilePush/Create/sagas.js +4 -1
- package/v2Containers/Templates/_templates.scss +2 -2
- package/v2Containers/Templates/index.js +8 -5
- package/v2Containers/Viber/index.js +2 -2
- package/v2Containers/Viber/messages.js +0 -4
package/package.json
CHANGED
|
@@ -122,14 +122,13 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
122
122
|
}
|
|
123
123
|
if (nextProps.startValidation && nextProps.startValidation !== false && this.props.startValidation !== nextProps.startValidation) {
|
|
124
124
|
this.setState({checkValidation: true});
|
|
125
|
-
this.validateForm(null, null, true, true
|
|
125
|
+
this.validateForm(null, null, true, true);
|
|
126
126
|
//triggering the saveFormData or onSubmit when validation sets isFormValid to TRUE
|
|
127
|
-
|
|
127
|
+
if (this.state.isFormValid) {
|
|
128
128
|
this.saveForm(true);
|
|
129
|
-
|
|
129
|
+
this.setState({isFormValid:false});
|
|
130
|
+
}
|
|
130
131
|
this.props.stopValidation();
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
132
|
}
|
|
134
133
|
// if (nextProps.saveForm && this.props.saveForm !== nextProps.saveForm) {
|
|
135
134
|
// this.saveForm(saveForm);
|
|
@@ -614,13 +614,17 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
614
614
|
'background-color': CAP_PURPLE01,
|
|
615
615
|
"margin-top": '14px',
|
|
616
616
|
'text-align': 'center',
|
|
617
|
-
"width": '
|
|
617
|
+
"width": '143px',
|
|
618
618
|
"height": '20px',
|
|
619
619
|
"margin-left": "5px",
|
|
620
620
|
}}>
|
|
621
621
|
<p
|
|
622
622
|
style={{ 'font-size': '12px',
|
|
623
623
|
'font-weight': '500',
|
|
624
|
+
"display": '-webkit-box',
|
|
625
|
+
'-webkit-line-clamp': '1',
|
|
626
|
+
'-webkit-box-orient': 'vertical',
|
|
627
|
+
'overflow': 'hidden',
|
|
624
628
|
"color": CAP_WHITE }}
|
|
625
629
|
>
|
|
626
630
|
{buttonText || ''}</p>
|
|
@@ -292,7 +292,7 @@ function SlideBoxContent(props) {
|
|
|
292
292
|
<TemplatePreview
|
|
293
293
|
content={getChannelPreviewContent(templateData)}
|
|
294
294
|
viberBrandName={selectedAccount || ""}
|
|
295
|
-
viberAccountName={selectedAccount[0]}
|
|
295
|
+
viberAccountName={(selectedAccount || "")[0]}
|
|
296
296
|
unicodeEnabled={get(templateData, `versions.base['unicode-validity']`)}
|
|
297
297
|
channel={(templateData.type || '').toLowerCase()}
|
|
298
298
|
charCounterEnabled={channel === constants.SMS}
|
|
@@ -351,10 +351,11 @@ class Creatives extends React.Component {
|
|
|
351
351
|
break;
|
|
352
352
|
case constants.VIBER:
|
|
353
353
|
if (template.value) {
|
|
354
|
-
const { Templates
|
|
354
|
+
const { Templates, templateData: templateDataProps } = this.props;
|
|
355
|
+
const { accountDetails: selectedAccountDetails, accountId: selectedAccountId } = templateDataProps || {};
|
|
355
356
|
const selectedViberAccount = Templates && Templates.selectedViberAccount;
|
|
356
|
-
const accountDetails = selectedViberAccount ? JSON.stringify(selectedViberAccount) : '';
|
|
357
|
-
const accountId = selectedViberAccount ? selectedViberAccount.id : '';
|
|
357
|
+
const accountDetails = selectedAccountDetails || (selectedViberAccount ? JSON.stringify(selectedViberAccount) : '');
|
|
358
|
+
const accountId = selectedAccountId || (selectedViberAccount ? selectedViberAccount.id : '');
|
|
358
359
|
const { versions } = template.value;
|
|
359
360
|
const content = cloneDeep(versions.base.content);
|
|
360
361
|
content.scenarioKey = get(accountDetails, 'configs.scenario_key');
|
|
@@ -709,4 +710,4 @@ function mapDispatchToProps(dispatch) {
|
|
|
709
710
|
actions: bindActionCreators(actions, dispatch),
|
|
710
711
|
};
|
|
711
712
|
}
|
|
712
|
-
export default connect(mapStatesToProps, mapDispatchToProps)(injectIntl(Creatives));
|
|
713
|
+
export default connect(mapStatesToProps, mapDispatchToProps)(injectIntl(Creatives));
|
|
@@ -11,8 +11,11 @@ export function* createTemplate(template) {
|
|
|
11
11
|
try {
|
|
12
12
|
console.log('saga createTemplate mobilepush', template);
|
|
13
13
|
const result = yield call(Api.createMobilePushTemplate, template);
|
|
14
|
-
if (result.message
|
|
14
|
+
if (result.message) {
|
|
15
15
|
errorMsg = result.message;
|
|
16
|
+
if(result.status.code>=400){
|
|
17
|
+
throw errorMsg;
|
|
18
|
+
}
|
|
16
19
|
}
|
|
17
20
|
if (template.callback) {
|
|
18
21
|
yield call(template.callback, result.response);
|
|
@@ -292,10 +292,12 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
292
292
|
return;
|
|
293
293
|
}
|
|
294
294
|
selectedAccount = nextProps.Templates.weCrmAccounts[0];
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
params.
|
|
295
|
+
const { configs = {}, name = "" } = selectedAccount;
|
|
296
|
+
const { wecrm_app_id = "", wecrm_token = "", sourceAccountIdentifier = "" } = configs;
|
|
297
|
+
this.setState({selectedAccount: name}, () => {
|
|
298
|
+
params.wecrmId = wecrm_app_id;
|
|
299
|
+
params.wecrmToken = wecrm_token;
|
|
300
|
+
params.originalId = sourceAccountIdentifier;
|
|
299
301
|
this.props.actions.setViberAccount(nextProps.Templates.weCrmAccounts[0]);
|
|
300
302
|
this.getAllTemplates({params});
|
|
301
303
|
});
|
|
@@ -1838,7 +1840,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1838
1840
|
render() {
|
|
1839
1841
|
const isFullMode = this.isFullMode();
|
|
1840
1842
|
const { activeMode, channel, wechatFilter, lineFilter } = this.state;
|
|
1841
|
-
const showForViber = (channel.toLowerCase() !== VIBER_CHANNEL ||
|
|
1843
|
+
const showForViber = (channel.toLowerCase() !== VIBER_CHANNEL ||
|
|
1844
|
+
(channel.toLowerCase() === VIBER_CHANNEL && !this.props.isFullMode && isEmpty(get(this.props, 'Templates.selectedViberAccount', {}))));
|
|
1842
1845
|
if (activeMode === ACCOUNT_SELECTION_MODE && showForViber ) {
|
|
1843
1846
|
return this.renderAccountSelection();
|
|
1844
1847
|
}
|
|
@@ -516,6 +516,7 @@ const Viber = (props) => {
|
|
|
516
516
|
defaultValue={buttonText}
|
|
517
517
|
value={buttonText}
|
|
518
518
|
style={{paddingBottom: '11px'}}
|
|
519
|
+
maxLength={20}
|
|
519
520
|
/>
|
|
520
521
|
<CapInput
|
|
521
522
|
id="viber-button-url"
|
|
@@ -626,7 +627,7 @@ const Viber = (props) => {
|
|
|
626
627
|
return true;
|
|
627
628
|
}
|
|
628
629
|
// if button is being added than button url and button Text both are mandatory
|
|
629
|
-
if (( trimedButtonText === '' && trimedButtonUrl !== '') || (
|
|
630
|
+
if (( trimedButtonText === '' && trimedButtonUrl !== '') || ( trimedButtonText !== '' && trimedButtonUrl === '')) {
|
|
630
631
|
return true;
|
|
631
632
|
}
|
|
632
633
|
// if button url is not valid url
|
|
@@ -643,7 +644,6 @@ const Viber = (props) => {
|
|
|
643
644
|
<CapColumn span={14}>
|
|
644
645
|
<StyledHeader
|
|
645
646
|
title={formatMessage(messages.viberCreativeTitle)}
|
|
646
|
-
description={formatMessage(messages.viberCreativeDesc)}
|
|
647
647
|
size="regular"
|
|
648
648
|
/>
|
|
649
649
|
{
|
|
@@ -14,10 +14,6 @@ export default defineMessages({
|
|
|
14
14
|
id: `${scope}.viberCreativeTitle`,
|
|
15
15
|
defaultMessage: "Viber creative",
|
|
16
16
|
},
|
|
17
|
-
viberCreativeDesc: {
|
|
18
|
-
id: `${scope}.viberCreativeDesc`,
|
|
19
|
-
defaultMessage: "Select any of the existing templates or create new",
|
|
20
|
-
},
|
|
21
17
|
message: {
|
|
22
18
|
id: `${scope}.message`,
|
|
23
19
|
defaultMessage: 'Message',
|