@orangelogic/orange-dam-content-browser-sdk 2.1.53 → 2.1.54

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 (281) 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/azure-pipeline.yaml +93 -0
  9. package/clientlib.config.js +36 -0
  10. package/config/env.js +105 -0
  11. package/config/getHttpsConfig.js +67 -0
  12. package/config/jest/babelTransform.js +30 -0
  13. package/config/jest/cssTransform.js +14 -0
  14. package/config/jest/fileTransform.js +41 -0
  15. package/config/modules.js +135 -0
  16. package/config/paths.js +79 -0
  17. package/config/webpack/persistentCache/createEnvironmentHash.js +10 -0
  18. package/config/webpack.config.js +762 -0
  19. package/config/webpackDevServer.config.js +128 -0
  20. package/config-overrides.js +8 -0
  21. package/gab_extension/GAB.html +85 -0
  22. package/gab_extension/GoogleChrome/manifest.json +28 -0
  23. package/gab_extension/GoogleChrome/src/assets/icon48.png +0 -0
  24. package/gab_extension/GoogleChrome/src/background/index.js +6 -0
  25. package/gab_extension/GoogleChrome/src/scripts/index.js +347 -0
  26. package/gab_extension/MozillaFirefox/manifest.json +20 -0
  27. package/gab_extension/MozillaFirefox/src/assets/icon.png +0 -0
  28. package/gab_extension/MozillaFirefox/src/background/index.js +5 -0
  29. package/gab_extension/MozillaFirefox/src/scripts/index.js +347 -0
  30. package/gab_extension/README.md +11 -0
  31. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.pbxproj +927 -0
  32. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  33. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  34. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.xcworkspace/xcuserdata/oldevmac01.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  35. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/xcuserdata/oldevmac01.xcuserdatad/xcschemes/xcschememanagement.plist +19 -0
  36. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
  37. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/AppIcon.appiconset/Contents.json +63 -0
  38. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/Contents.json +6 -0
  39. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/LargeIcon.imageset/Contents.json +20 -0
  40. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Base.lproj/Main.html +23 -0
  41. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Resources/Icon.png +0 -0
  42. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Resources/Script.js +24 -0
  43. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Resources/Style.css +61 -0
  44. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/ViewController.swift +81 -0
  45. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (Extension)/SafariWebExtensionHandler.swift +26 -0
  46. package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/AppDelegate.swift +24 -0
  47. package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/Base.lproj/LaunchScreen.storyboard +36 -0
  48. package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/Base.lproj/Main.storyboard +38 -0
  49. package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/Info.plist +27 -0
  50. package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/SceneDelegate.swift +18 -0
  51. package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (Extension)/Info.plist +13 -0
  52. package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/AppDelegate.swift +21 -0
  53. package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/Base.lproj/Main.storyboard +125 -0
  54. package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/Info.plist +8 -0
  55. package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/Orange DAM Asset Browser Extension.entitlements +12 -0
  56. package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (Extension)/Info.plist +13 -0
  57. package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (Extension)/Orange DAM Asset Browser Extension.entitlements +10 -0
  58. package/package.json +8 -49
  59. package/public/index.html +92 -0
  60. package/scripts/build.js +218 -0
  61. package/scripts/start.js +154 -0
  62. package/scripts/test.js +53 -0
  63. package/src/App.tsx +98 -0
  64. package/src/AppContext.ts +18 -0
  65. package/src/GlobalConfigContext.ts +46 -0
  66. package/src/components/ArrayClamp/ArrayClamp.styled.ts +42 -0
  67. package/src/components/ArrayClamp/ArrayClamp.tsx +167 -0
  68. package/src/components/ArrayClamp/index.ts +1 -0
  69. package/src/components/Browser/Browser.styled.ts +82 -0
  70. package/src/components/Browser/Browser.tsx +284 -0
  71. package/src/components/Browser/BrowserItem.tsx +98 -0
  72. package/src/components/ControlBar/ControlBar.constants.tsx +66 -0
  73. package/src/components/ControlBar/ControlBar.styled.ts +82 -0
  74. package/src/components/ControlBar/ControlBar.tsx +528 -0
  75. package/src/components/ControlBar/Facet/Facet.tsx +113 -0
  76. package/src/components/ControlBar/Facet/index.ts +1 -0
  77. package/src/components/FormatDialog/CropPreviewer/CropPreviewer.tsx +224 -0
  78. package/{build/components/FormatDialog/CropPreviewer/index.d.ts → src/components/FormatDialog/CropPreviewer/index.ts} +1 -1
  79. package/src/components/FormatDialog/CustomRendition/CustomRendition.constants.ts +24 -0
  80. package/src/components/FormatDialog/CustomRendition/CustomRendition.styled.ts +57 -0
  81. package/src/components/FormatDialog/CustomRendition/CustomRendition.tsx +178 -0
  82. package/src/components/FormatDialog/CustomRendition/index.ts +1 -0
  83. package/src/components/FormatDialog/CustomRendition/transformations/Crop.tsx +249 -0
  84. package/src/components/FormatDialog/CustomRendition/transformations/Extension.tsx +54 -0
  85. package/src/components/FormatDialog/CustomRendition/transformations/Format.tsx +86 -0
  86. package/src/components/FormatDialog/CustomRendition/transformations/Resize.tsx +176 -0
  87. package/src/components/FormatDialog/CustomRendition/transformations/Rotate.tsx +101 -0
  88. package/{build/components/FormatDialog/CustomRendition/transformations/index.d.ts → src/components/FormatDialog/CustomRendition/transformations/index.ts} +1 -3
  89. package/src/components/FormatDialog/FormatDialog.styled.ts +137 -0
  90. package/src/components/FormatDialog/FormatDialog.tsx +1533 -0
  91. package/src/components/FormatDialog/Previewer/Previewer.styled.ts +31 -0
  92. package/src/components/FormatDialog/Previewer/Previewer.tsx +143 -0
  93. package/src/components/FormatDialog/Previewer/index.ts +1 -0
  94. package/src/components/FormatDialog/ProxyMenu/ProxyMenu.styled.ts +88 -0
  95. package/src/components/FormatDialog/ProxyMenu/ProxyMenu.tsx +74 -0
  96. package/src/components/FormatDialog/ProxyMenu/index.ts +1 -0
  97. package/src/components/FormatDialog/TrackingParameters/TrackingParameters.tsx +59 -0
  98. package/src/components/FormatDialog/TrackingParameters/index.ts +1 -0
  99. package/src/components/FormatDialog/index.ts +1 -0
  100. package/src/components/Header/Header.styled.ts +51 -0
  101. package/src/components/Header/Header.tsx +118 -0
  102. package/src/components/Loader/Loader.tsx +37 -0
  103. package/src/components/Loader/index.ts +1 -0
  104. package/src/components/NoResult/NoResult.tsx +37 -0
  105. package/src/components/NoResult/index.tsx +1 -0
  106. package/src/components/Result/AssetCard/AssetCard.styled.ts +120 -0
  107. package/src/components/Result/AssetCard/AssetCard.tsx +192 -0
  108. package/src/components/Result/AssetCard/AssetCardWrapper.styled.ts +35 -0
  109. package/src/components/Result/AssetCard/AssetCardWrapper.tsx +165 -0
  110. package/src/components/Result/AssetCard/index.ts +1 -0
  111. package/src/components/Result/AssetPreview/AssetPreview.styled.ts +108 -0
  112. package/src/components/Result/AssetPreview/AssetPreview.tsx +78 -0
  113. package/src/components/Result/AssetPreview/ImagePreview/ImagePreview.tsx +42 -0
  114. package/src/components/Result/AssetPreview/ImagePreview/index.ts +1 -0
  115. package/src/components/Result/AssetPreview/OtherPreview/OtherPreview.styled.ts +23 -0
  116. package/src/components/Result/AssetPreview/OtherPreview/OtherPreview.tsx +28 -0
  117. package/src/components/Result/AssetPreview/OtherPreview/index.ts +1 -0
  118. package/src/components/Result/AssetPreview/VideoPreview/VideoPreview.tsx +132 -0
  119. package/src/components/Result/AssetPreview/VideoPreview/index.ts +1 -0
  120. package/src/components/Result/AssetPreview/index.ts +1 -0
  121. package/src/consts/asset.ts +16 -0
  122. package/src/consts/data.ts +17 -0
  123. package/src/index.tsx +305 -0
  124. package/src/page/Authenticate/Authenticate.tsx +232 -0
  125. package/src/page/Authenticate/ConnectingBackground.tsx +44 -0
  126. package/src/page/Authenticate/index.tsx +94 -0
  127. package/src/page/Home/Home.styled.ts +46 -0
  128. package/src/page/Home/Home.tsx +941 -0
  129. package/src/react-web-component.d.ts +4617 -0
  130. package/src/store/assets/assets.api.ts +167 -0
  131. package/src/store/assets/assets.service.ts +223 -0
  132. package/src/store/assets/assets.slice.ts +104 -0
  133. package/src/store/auth/auth.service.ts +71 -0
  134. package/src/store/auth/auth.slice.ts +295 -0
  135. package/src/store/index.ts +27 -0
  136. package/src/store/search/search.api.ts +319 -0
  137. package/src/store/search/search.slice.ts +28 -0
  138. package/src/store/user/user.api.ts +29 -0
  139. package/src/styles.css +42 -0
  140. package/src/types/assets.ts +71 -0
  141. package/src/types/auth.ts +42 -0
  142. package/src/types/common.ts +11 -0
  143. package/src/types/download.ts +8 -0
  144. package/src/types/navigation.ts +3 -0
  145. package/src/types/search.ts +116 -0
  146. package/{build/types/storage.d.ts → src/types/storage.ts} +1 -1
  147. package/src/types/user.ts +6 -0
  148. package/src/utils/api.ts +186 -0
  149. package/src/utils/array.ts +25 -0
  150. package/src/utils/constants.ts +12 -0
  151. package/src/utils/fetch.ts +116 -0
  152. package/src/utils/getRequestUrl.ts +15 -0
  153. package/src/utils/hooks.ts +36 -0
  154. package/src/utils/icon.ts +22 -0
  155. package/src/utils/image.ts +157 -0
  156. package/src/utils/number.ts +11 -0
  157. package/src/utils/rotate.ts +23 -0
  158. package/src/utils/storage.ts +184 -0
  159. package/src/utils/string.ts +24 -0
  160. package/src/view/AssetsPicker.tsx +24 -0
  161. package/src/web-component.d.ts +8151 -0
  162. package/tsconfig.eslint.json +10 -0
  163. package/tsconfig.json +37 -0
  164. package/build/ApiService.d.ts +0 -15
  165. package/build/App.d.ts +0 -62
  166. package/build/AppContext.d.ts +0 -18
  167. package/build/GlobalConfigContext.d.ts +0 -32
  168. package/build/OrangeDAMContentBrowserSDK.min.css +0 -2
  169. package/build/OrangeDAMContentBrowserSDK.min.css.map +0 -1
  170. package/build/OrangeDAMContentBrowserSDK.min.js +0 -11468
  171. package/build/OrangeDAMContentBrowserSDK.min.js.map +0 -1
  172. package/build/asset-manifest.json +0 -13
  173. package/build/components/ArrayClamp/ArrayClamp.d.ts +0 -10
  174. package/build/components/ArrayClamp/ArrayClamp.styled.d.ts +0 -1
  175. package/build/components/ArrayClamp/index.d.ts +0 -1
  176. package/build/components/Browser/Browser.constants.d.ts +0 -3
  177. package/build/components/Browser/Browser.d.ts +0 -21
  178. package/build/components/Browser/Browser.styled.d.ts +0 -2
  179. package/build/components/Browser/BrowserItem.d.ts +0 -13
  180. package/build/components/Browser/LoadMoreButton.d.ts +0 -9
  181. package/build/components/ControlBar/ControlBar.constants.d.ts +0 -10
  182. package/build/components/ControlBar/ControlBar.d.ts +0 -23
  183. package/build/components/ControlBar/ControlBar.styled.d.ts +0 -1
  184. package/build/components/ControlBar/Facet/Facet.d.ts +0 -14
  185. package/build/components/ControlBar/Facet/index.d.ts +0 -1
  186. package/build/components/FormatDialog/CropPreviewer/CropPreviewer.d.ts +0 -41
  187. package/build/components/FormatDialog/CustomRendition/CustomRendition.constants.d.ts +0 -5
  188. package/build/components/FormatDialog/CustomRendition/CustomRendition.d.ts +0 -56
  189. package/build/components/FormatDialog/CustomRendition/CustomRendition.styled.d.ts +0 -1
  190. package/build/components/FormatDialog/CustomRendition/index.d.ts +0 -1
  191. package/build/components/FormatDialog/CustomRendition/transformations/Crop.d.ts +0 -26
  192. package/build/components/FormatDialog/CustomRendition/transformations/Extension.d.ts +0 -11
  193. package/build/components/FormatDialog/CustomRendition/transformations/Format.d.ts +0 -10
  194. package/build/components/FormatDialog/CustomRendition/transformations/Metadata.d.ts +0 -7
  195. package/build/components/FormatDialog/CustomRendition/transformations/Quality.d.ts +0 -7
  196. package/build/components/FormatDialog/CustomRendition/transformations/Resize.d.ts +0 -18
  197. package/build/components/FormatDialog/CustomRendition/transformations/Rotate.d.ts +0 -8
  198. package/build/components/FormatDialog/FormatDialog.d.ts +0 -49
  199. package/build/components/FormatDialog/FormatDialog.styled.d.ts +0 -3
  200. package/build/components/FormatDialog/Previewer/Previewer.d.ts +0 -17
  201. package/build/components/FormatDialog/Previewer/Previewer.styled.d.ts +0 -1
  202. package/build/components/FormatDialog/Previewer/index.d.ts +0 -1
  203. package/build/components/FormatDialog/ProxyMenu/ProxyMenu.d.ts +0 -20
  204. package/build/components/FormatDialog/ProxyMenu/ProxyMenu.styled.d.ts +0 -2
  205. package/build/components/FormatDialog/ProxyMenu/index.d.ts +0 -1
  206. package/build/components/FormatDialog/TrackingParameters/TrackingParameters.d.ts +0 -13
  207. package/build/components/FormatDialog/TrackingParameters/index.d.ts +0 -1
  208. package/build/components/FormatDialog/VersionHistory/VersionHistory.d.ts +0 -6
  209. package/build/components/FormatDialog/VersionHistory/VersionHistory.styled.d.ts +0 -1
  210. package/build/components/FormatDialog/VersionHistory/index.d.ts +0 -1
  211. package/build/components/FormatDialog/index.d.ts +0 -1
  212. package/build/components/Header/Header.d.ts +0 -15
  213. package/build/components/Header/Header.styled.d.ts +0 -5
  214. package/build/components/Loader/Loader.d.ts +0 -7
  215. package/build/components/Loader/index.d.ts +0 -1
  216. package/build/components/NoResult/NoResult.d.ts +0 -7
  217. package/build/components/NoResult/index.d.ts +0 -1
  218. package/build/components/Result/AssetCard/AssetCard.d.ts +0 -15
  219. package/build/components/Result/AssetCard/AssetCard.styled.d.ts +0 -2
  220. package/build/components/Result/AssetCard/AssetCardWrapper.d.ts +0 -18
  221. package/build/components/Result/AssetCard/AssetCardWrapper.styled.d.ts +0 -1
  222. package/build/components/Result/AssetCard/index.d.ts +0 -1
  223. package/build/components/Result/AssetPreview/AssetPreview.d.ts +0 -11
  224. package/build/components/Result/AssetPreview/AssetPreview.styled.d.ts +0 -1
  225. package/build/components/Result/AssetPreview/ImagePreview/ImagePreview.d.ts +0 -11
  226. package/build/components/Result/AssetPreview/ImagePreview/index.d.ts +0 -1
  227. package/build/components/Result/AssetPreview/OtherPreview/OtherPreview.d.ts +0 -9
  228. package/build/components/Result/AssetPreview/OtherPreview/OtherPreview.styled.d.ts +0 -1
  229. package/build/components/Result/AssetPreview/OtherPreview/index.d.ts +0 -1
  230. package/build/components/Result/AssetPreview/VideoPreview/VideoPreview.d.ts +0 -11
  231. package/build/components/Result/AssetPreview/VideoPreview/index.d.ts +0 -1
  232. package/build/components/Result/AssetPreview/index.d.ts +0 -1
  233. package/build/consts/asset.d.ts +0 -14
  234. package/build/consts/auth.d.ts +0 -4
  235. package/build/consts/data.d.ts +0 -21
  236. package/build/index.d.ts +0 -225
  237. package/build/index.html +0 -1
  238. package/build/page/Authenticate/Authenticate.d.ts +0 -2
  239. package/build/page/Authenticate/ConnectingBackground.d.ts +0 -8
  240. package/build/page/Authenticate/index.d.ts +0 -2
  241. package/build/page/Home/Home.d.ts +0 -6
  242. package/build/page/Home/Home.styled.d.ts +0 -2
  243. package/build/setupTests.d.ts +0 -1
  244. package/build/store/assets/assets.api.d.ts +0 -66
  245. package/build/store/assets/assets.service.d.ts +0 -23
  246. package/build/store/assets/assets.slice.d.ts +0 -65
  247. package/build/store/auth/auth.service.d.ts +0 -10
  248. package/build/store/auth/auth.slice.d.ts +0 -76
  249. package/build/store/index.d.ts +0 -368
  250. package/build/store/search/search.api.d.ts +0 -39
  251. package/build/store/search/search.slice.d.ts +0 -12
  252. package/build/store/user/user.api.d.ts +0 -5
  253. package/build/types/assets.d.ts +0 -68
  254. package/build/types/auth.d.ts +0 -35
  255. package/build/types/common.d.ts +0 -11
  256. package/build/types/download.d.ts +0 -8
  257. package/build/types/navigation.d.ts +0 -3
  258. package/build/types/search.d.ts +0 -148
  259. package/build/types/user.d.ts +0 -7
  260. package/build/utils/api.d.ts +0 -27
  261. package/build/utils/array.d.ts +0 -13
  262. package/build/utils/constants.d.ts +0 -11
  263. package/build/utils/function.d.ts +0 -1
  264. package/build/utils/getRequestUrl.d.ts +0 -1
  265. package/build/utils/hooks.d.ts +0 -1
  266. package/build/utils/icon.d.ts +0 -3
  267. package/build/utils/image.d.ts +0 -24
  268. package/build/utils/number.d.ts +0 -4
  269. package/build/utils/rotate.d.ts +0 -4
  270. package/build/utils/storage.d.ts +0 -23
  271. package/build/utils/string.d.ts +0 -12
  272. package/build/view/AssetsPicker.d.ts +0 -6
  273. /package/{build → public}/favicon.ico +0 -0
  274. /package/{build → public}/logo192.png +0 -0
  275. /package/{build → public}/logo512.png +0 -0
  276. /package/{build → public}/manifest.json +0 -0
  277. /package/{build → public}/robots.txt +0 -0
  278. /package/{build/components/Browser/index.d.ts → src/components/Browser/index.ts} +0 -0
  279. /package/{build/components/ControlBar/index.d.ts → src/components/ControlBar/index.ts} +0 -0
  280. /package/{build/components/Header/index.d.ts → src/components/Header/index.ts} +0 -0
  281. /package/{build/page/Home/index.d.ts → src/page/Home/index.ts} +0 -0
