@capillarytech/creatives-library 6.9.5 → 6.9.8

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 (78) 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 +3 -3
  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 +278 -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/App/constants.js +1 -0
  32. package/v2Containers/CreativesContainer/SlideBoxFooter.js +51 -51
  33. package/v2Containers/CreativesContainer/actions.js +27 -27
  34. package/v2Containers/CreativesContainer/constants.js +17 -17
  35. package/v2Containers/CreativesContainer/index.js +7 -2
  36. package/v2Containers/CreativesContainer/index.scss +44 -44
  37. package/v2Containers/CreativesContainer/messages.js +305 -305
  38. package/v2Containers/CreativesContainer/reducer.js +29 -29
  39. package/v2Containers/CreativesContainer/sagas.js +11 -11
  40. package/v2Containers/CreativesContainer/selectors.js +30 -30
  41. package/v2Containers/CreativesContainer/tests/actions.test.js +18 -18
  42. package/v2Containers/CreativesContainer/tests/index.test.js +10 -10
  43. package/v2Containers/CreativesContainer/tests/reducer.test.js +9 -9
  44. package/v2Containers/CreativesContainer/tests/sagas.test.js +15 -15
  45. package/v2Containers/CreativesContainer/tests/selectors.test.js +10 -10
  46. package/v2Containers/Email/constants.js +1 -0
  47. package/v2Containers/Email/index.js +170 -116
  48. package/v2Containers/Email/initialSchema.js +18 -3
  49. package/v2Containers/Email/sagas.js +2 -2
  50. package/v2Containers/Email/selectors.js +5 -0
  51. package/v2Containers/EmailWrapper/index.js +19 -3
  52. package/v2Containers/Line/Container/ImageCarousel/Content.js +2 -2
  53. package/v2Containers/Line/Container/ImageCarousel/constants.js +1 -1
  54. package/v2Containers/Line/Container/ImageCarousel/index.js +6 -3
  55. package/v2Containers/Line/Container/_lineCreate.scss +6 -0
  56. package/v2Containers/TagList/index.js +9 -2
  57. package/v2Containers/Templates/actions.js +122 -117
  58. package/v2Containers/Templates/constants.js +49 -47
  59. package/v2Containers/Templates/index.js +36 -20
  60. package/v2Containers/Templates/messages.js +8 -0
  61. package/v2Containers/Templates/reducer.js +153 -145
  62. package/v2Containers/Templates/sagas.js +179 -179
  63. package/v2Containers/Templates/selectors.js +19 -1
  64. package/v2Containers/Templates/tests/actions.test.js +18 -18
  65. package/v2Containers/Templates/tests/index.test.js +10 -10
  66. package/v2Containers/Templates/tests/reducer.test.js +9 -9
  67. package/v2Containers/Templates/tests/sagas.test.js +15 -15
  68. package/v2Containers/Templates/tests/selectors.test.js +10 -10
  69. package/v2Containers/TemplatesV2/TemplatesV2.style.js +29 -29
  70. package/v2Containers/TemplatesV2/actions.js +16 -16
  71. package/v2Containers/TemplatesV2/constants.js +10 -10
  72. package/v2Containers/TemplatesV2/messages.js +61 -61
  73. package/v2Containers/TemplatesV2/selectors.js +25 -25
  74. package/v2Containers/TemplatesV2/tests/actions.test.js +18 -18
  75. package/v2Containers/TemplatesV2/tests/index.test.js +10 -10
  76. package/v2Containers/TemplatesV2/tests/reducer.test.js +9 -9
  77. package/v2Containers/TemplatesV2/tests/sagas.test.js +15 -15
  78. package/v2Containers/TemplatesV2/tests/selectors.test.js +10 -10
@@ -187,7 +187,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
187
187
  {this.props.moduleFilterEnabled ? <CapSelect getPopupContainer={(triggerNode) => triggerNode.parentNode} style={{width: '250px', marginBottom: '16px', minWidth: 'initial', display: 'inherit'}} onChange={this.props.onContextChange} defaultValue="All" options={options}>
188
188
  </CapSelect> : ''}
189
189
  <Tree
190
- styling={{'height': '350px', 'overflow': 'auto'}}
190
+ styling={{height: '350px', overflow: 'auto'}}
191
191
  onSelect={this.handleOnSelect}
192
192
  selectedKeys={this.state.tagValue}
193
193
  expandedKeys={this.state.expandedKeys}
