@capillarytech/creatives-library 7.12.51 → 7.12.54
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/services/api.js +15 -2
- package/v2Components/CapImageUpload/index.js +33 -17
- package/v2Components/CapImageUpload/messages.js +11 -3
- package/v2Components/CapWhatsappCTA/constants.js +12 -1
- package/v2Components/CapWhatsappCTA/index.js +109 -29
- package/v2Components/CapWhatsappCTA/index.scss +9 -6
- package/v2Components/CapWhatsappCTA/messages.js +31 -1
- package/v2Components/TemplatePreview/_templatePreview.scss +9 -8
- package/v2Components/TemplatePreview/index.js +8 -6
- package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +3 -19
- package/v2Components/TemplatePreview/tests/index.test.js +0 -2
- package/v2Components/WhatsappStatusContainer/index.js +42 -52
- package/v2Containers/CreativesContainer/SlideBoxContent.js +0 -1
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +5 -7
- package/v2Containers/Line/Container/ImageCarousel/index.js +6 -7
- package/v2Containers/Line/Container/index.js +3 -1
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +4660 -652
- package/v2Containers/Templates/_templates.scss +5 -0
- package/v2Containers/Templates/actions.js +7 -0
- package/v2Containers/Templates/constants.js +9 -1
- package/v2Containers/Templates/index.js +45 -30
- package/v2Containers/Templates/messages.js +1 -1
- package/v2Containers/Templates/reducer.js +15 -0
- package/v2Containers/Templates/sagas.js +32 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1774 -1881
- package/v2Containers/Templates/tests/index.test.js +14 -3
- package/v2Containers/Whatsapp/actions.js +22 -0
- package/v2Containers/Whatsapp/constants.js +56 -23
- package/v2Containers/Whatsapp/index.js +208 -66
- package/v2Containers/Whatsapp/index.scss +18 -2
- package/v2Containers/Whatsapp/messages.js +35 -7
- package/v2Containers/Whatsapp/reducer.js +35 -1
- package/v2Containers/Whatsapp/sagas.js +30 -1
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +44373 -32926
- package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +15 -21
- package/v2Containers/Whatsapp/utils.js +16 -9
- package/v2Containers/mockdata.js +150 -399
package/package.json
CHANGED
package/services/api.js
CHANGED
|
@@ -119,7 +119,7 @@ function request(url, options, handleUnauthorizedStatus) {
|
|
|
119
119
|
.catch((error) => error);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
function getAPICallObject(method, body, isFileUpload = false, loadCampaignHeaders = false) {
|
|
122
|
+
function getAPICallObject(method, body, isFileUpload = false, loadCampaignHeaders = false, orgUnitId = false) {
|
|
123
123
|
const token = loadItem('token');
|
|
124
124
|
const orgID = loadItem('orgID');
|
|
125
125
|
const user = loadItem('user');
|
|
@@ -138,6 +138,9 @@ function getAPICallObject(method, body, isFileUpload = false, loadCampaignHeader
|
|
|
138
138
|
if (token !== undefined) {
|
|
139
139
|
headers['X-CAP-CT'] = token;
|
|
140
140
|
}
|
|
141
|
+
if (orgUnitId) {
|
|
142
|
+
headers['X-CAP-OU'] = orgUnitId;
|
|
143
|
+
}
|
|
141
144
|
} else {
|
|
142
145
|
if (user && user.refID) {
|
|
143
146
|
headers['X-CAP-REMOTE-USER'] = user.refID;
|
|
@@ -299,7 +302,7 @@ export const deleteAssetById = ({assetId, assetType}) => {
|
|
|
299
302
|
// return API.deleteResource(url);
|
|
300
303
|
};
|
|
301
304
|
|
|
302
|
-
export const uploadFile = ({file, assetType, fileParams, mode, wechatParams}) => {
|
|
305
|
+
export const uploadFile = ({file, assetType, fileParams, mode, wechatParams, whatsappParams}) => {
|
|
303
306
|
const data = new FormData();
|
|
304
307
|
data.append('file', file);
|
|
305
308
|
data.append('fileParam', JSON.stringify(fileParams));
|
|
@@ -311,6 +314,11 @@ export const uploadFile = ({file, assetType, fileParams, mode, wechatParams}) =>
|
|
|
311
314
|
data.append('appId', wechatParams.appId);
|
|
312
315
|
data.append('appSecret', wechatParams.appSecret);
|
|
313
316
|
}
|
|
317
|
+
if (whatsappParams) {
|
|
318
|
+
data.append('source', whatsappParams.source);
|
|
319
|
+
data.append('wabaId', whatsappParams.wabaId);
|
|
320
|
+
data.append('accessToken', whatsappParams.accessToken);
|
|
321
|
+
}
|
|
314
322
|
const url = `${API_ENDPOINT}/assets/${assetType}`;
|
|
315
323
|
// return API.post(url, data, true);
|
|
316
324
|
return request(url, getAPICallObject('POST', data, true));
|
|
@@ -472,3 +480,8 @@ export const createWhatsappTemplate = ({ payload }) => {
|
|
|
472
480
|
const url = `${API_ENDPOINT}/templates/WHATSAPP`;
|
|
473
481
|
return request(url, getAPICallObject('POST', payload));
|
|
474
482
|
};
|
|
483
|
+
|
|
484
|
+
export const getSenderDetails = (channel, orgUnitId) => {
|
|
485
|
+
const url = `${CAMPAIGNS_API_ORG_ENDPOINT}/meta/domainProperties?channel=${channel}`;
|
|
486
|
+
return request(url, getAPICallObject('GET', null, false, true, orgUnitId));
|
|
487
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
1
2
|
/**
|
|
2
3
|
*
|
|
3
4
|
* CapImageUpload
|
|
@@ -16,10 +17,10 @@ import {
|
|
|
16
17
|
CapImage,
|
|
17
18
|
} from '@capillarytech/cap-ui-library';
|
|
18
19
|
import { injectIntl, FormattedMessage, intlShape} from 'react-intl';
|
|
19
|
-
import get from 'lodash
|
|
20
|
+
import { isEmpty, get } from 'lodash';
|
|
20
21
|
import './index.scss';
|
|
21
22
|
import Gallery from '../../v2Containers/Assets/Gallery';
|
|
22
|
-
import { FACEBOOK, RCS } from "../../v2Containers/CreativesContainer/constants";
|
|
23
|
+
import { FACEBOOK, RCS, WHATSAPP } from "../../v2Containers/CreativesContainer/constants";
|
|
23
24
|
|
|
24
25
|
import messages from './messages';
|
|
25
26
|
function CapImageUpload(props) {
|
|
@@ -48,9 +49,10 @@ function CapImageUpload(props) {
|
|
|
48
49
|
|
|
49
50
|
|
|
50
51
|
useEffect(() => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
const imageDataObj = imageData[`uploadedAssetData${index}`];
|
|
53
|
+
if (!isEmpty(imageDataObj)) {
|
|
54
|
+
const { secure_file_path = '', karixFileHandle = '' } = get(imageDataObj, 'metaInfo', {});
|
|
55
|
+
updateImageSrc(secure_file_path, karixFileHandle);
|
|
54
56
|
}
|
|
55
57
|
}, [imageData[`uploadedAssetData${index}`]]);
|
|
56
58
|
|
|
@@ -111,7 +113,7 @@ function CapImageUpload(props) {
|
|
|
111
113
|
const { size } = file || {};
|
|
112
114
|
const { height, width, error } = fileParams || {};
|
|
113
115
|
if (incorrectFile || size > imgSize || height > imgHeight || width > imgWidth || error) {
|
|
114
|
-
updateImageErrorMessage(formatMessage(messages.
|
|
116
|
+
updateImageErrorMessage(formatMessage(messages.imageErrorDesc));
|
|
115
117
|
} else {
|
|
116
118
|
updateImageErrorMessage('');
|
|
117
119
|
uploadAsset(
|
|
@@ -143,7 +145,7 @@ function CapImageUpload(props) {
|
|
|
143
145
|
const {secure_file_path: image, width, height, file_size: size} = get(imageTemplate, 'metaInfo', {});
|
|
144
146
|
updateDrawerRequirement(false);
|
|
145
147
|
if (!allowedExtensionsRegex.test(image) || height > imgHeight || width > imgWidth || size > imgSize ) {
|
|
146
|
-
updateImageErrorMessage(formatMessage(messages.
|
|
148
|
+
updateImageErrorMessage(formatMessage(messages.imageErrorDesc));
|
|
147
149
|
} else {
|
|
148
150
|
updateImageErrorMessage('');
|
|
149
151
|
updateImageSrc(image);
|
|
@@ -188,13 +190,15 @@ function CapImageUpload(props) {
|
|
|
188
190
|
<CapButton className="dragger-button upload-image" type="secondary">
|
|
189
191
|
<FormattedMessage {...messages.uploadComputer} />
|
|
190
192
|
</CapButton>
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
193
|
+
{channel !== WHATSAPP && (
|
|
194
|
+
<CapButton
|
|
195
|
+
className="dragger-button gallery-select"
|
|
196
|
+
type="secondary"
|
|
197
|
+
onClick={onGalleryClick}
|
|
198
|
+
>
|
|
199
|
+
<FormattedMessage {...messages.uploadGallery} />
|
|
200
|
+
</CapButton>
|
|
201
|
+
)}
|
|
198
202
|
</CapUploader.CapDragger>
|
|
199
203
|
|
|
200
204
|
|
|
@@ -238,9 +242,21 @@ function CapImageUpload(props) {
|
|
|
238
242
|
/>
|
|
239
243
|
</form>
|
|
240
244
|
<div className="image-info-wrapper">
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
245
|
+
{channel === WHATSAPP ? (
|
|
246
|
+
<>
|
|
247
|
+
<CapHeadingSpan type="label2">
|
|
248
|
+
<FormattedMessage {...messages.whatsappImageSize} />
|
|
249
|
+
</CapHeadingSpan>
|
|
250
|
+
<CapHeadingSpan type="label2">
|
|
251
|
+
<FormattedMessage {...messages.whatsappAspectRatio} />
|
|
252
|
+
</CapHeadingSpan>
|
|
253
|
+
</>
|
|
254
|
+
) : (
|
|
255
|
+
<CapHeadingSpan type="label2" className="image-dimension">
|
|
256
|
+
<FormattedMessage {...messages.imageDimenstionDescription} values={{ width: imgWidth, height: imgHeight }} />
|
|
257
|
+
</CapHeadingSpan>
|
|
258
|
+
)
|
|
259
|
+
}
|
|
244
260
|
{channel === FACEBOOK && (
|
|
245
261
|
<CapHeadingSpan type="label2" className="image-aspect-ratio">
|
|
246
262
|
<FormattedMessage {...messages.aspectRatio} />
|
|
@@ -2,6 +2,14 @@ import { defineMessages } from 'react-intl';
|
|
|
2
2
|
const scope = `creatives.componentsV2.CapImageUpload`;
|
|
3
3
|
|
|
4
4
|
export default defineMessages({
|
|
5
|
+
whatsappImageSize: {
|
|
6
|
+
id: `${scope}.whatsappImageSize`,
|
|
7
|
+
defaultMessage: 'Size upto: 5MB',
|
|
8
|
+
},
|
|
9
|
+
whatsappAspectRatio: {
|
|
10
|
+
id: `${scope}.whatsappAspectRatio`,
|
|
11
|
+
defaultMessage: 'Max aspect ratio: 1.91:1',
|
|
12
|
+
},
|
|
5
13
|
uploadGallery: {
|
|
6
14
|
id: `${scope}.uploadGallery`,
|
|
7
15
|
defaultMessage: 'Gallery',
|
|
@@ -34,10 +42,10 @@ export default defineMessages({
|
|
|
34
42
|
id: `${scope}.format`,
|
|
35
43
|
defaultMessage: 'Format: JPEG, JPG, PNG',
|
|
36
44
|
},
|
|
37
|
-
|
|
38
|
-
id: `${scope}.
|
|
45
|
+
imageErrorDesc: {
|
|
46
|
+
id: `${scope}.imageErrorDesc`,
|
|
39
47
|
defaultMessage:
|
|
40
|
-
'Please upload the image with
|
|
48
|
+
'Please upload the image with allowed file extension, size, dimension and aspect ratio',
|
|
41
49
|
},
|
|
42
50
|
imageGallery: {
|
|
43
51
|
id: `${scope}.imageGallery`,
|
|
@@ -22,12 +22,23 @@ export const CTA_OPTIONS = [
|
|
|
22
22
|
},
|
|
23
23
|
];
|
|
24
24
|
|
|
25
|
-
export const
|
|
25
|
+
export const TWILIO_URL_OPTIONS = [
|
|
26
26
|
{
|
|
27
27
|
value: STATIC_URL,
|
|
28
28
|
label: <FormattedMessage {...messages.ctaWebsiteTypeStatic} />,
|
|
29
29
|
},
|
|
30
30
|
];
|
|
31
|
+
|
|
32
|
+
export const KARIX_URL_OPTIONS = [
|
|
33
|
+
{
|
|
34
|
+
value: STATIC_URL,
|
|
35
|
+
label: <FormattedMessage {...messages.ctaWebsiteTypeStatic} />,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
value: DYNAMIC_URL,
|
|
39
|
+
label: <FormattedMessage {...messages.ctaWebsiteTypeDynamic} />,
|
|
40
|
+
},
|
|
41
|
+
];
|
|
31
42
|
export const BTN_MAX_LENGTH = 20;
|
|
32
43
|
export const PHONE_NUMBER_MAX_LENGTH = 15;
|
|
33
44
|
export const URL_MAX_LENGTH = 2000;
|
|
@@ -21,21 +21,41 @@ import whatsappMsg from '../../v2Containers/Whatsapp/messages';
|
|
|
21
21
|
import messages from './messages';
|
|
22
22
|
import './index.scss';
|
|
23
23
|
import { isUrl } from '../../v2Containers/Line/Container/Wrapper/utils';
|
|
24
|
+
import TagList from '../../v2Containers/TagList';
|
|
24
25
|
import {
|
|
25
26
|
CTA_OPTIONS,
|
|
26
27
|
BTN_MAX_LENGTH,
|
|
27
28
|
PHONE_NUMBER_MAX_LENGTH,
|
|
28
|
-
|
|
29
|
+
TWILIO_URL_OPTIONS,
|
|
30
|
+
KARIX_URL_OPTIONS,
|
|
29
31
|
URL_MAX_LENGTH,
|
|
30
32
|
PHONE_NUMBER,
|
|
31
33
|
WEBSITE,
|
|
34
|
+
DYNAMIC_URL,
|
|
32
35
|
STATIC_URL,
|
|
33
36
|
} from './constants';
|
|
34
|
-
import {
|
|
37
|
+
import {
|
|
38
|
+
INITIAL_CTA_DATA,
|
|
39
|
+
HOST_KARIX,
|
|
40
|
+
} from '../../v2Containers/Whatsapp/constants';
|
|
35
41
|
|
|
36
42
|
export const CapWhatsappCTA = (props) => {
|
|
37
|
-
const {
|
|
43
|
+
const {
|
|
44
|
+
intl,
|
|
45
|
+
ctaData = [],
|
|
46
|
+
updateHandler,
|
|
47
|
+
deleteHandler,
|
|
48
|
+
isEditFlow,
|
|
49
|
+
hostName,
|
|
50
|
+
isFullMode,
|
|
51
|
+
tags = [],
|
|
52
|
+
injectedTags = {},
|
|
53
|
+
selectedOfferDetails = [],
|
|
54
|
+
} = props;
|
|
38
55
|
const { formatMessage } = intl;
|
|
56
|
+
const validVarRegex = /{{(1)}}/g;
|
|
57
|
+
const invalidVarRegex = /{{(.*?)}}/g;
|
|
58
|
+
const moreThanTwoBracketsRegex = /{{3,}(1)}{3,}/g;
|
|
39
59
|
|
|
40
60
|
const [urlError, setUrlError] = useState(false);
|
|
41
61
|
|
|
@@ -45,6 +65,9 @@ export const CapWhatsappCTA = (props) => {
|
|
|
45
65
|
...clonedCta,
|
|
46
66
|
[type]: value,
|
|
47
67
|
};
|
|
68
|
+
if (type === 'urlType') {
|
|
69
|
+
clonedCta.url = '';
|
|
70
|
+
}
|
|
48
71
|
updateHandler(clonedCta, index);
|
|
49
72
|
};
|
|
50
73
|
|
|
@@ -57,6 +80,10 @@ export const CapWhatsappCTA = (props) => {
|
|
|
57
80
|
</CapHeading>
|
|
58
81
|
);
|
|
59
82
|
|
|
83
|
+
const onTagSelect = (data, index, url) => {
|
|
84
|
+
updateHelper('url', url.replace('{{1}}', `{{${data}}}`), index);
|
|
85
|
+
};
|
|
86
|
+
|
|
60
87
|
const onCtaTypeChange = (value, index) => {
|
|
61
88
|
let clonedCta = cloneDeep(ctaData[index]);
|
|
62
89
|
clonedCta = {
|
|
@@ -119,11 +146,34 @@ export const CapWhatsappCTA = (props) => {
|
|
|
119
146
|
updateHelper('phone_number', value, index);
|
|
120
147
|
};
|
|
121
148
|
|
|
122
|
-
const
|
|
149
|
+
const onUrlTypeChange = (value, index) => {
|
|
150
|
+
updateHelper('urlType', value, index);
|
|
151
|
+
setUrlError(false);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const onUrlChange = ({ target }, urlType) => {
|
|
123
155
|
const { value, id } = target;
|
|
124
156
|
let errorMessage = false;
|
|
125
157
|
if (!isUrl(value)) {
|
|
126
158
|
errorMessage = formatMessage(messages.ctaWebsiteUrlErrorMessage);
|
|
159
|
+
} else {
|
|
160
|
+
const validVarArr = value.match(validVarRegex) || [];
|
|
161
|
+
const validVarSet = [...new Set(validVarArr)];
|
|
162
|
+
const invalidVarArr = value.match(invalidVarRegex) || [];
|
|
163
|
+
const invalidVarSet = [...new Set(invalidVarArr)];
|
|
164
|
+
if (validVarArr?.length > 0 || invalidVarArr?.length > 0) {
|
|
165
|
+
if (urlType === STATIC_URL) {
|
|
166
|
+
errorMessage = formatMessage(messages.staticUrlWithVarErrorMessage);
|
|
167
|
+
} else if (validVarArr?.length > 1) {
|
|
168
|
+
errorMessage = formatMessage(
|
|
169
|
+
messages.dynamicUrlWithMoreVarErrorMessage,
|
|
170
|
+
);
|
|
171
|
+
} else if (invalidVarSet?.length !== validVarSet?.length) {
|
|
172
|
+
errorMessage = formatMessage(messages.dynamicUrlUnknownVars);
|
|
173
|
+
} else if (value.match(moreThanTwoBracketsRegex)?.length > 0) {
|
|
174
|
+
errorMessage = formatMessage(messages.useTwoBracketsOnly);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
127
177
|
}
|
|
128
178
|
setUrlError(errorMessage);
|
|
129
179
|
updateHelper('url', value, id);
|
|
@@ -152,22 +202,18 @@ export const CapWhatsappCTA = (props) => {
|
|
|
152
202
|
const renderArray = [];
|
|
153
203
|
const addBtnDisabled = ctaData.length === 1 && !ctaData[0].isSaved;
|
|
154
204
|
ctaData.forEach((cta) => {
|
|
155
|
-
const { index, ctaType, text, phone_number, url, isSaved } =
|
|
205
|
+
const { index, ctaType, text, phone_number, urlType, url, isSaved } =
|
|
206
|
+
cta || {};
|
|
156
207
|
if (isSaved) {
|
|
157
208
|
const ctaIsPhone = ctaType === PHONE_NUMBER;
|
|
209
|
+
const urlTypeIsDynamic = urlType === DYNAMIC_URL;
|
|
158
210
|
renderArray.push(
|
|
159
211
|
<CapRow
|
|
160
212
|
className="cap-whatsapp-saved-cta margin-t-12"
|
|
161
213
|
align="middle"
|
|
162
214
|
type="flex"
|
|
215
|
+
style={{ marginLeft: isEditFlow ? 0 : '' }}
|
|
163
216
|
>
|
|
164
|
-
<CapColumn span={1}>
|
|
165
|
-
<CapIcon
|
|
166
|
-
size="s"
|
|
167
|
-
type="drag"
|
|
168
|
-
className="whatsapp-saved-cta-drag-icon"
|
|
169
|
-
/>
|
|
170
|
-
</CapColumn>
|
|
171
217
|
<CapColumn
|
|
172
218
|
span={1}
|
|
173
219
|
className={`${ctaIsPhone ? 'whatsapp-saved-cta-phone-icon' : ''}`}
|
|
@@ -183,7 +229,7 @@ export const CapWhatsappCTA = (props) => {
|
|
|
183
229
|
</CapLabel>
|
|
184
230
|
</CapColumn>
|
|
185
231
|
{ctaIsPhone && (
|
|
186
|
-
<CapColumn span={
|
|
232
|
+
<CapColumn span={9} align="left">
|
|
187
233
|
<CapLabel className="phone">+{phone_number}</CapLabel>
|
|
188
234
|
</CapColumn>
|
|
189
235
|
)}
|
|
@@ -191,24 +237,43 @@ export const CapWhatsappCTA = (props) => {
|
|
|
191
237
|
<>
|
|
192
238
|
<CapColumn span={3}>
|
|
193
239
|
<CapLabel className="url-type" type="label2">
|
|
194
|
-
|
|
240
|
+
{urlType === STATIC_URL
|
|
241
|
+
? formatMessage(messages.ctaWebsiteTypeStatic)
|
|
242
|
+
: formatMessage(messages.ctaWebsiteTypeDynamic)}
|
|
195
243
|
</CapLabel>
|
|
196
244
|
</CapColumn>
|
|
197
|
-
<
|
|
198
|
-
<
|
|
245
|
+
<CapTooltip title={url} placement={'top'}>
|
|
246
|
+
<CapColumn span={6} style={{ marginRight: '0px' }}>
|
|
247
|
+
<CapLabel className="url">{url}</CapLabel>
|
|
248
|
+
</CapColumn>
|
|
249
|
+
</CapTooltip>
|
|
250
|
+
</>
|
|
251
|
+
)}
|
|
252
|
+
{!isEditFlow && (
|
|
253
|
+
<>
|
|
254
|
+
<CapColumn
|
|
255
|
+
span={1}
|
|
256
|
+
className="whatsapp-saved-cta-edit-icon"
|
|
257
|
+
onClick={() => editCta(index)}
|
|
258
|
+
>
|
|
259
|
+
<CapIcon size="s" type="edit" />
|
|
260
|
+
</CapColumn>
|
|
261
|
+
<CapColumn span={1} onClick={() => deleteHandler(index)}>
|
|
262
|
+
<CapIcon size="s" type="delete" />
|
|
199
263
|
</CapColumn>
|
|
200
264
|
</>
|
|
201
265
|
)}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
266
|
+
{isEditFlow && !isFullMode && urlTypeIsDynamic && (
|
|
267
|
+
<TagList
|
|
268
|
+
className="whatsapp-cta-taglist"
|
|
269
|
+
label={formatMessage(messages.whatsappCtaTagListLabel)}
|
|
270
|
+
onTagSelect={(data) => onTagSelect(data, index, url)}
|
|
271
|
+
tags={tags}
|
|
272
|
+
injectedTags={injectedTags}
|
|
273
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
274
|
+
hidePopover={!url.includes('{{1}}')}
|
|
275
|
+
/>
|
|
276
|
+
)}
|
|
212
277
|
</CapRow>,
|
|
213
278
|
);
|
|
214
279
|
} else {
|
|
@@ -284,19 +349,34 @@ export const CapWhatsappCTA = (props) => {
|
|
|
284
349
|
</CapHeading>
|
|
285
350
|
<CapSelect
|
|
286
351
|
id="whatsapp-cta-url-type"
|
|
287
|
-
options={
|
|
288
|
-
|
|
352
|
+
options={
|
|
353
|
+
hostName === HOST_KARIX
|
|
354
|
+
? KARIX_URL_OPTIONS
|
|
355
|
+
: TWILIO_URL_OPTIONS
|
|
356
|
+
}
|
|
357
|
+
onChange={(value) => onUrlTypeChange(value, index)}
|
|
358
|
+
value={urlType}
|
|
289
359
|
/>
|
|
290
360
|
</CapColumn>
|
|
291
361
|
<CapColumn span={12}>
|
|
292
362
|
{/* cta url */}
|
|
293
363
|
<CapHeading type="h4" className="cta-label">
|
|
294
364
|
{formatMessage(messages.ctaWebsiteUrl)}
|
|
365
|
+
{urlType === DYNAMIC_URL && (
|
|
366
|
+
<CapTooltipWithInfo
|
|
367
|
+
infoIconProps={{
|
|
368
|
+
style: { marginLeft: CAP_SPACE_04 },
|
|
369
|
+
}}
|
|
370
|
+
autoAdjustOverflow
|
|
371
|
+
placement="right"
|
|
372
|
+
title={formatMessage(messages.dynamicUrlTooltip)}
|
|
373
|
+
/>
|
|
374
|
+
)}
|
|
295
375
|
</CapHeading>
|
|
296
376
|
<CapInput
|
|
297
377
|
id={index}
|
|
298
378
|
className="whatsapp-cta-url"
|
|
299
|
-
onChange={onUrlChange}
|
|
379
|
+
onChange={(event) => onUrlChange(event, urlType)}
|
|
300
380
|
placeholder={formatMessage(messages.ctaWebsitePlaceholder)}
|
|
301
381
|
value={url}
|
|
302
382
|
size="large"
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
margin-left: 24px;
|
|
6
6
|
padding: 10px;
|
|
7
7
|
border-radius: 4px;
|
|
8
|
+
height: 48px;
|
|
8
9
|
|
|
9
10
|
div:not(:last-child) {
|
|
10
11
|
margin-right: 9px;
|
|
@@ -25,10 +26,6 @@
|
|
|
25
26
|
background-color: #f1f1f1;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
.whatsapp-saved-cta-drag-icon {
|
|
29
|
-
transform: rotate(90deg);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
29
|
.whatsapp-saved-cta-phone-icon {
|
|
33
30
|
margin-bottom: -4px;
|
|
34
31
|
}
|
|
@@ -36,8 +33,14 @@
|
|
|
36
33
|
.whatsapp-saved-cta-button-text {
|
|
37
34
|
font-weight: 500;
|
|
38
35
|
}
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
|
|
37
|
+
.whatsapp-saved-cta-edit-icon {
|
|
38
|
+
margin-left: 110px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.whatsapp-cta-taglist {
|
|
42
|
+
margin-left: 32px;
|
|
43
|
+
margin-top: -10px;
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
46
|
|
|
@@ -29,6 +29,10 @@ export default defineMessages({
|
|
|
29
29
|
id: `${prefix}.ctaWebsiteTypeStatic`,
|
|
30
30
|
defaultMessage: 'Static',
|
|
31
31
|
},
|
|
32
|
+
ctaWebsiteTypeDynamic: {
|
|
33
|
+
id: `${prefix}.ctaWebsiteTypeDynamic`,
|
|
34
|
+
defaultMessage: 'Dynamic',
|
|
35
|
+
},
|
|
32
36
|
ctaPhoneNoPlaceholder: {
|
|
33
37
|
id: `${prefix}.ctaPhoneNoPlaceholder`,
|
|
34
38
|
defaultMessage: 'Enter phone number',
|
|
@@ -60,10 +64,36 @@ export default defineMessages({
|
|
|
60
64
|
},
|
|
61
65
|
ctaButtonTextTooltip: {
|
|
62
66
|
id: `${prefix}.ctaButtonTextTooltip`,
|
|
63
|
-
defaultMessage:
|
|
67
|
+
defaultMessage:
|
|
68
|
+
'Use this to name the button. We would recommend not to use special characters for the button text.',
|
|
64
69
|
},
|
|
65
70
|
ctaOptionDisabledTooltip: {
|
|
66
71
|
id: `${prefix}.ctaOptionDisabledTooltip`,
|
|
67
72
|
defaultMessage: 'This type of button can only be added once',
|
|
68
73
|
},
|
|
74
|
+
dynamicUrlTooltip: {
|
|
75
|
+
id: `${prefix}.dynamicUrlTooltip`,
|
|
76
|
+
defaultMessage:
|
|
77
|
+
'Only one variable can be added to a URL. No need to add {{1}} to the end of the URL',
|
|
78
|
+
},
|
|
79
|
+
staticUrlWithVarErrorMessage: {
|
|
80
|
+
id: `${prefix}.staticUrlWithVarErrorMessage`,
|
|
81
|
+
defaultMessage: 'Button with URL type as static cannot contain variables',
|
|
82
|
+
},
|
|
83
|
+
dynamicUrlWithMoreVarErrorMessage: {
|
|
84
|
+
id: `${prefix}.dynamicUrlWithMoreVarErrorMessage`,
|
|
85
|
+
defaultMessage: 'Button with URL type as dynamic can have only 1 variable',
|
|
86
|
+
},
|
|
87
|
+
dynamicUrlUnknownVars: {
|
|
88
|
+
id: `${prefix}.dynamicUrlUnknownVars`,
|
|
89
|
+
defaultMessage: 'Valid variable is {{1}}',
|
|
90
|
+
},
|
|
91
|
+
useTwoBracketsOnly: {
|
|
92
|
+
id: `${prefix}.useTwoBracketsOnly`,
|
|
93
|
+
defaultMessage: 'Use two brackets on each side to declare a variable',
|
|
94
|
+
},
|
|
95
|
+
whatsappCtaTagListLabel: {
|
|
96
|
+
id: `${prefix}.whatsappCtaTagListLabel`,
|
|
97
|
+
defaultMessage: 'Add URL label',
|
|
98
|
+
},
|
|
69
99
|
});
|
|
@@ -255,20 +255,16 @@
|
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
-
.whatsapp-brand-name {
|
|
259
|
-
position: absolute;
|
|
260
|
-
top: 11%;
|
|
261
|
-
left: 38%;
|
|
262
|
-
color: white;
|
|
263
|
-
font-size: small;
|
|
264
|
-
}
|
|
265
258
|
.whatsapp-divider{
|
|
266
259
|
margin: 8px 0;
|
|
267
260
|
}
|
|
268
261
|
.whatsapp-cta-preview{
|
|
269
262
|
font-family: 'Roboto';
|
|
270
263
|
font-size: 10px;
|
|
271
|
-
|
|
264
|
+
display: flex;
|
|
265
|
+
align-content: center;
|
|
266
|
+
justify-content: center;
|
|
267
|
+
margin-bottom: 4px;
|
|
272
268
|
}
|
|
273
269
|
.whatsapp-message-container{
|
|
274
270
|
max-height: 292px;
|
|
@@ -277,6 +273,11 @@
|
|
|
277
273
|
.whatsapp-content{
|
|
278
274
|
margin: 2px 6px 1px 7px;
|
|
279
275
|
}
|
|
276
|
+
.whatsapp-image{
|
|
277
|
+
width: 100%;
|
|
278
|
+
max-height: 123px;
|
|
279
|
+
margin-bottom: 4px;
|
|
280
|
+
}
|
|
280
281
|
}
|
|
281
282
|
|
|
282
283
|
.align-center {
|
|
@@ -155,7 +155,6 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
155
155
|
module,
|
|
156
156
|
viberBrandName,
|
|
157
157
|
viberAccountName,
|
|
158
|
-
whatsappAccountName,
|
|
159
158
|
whatsappContentLen,
|
|
160
159
|
intl,
|
|
161
160
|
templateData,
|
|
@@ -322,7 +321,6 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
322
321
|
return renderArray;
|
|
323
322
|
};
|
|
324
323
|
|
|
325
|
-
const whatsappUpdatedAccountName = whatsappAccountName || templateData?.versions?.base?.content?.whatsapp?.accountName || '';
|
|
326
324
|
const whatsappUpdatedLen = whatsappContentLen !== undefined ? whatsappContentLen : content?.charCount;
|
|
327
325
|
|
|
328
326
|
return (
|
|
@@ -616,7 +614,7 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
616
614
|
</div>
|
|
617
615
|
);
|
|
618
616
|
}
|
|
619
|
-
if ((type === IMAGE_CAROUSEL || type === TEMPLATE) && imageCarousel) {
|
|
617
|
+
if ((type === IMAGE_CAROUSEL || type === TEMPLATE || type === 'template') && imageCarousel) {
|
|
620
618
|
return (
|
|
621
619
|
<div
|
|
622
620
|
style={{
|
|
@@ -725,12 +723,16 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
725
723
|
src={whatsappMobileAndroid}
|
|
726
724
|
alt={formatMessage(messages.previewGenerated)}
|
|
727
725
|
/>
|
|
728
|
-
<CapLabel className="whatsapp-brand-name">
|
|
729
|
-
{whatsappUpdatedAccountName || ''}
|
|
730
|
-
</CapLabel>
|
|
731
726
|
<div className="msg-container whatsapp-message-container">
|
|
732
727
|
<div className="message-pop align-left" style={whatsappSectionStyle}>
|
|
733
728
|
<CapLabel className="whatsapp-content">
|
|
729
|
+
{content?.whatsappImageSrc && (
|
|
730
|
+
<CapImage
|
|
731
|
+
src={content.whatsappImageSrc}
|
|
732
|
+
className="whatsapp-image"
|
|
733
|
+
alt={formatMessage(messages.previewGenerated)}
|
|
734
|
+
/>
|
|
735
|
+
)}
|
|
734
736
|
{content?.templateMsg || ''}
|
|
735
737
|
</CapLabel>
|
|
736
738
|
{renderWhatsappCtaPreview()}
|
|
@@ -59,12 +59,6 @@ exports[`Test Templates container Should render correct preview component for wh
|
|
|
59
59
|
className="preview-image"
|
|
60
60
|
src="test-file-stub"
|
|
61
61
|
/>
|
|
62
|
-
<CapLabel
|
|
63
|
-
className="whatsapp-brand-name"
|
|
64
|
-
type="label1"
|
|
65
|
-
>
|
|
66
|
-
30
|
|
67
|
-
</CapLabel>
|
|
68
62
|
<div
|
|
69
63
|
className="msg-container whatsapp-message-container"
|
|
70
64
|
>
|
|
@@ -140,7 +134,7 @@ exports[`Test Templates container Should render correct preview component for wh
|
|
|
140
134
|
id="app.components.TemplatePreview.whatsappMessageLength"
|
|
141
135
|
values={
|
|
142
136
|
Object {
|
|
143
|
-
"length":
|
|
137
|
+
"length": 30,
|
|
144
138
|
}
|
|
145
139
|
}
|
|
146
140
|
/>
|
|
@@ -166,12 +160,6 @@ exports[`Test Templates container Should render correct preview component for wh
|
|
|
166
160
|
className="preview-image"
|
|
167
161
|
src="test-file-stub"
|
|
168
162
|
/>
|
|
169
|
-
<CapLabel
|
|
170
|
-
className="whatsapp-brand-name"
|
|
171
|
-
type="label1"
|
|
172
|
-
>
|
|
173
|
-
30
|
|
174
|
-
</CapLabel>
|
|
175
163
|
<div
|
|
176
164
|
className="msg-container whatsapp-message-container"
|
|
177
165
|
>
|
|
@@ -213,7 +201,7 @@ exports[`Test Templates container Should render correct preview component for wh
|
|
|
213
201
|
id="app.components.TemplatePreview.whatsappMessageLength"
|
|
214
202
|
values={
|
|
215
203
|
Object {
|
|
216
|
-
"length":
|
|
204
|
+
"length": 30,
|
|
217
205
|
}
|
|
218
206
|
}
|
|
219
207
|
/>
|
|
@@ -239,10 +227,6 @@ exports[`Test Templates container Should render correct preview component for wh
|
|
|
239
227
|
className="preview-image"
|
|
240
228
|
src="test-file-stub"
|
|
241
229
|
/>
|
|
242
|
-
<CapLabel
|
|
243
|
-
className="whatsapp-brand-name"
|
|
244
|
-
type="label1"
|
|
245
|
-
/>
|
|
246
230
|
<div
|
|
247
231
|
className="msg-container whatsapp-message-container"
|
|
248
232
|
>
|
|
@@ -279,7 +263,7 @@ exports[`Test Templates container Should render correct preview component for wh
|
|
|
279
263
|
id="app.components.TemplatePreview.whatsappMessageLength"
|
|
280
264
|
values={
|
|
281
265
|
Object {
|
|
282
|
-
"length":
|
|
266
|
+
"length": 0,
|
|
283
267
|
}
|
|
284
268
|
}
|
|
285
269
|
/>
|