@capillarytech/creatives-library 7.8.1 → 7.9.1

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 (37) hide show
  1. package/app.js +5 -1
  2. package/components/FormBuilder/index.js +2 -2
  3. package/containers/Email/index.js +8 -3
  4. package/containers/MobilePush/Create/index.js +2 -2
  5. package/containers/MobilePush/Edit/index.js +2 -2
  6. package/containers/WeChat/MapTemplates/index.js +15 -3
  7. package/package.json +1 -1
  8. package/services/api.js +20 -5
  9. package/translations/en.json +113 -2
  10. package/translations/zh.json +112 -1
  11. package/utils/gtmTrackers/gtmEvents/creativeDetails.js +6 -2
  12. package/utils/gtmTrackers/index.js +8 -4
  13. package/v2Components/CapImageUpload/index.js +14 -8
  14. package/v2Components/FormBuilder/index.js +10 -1
  15. package/v2Components/NavigationBar/index.js +63 -29
  16. package/v2Components/NavigationBar/messages.js +5 -0
  17. package/v2Containers/App/constants.js +23 -3
  18. package/v2Containers/Cap/actions.js +2 -2
  19. package/v2Containers/Cap/constants.js +3 -2
  20. package/v2Containers/Cap/index.js +31 -18
  21. package/v2Containers/Cap/messages.js +8 -0
  22. package/v2Containers/Cap/sagas.js +18 -6
  23. package/v2Containers/CapFacebookPreview/constants.js +4 -0
  24. package/v2Containers/CapFacebookPreview/index.js +92 -67
  25. package/v2Containers/CapFacebookPreview/reducer.js +19 -10
  26. package/v2Containers/CreativesContainer/SlideBoxContent.js +2 -0
  27. package/v2Containers/CreativesContainer/index.js +80 -2
  28. package/v2Containers/Facebook/Advertisement/index.js +2 -2
  29. package/v2Containers/Facebook/Advertisement/index.scss +1 -1
  30. package/v2Containers/Facebook/index.js +15 -4
  31. package/v2Containers/Line/Container/Drawer/index.js +1 -1
  32. package/v2Containers/MobilePush/Edit/index.js +2 -2
  33. package/v2Containers/MobilepushWrapper/index.js +1 -1
  34. package/v2Containers/Templates/_templates.scss +4 -2
  35. package/v2Containers/Templates/index.js +6 -2
  36. package/v2Containers/TemplatesV2/index.js +11 -3
  37. package/v2Containers/WeChat/MapTemplates/index.js +12 -2