@@ -44,7 +44,7 @@ class Edmeditor extends React.Component { // eslint-disable-line react/prefer-st
44
44
  console.log('current language edm editor loading', this.props.id, this.props.edmSrc);
45
45
  return (
46
46
  this.props.edmSrc ?
47
- (<iframe id={this.props.id} className={this.props.activeClass} src={this.props.edmSrc} height="460" width="100%" style={{"height": "calc(100vh - 180px)"}}></iframe>)
47
+ (<iframe id={this.props.id} className={this.props.activeClass} src={this.props.edmSrc} height="460" width="100%" style={{height: "calc(100vh - 180px)"}}></iframe>)
48
48
  : 'aaasass'
49
49
  );
50
50
  }
@@ -912,7 +912,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
912
912
 
913
913
  };
914
914
  saveForm(saveForm) {
915
-
916
915
  if (this.props.isNewVersionFlow && !saveForm) {
917
916
  this.props.getValidationData();
918
917
  return;
@@ -82,9 +82,9 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
82
82
  console.log('Inside ', tag.label);
83
83
  mainTags[tag.value] = {
84
84
  'tag-header': true,
85
- name: tag.label[this.props.userLocale] ? tag.label[this.props.userLocale] : tag.label.en,
86
- desc: tag.desc ? tag.desc : tag.label.en,
87
- subtags: tag.subtags,
85
+ "name": tag.label[this.props.userLocale] ? tag.label[this.props.userLocale] : tag.label.en,
86
+ "desc": tag.desc ? tag.desc : tag.label.en,
87
+ "subtags": tag.subtags,
88
88
  };
89
89
  }
90
90
  });
package/index.html CHANGED
@@ -11,6 +11,9 @@
11
11
  <meta http-equiv="Pragma" content="no-cache" />
12
12
  <meta http-equiv="Expires" content="0" />
13
13
  <script src="https://use.typekit.net/ifw1ntv.js"></script>
14
+
15
+ <script src="https://app-rsrc.getbee.io/plugin/BeePlugin.js" type="text/javascript"></script>
16
+
14
17
  <!-- Google Tag Manager -->
15
18
  <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
16
19
  new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "6.9.5",
4
+ "version": "6.9.8",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -16,6 +16,7 @@
16
16
  "@bugsnag/js": "^7.2.1",
17
17
  "@bugsnag/plugin-react": "^7.2.1",
18
18
  "@capillarytech/cap-ui-utils": "1.2.6",
19
+ "@mailupinc/bee-plugin": "^1.2.0",
19
20
  "babel-cli": "^6.26.0",
20
21
  "chalk": "1.1.3",
21
22
  "jquery": "^3.3.1",
package/services/api.js CHANGED
@@ -319,23 +319,38 @@ export const getCmsTemplateSettings = (cmsType, projectId, cmsMode, langId, isEd
319
319
  return API.get(url);
320
320
  };
321
321
 
322
+ export const getCmsTemplateSettingsV2 = (cmsType, projectId, cmsMode, langId, isEdmSupport) => {
323
+ const url = `${API_ENDPOINT}/cms/v2/getDetails/?type=${cmsType}&projectId=${projectId}&cmsMode=${cmsMode}&langId=${langId}&isEdmSupport=${isEdmSupport ? 1 : 0}`;
324
+ return API.get(url);
325
+ };
326
+
327
+
322
328
  export const getCmsTemplateData = (cmsType, projectId, langId) => {
323
329
  const url = `${API_ENDPOINT}/cms/getContent?type=${cmsType}&projectId=${projectId}&langId=${langId}`;
324
330
  return API.get(url);
325
331
  };
326
332
 
333
+ export const getCmsTemplateDataV2 = (cmsType, projectId, langId) => {
334
+ const url = `${API_ENDPOINT}/cms/v2/getContent?type=${cmsType}&projectId=${projectId}&langId=${langId}`;
335
+ return API.get(url);
336
+ };
337
+
327
338
  export const getCmsData = (cmsType, projectId, langId) => {
328
339
  const url = `${API_ENDPOINT}/cms/getCmsData?type=${cmsType}&projectId=${projectId}&langId=${langId}`;
329
340
  return API.get(url);
330
341
  };
331
342
 
332
-
333
343
  export const getEdmTemplates = () => {
334
344
  console.log('in api.js');
335
345
  const url = `${API_ENDPOINT}/templates/email/default`;
336
346
  return request(url, getAPICallObject('GET'));
337
347
  };
338
348
 
