@capillarytech/creatives-library 7.12.93 → 7.12.94
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 +2 -1
- package/utils/cdnTransformation.js +220 -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 +76 -0
- package/v2Containers/CreativesContainer/index.js +3 -1
- 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/ImageCarousel/tests/__snapshots__/index.test.js.snap +9 -9
- 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/Rcs/tests/__snapshots__/index.test.js.snap +2 -2
- package/v2Containers/Viber/index.js +11 -2
- package/v2Containers/Whatsapp/index.js +4 -2
|
@@ -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) {
|
|
@@ -1320,10 +1321,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1320
1321
|
duration: 2,
|
|
1321
1322
|
});
|
|
1322
1323
|
} else {
|
|
1323
|
-
|
|
1324
|
-
const blob = data.file.slice(0, -1, 'image');
|
|
1325
|
-
const newFile = new File([blob], `${name[0]}${Date.now()}.${name[1]}`, {type: 'image'});
|
|
1326
|
-
this.props.actions.uploadAsset(newFile, data.type, data.fileParams);
|
|
1324
|
+
this.props.actions.uploadAsset(data.file, data.type, data.fileParams);
|
|
1327
1325
|
}
|
|
1328
1326
|
};
|
|
1329
1327
|
selectCtaIos = (selectedConfig) => {
|
|
@@ -1852,4 +1850,4 @@ export default withCreatives({
|
|
|
1852
1850
|
mapStateToProps,
|
|
1853
1851
|
mapDispatchToProps,
|
|
1854
1852
|
userAuth: false,
|
|
1855
|
-
});
|
|
1853
|
+
});
|
|
@@ -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
|
}),
|
|
@@ -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://
|
|
57169
|
+
"mediaUrl": "https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=1440,height=720,quality=75,/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://
|
|
84711
|
+
"mediaUrl": "https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=1440,height=720,quality=75,/intouch_creative_assets/8fcb2fdce8f92e4a48d4.png",
|
|
84712
84712
|
},
|
|
84713
84713
|
"mediaType": "IMAGE",
|
|
84714
84714
|
"suggestions": Array [
|
|
@@ -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
|
+
});
|
|
@@ -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
|
+
});
|