@@ -0,0 +1,42 @@
1
+ import { FC } from 'react';
2
+
3
+ type Props = {
4
+ alt: string;
5
+ url: string;
6
+ loaded: boolean;
7
+ originalUrl?: string;
8
+ onError: () => void;
9
+ onLoaded: () => void;
10
+ };
11
+
12
+ const ImagePreview: FC<Props> = ({
13
+ alt,
14
+ url,
15
+ loaded,
16
+ originalUrl,
17
+ onError,
18
+ onLoaded,
19
+ }) => {
20
+ return (
21
+ <div className={originalUrl && loaded ? 'asset-preview__representative-container' : undefined}>
22
+ <img
23
+ className="asset-preview__representative"
24
+ src={url}
25
+ alt={alt}
26
+ onLoad={onLoaded}
27
+ onError={onError}
28
+ />
29
+ {originalUrl && (
30
+ <img
31
+ className="asset-preview__representative asset-preview__representative--animated"
32
+ src={originalUrl}
33
+ alt={alt}
34
+ onLoad={onLoaded}
35
+ onError={onError}
36
+ />
37
+ )}
38
+ </div>
39
+ );
40
+ };
41
+
42
+ export default ImagePreview;
@@ -0,0 +1 @@
1
+ export { default } from './ImagePreview';
@@ -0,0 +1,23 @@
1
+ import styled from 'styled-components';
2
+
3
+ export const Container = styled.div`
4
+ --text-font-size: var(--cx-font-size-medium);
5
+ --icon-font-size: var(--cx-font-size-x-large);
6
+ --gap: var(--cx-spacing-2x-small);
7
+
8
+ width: 100%;
9
+ height: 100%;
10
+ display: flex;
11
+ flex-direction: column;
12
+ align-items: center;
13
+ justify-content: center;
14
+ gap: var(--gap);
15
+ background-color: var(--default-representative-background-color);
16
+ color: var(--default-representative-color);
17
+ font-weight: var(--cx-font-weight-medium);
18
+ font-size: var(--text-font-size);
19
+
20
+ cx-icon {
21
+ font-size: var(--icon-font-size);
22
+ }
23
+ `;
@@ -0,0 +1,28 @@
1
+ import { CSSProperties, FC, ReactNode } from 'react';
2
+
3
+ import { MediaType } from '@/types/search';
4
+ import { getMediaIcon } from '@/utils/icon';
5
+
6
+ import { Container } from './OtherPreview.styled';
7
+
8
+ type Props = {
9
+ children?: ReactNode;
10
+ type?: MediaType;
11
+ style?: CSSProperties;
12
+ };
13
+
14
+ const OtherPreview: FC<Props> = ({
15
+ children,
16
+ style,
17
+ type,
18
+ }) => {
19
+
20
+ return (
21
+ <Container style={style}>
22
+ <cx-icon name={getMediaIcon(type)}></cx-icon>
23
+ {children}
24
+ </Container>
25
+ );
26
+ };
27
+
28
+ export default OtherPreview;
@@ -0,0 +1 @@
1
+ export { default } from './OtherPreview';
@@ -0,0 +1,132 @@
1
+ import { FC, useCallback, useEffect, useRef, useState } from 'react';
2
+
3
+ import { CxProgressBar } from '@/web-component';
4
+
5
+ type Props = {
6
+ url: string;
7
+ thumbnailOnly: boolean;
8
+ thumbnailUrl: string;
9
+ onError: () => void;
10
+ loaded: boolean;
11
+ onLoaded: () => void;
12
+ };
13
+
14
+ const ViewPreview: FC<Props> = ({
15
+ url,
16
+ thumbnailOnly = false,
17
+ thumbnailUrl,
18
+ onError,
19
+ loaded,
20
+ onLoaded,
21
+ }) => {
22
+ const [assetDirection, setAssetDirection] = useState<'vertical' | 'horizontal'>('horizontal');
23
+ const containerRef = useRef<HTMLDivElement>(null);
24
+ const imageRef = useRef<HTMLImageElement>(null);
25
+ const videoRef = useRef<HTMLVideoElement>(null);
26
+ const progressBarRef = useRef<CxProgressBar>(null);
27
+
28
+ useEffect(() => {
29
+ if (thumbnailOnly) {
30
+ return;
31
+ }
32
+
33
+ const container = containerRef.current?.parentElement;
34
+ const video = videoRef.current;
35
+ const progressBar = progressBarRef.current;
36
+
37
+ if (!container || !video || !progressBar) {
38
+ return;
39
+ }
40
+
41
+ const updateVideoProgress = (e: MouseEvent) => {
42
+ if (video.duration && e.currentTarget === container) {
43
+ progressBar.value = (e.offsetX / container.offsetWidth) * 100;
44
+ video.currentTime =
45
+ (e.offsetX / container.offsetWidth) * video.duration;
46
+ }
47
+ };
48
+
49
+ const onMouseEnter = (e: MouseEvent) => {
50
+ e.stopImmediatePropagation();
51
+ updateVideoProgress(e);
52
+ };
53
+
54
+ const onMouseLeave = (e: MouseEvent) => {
55
+ e.stopImmediatePropagation();
56
+ progressBar.value = 0;
57
+ video.currentTime = 0;
58
+ video.pause();
59
+ };
60
+
61
+ const onMouseMove = (e: MouseEvent) => {
62
+ e.stopImmediatePropagation();
63
+ updateVideoProgress(e);
64
+ };
65
+
66
+ container.addEventListener('mouseenter', onMouseEnter);
67
+ container.addEventListener('mouseleave', onMouseLeave);
68
+ container.addEventListener('mousemove', onMouseMove);
69
+
70
+ return () => {
71
+ container.removeEventListener('mouseenter', onMouseEnter);
72
+ container.removeEventListener('mouseleave', onMouseLeave);
73
+ container.removeEventListener('mousemove', onMouseMove);
74
+ };
75
+ }, [thumbnailOnly, thumbnailUrl]);
76
+
77
+ const onLoadAsset = useCallback(() => {
78
+ onLoaded();
79
+
80
+ if (videoRef.current) {
81
+ const { videoWidth, videoHeight } = videoRef.current;
82
+ setAssetDirection(videoWidth > videoHeight ? 'horizontal' : 'vertical');
83
+ }
84
+
85
+ if (imageRef.current) {
86
+ const { naturalWidth, naturalHeight } = imageRef.current;
87
+ setAssetDirection(naturalWidth > naturalHeight ? 'horizontal' : 'vertical');
88
+ }
89
+ }, [onLoaded]);
90
+
91
+ return (
92
+ <>
93
+ <div
94
+ className={`asset-preview__representative asset-preview__representative--${assetDirection}`}
95
+ >
96
+ {url && !thumbnailOnly ? (
97
+ <video
98
+ ref={videoRef}
99
+ src={url}
100
+ poster={thumbnailUrl}
101
+ onLoadedMetadata={onLoadAsset}
102
+ onError={() => {
103
+ onError();
104
+ }}
105
+ >
106
+ <track default kind="captions" srcLang="en" />
107
+ </video>
108
+ ) : (
109
+ <img
110
+ ref={imageRef}
111
+ src={thumbnailUrl}
112
+ alt="Asset preview"
113
+ onLoad={onLoadAsset}
114
+ onError={onError}
115
+ />
116
+ )}
117
+ <div className="asset-preview__video-icon" hidden={!loaded}>
118
+ <cx-icon name="play_arrow" variant="filled"></cx-icon>
119
+ </div>
120
+ </div>
121
+ {!thumbnailOnly && (
122
+ <cx-progress-bar
123
+ ref={progressBarRef}
124
+ className="asset-preview__progress-bar"
125
+ ></cx-progress-bar>
126
+ )}
127
+ <div ref={containerRef} className="asset-preview__representative-overlay"></div>
128
+ </>
129
+ );
130
+ };
131
+
132
+ export default ViewPreview;
@@ -0,0 +1 @@
1
+ export { default } from './VideoPreview';
@@ -0,0 +1 @@
1
+ export { default } from './AssetPreview';
@@ -0,0 +1,16 @@
1
+ import { GridView } from '@/types/search';
2
+
3
+ export const ASSET_SIZE = {
4
+ [GridView.Small]:{
5
+ minWidth: 130,
6
+ maxWidth: 178,
7
+ },
8
+ [GridView.Medium]:{
9
+ minWidth: 190,
10
+ maxWidth: 292,
11
+ },
12
+ [GridView.Large]:{
13
+ minWidth: 302,
14
+ maxWidth: 456,
15
+ },
16
+ };
@@ -0,0 +1,17 @@
1
+ export const DEFAULT_VIEW_SIZE = 'CoreField.LargeSizePreview';
2
+ export const FIELD_CORTEX_PATH = 'Document.CortexPath';
3
+ export const FIELD_DOC_TYPE = 'CoreField.DocType';
4
+ export const FIELD_EXTENSION = 'Document.FileExtension';
5
+ export const FIELD_FILE_SIZE = 'CoreField.FileSize';
6
+ export const FIELD_IDENTIFIER = 'CoreField.Identifier';
7
+ export const FIELD_KEYWORDS = 'CoreField.Keywords';
8
+ export const FIELD_MAX_HEIGHT = 'CoreField.MaxHeight';
9
+ export const FIELD_MAX_WIDTH = 'CoreField.MaxWidth';
10
+ export const FIELD_SCRUB_URL = 'ScrubURL';
11
+ export const FIELD_SUBTYPE = 'CoreField.DocSubType';
12
+ export const FIELD_TITLE_WITH_FALLBACK = 'CoreField.TitleWithFallback';
13
+ export const FIELD_HAS_BROWSER_CHILDREN = 'Document.HasBrowserChildren';
14
+ export const LIBRARY_NAME = 'Library';
15
+ export const MESSAGE_NEW_LINE = '\n';
16
+ export const ORIGINAL_VIEW_SIZE = 'CoreField.OriginalPreview';
17
+ export const FIELD_ALLOW_ATS_LINK = 'AllowATSLink';
package/src/index.tsx ADDED
@@ -0,0 +1,305 @@
1
+ import './styles.css';
2
+
3
+ import { createRoot } from 'react-dom/client';
4
+ import { Provider } from 'react-redux';
5
+
6
+ import { App } from '@/App';
7
+ import { AppContextType } from '@/AppContext';
8
+ import {
9
+ GlobalConfigContext,
10
+ ImageCardDisplayInfo,
11
+ } from '@/GlobalConfigContext';
12
+ import { store } from '@/store';
13
+ import { resetImportStatus } from '@/store/assets/assets.slice';
14
+ import {
15
+ initAuthInfoFromCache,
16
+ setUserConfigSiteUrl,
17
+ } from '@/store/auth/auth.slice';
18
+
19
+ import { assetsApi } from './store/assets/assets.api';
20
+ import { searchApi } from './store/search/search.api';
21
+ import { userApi } from './store/user/user.api';
22
+
23
+ declare global {
24
+ interface Window {
25
+ OrangeDAMContentBrowser: {
26
+ help: () => void,
27
+ open: (config: {
28
+ /**
29
+ * Callback when asset(s) selected (deprecated)
30
+ * @returns
31
+ */
32
+ onImageSelected: AppContextType['onImageSelected'];
33
+ /**
34
+ * Callback when asset(s) selected
35
+ * @returns
36
+ */
37
+ onAssetSelected: AppContextType['onAssetSelected'];
38
+ /**
39
+ * Callback when we have any error while using content browser
40
+ */
41
+ onError: AppContextType['onError'];
42
+ /**
43
+ * Callback when we close the content browser
44
+ */
45
+ onClose: () => void;
46
+ /**
47
+ * whether you want to select multiple assets
48
+ */
49
+ multiSelect: boolean;
50
+ /**
51
+ * The containerId to inject to component to
52
+ * If not defined, we will create a new popup inside
53
+ */
54
+ containerId?: string;
55
+ /**
56
+ * User can request for extra field via this config
57
+ */
58
+ extraFields?: string[];
59
+ /**
60
+ * Base url. If specified, we will prefill the site URL in the authentication page
61
+ */
62
+ baseUrl?: string;
63
+ /**
64
+ * Only show IIIF prefix. When enable, instead of return full IIIF image url, we will
65
+ * only return the url before the {region}. IIIF link will have the format like below
66
+ * {scheme}://{server}{/prefix}/{identifier}/{region}/{size}/{rotation}/{quality}.{format}
67
+ *
68
+ * E.g:
69
+ * onlyIIIFPrefix = false
70
+ * => https://local.orangelogic.com/IIIF3/Image/2Y1XC5O9J67/full/max/0.0/default.jpg
71
+ *
72
+ * onlyIIIFPrefix = true
73
+ * => https://local.orangelogic.com/IIIF3/Image/2Y1XC5O9J67
74
+ */
75
+ onlyIIIFPrefix?: boolean;
76
+ /**
77
+ * Whether to display info on the asset card
78
+ * default to true for all field
79
+ */
80
+ displayInfo?: ImageCardDisplayInfo;
81
+ /**
82
+ * The Public Application Name.
83
+ * By default, it will be OrangeDAM.
84
+ */
85
+ publicApplicationName?: string;
86
+ /**
87
+ * The plugin short name.
88
+ * By default, it will be OrangeDAM Content Browser.
89
+ */
90
+ pluginName?: string;
91
+
92
+ /**
93
+ * Whether to search in drive or not (used for File on demand)
94
+ * default to false
95
+ */
96
+ searchInDrive?: boolean;
97
+ /**
98
+ * The CTA text for the content browser
99
+ * default to "Insert"
100
+ */
101
+ ctaText?: string;
102
+ /**
103
+ * The persist mode for the content browser which will prevent the browser from closing after selecting asset
104
+ * default to false
105
+ */
106
+ persistMode?: boolean;
107
+ /**
108
+ * The available subtypes for the content browser
109
+ */
110
+ availableDocTypes?: string[];
111
+ /**
112
+ * The supported subtypes for inserting representative image
113
+ */
114
+ availableRepresentativeSubtypes?: string[];
115
+ /**
116
+ * The flag to show the collection
117
+ */
118
+ showCollections?: boolean;
119
+ /**
120
+ * The session id to use for the content browser
121
+ */
122
+ useSession?: string
123
+ /**
124
+ * The flag to keep the last folder selected between sessions
125
+ */
126
+ lastLocationMode?: boolean;
127
+ /**
128
+ * The flag to turn on/off tracking parameters for links
129
+ */
130
+ allowTracking?: boolean;
131
+ }) => void,
132
+ close: () => void,
133
+ /**
134
+ * Global function which mirrored the behavior of onAssetSelected
135
+ */
136
+ _onAssetSelected?: AppContextType['onAssetSelected'],
137
+ /**
138
+ * Global function which mirrored the behavior of onImageSelected (deprecated)
139
+ */
140
+ _onImageSelected?: AppContextType['onImageSelected'],
141
+ /**
142
+ * Global function which mirrored the behavior of onError
143
+ */
144
+ _onError?: AppContextType['onError'],
145
+ /**
146
+ * Global function which mirrored the behavior of onClose
147
+ */
148
+ _onClose?: () => void,
149
+ };
150
+ }
151
+
152
+ interface URLSearchParams {
153
+ Token?: string;
154
+ }
155
+ }
156
+
157
+ window.OrangeDAMContentBrowser = {
158
+ help: () => {
159
+ console.log(`/* Orange DAM Content Browser SDK Example */
160
+ window.OrangeDAMContentBrowser.open({
161
+ onAssetSelected: (assets) => {
162
+ // Callback function triggered when assets are selected
163
+ console.log(assets);
164
+ window.open(assets[0]?.imageUrl, '_blank');
165
+ },
166
+ onError: (errorMessage, error) => {
167
+ // Callback function triggered when an error occurs
168
+ console.error(errorMessage, error);
169
+ },
170
+ onClose: () => {
171
+ // Callback function triggered when the browser is closed
172
+ window.alert('Content Browser is closing');
173
+ },
174
+ containerId: "", // ID of the container to attach the browser; opens in a popup if blank
175
+ extraFields: ['coreField.OriginalFileName', 'document.CortexPath'], // Additional fields to retrieve from the assets
176
+ baseUrl: "", // Default base URL to pre-fill in the content browser
177
+ displayInfo: {
178
+ title: true, // Whether to display the asset title
179
+ dimension: true, // Whether to display the asset dimensions
180
+ fileSize: false, // Whether to display the file size
181
+ tags: false, // Whether to display the asset tags
182
+ },
183
+ publicApplicationName: "", // Public name of the DAM to display on the login screen
184
+ pluginName: "OrangeDAM Content Browser", // Name of the plugin to display on the login screen
185
+ ctaText: "Insert", // Text to display on the insert button
186
+ persistMode: true, // Whether the browser remains open after selecting an asset
187
+ availableDocTypes: ['Images*', 'Videos*', 'Audio*', 'Others*'], // An array of available OrangeDAM asset types to filter the assets. The available doc types will be configured in OL Platform. If not provided, all doc types will be available.
188
+ availableRepresentativeSubtypes: ['Other'], // Array of supported subtypes for representative images
189
+ showCollections: true, // Whether to show collections in the content browser
190
+ lastLocationMode: true, // Whether to open the last selected folder on load
191
+ allowTracking: true, // Whether to enable tracking parameters for asset URLs
192
+ });`);
193
+ },
194
+ open: ({
195
+ onAssetSelected,
196
+ onImageSelected,
197
+ onError,
198
+ onClose,
199
+ availableRepresentativeSubtypes,
200
+ availableDocTypes,
201
+ baseUrl,
202
+ containerId,
203
+ ctaText,
204
+ displayInfo = {
205
+ title: true,
206
+ dimension: true,
207
+ fileSize: false,
208
+ tags: false,
209
+ },
210
+ extraFields,
211
+ lastLocationMode,
212
+ multiSelect,
213
+ persistMode,
214
+ publicApplicationName,
215
+ pluginName,
216
+ showCollections,
217
+ searchInDrive,
218
+ useSession,
219
+ allowTracking,
220
+ }) => {
221
+ let container = containerId && document.getElementById(containerId);
222
+ if (!containerId) {
223
+ container = document.body;
224
+ } else if (!container) {
225
+ console.error(`Container with id ${containerId} is not found`);
226
+ return;
227
+ }
228
+ let pickerRoot:HTMLDivElement | null = container.querySelector('#cortex-asset-picker-root');
229
+ if (!pickerRoot) {
230
+ //?? if not found, create a new one
231
+ pickerRoot = document.createElement('div') ;
232
+ pickerRoot.id = 'cortex-asset-picker-root';
233
+ pickerRoot.style.width = '100%';
234
+ pickerRoot.style.height = '100%';
235
+ pickerRoot.style.display = 'flex';
236
+ pickerRoot.style.alignItems = 'center';
237
+ pickerRoot.style.justifyContent = 'center';
238
+ pickerRoot.style.position = 'relative';
239
+ container.appendChild(pickerRoot);
240
+ }
241
+ const root = createRoot(pickerRoot);
242
+
243
+ // Dispatch some event before start render the APP
244
+ if (baseUrl) {
245
+ store.dispatch(setUserConfigSiteUrl(baseUrl));
246
+ }
247
+ store.dispatch(initAuthInfoFromCache());
248
+
249
+ const errorHandler = (typeof onError === 'function' && !!onError) ? onError : console.log;
250
+ const assetSelectedHandler = (typeof onAssetSelected === 'function' && !!onAssetSelected) ? onAssetSelected : console.log;
251
+ const imageSelectedHandler = (typeof onImageSelected === 'function' && !!onImageSelected) ? onImageSelected : console.log;
252
+ const handleClose = () => {
253
+ store.dispatch(resetImportStatus());
254
+ store.dispatch(searchApi.util.resetApiState());
255
+ store.dispatch(assetsApi.util.resetApiState());
256
+ store.dispatch(userApi.util.resetApiState());
257
+ root.unmount();
258
+ // Reset these function when close the Content Browser
259
+ window.OrangeDAMContentBrowser._onAssetSelected = undefined;
260
+ window.OrangeDAMContentBrowser._onImageSelected = undefined;
261
+ window.OrangeDAMContentBrowser._onError = undefined;
262
+ window.OrangeDAMContentBrowser._onClose = undefined;
263
+
264
+ onClose?.();
265
+ };
266
+ window.OrangeDAMContentBrowser._onAssetSelected = assetSelectedHandler;
267
+ window.OrangeDAMContentBrowser._onImageSelected = imageSelectedHandler;
268
+ window.OrangeDAMContentBrowser._onError = errorHandler;
269
+ window.OrangeDAMContentBrowser._onClose = handleClose;
270
+
271
+ root.render(
272
+ <Provider store={store}>
273
+ <GlobalConfigContext.Provider value={{
274
+ availableDocTypes,
275
+ availableRepresentativeSubtypes,
276
+ ctaText: ctaText ?? 'Insert',
277
+ displayInfo,
278
+ lastLocationMode: lastLocationMode !== undefined ? !!lastLocationMode : true,
279
+ persistMode: !!persistMode,
280
+ pluginInfo: {
281
+ publicApplicationName: publicApplicationName !== undefined ? publicApplicationName : '',
282
+ pluginName: pluginName !== undefined ? pluginName : 'OrangeDAM Content Browser',
283
+ },
284
+ isContentBrowserPopedup: !containerId,
285
+ searchInDrive: !!searchInDrive,
286
+ showCollections: !!showCollections,
287
+ useSession,
288
+ allowTracking: allowTracking !== undefined ? !!allowTracking : true,
289
+ }}>
290
+ <App
291
+ containerId={containerId}
292
+ extraFields={extraFields}
293
+ multiSelect={multiSelect}
294
+ onError={errorHandler}
295
+ onAssetSelected={assetSelectedHandler}
296
+ onImageSelected={imageSelectedHandler}
297
+ onClose={handleClose} />
298
+ </GlobalConfigContext.Provider>
299
+ </Provider>,
300
+ );
301
+ },
302
+ close: () => {
303
+ window.OrangeDAMContentBrowser._onClose?.();
304
+ },
305
+ };