349
+ export const getDefaultBeeTemplates = () => {
350
+ const url = `${API_ENDPOINT}/templates/v2/email/default`;
351
+ return request(url, getAPICallObject('GET'));
352
+ }
353
+
339
354
  // All about line
340
355
 
341
356
  export const createLineTemplate = ({template}) => {
@@ -0,0 +1,278 @@
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 = [];
44
+ const [visibleTaglist, setVisibleTaglist] = useState(false);
45
+ const [showRowMetaModal, setRowMetaModal] = useState(false);
46
+ const [selectedTag, setSelectedTag] = useState({});
47
+ const [rowMetaInfo, setRowMetaInfo] = useState({});
48
+ const [rowName, setRowName] = useState('');
49
+ const [rowTags, setRowTags] = useState('');
50
+ const [rowCategory, setRowCategory] = useState('');
51
+
52
+ const savedCallback = useRef();
53
+ const filteredTags = (tags || []).filter((obj) => obj.definition.value !== UNSUBSCRIBE);
54
+ let intervalTimer;
55
+
56
+ useEffect(() => {
57
+ savedCallback.current = Object.keys(selectedTag).length > 0 ? selectedTag : rowMetaInfo;
58
+ }, [selectedTag, rowMetaInfo]);
59
+
60
+ useEffect(() => {
61
+ const beeConfig = {
62
+ uid,
63
+ container: 'bee-plugin-container',
64
+ rowsConfiguration: {
65
+ emptyRows: true,
66
+ defaultRows: true,
67
+ },
68
+ contentDialog: {
69
+ specialLinks: {
70
+ label: UNSUBSCRIBE,
71
+ handler(resolve) {
72
+ resolve({
73
+ type: 'custom',
74
+ label: UNSUBSCRIBE,
75
+ link: `{{${UNSUBSCRIBE}}}`,
76
+ });
77
+ },
78
+ },
79
+ mergeTags: {
80
+ label: 'search',
81
+ handler: async (resolve, reject) => {
82
+ // this will open tag modal
83
+ await setVisibleTaglist(true);
84
+ // until tag modal will not open promise will not execute
85
+ // once tag modal is opened it will start 2 sec interval to wait use has selected any tag or cancel the tag selection
86
+ const promise = new Promise((resolveP) => {
87
+ intervalTimer = setInterval(() => {
88
+ // this will execute, if user cancel the tag selection
89
+ if ((savedCallback.current || {}).close === true) {
90
+ reject();
91
+ clearInterval(intervalTimer);
92
+ return;
93
+ }
94
+ // this block is checking use has selected any tag or not
95
+ if (Object.keys(savedCallback.current || {}).length > 0) {
96
+ resolveP(savedCallback.current);
97
+ setSelectedTag({});
98
+ clearInterval(intervalTimer);
99
+ }
100
+ }, 2000);
101
+ });
102
+ // once prmise will resolve , pass the resolve data to handler to show tags in bee edior
103
+ const result = await promise;
104
+ resolve(result);
105
+ },
106
+ },
107
+ saveRow: {
108
+ handler: async (resolve, reject, args) => {
109
+ await setRowMetaModal(true);
110
+ const promise = new Promise((resolveP) => {
111
+ intervalTimer = setInterval(() => {
112
+ if ((savedCallback.current || {}).close === true) {
113
+ reject();
114
+ clearInterval(intervalTimer);
115
+ setRowMetaInfo({});
116
+ setRowName('');
117
+ setRowTags('');
118
+ setRowCategory('');
119
+ return;
120
+ }
121
+ if (Object.keys(savedCallback.current || {}).length > 0) {
122
+ const data = {...args, ...savedCallback.current};
123
+ resolveP(data);
124
+ }
125
+ }, 2000);
126
+ });
127
+ const result = await promise;
128
+ resolve(result); // "done!"
129
+ setRowMetaInfo({});
130
+ setRowName('');
131
+ setRowTags('');
132
+ setRowCategory('');
133
+ clearInterval(intervalTimer);
134
+ },
135
+ },
136
+ },
137
+ onSave: (jsonFile, htmlFile) => {
138
+ saveBeeData(jsonFile, htmlFile);
139
+ },
140
+ // will use this function on save row feature
141
+ onSaveRows: (jsonFile, htmlFile) => {
142
+ console.log('bee-plugin-container onSaveRows', jsonFile, htmlFile);
143
+ },
144
+ };
145
+ window.BeePlugin.create(tokenData, beeConfig, (instance) => {
146
+ beePluginInstance = instance;
147
+ const parseJson = JSON.parse(beeJson);
148
+ beePluginInstance.start(parseJson);
149
+ saveBeeInstance(beePluginInstance);
150
+ });
151
+ return () => clearInterval(intervalTimer);
152
+ }, []);
153
+
154
+ const onTagSelect = (result) => {
155
+ const msg = {
156
+ name: result,
157
+ value: `{{${result}}}`,
158
+ };
159
+ setSelectedTag(msg);
160
+ setVisibleTaglist(false);
161
+ };
162
+
163
+ const onCancelTagList = () => {
164
+ setVisibleTaglist(false);
165
+ setSelectedTag({close: true});
166
+ };
167
+
168
+ const handleCancel = () => {
169
+ setRowMetaModal(false);
170
+ setRowMetaInfo({close: true});
171
+ };
172
+
173
+ const handleOk = () => {
174
+ const rowInfo = {};
175
+ if (rowTags !== '') {
176
+ rowInfo.tags = rowTags;
177
+ }
178
+ if (rowCategory !== '') {
179
+ rowInfo.category = rowCategory;
180
+ }
181
+ setRowMetaInfo({
182
+ name: rowName,
183
+ ...rowInfo,
184
+ });
185
+ setRowMetaModal(false);
186
+ };
187
+ const isDisableSave = () => rowName === '';
188
+
189
+ const onRowChange = useCallback((e) => {
190
+ setRowName(e.target.value);
191
+ });
192
+ // will use this function on save row feature
193
+ const onChangeCategoy = (e) => {
194
+ console.log('onChangeCategoy', e);
195
+ };
196
+
197
+ const onTagChange = (e) => {
198
+ setRowTags(e.target.value);
199
+ };
200
+
201
+ const contentSection = <>
202
+ <CapInput
203
+ label={<FormattedMessage {...messages.rowName} />}
204
+ placeholder={formatMessage(messages.rowPlaceHolder)}
205
+ onChange={onRowChange}
206
+ value={rowName}
207
+ maxLength={50}
208
+ style={{ width: '324px', paddingBottom: '16px' }}
209
+ />
210
+ <CapSelect
211
+ label="Category"
212
+ style={{ width: 250, paddingBottom: '16px'}}
213
+ options={categoryOptions}
214
+ selectPlaceholder={formatMessage(messages.select)}
215
+ placeholder={
216
+ <FormattedMessage {...messages.selectCategoyPlaceholder} />
217
+ }
218
+ onChange={onChangeCategoy}
219
+ />
220
+ <CapInput
221
+ label={<FormattedMessage {...messages.tags} />}
222
+ placeholder={formatMessage(messages.tagPlaceHolder)}
223
+ onChange={onTagChange}
224
+ value={rowTags}
225
+ maxLength={50}
226
+ style={{ width: '324px', paddingBottom: '16px'}}
227
+ />
228
+ </>;
229
+ return (
230
+ <>
231
+ <div id="bee-plugin-container" style={{ height: '500px'}}>
232
+ </div>
233
+ <TagList
234
+ moduleFilterEnabled={moduleFilterEnabled}
235
+ label={label}
236
+ onTagSelect={onTagSelect}
237
+ location={location}
238
+ tags={filteredTags}
239
+ injectedTags={injectedTags}
240
+ className={className}
241
+ id={id}
242
+ userLocale={userLocale}
243
+ selectedOfferDetails={selectedOfferDetails}
244
+ visibleTaglist={visibleTaglist}
245
+ hidePopover
246
+ modalProps={{
247
+ onCancel: onCancelTagList,
248
+ style: { left: 135, top: 250 },
249
+ className: "bee-editor-tag-list",
250
+ }}
251
+ onContextChange={onContextChange}
252
+ />
253
+ <CapModal
254
+ visible={showRowMetaModal}
255
+ onCancel={handleCancel}
256
+ title={formatMessage(messages.customRows)}
257
+ footer={[
258
+ <CapButton key="back" onClick={handleCancel}>{formatMessage(messages.cancel)}</CapButton>,
259
+ <CapButton key="submit" type="primary" id="delete-version" onClick={handleOk} disabled={isDisableSave()}>
260
+ {formatMessage(messages.save)}
261
+ </CapButton>,
262
+ ]}
263
+ >
264
+ {contentSection}
265
+ </CapModal>
266
+ </>
267
+ );
268
+ }
269
+
270
+ BeeEditor.propTypes = {
271
+ beeJson: PropTypes.object.isRequired,
272
+ tokenData: PropTypes.object.isRequired,
273
+ uid: PropTypes.string.isRequired,
274
+ showTagsPopover: PropTypes.func.isRequired,
275
+ intl: intlShape.isRequired,
276
+ };
277
+
278
+ export default injectIntl(BeeEditor);
@@ -0,0 +1,11 @@
1
+ .cap-modal-v2.bee-editor-tag-list {
2
+ .ant-modal-content {
3
+ .ant-modal-body {
4
+ padding-top: 20px;
5
+ padding-bottom: 10px;
6
+ }
7
+ .ant-modal-footer {
8
+ display: none;
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,47 @@
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
+ });
@@ -0,0 +1,10 @@
1
+ // import React from 'react';
2
+ // import { shallow } from 'enzyme';
3
+
4
+ // import Beeeditor from '../index';
5
+
6
+ describe('<Beeeditor />', () => {
7
+ it('Expect to have unit tests specified', () => {
8
+ expect(true).toEqual(false);
9
+ });
10
+ });
@@ -156,50 +156,72 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
156
156
  }
