@capillarytech/creatives-library 3.1.28 → 3.1.29
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
CHANGED
package/utils/smsCharCountV2.js
CHANGED
|
@@ -88,7 +88,7 @@ export function updateCharCount(content, isUnicodeEnabled) {
|
|
|
88
88
|
break;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
|
|
91
|
+
chars_used = showOptoutCount ? (chars_used + (((optoutUrl && optoutUrl.length) || 0) * noOfOptout) - (optoutTagLength * noOfOptout)) : chars_used;
|
|
92
92
|
if (coding == '7bit') {
|
|
93
93
|
if (chars_used > 160) {
|
|
94
94
|
var parts = Math.ceil(chars_used / 153);
|
|
@@ -147,6 +147,5 @@ export function updateCharCount(content, isUnicodeEnabled) {
|
|
|
147
147
|
optouturlLength: (optoutUrl && optoutUrl.length) || 0,
|
|
148
148
|
optoutUrlPresent: noOfOptout > 0,
|
|
149
149
|
responseState,
|
|
150
|
-
actual_chars_used,
|
|
151
150
|
};
|
|
152
151
|
}
|
|
@@ -60,7 +60,6 @@ function SlideBoxContent(props) {
|
|
|
60
60
|
onValidationFail,
|
|
61
61
|
channelsToHide,
|
|
62
62
|
forwardedTags,
|
|
63
|
-
channelsToDisable,
|
|
64
63
|
weChatTemplateType,
|
|
65
64
|
onWechatTemplateChange,
|
|
66
65
|
selectedWeChatAccount,
|
|
@@ -114,7 +113,6 @@ function SlideBoxContent(props) {
|
|
|
114
113
|
cap={cap}
|
|
115
114
|
channelsToHide={channelsToHide}
|
|
116
115
|
forwardedTags={forwardedTags}
|
|
117
|
-
channelsToDisable={channelsToDisable}
|
|
118
116
|
/>
|
|
119
117
|
)}
|
|
120
118
|
{isPreview && (
|
|
@@ -325,7 +323,6 @@ SlideBoxContent.propTypes = {
|
|
|
325
323
|
onValidationFail: PropTypes.func,
|
|
326
324
|
channelsToHide: PropTypes.array,
|
|
327
325
|
forwardedTags: PropTypes.object,
|
|
328
|
-
channelsToDisable: PropTypes.array,
|
|
329
326
|
weChatTemplateType: PropTypes.string,
|
|
330
327
|
onWechatTemplateChange: PropTypes.func,
|
|
331
328
|
selectedWeChatAccount: PropTypes.object,
|
|
@@ -463,7 +463,7 @@ class Creatives extends React.Component {
|
|
|
463
463
|
}
|
|
464
464
|
render() {
|
|
465
465
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
|
|
466
|
-
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags
|
|
466
|
+
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags} = this.props;
|
|
467
467
|
return (
|
|
468
468
|
<SlideBoxWrapper className={classnames(`${classPrefix} ${isFullMode ? 'creatives-full-mode' : 'creatives-library-mode'}`)}>
|
|
469
469
|
<CapSlideBox
|
|
@@ -519,7 +519,6 @@ class Creatives extends React.Component {
|
|
|
519
519
|
onValidationFail={this.onValidationFail}
|
|
520
520
|
channelsToHide={channelsToHide}
|
|
521
521
|
forwardedTags={forwardedTags}
|
|
522
|
-
channelsToDisable={channelsToDisable}
|
|
523
522
|
weChatTemplateType={weChatTemplateType}
|
|
524
523
|
onWechatTemplateChange={this.onWechatTemplateChange}
|
|
525
524
|
weChatMaptemplateStep={weChatMaptemplateStep}
|
|
@@ -571,7 +570,6 @@ Creatives.propTypes = {
|
|
|
571
570
|
EmailLayout: PropTypes.string,
|
|
572
571
|
channelsToHide: PropTypes.array,
|
|
573
572
|
forwardedTags: PropTypes.object,
|
|
574
|
-
channelsToDisable: PropTypes.array,
|
|
575
573
|
selectedWeChatAccount: PropTypes.object,
|
|
576
574
|
};
|
|
577
575
|
const mapStatesToProps = () => createStructuredSelector({
|
|
@@ -12,7 +12,6 @@ import { createStructuredSelector } from 'reselect';
|
|
|
12
12
|
import { bindActionCreators } from 'redux';
|
|
13
13
|
import { CapTab, CapCustomCard, CapButton, CapHeader, CapSpin, CapIcon } from '@capillarytech/cap-ui-library';
|
|
14
14
|
import { find, get } from 'lodash';
|
|
15
|
-
import isEmpty from 'lodash/isEmpty';
|
|
16
15
|
import Helmet from 'react-helmet';
|
|
17
16
|
|
|
18
17
|
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
@@ -32,7 +31,7 @@ const StyledCapTab = withStyles(CapTab, CapTabStyle);
|
|
|
32
31
|
export class TemplatesV2 extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
33
32
|
constructor(props) {
|
|
34
33
|
super(props);
|
|
35
|
-
|
|
34
|
+
const defaultChannel = get(this, 'props.channel') || get(this, 'props.params.channel') || 'sms';
|
|
36
35
|
const defaultPanes = {
|
|
37
36
|
sms: {content: <div></div>, tab: props.intl.formatMessage(messages.sms), key: 'sms'},
|
|
38
37
|
email: {content: <div></div>, tab: props.intl.formatMessage(messages.email), key: 'email'},
|
|
@@ -41,8 +40,8 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
41
40
|
mPush: {content: <div></div>, tab: props.intl.formatMessage(messages.pushNotification), key: 'mobilepush'},
|
|
42
41
|
};
|
|
43
42
|
const channelsToHide = this.props.channelsToHide || [];
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
|
|
44
|
+
const filteredPanes = Object.keys(defaultPanes)
|
|
46
45
|
.filter((key) => !channelsToHide.includes(key)).reduce((obj = [], key) => {
|
|
47
46
|
obj.push(defaultPanes[key]);
|
|
48
47
|
return obj;
|
|
@@ -53,26 +52,8 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
53
52
|
} else if (!channelsToHide.includes('callTask')) {
|
|
54
53
|
filteredPanes.push({content: <div></div>, tab: props.intl.formatMessage(messages.callTask), key: 'call_task'});
|
|
55
54
|
}
|
|
56
|
-
/* eslint-disable no-param-reassign */
|
|
57
|
-
filteredPanes = filteredPanes.forEach( (pane) => {
|
|
58
|
-
if (channelsToDisable.includes(pane.key)) {
|
|
59
|
-
pane.disabled = true;
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
const channel = ['sms', 'email', 'mobilepush', 'call_task'];
|
|
64
|
-
if (!isEmpty(channelsToDisable)) {
|
|
65
|
-
channel.some((ch) => {
|
|
66
|
-
if (!channelsToDisable.includes(ch)) {
|
|
67
|
-
defaultChannel = ch;
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
return false;
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
55
|
|
|
74
56
|
const panes = this.setChannelContent(defaultChannel, filteredPanes);
|
|
75
|
-
|
|
76
57
|
this.state = {
|
|
77
58
|
selectedChannel: defaultChannel,
|
|
78
59
|
panes,
|
|
@@ -210,7 +191,6 @@ TemplatesV2.propTypes = {
|
|
|
210
191
|
onChannelChange: PropTypes.func,
|
|
211
192
|
channelsToHide: PropTypes.array,
|
|
212
193
|
className: PropTypes.string.isRequired,
|
|
213
|
-
channelsToDisable: PropTypes.array,
|
|
214
194
|
};
|
|
215
195
|
|
|
216
196
|
TemplatesV2.defaultProps = {
|