@capillarytech/creatives-library 7.12.25 → 7.12.26
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
|
@@ -45,13 +45,14 @@ export const CapActionButton = (props) => {
|
|
|
45
45
|
let errorMessage = false;
|
|
46
46
|
if (!isUrl(val)) {
|
|
47
47
|
errorMessage = formatMessage(messages.inValidUrlErrorMessage);
|
|
48
|
-
} else {
|
|
49
|
-
updateButtonChange([{
|
|
50
|
-
type,
|
|
51
|
-
text: buttonText,
|
|
52
|
-
url: val,
|
|
53
|
-
}]);
|
|
54
48
|
}
|
|
49
|
+
updateButtonChange({
|
|
50
|
+
type,
|
|
51
|
+
text: buttonText,
|
|
52
|
+
url: val,
|
|
53
|
+
error: errorMessage,
|
|
54
|
+
});
|
|
55
|
+
|
|
55
56
|
updateButtonURLErrorMessage(errorMessage);
|
|
56
57
|
};
|
|
57
58
|
|
|
@@ -76,81 +76,6 @@ exports[`CapActionButton test Test if CapActionButton component renders 1`] = `
|
|
|
76
76
|
`;
|
|
77
77
|
|
|
78
78
|
exports[`CapActionButton test Test if CapActionButton component renders 2`] = `
|
|
79
|
-
<CapRow
|
|
80
|
-
className="cap-action-button"
|
|
81
|
-
>
|
|
82
|
-
<CapHeading
|
|
83
|
-
type="h4"
|
|
84
|
-
>
|
|
85
|
-
<FormattedMessage
|
|
86
|
-
defaultMessage="Button text"
|
|
87
|
-
id="creatives.componentsV2.CapActionButton.templateButtonText"
|
|
88
|
-
values={Object {}}
|
|
89
|
-
/>
|
|
90
|
-
</CapHeading>
|
|
91
|
-
<_class
|
|
92
|
-
id="rcs-template-Button-Text"
|
|
93
|
-
labelPosition="top"
|
|
94
|
-
maxLength={200}
|
|
95
|
-
onChange={[Function]}
|
|
96
|
-
placeholder="Enter button text"
|
|
97
|
-
size="default"
|
|
98
|
-
suffix={
|
|
99
|
-
<CapLabel
|
|
100
|
-
type="label1"
|
|
101
|
-
>
|
|
102
|
-
9 / 200
|
|
103
|
-
</CapLabel>
|
|
104
|
-
}
|
|
105
|
-
value="testValue"
|
|
106
|
-
/>
|
|
107
|
-
<CapHeading
|
|
108
|
-
style={
|
|
109
|
-
Object {
|
|
110
|
-
"paddingTop": "20px",
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
type="h4"
|
|
114
|
-
>
|
|
115
|
-
<FormattedMessage
|
|
116
|
-
defaultMessage="Button link"
|
|
117
|
-
id="creatives.componentsV2.CapActionButton.templateButtonLink"
|
|
118
|
-
values={Object {}}
|
|
119
|
-
/>
|
|
120
|
-
</CapHeading>
|
|
121
|
-
<_class
|
|
122
|
-
errorMessage="Button URL is not valid"
|
|
123
|
-
id="rcs-template-Button-link"
|
|
124
|
-
labelPosition="top"
|
|
125
|
-
onChange={[Function]}
|
|
126
|
-
placeholder="Enter button link"
|
|
127
|
-
size="default"
|
|
128
|
-
value="testValue"
|
|
129
|
-
/>
|
|
130
|
-
<CapDivider
|
|
131
|
-
style={
|
|
132
|
-
Object {
|
|
133
|
-
"marginBottom": 16,
|
|
134
|
-
"marginTop": 23,
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
/>
|
|
138
|
-
<CapTooltip
|
|
139
|
-
placement="topLeft"
|
|
140
|
-
title="Not enabled yet. Coming soon!"
|
|
141
|
-
>
|
|
142
|
-
<CapButton
|
|
143
|
-
className="disabled-button"
|
|
144
|
-
isAddBtn={true}
|
|
145
|
-
type="flat"
|
|
146
|
-
>
|
|
147
|
-
Add button
|
|
148
|
-
</CapButton>
|
|
149
|
-
</CapTooltip>
|
|
150
|
-
</CapRow>
|
|
151
|
-
`;
|
|
152
|
-
|
|
153
|
-
exports[`CapActionButton test Test if CapActionButton component renders 3`] = `
|
|
154
79
|
<CapRow
|
|
155
80
|
className="cap-action-button"
|
|
156
81
|
>
|
|
@@ -133,6 +133,7 @@ export const Rcs = (props) => {
|
|
|
133
133
|
const [dltPreviewData, setDltPreviewData] = useState('');
|
|
134
134
|
const [suggestions, setSuggestions] = useState([]);
|
|
135
135
|
const [buttonType, setButtonType] = useState('');
|
|
136
|
+
const [suggestionError, setSuggestionError] = useState(true);
|
|
136
137
|
const mediaRadioOptions = [
|
|
137
138
|
{
|
|
138
139
|
value: RCS_MEDIA_TYPES.NONE,
|
|
@@ -167,8 +168,15 @@ export const Rcs = (props) => {
|
|
|
167
168
|
}
|
|
168
169
|
}
|
|
169
170
|
`;
|
|
170
|
-
const updateButtonChange = (
|
|
171
|
-
|
|
171
|
+
const updateButtonChange = (data) => {
|
|
172
|
+
const {
|
|
173
|
+
type,
|
|
174
|
+
text,
|
|
175
|
+
url,
|
|
176
|
+
error,
|
|
177
|
+
} = data;
|
|
178
|
+
setSuggestions([{type, text, url}]);
|
|
179
|
+
setSuggestionError(error);
|
|
172
180
|
};
|
|
173
181
|
const RcsLabel = styled.div`
|
|
174
182
|
display: flex;
|
|
@@ -1004,7 +1012,7 @@ export const Rcs = (props) => {
|
|
|
1004
1012
|
|
|
1005
1013
|
// if call to action (Button text & link) is not added
|
|
1006
1014
|
const {text, url} = suggestions[0] || {};
|
|
1007
|
-
if (buttonType.includes(CTA) && !(text && url) ) {
|
|
1015
|
+
if (buttonType.includes(CTA) && !(text && url && !suggestionError ) ) {
|
|
1008
1016
|
return true;
|
|
1009
1017
|
}
|
|
1010
1018
|
if (templateDescError || fallbackMessageError) {
|