@capillarytech/creatives-library 6.15.2 → 7.0.0
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 +1 -1
- package/assets/viber.png +0 -0
- package/package.json +1 -1
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +151 -151
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +33 -33
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/tests/index.test.js +10 -10
- package/v2Components/TemplatePreview/assets/images/androidPushMessage.svg +44 -44
- package/v2Components/TemplatePreview/assets/images/home-screen-android.svg +21 -21
- package/v2Components/TemplatePreview/assets/images/home-screen-ios.svg +16 -16
- package/v2Components/TemplatePreview/assets/images/iPhonePushMessage.svg +134 -134
- package/v2Components/TemplatePreview/assets/images/mobile.svg +23 -23
- package/v2Components/TemplatePreview/assets/images/sms_mobile_android.svg +22 -22
- package/v2Components/TemplatePreview/assets/images/user-icon.svg +18 -18
- package/v2Components/TemplatePreview/assets/images/wechat-home-screen-android.svg +21 -21
- package/v2Components/TemplatePreview/assets/images/wechat-mobile.svg +77 -77
- package/v2Components/TemplatePreview/assets/images/wechat_mobile_android.svg +20 -20
- package/v2Components/TemplatePreview/tests/index.test.js +10 -10
- package/v2Containers/CreativesContainer/actions.js +27 -27
- package/v2Containers/CreativesContainer/index.scss +44 -44
- package/v2Containers/CreativesContainer/messages.js +305 -305
- package/v2Containers/CreativesContainer/reducer.js +29 -29
- package/v2Containers/CreativesContainer/sagas.js +11 -11
- package/v2Containers/CreativesContainer/selectors.js +30 -30
- package/v2Containers/CreativesContainer/tests/actions.test.js +18 -18
- package/v2Containers/CreativesContainer/tests/index.test.js +10 -10
- package/v2Containers/CreativesContainer/tests/reducer.test.js +9 -9
- package/v2Containers/CreativesContainer/tests/sagas.test.js +15 -15
- package/v2Containers/CreativesContainer/tests/selectors.test.js +10 -10
- package/v2Containers/Email/index.js +1 -1
- package/v2Containers/Templates/tests/actions.test.js +18 -18
- package/v2Containers/Templates/tests/index.test.js +10 -10
- package/v2Containers/Templates/tests/reducer.test.js +9 -9
- package/v2Containers/Templates/tests/sagas.test.js +15 -15
- package/v2Containers/Templates/tests/selectors.test.js +10 -10
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +29 -29
- package/v2Containers/TemplatesV2/actions.js +16 -16
- package/v2Containers/TemplatesV2/constants.js +10 -10
- package/v2Containers/TemplatesV2/selectors.js +25 -25
- package/v2Containers/TemplatesV2/tests/actions.test.js +18 -18
- package/v2Containers/TemplatesV2/tests/index.test.js +10 -10
- package/v2Containers/TemplatesV2/tests/reducer.test.js +9 -9
- package/v2Containers/TemplatesV2/tests/sagas.test.js +15 -15
- package/v2Containers/TemplatesV2/tests/selectors.test.js +10 -10
- package/v2Containers/Viber/_viber.scss +3 -0
- package/v2Containers/Viber/actions.js +74 -0
- package/v2Containers/Viber/constants.js +30 -0
- package/v2Containers/Viber/index.js +707 -0
- package/v2Containers/Viber/messages.js +137 -0
- package/v2Containers/Viber/reducer.js +84 -0
- package/v2Containers/Viber/sagas.js +107 -0
- package/v2Containers/Viber/selectors.js +21 -0
- package/v2Components/BeeEditor/index.js +0 -263
- package/v2Components/BeeEditor/index.scss +0 -11
- package/v2Components/BeeEditor/messages.js +0 -71
- package/v2Components/BeeEditor/tests/index.test.js +0 -10
- package/v2Containers/Line/Create/_lineCreate.scss +0 -64
- package/v2Containers/Line/Create/actions.js +0 -94
- package/v2Containers/Line/Create/constants.js +0 -43
- package/v2Containers/Line/Create/index.js +0 -1132
- package/v2Containers/Line/Create/initialSchema.js +0 -378
- package/v2Containers/Line/Create/messages.js +0 -229
- package/v2Containers/Line/Create/reducer.js +0 -99
- package/v2Containers/Line/Create/sagas.js +0 -113
- package/v2Containers/Line/Create/selectors.js +0 -30
- package/v2Containers/Line/CreateWrapper/constants.js +0 -2
- package/v2Containers/Line/CreateWrapper/index.js +0 -117
- package/v2Containers/Line/CreateWrapper/messages.js +0 -55
- package/v2Containers/Line/Edit/_lineEdit.scss +0 -23
- package/v2Containers/Line/Edit/actions.js +0 -79
- package/v2Containers/Line/Edit/constants.js +0 -27
- package/v2Containers/Line/Edit/index.js +0 -1051
- package/v2Containers/Line/Edit/messages.js +0 -173
- package/v2Containers/Line/Edit/reducer.js +0 -83
- package/v2Containers/Line/Edit/sagas.js +0 -81
- package/v2Containers/Line/Edit/selectors.js +0 -29
- package/v2Containers/Line/Edit/tests/actions.test.js +0 -18
- package/v2Containers/Line/Edit/tests/index.test.js +0 -10
- package/v2Containers/Line/Edit/tests/reducer.test.js +0 -9
- package/v2Containers/Line/Edit/tests/sagas.test.js +0 -15
- package/v2Containers/Line/Edit/tests/selectors.test.js +0 -10
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl';
|
|
2
|
+
const scope = `creatives.containersV2.viber`;
|
|
3
|
+
|
|
4
|
+
export default defineMessages({
|
|
5
|
+
search: {
|
|
6
|
+
id: `${scope}.search`,
|
|
7
|
+
defaultMessage: 'Search',
|
|
8
|
+
},
|
|
9
|
+
gettingAllTemplates: {
|
|
10
|
+
id: `${scope}.gettingAllTemplates`,
|
|
11
|
+
defaultMessage: "Getting all templates...",
|
|
12
|
+
},
|
|
13
|
+
viberCreativeTitle: {
|
|
14
|
+
id: `${scope}.viberCreativeTitle`,
|
|
15
|
+
defaultMessage: "Viber creative",
|
|
16
|
+
},
|
|
17
|
+
viberCreativeDesc: {
|
|
18
|
+
id: `${scope}.viberCreativeDesc`,
|
|
19
|
+
defaultMessage: "Select any of the existing templates or create new",
|
|
20
|
+
},
|
|
21
|
+
message: {
|
|
22
|
+
id: `${scope}.message`,
|
|
23
|
+
defaultMessage: 'Message',
|
|
24
|
+
},
|
|
25
|
+
textMessage: {
|
|
26
|
+
id: `${scope}.textMessage`,
|
|
27
|
+
defaultMessage: 'Text message',
|
|
28
|
+
},
|
|
29
|
+
characters: {
|
|
30
|
+
id: `${scope}.characters`,
|
|
31
|
+
defaultMessage: 'characters',
|
|
32
|
+
},
|
|
33
|
+
addLabels: {
|
|
34
|
+
id: `${scope}.addLabels`,
|
|
35
|
+
defaultMessage: 'Add labels',
|
|
36
|
+
},
|
|
37
|
+
image: {
|
|
38
|
+
id: `${scope}.image`,
|
|
39
|
+
defaultMessage: 'Image',
|
|
40
|
+
},
|
|
41
|
+
button: {
|
|
42
|
+
id: `${scope}.button`,
|
|
43
|
+
defaultMessage: 'Button',
|
|
44
|
+
},
|
|
45
|
+
buttonText: {
|
|
46
|
+
id: `${scope}.buttonText`,
|
|
47
|
+
defaultMessage: 'Button text',
|
|
48
|
+
},
|
|
49
|
+
buttonUrl: {
|
|
50
|
+
id: `${scope}.buttonUrl`,
|
|
51
|
+
defaultMessage: 'Button url',
|
|
52
|
+
},
|
|
53
|
+
uploadImage: {
|
|
54
|
+
id: `${scope}.uploadImage`,
|
|
55
|
+
defaultMessage: 'Upload Image',
|
|
56
|
+
},
|
|
57
|
+
imageDesc: {
|
|
58
|
+
id: `${scope}.imageDesc`,
|
|
59
|
+
defaultMessage: 'The relevant image that complements the message context.',
|
|
60
|
+
},
|
|
61
|
+
uploadGallery: {
|
|
62
|
+
id: `${scope}.uploadGallery`,
|
|
63
|
+
defaultMessage: 'Gallery',
|
|
64
|
+
},
|
|
65
|
+
uploadComputer: {
|
|
66
|
+
id: `${scope}.uploadComputer`,
|
|
67
|
+
defaultMessage: 'Your computer',
|
|
68
|
+
},
|
|
69
|
+
or: {
|
|
70
|
+
id: `${scope}.or`,
|
|
71
|
+
defaultMessage: 'OR',
|
|
72
|
+
},
|
|
73
|
+
dragAndDrop: {
|
|
74
|
+
id: `${scope}.dragAndDrop`,
|
|
75
|
+
defaultMessage: 'Drag and drop image here',
|
|
76
|
+
},
|
|
77
|
+
uploadImageDescription: {
|
|
78
|
+
id: `${scope}.uploadImageDescription`,
|
|
79
|
+
defaultMessage: 'The relevant image that complements the message context.',
|
|
80
|
+
},
|
|
81
|
+
imageReUpload: {
|
|
82
|
+
id: `${scope}.imageReUpload`,
|
|
83
|
+
defaultMessage: 'Re upload',
|
|
84
|
+
},
|
|
85
|
+
imageDimenstionDescription: {
|
|
86
|
+
id: `${scope}.imageDimenstionDescription`,
|
|
87
|
+
defaultMessage: 'Dimensions: 300px x 400px',
|
|
88
|
+
},
|
|
89
|
+
imageSizeDescription: {
|
|
90
|
+
id: `${scope}.imageSizeDescription`,
|
|
91
|
+
defaultMessage: ' Size: 10mb',
|
|
92
|
+
},
|
|
93
|
+
doneButtonLabel: {
|
|
94
|
+
id: `${scope}.doneButtonLabel`,
|
|
95
|
+
defaultMessage: 'Done',
|
|
96
|
+
},
|
|
97
|
+
cancelButtonLabel: {
|
|
98
|
+
id: `${scope}.cancelButtonLabel`,
|
|
99
|
+
defaultMessage: 'Cancel',
|
|
100
|
+
},
|
|
101
|
+
imageGallery: {
|
|
102
|
+
id: `${scope}.imageGallery`,
|
|
103
|
+
defaultMessage: 'Gallery',
|
|
104
|
+
},
|
|
105
|
+
emptyContentErrorMessage: {
|
|
106
|
+
id: `${scope}.emptyContentErrorMessage`,
|
|
107
|
+
defaultMessage: 'Template content can not be empty',
|
|
108
|
+
},
|
|
109
|
+
limitExceededContentErrorMessage: {
|
|
110
|
+
id: `${scope}.limitExceededContentErrorMessage`,
|
|
111
|
+
defaultMessage: 'Template content can not be more than 1000',
|
|
112
|
+
},
|
|
113
|
+
invalidTagError: {
|
|
114
|
+
id: `${scope}.invalidTagError`,
|
|
115
|
+
defaultMessage: 'Please check the message content for unsupported/missing tags',
|
|
116
|
+
},
|
|
117
|
+
viberImageIncorrectSize: {
|
|
118
|
+
id: `${scope}.viberImageIncorrectSize`,
|
|
119
|
+
defaultMessage: 'Please upload the image with correct type, size and dimension',
|
|
120
|
+
},
|
|
121
|
+
viberCreateNotification: {
|
|
122
|
+
id: `${scope}.viberCreateNotification`,
|
|
123
|
+
defaultMessage: 'Viber template created successfully',
|
|
124
|
+
},
|
|
125
|
+
textMessageTitlePlaceholder: {
|
|
126
|
+
id: `${scope}.textMessageTitlePlaceholder`,
|
|
127
|
+
defaultMessage: 'Enter template name',
|
|
128
|
+
},
|
|
129
|
+
textMessageTitleLabel: {
|
|
130
|
+
id: `${scope}.textMessageTitleLabel`,
|
|
131
|
+
defaultMessage: 'Creative name',
|
|
132
|
+
},
|
|
133
|
+
emptyTitleErrorMessage: {
|
|
134
|
+
id: `${scope}.emptyTitleErrorMessage`,
|
|
135
|
+
defaultMessage: 'Template title can not be empty',
|
|
136
|
+
},
|
|
137
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* Faceboook reducer
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { fromJS } from 'immutable';
|
|
8
|
+
import * as types from './constants';
|
|
9
|
+
|
|
10
|
+
const initialState = fromJS({
|
|
11
|
+
uploadedAssetData: {},
|
|
12
|
+
createTemplateInProgress: false,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
function viberReducer(state = initialState, action) {
|
|
16
|
+
switch (action.type) {
|
|
17
|
+
case types.CREATE_VIBER_TEMPLATE_REQUEST:
|
|
18
|
+
return state
|
|
19
|
+
.set('createTemplateInProgress', true)
|
|
20
|
+
.set('createTemplateError', false)
|
|
21
|
+
.set('createTemplateErrorMessage', fromJS(""));
|
|
22
|
+
case types.CREATE_VIBER_TEMPLATE_SUCCESS:
|
|
23
|
+
return state.set('createTemplateInProgress', false)
|
|
24
|
+
.set('response', action.data)
|
|
25
|
+
.set('createTemplateError', (action.statusCode !== undefined && action.statusCode > 300))
|
|
26
|
+
.set('createTemplateErrorMessage', fromJS(action.errorMsg));
|
|
27
|
+
case types.CREATE_VIBER_TEMPLATE_FAILURE:
|
|
28
|
+
return state
|
|
29
|
+
.set('createTemplateInProgress', false)
|
|
30
|
+
.set('createTemplateError', true)
|
|
31
|
+
.set('createTemplateErrorMessage', fromJS(action.errorMsg));
|
|
32
|
+
case types.UPLOAD_VIBER_ASSET_REQUEST:
|
|
33
|
+
return state
|
|
34
|
+
.set('uploadAssetSuccess', false)
|
|
35
|
+
.set('assetUploading', true);
|
|
36
|
+
case types.UPLOAD_VIBER_ASSET_SUCCESS:
|
|
37
|
+
return state
|
|
38
|
+
.set('uploadAssetSuccess', (action.statusCode !== undefined && action.statusCode !== '' && action.statusCode < 300))
|
|
39
|
+
.set('assetUploading', false)
|
|
40
|
+
.set(action.templateType !== undefined ? `uploadedAssetData${action.templateType}` : 'uploadedAssetData', action.data);
|
|
41
|
+
case types.UPLOAD_VIBER_ASSET_FAILURE:
|
|
42
|
+
return state
|
|
43
|
+
.set('uploadAssetSuccess', false)
|
|
44
|
+
.set('assetUploading', false);
|
|
45
|
+
case types.CLEAR_VIBER_ASSET:
|
|
46
|
+
return state
|
|
47
|
+
.delete(action.templateType !== undefined ? `uploadedAssetData${action.templateType}` : 'uploadedAssetData');
|
|
48
|
+
// FOR EDIT
|
|
49
|
+
case types.EDIT_VIBER_TEMPLATE_REQUEST:
|
|
50
|
+
return state
|
|
51
|
+
.set('editTemplateInProgress', true)
|
|
52
|
+
.set('editTemplateError', false)
|
|
53
|
+
.set('editTemplateErrorMessage', fromJS(""));
|
|
54
|
+
case types.EDIT_VIBER_TEMPLATE_SUCCESS:
|
|
55
|
+
return state.set('editTemplateInProgress', false)
|
|
56
|
+
.set('editResponse', action.data)
|
|
57
|
+
.set('editTemplateError', (action.statusCode !== undefined && action.statusCode > 300))
|
|
58
|
+
.set('editTemplateErrorMessage', fromJS(action.errorMsg));
|
|
59
|
+
case types.EDIT_VIBER_TEMPLATE_FAILURE:
|
|
60
|
+
return state
|
|
61
|
+
.set('editTemplateInProgress', false)
|
|
62
|
+
.set('editTemplateError', true)
|
|
63
|
+
.set('editTemplateErrorMessage', fromJS(action.errorMsg));
|
|
64
|
+
case types.GET_VIBER_TEMPLATE_DETAILS_REQUEST:
|
|
65
|
+
return state.set('getTemplateDetailsInProgress', true);
|
|
66
|
+
case types.GET_VIBER_TEMPLATE_DETAILS_SUCCESS:
|
|
67
|
+
return state.set('getTemplateDetailsInProgress', false)
|
|
68
|
+
.set('templateDetails', action.data);
|
|
69
|
+
case types.GET_VIBER_TEMPLATE_DETAILS_FAILURE:
|
|
70
|
+
case types.CLEAR_VIBER_EDIT_RESPONSE_REQUEST:
|
|
71
|
+
return state.set('editResponse', {});
|
|
72
|
+
case types.CLEAR_VIBER_CREATE_RESPONSE_REQUEST:
|
|
73
|
+
return state.set('response', {});
|
|
74
|
+
case types.CLEAR_VIBER_DATA:
|
|
75
|
+
return state
|
|
76
|
+
.delete('uploadedAssetData')
|
|
77
|
+
.delete('metaEntities')
|
|
78
|
+
.delete('templateDetails');
|
|
79
|
+
default:
|
|
80
|
+
return state;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export default viberReducer;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
|
|
2
|
+
import { take, cancel, call, put, takeLatest } from 'redux-saga/effects';
|
|
3
|
+
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
4
|
+
import * as Api from '../../services/api';
|
|
5
|
+
import * as types from './constants';
|
|
6
|
+
|
|
7
|
+
export function* uploadViberAsset(file, assetType, fileParams ) {
|
|
8
|
+
try {
|
|
9
|
+
const result = yield call(Api.uploadFile, file, assetType, fileParams);
|
|
10
|
+
yield put({
|
|
11
|
+
type: types.UPLOAD_VIBER_ASSET_SUCCESS,
|
|
12
|
+
data: result.response.asset,
|
|
13
|
+
statusCode: result.status ? result.status.code : '',
|
|
14
|
+
templateType: file.templateType,
|
|
15
|
+
});
|
|
16
|
+
} catch (error) {
|
|
17
|
+
yield put({ type: types.UPLOAD_VIBER_ASSET_FAILURE, error });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function* createViberTemplate({ template, callback }) {
|
|
22
|
+
let errorMsg;
|
|
23
|
+
try {
|
|
24
|
+
const result = yield call(Api.createViberTemplate, { template });
|
|
25
|
+
if (result.status.code >= 400) {
|
|
26
|
+
errorMsg = result.message;
|
|
27
|
+
throw errorMsg;
|
|
28
|
+
}
|
|
29
|
+
yield put({ type: types.CREATE_VIBER_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg });
|
|
30
|
+
if (callback) {
|
|
31
|
+
callback(result.response);
|
|
32
|
+
}
|
|
33
|
+
} catch (error) {
|
|
34
|
+
yield put({ type: types.CREATE_VIBER_TEMPLATE_FAILURE, error, errorMsg });
|
|
35
|
+
if (callback) {
|
|
36
|
+
callback(null, errorMsg);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
export function* editTemplate({ template, callback }) {
|
|
43
|
+
let errorMsg;
|
|
44
|
+
try {
|
|
45
|
+
const result = yield call(Api.createViberTemplate, {template});
|
|
46
|
+
if (result.status.code >= 400) {
|
|
47
|
+
errorMsg = result.message;
|
|
48
|
+
throw errorMsg;
|
|
49
|
+
}
|
|
50
|
+
if (callback) {
|
|
51
|
+
callback(result.response);
|
|
52
|
+
}
|
|
53
|
+
yield put({ type: types.EDIT_TEMPLATE_VIBER_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg });
|
|
54
|
+
} catch (error) {
|
|
55
|
+
yield put({ type: types.EDIT_VIBER_TEMPLATE_FAILURE, error, errorMsg });
|
|
56
|
+
if (callback) {
|
|
57
|
+
callback(null, errorMsg);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function* getTemplateDetails({id, callback}) {
|
|
63
|
+
try {
|
|
64
|
+
console.log('saga get Template details viber', id);
|
|
65
|
+
const result = yield call(Api.getTemplateDetails, {id, channel: 'VIBER'});
|
|
66
|
+
yield put({ type: types.GET_VIBER_TEMPLATE_DETAILS_SUCCESS, data: result.response });
|
|
67
|
+
if (callback) {
|
|
68
|
+
callback(false);
|
|
69
|
+
}
|
|
70
|
+
} catch (error) {
|
|
71
|
+
yield put({ type: types.GET_VIBER_TEMPLATE_DETAILS_FAILURE, error });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
function* watchUploadViberAsset() {
|
|
77
|
+
const watcher = yield takeLatest(types.UPLOAD_VIBER_ASSET_REQUEST, uploadViberAsset);
|
|
78
|
+
yield take(LOCATION_CHANGE);
|
|
79
|
+
yield cancel(watcher);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
function* watchCreateTemplate() {
|
|
84
|
+
console.log('inside watch vibee saga createTemplate@@@');
|
|
85
|
+
const watcher = yield takeLatest(types.CREATE_VIBER_TEMPLATE_REQUEST, createViberTemplate);
|
|
86
|
+
yield take(LOCATION_CHANGE);
|
|
87
|
+
yield cancel(watcher);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function* watchGetTemplateDetails() {
|
|
91
|
+
const watcher = yield takeLatest(types.GET_VIBER_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
|
|
92
|
+
yield take(LOCATION_CHANGE);
|
|
93
|
+
yield cancel(watcher);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function* watchEditTemplate() {
|
|
97
|
+
const watcher = yield takeLatest(types.EDIT_VIBER_TEMPLATE_REQUEST, editTemplate);
|
|
98
|
+
yield take(LOCATION_CHANGE);
|
|
99
|
+
yield cancel(watcher);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export default [
|
|
103
|
+
watchUploadViberAsset,
|
|
104
|
+
watchCreateTemplate,
|
|
105
|
+
watchGetTemplateDetails,
|
|
106
|
+
watchEditTemplate,
|
|
107
|
+
];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createSelector } from 'reselect';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Direct selector to the create state domain
|
|
5
|
+
*/
|
|
6
|
+
const selectViberDomain = () => (state) => state.get('templates');
|
|
7
|
+
const selectViberMessageEditDomain = () => (state) => state.get('viber');
|
|
8
|
+
|
|
9
|
+
const makeSelectViber = () => createSelector(
|
|
10
|
+
selectViberDomain(),
|
|
11
|
+
(substate) => substate && substate.toJS()
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const makeSelectCreateViber = () => createSelector(
|
|
15
|
+
selectViberMessageEditDomain(),
|
|
16
|
+
(substate) => substate && substate.toJS()
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
makeSelectViber, makeSelectCreateViber,
|
|
21
|
+
};
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* Beeeditor
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
import React, { useEffect, useState, useRef, useCallback } from 'react';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
9
|
-
import TagList from '../../v2Containers/TagList';
|
|
10
|
-
import
|
|
11
|
-
{
|
|
12
|
-
CapModal,
|
|
13
|
-
CapButton,
|
|
14
|
-
CapInput,
|
|
15
|
-
CapSelect,
|
|
16
|
-
}
|
|
17
|
-
from '@capillarytech/cap-ui-library';
|
|
18
|
-
import messages from './messages';
|
|
19
|
-
import './index.scss';
|
|
20
|
-
|
|
21
|
-
function BeeEditor(props) {
|
|
22
|
-
const {
|
|
23
|
-
uid,
|
|
24
|
-
beeJson,
|
|
25
|
-
tokenData,
|
|
26
|
-
id,
|
|
27
|
-
location = {},
|
|
28
|
-
moduleFilterEnabled,
|
|
29
|
-
label,
|
|
30
|
-
className,
|
|
31
|
-
userLocale,
|
|
32
|
-
selectedOfferDetails,
|
|
33
|
-
tags,
|
|
34
|
-
injectedTags,
|
|
35
|
-
saveBeeInstance,
|
|
36
|
-
saveBeeData,
|
|
37
|
-
intl,
|
|
38
|
-
onContextChange,
|
|
39
|
-
} = props;
|
|
40
|
-
const {formatMessage} = intl;
|
|
41
|
-
const UNSUBSCRIBE = 'unsubscribe';
|
|
42
|
-
let beePluginInstance = null;
|
|
43
|
-
const categoryOptions = [{key: 'cta', value: 'cta', label: formatMessage(messages.cta)},
|
|
44
|
-
{key: 'footer', value: 'footer', label: formatMessage(messages.footer)},
|
|
45
|
-
{key: 'header', value: 'header', label: formatMessage(messages.header)},
|
|
46
|
-
{key: 'sp', value: 'sp', label: formatMessage(messages.socialPlatform)},
|
|
47
|
-
{key: 'others', value: 'others', label: formatMessage(messages.others)},
|
|
48
|
-
];
|
|
49
|
-
const [visibleTaglist, setVisibleTaglist] = useState(false);
|
|
50
|
-
const [showRowMetaModal, setRowMetaModal] = useState(false);
|
|
51
|
-
const [selectedTag, setSelectedTag] = useState({});
|
|
52
|
-
const [rowMetaInfo, setRowMetaInfo] = useState({});
|
|
53
|
-
const [rowName, setRowName] = useState('');
|
|
54
|
-
const [rowCategory, setRowCategory] = useState('');
|
|
55
|
-
|
|
56
|
-
const savedCallback = useRef();
|
|
57
|
-
const filteredTags = (tags || []).filter((obj) => obj.definition.value !== UNSUBSCRIBE);
|
|
58
|
-
let intervalTimer;
|
|
59
|
-
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
savedCallback.current = Object.keys(selectedTag).length > 0 ? selectedTag : rowMetaInfo;
|
|
62
|
-
}, [selectedTag, rowMetaInfo]);
|
|
63
|
-
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
const beeConfig = {
|
|
66
|
-
uid,
|
|
67
|
-
container: 'bee-plugin-container',
|
|
68
|
-
rowsConfiguration: {
|
|
69
|
-
emptyRows: true,
|
|
70
|
-
defaultRows: true,
|
|
71
|
-
},
|
|
72
|
-
contentDialog: {
|
|
73
|
-
specialLinks: {
|
|
74
|
-
label: UNSUBSCRIBE,
|
|
75
|
-
handler(resolve) {
|
|
76
|
-
resolve({
|
|
77
|
-
type: 'custom',
|
|
78
|
-
label: UNSUBSCRIBE,
|
|
79
|
-
link: `{{${UNSUBSCRIBE}}}`,
|
|
80
|
-
});
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
mergeTags: {
|
|
84
|
-
label: formatMessage(messages.addLabel),
|
|
85
|
-
handler: async (resolve, reject) => {
|
|
86
|
-
// this will open tag modal
|
|
87
|
-
await setVisibleTaglist(true);
|
|
88
|
-
// until tag modal will not open promise will not execute
|
|
89
|
-
// once tag modal is opened it will start 2 sec interval to wait use has selected any tag or cancel the tag selection
|
|
90
|
-
const promise = new Promise((resolveP) => {
|
|
91
|
-
intervalTimer = setInterval(() => {
|
|
92
|
-
// this will execute, if user cancel the tag selection
|
|
93
|
-
if ((savedCallback.current || {}).close === true) {
|
|
94
|
-
reject();
|
|
95
|
-
clearInterval(intervalTimer);
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
// this block is checking use has selected any tag or not
|
|
99
|
-
if (Object.keys(savedCallback.current || {}).length > 0) {
|
|
100
|
-
resolveP(savedCallback.current);
|
|
101
|
-
setSelectedTag({});
|
|
102
|
-
clearInterval(intervalTimer);
|
|
103
|
-
}
|
|
104
|
-
}, 2000);
|
|
105
|
-
});
|
|
106
|
-
// once prmise will resolve , pass the resolve data to handler to show tags in bee edior
|
|
107
|
-
const result = await promise;
|
|
108
|
-
resolve(result);
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
saveRow: {
|
|
112
|
-
handler: async (resolve, reject) => {
|
|
113
|
-
await setRowMetaModal(true);
|
|
114
|
-
const promise = new Promise((resolveP) => {
|
|
115
|
-
intervalTimer = setInterval(() => {
|
|
116
|
-
if ((savedCallback.current || {}).close === true) {
|
|
117
|
-
reject();
|
|
118
|
-
clearInterval(intervalTimer);
|
|
119
|
-
setRowMetaInfo({});
|
|
120
|
-
setRowName('');
|
|
121
|
-
setRowCategory('');
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
if (Object.keys(savedCallback.current || {}).length > 0) {
|
|
125
|
-
resolveP(savedCallback.current);
|
|
126
|
-
}
|
|
127
|
-
}, 2000);
|
|
128
|
-
});
|
|
129
|
-
const result = await promise;
|
|
130
|
-
resolve(result); // "done!"
|
|
131
|
-
setRowMetaInfo({});
|
|
132
|
-
setRowName('');
|
|
133
|
-
setRowCategory('');
|
|
134
|
-
clearInterval(intervalTimer);
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
onSave: (jsonFile, htmlFile) => {
|
|
139
|
-
saveBeeData(jsonFile, htmlFile);
|
|
140
|
-
},
|
|
141
|
-
// will use this function on save row feature
|
|
142
|
-
onSaveRow: (rowJSON) => {
|
|
143
|
-
console.log('bee-plugin-container onSaveRows', rowJSON);
|
|
144
|
-
},
|
|
145
|
-
};
|
|
146
|
-
window.BeePlugin.create(tokenData, beeConfig, (instance) => {
|
|
147
|
-
beePluginInstance = instance;
|
|
148
|
-
const parseJson = JSON.parse(beeJson);
|
|
149
|
-
beePluginInstance.start(parseJson);
|
|
150
|
-
saveBeeInstance(beePluginInstance);
|
|
151
|
-
});
|
|
152
|
-
return () => clearInterval(intervalTimer);
|
|
153
|
-
}, []);
|
|
154
|
-
|
|
155
|
-
const onTagSelect = (result) => {
|
|
156
|
-
const msg = {
|
|
157
|
-
name: result,
|
|
158
|
-
value: `{{${result}}}`,
|
|
159
|
-
};
|
|
160
|
-
setSelectedTag(msg);
|
|
161
|
-
setVisibleTaglist(false);
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
const onCancelTagList = () => {
|
|
165
|
-
setVisibleTaglist(false);
|
|
166
|
-
setSelectedTag({close: true});
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
const handleCancel = () => {
|
|
170
|
-
setRowMetaModal(false);
|
|
171
|
-
setRowMetaInfo({close: true});
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
const handleOk = () => {
|
|
175
|
-
const rowInfo = {};
|
|
176
|
-
if (rowCategory !== '') {
|
|
177
|
-
rowInfo.category = rowCategory;
|
|
178
|
-
}
|
|
179
|
-
setRowMetaInfo({
|
|
180
|
-
name: rowName,
|
|
181
|
-
...rowInfo,
|
|
182
|
-
});
|
|
183
|
-
setRowMetaModal(false);
|
|
184
|
-
};
|
|
185
|
-
const isDisableSave = () => rowName === '';
|
|
186
|
-
|
|
187
|
-
const onRowChange = useCallback((e) => {
|
|
188
|
-
setRowName(e.target.value);
|
|
189
|
-
});
|
|
190
|
-
const onChangeCategoy = (e) => {
|
|
191
|
-
setRowCategory(e);
|
|
192
|
-
};
|
|
193
|
-
const contentSection = <>
|
|
194
|
-
<CapInput
|
|
195
|
-
label={<FormattedMessage {...messages.rowName} />}
|
|
196
|
-
placeholder={formatMessage(messages.rowPlaceHolder)}
|
|
197
|
-
onChange={onRowChange}
|
|
198
|
-
value={rowName}
|
|
199
|
-
maxLength={50}
|
|
200
|
-
style={{ width: '324px', paddingBottom: '16px' }}
|
|
201
|
-
/>
|
|
202
|
-
<CapSelect
|
|
203
|
-
label="Category"
|
|
204
|
-
style={{ width: 250, paddingBottom: '16px'}}
|
|
205
|
-
options={categoryOptions}
|
|
206
|
-
selectPlaceholder={formatMessage(messages.select)}
|
|
207
|
-
placeholder={
|
|
208
|
-
<FormattedMessage {...messages.selectCategoyPlaceholder} />
|
|
209
|
-
}
|
|
210
|
-
onChange={onChangeCategoy}
|
|
211
|
-
/>
|
|
212
|
-
|
|
213
|
-
</>;
|
|
214
|
-
return (
|
|
215
|
-
<>
|
|
216
|
-
<div id="bee-plugin-container" style={{ height: '500px'}}>
|
|
217
|
-
</div>
|
|
218
|
-
<TagList
|
|
219
|
-
moduleFilterEnabled={moduleFilterEnabled}
|
|
220
|
-
label={label}
|
|
221
|
-
onTagSelect={onTagSelect}
|
|
222
|
-
location={location}
|
|
223
|
-
tags={filteredTags}
|
|
224
|
-
injectedTags={injectedTags}
|
|
225
|
-
className={className}
|
|
226
|
-
id={id}
|
|
227
|
-
userLocale={userLocale}
|
|
228
|
-
selectedOfferDetails={selectedOfferDetails}
|
|
229
|
-
visibleTaglist={visibleTaglist}
|
|
230
|
-
hidePopover
|
|
231
|
-
modalProps={{
|
|
232
|
-
onCancel: onCancelTagList,
|
|
233
|
-
style: { left: 135, top: 250 },
|
|
234
|
-
className: "bee-editor-tag-list",
|
|
235
|
-
}}
|
|
236
|
-
onContextChange={onContextChange}
|
|
237
|
-
/>
|
|
238
|
-
<CapModal
|
|
239
|
-
visible={showRowMetaModal}
|
|
240
|
-
onCancel={handleCancel}
|
|
241
|
-
title={formatMessage(messages.customRows)}
|
|
242
|
-
footer={[
|
|
243
|
-
<CapButton key="back" onClick={handleCancel}>{formatMessage(messages.cancel)}</CapButton>,
|
|
244
|
-
<CapButton key="submit" type="primary" id="delete-version" onClick={handleOk} disabled={isDisableSave()}>
|
|
245
|
-
{formatMessage(messages.save)}
|
|
246
|
-
</CapButton>,
|
|
247
|
-
]}
|
|
248
|
-
>
|
|
249
|
-
{contentSection}
|
|
250
|
-
</CapModal>
|
|
251
|
-
</>
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
BeeEditor.propTypes = {
|
|
256
|
-
beeJson: PropTypes.object.isRequired,
|
|
257
|
-
tokenData: PropTypes.object.isRequired,
|
|
258
|
-
uid: PropTypes.string.isRequired,
|
|
259
|
-
showTagsPopover: PropTypes.func.isRequired,
|
|
260
|
-
intl: intlShape.isRequired,
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
export default injectIntl(BeeEditor);
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* BeeEditor Messages
|
|
3
|
-
*
|
|
4
|
-
* This contains all the text for the BeeEditor component.
|
|
5
|
-
*/
|
|
6
|
-
import { defineMessages } from 'react-intl';
|
|
7
|
-
|
|
8
|
-
const prefix = 'creatives.componentsV2.BeeEditor';
|
|
9
|
-
|
|
10
|
-
export default defineMessages({
|
|
11
|
-
cancel: {
|
|
12
|
-
id: `${prefix}.cancel`,
|
|
13
|
-
defaultMessage: 'Cancel',
|
|
14
|
-
},
|
|
15
|
-
save: {
|
|
16
|
-
id: `${prefix}.save`,
|
|
17
|
-
defaultMessage: 'Save',
|
|
18
|
-
},
|
|
19
|
-
rowPlaceHolder: {
|
|
20
|
-
id: `${prefix}.rowPlaceHolder`,
|
|
21
|
-
defaultMessage: 'Enter Row name',
|
|
22
|
-
},
|
|
23
|
-
rowName: {
|
|
24
|
-
id: `${prefix}.rowName`,
|
|
25
|
-
defaultMessage: 'Row name',
|
|
26
|
-
},
|
|
27
|
-
select: {
|
|
28
|
-
id: `${prefix}.select`,
|
|
29
|
-
defaultMessage: 'Select',
|
|
30
|
-
},
|
|
31
|
-
customRows: {
|
|
32
|
-
id: `${prefix}.customRows`,
|
|
33
|
-
defaultMessage: 'Custom rows',
|
|
34
|
-
},
|
|
35
|
-
selectCategoyPlaceholder: {
|
|
36
|
-
id: `${prefix}.selectCategoyPlaceholder`,
|
|
37
|
-
defaultMessage: 'Select category',
|
|
38
|
-
},
|
|
39
|
-
tags: {
|
|
40
|
-
id: `${prefix}.tags`,
|
|
41
|
-
defaultMessage: 'Tags (optional)',
|
|
42
|
-
},
|
|
43
|
-
tagPlaceHolder: {
|
|
44
|
-
id: `${prefix}.tagPlaceHolder`,
|
|
45
|
-
defaultMessage: 'Enter tags',
|
|
46
|
-
},
|
|
47
|
-
addLabel: {
|
|
48
|
-
id: `${prefix}.addLabel`,
|
|
49
|
-
defaultMessage: 'Add label',
|
|
50
|
-
},
|
|
51
|
-
cta: {
|
|
52
|
-
id: `${prefix}.cta`,
|
|
53
|
-
defaultMessage: 'CTA',
|
|
54
|
-
},
|
|
55
|
-
header: {
|
|
56
|
-
id: `${prefix}.header`,
|
|
57
|
-
defaultMessage: 'Header',
|
|
58
|
-
},
|
|
59
|
-
footer: {
|
|
60
|
-
id: `${prefix}.footer`,
|
|
61
|
-
defaultMessage: 'Footer',
|
|
62
|
-
},
|
|
63
|
-
others: {
|
|
64
|
-
id: `${prefix}.others`,
|
|
65
|
-
defaultMessage: 'Others',
|
|
66
|
-
},
|
|
67
|
-
socialPlatform: {
|
|
68
|
-
id: `${prefix}.socialPlatform`,
|
|
69
|
-
defaultMessage: 'Social platform',
|
|
70
|
-
},
|
|
71
|
-
});
|