@capillarytech/creatives-library 7.16.9-alpha.1 → 7.16.10
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/app.js +2 -2
- package/components/TemplatePreview/index.js +0 -1
- package/containers/Assets/Gallery/messages.js +1 -1
- package/containers/Cap/sagas.js +3 -4
- package/containers/Cap/tests/__snapshots__/index.test.js.snap +4 -4
- package/containers/Email/messages.js +1 -1
- package/package.json +1 -1
- package/services/api.js +9 -1
- package/styles/vendor/semantic/src/definitions/collections/form.less +2 -2
- package/styles/vendor/semantic/src/definitions/elements/flag.less +1 -1
- package/styles/vendor/semantic/src/definitions/elements/icon.less +1 -0
- package/styles/vendor/semantic/src/definitions/globals/site.less +1 -1
- package/translations/en.json +4 -4
- package/utils/common.js +0 -22
- package/utils/smsCharCountV2.js +13 -0
- package/utils/test-utils.js +17 -0
- package/utils/tests/v2Common.test.js +2 -44
- package/v2Components/CapDocumentUpload/index.js +6 -3
- package/v2Components/CapImageUpload/index.js +5 -2
- package/v2Components/CapVideoUpload/index.js +6 -2
- package/v2Components/FormBuilder/index.js +31 -9
- package/v2Containers/Assets/Gallery/index.js +3 -28
- package/v2Containers/Assets/Gallery/messages.js +1 -1
- package/v2Containers/Cap/sagas.js +3 -4
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +4 -4
- package/v2Containers/ChannelTemplates/actions.js +20 -0
- package/v2Containers/ChannelTemplates/constants.js +8 -0
- package/v2Containers/ChannelTemplates/index.js +47 -0
- package/v2Containers/ChannelTemplates/messages.js +13 -0
- package/v2Containers/ChannelTemplates/reducer.js +34 -0
- package/v2Containers/ChannelTemplates/sagas.js +32 -0
- package/v2Containers/ChannelTemplates/selectors.js +25 -0
- package/v2Containers/CreativesContainer/constants.js +2 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +8 -0
- package/v2Containers/Email/index.js +2 -4
- package/v2Containers/Email/messages.js +1 -1
- package/v2Containers/LanguageProvider/index.js +0 -3
- package/v2Containers/Line/Container/Image/index.js +5 -2
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +12 -3397
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +8 -8
- package/v2Containers/Line/Container/ImageMap/index.js +2 -4
- package/v2Containers/Line/Container/Video/index.js +8 -5
- package/v2Containers/Line/Container/Video/messages.js +0 -9
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +68 -68
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +72 -72
- package/v2Containers/MobilePush/Create/index.js +3 -21
- package/v2Containers/MobilePush/Create/messages.js +0 -48
- package/v2Containers/MobilePush/Edit/index.js +1 -19
- package/v2Containers/MobilePush/Edit/messages.js +0 -16
- package/v2Containers/MobilePush/commonMethods.js +2 -2
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +197 -191
- package/v2Containers/Sms/Create/actions.js +9 -0
- package/v2Containers/Sms/Create/constants.js +2 -0
- package/v2Containers/Sms/Create/index.js +12 -0
- package/v2Containers/Sms/Create/sagas.js +19 -3
- package/v2Containers/Sms/Create/tests/sagas.test.js +82 -0
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +16 -16
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +32 -32
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +16 -0
- package/v2Containers/Viber/index.js +5 -2
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +336 -284
|
@@ -356,7 +356,7 @@ exports[`<Cap /> should render correct component 1`] = `
|
|
|
356
356
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
357
357
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
358
358
|
"creatives.containers.Assets.Gallery.assetDeleteSuccess": "Image deleted successfully.",
|
|
359
|
-
"creatives.containers.Assets.Gallery.assetUploadFailed": "Image
|
|
359
|
+
"creatives.containers.Assets.Gallery.assetUploadFailed": "Image uploaded failed",
|
|
360
360
|
"creatives.containers.Assets.Gallery.assetUploadSuccess": "Image uploaded successfully",
|
|
361
361
|
"creatives.containers.Assets.Gallery.backToGallery": "Back to image gallery",
|
|
362
362
|
"creatives.containers.Assets.Gallery.delete": "Delete",
|
|
@@ -503,7 +503,7 @@ exports[`<Cap /> should render correct component 1`] = `
|
|
|
503
503
|
"creatives.containers.Email.Tags": "Tags",
|
|
504
504
|
"creatives.containers.Email.alphabetically": "Alphabetically",
|
|
505
505
|
"creatives.containers.Email.alphabeticallyOption": "Alphabetically",
|
|
506
|
-
"creatives.containers.Email.assetUploadFailed": "Image
|
|
506
|
+
"creatives.containers.Email.assetUploadFailed": "Image uploaded failed",
|
|
507
507
|
"creatives.containers.Email.blankTemplate": "Blank template",
|
|
508
508
|
"creatives.containers.Email.cancel": "Cancel",
|
|
509
509
|
"creatives.containers.Email.createHeading": "Create email template",
|
|
@@ -908,7 +908,7 @@ exports[`<Cap /> should render correct component 1`] = `
|
|
|
908
908
|
"creatives.containersV2.Assets.Gallery.alphabetically": "Alphabetically",
|
|
909
909
|
"creatives.containersV2.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
910
910
|
"creatives.containersV2.Assets.Gallery.assetDeleteSuccess": "Image deleted successfully.",
|
|
911
|
-
"creatives.containersV2.Assets.Gallery.assetUploadFailed": "Image
|
|
911
|
+
"creatives.containersV2.Assets.Gallery.assetUploadFailed": "Image uploaded failed",
|
|
912
912
|
"creatives.containersV2.Assets.Gallery.assetUploadSuccess": "Image uploaded successfully",
|
|
913
913
|
"creatives.containersV2.Assets.Gallery.backToGallery": "Back to image gallery",
|
|
914
914
|
"creatives.containersV2.Assets.Gallery.delete": "Delete",
|
|
@@ -1166,7 +1166,7 @@ exports[`<Cap /> should render correct component 1`] = `
|
|
|
1166
1166
|
"creatives.containersV2.Email.alertMessage": "Alert",
|
|
1167
1167
|
"creatives.containersV2.Email.alphabetically": "Alphabetically",
|
|
1168
1168
|
"creatives.containersV2.Email.alphabeticallyOption": "Alphabetically",
|
|
1169
|
-
"creatives.containersV2.Email.assetUploadFailed": "Image
|
|
1169
|
+
"creatives.containersV2.Email.assetUploadFailed": "Image uploaded failed",
|
|
1170
1170
|
"creatives.containersV2.Email.blankTemplate": "Blank template",
|
|
1171
1171
|
"creatives.containersV2.Email.cancel": "Cancel",
|
|
1172
1172
|
"creatives.containersV2.Email.copyPrimaryLanguage": "Copy Primary Language",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* ChannelTemplates actions
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as types from './constants';
|
|
8
|
+
|
|
9
|
+
export function defaultAction() {
|
|
10
|
+
return {
|
|
11
|
+
type: types.DEFAULT_ACTION,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function getTemplates(channel) {
|
|
16
|
+
return {
|
|
17
|
+
type: types.GET_TEMPLATES_REQUEST,
|
|
18
|
+
channel,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* ChannelTemplates
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { connect } from 'react-redux';
|
|
11
|
+
import { FormattedMessage } from 'react-intl';
|
|
12
|
+
import { bindActionCreators } from 'redux';
|
|
13
|
+
import { createStructuredSelector } from 'reselect';
|
|
14
|
+
import makeSelectChannelTemplates from './selectors';
|
|
15
|
+
import * as actions from './actions';
|
|
16
|
+
import messages from './messages';
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export class ChannelTemplates extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
20
|
+
componentDidMount() {
|
|
21
|
+
this.props.actions.getTemplates(this.props.channel);
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
|
+
return (
|
|
25
|
+
<CardGrid
|
|
26
|
+
cardDataList={[]}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
ChannelTemplates.propTypes = {
|
|
33
|
+
actions: PropTypes.object.isRequired,
|
|
34
|
+
channel: PropTypes.string,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const mapStateToProps = createStructuredSelector({
|
|
38
|
+
ChannelTemplates: makeSelectChannelTemplates(),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
function mapDispatchToProps(dispatch) {
|
|
42
|
+
return {
|
|
43
|
+
actions: bindActionCreators(actions, dispatch),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default connect(mapStateToProps, mapDispatchToProps)(ChannelTemplates);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* ChannelTemplates Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the ChannelTemplates component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
header: {
|
|
10
|
+
id: 'creatives.containersV2.ChannelTemplates.header',
|
|
11
|
+
defaultMessage: 'This is ChannelTemplates container !',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* ChannelTemplates reducer
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { fromJS } from 'immutable';
|
|
8
|
+
import * as types from './constants';
|
|
9
|
+
|
|
10
|
+
const initialState = fromJS({
|
|
11
|
+
loadingTemplates: true,
|
|
12
|
+
smsTemplates: [],
|
|
13
|
+
emailTemplates: [],
|
|
14
|
+
wechatTemplates: [],
|
|
15
|
+
mobilepushTemplates: [],
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
function channelTemplatesReducer(state = initialState, action) {
|
|
19
|
+
const channelTemplates = `${action.channel}Templates`;
|
|
20
|
+
switch (action.type) {
|
|
21
|
+
case types.DEFAULT_ACTION:
|
|
22
|
+
return state;
|
|
23
|
+
case types.GET_TEMPLATES_REQUEST:
|
|
24
|
+
return state.set('loadingTemplates', true);
|
|
25
|
+
case types.GET_TEMPLATES_SUCESS:
|
|
26
|
+
return state.set('loadingTemplates', false).set(channelTemplates, action.templates);
|
|
27
|
+
case types.GET_TEMPLATES_FAILURE:
|
|
28
|
+
return state.set('loadingTemplates', false).set('error', action.error);
|
|
29
|
+
default:
|
|
30
|
+
return state;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default channelTemplatesReducer;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { take, takeLatest, call, put, cancel } from 'redux-saga/effects';
|
|
2
|
+
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
3
|
+
import * as Api from '../../services/api';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
import * as types from './constants';
|
|
7
|
+
// Individual exports for testing
|
|
8
|
+
export function* defaultSaga() {
|
|
9
|
+
// See example in v2Containers/HomePage/sagas.js
|
|
10
|
+
}
|
|
11
|
+
function* getTemplates(action) {
|
|
12
|
+
try {
|
|
13
|
+
const req = {
|
|
14
|
+
channel: action.channel,
|
|
15
|
+
queryParams: action.query,
|
|
16
|
+
};
|
|
17
|
+
const res = call(Api.getAllTemplates, req);
|
|
18
|
+
put({type: types.GET_TEMPLATES_SUCESS, templates: res.response, channel: action.channel});
|
|
19
|
+
} catch (error) {
|
|
20
|
+
put({type: types.GET_TEMPLATES_FAILURE, error});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function* getTemplatesWatcher() {
|
|
24
|
+
const watcher = yield takeLatest(types.GET_TEMPLATES_REQUEST, getTemplates);
|
|
25
|
+
yield take(LOCATION_CHANGE);
|
|
26
|
+
yield cancel(watcher);
|
|
27
|
+
}
|
|
28
|
+
// All sagas to be loaded
|
|
29
|
+
export default [
|
|
30
|
+
defaultSaga,
|
|
31
|
+
getTemplatesWatcher,
|
|
32
|
+
];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createSelector } from 'reselect';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Direct selector to the channelTemplates state domain
|
|
5
|
+
*/
|
|
6
|
+
const selectChannelTemplatesDomain = () => (state) => state.get('templates');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Other specific selectors
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Default selector used by ChannelTemplates
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const makeSelectChannelTemplates = () => createSelector(
|
|
18
|
+
selectChannelTemplatesDomain(),
|
|
19
|
+
(substate) => substate.toJS()
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export default makeSelectChannelTemplates;
|
|
23
|
+
export {
|
|
24
|
+
selectChannelTemplatesDomain,
|
|
25
|
+
};
|
|
@@ -23,3 +23,5 @@ export const SHOW_CONTANER_LOADER = "app/CreativesContainer/SHOW_CONTANER_LOADER
|
|
|
23
23
|
export const HIDE_CONTAINER_LOADER = "app/CreativesContainer/HIDE_CONTAINER_LOADER";
|
|
24
24
|
|
|
25
25
|
export const WHATSAPP_HELP_DOC_LINK = "https://docs.capillarytech.com/docs/create-whatsapp-template";
|
|
26
|
+
|
|
27
|
+
export const ENABLE_AI_SUGGESTIONS = "ENABLE_AI_SUGGESTIONS";
|
|
@@ -5,7 +5,9 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
|
|
|
5
5
|
className="add-creatives-section creatives-library-mode "
|
|
6
6
|
>
|
|
7
7
|
<CapSlideBox
|
|
8
|
+
closeIconPosition="right"
|
|
8
9
|
closeIconSize="m"
|
|
10
|
+
closeIconType="close"
|
|
9
11
|
content={
|
|
10
12
|
<SlideBoxContent
|
|
11
13
|
currentChannel="RCS"
|
|
@@ -76,7 +78,9 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
|
|
|
76
78
|
className="add-creatives-section creatives-library-mode "
|
|
77
79
|
>
|
|
78
80
|
<CapSlideBox
|
|
81
|
+
closeIconPosition="right"
|
|
79
82
|
closeIconSize="m"
|
|
83
|
+
closeIconType="close"
|
|
80
84
|
content={
|
|
81
85
|
<SlideBoxContent
|
|
82
86
|
currentChannel="WHATSAPP"
|
|
@@ -147,7 +151,9 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
147
151
|
className="add-creatives-section creatives-library-mode "
|
|
148
152
|
>
|
|
149
153
|
<CapSlideBox
|
|
154
|
+
closeIconPosition="right"
|
|
150
155
|
closeIconSize="m"
|
|
156
|
+
closeIconType="close"
|
|
151
157
|
content={
|
|
152
158
|
<SlideBoxContent
|
|
153
159
|
currentChannel="WHATSAPP"
|
|
@@ -220,7 +226,9 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
220
226
|
className="add-creatives-section creatives-library-mode "
|
|
221
227
|
>
|
|
222
228
|
<CapSlideBox
|
|
229
|
+
closeIconPosition="right"
|
|
223
230
|
closeIconSize="m"
|
|
231
|
+
closeIconType="close"
|
|
224
232
|
content={
|
|
225
233
|
<SlideBoxContent
|
|
226
234
|
currentChannel="WHATSAPP"
|
|
@@ -36,7 +36,6 @@ import { FONT_COLOR_05 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
|
36
36
|
import { gtmPush } from '../../utils/gtmTrackers';
|
|
37
37
|
const {CapCustomCardList} = CapCustomCard;
|
|
38
38
|
import {transformEmailTemplates, storeS3FileSizeDetails, CREATIVES_S3_ASSET_FILESIZES} from '../../utils/cdnTransformation';
|
|
39
|
-
import { createNewFile } from '../../utils/common';
|
|
40
39
|
|
|
41
40
|
export class Email extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
42
41
|
constructor(props) {
|
|
@@ -1151,15 +1150,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1151
1150
|
uploadImages(e, {files}) {
|
|
1152
1151
|
e.preventDefault();
|
|
1153
1152
|
const _URL = window.URL || window.webkitURL;
|
|
1154
|
-
const
|
|
1155
|
-
const fileSize =
|
|
1153
|
+
const file = files[0];
|
|
1154
|
+
const fileSize = file && (file.size / ( 1024 * 1024 ));
|
|
1156
1155
|
if (fileSize > 5) {
|
|
1157
1156
|
const message = this.props.intl.formatMessage(messages.uploadSizeError);
|
|
1158
1157
|
CapNotification.error({key: 'uploadImageIssue', message});
|
|
1159
1158
|
document.getElementById("fileName").value = "";
|
|
1160
1159
|
return;
|
|
1161
1160
|
}
|
|
1162
|
-
const [file] = createNewFile(files);
|
|
1163
1161
|
const img = new Image();
|
|
1164
1162
|
const that = this;
|
|
1165
1163
|
img.src = _URL.createObjectURL(file);
|
|
@@ -232,7 +232,7 @@ export default defineMessages({
|
|
|
232
232
|
},
|
|
233
233
|
"assetUploadFailed": {
|
|
234
234
|
id: 'creatives.containersV2.Email.assetUploadFailed',
|
|
235
|
-
defaultMessage: 'Image
|
|
235
|
+
defaultMessage: 'Image uploaded failed',
|
|
236
236
|
},
|
|
237
237
|
"noImgInGallery": {
|
|
238
238
|
id: 'creatives.containersV2.Email.noImgInGallery',
|
|
@@ -12,7 +12,6 @@ import React from 'react';
|
|
|
12
12
|
import { ConfigProvider } from 'antd';
|
|
13
13
|
import enUS from 'antd/es/locale-provider/en_US';
|
|
14
14
|
import zhCN from 'antd/es/locale-provider/zh_CN';
|
|
15
|
-
import jaJP from 'antd/es/locale-provider/ja_JP';
|
|
16
15
|
import { connect } from 'react-redux';
|
|
17
16
|
import { createStructuredSelector } from 'reselect';
|
|
18
17
|
import { IntlProvider } from 'react-intl';
|
|
@@ -38,7 +37,6 @@ export class LanguageProvider extends React.PureComponent { // eslint-disable-li
|
|
|
38
37
|
'zh-cn': 'zh',
|
|
39
38
|
'zh': 'zh',
|
|
40
39
|
'en-US': 'en-US',
|
|
41
|
-
'ja-JP': 'ja-JP',
|
|
42
40
|
};
|
|
43
41
|
return map[locale];
|
|
44
42
|
};
|
|
@@ -59,7 +57,6 @@ export class LanguageProvider extends React.PureComponent { // eslint-disable-li
|
|
|
59
57
|
'zh-cn': zhCN,
|
|
60
58
|
'en-US': enUS,
|
|
61
59
|
'zh': zhCN,
|
|
62
|
-
'ja-JP': jaJP,
|
|
63
60
|
};
|
|
64
61
|
const jLocale = localStorage.getItem('jlocale') || 'en';
|
|
65
62
|
const file = mappedLocale[jLocale];
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
LINE_IMG_SIZE,
|
|
25
25
|
ALLOWED_EXTENSIONS_REGEX,
|
|
26
26
|
} from './constants';
|
|
27
|
-
import { createNewFile } from '../../../../utils/common';
|
|
28
27
|
|
|
29
28
|
export const LineImage = ({
|
|
30
29
|
className,
|
|
@@ -172,7 +171,11 @@ export const LineImage = ({
|
|
|
172
171
|
e.preventDefault();
|
|
173
172
|
}
|
|
174
173
|
const _URL = window.URL || window.webkitURL;
|
|
175
|
-
|
|
174
|
+
let incorrectFile = false;
|
|
175
|
+
const file = files[0];
|
|
176
|
+
if (!ALLOWED_EXTENSIONS_REGEX.test(file.name)) {
|
|
177
|
+
incorrectFile = true;
|
|
178
|
+
}
|
|
176
179
|
const img = new Image();
|
|
177
180
|
img.src = _URL.createObjectURL(file);
|
|
178
181
|
img.onload = () => {
|