@capillarytech/cap-ui-utils 1.4.6-alpha.0 → 1.4.6-alpha2.0

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-alpha.0",
3
+ "version": "1.4.6-alpha2.0",
4
4
  "description": "Utility functions shared accross all the modules",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,27 +1,54 @@
1
1
  import React, { useState } from 'react';
2
2
  import ResizablePIP from './ResizablePIP';
3
+ import PropTypes from "prop-types";
3
4
 
4
- const withDemoVideosAndLinks = (WrappedComponent, publicPath) => props => {
5
+ /** Sample targetElementsData
6
+ target_elements: {
7
+ '.loyalty-graph-header': {
8
+ support_link: {
9
+ target_url: {
10
+ default: {
11
+ label: 'Help default',
12
+ href: 'https://app.storylane.io/share/v1ilsyhwno8m',
13
+ },
14
+ en: {
15
+ label: 'Help',
16
+ href: 'https://app.storylane.io/share/v1ilsyhwno8m',
17
+ },
18
+ },
19
+ // icon: '',
20
+ // position: 'right',
21
+ // target_opening: '_blank',
22
+ },
23
+ },
24
+ '.performance-time-head-title': {
25
+ support_video: {
26
+ target_url: {
27
+ default: {
28
+ label: 'Demo',
29
+ href: ' https://www.youtube.com/embed/JJI4eR-G5AM',
30
+ },
31
+ en: {
32
+ label: 'Demo',
33
+ href: ' https://www.youtube.com/embed/JJI4eR-G5AM',
34
+ },
35
+ 'zh-CN': {
36
+ label: '演示',
37
+ href: ' https://www.youtube.com/embed/JJI4eR-G5AM',
38
+ },
39
+ },
40
+ // icon: 'play',
41
+ // position: 'right', // right | left | top | bottom
42
+ // target_opening: '_blank',
43
+ },
44
+ },
45
+ },
46
+ */
47
+ const WithDemoVideosAndLinks = (props) => {
48
+ const { children, targetElements, locale = 'en'} = props;
5
49
  const [showPIP, setShowPIP] = useState(false);
6
50
  const [PIPContentLink, setPIPContentLink] = useState('');
7
51
  const [showMaximised, setShowMaximised] = useState(false);
8
- const {
9
- demoVideoAndLinkJSONData: { demoVideoAndLinkJSON = {} } = {},
10
- userData: {
11
- user: { lang: userLocale = '' } = {},
12
- currentOrgDetails: {
13
- basicDetails: { base_language: orgLocale = '' } = {},
14
- } = {},
15
- } = {},
16
- match: { path = '' } = {},
17
- } = props || {};
18
- const JSONInContext = demoVideoAndLinkJSON?.[publicPath];
19
- const currentPathJSON = JSONInContext?.find(
20
- routeEle => routeEle.route === path,
21
- );
22
- const locale = userLocale || orgLocale || 'default';
23
-
24
- const targetElements = currentPathJSON?.target_elements;
25
52
  const cssSelectors = [];
26
53
  if (Object.keys(targetElements)?.length) {
27
54
  Object.keys(targetElements).map(targetElement => {
@@ -131,9 +158,14 @@ const withDemoVideosAndLinks = (WrappedComponent, publicPath) => props => {
131
158
  />
132
159
  </ResizablePIP>
133
160
  )}
134
- <WrappedComponent {...props} />
161
+ {children}
135
162
  </div>
136
163
  );
137
164
  };
138
165
 
139
- export default withDemoVideosAndLinks;
166
+ WithDemoVideosAndLinks.PropTypes = {
167
+ children: PropTypes.any,
168
+ locale: PropTypes.string,
169
+ targetElements: PropTypes.object,
170
+ };
171
+ export default WithDemoVideosAndLinks;