@capillarytech/creatives-library 7.12.94 → 7.12.96

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.94",
4
+ "version": "7.12.96",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
package/services/api.js CHANGED
@@ -484,4 +484,9 @@ export const createWhatsappTemplate = ({ payload }) => {
484
484
  export const getSenderDetails = (channel, orgUnitId) => {
485
485
  const url = `${CAMPAIGNS_API_ORG_ENDPOINT}/meta/domainProperties?channel=${channel}`;
486
486
  return request(url, getAPICallObject('GET', null, false, true, orgUnitId));
487
- };
487
+ };
488
+
489
+ export const getCdnTransformationConfig = () => {
490
+ const url = `${API_ENDPOINT}/common/getCdnTransformationConfig`;
491
+ return request(url, getAPICallObject('GET'));
492
+ }
@@ -7,9 +7,6 @@ import { parse } from "node-html-parser";
7
7
 
8
8
  // 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
9
9
 
10
- const CDN_BASE_URL = `https://storage.crm.n.content-cdn.io`;
11
- const CDN_TRANSFORMATION_URL_SUFFIX = `/cdn-cgi/image/`;
12
- const QUALITY = 75;
13
10
  // const regex = /https:\/\/.*intouch_creative_assets.*(?:jpg|png|jpeg|gif)$/;
14
11
  const regex = /https:\/\/.*intouch_creative_assets.*$/;
15
12
  const INTOUCH_CREATIVE_ASSETS = "intouch_creative_assets";
@@ -86,6 +83,14 @@ const CHANNEL_CONFIGS = {
86
83
  },
87
84
  }
88
85
  },
86
+ WECHAT: {
87
+ transformations: {
88
+ width: 360,
89
+ height: 200,
90
+ quality: QUALITY_TYPE.DECREASE,
91
+
92
+ }
93
+ }
89
94
  };
90
95
 
