@capillarytech/cap-ui-utils 1.4.6-alpha.0 → 1.4.6-alpha1.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-alpha1.0",
4
4
  "description": "Utility functions shared accross all the modules",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,28 +1,52 @@
1
1
  import React, { useState } from 'react';
2
2
  import ResizablePIP from './ResizablePIP';
3
3
 
4
- const withDemoVideosAndLinks = (WrappedComponent, publicPath) => props => {
4
+ /** Sample targetElementsData
5
+ target_elements: {
6
+ '.loyalty-graph-header': {
7
+ support_link: {
8
+ target_url: {
9
+ default: {
10
+ label: 'Help default',
11
+ href: 'https://app.storylane.io/share/v1ilsyhwno8m',
12
+ },
13
+ en: {
14
+ label: 'Help',
15
+ href: 'https://app.storylane.io/share/v1ilsyhwno8m',
16
+ },
17
+ },
18
+ // icon: '',
19
+ // position: 'right',
20
+ // target_opening: '_blank',
21
+ },
22
+ },
23
+ '.performance-time-head-title': {
24
+ support_video: {
25
+ target_url: {
26
+ default: {
27
+ label: 'Demo',
28
+ href: ' https://www.youtube.com/embed/JJI4eR-G5AM',
29
+ },
30
+ en: {
31
+ label: 'Demo',
32
+ href: ' https://www.youtube.com/embed/JJI4eR-G5AM',
33
+ },
34
+ 'zh-CN': {
35
+ label: '演示',
36
+ href: ' https://www.youtube.com/embed/JJI4eR-G5AM',
37
+ },
38
+ },
39
+ // icon: 'play',
40
+ // position: 'right', // right | left | top | bottom
41
+ // target_opening: '_blank',
42
+ },
43
+ },
44
+ },
45
+ */
46
+ const withDemoVideosAndLinks = (WrappedComponent, targetElements = {}, locale = 'en') => props => {
5
47
  const [showPIP, setShowPIP] = useState(false);
6
48
  const [PIPContentLink, setPIPContentLink] = useState('');
7
49
  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
- const cssSelectors = [];
26
50
  if (Object.keys(targetElements)?.length) {
27
51
  Object.keys(targetElements).map(targetElement => {
28
52
  cssSelectors.push({