@capillarytech/creatives-library 7.16.7 → 7.16.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.16.7",
4
+ "version": "7.16.8",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -142,7 +142,7 @@ export const CapWhatsappCTA = (props) => {
142
142
 
143
143
  const onButtonTextChange = ({ target }) => {
144
144
  const { value, id } = target;
145
- let errorMessage = false;
145
+ let errorMessage = '';
146
146
  if (!isValidText(value)) {
147
147
  errorMessage = formatMessage(messages.ctaButtonErrorMessage);
148
148
  }
@@ -179,14 +179,12 @@ export const CapWhatsappCTA = (props) => {
179
179
 
180
180
  const ctaSaveDisabled = (index) => {
181
181
  const { ctaType, text, phone_number, url } = ctaData[index] || {};
182
- if (text === '') {
182
+ if (text === '' || buttonError) {
183
183
  return true;
184
184
  } else if (ctaType === PHONE_NUMBER && phone_number.length < 5) {
185
185
  return true;
186
186
  } else if (ctaType === WEBSITE && (url === '' || urlError)) {
187
187
  return true;
188
- } else if (text === '' || buttonError) {
189
- return true;
190
188
  }
191
189
  return false;
192
190
  };
@@ -55,7 +55,7 @@ export default defineMessages({
55
55
  },
56
56
  ctaButtonErrorMessage: {
57
57
  id: `${prefix}.ctaButtonErrorMessage`,
58
- defaultMessage: "Newlines, Emojis, or Special characters not allowed",
58
+ defaultMessage: "Newlines, Emojis, or Special characters are not allowed",
59
59
  },
60
60
  addButton: {
61
61
  id: `${prefix}.addButton`,
@@ -72,6 +72,10 @@ describe('line wrapper test/>', () => {
72
72
  const textWithEmojis = 'Invalid text 😊';
73
73
  expect(isValidText(textWithEmojis)).toBe(false);
74
74
  });
75
+ it('should return false for text with emojis,newlines,special char', () => {
76
+ const textWithEmojis = 'Invalid text 😊@#$ \n';
77
+ expect(isValidText(textWithEmojis)).toBe(false);
78
+ });
75
79
 
76
80
  it('should return true for an empty string', () => {
77
81
  const emptyString = '';