@capillarytech/creatives-library 6.9.5 → 6.9.7

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.
Files changed (73) hide show
  1. package/components/CapTagList/index.js +1 -1
  2. package/components/Edmeditor/index.js +1 -1
  3. package/components/FormBuilder/index.js +0 -1
  4. package/containers/TagList/index.js +5 -4
  5. package/index.html +3 -0
  6. package/package.json +2 -1
  7. package/services/api.js +16 -1
  8. package/v2Components/BeeEditor/index.js +272 -0
  9. package/v2Components/BeeEditor/index.scss +11 -0
  10. package/v2Components/BeeEditor/messages.js +47 -0
  11. package/v2Components/BeeEditor/tests/index.test.js +10 -0
  12. package/v2Components/CapTagList/index.js +55 -26
  13. package/v2Components/CmsTemplatesComponent/index.js +4 -4
  14. package/v2Components/Edmeditor/index.js +1 -1
  15. package/v2Components/EmailPreview/_emailPreview.scss +2 -2
  16. package/v2Components/FormBuilder/index.js +79 -43
  17. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +151 -151
  18. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +33 -33
  19. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/tests/index.test.js +10 -10
  20. package/v2Components/TemplatePreview/assets/images/androidPushMessage.svg +44 -44
  21. package/v2Components/TemplatePreview/assets/images/home-screen-android.svg +21 -21
  22. package/v2Components/TemplatePreview/assets/images/home-screen-ios.svg +16 -16
  23. package/v2Components/TemplatePreview/assets/images/iPhonePushMessage.svg +134 -134
  24. package/v2Components/TemplatePreview/assets/images/mobile.svg +23 -23
  25. package/v2Components/TemplatePreview/assets/images/sms_mobile_android.svg +22 -22
  26. package/v2Components/TemplatePreview/assets/images/user-icon.svg +18 -18
  27. package/v2Components/TemplatePreview/assets/images/wechat-home-screen-android.svg +21 -21
  28. package/v2Components/TemplatePreview/assets/images/wechat-mobile.svg +77 -77
  29. package/v2Components/TemplatePreview/assets/images/wechat_mobile_android.svg +20 -20
  30. package/v2Components/TemplatePreview/tests/index.test.js +10 -10
  31. package/v2Containers/CreativesContainer/SlideBoxFooter.js +51 -51
  32. package/v2Containers/CreativesContainer/actions.js +27 -27
  33. package/v2Containers/CreativesContainer/constants.js +17 -17
  34. package/v2Containers/CreativesContainer/index.js +7 -2
  35. package/v2Containers/CreativesContainer/index.scss +44 -44
  36. package/v2Containers/CreativesContainer/messages.js +305 -305
  37. package/v2Containers/CreativesContainer/reducer.js +29 -29
  38. package/v2Containers/CreativesContainer/sagas.js +11 -11
  39. package/v2Containers/CreativesContainer/selectors.js +30 -30
  40. package/v2Containers/CreativesContainer/tests/actions.test.js +18 -18
  41. package/v2Containers/CreativesContainer/tests/index.test.js +10 -10
  42. package/v2Containers/CreativesContainer/tests/reducer.test.js +9 -9
  43. package/v2Containers/CreativesContainer/tests/sagas.test.js +15 -15
  44. package/v2Containers/CreativesContainer/tests/selectors.test.js +10 -10
  45. package/v2Containers/Email/constants.js +1 -0
  46. package/v2Containers/Email/index.js +169 -115
  47. package/v2Containers/Email/initialSchema.js +18 -3
  48. package/v2Containers/Email/sagas.js +2 -2
  49. package/v2Containers/Email/selectors.js +5 -0
  50. package/v2Containers/EmailWrapper/index.js +19 -3
  51. package/v2Containers/TagList/index.js +6 -0
  52. package/v2Containers/Templates/actions.js +122 -117
  53. package/v2Containers/Templates/constants.js +49 -47
  54. package/v2Containers/Templates/index.js +36 -20
  55. package/v2Containers/Templates/messages.js +8 -0
  56. package/v2Containers/Templates/reducer.js +153 -145
  57. package/v2Containers/Templates/sagas.js +179 -179
  58. package/v2Containers/Templates/selectors.js +19 -1
  59. package/v2Containers/Templates/tests/actions.test.js +18 -18
  60. package/v2Containers/Templates/tests/index.test.js +10 -10
  61. package/v2Containers/Templates/tests/reducer.test.js +9 -9
  62. package/v2Containers/Templates/tests/sagas.test.js +15 -15
  63. package/v2Containers/Templates/tests/selectors.test.js +10 -10
  64. package/v2Containers/TemplatesV2/TemplatesV2.style.js +29 -29
  65. package/v2Containers/TemplatesV2/actions.js +16 -16
  66. package/v2Containers/TemplatesV2/constants.js +10 -10
  67. package/v2Containers/TemplatesV2/messages.js +61 -61
  68. package/v2Containers/TemplatesV2/selectors.js +25 -25
  69. package/v2Containers/TemplatesV2/tests/actions.test.js +18 -18
  70. package/v2Containers/TemplatesV2/tests/index.test.js +10 -10
  71. package/v2Containers/TemplatesV2/tests/reducer.test.js +9 -9
  72. package/v2Containers/TemplatesV2/tests/sagas.test.js +15 -15
  73. package/v2Containers/TemplatesV2/tests/selectors.test.js +10 -10
