corpushub-design-system 0.0.21 → 0.0.22

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.
@@ -1,3 +1,4 @@
1
+ import authApi from '../auth/authApi';
1
2
  import { applyAuthErrorHandling } from './applyAuthErrorHandling';
2
3
  import { createApiClient } from './createApiClient';
3
4
  const platformApiBase = import.meta.env.VITE_APP_PLATFORM_API;
@@ -13,6 +14,7 @@ export const parserApiBase = import.meta.env.VITE_APP_PARSER_API ||
13
14
  export const lexiconApiBase = import.meta.env.VITE_APP_LEXICON_API ||
14
15
  import.meta.env.VITE_APP_URL_API;
15
16
  const api = applyAuthErrorHandling(createApiClient({ baseURL: platformApiBase }), { authErrorHandling: 'redirect' });
17
+ applyAuthErrorHandling(authApi, { authErrorHandling: 'redirect' });
16
18
  export { createApiClient } from './createApiClient';
17
19
  export { installAuthRefreshInterceptor } from '../auth/installAuthRefreshInterceptor';
18
20
  export { applyAuthErrorHandling } from './applyAuthErrorHandling';
@@ -5,6 +5,7 @@ export { applyAccessTokenFromApi, loginWithGoogle, loginWithPassword, logout, }
5
5
  export { bootstrapAuthSession, clearSession, getAccessToken, LEGACY_JWT_COOKIE, mayHaveRefreshSession, REDIRECT_ACCESS_TOKEN_HASH_PARAM, refreshAccessToken, setAccessToken, } from './auth/session';
6
6
  export { buildCrossAppRedirectUrl, clearLocalhostJwtHandoff, isLocalDevHost, persistLocalhostJwtHandoff, } from './auth/localDevHandoff';
7
7
  export { installAuthRefreshInterceptor } from './auth/installAuthRefreshInterceptor';
8
+ export { default as authApi, configureAuthApiBaseUrl, } from './auth/authApi';
8
9
  export type { TokenAuthResponse } from './auth/authApi';
9
10
  export { commonLocalization, commonResources, featureResources, mergeResources, } from './Localization';
10
11
  export { applyAuthErrorHandling, createApiClient, dispatchAccessDeniedError, dispatchApiError, dispatchClientError, dispatchServerApiError, isAccessDeniedApiError, isHandledApiError, isHandledAuthError, markApiErrorHandled, markAuthErrorHandled, parserApiBase, lexiconApiBase, platformApi, resolveAccessDeniedMessage, } from './api';
@@ -5,6 +5,7 @@ export { applyAccessTokenFromApi, loginWithGoogle, loginWithPassword, logout, }
5
5
  export { bootstrapAuthSession, clearSession, getAccessToken, LEGACY_JWT_COOKIE, mayHaveRefreshSession, REDIRECT_ACCESS_TOKEN_HASH_PARAM, refreshAccessToken, setAccessToken, } from './auth/session';
6
6
  export { buildCrossAppRedirectUrl, clearLocalhostJwtHandoff, isLocalDevHost, persistLocalhostJwtHandoff, } from './auth/localDevHandoff';
7
7
  export { installAuthRefreshInterceptor } from './auth/installAuthRefreshInterceptor';
8
+ export { default as authApi, configureAuthApiBaseUrl, } from './auth/authApi';
8
9
  export { commonLocalization, commonResources, featureResources, mergeResources, } from './Localization';
9
10
  export { applyAuthErrorHandling, createApiClient, dispatchAccessDeniedError, dispatchApiError, dispatchClientError, dispatchServerApiError, isAccessDeniedApiError, isHandledApiError, isHandledAuthError, markApiErrorHandled, markAuthErrorHandled, parserApiBase, lexiconApiBase, platformApi, resolveAccessDeniedMessage, } from './api';
10
11
  export { brandAssetBase, brandFromEnv, createBrand, resolveBrandLogo, resolveBrandLogoShort, resolveBrandYoutube, } from './brand';
