@capillarytech/creatives-library 7.12.108 → 7.12.110
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 +4 -2
- package/routes.js +1 -0
- package/services/api.js +6 -1
- package/utils/cdnTransformation.js +369 -0
- package/utils/tests/__snapshots__/cdnTransformation.test.js.snap +298 -0
- package/utils/tests/cdnTransformation.mockdata.js +301 -0
- package/utils/tests/cdnTransformation.test.js +245 -0
- package/v2Containers/Cap/actions.js +0 -1
- package/v2Containers/Cap/constants.js +0 -1
- package/v2Containers/Cap/sagas.js +3 -0
- package/v2Containers/CreativesContainer/actions.js +2 -1
- package/v2Containers/CreativesContainer/constants.js +1 -1
- package/v2Containers/CreativesContainer/index.js +6 -1
- package/v2Containers/CreativesContainer/tests/index.test.js +4 -0
- package/v2Containers/Email/index.js +4 -1
- package/v2Containers/Facebook/Advertisement/index.js +4 -4
- package/v2Containers/Line/Container/Image/index.js +5 -4
- package/v2Containers/Line/Container/ImageCarousel/index.js +6 -5
- package/v2Containers/Line/Container/ImageMap/index.js +2 -1
- package/v2Containers/MobilePush/Create/index.js +5 -7
- package/v2Containers/MobilePush/Edit/index.js +4 -3
- package/v2Containers/Rcs/index.js +2 -1
- package/v2Containers/Templates/actions.js +6 -0
- package/v2Containers/Templates/constants.js +4 -0
- package/v2Containers/Templates/sagas.js +23 -0
- package/v2Containers/TemplatesV2/index.js +5 -0
- package/v2Containers/Viber/index.js +11 -2
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +3 -1
- package/v2Containers/Whatsapp/index.js +4 -2
- package/tests/integration/CreateTemplate/CreateTemplate.integration.test.js +0 -18
|
@@ -3,6 +3,7 @@ import { LOCATION_CHANGE } from 'react-router-redux';
|
|
|
3
3
|
// import { schema, normalize } from 'normalizr';
|
|
4
4
|
import * as Api from '../../services/api';
|
|
5
5
|
import * as types from './constants';
|
|
6
|
+
import { saveCdnConfigs, removeAllCdnLocalStorageItems } from '../../utils/cdnTransformation';
|
|
6
7
|
|
|
7
8
|
// Individual exports for testing
|
|
8
9
|
export function* getAllTemplates(channel, queryParams) {
|
|
@@ -85,6 +86,20 @@ export function* getOrgLevelCampaignSettings() {
|
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
|
|
89
|
+
function* getCdnTransformationConfig() {
|
|
90
|
+
try {
|
|
91
|
+
const res = yield call(Api.getCdnTransformationConfig);
|
|
92
|
+
|
|
93
|
+
if (res?.success && res?.status?.code === 200) {
|
|
94
|
+
const cdnConfigs = res?.response;
|
|
95
|
+
saveCdnConfigs(cdnConfigs);
|
|
96
|
+
}
|
|
97
|
+
} catch (error) {
|
|
98
|
+
console.log("some error occured during getCdnTransformationConfig call");
|
|
99
|
+
removeAllCdnLocalStorageItems();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
88
103
|
export function* watchGetOrgLevelCampaignSettings() {
|
|
89
104
|
const watcher = yield takeLatest(
|
|
90
105
|
types.GET_ORG_LEVEL_CAMPAIGN_SETTINGS_REQUEST,
|
|
@@ -222,6 +237,13 @@ function* watchGetSenderDetails() {
|
|
|
222
237
|
yield cancel(watcher);
|
|
223
238
|
}
|
|
224
239
|
|
|
240
|
+
function* watchGetCdnTransformationConfig() {
|
|
241
|
+
yield takeLatest(
|
|
242
|
+
types.GET_CDN_TRANSFORMATION_CONFIG_REQUEST,
|
|
243
|
+
getCdnTransformationConfig
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
|
|
225
247
|
// All sagas to be loaded
|
|
226
248
|
export default [
|
|
227
249
|
watchGetAllTemplates,
|
|
@@ -233,4 +255,5 @@ export default [
|
|
|
233
255
|
watchGetTemplateDetails,
|
|
234
256
|
watchGetOrgLevelCampaignSettings,
|
|
235
257
|
watchGetSenderDetails,
|
|
258
|
+
watchGetCdnTransformationConfig
|
|
236
259
|
];
|
|
@@ -19,6 +19,7 @@ import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
|
19
19
|
import { makeSelectTemplates, makeSelectTemplatesResponse } from '../Templates/selectors';
|
|
20
20
|
import messages from './messages';
|
|
21
21
|
import * as actions from './actions';
|
|
22
|
+
import * as templateActions from '../Templates/actions';
|
|
22
23
|
import Templates from '../Templates';
|
|
23
24
|
import CallTask from '../CallTask';
|
|
24
25
|
import Facebook from '../Facebook';
|
|
@@ -139,6 +140,9 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
139
140
|
if (queryItems.channel === WHATSAPP) {
|
|
140
141
|
this.channelChange(WHATSAPP);
|
|
141
142
|
}
|
|
143
|
+
if(this.props?.isFullMode){
|
|
144
|
+
this.props.templateActions.getCdnTransformationConfig();
|
|
145
|
+
}
|
|
142
146
|
}
|
|
143
147
|
|
|
144
148
|
componentWillReceiveProps(nextProps) {
|
|
@@ -350,6 +354,7 @@ const mapStateToProps = createStructuredSelector({
|
|
|
350
354
|
function mapDispatchToProps(dispatch) {
|
|
351
355
|
return {
|
|
352
356
|
actions: bindActionCreators(actions, dispatch),
|
|
357
|
+
templateActions: bindActionCreators(templateActions, dispatch),
|
|
353
358
|
};
|
|
354
359
|
}
|
|
355
360
|
|
|
@@ -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,
|
|
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
|
+
});
|
|
@@ -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
|
});
|
|
@@ -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
|
-
});
|