@@ -5,13 +5,17 @@ const gtmEvents = require.context('./gtmEvents', true, /\.js$/, 'lazy');
5
5
  export const gtmPush = (eventType, eventObject) => {
6
6
  try {
7
7
  gtmEvents(`./${eventType}.js`)
8
- .then(event => {
8
+ .then((event) => {
9
9
  event.default(eventObject);
10
10
  })
11
- .catch(err => {
12
- Bugsnag.notify(err);
11
+ .catch((err) => {
12
+ if (err) {
13
+ Bugsnag.notify(err);
14
+ }
13
15
  });
14
16
  } catch (e) {
15
- Bugsnag.notify(e);
17
+ if (e) {
18
+ Bugsnag.notify(e);
19
+ }
16
20
  }
17
21
  };
@@ -85,6 +85,12 @@ function CapImageUpload(props) {
85
85
  };
86
86
  submitAction({file, type: 'image', fileParams}, incorrectFile);
87
87
  };
88
+ img.onerror = () => {
89
+ const fileParams = {
90
+ error: true,
91
+ };
92
+ submitAction({fileParams}, incorrectFile);
93
+ }
88
94
  if (e) {
89
95
  const event = e;
90
96
  event.target.value = null;
@@ -93,13 +99,12 @@ function CapImageUpload(props) {
93
99
 
94
100
  const submitAction = useCallback((data, incorrectFile) => {
95
101
  const {
96
- file: {size},
97
- fileParams: {
98
- height,
99
- width,
100
- },
101
- } = data;
102
- if (incorrectFile || size > imgSize || height > imgHeight || width > imgWidth) {
102
+ file,
103
+ fileParams
104
+ } = data || {};
105
+ const { size } = file || {};
106
+ const { height, width, error } = fileParams || {};
107
+ if (incorrectFile || size > imgSize || height > imgHeight || width > imgWidth || error) {
103
108
  updateImageErrorMessage(formatMessage(messages.imageIncorrectSize));
104
109
  } else {
105
110
  updateImageErrorMessage('');
@@ -166,6 +171,7 @@ function CapImageUpload(props) {
166
171
  <CapUploader.CapDragger
167
172
  customRequest={capUploaderCustomRequest}
168
173
  className="form-builder-dragger"
174
+ showUploadList={!isImageError}
169
175
  >
170
176
  <CapHeading className="dragger-title" type="h7">
171
177
  <FormattedMessage {...messages.dragAndDrop} />
@@ -198,7 +204,7 @@ function CapImageUpload(props) {
198
204
  <FormattedMessage {...messages.imageReUpload} />
199
205
  </CapButton>
200
206
  );
201
- }, []);
207
+ }, [isImageError]);
202
208
 
203
209
  return (
204
210
  <div style={style} className="cap-custom-image-upload">
@@ -2854,7 +2854,16 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2854
2854
  name={val.name ? val.name : `${val.id}-name`}
2855
2855
  disabled={val.disabled}
2856
2856
  >
2857
- {val.options.map((option, index) => <CapRadio value={option} inductiveText={val.inductiveText && val.inductiveText[index]}>{option}</CapRadio>) }
2857
+ {val.options.map((option, index) => {
2858
+ const isMappedTemplateWechat = val.id === "template-redirect-options-radio";
2859
+ return (
2860
+ <CapRadio
2861
+ value={ isMappedTemplateWechat ? option.value : option }
2862
+ inductiveText={val.inductiveText && val.inductiveText[index]}>{ isMappedTemplateWechat ? option.label : option }
2863
+ </CapRadio>
2864
+ )
2865
+ }
2866
+ )}
2858
2867
 
2859
2868
  </CapRadioGroup>
2860
2869
  {/*{ifError ?*/}
@@ -10,11 +10,23 @@ import styled from 'styled-components';
10
10
  import { isEmpty, forEach } from 'lodash';
11
11
  import { loadItem } from 'services/localStorageApi';
12
12
  import { intlShape, injectIntl } from 'react-intl';
13
+ import { FONT_COLOR_04 } from '@capillarytech/cap-ui-library/styled/variables';
13
14
  import TopBar from '../TopBar';
14
15
  import messages from './messages';
16
+ import { LOYALTY } from '../../v2Containers/App/constants';
17
+ import {
18
+ HELP_URL,
19
+ LOYALTY_HELP_URL,
20
+ } from '../../v2Containers/Cap/constants';
15
21
  const PRODUCT_MASTERS = 'masters';
16
22
  const EMBEDDED = 'embedded';
17
23
 
24
+ const AppWrapper = styled.div`
25
+ .navigation-setting-icon {
26
+ color: ${FONT_COLOR_04};
27
+ }
28
+ `;
29
+
18
30
  const CapWrapper = styled.div`
19
31
  position: absolute;
20
32
  padding: 0;
@@ -34,9 +46,37 @@ const ComponentWrapper = styled.div`
34
46
  class NavigationBar extends React.Component {
35
47
  constructor(props) {
36
48
  super(props);
37
- this.state = {
38
- selectedProduct: '',
39
- };
49
+ this.state = this.initializeSelectedProduct();
50
+ }
51
+
52
+ initializeSelectedProduct = () => {
53
+ const {location, intl: {formatMessage}} = this.props;
54
+ const { pathname } = location;
55
+ const parentModule = pathname.substring(pathname.lastIndexOf('/') + 1);
56
+ switch (parentModule) {
57
+ case LOYALTY:
58
+ return {
59
+ selectedProduct: formatMessage(messages.loyaltyProgram),
60
+ helpUrl: LOYALTY_HELP_URL,
61
+ settingsIcon: {
62
+ iconType: 'settings',
63
+ key: 'settings',
64
+ placement: 'bottomRight',
65
+ className: 'navigation-setting-icon',
66
+ toolTip: formatMessage(messages.noProductSetting),
67
+ },
68
+ };
69
+ default:
70
+ return {
71
+ selectedProduct: formatMessage(messages.selectedProductDefault),
72
+ helpUrl: HELP_URL,
73
+ settingsIcon: {
74
+ iconType: 'settings',
75
+ key: 'settings',
76
+ onClickHandler: this.onSettingsIconClick,
77
+ },
78
+ };
79
+ }
40
80
  }
41
81
 
42
82
  onOrgSettingsClick = () => {
@@ -57,7 +97,7 @@ class NavigationBar extends React.Component {
57
97
  };
58
98
 
59
99
  onHelpIconClick = () => {
60
- const { helpUrl } = this.props;
100
+ const {helpUrl} = this.state;
61
101
  if (helpUrl) {
62
102
  window.open(helpUrl, '_blank');
63
103
  }
@@ -113,18 +153,17 @@ class NavigationBar extends React.Component {
113
153
  return productsList;
114
154
  };
115
155
 
116
- getTopbarIcons = () => [
117
- {
118
- iconType: 'help',
119
- key: 'help',
120
- onClickHandler: this.onHelpIconClick,
121
- },
122
- {
123
- iconType: 'settings',
124
- key: 'settings',
125
- onClickHandler: this.onSettingsIconClick,
126
- },
127
- ];
156
+ getTopbarIcons = () => {
157
+ const {settingsIcon} = this.state;
158
+ return [
159
+ {
160
+ iconType: 'help',
161
+ key: 'help',
162
+ onClickHandler: this.onHelpIconClick,
163
+ },
164
+ settingsIcon,
165
+ ];
166
+ }
128
167
 
129
168
  getDropdownMenu = () => {
130
169
  const { formatMessage } = this.props.intl;
@@ -168,7 +207,6 @@ class NavigationBar extends React.Component {
168
207
  topbarMenuData,
169
208
  loggedIn,
170
209
  type,
171
- intl,
172
210
  } = this.props;
173
211
  const productsList = this.getProductsList();
174
212
  const proxyOrgList = this.getProxyOrgList();
@@ -178,14 +216,11 @@ class NavigationBar extends React.Component {
178
216
  const { selectedProduct } = this.state;
179
217
  const customTopBarProps = {};
180
218
  return (
181
- <div>
219
+ <AppWrapper>
182
220
  {loggedIn && type !== EMBEDDED &&
183
221
  <TopBar
184
222
  productsList={productsList}
185
- selectedProduct={
186
- selectedProduct ||
187
- intl.formatMessage(messages.selectedProductDefault)
188
- }
223
+ selectedProduct={selectedProduct}
189
224
  handleProductChange={this.handleProductChange}
190
225
  proxyOrgList={proxyOrgList}
191
226
  selectedOrg={selectedOrg}
@@ -197,12 +232,12 @@ class NavigationBar extends React.Component {
197
232
  {...customTopBarProps}
198
233
  />
199
234
  }
200
- <CapWrapper isEmbedded={type === EMBEDDED}>
201
- <ComponentWrapper>
202
- {React.Children.toArray(this.props.children)}
203
- </ComponentWrapper>
204
- </CapWrapper>
205
- </div>
235
+ <CapWrapper isEmbedded={type === EMBEDDED}>
236
+ <ComponentWrapper>
237
+ {React.Children.toArray(this.props.children)}
238
+ </ComponentWrapper>
239
+ </CapWrapper>
240
+ </AppWrapper>
206
241
  );
207
242
  }
208
243
  }
@@ -214,7 +249,6 @@ NavigationBar.propTypes = {
214
249
  changeOrg: PropTypes.func,
215
250
  settingsUrl: PropTypes.string,
216
251
  children: PropTypes.node,
217
- helpUrl: PropTypes.string,
218
252
  orgSettingsUrl: PropTypes.string,
219
253
  loggedIn: PropTypes.bool,
220
254
  intl: intlShape.isRequired,
@@ -57,4 +57,9 @@ export default defineMessages({
57
57
  id: `${scope}.storeCare`,
58
58
  defaultMessage: 'Store Care',
59
59
  },
60
+ "noProductSetting": {
61
+ id: `${scope}.noProductSetting`,
62
+ defaultMessage:
63
+ 'There are no product settings. Organisation settings are available under profile on the right.',
64
+ },
60
65
  });
@@ -13,6 +13,25 @@ export const getTopbarMenuDataValue = () => ([
13
13
  { label: <FormattedMessage {...globalMessages.creatives} />, link: '/creatives/ui/v2', key: 'creatives' },
14
14
  ]);
15
15
 
16
+ export const getLoyaltyTopbarMenuDataValue = () => [
17
+ {
18
+ label: <FormattedMessage {...globalMessages.programs} />,
19
+ link: 'loyalty/ui/',
20
+ key: 'programs',
21
+ },
22
+ //commented as promotions are not supported in loyalty v2 flow
23
+ // {
24
+ // label: <FormattedMessage {...globalMessages.promotions} />,
25
+ // link: 'loyalty/ui/promotions/',
26
+ // key: 'promotions',
27
+ // },
28
+ {
29
+ label: <FormattedMessage {...globalMessages.creatives} />,
30
+ link: '/creatives/ui/v2/loyalty',
31
+ key: 'creatives',
32
+ },
33
+ ];
34
+
16
35
  export const TRACK_CREATE_SMS = 'createSms';
17
36
  export const TRACK_CREATE_EMAIL = 'createEmail';
18
37
  export const TRACK_CREATE_MPUSH = 'createMpush';
@@ -46,7 +65,7 @@ export const CHANNEL_CREATE_TRACK_MAPPING = {
46
65
  gallery: TRACK_CREATE_IMAGE,
47
66
  line: TRACK_CREATE_LINE,
48
67
  viber: TRACK_CREATE_VIBER,
49
- facebook: TRACK_CREATE_FACEBOOK
68
+ facebook: TRACK_CREATE_FACEBOOK,
50
69
  };
51
70
 
52
71
  export const CHANNEL_EDIT_TRACK_MAPPING = {
@@ -57,7 +76,7 @@ export const CHANNEL_EDIT_TRACK_MAPPING = {
57
76
  gallery: TRACK_EDIT_IMAGE,
58
77
  line: TRACK_EDIT_LINE,
59
78
  viber: TRACK_EDIT_VIBER,
60
- facebook: TRACK_EDIT_FACEBOOK
79
+ facebook: TRACK_EDIT_FACEBOOK,
61
80
  };
62
81
  export const GTM_TRACKING_ID = 'UA-110024621-2';
63
82
  export const BEE_PLUGIN = 'BEE_PLUGIN';
@@ -85,4 +104,5 @@ export const FB_AD_CALL_TO_ACTION = {
85
104
  };
86
105
 
87
106
 
88
- export const CREATIVES = 'creatives';
107
+ export const CREATIVES = 'creatives';
108
+ export const LOYALTY = 'loyalty';
@@ -45,7 +45,6 @@ export function getUserData(callback) {
45
45
  }
46
46
 
47
47
  export function fetchSchemaForEntity(queryParams) {
48
-
49
48
  return {
50
49
  type: types.GET_SCHEMA_FOR_ENTITY_REQUEST, queryParams,
51
50
  };
@@ -62,8 +61,9 @@ export function setInjectedTags(injectedTags) {
62
61
  };
63
62
  }
64
63
 
65
- export function getTopbarMenuData() {
64
+ export function getTopbarMenuData(parentModule) {
66
65
  return {
66
+ parentModule,
67
67
  type: types.GET_TOPBAR_MENU_DATA_REQUEST,
68
68
  };
69
69
  }
@@ -31,7 +31,8 @@ export const CLEAR_TOPBAR_MENU_DATA = 'creatives/cap/CLEAR_TOPBAR_MENU_DATA';
31
31
  export const CAMPAIGN_SETTINGS_URL = '/creatives/settings/message';
32
32
  export const ORG_SETTINGS_URL = '/org/index';
33
33
  export const HELP_URL = 'https://support.capillarytech.com/en/support/solutions/4000007853';
34
+ export const LOYALTY_HELP_URL = 'https://support.capillarytech.com/en/support/solutions/97443';
34
35
 
35
- export const ORG_REFRESH_SEC = 10;
36
- export const ORG_CHANGED = 'ORG_CHANGED';
36
+ export const ORG_REFRESH_SEC = 10;
37
+ export const ORG_CHANGED = 'ORG_CHANGED';
37
38
 
@@ -22,11 +22,10 @@ import { engagePlusPublicPath } from '../../config/path';
22
22
  import { GTM_TRACKING_ID, CREATIVES_UI_VIEW } from '../App/constants';
23
23
  import { makeSelectLocale } from '../../v2Containers/LanguageProvider/selectors';
24
24
  import {
25
- HELP_URL,
26
25
  ORG_SETTINGS_URL,
27
26
  CAMPAIGN_SETTINGS_URL,
28
27
  ORG_REFRESH_SEC,
29
- ORG_CHANGED
28
+ ORG_CHANGED,
30
29
  } from './constants';
31
30
  import './_cap.scss';
32
31
 
@@ -73,6 +72,8 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
73
72
  }
74
73
 
75
74
  componentWillMount() {
75
+ const { pathname } = this.props.location;
76
+ const parentModule = pathname.substring(pathname.lastIndexOf('/') + 1);
76
77
  this.props.actions.getUserData((userData) => {
77
78
  if (!userData.accessiblePermissions.includes(CREATIVES_UI_VIEW)) {
78
79
  this.setState({ isCreativesAccessible: false });
@@ -81,7 +82,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
81
82
  this.setDimensionData(userGtmData);
82
83
  gtm.push({...userGtmData, event: 'userAuthenticated'});
83
84
  });
84
- this.props.actions.getTopbarMenuData();
85
+ this.props.actions.getTopbarMenuData(parentModule);
85
86
  if (this.props.Global.orgID !== undefined) {
86
87
  gtm.push({orgId: this.props.Global.orgID});
87
88
  }
@@ -101,7 +102,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
101
102
  }
102
103
  locale = this.getMappedLocale(locale);
103
104
  //locale = 'zh';
104
-
105
+
105
106
  moment.locale(locale);
106
107
  window.addEventListener('storage', this.handleStorageChange, false);
107
108
  document.addEventListener(
@@ -167,7 +168,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
167
168
  tabOnloadEventHandler = () => {
168
169
  logNewTab();
169
170
  }
170
-
171
+
171
172
  setDimensionData(userGtmData) {
172
173
  Object.values(userGtmData).forEach((value, index) => {
173
174
  GA.setCustomDimension({ [`dimension${index + 1}`]: value });
@@ -175,28 +176,41 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
175
176
  }
176
177
  getUserGtmData(props) {
177
178
  const selectedProps = props || this.props;
178
- const { user: userData, orgID} = selectedProps?.Global || {};
179
+ const { user: userData, orgID, currentOrgDetails} = selectedProps?.Global || {};
180
+ const {
181
+ basic_details: {
182
+ base_country: orgBaseCountry = '',
183
+ base_currency: orgBaseCurrency = '',
184
+ base_language: orgBaseLanguage = '',
185
+ } = {},
186
+ } = currentOrgDetails || {};
179
187
  if (userData) {
180
188
  const {
181
189
  attributes: {
182
- USERNAME : userName,
183
- EMAIL : userEmail
190
+ USERNAME: userName,
191
+ EMAIL: userEmail,
184
192
  } = {},
185
- proxyOrgList =[],
193
+ proxyOrgList = [],
186
194
  isCapUser,
187
195
  refID,
196
+ type: userRole = '',
188
197
  orgName: userOrgName,
189
198
  } = userData;
190
- const { orgName } = _.find(proxyOrgList, { orgID: orgID }) || {
199
+ const { orgName } = _.find(proxyOrgList, { orgID }) || {
191
200
  orgName: userOrgName,
192
201
  };
193
202
  const gtmData = {
194
- isCapUser: isCapUser,
203
+ isCapUser,
195
204
  orgId: orgID,
196
205
  orgName,
197
206
  userId: refID,
198
207
  userName: userName?.value,
199
208
  userEmail: userEmail?.value,
209
+ userRole,
210
+ orgBaseCountry,
211
+ orgBaseCurrency,
212
+ orgBaseLanguage,
213
+ domainName: userEmail?.value?.split('@').pop(),
200
214
  };
201
215
  return gtmData;
202
216
  }
@@ -272,7 +286,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
272
286
  refreshSeconds === ORG_REFRESH_SEC
273
287
  ) {
274
288
  const timer = setInterval(() => {
275
- this.setState(prevState => ({
289
+ this.setState((prevState) => ({
276
290
  refreshSeconds: prevState.refreshSeconds - 1,
277
291
  }));
278
292
  }, 1000);
@@ -286,13 +300,13 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
286
300
 
287
301
  handleStorageChange = (e) => {
288
302
  const { oldValue, newValue } = e;
289
- if (utilsHandleStorageChange(e, 'orgID')) {
303
+ if (utilsHandleStorageChange(e, 'orgID')) {
290
304
  const localStorageOrgInfo = { oldValue, newValue };
291
305
  this.setState({ showRefreshModal: true, localStorageOrgInfo });
292
306
  }
293
307
  };
294
308
 
295
- getOrgNameFromId = orgId => {
309
+ getOrgNameFromId = (orgId) => {
296
310
  const {
297
311
  Global: {
298
312
  user: {
@@ -352,11 +366,11 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
352
366
  renderOrgChangeModal = () => {
353
367
  const { selectedOrgId, showOrgChangeModal } = this.state;
354
368
  const {
355
- Global: {
369
+ Global: {
356
370
  currentOrgDetails: { basic_details: { name: oldOrgName } = {} } = {},
357
371
  },
358
372
  intl: { formatMessage } = {},
359
- } = this.props;
373
+ } = this.props;
360
374
  const newOrgName = this.getOrgNameFromId(selectedOrgId);
361
375
  // some users do not have entry for their default org in proxyOrgList.
362
376
  // getOrgNameFromId returns back orgID if no matching entry is present in proxyOrgList
@@ -399,7 +413,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
399
413
  const type = this.props.location.query.type;
400
414
  const toastMessages = this.props.Global.messages;
401
415
  const { isCreativesAccessible, showOrgChangeModal, showRefreshModal } = this.state;
402
-
416
+
403
417
  return (
404
418
  <CapWrapper>
405
419
  { this.props.loader.localeLoading || this.props.Global.fetching_userdata ?
@@ -425,7 +439,6 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
425
439
  logout={this.logout}
426
440
  settingsUrl={`${engagePlusPublicPath}${CAMPAIGN_SETTINGS_URL}`}
427
441
  orgSettingsUrl={ORG_SETTINGS_URL}
428
- helpUrl={HELP_URL}
429
442
  loggedIn={isLoggedIn}
430
443
  topbarMenuData={topbarMenuDataOptions}
431
444
  location={location}
@@ -72,6 +72,14 @@ export default defineMessages({
72
72
  id: 'creatives.containersV2.incentive',
73
73
  defaultMessage: 'Incentive',
74
74
  },
75
+ "programs": {
76
+ id: `creatives.containersV2.programs`,
77
+ defaultMessage: 'Programs',
78
+ },
79
+ "promotions": {
80
+ id: `creatives.containersV2.promotions`,
81
+ defaultMessage: 'Promotions',
82
+ },
75
83
 
76
84
  //refresh due to org change messages
77
85
 
@@ -6,7 +6,11 @@ import * as LocalStorage from '../../services/localStorageApi';
6
6
  import * as types from './constants';
7
7
  import config from '../../config/app';
8
8
  //import pathConfig from '../../config/path';
9
- import { getTopbarMenuDataValue } from '../../v2Containers/App/constants';
9
+ import {
10
+ getTopbarMenuDataValue,
11
+ getLoyaltyTopbarMenuDataValue,
12
+ LOYALTY,
13
+ } from '../../v2Containers/App/constants';
10
14
  // import {makeSelectOrgId} from './selectors';
11
15
 
12
16
  function* authorize(user) {
@@ -106,9 +110,8 @@ export function* fetchUserInfo(option) {
106
110
 
107
111
  export function* fetchSchemaForEntity(queryParams) {
108
112
  try {
109
-
110
113
  const result = yield call(Api.fetchSchemaForEntity, queryParams);
111
-
114
+
112
115
  // const sidebar = result.response.sidebar;
113
116
  yield put({ type: types.GET_SCHEMA_FOR_ENTITY_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', entityType: queryParams.queryParams.type });
114
117
  } catch (error) {
@@ -116,11 +119,21 @@ export function* fetchSchemaForEntity(queryParams) {
116
119
  }
117
120
  }
118
121
 
119
- function* getTopbarMenuData() {
122
+ const getTopbarData = (parentModule) => {
123
+ switch (parentModule) {
124
+ case LOYALTY:
125
+ return getLoyaltyTopbarMenuDataValue();
126
+ default:
127
+ return getTopbarMenuDataValue();
128
+ }
129
+ };
130
+
131
+ function* getTopbarMenuData(params) {
132
+ const {parentModule} = params;
120
133
  try {
121
134
  yield put({
122
135
  type: types.GET_TOPBAR_MENU_DATA_SUCCESS,
123
- data: getTopbarMenuDataValue(),
136
+ data: getTopbarData(parentModule),
124
137
  });
125
138
  } catch (error) {
126
139
  yield put({ type: types.GET_TOPBAR_MENU_DATA_FAILURE, error });
@@ -129,7 +142,6 @@ function* getTopbarMenuData() {
129
142
 
130
143
 
131
144
  function* watchFetchSchemaForEntity() {
132
-
133
145
  const watcher = yield takeLatest(types.GET_SCHEMA_FOR_ENTITY_REQUEST, fetchSchemaForEntity);
134
146
  yield take(LOCATION_CHANGE);
135
147
  yield cancel(watcher);
@@ -11,3 +11,7 @@ export const GENERATE_PREVIEW_FAILURE = 'app/CapFacebookPreview/GET_PREVIEW_FAIL
11
11
 
12
12
  export const CLEAR_PREVIEW = 'app/CapFacebookPreview/CLEAR_PREVIEW';
13
13
 
14
+ export const PREVIEW_NOT_REQUESTED = "PreviewNotRequested";
15
+ export const FETCH_PREVIEW_REQUESTED = "PreviewRequested";
16
+ export const FETCH_PREVIEW_SUCCESS = "PreviewRequestSuccess";
17
+ export const FETCH_PREVIEW_FAILURE = "PreviewRequestFailure";