@capillarytech/creatives-library 7.12.65 → 7.12.67
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 +1 -1
- package/v2Components/CapImageUpload/index.js +4 -4
- package/v2Components/CapWhatsappCTA/index.js +14 -7
- package/v2Containers/Templates/sagas.js +1 -1
- package/v2Containers/Whatsapp/index.js +12 -11
- package/v2Containers/Whatsapp/messages.js +3 -3
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +1469 -357
- package/v2Containers/Whatsapp/utils.js +3 -4
package/package.json
CHANGED
|
@@ -242,7 +242,7 @@ function CapImageUpload(props) {
|
|
|
242
242
|
/>
|
|
243
243
|
</form>
|
|
244
244
|
<div className="image-info-wrapper">
|
|
245
|
-
{channel === WHATSAPP
|
|
245
|
+
{channel === WHATSAPP && (
|
|
246
246
|
<>
|
|
247
247
|
<CapHeadingSpan type="label2">
|
|
248
248
|
<FormattedMessage {...messages.whatsappImageSize} />
|
|
@@ -251,12 +251,12 @@ function CapImageUpload(props) {
|
|
|
251
251
|
<FormattedMessage {...messages.whatsappAspectRatio} />
|
|
252
252
|
</CapHeadingSpan>
|
|
253
253
|
</>
|
|
254
|
-
)
|
|
254
|
+
)}
|
|
255
|
+
{channel !== WHATSAPP && (
|
|
255
256
|
<CapHeadingSpan type="label2" className="image-dimension">
|
|
256
257
|
<FormattedMessage {...messages.imageDimenstionDescription} values={{ width: imgWidth, height: imgHeight }} />
|
|
257
258
|
</CapHeadingSpan>
|
|
258
|
-
)
|
|
259
|
-
}
|
|
259
|
+
)}
|
|
260
260
|
{channel === FACEBOOK && (
|
|
261
261
|
<CapHeadingSpan type="label2" className="image-aspect-ratio">
|
|
262
262
|
<FormattedMessage {...messages.aspectRatio} />
|
|
@@ -62,12 +62,14 @@ export const CapWhatsappCTA = (props) => {
|
|
|
62
62
|
...clonedCta,
|
|
63
63
|
[type]: value,
|
|
64
64
|
};
|
|
65
|
-
if (type === 'urlType'
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
if (type === 'urlType') {
|
|
66
|
+
if (value === STATIC_URL) {
|
|
67
|
+
clonedCta.url = '';
|
|
68
|
+
setUrlError(false);
|
|
69
|
+
} else if (value === DYNAMIC_URL) {
|
|
70
|
+
clonedCta.url = '{{1}}';
|
|
71
|
+
setUrlError(formatMessage(messages.ctaWebsiteUrlErrorMessage));
|
|
72
|
+
}
|
|
71
73
|
}
|
|
72
74
|
updateHandler(clonedCta, index);
|
|
73
75
|
};
|
|
@@ -164,7 +166,10 @@ export const CapWhatsappCTA = (props) => {
|
|
|
164
166
|
let errorMessage = false;
|
|
165
167
|
if (!isUrl(value)) {
|
|
166
168
|
errorMessage = formatMessage(messages.ctaWebsiteUrlErrorMessage);
|
|
167
|
-
} else if (
|
|
169
|
+
} else if (
|
|
170
|
+
urlType === STATIC_URL &&
|
|
171
|
+
value.match(invalidVarRegex)?.length > 0
|
|
172
|
+
) {
|
|
168
173
|
errorMessage = formatMessage(messages.staticUrlWithVarErrorMessage);
|
|
169
174
|
}
|
|
170
175
|
setUrlError(errorMessage);
|
|
@@ -196,6 +201,7 @@ export const CapWhatsappCTA = (props) => {
|
|
|
196
201
|
ctaData.forEach((cta) => {
|
|
197
202
|
const { index, ctaType, text, phone_number, urlType, url, isSaved } =
|
|
198
203
|
cta || {};
|
|
204
|
+
//this is to display buttons after they are saved, in both create and edit mode.
|
|
199
205
|
if (isSaved) {
|
|
200
206
|
const ctaIsPhone = ctaType === PHONE_NUMBER;
|
|
201
207
|
const urlTypeIsDynamic = urlType === DYNAMIC_URL;
|
|
@@ -284,6 +290,7 @@ export const CapWhatsappCTA = (props) => {
|
|
|
284
290
|
</CapRow>,
|
|
285
291
|
);
|
|
286
292
|
} else {
|
|
293
|
+
//this is to display buttons before they are saved, only in create mode.
|
|
287
294
|
renderArray.push(
|
|
288
295
|
<CapRow
|
|
289
296
|
className="cap-whatsapp-cta margin-t-16"
|
|
@@ -157,7 +157,7 @@ export function* getSenderDetails({
|
|
|
157
157
|
if (!apiResponse?.errors?.length) {
|
|
158
158
|
yield put({
|
|
159
159
|
type: types.GET_SENDER_DETAILS_SUCCESS,
|
|
160
|
-
payload: apiResponse
|
|
160
|
+
payload: apiResponse?.entity?.WHATSAPP[0]?.domainProperties?.hostName || '',
|
|
161
161
|
});
|
|
162
162
|
} else {
|
|
163
163
|
yield put({
|
|
@@ -871,13 +871,7 @@ export const Whatsapp = (props) => {
|
|
|
871
871
|
});
|
|
872
872
|
|
|
873
873
|
const actionCallback = ({ errorMessage }) => {
|
|
874
|
-
|
|
875
|
-
if (host === HOST_KARIX) {
|
|
876
|
-
error = JSON.parse(errorMessage.errorMessage).error.message || 'Error';
|
|
877
|
-
} else {
|
|
878
|
-
error = errorMessage?.message || errorMessage;
|
|
879
|
-
}
|
|
880
|
-
if (!error) {
|
|
874
|
+
if (!errorMessage) {
|
|
881
875
|
CapNotification.success({
|
|
882
876
|
message: formatMessage(messages.whatsappCreateNotification, {
|
|
883
877
|
name: templateName,
|
|
@@ -886,7 +880,7 @@ export const Whatsapp = (props) => {
|
|
|
886
880
|
actions.clearCreateResponse();
|
|
887
881
|
} else {
|
|
888
882
|
CapNotification.error({
|
|
889
|
-
message:
|
|
883
|
+
message: JSON.stringify(errorMessage),
|
|
890
884
|
});
|
|
891
885
|
}
|
|
892
886
|
};
|
|
@@ -1379,7 +1373,7 @@ export const Whatsapp = (props) => {
|
|
|
1379
1373
|
<CapTooltip
|
|
1380
1374
|
title={
|
|
1381
1375
|
isDisableDone()
|
|
1382
|
-
? formatMessage(messages.
|
|
1376
|
+
? formatMessage(messages.btnDisabledTooltip)
|
|
1383
1377
|
: ''
|
|
1384
1378
|
}
|
|
1385
1379
|
placement={'right'}
|
|
@@ -1404,7 +1398,14 @@ export const Whatsapp = (props) => {
|
|
|
1404
1398
|
</>
|
|
1405
1399
|
)}
|
|
1406
1400
|
{!isFullMode && isEditFlow && (
|
|
1407
|
-
|
|
1401
|
+
<CapTooltip
|
|
1402
|
+
title={
|
|
1403
|
+
isEditDoneDisabled()
|
|
1404
|
+
? formatMessage(messages.btnDisabledTooltip)
|
|
1405
|
+
: ''
|
|
1406
|
+
}
|
|
1407
|
+
placement={'right'}
|
|
1408
|
+
>
|
|
1408
1409
|
<CapButton
|
|
1409
1410
|
onClick={saveToMessage}
|
|
1410
1411
|
disabled={isEditDoneDisabled()}
|
|
@@ -1412,7 +1413,7 @@ export const Whatsapp = (props) => {
|
|
|
1412
1413
|
>
|
|
1413
1414
|
<FormattedMessage {...globalMessages.done} />
|
|
1414
1415
|
</CapButton>
|
|
1415
|
-
|
|
1416
|
+
</CapTooltip>
|
|
1416
1417
|
)}
|
|
1417
1418
|
</WhatsappFooter>
|
|
1418
1419
|
</CapSpin>
|
|
@@ -185,8 +185,8 @@ export default defineMessages({
|
|
|
185
185
|
id: `${prefix}.sendForApprovalButtonLabel`,
|
|
186
186
|
defaultMessage: 'Send for approval',
|
|
187
187
|
},
|
|
188
|
-
|
|
189
|
-
id: `${prefix}.
|
|
188
|
+
btnDisabledTooltip: {
|
|
189
|
+
id: `${prefix}.btnDisabledTooltip`,
|
|
190
190
|
defaultMessage: 'Please add all mandatory fields to proceed further',
|
|
191
191
|
},
|
|
192
192
|
cancelButtonLabel: {
|
|
@@ -286,7 +286,7 @@ export default defineMessages({
|
|
|
286
286
|
},
|
|
287
287
|
btnTypeQuickReply: {
|
|
288
288
|
id: `${prefix}.btnTypeQuickReply`,
|
|
289
|
-
defaultMessage: '
|
|
289
|
+
defaultMessage: 'Quick reply',
|
|
290
290
|
},
|
|
291
291
|
quickReplyDesc: {
|
|
292
292
|
id: `${prefix}.quickReplyDesc`,
|