@capillarytech/creatives-library 6.14.1 → 6.15.2
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 -2
- package/config/app.js +0 -2
- package/containers/Templates/index.js +0 -3
- package/index.js +0 -7
- package/package.json +2 -2
- package/reducers.js +1 -2
- package/services/api.js +0 -7
- package/utils/common.js +0 -118
- package/utils/ignoredErrorMessages.js +4 -0
- package/v2Components/BeeEditor/index.js +263 -0
- package/v2Components/BeeEditor/index.scss +11 -0
- package/v2Components/BeeEditor/messages.js +71 -0
- package/v2Components/BeeEditor/tests/index.test.js +10 -0
- package/v2Components/FormBuilder/index.js +4 -2
- 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/App/constants.js +1 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +1 -17
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +0 -2
- package/v2Containers/CreativesContainer/actions.js +27 -27
- package/v2Containers/CreativesContainer/constants.js +0 -2
- package/v2Containers/CreativesContainer/index.js +0 -8
- 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/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/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/index.js +0 -13
- package/v2Containers/TemplatesV2/messages.js +0 -4
- 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/WeChat/MapTemplates/index.js +1 -1
- package/v2Containers/FTP/_FTP.scss +0 -92
- package/v2Containers/FTP/actions.js +0 -7
- package/v2Containers/FTP/constants.js +0 -3
- package/v2Containers/FTP/index.js +0 -517
- package/v2Containers/FTP/messages.js +0 -60
- package/v2Containers/FTP/reducer.js +0 -32
- package/v2Containers/FTP/sagas.js +0 -26
- package/v2Containers/FTP/selectors.js +0 -20
package/app.js
CHANGED
|
@@ -25,6 +25,7 @@ import initialState from './initialState';
|
|
|
25
25
|
import './styles/vendor/semantic/dist/semantic.min.css';
|
|
26
26
|
import './styles/main.scss';
|
|
27
27
|
import pathConfig from './config/path';
|
|
28
|
+
import ignoredErrorMessages from './utils/ignoredErrorMessages';
|
|
28
29
|
// addLocaleData([...en, ...es, ...fr, ...it, ...zh]);
|
|
29
30
|
|
|
30
31
|
const browserHistory = useRouterHistory(createHistory)({
|
|
@@ -38,10 +39,12 @@ const history = syncHistoryWithStore(browserHistory, store, {
|
|
|
38
39
|
});
|
|
39
40
|
|
|
40
41
|
const bugSnagErrorCallback = (event) => {
|
|
41
|
-
const { app: { releaseStage } = {} } = event || {};
|
|
42
|
+
const { app: { releaseStage } = {}, originalError } = event || {};
|
|
43
|
+
const errorMessage = originalError && originalError.message;
|
|
42
44
|
if (
|
|
43
45
|
(releaseStage || '').includes('nightly') ||
|
|
44
|
-
process.env.NODE_ENV !== 'production'
|
|
46
|
+
process.env.NODE_ENV !== 'production' ||
|
|
47
|
+
ignoredErrorMessages.include[errorMessage]
|
|
45
48
|
) {
|
|
46
49
|
return false;
|
|
47
50
|
}
|
package/config/app.js
CHANGED
|
@@ -11,7 +11,6 @@ const config = {
|
|
|
11
11
|
dashboard_url: '/sms',
|
|
12
12
|
dashboard_url_v2: '/v2',
|
|
13
13
|
subscription_api_endpoint: '/arya/api/v1/org-settings/subscription',
|
|
14
|
-
exports_api_endpoint: '/arya/api/v1/export/data',
|
|
15
14
|
accountConfig: (strs, accountId) => `${window.location.origin}/org/config/AccountAdd?q=a&channelId=2&accountId=${accountId}&edit=1`,
|
|
16
15
|
},
|
|
17
16
|
development: {
|
|
@@ -20,7 +19,6 @@ const config = {
|
|
|
20
19
|
auth_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/auth',
|
|
21
20
|
arya_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1',
|
|
22
21
|
subscription_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/org-settings/subscription',
|
|
23
|
-
exports_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/export/data',
|
|
24
22
|
login_url: '/auth/login',
|
|
25
23
|
dashboard_url: '/sms',
|
|
26
24
|
dashboard_url_v2: '/v2',
|
|
@@ -721,9 +721,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
721
721
|
}
|
|
722
722
|
}
|
|
723
723
|
switch (type) {
|
|
724
|
-
case "getFormData":
|
|
725
|
-
this.getFormData(e);
|
|
726
|
-
break;
|
|
727
724
|
case "startTemplateCreation":
|
|
728
725
|
console.log('Starting to create template');
|
|
729
726
|
//this.getFormData(e);
|
package/index.js
CHANGED
|
@@ -56,10 +56,6 @@ import MobilepushCreate from './v2Containers/MobilePush/Create';
|
|
|
56
56
|
import mobilepushCreateReducer from './v2Containers/MobilePush/Create/reducer';
|
|
57
57
|
import mobilepushCreateSaga from './v2Containers/MobilePush/Create/sagas';
|
|
58
58
|
|
|
59
|
-
import FTP from './v2Containers/FTP';
|
|
60
|
-
import FTPReducer from './v2Containers/FTP/reducer';
|
|
61
|
-
import FTPSagas from './v2Containers/FTP/sagas';
|
|
62
|
-
|
|
63
59
|
import MobilepushEdit from './v2Containers/MobilePush/Edit';
|
|
64
60
|
import mobilepushEditReducer from './v2Containers/MobilePush/Edit/reducer';
|
|
65
61
|
import mobilepushEditSaga from './v2Containers/MobilePush/Edit/sagas';
|
|
@@ -97,7 +93,6 @@ const LineCreateContainer = {LineCreate, lineCreateReducer, lineCreateSaga};
|
|
|
97
93
|
const TemplatesV2Container = {TemplatesV2, templateReducer, templateSaga};
|
|
98
94
|
const FacebookContainer = {Facebook, facebookReducer, facebookSaga};
|
|
99
95
|
const GalleryContainer = {Gallery, galleryReducer, gallerySagas};
|
|
100
|
-
const FTPContainer = {FTP, FTPReducer, FTPSagas};
|
|
101
96
|
|
|
102
97
|
export {default as TagList} from './v2Containers/TagList/index';
|
|
103
98
|
export {default as TagListSaga} from './v2Containers/TagList/sagas';
|
|
@@ -109,7 +104,6 @@ export {default as CallTaskPreview} from './v2Components/CallTaskPreview';
|
|
|
109
104
|
export {default as EmailMobilePreview} from './v2Components/EmailMobilePreview';
|
|
110
105
|
export {default as MobilePushPreview} from './v2Components/MobilePushPreviewV2';
|
|
111
106
|
export {default as WechatRichmediaTemplatePreview} from './v2Components/TemplatePreview/WechatRichmediaTemplatePreview';
|
|
112
|
-
export {default as FTP} from './v2Containers/FTP';
|
|
113
107
|
|
|
114
108
|
CreativesContainer.CreativesContainerReducer = CreativesContainerReducer;
|
|
115
109
|
|
|
@@ -137,5 +131,4 @@ export { CapContainer,
|
|
|
137
131
|
updateCharCount,
|
|
138
132
|
FacebookContainer,
|
|
139
133
|
GalleryContainer,
|
|
140
|
-
FTPContainer,
|
|
141
134
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capillarytech/creatives-library",
|
|
3
3
|
"author": "meharaj",
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.15.2",
|
|
5
5
|
"description": "Capillary creatives ui",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"module": "./index.es.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@babel/polyfill": "7.4.3",
|
|
16
16
|
"@bugsnag/js": "^7.2.1",
|
|
17
17
|
"@bugsnag/plugin-react": "^7.2.1",
|
|
18
|
-
"@capillarytech/cap-ui-utils": "1.3.
|
|
18
|
+
"@capillarytech/cap-ui-utils": "1.3.4",
|
|
19
19
|
"@mailupinc/bee-plugin": "^1.2.0",
|
|
20
20
|
"babel-cli": "^6.26.0",
|
|
21
21
|
"chalk": "1.1.3",
|
package/reducers.js
CHANGED
|
@@ -17,7 +17,7 @@ import templateReducer from 'containers/Templates/reducer';
|
|
|
17
17
|
import tagsReducer from 'containers/TagList/reducer';
|
|
18
18
|
import emailReducer from 'containers/Email/reducer';
|
|
19
19
|
import ebillReducer from 'containers/Ebill/reducer';
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
/*
|
|
22
22
|
* routeReducer
|
|
23
23
|
*
|
|
@@ -62,7 +62,6 @@ export default function createReducer(asyncReducers) {
|
|
|
62
62
|
email: emailReducer,
|
|
63
63
|
ebill: ebillReducer,
|
|
64
64
|
beeEditor: beeEditorReducer,
|
|
65
|
-
FTP: ftpReducer,
|
|
66
65
|
...asyncReducers,
|
|
67
66
|
});
|
|
68
67
|
}
|
package/services/api.js
CHANGED
|
@@ -9,7 +9,6 @@ import getSchema from './getSchema';
|
|
|
9
9
|
import * as API from '../utils/ApiCaller';
|
|
10
10
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
11
11
|
let API_ENDPOINT = config.development.api_endpoint;
|
|
12
|
-
let EXPORT_API_ENDPOINT = config.development.exports_api_endpoint;
|
|
13
12
|
let CAMPAIGNS_API_ENDPOINT = config.development.campaigns_api_endpoint;
|
|
14
13
|
let API_AUTH_ENDPOINT = config.development.auth_endpoint;
|
|
15
14
|
let ARYA_ENDPOINT = config.development.arya_endpoint;
|
|
@@ -214,12 +213,6 @@ export const duplicateTemplate = ({id, channel}) => {
|
|
|
214
213
|
return request(url, getAPICallObject('GET'));
|
|
215
214
|
};
|
|
216
215
|
|
|
217
|
-
export const getFTPServers = () => {
|
|
218
|
-
console.log('in api.js getFTPServers');
|
|
219
|
-
const url = `${EXPORT_API_ENDPOINT}/ftplist`;
|
|
220
|
-
return request(url, getAPICallObject('GET'));
|
|
221
|
-
};
|
|
222
|
-
|
|
223
216
|
export const editWeChatTemplate = ({template}) => {
|
|
224
217
|
console.log('in api.js', template);
|
|
225
218
|
const url = `${API_ENDPOINT}/templates/WECHAT`;
|
package/utils/common.js
CHANGED
|
@@ -37,121 +37,3 @@ export const hasStore2DoorFeature = Auth.hasFeatureAccess.bind(
|
|
|
37
37
|
null,
|
|
38
38
|
STORE2DOOR_PLUS_ENABLED,
|
|
39
39
|
);
|
|
40
|
-
|
|
41
|
-
export function getTreeStructuredTags(tagsList, userLocale = 'en') {
|
|
42
|
-
console.log('populating tags', (tagsList || []).length);
|
|
43
|
-
const mainTags = {};
|
|
44
|
-
|
|
45
|
-
//Form tags object with tag headers
|
|
46
|
-
_.forEach(tagsList, (temp) => {
|
|
47
|
-
const tag = temp.definition;
|
|
48
|
-
if (!tag['tag-header']) {
|
|
49
|
-
mainTags[tag.value] = {
|
|
50
|
-
name: tag.label[userLocale] ? tag.label[userLocale] : tag.label.en,
|
|
51
|
-
value: tag.value,
|
|
52
|
-
};
|
|
53
|
-
} else if (tag['tag-header'] && mainTags[tag.value]) {
|
|
54
|
-
mainTags[tag.value].subtags = _.concat(mainTags[tag.value].subtags, tag.subtags);
|
|
55
|
-
} else if (!mainTags[tag.value]) {
|
|
56
|
-
// console.log('Inside ', tag.label);
|
|
57
|
-
mainTags[tag.value] = {
|
|
58
|
-
'tag-header': true,
|
|
59
|
-
"name": tag.label[userLocale] ? tag.label[userLocale] : tag.label.en,
|
|
60
|
-
"subtags": tag.subtags,
|
|
61
|
-
"value": tag.value,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
const mainTagsCloned = _.cloneDeep(mainTags);
|
|
67
|
-
//Insert subtags in tag headers and reomve them from top level
|
|
68
|
-
const result = {};
|
|
69
|
-
_.forEach(mainTagsCloned, (tag, key) => {
|
|
70
|
-
if (tag['tag-header']) {
|
|
71
|
-
const tagWithChildren = populateTagForChildren(tag, mainTagsCloned, key);
|
|
72
|
-
tagWithChildren.resolved = true;
|
|
73
|
-
result[key] = tagWithChildren;
|
|
74
|
-
} else {
|
|
75
|
-
result[key] = tag;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
//Delete extra tag headers
|
|
80
|
-
_.forEach(result, (tag) => {
|
|
81
|
-
if (tag['tag-header']) {
|
|
82
|
-
_.forEach(tag.subtags, (subtag, key) => {
|
|
83
|
-
if (result[key]) {
|
|
84
|
-
result[key].deleted = true;
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
//Actually delete them
|
|
90
|
-
_.forEach(result, (tag, key) => {
|
|
91
|
-
if (tag.deleted) {
|
|
92
|
-
delete result[key];
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
return getTreeStructureData(result);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function populateTagForChildren(targetTag, tagsObject, tagValue) {
|
|
99
|
-
const tag = targetTag;
|
|
100
|
-
if (tag && tag['tag-header'] && !tag.resolved) {
|
|
101
|
-
const tempSubTags = {};
|
|
102
|
-
_.forEach(tag.subtags, (subtag) => {
|
|
103
|
-
if (tagsObject[subtag]) {
|
|
104
|
-
const children = populateTagForChildren(tagsObject[subtag], tagsObject, subtag);
|
|
105
|
-
children.resolved = true;
|
|
106
|
-
tempSubTags[subtag] = children;
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
tag.subtags = tempSubTags;
|
|
110
|
-
return tag;
|
|
111
|
-
}
|
|
112
|
-
return tagsObject[tagValue];
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function getTreeStructureData(data) {
|
|
116
|
-
const result = [];
|
|
117
|
-
_.forOwn(data, (mainTag) => {
|
|
118
|
-
const { name, value, subtags = [] } = mainTag;
|
|
119
|
-
if (!mainTag['tag-header']) {
|
|
120
|
-
result.push({
|
|
121
|
-
title: name,
|
|
122
|
-
value: `{{${value}}}`,
|
|
123
|
-
});
|
|
124
|
-
} else {
|
|
125
|
-
const obj = {
|
|
126
|
-
title: name,
|
|
127
|
-
value: `{{${value}}}`,
|
|
128
|
-
selectable: false,
|
|
129
|
-
};
|
|
130
|
-
obj.children = getSubTags(subtags);
|
|
131
|
-
result.push(obj);
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
return result;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function getSubTags(subtagsParam) {
|
|
138
|
-
const result = [];
|
|
139
|
-
_.forOwn(subtagsParam, (subTag) => {
|
|
140
|
-
const { name, value, subtags = [] } = subTag;
|
|
141
|
-
if (_.isEmpty(subtags)) {
|
|
142
|
-
result.push({
|
|
143
|
-
title: name,
|
|
144
|
-
value: `{{${value}}}`,
|
|
145
|
-
});
|
|
146
|
-
} else {
|
|
147
|
-
const obj = {
|
|
148
|
-
title: name,
|
|
149
|
-
value: `{{${value}}}`,
|
|
150
|
-
selectable: false,
|
|
151
|
-
};
|
|
152
|
-
obj.children = getSubTags(subtags);
|
|
153
|
-
result.push(obj);
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
return result;
|
|
157
|
-
}
|
|
@@ -0,0 +1,263 @@
|
|
|
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);
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
});
|
|
@@ -2362,7 +2362,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2362
2362
|
this.renderTextAreaContent(styling, columns, val, isVersionEnable, rows, cols, val.offset);
|
|
2363
2363
|
break;
|
|
2364
2364
|
case "contentPreview":
|
|
2365
|
-
|
|
2365
|
+
const { formData , currentTab } = this.state || {};
|
|
2366
|
+
const tab = formData && formData[currentTab - 1];
|
|
2367
|
+
content = isVersionEnable ? tab && tab['sms-editor'] : formData && formData['sms-editor'];
|
|
2366
2368
|
charList = updateCharCount(content).char_list;
|
|
2367
2369
|
columns.push(<CapColumn id={val.id} className={"preview-chars"} span={val.width}>
|
|
2368
2370
|
{charList.map((char) => char)}
|
|
@@ -3198,7 +3200,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3198
3200
|
}
|
|
3199
3201
|
}
|
|
3200
3202
|
const { currentTab, formData } = this.state;
|
|
3201
|
-
const supportedLanguages = (formData[currentTab - 1] || {}).selectedLanguages;
|
|
3203
|
+
const supportedLanguages = (formData[currentTab - 1] || {}).selectedLanguages || {};
|
|
3202
3204
|
const currentLang = supportedLanguages[langTab - 1];
|
|
3203
3205
|
|
|
3204
3206
|
let beeJson = '',
|