@capillarytech/creatives-library 7.11.4 → 7.11.6

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.4",
4
+ "version": "7.11.6",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -43,6 +43,7 @@
43
43
  &.line-preview {
44
44
  margin-left: $CAP_SPACE_16;
45
45
  width: 40%;
46
+ left: 197px;
46
47
 
47
48
  .message-pop {
48
49
  width: 80%;
@@ -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} />
@@ -447,7 +447,7 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
447
447
  className="msg-container line-preview"
448
448
  style={{
449
449
  maxHeight: 330,
450
- overflow: 'scroll',
450
+ overflow: 'auto',
451
451
  flexDirection: 'column',
452
452
  marginLeft: 40,
453
453
  }}
@@ -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
  })}
@@ -438,30 +438,18 @@ export const Whatsapp = (props) => {
438
438
  setTemplateCategory(value);
439
439
  };
440
440
 
441
- const onAddVar = (isAutoComplete) => {
442
- let tempMessage = templateMessage;
443
-
444
- //if autocomplete feature, first remove the trailing bracket and then add variable
445
- if (isAutoComplete) {
446
- tempMessage = tempMessage.slice(0, templateMessage.length - 1);
447
- }
448
- const validVarArr = tempMessage.match(validVarRegex) || [];
449
- const tempMsg = `${tempMessage}{{${validVarArr.length + 1}}}`;
441
+ const onAddVar = () => {
442
+ const validVarArr = templateMessage.match(validVarRegex) || [];
443
+ const tempMsg = `${templateMessage}{{${validVarArr.length + 1}}}`;
450
444
  const error = templateMessageErrorHandler(tempMsg);
451
445
  setTemplateMessage(tempMsg);
452
446
  setTemplateMessageError(error);
453
447
  };
454
448
 
455
449
  const onTemplateMessageChange = ({ target: { value } }) => {
456
- // autocomplete feature
457
- if ( value.slice(-2) === '{{' ) {
458
- onAddVar(true);
459
- }
460
- else {
461
- const error = templateMessageErrorHandler(value);
462
- setTemplateMessage(value);
463
- setTemplateMessageError(error);
464
- }
450
+ const error = templateMessageErrorHandler(value);
451
+ setTemplateMessage(value);
452
+ setTemplateMessageError(error);
465
453
  };
466
454
 
467
455
  const templateMessageErrorHandler = (value) => {
@@ -515,7 +503,7 @@ export const Whatsapp = (props) => {
515
503
 
516
504
  const getPayloadContent = () => (
517
505
  (isEditFlow && !isFullMode)
518
- ? `${updatedSmsEditor.join('')} ${formatMessage(
506
+ ? `${updatedSmsEditor.join('')}\n${formatMessage(
519
507
  messages.templateMessageUnsubscribeText,
520
508
  )}`
521
509
  : `${templateMessage}\n${formatMessage(
@@ -940,7 +928,7 @@ export const Whatsapp = (props) => {
940
928
  channel={WHATSAPP}
941
929
  content={{ templateMsg }}
942
930
  whatsappContentLen={
943
- isEditFlow ? updatedSmsEditor.join('').length - 1 : templateMessage.length
931
+ isEditFlow ? updatedSmsEditor.join('').length : templateMessage.length
944
932
  }
945
933
  whatsappAccountName={accountName}
946
934
  />