@@ -1,6 +1,6 @@
1
1
  import api, { lexiconApiBase, parserApiBase, platformApi } from '../../configs/api';
2
+ import authApi from '../../configs/auth/authApi';
2
3
  import { convertPageable } from '../../common';
3
- const AUTH_API = () => import.meta.env.VITE_APP_AUTH_API;
4
4
  const APP_BY_MODE = {
5
5
  corpus: 'CORPUS',
6
6
  parser: 'PARSER',
@@ -10,20 +10,20 @@ function resourceKey(mode) {
10
10
  return mode;
11
11
  }
12
12
  function updatePortal(user, corpus, request) {
13
- return api.patch(`${AUTH_API()}/portal/${user}`, {
13
+ return authApi.patch(`/portal/${user}`, {
14
14
  corpus,
15
15
  ...request,
16
16
  });
17
17
  }
18
18
  function update(mode, resourceUid, user, request) {
19
- return api.patch(`${AUTH_API()}/access/${resourceUid}`, {
19
+ return authApi.patch(`/access/${resourceUid}`, {
20
20
  user,
21
21
  ...request,
22
22
  app: APP_BY_MODE[mode],
23
23
  });
24
24
  }
25
25
  function revoke(mode, user, resourceUid) {
26
- return api.delete(`${AUTH_API()}/${resourceUid}/${user}/${mode}`);
26
+ return authApi.delete(`/${resourceUid}/${user}/${mode}`);
27
27
  }
28
28
  function grant(mode, access, resourceUid) {
29
29
  const flags = mode === 'corpus'
@@ -31,7 +31,7 @@ function grant(mode, access, resourceUid) {
31
31
  : mode === 'parser'
32
32
  ? { corpus: false }
33
33
  : { corpus: false, lexicon: true, parser: false };
34
- return api.post(`${AUTH_API()}/${resourceUid}`, {
34
+ return authApi.post(`/${resourceUid}`, {
35
35
  ...access,
36
36
  ...flags,
37
37
  });
@@ -41,10 +41,10 @@ function page(mode, resourceUid, filter) {
41
41
  [resourceKey(mode)]: resourceUid,
42
42
  ...convertPageable(filter),
43
43
  };
44
- return api.post(`${AUTH_API()}/access`, data);
44
+ return authApi.post('/access', data);
45
45
  }
46
46
  function search(mode, text, resourceUid) {
47
- return api.get(`${AUTH_API()}/search`, {
47
+ return authApi.get('/search', {
48
48
  params: {
49
49
  text,
50
50
  [resourceKey(mode)]: resourceUid,
@@ -53,7 +53,7 @@ function search(mode, text, resourceUid) {
53
53
  });
54
54
  }
55
55
  function searchAll(text) {
56
- return api.get(`${AUTH_API()}/search`, {
56
+ return authApi.get('/search', {
57
57
  params: { text },
58
58
  });
59
59
  }
@@ -1,4 +1,5 @@
1
1
  import api from '../../configs/api';
2
+ import authApi from '../../configs/auth/authApi';
2
3
  import StorybookUtils from '../../functions/StorybookUtils';
3
4
  import { mockCommentUsers, mockComments } from './CommentService.mock';
4
5
  let storybookComments = mockComments.map((c) => ({ ...c }));
@@ -109,7 +110,7 @@ function findAvailableUsers(uid, mode) {
109
110
  if (StorybookUtils.isStorybook()) {
110
111
  return mockResponse(mockCommentUsers);
111
112
  }
112
- return api.get(`${import.meta.env.VITE_APP_AUTH_API}/${mode}/${uid}`);
113
+ return authApi.get(`/${mode}/${uid}`);
113
114
  }
114
115
  const CommentService = {
115
116
  add,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "corpushub-design-system",
3
3
  "private": false,
4
- "version": "0.0.21",
4
+ "version": "0.0.22",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {