@capillarytech/creatives-library 7.12.51 → 7.12.53

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.
Files changed (38) hide show
  1. package/package.json +1 -1
  2. package/services/api.js +15 -2
  3. package/v2Components/CapImageUpload/index.js +33 -17
  4. package/v2Components/CapImageUpload/messages.js +11 -3
  5. package/v2Components/CapWhatsappCTA/constants.js +12 -1
  6. package/v2Components/CapWhatsappCTA/index.js +88 -29
  7. package/v2Components/CapWhatsappCTA/index.scss +4 -6
  8. package/v2Components/CapWhatsappCTA/messages.js +24 -0
  9. package/v2Components/TemplatePreview/_templatePreview.scss +9 -8
  10. package/v2Components/TemplatePreview/index.js +8 -6
  11. package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +3 -19
  12. package/v2Components/TemplatePreview/tests/index.test.js +0 -2
  13. package/v2Components/WhatsappStatusContainer/index.js +42 -52
  14. package/v2Containers/CreativesContainer/SlideBoxContent.js +0 -1
  15. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +5 -7
  16. package/v2Containers/Line/Container/ImageCarousel/index.js +6 -7
  17. package/v2Containers/Line/Container/index.js +3 -1
  18. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +4660 -652
  19. package/v2Containers/Templates/_templates.scss +5 -0
  20. package/v2Containers/Templates/actions.js +7 -0
  21. package/v2Containers/Templates/constants.js +9 -1
  22. package/v2Containers/Templates/index.js +45 -30
  23. package/v2Containers/Templates/messages.js +1 -1
  24. package/v2Containers/Templates/reducer.js +15 -0
  25. package/v2Containers/Templates/sagas.js +32 -0
  26. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1774 -1881
  27. package/v2Containers/Templates/tests/index.test.js +14 -3
  28. package/v2Containers/Whatsapp/actions.js +22 -0
  29. package/v2Containers/Whatsapp/constants.js +56 -23
  30. package/v2Containers/Whatsapp/index.js +204 -66
  31. package/v2Containers/Whatsapp/index.scss +18 -2
  32. package/v2Containers/Whatsapp/messages.js +35 -7
  33. package/v2Containers/Whatsapp/reducer.js +35 -1
  34. package/v2Containers/Whatsapp/sagas.js +30 -1
  35. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +44349 -32926
  36. package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +15 -21
  37. package/v2Containers/Whatsapp/utils.js +16 -9
  38. package/v2Containers/mockdata.js +150 -399
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.12.51",
4
+ "version": "7.12.53",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
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/get';
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
- if (imageData[`uploadedAssetData${index}`] && Object.keys(imageData[`uploadedAssetData${index}`]).length) {
52
- const imgSrc = get(imageData, `uploadedAssetData${index}.metaInfo.secure_file_path`, '');
53
- updateImageSrc(imgSrc);
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.imageIncorrectSize));
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.imageIncorrectSize));
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
- <CapButton
192
- className="dragger-button gallery-select"
193
- type="secondary"
194
- onClick={onGalleryClick}
195
- >
196
- <FormattedMessage {...messages.uploadGallery} />
197
- </CapButton>
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
- <CapHeadingSpan type="label2" className="image-dimension">
242
- <FormattedMessage {...messages.imageDimenstionDescription} values={{ width: imgWidth, height: imgHeight}}/>
243
- </CapHeadingSpan>
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
- imageIncorrectSize: {
38
- id: `${scope}.imageIncorrectSize`,
45
+ imageErrorDesc: {
46
+ id: `${scope}.imageErrorDesc`,
39
47
  defaultMessage:
40
- 'Please upload the image with correct type, size and dimension',
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 CTA_URL_OPTIONS = [
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;
@@ -25,17 +25,32 @@ import {
25
25
  CTA_OPTIONS,
26
26
  BTN_MAX_LENGTH,
27
27
  PHONE_NUMBER_MAX_LENGTH,
28
- CTA_URL_OPTIONS,
28
+ TWILIO_URL_OPTIONS,
29
+ KARIX_URL_OPTIONS,
29
30
  URL_MAX_LENGTH,
30
31
  PHONE_NUMBER,
31
32
  WEBSITE,
33
+ DYNAMIC_URL,
32
34
  STATIC_URL,
33
35
  } from './constants';
34
- import { INITIAL_CTA_DATA } from '../../v2Containers/Whatsapp/constants';
36
+ import {
37
+ INITIAL_CTA_DATA,
38
+ HOST_KARIX,
39
+ } from '../../v2Containers/Whatsapp/constants';
35
40
 
36
41
  export const CapWhatsappCTA = (props) => {
37
- const { intl, ctaData = [], updateHandler, deleteHandler } = props;
42
+ const {
43
+ intl,
44
+ ctaData = [],
45
+ updateHandler,
46
+ deleteHandler,
47
+ isEditFlow,
48
+ hostName,
49
+ } = props;
38
50
  const { formatMessage } = intl;
51
+ const validVarRegex = /{{(1)}}/g;
52
+ const invalidVarRegex = /{{(.*?)}}/g;
53
+ const moreThanTwoBracketsRegex = /{{3,}(1)}{3,}/g;
39
54
 
40
55
  const [urlError, setUrlError] = useState(false);
41
56
 
@@ -45,6 +60,9 @@ export const CapWhatsappCTA = (props) => {
45
60
  ...clonedCta,
46
61
  [type]: value,
47
62
  };
63
+ if (type === 'urlType') {
64
+ clonedCta.url = '';
65
+ }
48
66
  updateHandler(clonedCta, index);
49
67
  };
50
68
 
@@ -119,11 +137,34 @@ export const CapWhatsappCTA = (props) => {
119
137
  updateHelper('phone_number', value, index);
120
138
  };
121
139
 
122
- const onUrlChange = ({ target }) => {
140
+ const onUrlTypeChange = (value, index) => {
141
+ updateHelper('urlType', value, index);
142
+ setUrlError(false);
143
+ };
144
+
145
+ const onUrlChange = ({ target }, urlType) => {
123
146
  const { value, id } = target;
124
147
  let errorMessage = false;
125
148
  if (!isUrl(value)) {
126
149
  errorMessage = formatMessage(messages.ctaWebsiteUrlErrorMessage);
150
+ } else {
151
+ const validVarArr = value.match(validVarRegex) || [];
152
+ const validVarSet = [...new Set(validVarArr)];
153
+ const invalidVarArr = value.match(invalidVarRegex) || [];
154
+ const invalidVarSet = [...new Set(invalidVarArr)];
155
+ if (validVarArr?.length > 0 || invalidVarArr?.length > 0) {
156
+ if (urlType === STATIC_URL) {
157
+ errorMessage = formatMessage(messages.staticUrlWithVarErrorMessage);
158
+ } else if (validVarArr?.length > 1) {
159
+ errorMessage = formatMessage(
160
+ messages.dynamicUrlWithMoreVarErrorMessage,
161
+ );
162
+ } else if (invalidVarSet?.length !== validVarSet?.length) {
163
+ errorMessage = formatMessage(messages.dynamicUrlUnknownVars);
164
+ } else if (value.match(moreThanTwoBracketsRegex)?.length > 0) {
165
+ errorMessage = formatMessage(messages.useTwoBracketsOnly);
166
+ }
167
+ }
127
168
  }
128
169
  setUrlError(errorMessage);
129
170
  updateHelper('url', value, id);
@@ -152,7 +193,8 @@ export const CapWhatsappCTA = (props) => {
152
193
  const renderArray = [];
153
194
  const addBtnDisabled = ctaData.length === 1 && !ctaData[0].isSaved;
154
195
  ctaData.forEach((cta) => {
155
- const { index, ctaType, text, phone_number, url, isSaved } = cta || {};
196
+ const { index, ctaType, text, phone_number, urlType, url, isSaved } =
197
+ cta || {};
156
198
  if (isSaved) {
157
199
  const ctaIsPhone = ctaType === PHONE_NUMBER;
158
200
  renderArray.push(
@@ -160,14 +202,8 @@ export const CapWhatsappCTA = (props) => {
160
202
  className="cap-whatsapp-saved-cta margin-t-12"
161
203
  align="middle"
162
204
  type="flex"
205
+ style={{ marginLeft: isEditFlow ? 0 : '' }}
163
206
  >
164
- <CapColumn span={1}>
165
- <CapIcon
166
- size="s"
167
- type="drag"
168
- className="whatsapp-saved-cta-drag-icon"
169
- />
170
- </CapColumn>
171
207
  <CapColumn
172
208
  span={1}
173
209
  className={`${ctaIsPhone ? 'whatsapp-saved-cta-phone-icon' : ''}`}
@@ -183,7 +219,7 @@ export const CapWhatsappCTA = (props) => {
183
219
  </CapLabel>
184
220
  </CapColumn>
185
221
  {ctaIsPhone && (
186
- <CapColumn span={11} align="left">
222
+ <CapColumn span={9} align="left">
187
223
  <CapLabel className="phone">+{phone_number}</CapLabel>
188
224
  </CapColumn>
189
225
  )}
@@ -191,24 +227,32 @@ export const CapWhatsappCTA = (props) => {
191
227
  <>
192
228
  <CapColumn span={3}>
193
229
  <CapLabel className="url-type" type="label2">
194
- Static
230
+ {urlType === STATIC_URL
231
+ ? formatMessage(messages.ctaWebsiteTypeStatic)
232
+ : formatMessage(messages.ctaWebsiteTypeDynamic)}
195
233
  </CapLabel>
196
234
  </CapColumn>
197
- <CapColumn span={8} style={{ marginRight: '0px' }}>
198
- <CapLabel className="url">{url}</CapLabel>
235
+ <CapTooltip title={url} placement={'top'}>
236
+ <CapColumn span={6} style={{ marginRight: '0px' }}>
237
+ <CapLabel className="url">{url}</CapLabel>
238
+ </CapColumn>
239
+ </CapTooltip>
240
+ </>
241
+ )}
242
+ {!isEditFlow && (
243
+ <>
244
+ <CapColumn
245
+ span={1}
246
+ className="whatsapp-saved-cta-edit-icon"
247
+ onClick={() => editCta(index)}
248
+ >
249
+ <CapIcon size="s" type="edit" />
250
+ </CapColumn>
251
+ <CapColumn span={1} onClick={() => deleteHandler(index)}>
252
+ <CapIcon size="s" type="delete" />
199
253
  </CapColumn>
200
254
  </>
201
255
  )}
202
- <CapColumn
203
- span={1}
204
- className="whatsapp-saved-cta-edit-icon"
205
- onClick={() => editCta(index)}
206
- >
207
- <CapIcon size="s" type="edit" />
208
- </CapColumn>
209
- <CapColumn span={1} onClick={() => deleteHandler(index)}>
210
- <CapIcon size="s" type="delete" />
211
- </CapColumn>
212
256
  </CapRow>,
213
257
  );
214
258
  } else {
@@ -284,19 +328,34 @@ export const CapWhatsappCTA = (props) => {
284
328
  </CapHeading>
285
329
  <CapSelect
286
330
  id="whatsapp-cta-url-type"
287
- options={CTA_URL_OPTIONS || []}
288
- value={STATIC_URL}
331
+ options={
332
+ hostName === HOST_KARIX
333
+ ? KARIX_URL_OPTIONS
334
+ : TWILIO_URL_OPTIONS
335
+ }
336
+ onChange={(value) => onUrlTypeChange(value, index)}
337
+ value={urlType}
289
338
  />
290
339
  </CapColumn>
291
340
  <CapColumn span={12}>
292
341
  {/* cta url */}
293
342
  <CapHeading type="h4" className="cta-label">
294
343
  {formatMessage(messages.ctaWebsiteUrl)}
344
+ {urlType === DYNAMIC_URL && (
345
+ <CapTooltipWithInfo
346
+ infoIconProps={{
347
+ style: { marginLeft: CAP_SPACE_04 },
348
+ }}
349
+ autoAdjustOverflow
350
+ placement="right"
351
+ title={formatMessage(messages.dynamicUrlTooltip)}
352
+ />
353
+ )}
295
354
  </CapHeading>
296
355
  <CapInput
297
356
  id={index}
298
357
  className="whatsapp-cta-url"
299
- onChange={onUrlChange}
358
+ onChange={(event) => onUrlChange(event, urlType)}
300
359
  placeholder={formatMessage(messages.ctaWebsitePlaceholder)}
301
360
  value={url}
302
361
  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,9 @@
36
33
  .whatsapp-saved-cta-button-text {
37
34
  font-weight: 500;
38
35
  }
39
- .whatsapp-saved-cta-edit-icon{
40
- margin-left: 16px;
36
+
37
+ .whatsapp-saved-cta-edit-icon {
38
+ margin-left: 110px;
41
39
  }
42
40
  }
43
41
 
@@ -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',
@@ -66,4 +70,24 @@ export default defineMessages({
66
70
  id: `${prefix}.ctaOptionDisabledTooltip`,
67
71
  defaultMessage: 'This type of button can only be added once',
68
72
  },
73
+ dynamicUrlTooltip: {
74
+ id: `${prefix}.dynamicUrlTooltip`,
75
+ defaultMessage: 'Only one variable can be added to a URL. No need to add {{1}} to the end of the URL',
76
+ },
77
+ staticUrlWithVarErrorMessage: {
78
+ id: `${prefix}.staticUrlWithVarErrorMessage`,
79
+ defaultMessage: 'Button with URL type as static cannot contain variables',
80
+ },
81
+ dynamicUrlWithMoreVarErrorMessage: {
82
+ id: `${prefix}.dynamicUrlWithMoreVarErrorMessage`,
83
+ defaultMessage: 'Button with URL type as dynamic can have only 1 variable',
84
+ },
85
+ dynamicUrlUnknownVars: {
86
+ id: `${prefix}.dynamicUrlUnknownVars`,
87
+ defaultMessage: 'Valid variable is {{1}}',
88
+ },
89
+ useTwoBracketsOnly: {
90
+ id: `${prefix}.useTwoBracketsOnly`,
91
+ defaultMessage: 'Use two brackets on each side to declare a variable',
92
+ },
69
93
  });
@@ -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
- text-align: center;
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": "test",
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": "test",
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": "test",
266
+ "length": 0,
283
267
  }
284
268
  }
285
269
  />
@@ -9,14 +9,12 @@ describe('Test Templates container', () => {
9
9
  const renderFunction = (
10
10
  channel,
11
11
  content,
12
- whatsappAccountName,
13
12
  whatsappContentLen,
14
13
  ) => {
15
14
  renderedComponent = shallowWithIntl(
16
15
  <TemplatePreview
17
16
  channel={channel}
18
17
  content={content}
19
- whatsappAccountName={whatsappAccountName}
20
18
  whatsappContentLen={whatsappContentLen}
21
19
  />,
22
20
  );