@capillarytech/creatives-library 6.13.5 → 6.13.6
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 +3 -3
- package/containers/Templates/index.js +3 -0
- package/index.js +1 -8
- package/package.json +2 -2
- package/reducers.js +0 -2
- package/routes.js +1 -7
- package/services/api.js +0 -5
- package/v2Components/TemplatePreview/_templatePreview.scss +2 -8
- package/v2Components/TemplatePreview/index.js +18 -104
- package/v2Containers/App/constants.js +1 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +2 -65
- package/v2Containers/CreativesContainer/constants.js +0 -2
- package/v2Containers/CreativesContainer/index.js +2 -29
- package/v2Containers/Line/Create/_lineCreate.scss +64 -0
- package/v2Containers/Line/Create/actions.js +94 -0
- package/v2Containers/Line/Create/constants.js +43 -0
- package/v2Containers/Line/Create/index.js +1112 -0
- package/v2Containers/Line/Create/initialSchema.js +378 -0
- package/v2Containers/Line/Create/messages.js +229 -0
- package/v2Containers/Line/Create/reducer.js +99 -0
- package/v2Containers/Line/Create/sagas.js +113 -0
- package/v2Containers/Line/Create/selectors.js +30 -0
- package/v2Containers/Line/CreateWrapper/constants.js +2 -0
- package/v2Containers/Line/CreateWrapper/index.js +117 -0
- package/v2Containers/Line/CreateWrapper/messages.js +55 -0
- package/v2Containers/Line/Edit/_lineEdit.scss +23 -0
- package/v2Containers/Line/Edit/actions.js +79 -0
- package/v2Containers/Line/Edit/constants.js +27 -0
- package/v2Containers/Line/Edit/index.js +1051 -0
- package/v2Containers/Line/Edit/messages.js +173 -0
- package/v2Containers/Line/Edit/reducer.js +83 -0
- package/v2Containers/Line/Edit/sagas.js +81 -0
- package/v2Containers/Line/Edit/selectors.js +29 -0
- package/v2Containers/Line/Edit/tests/actions.test.js +18 -0
- package/v2Containers/Line/Edit/tests/index.test.js +10 -0
- package/v2Containers/Line/Edit/tests/reducer.test.js +9 -0
- package/v2Containers/Line/Edit/tests/sagas.test.js +15 -0
- package/v2Containers/Line/Edit/tests/selectors.test.js +10 -0
- package/v2Containers/Templates/_templates.scss +0 -57
- package/v2Containers/Templates/index.js +6 -59
- package/v2Containers/TemplatesV2/index.js +1 -9
- package/v2Containers/TemplatesV2/messages.js +0 -4
- package/assets/viber.png +0 -0
- package/v2Containers/Viber/_viber.scss +0 -3
- package/v2Containers/Viber/actions.js +0 -74
- package/v2Containers/Viber/constants.js +0 -30
- package/v2Containers/Viber/index.js +0 -707
- package/v2Containers/Viber/messages.js +0 -137
- package/v2Containers/Viber/reducer.js +0 -84
- package/v2Containers/Viber/sagas.js +0 -107
- package/v2Containers/Viber/selectors.js +0 -21
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Edit Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the Edit component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
"imageUploadLabel": {
|
|
10
|
+
id: 'creatives.containersV2.Line.Edit.ImageUploadLabel',
|
|
11
|
+
defaultMessage: 'Upload image',
|
|
12
|
+
},
|
|
13
|
+
"Enter template name*": {
|
|
14
|
+
id: 'creatives.containersV2.Line.Edit.enterTemplateNameImportant',
|
|
15
|
+
defaultMessage: 'Enter template name*',
|
|
16
|
+
},
|
|
17
|
+
"Enter template name": {
|
|
18
|
+
id: 'creatives.containersV2.Line.Edit.enterTemplateName',
|
|
19
|
+
defaultMessage: 'Enter template name',
|
|
20
|
+
},
|
|
21
|
+
"Template name cannot be empty": {
|
|
22
|
+
id: 'creatives.containersV2.Line.Edit.templateCantEmpty',
|
|
23
|
+
defaultMessage: 'Template name cannot be empty',
|
|
24
|
+
},
|
|
25
|
+
"Discard Changes": {
|
|
26
|
+
id: 'creatives.containersV2.Line.Edit.discardChanges',
|
|
27
|
+
defaultMessage: 'Discard changes',
|
|
28
|
+
},
|
|
29
|
+
"Cancel": {
|
|
30
|
+
id: 'creatives.containersV2.Line.Edit.cancel',
|
|
31
|
+
defaultMessage: 'Cancel',
|
|
32
|
+
},
|
|
33
|
+
"Save": {
|
|
34
|
+
id: 'creatives.containersV2.Line.Edit.save',
|
|
35
|
+
defaultMessage: 'Save',
|
|
36
|
+
},
|
|
37
|
+
"Select Line Template": {
|
|
38
|
+
id: 'creatives.containersV2.Line.Edit.selectLineTemplate',
|
|
39
|
+
defaultMessage: 'Select line template',
|
|
40
|
+
},
|
|
41
|
+
"Template": {
|
|
42
|
+
id: 'creatives.containersV2.Line.Edit.template',
|
|
43
|
+
defaultMessage: 'Template',
|
|
44
|
+
},
|
|
45
|
+
"Title*": {
|
|
46
|
+
id: 'creatives.containersV2.Line.Edit.titleLabel',
|
|
47
|
+
defaultMessage: 'Title*',
|
|
48
|
+
},
|
|
49
|
+
"Title": {
|
|
50
|
+
id: 'creatives.containersV2.Line.Edit.title',
|
|
51
|
+
defaultMessage: 'Title',
|
|
52
|
+
},
|
|
53
|
+
"Please input message title name.": {
|
|
54
|
+
id: 'creatives.containersV2.Line.Edit.titleNameInvalid',
|
|
55
|
+
defaultMessage: 'Please enter the message title',
|
|
56
|
+
},
|
|
57
|
+
"Template message has unsupported/missing tags!": {
|
|
58
|
+
id: 'creatives.containersV2.Line.Edit.messageHasUnsupportedTag',
|
|
59
|
+
defaultMessage: 'Please check the message content for unsupported/missing tags',
|
|
60
|
+
},
|
|
61
|
+
"Tags": {
|
|
62
|
+
id: 'creatives.containersV2.Line.Edit.Tags',
|
|
63
|
+
defaultMessage: 'Tags',
|
|
64
|
+
},
|
|
65
|
+
"Message*": {
|
|
66
|
+
id: 'creatives.containersV2.Line.Edit.messageLabel',
|
|
67
|
+
defaultMessage: 'Message*',
|
|
68
|
+
},
|
|
69
|
+
"Message": {
|
|
70
|
+
id: 'creatives.containersV2.Line.Edit.message',
|
|
71
|
+
defaultMessage: 'Message',
|
|
72
|
+
},
|
|
73
|
+
"Please input mobile push template content.": {
|
|
74
|
+
id: 'creatives.containersV2.Line.Edit.inputLineTemplateContent',
|
|
75
|
+
defaultMessage: 'Please enter the message content',
|
|
76
|
+
},
|
|
77
|
+
"Template title has unsupported/missing tags.": {
|
|
78
|
+
id: 'creatives.containersV2.Line.Edit.titleHasUnsupportedTag',
|
|
79
|
+
defaultMessage: 'Please check the message content for unsupported/missing tags',
|
|
80
|
+
},
|
|
81
|
+
"Template name cannot be empty.": {
|
|
82
|
+
id: 'creatives.containersV2.Line.Edit.templateNameNotEmpty',
|
|
83
|
+
defaultMessage: 'Please provide a template name ',
|
|
84
|
+
},
|
|
85
|
+
"Message title has unsupported/missing tags!": {
|
|
86
|
+
id: 'creatives.containersV2.Line.Edit.messageTitleWithUnsupportedTag',
|
|
87
|
+
defaultMessage: 'Please check the message content for unsupported/missing tags',
|
|
88
|
+
},
|
|
89
|
+
"Image": {
|
|
90
|
+
id: 'creatives.containersV2.Line.Edit.Image',
|
|
91
|
+
defaultMessage: 'Image',
|
|
92
|
+
},
|
|
93
|
+
"Max file size acceptable is 5mb": {
|
|
94
|
+
id: 'creatives.containersV2.Line.Edit.maxUploadFileSize',
|
|
95
|
+
defaultMessage: 'Max file size acceptable is 5mb',
|
|
96
|
+
},
|
|
97
|
+
"Please upload Image": {
|
|
98
|
+
id: 'creatives.containersV2.Line.Edit.pleaseUploadImage',
|
|
99
|
+
defaultMessage: 'Please upload image',
|
|
100
|
+
},
|
|
101
|
+
"Upload Image": {
|
|
102
|
+
id: 'creatives.containersV2.Line.Edit.uploadImage',
|
|
103
|
+
defaultMessage: 'Upload image',
|
|
104
|
+
},
|
|
105
|
+
"Line Template Edited Successfully": {
|
|
106
|
+
id: 'creatives.containersV2.Line.Edit.templateEditedSuccessfully',
|
|
107
|
+
defaultMessage: 'Line template edited successfully',
|
|
108
|
+
},
|
|
109
|
+
"somethingWentWrong": {
|
|
110
|
+
id: 'creatives.containersV2.Line.Edit.somethingWentWrong',
|
|
111
|
+
defaultMessage: 'Something went wrong!!',
|
|
112
|
+
},
|
|
113
|
+
"Do you really want to go back? All your temporary changes will be lost!": {
|
|
114
|
+
id: 'creatives.containersV2.Line.Edit.goBackConfirmation',
|
|
115
|
+
defaultMessage: "Going back will discard all the changes you've made. Continue?",
|
|
116
|
+
},
|
|
117
|
+
"Name and Description": {
|
|
118
|
+
id: 'creatives.containersV2.Line.Edit.nameAndDescription',
|
|
119
|
+
defaultMessage: 'Name and description',
|
|
120
|
+
},
|
|
121
|
+
"Button 1": {
|
|
122
|
+
id: 'creatives.containersV2.Line.Edit.button1',
|
|
123
|
+
defaultMessage: 'Button 1',
|
|
124
|
+
},
|
|
125
|
+
"Button 2": {
|
|
126
|
+
id: 'creatives.containersV2.Line.Edit.button2',
|
|
127
|
+
defaultMessage: 'Button 2',
|
|
128
|
+
},
|
|
129
|
+
"File size cannot be more than 5mb": {
|
|
130
|
+
id: 'creatives.containersV2.Line.Edit.uploadFileSizeError',
|
|
131
|
+
defaultMessage: 'File size cannot be more than 5mb',
|
|
132
|
+
},
|
|
133
|
+
"value cannot be empty.": {
|
|
134
|
+
id: 'creatives.containersV2.Line.Edit.valueCantEmpty',
|
|
135
|
+
defaultMessage: 'value cannot be empty.',
|
|
136
|
+
},
|
|
137
|
+
"Uploading Image...": {
|
|
138
|
+
id: 'creatives.containersV2.Line.Edit.uploadingImage',
|
|
139
|
+
defaultMessage: 'Uploading image...',
|
|
140
|
+
},
|
|
141
|
+
"Campaigns": {
|
|
142
|
+
id: 'creatives.containersV2.Line.Edit.Campaigns',
|
|
143
|
+
defaultMessage: 'Campaigns',
|
|
144
|
+
},
|
|
145
|
+
"Creatives": {
|
|
146
|
+
id: 'creatives.containersV2.Line.Edit.Creatives',
|
|
147
|
+
defaultMessage: 'Creatives',
|
|
148
|
+
},
|
|
149
|
+
"mobilePush": {
|
|
150
|
+
id: 'creatives.containersV2.Line.Edit.mobilePush',
|
|
151
|
+
defaultMessage: 'Mobile Push',
|
|
152
|
+
},
|
|
153
|
+
"templateNotConfigured": {
|
|
154
|
+
id: 'creatives.containersV2.Line.Edit.templateNotConfigured',
|
|
155
|
+
defaultMessage: 'template not configured,',
|
|
156
|
+
},
|
|
157
|
+
"alertMessage": {
|
|
158
|
+
id: 'creatives.containersV2.Line.Edit.alertMessage',
|
|
159
|
+
defaultMessage: 'Alert',
|
|
160
|
+
},
|
|
161
|
+
"androidNotConfigured": {
|
|
162
|
+
id: 'creatives.containersV2.Line.Edit.androidNotConfigured',
|
|
163
|
+
defaultMessage: 'Android template is not configured. Save without Android template',
|
|
164
|
+
},
|
|
165
|
+
"iosNotConfigured": {
|
|
166
|
+
id: 'creatives.containersV2.Line.Edit.iosNotConfigured',
|
|
167
|
+
defaultMessage: 'IOS template is not configured, Save without IOS template',
|
|
168
|
+
},
|
|
169
|
+
"goBackTemporaryChangesLost": {
|
|
170
|
+
id: 'creatives.containersV2.Line.Edit.goBackTemporaryChangesLost',
|
|
171
|
+
defaultMessage: 'Do you really want to go back? All your temporary changes will be lost!',
|
|
172
|
+
},
|
|
173
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
editTemplateInProgress: false,
|
|
12
|
+
editResponse: {},
|
|
13
|
+
getTemplateDetailsInProgress: false,
|
|
14
|
+
templateDetails: {},
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
function editReducer(state = initialState, action) {
|
|
18
|
+
switch (action.type) {
|
|
19
|
+
case types.DEFAULT_ACTION:
|
|
20
|
+
return state;
|
|
21
|
+
case types.EDIT_TEMPLATE_REQUEST:
|
|
22
|
+
return state
|
|
23
|
+
.set('editTemplateInProgress', true)
|
|
24
|
+
.set('editTemplateError', false)
|
|
25
|
+
.set('editTemplateErrorMessage', fromJS(""));
|
|
26
|
+
case types.EDIT_TEMPLATE_SUCCESS:
|
|
27
|
+
return state.set('editTemplateInProgress', false)
|
|
28
|
+
.set('editResponse', action.data)
|
|
29
|
+
.set('editTemplateError', (action.statusCode !== undefined && action.statusCode > 300))
|
|
30
|
+
.set('editTemplateErrorMessage', fromJS(action.errorMsg));
|
|
31
|
+
case types.EDIT_TEMPLATE_FAILURE:
|
|
32
|
+
return state
|
|
33
|
+
.set('editTemplateInProgress', false)
|
|
34
|
+
.set('editTemplateError', true)
|
|
35
|
+
.set('editTemplateErrorMessage', fromJS(action.errorMsg));
|
|
36
|
+
case types.GET_TEMPLATE_DETAILS_REQUEST:
|
|
37
|
+
return state.set('getTemplateDetailsInProgress', true);
|
|
38
|
+
case types.GET_TEMPLATE_DETAILS_SUCCESS:
|
|
39
|
+
case types.SET_SELECTED_TEMPLATE:
|
|
40
|
+
return state.set('getTemplateDetailsInProgress', false)
|
|
41
|
+
.set('templateDetails', action.data);
|
|
42
|
+
case types.GET_TEMPLATE_DETAILS_FAILURE:
|
|
43
|
+
return state.set('getTemplateDetailsInProgress', false);
|
|
44
|
+
case types.CLEAR_EDIT_RESPONSE_REQUEST:
|
|
45
|
+
return state.set('editResponse', {});
|
|
46
|
+
case types.UPLOAD_ASSET_REQUEST:
|
|
47
|
+
return state
|
|
48
|
+
.set('uploadAssetSuccess', false)
|
|
49
|
+
.set('assetUploading', true);
|
|
50
|
+
case types.UPLOAD_ASSET_SUCCESS:
|
|
51
|
+
return state
|
|
52
|
+
.set('uploadAssetSuccess', (action.statusCode !== undefined && action.statusCode !== '' && action.statusCode < 300))
|
|
53
|
+
.set('assetUploading', false)
|
|
54
|
+
.set('uploadedAssetData', action.data);
|
|
55
|
+
case types.UPLOAD_ASSET_FAILURE:
|
|
56
|
+
return state
|
|
57
|
+
.set('uploadAssetSuccess', false)
|
|
58
|
+
.set('assetUploading', false);
|
|
59
|
+
case types.CLEAR_DATA:
|
|
60
|
+
return state
|
|
61
|
+
.delete('uploadedAssetData')
|
|
62
|
+
.delete('metaEntities')
|
|
63
|
+
.delete('templateDetails');
|
|
64
|
+
case types.CLEAR_ASSET:
|
|
65
|
+
return state
|
|
66
|
+
.delete('uploadedAssetData');
|
|
67
|
+
case types.GET_LINE_TEMPLATES_LIST_REQUEST:
|
|
68
|
+
return state
|
|
69
|
+
.set('fetchingDefaultTemplates', true);
|
|
70
|
+
case types.GET_LINE_TEMPLATES_LIST_SUCCESS:
|
|
71
|
+
return state
|
|
72
|
+
.set('fetchingDefaultTemplates', false)
|
|
73
|
+
.set('lineTemplates', fromJS(action.data));
|
|
74
|
+
case types.GET_LINE_TEMPLATES_LIST_FAILURE:
|
|
75
|
+
return state
|
|
76
|
+
.set('fetchingDefaultTemplates', false)
|
|
77
|
+
.set('errorFetchingDefaultTempalte', true);
|
|
78
|
+
default:
|
|
79
|
+
return state;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export default editReducer;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { call, put, takeLatest, take, cancel } from 'redux-saga/effects';
|
|
2
|
+
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
3
|
+
// import { schema, normalize } from 'normalizr';
|
|
4
|
+
import * as Api from '../../../services/api';
|
|
5
|
+
import * as types from './constants';
|
|
6
|
+
|
|
7
|
+
// Individual exports for testing
|
|
8
|
+
export function* editTemplate(template) {
|
|
9
|
+
let errorMsg;
|
|
10
|
+
try {
|
|
11
|
+
console.log('saga editTemplate line', template);
|
|
12
|
+
const result = yield call(Api.createLineTemplate, template);
|
|
13
|
+
console.log('saga editTemplate success line', result);
|
|
14
|
+
if (result.message || result.status.code === 500) {
|
|
15
|
+
errorMsg = result.message;
|
|
16
|
+
}
|
|
17
|
+
yield put({ type: types.EDIT_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg });
|
|
18
|
+
} catch (error) {
|
|
19
|
+
yield put({ type: types.EDIT_TEMPLATE_FAILURE, error, errorMsg });
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function* getTemplateDetails(id) {
|
|
24
|
+
try {
|
|
25
|
+
console.log('saga get Template details line', id);
|
|
26
|
+
const result = yield call(Api.getTemplateDetails, id);
|
|
27
|
+
// const sidebar = result.response.sidebar;
|
|
28
|
+
yield put({ type: types.GET_TEMPLATE_DETAILS_SUCCESS, data: result.response });
|
|
29
|
+
} catch (error) {
|
|
30
|
+
yield put({ type: types.GET_TEMPLATE_DETAILS_FAILURE, error });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function* uploadAsset(file, assetType, fileParams, mode) {
|
|
35
|
+
try {
|
|
36
|
+
const result = yield call(Api.uploadFile, file, assetType, fileParams, mode);
|
|
37
|
+
yield put({ type: types.UPLOAD_ASSET_SUCCESS, data: result.response.asset, statusCode: result.status ? result.status.code : '' });
|
|
38
|
+
} catch (error) {
|
|
39
|
+
yield put({ type: types.UPLOAD_ASSET_FAILURE, error });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function* getLineTemplatesList(params) {
|
|
44
|
+
try {
|
|
45
|
+
console.log('Saga param line ', params.channel, params.queryParams);
|
|
46
|
+
const result = yield call(Api.getAllTemplates, {channel: params.channel, queryParams: params.queryParams});
|
|
47
|
+
yield put({ type: types.GET_LINE_TEMPLATES_LIST_SUCCESS, data: result.response.templates, templateData: result.response.mapped});
|
|
48
|
+
} catch (error) {
|
|
49
|
+
yield put({ type: types.GET_LINE_TEMPLATES_LIST_FAILURE, error });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function* watchEditTemplate() {
|
|
54
|
+
const watcher = yield takeLatest(types.EDIT_TEMPLATE_REQUEST, editTemplate);
|
|
55
|
+
yield take(LOCATION_CHANGE);
|
|
56
|
+
yield cancel(watcher);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function* watchGetTemplateDetails() {
|
|
60
|
+
const watcher = yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
|
|
61
|
+
yield take(LOCATION_CHANGE);
|
|
62
|
+
yield cancel(watcher);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function* watchUploadAsset() {
|
|
66
|
+
const watcher = yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
|
|
67
|
+
yield take(LOCATION_CHANGE);
|
|
68
|
+
yield cancel(watcher);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function* watchLineTemplatesList() {
|
|
72
|
+
const watcher = yield takeLatest(types.GET_LINE_TEMPLATES_LIST_REQUEST, getLineTemplatesList);
|
|
73
|
+
yield take(LOCATION_CHANGE);
|
|
74
|
+
yield cancel(watcher);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// All sagas to be loaded
|
|
78
|
+
export default [
|
|
79
|
+
watchEditTemplate, watchGetTemplateDetails, watchLineTemplatesList,
|
|
80
|
+
watchUploadAsset,
|
|
81
|
+
];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createSelector } from 'reselect';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Direct selector to the create state domain
|
|
5
|
+
*/
|
|
6
|
+
const selectLineEditDomain = () => (state) => state.get('edit');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Other specific selectors
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Default selector used by Create
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const makeSelectEdit = () => createSelector(
|
|
18
|
+
selectLineEditDomain(),
|
|
19
|
+
(substate) => substate.toJS()
|
|
20
|
+
);
|
|
21
|
+
const makeSelectEditResponse = () => createSelector(
|
|
22
|
+
selectLineEditDomain(), (dimensionState) => dimensionState.get('editResponse')
|
|
23
|
+
);
|
|
24
|
+
const makeSelectTemplateDetailsResponse = () => createSelector(
|
|
25
|
+
selectLineEditDomain(), (dimensionState) => dimensionState.get('templateDetails')
|
|
26
|
+
);
|
|
27
|
+
export {
|
|
28
|
+
makeSelectEdit, makeSelectEditResponse, makeSelectTemplateDetailsResponse,
|
|
29
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
import {
|
|
3
|
+
defaultAction,
|
|
4
|
+
} from '../actions';
|
|
5
|
+
import {
|
|
6
|
+
DEFAULT_ACTION,
|
|
7
|
+
} from '../constants';
|
|
8
|
+
|
|
9
|
+
describe('Create actions', () => {
|
|
10
|
+
describe('Default Action', () => {
|
|
11
|
+
it('has a type of DEFAULT_ACTION', () => {
|
|
12
|
+
const expected = {
|
|
13
|
+
type: DEFAULT_ACTION,
|
|
14
|
+
};
|
|
15
|
+
expect(defaultAction()).toEqual(expected);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test sagas
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/* eslint-disable redux-saga/yield-effects */
|
|
6
|
+
// import { take, call, put, select } from 'redux-saga/effects';
|
|
7
|
+
// import { defaultSaga } from '../sagas';
|
|
8
|
+
|
|
9
|
+
// const generator = defaultSaga();
|
|
10
|
+
|
|
11
|
+
describe('defaultSaga Saga', () => {
|
|
12
|
+
it('Expect to have unit tests specified', () => {
|
|
13
|
+
expect(true).toEqual(false);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// import { fromJS } from 'immutable';
|
|
2
|
+
// import { makeSelectCreateDomain } from '../selectors';
|
|
3
|
+
|
|
4
|
+
// const selector = makeSelectCreateDomain();
|
|
5
|
+
|
|
6
|
+
describe('makeSelectCreateDomain', () => {
|
|
7
|
+
it('Expect to have unit tests specified', () => {
|
|
8
|
+
expect(true).toEqual(false);
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -46,63 +46,6 @@
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
.VIBER {
|
|
50
|
-
&.cap-custom-card{
|
|
51
|
-
height: 241px;
|
|
52
|
-
.ant-card-body {
|
|
53
|
-
padding:0px 24px 0px;
|
|
54
|
-
.button-content {
|
|
55
|
-
.ant-card-meta-description {
|
|
56
|
-
min-width: 108px;
|
|
57
|
-
max-width: 160px;
|
|
58
|
-
height: 24px;
|
|
59
|
-
padding: 1px 23px 2px 22px;
|
|
60
|
-
border-radius: 16px;
|
|
61
|
-
font-size: 14px;
|
|
62
|
-
font-weight: 500;
|
|
63
|
-
background-color:$CAP_PURPLE01;
|
|
64
|
-
color:$CAP_WHITE;
|
|
65
|
-
text-align:center;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
.truncate-text-viber{
|
|
69
|
-
.ant-card-meta-description{
|
|
70
|
-
display: -webkit-box;
|
|
71
|
-
-webkit-line-clamp: 9;
|
|
72
|
-
-webkit-box-orient: vertical;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
.truncate-text-with-button{
|
|
76
|
-
.ant-card-meta-description{
|
|
77
|
-
-webkit-line-clamp: 8;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
.truncate-text-with-image{
|
|
81
|
-
.ant-card-meta-description{
|
|
82
|
-
-webkit-line-clamp: 2;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
&.no-image .ant-card-meta {
|
|
89
|
-
.ant-card-meta-description {
|
|
90
|
-
word-wrap: break-word;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
&.carousel-img-section {
|
|
96
|
-
.ant-card-body {
|
|
97
|
-
padding: $CAP_SPACE_24 0;
|
|
98
|
-
}
|
|
99
|
-
.ant-card-meta {
|
|
100
|
-
padding: 0;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
}
|
|
106
49
|
}
|
|
107
50
|
}
|
|
108
51
|
|
|
@@ -30,7 +30,6 @@ 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
32
|
import { makeSelectLine } from '../Line/Container/selectors';
|
|
33
|
-
import { makeSelectViber } from '../Viber/selectors';
|
|
34
33
|
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
35
34
|
import messages from './messages';
|
|
36
35
|
import {checkUnicode} from '../../utils/smsCharCountV2';
|
|
@@ -41,8 +40,6 @@ import * as smsEditActions from '../Sms/Edit/actions';
|
|
|
41
40
|
import * as ebillActions from '../Ebill/actions';
|
|
42
41
|
import * as emailActions from '../Email/actions';
|
|
43
42
|
import * as lineActions from '../Line/Container/actions';
|
|
44
|
-
import * as viberActions from '../Viber/actions';
|
|
45
|
-
|
|
46
43
|
import CardGrid from '../../v2Components/CardGrid';
|
|
47
44
|
import config from '../../config/app';
|
|
48
45
|
import './_templates.scss';
|
|
@@ -53,13 +50,8 @@ import Pagination from '../../v2Components/Pagination';
|
|
|
53
50
|
import EmailPreview from '../../v2Components/EmailPreview';
|
|
54
51
|
import CreativesContainer from '../CreativesContainer';
|
|
55
52
|
import WechatRichmediaTemplatePreview from '../../v2Components/TemplatePreview/WechatRichmediaTemplatePreview';
|
|
56
|
-
import {
|
|
57
|
-
|
|
58
|
-
CHANNEL_EDIT_TRACK_MAPPING,
|
|
59
|
-
VIBER as VIBER_CHANNEL,
|
|
60
|
-
} from '../App/constants';
|
|
61
|
-
import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE, VIBER } from '../CreativesContainer/constants';
|
|
62
|
-
|
|
53
|
+
import { CHANNEL_CREATE_TRACK_MAPPING, CHANNEL_EDIT_TRACK_MAPPING } from '../App/constants';
|
|
54
|
+
import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE } from '../CreativesContainer/constants';
|
|
63
55
|
import emailIllustration from '../Assets/images/emailIllustration.svg';
|
|
64
56
|
import smsIllustration from '../Assets/images/smsIllustration.svg';
|
|
65
57
|
import pushIllustration from '../Assets/images/pushIllustration.svg';
|
|
@@ -169,9 +161,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
169
161
|
case EBILL:
|
|
170
162
|
channel = 'Ebill';
|
|
171
163
|
break;
|
|
172
|
-
case VIBER:
|
|
173
|
-
channel = 'Viber';
|
|
174
|
-
break;
|
|
175
164
|
case LINE:
|
|
176
165
|
channel = "Line";
|
|
177
166
|
if (!this.props.isFullMode) {
|
|
@@ -196,7 +185,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
196
185
|
if (this.props.location.query.type === 'embedded') {
|
|
197
186
|
this.props.actions.resetAccount();
|
|
198
187
|
}
|
|
199
|
-
if ((
|
|
188
|
+
if ((this.state.channel && (this.state.channel.toLowerCase() === 'line' || this.state.channel.toLowerCase() === 'sms' || this.state.channel.toLowerCase() === 'email' || this.state.channel.toLowerCase() === 'ebill')) || ((this.state.channel.toLowerCase() === 'wechat' || this.state.channel.toLowerCase() === 'mobilepush') && !isEmpty(this.props.Templates.selectedWeChatAccount))) {
|
|
200
189
|
const queryParams = {
|
|
201
190
|
// name: this.state.searchText,
|
|
202
191
|
// sortBy: this.state.sortBy,
|
|
@@ -256,12 +245,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
256
245
|
this.setState({defaultAccount: true});
|
|
257
246
|
nextProps.actions.getWeCrmAccounts(channel);
|
|
258
247
|
}
|
|
259
|
-
} else if (nextProps.route.name.toLowerCase() === VIBER_CHANNEL) {
|
|
260
|
-
channel = 'Viber';
|
|
261
248
|
}
|
|
262
|
-
|
|
263
249
|
this.setState({ channel }, () => {
|
|
264
|
-
if (
|
|
250
|
+
if ((this.state.channel.toLowerCase() === 'line' || this.state.channel.toLowerCase() === 'sms' || this.state.channel.toLowerCase() === 'email' || this.state.channel.toLowerCase() === 'ebill') || (this.state.channel.toLowerCase() === 'wechat' && !isEmpty(nextProps.Templates.selectedWeChatAccount))) {
|
|
265
251
|
if (this.state.channel.toLowerCase() === 'wechat' && !isEmpty(nextProps.Templates.selectedWeChatAccount)) {
|
|
266
252
|
params.wecrmId = (nextProps.Templates.selectedWeChatAccount.configs || {}).wecrm_app_id;
|
|
267
253
|
params.wecrmToken = (nextProps.Templates.selectedWeChatAccount.configs || {}).wecrm_token;
|
|
@@ -350,8 +336,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
350
336
|
this.props.ebillActions.clearCreateResponse();
|
|
351
337
|
} else if (this.state.channel.toLowerCase() === "line") {
|
|
352
338
|
this.props.lineActions.clearCreateResponse();
|
|
353
|
-
} else if (this.state.channel.toLowerCase() === VIBER_CHANNEL) {
|
|
354
|
-
this.props.viberActions.clearCreateResponse();
|
|
355
339
|
}
|
|
356
340
|
}
|
|
357
341
|
}
|
|
@@ -667,7 +651,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
667
651
|
<video height="279">
|
|
668
652
|
<source src={originalVideoContentUrl} type="video/mp4" />
|
|
669
653
|
</video>
|
|
670
|
-
)
|
|
654
|
+
)
|
|
671
655
|
}
|
|
672
656
|
if (carouselTemplate) {
|
|
673
657
|
const carouselContent = get(carouselTemplate, 'columns', [{}]).map(({ imageUrl, action: { label: actionLabel } = {} }) => ({ imageUrl, actionLabel }) );
|
|
@@ -693,26 +677,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
693
677
|
}
|
|
694
678
|
break;
|
|
695
679
|
}
|
|
696
|
-
case VIBER: {
|
|
697
|
-
const {
|
|
698
|
-
content: {
|
|
699
|
-
viber: {
|
|
700
|
-
text = '',
|
|
701
|
-
imageURL = '',
|
|
702
|
-
buttonURL = '',
|
|
703
|
-
buttonText = '',
|
|
704
|
-
} = {},
|
|
705
|
-
} = {},
|
|
706
|
-
} = template.versions.base;
|
|
707
|
-
templateData.content = text;
|
|
708
|
-
if (imageURL) {
|
|
709
|
-
templateData.url = imageURL;
|
|
710
|
-
}
|
|
711
|
-
if (buttonURL && buttonText) {
|
|
712
|
-
templateData.buttonText = buttonText;
|
|
713
|
-
}
|
|
714
|
-
break;
|
|
715
|
-
}
|
|
716
680
|
default:
|
|
717
681
|
templateData.content = "";
|
|
718
682
|
}
|
|
@@ -1210,15 +1174,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1210
1174
|
this.props.lineActions.clearCreateResponse();
|
|
1211
1175
|
}
|
|
1212
1176
|
});
|
|
1213
|
-
} else if (this.state.channel.toLowerCase() === VIBER_CHANNEL) {
|
|
1214
|
-
this.props.viberActions.createTemplate(duplicateObj, (response) => {
|
|
1215
|
-
if (response && response.templateId) {
|
|
1216
|
-
const message = `${this.state.channel} ${this.props.intl.formatMessage(messages.templateDuplicateSuccess)}`;
|
|
1217
|
-
CapNotification.success({key: 'duplicateSucess', message});
|
|
1218
|
-
this.getAllTemplates({params, resetPage: true});
|
|
1219
|
-
this.props.viberActions.clearCreateResponse();
|
|
1220
|
-
}
|
|
1221
|
-
});
|
|
1222
1177
|
}
|
|
1223
1178
|
}
|
|
1224
1179
|
|
|
@@ -1300,9 +1255,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1300
1255
|
pathName += `/${options.account}`;
|
|
1301
1256
|
}
|
|
1302
1257
|
}
|
|
1303
|
-
if (this.state.channel.toLowerCase() === VIBER_CHANNEL) {
|
|
1304
|
-
pathName = `/viber/edit/${id}/`;
|
|
1305
|
-
}
|
|
1306
1258
|
if (this.state.channel.toUpperCase() === WECHAT) {
|
|
1307
1259
|
if (get(template, 'definition.msgcontent', '') === "RICH_MEDIA_WECHAT") {
|
|
1308
1260
|
pathName = `/wechat/richmedia/edit/${id}`;
|
|
@@ -1601,7 +1553,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1601
1553
|
} = Templates;
|
|
1602
1554
|
const lineLoader = (getAllTemplatesInProgress && this.state.channel.toLowerCase() === 'line');
|
|
1603
1555
|
const smsLoader = (getAllTemplatesInProgress && this.state.channel.toLowerCase() === 'sms');
|
|
1604
|
-
const viberLoader = (getAllTemplatesInProgress && this.state.channel.toLowerCase() === VIBER_CHANNEL);
|
|
1605
1556
|
const wechatLoader = (((this.state.selectedAccount !== '' && getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === 'wechat');
|
|
1606
1557
|
const mobilePushLoader = (((getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === 'mobilepush');
|
|
1607
1558
|
const emailLoader = (
|
|
@@ -1615,8 +1566,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1615
1566
|
(emailLoader !== undefined ? emailLoader : false) ||
|
|
1616
1567
|
(ebillLoader !== undefined ? ebillLoader : false) ||
|
|
1617
1568
|
(mobilePushLoader !== undefined ? mobilePushLoader : false) ||
|
|
1618
|
-
(lineLoader !== undefined ? lineLoader : false)
|
|
1619
|
-
(viberLoader !== undefined ? viberLoader : false);
|
|
1569
|
+
(lineLoader !== undefined ? lineLoader : false);
|
|
1620
1570
|
return isLoading;
|
|
1621
1571
|
}
|
|
1622
1572
|
getChannelTypeIllustrationInfo = (type) => {
|
|
@@ -2027,7 +1977,6 @@ Templates.propTypes = {
|
|
|
2027
1977
|
isFullMode: PropTypes.bool,
|
|
2028
1978
|
handlePeviewTemplate: PropTypes.func,
|
|
2029
1979
|
router: PropTypes.object,
|
|
2030
|
-
viberActions: PropTypes.object,
|
|
2031
1980
|
};
|
|
2032
1981
|
|
|
2033
1982
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -2040,7 +1989,6 @@ const mapStateToProps = createStructuredSelector({
|
|
|
2040
1989
|
EmailCreate: makeSelectCreateEmail(),
|
|
2041
1990
|
Global: makeSelectAuthenticated(),
|
|
2042
1991
|
Line: makeSelectLine(),
|
|
2043
|
-
Viber: makeSelectViber(),
|
|
2044
1992
|
});
|
|
2045
1993
|
|
|
2046
1994
|
function mapDispatchToProps(dispatch) {
|
|
@@ -2053,7 +2001,6 @@ function mapDispatchToProps(dispatch) {
|
|
|
2053
2001
|
emailActions: bindActionCreators(emailActions, dispatch),
|
|
2054
2002
|
globalActions: bindActionCreators(globalActions, dispatch),
|
|
2055
2003
|
lineActions: bindActionCreators(lineActions, dispatch),
|
|
2056
|
-
viberActions: bindActionCreators(viberActions, dispatch),
|
|
2057
2004
|
};
|
|
2058
2005
|
}
|
|
2059
2006
|
|