@capillarytech/creatives-library 7.12.14 → 7.12.15
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/containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +2 -2
- package/index.js +0 -6
- package/package.json +1 -1
- package/routes.js +2 -7
- package/services/api.js +2 -8
- package/v2Components/CapImageUpload/index.js +11 -24
- package/v2Components/CapImageUpload/index.scss +27 -12
- package/v2Components/CapImageUpload/messages.js +5 -10
- package/v2Components/TemplatePreview/_templatePreview.scss +0 -10
- package/v2Components/TemplatePreview/index.js +1 -41
- package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +1 -33
- package/v2Components/TemplatePreview/tests/index.test.js +7 -7
- package/v2Containers/App/constants.js +1 -2
- package/v2Containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +2 -2
- package/v2Containers/Cap/messages.js +1 -20
- package/v2Containers/CreativesContainer/SlideBoxContent.js +11 -58
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +30 -39
- package/v2Containers/CreativesContainer/constants.js +0 -1
- package/v2Containers/CreativesContainer/index.js +1 -53
- package/v2Containers/CreativesContainer/messages.js +0 -4
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +4 -24
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +4 -23
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +2 -147
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +0 -98
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +0 -71
- package/v2Containers/CreativesContainer/tests/index.test.js +9 -21
- package/v2Containers/Facebook/Advertisement/index.js +2 -4
- package/v2Containers/MobilePush/Create/index.js +6 -6
- package/v2Containers/MobilePush/Edit/index.js +34 -21
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -4
- package/v2Containers/Templates/_templates.scss +1 -9
- package/v2Containers/Templates/actions.js +1 -2
- package/v2Containers/Templates/constants.js +0 -1
- package/v2Containers/Templates/index.js +174 -234
- package/v2Containers/Templates/messages.js +0 -20
- package/v2Containers/Templates/reducer.js +0 -2
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +80 -520
- package/v2Containers/TemplatesV2/index.js +4 -13
- package/v2Containers/TemplatesV2/messages.js +0 -4
- package/v2Containers/Whatsapp/index.js +2 -4
- package/v2Containers/Whatsapp/messages.js +13 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +13 -13
- package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +26 -32
- package/v2Containers/mockdata.js +541 -500
- package/v2Components/TemplatePreview/assets/images/sms_mobile_ios.svg +0 -18
- package/v2Containers/Assets/images/addCreativesIllustration.svg +0 -30
- package/v2Containers/Assets/images/rcsIllustration.png +0 -0
- package/v2Containers/Rcs/actions.js +0 -57
- package/v2Containers/Rcs/constants.js +0 -51
- package/v2Containers/Rcs/index.js +0 -1075
- package/v2Containers/Rcs/index.scss +0 -72
- package/v2Containers/Rcs/messages.js +0 -122
- package/v2Containers/Rcs/reducer.js +0 -107
- package/v2Containers/Rcs/sagas.js +0 -141
- package/v2Containers/Rcs/selectors.js +0 -8
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +0 -144496
- package/v2Containers/Rcs/tests/index.test.js +0 -226
- package/v2Containers/Rcs/tests/mockData.js +0 -166
- package/v2Containers/Rcs/utils.js +0 -40
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`galleryReducer Initial State should match snapshot returns the initial state 1`] = `
|
|
4
|
-
|
|
5
|
-
"assetList":
|
|
4
|
+
Object {
|
|
5
|
+
"assetList": Array [],
|
|
6
6
|
"assetUploading": false,
|
|
7
7
|
"fetchingAllAssets": false,
|
|
8
8
|
}
|
package/index.js
CHANGED
|
@@ -91,10 +91,6 @@ import Whatsapp from './v2Containers/Whatsapp';
|
|
|
91
91
|
import whatsappReducer from './v2Containers/Whatsapp/reducer';
|
|
92
92
|
import whatsappSaga from './v2Containers/Whatsapp/sagas';
|
|
93
93
|
|
|
94
|
-
import Rcs from './v2Containers/Rcs';
|
|
95
|
-
import rcsReducer from './v2Containers/Rcs/reducer';
|
|
96
|
-
import rcsSaga from './v2Containers/Rcs/sagas';
|
|
97
|
-
|
|
98
94
|
export {default as Ebill} from './v2Containers/Ebill';
|
|
99
95
|
export {default as EbillReducer} from './v2Containers/Ebill/reducer';
|
|
100
96
|
export {default as EbillSaga} from './v2Containers/Ebill/sagas';
|
|
@@ -120,7 +116,6 @@ const ViberContainer = {Viber, viberReducer, viberSaga};
|
|
|
120
116
|
const FacebookPreviewContainer = { FacebookPreview, facebookPreviewReducer, facebookPreviewSaga };
|
|
121
117
|
const SmsTraiContainer = {SmsTraiCreate, SmsTraiCreateReducer, SmsTraiCreateSaga};
|
|
122
118
|
const WhatsappContainer = { Whatsapp, whatsappReducer, whatsappSaga };
|
|
123
|
-
const RcsContainer = { Rcs, rcsReducer, rcsSaga };
|
|
124
119
|
|
|
125
120
|
const GalleryContainer = {Gallery, galleryReducer, gallerySagas};
|
|
126
121
|
const FTPContainer = {FTP, FTPReducer, FTPSagas};
|
|
@@ -168,5 +163,4 @@ export { CapContainer,
|
|
|
168
163
|
FacebookPreviewContainer,
|
|
169
164
|
SmsTraiContainer,
|
|
170
165
|
WhatsappContainer,
|
|
171
|
-
RcsContainer,
|
|
172
166
|
};
|
package/package.json
CHANGED
package/routes.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// about the code splitting business
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { getAsyncInjectors } from 'utils/asyncInjectors';
|
|
7
|
+
import pathConfig from './config/path'
|
|
7
8
|
import * as rootSaga from 'containers/Cap/sagas';
|
|
8
9
|
import * as smsSagas from 'containers/Sms/Create/sagas';
|
|
9
10
|
import * as smsEditSagas from 'containers/Sms/Edit/sagas';
|
|
@@ -13,7 +14,6 @@ import * as emailSagas from 'containers/Email/sagas';
|
|
|
13
14
|
import * as templateSagas from 'containers/Templates/sagas';
|
|
14
15
|
import * as lineSagas from 'containers/Line/Create/sagas';
|
|
15
16
|
import * as languageSaga from './v2Containers/LanguageProvider/sagas';
|
|
16
|
-
import pathConfig from './config/path';
|
|
17
17
|
|
|
18
18
|
import {updateCharCount} from './utils/smsCharCountV2';
|
|
19
19
|
const errorLoading = (err) => {
|
|
@@ -26,7 +26,7 @@ const loadModule = (cb) => (componentModule) => {
|
|
|
26
26
|
|
|
27
27
|
const loadModuleWithProps = (cb) => (ComponentModule, props) => {
|
|
28
28
|
cb(
|
|
29
|
-
null,
|
|
29
|
+
null,
|
|
30
30
|
() => <ComponentModule.default {...props} />
|
|
31
31
|
);
|
|
32
32
|
};
|
|
@@ -662,8 +662,6 @@ export default function createRoutes(store) {
|
|
|
662
662
|
import('v2Containers/SmsTrai/Create/reducer'),
|
|
663
663
|
import('v2Containers/Whatsapp/sagas'),
|
|
664
664
|
import('v2Containers/Whatsapp/reducer'),
|
|
665
|
-
import('v2Containers/Rcs/sagas'),
|
|
666
|
-
import('v2Containers/Rcs/reducer'),
|
|
667
665
|
]);
|
|
668
666
|
|
|
669
667
|
const renderRoute = loadModule(cb);
|
|
@@ -688,7 +686,6 @@ export default function createRoutes(store) {
|
|
|
688
686
|
capFacebookPreviewSagas, capFacebookPreviewReducer,
|
|
689
687
|
smsTraiSagas, smsTraiReducer,
|
|
690
688
|
whatsappSagas, whatsappReducer,
|
|
691
|
-
rcsSagas, rcsReducer,
|
|
692
689
|
]) => {
|
|
693
690
|
injectReducer('templates', reducer.default);
|
|
694
691
|
injectReducer('cap', capReducer.default);
|
|
@@ -709,7 +706,6 @@ export default function createRoutes(store) {
|
|
|
709
706
|
injectReducer('facebookPreview', capFacebookPreviewReducer.default);
|
|
710
707
|
injectReducer('smsTrai', smsTraiReducer.default);
|
|
711
708
|
injectReducer('whatsapp', whatsappReducer.default);
|
|
712
|
-
injectReducer('rcs', rcsReducer.default);
|
|
713
709
|
injectSagas(gallerySagas.default);
|
|
714
710
|
injectSagas(sagas.default);
|
|
715
711
|
injectSagas(capSagas.default);
|
|
@@ -729,7 +725,6 @@ export default function createRoutes(store) {
|
|
|
729
725
|
injectSagas(capFacebookPreviewSagas.default);
|
|
730
726
|
injectSagas(smsTraiSagas.default);
|
|
731
727
|
injectSagas(whatsappSagas.default);
|
|
732
|
-
injectSagas(rcsSagas.default);
|
|
733
728
|
renderRoute(component);
|
|
734
729
|
});
|
|
735
730
|
importModules.catch(errorLoading);
|
package/services/api.js
CHANGED
|
@@ -109,14 +109,14 @@ function request(url, options, handleUnauthorizedStatus) {
|
|
|
109
109
|
}
|
|
110
110
|
const fetchUrl = url.indexOf('?') !== -1 ? `${url}&time=${Date.now()}` : `${url}?time=${Date.now()}`;
|
|
111
111
|
return fetch(fetchUrl, options)
|
|
112
|
-
.then(
|
|
112
|
+
.then(response => {
|
|
113
113
|
if (response.status === 403 && handleUnauthorizedStatus) {
|
|
114
114
|
showSomethingwentWrong();
|
|
115
115
|
}
|
|
116
116
|
return checkStatus(response);
|
|
117
117
|
})
|
|
118
118
|
.then(parseJSON)
|
|
119
|
-
.catch(
|
|
119
|
+
.catch(error => error);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
function getAPICallObject(method, body, isFileUpload = false, loadCampaignHeaders = false) {
|
|
@@ -259,12 +259,6 @@ export const createEbillTemplate = ({template}) => {
|
|
|
259
259
|
return request(url, getAPICallObject('POST', template));
|
|
260
260
|
};
|
|
261
261
|
|
|
262
|
-
export const createChannelWiseTemplate = ({ channel, template }) => {
|
|
263
|
-
const url = `${API_ENDPOINT}/templates/${channel}`;
|
|
264
|
-
return request(url, getAPICallObject('POST', template));
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
|
|
268
262
|
export const getTemplateDetails = ({id, channel}) => {
|
|
269
263
|
const url = `${API_ENDPOINT}/templates/${id}/${channel ? channel.toUpperCase() : 'SMS'}`;
|
|
270
264
|
return request(url, getAPICallObject('GET'));
|
|
@@ -19,7 +19,6 @@ import { injectIntl, FormattedMessage, intlShape} from 'react-intl';
|
|
|
19
19
|
import get from 'lodash/get';
|
|
20
20
|
import './index.scss';
|
|
21
21
|
import Gallery from '../../v2Containers/Assets/Gallery';
|
|
22
|
-
import { FACEBOOK, RCS } from "../../v2Containers/CreativesContainer/constants";
|
|
23
22
|
|
|
24
23
|
import messages from './messages';
|
|
25
24
|
function CapImageUpload(props) {
|
|
@@ -39,7 +38,6 @@ function CapImageUpload(props) {
|
|
|
39
38
|
index,
|
|
40
39
|
className,
|
|
41
40
|
imageData,
|
|
42
|
-
channel,
|
|
43
41
|
} = props;
|
|
44
42
|
const {
|
|
45
43
|
formatMessage,
|
|
@@ -57,16 +55,13 @@ function CapImageUpload(props) {
|
|
|
57
55
|
const [isDrawerRequired, updateDrawerRequirement] = useState(false);
|
|
58
56
|
|
|
59
57
|
const {CapHeadingSpan} = CapHeading;
|
|
60
|
-
const ImageComponent = useCallback(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
),
|
|
68
|
-
[imageSrc],
|
|
69
|
-
);
|
|
58
|
+
const ImageComponent = useCallback(() => (<>
|
|
59
|
+
<div
|
|
60
|
+
className={`image-container upload ${props.ifError ? 'error' : ''}`}
|
|
61
|
+
>
|
|
62
|
+
{imageSrc !== "" && (<CapImage src={imageSrc || ""} alt="upload-image-src" height="400" />)}
|
|
63
|
+
</div></>
|
|
64
|
+
), []);
|
|
70
65
|
|
|
71
66
|
const WithLabel = LabelHOC(ImageComponent);
|
|
72
67
|
|
|
@@ -209,7 +204,7 @@ function CapImageUpload(props) {
|
|
|
209
204
|
<FormattedMessage {...messages.imageReUpload} />
|
|
210
205
|
</CapButton>
|
|
211
206
|
);
|
|
212
|
-
}, [isImageError
|
|
207
|
+
}, [isImageError]);
|
|
213
208
|
|
|
214
209
|
return (
|
|
215
210
|
<div style={style} className="cap-custom-image-upload">
|
|
@@ -239,16 +234,9 @@ function CapImageUpload(props) {
|
|
|
239
234
|
<CapHeadingSpan type="label2" className="image-dimension">
|
|
240
235
|
<FormattedMessage {...messages.imageDimenstionDescription} values={{ width: imgWidth, height: imgHeight}}/>
|
|
241
236
|
</CapHeadingSpan>
|
|
242
|
-
|
|
243
|
-
<
|
|
244
|
-
|
|
245
|
-
</CapHeadingSpan>
|
|
246
|
-
)}
|
|
247
|
-
{channel === RCS && (
|
|
248
|
-
<CapHeadingSpan type="label2" className="image-size">
|
|
249
|
-
<FormattedMessage {...messages.imageSize} />
|
|
250
|
-
</CapHeadingSpan>
|
|
251
|
-
)}
|
|
237
|
+
<CapHeadingSpan type="label2" className="image-aspect-ratio">
|
|
238
|
+
<FormattedMessage {...messages.aspectRatio} />
|
|
239
|
+
</CapHeadingSpan>
|
|
252
240
|
<CapHeadingSpan type="label2" className="image-format">
|
|
253
241
|
<FormattedMessage {...messages.format} />
|
|
254
242
|
</CapHeadingSpan>
|
|
@@ -273,7 +261,6 @@ CapImageUpload.propTypes = {
|
|
|
273
261
|
updateOnReUpload: PropTypes.func,
|
|
274
262
|
imageData: PropTypes.object,
|
|
275
263
|
index: PropTypes.number,
|
|
276
|
-
channel: PropTypes.string,
|
|
277
264
|
};
|
|
278
265
|
|
|
279
266
|
export default injectIntl(CapImageUpload);
|
|
@@ -3,15 +3,30 @@
|
|
|
3
3
|
$classPrefix: cap-custom-image-upload;
|
|
4
4
|
|
|
5
5
|
.#{$classPrefix} {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
6
|
+
.image-container{
|
|
7
|
+
.upload{
|
|
8
|
+
margin-top: 20;
|
|
9
|
+
background-color: $CAP_G09;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
.upload-image{
|
|
13
|
+
margin-right: $CAP_SPACE_08
|
|
14
|
+
}
|
|
15
|
+
.gallery-select{
|
|
16
|
+
margin-left: $CAP_SPACE_08
|
|
17
|
+
}
|
|
18
|
+
.image-format{
|
|
19
|
+
float: right;
|
|
20
|
+
}
|
|
21
|
+
.image-aspect-ratio{
|
|
22
|
+
margin-top: $CAP_SPACE_12;
|
|
23
|
+
margin-left: 64px;
|
|
24
|
+
}
|
|
25
|
+
.image-dimension{
|
|
26
|
+
margin-top: $CAP_SPACE_12;
|
|
27
|
+
margin-right: 46px;
|
|
28
|
+
}
|
|
29
|
+
.image-info-wrapper{
|
|
30
|
+
margin-bottom: 15px;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -8,7 +8,7 @@ export default defineMessages({
|
|
|
8
8
|
},
|
|
9
9
|
uploadComputer: {
|
|
10
10
|
id: `${scope}.uploadComputer`,
|
|
11
|
-
defaultMessage: '
|
|
11
|
+
defaultMessage: 'Your computer',
|
|
12
12
|
},
|
|
13
13
|
or: {
|
|
14
14
|
id: `${scope}.or`,
|
|
@@ -24,20 +24,19 @@ export default defineMessages({
|
|
|
24
24
|
},
|
|
25
25
|
imageReUpload: {
|
|
26
26
|
id: `${scope}.imageReUpload`,
|
|
27
|
-
defaultMessage: '
|
|
27
|
+
defaultMessage: 'Re upload',
|
|
28
28
|
},
|
|
29
29
|
imageDimenstionDescription: {
|
|
30
30
|
id: `${scope}.imageDimenstionDescription`,
|
|
31
|
-
defaultMessage: 'Dimensions
|
|
31
|
+
defaultMessage: 'Dimensions: {width}px x {height}px',
|
|
32
32
|
},
|
|
33
33
|
format: {
|
|
34
34
|
id: `${scope}.format`,
|
|
35
|
-
defaultMessage: 'Format:
|
|
35
|
+
defaultMessage: 'Format: JPG, PNG',
|
|
36
36
|
},
|
|
37
37
|
imageIncorrectSize: {
|
|
38
38
|
id: `${scope}.imageIncorrectSize`,
|
|
39
|
-
defaultMessage:
|
|
40
|
-
'Please upload the image with correct type, size and dimension',
|
|
39
|
+
defaultMessage: 'Please upload the image with correct type, size and dimension',
|
|
41
40
|
},
|
|
42
41
|
imageGallery: {
|
|
43
42
|
id: `${scope}.imageGallery`,
|
|
@@ -47,8 +46,4 @@ export default defineMessages({
|
|
|
47
46
|
id: `${scope}.aspectRatio`,
|
|
48
47
|
defaultMessage: 'Aspect ratio: 1:1',
|
|
49
48
|
},
|
|
50
|
-
imageSize: {
|
|
51
|
-
id: `${scope}.imageSize`,
|
|
52
|
-
defaultMessage: 'Size upto: 2MB',
|
|
53
|
-
},
|
|
54
49
|
});
|
|
@@ -77,10 +77,6 @@
|
|
|
77
77
|
font-size: 10px;
|
|
78
78
|
width: 100%;
|
|
79
79
|
font-family: 'open-sans';
|
|
80
|
-
.rcs-image{
|
|
81
|
-
width: 100%;
|
|
82
|
-
height: 123px;
|
|
83
|
-
}
|
|
84
80
|
.message-pop-item{
|
|
85
81
|
padding: 4px;
|
|
86
82
|
background: #3F51B5;
|
|
@@ -91,12 +87,6 @@
|
|
|
91
87
|
&:first-child{
|
|
92
88
|
margin-top: 0;
|
|
93
89
|
}
|
|
94
|
-
&.rcs-content {
|
|
95
|
-
background: $CAP_WHITE;
|
|
96
|
-
color: $CAP_G01;
|
|
97
|
-
margin-top: 0;
|
|
98
|
-
padding: 4px 8px;
|
|
99
|
-
}
|
|
100
90
|
}
|
|
101
91
|
}
|
|
102
92
|
&:not(.sms){
|
|
@@ -17,7 +17,6 @@ import messages from './messages';
|
|
|
17
17
|
import {
|
|
18
18
|
WECHAT,
|
|
19
19
|
WHATSAPP,
|
|
20
|
-
RCS,
|
|
21
20
|
} from '../../v2Containers/CreativesContainer/constants';
|
|
22
21
|
import Carousel from '../Carousel';
|
|
23
22
|
import { VIBER, FACEBOOK } from '../../v2Containers/App/constants';
|
|
@@ -25,7 +24,6 @@ import { UNSUBSCRIBE_TEXT_LENGTH } from '../../v2Containers/Whatsapp/constants';
|
|
|
25
24
|
import whatsappMobileAndroid from './assets/images/whatsapp_mobile_android.svg'
|
|
26
25
|
const wechatBodyNew = require('./assets/images/wechat_mobile_android.svg');
|
|
27
26
|
const smsMobileAndroid = require('./assets/images/sms_mobile_android.svg');
|
|
28
|
-
const smsMobileIos = require('./assets/images/sms_mobile_ios.svg');
|
|
29
27
|
const lineMobileAndroid = require('../../assets/line.png');
|
|
30
28
|
const viberMobileAndroid = require('./assets/images/viberMobile.svg');
|
|
31
29
|
|
|
@@ -160,11 +158,9 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
160
158
|
whatsappContentLen,
|
|
161
159
|
intl,
|
|
162
160
|
templateData,
|
|
163
|
-
rcsIosPreview,
|
|
164
161
|
} = this.props;
|
|
165
162
|
const { formatMessage } = intl;
|
|
166
|
-
const { buttonText, imageURL,
|
|
167
|
-
const { rcsImageSrc, rcsTitle, rcsDesc } = rcsPreviewContent || {};
|
|
163
|
+
const { buttonText, imageURL, messageContent: viberMessageContent } = content || {};
|
|
168
164
|
let smsDetails = {};
|
|
169
165
|
// let smsText = '';
|
|
170
166
|
if (this.props.content && this.props.charCounterEnabled) {
|
|
@@ -726,42 +722,6 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
726
722
|
''
|
|
727
723
|
)
|
|
728
724
|
}
|
|
729
|
-
{
|
|
730
|
-
channel?.toUpperCase() === RCS && (
|
|
731
|
-
<div className='shell-v2 align-center'>
|
|
732
|
-
<CapImage
|
|
733
|
-
className='preview-image'
|
|
734
|
-
src={rcsIosPreview ? smsMobileIos : smsMobileAndroid}
|
|
735
|
-
alt={formatMessage(messages.previewGenerated)}
|
|
736
|
-
/>
|
|
737
|
-
<div className='msg-container sms'>
|
|
738
|
-
<div className='message-pop sms'>
|
|
739
|
-
{rcsImageSrc && (
|
|
740
|
-
<CapImage
|
|
741
|
-
src={rcsImageSrc}
|
|
742
|
-
className='rcs-image'
|
|
743
|
-
alt={formatMessage(messages.previewGenerated)}
|
|
744
|
-
/>
|
|
745
|
-
)}
|
|
746
|
-
{rcsTitle && (
|
|
747
|
-
<CapLabel
|
|
748
|
-
type="label5"
|
|
749
|
-
className='message-pop-item align-left rcs-content'
|
|
750
|
-
fontWeight='bold'
|
|
751
|
-
>
|
|
752
|
-
{rcsTitle}
|
|
753
|
-
</CapLabel>
|
|
754
|
-
)}
|
|
755
|
-
{rcsDesc && (
|
|
756
|
-
<CapLabel type="label5" className='message-pop-item align-left rcs-content rcs-desc'>
|
|
757
|
-
{rcsDesc}
|
|
758
|
-
</CapLabel>
|
|
759
|
-
)}
|
|
760
|
-
</div>
|
|
761
|
-
</div>
|
|
762
|
-
</div>
|
|
763
|
-
)
|
|
764
|
-
}
|
|
765
725
|
{channel && channel.toLowerCase() === FACEBOOK && (
|
|
766
726
|
<div style={{position: 'absolute', left: '80%'}} id="facebook-preview">
|
|
767
727
|
<CapFacebookPreview
|
|
@@ -1,37 +1,5 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Test Templates container Should render correct preview component for rcs channel 1`] = `
|
|
4
|
-
<CapRow>
|
|
5
|
-
<CapColumn
|
|
6
|
-
span={16}
|
|
7
|
-
/>
|
|
8
|
-
<CapColumn
|
|
9
|
-
span={8}
|
|
10
|
-
>
|
|
11
|
-
<div
|
|
12
|
-
className="preview-container "
|
|
13
|
-
>
|
|
14
|
-
<div
|
|
15
|
-
className="shell-v2 align-center"
|
|
16
|
-
>
|
|
17
|
-
<CapImage
|
|
18
|
-
alt="Preview is being generated"
|
|
19
|
-
className="preview-image"
|
|
20
|
-
src="test-file-stub"
|
|
21
|
-
/>
|
|
22
|
-
<div
|
|
23
|
-
className="msg-container sms"
|
|
24
|
-
>
|
|
25
|
-
<div
|
|
26
|
-
className="message-pop sms"
|
|
27
|
-
/>
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
</CapColumn>
|
|
32
|
-
</CapRow>
|
|
33
|
-
`;
|
|
34
|
-
|
|
35
3
|
exports[`Test Templates container Should render correct preview component for whatsapp channel 1`] = `
|
|
36
4
|
<CapRow>
|
|
37
5
|
<CapColumn
|
|
@@ -89,7 +57,7 @@ exports[`Test Templates container Should render correct preview component for wh
|
|
|
89
57
|
Object {
|
|
90
58
|
"background-color": "#efefef",
|
|
91
59
|
"border-radius": "6px",
|
|
92
|
-
"left":
|
|
60
|
+
"left": "10%",
|
|
93
61
|
"padding": "4px 0 0.571rem",
|
|
94
62
|
"width": "88%",
|
|
95
63
|
}
|
|
@@ -2,23 +2,23 @@ import React from 'react';
|
|
|
2
2
|
import { shallowWithIntl } from '../../../helpers/intl-enzym-test-helpers';
|
|
3
3
|
|
|
4
4
|
import { TemplatePreview } from '../index';
|
|
5
|
+
import mockdata from '../../mockdata';
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
describe('Test Templates container', () => {
|
|
8
9
|
let renderedComponent;
|
|
9
10
|
|
|
10
|
-
const renderFunction = (
|
|
11
|
+
const renderFunction = () => {
|
|
11
12
|
renderedComponent = shallowWithIntl(
|
|
12
|
-
<TemplatePreview
|
|
13
|
+
<TemplatePreview
|
|
14
|
+
channel="whatsapp"
|
|
15
|
+
showCount
|
|
16
|
+
/>
|
|
13
17
|
);
|
|
14
18
|
};
|
|
15
19
|
|
|
16
20
|
it('Should render correct preview component for whatsapp channel', () => {
|
|
17
|
-
renderFunction(
|
|
18
|
-
expect(renderedComponent).toMatchSnapshot();
|
|
19
|
-
});
|
|
20
|
-
it('Should render correct preview component for rcs channel', () => {
|
|
21
|
-
renderFunction('rcs');
|
|
21
|
+
renderFunction();
|
|
22
22
|
expect(renderedComponent).toMatchSnapshot();
|
|
23
23
|
});
|
|
24
24
|
});
|
|
@@ -48,7 +48,6 @@ export const PREVIEW = 'preview';
|
|
|
48
48
|
export const VIBER = 'viber';
|
|
49
49
|
export const FACEBOOK = 'facebook';
|
|
50
50
|
export const WHATSAPP = 'whatsapp';
|
|
51
|
-
export const RCS = 'rcs';
|
|
52
51
|
|
|
53
52
|
export const TRACK_EDIT_SMS = 'editSms';
|
|
54
53
|
export const TRACK_EDIT_EMAIL = 'editEmail';
|
|
@@ -111,4 +110,4 @@ export const LOYALTY = 'loyalty';
|
|
|
111
110
|
|
|
112
111
|
export const FAILURE = 'FAILURE';
|
|
113
112
|
export const DATE_DISPLAY_FORMAT = 'D MMM YYYY';
|
|
114
|
-
export const TIME_DISPLAY_FORMAT = 'hh:mm A';
|
|
113
|
+
export const TIME_DISPLAY_FORMAT = 'hh:mm A';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`galleryReducer Initial State should match snapshot returns the initial state 1`] = `
|
|
4
|
-
|
|
5
|
-
"assetList":
|
|
4
|
+
Object {
|
|
5
|
+
"assetList": Array [],
|
|
6
6
|
"assetUploading": false,
|
|
7
7
|
"fetchingAllAssets": false,
|
|
8
8
|
}
|
|
@@ -88,26 +88,7 @@ export default defineMessages({
|
|
|
88
88
|
id: `creatives.containersV2.templateNamePlaceholder`,
|
|
89
89
|
defaultMessage: 'Enter template name',
|
|
90
90
|
},
|
|
91
|
-
|
|
92
|
-
id: `creatives.containersV2.emptyTemplateNameErrorMessage`,
|
|
93
|
-
defaultMessage: 'Template name cannot be empty',
|
|
94
|
-
},
|
|
95
|
-
"creativeNameLabel": {
|
|
96
|
-
id: `creatives.containersV2.creativeNameLabel`,
|
|
97
|
-
defaultMessage: 'Creative name',
|
|
98
|
-
},
|
|
99
|
-
"addLabels": {
|
|
100
|
-
id: `creatives.containersV2.addLabels`,
|
|
101
|
-
defaultMessage: 'Add labels',
|
|
102
|
-
},
|
|
103
|
-
"preview": {
|
|
104
|
-
id: `creatives.containersV2.preview`,
|
|
105
|
-
defaultMessage: 'Preview',
|
|
106
|
-
},
|
|
107
|
-
"delete": {
|
|
108
|
-
id: `creatives.containersV2.delete`,
|
|
109
|
-
defaultMessage: 'Delete',
|
|
110
|
-
},
|
|
91
|
+
|
|
111
92
|
//refresh due to org change messages
|
|
112
93
|
|
|
113
94
|
"refreshOrgText": {
|
|
@@ -22,7 +22,6 @@ import LineContainer from '../Line/Container';
|
|
|
22
22
|
import FTP from '../FTP';
|
|
23
23
|
import Viber from '../Viber';
|
|
24
24
|
import Whatsapp from '../Whatsapp';
|
|
25
|
-
import Rcs from '../Rcs';
|
|
26
25
|
import { getWhatsappContent } from '../Whatsapp/utils';
|
|
27
26
|
import * as commonUtil from '../../utils/common';
|
|
28
27
|
const CreativesWrapper = styled.div`
|
|
@@ -175,11 +174,9 @@ export function SlideBoxContent(props) {
|
|
|
175
174
|
|
|
176
175
|
|
|
177
176
|
const isCreate = slidBoxContent === 'createTemplate';
|
|
178
|
-
const isEdit = slidBoxContent === 'editTemplate';
|
|
179
177
|
const isCreateSms = isCreate && channel === constants.SMS;
|
|
180
178
|
const isCreateFacebook = isCreate && channel === constants.FACEBOOK;
|
|
181
179
|
const isCreateWhatsapp = isCreate && channel === constants.WHATSAPP;
|
|
182
|
-
const isCreateRcs = isCreate && channel === constants.RCS;
|
|
183
180
|
const isCreateMPush = isCreate && channel === constants.MOBILE_PUSH;
|
|
184
181
|
const isCreateCallTask = isCreate && channel === constants.CALL_TASK;
|
|
185
182
|
let isEditSms = false;
|
|
@@ -193,34 +190,32 @@ export function SlideBoxContent(props) {
|
|
|
193
190
|
let isEditFacebook = false;
|
|
194
191
|
let isEditFTP = false;
|
|
195
192
|
let isEditWhatsapp = false;
|
|
196
|
-
let isEditRcs = false;
|
|
197
193
|
const isEmailCreate = isCreate && channel === constants.EMAIL;
|
|
198
194
|
if (templateData && channel) {
|
|
199
195
|
channel = templateData.type;// for edit mode with template data
|
|
200
|
-
isEditSms =
|
|
201
|
-
isEditCallTask =
|
|
202
|
-
isEditMPush =
|
|
203
|
-
isEditEmailWithId =
|
|
204
|
-
isEmailEditWithContent =
|
|
205
|
-
isEditFacebook =
|
|
206
|
-
isEditWhatsapp =
|
|
207
|
-
|
|
208
|
-
isPreview = slidBoxContent === 'preview' && [constants.SMS, constants.LINE, constants.WHATSAPP, constants.FACEBOOK, constants.VIBER, constants.RCS].includes(channel);
|
|
196
|
+
isEditSms = slidBoxContent === 'editTemplate' && channel === constants.SMS;
|
|
197
|
+
isEditCallTask = slidBoxContent === 'editTemplate' && channel === constants.CALL_TASK;
|
|
198
|
+
isEditMPush = slidBoxContent === 'editTemplate' && channel === constants.MOBILE_PUSH;
|
|
199
|
+
isEditEmailWithId = slidBoxContent === 'editTemplate' && channel === constants.EMAIL && templateData._id;
|
|
200
|
+
isEmailEditWithContent = slidBoxContent === 'editTemplate' && channel === constants.EMAIL && !templateData._id;
|
|
201
|
+
isEditFacebook = slidBoxContent === 'editTemplate' && channel === constants.FACEBOOK;
|
|
202
|
+
isEditWhatsapp = slidBoxContent === 'editTemplate' && channel === constants.WHATSAPP;
|
|
203
|
+
isPreview = slidBoxContent === 'preview' && (channel === constants.SMS || channel === constants.LINE || channel === constants.VIBER || channel === constants.FACEBOOK || channel === constants.WHATSAPP);
|
|
209
204
|
isEmailPreview = slidBoxContent === 'preview' && channel === constants.EMAIL;
|
|
210
205
|
isMpushPreview = slidBoxContent === 'preview' && channel === constants.MOBILE_PUSH;
|
|
211
|
-
isEditFTP =
|
|
206
|
+
isEditFTP = slidBoxContent === 'editTemplate' && [constants.NO_COMMUNICATION, constants.FTP].includes(channel);
|
|
212
207
|
}
|
|
213
|
-
const isDltEnabled = commonUtil.isTraiDLTEnable(isFullMode, smsRegister);
|
|
214
208
|
|
|
215
209
|
const getChannelPreviewContent = (templateDataObject) => {
|
|
216
210
|
switch (templateDataObject.type.toUpperCase()) {
|
|
217
211
|
case constants.SMS: {
|
|
212
|
+
const isTraiDlt = commonUtil.isTraiDLTEnable(isFullMode, smsRegister);
|
|
218
213
|
const updatedSmsEditor = get(
|
|
219
214
|
templateDataObject,
|
|
220
215
|
`versions.base['updated-sms-editor']`,
|
|
221
216
|
'',
|
|
222
217
|
);
|
|
223
|
-
if (!
|
|
218
|
+
if (!isTraiDlt || updatedSmsEditor === '') {
|
|
224
219
|
return get(templateDataObject, `versions.base['sms-editor']`);
|
|
225
220
|
}
|
|
226
221
|
return updatedSmsEditor.join('');
|
|
@@ -337,32 +332,11 @@ export function SlideBoxContent(props) {
|
|
|
337
332
|
...getWhatsappContent(templateDataObject, true),
|
|
338
333
|
};
|
|
339
334
|
}
|
|
340
|
-
case constants.RCS: {
|
|
341
|
-
const template = cloneDeep(templateDataObject);
|
|
342
|
-
const { description = "", media: { mediaUrl = "" } = {}, title = "" } = get(template, 'versions.base.content.RCS.cardContent[0]', {});
|
|
343
|
-
return {
|
|
344
|
-
rcsPreviewContent: {
|
|
345
|
-
rcsImageSrc: mediaUrl,
|
|
346
|
-
rcsTitle: title,
|
|
347
|
-
rcsDesc: description,
|
|
348
|
-
},
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
335
|
default:
|
|
352
336
|
return get(templateDataObject, `versions.base.content`);
|
|
353
337
|
}
|
|
354
338
|
};
|
|
355
339
|
|
|
356
|
-
const rcsCommonProps = {
|
|
357
|
-
isFullMode,
|
|
358
|
-
isDltEnabled,
|
|
359
|
-
smsRegister,
|
|
360
|
-
getDefaultTags: type,
|
|
361
|
-
onCreateComplete,
|
|
362
|
-
selectedOfferDetails,
|
|
363
|
-
getFormData,
|
|
364
|
-
};
|
|
365
|
-
|
|
366
340
|
return (
|
|
367
341
|
<CreativesWrapper>
|
|
368
342
|
{!isFullMode && slidBoxContent === 'templates' && (
|
|
@@ -741,27 +715,6 @@ export function SlideBoxContent(props) {
|
|
|
741
715
|
}}/>
|
|
742
716
|
)}
|
|
743
717
|
|
|
744
|
-
{isCreateRcs && (<Rcs
|
|
745
|
-
{...rcsCommonProps}
|
|
746
|
-
location={{
|
|
747
|
-
pathname: `/rcs/create`,
|
|
748
|
-
query,
|
|
749
|
-
search: '',
|
|
750
|
-
}} />
|
|
751
|
-
)}
|
|
752
|
-
{isEditRcs && (<Rcs
|
|
753
|
-
{...rcsCommonProps}
|
|
754
|
-
templateData={templateData}
|
|
755
|
-
params={{
|
|
756
|
-
id: templateData._id,
|
|
757
|
-
}}
|
|
758
|
-
location={{
|
|
759
|
-
pathname: `/rcs/edit`,
|
|
760
|
-
query,
|
|
761
|
-
search: '',
|
|
762
|
-
}} />
|
|
763
|
-
)}
|
|
764
|
-
|
|
765
718
|
</CreativesWrapper>
|
|
766
719
|
);
|
|
767
720
|
}
|