@capillarytech/creatives-library 7.12.88 → 7.12.90

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.12.88",
4
+ "version": "7.12.90",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -24,8 +24,10 @@
24
24
  "jest-date-mock": "^1.0.8",
25
25
  "jquery": "^3.3.1",
26
26
  "load-script": "^1.0.0",
27
+ "node-html-parser": "^5.4.2-0",
27
28
  "normalizr": "^3.2.3",
28
29
  "papaparse": "^5.3.1",
30
+ "pre-push": "^0.1.2",
29
31
  "react-datepicker": "^0.46.0",
30
32
  "react-dropzone": "^11.3.4",
31
33
  "react-phone-input-2": "^2.15.0",
@@ -0,0 +1,221 @@
1
+ import cloneDeep from "lodash/cloneDeep";
2
+ import isEmpty from "lodash/isEmpty";
3
+ import isNumber from "lodash/isNumber";
4
+ /* eslint-disable no-unused-expressions */
5
+ import { parse } from "node-html-parser";
6
+
7
+ // https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=100,height=100,quality=75,fit=cover,g=top,format=auto/intouch_creative_assets/005710a7-6412-44fe-a19f-e72456b1.jpg
8
+
9
+ const CDN_BASE_URL = `https://storage.crm.n.content-cdn.io`;
10
+ const CDN_TRANSFORMATION_URL_SUFFIX = `/cdn-cgi/image/`;
11
+ const QUALITY = 75;
12
+ // const regex = /https:\/\/.*intouch_creative_assets.*(?:jpg|png|jpeg|gif)$/;
13
+ const regex = /https:\/\/.*intouch_creative_assets.*$/;
14
+ const INTOUCH_CREATIVE_ASSETS = "intouch_creative_assets";
15
+ const SPECIFIED = "specified";
16
+ const FORMAT_TYPES = { AUTO: "auto" };
17
+ const QUALITY_TYPE = {
18
+ DECREASE: "decrease",
19
+ PRESERVE: "preserve",
20
+ };
21
+
22
+ const CHANNEL_CONFIGS = {
23
+ EMAIL: {
24
+ transformations: {
25
+ width: SPECIFIED,
26
+ height: SPECIFIED,
27
+ format: FORMAT_TYPES.AUTO,
28
+ quality: QUALITY_TYPE.DECREASE,
29
+ },
30
+ },
31
+ RCS: {
32
+ transformations: {
33
+ width: 1440,
34
+ height: 720,
35
+ quality: QUALITY_TYPE.DECREASE,
36
+ },
37
+ },
38
+ VIBER: {
39
+ transformations: {
40
+ width: 300,
41
+ height: 400,
42
+ quality: QUALITY_TYPE.DECREASE,
43
+ },
44
+ },
45
+ WHATSAPP: {
46
+ transformations: {
47
+ quality: QUALITY_TYPE.DECREASE, //TODO whatsapp itself might reduce quality. To be checked
48
+ },
49
+ },
50
+ MOBILE_PUSH: {
51
+ transformations: {
52
+ quality: QUALITY_TYPE.DECREASE,
53
+ },
54
+ },
55
+ FACEBOOK: {
56
+ IMAGE: {
57
+ transformations: {
58
+ width: 1080,
59
+ height: 1080,
60
+ quality: QUALITY_TYPE.DECREASE,
61
+ },
62
+ }
63
+ },
64
+ LINE: {
65
+ IMAGE: {
66
+ transformations: {
67
+ width: 300,
68
+ height: 400,
69
+ quality: QUALITY_TYPE.DECREASE,
70
+ },
71
+ },
72
+ CARD: {
73
+ transformations: {
74
+ width: 1024,
75
+ height: 1024,
76
+ quality: QUALITY_TYPE.DECREASE,
77
+ },
78
+ },
79
+ RICH_MESSAGE: {
80
+ //Rich Message in Line has Square and Custom templates.
81
+ //Width (1040px) is same in both whereas height varies. Hence including width only.
82
+ transformations: {
83
+ width: 1040,
84
+ quality: QUALITY_TYPE.DECREASE,
85
+ },
86
+ }
87
+ },
88
+ };
89
+
90
+ /**
91
+ * getCdnUrl : utility function to replace and return s3/cdn url with cdn url.
92
+ */
93
+ export const getCdnUrl = ({
94
+ url,
95
+ height,
96
+ width,
97
+ channelName: receivedChannelName,
98
+ channelSubType: receivedChannelSubType,
99
+ }) => {
100
+ const channelName = receivedChannelName?.toUpperCase();
101
+ const channelSubType = receivedChannelSubType?.toUpperCase();
102
+
103
+ if (
104
+ !regex.test(url) ||
105
+ !CHANNEL_CONFIGS?.[channelName] ||
106
+ (channelSubType && !CHANNEL_CONFIGS?.[channelName]?.[channelSubType])
107
+ )
108
+ return url;
109
+
110
+ const [, assetKey] = url.split(INTOUCH_CREATIVE_ASSETS);
111
+
112
+ let newUrl = `${CDN_BASE_URL}`;
113
+
114
+ let applicableTransformations;
115
+
116
+ if (channelSubType) {
117
+ applicableTransformations =
118
+ CHANNEL_CONFIGS?.[channelName]?.[channelSubType]?.transformations;
119
+ } else {
120
+ applicableTransformations = CHANNEL_CONFIGS?.[channelName]?.transformations;
121
+ }
122
+
123
+ if (!isEmpty(applicableTransformations)) {
124
+
125
+ newUrl += CDN_TRANSFORMATION_URL_SUFFIX;
126
+
127
+ Object.keys(applicableTransformations)?.forEach((transformationParam) => {
128
+ const transformationParamVal =
129
+ applicableTransformations?.[transformationParam];
130
+
131
+ try {
132
+ switch (transformationParam) {
133
+ case "height":
134
+ if (transformationParamVal === SPECIFIED && isNumber(height)) {
135
+ newUrl += `${transformationParam}=${height},`;
136
+ } else if(isNumber(transformationParamVal)) {
137
+ newUrl += `${transformationParam}=${transformationParamVal},`;
138
+ }
139
+ break;
140
+ case "width":
141
+ if (transformationParamVal === SPECIFIED && isNumber(width)) {
142
+ newUrl += `${transformationParam}=${width},`;
143
+ } else if(isNumber(transformationParamVal)) {
144
+ newUrl += `${transformationParam}=${transformationParamVal},`;
145
+ }
146
+ break;
147
+ case "format":
148
+ if(transformationParamVal){
149
+ newUrl += `${transformationParam}=${transformationParamVal},`;
150
+ }
151
+ break;
152
+ case "quality":
153
+ if (transformationParamVal === QUALITY_TYPE?.DECREASE && isNumber(QUALITY)) {
154
+ newUrl += `${transformationParam}=${QUALITY},`;
155
+ }
156
+ break;
157
+ default:
158
+ break;
159
+ }
160
+ } catch (e) {
161
+ console.log("some error occured while applying transformation",e);
162
+ }
163
+ });
164
+ }
165
+
166
+ newUrl += `/intouch_creative_assets${assetKey}`;
167
+ return newUrl;
168
+ };
169
+
170
+ /**
171
+ *
172
+ * @param {*} htmlContents
173
+ * @returns htmlContents with updated urls in image tag
174
+ */
175
+ export const updateImagesInHtml = (htmlContents) => {
176
+ const copiedHtmlContents = htmlContents;
177
+ try {
178
+ const root = parse(htmlContents);
179
+ root.querySelectorAll("img").forEach((element) => {
180
+ const imageSrc = element.getAttribute("src");
181
+ const isAsset = regex.test(imageSrc);
182
+ if (isAsset) {
183
+ const height = element.getAttribute("height");
184
+ const width = element.getAttribute("width");
185
+ const newUrl = getCdnUrl({
186
+ url: imageSrc,
187
+ height,
188
+ width,
189
+ channelName: "EMAIL",
190
+ });
191
+ element.setAttribute("src", newUrl);
192
+ }
193
+ });
194
+ return root.toString();
195
+ } catch (e) {
196
+ console.log("An error occured while updating images in html", e);
197
+ return copiedHtmlContents; //return received input directly in case an exception is thrown
198
+ }
199
+ };
200
+
201
+ /**
202
+ *
203
+ * @param {*} contents
204
+ * @returns
205
+ */
206
+ export const transformEmailTemplates = (contents) => {
207
+ const contentsCopy = cloneDeep(contents);
208
+ try {
209
+ const base = contentsCopy?.versions?.base;
210
+ const languages = base?.selectedLanguages;
211
+ languages?.forEach((lang) => {
212
+ const htmlContents = base?.[lang]?.["template-content"];
213
+ const newHtmlContents = updateImagesInHtml(htmlContents);
214
+ base[lang]["template-content"] = newHtmlContents;
215
+ });
216
+ return contentsCopy;
217
+ } catch (e) {
218
+ console.log("Some error has occured while transforming email templates", e);
219
+ return contents; //return received input directly in case an exception is thrown
220
+ }
221
+ };
@@ -32,8 +32,8 @@ export const SET_LOYALTY_PROMOTION_RELATED_CREATIVE_TAGS_DISPLAY = 'SET_LOYALTY_
32
32
 
