@capillarytech/creatives-library 3.1.25 → 3.1.27

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.
@@ -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.chars_used} ${this.props.intl.formatMessage(messages.characters)})`}</div>
152
+ <div style={{marginTop: '8px', fontSize: '16px'}} >{`${smsDetails.parts} ${this.props.intl.formatMessage(messages.sms)} (${smsDetails.actual_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 Optout tag',
31
+ defaultMessage: 'Includes optout tag',
32
32
  },
33
33
  previewGenerated: {
34
34
  id: 'creatives.components.TemplatePreview.previewGenerated',
@@ -0,0 +1,63 @@
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
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "3.1.25",
4
+ "version": "3.1.27",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -73,30 +73,27 @@ export function updateCharCount(content, isUnicodeEnabled) {
73
73
  var coding = '7bit';
74
74
  var parts = 1;
75
75
  var part = 1;
76
- var chars_used = showOptoutCount ? ((optoutUrl && optoutUrl.length || 0) * noOfOptout) : 0;
76
+ var chars_used = 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);
84
83
  } else if (charset7bitext.indexOf(chars_arr[i]) >= 0) {
85
84
  chars_used = chars_used + 2;
86
- console.log('X2:', chars_used);
87
85
  } else {
88
86
  coding = '16bit';
89
87
  chars_used = chars_arr.length;
90
- console.log('X3:', chars_used);
91
88
  break;
92
89
  }
93
90
  }
91
+ const actual_chars_used = showOptoutCount ? (chars_used + (((optoutUrl && optoutUrl.length) || 0) * noOfOptout) - (optoutTagLength * noOfOptout)) : chars_used;
94
92
  if (coding == '7bit') {
95
93
  if (chars_used > 160) {
96
94
  var parts = Math.ceil(chars_used / 153);
97
95
  var part_chars_used = 7;
98
96
  chars_sms = 153;
99
- // partc.push(getUHDHtml(parts, part));
100
97
  for (let i = 0; i < chars_arr.length; i++) {
101
98
  if (part_chars_used + 1 > 160) {
102
99
  part = part + 1;
@@ -123,15 +120,12 @@ export function updateCharCount(content, isUnicodeEnabled) {
123
120
  }
124
121
  } else {
125
122
  if (chars_used > 70) {
126
-
127
123
  parts = Math.ceil(chars_used / 67);
128
124
  var part_chars_used = 3;
129
125
  chars_sms = 67;
130
- //partc.push(getUHDHtml(parts, part));
131
126
  for (let i = 0; i < chars_arr.length; i++) {
132
127
  if (part_chars_used + 1 > 70) {
133
128
  part = part + 1;
134
- // partc.push(getUHDHtml(parts, part));
135
129
  part_chars_used = 3;
136
130
  }
137
131
  partc = [...partc, charToSpan(chars_arr[i], coding, isUnicodeEnabled)];
@@ -144,8 +138,6 @@ export function updateCharCount(content, isUnicodeEnabled) {
144
138
  }
145
139
  }
146
140
  }
147
-
148
- chars_used = showOptoutCount ? (chars_used - (optoutTagLength * noOfOptout)) : chars_used;
149
141
  return {
150
142
  unicode: (coding === '7bit' ? false : true),
151
143
  parts,
@@ -155,5 +147,6 @@ export function updateCharCount(content, isUnicodeEnabled) {
155
147
  optouturlLength: (optoutUrl && optoutUrl.length) || 0,
156
148
  optoutUrlPresent: noOfOptout > 0,
157
149
  responseState,
150
+ actual_chars_used,
158
151
  };
159
152
  }
@@ -0,0 +1,46 @@
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;
@@ -0,0 +1,10 @@
1
+ // import React from 'react';
2
+ // import { shallow } from 'enzyme';
3
+
4
+ // import Header from '../index';
5
+
6
+ describe('<Header />', () => {
7
+ it('Expect to have unit tests specified', () => {
8
+ expect(true).toEqual(false);
9
+ });
10
+ });
@@ -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.chars_used}}/>
57
+ <FormattedMessage {...messages.charactersTotal} values={{smsCount: smsDetails.parts, charCount: smsDetails.actual_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.chars_used}}/>
86
+ <FormattedMessage {...messages.charactersTotal} values={{smsCount: smsDetails.parts, charCount: smsDetails.actual_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 Optout tag ({optoutUrlLength} characters)",
27
+ defaultMessage: "Includes optout tag ({optoutUrlLength} characters)",
28
28
  },
29
29
  smsFormatType: {
30
30
  id: 'creatives.componentsV2.TemplatePreview.smsFormatType',