91
96
  /**
@@ -98,19 +103,29 @@ export const getCdnUrl = ({
98
103
  channelName: receivedChannelName,
99
104
  channelSubType: receivedChannelSubType,
100
105
  }) => {
106
+ console.log('hello func called..');
101
107
  const channelName = receivedChannelName?.toUpperCase();
102
108
  const channelSubType = receivedChannelSubType?.toUpperCase();
103
109
 
110
+ const CREATIVES_CDN_BASE_URL = getLocalStorageItem('CREATIVES_CDN_BASE_URL');
111
+ const CREATIVES_CDN_QUALITY_CONFIG = getLocalStorageItem('CREATIVES_CDN_QUALITY_CONFIG', true);
112
+ const CREATIVES_CDN_TRANSFORMATION_URL_SUFFIX = getLocalStorageItem('CREATIVES_CDN_TRANSFORMATION_URL_SUFFIX');
113
+
114
+ const QUALITY = CREATIVES_CDN_QUALITY_CONFIG?.[channelName] || CREATIVES_CDN_QUALITY_CONFIG?.DEFAULT;
115
+
104
116
  if (
105
117
  !regex.test(url) ||
106
118
  !CHANNEL_CONFIGS?.[channelName] ||
107
- (channelSubType && !CHANNEL_CONFIGS?.[channelName]?.[channelSubType])
119
+ (channelSubType && !CHANNEL_CONFIGS?.[channelName]?.[channelSubType]) ||
120
+ !CREATIVES_CDN_BASE_URL ||
121
+ !CREATIVES_CDN_TRANSFORMATION_URL_SUFFIX ||
122
+ !QUALITY
108
123
  )
109
124
  return url;
110
125
 
111
126
  const [, assetKey] = url.split(INTOUCH_CREATIVE_ASSETS);
112
127
 
113
- let newUrl = `${CDN_BASE_URL}`;
128
+ let newUrl = `${CREATIVES_CDN_BASE_URL}`;
114
129
 
115
130
  let applicableTransformations;
116
131
 
@@ -123,7 +138,7 @@ export const getCdnUrl = ({
123
138
 
124
139
  if (!isEmpty(applicableTransformations)) {
125
140
 
126
- newUrl += CDN_TRANSFORMATION_URL_SUFFIX;
141
+ newUrl += `/${CREATIVES_CDN_TRANSFORMATION_URL_SUFFIX}/`;
127
142
 
128
143
  // Object.keys(applicableTransformations)?.forEach((transformationParam) => {
129
144
  forOwn(applicableTransformations, (transformationParamVal, transformationParam)=>{
@@ -218,3 +233,31 @@ export const transformEmailTemplates = (contents) => {
218
233
  return contents; //return received input directly in case an exception is thrown
219
234
  }
220
235
  };
236
+
237
+
238
+
239
+ export function getLocalStorageItem(key, parse = false){
240
+ const val = localStorage.getItem(key);
241
+ if(parse){
242
+ return JSON.parse(val);
243
+ }
244
+ return val;
245
+ }
246
+
247
+ export function saveCdnConfigs(configsResponse){
248
+ try{
249
+ if(isEmpty(configsResponse)) return;
250
+ if(configsResponse?.hostname){
251
+ localStorage.setItem('CREATIVES_CDN_BASE_URL', configsResponse?.hostname);
252
+ }
253
+ if(!isEmpty(configsResponse?.qualityCfg)){
254
+ const qualityString = JSON.stringify(configsResponse?.qualityCfg);
255
+ localStorage.setItem('CREATIVES_CDN_QUALITY_CONFIG', qualityString);
256
+ }
257
+ if(configsResponse?.transformationUrlSuffix){
258
+ localStorage.setItem('CREATIVES_CDN_TRANSFORMATION_URL_SUFFIX', configsResponse?.transformationUrlSuffix);
259
+ }
260
+ }catch(e){
261
+ console.log('some error while setting localstorage cdn configs')
262
+ }
263
+ }
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`transformEmailTemplate() should transform email template 1`] = `
3
+ exports[`cdnTransformationTests transformEmailTemplate() should transform email template 1`] = `
4
4
  Object {
5
5
  "name": "test template1",
6
6
  "type": "EMAIL",
@@ -1,76 +1,105 @@
1
1
  import * as cdnUtils from '../cdnTransformation';
2
2
  import * as mockdata from './cdnTransformation.mockdata';
3
3
 
4
- describe('getCdnUrl()',()=>{
5
- it('should return s3 url if bucket subfolder doesn\'t contain intouch_creative_assets',()=>{
6
- const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/test/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
7
- const GENERATED_CDN_URL = cdnUtils.getCdnUrl({url: TEST_S3_URL, channelName: 'EMAIL'});
8
- expect(GENERATED_CDN_URL).toEqual(TEST_S3_URL);
9
- })
10
-
11
- it('should return s3 if channelName is not defined',()=>{
12
- const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
13
- const GENERATED_CDN_URL = cdnUtils.getCdnUrl({url: TEST_S3_URL});
14
- expect(GENERATED_CDN_URL).toEqual(TEST_S3_URL);
15
- })
16
-
17
- it('should return s3 if specified channelSubType doesn\'t exist',()=>{
18
- const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
19
- const GENERATED_CDN_URL = cdnUtils.getCdnUrl({url: TEST_S3_URL, channelName: 'LINE', channelSubType: 'ABC'});
20
- expect(GENERATED_CDN_URL).toEqual(TEST_S3_URL);
21
- })
22
-
23
- it('Should replace s3 url with cdn url for email when h/w are not provided',()=>{
24
- const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
25
- const GENERATED_CDN_URL = cdnUtils.getCdnUrl({url: TEST_S3_URL, channelName: 'EMAIL'})
26
- const EXPECTED_CDN_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/format=auto,quality=75,/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`
27
- expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
28
- })
29
-
30
- it('Should replace s3 url with cdn url for email when h/w are provided',()=>{
31
- const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
32
- const GENERATED_CDN_URL = cdnUtils.getCdnUrl({url: TEST_S3_URL, channelName: 'EMAIL', height: 100, width: 200})
33
- const EXPECTED_CDN_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=200,height=100,format=auto,quality=75,/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`
34
- expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
35
- })
36
-
37
- it('should replace cdn url with new cdn url for email incase h/w etc changed', ()=>{
38
- const TEST_S3_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=200,height=100,format=auto,quality=75,/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`
39
- const GENERATED_CDN_URL = cdnUtils.getCdnUrl({url: TEST_S3_URL, channelName: 'EMAIL', height: 400, width: 500})
40
- const EXPECTED_CDN_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=500,height=400,format=auto,quality=75,/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`
41
- expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
42
- })
43
-
44
- it('should replace cdn url with new cdn url incase channelName is LINE and channelSubType is RICH_MESSAGE ',()=>{
45
- const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8`;
46
- const GENERATED_CDN_URL = cdnUtils.getCdnUrl({url: TEST_S3_URL, channelName: 'LINE', channelSubType: 'RICH_MESSAGE'})
47
- const EXPECTED_CDN_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=1040,quality=75,/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8`
48
- expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
4
+ describe('cdnTransformationTests',()=>{
5
+ beforeAll(()=>{
6
+ var localStorageMock = (function() {
7
+ var store = {
8
+ CREATIVES_CDN_TRANSFORMATION_URL_SUFFIX: "cdn-cgi/image",
9
+ CREATIVES_CDN_BASE_URL: "https://storage.crm.n.content-cdn.io",
10
+ CREATIVES_CDN_QUALITY_CONFIG: '{"EMAIL":75,"RCS":75,"VIBER":75,"WHATSAPP":75,"MOBILE_PUSH":75,"FACEBOOK":75,"LINE":75,"DEFAULT":75}',
11
+ };
12
+ return {
13
+ getItem: function(key) {
14
+ return store[key];
15
+ },
16
+ setItem: function(key, value) {
17
+ store[key] = value.toString();
18
+ },
19
+ clear: function() {
20
+ store = {};
21
+ },
22
+ removeItem: function(key) {
23
+ delete store[key];
24
+ }
25
+ };
26
+ })();
27
+ Object.defineProperty(window, 'localStorage', { value: localStorageMock });
49
28
  })
50
29
 
51
- it('should replace cdn url with new cdn url for channels which has predefined h/w for channel', ()=>{
52
- const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
53
- const GENERATED_CDN_URL = cdnUtils.getCdnUrl({url: TEST_S3_URL, channelName: 'RCS'})
54
- const EXPECTED_CDN_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=1440,height=720,quality=75,/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`
55
- expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
30
+
31
+ describe('getCdnUrl()',()=>{
32
+ it('should return s3 url if bucket subfolder doesn\'t contain intouch_creative_assets',()=>{
33
+ const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/test/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
34
+ const GENERATED_CDN_URL = cdnUtils.getCdnUrl({url: TEST_S3_URL, channelName: 'EMAIL'});
35
+ expect(GENERATED_CDN_URL).toEqual(TEST_S3_URL);
36
+ })
37
+
38
+ it('should return s3 if channelName is not defined',()=>{
39
+ const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
40
+ const GENERATED_CDN_URL = cdnUtils.getCdnUrl({url: TEST_S3_URL});
41
+ expect(GENERATED_CDN_URL).toEqual(TEST_S3_URL);
42
+ })
43
+
44
+ it('should return s3 if specified channelSubType doesn\'t exist',()=>{
45
+ const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
46
+ const GENERATED_CDN_URL = cdnUtils.getCdnUrl({url: TEST_S3_URL, channelName: 'LINE', channelSubType: 'ABC'});
47
+ expect(GENERATED_CDN_URL).toEqual(TEST_S3_URL);
48
+ })
49
+
50
+ it('Should replace s3 url with cdn url for email when h/w are not provided',()=>{
51
+ const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
52
+ const GENERATED_CDN_URL = cdnUtils.getCdnUrl({url: TEST_S3_URL, channelName: 'EMAIL'})
53
+ const EXPECTED_CDN_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/format=auto,quality=75,/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`
54
+ expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
55
+ })
56
+
57
+ it('Should replace s3 url with cdn url for email when h/w are provided',()=>{
58
+ const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
59
+ const GENERATED_CDN_URL = cdnUtils.getCdnUrl({url: TEST_S3_URL, channelName: 'EMAIL', height: 100, width: 200})
60
+ const EXPECTED_CDN_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=200,height=100,format=auto,quality=75,/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`
61
+ expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
62
+ })
63
+
64
+ it('should replace cdn url with new cdn url for email incase h/w etc changed', ()=>{
65
+ const TEST_S3_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=200,height=100,format=auto,quality=75,/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`
66
+ const GENERATED_CDN_URL = cdnUtils.getCdnUrl({url: TEST_S3_URL, channelName: 'EMAIL', height: 400, width: 500})
67
+ const EXPECTED_CDN_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=500,height=400,format=auto,quality=75,/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`
68
+ expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
69
+ })
70
+
71
+ it('should replace cdn url with new cdn url incase channelName is LINE and channelSubType is RICH_MESSAGE ',()=>{
72
+ const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8`;
73
+ const GENERATED_CDN_URL = cdnUtils.getCdnUrl({url: TEST_S3_URL, channelName: 'LINE', channelSubType: 'RICH_MESSAGE'})
74
+ const EXPECTED_CDN_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=1040,quality=75,/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8`
75
+ expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
76
+ })
77
+
78
+ it('should replace cdn url with new cdn url for channels which has predefined h/w for channel', ()=>{
79
+ const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
80
+ const GENERATED_CDN_URL = cdnUtils.getCdnUrl({url: TEST_S3_URL, channelName: 'RCS'})
81
+ const EXPECTED_CDN_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=1440,height=720,quality=75,/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`
82
+ expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
83
+ })
56
84
  })
57
- })
58
85
 
59
86
 
60
- describe('updateImagesInHtml()',()=>{
61
- it('should update images in html',()=>{
62
- const htmlContentsInput = mockdata.emailRawInput;
63
- const htmlContentsOutput = cdnUtils.updateImagesInHtml(htmlContentsInput);
64
- const expected = mockdata.emailRawTransformed;
65
- expect(htmlContentsOutput).toEqual(expected);
87
+ describe('updateImagesInHtml()',()=>{
88
+ it('should update images in html',()=>{
89
+ const htmlContentsInput = mockdata.emailRawInput;
90
+ const htmlContentsOutput = cdnUtils.updateImagesInHtml(htmlContentsInput);
91
+ const expected = mockdata.emailRawTransformed;
92
+ expect(htmlContentsOutput).toEqual(expected);
93
+ })
66
94
  })
67
- })
68
95
 
69
96
 
70
- describe('transformEmailTemplate()',()=>{
71
- it('should transform email template',()=>{
72
- const emailTemplateInput = mockdata.emailTemplateRaw;
73
- const emailTemplateOutput = cdnUtils.transformEmailTemplates(emailTemplateInput);
74
- expect(emailTemplateOutput).toMatchSnapshot();
97
+ describe('transformEmailTemplate()',()=>{
98
+ it('should transform email template',()=>{
99
+ const emailTemplateInput = mockdata.emailTemplateRaw;
100
+ const emailTemplateOutput = cdnUtils.transformEmailTemplates(emailTemplateInput);
101
+ expect(emailTemplateOutput).toMatchSnapshot();
102
+ })
75
103
  })
76
104
  })
105
+
@@ -74,3 +74,8 @@ export function clearTopbarMenuData() {
74
74
  };
75
75
  }
76
76
 
77
+ export function getCdnTransformationConfig() {
78
+ return {
79
+ type: types.GET_CDN_TRANSFORMATION_CONFIG_REQUEST,
80
+ }
81
+ }
@@ -38,3 +38,6 @@ export const LOYALTY_HELP_URL = 'https://docs.capillarytech.com/docs/loyalty-ove
38
38
  export const ORG_REFRESH_SEC = 10;
39
39
  export const ORG_CHANGED = 'ORG_CHANGED';
40
40
 
41
+ export const GET_CDN_TRANSFORMATION_CONFIG_REQUEST = 'creatives/GET_CDN_TRANSFORMATION_CONFIG_REQUEST/V2';
42
+ export const GET_CDN_TRANSFORMATION_CONFIG_SUCCESS = 'creatives/GET_CDN_TRANSFORMATION_CONFIG_SUCCESS/V2';
43
+ export const GET_CDN_TRANSFORMATION_CONFIG_FAILURE = 'creatives/GET_CDN_TRANSFORMATION_CONFIG_FAILURE/V2';
@@ -119,6 +119,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
119
119
  );
120
120
  window.addEventListener('pageshow', this.tabOnloadEventHandler, false);
121
121
  window.addEventListener('pagehide', tabBeforeUnloadEventHandler, false);
122
+ this.props.actions.getCdnTransformationConfig();
122
123
  }
123
124
 
124
125
  componentWillReceiveProps(nextProps) {
@@ -13,6 +13,8 @@ import {
13
13
  } from '../../v2Containers/App/constants';
14
14
  // import {makeSelectOrgId} from './selectors';
15
15
 
16
+ import { saveCdnConfigs } from '../../utils/cdnTransformation';
17
+
16
18
  function* authorize(user) {
17
19
  try {
18
20
  const res = yield call(Api.authorize, user);
@@ -41,6 +43,19 @@ function* switchOrg({orgID}) {
41
43
  }
42
44
  }
43
45
 
46
+ function* getCdnTransformationConfig() {
47
+ try {
48
+ const res = yield call(Api.getCdnTransformationConfig);
49
+
50
+ if(res?.success && res?.status?.code === 200){
51
+ const cdnConfigs = res?.response;
52
+ saveCdnConfigs(cdnConfigs);
53
+ }
54
+ } catch (error) {
55
+ console.log('some error occured during getCdnTransformationConfig call')
56
+ }
57
+ }
58
+
44
59
  function* loginFlow() {
45
60
  const condition = true;
46
61
  while (condition) {
@@ -175,6 +190,11 @@ function* watchGetTopbarMenuData() {
175
190
  yield takeLatest(types.GET_TOPBAR_MENU_DATA_REQUEST, getTopbarMenuData);
176
191
  }
177
192
 
193
+
194
+ function* watchGetCdnTransformationConfig() {
195
+ yield takeLatest(types.GET_CDN_TRANSFORMATION_CONFIG_REQUEST, getCdnTransformationConfig);
196
+ }
197
+
178
198
  export default [
179
199
  loginFlow,
180
200
  watchForOrgChange,
@@ -182,5 +202,6 @@ export default [
182
202
  watchForFetchUserInfo,
183
203
  watchFetchSchemaForEntity,
184
204
  watchGetTopbarMenuData,
205
+ watchGetCdnTransformationConfig,
185
206
  ];
186
207
 
@@ -41,6 +41,7 @@ exports[`<Cap /> should render correct component 1`] = `
41
41
  "clearMetaEntities": [Function],
42
42
  "clearTopbarMenuData": [Function],
43
43
  "fetchSchemaForEntity": [Function],
44
+ "getCdnTransformationConfig": [Function],
44
45
  "getTopbarMenuData": [Function],
45
46
  "getUserData": [Function],
46
47
  "logout": [Function],
@@ -4643,7 +4643,7 @@ exports[`line wrapper test/> should render line component new 1`] = `
4643
4643
  "actionLabel": "Click",
4644
4644
  "activeIndex": 0,
4645
4645
  "aspectRatio": "1:1",
4646
- "originalContentUrl": "https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=1024,height=1024,quality=75,/intouch_creative_assets/b9f2aa7a-3f1a-4a20-a737-8d50841.jpeg",
4646
+ "originalContentUrl": "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/b9f2aa7a-3f1a-4a20-a737-8d50841.jpeg",
4647
4647
  "selectedActionType": "text",
4648
4648
  "type": "carousel",
4649
4649
  }
@@ -6081,7 +6081,7 @@ exports[`line wrapper test/> should render line component new 1`] = `
6081
6081
  "actionLabel": "Click",
6082
6082
  "activeIndex": 0,
6083
6083
  "aspectRatio": "1:1",
6084
- "originalContentUrl": "https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=1024,height=1024,quality=75,/intouch_creative_assets/b9f2aa7a-3f1a-4a20-a737-8d50841.jpeg",
6084
+ "originalContentUrl": "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/b9f2aa7a-3f1a-4a20-a737-8d50841.jpeg",
6085
6085
  "selectedActionType": "text",
6086
6086
  "type": "carousel",
6087
6087
  }
@@ -7375,7 +7375,7 @@ exports[`line wrapper test/> should render line component new 1`] = `
7375
7375
  "actionLabel": "Click",
7376
7376
  "activeIndex": 0,
7377
7377
  "aspectRatio": "1:1",
7378
- "originalContentUrl": "https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=1024,height=1024,quality=75,/intouch_creative_assets/b9f2aa7a-3f1a-4a20-a737-8d50841.jpeg",
7378
+ "originalContentUrl": "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/b9f2aa7a-3f1a-4a20-a737-8d50841.jpeg",
7379
7379
  "selectedActionType": "text",
7380
7380
  "type": "carousel",
7381
7381
  }
@@ -8680,7 +8680,7 @@ exports[`line wrapper test/> should render line component new 1`] = `
8680
8680
  "actionLabel": "Click",
8681
8681
  "activeIndex": 0,
8682
8682
  "aspectRatio": "1:1",
8683
- "originalContentUrl": "https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=1024,height=1024,quality=75,/intouch_creative_assets/b9f2aa7a-3f1a-4a20-a737-8d50841.jpeg",
8683
+ "originalContentUrl": "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/b9f2aa7a-3f1a-4a20-a737-8d50841.jpeg",
8684
8684
  "selectedActionType": "text",
8685
8685
  "type": "carousel",
8686
8686
  }
@@ -12747,7 +12747,7 @@ exports[`line wrapper test/> should render line component new 1`] = `
12747
12747
  "actionLabel": "Click",
12748
12748
  "activeIndex": 0,
12749
12749
  "aspectRatio": "1:1",
12750
- "originalContentUrl": "https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=1024,height=1024,quality=75,/intouch_creative_assets/b9f2aa7a-3f1a-4a20-a737-8d50841.jpeg",
12750
+ "originalContentUrl": "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/b9f2aa7a-3f1a-4a20-a737-8d50841.jpeg",
12751
12751
  "selectedActionType": "text",
12752
12752
  "type": "carousel",
12753
12753
  }
@@ -14157,7 +14157,7 @@ exports[`line wrapper test/> should render line component new 1`] = `
14157
14157
  "actionLabel": "Click",
14158
14158
  "activeIndex": 0,
14159
14159
  "aspectRatio": "1:1",
14160
- "originalContentUrl": "https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=1024,height=1024,quality=75,/intouch_creative_assets/b9f2aa7a-3f1a-4a20-a737-8d50841.jpeg",
14160
+ "originalContentUrl": "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/b9f2aa7a-3f1a-4a20-a737-8d50841.jpeg",
14161
14161
  "selectedActionType": "text",
14162
14162
  "type": "carousel",
14163
14163
  }
@@ -15498,7 +15498,7 @@ exports[`line wrapper test/> should render line component new 1`] = `
15498
15498
  "actionLabel": "Click",
15499
15499
  "activeIndex": 0,
15500
15500
  "aspectRatio": "1:1",
15501
- "originalContentUrl": "https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=1024,height=1024,quality=75,/intouch_creative_assets/b9f2aa7a-3f1a-4a20-a737-8d50841.jpeg",
15501
+ "originalContentUrl": "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/b9f2aa7a-3f1a-4a20-a737-8d50841.jpeg",
15502
15502
  "selectedActionType": "text",
15503
15503
  "type": "carousel",
15504
15504
  }
@@ -16752,7 +16752,7 @@ exports[`line wrapper test/> should render line component new 1`] = `
16752
16752
  "actionLabel": "Click",
16753
16753
  "activeIndex": 0,
16754
16754
  "aspectRatio": "1:1",
16755
- "originalContentUrl": "https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=1024,height=1024,quality=75,/intouch_creative_assets/b9f2aa7a-3f1a-4a20-a737-8d50841.jpeg",
16755
+ "originalContentUrl": "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/b9f2aa7a-3f1a-4a20-a737-8d50841.jpeg",
16756
16756
  "selectedActionType": "text",
16757
16757
  "type": "carousel",
16758
16758
  }
@@ -17753,7 +17753,7 @@ exports[`line wrapper test/> should render line component new 1`] = `
17753
17753
  "actionLabel": "Click",
17754
17754
  "activeIndex": 0,
17755
17755
  "aspectRatio": "1:1",
17756
- "originalContentUrl": "https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=1024,height=1024,quality=75,/intouch_creative_assets/b9f2aa7a-3f1a-4a20-a737-8d50841.jpeg",
17756
+ "originalContentUrl": "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/b9f2aa7a-3f1a-4a20-a737-8d50841.jpeg",
17757
17757
  "selectedActionType": "text",
17758
17758
  "type": "carousel",
17759
17759
  }
@@ -57166,7 +57166,7 @@ exports[`Creatives rcs test/> rcs edit with dlt fallback and save 2`] = `
57166
57166
  "description": "Rcs desc",
57167
57167
  "media": Object {
57168
57168
  "height": "MEDIUM",
57169
- "mediaUrl": "https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=1440,height=720,quality=75,/intouch_creative_assets/8fcb2fdce8f92e4a48d4.png",
57169
+ "mediaUrl": "https://s3.amazonaws.com/test_files_cache_bkp/intouch_creative_assets/8fcb2fdce8f92e4a48d4.png",
57170
57170
  },
57171
57171
  "mediaType": "IMAGE",
57172
57172
  "suggestions": Array [
@@ -84708,7 +84708,7 @@ exports[`Creatives rcs test/> rcs edit with dlt fallback and save in library mod
84708
84708
  "description": "Rcs desc",
84709
84709
  "media": Object {
84710
84710
  "height": "MEDIUM",
84711
- "mediaUrl": "https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=1440,height=720,quality=75,/intouch_creative_assets/8fcb2fdce8f92e4a48d4.png",
84711
+ "mediaUrl": "https://s3.amazonaws.com/test_files_cache_bkp/intouch_creative_assets/8fcb2fdce8f92e4a48d4.png",
84712
84712
  },
84713
84713
  "mediaType": "IMAGE",
84714
84714
  "suggestions": Array [
@@ -32,6 +32,8 @@ import { GA } from '@capillarytech/cap-ui-utils';
32
32
  import { CREATE, EDIT, TRACK_CREATE_WECHAT, TRACK_EDIT_WECHAT } from '../../../App/constants';
33
33
  import { gtmPush } from '../../../../utils/gtmTrackers';
34
34
  import { WECHAT } from '../../../CreativesContainer/constants';
35
+ import { getCdnUrl } from '../../../../utils/cdnTransformation';
36
+
35
37
  export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
36
38
  constructor(props) {
37
39
  super(props);
@@ -478,7 +480,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
478
480
  need_open_comment: postCommentsData.need_open_comment,
479
481
  only_fans_can_comment: postCommentsData.only_fans_can_comment,
480
482
  thumb_media_id: contentData.mediaId,
481
- image_url: contentData.imageUrl,
483
+ image_url: getCdnUrl({url: contentData.imageUrl, channelName: 'WECHAT'}),
482
484
  };
483
485
  mediaList.push(filteredContent);
484
486
  });