@orangelogic/orange-dam-content-browser-sdk 2.1.55 → 2.2.0-beta
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/.env +1 -0
- package/.eslintignore +2 -0
- package/.eslintrc.json +82 -0
- package/.releaserc +17 -0
- package/.travis.yml +20 -0
- package/CBSDKdemo.html +315 -0
- package/GitVersion.yml +18 -0
- package/azure-pipeline.yaml +94 -0
- package/clientlib.config.js +36 -0
- package/config/env.js +105 -0
- package/config/getHttpsConfig.js +67 -0
- package/config/jest/babelTransform.js +30 -0
- package/config/jest/cssTransform.js +14 -0
- package/config/jest/fileTransform.js +41 -0
- package/config/modules.js +135 -0
- package/config/paths.js +79 -0
- package/config/webpack/persistentCache/createEnvironmentHash.js +10 -0
- package/config/webpack.config.js +762 -0
- package/config/webpackDevServer.config.js +128 -0
- package/config-overrides.js +8 -0
- package/gab_extension/GAB.html +85 -0
- package/gab_extension/GoogleChrome/manifest.json +28 -0
- package/gab_extension/GoogleChrome/src/assets/icon48.png +0 -0
- package/gab_extension/GoogleChrome/src/background/index.js +6 -0
- package/gab_extension/GoogleChrome/src/scripts/index.js +347 -0
- package/gab_extension/MozillaFirefox/manifest.json +20 -0
- package/gab_extension/MozillaFirefox/src/assets/icon.png +0 -0
- package/gab_extension/MozillaFirefox/src/background/index.js +5 -0
- package/gab_extension/MozillaFirefox/src/scripts/index.js +347 -0
- package/gab_extension/README.md +11 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.pbxproj +927 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.xcworkspace/xcuserdata/oldevmac01.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/xcuserdata/oldevmac01.xcuserdatad/xcschemes/xcschememanagement.plist +19 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/AppIcon.appiconset/Contents.json +63 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/Contents.json +6 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/LargeIcon.imageset/Contents.json +20 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Base.lproj/Main.html +23 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Resources/Icon.png +0 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Resources/Script.js +24 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Resources/Style.css +61 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/ViewController.swift +81 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (Extension)/SafariWebExtensionHandler.swift +26 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/AppDelegate.swift +24 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/Base.lproj/LaunchScreen.storyboard +36 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/Base.lproj/Main.storyboard +38 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/Info.plist +27 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/SceneDelegate.swift +18 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (Extension)/Info.plist +13 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/AppDelegate.swift +21 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/Base.lproj/Main.storyboard +125 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/Info.plist +8 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/Orange DAM Asset Browser Extension.entitlements +12 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (Extension)/Info.plist +13 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (Extension)/Orange DAM Asset Browser Extension.entitlements +10 -0
- package/package.json +8 -49
- package/public/index.html +92 -0
- package/scripts/build.js +218 -0
- package/scripts/start.js +154 -0
- package/scripts/test.js +53 -0
- package/src/App.tsx +98 -0
- package/src/AppContext.ts +18 -0
- package/src/GlobalConfigContext.ts +46 -0
- package/src/components/ArrayClamp/ArrayClamp.styled.ts +42 -0
- package/src/components/ArrayClamp/ArrayClamp.tsx +167 -0
- package/src/components/ArrayClamp/index.ts +1 -0
- package/src/components/Browser/Browser.styled.ts +82 -0
- package/src/components/Browser/Browser.tsx +284 -0
- package/src/components/Browser/BrowserItem.tsx +98 -0
- package/src/components/ControlBar/ControlBar.constants.tsx +66 -0
- package/src/components/ControlBar/ControlBar.styled.ts +82 -0
- package/src/components/ControlBar/ControlBar.tsx +528 -0
- package/src/components/ControlBar/Facet/Facet.tsx +113 -0
- package/src/components/ControlBar/Facet/index.ts +1 -0
- package/src/components/FormatDialog/CropPreviewer/CropPreviewer.tsx +224 -0
- package/{build/components/FormatDialog/CropPreviewer/index.d.ts → src/components/FormatDialog/CropPreviewer/index.ts} +1 -1
- package/src/components/FormatDialog/CustomRendition/CustomRendition.constants.ts +24 -0
- package/src/components/FormatDialog/CustomRendition/CustomRendition.styled.ts +57 -0
- package/src/components/FormatDialog/CustomRendition/CustomRendition.tsx +178 -0
- package/src/components/FormatDialog/CustomRendition/index.ts +1 -0
- package/src/components/FormatDialog/CustomRendition/transformations/Crop.tsx +249 -0
- package/src/components/FormatDialog/CustomRendition/transformations/Extension.tsx +54 -0
- package/src/components/FormatDialog/CustomRendition/transformations/Format.tsx +86 -0
- package/src/components/FormatDialog/CustomRendition/transformations/Resize.tsx +176 -0
- package/src/components/FormatDialog/CustomRendition/transformations/Rotate.tsx +101 -0
- package/{build/components/FormatDialog/CustomRendition/transformations/index.d.ts → src/components/FormatDialog/CustomRendition/transformations/index.ts} +1 -3
- package/src/components/FormatDialog/FormatDialog.styled.ts +137 -0
- package/src/components/FormatDialog/FormatDialog.tsx +1533 -0
- package/src/components/FormatDialog/Previewer/Previewer.styled.ts +31 -0
- package/src/components/FormatDialog/Previewer/Previewer.tsx +143 -0
- package/src/components/FormatDialog/Previewer/index.ts +1 -0
- package/src/components/FormatDialog/ProxyMenu/ProxyMenu.styled.ts +88 -0
- package/src/components/FormatDialog/ProxyMenu/ProxyMenu.tsx +74 -0
- package/src/components/FormatDialog/ProxyMenu/index.ts +1 -0
- package/src/components/FormatDialog/TrackingParameters/TrackingParameters.tsx +59 -0
- package/src/components/FormatDialog/TrackingParameters/index.ts +1 -0
- package/src/components/FormatDialog/index.ts +1 -0
- package/src/components/Header/Header.styled.ts +51 -0
- package/src/components/Header/Header.tsx +118 -0
- package/src/components/Loader/Loader.tsx +37 -0
- package/src/components/Loader/index.ts +1 -0
- package/src/components/NoResult/NoResult.tsx +37 -0
- package/src/components/NoResult/index.tsx +1 -0
- package/src/components/Result/AssetCard/AssetCard.styled.ts +120 -0
- package/src/components/Result/AssetCard/AssetCard.tsx +192 -0
- package/src/components/Result/AssetCard/AssetCardWrapper.styled.ts +35 -0
- package/src/components/Result/AssetCard/AssetCardWrapper.tsx +165 -0
- package/src/components/Result/AssetCard/index.ts +1 -0
- package/src/components/Result/AssetPreview/AssetPreview.styled.ts +108 -0
- package/src/components/Result/AssetPreview/AssetPreview.tsx +78 -0
- package/src/components/Result/AssetPreview/ImagePreview/ImagePreview.tsx +42 -0
- package/src/components/Result/AssetPreview/ImagePreview/index.ts +1 -0
- package/src/components/Result/AssetPreview/OtherPreview/OtherPreview.styled.ts +23 -0
- package/src/components/Result/AssetPreview/OtherPreview/OtherPreview.tsx +28 -0
- package/src/components/Result/AssetPreview/OtherPreview/index.ts +1 -0
- package/src/components/Result/AssetPreview/VideoPreview/VideoPreview.tsx +132 -0
- package/src/components/Result/AssetPreview/VideoPreview/index.ts +1 -0
- package/src/components/Result/AssetPreview/index.ts +1 -0
- package/src/consts/asset.ts +16 -0
- package/src/consts/data.ts +17 -0
- package/src/index.tsx +305 -0
- package/src/page/Authenticate/Authenticate.tsx +232 -0
- package/src/page/Authenticate/ConnectingBackground.tsx +44 -0
- package/src/page/Authenticate/index.tsx +94 -0
- package/src/page/Home/Home.styled.ts +46 -0
- package/src/page/Home/Home.tsx +941 -0
- package/src/react-web-component.d.ts +4617 -0
- package/src/store/assets/assets.api.ts +167 -0
- package/src/store/assets/assets.service.ts +223 -0
- package/src/store/assets/assets.slice.ts +104 -0
- package/src/store/auth/auth.service.ts +71 -0
- package/src/store/auth/auth.slice.ts +295 -0
- package/src/store/index.ts +27 -0
- package/src/store/search/search.api.ts +319 -0
- package/src/store/search/search.slice.ts +28 -0
- package/src/store/user/user.api.ts +29 -0
- package/src/styles.css +42 -0
- package/src/types/assets.ts +71 -0
- package/src/types/auth.ts +42 -0
- package/src/types/common.ts +11 -0
- package/src/types/download.ts +8 -0
- package/src/types/navigation.ts +3 -0
- package/src/types/search.ts +116 -0
- package/{build/types/storage.d.ts → src/types/storage.ts} +1 -1
- package/src/types/user.ts +6 -0
- package/src/utils/api.ts +186 -0
- package/src/utils/array.ts +25 -0
- package/src/utils/constants.ts +12 -0
- package/src/utils/fetch.ts +116 -0
- package/src/utils/getRequestUrl.ts +15 -0
- package/src/utils/hooks.ts +36 -0
- package/src/utils/icon.ts +22 -0
- package/src/utils/image.ts +157 -0
- package/src/utils/number.ts +11 -0
- package/src/utils/rotate.ts +23 -0
- package/src/utils/storage.ts +184 -0
- package/src/utils/string.ts +24 -0
- package/src/view/AssetsPicker.tsx +24 -0
- package/src/web-component.d.ts +8151 -0
- package/tsconfig.eslint.json +10 -0
- package/tsconfig.json +37 -0
- package/build/ApiService.d.ts +0 -15
- package/build/App.d.ts +0 -62
- package/build/AppContext.d.ts +0 -18
- package/build/GlobalConfigContext.d.ts +0 -32
- package/build/OrangeDAMContentBrowserSDK.min.css +0 -2
- package/build/OrangeDAMContentBrowserSDK.min.css.map +0 -1
- package/build/OrangeDAMContentBrowserSDK.min.js +0 -11468
- package/build/OrangeDAMContentBrowserSDK.min.js.map +0 -1
- package/build/asset-manifest.json +0 -13
- package/build/components/ArrayClamp/ArrayClamp.d.ts +0 -10
- package/build/components/ArrayClamp/ArrayClamp.styled.d.ts +0 -1
- package/build/components/ArrayClamp/index.d.ts +0 -1
- package/build/components/Browser/Browser.constants.d.ts +0 -3
- package/build/components/Browser/Browser.d.ts +0 -21
- package/build/components/Browser/Browser.styled.d.ts +0 -2
- package/build/components/Browser/BrowserItem.d.ts +0 -13
- package/build/components/Browser/LoadMoreButton.d.ts +0 -9
- package/build/components/ControlBar/ControlBar.constants.d.ts +0 -10
- package/build/components/ControlBar/ControlBar.d.ts +0 -23
- package/build/components/ControlBar/ControlBar.styled.d.ts +0 -1
- package/build/components/ControlBar/Facet/Facet.d.ts +0 -14
- package/build/components/ControlBar/Facet/index.d.ts +0 -1
- package/build/components/FormatDialog/CropPreviewer/CropPreviewer.d.ts +0 -41
- package/build/components/FormatDialog/CustomRendition/CustomRendition.constants.d.ts +0 -5
- package/build/components/FormatDialog/CustomRendition/CustomRendition.d.ts +0 -56
- package/build/components/FormatDialog/CustomRendition/CustomRendition.styled.d.ts +0 -1
- package/build/components/FormatDialog/CustomRendition/index.d.ts +0 -1
- package/build/components/FormatDialog/CustomRendition/transformations/Crop.d.ts +0 -26
- package/build/components/FormatDialog/CustomRendition/transformations/Extension.d.ts +0 -11
- package/build/components/FormatDialog/CustomRendition/transformations/Format.d.ts +0 -10
- package/build/components/FormatDialog/CustomRendition/transformations/Metadata.d.ts +0 -7
- package/build/components/FormatDialog/CustomRendition/transformations/Quality.d.ts +0 -7
- package/build/components/FormatDialog/CustomRendition/transformations/Resize.d.ts +0 -18
- package/build/components/FormatDialog/CustomRendition/transformations/Rotate.d.ts +0 -8
- package/build/components/FormatDialog/FormatDialog.d.ts +0 -49
- package/build/components/FormatDialog/FormatDialog.styled.d.ts +0 -3
- package/build/components/FormatDialog/Previewer/Previewer.d.ts +0 -17
- package/build/components/FormatDialog/Previewer/Previewer.styled.d.ts +0 -1
- package/build/components/FormatDialog/Previewer/index.d.ts +0 -1
- package/build/components/FormatDialog/ProxyMenu/ProxyMenu.d.ts +0 -20
- package/build/components/FormatDialog/ProxyMenu/ProxyMenu.styled.d.ts +0 -2
- package/build/components/FormatDialog/ProxyMenu/index.d.ts +0 -1
- package/build/components/FormatDialog/TrackingParameters/TrackingParameters.d.ts +0 -13
- package/build/components/FormatDialog/TrackingParameters/index.d.ts +0 -1
- package/build/components/FormatDialog/VersionHistory/VersionHistory.d.ts +0 -6
- package/build/components/FormatDialog/VersionHistory/VersionHistory.styled.d.ts +0 -1
- package/build/components/FormatDialog/VersionHistory/index.d.ts +0 -1
- package/build/components/FormatDialog/index.d.ts +0 -1
- package/build/components/Header/Header.d.ts +0 -15
- package/build/components/Header/Header.styled.d.ts +0 -5
- package/build/components/Loader/Loader.d.ts +0 -7
- package/build/components/Loader/index.d.ts +0 -1
- package/build/components/NoResult/NoResult.d.ts +0 -7
- package/build/components/NoResult/index.d.ts +0 -1
- package/build/components/Result/AssetCard/AssetCard.d.ts +0 -15
- package/build/components/Result/AssetCard/AssetCard.styled.d.ts +0 -2
- package/build/components/Result/AssetCard/AssetCardWrapper.d.ts +0 -18
- package/build/components/Result/AssetCard/AssetCardWrapper.styled.d.ts +0 -1
- package/build/components/Result/AssetCard/index.d.ts +0 -1
- package/build/components/Result/AssetPreview/AssetPreview.d.ts +0 -11
- package/build/components/Result/AssetPreview/AssetPreview.styled.d.ts +0 -1
- package/build/components/Result/AssetPreview/ImagePreview/ImagePreview.d.ts +0 -11
- package/build/components/Result/AssetPreview/ImagePreview/index.d.ts +0 -1
- package/build/components/Result/AssetPreview/OtherPreview/OtherPreview.d.ts +0 -9
- package/build/components/Result/AssetPreview/OtherPreview/OtherPreview.styled.d.ts +0 -1
- package/build/components/Result/AssetPreview/OtherPreview/index.d.ts +0 -1
- package/build/components/Result/AssetPreview/VideoPreview/VideoPreview.d.ts +0 -11
- package/build/components/Result/AssetPreview/VideoPreview/index.d.ts +0 -1
- package/build/components/Result/AssetPreview/index.d.ts +0 -1
- package/build/consts/asset.d.ts +0 -14
- package/build/consts/auth.d.ts +0 -4
- package/build/consts/data.d.ts +0 -21
- package/build/index.d.ts +0 -225
- package/build/index.html +0 -1
- package/build/page/Authenticate/Authenticate.d.ts +0 -2
- package/build/page/Authenticate/ConnectingBackground.d.ts +0 -8
- package/build/page/Authenticate/index.d.ts +0 -2
- package/build/page/Home/Home.d.ts +0 -6
- package/build/page/Home/Home.styled.d.ts +0 -2
- package/build/setupTests.d.ts +0 -1
- package/build/store/assets/assets.api.d.ts +0 -66
- package/build/store/assets/assets.service.d.ts +0 -23
- package/build/store/assets/assets.slice.d.ts +0 -65
- package/build/store/auth/auth.service.d.ts +0 -10
- package/build/store/auth/auth.slice.d.ts +0 -76
- package/build/store/index.d.ts +0 -368
- package/build/store/search/search.api.d.ts +0 -39
- package/build/store/search/search.slice.d.ts +0 -12
- package/build/store/user/user.api.d.ts +0 -5
- package/build/types/assets.d.ts +0 -68
- package/build/types/auth.d.ts +0 -35
- package/build/types/common.d.ts +0 -11
- package/build/types/download.d.ts +0 -8
- package/build/types/navigation.d.ts +0 -3
- package/build/types/search.d.ts +0 -148
- package/build/types/user.d.ts +0 -7
- package/build/utils/api.d.ts +0 -27
- package/build/utils/array.d.ts +0 -13
- package/build/utils/constants.d.ts +0 -11
- package/build/utils/function.d.ts +0 -1
- package/build/utils/getRequestUrl.d.ts +0 -1
- package/build/utils/hooks.d.ts +0 -1
- package/build/utils/icon.d.ts +0 -3
- package/build/utils/image.d.ts +0 -24
- package/build/utils/number.d.ts +0 -4
- package/build/utils/rotate.d.ts +0 -4
- package/build/utils/storage.d.ts +0 -23
- package/build/utils/string.d.ts +0 -12
- package/build/view/AssetsPicker.d.ts +0 -6
- /package/{build → public}/favicon.ico +0 -0
- /package/{build → public}/logo192.png +0 -0
- /package/{build → public}/logo512.png +0 -0
- /package/{build → public}/manifest.json +0 -0
- /package/{build → public}/robots.txt +0 -0
- /package/{build/components/Browser/index.d.ts → src/components/Browser/index.ts} +0 -0
- /package/{build/components/ControlBar/index.d.ts → src/components/ControlBar/index.ts} +0 -0
- /package/{build/components/Header/index.d.ts → src/components/Header/index.ts} +0 -0
- /package/{build/page/Home/index.d.ts → src/page/Home/index.ts} +0 -0
package/.env
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
BUILD_PATH=./build
|
package/.eslintignore
ADDED
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"browser": true,
|
|
4
|
+
"es2021": true,
|
|
5
|
+
"jest/globals": true
|
|
6
|
+
},
|
|
7
|
+
"extends": [
|
|
8
|
+
"airbnb-typescript/base",
|
|
9
|
+
"plugin:@typescript-eslint/recommended",
|
|
10
|
+
"plugin:import/typescript",
|
|
11
|
+
"plugin:react/recommended",
|
|
12
|
+
"plugin:react/jsx-runtime",
|
|
13
|
+
"plugin:react-hooks/recommended"
|
|
14
|
+
],
|
|
15
|
+
"parser": "@typescript-eslint/parser",
|
|
16
|
+
"parserOptions": {
|
|
17
|
+
"ecmaVersion": "latest",
|
|
18
|
+
"sourceType": "module",
|
|
19
|
+
"project": "./tsconfig.eslint.json"
|
|
20
|
+
},
|
|
21
|
+
"plugins": [
|
|
22
|
+
"@typescript-eslint",
|
|
23
|
+
"import",
|
|
24
|
+
"jest"
|
|
25
|
+
],
|
|
26
|
+
"rules": {
|
|
27
|
+
"@typescript-eslint/ban-ts-comment": "off",
|
|
28
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
29
|
+
"@typescript-eslint/return-await": "off",
|
|
30
|
+
"no-unused-vars": "off",
|
|
31
|
+
"react/display-name": "off",
|
|
32
|
+
"@typescript-eslint/no-unused-vars": [
|
|
33
|
+
"warn",
|
|
34
|
+
{
|
|
35
|
+
"argsIgnorePattern": "^_",
|
|
36
|
+
"varsIgnorePattern": "^_",
|
|
37
|
+
"caughtErrorsIgnorePattern": "^_"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"linebreak-style": 0,
|
|
41
|
+
"max-len": [
|
|
42
|
+
"error",
|
|
43
|
+
{
|
|
44
|
+
"code": 200,
|
|
45
|
+
"ignoreTemplateLiterals": true,
|
|
46
|
+
"ignoreStrings": true
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"import/extensions": [
|
|
50
|
+
"error",
|
|
51
|
+
"ignorePackages",
|
|
52
|
+
{
|
|
53
|
+
"": "never",
|
|
54
|
+
"js": "never",
|
|
55
|
+
"jsx": "never",
|
|
56
|
+
"ts": "never",
|
|
57
|
+
"tsx": "never"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"import/no-extraneous-dependencies": [
|
|
61
|
+
"error", {
|
|
62
|
+
"devDependencies": false,
|
|
63
|
+
"optionalDependencies": false,
|
|
64
|
+
"peerDependencies": false,
|
|
65
|
+
"packageDir": "./"
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"react-hooks/exhaustive-deps": "warn"
|
|
69
|
+
},
|
|
70
|
+
"settings": {
|
|
71
|
+
"import/resolver": {
|
|
72
|
+
"node": {
|
|
73
|
+
"extensions": [
|
|
74
|
+
".js",
|
|
75
|
+
".jsx",
|
|
76
|
+
".ts",
|
|
77
|
+
".tsx"
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
package/.releaserc
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"plugins": [
|
|
3
|
+
"@semantic-release/commit-analyzer",
|
|
4
|
+
"@semantic-release/release-notes-generator",
|
|
5
|
+
["@semantic-release/npm", {
|
|
6
|
+
"npmPublish": false
|
|
7
|
+
}],
|
|
8
|
+
["@semantic-release/exec", {
|
|
9
|
+
"prepareCmd": "npm run build"
|
|
10
|
+
}],
|
|
11
|
+
["@semantic-release/git", {
|
|
12
|
+
"assets": ["dist/**/*", "docs", "package.json"],
|
|
13
|
+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
|
14
|
+
}],
|
|
15
|
+
"@semantic-release/github"
|
|
16
|
+
]
|
|
17
|
+
}
|
package/.travis.yml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
language: node_js
|
|
2
|
+
node_js:
|
|
3
|
+
- lts/*
|
|
4
|
+
- "stable"
|
|
5
|
+
script:
|
|
6
|
+
- npm test
|
|
7
|
+
- npm run build
|
|
8
|
+
jobs:
|
|
9
|
+
include:
|
|
10
|
+
# Define the release stage that runs semantic-release
|
|
11
|
+
- stage: release
|
|
12
|
+
node_js: lts/*
|
|
13
|
+
# Advanced: optionally overwrite your default `script` step to skip the tests
|
|
14
|
+
# It may not needed if `npm run build` and `npm test` run in preversion step
|
|
15
|
+
# script: skip
|
|
16
|
+
deploy:
|
|
17
|
+
provider: script
|
|
18
|
+
skip_cleanup: true
|
|
19
|
+
script:
|
|
20
|
+
- npm run release
|
package/CBSDKdemo.html
ADDED
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
|
|
8
|
+
|
|
9
|
+
<script src="https://downloads.orangelogic.com/ContentBrowserSDK/v2.2.0-beta/OrangeDAMContentBrowserSDK.min.js"></script>
|
|
10
|
+
<link rel="stylesheet" type="text/css"
|
|
11
|
+
href="https://downloads.orangelogic.com/ContentBrowserSDK/v2.2.0-beta/OrangeDAMContentBrowserSDK.min.css">
|
|
12
|
+
|
|
13
|
+
<style>
|
|
14
|
+
* {
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
}
|
|
17
|
+
body {
|
|
18
|
+
color: var(--cx-color-neutral);
|
|
19
|
+
font-family: 'Roboto', sans-serif;
|
|
20
|
+
padding: 1rem;
|
|
21
|
+
}
|
|
22
|
+
p {
|
|
23
|
+
margin: 0;
|
|
24
|
+
}
|
|
25
|
+
#app {
|
|
26
|
+
display: flex;
|
|
27
|
+
gap: 0.5em;
|
|
28
|
+
height: 800px;
|
|
29
|
+
}
|
|
30
|
+
#asset-browser-container {
|
|
31
|
+
flex: 1;
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
}
|
|
35
|
+
#asset-browser-header {
|
|
36
|
+
display: flex;
|
|
37
|
+
justify-content: space-between;
|
|
38
|
+
align-items: center;
|
|
39
|
+
}
|
|
40
|
+
#react-app-root {
|
|
41
|
+
flex: 1;
|
|
42
|
+
border: 2px solid var(--cx-color-neutral);
|
|
43
|
+
border-radius: var(--cx-border-radius-small);
|
|
44
|
+
}
|
|
45
|
+
#more {
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
gap: 0.5rem;
|
|
49
|
+
min-width: 400px;
|
|
50
|
+
height: 100%;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.wrapper {
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
flex-basis: 50%;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.wrapper button {
|
|
60
|
+
border: none;
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
margin-top: var(--cx-spacing-small);
|
|
63
|
+
padding: var(--cx-spacing-x-small) var(--cx-spacing-medium);
|
|
64
|
+
letter-spacing: 0.05em;
|
|
65
|
+
width: 100%;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
#config,
|
|
69
|
+
#output {
|
|
70
|
+
border: 2px solid var(--cx-color-neutral);
|
|
71
|
+
border-radius: var(--cx-border-radius-small);
|
|
72
|
+
padding: var(--cx-spacing-small);
|
|
73
|
+
position: relative;
|
|
74
|
+
flex: 1;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
#content {
|
|
78
|
+
position: absolute;
|
|
79
|
+
top: 0;
|
|
80
|
+
left: 0;
|
|
81
|
+
width: 100%;
|
|
82
|
+
height: 100%;
|
|
83
|
+
overflow-y: auto;
|
|
84
|
+
white-space: pre;
|
|
85
|
+
}
|
|
86
|
+
</style>
|
|
87
|
+
</head>
|
|
88
|
+
|
|
89
|
+
<body>
|
|
90
|
+
<div id="app">
|
|
91
|
+
<div id="asset-browser-container">
|
|
92
|
+
<div id="asset-browser-header">
|
|
93
|
+
<span>OrangeDAM Content Browser SDK</span>
|
|
94
|
+
<div>
|
|
95
|
+
<input type="checkbox" id="mobile">
|
|
96
|
+
<label for="mobile">Mobile</label>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
<div id="react-app-root"></div>
|
|
100
|
+
</div>
|
|
101
|
+
<div id="more">
|
|
102
|
+
<div class="wrapper">
|
|
103
|
+
<span>Config</span>
|
|
104
|
+
<div id="config">
|
|
105
|
+
<div id="content" contenteditable></div>
|
|
106
|
+
</div>
|
|
107
|
+
<button onclick="loadConfig()">Load config</button>
|
|
108
|
+
</div>
|
|
109
|
+
<div class="wrapper">
|
|
110
|
+
<span>Output</span>
|
|
111
|
+
<textarea id="output"></textarea>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
<div>
|
|
116
|
+
<h3>Properties</h3>
|
|
117
|
+
<div style="display: flex;">
|
|
118
|
+
<ul>
|
|
119
|
+
<li>
|
|
120
|
+
<b>onAssetSelected</b>
|
|
121
|
+
<p>
|
|
122
|
+
A function that will be called when an asset is selected. The function will receive an array of selected assets.
|
|
123
|
+
</p>
|
|
124
|
+
</li>
|
|
125
|
+
<li>
|
|
126
|
+
<b>onError</b>
|
|
127
|
+
<p>
|
|
128
|
+
A function that will be called when an error occurs. The function will receive an error message and the error object.
|
|
129
|
+
</p>
|
|
130
|
+
</li>
|
|
131
|
+
<li>
|
|
132
|
+
<b>onClose</b>
|
|
133
|
+
<p>
|
|
134
|
+
A function that will be called when the content browser is closed.
|
|
135
|
+
</p>
|
|
136
|
+
</li>
|
|
137
|
+
<li>
|
|
138
|
+
<b>publicApplicationName</b> (default blank)
|
|
139
|
+
<p>
|
|
140
|
+
The public name of the DAM to display in the login screen.
|
|
141
|
+
</p>
|
|
142
|
+
</li>
|
|
143
|
+
<li>
|
|
144
|
+
<b>pluginName</b> (default "OrangeDAM Content Browser")
|
|
145
|
+
<p>
|
|
146
|
+
The name of the plugin to display in the login screen.
|
|
147
|
+
</p>
|
|
148
|
+
</li>
|
|
149
|
+
<li>
|
|
150
|
+
<b>containerId</b>
|
|
151
|
+
<p>
|
|
152
|
+
The id of the container element to attach the content browser. If not provided, the content browser will open in a popup.
|
|
153
|
+
</p>
|
|
154
|
+
</li>
|
|
155
|
+
<li>
|
|
156
|
+
<b>baseUrl</b>
|
|
157
|
+
<p>
|
|
158
|
+
The default base URL to pre-fill in the content browser.
|
|
159
|
+
</p>
|
|
160
|
+
</li>
|
|
161
|
+
<li>
|
|
162
|
+
<b>ctaText</b> (default "Insert")
|
|
163
|
+
<p>
|
|
164
|
+
The text to display on the insert button.
|
|
165
|
+
</p>
|
|
166
|
+
</li>
|
|
167
|
+
<li>
|
|
168
|
+
<b>availableDocTypes</b>
|
|
169
|
+
<p>
|
|
170
|
+
An array of available OrangeDAM asset types to filter the assets.
|
|
171
|
+
The available doc types will be configured in OL Platform. If not provided, all doc types will be available.
|
|
172
|
+
To get the available asset of a doc type, you can add a wildcard (*) at the end of the doc type name.
|
|
173
|
+
<br/>
|
|
174
|
+
<span>E.g. Images*, Videos*, Audio*, Others*,...</span>
|
|
175
|
+
</p>
|
|
176
|
+
<p>
|
|
177
|
+
<small>
|
|
178
|
+
Note: The asset types are case-sensitive.
|
|
179
|
+
</small>
|
|
180
|
+
</p>
|
|
181
|
+
</li>
|
|
182
|
+
<li>
|
|
183
|
+
<b>availableRepresentativeSubtypes</b>
|
|
184
|
+
<p>
|
|
185
|
+
An array of supported OrangeDAM subtypes to allow inserting representative image. If not provided, all subtypes will be supported.
|
|
186
|
+
<br/>
|
|
187
|
+
<span>E.g. Standard Image, Standard Video, Standard Audio, Other,...</span>
|
|
188
|
+
</p>
|
|
189
|
+
<p>
|
|
190
|
+
<small>
|
|
191
|
+
Note: The subtypes are case-sensitive.
|
|
192
|
+
</small>
|
|
193
|
+
</p>
|
|
194
|
+
</li>
|
|
195
|
+
</ul>
|
|
196
|
+
<ul>
|
|
197
|
+
<li>
|
|
198
|
+
<b>displayInfo</b>
|
|
199
|
+
<p>
|
|
200
|
+
An object to configure the display of the asset information. The object has the following properties:
|
|
201
|
+
</p>
|
|
202
|
+
<ul>
|
|
203
|
+
<li>title (default true)</li>
|
|
204
|
+
<li>dimension (default true)</li>
|
|
205
|
+
<li>fileSize (default false)</li>
|
|
206
|
+
<li>tags (default false)</li>
|
|
207
|
+
</ul>
|
|
208
|
+
</li>
|
|
209
|
+
<li>
|
|
210
|
+
<b>extraFields</b>
|
|
211
|
+
<p>
|
|
212
|
+
An array of extra fields to get from the assets. The fields are in the format of "coreField.FieldName" or "document.FieldName".
|
|
213
|
+
</p>
|
|
214
|
+
</li>
|
|
215
|
+
<li>
|
|
216
|
+
<b>lastLocationMode</b> (default false)
|
|
217
|
+
<p>
|
|
218
|
+
A boolean to enable the last location mode. When enabled, the content browser open the last selected folder on loaded.
|
|
219
|
+
</p>
|
|
220
|
+
</li>
|
|
221
|
+
<li>
|
|
222
|
+
<b>persistMode</b> (default true)
|
|
223
|
+
<p>
|
|
224
|
+
A boolean to enable the persist mode. When enabled, the content browser will not close after selecting an asset.
|
|
225
|
+
</p>
|
|
226
|
+
</li>
|
|
227
|
+
<li>
|
|
228
|
+
<b>allowTracking</b> (default true)
|
|
229
|
+
<p>
|
|
230
|
+
A boolean to enable tracking. When enabled, the user will be able to input tracking parameters to be added to the asset URL.
|
|
231
|
+
</p>
|
|
232
|
+
</li>
|
|
233
|
+
<li>
|
|
234
|
+
<b>showCollections</b> (default true)
|
|
235
|
+
<p>
|
|
236
|
+
A boolean to show collections in the content browser.
|
|
237
|
+
</p>
|
|
238
|
+
</li>
|
|
239
|
+
<li>
|
|
240
|
+
<b>useSession</b>
|
|
241
|
+
<p>
|
|
242
|
+
The session id to use for the content browser. Try logging out and in whenever you change the sesssion.
|
|
243
|
+
</p>
|
|
244
|
+
</li>
|
|
245
|
+
</ul>
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
<script>
|
|
249
|
+
function loadDefaultConfig() {
|
|
250
|
+
const config = {
|
|
251
|
+
onAssetSelected: (assets) => {
|
|
252
|
+
document.getElementById('output').value = JSON.stringify(assets, undefined, 2);
|
|
253
|
+
window.open(assets[0].imageUrl, '_blank');
|
|
254
|
+
},
|
|
255
|
+
onError: (errorMessage, error) => {
|
|
256
|
+
},
|
|
257
|
+
availableDocTypes: ['Images*', 'Videos*', 'Audio*', 'Others*'],
|
|
258
|
+
availableRepresentativeSubtypes: ['Other'],
|
|
259
|
+
// container element to attach, leave blank to open popup
|
|
260
|
+
containerId: 'react-app-root',
|
|
261
|
+
ctaText: 'Open in new tab',
|
|
262
|
+
// extra asset fields to get
|
|
263
|
+
extraFields: ['coreField.OriginalFileName', 'document.CortexPath'],
|
|
264
|
+
// default base url to pre-filled
|
|
265
|
+
baseUrl: 'https://qa-latest.orangelogic.com',
|
|
266
|
+
displayInfo: {
|
|
267
|
+
title: true,
|
|
268
|
+
dimension: true,
|
|
269
|
+
fileSize: false,
|
|
270
|
+
tags: false,
|
|
271
|
+
},
|
|
272
|
+
lastLocationMode: true,
|
|
273
|
+
persistMode: true,
|
|
274
|
+
publicApplicationName: "",
|
|
275
|
+
pluginName: "OrangeDAM Content Browser",
|
|
276
|
+
showCollections: true,
|
|
277
|
+
lastLocationMode: true,
|
|
278
|
+
allowTracking: true,
|
|
279
|
+
useSession: '',
|
|
280
|
+
};
|
|
281
|
+
document.getElementById("content").innerHTML = JSON.stringify(config, function(key, value) {
|
|
282
|
+
if (typeof value === "function") {
|
|
283
|
+
return value.toString().replace(/\n/g, "<br/>");
|
|
284
|
+
}
|
|
285
|
+
return value;
|
|
286
|
+
}, 4).replace(/\n/g, "<br/>");
|
|
287
|
+
}
|
|
288
|
+
function loadConfig() {
|
|
289
|
+
const value = document.getElementById("content").textContent;
|
|
290
|
+
const config = JSON.parse(value.replace(/<br>/g, ""), function(key, value) {
|
|
291
|
+
if (typeof value === "string" && (key === "onAssetSelected" || key === "onError")) {
|
|
292
|
+
return new Function("return " + value)();
|
|
293
|
+
}
|
|
294
|
+
return value;
|
|
295
|
+
});
|
|
296
|
+
OrangeDAMContentBrowser.close();
|
|
297
|
+
OrangeDAMContentBrowser.open(config);
|
|
298
|
+
}
|
|
299
|
+
window.onload = function() {
|
|
300
|
+
loadDefaultConfig();
|
|
301
|
+
|
|
302
|
+
document.getElementById('mobile').addEventListener('change', function() {
|
|
303
|
+
const checked = this.checked;
|
|
304
|
+
const container = document.getElementById('react-app-root');
|
|
305
|
+
if (checked) {
|
|
306
|
+
container.style.maxWidth = '400px';
|
|
307
|
+
} else {
|
|
308
|
+
container.style.maxWidth = 'none';
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
};
|
|
312
|
+
</script>
|
|
313
|
+
</body>
|
|
314
|
+
|
|
315
|
+
</html>
|
package/GitVersion.yml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
mode: Mainline
|
|
2
|
+
assembly-versioning-scheme: MajorMinor
|
|
3
|
+
assembly-file-versioning-scheme: MajorMinorPatchTag
|
|
4
|
+
assembly-informational-format: '{InformationalVersion}'
|
|
5
|
+
branches:
|
|
6
|
+
main:
|
|
7
|
+
tag: ci
|
|
8
|
+
increment: None
|
|
9
|
+
regex: ^master$|^tags/
|
|
10
|
+
feature:
|
|
11
|
+
regex: ^dev/
|
|
12
|
+
hotfix:
|
|
13
|
+
regex: ^fix/
|
|
14
|
+
support:
|
|
15
|
+
regex: ^stable/
|
|
16
|
+
pull-request:
|
|
17
|
+
increment: None
|
|
18
|
+
tag: pr
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
trigger:
|
|
2
|
+
tags:
|
|
3
|
+
include:
|
|
4
|
+
- '*.*.*'
|
|
5
|
+
branches:
|
|
6
|
+
include:
|
|
7
|
+
- 'master'
|
|
8
|
+
|
|
9
|
+
resources:
|
|
10
|
+
repositories:
|
|
11
|
+
- repository: infra-templates
|
|
12
|
+
type: git
|
|
13
|
+
name: Infra_Pipelines-templates-dev
|
|
14
|
+
ref: refs/tags/1.0.15
|
|
15
|
+
|
|
16
|
+
- repository: gab-extension
|
|
17
|
+
type: git
|
|
18
|
+
name: GAB_Browser_Extension
|
|
19
|
+
ref: main
|
|
20
|
+
|
|
21
|
+
variables:
|
|
22
|
+
- group: "Global Vars"
|
|
23
|
+
|
|
24
|
+
parameters:
|
|
25
|
+
- name: promoteLatest
|
|
26
|
+
displayName: Enable promoting to latest
|
|
27
|
+
type: boolean
|
|
28
|
+
default: false
|
|
29
|
+
|
|
30
|
+
stages:
|
|
31
|
+
- stage: Build
|
|
32
|
+
dependsOn: []
|
|
33
|
+
jobs:
|
|
34
|
+
- job: BuildPackage
|
|
35
|
+
displayName: 'Build GAB'
|
|
36
|
+
pool:
|
|
37
|
+
name: Azure Pipelines
|
|
38
|
+
steps:
|
|
39
|
+
- checkout: self
|
|
40
|
+
clean: true
|
|
41
|
+
fetchDepth: 0
|
|
42
|
+
path: s
|
|
43
|
+
|
|
44
|
+
- checkout: gab-extension
|
|
45
|
+
clean: true
|
|
46
|
+
fetchDepth: 0
|
|
47
|
+
path: s/gab_extension
|
|
48
|
+
|
|
49
|
+
- template: azure-pipelines/common/steps-printenv.yml@infra-templates
|
|
50
|
+
|
|
51
|
+
- template: azure-pipelines/common/steps-gitversion.yml@infra-templates
|
|
52
|
+
|
|
53
|
+
- template: azure-pipelines/common/npm/steps-node-setup.yml@infra-templates
|
|
54
|
+
parameters:
|
|
55
|
+
versionSpec: 18.x
|
|
56
|
+
|
|
57
|
+
- task: replacetokens@6
|
|
58
|
+
displayName: 'Replace tokens in HTML files'
|
|
59
|
+
inputs:
|
|
60
|
+
sources: |
|
|
61
|
+
**/CBSDKdemo.html
|
|
62
|
+
**/GAB.html
|
|
63
|
+
tokenPattern: 'custom'
|
|
64
|
+
tokenPrefix: '__'
|
|
65
|
+
tokenSuffix: '__'
|
|
66
|
+
additionalVariables: |
|
|
67
|
+
- tag: v$(GitVersion.FullSemVer)
|
|
68
|
+
|
|
69
|
+
- template: azure-pipelines/common/npm/steps-npm-package.yml@infra-templates
|
|
70
|
+
parameters:
|
|
71
|
+
npmEndpoint: 'OL NPM registry'
|
|
72
|
+
isCustomNpmEndpoint: true
|
|
73
|
+
version: '$(GitVersion.FullSemVer)'
|
|
74
|
+
skipBuild: false
|
|
75
|
+
|
|
76
|
+
- template: azure-pipelines/common/steps-s3-publish.yml@infra-templates
|
|
77
|
+
parameters:
|
|
78
|
+
artifacts:
|
|
79
|
+
- sourceFolder: 'build/static/css'
|
|
80
|
+
targetFolder: 'ContentBrowserSDK/v$(GitVersion.FullSemVer)'
|
|
81
|
+
contents: OrangeDAMContentBrowserSDK.min.css
|
|
82
|
+
- sourceFolder: 'build/static/js'
|
|
83
|
+
targetFolder: 'ContentBrowserSDK/v$(GitVersion.FullSemVer)'
|
|
84
|
+
contents: OrangeDAMContentBrowserSDK.min.js
|
|
85
|
+
- sourceFolder: '.'
|
|
86
|
+
targetFolder: 'ContentBrowserSDK/v$(GitVersion.FullSemVer)'
|
|
87
|
+
contents: CBSDKdemo.html
|
|
88
|
+
- ${{ if eq(parameters.promoteLatest, true) }}:
|
|
89
|
+
- sourceFolder: '.'
|
|
90
|
+
targetFolder: 'ContentBrowserSDK/latest'
|
|
91
|
+
contents: CBSDKdemo.html
|
|
92
|
+
- sourceFolder: 'gab_extension'
|
|
93
|
+
targetFolder: 'ContentBrowserSDK/v$(GitVersion.FullSemVer)'
|
|
94
|
+
contents: GAB.html
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration file for aem-clientlib-generator
|
|
3
|
+
*/
|
|
4
|
+
module.exports = {
|
|
5
|
+
// default working directory (can be changed per 'cwd' in every asset option)
|
|
6
|
+
context: __dirname,
|
|
7
|
+
|
|
8
|
+
// path to the clientlib root folder (output)
|
|
9
|
+
clientLibRoot: 'dist',
|
|
10
|
+
|
|
11
|
+
// define all clientlib options here as array... (multiple clientlibs)
|
|
12
|
+
libs: [
|
|
13
|
+
{
|
|
14
|
+
name: 'example',
|
|
15
|
+
assets: {
|
|
16
|
+
js: [
|
|
17
|
+
'src/js/*.js',
|
|
18
|
+
],
|
|
19
|
+
css: [
|
|
20
|
+
'src/css/*.css',
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
// Clientlib categories this will register to
|
|
24
|
+
categories: [
|
|
25
|
+
'orangelogic.genericassetbrowser.clientlibs',
|
|
26
|
+
],
|
|
27
|
+
// Prevent Generic Asset Browser from minifying JS bundle with ancient YUI
|
|
28
|
+
jsProcessor: [
|
|
29
|
+
'default:none',
|
|
30
|
+
'min:none',
|
|
31
|
+
],
|
|
32
|
+
// Package format XML for vault or JSON for SLING-INF
|
|
33
|
+
serializationFormat: 'xml',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
};
|
package/config/env.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const paths = require('./paths');
|
|
7
|
+
|
|
8
|
+
// Make sure that including paths.js after env.js will read .env variables.
|
|
9
|
+
delete require.cache[require.resolve('./paths')];
|
|
10
|
+
|
|
11
|
+
const NODE_ENV = process.env.NODE_ENV;
|
|
12
|
+
if (!NODE_ENV) {
|
|
13
|
+
throw new Error(
|
|
14
|
+
'The NODE_ENV environment variable is required but was not specified.',
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
|
|
19
|
+
const dotenvFiles = [
|
|
20
|
+
`${paths.dotenv}.${NODE_ENV}.local`,
|
|
21
|
+
// Don't include `.env.local` for `test` environment
|
|
22
|
+
// since normally you expect tests to produce the same
|
|
23
|
+
// results for everyone
|
|
24
|
+
NODE_ENV !== 'test' && `${paths.dotenv}.local`,
|
|
25
|
+
`${paths.dotenv}.${NODE_ENV}`,
|
|
26
|
+
paths.dotenv,
|
|
27
|
+
].filter(Boolean);
|
|
28
|
+
|
|
29
|
+
// Load environment variables from .env* files. Suppress warnings using silent
|
|
30
|
+
// if this file is missing. dotenv will never modify any environment variables
|
|
31
|
+
// that have already been set. Variable expansion is supported in .env files.
|
|
32
|
+
// https://github.com/motdotla/dotenv
|
|
33
|
+
// https://github.com/motdotla/dotenv-expand
|
|
34
|
+
dotenvFiles.forEach(dotenvFile => {
|
|
35
|
+
if (fs.existsSync(dotenvFile)) {
|
|
36
|
+
require('dotenv-expand')(
|
|
37
|
+
require('dotenv').config({
|
|
38
|
+
path: dotenvFile,
|
|
39
|
+
}),
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// We support resolving modules according to `NODE_PATH`.
|
|
45
|
+
// This lets you use absolute paths in imports inside large monorepos:
|
|
46
|
+
// https://github.com/facebook/create-react-app/issues/253.
|
|
47
|
+
// It works similar to `NODE_PATH` in Node itself:
|
|
48
|
+
// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
|
|
49
|
+
// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
|
|
50
|
+
// Otherwise, we risk importing Node.js core modules into an app instead of webpack shims.
|
|
51
|
+
// https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421
|
|
52
|
+
// We also resolve them to make sure all tools using them work consistently.
|
|
53
|
+
const appDirectory = fs.realpathSync(process.cwd());
|
|
54
|
+
process.env.NODE_PATH = (process.env.NODE_PATH || '')
|
|
55
|
+
.split(path.delimiter)
|
|
56
|
+
.filter(folder => folder && !path.isAbsolute(folder))
|
|
57
|
+
.map(folder => path.resolve(appDirectory, folder))
|
|
58
|
+
.join(path.delimiter);
|
|
59
|
+
|
|
60
|
+
// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
|
|
61
|
+
// injected into the application via DefinePlugin in webpack configuration.
|
|
62
|
+
const REACT_APP = /^REACT_APP_/i;
|
|
63
|
+
|
|
64
|
+
function getClientEnvironment(publicUrl) {
|
|
65
|
+
const raw = Object.keys(process.env)
|
|
66
|
+
.filter(key => REACT_APP.test(key))
|
|
67
|
+
.reduce(
|
|
68
|
+
(env, key) => {
|
|
69
|
+
env[key] = process.env[key];
|
|
70
|
+
return env;
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
// Useful for determining whether we’re running in production mode.
|
|
74
|
+
// Most importantly, it switches React into the correct mode.
|
|
75
|
+
NODE_ENV: process.env.NODE_ENV || 'development',
|
|
76
|
+
// Useful for resolving the correct path to static assets in `public`.
|
|
77
|
+
// For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
|
|
78
|
+
// This should only be used as an escape hatch. Normally you would put
|
|
79
|
+
// images into the `src` and `import` them in code to get their paths.
|
|
80
|
+
PUBLIC_URL: publicUrl,
|
|
81
|
+
// We support configuring the sockjs pathname during development.
|
|
82
|
+
// These settings let a developer run multiple simultaneous projects.
|
|
83
|
+
// They are used as the connection `hostname`, `pathname` and `port`
|
|
84
|
+
// in webpackHotDevClient. They are used as the `sockHost`, `sockPath`
|
|
85
|
+
// and `sockPort` options in webpack-dev-server.
|
|
86
|
+
WDS_SOCKET_HOST: process.env.WDS_SOCKET_HOST,
|
|
87
|
+
WDS_SOCKET_PATH: process.env.WDS_SOCKET_PATH,
|
|
88
|
+
WDS_SOCKET_PORT: process.env.WDS_SOCKET_PORT,
|
|
89
|
+
// Whether or not react-refresh is enabled.
|
|
90
|
+
// It is defined here so it is available in the webpackHotDevClient.
|
|
91
|
+
FAST_REFRESH: process.env.FAST_REFRESH !== 'false',
|
|
92
|
+
},
|
|
93
|
+
);
|
|
94
|
+
// Stringify all values so we can feed into webpack DefinePlugin
|
|
95
|
+
const stringified = {
|
|
96
|
+
'process.env': Object.keys(raw).reduce((env, key) => {
|
|
97
|
+
env[key] = JSON.stringify(raw[key]);
|
|
98
|
+
return env;
|
|
99
|
+
}, {}),
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
return { raw, stringified };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
module.exports = getClientEnvironment;
|