@lark-apaas/client-toolkit-lite 1.1.8-alpha.2 → 1.1.8-alpha.4

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/dist/index.cjs CHANGED
@@ -76,7 +76,7 @@ __export(index_exports, {
76
76
  module.exports = __toCommonJS(index_exports);
77
77
 
78
78
  // src/components/AppContainer/index.tsx
79
- var import_react10 = __toESM(require("react"), 1);
79
+ var import_react9 = __toESM(require("react"), 1);
80
80
  var import_miaoda_inspector = require("@lark-apaas/miaoda-inspector");
81
81
 
82
82
  // src/runtime/react-devtools-hook.ts
@@ -1355,6 +1355,7 @@ var useAppInfo = /* @__PURE__ */ __name(() => {
1355
1355
 
1356
1356
  // src/hooks/useCurrentUserProfile.tsx
1357
1357
  var import_react2 = require("react");
1358
+ var import_auth_sdk = require("@lark-apaas/auth-sdk");
1358
1359
 
1359
1360
  // src/integrations/getCurrentUserProfile.ts
1360
1361
  function getCurrentUserProfile() {
@@ -1362,69 +1363,6 @@ function getCurrentUserProfile() {
1362
1363
  }
1363
1364
  __name(getCurrentUserProfile, "getCurrentUserProfile");
1364
1365
 
1365
- // src/utils/url.ts
1366
- function splitWorkspaceUrl(fullUrl) {
1367
- try {
1368
- const url = new URL(fullUrl);
1369
- const pathParts = url.pathname.split("/");
1370
- const workspacesIndex = pathParts.findIndex((part) => part === "workspaces");
1371
- if (workspacesIndex === -1) {
1372
- throw new Error("Invalid workspace URL format");
1373
- }
1374
- const basePathParts = pathParts.slice(0, workspacesIndex);
1375
- const workspace = pathParts[workspacesIndex + 1];
1376
- return {
1377
- baseUrl: `${url.origin}${basePathParts.join("/")}`,
1378
- workspace
1379
- };
1380
- } catch (error) {
1381
- console.error("Error splitting workspace URL:", error);
1382
- }
1383
- return {
1384
- baseUrl: fullUrl,
1385
- // 兜底给一个,不要给空字符串,不然 createClient 都直接挂了,页面会白屏,体感不太好
1386
- workspace: "workspace"
1387
- };
1388
- }
1389
- __name(splitWorkspaceUrl, "splitWorkspaceUrl");
1390
-
1391
- // src/integrations/dataloom.ts
1392
- var import_dataloom = require("@lark-apaas/dataloom");
1393
- var createDataLoomClient = /* @__PURE__ */ __name((url, pat) => {
1394
- const { baseUrl } = url ? splitWorkspaceUrl(url) : {
1395
- baseUrl: ""
1396
- };
1397
- const appId = getAppId() ?? "";
1398
- return (0, import_dataloom.createClient)(baseUrl, pat ?? "", {
1399
- global: {
1400
- enableDataloomLog: process.env.NODE_ENV !== "production",
1401
- requestRateLimit: process.env.NODE_ENV !== "production" ? 100 : void 0,
1402
- brandName: "miaoda",
1403
- appId
1404
- }
1405
- });
1406
- }, "createDataLoomClient");
1407
- var dataloom = null;
1408
- var pendingPromise3 = null;
1409
- function getDataloom() {
1410
- if (dataloom) {
1411
- return Promise.resolve(dataloom);
1412
- }
1413
- if (pendingPromise3) {
1414
- return pendingPromise3;
1415
- }
1416
- pendingPromise3 = getInitialInfo().then((info) => {
1417
- const DATALOOM_CLIENT_URL = info?.app_runtime_extra?.url;
1418
- const DATALOOM_PAT = info?.app_runtime_extra?.token;
1419
- dataloom = createDataLoomClient(DATALOOM_CLIENT_URL, DATALOOM_PAT);
1420
- return dataloom;
1421
- }).finally(() => {
1422
- pendingPromise3 = null;
1423
- });
1424
- return pendingPromise3;
1425
- }
1426
- __name(getDataloom, "getDataloom");
1427
-
1428
1366
  // src/hooks/useCurrentUserProfile.tsx
1429
1367
  function getNameFromArray(nameArray) {
1430
1368
  if (!nameArray || nameArray.length === 0) {
@@ -1449,8 +1387,7 @@ var useCurrentUserProfile = /* @__PURE__ */ __name(() => {
1449
1387
  (0, import_react2.useEffect)(() => {
1450
1388
  let cancelled = false;
1451
1389
  const fetchAndSetUserInfo = /* @__PURE__ */ __name(async () => {
1452
- const dataloom2 = await getDataloom();
1453
- const result = await dataloom2?.service?.session?.getUserInfo();
1390
+ const result = await import_auth_sdk.authClient.session.getUserInfo();
1454
1391
  if (cancelled) return;
1455
1392
  const info = result?.data?.user_info;
1456
1393
  const userName = getNameFromArray(info?.name);
@@ -1514,6 +1451,7 @@ __name(useIsMobile, "useIsMobile");
1514
1451
 
1515
1452
  // src/hooks/useLogout.ts
1516
1453
  var import_react4 = require("react");
1454
+ var import_auth_sdk2 = require("@lark-apaas/auth-sdk");
1517
1455
  function useLogout() {
1518
1456
  const [isLoading, setIsLoading] = (0, import_react4.useState)(false);
1519
1457
  async function handlerLogout() {
@@ -1523,8 +1461,7 @@ function useLogout() {
1523
1461
  }
1524
1462
  setIsLoading(true);
1525
1463
  try {
1526
- const dataloom2 = await getDataloom();
1527
- await dataloom2.service.session.signOut();
1464
+ await import_auth_sdk2.authClient.session.signOut();
1528
1465
  } catch (error) {
1529
1466
  console.error("\u767B\u51FA\u5931\u8D25", error);
1530
1467
  } finally {
@@ -2118,112 +2055,8 @@ var Safety = /* @__PURE__ */ __name(() => {
2118
2055
  }, "Safety");
2119
2056
  var safety_default = Safety;
2120
2057
 
2121
- // src/components/AppContainer/Watermark.tsx
2122
- var import_react6 = __toESM(require("react"), 1);
2123
-
2124
- // src/components/AppContainer/doubao-watermark-asset.ts
2125
- var CDN = "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miaoda-ui";
2126
- var DOUBAO_LOGO_SRC = `${CDN}/setting_voice.svg`;
2127
- var DOUBAO_CLOSE_SRC = `${CDN}/icon_close_outlined.svg`;
2128
- var DOUBAO_REPORT_SRC = `${CDN}/%5BDBX%5DDropdown.svg`;
2129
-
2130
- // src/components/AppContainer/Watermark.tsx
2131
- var DOUBAO_SOURCE = "5";
2132
- var Watermark = /* @__PURE__ */ __name(() => {
2133
- const [closed, setClosed] = (0, import_react6.useState)(false);
2134
- const [open, setOpen] = (0, import_react6.useState)(false);
2135
- const timer = (0, import_react6.useRef)(null);
2136
- if (String(process.env.MIAODA_APP_SOURCE) !== DOUBAO_SOURCE) return null;
2137
- if (closed) return null;
2138
- const enter = /* @__PURE__ */ __name(() => {
2139
- if (timer.current) clearTimeout(timer.current);
2140
- setOpen(true);
2141
- }, "enter");
2142
- const leave = /* @__PURE__ */ __name(() => {
2143
- timer.current = setTimeout(() => setOpen(false), 100);
2144
- }, "leave");
2145
- return /* @__PURE__ */ import_react6.default.createElement("div", {
2146
- "data-custom-element": "doubao-watermark",
2147
- onMouseEnter: enter,
2148
- onMouseLeave: leave,
2149
- style: {
2150
- position: "fixed",
2151
- right: 12,
2152
- bottom: 12,
2153
- zIndex: 9999,
2154
- display: "flex",
2155
- flexDirection: "column",
2156
- alignItems: "flex-end"
2157
- }
2158
- }, open && // TODO: 点击跳转「投诉与举报」链接(待产品给链接)
2159
- /* @__PURE__ */ import_react6.default.createElement("img", {
2160
- src: DOUBAO_REPORT_SRC,
2161
- width: 168,
2162
- height: 78,
2163
- alt: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
2164
- style: {
2165
- display: "block",
2166
- cursor: "pointer",
2167
- marginBottom: -8,
2168
- marginRight: -12
2169
- }
2170
- }), /* @__PURE__ */ import_react6.default.createElement("div", {
2171
- style: {
2172
- boxSizing: "border-box",
2173
- display: "inline-flex",
2174
- alignItems: "center",
2175
- gap: 4,
2176
- padding: "6px 12px 6px 8px",
2177
- background: "#363636",
2178
- border: "0.5px solid rgba(255,255,255,0.1)",
2179
- borderRadius: 100,
2180
- boxShadow: "0px 2px 2px rgba(0,0,0,0.02), 0px 4px 8px rgba(0,0,0,0.04), 0px 8px 16px rgba(0,0,0,0.08)"
2181
- }
2182
- }, /* @__PURE__ */ import_react6.default.createElement("img", {
2183
- src: DOUBAO_LOGO_SRC,
2184
- width: 16,
2185
- height: 16,
2186
- alt: "",
2187
- style: {
2188
- borderRadius: 100,
2189
- flexShrink: 0,
2190
- display: "block"
2191
- }
2192
- }), /* @__PURE__ */ import_react6.default.createElement("span", {
2193
- style: {
2194
- fontFamily: "'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif",
2195
- fontSize: 12,
2196
- lineHeight: "18px",
2197
- color: "rgba(255,255,255,0.85)",
2198
- whiteSpace: "nowrap"
2199
- }
2200
- }, "\u7531 \u8C46\u5305AI \u751F\u6210"), /* @__PURE__ */ import_react6.default.createElement("span", {
2201
- role: "button",
2202
- "aria-label": "\u5173\u95ED",
2203
- onClick: /* @__PURE__ */ __name((e) => {
2204
- e.stopPropagation();
2205
- setClosed(true);
2206
- }, "onClick"),
2207
- style: {
2208
- display: "inline-flex",
2209
- alignItems: "center",
2210
- cursor: "pointer",
2211
- flexShrink: 0
2212
- }
2213
- }, /* @__PURE__ */ import_react6.default.createElement("img", {
2214
- src: DOUBAO_CLOSE_SRC,
2215
- width: 10,
2216
- height: 10,
2217
- alt: "",
2218
- style: {
2219
- display: "block"
2220
- }
2221
- }))));
2222
- }, "Watermark");
2223
- var Watermark_default = Watermark;
2224
-
2225
2058
  // src/components/QueryProvider/index.tsx
2226
- var import_react7 = __toESM(require("react"), 1);
2059
+ var import_react6 = __toESM(require("react"), 1);
2227
2060
  var import_react_query = require("@tanstack/react-query");
2228
2061
  var defaultQueryClient = null;
2229
2062
  var getDefaultQueryClient = /* @__PURE__ */ __name(() => {
@@ -2244,20 +2077,20 @@ var getDefaultQueryClient = /* @__PURE__ */ __name(() => {
2244
2077
  }, "getDefaultQueryClient");
2245
2078
  var QueryProvider = /* @__PURE__ */ __name(({ children, client }) => {
2246
2079
  const qc = client ?? getDefaultQueryClient();
2247
- return /* @__PURE__ */ import_react7.default.createElement(import_react_query.QueryClientProvider, {
2080
+ return /* @__PURE__ */ import_react6.default.createElement(import_react_query.QueryClientProvider, {
2248
2081
  client: qc
2249
2082
  }, children);
2250
2083
  }, "QueryProvider");
2251
2084
  var QueryProvider_default = QueryProvider;
2252
2085
 
2253
2086
  // src/components/AppContainer/IframeBridge.tsx
2254
- var import_react9 = require("react");
2087
+ var import_react8 = require("react");
2255
2088
  var import_react_router_dom = require("react-router-dom");
2256
2089
 
2257
2090
  // src/hooks/useUpdatingRef.ts
2258
- var import_react8 = require("react");
2091
+ var import_react7 = require("react");
2259
2092
  function useUpdatingRef(value) {
2260
- const ref = (0, import_react8.useRef)(value);
2093
+ const ref = (0, import_react7.useRef)(value);
2261
2094
  ref.current = value;
2262
2095
  return ref;
2263
2096
  }
@@ -2278,20 +2111,20 @@ function IframeBridge() {
2278
2111
  const location = (0, import_react_router_dom.useLocation)();
2279
2112
  const navigate = (0, import_react_router_dom.useNavigate)();
2280
2113
  const navigateRef = useUpdatingRef(navigate);
2281
- const isActive = (0, import_react9.useRef)(false);
2282
- const historyBack = (0, import_react9.useCallback)((_payload) => {
2114
+ const isActive = (0, import_react8.useRef)(false);
2115
+ const historyBack = (0, import_react8.useCallback)((_payload) => {
2283
2116
  navigateRef.current(-1);
2284
2117
  isActive.current = true;
2285
2118
  }, [
2286
2119
  navigateRef
2287
2120
  ]);
2288
- const historyForward = (0, import_react9.useCallback)((_payload) => {
2121
+ const historyForward = (0, import_react8.useCallback)((_payload) => {
2289
2122
  navigateRef.current(1);
2290
2123
  isActive.current = true;
2291
2124
  }, [
2292
2125
  navigateRef
2293
2126
  ]);
2294
- const operatorMessage = (0, import_react9.useMemo)(() => ({
2127
+ const operatorMessage = (0, import_react8.useMemo)(() => ({
2295
2128
  ["RouteBack"]: historyBack,
2296
2129
  ["RouteForward"]: historyForward,
2297
2130
  ["RouteChange"]: navigateRef.current
@@ -2300,7 +2133,7 @@ function IframeBridge() {
2300
2133
  historyForward,
2301
2134
  navigateRef
2302
2135
  ]);
2303
- (0, import_react9.useEffect)(() => {
2136
+ (0, import_react8.useEffect)(() => {
2304
2137
  if (isActive.current) {
2305
2138
  isActive.current = false;
2306
2139
  return;
@@ -2312,7 +2145,7 @@ function IframeBridge() {
2312
2145
  }, [
2313
2146
  location
2314
2147
  ]);
2315
- const handleMessage = (0, import_react9.useCallback)((event) => {
2148
+ const handleMessage = (0, import_react8.useCallback)((event) => {
2316
2149
  const data = event.data ?? {};
2317
2150
  if (typeof data.type === "string" && isRouteMessageType(data.type)) {
2318
2151
  operatorMessage[data.type](data.data);
@@ -2320,7 +2153,7 @@ function IframeBridge() {
2320
2153
  }, [
2321
2154
  operatorMessage
2322
2155
  ]);
2323
- (0, import_react9.useEffect)(() => {
2156
+ (0, import_react8.useEffect)(() => {
2324
2157
  window.addEventListener("message", handleMessage);
2325
2158
  return () => {
2326
2159
  window.removeEventListener("message", handleMessage);
@@ -2328,7 +2161,7 @@ function IframeBridge() {
2328
2161
  }, [
2329
2162
  handleMessage
2330
2163
  ]);
2331
- return /* @__PURE__ */ (0, import_react9.createElement)("div", {
2164
+ return /* @__PURE__ */ (0, import_react8.createElement)("div", {
2332
2165
  style: {
2333
2166
  display: "none"
2334
2167
  }
@@ -2456,7 +2289,7 @@ var TrackKey = /* @__PURE__ */ (function(TrackKey2) {
2456
2289
  // src/components/AppContainer/index.tsx
2457
2290
  var AppContainer = /* @__PURE__ */ __name(({ children }) => {
2458
2291
  useAppInfo();
2459
- (0, import_react10.useEffect)(() => {
2292
+ (0, import_react9.useEffect)(() => {
2460
2293
  if (process.env.NODE_ENV === "production") {
2461
2294
  reportTeaEvent({
2462
2295
  trackKey: TrackKey.VIEW,
@@ -2468,14 +2301,14 @@ var AppContainer = /* @__PURE__ */ __name(({ children }) => {
2468
2301
  });
2469
2302
  }
2470
2303
  }, []);
2471
- return /* @__PURE__ */ import_react10.default.createElement(import_react10.default.Fragment, null, String(process.env.MIAODA_APP_TYPE) !== "7" && /* @__PURE__ */ import_react10.default.createElement(safety_default, null), process.env.NODE_ENV !== "production" && /* @__PURE__ */ import_react10.default.createElement(import_miaoda_inspector.MiaodaInspector, null), process.env.NODE_ENV !== "production" && /* @__PURE__ */ import_react10.default.createElement(IframeBridge, null), /* @__PURE__ */ import_react10.default.createElement(safety_default, null), /* @__PURE__ */ import_react10.default.createElement(Watermark_default, null), /* @__PURE__ */ import_react10.default.createElement(QueryProvider_default, null, children));
2304
+ return /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, null, String(process.env.MIAODA_APP_TYPE) !== "7" && /* @__PURE__ */ import_react9.default.createElement(safety_default, null), process.env.NODE_ENV !== "production" && /* @__PURE__ */ import_react9.default.createElement(import_miaoda_inspector.MiaodaInspector, null), process.env.NODE_ENV !== "production" && /* @__PURE__ */ import_react9.default.createElement(IframeBridge, null), /* @__PURE__ */ import_react9.default.createElement(QueryProvider_default, null, children));
2472
2305
  }, "AppContainer");
2473
2306
  var AppContainer_default = AppContainer;
2474
2307
 
2475
2308
  // src/components/Welcome/index.tsx
2476
- var import_react11 = __toESM(require("react"), 1);
2309
+ var import_react10 = __toESM(require("react"), 1);
2477
2310
  var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1", description = "\u9875\u9762\u6682\u672A\u5F00\u53D1\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85..." }) => {
2478
- return /* @__PURE__ */ import_react11.default.createElement("div", {
2311
+ return /* @__PURE__ */ import_react10.default.createElement("div", {
2479
2312
  style: {
2480
2313
  display: "flex",
2481
2314
  flexDirection: "column",
@@ -2486,7 +2319,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
2486
2319
  padding: "0 24px",
2487
2320
  textAlign: "center"
2488
2321
  }
2489
- }, /* @__PURE__ */ import_react11.default.createElement("img", {
2322
+ }, /* @__PURE__ */ import_react10.default.createElement("img", {
2490
2323
  style: {
2491
2324
  borderRadius: 6,
2492
2325
  marginBottom: 24
@@ -2495,7 +2328,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
2495
2328
  height: "200",
2496
2329
  src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miao/welcome.svg",
2497
2330
  alt: "Welcome"
2498
- }), /* @__PURE__ */ import_react11.default.createElement("div", {
2331
+ }), /* @__PURE__ */ import_react10.default.createElement("div", {
2499
2332
  style: {
2500
2333
  fontSize: 16,
2501
2334
  fontWeight: 500,
@@ -2503,7 +2336,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
2503
2336
  marginBottom: 4,
2504
2337
  color: "#1f2329"
2505
2338
  }
2506
- }, title), /* @__PURE__ */ import_react11.default.createElement("div", {
2339
+ }, title), /* @__PURE__ */ import_react10.default.createElement("div", {
2507
2340
  style: {
2508
2341
  fontSize: 16,
2509
2342
  lineHeight: "24px",
@@ -2515,9 +2348,9 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
2515
2348
  var Welcome_default = Welcome;
2516
2349
 
2517
2350
  // src/components/PagePlaceholder/index.tsx
2518
- var import_react12 = __toESM(require("react"), 1);
2351
+ var import_react11 = __toESM(require("react"), 1);
2519
2352
  var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1", description = "\u9875\u9762\u6682\u672A\u5F00\u53D1\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85..." }) => {
2520
- return /* @__PURE__ */ import_react12.default.createElement("div", {
2353
+ return /* @__PURE__ */ import_react11.default.createElement("div", {
2521
2354
  style: {
2522
2355
  display: "flex",
2523
2356
  flexDirection: "column",
@@ -2528,7 +2361,7 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
2528
2361
  height: "calc(100vh - 64px)",
2529
2362
  textAlign: "center"
2530
2363
  }
2531
- }, /* @__PURE__ */ import_react12.default.createElement("img", {
2364
+ }, /* @__PURE__ */ import_react11.default.createElement("img", {
2532
2365
  style: {
2533
2366
  borderRadius: "6px",
2534
2367
  marginBottom: "24px"
@@ -2537,14 +2370,14 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
2537
2370
  height: "200",
2538
2371
  src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miao/welcome.svg",
2539
2372
  alt: "Welcome"
2540
- }), /* @__PURE__ */ import_react12.default.createElement("div", {
2373
+ }), /* @__PURE__ */ import_react11.default.createElement("div", {
2541
2374
  style: {
2542
2375
  fontSize: "16px",
2543
2376
  fontWeight: 500,
2544
2377
  marginBottom: "4px",
2545
2378
  lineHeight: "24px"
2546
2379
  }
2547
- }, title), /* @__PURE__ */ import_react12.default.createElement("div", {
2380
+ }, title), /* @__PURE__ */ import_react11.default.createElement("div", {
2548
2381
  style: {
2549
2382
  color: "#6b7280",
2550
2383
  fontSize: "16px",
@@ -2560,10 +2393,10 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
2560
2393
  var PagePlaceholder_default = PagePlaceholder;
2561
2394
 
2562
2395
  // src/components/ErrorRender/index.tsx
2563
- var import_react13 = __toESM(require("react"), 1);
2396
+ var import_react12 = __toESM(require("react"), 1);
2564
2397
  var ErrorRender = /* @__PURE__ */ __name((props) => {
2565
2398
  const { error, resetErrorBoundary } = props;
2566
- (0, import_react13.useEffect)(() => {
2399
+ (0, import_react12.useEffect)(() => {
2567
2400
  if (error) {
2568
2401
  submitPostMessage({
2569
2402
  type: "RenderError",
@@ -2584,7 +2417,7 @@ var ErrorRender = /* @__PURE__ */ __name((props) => {
2584
2417
  }, [
2585
2418
  error
2586
2419
  ]);
2587
- (0, import_react13.useEffect)(() => {
2420
+ (0, import_react12.useEffect)(() => {
2588
2421
  if (!resetErrorBoundary) return;
2589
2422
  const hmr = getHmrApi();
2590
2423
  if (!hmr) return;
@@ -2599,27 +2432,27 @@ var ErrorRender = /* @__PURE__ */ __name((props) => {
2599
2432
  }, [
2600
2433
  resetErrorBoundary
2601
2434
  ]);
2602
- return /* @__PURE__ */ import_react13.default.createElement("div", {
2435
+ return /* @__PURE__ */ import_react12.default.createElement("div", {
2603
2436
  className: "min-h-screen flex items-center justify-center bg-white"
2604
- }, /* @__PURE__ */ import_react13.default.createElement("div", {
2437
+ }, /* @__PURE__ */ import_react12.default.createElement("div", {
2605
2438
  className: "flex flex-col justify-center items-center text-center"
2606
- }, /* @__PURE__ */ import_react13.default.createElement("img", {
2439
+ }, /* @__PURE__ */ import_react12.default.createElement("img", {
2607
2440
  src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/illustration_empty_negative_error.svg",
2608
2441
  alt: "render error",
2609
2442
  className: "mb-3 w-[100px]"
2610
- }), /* @__PURE__ */ import_react13.default.createElement("p", {
2443
+ }), /* @__PURE__ */ import_react12.default.createElement("p", {
2611
2444
  className: "text-l/[22px] text-[14px] text-[#1F2329] font-medium"
2612
2445
  }, "\u9875\u9762\u51FA\u9519\u4E86")));
2613
2446
  }, "ErrorRender");
2614
2447
  var ErrorRender_default = ErrorRender;
2615
2448
 
2616
2449
  // src/route-components/ActiveLink.tsx
2617
- var import_react14 = __toESM(require("react"), 1);
2450
+ var import_react13 = __toESM(require("react"), 1);
2618
2451
  var import_react_router_dom2 = require("react-router-dom");
2619
- var ActiveLink = /* @__PURE__ */ (0, import_react14.forwardRef)(({ to, onClick, className, style, children, ...rest }, ref) => {
2620
- const [currentHash, setCurrentHash] = (0, import_react14.useState)(() => typeof window !== "undefined" ? window.location.hash : "");
2452
+ var ActiveLink = /* @__PURE__ */ (0, import_react13.forwardRef)(({ to, onClick, className, style, children, ...rest }, ref) => {
2453
+ const [currentHash, setCurrentHash] = (0, import_react13.useState)(() => typeof window !== "undefined" ? window.location.hash : "");
2621
2454
  const isHashRoute = typeof to === "string" && to.startsWith("#");
2622
- (0, import_react14.useEffect)(() => {
2455
+ (0, import_react13.useEffect)(() => {
2623
2456
  if (!isHashRoute) return;
2624
2457
  const handleHashChange = /* @__PURE__ */ __name(() => {
2625
2458
  setCurrentHash(window.location.hash);
@@ -2631,7 +2464,7 @@ var ActiveLink = /* @__PURE__ */ (0, import_react14.forwardRef)(({ to, onClick,
2631
2464
  ]);
2632
2465
  const isActive = isHashRoute && currentHash === to;
2633
2466
  if (!isHashRoute) {
2634
- return /* @__PURE__ */ import_react14.default.createElement(import_react_router_dom2.NavLink, {
2467
+ return /* @__PURE__ */ import_react13.default.createElement(import_react_router_dom2.NavLink, {
2635
2468
  ref,
2636
2469
  to,
2637
2470
  onClick,
@@ -2672,7 +2505,7 @@ var ActiveLink = /* @__PURE__ */ (0, import_react14.forwardRef)(({ to, onClick,
2672
2505
  isPending: false,
2673
2506
  isTransitioning: false
2674
2507
  }) : children;
2675
- return /* @__PURE__ */ import_react14.default.createElement("a", {
2508
+ return /* @__PURE__ */ import_react13.default.createElement("a", {
2676
2509
  ref,
2677
2510
  href: to,
2678
2511
  onClick: handleHashClick,
@@ -2684,9 +2517,9 @@ var ActiveLink = /* @__PURE__ */ (0, import_react14.forwardRef)(({ to, onClick,
2684
2517
  ActiveLink.displayName = "ActiveLink";
2685
2518
 
2686
2519
  // src/route-components/NavLink.tsx
2687
- var React10 = __toESM(require("react"), 1);
2520
+ var React9 = __toESM(require("react"), 1);
2688
2521
  var import_react_router_dom3 = require("react-router-dom");
2689
- var NavLink2 = /* @__PURE__ */ React10.forwardRef(({ to, children, className, style, ...props }, ref) => {
2522
+ var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, style, ...props }, ref) => {
2690
2523
  const isHashLink = typeof to === "string" && to.startsWith("#");
2691
2524
  const location = (0, import_react_router_dom3.useLocation)();
2692
2525
  const navigate = (0, import_react_router_dom3.useNavigate)();
@@ -2710,7 +2543,7 @@ var NavLink2 = /* @__PURE__ */ React10.forwardRef(({ to, children, className, st
2710
2543
  const resolvedClassName = typeof className === "function" ? className(renderProps) : className;
2711
2544
  const resolvedStyle = typeof style === "function" ? style(renderProps) : style;
2712
2545
  const { caseSensitive, end, replace, state, preventScrollReset, relative, viewTransition, ...restProps } = props;
2713
- return /* @__PURE__ */ React10.createElement("a", {
2546
+ return /* @__PURE__ */ React9.createElement("a", {
2714
2547
  href: to,
2715
2548
  onClick: handleClick,
2716
2549
  ref,
@@ -2719,7 +2552,7 @@ var NavLink2 = /* @__PURE__ */ React10.forwardRef(({ to, children, className, st
2719
2552
  ...restProps
2720
2553
  }, typeof children === "function" ? children(renderProps) : children);
2721
2554
  }
2722
- return /* @__PURE__ */ React10.createElement(import_react_router_dom3.NavLink, {
2555
+ return /* @__PURE__ */ React9.createElement(import_react_router_dom3.NavLink, {
2723
2556
  to,
2724
2557
  ref,
2725
2558
  className,
@@ -2734,7 +2567,7 @@ var NavLink2 = /* @__PURE__ */ React10.forwardRef(({ to, children, className, st
2734
2567
  NavLink2.displayName = "NavLink";
2735
2568
 
2736
2569
  // src/route-components/UniversalLink.tsx
2737
- var import_react15 = __toESM(require("react"), 1);
2570
+ var import_react14 = __toESM(require("react"), 1);
2738
2571
  var import_react_router_dom4 = require("react-router-dom");
2739
2572
  function isInternalRoute(to) {
2740
2573
  return !to.startsWith("#") && !to.startsWith("http://") && !to.startsWith("https://") && !to.startsWith("//");
@@ -2744,15 +2577,15 @@ function isExternalLink(to) {
2744
2577
  return to.startsWith("http://") || to.startsWith("https://") || to.startsWith("//");
2745
2578
  }
2746
2579
  __name(isExternalLink, "isExternalLink");
2747
- var UniversalLink = /* @__PURE__ */ import_react15.default.forwardRef(/* @__PURE__ */ __name(function UniversalLink2({ to, ...props }, ref) {
2580
+ var UniversalLink = /* @__PURE__ */ import_react14.default.forwardRef(/* @__PURE__ */ __name(function UniversalLink2({ to, ...props }, ref) {
2748
2581
  if (isInternalRoute(to)) {
2749
- return /* @__PURE__ */ import_react15.default.createElement(import_react_router_dom4.Link, {
2582
+ return /* @__PURE__ */ import_react14.default.createElement(import_react_router_dom4.Link, {
2750
2583
  to,
2751
2584
  ref,
2752
2585
  ...props
2753
2586
  });
2754
2587
  }
2755
- return /* @__PURE__ */ import_react15.default.createElement("a", {
2588
+ return /* @__PURE__ */ import_react14.default.createElement("a", {
2756
2589
  href: to,
2757
2590
  ref,
2758
2591
  ...props,
@@ -2977,6 +2810,74 @@ function getAxiosForBackend() {
2977
2810
  __name(getAxiosForBackend, "getAxiosForBackend");
2978
2811
  var axiosForBackend = getAxiosForBackend();
2979
2812
 
2813
+ // src/utils/url.ts
2814
+ function splitWorkspaceUrl(fullUrl) {
2815
+ try {
2816
+ const url = new URL(fullUrl);
2817
+ const pathParts = url.pathname.split("/");
2818
+ const workspacesIndex = pathParts.findIndex((part) => part === "workspaces");
2819
+ if (workspacesIndex === -1) {
2820
+ throw new Error("Invalid workspace URL format");
2821
+ }
2822
+ const basePathParts = pathParts.slice(0, workspacesIndex);
2823
+ const workspace = pathParts[workspacesIndex + 1];
2824
+ return {
2825
+ baseUrl: `${url.origin}${basePathParts.join("/")}`,
2826
+ workspace
2827
+ };
2828
+ } catch (error) {
2829
+ console.error("Error splitting workspace URL:", error);
2830
+ }
2831
+ return {
2832
+ baseUrl: fullUrl,
2833
+ // 兜底给一个,不要给空字符串,不然 createClient 都直接挂了,页面会白屏,体感不太好
2834
+ workspace: "workspace"
2835
+ };
2836
+ }
2837
+ __name(splitWorkspaceUrl, "splitWorkspaceUrl");
2838
+
2839
+ // src/integrations/dataloom.ts
2840
+ var import_dataloom = require("@lark-apaas/dataloom");
2841
+ var import_auth_sdk3 = require("@lark-apaas/auth-sdk");
2842
+ var createDataLoomClient = /* @__PURE__ */ __name((url, pat) => {
2843
+ const { baseUrl } = url ? splitWorkspaceUrl(url) : {
2844
+ baseUrl: ""
2845
+ };
2846
+ const appId = getAppId() ?? "";
2847
+ return (0, import_dataloom.createClient)(baseUrl, pat ?? "", {
2848
+ global: {
2849
+ enableDataloomLog: process.env.NODE_ENV !== "production",
2850
+ requestRateLimit: process.env.NODE_ENV !== "production" ? 100 : void 0,
2851
+ brandName: "miaoda",
2852
+ appId,
2853
+ accountServices: {
2854
+ user: import_auth_sdk3.authClient.user,
2855
+ session: import_auth_sdk3.authClient.session
2856
+ }
2857
+ }
2858
+ });
2859
+ }, "createDataLoomClient");
2860
+ var dataloom = null;
2861
+ var pendingPromise3 = null;
2862
+ function getDataloom() {
2863
+ if (dataloom) {
2864
+ return Promise.resolve(dataloom);
2865
+ }
2866
+ if (pendingPromise3) {
2867
+ return pendingPromise3;
2868
+ }
2869
+ pendingPromise3 = getInitialInfo().then((info) => {
2870
+ const DATALOOM_CLIENT_URL = info?.app_runtime_extra?.url;
2871
+ const DATALOOM_PAT = info?.app_runtime_extra?.token;
2872
+ dataloom = createDataLoomClient(DATALOOM_CLIENT_URL, DATALOOM_PAT);
2873
+ return dataloom;
2874
+ }).finally(() => {
2875
+ pendingPromise3 = null;
2876
+ });
2877
+ return pendingPromise3;
2878
+ }
2879
+ __name(getDataloom, "getDataloom");
2880
+
2980
2881
  // src/integrations/capabilityClient.ts
2981
2882
  var import_client_capability = require("@lark-apaas/client-capability");
2982
2883