33
33
  export const CAMPAIGN_SETTINGS_URL = '/creatives/settings/message';
34
34
  export const ORG_SETTINGS_URL = '/org/index';
35
- export const HELP_URL = 'https://support.capillarytech.com/en/support/solutions/4000007853';
36
- export const LOYALTY_HELP_URL = 'https://support.capillarytech.com/en/support/solutions/97443';
35
+ export const HELP_URL = 'https://docs.capillarytech.com/docs/getting-started';
36
+ export const LOYALTY_HELP_URL = 'https://docs.capillarytech.com/docs/loyalty-overview';
37
37
 
38
38
  export const ORG_REFRESH_SEC = 10;
39
39
  export const ORG_CHANGED = 'ORG_CHANGED';
@@ -33,6 +33,7 @@ import { CREATIVE } from '../Facebook/constants';
33
33
  import { LOYALTY } from '../App/constants';
34
34
  import { WHATSAPP_STATUSES } from '../Whatsapp/constants';
35
35
 
36
+ import { updateImagesInHtml } from '../../utils/cdnTransformation';
36
37
 
37
38
  const classPrefix = 'add-creatives-section';
38
39
  const CREATIVES_CONTAINER = 'creativesContainer';
@@ -495,7 +496,8 @@ export class Creatives extends React.Component {
495
496
  if (!html_content) {
496
497
  emailBase = templateRecords.base;
497
498
  }
498
- templateData = {...templateData, ...emailBase, emailBody: html_content, emailSubject: (emailBase && emailBase.subject) ? emailBase.subject : ''};
499
+ const newHtmlContent = updateImagesInHtml(html_content);
500
+ templateData = {...templateData, ...emailBase, emailBody: newHtmlContent, emailSubject: (emailBase && emailBase.subject) ? emailBase.subject : ''};
499
501
  delete templateData.html_content;
500
502
  delete templateData.subject;
501
503
  }
