@capillarytech/creatives-library 6.7.1 → 6.8.1
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/assets/line-image-placeholder.svg +14 -0
- package/assets/line.png +0 -0
- package/assets/smiley-placeholder.svg +11 -0
- package/components/TemplatePreview/index.js +185 -8
- package/index.js +3 -3
- package/package.json +1 -1
- package/routes.js +2 -2
- package/services/api.js +3 -0
- package/styles/vendor/semantic/src/definitions/modules/accordion.less +219 -219
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +1 -1
- package/v2Components/TemplatePreview/index.js +164 -12
- package/v2Components/TemplatePreview/messages.js +8 -0
- package/v2Containers/Assets/Gallery/index.js +3 -0
- package/v2Containers/Assets/Gallery/selectors.js +12 -5
- package/v2Containers/CreativesContainer/SlideBoxContent.js +51 -17
- package/v2Containers/CreativesContainer/index.js +23 -17
- package/v2Containers/Line/Container/Drawer/index.js +93 -0
- package/v2Containers/Line/Container/Image/constants.js +3 -0
- package/v2Containers/Line/Container/Image/index.js +460 -0
- package/v2Containers/Line/Container/Image/messages.js +86 -0
- package/v2Containers/Line/Container/Image/style.js +32 -0
- package/v2Containers/Line/Container/ImageMap/assets/hover/custom.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/hover/templateEight.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/hover/templateFive.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/hover/templateFour.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/hover/templateOne.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/hover/templateSeven.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/hover/templateSix.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/hover/templateThree.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/hover/templateTwo.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/selected/custom.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/selected/templateEight.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/selected/templateFive.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/selected/templateFour.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/selected/templateOne.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/selected/templateSeven.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/selected/templateSix.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/selected/templateThree.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/selected/templateTwo.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/templates/custom.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/templates/templateEight.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/templates/templateFive.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/templates/templateFour.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/templates/templateOne.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/templates/templateSeven.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/templates/templateSix.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/templates/templateThree.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/templates/templateTwo.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/templates_with_alphabets/custom.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/templates_with_alphabets/templateEight.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/templates_with_alphabets/templateFive.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/templates_with_alphabets/templateFour.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/templates_with_alphabets/templateOne.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/templates_with_alphabets/templateSeven.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/templates_with_alphabets/templateSix.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/templates_with_alphabets/templateThree.png +0 -0
- package/v2Containers/Line/Container/ImageMap/assets/templates_with_alphabets/templateTwo.png +0 -0
- package/v2Containers/Line/Container/ImageMap/constants.js +19 -0
- package/v2Containers/Line/Container/ImageMap/index.js +603 -0
- package/v2Containers/Line/Container/ImageMap/messages.js +126 -0
- package/v2Containers/Line/Container/ImageMap/style.js +94 -0
- package/v2Containers/Line/Container/ImageMap/templates.json +195 -0
- package/v2Containers/Line/Container/Sticker/index.js +224 -0
- package/v2Containers/Line/Container/Sticker/messages.js +34 -0
- package/v2Containers/Line/Container/Sticker/style.js +36 -0
- package/v2Containers/Line/Container/Sticker/utils.js +68 -0
- package/v2Containers/Line/Container/Text/index.js +338 -0
- package/v2Containers/Line/Container/Text/messages.js +74 -0
- package/v2Containers/Line/Container/Text/style.js +37 -0
- package/v2Containers/Line/Container/Wrapper/index.js +152 -0
- package/v2Containers/Line/Container/Wrapper/messages.js +46 -0
- package/v2Containers/Line/Container/Wrapper/style.js +44 -0
- package/v2Containers/Line/Container/Wrapper/utils.js +67 -0
- package/v2Containers/Line/Container/_lineCreate.scss +108 -0
- package/v2Containers/Line/Container/actions.js +99 -0
- package/v2Containers/Line/Container/constants.js +48 -0
- package/v2Containers/Line/Container/index.js +581 -0
- package/v2Containers/Line/Container/messages.js +66 -0
- package/v2Containers/Line/Container/reducer.js +103 -0
- package/v2Containers/Line/Container/sagas.js +137 -0
- package/v2Containers/Line/Container/selectors.js +30 -0
- package/v2Containers/Line/Container/style.js +57 -0
- package/v2Containers/Line/Create/index.js +1 -1
- package/v2Containers/Templates/index.js +40 -22
- package/v2Containers/Templates/messages.js +8 -0
- package/v2Containers/TemplatesV2/index.js +13 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* Create reducer
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { fromJS } from 'immutable';
|
|
8
|
+
import * as types from './constants';
|
|
9
|
+
|
|
10
|
+
const initialState = fromJS({
|
|
11
|
+
createTemplateInProgress: false,
|
|
12
|
+
response: {},
|
|
13
|
+
uploadedAssetData: {},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
function createReducer(state = initialState, action) {
|
|
17
|
+
switch (action.type) {
|
|
18
|
+
case types.DEFAULT_ACTION:
|
|
19
|
+
return state;
|
|
20
|
+
case types.CREATE_TEMPLATE_REQUEST:
|
|
21
|
+
return state
|
|
22
|
+
.set('createTemplateInProgress', true)
|
|
23
|
+
.set('createTemplateError', false)
|
|
24
|
+
.set('createTemplateErrorMessage', fromJS(""));
|
|
25
|
+
case types.CREATE_TEMPLATE_SUCCESS:
|
|
26
|
+
return state.set('createTemplateInProgress', false)
|
|
27
|
+
.set('response', action.data)
|
|
28
|
+
.set('createTemplateError', (action.statusCode !== undefined && action.statusCode > 300))
|
|
29
|
+
.set('createTemplateErrorMessage', fromJS(action.errorMsg));
|
|
30
|
+
case types.CREATE_TEMPLATE_FAILURE:
|
|
31
|
+
return state
|
|
32
|
+
.set('createTemplateInProgress', false)
|
|
33
|
+
.set('createTemplateError', true)
|
|
34
|
+
.set('createTemplateErrorMessage', fromJS(action.errorMsg));
|
|
35
|
+
case types.CLEAR_CREATE_RESPONSE_REQUEST:
|
|
36
|
+
return state.set('response', {});
|
|
37
|
+
case types.UPLOAD_ASSET_REQUEST:
|
|
38
|
+
return state
|
|
39
|
+
.set('uploadAssetSuccess', false)
|
|
40
|
+
.set('assetUploading', true);
|
|
41
|
+
case types.UPLOAD_ASSET_SUCCESS:
|
|
42
|
+
return state
|
|
43
|
+
.set('uploadAssetSuccess', (action.statusCode !== undefined && action.statusCode !== '' && action.statusCode < 300))
|
|
44
|
+
.set('assetUploading', false)
|
|
45
|
+
.set('uploadedAssetData', action.data);
|
|
46
|
+
case types.UPLOAD_ASSET_FAILURE:
|
|
47
|
+
return state
|
|
48
|
+
.set('uploadAssetSuccess', false)
|
|
49
|
+
.set('assetUploading', false);
|
|
50
|
+
case types.CLEAR_ASSET:
|
|
51
|
+
return state
|
|
52
|
+
.delete('uploadedAssetData');
|
|
53
|
+
// FOR EDIT
|
|
54
|
+
case types.EDIT_TEMPLATE_REQUEST:
|
|
55
|
+
return state
|
|
56
|
+
.set('editTemplateInProgress', true)
|
|
57
|
+
.set('editTemplateError', false)
|
|
58
|
+
.set('editTemplateErrorMessage', fromJS(""));
|
|
59
|
+
case types.EDIT_TEMPLATE_SUCCESS:
|
|
60
|
+
return state.set('editTemplateInProgress', false)
|
|
61
|
+
.set('editResponse', action.data)
|
|
62
|
+
.set('editTemplateError', (action.statusCode !== undefined && action.statusCode > 300))
|
|
63
|
+
.set('editTemplateErrorMessage', fromJS(action.errorMsg));
|
|
64
|
+
case types.EDIT_TEMPLATE_FAILURE:
|
|
65
|
+
return state
|
|
66
|
+
.set('editTemplateInProgress', false)
|
|
67
|
+
.set('editTemplateError', true)
|
|
68
|
+
.set('editTemplateErrorMessage', fromJS(action.errorMsg));
|
|
69
|
+
case types.GET_TEMPLATE_DETAILS_REQUEST:
|
|
70
|
+
return state.set('getTemplateDetailsInProgress', true);
|
|
71
|
+
case types.GET_TEMPLATE_DETAILS_SUCCESS:
|
|
72
|
+
return state.set('getTemplateDetailsInProgress', false)
|
|
73
|
+
.set('templateDetails', action.data);
|
|
74
|
+
case types.GET_TEMPLATE_DETAILS_FAILURE:
|
|
75
|
+
return state.set('getTemplateDetailsInProgress', false);
|
|
76
|
+
case types.CLEAR_EDIT_RESPONSE_REQUEST:
|
|
77
|
+
return state.set('editResponse', {});
|
|
78
|
+
case types.CLEAR_DATA:
|
|
79
|
+
return state
|
|
80
|
+
.delete('uploadedAssetData')
|
|
81
|
+
.delete('metaEntities')
|
|
82
|
+
.delete('templateDetails');
|
|
83
|
+
case types.GET_LINE_TEMPLATES_LIST_REQUEST:
|
|
84
|
+
return state
|
|
85
|
+
.set('fetchingDefaultTemplates', true);
|
|
86
|
+
case types.GET_LINE_TEMPLATES_LIST_SUCCESS:
|
|
87
|
+
return state
|
|
88
|
+
.set('fetchingDefaultTemplates', false)
|
|
89
|
+
.set('lineTemplates', fromJS(action.data));
|
|
90
|
+
case types.GET_LINE_TEMPLATES_LIST_FAILURE:
|
|
91
|
+
return state
|
|
92
|
+
.set('fetchingDefaultTemplates', false)
|
|
93
|
+
.set('errorFetchingDefaultTempalte', true);
|
|
94
|
+
case types.GET_STICKER_RESPONSE:
|
|
95
|
+
return state
|
|
96
|
+
.set('lineStickers', action.result)
|
|
97
|
+
.set('lineStickersError', action.error)
|
|
98
|
+
default:
|
|
99
|
+
return state;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export default createReducer;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// Line Sagas
|
|
2
|
+
|
|
3
|
+
import { take, cancel, call, put, takeLatest } from 'redux-saga/effects';
|
|
4
|
+
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
5
|
+
import * as Api from '../../../services/api';
|
|
6
|
+
import * as types from './constants';
|
|
7
|
+
|
|
8
|
+
export function* createTemplate({ template, callback }) {
|
|
9
|
+
let errorMsg;
|
|
10
|
+
try {
|
|
11
|
+
console.log('inside line saga createTemplate@@@', template);
|
|
12
|
+
const result = yield call(Api.createLineTemplate, { template });
|
|
13
|
+
if (result.message || result.status.code === 500) {
|
|
14
|
+
errorMsg = result.message;
|
|
15
|
+
}
|
|
16
|
+
yield put({ type: types.CREATE_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg });
|
|
17
|
+
if (callback) {
|
|
18
|
+
callback(result.response);
|
|
19
|
+
}
|
|
20
|
+
} catch (error) {
|
|
21
|
+
yield put({ type: types.CREATE_TEMPLATE_FAILURE, error, errorMsg });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function* uploadAsset(file, assetType, fileParams) {
|
|
25
|
+
try {
|
|
26
|
+
const result = yield call(Api.uploadFile, file, assetType, fileParams);
|
|
27
|
+
yield put({ type: types.UPLOAD_ASSET_SUCCESS, data: result.response.asset, statusCode: result.status ? result.status.code : '' });
|
|
28
|
+
} catch (error) {
|
|
29
|
+
yield put({ type: types.UPLOAD_ASSET_FAILURE, error });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function* watchCreateTemplate() {
|
|
34
|
+
console.log('inside watch line saga createTemplate@@@');
|
|
35
|
+
const watcher = yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
|
|
36
|
+
yield take(LOCATION_CHANGE);
|
|
37
|
+
yield cancel(watcher);
|
|
38
|
+
}
|
|
39
|
+
function* watchUploadAsset() {
|
|
40
|
+
console.log("inside watchUploadAsset");
|
|
41
|
+
const watcher = yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
|
|
42
|
+
yield take(LOCATION_CHANGE);
|
|
43
|
+
yield cancel(watcher);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// edit
|
|
47
|
+
|
|
48
|
+
export function* editTemplate({ template, callback }) {
|
|
49
|
+
let errorMsg;
|
|
50
|
+
try {
|
|
51
|
+
console.log('saga editTemplate line', template);
|
|
52
|
+
const result = yield call(Api.createLineTemplate, {template});
|
|
53
|
+
console.log('saga editTemplate success line', result);
|
|
54
|
+
if (result.message || result.status.code === 500) {
|
|
55
|
+
errorMsg = result.message;
|
|
56
|
+
}
|
|
57
|
+
if (callback) {
|
|
58
|
+
callback(result.response);
|
|
59
|
+
}
|
|
60
|
+
yield put({ type: types.EDIT_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg });
|
|
61
|
+
} catch (error) {
|
|
62
|
+
yield put({ type: types.EDIT_TEMPLATE_FAILURE, error, errorMsg });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function* getTemplateDetails(id) {
|
|
67
|
+
try {
|
|
68
|
+
console.log('saga get Template details line', id);
|
|
69
|
+
const result = yield call(Api.getTemplateDetails, id);
|
|
70
|
+
// const sidebar = result.response.sidebar;
|
|
71
|
+
yield put({ type: types.GET_TEMPLATE_DETAILS_SUCCESS, data: result.response });
|
|
72
|
+
if (id.callback) {
|
|
73
|
+
id.callback(false);
|
|
74
|
+
}
|
|
75
|
+
} catch (error) {
|
|
76
|
+
yield put({ type: types.GET_TEMPLATE_DETAILS_FAILURE, error });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function* getLineTemplatesList(params) {
|
|
81
|
+
try {
|
|
82
|
+
console.log('Saga param line ', params.channel, params.queryParams);
|
|
83
|
+
const result = yield call(Api.getAllTemplates, {channel: params.channel, queryParams: params.queryParams});
|
|
84
|
+
yield put({ type: types.GET_LINE_TEMPLATES_LIST_SUCCESS, data: result.response.templates, templateData: result.response.mapped});
|
|
85
|
+
} catch (error) {
|
|
86
|
+
yield put({ type: types.GET_LINE_TEMPLATES_LIST_FAILURE, error });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function* getLineStickers() {
|
|
91
|
+
try {
|
|
92
|
+
const result = yield call(Api.getAllLineStickers);
|
|
93
|
+
yield put({
|
|
94
|
+
type: types.GET_STICKER_RESPONSE,
|
|
95
|
+
result,
|
|
96
|
+
});
|
|
97
|
+
} catch (error) {
|
|
98
|
+
yield put({
|
|
99
|
+
type: types.GET_STICKER_RESPONSE,
|
|
100
|
+
error,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function* watchEditTemplate() {
|
|
106
|
+
const watcher = yield takeLatest(types.EDIT_TEMPLATE_REQUEST, editTemplate);
|
|
107
|
+
yield take(LOCATION_CHANGE);
|
|
108
|
+
yield cancel(watcher);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function* watchGetTemplateDetails() {
|
|
112
|
+
const watcher = yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
|
|
113
|
+
yield take(LOCATION_CHANGE);
|
|
114
|
+
yield cancel(watcher);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function* watchLineTemplatesList() {
|
|
118
|
+
const watcher = yield takeLatest(types.GET_LINE_TEMPLATES_LIST_REQUEST, getLineTemplatesList);
|
|
119
|
+
yield take(LOCATION_CHANGE);
|
|
120
|
+
yield cancel(watcher);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function* watchGetLineStickers() {
|
|
124
|
+
const watcher = yield takeLatest(types.GET_STICKER_REQUEST, getLineStickers);
|
|
125
|
+
yield take(LOCATION_CHANGE);
|
|
126
|
+
yield cancel(watcher);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// All sagas to be loaded
|
|
130
|
+
export default [
|
|
131
|
+
watchCreateTemplate,
|
|
132
|
+
watchUploadAsset,
|
|
133
|
+
watchEditTemplate,
|
|
134
|
+
watchGetTemplateDetails,
|
|
135
|
+
watchLineTemplatesList,
|
|
136
|
+
watchGetLineStickers,
|
|
137
|
+
];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createSelector } from 'reselect';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Direct selector to the create state domain
|
|
5
|
+
*/
|
|
6
|
+
const selectLineDomain = () => (state) => state.get('templates');
|
|
7
|
+
const selectLineMessageEditDomain = () => (state) => state.get('lineCreate');
|
|
8
|
+
|
|
9
|
+
const makeSelectLine = () => createSelector(
|
|
10
|
+
selectLineDomain(),
|
|
11
|
+
(substate) => substate && substate.toJS()
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const makeSelectCreateLine = () => createSelector(
|
|
15
|
+
selectLineMessageEditDomain(),
|
|
16
|
+
(substate) => substate && substate.toJS()
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const editLineContentSelector = () => createSelector(
|
|
20
|
+
selectLineMessageEditDomain(),
|
|
21
|
+
substate => [{
|
|
22
|
+
messageContent: substate.getIn(['templateDetails', 'versions', 'base', 'content', 'messages']),
|
|
23
|
+
messageTitle: substate.getIn(['templateDetails', 'name']),
|
|
24
|
+
type: substate.getIn(['templateDetails', 'mode']),
|
|
25
|
+
}]
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
makeSelectLine, makeSelectCreateLine, editLineContentSelector,
|
|
30
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { css } from 'styled-components';
|
|
2
|
+
import {
|
|
3
|
+
CAP_SPACE_44,
|
|
4
|
+
CAP_SPACE_28,
|
|
5
|
+
CAP_SPACE_20,
|
|
6
|
+
CAP_SPACE_12,
|
|
7
|
+
CAP_SPACE_08,
|
|
8
|
+
CAP_G07,
|
|
9
|
+
CAP_G12,
|
|
10
|
+
CAP_G06,
|
|
11
|
+
FONT_COLOR_05,
|
|
12
|
+
CAP_SPACE_16,
|
|
13
|
+
CAP_SECONDARY,
|
|
14
|
+
CAP_SPACE_24,
|
|
15
|
+
CAP_SPACE_32,
|
|
16
|
+
CAP_WHITE,
|
|
17
|
+
} from '@capillarytech/cap-ui-library/styled/variables';
|
|
18
|
+
|
|
19
|
+
export default css`
|
|
20
|
+
.ant-btn.cap-button-v2.add-msg {
|
|
21
|
+
margin-bottom: ${CAP_SPACE_16};
|
|
22
|
+
border: 2px solid ${CAP_SECONDARY.base};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ant-spin-container > .ant-row {
|
|
26
|
+
height: calc(100vh - 160px);
|
|
27
|
+
overflow-y: auto;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.shell-v2 {
|
|
31
|
+
text-align: right;
|
|
32
|
+
|
|
33
|
+
.msgContainer.line-preview {
|
|
34
|
+
left: 46%;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.action-section {
|
|
39
|
+
background-color: ${CAP_WHITE};
|
|
40
|
+
position: fixed;
|
|
41
|
+
bottom: 0;
|
|
42
|
+
width: 100%;
|
|
43
|
+
margin-left: -32px;
|
|
44
|
+
padding: ${CAP_SPACE_32} ${CAP_SPACE_24};
|
|
45
|
+
|
|
46
|
+
.ant-btn {
|
|
47
|
+
margin-right: ${CAP_SPACE_16};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.text-template-title,
|
|
52
|
+
.sticker-template-title,
|
|
53
|
+
.image-template-title {
|
|
54
|
+
margin-bottom: ${CAP_SPACE_16};
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
|
|
@@ -29,7 +29,7 @@ import { makeSelectCreate as makeSelectCreateMobilePush } from '../MobilePush/Cr
|
|
|
29
29
|
import { makeSelectEbill as makeSelectCreateEbill } from '../Ebill/selectors';
|
|
30
30
|
import { makeSelectEmail as makeSelectCreateEmail } from '../Email/selectors';
|
|
31
31
|
import { makeSelectEdit } from '../Sms/Edit/selectors';
|
|
32
|
-
import { makeSelectLine } from '../Line/
|
|
32
|
+
import { makeSelectLine } from '../Line/Container/selectors';
|
|
33
33
|
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
34
34
|
import messages from './messages';
|
|
35
35
|
import {checkUnicode} from '../../utils/smsCharCountV2';
|
|
@@ -39,7 +39,7 @@ import * as mobilepushActions from '../MobilePush/Create/actions';
|
|
|
39
39
|
import * as smsEditActions from '../Sms/Edit/actions';
|
|
40
40
|
import * as ebillActions from '../Ebill/actions';
|
|
41
41
|
import * as emailActions from '../Email/actions';
|
|
42
|
-
import * as lineActions from '../Line/
|
|
42
|
+
import * as lineActions from '../Line/Container/actions';
|
|
43
43
|
import CardGrid from '../../v2Components/CardGrid';
|
|
44
44
|
import config from '../../config/app';
|
|
45
45
|
import './_templates.scss';
|
|
@@ -81,6 +81,8 @@ const LINE_FILTERS = {
|
|
|
81
81
|
ALL: 'all',
|
|
82
82
|
TEXT: 'text',
|
|
83
83
|
IMAGE_VIDEO: 'image',
|
|
84
|
+
STICKER: 'sticker',
|
|
85
|
+
IMAGE_MAP: 'imagemap'
|
|
84
86
|
};
|
|
85
87
|
|
|
86
88
|
export class Templates extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
@@ -636,11 +638,14 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
636
638
|
messages: [{
|
|
637
639
|
text = '',
|
|
638
640
|
originalContentUrl = '',
|
|
641
|
+
stickerUrl = '',
|
|
642
|
+
animatedStickerUrl = '',
|
|
643
|
+
baseUrl = '',
|
|
639
644
|
}] = [{}],
|
|
640
645
|
} = {},
|
|
641
646
|
} = template.versions.base;
|
|
642
647
|
templateData.content = text;
|
|
643
|
-
templateData.url = originalContentUrl;
|
|
648
|
+
templateData.url = originalContentUrl || animatedStickerUrl || stickerUrl || (baseUrl ? `${baseUrl}/1040` : '');
|
|
644
649
|
break;
|
|
645
650
|
}
|
|
646
651
|
default:
|
|
@@ -1773,26 +1778,39 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1773
1778
|
</CapRadio.CapRadioGroup>
|
|
1774
1779
|
}
|
|
1775
1780
|
{
|
|
1776
|
-
channel.toUpperCase() === LINE &&
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1781
|
+
channel.toUpperCase() === LINE &&
|
|
1782
|
+
isFullMode
|
|
1783
|
+
? (
|
|
1784
|
+
<CapRadio.CapRadioGroup className="line-filters" defaultValue={lineFilter} onChange={this.setLineFilter}>
|
|
1785
|
+
{
|
|
1786
|
+
(() => {
|
|
1787
|
+
const { ALL, TEXT, IMAGE_VIDEO, STICKER, IMAGE_MAP } = LINE_FILTERS;
|
|
1788
|
+
return (
|
|
1789
|
+
<>
|
|
1790
|
+
<CapRadio.Button value={ALL}><CapLabel type="label2">
|
|
1791
|
+
<FormattedMessage {...messages.all} />
|
|
1792
|
+
</CapLabel></CapRadio.Button>
|
|
1793
|
+
<CapRadio.Button value={TEXT}><CapLabel type="label2">
|
|
1794
|
+
<FormattedMessage {...messages.textTemplate} />
|
|
1795
|
+
</CapLabel></CapRadio.Button>
|
|
1796
|
+
<CapRadio.Button value={IMAGE_VIDEO}><CapLabel type="label2">
|
|
1797
|
+
<FormattedMessage {...messages.imageTemplate} />
|
|
1798
|
+
</CapLabel></CapRadio.Button>
|
|
1799
|
+
<CapRadio.Button value={STICKER}><CapLabel type="label2">
|
|
1800
|
+
<FormattedMessage {...messages.stickerTemplate} />
|
|
1801
|
+
</CapLabel></CapRadio.Button>
|
|
1802
|
+
<CapRadio.Button value={IMAGE_MAP}><CapLabel type="label2">
|
|
1803
|
+
<FormattedMessage {...messages.imageMapTemplate} />
|
|
1804
|
+
</CapLabel></CapRadio.Button>
|
|
1805
|
+
</>
|
|
1806
|
+
);
|
|
1807
|
+
})()
|
|
1808
|
+
}
|
|
1809
|
+
</CapRadio.CapRadioGroup>
|
|
1810
|
+
)
|
|
1811
|
+
: () => {
|
|
1812
|
+
return null;
|
|
1794
1813
|
}
|
|
1795
|
-
</CapRadio.CapRadioGroup>
|
|
1796
1814
|
}
|
|
1797
1815
|
<div style={{display: "flex", justifyContent: "space-between", alignItems: 'center'}}>
|
|
1798
1816
|
{isfilterContentVisisble && !isWechatEmbedded && <CapButton
|
|
@@ -238,6 +238,14 @@ export default defineMessages({
|
|
|
238
238
|
id: `${scope}.imageTemplate`,
|
|
239
239
|
defaultMessage: `Image`,
|
|
240
240
|
},
|
|
241
|
+
"stickerTemplate": {
|
|
242
|
+
id: `${scope}.stickerTemplate`,
|
|
243
|
+
defaultMessage: `Sticker`,
|
|
244
|
+
},
|
|
245
|
+
"imageMapTemplate": {
|
|
246
|
+
id: `${scope}.imageMapTemplate`,
|
|
247
|
+
defaultMessage: `Image map`,
|
|
248
|
+
},
|
|
241
249
|
"selectDefaultButton": {
|
|
242
250
|
id: `${scope}.selectDefaultButton`,
|
|
243
251
|
defaultMessage: `Select`,
|
|
@@ -22,6 +22,7 @@ import * as actions from './actions';
|
|
|
22
22
|
import Templates from '../Templates';
|
|
23
23
|
import CallTask from '../CallTask';
|
|
24
24
|
import Facebook from '../Facebook';
|
|
25
|
+
import Line from '../Line/Container';
|
|
25
26
|
import Gallery from '../Assets/Gallery';
|
|
26
27
|
import withStyles from '../../hoc/withStyles';
|
|
27
28
|
import styles, { CapTabStyle } from './TemplatesV2.style';
|
|
@@ -149,11 +150,23 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
149
150
|
);
|
|
150
151
|
}
|
|
151
152
|
|
|
153
|
+
getLineComponent = () => {
|
|
154
|
+
return (
|
|
155
|
+
<Line
|
|
156
|
+
{...this.props}
|
|
157
|
+
isCreateFlow
|
|
158
|
+
/>
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
|
|
152
162
|
getTemplatesComponent(channel) {
|
|
153
163
|
// const templates = this.props.Templates[`${channel}Templates`];
|
|
154
164
|
let query = {};
|
|
155
165
|
if (!this.props.isFullMode) {
|
|
156
166
|
query = {type: 'embedded', module: 'library'};
|
|
167
|
+
if (channel === 'line') {
|
|
168
|
+
return this.getLineComponent();
|
|
169
|
+
}
|
|
157
170
|
}
|
|
158
171
|
const location = {pathname: `/${channel}`, search: '', query};
|
|
159
172
|
switch (channel) {
|