@orangelogic/orange-dam-content-browser-sdk 2.1.54 → 2.1.55
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/build/ApiService.d.ts +15 -0
- package/build/App.d.ts +62 -0
- package/build/AppContext.d.ts +18 -0
- package/build/GlobalConfigContext.d.ts +32 -0
- package/build/OrangeDAMContentBrowserSDK.min.css +2 -0
- package/build/OrangeDAMContentBrowserSDK.min.css.map +1 -0
- package/build/OrangeDAMContentBrowserSDK.min.js +11468 -0
- package/build/OrangeDAMContentBrowserSDK.min.js.map +1 -0
- package/build/asset-manifest.json +13 -0
- package/build/components/ArrayClamp/ArrayClamp.d.ts +10 -0
- package/build/components/ArrayClamp/ArrayClamp.styled.d.ts +1 -0
- package/build/components/ArrayClamp/index.d.ts +1 -0
- package/build/components/Browser/Browser.constants.d.ts +3 -0
- package/build/components/Browser/Browser.d.ts +21 -0
- package/build/components/Browser/Browser.styled.d.ts +2 -0
- package/build/components/Browser/BrowserItem.d.ts +13 -0
- package/build/components/Browser/LoadMoreButton.d.ts +9 -0
- package/build/components/ControlBar/ControlBar.constants.d.ts +10 -0
- package/build/components/ControlBar/ControlBar.d.ts +23 -0
- package/build/components/ControlBar/ControlBar.styled.d.ts +1 -0
- package/build/components/ControlBar/Facet/Facet.d.ts +14 -0
- package/build/components/ControlBar/Facet/index.d.ts +1 -0
- package/build/components/FormatDialog/CropPreviewer/CropPreviewer.d.ts +41 -0
- package/{src/components/FormatDialog/CropPreviewer/index.ts → build/components/FormatDialog/CropPreviewer/index.d.ts} +1 -1
- package/build/components/FormatDialog/CustomRendition/CustomRendition.constants.d.ts +5 -0
- package/build/components/FormatDialog/CustomRendition/CustomRendition.d.ts +56 -0
- package/build/components/FormatDialog/CustomRendition/CustomRendition.styled.d.ts +1 -0
- package/build/components/FormatDialog/CustomRendition/index.d.ts +1 -0
- package/build/components/FormatDialog/CustomRendition/transformations/Crop.d.ts +26 -0
- package/build/components/FormatDialog/CustomRendition/transformations/Extension.d.ts +11 -0
- package/build/components/FormatDialog/CustomRendition/transformations/Format.d.ts +10 -0
- package/build/components/FormatDialog/CustomRendition/transformations/Metadata.d.ts +7 -0
- package/build/components/FormatDialog/CustomRendition/transformations/Quality.d.ts +7 -0
- package/build/components/FormatDialog/CustomRendition/transformations/Resize.d.ts +18 -0
- package/build/components/FormatDialog/CustomRendition/transformations/Rotate.d.ts +8 -0
- package/{src/components/FormatDialog/CustomRendition/transformations/index.ts → build/components/FormatDialog/CustomRendition/transformations/index.d.ts} +3 -1
- package/build/components/FormatDialog/FormatDialog.d.ts +49 -0
- package/build/components/FormatDialog/FormatDialog.styled.d.ts +3 -0
- package/build/components/FormatDialog/Previewer/Previewer.d.ts +17 -0
- package/build/components/FormatDialog/Previewer/Previewer.styled.d.ts +1 -0
- package/build/components/FormatDialog/Previewer/index.d.ts +1 -0
- package/build/components/FormatDialog/ProxyMenu/ProxyMenu.d.ts +20 -0
- package/build/components/FormatDialog/ProxyMenu/ProxyMenu.styled.d.ts +2 -0
- package/build/components/FormatDialog/ProxyMenu/index.d.ts +1 -0
- package/build/components/FormatDialog/TrackingParameters/TrackingParameters.d.ts +13 -0
- package/build/components/FormatDialog/TrackingParameters/index.d.ts +1 -0
- package/build/components/FormatDialog/VersionHistory/VersionHistory.d.ts +6 -0
- package/build/components/FormatDialog/VersionHistory/VersionHistory.styled.d.ts +1 -0
- package/build/components/FormatDialog/VersionHistory/index.d.ts +1 -0
- package/build/components/FormatDialog/index.d.ts +1 -0
- package/build/components/Header/Header.d.ts +15 -0
- package/build/components/Header/Header.styled.d.ts +5 -0
- package/build/components/Loader/Loader.d.ts +7 -0
- package/build/components/Loader/index.d.ts +1 -0
- package/build/components/NoResult/NoResult.d.ts +7 -0
- package/build/components/NoResult/index.d.ts +1 -0
- package/build/components/Result/AssetCard/AssetCard.d.ts +15 -0
- package/build/components/Result/AssetCard/AssetCard.styled.d.ts +2 -0
- package/build/components/Result/AssetCard/AssetCardWrapper.d.ts +18 -0
- package/build/components/Result/AssetCard/AssetCardWrapper.styled.d.ts +1 -0
- package/build/components/Result/AssetCard/index.d.ts +1 -0
- package/build/components/Result/AssetPreview/AssetPreview.d.ts +11 -0
- package/build/components/Result/AssetPreview/AssetPreview.styled.d.ts +1 -0
- package/build/components/Result/AssetPreview/ImagePreview/ImagePreview.d.ts +11 -0
- package/build/components/Result/AssetPreview/ImagePreview/index.d.ts +1 -0
- package/build/components/Result/AssetPreview/OtherPreview/OtherPreview.d.ts +9 -0
- package/build/components/Result/AssetPreview/OtherPreview/OtherPreview.styled.d.ts +1 -0
- package/build/components/Result/AssetPreview/OtherPreview/index.d.ts +1 -0
- package/build/components/Result/AssetPreview/VideoPreview/VideoPreview.d.ts +11 -0
- package/build/components/Result/AssetPreview/VideoPreview/index.d.ts +1 -0
- package/build/components/Result/AssetPreview/index.d.ts +1 -0
- package/build/consts/asset.d.ts +14 -0
- package/build/consts/auth.d.ts +4 -0
- package/build/consts/data.d.ts +21 -0
- package/build/index.d.ts +225 -0
- package/build/index.html +1 -0
- package/build/page/Authenticate/Authenticate.d.ts +2 -0
- package/build/page/Authenticate/ConnectingBackground.d.ts +8 -0
- package/build/page/Authenticate/index.d.ts +2 -0
- package/build/page/Home/Home.d.ts +6 -0
- package/build/page/Home/Home.styled.d.ts +2 -0
- package/build/setupTests.d.ts +1 -0
- package/build/store/assets/assets.api.d.ts +66 -0
- package/build/store/assets/assets.service.d.ts +23 -0
- package/build/store/assets/assets.slice.d.ts +65 -0
- package/build/store/auth/auth.service.d.ts +10 -0
- package/build/store/auth/auth.slice.d.ts +76 -0
- package/build/store/index.d.ts +368 -0
- package/build/store/search/search.api.d.ts +39 -0
- package/build/store/search/search.slice.d.ts +12 -0
- package/build/store/user/user.api.d.ts +5 -0
- package/build/types/assets.d.ts +68 -0
- package/build/types/auth.d.ts +35 -0
- package/build/types/common.d.ts +11 -0
- package/build/types/download.d.ts +8 -0
- package/build/types/navigation.d.ts +3 -0
- package/build/types/search.d.ts +148 -0
- package/{src/types/storage.ts → build/types/storage.d.ts} +1 -1
- package/build/types/user.d.ts +7 -0
- package/build/utils/api.d.ts +27 -0
- package/build/utils/array.d.ts +13 -0
- package/build/utils/constants.d.ts +11 -0
- package/build/utils/function.d.ts +1 -0
- package/build/utils/getRequestUrl.d.ts +1 -0
- package/build/utils/hooks.d.ts +1 -0
- package/build/utils/icon.d.ts +3 -0
- package/build/utils/image.d.ts +24 -0
- package/build/utils/number.d.ts +4 -0
- package/build/utils/rotate.d.ts +4 -0
- package/build/utils/storage.d.ts +23 -0
- package/build/utils/string.d.ts +12 -0
- package/build/view/AssetsPicker.d.ts +6 -0
- package/package.json +49 -8
- package/.env +0 -1
- package/.eslintignore +0 -2
- package/.eslintrc.json +0 -82
- package/.releaserc +0 -17
- package/.travis.yml +0 -20
- package/CBSDKdemo.html +0 -315
- package/GitVersion.yml +0 -18
- package/azure-pipeline.yaml +0 -93
- package/clientlib.config.js +0 -36
- package/config/env.js +0 -105
- package/config/getHttpsConfig.js +0 -67
- package/config/jest/babelTransform.js +0 -30
- package/config/jest/cssTransform.js +0 -14
- package/config/jest/fileTransform.js +0 -41
- package/config/modules.js +0 -135
- package/config/paths.js +0 -79
- package/config/webpack/persistentCache/createEnvironmentHash.js +0 -10
- package/config/webpack.config.js +0 -762
- package/config/webpackDevServer.config.js +0 -128
- package/config-overrides.js +0 -8
- package/gab_extension/GAB.html +0 -85
- package/gab_extension/GoogleChrome/manifest.json +0 -28
- package/gab_extension/GoogleChrome/src/assets/icon48.png +0 -0
- package/gab_extension/GoogleChrome/src/background/index.js +0 -6
- package/gab_extension/GoogleChrome/src/scripts/index.js +0 -347
- package/gab_extension/MozillaFirefox/manifest.json +0 -20
- package/gab_extension/MozillaFirefox/src/assets/icon.png +0 -0
- package/gab_extension/MozillaFirefox/src/background/index.js +0 -5
- package/gab_extension/MozillaFirefox/src/scripts/index.js +0 -347
- package/gab_extension/README.md +0 -11
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.pbxproj +0 -927
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- 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 +0 -19
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/AccentColor.colorset/Contents.json +0 -11
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -63
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/Contents.json +0 -6
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/LargeIcon.imageset/Contents.json +0 -20
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Base.lproj/Main.html +0 -23
- 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 +0 -24
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Resources/Style.css +0 -61
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/ViewController.swift +0 -81
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (Extension)/SafariWebExtensionHandler.swift +0 -26
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/AppDelegate.swift +0 -24
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/Base.lproj/LaunchScreen.storyboard +0 -36
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/Base.lproj/Main.storyboard +0 -38
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/Info.plist +0 -27
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/SceneDelegate.swift +0 -18
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (Extension)/Info.plist +0 -13
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/AppDelegate.swift +0 -21
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/Base.lproj/Main.storyboard +0 -125
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/Info.plist +0 -8
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/Orange DAM Asset Browser Extension.entitlements +0 -12
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (Extension)/Info.plist +0 -13
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (Extension)/Orange DAM Asset Browser Extension.entitlements +0 -10
- package/public/index.html +0 -92
- package/scripts/build.js +0 -218
- package/scripts/start.js +0 -154
- package/scripts/test.js +0 -53
- package/src/App.tsx +0 -98
- package/src/AppContext.ts +0 -18
- package/src/GlobalConfigContext.ts +0 -46
- package/src/components/ArrayClamp/ArrayClamp.styled.ts +0 -42
- package/src/components/ArrayClamp/ArrayClamp.tsx +0 -167
- package/src/components/ArrayClamp/index.ts +0 -1
- package/src/components/Browser/Browser.styled.ts +0 -82
- package/src/components/Browser/Browser.tsx +0 -284
- package/src/components/Browser/BrowserItem.tsx +0 -98
- package/src/components/ControlBar/ControlBar.constants.tsx +0 -66
- package/src/components/ControlBar/ControlBar.styled.ts +0 -82
- package/src/components/ControlBar/ControlBar.tsx +0 -528
- package/src/components/ControlBar/Facet/Facet.tsx +0 -113
- package/src/components/ControlBar/Facet/index.ts +0 -1
- package/src/components/FormatDialog/CropPreviewer/CropPreviewer.tsx +0 -224
- package/src/components/FormatDialog/CustomRendition/CustomRendition.constants.ts +0 -24
- package/src/components/FormatDialog/CustomRendition/CustomRendition.styled.ts +0 -57
- package/src/components/FormatDialog/CustomRendition/CustomRendition.tsx +0 -178
- package/src/components/FormatDialog/CustomRendition/index.ts +0 -1
- package/src/components/FormatDialog/CustomRendition/transformations/Crop.tsx +0 -249
- package/src/components/FormatDialog/CustomRendition/transformations/Extension.tsx +0 -54
- package/src/components/FormatDialog/CustomRendition/transformations/Format.tsx +0 -86
- package/src/components/FormatDialog/CustomRendition/transformations/Resize.tsx +0 -176
- package/src/components/FormatDialog/CustomRendition/transformations/Rotate.tsx +0 -101
- package/src/components/FormatDialog/FormatDialog.styled.ts +0 -137
- package/src/components/FormatDialog/FormatDialog.tsx +0 -1533
- package/src/components/FormatDialog/Previewer/Previewer.styled.ts +0 -31
- package/src/components/FormatDialog/Previewer/Previewer.tsx +0 -143
- package/src/components/FormatDialog/Previewer/index.ts +0 -1
- package/src/components/FormatDialog/ProxyMenu/ProxyMenu.styled.ts +0 -88
- package/src/components/FormatDialog/ProxyMenu/ProxyMenu.tsx +0 -74
- package/src/components/FormatDialog/ProxyMenu/index.ts +0 -1
- package/src/components/FormatDialog/TrackingParameters/TrackingParameters.tsx +0 -59
- package/src/components/FormatDialog/TrackingParameters/index.ts +0 -1
- package/src/components/FormatDialog/index.ts +0 -1
- package/src/components/Header/Header.styled.ts +0 -51
- package/src/components/Header/Header.tsx +0 -118
- package/src/components/Loader/Loader.tsx +0 -37
- package/src/components/Loader/index.ts +0 -1
- package/src/components/NoResult/NoResult.tsx +0 -37
- package/src/components/NoResult/index.tsx +0 -1
- package/src/components/Result/AssetCard/AssetCard.styled.ts +0 -120
- package/src/components/Result/AssetCard/AssetCard.tsx +0 -192
- package/src/components/Result/AssetCard/AssetCardWrapper.styled.ts +0 -35
- package/src/components/Result/AssetCard/AssetCardWrapper.tsx +0 -165
- package/src/components/Result/AssetCard/index.ts +0 -1
- package/src/components/Result/AssetPreview/AssetPreview.styled.ts +0 -108
- package/src/components/Result/AssetPreview/AssetPreview.tsx +0 -78
- package/src/components/Result/AssetPreview/ImagePreview/ImagePreview.tsx +0 -42
- package/src/components/Result/AssetPreview/ImagePreview/index.ts +0 -1
- package/src/components/Result/AssetPreview/OtherPreview/OtherPreview.styled.ts +0 -23
- package/src/components/Result/AssetPreview/OtherPreview/OtherPreview.tsx +0 -28
- package/src/components/Result/AssetPreview/OtherPreview/index.ts +0 -1
- package/src/components/Result/AssetPreview/VideoPreview/VideoPreview.tsx +0 -132
- package/src/components/Result/AssetPreview/VideoPreview/index.ts +0 -1
- package/src/components/Result/AssetPreview/index.ts +0 -1
- package/src/consts/asset.ts +0 -16
- package/src/consts/data.ts +0 -17
- package/src/index.tsx +0 -305
- package/src/page/Authenticate/Authenticate.tsx +0 -232
- package/src/page/Authenticate/ConnectingBackground.tsx +0 -44
- package/src/page/Authenticate/index.tsx +0 -94
- package/src/page/Home/Home.styled.ts +0 -46
- package/src/page/Home/Home.tsx +0 -941
- package/src/react-web-component.d.ts +0 -4617
- package/src/store/assets/assets.api.ts +0 -167
- package/src/store/assets/assets.service.ts +0 -223
- package/src/store/assets/assets.slice.ts +0 -104
- package/src/store/auth/auth.service.ts +0 -71
- package/src/store/auth/auth.slice.ts +0 -295
- package/src/store/index.ts +0 -27
- package/src/store/search/search.api.ts +0 -319
- package/src/store/search/search.slice.ts +0 -28
- package/src/store/user/user.api.ts +0 -29
- package/src/styles.css +0 -42
- package/src/types/assets.ts +0 -71
- package/src/types/auth.ts +0 -42
- package/src/types/common.ts +0 -11
- package/src/types/download.ts +0 -8
- package/src/types/navigation.ts +0 -3
- package/src/types/search.ts +0 -116
- package/src/types/user.ts +0 -6
- package/src/utils/api.ts +0 -186
- package/src/utils/array.ts +0 -25
- package/src/utils/constants.ts +0 -12
- package/src/utils/fetch.ts +0 -116
- package/src/utils/getRequestUrl.ts +0 -15
- package/src/utils/hooks.ts +0 -36
- package/src/utils/icon.ts +0 -22
- package/src/utils/image.ts +0 -157
- package/src/utils/number.ts +0 -11
- package/src/utils/rotate.ts +0 -23
- package/src/utils/storage.ts +0 -184
- package/src/utils/string.ts +0 -24
- package/src/view/AssetsPicker.tsx +0 -24
- package/src/web-component.d.ts +0 -8151
- package/tsconfig.eslint.json +0 -10
- package/tsconfig.json +0 -37
- /package/{src/components/Browser/index.ts → build/components/Browser/index.d.ts} +0 -0
- /package/{src/components/ControlBar/index.ts → build/components/ControlBar/index.d.ts} +0 -0
- /package/{src/components/Header/index.ts → build/components/Header/index.d.ts} +0 -0
- /package/{public → build}/favicon.ico +0 -0
- /package/{public → build}/logo192.png +0 -0
- /package/{public → build}/logo512.png +0 -0
- /package/{public → build}/manifest.json +0 -0
- /package/{src/page/Home/index.ts → build/page/Home/index.d.ts} +0 -0
- /package/{public → build}/robots.txt +0 -0
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
import type { PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
-
import { RootState } from '@/store';
|
|
3
|
-
import { resetImportStatus } from '@/store/assets/assets.slice';
|
|
4
|
-
import {
|
|
5
|
-
GetAccessKeyRes,
|
|
6
|
-
GetAccessKeyResponseCode,
|
|
7
|
-
OAuthRes,
|
|
8
|
-
} from '@/types/auth';
|
|
9
|
-
import { getRequestUrl } from '@/utils/getRequestUrl';
|
|
10
|
-
import { deleteData, getData, storeData } from '@/utils/storage';
|
|
11
|
-
import { generateRandomString } from '@/utils/string';
|
|
12
|
-
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
13
|
-
|
|
14
|
-
import { assetsApi } from '../assets/assets.api';
|
|
15
|
-
import { searchApi } from '../search/search.api';
|
|
16
|
-
import { userApi } from '../user/user.api';
|
|
17
|
-
import {
|
|
18
|
-
abortAuthService,
|
|
19
|
-
authAbortController,
|
|
20
|
-
CANCEL_AUTH_MESSAGE,
|
|
21
|
-
getAccessKeyService,
|
|
22
|
-
getAccessTokenService,
|
|
23
|
-
requestAuthorizeService,
|
|
24
|
-
} from './auth.service';
|
|
25
|
-
|
|
26
|
-
export const AUTH_FEATURE_KEY = 'auth';
|
|
27
|
-
export const AUTH_FEATURE_ACCESS_KEY_KEY = `${AUTH_FEATURE_KEY}_access_key_key`;
|
|
28
|
-
export const AUTH_FEATURE_SITE_URL_KEY = `${AUTH_FEATURE_KEY}_site_url_key`;
|
|
29
|
-
export const USE_SESSION = 'useSession';
|
|
30
|
-
|
|
31
|
-
export type AuthState = {
|
|
32
|
-
siteUrl: string;
|
|
33
|
-
userConfigSiteUrl?: string;
|
|
34
|
-
nonce?: string;
|
|
35
|
-
accessToken?: string;
|
|
36
|
-
accessKey?: string;
|
|
37
|
-
oAuthUrl?: string;
|
|
38
|
-
error?: string;
|
|
39
|
-
status: 'authenticated' | 'unauthenticated' | 'restoreSession' | 'requestLogin' | 'waitForAuthorise';
|
|
40
|
-
useSession: string;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// #region Slice
|
|
44
|
-
const initialState: AuthState = {
|
|
45
|
-
siteUrl: '',
|
|
46
|
-
status: 'unauthenticated',
|
|
47
|
-
useSession: '',
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export const authSlice = createSlice({
|
|
51
|
-
name: AUTH_FEATURE_KEY,
|
|
52
|
-
initialState,
|
|
53
|
-
reducers: {
|
|
54
|
-
setAccessToken: (state, action: PayloadAction<string | undefined>) => {
|
|
55
|
-
state.accessToken = action.payload;
|
|
56
|
-
},
|
|
57
|
-
updateAuthTokens: (state, action: PayloadAction<Partial<AuthState>>) => {
|
|
58
|
-
state.status = 'authenticated';
|
|
59
|
-
state.accessKey = action.payload.accessKey;
|
|
60
|
-
state.accessToken = action.payload.accessToken;
|
|
61
|
-
},
|
|
62
|
-
setSiteUrl: (state, action: PayloadAction<string>) => {
|
|
63
|
-
state.error = '';
|
|
64
|
-
state.siteUrl = action.payload;
|
|
65
|
-
},
|
|
66
|
-
setUserConfigSiteUrl: (state, action: PayloadAction<string>) => {
|
|
67
|
-
state.userConfigSiteUrl = action.payload;
|
|
68
|
-
},
|
|
69
|
-
generateNonce: (state) => {
|
|
70
|
-
state.nonce = generateRandomString(12);
|
|
71
|
-
},
|
|
72
|
-
logout: (state) => {
|
|
73
|
-
state.status = 'unauthenticated';
|
|
74
|
-
state.error = '';
|
|
75
|
-
state.accessKey = undefined;
|
|
76
|
-
state.accessToken = undefined;
|
|
77
|
-
state.oAuthUrl = undefined;
|
|
78
|
-
state.siteUrl = state.userConfigSiteUrl ?? '';
|
|
79
|
-
state.nonce = undefined;
|
|
80
|
-
state.useSession = '';
|
|
81
|
-
deleteData(AUTH_FEATURE_ACCESS_KEY_KEY);
|
|
82
|
-
deleteData(AUTH_FEATURE_SITE_URL_KEY);
|
|
83
|
-
deleteData(USE_SESSION);
|
|
84
|
-
deleteData('selectedSortOrder');
|
|
85
|
-
deleteData('selectedSortDirection');
|
|
86
|
-
deleteData('selectedView');
|
|
87
|
-
deleteData('newlySelectedFacet');
|
|
88
|
-
deleteData('newFacets');
|
|
89
|
-
deleteData('selectedFilter');
|
|
90
|
-
deleteData('selectedIsSeeThrough');
|
|
91
|
-
deleteData('searchText');
|
|
92
|
-
deleteData('lastLocation');
|
|
93
|
-
},
|
|
94
|
-
setAuthStatus: (state, action: PayloadAction<AuthState['status']>) => {
|
|
95
|
-
state.status = action.payload;
|
|
96
|
-
},
|
|
97
|
-
setUseSession: (state, action: PayloadAction<string>) => {
|
|
98
|
-
state.useSession = action.payload;
|
|
99
|
-
storeData(USE_SESSION, action.payload);
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
extraReducers: (builder) => {
|
|
103
|
-
builder
|
|
104
|
-
.addCase(
|
|
105
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
106
|
-
oAuth.fulfilled,
|
|
107
|
-
(state, { payload }) => {
|
|
108
|
-
if (payload) {
|
|
109
|
-
const { accessKey, accessToken, siteUrl } = payload;
|
|
110
|
-
state.accessKey = accessKey;
|
|
111
|
-
state.accessToken = accessToken;
|
|
112
|
-
state.status = 'authenticated';
|
|
113
|
-
state.siteUrl = siteUrl;
|
|
114
|
-
storeData(AUTH_FEATURE_ACCESS_KEY_KEY, accessKey ?? '');
|
|
115
|
-
storeData(AUTH_FEATURE_SITE_URL_KEY, siteUrl);
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
)
|
|
119
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
120
|
-
.addCase(oAuth.rejected, (state, action) => {
|
|
121
|
-
state.error = action.payload as string;
|
|
122
|
-
state.status = 'unauthenticated';
|
|
123
|
-
deleteData(AUTH_FEATURE_ACCESS_KEY_KEY);
|
|
124
|
-
})
|
|
125
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
126
|
-
.addCase(oAuth.pending, (state) => {
|
|
127
|
-
state.error = '';
|
|
128
|
-
});
|
|
129
|
-
},
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
export default authSlice.reducer;
|
|
133
|
-
export const { logout, setAccessToken, generateNonce, setSiteUrl, setUserConfigSiteUrl, setUseSession } = authSlice.actions;
|
|
134
|
-
// #endregion
|
|
135
|
-
|
|
136
|
-
// #region Selector
|
|
137
|
-
export const authenticatedSelector = (rootState: RootState) =>
|
|
138
|
-
rootState[AUTH_FEATURE_KEY].status == 'authenticated';
|
|
139
|
-
|
|
140
|
-
export const accessTokenSelector = (rootState: RootState) =>
|
|
141
|
-
rootState[AUTH_FEATURE_KEY].accessToken;
|
|
142
|
-
|
|
143
|
-
export const oAuthUrlSelector = (rootState: RootState) =>
|
|
144
|
-
rootState[AUTH_FEATURE_KEY].oAuthUrl;
|
|
145
|
-
|
|
146
|
-
export const siteUrlSelector = (rootState: RootState) =>
|
|
147
|
-
rootState[AUTH_FEATURE_KEY].siteUrl;
|
|
148
|
-
|
|
149
|
-
export const userConfigSiteUrlSelector = (rootState: RootState) =>
|
|
150
|
-
rootState[AUTH_FEATURE_KEY].userConfigSiteUrl;
|
|
151
|
-
|
|
152
|
-
export const authErrorSelector = (rootState: RootState) =>
|
|
153
|
-
rootState[AUTH_FEATURE_KEY].error;
|
|
154
|
-
|
|
155
|
-
export const nonceSelector = (rootState: RootState) =>
|
|
156
|
-
rootState[AUTH_FEATURE_KEY].nonce;
|
|
157
|
-
|
|
158
|
-
export const authStateSelector = (rootState: RootState) =>
|
|
159
|
-
rootState[AUTH_FEATURE_KEY].status;
|
|
160
|
-
|
|
161
|
-
export const useSessionSelector = (rootState: RootState) =>
|
|
162
|
-
rootState[AUTH_FEATURE_KEY].useSession;
|
|
163
|
-
|
|
164
|
-
export const appAuthUrlSelector = (rootState: RootState) => {
|
|
165
|
-
const siteUrl = rootState[AUTH_FEATURE_KEY].siteUrl;
|
|
166
|
-
return siteUrl ? getRequestUrl(siteUrl, `AppAuth?RID=${rootState[AUTH_FEATURE_KEY].nonce}`) : '';
|
|
167
|
-
};
|
|
168
|
-
// #endregion
|
|
169
|
-
|
|
170
|
-
// #region Action
|
|
171
|
-
export const cancelAuth = createAsyncThunk(`${AUTH_FEATURE_KEY}/oauth`, (_, { dispatch, getState }) => {
|
|
172
|
-
if (!authenticatedSelector(getState() as RootState)) {
|
|
173
|
-
abortAuthService();
|
|
174
|
-
dispatch(authSlice.actions.setAuthStatus('unauthenticated'));
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
export const oAuth = createAsyncThunk<OAuthRes, { siteUrl: string }>(
|
|
179
|
-
`${AUTH_FEATURE_KEY}/oauth`,
|
|
180
|
-
async ({ siteUrl }, { rejectWithValue, dispatch, getState }) => {
|
|
181
|
-
dispatch(authSlice.actions.setSiteUrl(siteUrl));
|
|
182
|
-
dispatch(authSlice.actions.setAuthStatus('requestLogin'));
|
|
183
|
-
|
|
184
|
-
const execute = async () => {
|
|
185
|
-
dispatch(generateNonce());
|
|
186
|
-
const nonce = nonceSelector(getState() as RootState);
|
|
187
|
-
const resp = await requestAuthorizeService(nonce ?? '');
|
|
188
|
-
if (authAbortController.signal.aborted) {
|
|
189
|
-
throw Error(CANCEL_AUTH_MESSAGE);
|
|
190
|
-
}
|
|
191
|
-
const requestID = resp.requestID;
|
|
192
|
-
const popupUrl = appAuthUrlSelector(getState() as RootState);
|
|
193
|
-
dispatch(authSlice.actions.setAuthStatus('waitForAuthorise'));
|
|
194
|
-
window.open(popupUrl, '_blank');
|
|
195
|
-
const getAccessKeyData = await getAccessKeyService(requestID);
|
|
196
|
-
if (getAccessKeyData.accessKey) {
|
|
197
|
-
const tokenResp = await getAccessTokenService(getAccessKeyData.accessKey);
|
|
198
|
-
if (tokenResp.accessToken) {
|
|
199
|
-
return {
|
|
200
|
-
code: GetAccessKeyResponseCode.Authorized,
|
|
201
|
-
accessKey: getAccessKeyData.accessKey,
|
|
202
|
-
accessToken: tokenResp.accessToken,
|
|
203
|
-
siteUrl,
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
return getAccessKeyData;
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
let getOAuthResult: Awaited<ReturnType<typeof execute>>;
|
|
211
|
-
try {
|
|
212
|
-
getOAuthResult = await execute();
|
|
213
|
-
if (getOAuthResult.code !== GetAccessKeyResponseCode.Authorized) {
|
|
214
|
-
return rejectWithValue((getOAuthResult as GetAccessKeyRes).message);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// Login successfully, reset other state
|
|
218
|
-
dispatch(resetImportStatus());
|
|
219
|
-
dispatch(searchApi.util.resetApiState());
|
|
220
|
-
dispatch(assetsApi.util.resetApiState());
|
|
221
|
-
dispatch(userApi.util.resetApiState());
|
|
222
|
-
|
|
223
|
-
return getOAuthResult as OAuthRes;
|
|
224
|
-
} catch (exception) {
|
|
225
|
-
return rejectWithValue((exception as Error).message);
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
);
|
|
229
|
-
|
|
230
|
-
export const initAuthInfoFromCache = createAsyncThunk(
|
|
231
|
-
`${AUTH_FEATURE_KEY}/initAuthInfoFromCache`,
|
|
232
|
-
async (_, { dispatch, rejectWithValue, getState }) => {
|
|
233
|
-
dispatch(authSlice.actions.setAuthStatus('restoreSession'));
|
|
234
|
-
|
|
235
|
-
const execute = async () => {
|
|
236
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
237
|
-
let siteUrl = siteUrlSelector(getState() as RootState);
|
|
238
|
-
if (!siteUrl) {
|
|
239
|
-
siteUrl = await getData(AUTH_FEATURE_SITE_URL_KEY) ?? '';
|
|
240
|
-
if (!siteUrl) {
|
|
241
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
242
|
-
siteUrl = userConfigSiteUrlSelector(getState() as RootState) ?? '';
|
|
243
|
-
}
|
|
244
|
-
if (siteUrl) {
|
|
245
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
246
|
-
dispatch(setSiteUrl(siteUrl));
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
if (!siteUrl) {
|
|
251
|
-
return false;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
const accessKey = await getData(AUTH_FEATURE_ACCESS_KEY_KEY);
|
|
255
|
-
|
|
256
|
-
if (accessKey) {
|
|
257
|
-
const accessToken = (
|
|
258
|
-
await getAccessTokenService(accessKey)
|
|
259
|
-
).accessToken;
|
|
260
|
-
if (accessToken) {
|
|
261
|
-
dispatch(
|
|
262
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
263
|
-
authSlice.actions.updateAuthTokens({
|
|
264
|
-
accessKey,
|
|
265
|
-
accessToken,
|
|
266
|
-
}),
|
|
267
|
-
);
|
|
268
|
-
return true;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
return false;
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
let isSuccess = false;
|
|
275
|
-
|
|
276
|
-
try {
|
|
277
|
-
isSuccess = await execute();
|
|
278
|
-
if (!isSuccess) {
|
|
279
|
-
return rejectWithValue('Unable to recover access key');
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
dispatch(resetImportStatus());
|
|
283
|
-
dispatch(searchApi.util.resetApiState());
|
|
284
|
-
dispatch(assetsApi.util.resetApiState());
|
|
285
|
-
dispatch(userApi.util.resetApiState());
|
|
286
|
-
} catch (exception) {
|
|
287
|
-
return rejectWithValue((exception as Error).message);
|
|
288
|
-
} finally {
|
|
289
|
-
if (!isSuccess) {
|
|
290
|
-
dispatch(logout());
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
},
|
|
294
|
-
);
|
|
295
|
-
// #endregion
|
package/src/store/index.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { configureStore } from '@reduxjs/toolkit';
|
|
2
|
-
import type { TypedUseSelectorHook } from 'react-redux';
|
|
3
|
-
import { useDispatch, useSelector } from 'react-redux';
|
|
4
|
-
import authReducer, { AUTH_FEATURE_KEY } from './auth/auth.slice';
|
|
5
|
-
import assetsReducer, { ASSETS_FEATURE_KEY } from './assets/assets.slice';
|
|
6
|
-
import { searchApi } from './search/search.api';
|
|
7
|
-
import { assetsApi } from './assets/assets.api';
|
|
8
|
-
import { userApi } from './user/user.api';
|
|
9
|
-
|
|
10
|
-
export const store = configureStore({
|
|
11
|
-
reducer: {
|
|
12
|
-
[AUTH_FEATURE_KEY]: authReducer,
|
|
13
|
-
[ASSETS_FEATURE_KEY]: assetsReducer,
|
|
14
|
-
[searchApi.reducerPath]: searchApi.reducer,
|
|
15
|
-
[userApi.reducerPath]: userApi.reducer,
|
|
16
|
-
[assetsApi.reducerPath]: assetsApi.reducer,
|
|
17
|
-
},
|
|
18
|
-
middleware: (getDefaultMiddleware) =>
|
|
19
|
-
getDefaultMiddleware().concat([searchApi.middleware, userApi.middleware, assetsApi.middleware]),
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
export type RootState = ReturnType<typeof store.getState>;
|
|
23
|
-
|
|
24
|
-
export type AppDispatch = typeof store.dispatch;
|
|
25
|
-
|
|
26
|
-
export const useAppDispatch = () => useDispatch<AppDispatch>();
|
|
27
|
-
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
|
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
import _mapKeys from 'lodash-es/mapKeys';
|
|
2
|
-
import _camelCase from 'lodash-es/camelCase';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
DEFAULT_VIEW_SIZE, ORIGINAL_VIEW_SIZE, FIELD_CORTEX_PATH, FIELD_DOC_TYPE, FIELD_EXTENSION, FIELD_FILE_SIZE,
|
|
6
|
-
FIELD_HAS_BROWSER_CHILDREN,
|
|
7
|
-
FIELD_IDENTIFIER, FIELD_KEYWORDS, FIELD_MAX_HEIGHT, FIELD_MAX_WIDTH, FIELD_SCRUB_URL, FIELD_SUBTYPE, FIELD_TITLE_WITH_FALLBACK, FIELD_ALLOW_ATS_LINK,
|
|
8
|
-
} from '@/consts/data';
|
|
9
|
-
import { Asset, Folder, GetContentRequest, GetContentResponse } from '@/types/search';
|
|
10
|
-
import { AppBaseQuery, GetValueByKeyCaseInsensitive } from '@/utils/api';
|
|
11
|
-
import { isNullOrWhiteSpace } from '@/utils/string';
|
|
12
|
-
import { createApi } from '@reduxjs/toolkit/query/react';
|
|
13
|
-
|
|
14
|
-
const NATURAL_SORT_ORDER_REFERENCE_ID = 'OR4ND000000063615';
|
|
15
|
-
|
|
16
|
-
const resolveFolderExtraFilters = (searchText: string) => {
|
|
17
|
-
if (isNullOrWhiteSpace(searchText)) {
|
|
18
|
-
return 'MediaType:Story OR MediaType:Album';
|
|
19
|
-
}
|
|
20
|
-
return `(MediaType:Story OR MediaType:Album) AND Story_Title:${searchText}`;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const resolveAssetExtraFilters = ({
|
|
24
|
-
extensions,
|
|
25
|
-
searchText,
|
|
26
|
-
statuses,
|
|
27
|
-
visibilityClasses,
|
|
28
|
-
}: {
|
|
29
|
-
extensions: string[];
|
|
30
|
-
searchText: string;
|
|
31
|
-
statuses: string[];
|
|
32
|
-
visibilityClasses: string[];
|
|
33
|
-
}) => {
|
|
34
|
-
let statusQuery = '';
|
|
35
|
-
if (statuses?.length) {
|
|
36
|
-
statusQuery = statuses
|
|
37
|
-
.map(status => `WorkflowStatus:${status}`)
|
|
38
|
-
.join(' OR ');
|
|
39
|
-
if (statuses.length > 1) {
|
|
40
|
-
statusQuery = `(${statusQuery})`;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
let extensionsQuery = '';
|
|
45
|
-
if (extensions?.length) {
|
|
46
|
-
extensionsQuery = extensions
|
|
47
|
-
.map(extension => `FileExtension:${extension}`)
|
|
48
|
-
.join(' OR ');
|
|
49
|
-
if (extensions.length > 1) {
|
|
50
|
-
extensionsQuery = `(${extensionsQuery})`;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
let visibilityClassesQuery = '';
|
|
55
|
-
if (visibilityClasses?.length) {
|
|
56
|
-
visibilityClassesQuery = visibilityClasses
|
|
57
|
-
.map(visibilityClass => `Purpose:${visibilityClass}`)
|
|
58
|
-
.join(' OR ');
|
|
59
|
-
if (visibilityClasses.length > 1) {
|
|
60
|
-
visibilityClassesQuery = `(${visibilityClassesQuery})`;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const searchTextQuery = isNullOrWhiteSpace(searchText) ? '' : `Text:${searchText}`;
|
|
65
|
-
|
|
66
|
-
const filters = [statusQuery, extensionsQuery, visibilityClassesQuery, searchTextQuery].filter(filter => filter.length > 0);
|
|
67
|
-
|
|
68
|
-
return filters.join(' AND ');
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
// Define a service using a base URL and expected endpoints
|
|
72
|
-
export const searchApi = createApi({
|
|
73
|
-
reducerPath: 'searchApi',
|
|
74
|
-
baseQuery: AppBaseQuery,
|
|
75
|
-
tagTypes: ['Folders', 'Images', 'ImagesInFolders'],
|
|
76
|
-
endpoints: (builder) => ({
|
|
77
|
-
getFolders: builder.query({
|
|
78
|
-
query: ({
|
|
79
|
-
folder,
|
|
80
|
-
searchText,
|
|
81
|
-
useSession,
|
|
82
|
-
}: {
|
|
83
|
-
folder: Folder;
|
|
84
|
-
searchText: string;
|
|
85
|
-
useSession?: string;
|
|
86
|
-
}) => {
|
|
87
|
-
const params = [
|
|
88
|
-
[
|
|
89
|
-
'extraFilters',
|
|
90
|
-
resolveFolderExtraFilters(searchText),
|
|
91
|
-
],
|
|
92
|
-
['fields', FIELD_CORTEX_PATH],
|
|
93
|
-
['fields', FIELD_DOC_TYPE],
|
|
94
|
-
['fields', FIELD_TITLE_WITH_FALLBACK],
|
|
95
|
-
['fields', FIELD_HAS_BROWSER_CHILDREN],
|
|
96
|
-
['objectRecordID', folder.id],
|
|
97
|
-
['orderBy', NATURAL_SORT_ORDER_REFERENCE_ID],
|
|
98
|
-
['seeThru', !isNullOrWhiteSpace(searchText)],
|
|
99
|
-
];
|
|
100
|
-
|
|
101
|
-
if (useSession) {
|
|
102
|
-
params.push(['UseSession', useSession]);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return {
|
|
106
|
-
url: '/webapi/extensibility/integrations/contentBrowserSDK/getcontent_4bw_v1',
|
|
107
|
-
params,
|
|
108
|
-
};
|
|
109
|
-
},
|
|
110
|
-
transformResponse: (
|
|
111
|
-
response: GetContentResponse,
|
|
112
|
-
_meta,
|
|
113
|
-
arg,
|
|
114
|
-
): Folder[] => {
|
|
115
|
-
return (
|
|
116
|
-
response.contentItems
|
|
117
|
-
?.map((item) => {
|
|
118
|
-
return {
|
|
119
|
-
id: item.recordID,
|
|
120
|
-
title:
|
|
121
|
-
GetValueByKeyCaseInsensitive(item.fields, FIELD_TITLE_WITH_FALLBACK) ?? '',
|
|
122
|
-
docType:
|
|
123
|
-
GetValueByKeyCaseInsensitive(item.fields, FIELD_DOC_TYPE) ?? '',
|
|
124
|
-
path: [...arg.folder.path, arg.folder.title],
|
|
125
|
-
fullPath: (
|
|
126
|
-
GetValueByKeyCaseInsensitive(item.fields, FIELD_CORTEX_PATH) ?? ''
|
|
127
|
-
).replace(/^Root\//i, ''),
|
|
128
|
-
parents: [...arg.folder.parents, arg.folder],
|
|
129
|
-
hasChildren: (GetValueByKeyCaseInsensitive(item.fields, FIELD_HAS_BROWSER_CHILDREN) ?? '0') === '1' ? true : false,
|
|
130
|
-
};
|
|
131
|
-
}) ?? []
|
|
132
|
-
);
|
|
133
|
-
},
|
|
134
|
-
providesTags: (_result, _error, arg) => {
|
|
135
|
-
return [{ type: 'Folders', id: arg.folder.id }];
|
|
136
|
-
},
|
|
137
|
-
}),
|
|
138
|
-
getCollections: builder.query({
|
|
139
|
-
query: ({
|
|
140
|
-
folder,
|
|
141
|
-
useSession,
|
|
142
|
-
}) => {
|
|
143
|
-
const params = [
|
|
144
|
-
['fields', FIELD_CORTEX_PATH],
|
|
145
|
-
['fields', FIELD_DOC_TYPE],
|
|
146
|
-
['fields', FIELD_TITLE_WITH_FALLBACK],
|
|
147
|
-
['seeThru', true],
|
|
148
|
-
['subtypeCriteria', folder],
|
|
149
|
-
];
|
|
150
|
-
|
|
151
|
-
if (useSession) {
|
|
152
|
-
params.push(['UseSession', useSession]);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return {
|
|
156
|
-
url: '/webapi/extensibility/integrations/contentBrowserSDK/getcontent_4bw_v1',
|
|
157
|
-
params,
|
|
158
|
-
};
|
|
159
|
-
},
|
|
160
|
-
transformResponse: (
|
|
161
|
-
response: GetContentResponse,
|
|
162
|
-
_meta,
|
|
163
|
-
): Folder[] => {
|
|
164
|
-
return (
|
|
165
|
-
response.contentItems
|
|
166
|
-
?.map((item) => ({
|
|
167
|
-
id: item.recordID,
|
|
168
|
-
title:
|
|
169
|
-
GetValueByKeyCaseInsensitive(item.fields, FIELD_TITLE_WITH_FALLBACK) ?? '',
|
|
170
|
-
docType:
|
|
171
|
-
GetValueByKeyCaseInsensitive(item.fields, FIELD_DOC_TYPE) ?? '',
|
|
172
|
-
path: [],
|
|
173
|
-
fullPath: (
|
|
174
|
-
GetValueByKeyCaseInsensitive(item.fields, FIELD_CORTEX_PATH) ?? ''
|
|
175
|
-
).replace(/^Root\//i, ''),
|
|
176
|
-
parents: [],
|
|
177
|
-
hasChildren: false,
|
|
178
|
-
})) ?? []
|
|
179
|
-
);
|
|
180
|
-
},
|
|
181
|
-
providesTags: (_result, _error, arg) => {
|
|
182
|
-
return [{ type: 'Folders', id: arg.folder.id }];
|
|
183
|
-
},
|
|
184
|
-
}),
|
|
185
|
-
getAssets: builder.query({
|
|
186
|
-
query: ({
|
|
187
|
-
extensions,
|
|
188
|
-
folderID,
|
|
189
|
-
isSeeThrough,
|
|
190
|
-
mediaTypes,
|
|
191
|
-
start,
|
|
192
|
-
pageSize,
|
|
193
|
-
searchText,
|
|
194
|
-
sortOrder,
|
|
195
|
-
statuses,
|
|
196
|
-
visibilityClasses,
|
|
197
|
-
useSession,
|
|
198
|
-
}: GetContentRequest) => {
|
|
199
|
-
const mappedMediaTypes = mediaTypes.map((mediaType) => ['subtypeCriteria', mediaType]);
|
|
200
|
-
const params = [
|
|
201
|
-
['objectRecordID', folderID],
|
|
202
|
-
['fields', FIELD_TITLE_WITH_FALLBACK],
|
|
203
|
-
['fields', DEFAULT_VIEW_SIZE],
|
|
204
|
-
['fields', ORIGINAL_VIEW_SIZE],
|
|
205
|
-
['fields', FIELD_KEYWORDS],
|
|
206
|
-
['fields', FIELD_MAX_WIDTH],
|
|
207
|
-
['fields', FIELD_MAX_HEIGHT],
|
|
208
|
-
['fields', FIELD_FILE_SIZE],
|
|
209
|
-
['fields', FIELD_DOC_TYPE],
|
|
210
|
-
['fields', FIELD_SUBTYPE],
|
|
211
|
-
['fields', FIELD_IDENTIFIER],
|
|
212
|
-
['fields', FIELD_EXTENSION],
|
|
213
|
-
['seeThru', isSeeThrough],
|
|
214
|
-
['start', start],
|
|
215
|
-
['limit', pageSize],
|
|
216
|
-
];
|
|
217
|
-
const extraFilters = resolveAssetExtraFilters({
|
|
218
|
-
extensions,
|
|
219
|
-
searchText,
|
|
220
|
-
statuses,
|
|
221
|
-
visibilityClasses,
|
|
222
|
-
});
|
|
223
|
-
if (extraFilters) {
|
|
224
|
-
params.push(['extraFilters', extraFilters]);
|
|
225
|
-
}
|
|
226
|
-
if (sortOrder) {
|
|
227
|
-
params.push(['orderBy', sortOrder]);
|
|
228
|
-
}
|
|
229
|
-
if (mappedMediaTypes.length) {
|
|
230
|
-
params.push(...mappedMediaTypes);
|
|
231
|
-
}
|
|
232
|
-
if (useSession) {
|
|
233
|
-
params.push(['UseSession', useSession]);
|
|
234
|
-
}
|
|
235
|
-
return {
|
|
236
|
-
url: '/webapi/extensibility/integrations/contentBrowserSDK/getcontent_4bw_v1',
|
|
237
|
-
params,
|
|
238
|
-
};
|
|
239
|
-
},
|
|
240
|
-
transformResponse: (
|
|
241
|
-
response: GetContentResponse,
|
|
242
|
-
): {
|
|
243
|
-
facets: Record<string, Record<string, number>>;
|
|
244
|
-
items: Asset[];
|
|
245
|
-
totalCount: number;
|
|
246
|
-
} => ({
|
|
247
|
-
facets: _mapKeys(response.facets, (_, key) => _camelCase(key)),
|
|
248
|
-
items:
|
|
249
|
-
response.contentItems?.map((item) => {
|
|
250
|
-
let extension = GetValueByKeyCaseInsensitive(item.fields, FIELD_EXTENSION) ?? '';
|
|
251
|
-
if (extension && !extension.startsWith('.')) {
|
|
252
|
-
extension = '.' + extension;
|
|
253
|
-
}
|
|
254
|
-
return {
|
|
255
|
-
docType: GetValueByKeyCaseInsensitive(item.fields, FIELD_DOC_TYPE) ?? '',
|
|
256
|
-
docSubType: GetValueByKeyCaseInsensitive(item.fields, FIELD_SUBTYPE) ?? '',
|
|
257
|
-
extension,
|
|
258
|
-
height: GetValueByKeyCaseInsensitive(item.fields, FIELD_MAX_HEIGHT) ?? '0',
|
|
259
|
-
id: item.recordID,
|
|
260
|
-
identifier: GetValueByKeyCaseInsensitive(item.fields, FIELD_IDENTIFIER) ?? '',
|
|
261
|
-
imageUrl: GetValueByKeyCaseInsensitive(item.fields, DEFAULT_VIEW_SIZE) ?? '',
|
|
262
|
-
originalUrl: GetValueByKeyCaseInsensitive(item.fields, ORIGINAL_VIEW_SIZE) ?? '',
|
|
263
|
-
name: GetValueByKeyCaseInsensitive(item.fields, FIELD_TITLE_WITH_FALLBACK) ?? '',
|
|
264
|
-
scrubUrl: GetValueByKeyCaseInsensitive(item.fields, FIELD_SCRUB_URL) ?? '',
|
|
265
|
-
size: GetValueByKeyCaseInsensitive(item.fields, FIELD_FILE_SIZE) ?? '0 MB',
|
|
266
|
-
tags: GetValueByKeyCaseInsensitive(item.fields, FIELD_KEYWORDS) ?? '',
|
|
267
|
-
width: GetValueByKeyCaseInsensitive(item.fields, FIELD_MAX_WIDTH) ?? '0',
|
|
268
|
-
allowATSLink: GetValueByKeyCaseInsensitive(item.fields, FIELD_ALLOW_ATS_LINK) === 'True',
|
|
269
|
-
} as Asset;
|
|
270
|
-
}) ?? [],
|
|
271
|
-
totalCount: response.totalCount,
|
|
272
|
-
}),
|
|
273
|
-
providesTags: (_result, _error, arg) => {
|
|
274
|
-
return [
|
|
275
|
-
{
|
|
276
|
-
extensions: arg.extensions,
|
|
277
|
-
id: arg.folderID,
|
|
278
|
-
isSeeThrough: arg.isSeeThrough,
|
|
279
|
-
mediaTypes: arg.mediaTypes,
|
|
280
|
-
searchText: arg.searchText,
|
|
281
|
-
sortOrder: arg.sortOrder,
|
|
282
|
-
statuses: arg.statuses,
|
|
283
|
-
type: 'ImagesInFolders',
|
|
284
|
-
},
|
|
285
|
-
'Images',
|
|
286
|
-
];
|
|
287
|
-
},
|
|
288
|
-
merge: (currentCachedData, responseData, request) => {
|
|
289
|
-
if (request.arg.start > 0) {
|
|
290
|
-
currentCachedData.items.push(...responseData.items);
|
|
291
|
-
return currentCachedData;
|
|
292
|
-
} else {
|
|
293
|
-
return responseData;
|
|
294
|
-
}
|
|
295
|
-
},
|
|
296
|
-
forceRefetch({ currentArg, previousArg }) {
|
|
297
|
-
return currentArg !== previousArg;
|
|
298
|
-
},
|
|
299
|
-
serializeQueryArgs: ({ endpointName, queryArgs }) => {
|
|
300
|
-
return {
|
|
301
|
-
endpointName,
|
|
302
|
-
extensions: queryArgs.extensions,
|
|
303
|
-
id: queryArgs.folderID,
|
|
304
|
-
isSeeThrough: queryArgs.isSeeThrough,
|
|
305
|
-
mediaTypes: queryArgs.mediaTypes,
|
|
306
|
-
searchText: queryArgs.searchText,
|
|
307
|
-
sortOrder: queryArgs.sortOrder,
|
|
308
|
-
statuses: queryArgs.statuses,
|
|
309
|
-
type: 'ImagesInFolders',
|
|
310
|
-
};
|
|
311
|
-
},
|
|
312
|
-
}),
|
|
313
|
-
}),
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
// Export hooks for usage in functional components, which are
|
|
317
|
-
// auto-generated based on the defined endpoints
|
|
318
|
-
export const { useGetFoldersQuery, useGetCollectionsQuery, useGetAssetsQuery } =
|
|
319
|
-
searchApi;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Folder } from '@/types/search';
|
|
2
|
-
import { createAsyncThunk } from '@reduxjs/toolkit';
|
|
3
|
-
import { searchApi } from './search.api';
|
|
4
|
-
|
|
5
|
-
export const RootFolder: Folder = Object.freeze({
|
|
6
|
-
id: '',
|
|
7
|
-
title: '',
|
|
8
|
-
docType: 'Story',
|
|
9
|
-
path: [],
|
|
10
|
-
parents: [],
|
|
11
|
-
fullPath: '',
|
|
12
|
-
hasChildren: true,
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
// #region Thunk
|
|
16
|
-
export const explorePath = createAsyncThunk(
|
|
17
|
-
'auth/explorePath',
|
|
18
|
-
async (folder: Folder, { dispatch }) => {
|
|
19
|
-
dispatch(
|
|
20
|
-
searchApi.util.invalidateTags([
|
|
21
|
-
{ type: 'ImagesInFolders', id: folder.id },
|
|
22
|
-
]),
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
return true;
|
|
26
|
-
},
|
|
27
|
-
);
|
|
28
|
-
// #endregion
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { store } from '@/store';
|
|
2
|
-
import { UserInfo } from '@/types/user';
|
|
3
|
-
import { AppBaseQuery } from '@/utils/api';
|
|
4
|
-
import { createApi } from '@reduxjs/toolkit/query/react';
|
|
5
|
-
|
|
6
|
-
import { AUTH_FEATURE_KEY } from '../auth/auth.slice';
|
|
7
|
-
|
|
8
|
-
// Define a service using a base URL and expected endpoints
|
|
9
|
-
export const userApi = createApi({
|
|
10
|
-
reducerPath: 'userApi',
|
|
11
|
-
baseQuery: AppBaseQuery,
|
|
12
|
-
endpoints: (builder) => ({
|
|
13
|
-
getUserInfo: builder.query({
|
|
14
|
-
query: () => '/webapi/extensibility/integrations/gab/authorization/getuserinfo_4bs_v1',
|
|
15
|
-
transformResponse: (response: UserInfo): UserInfo => {
|
|
16
|
-
const authState = store.getState()[AUTH_FEATURE_KEY];
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
...response,
|
|
20
|
-
avatar: `${authState.siteUrl}/${response.avatar}`,
|
|
21
|
-
};
|
|
22
|
-
},
|
|
23
|
-
}),
|
|
24
|
-
}),
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
// Export hooks for usage in functional components, which are
|
|
28
|
-
// auto-generated based on the defined endpoints
|
|
29
|
-
export const { useGetUserInfoQuery } = userApi;
|