@capillarytech/cap-ui-utils 1.4.6-alpha2.0 → 1.4.6-alpha3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capillarytech/cap-ui-utils",
3
- "version": "1.4.6-alpha2.0",
3
+ "version": "1.4.6-alpha3.1",
4
4
  "description": "Utility functions shared accross all the modules",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -17,6 +17,7 @@ const ResizablePIP = ({
17
17
  maxConstraints = [1404, 900],
18
18
  closePIPContainer = () => {},
19
19
  handleOpenInNew = () => {},
20
+ PIPPosition = 'topLeft',
20
21
  }) => {
21
22
  const [pipWidth, setPipWidth] = useState(width);
22
23
  const [pipHeight, setPipHeight] = useState(height);
@@ -109,6 +110,7 @@ ResizablePIP.propTypes = {
109
110
  handleOpenInNew: PropTypes.func,
110
111
  setShowMaximised: PropTypes.func,
111
112
  showMaximised: PropTypes.bool,
113
+ PIPPosition: PropTypes.string,
112
114
  };
113
115
  export default ResizablePIP;
114
116
 
@@ -48,9 +48,10 @@ const WithDemoVideosAndLinks = (props) => {
48
48
  const { children, targetElements, locale = 'en'} = props;
49
49
  const [showPIP, setShowPIP] = useState(false);
50
50
  const [PIPContentLink, setPIPContentLink] = useState('');
51
+ const [PIPPosition, setPIPPosition] = useState('topLeft');
51
52
  const [showMaximised, setShowMaximised] = useState(false);
52
53
  const cssSelectors = [];
53
- if (Object.keys(targetElements)?.length) {
54
+ if (Object.keys(targetElements || {})?.length) {
54
55
  Object.keys(targetElements).map(targetElement => {
55
56
  cssSelectors.push({
56
57
  cssSelector: targetElement,
@@ -63,7 +64,7 @@ const WithDemoVideosAndLinks = (props) => {
63
64
  cssSelectors.forEach(selector => {
64
65
  const {
65
66
  support_link: { target_url: linkTargetUrl = {} } = {},
66
- support_video: { target_url: videoTargetUrl = {} } = {},
67
+ support_video: { target_url: videoTargetUrl = {}, PIPPosition : videoPIPPosition = 'topLeft' } = {},
67
68
  locale,
68
69
  cssSelector,
69
70
  } = selector || {};
@@ -71,6 +72,7 @@ const WithDemoVideosAndLinks = (props) => {
71
72
  const handleOnClickVideoLink = () => {
72
73
  setPIPContentLink(videoTargetUrl?.[locale]?.href);
73
74
  setShowPIP(true);
75
+ setPIPPosition(videoPIPPosition);
74
76
  };
75
77
  const handleOpenSupportLink = () =>
76
78
  window.open(linkTargetUrl?.[locale]?.href, '_blank');
@@ -147,6 +149,7 @@ const WithDemoVideosAndLinks = (props) => {
147
149
  handleOpenInNew={handleOpenInNew}
148
150
  handleShowMaximised={handleShowMaximised}
149
151
  showMaximised={showMaximised}
152
+ PIPPosition={PIPPosition}
150
153
  >
151
154
  <iframe
152
155
  width="100%"
@@ -163,7 +166,7 @@ const WithDemoVideosAndLinks = (props) => {
163
166
  );
164
167
  };
165
168
 
166
- WithDemoVideosAndLinks.PropTypes = {
169
+ WithDemoVideosAndLinks.propTypes = {
167
170
  children: PropTypes.any,
168
171
  locale: PropTypes.string,
169
172
  targetElements: PropTypes.object,