@giteeteam/apps-team-components 1.10.9 → 1.10.10

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,5 +1,5 @@
1
1
  import { User as UserTyped } from '../../../lib/types/models';
2
2
  declare const CreatedByReadView: import("react").MemoExoticComponent<({ value }: {
3
3
  value: UserTyped;
4
- }) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element>;
4
+ }) => import("@emotion/react/jsx-runtime").JSX.Element>;
5
5
  export default CreatedByReadView;
@@ -24,6 +24,6 @@ type GetFormattedLabelParams = {
24
24
  background?: string;
25
25
  };
26
26
  };
27
- export declare const getFormattedLabel: ({ label, style }?: GetFormattedLabelParams) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
27
+ export declare const getFormattedLabel: ({ label, style }?: GetFormattedLabelParams) => import("@emotion/react/jsx-runtime").JSX.Element;
28
28
  declare const Dropdown: React.FC<BaseDropdownProps>;
29
29
  export default Dropdown;
@@ -2,5 +2,5 @@ import { User as UserTyped } from '../../../lib/types/models';
2
2
  declare const ReporterReadView: import("react").MemoExoticComponent<({ value, readonly }: {
3
3
  value: UserTyped;
4
4
  readonly?: boolean;
5
- }) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element>;
5
+ }) => import("@emotion/react/jsx-runtime").JSX.Element>;
6
6
  export default ReporterReadView;
@@ -1,5 +1,5 @@
1
1
  import { User as UserTyped } from '../../../lib/types/models';
2
2
  declare const UpdatedByReadView: import("react").MemoExoticComponent<({ value }: {
3
3
  value: UserTyped;
4
- }) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element>;
4
+ }) => import("@emotion/react/jsx-runtime").JSX.Element>;
5
5
  export default UpdatedByReadView;
@@ -12,7 +12,7 @@ import { TeamConfigProvider } from './teamConfig.js';
12
12
  import { TenantProvider } from './tenant.js';
13
13
  import { WorkflowConfigProvider } from './workflowConfig.js';
14
14
 
