@capillarytech/creatives-library 3.1.29 → 3.1.31
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/TemplatePreview/index.js +1 -1
- package/components/TemplatePreview/messages.js +1 -1
- package/package.json +1 -1
- package/utils/smsCharCountV2.js +10 -2
- package/v2Components/TemplatePreview/index.js +2 -2
- package/v2Components/TemplatePreview/messages.js +1 -1
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -1
- package/v2Containers/CreativesContainer/index.js +4 -1
- package/v2Containers/CreativesContainer/index.scss +6 -3
- package/containers/Cap/messsages.js +0 -63
- package/v2Components/Header/index.js +0 -46
- package/v2Components/Header/tests/index.test.js +0 -10
|
@@ -149,7 +149,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
149
149
|
{smsDetails.unicode &&
|
|
150
150
|
<div style={{fontSize: '16px'}}>{`${this.props.intl.formatMessage(messages.smsFormatType)}`}</div>
|
|
151
151
|
}
|
|
152
|
-
<div style={{marginTop: '8px', fontSize: '16px'}} >{`${smsDetails.parts} ${this.props.intl.formatMessage(messages.sms)} (${smsDetails.
|
|
152
|
+
<div style={{marginTop: '8px', fontSize: '16px'}} >{`${smsDetails.parts} ${this.props.intl.formatMessage(messages.sms)} (${smsDetails.chars_used} ${this.props.intl.formatMessage(messages.characters)})`}</div>
|
|
153
153
|
{smsDetails.optoutUrlPresent && <div style={{fontWeight: '100', fontSize: '12px'}}>
|
|
154
154
|
{`${this.props.intl.formatMessage(messages.includesOptoutTag)} (${smsDetails.optouturlLength} ${this.props.intl.formatMessage(messages.characters)})`}
|
|
155
155
|
</div>}
|
|
@@ -28,7 +28,7 @@ export default defineMessages({
|
|
|
28
28
|
},
|
|
29
29
|
includesOptoutTag: {
|
|
30
30
|
id: 'app.components.TemplatePreview.includesOptoutTag',
|
|
31
|
-
defaultMessage: 'Includes
|
|
31
|
+
defaultMessage: 'Includes Optout tag',
|
|
32
32
|
},
|
|
33
33
|
previewGenerated: {
|
|
34
34
|
id: 'creatives.components.TemplatePreview.previewGenerated',
|
package/package.json
CHANGED
package/utils/smsCharCountV2.js
CHANGED
|
@@ -73,27 +73,30 @@ export function updateCharCount(content, isUnicodeEnabled) {
|
|
|
73
73
|
var coding = '7bit';
|
|
74
74
|
var parts = 1;
|
|
75
75
|
var part = 1;
|
|
76
|
-
var chars_used = 0;
|
|
76
|
+
var chars_used = showOptoutCount ? ((optoutUrl && optoutUrl.length || 0) * noOfOptout) : 0;
|
|
77
77
|
var chars_sms = 160;
|
|
78
78
|
var sms_parts_container = [];
|
|
79
79
|
var partc = [];
|
|
80
80
|
for (let i = 0; i < chars_arr.length; i++) {
|
|
81
81
|
if (charset7bit.indexOf(chars_arr[i]) >= 0) {
|
|
82
82
|
chars_used = chars_used + 1;
|
|
83
|
+
console.log('X1:', chars_used);
|
|
83
84
|
} else if (charset7bitext.indexOf(chars_arr[i]) >= 0) {
|
|
84
85
|
chars_used = chars_used + 2;
|
|
86
|
+
console.log('X2:', chars_used);
|
|
85
87
|
} else {
|
|
86
88
|
coding = '16bit';
|
|
87
89
|
chars_used = chars_arr.length;
|
|
90
|
+
console.log('X3:', chars_used);
|
|
88
91
|
break;
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
|
-
chars_used = showOptoutCount ? (chars_used + (((optoutUrl && optoutUrl.length) || 0) * noOfOptout) - (optoutTagLength * noOfOptout)) : chars_used;
|
|
92
94
|
if (coding == '7bit') {
|
|
93
95
|
if (chars_used > 160) {
|
|
94
96
|
var parts = Math.ceil(chars_used / 153);
|
|
95
97
|
var part_chars_used = 7;
|
|
96
98
|
chars_sms = 153;
|
|
99
|
+
// partc.push(getUHDHtml(parts, part));
|
|
97
100
|
for (let i = 0; i < chars_arr.length; i++) {
|
|
98
101
|
if (part_chars_used + 1 > 160) {
|
|
99
102
|
part = part + 1;
|
|
@@ -120,12 +123,15 @@ export function updateCharCount(content, isUnicodeEnabled) {
|
|
|
120
123
|
}
|
|
121
124
|
} else {
|
|
122
125
|
if (chars_used > 70) {
|
|
126
|
+
|
|
123
127
|
parts = Math.ceil(chars_used / 67);
|
|
124
128
|
var part_chars_used = 3;
|
|
125
129
|
chars_sms = 67;
|
|
130
|
+
//partc.push(getUHDHtml(parts, part));
|
|
126
131
|
for (let i = 0; i < chars_arr.length; i++) {
|
|
127
132
|
if (part_chars_used + 1 > 70) {
|
|
128
133
|
part = part + 1;
|
|
134
|
+
// partc.push(getUHDHtml(parts, part));
|
|
129
135
|
part_chars_used = 3;
|
|
130
136
|
}
|
|
131
137
|
partc = [...partc, charToSpan(chars_arr[i], coding, isUnicodeEnabled)];
|
|
@@ -138,6 +144,8 @@ export function updateCharCount(content, isUnicodeEnabled) {
|
|
|
138
144
|
}
|
|
139
145
|
}
|
|
140
146
|
}
|
|
147
|
+
|
|
148
|
+
chars_used = showOptoutCount ? (chars_used - (optoutTagLength * noOfOptout)) : chars_used;
|
|
141
149
|
return {
|
|
142
150
|
unicode: (coding === '7bit' ? false : true),
|
|
143
151
|
parts,
|
|
@@ -54,7 +54,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
54
54
|
<CapRow>
|
|
55
55
|
{this.props.showCount && <CapColumn span={16}>
|
|
56
56
|
{channel && channel.toLowerCase() === 'sms' && <CapHeading type="h3">
|
|
57
|
-
<FormattedMessage {...messages.charactersTotal} values={{smsCount: smsDetails.parts, charCount: smsDetails.
|
|
57
|
+
<FormattedMessage {...messages.charactersTotal} values={{smsCount: smsDetails.parts, charCount: smsDetails.chars_used}}/>
|
|
58
58
|
{smsDetails.unicode &&
|
|
59
59
|
<FormattedMessage {...messages.smsFormatType}/>
|
|
60
60
|
}
|
|
@@ -83,7 +83,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
83
83
|
{!this.props.showCount && <div>
|
|
84
84
|
<CapColumn className="character-count-col" span={22}>
|
|
85
85
|
{channel && channel.toLowerCase() === 'sms' && <CapHeading type="h3">
|
|
86
|
-
<FormattedMessage {...messages.charactersTotal} values={{smsCount: smsDetails.parts, charCount: smsDetails.
|
|
86
|
+
<FormattedMessage {...messages.charactersTotal} values={{smsCount: smsDetails.parts, charCount: smsDetails.chars_used}}/>
|
|
87
87
|
{smsDetails.unicode &&
|
|
88
88
|
<FormattedMessage {...messages.smsFormatType}/>
|
|
89
89
|
}
|
|
@@ -24,7 +24,7 @@ export default defineMessages({
|
|
|
24
24
|
},
|
|
25
25
|
optoutCharactersTotal: {
|
|
26
26
|
id: 'app.components.TemplatePreview.optoutCharactersTotal',
|
|
27
|
-
defaultMessage: "Includes
|
|
27
|
+
defaultMessage: "Includes Optout tag ({optoutUrlLength} characters)",
|
|
28
28
|
},
|
|
29
29
|
smsFormatType: {
|
|
30
30
|
id: 'creatives.componentsV2.TemplatePreview.smsFormatType',
|
|
@@ -21,6 +21,7 @@ function getChannelLabel(channel) {
|
|
|
21
21
|
function SlideBoxHeader(props) {
|
|
22
22
|
const { slidBoxContent, templateData, onShowTemplates, creativesMode, isFullMode, showPrefix, shouldShowTemplateName, channel, templateNameRenderProp, weChatTemplateType, onWeChatMaptemplateStepChange, weChatMaptemplateStep, templateStep } = props;
|
|
23
23
|
const showTemplateNameHeader = isFullMode && shouldShowTemplateName;
|
|
24
|
+
const mapTemplateCreate = !showTemplateNameHeader && slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
24
25
|
return (
|
|
25
26
|
<div key="creatives-container-slidebox-header-content">
|
|
26
27
|
{slidBoxContent === 'templates' && !showTemplateNameHeader && (
|
|
@@ -65,7 +66,7 @@ function SlideBoxHeader(props) {
|
|
|
65
66
|
}
|
|
66
67
|
/>
|
|
67
68
|
)}
|
|
68
|
-
{
|
|
69
|
+
{mapTemplateCreate && (
|
|
69
70
|
<CapSteps
|
|
70
71
|
onChange={onWeChatMaptemplateStepChange}
|
|
71
72
|
current={weChatMaptemplateStep}
|
|
@@ -24,6 +24,8 @@ import * as templateActions from '../Templates/actions';
|
|
|
24
24
|
import * as globalActions from '../Cap/actions';
|
|
25
25
|
import {isLoading as isLoadingSelector} from './selectors';
|
|
26
26
|
import messages from './messages';
|
|
27
|
+
import { MAP_TEMPLATE } from '../WeChat/Wrapper/constants';
|
|
28
|
+
|
|
27
29
|
const classPrefix = 'add-creatives-section';
|
|
28
30
|
|
|
29
31
|
const SlideBoxWrapper = styled.div`
|
|
@@ -464,8 +466,9 @@ class Creatives extends React.Component {
|
|
|
464
466
|
render() {
|
|
465
467
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
|
|
466
468
|
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags} = this.props;
|
|
469
|
+
const mapTemplateCreate = slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
467
470
|
return (
|
|
468
|
-
<SlideBoxWrapper className={classnames(`${classPrefix} ${isFullMode ? 'creatives-full-mode' : 'creatives-library-mode'}`)}>
|
|
471
|
+
<SlideBoxWrapper className={classnames(`${classPrefix} ${isFullMode ? 'creatives-full-mode' : 'creatives-library-mode'} ${mapTemplateCreate ? 'map-template-create' : ''}`)}>
|
|
469
472
|
<CapSlideBox
|
|
470
473
|
header={
|
|
471
474
|
<SlideBoxHeader
|
|
@@ -24,9 +24,6 @@ $classPrefix: add-creatives-section;
|
|
|
24
24
|
width: 100%;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
.slidebox-header div:first-child {
|
|
28
|
-
width: 100%;
|
|
29
|
-
}
|
|
30
27
|
.wechat-steps {
|
|
31
28
|
width: 40% !important;
|
|
32
29
|
left: 20%;
|
|
@@ -39,4 +36,10 @@ $classPrefix: add-creatives-section;
|
|
|
39
36
|
padding-top: 4px;
|
|
40
37
|
}
|
|
41
38
|
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.map-template-create {
|
|
42
|
+
.slidebox-header div:first-child {
|
|
43
|
+
width: 100%;
|
|
44
|
+
}
|
|
42
45
|
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { defineMessages } from 'react-intl';
|
|
2
|
-
export default defineMessages({
|
|
3
|
-
"sms": {
|
|
4
|
-
id: 'reon.components.Cap.sms',
|
|
5
|
-
defaultMessage: 'SMS',
|
|
6
|
-
},
|
|
7
|
-
"wechat": {
|
|
8
|
-
id: 'reon.components.Cap.wechat',
|
|
9
|
-
defaultMessage: 'WeChat',
|
|
10
|
-
},
|
|
11
|
-
"gallery": {
|
|
12
|
-
id: 'reon.components.Cap.gallery',
|
|
13
|
-
defaultMessage: 'Gallery',
|
|
14
|
-
},
|
|
15
|
-
"creativesDashboard": {
|
|
16
|
-
id: 'reon.components.Cap.creativesDashboard',
|
|
17
|
-
defaultMessage: 'Creatives',
|
|
18
|
-
},
|
|
19
|
-
"creatives": {
|
|
20
|
-
id: 'reon.components.Cap.creatives',
|
|
21
|
-
defaultMessage: 'Creatives',
|
|
22
|
-
},
|
|
23
|
-
"campaigns": {
|
|
24
|
-
id: 'reon.components.Cap.campaigns',
|
|
25
|
-
defaultMessage: 'Campaigns',
|
|
26
|
-
},
|
|
27
|
-
"loyalty": {
|
|
28
|
-
id: 'reon.components.Cap.loyalty',
|
|
29
|
-
defaultMessage: 'Loyalty',
|
|
30
|
-
},
|
|
31
|
-
"member care": {
|
|
32
|
-
id: 'reon.components.Cap.memberCare',
|
|
33
|
-
defaultMessage: 'Member Care',
|
|
34
|
-
},
|
|
35
|
-
"workbench": {
|
|
36
|
-
id: 'reon.components.Cap.Workbench',
|
|
37
|
-
defaultMessage: 'WorkBench',
|
|
38
|
-
},
|
|
39
|
-
"store care": {
|
|
40
|
-
id: 'reon.components.Cap.storeCare',
|
|
41
|
-
defaultMessage: 'Store Care',
|
|
42
|
-
},
|
|
43
|
-
"store performance": {
|
|
44
|
-
id: 'reon.components.Cap.storePerformance',
|
|
45
|
-
defaultMessage: 'Store Performance',
|
|
46
|
-
},
|
|
47
|
-
"email": {
|
|
48
|
-
id: 'reon.components.Cap.email',
|
|
49
|
-
defaultMessage: 'Email',
|
|
50
|
-
},
|
|
51
|
-
"ebill": {
|
|
52
|
-
id: 'reon.components.Cap.ebill',
|
|
53
|
-
defaultMessage: 'Ebill',
|
|
54
|
-
},
|
|
55
|
-
"campaignsDashboard": {
|
|
56
|
-
id: 'reon.components.campaignsDashboard',
|
|
57
|
-
defaultMessage: 'Campaigns',
|
|
58
|
-
},
|
|
59
|
-
"campaignsHome": {
|
|
60
|
-
id: 'reon.components.campaignsHome',
|
|
61
|
-
defaultMessage: "Campaigns Home",
|
|
62
|
-
},
|
|
63
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* Header
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
9
|
-
import React from 'react';
|
|
10
|
-
// import styled from 'styled-components';
|
|
11
|
-
import { FormattedMessage } from 'react-intl';
|
|
12
|
-
|
|
13
|
-
import { CapRow, CapColumn, CapInput, CapButton } from '@capillarytech/cap-ui-library';
|
|
14
|
-
import messages from './messages';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function Header(props) {
|
|
18
|
-
return (
|
|
19
|
-
<div>
|
|
20
|
-
<CapRow className="template-form-header">
|
|
21
|
-
<CapColumn span={10}>
|
|
22
|
-
<CapInput id="template-name" placeholder="Enter template name*" defaultValue={props.templateName} type="input" onChange={props.templateNameHandler}/>
|
|
23
|
-
</CapColumn>
|
|
24
|
-
<CapColumn span={2} offset={8}>
|
|
25
|
-
<CapButton id="preview-button" type="cancel" onClick={props.previewHandler}> <FormattedMessage {...messages.preview} /> </CapButton>
|
|
26
|
-
</CapColumn>
|
|
27
|
-
<CapColumn span={2}>
|
|
28
|
-
<CapButton id="cancel-button" type="cancel" onClick={props.cancelHandler}> <FormattedMessage {...messages.cancel} /> </CapButton>
|
|
29
|
-
</CapColumn>
|
|
30
|
-
<CapColumn span={2}>
|
|
31
|
-
<CapButton id="save-button" type="primary" onClick={props.saveHandler}> <FormattedMessage {...messages.save} /> </CapButton>
|
|
32
|
-
</CapColumn>
|
|
33
|
-
</CapRow>
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
Header.propTypes = {
|
|
39
|
-
templateNameHandler: PropTypes.func,
|
|
40
|
-
previewHandler: PropTypes.func,
|
|
41
|
-
cancelHandler: PropTypes.func,
|
|
42
|
-
saveHandler: PropTypes.func,
|
|
43
|
-
templateName: PropTypes.string,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export default Header;
|