@@ -35,6 +35,8 @@ import { TRACK_CREATE_EMAIL, TRACK_EDIT_EMAIL, BEE_PLUGIN, CREATE, EDIT } from '
35
35
  import { FONT_COLOR_05 } from '@capillarytech/cap-ui-library/styled/variables';
36
36
  import { gtmPush } from '../../utils/gtmTrackers';
37
37
  const {CapCustomCardList} = CapCustomCard;
38
+ import {transformEmailTemplates} from '../../utils/cdnTransformation';
39
+
38
40
  export class Email extends React.Component { // eslint-disable-line react/prefer-stateless-function
39
41
  constructor(props) {
40
42
  super(props);
@@ -2438,7 +2440,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2438
2440
 
2439
2441
  // if (saveCount === 0) {
2440
2442
 
2441
- this.props.actions.createTemplate(obj, this.onUpdateTemplateComplete);
2443
+ const newEmail = transformEmailTemplates(obj);
2444
+ this.props.actions.createTemplate(newEmail, this.onUpdateTemplateComplete);
2442
2445
  // } else {
2443
2446
  // this.setState({saveObj: obj, targetSaveCount: saveCount, mode: "save", saveEdmDataMode: 'save'}, () => {
2444
2447
  // _.forEach(data.selectedLanguages, (language, langIndex) => {
@@ -7,7 +7,7 @@ import isEmpty from 'lodash/isEmpty';
7
7
  import { connect } from "react-redux";
8
8
  import { createStructuredSelector } from "reselect";
9
9
  import { selectCurrentOrgDetails } from "../../Cap/selectors";
10
-
10
+ import { getCdnUrl } from '../../../utils/cdnTransformation';
11
11
  import {
12
12
  CapInput,
13
13
  CapRadioCard,
@@ -197,7 +197,7 @@ export const Advertisement = (props) => {
197
197
  };
198
198
  if (obj.subType === IMAGE) {
199
199
  data.imageData = {
200
- imageSrc: obj.imgSrc,
200
+ imageSrc: getCdnUrl({url: obj.imgSrc, channelName: 'FACEBOOK', channelSubType: 'IMAGE'}),
201
201
  };
202
202
  }
203
203
  if (obj.subType === VIDEO) {
@@ -336,7 +336,7 @@ export const Advertisement = (props) => {
336
336
  };
337
337
  }
338
338
  if (obj.subType === IMAGE) {
339
- data.imgSrc = obj.imageData.imageSrc;
339
+ data.imgSrc = getCdnUrl({url: obj.imageData.imageSrc, channelName: 'FACEBOOK', channelSubType: 'IMAGE'});
340
340
  } else {
341
341
  const {
342
342
  videoSrc,
@@ -1033,4 +1033,4 @@ const mapStateToProps = (state, props) =>
1033
1033
  : selectCurrentOrgDetails(),
1034
1034
  });
1035
1035
 
1036
- export default connect(mapStateToProps, null)(injectIntl(Advertisement));
1036
+ export default connect(mapStateToProps, null)(injectIntl(Advertisement));
@@ -15,6 +15,7 @@ import Gallery from '../../../Assets/Gallery';
15
15
  import style from './style';
16
16
  import { CAP_G06, CAP_G09 } from '@capillarytech/cap-ui-library/styled/variables';
17
17
  import withStyles from '../../../../hoc/withStyles';
18
+ import { getCdnUrl } from '../../../../utils/cdnTransformation';
18
19
 
19
20
  import messages from './messages';
20
21
  import {
@@ -73,7 +74,7 @@ export const LineImage = ({
73
74
  if (imageSrc && (isFullMode ? messageTitle: true) && imagePreview) {
74
75
  updateMessageState({
75
76
  isError: !imageSrc || !(isFullMode ? messageTitle : true) || isImageError || errorMessageTitle,
76
- originalContentUrl: imageSrc,
77
+ originalContentUrl: getCdnUrl({url: imageSrc, channelName: 'LINE', channelSubType: 'IMAGE'}),
77
78
  previewImageUrl: imagePreview,
78
79
  messageTitle,
79
80
  index,
@@ -112,7 +113,7 @@ export const LineImage = ({
112
113
 
113
114
  updateMessageState({
114
115
  isError: !imgSrc || !(isFullMode ? messageTitle : true) || errorMessageTitle,
115
- originalContentUrl: imgSrc,
116
+ originalContentUrl: getCdnUrl({url: imgSrc, channelName: 'LINE', channelSubType: 'IMAGE'}),
116
117
  previewImageUrl: imgPreview,
117
118
  messageTitle,
118
119
  index,
@@ -155,7 +156,7 @@ export const LineImage = ({
155
156
  }
156
157
  updateMessageState({
157
158
  isError: !imageSrc || !(isFullMode ? value : true) || isImageError || !value,
158
- originalContentUrl: imageSrc,
159
+ originalContentUrl: getCdnUrl({url: imageSrc, channelName: 'LINE', channelSubType: 'IMAGE'}),
159
160
  previewImageUrl: imagePreview,
160
161
  messageTitle: value,
161
162
  index,
@@ -412,7 +413,7 @@ export const LineImage = ({
412
413
  updateImagePreview(imagePreview);
413
414
  updateMessageState({
414
415
  isError: !image || !(isFullMode ? messageTitle : true) || isImageError || errorMessageTitle,
415
- originalContentUrl: image,
416
+ originalContentUrl: getCdnUrl({url: image, channelName: 'LINE', channelSubType: 'IMAGE'}),
416
417
  previewImageUrl: imagePreview,
417
418
  messageTitle,
418
419
  index,
@@ -15,6 +15,7 @@ import LineDrawer from '../Drawer';
15
15
  import style from './style';
16
16
  import { CAP_G06, FONT_COLOR_01, FONT_COLOR_02, CAP_SPACE_08, CAP_WHITE, CAP_SPACE_24, CAP_SPACE_04 } from '@capillarytech/cap-ui-library/styled/variables';
17
17
  import withStyles from '../../../../hoc/withStyles';
18
+ import { getCdnUrl } from '../../../../utils/cdnTransformation';
18
19
 
19
20
  import LineImageCarouselContent from './Content';
20
21
 
@@ -103,7 +104,7 @@ export const LineImageCarousel = (props) => {
103
104
  } = content || {};
104
105
  validCarouselImages.push({
105
106
  activeIndex: index,
106
- originalContentUrl: url,
107
+ originalContentUrl: getCdnUrl({url: url, channelName: 'LINE', channelSubType: 'CARD'}),
107
108
  aspectRatio,
108
109
  selectedActionType: buttonType ? (buttonType === MESSAGE_ACTION_TYPE ? TEXT_ACTION_TYPE : URL_ACTION_TYPE) : '',
109
110
  actionContent: text || uri,
@@ -127,7 +128,7 @@ export const LineImageCarousel = (props) => {
127
128
 
128
129
  validCarouselImages.push({
129
130
  activeIndex: index,
130
- originalContentUrl: imageUrl,
131
+ originalContentUrl: getCdnUrl({url: imageUrl, channelName: 'LINE', channelSubType: 'CARD'}),
131
132
  selectedActionType: type ? (type === MESSAGE_ACTION_TYPE ? TEXT_ACTION_TYPE : URL_ACTION_TYPE) : '',
132
133
  actionContent: text || uri,
133
134
  actionLabel: label,
@@ -160,7 +161,7 @@ export const LineImageCarousel = (props) => {
160
161
  ? isErrorIndex
161
162
  : ((!originalContentUrl || !selectedActionType || actionContentErrorMessage || actionLabelErrorMessage || !actionContent) && activeIndex);
162
163
  columns.push({
163
- imageUrl: originalContentUrl,
164
+ imageUrl: getCdnUrl({url: originalContentUrl, channelName: 'LINE', channelSubType: 'CARD'}),
164
165
  aspectRatio,
165
166
  action: {
166
167
  type: selectedActionType ? (selectedActionType === TEXT_ACTION_TYPE ? MESSAGE_ACTION_TYPE : URL_ACTION_TYPE) : '',
@@ -455,7 +456,7 @@ export const LineImageCarousel = (props) => {
455
456
  } = content || {};
456
457
  validCarouselImages.push({
457
458
  activeIndex: index,
458
- originalContentUrl: url,
459
+ originalContentUrl: getCdnUrl({url: url, channelName: 'LINE', channelSubType: 'CARD'}),
459
460
  aspectRatio,
460
461
  selectedActionType: buttonType ? (buttonType === MESSAGE_ACTION_TYPE ? TEXT_ACTION_TYPE : URL_ACTION_TYPE) : '',
461
462
  actionContent: text || uri,
@@ -480,7 +481,7 @@ export const LineImageCarousel = (props) => {
480
481
 
481
482
  validCarouselImages.push({
482
483
  activeIndex: index,
483
- originalContentUrl: imageUrl,
484
+ originalContentUrl: getCdnUrl({url: imageUrl, channelName: 'LINE', channelSubType: 'CARD'}),
484
485
  selectedActionType: type ? (type === MESSAGE_ACTION_TYPE ? TEXT_ACTION_TYPE : URL_ACTION_TYPE) : '',
485
486
  actionContent: text || uri,
486
487
  actionLabel: label,
@@ -39,6 +39,7 @@ import {
39
39
  } from '../constants';
40
40
 
41
41
  const { CapIconAvatar } = CapIcon;
42
+ import { getCdnUrl } from '../../../../utils/cdnTransformation';
42
43
 
43
44
  export const LineImageMap = ({
44
45
  className,
@@ -114,7 +115,7 @@ export const LineImageMap = ({
114
115
  if (imageSrc && (isFullMode ? messageTitle: true) && imageMapTemplate && actionLinks) {
115
116
  updateMessageState({
116
117
  isError: !imageSrc || !(isFullMode ? messageTitle : true) || !imageMapTemplate || (isImageError && errorMessageTitle) || errorTitle || !altText,
117
- baseUrl: imageSrc,
118
+ baseUrl: getCdnUrl({url: imageSrc, channelName: 'LINE', channelSubType: 'RICH_MESSAGE'}),
118
119
  messageTitle,
119
120
  index,
120
121
  type: IMAGE_MAP,
@@ -31,6 +31,7 @@ import { GA } from '@capillarytech/cap-ui-utils';
31
31
  import { CREATE, TRACK_CREATE_MPUSH } from '../../App/constants';
32
32
  import { MOBILE_PUSH } from '../../CreativesContainer/constants';
33
33
  import { getContent } from '../commonMethods';
34
+ import { getCdnUrl } from '../../../utils/cdnTransformation'
34
35
 
35
36
  const PrefixWrapper = styled.div`
36
37
  margin-right: 16px;
@@ -464,7 +465,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
464
465
  const secondaryCta2 = !!android['cta-deeplink-secondary-cta-1-select'] || !!android['secondary-cta-1-label'];
465
466
  const imageLink = android.image;
466
467
  if (imageLink) {
467
- obj.versions.base.ANDROID.expandableDetails.image = imageLink;
468
+ obj.versions.base.ANDROID.expandableDetails.image = getCdnUrl({url: imageLink, channelName: 'MOBILE_PUSH'});
468
469
  obj.versions.base.ANDROID.expandableDetails.style = "BIG_PICTURE";
469
470
  }
470
471
  if (secondaryCta1 || secondaryCta2 ) {
@@ -538,7 +539,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
538
539
  const imageLinkIos = ios.image;
539
540
  const secondaryCtaIos = !!ios['cta-deeplink-secondary-cta-1-select'] || !!ios['secondary-cta-1-label'];
540
541
  if (imageLinkIos) {
541
- obj.versions.base.IOS.expandableDetails.image = imageLinkIos;
542
+ obj.versions.base.IOS.expandableDetails.image = getCdnUrl({url: imageLinkIos, channelName: 'MOBILE_PUSH'});
542
543
  obj.versions.base.IOS.expandableDetails.style = "BIG_PICTURE";
543
544
  }
544
545
  if (secondaryCtaIos) {
@@ -1852,4 +1853,4 @@ export default withCreatives({
1852
1853
  mapStateToProps,
1853
1854
  mapDispatchToProps,
1854
1855
  userAuth: false,
1855
- });
1856
+ });
@@ -33,6 +33,7 @@ import {getPrimaryCtaFields, getSecondaryCtaFields, getLinkTypeFields, getConten
33
33
  import { GA } from '@capillarytech/cap-ui-utils';
34
34
  import { EDIT, TRACK_EDIT_MPUSH } from '../../App/constants';
35
35
  import { MOBILE_PUSH } from '../../CreativesContainer/constants';
36
+ import { getCdnUrl } from '../../../utils/cdnTransformation';
36
37
 
37
38
  const PrefixWrapper = styled.div`
38
39
  margin-right: 16px;
@@ -421,7 +422,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
421
422
  }
422
423
  const imageLink = android.image;
423
424
  if (imageLink) {
424
- obj.versions.base.ANDROID.expandableDetails.image = imageLink;
425
+ obj.versions.base.ANDROID.expandableDetails.image = getCdnUrl({url: imageLink, channelName: 'MOBILE_PUSH'});
425
426
  obj.versions.base.ANDROID.expandableDetails.style = "BIG_PICTURE";
426
427
  }
427
428
  if (obj.versions.base.ANDROID && obj.versions.base.ANDROID.cta) {
@@ -492,7 +493,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
492
493
  }
493
494
  const imageLinkIos = ios.image;
494
495
  if (imageLinkIos) {
495
- obj.versions.base.IOS.expandableDetails.image = imageLinkIos;
496
+ obj.versions.base.IOS.expandableDetails.image = getCdnUrl({url: imageLinkIos, channelName: 'MOBILE_PUSH'});
496
497
  obj.versions.base.IOS.expandableDetails.style = "BIG_PICTURE";
497
498
  }
498
499
  if (obj.versions.base.IOS && obj.versions.base.IOS.cta) {
@@ -1940,4 +1941,4 @@ export default withCreatives({
1940
1941
  mapStateToProps,
1941
1942
  mapDispatchToProps,
1942
1943
  userAuth: false,
1943
- });
1944
+ });
@@ -81,6 +81,7 @@ import Templates from '../Templates';
81
81
  import SmsTraiEdit from '../SmsTrai/Edit';
82
82
  import TagList from '../TagList';
83
83
  import { validateTags } from '../../utils/tagValidations';
84
+ import { getCdnUrl } from '../../utils/cdnTransformation';
84
85
  const { Group: CapCheckboxGroup } = CapCheckbox;
85
86
  export const Rcs = (props) => {
86
87
  const {
@@ -900,7 +901,7 @@ export const Rcs = (props) => {
900
901
  ...(suggestions.length > 0 && { suggestions }),
901
902
  ...(!isMediaTypeNone && {
902
903
  media: {
903
- mediaUrl: rcsImageSrc,
904
+ mediaUrl: getCdnUrl({url: rcsImageSrc, channelName: 'RCS'}),
904
905
  height: MEDIUM,
905
906
  },
906
907
  }),
@@ -53,9 +53,12 @@ import { GA } from '@capillarytech/cap-ui-utils';
53
53
  import { CREATE, EDIT, TRACK_CREATE_VIBER, TRACK_EDIT_VIBER } from '../App/constants';
54
54
  import { gtmPush } from '../../utils/gtmTrackers';
55
55
  import { VIBER } from '../CreativesContainer/constants';
56
+ import { getCdnUrl } from '../../utils/cdnTransformation';
57
+
56
58
  const { CapHeadingSpan } = CapHeading;
57
59
  const { TextArea } = CapInput;
58
60
 
61
+
59
62
  const Viber = (props) => {
60
63
  const {
61
64
  intl,
@@ -78,7 +81,7 @@ const Viber = (props) => {
78
81
  const { formatMessage } = intl;
79
82
  const [isImageError, updateImageErrorMessage] = useState(false);
80
83
  const [isImage, updateImageStatus] = useState(false);
81
- const [imageSrc, updateImageSrc] = useState();
84
+ const [imageSrc, setImageSrc] = useState();
82
85
  const [isDrawerRequired, updateDrawerRequirement] = useState(false);
83
86
  const [messageContent, updateTextMessageContent] = useState('');
84
87
  const [buttonText, updateButtonText] = useState('');
@@ -92,6 +95,12 @@ const Viber = (props) => {
92
95
  const [buttonURLErrorMessage, updateButtonURLErrorMessage] = useState(false);
93
96
  const [accountName, updateAccountName] = useState("");
94
97
 
98
+
99
+ const updateImageSrc = React.useCallback((url)=>{
100
+ const newUrl = getCdnUrl({url, channelName: 'VIBER'});
101
+ setImageSrc(newUrl);
102
+ },[]);
103
+
95
104
  const StyledHeader = styled(CapHeader)`
96
105
  margin-bottom: 14px;
97
106
  `;
@@ -741,4 +750,4 @@ export default withCreatives({
741
750
  mapStateToProps,
742
751
  mapDispatchToProps,
743
752
  userAuth: true,
744
- });
753
+ });
@@ -74,6 +74,8 @@ import {
74
74
  PHONE_NUMBER,
75
75
  WEBSITE,
76
76
  } from '../../v2Components/CapWhatsappCTA/constants';
77
+ import { getCdnUrl } from '../../utils/cdnTransformation';
78
+
77
79
  let varMap = {};
78
80
  let editContent = {};
79
81
  let tagValidationResponse = {};
@@ -855,7 +857,7 @@ export const Whatsapp = (props) => {
855
857
  }),
856
858
  mediaType: templateMediaType,
857
859
  ...(isMediaTypeImage && {
858
- imageUrl: whatsappImageSrc,
860
+ imageUrl: getCdnUrl({url: whatsappImageSrc, channelName: 'WHATSAPP',}),
859
861
  karixFileHandle,
860
862
  }),
861
863
  varMapped: !isFullMode ? varMap : {},
@@ -1439,4 +1441,4 @@ export default withCreatives({
1439
1441
  mapStateToProps,
1440
1442
  mapDispatchToProps,
1441
1443
  userAuth: true,
1442
- });
1444
+ });
@@ -1,18 +0,0 @@
1
- /**
2
- * This is not an integration test rather it's created to run the integration test script for now.
3
- * The tests case and file name will be re-written as per the requirement in future.
4
- */
5
-
6
- describe('Create Templates ', () => {
7
- it('Should pass the test case for truthy values', async () => {
8
- expect(true).toBeTruthy();
9
- });
10
-
11
- it('Should pass the test case for falsy values', async () => {
12
- expect(false).toBeFalsy();
13
- });
14
-
15
- it('Should pass the test case for falsy values', async () => {
16
- expect({}).toEqual({});
17
- });
18
- });