15
- const LibraryProvider = ({ getPopupContainer, locale, tenant, datetimeFormat, teamBasePath, teamGateway, isMicroApp, publicRuntimeConfig, userConfig, workspaceKey, workflow, item, currentUser, emotionCacheOptions, children, }) => {
15
+ const LibraryProvider = ({ getPopupContainer, locale, tenant, datetimeFormat, teamBasePath, teamGateway, isMicroApp, publicRuntimeConfig, userConfig, workspaceKey, workflow, item, currentUser, emotionCacheOptions, children, extraHeaders, }) => {
16
16
  const emotionCache = useMemo(() => {
17
17
  return createCache({
18
18
  key: 'apps',
@@ -22,7 +22,7 @@ const LibraryProvider = ({ getPopupContainer, locale, tenant, datetimeFormat, te
22
22
  useEffect(() => {
23
23
  i18n.setLocale(locale);
24
24
  }, [locale]);
25
- return (jsx(CacheProvider, { value: emotionCache, children: jsx(AntdConfigProvider, { getPopupContainer: getPopupContainer, children: jsx(TeamConfigProvider, { teamBasePath: teamBasePath, teamGateway: teamGateway, isMicroApp: isMicroApp, publicRuntimeConfig: publicRuntimeConfig, userConfig: userConfig, children: jsx(TenantProvider, { tenant: tenant, children: jsx(CurrentWorkspaceProvider, { workspaceKey: workspaceKey, children: jsx(DatetimeFormatProvider, { datetimeFormat: datetimeFormat, children: jsx(CurrentUserProvider, { currentUser: currentUser, children: jsx(WorkflowConfigProvider, { workflow: workflow, children: jsx(ItemConfigProvider, { item: item, children: children }) }) }) }) }) }) }) }) }));
25
+ return (jsx(CacheProvider, { value: emotionCache, children: jsx(AntdConfigProvider, { getPopupContainer: getPopupContainer, children: jsx(TeamConfigProvider, { teamBasePath: teamBasePath, teamGateway: teamGateway, isMicroApp: isMicroApp, publicRuntimeConfig: publicRuntimeConfig, userConfig: userConfig, extraHeaders: extraHeaders, children: jsx(TenantProvider, { tenant: tenant, children: jsx(CurrentWorkspaceProvider, { workspaceKey: workspaceKey, children: jsx(DatetimeFormatProvider, { datetimeFormat: datetimeFormat, children: jsx(CurrentUserProvider, { currentUser: currentUser, children: jsx(WorkflowConfigProvider, { workflow: workflow, children: jsx(ItemConfigProvider, { item: item, children: children }) }) }) }) }) }) }) }) }));
26
26
  };
27
27
 
28
28
  export { LibraryProvider };
@@ -6,6 +6,7 @@ export interface ITeamConfigContext {
6
6
  isMicroApp?: boolean;
7
7
  publicRuntimeConfig?: Partial<IPublicRuntimeProps>;
8
8
  userConfig?: Partial<IUserConfig>;
9
+ extraHeaders?: Record<string, string>;
9
10
  }
10
11
  export declare const TeamConfigContext: React.Context<ITeamConfigContext>;
11
12
  export interface TeamConfigProviderProps extends React.PropsWithChildren, ITeamConfigContext {
@@ -4,7 +4,7 @@ import { getQiankunConfig, getPublicRuntimeConfig, getUserConfig } from '../conf
4
4
 
5
5
  const defaultContext = {};
6
6
  const TeamConfigContext = createContext(defaultContext);
7
- const TeamConfigProvider = ({ teamGateway, teamBasePath, isMicroApp, children, publicRuntimeConfig, userConfig, }) => {
7
+ const TeamConfigProvider = ({ teamGateway, teamBasePath, isMicroApp, children, publicRuntimeConfig, userConfig, extraHeaders, }) => {
8
8
  const runtimeConfig = useMemo(() => {
9
9
  const config = { ...getQiankunConfig(), ...getPublicRuntimeConfig(), ...(publicRuntimeConfig || {}) };
10
10
  if (teamGateway) {
@@ -23,6 +23,7 @@ const TeamConfigProvider = ({ teamGateway, teamBasePath, isMicroApp, children, p
23
23
  isMicroApp,
24
24
  publicRuntimeConfig: runtimeConfig,
25
25
  userConfig: _userConfig,
26
+ extraHeaders,
26
27
  }, children: children }));
27
28
  };
28
29
 
package/dist/lib/fetch.js CHANGED
@@ -2,7 +2,7 @@ import { useContext, useMemo, useCallback, useEffect } from 'react';
2
2
  import axios, { HttpStatusCode } from 'axios';
3
3
  import cjson from 'compressed-json';
4
4
  import debug from 'debug';
5
- import { toNumber } from 'lodash-es';
5
+ import { toNumber, isEmpty } from 'lodash-es';
6
6
  import { REDIRECT_URL_KEY, CANCEL_FETCH_STRING } from './global.js';
7
7
  import throttleWithCache, { THROTTLE_TYPE } from './swr/throttleWithCache.js';
8
8
  import { ParseErrorCode } from './constants/code.js';
@@ -140,7 +140,7 @@ const useRedirectToLogin = () => {
140
140
  return redirectToLogin;
141
141
  };
142
142
  const useRequestInterceptors = () => {
143
- const { sessionToken, locale, appId } = useAppProps();
143
+ const { sessionToken, locale, appId, extraHeaders = {} } = useAppProps();
144
144
  const requestInterceptors = useCallback(config => {
145
145
  if (!config.ignoreParseHeaders) {
146
146
  if (!config.headers)
@@ -168,9 +168,12 @@ const useRequestInterceptors = () => {
168
168
  if (config.useJsonDecompress) {
169
169
  config.headers['x-has-json-compression'] = 'true';
170
170
  }
171
+ if (!isEmpty(extraHeaders)) {
172
+ config.headers = { ...config.headers, ...extraHeaders };
173
+ }
171
174
  checkSessionToken(config);
172
175
  return config;
173
- }, [appId, locale, sessionToken]);
176
+ }, [appId, locale, sessionToken, extraHeaders]);
174
177
  return requestInterceptors;
175
178
  };
176
179
  const useAddResponseInterceptors = (fetch) => {
@@ -5,4 +5,5 @@ export declare const useAppProps: () => {
5
5
  locale: string;
6
6
  sessionToken: string;
7
7
  appId: string;
8
+ extraHeaders?: Record<string, string>;
8
9
  };
@@ -7,7 +7,7 @@ const LOCALE_KEY = 'lang';
7
7
  const PROXIMA_TENANT_KEY = 'team_tenant';
8
8
  const SESSION_KEY = 'sessionToken';
9
9
  const useAppProps = () => {
10
- const { userConfig = {}, publicRuntimeConfig = {} } = useContext(TeamConfigContext);
10
+ const { userConfig = {}, publicRuntimeConfig = {}, extraHeaders = {} } = useContext(TeamConfigContext);
11
11
  const locale = useMemo(() => {
12
12
  const userLocale = userConfig.locale;
13
13
  const [defaultLang] = navigator.languages;
@@ -25,6 +25,7 @@ const useAppProps = () => {
25
25
  locale,
26
26
  sessionToken,
27
27
  appId,
28
+ extraHeaders,
28
29
  };
29
30
  };
30
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giteeteam/apps-team-components",
3
- "version": "1.10.9",
3
+ "version": "1.10.10",
4
4
  "description": "Gitee team components",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -107,5 +107,5 @@
107
107
  "public"
108
108
  ]
109
109
  },
110
- "packageManager": "pnpm@7.32.5+sha512.4395951a16c3553123c8693f9e350e9ce18824f602b5af158fb17c2d6ee10a53251544522e31e3003d3b1b9bf5422d25ca14f86e8d10053c552674ee9e33fd15"
110
+ "packageManager": "pnpm@10.15.1"
111
111
  }