@capillarytech/creatives-library 7.11.3 → 7.11.5

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.11.3",
4
+ "version": "7.11.5",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -294,7 +294,7 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
294
294
  );
295
295
 
296
296
  const whatsappUpdatedAccountName = whatsappAccountName || templateData?.versions?.base?.content?.whatsapp?.accountName || '';
297
- const whatsappUpdatedLen = whatsappContentLen !== undefined ? UNSUBSCRIBE_TEXT_LENGTH + whatsappContentLen : content?.templateMsg?.length;
297
+ const whatsappUpdatedLen = whatsappContentLen !== undefined ? UNSUBSCRIBE_TEXT_LENGTH + whatsappContentLen : content?.charCount;
298
298
 
299
299
  return (
300
300
  <CapRow>
@@ -312,7 +312,7 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
312
312
  <>
313
313
  <WhatsappStatusContainer template={templateData} />
314
314
  <CapHeading type="h3" className='margin-t-12'>
315
- <FormattedMessage {...messages.whatsappCharactersTotal} values={{charCount: content?.templateMsg?.length}} />
315
+ <FormattedMessage {...messages.whatsappCharactersTotal} values={{charCount: whatsappUpdatedLen}} />
316
316
  </CapHeading>
317
317
  <CapHeading type="h6">
318
318
  <FormattedMessage {...messages.whatsappUnsubscribeLength} />
@@ -32,7 +32,7 @@ export default defineMessages({
32
32
  },
33
33
  whatsappUnsubscribeLength: {
34
34
  id: 'app.components.TemplatePreview.whatsappUnsubscribeLength',
35
- defaultMessage: "Includes 37 characters of (Click {{unsubscribe}} to unsubscribe)",
35
+ defaultMessage: "Includes 36 characters of (Click {{unsubscribe}} to unsubscribe)",
36
36
  },
37
37
  whatsappMessageLength: {
38
38
  id: 'app.components.TemplatePreview.whatsappMessageLength',
@@ -329,13 +329,14 @@ export function SlideBoxContent(props) {
329
329
  }
330
330
  case constants.WHATSAPP: {
331
331
  return {
332
- templateMsg: getWhatsappContent(templateDataObject, true),
332
+ ...getWhatsappContent(templateDataObject, true),
333
333
  };
334
334
  }
335
335
  default:
336
336
  return get(templateDataObject, `versions.base.content`);
337
337
  }
338
338
  };
339
+
339
340
  return (
340
341
  <CreativesWrapper>
341
342
  {!isFullMode && slidBoxContent === 'templates' && (
@@ -993,7 +993,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
993
993
  </CapRow>
994
994
  );
995
995
 
996
- templateData.content = getWhatsappContent(template);
996
+ templateData.content = getWhatsappContent(template).templateMsg;
997
997
  break;
998
998
  default:
999
999
  templateData.content = "";
@@ -10,7 +10,7 @@ import {
10
10
  CAP_GREEN02,
11
11
  } from '@capillarytech/cap-ui-library/styled/variables';
12
12
 
13
- export const UNSUBSCRIBE_TEXT_LENGTH = 37;
13
+ export const UNSUBSCRIBE_TEXT_LENGTH = 36;
14
14
  export const TEMPLATE_MESSAGE_MAX_LENGTH = 1024;
15
15
  export const WHATSAPP = 'WHATSAPP';
16
16
 
@@ -188,7 +188,7 @@ export const Whatsapp = (props) => {
188
188
  // msg = msg.slice(2, -1);
189
189
  //removing Click {{unsubscribe}} to unsubscribe
190
190
  msg = msg.replace(
191
- `Click ${validVarArr[validVarArr.length - 1]} to unsubscribe`,
191
+ `\nClick ${validVarArr[validVarArr.length - 1]} to unsubscribe`,
192
192
  '',
193
193
  );
194
194
  //removing last var added for Click {{unsubscribe}} to unsubscribe
@@ -410,7 +410,7 @@ export const Whatsapp = (props) => {
410
410
  <CapHeading type="h6" className="whatsapp-render-message-length">
411
411
  {formatMessage(messages.templateMessageLength, {
412
412
  currentLength: isEditFlow
413
- ? updatedSmsEditor?.join('')?.length + UNSUBSCRIBE_TEXT_LENGTH - 1
413
+ ? updatedSmsEditor?.join('')?.length + UNSUBSCRIBE_TEXT_LENGTH
414
414
  : templateMessage?.length + UNSUBSCRIBE_TEXT_LENGTH,
415
415
  maxLength: TEMPLATE_MESSAGE_MAX_LENGTH,
416
416
  })}
@@ -515,7 +515,7 @@ export const Whatsapp = (props) => {
515
515
 
516
516
  const getPayloadContent = () => (
517
517
  (isEditFlow && !isFullMode)
518
- ? `${updatedSmsEditor.join('')} ${formatMessage(
518
+ ? `${updatedSmsEditor.join('')}\n${formatMessage(
519
519
  messages.templateMessageUnsubscribeText,
520
520
  )}`
521
521
  : `${templateMessage}\n${formatMessage(
@@ -940,7 +940,7 @@ export const Whatsapp = (props) => {
940
940
  channel={WHATSAPP}
941
941
  content={{ templateMsg }}
942
942
  whatsappContentLen={
943
- isEditFlow ? updatedSmsEditor.join('').length - 1 : templateMessage.length
943
+ isEditFlow ? updatedSmsEditor.join('').length : templateMessage.length
944
944
  }
945
945
  whatsappAccountName={accountName}
946
946
  />
@@ -5,6 +5,7 @@ import {
5
5
  STATUS_OPTIONS,
6
6
  CATEGORY_OPTIONS,
7
7
  WHATSAPP_STATUSES,
8
+ UNSUBSCRIBE_TEXT_LENGTH
8
9
  } from '../Whatsapp/constants';
9
10
 
10
11
  export const getWhatsappContent = (template, isPreview) => {
@@ -28,16 +29,19 @@ export const getWhatsappContent = (template, isPreview) => {
28
29
  `${validVarArr[validVarArr.length - 1]}`,
29
30
  '{{unsubscribe}}',
30
31
  );
31
- return (
32
- <>
33
- <CapLabel type={ isPreview ? "label5" : "label9" }>
34
- {text.slice(0, text.length - 37)}
35
- </CapLabel>
36
- <CapLabel type={ isPreview ? "label11" : "label1" }>
37
- {text.slice(-37)}
38
- </CapLabel>
39
- </>
40
- );
32
+ return {
33
+ templateMsg: (
34
+ <>
35
+ <CapLabel type={ isPreview ? "label5" : "label9" }>
36
+ {text.slice(0, text.length - UNSUBSCRIBE_TEXT_LENGTH)}
37
+ </CapLabel>
38
+ <CapLabel type={ isPreview ? "label11" : "label1" }>
39
+ {text.slice(-UNSUBSCRIBE_TEXT_LENGTH)}
40
+ </CapLabel>
41
+ </>
42
+ ),
43
+ charCount: text?.length - 1,
44
+ };
41
45
  }
42
46
 
43
47
  export const getWhatsappCategory = (category) => {