@capillarytech/creatives-library 7.6.12 → 7.6.13
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 +5 -0
- package/index.html +2 -2
- package/package.json +2 -2
- package/services/api.js +2 -0
- package/utils/gtmTrackers/gtmEvents/creativeDetails.js +41 -0
- package/utils/gtmTrackers/index.js +17 -0
- package/v2Components/TemplatePreview/assets/images/mobile.svg +24 -0
- package/v2Containers/App/constants.js +11 -0
- package/v2Containers/Cap/index.js +23 -29
- package/v2Containers/Email/index.js +14 -3
- package/v2Containers/EmailWrapper/index.js +10 -3
- package/v2Containers/Line/Container/index.js +32 -4
- 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 +1132 -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/MobilePush/Create/index.js +25 -4
- package/v2Containers/MobilePush/Edit/index.js +27 -5
- package/v2Containers/MobilePush/Edit/sagas.js +1 -1
- package/v2Containers/MobilePush/commonMethods.js +19 -1
- package/v2Containers/Sms/Create/index.js +14 -2
- package/v2Containers/Sms/Edit/index.js +15 -2
- package/v2Containers/Templates/index.js +7 -4
- package/v2Containers/Viber/index.js +19 -3
- package/v2Containers/WeChat/MapTemplates/index.js +12 -3
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +11 -2
|
@@ -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
|
+
});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
7
|
+
import PropTypes, { object } from 'prop-types';
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { bindActionCreators } from 'redux';
|
|
@@ -22,11 +22,15 @@ import * as actions from './actions';
|
|
|
22
22
|
import withCreatives from '../../../hoc/withCreatives';
|
|
23
23
|
|
|
24
24
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
25
|
+
import { gtmPush } from '../../../utils/gtmTrackers';
|
|
26
|
+
|
|
25
27
|
import { makeSelectTemplates } from '../../Templates/selectors';
|
|
26
28
|
import messages from './messages';
|
|
27
29
|
import getEventsMap from '../eventsMap';
|
|
28
30
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
29
|
-
import { TRACK_CREATE_MPUSH } from '../../App/constants';
|
|
31
|
+
import { CREATE, TRACK_CREATE_MPUSH } from '../../App/constants';
|
|
32
|
+
import { MOBILE_PUSH } from '../../CreativesContainer/constants';
|
|
33
|
+
import { getContent } from '../commonMethods';
|
|
30
34
|
|
|
31
35
|
const PrefixWrapper = styled.div`
|
|
32
36
|
margin-right: 16px;
|
|
@@ -1401,16 +1405,33 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1401
1405
|
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, eventsMap, isSchemaChanged: true});
|
|
1402
1406
|
this.injectEvents(schema);
|
|
1403
1407
|
};
|
|
1408
|
+
|
|
1404
1409
|
saveFormData = (formData) => {
|
|
1405
1410
|
//this function gets called from form bulder only when the form data is valid
|
|
1406
1411
|
const obj = this.getTransformedData(formData);
|
|
1412
|
+
const content = getContent(obj);
|
|
1413
|
+
const {
|
|
1414
|
+
definition: {
|
|
1415
|
+
mode: definitionMode
|
|
1416
|
+
}
|
|
1417
|
+
} = obj || {};
|
|
1407
1418
|
const label = this.props.location.pathname.indexOf('image') >= 0 ? 'image' : 'text';
|
|
1408
|
-
this.props.actions.createTemplate(obj, () => {
|
|
1409
|
-
GA.timeTracker.stopTimer(TRACK_CREATE_MPUSH, {
|
|
1419
|
+
this.props.actions.createTemplate(obj, (response) => {
|
|
1420
|
+
const timeTaken = GA.timeTracker.stopTimer(TRACK_CREATE_MPUSH, {
|
|
1410
1421
|
category: 'Creatives',
|
|
1411
1422
|
action: TRACK_CREATE_MPUSH,
|
|
1412
1423
|
label,
|
|
1413
1424
|
});
|
|
1425
|
+
gtmPush('creativeDetails', {
|
|
1426
|
+
id: response.templateId,
|
|
1427
|
+
name: obj.name,
|
|
1428
|
+
channel: MOBILE_PUSH,
|
|
1429
|
+
timeTaken,
|
|
1430
|
+
content,
|
|
1431
|
+
mode: CREATE,
|
|
1432
|
+
imageAdded: definitionMode === 'image'
|
|
1433
|
+
});
|
|
1434
|
+
|
|
1414
1435
|
this.discardValues();
|
|
1415
1436
|
const message = this.props.intl.formatMessage(messages.messageCreateSuccess);
|
|
1416
1437
|
CapNotification.success({message, key: 'createMpushSuccess'});
|
|
@@ -26,11 +26,13 @@ import messages from './messages';
|
|
|
26
26
|
import './_mobilePushCreate.scss';
|
|
27
27
|
import {makeSelectCreate} from "../Create/selectors";
|
|
28
28
|
import withCreatives from '../../../hoc/withCreatives';
|
|
29
|
+
import { gtmPush } from '../../../utils/gtmTrackers';
|
|
29
30
|
|
|
30
31
|
import getEventsMap from '../eventsMap';
|
|
31
|
-
import {getPrimaryCtaFields, getSecondaryCtaFields, getLinkTypeFields} from '../commonMethods';
|
|
32
|
+
import {getPrimaryCtaFields, getSecondaryCtaFields, getLinkTypeFields, getContent} from '../commonMethods';
|
|
32
33
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
33
|
-
import { TRACK_EDIT_MPUSH } from '../../App/constants';
|
|
34
|
+
import { EDIT, TRACK_EDIT_MPUSH } from '../../App/constants';
|
|
35
|
+
import { MOBILE_PUSH } from '../../CreativesContainer/constants';
|
|
34
36
|
|
|
35
37
|
const PrefixWrapper = styled.div`
|
|
36
38
|
margin-right: 16px;
|
|
@@ -271,14 +273,34 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
271
273
|
this.setState({modalContent: {...this.state.modalContent, show: false}});
|
|
272
274
|
}
|
|
273
275
|
};
|
|
274
|
-
onUpdateTemplateComplete = () => {
|
|
275
|
-
|
|
276
|
+
onUpdateTemplateComplete = (response) => {
|
|
277
|
+
const obj = this.getTransformedData(this.state.formData);
|
|
278
|
+
const content = getContent(obj);
|
|
279
|
+
const {
|
|
280
|
+
definition: {
|
|
281
|
+
mode: definitionMode
|
|
282
|
+
}
|
|
283
|
+
} = obj || {};
|
|
276
284
|
const label = this.props.location.pathname.indexOf('image') >= 0 ? 'image' : 'text';
|
|
277
|
-
GA.timeTracker.stopTimer(TRACK_EDIT_MPUSH, {
|
|
285
|
+
const timeTaken = GA.timeTracker.stopTimer(TRACK_EDIT_MPUSH, {
|
|
278
286
|
category: 'Creatives',
|
|
279
287
|
action: TRACK_EDIT_MPUSH,
|
|
280
288
|
label,
|
|
281
289
|
});
|
|
290
|
+
try {
|
|
291
|
+
gtmPush('creativeDetails', {
|
|
292
|
+
id: response.templateId,
|
|
293
|
+
name: obj.name,
|
|
294
|
+
channel: MOBILE_PUSH,
|
|
295
|
+
timeTaken,
|
|
296
|
+
content,
|
|
297
|
+
mode: EDIT,
|
|
298
|
+
imageAdded: definitionMode === 'image'
|
|
299
|
+
})
|
|
300
|
+
} catch(e) {
|
|
301
|
+
console.log(e);
|
|
302
|
+
}
|
|
303
|
+
|
|
282
304
|
this.resetSchema();
|
|
283
305
|
this.setState({
|
|
284
306
|
formData: {},
|
|
@@ -15,7 +15,7 @@ export function* editTemplate(template) {
|
|
|
15
15
|
errorMsg = result.message;
|
|
16
16
|
}
|
|
17
17
|
yield put({ type: types.EDIT_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg });
|
|
18
|
-
yield call(template.callback);
|
|
18
|
+
yield call(template.callback, {templateId: result?.response?.templateId._id});
|
|
19
19
|
} catch (error) {
|
|
20
20
|
yield put({ type: types.EDIT_TEMPLATE_FAILURE, error, errorMsg });
|
|
21
21
|
}
|
|
@@ -246,6 +246,24 @@ function getLinkTypeFields({inputFieldsArgs, fieldIndex, deepLinkOptions, formDa
|
|
|
246
246
|
}
|
|
247
247
|
return inputFields;
|
|
248
248
|
}
|
|
249
|
+
|
|
250
|
+
function getContent(obj) {
|
|
251
|
+
const {
|
|
252
|
+
versions : {
|
|
253
|
+
base: {
|
|
254
|
+
ANDROID: {
|
|
255
|
+
title : androidTitle,
|
|
256
|
+
message : androidMessage
|
|
257
|
+
} = {},
|
|
258
|
+
IOS: {
|
|
259
|
+
title: iosTitle,
|
|
260
|
+
message: iosMessage
|
|
261
|
+
} = {}
|
|
262
|
+
} = {}
|
|
263
|
+
} = {}
|
|
264
|
+
} = obj;
|
|
265
|
+
return `${androidTitle} ${androidMessage} ${iosTitle} ${iosMessage}`;
|
|
266
|
+
}
|
|
249
267
|
export {
|
|
250
|
-
getPrimaryCtaFields, getSecondaryCtaFields, getLinkTypeFields,
|
|
268
|
+
getPrimaryCtaFields, getSecondaryCtaFields, getLinkTypeFields, getContent
|
|
251
269
|
};
|
|
@@ -21,13 +21,14 @@ import messages from './messages';
|
|
|
21
21
|
import * as charCount from '../../../utils/smsCharCount';
|
|
22
22
|
import {checkUnicode, updateCharCount} from '../../../utils/smsCharCountV2';
|
|
23
23
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
24
|
+
import { gtmPush } from '../../../utils/gtmTrackers';
|
|
24
25
|
import * as creativesContainerActions from '../../CreativesContainer/actions';
|
|
25
26
|
import {SMS} from '../../CreativesContainer/constants';
|
|
26
27
|
// import callNativeEvent from '../../../utils/callNativeEvent';
|
|
27
28
|
import {showError} from '../commonMethods';
|
|
28
29
|
import withCreatives from '../../../hoc/withCreatives';
|
|
29
30
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
30
|
-
import { TRACK_CREATE_SMS } from '../../App/constants';
|
|
31
|
+
import { CREATE, TRACK_CREATE_SMS } from '../../App/constants';
|
|
31
32
|
export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
32
33
|
constructor(props) {
|
|
33
34
|
super(props);
|
|
@@ -203,11 +204,22 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
203
204
|
this.setState({currentTab: data});
|
|
204
205
|
}
|
|
205
206
|
onCreateTemplateComplete = (editResponse) => {
|
|
206
|
-
GA.timeTracker.stopTimer(TRACK_CREATE_SMS, {
|
|
207
|
+
const timeTaken = GA.timeTracker.stopTimer(TRACK_CREATE_SMS, {
|
|
207
208
|
category: 'Creatives',
|
|
208
209
|
action: TRACK_CREATE_SMS,
|
|
209
210
|
});
|
|
211
|
+
const {
|
|
212
|
+
formData
|
|
213
|
+
} = this.state;
|
|
210
214
|
if (editResponse.templateId) {
|
|
215
|
+
gtmPush('creativeDetails', {
|
|
216
|
+
id: editResponse.templateId,
|
|
217
|
+
name: formData?.['template-name'],
|
|
218
|
+
channel: SMS,
|
|
219
|
+
timeTaken,
|
|
220
|
+
content: formData?.base?.['sms-editor'],
|
|
221
|
+
mode: CREATE
|
|
222
|
+
});
|
|
211
223
|
this.resetSchema();
|
|
212
224
|
this.setState({
|
|
213
225
|
formData: {},
|
|
@@ -21,12 +21,14 @@ import {checkUnicode, updateCharCount} from '../../../utils/smsCharCountV2';
|
|
|
21
21
|
import '../Create/_smsCreate.scss';
|
|
22
22
|
import messages from './messages';
|
|
23
23
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
24
|
+
import { gtmPush } from '../../../utils/gtmTrackers';
|
|
24
25
|
import * as creativesContainerActions from '../../CreativesContainer/actions';
|
|
25
26
|
// import callNativeEvent from '../../../utils/callNativeEvent';
|
|
26
27
|
import {showError} from '../commonMethods';
|
|
27
28
|
import withCreatives from '../../../hoc/withCreatives';
|
|
28
|
-
import { TRACK_EDIT_SMS } from '../../App/constants';
|
|
29
|
+
import { EDIT, TRACK_EDIT_SMS } from '../../App/constants';
|
|
29
30
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
31
|
+
import { SMS } from '../../CreativesContainer/constants';
|
|
30
32
|
export class Edit extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
31
33
|
constructor(props) {
|
|
32
34
|
super(props);
|
|
@@ -220,11 +222,22 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
220
222
|
this.setState({currentTab: data});
|
|
221
223
|
}
|
|
222
224
|
onUpdateTemplateComplete = (editResponse) => {
|
|
223
|
-
GA.timeTracker.stopTimer(TRACK_EDIT_SMS, {
|
|
225
|
+
const timeTaken = GA.timeTracker.stopTimer(TRACK_EDIT_SMS, {
|
|
224
226
|
category: 'Creatives',
|
|
225
227
|
action: TRACK_EDIT_SMS,
|
|
226
228
|
});
|
|
229
|
+
const {
|
|
230
|
+
formData
|
|
231
|
+
} = this.state;
|
|
227
232
|
if (editResponse.templateId) {
|
|
233
|
+
gtmPush('creativeDetails', {
|
|
234
|
+
id: editResponse.templateId,
|
|
235
|
+
name: formData?.['template-name'],
|
|
236
|
+
channel: SMS,
|
|
237
|
+
timeTaken,
|
|
238
|
+
content: formData?.base?.['sms-editor'],
|
|
239
|
+
mode: EDIT
|
|
240
|
+
})
|
|
228
241
|
this.resetSchema();
|
|
229
242
|
this.setState({
|
|
230
243
|
formData: {},
|