@capillarytech/creatives-library 0.0.7 → 0.0.8

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/routes.js CHANGED
@@ -277,7 +277,7 @@ export default function createRoutes(store) {
277
277
  },
278
278
  }, {
279
279
  path: '/email/create',
280
- name: 'Email',
280
+ name: 'EmailCreate',
281
281
  getComponent(nextState, cb) {
282
282
  const importModules = Promise.all([
283
283
  import('containers/Email/reducer'),
package/services/api.js CHANGED
@@ -273,13 +273,13 @@ export const getCmsTemplateSettings = (cmsType, projectId, cmsMode, langId) => {
273
273
  return API.get(url);
274
274
  };
275
275
 
276
- export const getCmsTemplateData = (cmsType, projectId) => {
277
- const url = `${API_ENDPOINT}/cms/getContent?type=${cmsType}&projectId=${projectId}`;
276
+ export const getCmsTemplateData = (cmsType, projectId, langId) => {
277
+ const url = `${API_ENDPOINT}/cms/getContent?type=${cmsType}&projectId=${projectId}&langId=${langId}`;
278
278
  return API.get(url);
279
279
  };
280
280
 
281
- export const getCmsData = (cmsType, projectId) => {
282
- const url = `${API_ENDPOINT}/cms/getCmsData?type=${cmsType}&projectId=${projectId}`;
281
+ export const getCmsData = (cmsType, projectId, langId) => {
282
+ const url = `${API_ENDPOINT}/cms/getCmsData?type=${cmsType}&projectId=${projectId}&langId=${langId}`;
283
283
  return API.get(url);
284
284
  };
285
285
 
@@ -1,331 +1,351 @@
1
1
  /* eslint-disable */
2
- import { Injectable } from '@angular/core';
3
- import {TranslateService} from '../../translate/translate.service';
4
- import './jed.js';
5
- import $ from 'jquery';
2
+ import Jed from './jed';
6
3
 
7
- const l10n = {};
8
- const i18n = new Jed(this.l10n);
9
- $.fn.smsCounter = function(options, chars) {
4
+ const l10n = {};
5
+ const i18n = new Jed(l10n);
6
+ let settings;
10
7
 
11
- //'use strict';
8
+ function smsCounter(options, chars) {
9
+ settings = Object.assign({
10
+ smsCount: 160,
11
+ }, options);
12
+ return updateSmsData(chars); //this.each(function() {
13
+ // if (!skipObj) {
14
+ // this.keyup(updateSmsData);
15
+ // } else {
16
+ // updateSmsData();
17
+ // }
18
+ // });
19
+ }
12
20
 
13
- var settings = $.extend({
14
- smsCount: 160
15
- }, options);
16
-
17
- var skipObj = false;
18
- if (chars != undefined && chars !== "" && chars !== false && chars !== true) {
19
- skipObj = true;
20
- }
21
+ let updateSmsData = (chars) => {
22
+ let skipObj = false;
23
+ let msgContent;
24
+ if (chars !== undefined && chars !== "" && chars !== false && chars !== true) {
25
+ skipObj = true;
26
+ }
27
+ if (skipObj) {
28
+ msgContent = chars;
29
+ } else {
30
+ // msgContent = $(this).val();
31
+ }
21
32
 
22
- var updateSmsData = function() {
33
+ const charset7bit = {
34
+ '@': 1,
35
+ '$': 1,
36
+ "\n": 1,
37
+ "\r": 1,
38
+ '_': 1,
39
+ ' ': 1,
40
+ '!': 1,
41
+ '"': 1,
42
+ '#': 1,
43
+ '%': 1,
44
+ '&': 1,
45
+ "'": 1,
46
+ '(': 1,
47
+ ')': 1,
48
+ '*': 1,
49
+ '+': 1,
50
+ ',': 1,
51
+ '-': 1,
52
+ '.': 1,
53
+ '/': 1,
54
+ '0': 1,
55
+ '1': 1,
56
+ '2': 1,
57
+ '3': 1,
58
+ '4': 1,
59
+ '5': 1,
60
+ '6': 1,
61
+ '7': 1,
62
+ '8': 1,
63
+ '9': 1,
64
+ ':': 1,
65
+ ';': 1,
66
+ '<': 1,
67
+ '=': 1,
68
+ '>': 1,
69
+ '?': 1,
70
+ '¡': 1,
71
+ 'A': 1,
72
+ 'B': 1,
73
+ 'C': 1,
74
+ 'D': 1,
75
+ 'E': 1,
76
+ 'F': 1,
77
+ 'G': 1,
78
+ 'H': 1,
79
+ 'I': 1,
80
+ 'J': 1,
81
+ 'K': 1,
82
+ 'L': 1,
83
+ 'M': 1,
84
+ 'N': 1,
85
+ 'O': 1,
86
+ 'P': 1,
87
+ 'Q': 1,
88
+ 'R': 1,
89
+ 'S': 1,
90
+ 'T': 1,
91
+ 'U': 1,
92
+ 'V': 1,
93
+ 'W': 1,
94
+ 'X': 1,
95
+ 'Y': 1,
96
+ 'Z': 1,
97
+ 'a': 1,
98
+ 'b': 1,
99
+ 'c': 1,
100
+ 'd': 1,
101
+ 'e': 1,
102
+ 'f': 1,
103
+ 'g': 1,
104
+ 'h': 1,
105
+ 'i': 1,
106
+ 'j': 1,
107
+ 'k': 1,
108
+ 'l': 1,
109
+ 'm': 1,
110
+ 'n': 1,
111
+ 'o': 1,
112
+ 'p': 1,
113
+ 'q': 1,
114
+ 'r': 1,
115
+ 's': 1,
116
+ 't': 1,
117
+ 'u': 1,
118
+ 'v': 1,
119
+ 'w': 1,
120
+ 'x': 1,
121
+ 'y': 1,
122
+ 'z': 1,
123
+ "\f": 2,
124
+ '^': 2,
125
+ '{': 2,
126
+ '}': 2,
127
+ '\\': 2,
128
+ '[': 2,
129
+ '~': 2,
130
+ ']': 2,
131
+ '|': 2,
132
+ 'è': 1,
133
+ 'é': 1,
134
+ 'ù': 1,
135
+ 'ì': 1,
136
+ 'ò': 1,
137
+ 'Ç': 1,
138
+ 'Ø': 1,
139
+ 'ø': 1,
140
+ 'Å': 1,
141
+ 'å': 1,
142
+ 'Δ': 1,
143
+ 'Φ': 1,
144
+ 'Γ': 1,
145
+ 'Λ': 1,
146
+ 'Ω': 1,
147
+ 'Π': 1,
148
+ 'Ψ': 1,
149
+ 'Σ': 1,
150
+ 'Θ': 1,
151
+ 'Ξ': 1,
152
+ 'Æ': 1,
153
+ 'æ': 1,
154
+ 'ß': 1,
155
+ 'É': 1,
156
+ 'Ä': 1,
157
+ 'Ö': 1,
158
+ 'Ñ': 1,
159
+ 'Ü': 1,
160
+ 'ä': 1,
161
+ 'ö': 1,
162
+ 'ñ': 1,
163
+ 'ü': 1,
164
+ 'à': 1,
165
+ '£': 1,
166
+ '¥': 1,
167
+ '¤': 1,
168
+ '§': 1,
169
+ '¿': 1,
170
+ '€': 2,
171
+ };
23
172
 
24
- if (skipObj) {
25
- var msgContent = chars;
26
- } else {
27
- var msgContent = $(this).val();
28
- }
173
+ msgContent = msgContent.replace(/\u00a0/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/\\n\\n/g, "\\n").replace(/\\n/g, " ");
174
+ msgContent = msgContent.replace(/\r/g, " ").replace(/\f/g, " ");
29
175
 
30
- var charset7bit = {
31
- '@': 1,
32
- '$': 1,
33
- "\n": 1,
34
- "\r": 1,
35
- '_': 1,
36
- ' ': 1,
37
- '!': 1,
38
- '"': 1,
39
- '#': 1,
40
- '%': 1,
41
- '&': 1,
42
- "'": 1,
43
- '(': 1,
44
- ')': 1,
45
- '*': 1,
46
- '+': 1,
47
- ',': 1,
48
- '-': 1,
49
- '.': 1,
50
- '/': 1,
51
- '0': 1,
52
- '1': 1,
53
- '2': 1,
54
- '3': 1,
55
- '4': 1,
56
- '5': 1,
57
- '6': 1,
58
- '7': 1,
59
- '8': 1,
60
- '9': 1,
61
- ':': 1,
62
- ';': 1,
63
- '<': 1,
64
- '=': 1,
65
- '>': 1,
66
- '?': 1,
67
- '¡': 1,
68
- 'A': 1,
69
- 'B': 1,
70
- 'C': 1,
71
- 'D': 1,
72
- 'E': 1,
73
- 'F': 1,
74
- 'G': 1,
75
- 'H': 1,
76
- 'I': 1,
77
- 'J': 1,
78
- 'K': 1,
79
- 'L': 1,
80
- 'M': 1,
81
- 'N': 1,
82
- 'O': 1,
83
- 'P': 1,
84
- 'Q': 1,
85
- 'R': 1,
86
- 'S': 1,
87
- 'T': 1,
88
- 'U': 1,
89
- 'V': 1,
90
- 'W': 1,
91
- 'X': 1,
92
- 'Y': 1,
93
- 'Z': 1,
94
- 'a': 1,
95
- 'b': 1,
96
- 'c': 1,
97
- 'd': 1,
98
- 'e': 1,
99
- 'f': 1,
100
- 'g': 1,
101
- 'h': 1,
102
- 'i': 1,
103
- 'j': 1,
104
- 'k': 1,
105
- 'l': 1,
106
- 'm': 1,
107
- 'n': 1,
108
- 'o': 1,
109
- 'p': 1,
110
- 'q': 1,
111
- 'r': 1,
112
- 's': 1,
113
- 't': 1,
114
- 'u': 1,
115
- 'v': 1,
116
- 'w': 1,
117
- 'x': 1,
118
- 'y': 1,
119
- 'z': 1,
120
- "\f": 2,
121
- '^': 2,
122
- '{': 2,
123
- '}': 2,
124
- '\\': 2,
125
- '[': 2,
126
- '~': 2,
127
- ']': 2,
128
- '|': 2,
129
- 'è': 1,
130
- 'é': 1,
131
- 'ù': 1,
132
- 'ì': 1,
133
- 'ò': 1,
134
- 'Ç': 1,
135
- 'Ø': 1,
136
- 'ø': 1,
137
- 'Å': 1,
138
- 'å': 1,
139
- 'Δ': 1,
140
- 'Φ': 1,
141
- 'Γ': 1,
142
- 'Λ': 1,
143
- 'Ω': 1,
144
- 'Π': 1,
145
- 'Ψ': 1,
146
- 'Σ': 1,
147
- 'Θ': 1,
148
- 'Ξ': 1,
149
- 'Æ': 1,
150
- 'æ': 1,
151
- 'ß': 1,
152
- 'É': 1,
153
- 'Ä': 1,
154
- 'Ö': 1,
155
- 'Ñ': 1,
156
- 'Ü': 1,
157
- 'ä': 1,
158
- 'ö': 1,
159
- 'ñ': 1,
160
- 'ü': 1,
161
- 'à': 1,
162
- '£': 1,
163
- '¥': 1,
164
- '¤': 1,
165
- '§': 1,
166
- '¿': 1,
167
- '€': 2
168
- };
176
+ const matches = msgContent.split("");
177
+ console.log('Test 1', msgContent, matches);
178
+ let use7bit = true;
179
+ let length7bit = 0;
180
+ let length16bit = 0;
181
+ let parts = {
182
+ sms_count: 1,
183
+ chars_left: 160,
184
+ };
169
185
 
170
- msgContent = msgContent.replace(/\u00a0/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/\\n\\n/g, "\\n").replace(/\\n/g, " ");
186
+ matches.forEach( (char) => {
187
+ if (use7bit && charset7bit[char] === undefined) {
188
+ use7bit = false;
189
+ }
171
190
 
172
- msgContent = msgContent.replace(/\r/g, " ").replace(/\f/g, " ");
191
+ if (use7bit) {
192
+ length7bit += charset7bit[char];
193
+ }
173
194
 
174
- var matches = msgContent.split("");
175
- var use_7bit = true;
176
- var length_7bit = 0;
177
- var length_16bit = 0;
178
- var parts = {
179
- 'sms_count': 1,
180
- 'chars_left': 160
181
- };
195
+ length16bit += 1;
196
+ });
182
197
 
183
- for (var i in matches) {
184
- var char = matches[i];
198
+ if (use7bit) {
199
+ parts = smsCount(length7bit, false);
200
+ } else {
201
+ parts = smsCount(length16bit, true);
202
+ }
185
203
 
186
- if (use_7bit && charset7bit[char] === undefined) {
187
- use_7bit = false;
188
- }
204
+ if (typeof settings.getCount === 'function') {
205
+ settings.getCount.call(this, parts);
206
+ }
207
+ };
189
208
 
190
- if (use_7bit) {
191
- length_7bit += charset7bit[char];
192
- }
209
+ let smsCount = (chars, enc16) => {
210
+ let charactersLeft = 0;
211
+ let smsCharCounter = 0;
193
212
 
194
- length_16bit++;
195
- }
213
+ if (enc16 === false && chars <= 160) {
214
+ charactersLeft = 160 - chars;
215
+ return {
216
+ sms_count: 1,
217
+ chars_left: charactersLeft,
218
+ chars,
219
+ charset: false,
220
+ };
221
+ }
196
222
 
197
- if (use_7bit) {
198
- parts = smsCount(length_7bit, false);
199
- } else {
200
- parts = smsCount(length_16bit, true);
201
- }
223
+ if (enc16 === true && chars <= 70) {
224
+ charactersLeft = 70 - chars;
225
+ return {
226
+ sms_count: 1,
227
+ chars_left: charactersLeft,
228
+ chars,
229
+ charset: "Unicode charset",
230
+ };
231
+ }
202
232
 
203
- if (typeof settings.getCount == 'function') {
204
- settings.getCount.call(this, parts);
205
- }
206
- }
207
- var smsCount = function(chars, enc_16): any {
233
+ if (enc16 === false) {
234
+ smsCharCounter = Math.ceil(chars / 153);
235
+ charactersLeft = (smsCount * 153) - chars;
236
+ return {
237
+ sms_count: smsCharCounter,
238
+ chars_left: charactersLeft,
239
+ chars,
240
+ charset: false,
241
+ };
242
+ }
208
243
 
209
- var characters_left = 0;
210
- var sms_count = 0;
244
+ smsCharCounter = Math.ceil(chars / 67);
245
+ charactersLeft = (smsCharCounter * 67) - chars;
246
+ return {
247
+ sms_count: smsCharCounter,
248
+ chars_left: charactersLeft,
249
+ chars,
250
+ charset: "Unicode charset",
251
+ };
252
+ };
211
253
 
212
- if (enc_16 === false && chars <= 160) {
213
- characters_left = 160 - chars;
214
- return {
215
- 'sms_count': 1,
216
- 'chars_left': characters_left,
217
- 'chars': chars,
218
- "charset": false
219
- };
220
- }
254
+ function _camp1(s) {
255
+ try {
256
+ return i18n.dgettext("camp1", s) !== '' ? this.i18n.dgettext("camp1", s) : s;
257
+ } catch (err) {
258
+ console.log('i18n Error', err.message);
259
+ return s;
260
+ }
261
+ }
221
262
 
222
- if (enc_16 === true && chars <= 70) {
223
- characters_left = 70 - chars;
224
- return {
225
- 'sms_count': 1,
226
- 'chars_left': characters_left,
227
- 'chars': chars,
228
- "charset": "Unicode charset"
229
- };
230
- }
263
+ /**
264
+ * returns no of char an SMS contains in
265
+ * messaging of campaign based on ascii and
266
+ * non-ascii characters.
267
+ * @param message
268
+ * @returns
269
+ */
270
+ function smsCharCount(message) {
271
+ // const that = this;
272
+ let msgcount = 1;
273
+ let countLbl = 0;
274
+ const props = {
275
+ chars_left: 160,
276
+ };
231
277
 
232
- if (enc_16 === false) {
233
- sms_count = Math.ceil(chars / 153);
234
- characters_left = (sms_count * 153) - chars;
235
- return {
236
- 'sms_count': sms_count,
237
- 'chars_left': characters_left,
238
- 'chars': chars,
239
- "charset": false
240
- };
241
- } else {
242
- sms_count = Math.ceil(chars / 67);
243
- characters_left = (sms_count * 67) - chars;
244
- return {
245
- 'sms_count': sms_count,
246
- 'chars_left': characters_left,
247
- 'chars': chars,
248
- "charset": "Unicode charset"
249
- };
250
- }
278
+ smsCounter({
279
+ getCount: (parts) => {
280
+ props.chars_left = parts.chars_left;
281
+ props.total_chars = parts.chars;
282
+ props.charset = parts.charset;
283
+ msgcount = parts.sms_count;
284
+ countLbl = parts.chars;
285
+ if (parts.charset !== false) {
286
+ countLbl = `${parts.chars} ${_camp1("Unicode")}`;
251
287
  }
288
+ },
289
+ }, message);
290
+ return [countLbl, msgcount, props];
291
+ }
252
292
 
253
- return this.each(function() {
293
+ // function escapeRegex(text) {
294
+ // return text.replace(/[-[\]{}()*+?.,\\^$|#]/g, "\\$&").replace(/\s/g, "\\s+").replace(/'|"/g, "(?:'|\")");
295
+ // }
254
296
 
255
- var $this = $(this);
297
+ export function checkUnicode(str, msg) {
298
+ const non_unicode = {'@': 1, '$': 1, "\n":1, "\r":1, '_': 1, ' ': 1, '!': 1, '"': 1, '#': 1, '%': 1, '&': 1, "'":1, '(': 1, ')': 1, '*': 1, '+': 1, ',': 1, '-': 1, '.': 1, '/': 1, '0': 1, '1': 1, '2': 1, '3': 1, '4': 1, '5': 1, '6': 1, '7': 1, '8': 1, '9': 1, ':': 1, ';': 1, '<': 1, '=': 1, '>': 1, '?': 1, '¡': 1, 'A': 1, 'B': 1, 'C': 1, 'D': 1, 'E': 1, 'F': 1, 'G': 1, 'H': 1, 'I': 1, 'J': 1, 'K': 1, 'L': 1, 'M': 1, 'N': 1, 'O': 1, 'P': 1, 'Q': 1, 'R': 1, 'S': 1, 'T': 1, 'U': 1, 'V': 1, 'W': 1, 'X': 1, 'Y': 1, 'Z': 1, 'a': 1, 'b': 1, 'c': 1, 'd': 1, 'e': 1, 'f': 1, 'g': 1, 'h': 1, 'i': 1, 'j': 1, 'k': 1, 'l': 1, 'm': 1, 'n': 1, 'o': 1, 'p': 1, 'q': 1, 'r': 1, 's': 1, 't': 1, 'u': 1, 'v': 1, 'w': 1, 'x': 1, 'y': 1, 'z': 1, "\f": 2, '^': 2, '{': 2, '}': 2, '\\': 2, '[': 2, '~': 2,']':2,'|':2,'è':1,'é':1,'ù':1,'ì':1,'ò':1,'Ç':1,'Ø':1,'ø':1,'Å':1,'å':1,'Δ':1,'Φ':1,'Γ':1,'Λ':1,'Ω':1,'Π':1,'Ψ':1,'Σ':1,'Θ':1,'Ξ':1,'Æ':1,'æ':1,'ß':1,'É':1,'Ä':1,'Ö':1,'Ñ':1,'Ü':1,'¿':1,'ä':1,'ö':1,'ñ':1,'ü':1,'à':1,'£': 1,'¥': 1,'¤': 1,'§': 1,'¿': 1,'€':2};
299
+ var isUnicode=0;
300
+ msg = typeof msg !== 'undefined' ? msg : "This message contains Unicode Characters. Do you want to proceed?";
256
301
 
257
- if (!skipObj) {
258
- $this.keyup(updateSmsData);
259
- } else {
260
- updateSmsData();
261
- }
262
- });
263
- };
264
-
265
- function _camp1(s) {
266
- try {
267
- return this.i18n.dgettext("camp1", s) != '' ? this.i18n.dgettext("camp1", s) : s;
268
- } catch (err) {
269
- console.log('i18n Error' + err.message);
270
- return s;
302
+ str = str.replace(/\u00a0/g, " ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/\\n\\n/g, "\\n").replace(/\\n/g, " ");
303
+ str = str.replace(/\r/g," ").replace(/\f/g," ");
304
+ var matches = str.split("");
305
+ for (var i in matches) {
306
+ const char = matches[i];
307
+ if (!non_unicode[char]) {
308
+ isUnicode = 1;
271
309
  }
272
310
  }
311
+ // if (isUnicode === 1) {
312
+ // const r = confirm(msg);
313
+ // if (r === true) {
314
+ // return true;
315
+ // }
316
+ // return false;
317
+ // }
318
+ //
319
+ return isUnicode === 1;
320
+ }
273
321
 
274
- /**
275
- * returns no of char an SMS contains in
276
- * messaging of campaign based on ascii and
277
- * non-ascii characters.
278
- * @param message
279
- * @returns
280
- */
281
- function smsCharCount(message) {
282
- var that = this;
283
- var msgcount = 1;
284
- var count_lbl: any = 0;
285
- var props = {
286
- "chars_left": 160
287
- };
322
+ export function updateCharCount(boxVal) {
323
+ // let tagHtml = "<span class='editor_tag' title='%desc%' contenteditable='false'>%name%</span>";
324
+ // let tagText = "{{%name%}}";
288
325
 
289
- $("body").smsCounter({
290
- getCount: function(parts) {
291
- props["chars_left"] = parts.chars_left;
292
- props["total_chars"] = parts.chars;
293
- props["charset"] = parts.charset;
294
- msgcount = parts.sms_count;
295
- count_lbl = parts.chars;
296
- if (parts.charset != false) {
297
- count_lbl = parts.chars + " " + that._camp1("Unicode");;
298
- }
299
- }
300
- }, message);
326
+ // let boxVal = html.replace(new RegExp(escapeRegex(tagHtml).replace("%name%", "(.*?)").replace(/%.*?%/g, "(?:.*?)"), "g"), tagText.replace(/%name%/g, "$1")).replace(/\<(p|div|br).*?\>/g, "\\n").replace(/\<.*?\>/g, "");
327
+ // boxVal = "" + boxVal;
301
328
 
302
-
303
- return Array(count_lbl, msgcount, props);
329
+ // let unicodeFlag = 0;
330
+ // let extraChars = 0;
331
+ console.log('Box val', boxVal);
332
+ let msgCount = 0;
333
+ const lenCount = smsCharCount(boxVal);
334
+ const len = lenCount[0];
335
+ msgCount = lenCount[1];
336
+ const charLeft = lenCount[2].chars_left;
337
+ const totalChars = lenCount[2].total_chars;
338
+ const charset = lenCount[2].charset;
339
+ if (!charset && totalChars > 1000) {
340
+ console.log("only 1000 character allowed in normal sms remaining character will be discarded");
341
+ } else if (charset && totalChars > 500) {
342
+ console.log("only 500 character allowed in unicode sms remaining character will be discarded");
304
343
  }
305
344
 
306
- export function updateCharCount(html) {
307
- var tagHtml = "<span class='editor_tag' title='%desc%' contenteditable='false'>%name%</span>";
308
- var tagText = "{{%name%}}";
309
-
310
- function escapeRegex(text) {
311
- return text.replace(/[-[\]{}()*+?.,\\^$|#]/g, "\\$&").replace(/\s/g, "\\s+").replace(/'|"/g, "(?:'|\")");
312
- }
313
- var boxVal = html.replace(new RegExp(escapeRegex(tagHtml).replace("%name%", "(.*?)").replace(/%.*?%/g, "(?:.*?)"), "g"), tagText.replace(/%name%/g, "$1")).replace(/\<(p|div|br).*?\>/g, "\\n").replace(/\<.*?\>/g, "");
314
- boxVal = "" + boxVal;
315
-
316
- var unicodeFlag = 0;
317
- var extraChars = 0;
318
- var msgCount = 0;
319
- var len_count = smsCharCount(boxVal);
320
- var len = len_count[0];
321
- msgCount = len_count[1];
322
- var charLeft = len_count[2]["chars_left"];
323
- var totalChars = len_count[2]["total_chars"];
324
- var charset = len_count[2]["charset"];
325
- if (!charset && totalChars > 1000) {
326
- console.log("only 1000 character allowed in normal sms remaining character will be discarded");
327
- } else if (charset && totalChars > 500) {
328
- console.log("only 500 character allowed in unicode sms remaining character will be discarded");
329
- }
330
- return len + " " + 'characters' + " = " + msgCount + " " + 'Messages' + "*, " + 'Characters left' + ": " + charLeft;
331
- }
345
+ // return `${len} characters = ${msgCount} Messages*, Characters left: ${charLeft}`;
346
+ return {
347
+ totalLength: len,
348
+ msgCount,
349
+ charLeft,
350
+ };
351
+ }