@learningpool/ui 1.19.0 → 1.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@ import CloseIcon from '@mui/icons-material/Close';
3
3
  import { styled } from '@mui/material/styles';
4
4
  import Button from '@mui/material/Button';
5
5
  const defaultWhite = '#fff';
6
+ const panelWidth = window.screen.width <= 1920 ? '40vw' : '30vw';
6
7
  export const AppSwitcherShadow = styled('div') `
7
8
  background-color: rgba(0, 0, 0, 0.6);
8
9
  bottom: 0;
@@ -27,7 +28,7 @@ export const AppSwitcherPanel = styled('div') `
27
28
  overflow: auto;
28
29
  overflow-x: hidden;
29
30
  position: fixed;
30
- width: 50vw;
31
+ width: ${panelWidth};
31
32
  z-index: -2;
32
33
  `;
33
34
  export const AppSwitcherHeaderPanel = styled(Box) `
@@ -50,7 +51,7 @@ export const AppSwitcherFooterPanel = styled(Box) `
50
51
  position: fixed;
51
52
  bottom: 0;
52
53
  z-index: 1;
53
- width: 50vw;
54
+ width: ${panelWidth};
54
55
  `;
55
56
  export const AppSwitcherHeader = styled(Typography) `
56
57
  font-size: 1.5rem;
@@ -71,8 +72,8 @@ export const StyledHomeButton = styled(Button) `
71
72
  color: #00538e;
72
73
  display: flex;
73
74
  flex-wrap: wrap;
74
- left: ${props => props.theme.direction === 'ltr' ? '40vw' : 'auto'};
75
- right: ${props => props.theme.direction === 'ltr' ? 'auto' : '40vw'};
75
+ left: ${props => props.theme.direction === 'ltr' ? `calc(${panelWidth} - 100px)` : 'auto'};
76
+ right: ${props => props.theme.direction === 'ltr' ? 'auto' : `calc(${panelWidth} - 100px)`};
76
77
  margin: 1rem 0 .75rem 0;
77
78
  padding: 0;
78
79
  text-decoration: none;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "components",
10
10
  "ui"
11
11
  ],
12
- "version": "1.19.0",
12
+ "version": "1.19.2",
13
13
  "private": false,
14
14
  "main": "index.js",
15
15
  "module": "index.js",
@@ -44,11 +44,14 @@ interface IHubTrackingProps {
44
44
  url: string;
45
45
  }
46
46
  /**
47
- * Add tracking log to the Hub.
48
- * @param {Bolean} param.isAppSwitcher - Is the interaction from App switcher.
49
- * @param {String} param.eventTypeId - Type of click event.
50
- * @param {String} param.referenceId - Clicked Id of the object.
51
- * @param {String} param.url - Url of the object on click.
47
+ * Sends tracking to the Hub.
48
+ * @param {string} param.hubApiUrl - Hub API endpoint.
49
+ * @param {string} param.apiKey - Hub API key.
50
+ * @param {string} param.token - Hub access token.
51
+ * @param {boolean} param.isAppSwitcher - Is the interaction from App switcher.
52
+ * @param {string} param.eventTypeId - Type of click event.
53
+ * @param {string} param.referenceId - Clicked Id of the object.
54
+ * @param {string} param.url - Url of the object on click.
52
55
  */
53
56
  export declare const handleHubTracking: ({ hubApiUrl, apiKey, token, isAppSwitcher, eventTypeId, referenceId, url }: IHubTrackingProps) => Promise<void>;
54
57
  export {};
package/utils/helpers.js CHANGED
@@ -109,22 +109,21 @@ export const useFadeAndMoveIn = (delayOrder, reverse = false) => {
109
109
  return useStaggerIn(animationConfig, delayOrder, reverse);
110
110
  };
111
111
  /**
112
- * Add tracking log to the Hub.
113
- * @param {Bolean} param.isAppSwitcher - Is the interaction from App switcher.
114
- * @param {String} param.eventTypeId - Type of click event.
115
- * @param {String} param.referenceId - Clicked Id of the object.
116
- * @param {String} param.url - Url of the object on click.
112
+ * Sends tracking to the Hub.
113
+ * @param {string} param.hubApiUrl - Hub API endpoint.
114
+ * @param {string} param.apiKey - Hub API key.
115
+ * @param {string} param.token - Hub access token.
116
+ * @param {boolean} param.isAppSwitcher - Is the interaction from App switcher.
117
+ * @param {string} param.eventTypeId - Type of click event.
118
+ * @param {string} param.referenceId - Clicked Id of the object.
119
+ * @param {string} param.url - Url of the object on click.
117
120
  */
118
121
  export const handleHubTracking = async ({ hubApiUrl, apiKey, token, isAppSwitcher, eventTypeId, referenceId, url }) => {
119
122
  const { hostname } = window.location;
120
- if (hostname === 'localhost') {
123
+ if (hostname === 'localhost' || !isAppSwitcher) {
121
124
  console.log('Send tracking to Hub', { isHub: !isAppSwitcher, eventTypeId, referenceId, url });
122
125
  return;
123
126
  }
124
- else if (['home.learningpool.com', 'home-staging.learningpool.com'].includes(hostname)) {
125
- // Not send tracking to hub
126
- return;
127
- }
128
127
  if (!eventTypeId || !referenceId) {
129
128
  return;
130
129
  }