@capillarytech/creatives-library 0.1.28 → 0.1.30

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.
@@ -0,0 +1,195 @@
1
+ import React, { PropTypes } from 'react';
2
+ // import styled from 'styled-components';
3
+
4
+ import { Menu, Image, Dropdown, Popup } from 'semantic-ui-react';
5
+ import { FormattedMessage } from 'react-intl';
6
+ import { Link } from 'react-router';
7
+ import { loadItem } from 'services/localStorageApi';
8
+ import messages from './messages';
9
+ import './_newtopbar.scss';
10
+ import { CapPopover, CapTreeSelect } from '@capillarytech/cap-react-ui-library';
11
+
12
+ const logo = require('./assets/images/capillary_logo_2.png');
13
+
14
+ class NewTopBar extends React.Component { // eslint-disable-line react/prefer-stateless-function
15
+ constructor(props) {
16
+ super(props);
17
+ this.state = {
18
+ activeItem: '',
19
+ orgList: [],
20
+ subOrgList: [],
21
+ selectedOrg: loadItem('orgID'),
22
+ selectedSubOrg: loadItem('subOrgID'),
23
+ };
24
+ this.handleItemClick = this.handleItemClick.bind(this);
25
+ this.logout = this.logout.bind(this);
26
+ this.handleOrgChange = this.handleOrgChange.bind(this);
27
+ this.handleSubOrgChange = this.handleSubOrgChange.bind(this);
28
+ }
29
+
30
+ componentDidUpdate(prevProps) {
31
+ if (prevProps.orgID !== this.props.orgID) {
32
+ this.props.navigateToDashboard();
33
+ }
34
+ }
35
+
36
+ handleOrgChange(data) {
37
+ const orgId = data.value;
38
+ if (this.state.selectedOrg !== orgId) {
39
+ this.props.changeOrg(orgId);
40
+ this.setState({ selectedOrg: orgId });
41
+ }
42
+ }
43
+
44
+ handleSubOrgChange(data) {
45
+ const subOrgId = data.value;
46
+ if (this.state.selectedSubOrg !== subOrgId) {
47
+ this.props.changeSubOrg(subOrgId);
48
+ this.setState({ selectedSubOrg: subOrgId });
49
+ }
50
+ }
51
+
52
+ handleItemClick(e) {
53
+ this.setState({ activeItem: e.target.id });
54
+ }
55
+
56
+ logout(e) {
57
+ e.preventDefault();
58
+ this.props.logout();
59
+ }
60
+
61
+ render() {
62
+ console.log("topbarprops", this.props);
63
+ const proxyOrgList = this.props.proxyOrgList;
64
+ const proxySubOrgList = this.props.proxySubOrgList;
65
+ const defaultOrgName = this.props.orgName;
66
+ const defaultSubOrgName = this.props.subOrgName;
67
+ const currentOrgName = this.props.currentOrgName;
68
+ const selectedOrg = loadItem('orgID');
69
+ const selectedSubOrg = loadItem('subOrgID');
70
+ const productOptions = [];
71
+ if (this.props.productMenuData.length > 1) {
72
+ _.forEach(this.props.productMenuData, (product) => {
73
+ productOptions.push(
74
+ <li className="productOption" key={product.text} value={product.text}>{product.text}</li>
75
+ );
76
+ });
77
+ }
78
+
79
+ const content = (
80
+ <div>
81
+ { proxyOrgList.length > 1 ?
82
+ <Menu.Item className="dropdownItem" key="orgSelection">
83
+ <div className="popoverTitle">Organization</div>
84
+ <FormattedMessage {...messages.dropdownMessage}>
85
+ {(message) => <CapTreeSelect
86
+ showSearch="true"
87
+ placeholder={message}
88
+ className="org-list-drp-dwn"
89
+ defaultValue={selectedOrg}
90
+ treeData={proxyOrgList}
91
+ onChange={(data) => this.handleOrgChange(data)}
92
+ />}
93
+ </FormattedMessage>
94
+ </Menu.Item> :
95
+ <Menu.Item key="default-org">
96
+ {defaultOrgName}
97
+ </Menu.Item>
98
+ }
99
+ { proxySubOrgList.length > 1 ?
100
+ <Menu.Item className="dropdownItem" key="subOrgSelection">
101
+ <FormattedMessage {...messages.dropdownMessage}>
102
+ {(message) => <Dropdown
103
+ placeholder={message}
104
+ className="org-list-drp-dwn"
105
+ defaultValue={selectedSubOrg}
106
+ search
107
+ options={proxySubOrgList}
108
+ selection
109
+ onChange={(event, data) => this.handleSubOrgChange(data)}
110
+ />}
111
+ </FormattedMessage>
112
+ </Menu.Item> :
113
+ <Menu.Item key="default-subOrg">
114
+ {defaultSubOrgName}
115
+ </Menu.Item>
116
+ }
117
+ { this.props.productMenuData.length > 1 ?
118
+ <div>
119
+ <div className="popoverTitle">Products</div>
120
+ <ul defaultValue={'CAMPAIGNS'} >
121
+ {productOptions}
122
+ </ul>
123
+ </div>
124
+ :
125
+ <div className="module-menu-header">{this.props.productMenuData[0].text}</div>
126
+ }
127
+
128
+ </div>
129
+ );
130
+
131
+ return (
132
+ <Menu className="navbar" key="navbar">
133
+
134
+ <Menu.Item key="logo" as={Link} to="/" name="logo" className="logo-container" onClick={this.handleItemClick}>
135
+ <Image className="logo" src={logo} alt="Capillary Technologies" />
136
+ </Menu.Item>
137
+
138
+ <CapPopover overlayClassName="navbarPopover" placement="topLeft" content={content} trigger="click">
139
+ <div className="displayOrg">
140
+ <div className="orgDetails">
141
+ <div className="orgName">{currentOrgName}</div>
142
+ <div className="subOrgName">/ {this.props.subOrgName}</div>
143
+ </div>
144
+ <div className="moduleName">Campaigns
145
+ </div>
146
+ </div>
147
+ </CapPopover>
148
+
149
+ <Menu.Menu position="right">
150
+ <Menu.Item className="navbarMenuOptions" key="name">
151
+ {this.props.firstName}&nbsp;{this.props.lastName}
152
+ </Menu.Item>
153
+ <Menu.Item className="navbarMenuOptions" key="notifications">
154
+ <i className="material-icons navbarIcon">notifications</i>
155
+ </Menu.Item>
156
+ <Menu.Item className="navbarMenuOptions" key="user-details">
157
+ <Popup
158
+ trigger={<i className="material-icons navbarIcon">person</i>}
159
+ content={< div className="ui secondary vertical menu">
160
+ <a href="" className="item hide"><FormattedMessage {...messages.profile} /><i className="user icon" /></a>
161
+ <a href="" className="item hide"><FormattedMessage {...messages.settings} /> <i className="settings icon" /></a>
162
+ <a href="" className="item" onClick={this.logout}><FormattedMessage {...messages.logout} />
163
+ <i className="sign out icon" /></a> </div >}
164
+ on="click" position="bottom right" offset={7}
165
+ />
166
+ </Menu.Item>
167
+ <Menu.Item className="navbarMenuOptions" key="help">
168
+ <i className="material-icons navbarIcon">help</i>
169
+ </Menu.Item>
170
+ </Menu.Menu>
171
+ </Menu>
172
+
173
+ );
174
+ }
175
+ }
176
+
177
+ NewTopBar.propTypes = {
178
+ userName: PropTypes.string,
179
+ firstName: PropTypes.string,
180
+ lastName: PropTypes.string,
181
+ proxyOrgList: PropTypes.array,
182
+ proxySubOrgList: PropTypes.array,
183
+ orgName: PropTypes.string,
184
+ currentOrgName: PropTypes.string,
185
+ subOrgName: PropTypes.string,
186
+ orgID: PropTypes.number,
187
+ subOrgID: PropTypes.number,
188
+ navigateToDashboard: PropTypes.func,
189
+ changeOrg: PropTypes.func,
190
+ changeSubOrg: PropTypes.func,
191
+ logout: PropTypes.func,
192
+ productMenuData: PropTypes.array.isRequired,
193
+ };
194
+
195
+ export default NewTopBar;
@@ -0,0 +1,29 @@
1
+ /*
2
+ * TopBar Messages
3
+ *
4
+ * This contains all the text for the TopBar component.
5
+ */
6
+ import { defineMessages } from 'react-intl';
7
+
8
+ export default defineMessages({
9
+ profile: {
10
+ id: 'reon.components.TopBar.profile',
11
+ defaultMessage: 'Profile',
12
+ },
13
+ settings: {
14
+ id: 'reon.components.TopBar.settings',
15
+ defaultMessage: 'Settings',
16
+ },
17
+ logout: {
18
+ id: 'reon.components.TopBar.logout',
19
+ defaultMessage: 'Logout',
20
+ },
21
+ dropdownMessage: {
22
+ id: 'reon.components.TopBar.brand.dropdown',
23
+ defaultMessage: 'Select Brand',
24
+ },
25
+ hi: {
26
+ id: 'app.components.TopBar.brand.dropdown',
27
+ defaultMessage: 'Hi',
28
+ },
29
+ });
@@ -0,0 +1,10 @@
1
+ // import React from 'react';
2
+ // import { shallow } from 'enzyme';
3
+
4
+ // import TopBar from '../index';
5
+
6
+ // describe('<TopBar />', () => {
7
+ // it('Expect to have unit tests specified', () => {
8
+ // expect(true).toEqual(false);
9
+ // });
10
+ // });
@@ -73,7 +73,7 @@ class PreviewSideBar extends React.Component { // eslint-disable-line react/pref
73
73
  if (isMsgReady) {
74
74
  content = {
75
75
  bodyText: this.props.templateData.versions.base.content.messages[0].text ? this.props.templateData.versions.base.content.messages[0].text : '',
76
- bodyImage: this.props.templateData.versions.base.content.messages[0].originalContentUrl ? this.props.templateData.versions.base.content.messages[0].originalContentUrl : '',
76
+ bodyImage: this.props.templateData.versions.base.content.messages[0].previewImageUrl ? this.props.templateData.versions.base.content.messages[0].previewImageUrl : '',
77
77
  };
78
78
  }
79
79
  } else {
@@ -110,6 +110,7 @@ class PreviewSideBar extends React.Component { // eslint-disable-line react/pref
110
110
  channel={this.props.channel}
111
111
  location={this.props.location}
112
112
  charCounterEnabled={this.props.channel.toLowerCase() === 'sms'}
113
+ unicodeEnabled={this.props.channel.toLowerCase() === 'sms'}
113
114
  >
114
115
  </TemplatePreview>
115
116
  }
@@ -8,6 +8,9 @@
8
8
 
9
9
  .preview-image {
10
10
  width: 51%;
11
+ &.sms {
12
+ width: 45%;
13
+ }
11
14
  }
12
15
 
13
16
  .msgContainer {
@@ -16,7 +19,6 @@
16
19
  left: 28.8%;
17
20
  width: 42%;
18
21
  height: 336px;
19
- overflow: auto;
20
22
  display: -webkit-box;
21
23
  display: -ms-flexbox;
22
24
  display: flex;
@@ -27,26 +29,65 @@
27
29
  width: 25px;
28
30
  position: absolute;
29
31
  }
32
+ &.sms{
33
+ height: 290px;
34
+ width: 40%;
35
+ .sms-icon{
36
+ width: 20px;
37
+ left: 14px;
38
+ }
39
+ }
30
40
 
31
41
  .message-pop{
32
- padding: 4px;
33
- background: #3F51B5;
34
- position: absolute;
35
- // width: initial;
36
- overflow: auto;
37
- top: 0;
38
- left: 17%;
39
- white-space: pre-wrap;
40
- word-break: break-word;
41
- border-radius: 4px;
42
- max-height: 100%;
43
- color: #FFFFFF;
44
- width: 70%;
45
- min-height: 26px;
46
- line-height: 14px;
47
- padding: 8px;
48
- font-size: 10px;
49
- font-family: 'open-sans';
42
+ .unicode-disabled{
43
+ font-size: 16px;
44
+ }
45
+ &.sms {
46
+ max-height: 100%;
47
+ position: absolute;
48
+ // width: initial;
49
+ overflow: auto;
50
+ top: 0;
51
+ left: 17%;
52
+ white-space: pre-wrap;
53
+ word-break: break-word;
54
+ line-height: 14px;
55
+ padding: 0 8px 8px 8px;
56
+ font-size: 10px;
57
+ width: 80%;
58
+ font-family: 'open-sans';
59
+ .message-pop-item{
60
+ padding: 4px;
61
+ background: #3F51B5;
62
+ color: #FFFFFF;
63
+ margin-top: 8px;
64
+ border-radius: 4px;
65
+ min-height: 26px;
66
+ &:first-child{
67
+ margin-top: 0;
68
+ }
69
+ }
70
+ }
71
+ &:not(.sms){
72
+ padding: 4px;
73
+ background: #3F51B5;
74
+ position: absolute;
75
+ // width: initial;
76
+ overflow: auto;
77
+ top: 0;
78
+ left: 17%;
79
+ white-space: pre-wrap;
80
+ word-break: break-word;
81
+ border-radius: 4px;
82
+ max-height: 100%;
83
+ color: #FFFFFF;
84
+ width: 70%;
85
+ min-height: 26px;
86
+ line-height: 14px;
87
+ padding: 8px;
88
+ font-size: 10px;
89
+ font-family: 'open-sans';
90
+ }
50
91
  }
51
92
  }
