@orangelogic/orange-dam-content-browser-sdk 1.0.1-test

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 (173) hide show
  1. package/.env +1 -0
  2. package/.eslintignore +2 -0
  3. package/.eslintrc.json +82 -0
  4. package/.releaserc +17 -0
  5. package/.travis.yml +20 -0
  6. package/CBSDKdemo.html +315 -0
  7. package/GitVersion.yml +18 -0
  8. package/README.md +57 -0
  9. package/azure-pipeline.yaml +94 -0
  10. package/clientlib.config.js +36 -0
  11. package/config/env.js +105 -0
  12. package/config/getHttpsConfig.js +67 -0
  13. package/config/jest/babelTransform.js +30 -0
  14. package/config/jest/cssTransform.js +14 -0
  15. package/config/jest/fileTransform.js +41 -0
  16. package/config/modules.js +135 -0
  17. package/config/paths.js +79 -0
  18. package/config/webpack/persistentCache/createEnvironmentHash.js +10 -0
  19. package/config/webpack.config.js +762 -0
  20. package/config/webpackDevServer.config.js +128 -0
  21. package/config-overrides.js +8 -0
  22. package/gab_extension/GAB.html +85 -0
  23. package/gab_extension/GoogleChrome/manifest.json +28 -0
  24. package/gab_extension/GoogleChrome/src/assets/icon48.png +0 -0
  25. package/gab_extension/GoogleChrome/src/background/index.js +6 -0
  26. package/gab_extension/GoogleChrome/src/scripts/index.js +347 -0
  27. package/gab_extension/MozillaFirefox/manifest.json +20 -0
  28. package/gab_extension/MozillaFirefox/src/assets/icon.png +0 -0
  29. package/gab_extension/MozillaFirefox/src/background/index.js +5 -0
  30. package/gab_extension/MozillaFirefox/src/scripts/index.js +347 -0
  31. package/gab_extension/README.md +11 -0
  32. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.pbxproj +927 -0
  33. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  34. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  35. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.xcworkspace/xcuserdata/oldevmac01.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  36. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/xcuserdata/oldevmac01.xcuserdatad/xcschemes/xcschememanagement.plist +19 -0
  37. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
  38. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/AppIcon.appiconset/Contents.json +63 -0
  39. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/Contents.json +6 -0
  40. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/LargeIcon.imageset/Contents.json +20 -0
  41. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Base.lproj/Main.html +23 -0
  42. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Resources/Icon.png +0 -0
  43. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Resources/Script.js +24 -0
  44. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Resources/Style.css +61 -0
  45. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/ViewController.swift +81 -0
  46. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (Extension)/SafariWebExtensionHandler.swift +26 -0
  47. package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/AppDelegate.swift +24 -0
  48. package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/Base.lproj/LaunchScreen.storyboard +36 -0
  49. package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/Base.lproj/Main.storyboard +38 -0
  50. package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/Info.plist +27 -0
  51. package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/SceneDelegate.swift +18 -0
  52. package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (Extension)/Info.plist +13 -0
  53. package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/AppDelegate.swift +21 -0
  54. package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/Base.lproj/Main.storyboard +125 -0
  55. package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/Info.plist +8 -0
  56. package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/Orange DAM Asset Browser Extension.entitlements +12 -0
  57. package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (Extension)/Info.plist +13 -0
  58. package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (Extension)/Orange DAM Asset Browser Extension.entitlements +10 -0
  59. package/package.json +192 -0
  60. package/public/favicon.ico +0 -0
  61. package/public/index.html +92 -0
  62. package/public/logo192.png +0 -0
  63. package/public/logo512.png +0 -0
  64. package/public/manifest.json +25 -0
  65. package/public/robots.txt +3 -0
  66. package/scripts/build.js +218 -0
  67. package/scripts/start.js +154 -0
  68. package/scripts/test.js +53 -0
  69. package/src/App.tsx +98 -0
  70. package/src/AppContext.ts +18 -0
  71. package/src/GlobalConfigContext.ts +46 -0
  72. package/src/components/ArrayClamp/ArrayClamp.styled.ts +42 -0
  73. package/src/components/ArrayClamp/ArrayClamp.tsx +167 -0
  74. package/src/components/ArrayClamp/index.ts +1 -0
  75. package/src/components/Browser/Browser.styled.ts +82 -0
  76. package/src/components/Browser/Browser.tsx +284 -0
  77. package/src/components/Browser/BrowserItem.tsx +98 -0
  78. package/src/components/Browser/index.ts +1 -0
  79. package/src/components/ControlBar/ControlBar.constants.tsx +66 -0
  80. package/src/components/ControlBar/ControlBar.styled.ts +82 -0
  81. package/src/components/ControlBar/ControlBar.tsx +528 -0
  82. package/src/components/ControlBar/Facet/Facet.tsx +113 -0
  83. package/src/components/ControlBar/Facet/index.ts +1 -0
  84. package/src/components/ControlBar/index.ts +1 -0
  85. package/src/components/FormatDialog/CropPreviewer/CropPreviewer.tsx +224 -0
  86. package/src/components/FormatDialog/CropPreviewer/index.ts +3 -0
  87. package/src/components/FormatDialog/CustomRendition/CustomRendition.constants.ts +24 -0
  88. package/src/components/FormatDialog/CustomRendition/CustomRendition.styled.ts +57 -0
  89. package/src/components/FormatDialog/CustomRendition/CustomRendition.tsx +178 -0
  90. package/src/components/FormatDialog/CustomRendition/index.ts +1 -0
  91. package/src/components/FormatDialog/CustomRendition/transformations/Crop.tsx +249 -0
  92. package/src/components/FormatDialog/CustomRendition/transformations/Extension.tsx +54 -0
  93. package/src/components/FormatDialog/CustomRendition/transformations/Format.tsx +86 -0
  94. package/src/components/FormatDialog/CustomRendition/transformations/Resize.tsx +176 -0
  95. package/src/components/FormatDialog/CustomRendition/transformations/Rotate.tsx +101 -0
  96. package/src/components/FormatDialog/CustomRendition/transformations/index.ts +5 -0
  97. package/src/components/FormatDialog/FormatDialog.styled.ts +137 -0
  98. package/src/components/FormatDialog/FormatDialog.tsx +1533 -0
  99. package/src/components/FormatDialog/Previewer/Previewer.styled.ts +31 -0
  100. package/src/components/FormatDialog/Previewer/Previewer.tsx +143 -0
  101. package/src/components/FormatDialog/Previewer/index.ts +1 -0
  102. package/src/components/FormatDialog/ProxyMenu/ProxyMenu.styled.ts +88 -0
  103. package/src/components/FormatDialog/ProxyMenu/ProxyMenu.tsx +74 -0
  104. package/src/components/FormatDialog/ProxyMenu/index.ts +1 -0
  105. package/src/components/FormatDialog/TrackingParameters/TrackingParameters.tsx +59 -0
  106. package/src/components/FormatDialog/TrackingParameters/index.ts +1 -0
  107. package/src/components/FormatDialog/index.ts +1 -0
  108. package/src/components/Header/Header.styled.ts +51 -0
  109. package/src/components/Header/Header.tsx +118 -0
  110. package/src/components/Header/index.ts +1 -0
  111. package/src/components/Loader/Loader.tsx +37 -0
  112. package/src/components/Loader/index.ts +1 -0
  113. package/src/components/NoResult/NoResult.tsx +37 -0
  114. package/src/components/NoResult/index.tsx +1 -0
  115. package/src/components/Result/AssetCard/AssetCard.styled.ts +120 -0
  116. package/src/components/Result/AssetCard/AssetCard.tsx +192 -0
  117. package/src/components/Result/AssetCard/AssetCardWrapper.styled.ts +35 -0
  118. package/src/components/Result/AssetCard/AssetCardWrapper.tsx +165 -0
  119. package/src/components/Result/AssetCard/index.ts +1 -0
  120. package/src/components/Result/AssetPreview/AssetPreview.styled.ts +108 -0
  121. package/src/components/Result/AssetPreview/AssetPreview.tsx +78 -0
  122. package/src/components/Result/AssetPreview/ImagePreview/ImagePreview.tsx +42 -0
  123. package/src/components/Result/AssetPreview/ImagePreview/index.ts +1 -0
  124. package/src/components/Result/AssetPreview/OtherPreview/OtherPreview.styled.ts +23 -0
  125. package/src/components/Result/AssetPreview/OtherPreview/OtherPreview.tsx +28 -0
  126. package/src/components/Result/AssetPreview/OtherPreview/index.ts +1 -0
  127. package/src/components/Result/AssetPreview/VideoPreview/VideoPreview.tsx +132 -0
  128. package/src/components/Result/AssetPreview/VideoPreview/index.ts +1 -0
  129. package/src/components/Result/AssetPreview/index.ts +1 -0
  130. package/src/consts/asset.ts +16 -0
  131. package/src/consts/data.ts +17 -0
  132. package/src/index.tsx +305 -0
  133. package/src/page/Authenticate/Authenticate.tsx +232 -0
  134. package/src/page/Authenticate/ConnectingBackground.tsx +44 -0
  135. package/src/page/Authenticate/index.tsx +94 -0
  136. package/src/page/Home/Home.styled.ts +46 -0
  137. package/src/page/Home/Home.tsx +941 -0
  138. package/src/page/Home/index.ts +1 -0
  139. package/src/react-web-component.d.ts +4617 -0
  140. package/src/store/assets/assets.api.ts +167 -0
  141. package/src/store/assets/assets.service.ts +223 -0
  142. package/src/store/assets/assets.slice.ts +104 -0
  143. package/src/store/auth/auth.service.ts +71 -0
  144. package/src/store/auth/auth.slice.ts +295 -0
  145. package/src/store/index.ts +27 -0
  146. package/src/store/search/search.api.ts +319 -0
  147. package/src/store/search/search.slice.ts +28 -0
  148. package/src/store/user/user.api.ts +29 -0
  149. package/src/styles.css +42 -0
  150. package/src/types/assets.ts +71 -0
  151. package/src/types/auth.ts +42 -0
  152. package/src/types/common.ts +11 -0
  153. package/src/types/download.ts +8 -0
  154. package/src/types/navigation.ts +3 -0
  155. package/src/types/search.ts +116 -0
  156. package/src/types/storage.ts +1 -0
  157. package/src/types/user.ts +6 -0
  158. package/src/utils/api.ts +186 -0
  159. package/src/utils/array.ts +25 -0
  160. package/src/utils/constants.ts +12 -0
  161. package/src/utils/fetch.ts +116 -0
  162. package/src/utils/getRequestUrl.ts +15 -0
  163. package/src/utils/hooks.ts +36 -0
  164. package/src/utils/icon.ts +22 -0
  165. package/src/utils/image.ts +157 -0
  166. package/src/utils/number.ts +11 -0
  167. package/src/utils/rotate.ts +23 -0
  168. package/src/utils/storage.ts +184 -0
  169. package/src/utils/string.ts +24 -0
  170. package/src/view/AssetsPicker.tsx +24 -0
  171. package/src/web-component.d.ts +8151 -0
  172. package/tsconfig.eslint.json +10 -0
  173. package/tsconfig.json +37 -0