@@ -199,9 +199,24 @@ export const response = {
199
199
  "getEditorInstanse",
200
200
  ],
201
201
  },
202
+ // will remove once bee gets tested end to end
203
+ // {
204
+ // id: "edmeditor",
205
+ // type: "edmeditor",
206
+ // metaType: "text",
207
+ // datatype: "string",
208
+ // required: true,
209
+ // onlyDisplay: true,
210
+ // standalone: false,
211
+ // width: 24,
212
+ // order: 2,
213
+ // customComponent: true,
214
+ // colStyle: { display: "none" },
215
+ // supportedEvents: [],
216
+ // },
202
217
  {
203
- id: "edmeditor",
204
- type: "edmeditor",
218
+ id: "BEEeditor",
219
+ type: "BEEeditor",
205
220
  metaType: "text",
206
221
  datatype: "string",
207
222
  required: true,
@@ -365,7 +380,7 @@ export const response = {
365
380
  styling: "semantic",
366
381
  order: 3,
367
382
  width: 2,
368
- offset: 1,
383
+ offset: 4,
369
384
  fluid: false,
370
385
  onlyDisplay: true,
371
386
  submitAction: "onTabOptionSelect",
@@ -53,7 +53,7 @@ export function* getAllAssets(assetType, queryParams) {
53
53
 
54
54
  export function* getCmsSetting({cmsType, projectId, cmsMode, langId, isEdmSupport}) {
55
55
  try {
56
- const result = yield call(Api.getCmsTemplateSettings, cmsType, projectId, cmsMode, langId, isEdmSupport);
56
+ const result = yield call(Api.getCmsTemplateSettingsV2, cmsType, projectId, cmsMode, langId, isEdmSupport);
57
57
 
58
58
  yield put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: result.data.response.cmsDetails });
59
59
  } catch (error) {
@@ -63,7 +63,7 @@ export function* getCmsSetting({cmsType, projectId, cmsMode, langId, isEdmSuppor
63
63
 
64
64
  export function* getCmsData({cmsType, projectId, langId}) {
65
65
  try {
66
- const result = yield call(Api.getCmsTemplateData, cmsType, projectId, langId);
66
+ const result = yield call(Api.getCmsTemplateDataV2, cmsType, projectId, langId);
67
67
 
68
68
  yield put({ type: types.GET_CMS_EDITOR_DATA_SUCCESS, data: result.data.response.data, langId: result.data.response.langId });
69
69
  } catch (error) {
@@ -26,9 +26,14 @@ const selectLoadingStatus = () => createSelector(
26
26
  selectEmailDomain(), (email) => email.createTemplateInProgress || (email.assetUploading !== undefined && email.assetUploading)
27
27
  );
28
28
 
29
+ const makeSelectFetchingCmsData = () => createSelector(
30
+ selectEmailDomain(), (state) => state.get('fetchingCmsData')
31
+ );
32
+
29
33
  export default makeSelectEmail;
30
34
  export {
31
35
  makeSelectEmail,
32
36
  makeSelectCreateResponse,
33
37
  selectLoadingStatus,
38
+ makeSelectFetchingCmsData,
34
39
  };
@@ -15,7 +15,13 @@ import styled from 'styled-components';
15
15
  import { CapRadioCard, CapNotification, CapInput, CapUploader, CapSpin, CapButton } from '@capillarytech/cap-ui-library';
16
16
  import ComponentWithLabelHOC from '@capillarytech/cap-ui-library/assets/HOCs/ComponentWithLabelHOC';
17
17
  import { UserIsAuthenticated } from '../../utils/authWrapper';
18
- import { selectEmailLayout, selectCmsTemplates, selectEdmEditor, uploadSelector } from '../Templates/selectors';
18
+ import {
19
+ selectEmailLayout,
20
+ selectCmsTemplates,
21
+ selectEdmEditor,
22
+ uploadSelector,
23
+ selectCmsTemplatesLoader,
24
+ } from '../Templates/selectors';
19
25
  import * as templatesActionsCreators from '../Templates/actions';
20
26
  import Email from '../Email';
21
27
  import CmsTemplatesComponent from '../../v2Components/CmsTemplatesComponent';
@@ -76,7 +82,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
76
82
  //document.getElementById('upload-email-template').click();
77
83
  } else if (step === "templateSelection" && !this.state.selectedCreateMode) {
78
84
  if (emailCreateMode === "editor" && !CmsTemplates) {
79
- templatesActions.getEdmDefaultTemplates();
85
+ templatesActions.getDefaultBeeTemplates();
80
86
  }
81
87
  } else if (step === "createTemplateContent" && !this.state.selectedCreateMode) {
82
88
  if (emailCreateMode === 'upload' && !_.isEmpty(EmailLayout)) {
@@ -156,6 +162,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
156
162
  const data = _.find(CmsTemplates, { _id: id });
157
163
 
158
164
  templatesActions.setEdmTemplate(data);
165
+ templatesActions.setBEETemplate(data);
159
166
  this.setState({
160
167
  selectedCreateMode: 'editor',
161
168
  });
@@ -188,6 +195,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
188
195
  selectedOfferDetails,
189
196
  onPreviewContentClicked,
190
197
  onTestContentClicked,
198
+ cmsTemplatesLoader,
191
199
  } = this.props;
192
200
  const {
193
201
  templateName,
@@ -206,6 +214,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
206
214
  value={templateName}
207
215
  labelPosition="top"
208
216
  size="default"
217
+ style={{ width: '68%'}}
209
218
  />
210
219
  }
211
220
  <CardContainer>
@@ -251,7 +260,13 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
251
260
  onPreviewContentClicked={onPreviewContentClicked}
252
261
  onTestContentClicked={onTestContentClicked}
253
262
  />}
254
- {CmsTemplates && !isShowEmailCreate && <CmsTemplatesComponent cmsTemplates={CmsTemplates} handleEdmDefaultTemplateSelection={this.useEditor} />}
263
+ {!isShowEmailCreate && (
264
+ <CmsTemplatesComponent
265
+ cmsTemplates={CmsTemplates}
266
+ handleEdmDefaultTemplateSelection={this.useEditor}
267
+ cmsTemplatesLoader={cmsTemplatesLoader}
268
+ />
269
+ )}
255
270
  </div>
256
271
  }
257
272
  </CapSpin>
@@ -289,6 +304,7 @@ const mapStateToProps = createStructuredSelector({
289
304
  CmsTemplates: selectCmsTemplates(),
290
305
  SelectedEdmDefaultTemplate: selectEdmEditor(),
291
306
  isUploading: uploadSelector(),
307
+ cmsTemplatesLoader: selectCmsTemplatesLoader(),
292
308
  });
293
309
 
294
310
  function mapDispatchToProps(dispatch) {
@@ -242,8 +242,11 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
242
242
  tags={tags}
243
243
  onSelect={this.onSelect}
244
244
  label={this.props.label}
245
+ visibleTaglist={this.props.visibleTaglist}
246
+ hidePopover={this.props.hidePopover}
245
247
  onContextChange={this.getTagsforContext}
246
248
  moduleFilterEnabled={this.props.moduleFilterEnabled}
249
+ modalProps={this.props.modalProps}
247
250
  />
248
251
  </div>
249
252
  );
@@ -265,6 +268,9 @@ TagList.propTypes = {
265
268
  className: PropTypes.string,
266
269
  userLocale: PropTypes.string,
267
270
  selectedOfferDetails: PropTypes.array,
271
+ visibleTaglist: PropTypes.bool,
272
+ hidePopover: PropTypes.bool,
273
+ modalProps: PropTypes.any,
268
274
  };
269
275
 
270
276
  const mapStateToProps = createStructuredSelector({
@@ -1,117 +1,122 @@
1
- /*
2
- *
3
- * Templates actions
4
- *
5
- */
6
-
7
- import * as types from './constants';
8
-
9
- export function getAllTemplates(channel, queryParams) {
10
- console.log('get all templates action trigereed', channel, queryParams);
11
- return {
12
- type: types.GET_ALL_TEMPLATES_REQUEST, channel, queryParams,
13
- };
14
- }
15
-
16
- export function resetTemplate() {
17
- return {
18
- type: types.RESET_TEMPLATE,
19
- };
20
- }
21
-
22
- export function resetAccount() {
23
- return {
24
- type: types.RESET_ACCOUNT,
25
- };
26
- }
27
-
28
- export function deleteTemplate(channel, id) {
29
- console.log('delete template action trigereed', channel, id);
30
- return {
31
- type: types.DELETE_TEMPLATE_REQUEST, channel, id,
32
- };
33
- }
34
-
35
- export function getUserList() {
36
- return {
37
- type: types.GET_USER_LIST_REQUEST,
38
- };
39
- }
40
-
41
- export function getWeCrmAccounts(source) {
42
- return {
43
- type: types.GET_WECRM_ACCOUNTS_REQUEST, source,
44
- };
45
- }
46
-
47
- export function setWeChatAccount(weChatAccount) {
48
- console.log('setting wechat account', weChatAccount);
49
- return {
50
- type: types.SET_WECHAT_ACCOUNT,
51
- weChatAccount,
52
- };
53
- }
54
-
55
- export function setLineAccount(lineAccount) {
56
- return {
57
- type: types.SET_LINE_ACCOUNT,
58
- lineAccount,
59
- };
60
- }
61
-
62
- export function handleHtmlUpload(selectedTemplate) {
63
- return {
64
- type: types.SET_SELECTED_LAYOUT,
65
- selectedTemplate,
66
- };
67
- }
68
-
69
- export function handleZipUpload(selectedFile, successHandler, errorHandler) {
70
- return {
71
- type: types.SEND_ZIPPED_FILE_REQUEST,
72
- selectedFile,
73
- successHandler,
74
- errorHandler,
75
- };
76
- }
77
-
78
- export function getEdmDefaultTemplates() {
79
- return {
80
- type: types.GET_EDM_DEAFULT_TEMPLATES_REQUEST,
81
- };
82
- }
83
-
84
- export function setEdmTemplate(template) {
85
- return {
86
- type: types.SET_EDM_TEMPLATE,
87
- template,
88
- };
89
- }
90
-
91
- export function getTemplateDetails(id, channel) {
92
- console.log('getting template', id, channel);
93
- return {
94
- type: types.GET_TEMPLATE_DETAILS_REQUEST,
95
- id,
96
- channel,
97
- };
98
- }
99
-
100
- export function resetTemplateData() {
101
- return {
102
- type: types.RESET_TEMPLATE_DATA,
103
- };
104
- }
105
-
106
- export function resetUploadData() {
107
- console.log('clearing upload data');
108
- return {
109
- type: types.RESET_UPLOAD_DATA,
110
- };
111
- }
112
-
113
- export function resetTemplateStoreData() {
114
- return {
115
- type: types.CLEAR_TEMPLATE_STORE_DATA,
116
- };
117
- }
1
+ /*
2
+ *
3
+ * Templates actions
4
+ *
5
+ */
6
+
7
+ import * as types from './constants';
8
+
9
+ export function getAllTemplates(channel, queryParams) {
10
+ console.log('get all templates action trigereed', channel, queryParams);
11
+ return {
12
+ type: types.GET_ALL_TEMPLATES_REQUEST, channel, queryParams,
13
+ };
14
+ }
15
+
16
+ export function resetTemplate() {
17
+ return {
18
+ type: types.RESET_TEMPLATE,
19
+ };
20
+ }
21
+
22
+ export function resetAccount() {
23
+ return {
24
+ type: types.RESET_ACCOUNT,
25
+ };
26
+ }
27
+
28
+ export function deleteTemplate(channel, id) {
29
+ console.log('delete template action trigereed', channel, id);
30
+ return {
31
+ type: types.DELETE_TEMPLATE_REQUEST, channel, id,
32
+ };
33
+ }
34
+
35
+ export function getUserList() {
36
+ return {
37
+ type: types.GET_USER_LIST_REQUEST,
38
+ };
39
+ }
40
+
41
+ export function getWeCrmAccounts(source) {
42
+ return {
43
+ type: types.GET_WECRM_ACCOUNTS_REQUEST, source,
44
+ };
45
+ }
46
+
47
+ export function setWeChatAccount(weChatAccount) {
48
+ console.log('setting wechat account', weChatAccount);
49
+ return {
50
+ type: types.SET_WECHAT_ACCOUNT,
51
+ weChatAccount,
52
+ };
53
+ }
54
+
55
+ export function setLineAccount(lineAccount) {
56
+ return {
57
+ type: types.SET_LINE_ACCOUNT,
58
+ lineAccount,
59
+ };
60
+ }
61
+
62
+ export function handleHtmlUpload(selectedTemplate) {
63
+ return {
64
+ type: types.SET_SELECTED_LAYOUT,
65
+ selectedTemplate,
66
+ };
67
+ }
68
+
69
+ export function handleZipUpload(selectedFile, successHandler, errorHandler) {
70
+ return {
71
+ type: types.SEND_ZIPPED_FILE_REQUEST,
72
+ selectedFile,
73
+ successHandler,
74
+ errorHandler,
75
+ };
76
+ }
77
+
78
+ export function getDefaultBeeTemplates() {
79
+ return {
80
+ type: types.GET_DEAFULT_BEE_TEMPLATES_REQUEST,
81
+ };
82
+ }
83
+
84
+ export function setEdmTemplate(template) {
85
+ return {
86
+ type: types.SET_EDM_TEMPLATE,
87
+ template,
88
+ };
89
+ }
90
+ export function setBEETemplate(template) {
91
+ return {
92
+ type: types.SET_BEE_TEMPLATE,
93
+ template,
94
+ };
95
+ }
96
+ export function getTemplateDetails(id, channel) {
97
+ console.log('getting template', id, channel);
98
+ return {
99
+ type: types.GET_TEMPLATE_DETAILS_REQUEST,
100
+ id,
101
+ channel,
102
+ };
103
+ }
104
+
105
+ export function resetTemplateData() {
106
+ return {
107
+ type: types.RESET_TEMPLATE_DATA,
108
+ };
109
+ }
110
+
111
+ export function resetUploadData() {
112
+ console.log('clearing upload data');
113
+ return {
114
+ type: types.RESET_UPLOAD_DATA,
115
+ };
116
+ }
117
+
118
+ export function resetTemplateStoreData() {
119
+ return {
120
+ type: types.CLEAR_TEMPLATE_STORE_DATA,
121
+ };
122
+ }
@@ -1,47 +1,49 @@
1
- /*
2
- *
3
- * Templates constants
4
- *
5
- */
6
-
7
- export const DEFAULT_ACTION = 'app/Templates/DEFAULT_ACTION';
8
-
9
- export const GET_ALL_TEMPLATES_REQUEST = 'app/v2Containers/Templates/GET_ALL_TEMPLATES_REQUEST';
10
- export const GET_ALL_TEMPLATES_SUCCESS = 'app/v2Containers/Templates/GET_ALL_TEMPLATES_SUCCESS';
11
- export const GET_ALL_TEMPLATES_FAILURE = 'app/v2Containers/Templates/GET_ALL_TEMPLATES_FAILURE';
12
-
13
- export const DELETE_TEMPLATE_REQUEST = 'app/v2Containers/Templates/DELETE_TEMPLATE_REQUEST';
14
- export const DELETE_TEMPLATE_SUCCESS = 'app/v2Containers/Templates/DELETE_TEMPLATE_SUCCESS';
15
- export const DELETE_TEMPLATE_FAILURE = 'app/v2Containers/Templates/DELETE_TEMPLATE_FAILURE';
16
-
17
- export const GET_USER_LIST_REQUEST = "app/v2Containers/GET_USER_LIST_REQUEST";
18
- export const GET_USER_LIST_SUCCESS = "app/v2Containers/GET_USER_LIST_SUCCESS";
19
- export const GET_USER_LIST_FAILURE = "app/v2Containers/GET_USER_LIST_FAILURE";
20
-
21
- export const GET_WECRM_ACCOUNTS_REQUEST = "app/v2Containers/Templates/GET_WECRM_ACCOUNTS_REQUEST";
22
- export const GET_WECRM_ACCOUNTS_SUCCESS = "app/v2Containers/Templates/GET_WECRM_ACCOUNTS_SUCCESS";
23
- export const GET_WECRM_ACCOUNTS_FAILURE = "app/v2Containers/Templates/GET_WECRM_ACCOUNTS_FAILURE";
24
- export const SET_WECHAT_ACCOUNT = "app/v2Containers/Templates/SET_WECHAT_ACCOUNT";
25
-
26
- export const SET_SELECTED_LAYOUT = "app/v2Containers/Templates/SET_SELECTED_LAYOUT";
27
- export const SEND_ZIPPED_FILE_REQUEST = "app/v2Containers/Templates/SEND_ZIPPED_FILE_REQUEST";
28
- export const SEND_ZIPPED_FILE_SUCCESS = "app/v2Containers/Templates/SEND_ZIPPED_FILE_SUCCESS";
29
- export const SEND_ZIPPED_FILE_FAILURE = "app/v2Containers/Templates/SEND_ZIPPED_FILE_FAILURE";
30
-
31
- export const GET_EDM_DEAFULT_TEMPLATES_REQUEST = 'app/v2Containers/Templates/GET_EDM_DEAFULT_TEMPLATES_REQUEST';
32
- export const GET_EDM_DEAFULT_TEMPLATES_SUCCESS = 'app/v2Containers/Templates/GET_EDM_DEAFULT_TEMPLATES_SUCCESS';
33
- export const GET_EDM_DEAFULT_TEMPLATES_FAILURE = 'app/v2Containers/Templates/GET_EDM_DEAFULT_TEMPLATES_FAILURE';
34
-
35
- export const GET_TEMPLATE_DETAILS_REQUEST = 'app/v2Containers/Templates/GET_TEMPLATE_DETAILS_REQUEST';
36
- export const GET_TEMPLATE_DETAILS_SUCCESS = 'app/v2Containers/Templates/GET_TEMPLATE_DETAILS_SUCCESS';
37
- export const GET_TEMPLATE_DETAILS_FAILURE = 'app/v2Containers/Templates/GET_TEMPLATE_DETAILS_FAILURE';
38
-
39
-
40
- export const SET_EDM_TEMPLATE = "app/v2Containers/Templates/SET_EDM_TEMPLATE";
41
- export const RESET_ACCOUNT = "app/v2Containers/Templates/RESET_ACCOUNT";
42
- export const RESET_TEMPLATE = "app/v2Containers/Templates/RESET_TEMPLATE";
43
- export const RESET_TEMPLATE_DATA = "app/v2Containers/Templates/RESET_TEMPLATE_DATA";
44
- export const RESET_UPLOAD_DATA = "app/v2Containers/Templates/RESET_UPLOAD_DATA";
45
- export const CLEAR_TEMPLATE_STORE_DATA = "app/v2Containers/Templates/CLEAR_TEMPLATE_STORE_DATA";
46
-
47
- export const SET_LINE_ACCOUNT = "app/v2Containers/Templates/SET_LINE_ACCOUNT";
1
+ /*
2
+ *
3
+ * Templates constants
4
+ *
5
+ */
6
+
7
+ export const DEFAULT_ACTION = 'app/Templates/DEFAULT_ACTION';
8
+
9
+ export const GET_ALL_TEMPLATES_REQUEST = 'app/v2Containers/Templates/GET_ALL_TEMPLATES_REQUEST';
10
+ export const GET_ALL_TEMPLATES_SUCCESS = 'app/v2Containers/Templates/GET_ALL_TEMPLATES_SUCCESS';
11
+ export const GET_ALL_TEMPLATES_FAILURE = 'app/v2Containers/Templates/GET_ALL_TEMPLATES_FAILURE';
12
+
13
+ export const DELETE_TEMPLATE_REQUEST = 'app/v2Containers/Templates/DELETE_TEMPLATE_REQUEST';
14
+ export const DELETE_TEMPLATE_SUCCESS = 'app/v2Containers/Templates/DELETE_TEMPLATE_SUCCESS';
15
+ export const DELETE_TEMPLATE_FAILURE = 'app/v2Containers/Templates/DELETE_TEMPLATE_FAILURE';
16
+
17
+ export const GET_USER_LIST_REQUEST = "app/v2Containers/GET_USER_LIST_REQUEST";
18
+ export const GET_USER_LIST_SUCCESS = "app/v2Containers/GET_USER_LIST_SUCCESS";
19
+ export const GET_USER_LIST_FAILURE = "app/v2Containers/GET_USER_LIST_FAILURE";
20
+
21
+ export const GET_WECRM_ACCOUNTS_REQUEST = "app/v2Containers/Templates/GET_WECRM_ACCOUNTS_REQUEST";
22
+ export const GET_WECRM_ACCOUNTS_SUCCESS = "app/v2Containers/Templates/GET_WECRM_ACCOUNTS_SUCCESS";
23
+ export const GET_WECRM_ACCOUNTS_FAILURE = "app/v2Containers/Templates/GET_WECRM_ACCOUNTS_FAILURE";
24
+ export const SET_WECHAT_ACCOUNT = "app/v2Containers/Templates/SET_WECHAT_ACCOUNT";
25
+
26
+ export const SET_SELECTED_LAYOUT = "app/v2Containers/Templates/SET_SELECTED_LAYOUT";
27
+ export const SEND_ZIPPED_FILE_REQUEST = "app/v2Containers/Templates/SEND_ZIPPED_FILE_REQUEST";
28
+ export const SEND_ZIPPED_FILE_SUCCESS = "app/v2Containers/Templates/SEND_ZIPPED_FILE_SUCCESS";
29
+ export const SEND_ZIPPED_FILE_FAILURE = "app/v2Containers/Templates/SEND_ZIPPED_FILE_FAILURE";
30
+
31
+ export const GET_TEMPLATE_DETAILS_REQUEST = 'app/v2Containers/Templates/GET_TEMPLATE_DETAILS_REQUEST';
32
+ export const GET_TEMPLATE_DETAILS_SUCCESS = 'app/v2Containers/Templates/GET_TEMPLATE_DETAILS_SUCCESS';
33
+ export const GET_TEMPLATE_DETAILS_FAILURE = 'app/v2Containers/Templates/GET_TEMPLATE_DETAILS_FAILURE';
34
+
35
+
36
+ export const SET_EDM_TEMPLATE = "app/v2Containers/Templates/SET_EDM_TEMPLATE";
37
+ export const SET_BEE_TEMPLATE = "app/v2Containers/Templates/SET_BEE_TEMPLATE";
38
+
39
+ export const RESET_ACCOUNT = "app/v2Containers/Templates/RESET_ACCOUNT";
40
+ export const RESET_TEMPLATE = "app/v2Containers/Templates/RESET_TEMPLATE";
41
+ export const RESET_TEMPLATE_DATA = "app/v2Containers/Templates/RESET_TEMPLATE_DATA";
42
+ export const RESET_UPLOAD_DATA = "app/v2Containers/Templates/RESET_UPLOAD_DATA";
43
+ export const CLEAR_TEMPLATE_STORE_DATA = "app/v2Containers/Templates/CLEAR_TEMPLATE_STORE_DATA";
44
+
45
+ export const SET_LINE_ACCOUNT = "app/v2Containers/Templates/SET_LINE_ACCOUNT";
46
+
47
+ export const GET_DEAFULT_BEE_TEMPLATES_REQUEST = 'app/v2Containers/Templates/GET_DEAFULT_BEE_TEMPLATES_REQUEST';
48
+ export const GET_DEAFULT_BEE_TEMPLATES_SUCCESS = 'app/v2Containers/Templates/GET_DEAFULT_BEE_TEMPLATES_SUCCESS';
49
+ export const GET_DEAFULT_BEE_TEMPLATES_FAILURE = 'app/v2Containers/Templates/GET_DEAFULT_BEE_TEMPLATES_FAILURE';
@@ -208,10 +208,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
208
208
  queryParams.perPage = this.state.perPageLimit;
209
209
  const channel = this.state.channel;
210
210
  this.props.actions.getAllTemplates(channel, queryParams);
211
- //this.getAllTemplates({});
212
- // if (this.state.channel.toLowerCase() === "email") {
213
- // this.props.actions.getEdmDefaultTemplates();
214
- // }
215
211
  }
216
212
 
217
213
  window.addEventListener("message", this.handleFrameTasks);
@@ -236,7 +232,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
236
232
  nextProps.actions.getWeCrmAccounts();
237
233
  } else if (nextProps.route.name.toLowerCase() === 'email') {
238
234
  channel = 'Email';
239
- // this.props.actions.getEdmDefaultTemplates();
240
235
  } else if (nextProps.route.name.toLowerCase() === "mobilepush") {
241
236
  this.setState({defaultAccount: true});
242
237
  channel = "mobilepush";
@@ -654,7 +649,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
654
649
  {
655
650
  carouselContent.map(({
656
651
  imageUrl,
657
- actionLabel
652
+ actionLabel,
658
653
  }) => (
659
654
  <img
660
655
  width={208}
@@ -1001,7 +996,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1001
996
  break;
1002
997
  }
1003
998
  };
1004
-
999
+
1005
1000
  createTemplate(ev) {
1006
1001
  const type = this.props.location.query.type;
1007
1002
  const module = this.props.location.query.module ? this.props.location.query.module : 'default';
@@ -1120,7 +1115,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1120
1115
  toggleEdmEmailTemplateSelection = () => {
1121
1116
  this.setState( (prevState) => ({
1122
1117
  showEdmEmailTemplates: !prevState.showEdmEmailTemplates}), () => {
1123
- this.props.actions.getEdmDefaultTemplates();
1118
+ this.props.actions.getDefaultBeeTemplates();
1124
1119
  });
1125
1120
  };
1126
1121
 
@@ -1415,7 +1410,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1415
1410
  //content = template.versions.base.messages[0].Text;
1416
1411
  const lineContent = template.versions.base.content;
1417
1412
  content = {
1418
- bodyText:lineContent && lineContent.messages[0].text ? lineContent.messages[0].text : '',
1413
+ bodyText: lineContent && lineContent.messages[0].text ? lineContent.messages[0].text : '',
1419
1414
  bodyImage: lineContent && lineContent.messages[0].originalContentUrl ? lineContent.messages[0].originalContentUrl : '',
1420
1415
  };
1421
1416
  const modeType = lineContent && lineContent.messages[0].type;
@@ -1538,12 +1533,23 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1538
1533
 
1539
1534
 
1540
1535
  isLoading = () => {
1541
- const lineLoader = (this.props.Templates.getAllTemplatesInProgress && this.state.channel.toLowerCase() === 'line');
1542
- const smsLoader = (this.props.Templates.getAllTemplatesInProgress && this.state.channel.toLowerCase() === 'sms');
1543
- const wechatLoader = (((this.state.selectedAccount !== '' && this.props.Templates.getAllTemplatesInProgress) || (this.props.Templates.fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === 'wechat');
1544
- const mobilePushLoader = (((this.props.Templates.getAllTemplatesInProgress) || (this.props.Templates.fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === 'mobilepush');
1545
- const emailLoader = ((this.props.Templates.getAllTemplatesInProgress || this.props.Templates.sendingFile) && this.state.channel.toLowerCase() === 'email');
1546
- const ebillLoader = ((this.props.Templates.getAllTemplatesInProgress || this.props.Templates.sendingFile) && this.state.channel.toLowerCase() === 'ebill');
1536
+ const { EmailCreate, Templates } = this.props;
1537
+ const {
1538
+ getAllTemplatesInProgress,
1539
+ deleteTemplateInProgress,
1540
+ fetchingWeCrmAccounts,
1541
+ sendingFile,
1542
+ } = Templates;
1543
+ const lineLoader = (getAllTemplatesInProgress && this.state.channel.toLowerCase() === 'line');
1544
+ const smsLoader = (getAllTemplatesInProgress && this.state.channel.toLowerCase() === 'sms');
1545
+ const wechatLoader = (((this.state.selectedAccount !== '' && getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === 'wechat');
1546
+ const mobilePushLoader = (((getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === 'mobilepush');
1547
+ const emailLoader = (
1548
+ (getAllTemplatesInProgress ||
1549
+ sendingFile ||
1550
+ deleteTemplateInProgress ||
1551
+ EmailCreate.duplicateTemplateInProgress) && this.state.channel.toLowerCase() === 'email');
1552
+ const ebillLoader = ((getAllTemplatesInProgress || sendingFile) && this.state.channel.toLowerCase() === 'ebill');
1547
1553
  const isLoading = ((wechatLoader !== undefined) ? wechatLoader : false) ||
1548
1554
  (smsLoader !== undefined ? smsLoader : false) ||
1549
1555
  (emailLoader !== undefined ? emailLoader : false) ||
@@ -1801,7 +1807,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1801
1807
  </CapRadio.CapRadioGroup>
1802
1808
  }
1803
1809
  {
1804
- channel.toUpperCase() === LINE &&
1810
+ channel.toUpperCase() === LINE &&
1805
1811
  isFullMode
1806
1812
  ? (
1807
1813
  <CapRadio.CapRadioGroup className="line-filters" defaultValue={lineFilter} onChange={this.setLineFilter}>
@@ -1831,9 +1837,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1831
1837
  }
1832
1838
  </CapRadio.CapRadioGroup>
1833
1839
  )
1834
- : () => {
1835
- return null;
1836
- }
1840
+ : () => null
1837
1841
  }
1838
1842
  <div style={{display: "flex", justifyContent: "space-between", alignItems: 'center'}}>
1839
1843
  {isfilterContentVisisble && !isWechatEmbedded && <CapButton
@@ -1858,7 +1862,19 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1858
1862
  const creativesParams = this.getCreativesParams();
1859
1863
  const templates = this.props.TemplatesList || [];
1860
1864
  const {route} = this.props;
1861
- const loadingTip = (this.props.Templates.sendingFile && (this.state.channel.toLowerCase() === 'email' || this.state.channel.toLowerCase() === 'ebill')) ? this.props.intl.formatMessage(messages.uploadingFile) : this.props.intl.formatMessage(messages.gettingAllTemplates);
1865
+ const loadingTipMap = {
1866
+ sendingFile: 'uploadingFile',
1867
+ deleteTemplateInProgress: 'deletingTemplate',
1868
+ duplicateTemplateInProgress: 'duplicatingTemplate',
1869
+ };
1870
+ const { sendingFile, deleteTemplateInProgress } = this.props.Templates;
1871
+ const loadingTipIntl =
1872
+ ((['email', 'ebill'].includes(this.state.channel.toLowerCase() === 'email')) && sendingFile && 'sendingFile') ||
1873
+ (deleteTemplateInProgress && 'deletingTemplate') ||
1874
+ (this.props.EmailCreate.duplicateTemplateInProgress && 'duplicatingTemplate');
1875
+
1876
+ const loadingTip = messages[loadingTipIntl] ? this.props.intl.formatMessage(messages[loadingTipIntl]) : this.props.intl.formatMessage(messages.gettingAllTemplates);
1877
+
1862
1878
  return (
1863
1879
  <>
1864
1880
  {activeMode === ACCOUNT_CHANGE_MODE && this.renderAccountSelection()}
@@ -354,4 +354,12 @@ export default defineMessages({
354
354
  id: `${scope}.richMediaTemplates`,
355
355
  defaultMessage: 'Rich media templates',
356
356
  },
357
+ deletingTemplate: {
358
+ id: `${scope}.deletingTemplate`,
359
+ defaultMessage: 'Deleting template...',
360
+ },
361
+ duplicatingTemplate: {
362
+ id: `${scope}.duplicatingTemplate`,
363
+ defaultMessage: 'Duplicating template...'
364
+ },
357
365
  });