@capillarytech/creatives-library 7.12.24 → 7.12.25

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.12.24",
4
+ "version": "7.12.25",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -19,7 +19,7 @@ export const TEMPLATE_DESC_MAX_LENGTH = 1000;
19
19
  export const FALLBACK_MESSAGE_MAX_LENGTH = 160;
20
20
  export const TEMPLATE_TITLE_MAX_LENGTH = 200;
21
21
  export const TEMPLATE_BUTTON_TEXT_MAX_LENGTH = 20;
22
-
22
+ export const CTA = 'CTA';
23
23
  export const TAG = 'TAG';
24
24
  export const EMBEDDED = 'embedded';
25
25
  export const DEFAULT = 'default';
@@ -70,6 +70,7 @@ import {
70
70
  VERTICAL,
71
71
  STANDALONE,
72
72
  RICHCARD,
73
+ CTA,
73
74
  } from './constants';
74
75
  import globalMessages from '../Cap/messages';
75
76
  import messages from './messages';
@@ -182,14 +183,14 @@ export const Rcs = (props) => {
182
183
  <FormattedMessage {...messages.templateCTAButtonDesc} />
183
184
  </CapLabel>
184
185
  </div>
185
- {buttonType && <CapActionButton
186
- type="CTA"
186
+ {buttonType.includes(CTA) && <CapActionButton
187
+ type={CTA}
187
188
  buttonTextlen={TEMPLATE_BUTTON_TEXT_MAX_LENGTH}
188
189
  updateButtonChange={updateButtonChange}
189
190
  suggestions={suggestions}
190
191
  />}
191
192
  </>,
192
- value: "CTA",
193
+ value: CTA,
193
194
  },
194
195
  {
195
196
  label: <CapTooltip
@@ -248,7 +249,7 @@ export const Rcs = (props) => {
248
249
  setEditFlow(true);
249
250
  if (rcsSuggestions.length > 0) {
250
251
  setSuggestions(rcsSuggestions);
251
- setButtonType(["CTA"]);
252
+ setButtonType(CTA);
252
253
  }
253
254
 
254
255
  // for DLT Fallback message
@@ -453,10 +454,11 @@ export const Rcs = (props) => {
453
454
  }
454
455
  return errorMessage;
455
456
  };
456
- const onChangeButtonTypes = (val) => {
457
- setButtonType(val[0]);
457
+
458
+ const onChangeButtonTypes = useCallback((checkedValues) => {
459
+ setButtonType(checkedValues);
458
460
  setSuggestions([]);
459
- };
461
+ });
460
462
  const renderTextComponent = (
461
463
  <>
462
464
  {/* template title */}
@@ -1002,7 +1004,7 @@ export const Rcs = (props) => {
1002
1004
 
1003
1005
  // if call to action (Button text & link) is not added
1004
1006
  const {text, url} = suggestions[0] || {};
1005
- if (buttonType && !(text && url) ) {
1007
+ if (buttonType.includes(CTA) && !(text && url) ) {
1006
1008
  return true;
1007
1009
  }
1008
1010
  if (templateDescError || fallbackMessageError) {
@@ -1029,7 +1031,7 @@ export const Rcs = (props) => {
1029
1031
  let mediaTypeMsg = isMediaTypeNone ? 'textMessage' : 'image';
1030
1032
  mediaTypeMsg = formatMessage(messages[mediaTypeMsg]);
1031
1033
  const {text, url} = suggestions[0] || {};
1032
- if (buttonType && !(text && url) ) {
1034
+ if (buttonType.includes(CTA) && !(text && url) ) {
1033
1035
  mediaTypeMsg = `${formatMessage(messages.buttonTextAndUrl)} ${mediaTypeMsg} `;
1034
1036
  }
1035
1037
  return (