157
157
 
158
158
  render() {
159
- const tg = this.props.tags;
159
+ const { hidePopover = false, tags = {}, intl = {}, moduleFilterEnabled, label, modalProps } = this.props;
160
+ const tg = tags;
161
+ const {formatMessage} = intl;
162
+ const { tagValue, expandedKeys, autoExpandParent, searchValue, visible } = this.state;
160
163
  const options = [
161
164
  {
162
165
  value: "All",
163
- label: this.props.intl.formatMessage(messages.all),
166
+ label: formatMessage(messages.all),
164
167
  key: 'all',
165
168
  },
166
169
  {
167
170
  value: "Outbound",
168
- label: this.props.intl.formatMessage(messages.outbound),
171
+ label: formatMessage(messages.outbound),
169
172
  key: 'outbound',
170
173
  },
171
174
  {
172
175
  value: "Loyalty",
173
- label: this.props.intl.formatMessage(messages.loyalty),
176
+ label: formatMessage(messages.loyalty),
174
177
  key: 'loyalty',
175
178
  },
176
179
  ];
180
+ const contentSection = (<div>
181
+ <CapSpin tip={formatMessage(messages.gettingTags)} spinning={this.props.loading}>
182
+ <Search
183
+ style={{ marginBottom: 8, width: '250px'}}
184
+ placeholder={formatMessage(messages.search)}
185
+ onChange={this.onChange} />
186
+ {moduleFilterEnabled ?
187
+ <CapSelect
188
+ getPopupContainer={(triggerNode) => triggerNode.parentNode}
189
+ style={{width: '250px', marginBottom: '16px', minWidth: 'initial', display: 'inherit'}}
190
+ onChange={this.props.onContextChange}
191
+ defaultValue={formatMessage(messages.all)}
192
+ options={options}>
193
+ </CapSelect> : ''}
194
+ <CapTree
195
+ styling={{height: '350px', overflow: 'auto'}}
196
+ onSelect={this.handleOnSelect}
197
+ selectedKeys={tagValue}
198
+ expandedKeys={expandedKeys}
199
+ autoExpandParent={autoExpandParent}
200
+ onExpand={this.onExpand}
201
+ >
202
+ {this.renderTags(tg, searchValue)}
203
+ </CapTree>
204
+ </CapSpin>
205
+ </div>);
177
206
  return (
178
- <div>
207
+ <>
208
+ {hidePopover ? <CapModal
209
+ visible={this.props.visibleTaglist}
210
+ footer={[]}
211
+ {...modalProps}
212
+ >
213
+ {contentSection}
214
+ </CapModal> :
179
215
  <CapPopover
180
- visible={this.state.visible}
216
+ visible={visible}
181
217
  onVisibleChange={this.togglePopoverVisibility}
182
- content={<div>
183
- <CapSpin tip={this.props.intl.formatMessage(messages.gettingTags)} spinning={this.props.loading}>
184
- <Search style={{ marginBottom: 8, width: '250px'}} placeholder={this.props.intl.formatMessage(messages.search)} onChange={this.onChange} />
185
- {this.props.moduleFilterEnabled ? <CapSelect getPopupContainer={(triggerNode) => triggerNode.parentNode} style={{width: '250px', marginBottom: '16px', minWidth: 'initial', display: 'inherit'}} onChange={this.props.onContextChange} defaultValue={this.props.intl.formatMessage(messages.all)} options={options}>
186
- </CapSelect> : ''}
187
- <CapTree
188
- styling={{height: '350px', overflow: 'auto'}}
189
- onSelect={this.handleOnSelect}
190
- selectedKeys={this.state.tagValue}
191
- expandedKeys={this.state.expandedKeys}
192
- autoExpandParent={this.state.autoExpandParent}
193
- onExpand={this.onExpand}
194
- >
195
- {this.renderTags(tg, this.state.searchValue)}
196
- </CapTree>
197
- </CapSpin>
198
- </div>}
218
+ content={contentSection}
199
219
  trigger="click"
200
- placement="bottomRight">
201
- <CapButton isAddBtn type="flat">{this.props.label !== '' ? this.props.label : ''}</CapButton>
220
+ placement="topLeft"
221
+ >
222
+ <CapButton isAddBtn type="flat">{label || ''}</CapButton>
202
223
  </CapPopover>
224
+ }
203
225
  <CapModal
204
226
  visible={this.state.showModal}
205
227
  title={this.props.intl.formatMessage(messages["Dynamic Days before Expiry"])}
@@ -215,7 +237,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
215
237
  <p>{this.props.intl.formatMessage(messages.numberOfDaysBeforeExpiry)}</p>
216
238
  <CapInput onChange={this.handleDynamicDateChange} value={this.state.dynamicDateValue} size="default"></CapInput>
217
239
  </CapModal>
218
- </div>
240
+ </>
219
241
  );
220
242
  }
