@capillarytech/creatives-library 7.12.41 → 7.12.42

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.41",
4
+ "version": "7.12.42",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -609,6 +609,7 @@ export const Whatsapp = (props) => {
609
609
  }
610
610
  />
611
611
  <CapRadioGroup
612
+ disabled={isEditFlow}
612
613
  options={buttonRadioOptions || []}
613
614
  value={buttonType}
614
615
  onChange={onChangeButtonType}
@@ -841,11 +842,24 @@ export const Whatsapp = (props) => {
841
842
  if (templateMessage.trim() === '' || templateMessageError) {
842
843
  return true;
843
844
  }
844
- if (buttonType === WHATSAPP_BUTTON_TYPES.CTA) {
845
- return !ctaData.every((i) => i.isSaved === true);
845
+ //cta
846
+ if (buttonType === WHATSAPP_BUTTON_TYPES.CTA) {
847
+ if (ctaData.length === 1 && ctaData[0].isSaved) {
848
+ //if button type is cta and 1st button is saved
849
+ return false;
850
+ } else if (
851
+ ctaData.length === 2 &&
852
+ ctaData[0].isSaved &&
853
+ ctaData[1].isSaved
854
+ ) {
855
+ //if button type is cta and 2nd button is saved
856
+ return false;
846
857
  }
847
- return false;
848
- };
858
+ //if button type is cta and there are no buttons saved
859
+ return true;
860
+ }
861
+ return false;
862
+ };
849
863
 
850
864
  const createModeContent = (
851
865
  <>
@@ -1160,6 +1174,13 @@ export const Whatsapp = (props) => {
1160
1174
 
1161
1175
  {renderMessageLength()}
1162
1176
  {isTagValidationError && tagValidationErrorMessage()}
1177
+ {computeTextLength() > TEMPLATE_MESSAGE_MAX_LENGTH ? (
1178
+ <CapError>
1179
+ {formatMessage(messages.templateMessageLengthError)}
1180
+ </CapError>
1181
+ ) : (
1182
+ ''
1183
+ )}
1163
1184
 
1164
1185
  <CapTooltip
1165
1186
  placement="bottom"
@@ -1202,7 +1223,8 @@ export const Whatsapp = (props) => {
1202
1223
 
1203
1224
  const isEditDoneDisabled = () =>
1204
1225
  isTagValidationError ||
1205
- Object.values(varMap).some((inputValue) => inputValue === '');
1226
+ Object.values(varMap).some((inputValue) => inputValue === '') ||
1227
+ computeTextLength() > TEMPLATE_MESSAGE_MAX_LENGTH;
1206
1228
  return (
1207
1229
  <CapSpin spinning={spin}>
1208
1230
  <CapRow className="cap-whatsapp-creatives">