@capillarytech/creatives-library 7.11.7 → 7.11.9
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/config/app.js +1 -0
- package/index.js +6 -0
- package/package.json +1 -1
- package/routes.js +7 -2
- package/services/api.js +8 -2
- package/v2Components/CapImageUpload/index.js +24 -11
- package/v2Components/CapImageUpload/index.scss +12 -27
- package/v2Components/CapImageUpload/messages.js +9 -4
- package/v2Components/TemplatePreview/_templatePreview.scss +13 -1
- package/v2Components/TemplatePreview/index.js +43 -2
- package/v2Containers/App/constants.js +2 -1
- package/v2Containers/Assets/images/addCreativesIllustration.svg +30 -0
- package/v2Containers/Cap/messages.js +20 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +57 -11
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +1 -0
- package/v2Containers/CreativesContainer/constants.js +1 -0
- package/v2Containers/CreativesContainer/messages.js +4 -0
- package/v2Containers/Facebook/Advertisement/index.js +4 -2
- package/v2Containers/Rcs/actions.js +29 -0
- package/v2Containers/Rcs/constants.js +38 -0
- package/v2Containers/Rcs/index.js +939 -0
- package/v2Containers/Rcs/index.scss +54 -0
- package/v2Containers/Rcs/messages.js +109 -0
- package/v2Containers/Rcs/reducer.js +72 -0
- package/v2Containers/Rcs/sagas.js +72 -0
- package/v2Containers/Rcs/selectors.js +8 -0
- package/v2Containers/Rcs/utils.js +37 -0
- package/v2Containers/Templates/_templates.scss +9 -1
- package/v2Containers/Templates/actions.js +2 -1
- package/v2Containers/Templates/constants.js +1 -0
- package/v2Containers/Templates/index.js +234 -174
- package/v2Containers/Templates/messages.js +20 -0
- package/v2Containers/Templates/reducer.js +2 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +520 -80
- package/v2Containers/TemplatesV2/index.js +2 -1
- package/v2Containers/TemplatesV2/messages.js +4 -0
- package/v2Containers/Whatsapp/index.js +4 -2
- package/v2Containers/Whatsapp/messages.js +0 -13
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +13 -13
- package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +32 -26
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
@import '~@capillarytech/cap-ui-library/styles/_variables';
|
|
2
|
+
|
|
3
|
+
.cap-rcs-creatives {
|
|
4
|
+
.rcs-scroll-div {
|
|
5
|
+
margin-bottom: 250px;
|
|
6
|
+
}
|
|
7
|
+
.rcs-preview-container {
|
|
8
|
+
.cap-row-v2 {
|
|
9
|
+
position: fixed;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
.rcs-optional-label {
|
|
13
|
+
margin-left: 8px;
|
|
14
|
+
color: $FONT_COLOR_03;
|
|
15
|
+
font-weight: normal;
|
|
16
|
+
}
|
|
17
|
+
.rcs-radio > label.ant-radio-wrapper {
|
|
18
|
+
margin-right: 50px;
|
|
19
|
+
}
|
|
20
|
+
.rcs-dlt-fallback-card {
|
|
21
|
+
max-width: 420px;
|
|
22
|
+
}
|
|
23
|
+
.rcs-dlt-fallback-card.ant-card-bordered > div {
|
|
24
|
+
padding: 12px;
|
|
25
|
+
}
|
|
26
|
+
.rcs-description {
|
|
27
|
+
display: -webkit-box;
|
|
28
|
+
-webkit-line-clamp: 7;
|
|
29
|
+
-webkit-box-orient: vertical;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
}
|
|
32
|
+
.fallback-sms-length {
|
|
33
|
+
margin-top: 13px;
|
|
34
|
+
float: right;
|
|
35
|
+
}
|
|
36
|
+
#rcs-template-title-input {
|
|
37
|
+
padding-right: 10%;
|
|
38
|
+
}
|
|
39
|
+
#rcs-template-message-label .ant-btn.cap-button-v2 {
|
|
40
|
+
height: 32px;
|
|
41
|
+
}
|
|
42
|
+
#rcs-template-message-label {
|
|
43
|
+
margin-top: 20px;
|
|
44
|
+
}
|
|
45
|
+
.cap-custom-image-upload {
|
|
46
|
+
.dragger-button.re-upload {
|
|
47
|
+
margin-top: 50px;
|
|
48
|
+
top: 46px;
|
|
49
|
+
position: absolute;
|
|
50
|
+
right: 20px;
|
|
51
|
+
color: $FONT_COLOR_05;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl';
|
|
2
|
+
const prefix = `creatives.containersV2.Rcs`;
|
|
3
|
+
|
|
4
|
+
export default defineMessages({
|
|
5
|
+
mediaLabel: {
|
|
6
|
+
id: `${prefix}.mediaLabel`,
|
|
7
|
+
defaultMessage: 'Media',
|
|
8
|
+
},
|
|
9
|
+
mediaNone: {
|
|
10
|
+
id: `${prefix}.mediaNone`,
|
|
11
|
+
defaultMessage: 'None',
|
|
12
|
+
},
|
|
13
|
+
mediaImage: {
|
|
14
|
+
id: `${prefix}.mediaImage`,
|
|
15
|
+
defaultMessage: 'Image',
|
|
16
|
+
},
|
|
17
|
+
image: {
|
|
18
|
+
id: `${prefix}.image`,
|
|
19
|
+
defaultMessage: 'image',
|
|
20
|
+
},
|
|
21
|
+
mediaVideo: {
|
|
22
|
+
id: `${prefix}.mediaVideo`,
|
|
23
|
+
defaultMessage: 'Video/Slideshow',
|
|
24
|
+
},
|
|
25
|
+
disabledMediaTooltip: {
|
|
26
|
+
id: `${prefix}.disabledMediaTooltip`,
|
|
27
|
+
defaultMessage: 'Not yet enabled. Coming soon!',
|
|
28
|
+
},
|
|
29
|
+
templateTitlePlaceholder: {
|
|
30
|
+
id: `${prefix}.templateTitlePlaceholder`,
|
|
31
|
+
defaultMessage: 'Enter title',
|
|
32
|
+
},
|
|
33
|
+
templateTitle: {
|
|
34
|
+
id: `${prefix}.templateTitle`,
|
|
35
|
+
defaultMessage: 'Title',
|
|
36
|
+
},
|
|
37
|
+
optional: {
|
|
38
|
+
id: `${prefix}.optional`,
|
|
39
|
+
defaultMessage: ' (Optional)',
|
|
40
|
+
},
|
|
41
|
+
templateDescPlaceholder: {
|
|
42
|
+
id: `${prefix}.templateDescPlaceholder`,
|
|
43
|
+
defaultMessage: 'Enter the text message',
|
|
44
|
+
},
|
|
45
|
+
emptyTemplateDescErrorMessage: {
|
|
46
|
+
id: `${prefix}.emptyTemplateDescErrorMessage`,
|
|
47
|
+
defaultMessage: 'Template message cannot be empty',
|
|
48
|
+
},
|
|
49
|
+
templateDescLabel: {
|
|
50
|
+
id: `${prefix}.templateDescLabel`,
|
|
51
|
+
defaultMessage: 'Text message',
|
|
52
|
+
},
|
|
53
|
+
textMessage: {
|
|
54
|
+
id: `${prefix}.textMessage`,
|
|
55
|
+
defaultMessage: 'text message',
|
|
56
|
+
},
|
|
57
|
+
templateDescLengthError: {
|
|
58
|
+
id: `${prefix}.templateDescLengthError`,
|
|
59
|
+
defaultMessage: 'Template message length cannot exceed 1000',
|
|
60
|
+
},
|
|
61
|
+
rcsDoneBtnToolTip: {
|
|
62
|
+
id: `${prefix}.rcsDoneBtnToolTip`,
|
|
63
|
+
defaultMessage: 'Please add template name & {type} to proceed further',
|
|
64
|
+
},
|
|
65
|
+
fallbackLabel: {
|
|
66
|
+
id: `${prefix}.fallbackLabel`,
|
|
67
|
+
defaultMessage: 'Fall-back SMS message',
|
|
68
|
+
},
|
|
69
|
+
fallbackDesc: {
|
|
70
|
+
id: `${prefix}.fallbackDesc`,
|
|
71
|
+
defaultMessage: 'We would suggest to add fall-back SMS',
|
|
72
|
+
},
|
|
73
|
+
fallbackTextAreaLabel: {
|
|
74
|
+
id: `${prefix}.fallbackTextAreaLabel`,
|
|
75
|
+
defaultMessage: 'SMS message',
|
|
76
|
+
},
|
|
77
|
+
fallbackMsgPlaceholder: {
|
|
78
|
+
id: `${prefix}.fallbackMsgPlaceholder`,
|
|
79
|
+
defaultMessage: 'Enter the text message content for fall-back SMS',
|
|
80
|
+
},
|
|
81
|
+
totalCharacters: {
|
|
82
|
+
id: `${prefix}.totalCharacters`,
|
|
83
|
+
defaultMessage: '{smsCount} SMS ({number} characters)',
|
|
84
|
+
},
|
|
85
|
+
addSmsCreative: {
|
|
86
|
+
id: `${prefix}.addSmsCreative`,
|
|
87
|
+
defaultMessage: 'Add SMS creative',
|
|
88
|
+
},
|
|
89
|
+
rcsDltTitle: {
|
|
90
|
+
id: `${prefix}.rcsDltTitle`,
|
|
91
|
+
defaultMessage: 'SMS creative templates',
|
|
92
|
+
},
|
|
93
|
+
rcsDltDesc: {
|
|
94
|
+
id: `${prefix}.rcsDltDesc`,
|
|
95
|
+
defaultMessage: 'Select any of the existing templates',
|
|
96
|
+
},
|
|
97
|
+
dltEditHeader: {
|
|
98
|
+
id: `${prefix}.dltEditHeader`,
|
|
99
|
+
defaultMessage: 'Edit SMS',
|
|
100
|
+
},
|
|
101
|
+
rcsCreateNotification: {
|
|
102
|
+
id: `${prefix}.rcsCreateNotification`,
|
|
103
|
+
defaultMessage: 'Rcs template created successfully',
|
|
104
|
+
},
|
|
105
|
+
fallbackPreviewtitle: {
|
|
106
|
+
id: `${prefix}.fallbackPreviewtitle`,
|
|
107
|
+
defaultMessage: 'Preview of fall-back SMS',
|
|
108
|
+
},
|
|
109
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { fromJS } from 'immutable';
|
|
2
|
+
import {
|
|
3
|
+
UPLOAD_ASSET_REQUEST,
|
|
4
|
+
UPLOAD_ASSET_SUCCESS,
|
|
5
|
+
UPLOAD_ASSET_FAILURE,
|
|
6
|
+
CLEAR_ASSET,
|
|
7
|
+
CREATE_TEMPLATE_REQUEST,
|
|
8
|
+
CREATE_TEMPLATE_SUCCESS,
|
|
9
|
+
CREATE_TEMPLATE_FAILURE,
|
|
10
|
+
CLEAR_CREATE_RESPONSE_REQUEST,
|
|
11
|
+
} from './constants';
|
|
12
|
+
|
|
13
|
+
export const initialState = fromJS({
|
|
14
|
+
uploadedAssetData: {},
|
|
15
|
+
createTemplateInProgress: false,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
function rcsReducer(state = initialState, action) {
|
|
19
|
+
const { type, statusCode, templateType, data, errorMsg } = action;
|
|
20
|
+
switch (type) {
|
|
21
|
+
case UPLOAD_ASSET_REQUEST:
|
|
22
|
+
return state.set('uploadAssetSuccess', false).set('assetUploading', true);
|
|
23
|
+
case UPLOAD_ASSET_SUCCESS:
|
|
24
|
+
return state
|
|
25
|
+
.set(
|
|
26
|
+
'uploadAssetSuccess',
|
|
27
|
+
statusCode !== undefined && statusCode !== '' && statusCode < 300,
|
|
28
|
+
)
|
|
29
|
+
.set('assetUploading', false)
|
|
30
|
+
.set(
|
|
31
|
+
templateType !== undefined
|
|
32
|
+
? `uploadedAssetData${templateType}`
|
|
33
|
+
: 'uploadedAssetData',
|
|
34
|
+
data,
|
|
35
|
+
);
|
|
36
|
+
case UPLOAD_ASSET_FAILURE:
|
|
37
|
+
return state
|
|
38
|
+
.set('uploadAssetSuccess', false)
|
|
39
|
+
.set('assetUploading', false);
|
|
40
|
+
case CLEAR_ASSET:
|
|
41
|
+
return state.delete(
|
|
42
|
+
templateType !== undefined
|
|
43
|
+
? `uploadedAssetData${templateType}`
|
|
44
|
+
: 'uploadedAssetData',
|
|
45
|
+
);
|
|
46
|
+
case CREATE_TEMPLATE_REQUEST:
|
|
47
|
+
return state
|
|
48
|
+
.set('createTemplateInProgress', true)
|
|
49
|
+
.set('createTemplateError', false)
|
|
50
|
+
.set('createTemplateErrorMessage', fromJS(''));
|
|
51
|
+
case CREATE_TEMPLATE_SUCCESS:
|
|
52
|
+
return state
|
|
53
|
+
.set('createTemplateInProgress', false)
|
|
54
|
+
.set('response', data)
|
|
55
|
+
.set(
|
|
56
|
+
'createTemplateError',
|
|
57
|
+
statusCode !== undefined && statusCode > 300,
|
|
58
|
+
)
|
|
59
|
+
.set('createTemplateErrorMessage', fromJS(errorMsg));
|
|
60
|
+
case CREATE_TEMPLATE_FAILURE:
|
|
61
|
+
return state
|
|
62
|
+
.set('createTemplateInProgress', false)
|
|
63
|
+
.set('createTemplateError', true)
|
|
64
|
+
.set('createTemplateErrorMessage', fromJS(errorMsg));
|
|
65
|
+
case CLEAR_CREATE_RESPONSE_REQUEST:
|
|
66
|
+
return state.set('response', {});
|
|
67
|
+
default:
|
|
68
|
+
return state;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export default rcsReducer;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { take, cancel, call, put, takeLatest } from 'redux-saga/effects';
|
|
2
|
+
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
3
|
+
import * as Api from '../../services/api';
|
|
4
|
+
import {
|
|
5
|
+
RCS,
|
|
6
|
+
UPLOAD_ASSET_REQUEST,
|
|
7
|
+
UPLOAD_ASSET_SUCCESS,
|
|
8
|
+
UPLOAD_ASSET_FAILURE,
|
|
9
|
+
CREATE_TEMPLATE_REQUEST,
|
|
10
|
+
CREATE_TEMPLATE_SUCCESS,
|
|
11
|
+
CREATE_TEMPLATE_FAILURE,
|
|
12
|
+
} from './constants';
|
|
13
|
+
|
|
14
|
+
export function* uploadRcsAsset(file, assetType, fileParams) {
|
|
15
|
+
try {
|
|
16
|
+
const result = yield call(Api.uploadFile, file, assetType, fileParams);
|
|
17
|
+
yield put({
|
|
18
|
+
type: UPLOAD_ASSET_SUCCESS,
|
|
19
|
+
data: result.response.asset,
|
|
20
|
+
statusCode: result.status ? result.status.code : '',
|
|
21
|
+
templateType: file.templateType,
|
|
22
|
+
});
|
|
23
|
+
} catch (error) {
|
|
24
|
+
yield put({ UPLOAD_ASSET_FAILURE, error });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function* createRCSTemplate({ template, callback }) {
|
|
29
|
+
let errorMsg;
|
|
30
|
+
try {
|
|
31
|
+
const result = yield call(Api.createChannelWiseTemplate, {
|
|
32
|
+
channel: RCS,
|
|
33
|
+
template,
|
|
34
|
+
});
|
|
35
|
+
if (result.status.code >= 400) {
|
|
36
|
+
errorMsg = result.message;
|
|
37
|
+
throw errorMsg;
|
|
38
|
+
}
|
|
39
|
+
yield put({
|
|
40
|
+
type: CREATE_TEMPLATE_SUCCESS,
|
|
41
|
+
data: result.response,
|
|
42
|
+
statusCode: result.status ? result.status.code : '',
|
|
43
|
+
errorMsg,
|
|
44
|
+
});
|
|
45
|
+
if (callback) {
|
|
46
|
+
callback(result.response);
|
|
47
|
+
}
|
|
48
|
+
} catch (error) {
|
|
49
|
+
yield put({ type: CREATE_TEMPLATE_FAILURE, error, errorMsg });
|
|
50
|
+
if (callback) {
|
|
51
|
+
callback(null, errorMsg);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function* watchUploadRcsAsset() {
|
|
57
|
+
const watcher = yield takeLatest(UPLOAD_ASSET_REQUEST, uploadRcsAsset);
|
|
58
|
+
yield take(LOCATION_CHANGE);
|
|
59
|
+
yield cancel(watcher);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function* watchCreateTemplate() {
|
|
63
|
+
const watcher = yield takeLatest(
|
|
64
|
+
CREATE_TEMPLATE_REQUEST,
|
|
65
|
+
createRCSTemplate,
|
|
66
|
+
);
|
|
67
|
+
yield take(LOCATION_CHANGE);
|
|
68
|
+
yield cancel(watcher);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// All sagas to be loaded
|
|
72
|
+
export default [watchUploadRcsAsset, watchCreateTemplate];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import CapLabel from '@capillarytech/cap-ui-library/CapLabel';
|
|
3
|
+
import { RCS } from '../CreativesContainer/constants';
|
|
4
|
+
import './index.scss';
|
|
5
|
+
export const getRCSContent = (template) => {
|
|
6
|
+
const {
|
|
7
|
+
name,
|
|
8
|
+
versions: {
|
|
9
|
+
base: {
|
|
10
|
+
content: {
|
|
11
|
+
[RCS]: {
|
|
12
|
+
cardContent = [{}],
|
|
13
|
+
} = {},
|
|
14
|
+
} = {},
|
|
15
|
+
} = {},
|
|
16
|
+
} = {},
|
|
17
|
+
} = template;
|
|
18
|
+
const {description, media = {}} = cardContent[0];
|
|
19
|
+
const {mediaUrl} = media;
|
|
20
|
+
return (
|
|
21
|
+
<div className="cap-rcs-creatives">
|
|
22
|
+
<CapLabel type="label19" className="rcs-description">
|
|
23
|
+
{description}
|
|
24
|
+
</CapLabel>
|
|
25
|
+
{mediaUrl && (
|
|
26
|
+
<img
|
|
27
|
+
style={{ marginTop: '8px' }}
|
|
28
|
+
width={220}
|
|
29
|
+
height={103}
|
|
30
|
+
alt={''}
|
|
31
|
+
src={mediaUrl}
|
|
32
|
+
key={`mediaUrl-${name}`}
|
|
33
|
+
/>
|
|
34
|
+
)}
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
@@ -574,9 +574,17 @@
|
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
576
|
|
|
577
|
-
.
|
|
577
|
+
.illustration-desc {
|
|
578
578
|
font-size: 14px;
|
|
579
579
|
color: rgba(0, 0, 0, 0.87);
|
|
580
580
|
margin: 8px 0;
|
|
581
581
|
white-space: pre-wrap;
|
|
582
582
|
}
|
|
583
|
+
.rcs-illustration{
|
|
584
|
+
width: 25%;
|
|
585
|
+
text-align: center;
|
|
586
|
+
}
|
|
587
|
+
.channel-specific-illustration-text{
|
|
588
|
+
text-align: center;
|
|
589
|
+
margin-top: $CAP_SPACE_44;
|
|
590
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as types from './constants';
|
|
8
|
-
import { LINE, WHATSAPP } from '../CreativesContainer/constants';
|
|
8
|
+
import { LINE, WHATSAPP, RCS } from '../CreativesContainer/constants';
|
|
9
9
|
|
|
10
10
|
export function getAllTemplates(channel, queryParams) {
|
|
11
11
|
return {
|
|
@@ -59,6 +59,7 @@ export function setChannelAccount(channel, account) {
|
|
|
59
59
|
const channelTypeMapping = {
|
|
60
60
|
[LINE]: types.SET_LINE_ACCOUNT,
|
|
61
61
|
[WHATSAPP]: types.SET_WHATSAPP_ACCOUNT,
|
|
62
|
+
[RCS]: types.SET_RCS_ACCOUNT,
|
|
62
63
|
};
|
|
63
64
|
if (channelTypeMapping[channel]) {
|
|
64
65
|
return {
|
|
@@ -46,6 +46,7 @@ export const SET_LINE_ACCOUNT = "app/v2Containers/Templates/SET_LINE_ACCOUNT";
|
|
|
46
46
|
export const SET_VIBER_ACCOUNT = "app/v2Containers/Templates/SET_VIBER_ACCOUNT";
|
|
47
47
|
export const SET_FACEBOOK_ACCOUNT = "app/v2Containers/Templates/SET_FACEBOOK_ACCOUNT";
|
|
48
48
|
export const SET_WHATSAPP_ACCOUNT = "app/v2Containers/Templates/SET_WHATSAPP_ACCOUNT";
|
|
49
|
+
export const SET_RCS_ACCOUNT = "app/v2Containers/Templates/SET_RCS_ACCOUNT";
|
|
49
50
|
|
|
50
51
|
export const GET_DEAFULT_BEE_TEMPLATES_REQUEST = 'app/v2Containers/Templates/GET_DEAFULT_BEE_TEMPLATES_REQUEST';
|
|
51
52
|
export const GET_DEAFULT_BEE_TEMPLATES_SUCCESS = 'app/v2Containers/Templates/GET_DEAFULT_BEE_TEMPLATES_SUCCESS';
|