221
243
  }
@@ -228,6 +250,13 @@ CapTagList.propTypes = {
228
250
  loading: PropTypes.bool,
229
251
  moduleFilterEnabled: PropTypes.bool,
230
252
  intl: intlShape.isRequired,
253
+ visibleTaglist: PropTypes.bool,
254
+ hidePopover: PropTypes.bool,
255
+ modalProps: PropTypes.any,
256
+ };
257
+
258
+ CapTagList.defaultValue = {
259
+ hidePopover: false,
231
260
  };
232
261
 
233
262
  export default injectIntl(CapTagList);
@@ -7,23 +7,23 @@
7
7
  import React from 'react';
8
8
  import PropTypes from 'prop-types';
9
9
  // import styled from 'styled-components';
10
- import {CapButton, CapCustomCard} from '@capillarytech/cap-ui-library';
10
+ import {CapButton, CapCustomCard, CapSpin} from '@capillarytech/cap-ui-library';
11
11
  import { FormattedMessage } from 'react-intl';
12
12
  import messages from './messages';
13
13
  const {CapCustomCardList} = CapCustomCard;
14
14
  function CmsTemplatesComponent(props) {
15
- const cardDataList = props.cmsTemplates.map((template) => (
15
+ const cardDataList = (props.cmsTemplates || []).map((template) => (
16
16
  {
17
17
  key: template.name,
18
18
  title: template.name,
19
19
  url: template.versions.base.preview_http_url,
20
20
  hoverOption: <CapButton onClick={() => props.handleEdmDefaultTemplateSelection(template._id)}><FormattedMessage {...messages.select}/></CapButton>,
21
21
  }));
22
- return (<div>
22
+ return (<CapSpin spinning={props.cmsTemplatesLoader}>
23
23
  <div className="pagination-container">
24
24
  <CapCustomCardList cardList={cardDataList} type="Email" />
25
25
  </div>
26
- </div>);
26
+ </CapSpin>);
27
27
  }
28
28
 
29
29
  CmsTemplatesComponent.propTypes = {
@@ -44,7 +44,7 @@ class Edmeditor extends React.Component { // eslint-disable-line react/prefer-st
44
44
  console.log('current language edm editor loading', this.props.id, this.props.edmSrc);
45
45
  return (
46
46
  this.props.edmSrc ?
47
- (<iframe id={this.props.id} className={this.props.activeClass} src={this.props.edmSrc} height="460" width="100%" style={{"height": "calc(100vh - 180px)"}}></iframe>)
47
+ (<iframe id={this.props.id} className={this.props.activeClass} src={this.props.edmSrc} height="460" width="100%" style={{height: "calc(100vh - 180px)"}}></iframe>)
48
48
  : 'aaasass'
49
49
  );
50
50
  }
@@ -9,8 +9,8 @@
9
9
 
10
10
  #emailPreivew-container {
11
11
  position: relative;
12
- left: 20vw;
13
- width: 80vw;
12
+ left: 18vw;
13
+ width: 82vw;
14
14
  height: 100vh;
15
15
  background: rgba(255,255,255,1);
16
16
  // padding: 0 24px 0 24px;