@lark-apaas/client-toolkit 1.1.36-alpha.0 → 1.2.0-alpha.2

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.
@@ -23,19 +23,17 @@ const useAppInfo = ()=>{
23
23
  if (info.description) {
24
24
  const meta = document.querySelector("meta[property='og:description']");
25
25
  if (meta) meta.content = info.description;
26
- const metaDom = document.querySelector("meta[name='description']");
27
- if (metaDom) metaDom.content = info.description;
28
26
  }
29
27
  };
30
- const handleMetaInfoChanged = async (info, refresh = true)=>{
31
- if (!info) info = await getAppInfo(refresh);
28
+ const handleMetaInfoChanged = async (info)=>{
29
+ if (!info) info = await getAppInfo(true);
32
30
  updateDomInfo(info);
33
31
  setAppInfo((prev)=>({
34
32
  ...prev,
35
33
  ...info
36
34
  }));
37
35
  };
38
- handleMetaInfoChanged(null, false);
36
+ handleMetaInfoChanged();
39
37
  const onUpdate = (e)=>{
40
38
  const info = e.detail;
41
39
  handleMetaInfoChanged(info);
package/lib/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { capabilityClient } from '@lark-apaas/client-capability';
1
2
  declare const _default: {
2
3
  version: string;
3
4
  };
package/lib/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { version } from "../package.json";
2
+ import { capabilityClient } from "@lark-apaas/client-capability";
2
3
  const src = {
3
4
  version: version
4
5
  };
5
- export { src as default };
6
+ export { capabilityClient, src as default };
@@ -131,17 +131,15 @@ function initAxiosConfig(axiosInstance) {
131
131
  if (!axiosInstance) axiosInstance = axios;
132
132
  axiosInstance.interceptors.request.use((config)=>{
133
133
  const requestUUID = crypto.randomUUID();
134
- if ('production' !== process.env.NODE_ENV) {
135
- const stacktrace = getStacktrace();
136
- requestStacktraceMap.set(requestUUID, stacktrace);
137
- }
134
+ const stacktrace = getStacktrace();
135
+ requestStacktraceMap.set(requestUUID, stacktrace);
138
136
  config._requestUUID = requestUUID;
139
137
  config._startTime = Date.now();
140
138
  const csrfToken = window.csrfToken;
141
139
  if (csrfToken) config.headers['X-Suda-Csrf-Token'] = csrfToken;
142
140
  return config;
143
141
  }, (error)=>Promise.reject(error));
144
- 'production' !== process.env.NODE_ENV && axiosInstance.interceptors.response.use((response)=>{
142
+ axiosInstance.interceptors.response.use((response)=>{
145
143
  logResponse('success', response);
146
144
  return response;
147
145
  }, (error)=>{
@@ -1,58 +1,6 @@
1
1
  import axios from "axios";
2
2
  import { initAxiosConfig } from "./axiosConfig.js";
3
3
  let axiosInstance;
4
- function showToast(message, duration = 3000) {
5
- return new Promise((resolve)=>{
6
- const toast = document.createElement('div');
7
- const iconSvg = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
8
- <path fill-rule="evenodd" clip-rule="evenodd" d="M8 1.333a6.667 6.667 0 1 1 0 13.334A6.667 6.667 0 0 1 8 1.333ZM8 10a.667.667 0 1 0 0 1.333A.667.667 0 0 0 8 10Zm0-5.333a.667.667 0 0 0-.667.666v3.334a.667.667 0 0 0 1.334 0V5.333A.667.667 0 0 0 8 4.667Z" fill="#ff811a"/>
9
- </svg>`;
10
- const iconWrapper = document.createElement('span');
11
- iconWrapper.innerHTML = iconSvg;
12
- Object.assign(iconWrapper.style, {
13
- display: 'flex',
14
- alignItems: 'center',
15
- marginRight: '8px',
16
- flexShrink: '0'
17
- });
18
- const textWrapper = document.createElement('span');
19
- textWrapper.textContent = message;
20
- toast.appendChild(iconWrapper);
21
- toast.appendChild(textWrapper);
22
- Object.assign(toast.style, {
23
- position: 'fixed',
24
- top: '20%',
25
- left: '50%',
26
- transform: 'translate(-50%, -50%)',
27
- display: 'flex',
28
- alignItems: 'center',
29
- padding: '12px 16px',
30
- backgroundColor: '#fff',
31
- color: '#1f2329',
32
- border: '1px solid #dee0e3',
33
- borderRadius: '6px',
34
- fontSize: '14px',
35
- lineHeight: '1.5',
36
- zIndex: '99999',
37
- maxWidth: '80vw',
38
- wordBreak: 'break-word',
39
- boxShadow: '0 4px 8px rgba(0, 0, 0, 0.03), 0 3px 6px rgba(0, 0, 0, 0.05), 0 6px 18px rgba(0, 0, 0, 0.03)',
40
- opacity: '0',
41
- transition: 'opacity 0.3s ease'
42
- });
43
- document.body.appendChild(toast);
44
- requestAnimationFrame(()=>{
45
- toast.style.opacity = '1';
46
- });
47
- setTimeout(()=>{
48
- toast.style.opacity = '0';
49
- setTimeout(()=>{
50
- document.body.removeChild(toast);
51
- resolve();
52
- }, 300);
53
- }, duration);
54
- });
55
- }
56
4
  function getAxiosForBackend() {
57
5
  if (!axiosInstance) {
58
6
  axiosInstance = axios.create({
@@ -61,9 +9,7 @@ function getAxiosForBackend() {
61
9
  axiosInstance.interceptors.response.use(null, (err)=>{
62
10
  if (err.config.meta?.autoJumpToLogin !== false) {
63
11
  const loginUrl = err.response?.headers?.['x-login-url'];
64
- if (loginUrl) showToast('需要登录后才能执行操作,将自动跳转登录页', 3000).then(()=>{
65
- window.location.href = loginUrl;
66
- });
12
+ if (loginUrl) window.location.href = loginUrl;
67
13
  }
68
14
  return Promise.reject(err);
69
15
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/client-toolkit",
3
- "version": "1.1.36-alpha.0",
3
+ "version": "1.2.0-alpha.2",
4
4
  "types": "./lib/index.d.ts",
5
5
  "main": "./lib/index.js",
6
6
  "files": [
@@ -81,7 +81,8 @@
81
81
  "@ant-design/colors": "^7.2.1",
82
82
  "@ant-design/cssinjs": "^1.24.0",
83
83
  "@data-loom/js": "^0.4.3",
84
- "@lark-apaas/miaoda-inspector": "^1.0.9-alpha.0",
84
+ "@lark-apaas/client-capability": "0.0.1-alpha.1",
85
+ "@lark-apaas/miaoda-inspector": "^1.0.7",
85
86
  "@radix-ui/react-avatar": "^1.1.10",
86
87
  "@radix-ui/react-popover": "^1.1.15",
87
88
  "@radix-ui/react-slot": "^1.2.3",