52
93
  .android-push-message-Container, .iphone-push-message-Container{
@@ -222,41 +263,81 @@
222
263
  padding: 0 10px;
223
264
  width: initial;
224
265
 
266
+ .preview-image {
267
+ &.sms{
268
+ width: 45%;
269
+ }
270
+ }
225
271
 
226
272
 
227
273
  .msgContainer {
228
274
  position: absolute;
229
275
  top: 14%;
230
- left: 28.8%;
276
+ left: 29%;
231
277
  width: 42%;
232
- height: 255px;
233
- overflow: auto;
278
+ height: 275px;
234
279
  display: -webkit-box;
235
280
  display: -ms-flexbox;
236
281
  display: flex;
237
282
 
238
283
  .sms-icon{
239
- top: 15%;
240
- left: 7%;
241
- width: 8%;
284
+ top: 6%;
285
+ left: 2%;
286
+ width: 12%;
242
287
  position: absolute;
243
288
  }
244
289
 
290
+ &.sms{
291
+ height: 290px;
292
+ width: 40%;
293
+ top: 16%;
294
+ .sms-icon{
295
+ left: 7%;
296
+ }
297
+ }
245
298
  .message-pop{
246
- padding: 8px 8px;
247
- background: #3F51B5;
248
- position: absolute;
249
- width: 65%;
250
- top: 15%;
251
- left: 19%;
252
- word-break: break-all;
253
- border-radius: 6px;
254
- max-height: 100%;
255
- overflow: auto;
256
- color: #FFFFFF;
257
- line-height: 14px;
258
- font-family: "open-sans";
259
- font-size: 10px;
299
+ &.sms {
300
+ max-height: 100%;
301
+ position: absolute;
302
+ // width: initial;
303
+ overflow: auto;
304
+ top: 6%;
305
+ left: 17%;
306
+ width: 80%;
307
+ white-space: pre-wrap;
308
+ word-break: break-word;
309
+ line-height: 14px;
310
+ padding: 0 8px 8px 8px;
311
+ font-size: 10px;
312
+ font-family: 'open-sans';
313
+ .message-pop-item{
314
+ padding: 8px;
315
+ background: #3F51B5;
316
+ color: #FFFFFF;
317
+ margin-top: 8px;
318
+ border-radius: 4px;
319
+ min-height: 26px;
320
+ &:first-child{
321
+ margin-top: 0;
322
+ }
323
+ }
324
+ }
325
+ &:not(.sms){
326
+ padding: 8px 8px;
327
+ background: #3F51B5;
328
+ position: absolute;
329
+ width: 65%;
330
+ top: 15%;
331
+ left: 19%;
332
+ word-break: break-all;
333
+ border-radius: 6px;
334
+ max-height: 100%;
335
+ overflow: auto;
336
+ color: #FFFFFF;
337
+ line-height: 14px;
338
+ font-family: "open-sans";
339
+ font-size: 10px;
340
+ }
260
341
  }
261
342
  }
262
343
  }