@@ -0,0 +1,31 @@
1
+ import styled from 'styled-components';
2
+
3
+ export const Container = styled.div`
4
+ position: relative;
5
+ width: 100%;
6
+ height: 350px;
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+
11
+ .loading {
12
+ width: 100%;
13
+ height: 100%;
14
+ position: absolute;
15
+ }
16
+
17
+ .loading__skeleton {
18
+ --border-radius: 0;
19
+ width: 100%;
20
+ height: 100%;
21
+ }
22
+
23
+ .loading__spinner {
24
+ --track-width: 0.2rem;
25
+ font-size: var(--cx-font-size-3x-large);
26
+ position: absolute;
27
+ top: 50%;
28
+ left: 50%;
29
+ transform: translate(-50%, -50%);
30
+ }
31
+ `;
@@ -0,0 +1,143 @@
1
+ import { CSSProperties, FC, useCallback, useRef, useState } from 'react';
2
+
3
+ import OtherPreview from '@/components/Result/AssetPreview/OtherPreview';
4
+ import { MediaType } from '@/types/search';
5
+
6
+ import { Container } from './Previewer.styled';
7
+
8
+ type Props = {
9
+ loadable: boolean;
10
+ asset: {
11
+ docType?: MediaType;
12
+ imageUrl?: string;
13
+ videoUrl?: string;
14
+ extension?: string;
15
+ };
16
+ onLoad?: ({ width, height }: { width: number, height: number }) => void;
17
+ };
18
+
19
+ const Previewer: FC<Props> = ({
20
+ loadable,
21
+ asset = {
22
+ docType: MediaType.Image,
23
+ imageUrl: '',
24
+ },
25
+ onLoad,
26
+ }) => {
27
+ const [isLoading, setIsLoading] = useState(false);
28
+ const [isLoadFailed, setIsLoadFailed] = useState(false);
29
+ const containerRef = useRef<HTMLDivElement>(null);
30
+ const imageRef = useRef<HTMLImageElement>(null);
31
+ const [assetDirection, setAssetDirection] = useState<'vertical' | 'horizontal'>('horizontal');
32
+
33
+ const onLoadAsset = useCallback((rect: { width: number, height: number }) => {
34
+ if (onLoad) {
35
+ onLoad(rect);
36
+ }
37
+
38
+ setAssetDirection(rect.width > rect.height ? 'horizontal' : 'vertical');
39
+ }, [onLoad]);
40
+
41
+ const renderPreview = useCallback(() => {
42
+ if (!loadable) {
43
+ return;
44
+ }
45
+
46
+ const otherPreview = (
47
+ <OtherPreview
48
+ type={asset.docType}
49
+ style={
50
+ {
51
+ '--text-font-size': 'var(--cx-font-size-x-large)',
52
+ '--icon-font-size': '56px',
53
+ '--gap': 'var(--cx-spacing-small)',
54
+ } as CSSProperties
55
+ }
56
+ >
57
+ {asset.extension?.toUpperCase() ?? asset.docType}
58
+ </OtherPreview>
59
+ );
60
+
61
+ if (isLoadFailed) {
62
+ return otherPreview;
63
+ }
64
+
65
+ if (asset.docType === MediaType.Video && asset.videoUrl) {
66
+ return (
67
+ <video
68
+ src={asset.videoUrl}
69
+ controls
70
+ controlsList="nodownload noremoteplayback noplaybackrate"
71
+ disablePictureInPicture
72
+ disableRemotePlayback
73
+ style={{
74
+ maxWidth: '100%',
75
+ maxHeight: '100%',
76
+ objectFit: 'contain',
77
+ width: assetDirection === 'horizontal' ? '100%' : 'auto',
78
+ height: assetDirection === 'vertical' ? '100%' : 'auto',
79
+ }}
80
+ onLoadedMetadata={(e) => {
81
+ setIsLoading(false);
82
+ onLoadAsset({
83
+ width: e.currentTarget.videoWidth,
84
+ height: e.currentTarget.videoHeight,
85
+ });
86
+ }}
87
+ onError={() => {
88
+ setIsLoading(false);
89
+ setIsLoadFailed(true);
90
+ }}
91
+ >
92
+ </video>
93
+ );
94
+ }
95
+
96
+ if (asset.docType === MediaType.Image || asset.imageUrl) {
97
+ return (
98
+ <img
99
+ ref={imageRef}
100
+ src={asset.imageUrl}
101
+ alt={asset.docType}
102
+ style={{
103
+ maxWidth: '100%',
104
+ maxHeight: '100%',
105
+ objectFit: 'contain',
106
+ width: assetDirection === 'horizontal' ? '100%' : 'auto',
107
+ height: assetDirection === 'vertical' ? '100%' : 'auto',
108
+ }}
109
+ onLoad={() => {
110
+ if (!imageRef.current) {
111
+ return;
112
+ }
113
+ setIsLoading(false);
114
+ onLoadAsset({
115
+ width: imageRef.current.naturalWidth,
116
+ height: imageRef.current.naturalHeight,
117
+ });
118
+ }}
119
+ onError={() => {
120
+ setIsLoading(false);
121
+ setIsLoadFailed(true);
122
+ }}
123
+ />
124
+ );
125
+ }
126
+
127
+ return otherPreview;
128
+ }, [asset.docType, asset.extension, asset.imageUrl, asset.videoUrl, assetDirection, isLoadFailed, loadable, onLoadAsset]);
129
+
130
+ return (
131
+ <Container ref={containerRef}>
132
+ {renderPreview()}
133
+ {isLoading && (
134
+ <div className="loading">
135
+ <cx-skeleton className="loading__skeleton"></cx-skeleton>
136
+ <cx-spinner className="loading__spinner"></cx-spinner>
137
+ </div>
138
+ )}
139
+ </Container>
140
+ );
141
+ };
142
+
143
+ export default Previewer;
@@ -0,0 +1 @@
1
+ export { default } from './Previewer';
@@ -0,0 +1,88 @@
1
+ import { CxMenuProps } from '@/react-web-component';
2
+ import styled from 'styled-components';
3
+
4
+ export const Container = styled('cx-menu')<CxMenuProps>`
5
+ border-radius: 0;
6
+ padding: 0;
7
+
8
+ cx-menu-item {
9
+ &::part(base) {
10
+ height: 60px;
11
+ padding: var(--cx-spacing-x-small) var(--cx-spacing-medium);
12
+ }
13
+
14
+ &::part(label) {
15
+ display: flex;
16
+ align-items: center;
17
+ }
18
+
19
+ &::part(checked-icon) {
20
+ display: none;
21
+ }
22
+
23
+ &::part(submenu-icon) {
24
+ display: none;
25
+ }
26
+
27
+ &::part(suffix) {
28
+ color: var(--cx-color-neutral-600);
29
+ }
30
+
31
+ .icon--primary {
32
+ color: var(--cx-color-primary);
33
+ }
34
+
35
+ &.proxy--switch::part(label) {
36
+ justify-content: space-between;
37
+ }
38
+
39
+ .proxy__name {
40
+ color: var(--cx-color-neutral-900);
41
+
42
+ &::part(base) {
43
+ font-weight: var(--cx-font-weight-medium);
44
+ }
45
+ }
46
+
47
+ .proxy__name.selected {
48
+ --color: var(--cx-color-primary);
49
+ }
50
+
51
+ .proxy__thumbnail {
52
+ background-color: var(--cx-color-neutral-100);
53
+ width: 54px;
54
+ height: 40px;
55
+ object-fit: cover;
56
+ display: flex;
57
+ align-items: center;
58
+ justify-content: center;
59
+
60
+ img {
61
+ width: auto;
62
+ max-width: 100%;
63
+ max-height: 100%;
64
+ }
65
+ }
66
+
67
+ .proxy__details {
68
+ --color: var(--cx-color-neutral-500);
69
+ &::part(base) {
70
+ display: flex;
71
+ align-items: center;
72
+ gap: var(--cx-spacing-2x-small);
73
+ }
74
+ }
75
+
76
+ .proxy__extension-dot {
77
+ display: inline-block;
78
+ width: 3px;
79
+ height: 3px;
80
+ border-radius: 50%;
81
+ background-color: var(--cx-color-neutral-500);
82
+ }
83
+
84
+ &:not(:last-child) {
85
+ border-bottom: var(--cx-panel-border-width) solid var(--cx-panel-border-color);
86
+ }
87
+ }
88
+ `;
@@ -0,0 +1,74 @@
1
+ import { ReactNode, CSSProperties } from 'react';
2
+ import { Container } from './ProxyMenu.styled';
3
+ import { MediaType } from '@/types/search';
4
+
5
+ type MenuItemProps = {
6
+ cdnName?: string | null;
7
+ docType?: string;
8
+ extension?: string;
9
+ height?: string;
10
+ image?: string;
11
+ name: string;
12
+ value: string;
13
+ width?: string;
14
+ };
15
+
16
+ type Props = {
17
+ items?: MenuItemProps[];
18
+ selectedItem?: string;
19
+ children?: ReactNode;
20
+ style?: CSSProperties;
21
+ selectedDisabled?: boolean;
22
+ };
23
+
24
+ const ProxyMenu = ({ items, selectedItem, children, style, selectedDisabled }: Props) => {
25
+ return (
26
+ <Container style={style}>
27
+ {items?.map((item) => {
28
+ const selected = selectedItem === item.value && !selectedDisabled;
29
+ const showDimensions = Boolean(Number(item.width)) && Boolean(Number(item.height)) && item.docType !== MediaType.Audio && item.docType !== MediaType.Multimedia;
30
+
31
+ return (
32
+ <cx-menu-item key={item.value} value={item.value} className={selected ? 'disable-hover' : ''}>
33
+ {item.image && (
34
+ <div slot="prefix" className="proxy__thumbnail">
35
+ <img src={item.image} alt={item.name} />
36
+ </div>
37
+ )}
38
+ <div>
39
+ <cx-typography
40
+ variant="body3"
41
+ className={`proxy__name ${selected ? 'selected' : ''}`}
42
+ >
43
+ {item.name}
44
+ </cx-typography>
45
+ <cx-typography variant="body3" className="proxy__details">
46
+ {showDimensions && `${item.width} x ${item.height}`}
47
+ {showDimensions && item.extension && (
48
+ <div className="proxy__extension-dot"></div>
49
+ )}
50
+ {item.extension?.replace(/^\./, '').toUpperCase()}
51
+ {item.cdnName && (
52
+ <>
53
+ <div className="proxy__extension-dot"></div>
54
+ <span className="proxy__cdn-name">{item.cdnName}</span>
55
+ </>
56
+ )}
57
+ </cx-typography>
58
+ </div>
59
+ <cx-icon
60
+ slot="suffix"
61
+ name={selected ? 'check' : ''}
62
+ style={{
63
+ color: 'var(--cx-color-primary)',
64
+ }}
65
+ ></cx-icon>
66
+ </cx-menu-item>
67
+ );
68
+ })}
69
+ {children}
70
+ </Container>
71
+ );
72
+ };
73
+
74
+ export default ProxyMenu;
@@ -0,0 +1 @@
1
+ export { default } from './ProxyMenu';
@@ -0,0 +1,59 @@
1
+ import { FC } from 'react';
2
+
3
+ type Props = {
4
+ values: { key: string; value: string }[];
5
+ onChange: (values: { key: string; value: string }[]) => void;
6
+ };
7
+
8
+ const TrackingParameters: FC<Props> = ({
9
+ values,
10
+ onChange,
11
+ }) => {
12
+ const addParameter = () => {
13
+ onChange([...values, { key: '', value: '' }]);
14
+ };
15
+
16
+ const removeParameter = (index: number) => {
17
+ onChange(values.filter((_, i) => i !== index));
18
+ };
19
+
20
+ const updateParameter = (index: number, key: string, value: string) => {
21
+ const newParameters = [...values];
22
+ newParameters[index] = { key, value };
23
+ onChange(newParameters);
24
+ };
25
+
26
+ return (
27
+ <cx-space direction="vertical" spacing="medium" className="dialog__tracking" align-items='flex-start'>
28
+ {values.map((param, index) => (
29
+ <cx-space key={index} spacing="small" wrap="nowrap" align-items="center">
30
+ <cx-input-group>
31
+ <cx-input
32
+ label="Name"
33
+ size="small"
34
+ value={param.key}
35
+ onInput={(e) => updateParameter(index, (e.target as HTMLInputElement).value, param.value)}
36
+ ></cx-input>
37
+ <cx-input
38
+ label="Value"
39
+ size="small"
40
+ value={param.value}
41
+ onInput={(e) => updateParameter(index, param.key, (e.target as HTMLInputElement).value)}
42
+ ></cx-input>
43
+ </cx-input-group>
44
+ <cx-icon-button
45
+ name="close"
46
+ onClick={() => removeParameter(index)}
47
+ ></cx-icon-button>
48
+ </cx-space>
49
+ ))}
50
+ <cx-button variant="neutral" onClick={addParameter}>
51
+ <cx-icon slot="prefix" name="add"></cx-icon>
52
+ Add parameter
53
+ </cx-button>
54
+ </cx-space>
55
+ );
56
+ };
57
+
58
+
59
+ export default TrackingParameters;
@@ -0,0 +1 @@
1
+ export { default } from './TrackingParameters';
@@ -0,0 +1 @@
1
+ export { default } from './FormatDialog';
@@ -0,0 +1,51 @@
1
+ import styled from 'styled-components';
2
+
3
+ import { CxSpaceProps } from '@/react-web-component';
4
+
5
+ export const Container = styled('cx-space')<CxSpaceProps & { bordered?: boolean }>`
6
+ border-bottom: ${({ bordered }) => (bordered ? '1px solid var(--cx-color-neutral-300)' : 'none')};
7
+ padding: var(--cx-spacing-medium);
8
+
9
+ cx-avatar {
10
+ --size: var(--cx-font-size-3x-large);
11
+
12
+ cursor: pointer;
13
+ }
14
+
15
+ cx-skeleton {
16
+ --color: var(--cx-color-primary);
17
+
18
+ width: var(--cx-font-size-3x-large);
19
+ height: var(--cx-font-size-3x-large);
20
+ }
21
+
22
+ cx-menu-item::part(checked-icon) {
23
+ display: none;
24
+ }
25
+
26
+ .header {
27
+ flex-wrap: nowrap;
28
+ width: 100%;
29
+ }
30
+
31
+ .header__title {
32
+ display: flex;
33
+ align-items: center;
34
+ }
35
+
36
+ .header__menu {
37
+ display: flex;
38
+ gap: var(--cx-spacing-2x-small);
39
+ align-items: center;
40
+ width: fit-content;
41
+ }
42
+
43
+ .header__user-info:hover::part(base) {
44
+ background-color: unset;
45
+ cursor: default;
46
+ }
47
+
48
+ .header__user-info cx-avatar {
49
+ cursor: default;
50
+ }
51
+ `;
@@ -0,0 +1,118 @@
1
+ import { CSSProperties, FC, ReactNode, useContext, useEffect, useMemo } from 'react';
2
+
3
+ import { AppContext } from '@/AppContext';
4
+ import { GlobalConfigContext } from '@/GlobalConfigContext';
5
+ import { useGetUserInfoQuery } from '@/store/user/user.api';
6
+ import { Folder } from '@/types/search';
7
+
8
+ import { Container } from './Header.styled';
9
+
10
+ type Props = {
11
+ authenticated: boolean;
12
+ bordered?: boolean;
13
+ children?: ReactNode;
14
+ currentFolder: Folder;
15
+ onMenuClick: () => void;
16
+ onLogout: () => void;
17
+ };
18
+
19
+ const Header: FC<Props> = ({
20
+ authenticated,
21
+ bordered,
22
+ children,
23
+ currentFolder,
24
+ onMenuClick,
25
+ onLogout,
26
+ }) => {
27
+ const { isContentBrowserPopedup, pluginInfo } = useContext(GlobalConfigContext);
28
+ const { onClose } = useContext(AppContext);
29
+ const { data, isFetching, isLoading, refetch: refetchUserInfo } = useGetUserInfoQuery({});
30
+
31
+ useEffect(() => {
32
+ if (authenticated) {
33
+ refetchUserInfo();
34
+ }
35
+ }, [authenticated, refetchUserInfo]);
36
+
37
+ const title = useMemo(() => {
38
+ if (!currentFolder.fullPath) {
39
+ return (
40
+ <cx-line-clamp lines={1}>
41
+ <cx-typography variant="h4">{pluginInfo.publicApplicationName}</cx-typography>
42
+ </cx-line-clamp>
43
+ );
44
+ }
45
+
46
+ return (
47
+ <cx-space direction="horizontal" align-items="center" spacing="2x-small">
48
+ <cx-typography variant="h4">{currentFolder.title}</cx-typography>
49
+ </cx-space>
50
+ );
51
+ }, [currentFolder.fullPath, currentFolder.title, pluginInfo.publicApplicationName]);
52
+
53
+ const Dropdown = useMemo(() => {
54
+ return isLoading || isFetching ? (
55
+ <cx-skeleton></cx-skeleton>
56
+ ) : (
57
+ <cx-dropdown distance={4}>
58
+ <cx-avatar
59
+ slot="trigger"
60
+ label="User avatar"
61
+ image={data?.avatar}
62
+ loading="lazy"
63
+ ></cx-avatar>
64
+ <cx-menu>
65
+ <cx-menu-item className='header__user-info' readonly>
66
+ {data?.fullName}
67
+ <cx-avatar
68
+ slot="prefix"
69
+ label="User avatar"
70
+ image={data?.avatar}
71
+ loading="lazy"
72
+ style={
73
+ {
74
+ '--size': 'var(--cx-font-size-x-large)',
75
+ } as CSSProperties
76
+ }
77
+ ></cx-avatar>
78
+ </cx-menu-item>
79
+ <cx-divider></cx-divider>
80
+ <cx-menu-item value="logout" onClick={onLogout}>
81
+ Logout
82
+ <cx-icon slot="prefix" name="logout"></cx-icon>
83
+ </cx-menu-item>
84
+ </cx-menu>
85
+ </cx-dropdown>
86
+ );
87
+ }, [isLoading, isFetching, data?.avatar, data?.fullName, onLogout]);
88
+
89
+ return (
90
+ <Container direction="vertical" spacing="small" bordered={bordered}>
91
+ <cx-space className="header" justify-content="space-between" align-items="center">
92
+ <div className="header__title">
93
+ <cx-space className="header" justify-content="space-between" align-items="center" spacing="x-small">
94
+ <cx-icon-button
95
+ name="menu"
96
+ label="Menu"
97
+ onClick={onMenuClick}
98
+ ></cx-icon-button>
99
+ {title}
100
+ </cx-space>
101
+ </div>
102
+ <div className="header__menu">
103
+ {Dropdown}
104
+ {isContentBrowserPopedup && (
105
+ <cx-icon-button
106
+ name="close"
107
+ label="Close"
108
+ onClick={onClose}
109
+ ></cx-icon-button>
110
+ )}
111
+ </div>
112
+ </cx-space>
113
+ {children}
114
+ </Container>
115
+ );
116
+ };
117
+
118
+ export default Header;
@@ -0,0 +1 @@
1
+ export { default } from './Header';
@@ -0,0 +1,37 @@
1
+ import { CSSProperties, FC } from 'react';
2
+
3
+ import { MESSAGE_NEW_LINE } from '@/consts/data';
4
+
5
+ type Props = {
6
+ message?: string;
7
+ children?: React.ReactNode;
8
+ };
9
+
10
+ const Loader: FC<Props> = ({ message, children }) => {
11
+ return (
12
+ <cx-space direction="vertical" align-items="center">
13
+ <cx-spinner
14
+ style={
15
+ {
16
+ '--track-width': '0.2rem',
17
+ fontSize: 'var(--cx-font-size-3x-large)',
18
+ } as CSSProperties
19
+ }
20
+ ></cx-spinner>
21
+ {message?.split(MESSAGE_NEW_LINE).map((line, index) =>
22
+ line.indexOf('http') !== -1 ? (
23
+ <cx-button key={index} href={line} target="_blank">
24
+ {line}
25
+ </cx-button>
26
+ ) : (
27
+ <cx-typography key={index} variant="body2">
28
+ {line}
29
+ </cx-typography>
30
+ ),
31
+ )}
32
+ {children}
33
+ </cx-space>
34
+ );
35
+ };
36
+
37
+ export default Loader;
@@ -0,0 +1 @@
1
+ export { default } from './Loader';
@@ -0,0 +1,37 @@
1
+ import { FC } from 'react';
2
+
3
+ type Props = {
4
+ icon: string;
5
+ message: string;
6
+ };
7
+
8
+ const NoResult: FC<Props> = ({
9
+ icon,
10
+ message,
11
+ }: Props) => {
12
+ return (
13
+ <div
14
+ style={{
15
+ alignItems: 'center',
16
+ color: 'var(--cx-color-neutral)',
17
+ display: 'flex',
18
+ flexDirection: 'column',
19
+ gap: 'var(--cx-spacing-medium)',
20
+ height: '100%',
21
+ justifyContent: 'center',
22
+ textAlign: 'center',
23
+ width: '100%',
24
+ }}
25
+ >
26
+ <cx-icon
27
+ name={icon}
28
+ style={{
29
+ fontSize: '96px',
30
+ }}
31
+ ></cx-icon>
32
+ {message}
33
+ </div>
34
+ );
35
+ };
36
+
37
+ export default NoResult;
@@ -0,0 +1 @@
1
+ export { default } from './NoResult';