@@ -8,9 +8,10 @@ import React, {PropTypes} from 'react';
8
8
  import _ from 'lodash';
9
9
  import { injectIntl, intlShape} from 'react-intl';
10
10
  // import styled from 'styled-components';
11
-
11
+ import {CapColumn} from '@capillarytech/cap-react-ui-library'
12
12
  import './_templatePreview.scss';
13
13
  import * as charCount from '../../utils/smsCharCount';
14
+ import {updateCharCount} from '../../utils/smsCharCountV2';
14
15
  import messages from './messages';
15
16
  const smsIcon = require('./assets/images/user-icon.svg');
16
17
  const wechatBody = require('./assets/images/WECHAT_5x.png');
@@ -21,14 +22,18 @@ const iPhonePushMessagePhone = require('./assets/images/iPhonePushMessage.svg');
21
22
  class TemplatePreview extends React.Component { // eslint-disable-line react/prefer-stateless-function
22
23
  render() {
23
24
  console.log('preview props', this.props);
24
- const content = this.props.content;
25
+ let content = channel && channel.toLowerCase() === 'sms' ? [this.props.content] : this.props.content;
25
26
  const channel = this.props.channel;
26
27
  let smsDetails = {};
27
28
  // let smsText = '';
28
29
  if (this.props.content && this.props.charCounterEnabled) {
29
- smsDetails = charCount.updateCharCount(this.props.content);
30
+ smsDetails = updateCharCount(this.props.content, this.props.unicodeEnabled);
31
+ content = [];
32
+ for (let i = 0, limit = 0; i < smsDetails.parts; i += 1, limit += smsDetails.chars_sms) {
33
+ content.push(smsDetails.char_list.slice(limit, smsDetails.chars_sms * (i + 1)));
34
+ }
30
35
  if (document.getElementById("msg_count")) {
31
- document.getElementById("msg_count").val = smsDetails.msgCount;
36
+ document.getElementById("msg_count").val = smsDetails.parts;
32
37
  }
33
38
  //smsText = this.props.intl.formatMessage(messages.previewGenerationMessage);
34
39
  //console.log('message text', smsText);
@@ -47,7 +52,22 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
47
52
  }
48
53
  return (
49
54
  <div className={`preview-container ${type === 'embedded' ? 'embedded-preview' : ''}`}>
50
- { channel && (channel.toLowerCase() === 'sms' || channel.toLowerCase() === 'wechat') ?
55
+ { channel && channel.toLowerCase() === 'sms'&&
56
+ <div className="shell align-center" id="sms-preview">
57
+ <img className="preview-image sms" src={smsBody} alt="Preview is being generated"/>
58
+ <div className="msgContainer sms">
59
+ <img className="sms-icon" src={smsIcon} alt="Sms icon" />
60
+ <div className={"message-pop sms"}>
61
+ {content && content.length && content.map((msg) =>
62
+ <CapColumn className="message-pop-item align-left" style={{ background: '#3F51B5', color: '#ffffff'}}>
63
+ {msg}
64
+ </CapColumn>)
65
+ }
66
+ </div>
67
+ </div>
68
+ </div>
69
+ }
70
+ {channel && channel.toLowerCase() === 'wechat' ?
51
71
  ( <div className="shell align-center" id="sms-preview">
52
72
  <img className="preview-image" src={channel.toLowerCase() === 'wechat' ? wechatBody : smsBody} alt="Preview is being generated"/>
53
73
  <div className="msgContainer">
@@ -123,7 +143,16 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
123
143
  }
124
144
  {
125
145
  this.props.charCounterEnabled && !_.isEmpty(smsDetails) ?
126
- <p style={{margin: '16px 0'}} className="preview-info">{`${smsDetails.msgCount} ${this.props.intl.formatMessage(messages.sms)}(${smsDetails.totalLength} ${this.props.intl.formatMessage(messages.characters)})`}</p> : ''
146
+ <div>
147
+ <p className="preview-info">
148
+ {smsDetails.unicode &&
149
+ <div style={{fontSize: '16px'}}>{`${this.props.intl.formatMessage(messages.smsFormatType)}`}</div>
150
+ }
151
+ <div style={{marginTop: '8px', fontSize: '16px'}} >{`${this.props.intl.formatMessage(messages.sms)}: ${smsDetails.parts}`}</div>
152
+ <div style={{fontSize: '16px'}}>{`${this.props.intl.formatMessage(messages.charactersPerSms)}: ${smsDetails.chars_used}`}</div>
153
+ </p>
154
+ </div>
155
+ : ''
127
156
  }
128
157
  </div>
129
158
  );
@@ -139,6 +168,7 @@ TemplatePreview.propTypes = {
139
168
  location: PropTypes.object,
140
169
  intl: intlShape.isRequired,
141
170
  device: PropTypes.string,
171
+ unicodeEnabled: PropTypes.bool,
142
172
  };
143
173
 
144
174
  export default (injectIntl(TemplatePreview));
@@ -14,8 +14,16 @@ export default defineMessages({
14
14
  id: 'app.components.TemplatePreview.sms',
15
15
  defaultMessage: "SMS",
16
16
  },
17
- characters: {
18
- id: 'app.components.TemplatePreview.characters',
19
- defaultMessage: "Characters",
17
+ charactersPerSms: {
18
+ id: 'app.components.TemplatePreview.charactersPerSms',
19
+ defaultMessage: "SMS Chars",
20
+ },
21
+ charactersTotal: {
22
+ id: 'app.components.TemplatePreview.charactersTotal',
23
+ defaultMessage: "SMS Char total",
24
+ },
25
+ smsFormatType: {
26
+ id: 'app.components.TemplatePreview.smsFormatType',
27
+ defaultMessage: 'Message has unicode characters',
20
28
  },
21
29
  });
@@ -19,3 +19,4 @@ export const GET_SCHEMA_FOR_ENTITY_FAILURE = 'cap/GET_SCHEMA_FOR_ENTITY_FAILURE'
19
19
  export const GET_SCHEMA_FOR_ENTITY_REQUEST = 'cap/GET_SCHEMA_FOR_ENTITY_REQUEST';
20
20
  export const GET_SCHEMA_FOR_ENTITY_SUCCESS = 'cap/GET_SCHEMA_FOR_ENTITY_SUCCESS';
21
21
  export const CLEAR_META_ENTITIES = 'cap/CLEAR_META_ENTITIES';
22
+ export const HIDE_TAGS = 'cap/HIDE_TAGS';
@@ -13,6 +13,7 @@ import { injectIntl, intlShape } from 'react-intl';
13
13
  import TopBar from '../../components/TopBar';
14
14
  // import 'moment/locale/en-us';
15
15
  import Sidebar from '../../components/Sidebar';
16
+ import isEqual from 'lodash/isEqual';
16
17
  import { makeSelectAuthenticated, makeSelectUser } from './selectors';
17
18
  import * as actions from './actions';
18
19
  import * as locationActions from '../LanguageProvider/actions';
@@ -20,6 +21,7 @@ import * as appActions from '../App/actions';
20
21
  import config from '../../config/app';
21
22
  import Toastr from '../../components/Toastr';
22
23
  import messages from './messsages';
24
+ const gtm = window.dataLayer || [];
23
25
 
24
26
  const CapWrapper = styled.div`
25
27
  margin: 0 auto;
@@ -29,7 +31,6 @@ const CapWrapper = styled.div`
29
31
  flex-direction: column;
30
32
  `;
31
33
 
32
- // const gtm = window.dataLayer || [];
33
34
  export class Cap extends React.Component { // eslint-disable-line react/prefer-stateless-function
34
35
 
35
36
  constructor(props) {
@@ -46,9 +47,13 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
46
47
 
47
48
  componentWillMount() {
48
49
  this.props.actions.getUserData();
49
- // if (!this.props.Global.user || Object.keys(this.props.Global.user).length === 0) {
50
- // this.props.actions.getUserData();
51
- // }
50
+ if (this.props.Global.user) {
51
+ const userGtmData = this.getUserGtmData(this.props);
52
+ gtm.push(userGtmData);
53
+ }
54
+ if (this.props.Global.orgID !== undefined) {
55
+ gtm.push({orgId: this.props.Global.orgID});
56
+ }
52
57
  if (this.props.Global.isLoggedIn) {
53
58
  if (this.props.Global.user && Object.keys(this.props.Global.user).length) {
54
59
  // gtm.push({userId: this.props.Global.user.id});
@@ -88,6 +93,18 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
88
93
  if (nextPropsUser && user && nextProps.Global.isLoggedIn && nextProps.Global.isLoggedIn !== this.props.Global.isLoggedIn) {
89
94
  this.props.appActions.getSidebar();
90
95
  }
96
+
97
+ if (nextProps.Global.user && this.props.Global.user && (nextProps.Global.user.refID !== this.props.Global.user.refID)) {
98
+ const userGtmData = this.getUserGtmData(nextProps);
99
+ gtm.push(userGtmData);
100
+ }
101
+
102
+ if (nextProps.Global.isLoggedIn && nextProps.Global.isLoggedIn !== this.props.Global.isLoggedIn) {
103
+ if (nextProps.Global.orgID !== undefined && !isEqual(nextProps.Global.orgID, this.props.Global.orgID)) {
104
+ const userGtmData = this.getUserGtmData(nextProps);
105
+ gtm.push(userGtmData);
106
+ }
107
+ }
91
108
  }
92
109
 
93
110
  componentWillUnmount() {
@@ -129,6 +146,22 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
129
146
  // this.setState({ menuData: tmpMenuData });
130
147
  // }
131
148
 
149
+ getUserGtmData = (props) => {
150
+ const { user: userData } = props.Global;
151
+ const userName = userData.attributes.USERNAME;
152
+ const userEmail = userData.attributes.EMAIL;
153
+ const orgObj = find(userData.proxyOrgList, {orgID: props.Global.orgID});
154
+ const gtmData = {
155
+ orgId: props.Global.orgID,
156
+ orgName: orgObj && orgObj.orgName,
157
+ userId: userData.refID,
158
+ userName: userName && userName.value,
159
+ userEmail: userEmail && userEmail.value,
160
+ isCapUser: userData.isCapUser,
161
+ };
162
+ return gtmData;
163
+ }
164
+
132
165
  getMappedLocale(locale) {
133
166
  const map = {
134
167
  'en': 'en',
@@ -95,6 +95,11 @@ function capReducer(state = fromJS(initialState), action) {
95
95
  layouts: [],
96
96
  tags: [],
97
97
  });
98
+ case types.HIDE_TAGS:
99
+ const metaEntities = {tags: {}, layouts: state.get('metaEntities').layouts};
100
+ metaEntities.tags.standard = _.filter(state.get('metaEntities').tags.standard, (tag) => action.tagList.indexOf(tag.definition.value) === -1);
101
+ metaEntities.tags.custom = _.filter(state.get('metaEntities').tags.custom, (tag) => action.tagList.indexOf(tag.name) === -1);
102
+ return state.setIn(['metaEntities'], metaEntities);
98
103
  default:
99
104
  return state;
100
105
  }
@@ -1,5 +1,6 @@
1
1
  // makeSelectLocationState expects a plain JS object for the routing state
2
2
  import { createSelector } from 'reselect';
3
+ import Immutable from 'immutable';
3
4
  const selectCapDomain = (state) => state.get('cap');
4
5
 
5
6
  const makeSelectAuthenticated = () => createSelector(