@lark-apaas/client-toolkit-lite 1.1.10-alpha.0 → 1.1.10-alpha.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.
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_react9 = __toESM(require("react"), 1);
79
+ var import_react10 = __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
@@ -2059,8 +2059,220 @@ var Safety = /* @__PURE__ */ __name(() => {
2059
2059
  }, "Safety");
2060
2060
  var safety_default = Safety;
2061
2061
 
2062
- // src/components/QueryProvider/index.tsx
2062
+ // src/components/AppContainer/Watermark.tsx
2063
2063
  var import_react6 = __toESM(require("react"), 1);
2064
+ var PopoverPrimitive2 = __toESM(require("@radix-ui/react-popover"), 1);
2065
+
2066
+ // src/components/AppContainer/doubao-watermark-asset.ts
2067
+ var CDN = "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miaoda-ui";
2068
+ var DOUBAO_LOGO_SRC = `${CDN}/setting_voice.svg`;
2069
+ var DOUBAO_CLOSE_SRC = `${CDN}/icon_close_outlined.svg`;
2070
+ var DOUBAO_REPORT_SRC = `${CDN}/%5BDBX%5DDropdown.svg`;
2071
+ var DOUBAO_PILL_MOBILE_SRC = `${CDN}/Frame%202147223991%20(4).svg`;
2072
+ var DOUBAO_REPORT_ITEM_SRC = `${CDN}/_Dropdown-item.svg`;
2073
+ var DOUBAO_DONTSHOW_ITEM_SRC = `${CDN}/_Dropdown-item%20(1).svg`;
2074
+
2075
+ // src/components/AppContainer/Watermark.tsx
2076
+ var DOUBAO_SOURCE = "5";
2077
+ var REPORT_ENABLED = false;
2078
+ var REPORT_DOMAIN = {
2079
+ staging: "tns.feishu-boe.cn",
2080
+ gray: "tns.feishu-pre.cn",
2081
+ online: "tns.feishu.cn"
2082
+ };
2083
+ var openDoubaoReport = /* @__PURE__ */ __name(() => {
2084
+ const params = JSON.stringify({
2085
+ scene: "miaoda_app_report",
2086
+ entity_id: getAppId() ?? "",
2087
+ entity_type: "miaoda_app",
2088
+ extra: ""
2089
+ });
2090
+ const url = `https://${REPORT_DOMAIN[window.ENVIRONMENT]}/cust/lark_report/?type=common&params=${encodeURIComponent(params)}&lang=zh-CN`;
2091
+ window.open(url, "_blank", "noopener,noreferrer");
2092
+ }, "openDoubaoReport");
2093
+ var mobilePillWrapper = {
2094
+ position: "fixed",
2095
+ right: 12,
2096
+ bottom: 12,
2097
+ width: 85,
2098
+ height: 30,
2099
+ zIndex: 9999,
2100
+ cursor: "pointer"
2101
+ };
2102
+ var mobilePillImg = {
2103
+ position: "absolute",
2104
+ right: -12,
2105
+ bottom: -40,
2106
+ width: 129,
2107
+ height: 94,
2108
+ // 钉死尺寸:宿主页常带 Tailwind preflight 的 `img{max-width:100%;height:auto}`,
2109
+ // 会把这张 129x94 的图压进 85x30 包裹层导致缩水变形 + 负偏移对齐错位。
2110
+ // 内联 style 特异度高于 element 选择器,可盖过 preflight。
2111
+ maxWidth: "none",
2112
+ maxHeight: "none",
2113
+ display: "block",
2114
+ pointerEvents: "none"
2115
+ };
2116
+ var mobileMenu = {
2117
+ display: "flex",
2118
+ flexDirection: "column",
2119
+ background: "#fff",
2120
+ borderRadius: 12,
2121
+ padding: 4,
2122
+ boxShadow: "0px 6px 16px rgba(0,0,0,0.12)",
2123
+ zIndex: 1e4,
2124
+ // radix Content 打开时获取焦点,去掉浏览器默认 focus 描边(同 Safety sheetContent)
2125
+ outline: "none"
2126
+ };
2127
+ var mobileMenuItem = {
2128
+ display: "block",
2129
+ // 同药丸:钉死尺寸盖过宿主 Tailwind preflight 的 img{max-width:100%;height:auto}
2130
+ width: 132,
2131
+ height: 38,
2132
+ maxWidth: "none",
2133
+ maxHeight: "none",
2134
+ cursor: "pointer"
2135
+ };
2136
+ var MobileWatermark = /* @__PURE__ */ __name(({ onDontShow }) => {
2137
+ const [open, setOpen] = (0, import_react6.useState)(false);
2138
+ return /* @__PURE__ */ import_react6.default.createElement(PopoverPrimitive2.Root, {
2139
+ open,
2140
+ onOpenChange: setOpen
2141
+ }, /* @__PURE__ */ import_react6.default.createElement(PopoverPrimitive2.Trigger, {
2142
+ asChild: true
2143
+ }, /* @__PURE__ */ import_react6.default.createElement("div", {
2144
+ "data-custom-element": "doubao-watermark-mobile",
2145
+ style: mobilePillWrapper
2146
+ }, /* @__PURE__ */ import_react6.default.createElement("img", {
2147
+ src: DOUBAO_PILL_MOBILE_SRC,
2148
+ width: 129,
2149
+ height: 94,
2150
+ alt: "\u8C46\u5305 AI \u751F\u6210",
2151
+ style: mobilePillImg
2152
+ }))), /* @__PURE__ */ import_react6.default.createElement(PopoverPrimitive2.Portal, null, /* @__PURE__ */ import_react6.default.createElement(PopoverPrimitive2.Content, {
2153
+ side: "top",
2154
+ align: "end",
2155
+ sideOffset: 8,
2156
+ style: mobileMenu
2157
+ }, /* @__PURE__ */ import_react6.default.createElement("img", {
2158
+ src: DOUBAO_REPORT_ITEM_SRC,
2159
+ width: 132,
2160
+ height: 38,
2161
+ alt: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
2162
+ style: mobileMenuItem
2163
+ }), /* @__PURE__ */ import_react6.default.createElement("img", {
2164
+ src: DOUBAO_DONTSHOW_ITEM_SRC,
2165
+ width: 132,
2166
+ height: 38,
2167
+ alt: "\u4E0D\u518D\u5C55\u793A",
2168
+ style: mobileMenuItem,
2169
+ onClick: /* @__PURE__ */ __name(() => {
2170
+ setOpen(false);
2171
+ onDontShow();
2172
+ }, "onClick")
2173
+ }))));
2174
+ }, "MobileWatermark");
2175
+ var Watermark = /* @__PURE__ */ __name(() => {
2176
+ const [closed, setClosed] = (0, import_react6.useState)(false);
2177
+ const [open, setOpen] = (0, import_react6.useState)(false);
2178
+ const timer = (0, import_react6.useRef)(null);
2179
+ const isMobile2 = useIsMobile();
2180
+ if (String(process.env.MIAODA_APP_SOURCE) !== DOUBAO_SOURCE) return null;
2181
+ if (closed) return null;
2182
+ if (isMobile2) {
2183
+ return /* @__PURE__ */ import_react6.default.createElement(MobileWatermark, {
2184
+ onDontShow: /* @__PURE__ */ __name(() => setClosed(true), "onDontShow")
2185
+ });
2186
+ }
2187
+ const enter = /* @__PURE__ */ __name(() => {
2188
+ if (timer.current) clearTimeout(timer.current);
2189
+ setOpen(true);
2190
+ }, "enter");
2191
+ const leave = /* @__PURE__ */ __name(() => {
2192
+ timer.current = setTimeout(() => setOpen(false), 100);
2193
+ }, "leave");
2194
+ return /* @__PURE__ */ import_react6.default.createElement("div", {
2195
+ "data-custom-element": "doubao-watermark",
2196
+ onMouseEnter: enter,
2197
+ onMouseLeave: leave,
2198
+ style: {
2199
+ position: "fixed",
2200
+ right: 12,
2201
+ bottom: 12,
2202
+ zIndex: 9999,
2203
+ display: "flex",
2204
+ flexDirection: "column",
2205
+ alignItems: "flex-end"
2206
+ }
2207
+ }, REPORT_ENABLED && open && /* @__PURE__ */ import_react6.default.createElement("img", {
2208
+ src: DOUBAO_REPORT_SRC,
2209
+ width: 168,
2210
+ height: 78,
2211
+ alt: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
2212
+ onClick: openDoubaoReport,
2213
+ style: {
2214
+ display: "block",
2215
+ cursor: "pointer",
2216
+ marginBottom: -8,
2217
+ marginRight: -12
2218
+ }
2219
+ }), /* @__PURE__ */ import_react6.default.createElement("div", {
2220
+ style: {
2221
+ boxSizing: "border-box",
2222
+ display: "inline-flex",
2223
+ alignItems: "center",
2224
+ gap: 4,
2225
+ padding: "6px 12px 6px 8px",
2226
+ background: "#363636",
2227
+ border: "0.5px solid rgba(255,255,255,0.1)",
2228
+ borderRadius: 100,
2229
+ 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)"
2230
+ }
2231
+ }, /* @__PURE__ */ import_react6.default.createElement("img", {
2232
+ src: DOUBAO_LOGO_SRC,
2233
+ width: 16,
2234
+ height: 16,
2235
+ alt: "",
2236
+ style: {
2237
+ borderRadius: 100,
2238
+ flexShrink: 0,
2239
+ display: "block"
2240
+ }
2241
+ }), /* @__PURE__ */ import_react6.default.createElement("span", {
2242
+ style: {
2243
+ fontFamily: "'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif",
2244
+ fontSize: 12,
2245
+ lineHeight: "18px",
2246
+ color: "rgba(255,255,255,0.85)",
2247
+ whiteSpace: "nowrap"
2248
+ }
2249
+ }, "\u7531 \u8C46\u5305AI \u751F\u6210"), /* @__PURE__ */ import_react6.default.createElement("span", {
2250
+ role: "button",
2251
+ "aria-label": "\u5173\u95ED",
2252
+ onClick: /* @__PURE__ */ __name((e) => {
2253
+ e.stopPropagation();
2254
+ setClosed(true);
2255
+ }, "onClick"),
2256
+ style: {
2257
+ display: "inline-flex",
2258
+ alignItems: "center",
2259
+ cursor: "pointer",
2260
+ flexShrink: 0
2261
+ }
2262
+ }, /* @__PURE__ */ import_react6.default.createElement("img", {
2263
+ src: DOUBAO_CLOSE_SRC,
2264
+ width: 10,
2265
+ height: 10,
2266
+ alt: "",
2267
+ style: {
2268
+ display: "block"
2269
+ }
2270
+ }))));
2271
+ }, "Watermark");
2272
+ var Watermark_default = Watermark;
2273
+
2274
+ // src/components/QueryProvider/index.tsx
2275
+ var import_react7 = __toESM(require("react"), 1);
2064
2276
  var import_react_query = require("@tanstack/react-query");
2065
2277
  var defaultQueryClient = null;
2066
2278
  var getDefaultQueryClient = /* @__PURE__ */ __name(() => {
@@ -2081,20 +2293,20 @@ var getDefaultQueryClient = /* @__PURE__ */ __name(() => {
2081
2293
  }, "getDefaultQueryClient");
2082
2294
  var QueryProvider = /* @__PURE__ */ __name(({ children, client }) => {
2083
2295
  const qc = client ?? getDefaultQueryClient();
2084
- return /* @__PURE__ */ import_react6.default.createElement(import_react_query.QueryClientProvider, {
2296
+ return /* @__PURE__ */ import_react7.default.createElement(import_react_query.QueryClientProvider, {
2085
2297
  client: qc
2086
2298
  }, children);
2087
2299
  }, "QueryProvider");
2088
2300
  var QueryProvider_default = QueryProvider;
2089
2301
 
2090
2302
  // src/components/AppContainer/IframeBridge.tsx
2091
- var import_react8 = require("react");
2303
+ var import_react9 = require("react");
2092
2304
  var import_react_router_dom = require("react-router-dom");
2093
2305
 
2094
2306
  // src/hooks/useUpdatingRef.ts
2095
- var import_react7 = require("react");
2307
+ var import_react8 = require("react");
2096
2308
  function useUpdatingRef(value) {
2097
- const ref = (0, import_react7.useRef)(value);
2309
+ const ref = (0, import_react8.useRef)(value);
2098
2310
  ref.current = value;
2099
2311
  return ref;
2100
2312
  }
@@ -2115,20 +2327,20 @@ function IframeBridge() {
2115
2327
  const location = (0, import_react_router_dom.useLocation)();
2116
2328
  const navigate = (0, import_react_router_dom.useNavigate)();
2117
2329
  const navigateRef = useUpdatingRef(navigate);
2118
- const isActive = (0, import_react8.useRef)(false);
2119
- const historyBack = (0, import_react8.useCallback)((_payload) => {
2330
+ const isActive = (0, import_react9.useRef)(false);
2331
+ const historyBack = (0, import_react9.useCallback)((_payload) => {
2120
2332
  navigateRef.current(-1);
2121
2333
  isActive.current = true;
2122
2334
  }, [
2123
2335
  navigateRef
2124
2336
  ]);
2125
- const historyForward = (0, import_react8.useCallback)((_payload) => {
2337
+ const historyForward = (0, import_react9.useCallback)((_payload) => {
2126
2338
  navigateRef.current(1);
2127
2339
  isActive.current = true;
2128
2340
  }, [
2129
2341
  navigateRef
2130
2342
  ]);
2131
- const operatorMessage = (0, import_react8.useMemo)(() => ({
2343
+ const operatorMessage = (0, import_react9.useMemo)(() => ({
2132
2344
  ["RouteBack"]: historyBack,
2133
2345
  ["RouteForward"]: historyForward,
2134
2346
  ["RouteChange"]: navigateRef.current
@@ -2137,7 +2349,7 @@ function IframeBridge() {
2137
2349
  historyForward,
2138
2350
  navigateRef
2139
2351
  ]);
2140
- (0, import_react8.useEffect)(() => {
2352
+ (0, import_react9.useEffect)(() => {
2141
2353
  if (isActive.current) {
2142
2354
  isActive.current = false;
2143
2355
  return;
@@ -2149,7 +2361,7 @@ function IframeBridge() {
2149
2361
  }, [
2150
2362
  location
2151
2363
  ]);
2152
- const handleMessage = (0, import_react8.useCallback)((event) => {
2364
+ const handleMessage = (0, import_react9.useCallback)((event) => {
2153
2365
  const data = event.data ?? {};
2154
2366
  if (typeof data.type === "string" && isRouteMessageType(data.type)) {
2155
2367
  operatorMessage[data.type](data.data);
@@ -2157,7 +2369,7 @@ function IframeBridge() {
2157
2369
  }, [
2158
2370
  operatorMessage
2159
2371
  ]);
2160
- (0, import_react8.useEffect)(() => {
2372
+ (0, import_react9.useEffect)(() => {
2161
2373
  window.addEventListener("message", handleMessage);
2162
2374
  return () => {
2163
2375
  window.removeEventListener("message", handleMessage);
@@ -2165,7 +2377,7 @@ function IframeBridge() {
2165
2377
  }, [
2166
2378
  handleMessage
2167
2379
  ]);
2168
- return /* @__PURE__ */ (0, import_react8.createElement)("div", {
2380
+ return /* @__PURE__ */ (0, import_react9.createElement)("div", {
2169
2381
  style: {
2170
2382
  display: "none"
2171
2383
  }
@@ -2293,7 +2505,7 @@ var TrackKey = /* @__PURE__ */ (function(TrackKey2) {
2293
2505
  // src/components/AppContainer/index.tsx
2294
2506
  var AppContainer = /* @__PURE__ */ __name(({ children }) => {
2295
2507
  useAppInfo();
2296
- (0, import_react9.useEffect)(() => {
2508
+ (0, import_react10.useEffect)(() => {
2297
2509
  if (process.env.NODE_ENV === "production") {
2298
2510
  reportTeaEvent({
2299
2511
  trackKey: TrackKey.VIEW,
@@ -2305,14 +2517,14 @@ var AppContainer = /* @__PURE__ */ __name(({ children }) => {
2305
2517
  });
2306
2518
  }
2307
2519
  }, []);
2308
- 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));
2520
+ 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(Watermark_default, null), /* @__PURE__ */ import_react10.default.createElement(QueryProvider_default, null, children));
2309
2521
  }, "AppContainer");
2310
2522
  var AppContainer_default = AppContainer;
2311
2523
 
2312
2524
  // src/components/Welcome/index.tsx
2313
- var import_react10 = __toESM(require("react"), 1);
2525
+ var import_react11 = __toESM(require("react"), 1);
2314
2526
  var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1", description = "\u9875\u9762\u6682\u672A\u5F00\u53D1\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85..." }) => {
2315
- return /* @__PURE__ */ import_react10.default.createElement("div", {
2527
+ return /* @__PURE__ */ import_react11.default.createElement("div", {
2316
2528
  style: {
2317
2529
  display: "flex",
2318
2530
  flexDirection: "column",
@@ -2323,7 +2535,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
2323
2535
  padding: "0 24px",
2324
2536
  textAlign: "center"
2325
2537
  }
2326
- }, /* @__PURE__ */ import_react10.default.createElement("img", {
2538
+ }, /* @__PURE__ */ import_react11.default.createElement("img", {
2327
2539
  style: {
2328
2540
  borderRadius: 6,
2329
2541
  marginBottom: 24
@@ -2332,7 +2544,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
2332
2544
  height: "200",
2333
2545
  src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miao/welcome.svg",
2334
2546
  alt: "Welcome"
2335
- }), /* @__PURE__ */ import_react10.default.createElement("div", {
2547
+ }), /* @__PURE__ */ import_react11.default.createElement("div", {
2336
2548
  style: {
2337
2549
  fontSize: 16,
2338
2550
  fontWeight: 500,
@@ -2340,7 +2552,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
2340
2552
  marginBottom: 4,
2341
2553
  color: "#1f2329"
2342
2554
  }
2343
- }, title), /* @__PURE__ */ import_react10.default.createElement("div", {
2555
+ }, title), /* @__PURE__ */ import_react11.default.createElement("div", {
2344
2556
  style: {
2345
2557
  fontSize: 16,
2346
2558
  lineHeight: "24px",
@@ -2352,9 +2564,9 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
2352
2564
  var Welcome_default = Welcome;
2353
2565
 
2354
2566
  // src/components/PagePlaceholder/index.tsx
2355
- var import_react11 = __toESM(require("react"), 1);
2567
+ var import_react12 = __toESM(require("react"), 1);
2356
2568
  var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1", description = "\u9875\u9762\u6682\u672A\u5F00\u53D1\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85..." }) => {
2357
- return /* @__PURE__ */ import_react11.default.createElement("div", {
2569
+ return /* @__PURE__ */ import_react12.default.createElement("div", {
2358
2570
  style: {
2359
2571
  display: "flex",
2360
2572
  flexDirection: "column",
@@ -2365,7 +2577,7 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
2365
2577
  height: "calc(100vh - 64px)",
2366
2578
  textAlign: "center"
2367
2579
  }
2368
- }, /* @__PURE__ */ import_react11.default.createElement("img", {
2580
+ }, /* @__PURE__ */ import_react12.default.createElement("img", {
2369
2581
  style: {
2370
2582
  borderRadius: "6px",
2371
2583
  marginBottom: "24px"
@@ -2374,14 +2586,14 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
2374
2586
  height: "200",
2375
2587
  src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miao/welcome.svg",
2376
2588
  alt: "Welcome"
2377
- }), /* @__PURE__ */ import_react11.default.createElement("div", {
2589
+ }), /* @__PURE__ */ import_react12.default.createElement("div", {
2378
2590
  style: {
2379
2591
  fontSize: "16px",
2380
2592
  fontWeight: 500,
2381
2593
  marginBottom: "4px",
2382
2594
  lineHeight: "24px"
2383
2595
  }
2384
- }, title), /* @__PURE__ */ import_react11.default.createElement("div", {
2596
+ }, title), /* @__PURE__ */ import_react12.default.createElement("div", {
2385
2597
  style: {
2386
2598
  color: "#6b7280",
2387
2599
  fontSize: "16px",
@@ -2397,10 +2609,10 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
2397
2609
  var PagePlaceholder_default = PagePlaceholder;
2398
2610
 
2399
2611
  // src/components/ErrorRender/index.tsx
2400
- var import_react12 = __toESM(require("react"), 1);
2612
+ var import_react13 = __toESM(require("react"), 1);
2401
2613
  var ErrorRender = /* @__PURE__ */ __name((props) => {
2402
2614
  const { error, resetErrorBoundary } = props;
2403
- (0, import_react12.useEffect)(() => {
2615
+ (0, import_react13.useEffect)(() => {
2404
2616
  if (error) {
2405
2617
  submitPostMessage({
2406
2618
  type: "RenderError",
@@ -2421,7 +2633,7 @@ var ErrorRender = /* @__PURE__ */ __name((props) => {
2421
2633
  }, [
2422
2634
  error
2423
2635
  ]);
2424
- (0, import_react12.useEffect)(() => {
2636
+ (0, import_react13.useEffect)(() => {
2425
2637
  if (!resetErrorBoundary) return;
2426
2638
  const hmr = getHmrApi();
2427
2639
  if (!hmr) return;
@@ -2436,27 +2648,27 @@ var ErrorRender = /* @__PURE__ */ __name((props) => {
2436
2648
  }, [
2437
2649
  resetErrorBoundary
2438
2650
  ]);
2439
- return /* @__PURE__ */ import_react12.default.createElement("div", {
2651
+ return /* @__PURE__ */ import_react13.default.createElement("div", {
2440
2652
  className: "min-h-screen flex items-center justify-center bg-white"
2441
- }, /* @__PURE__ */ import_react12.default.createElement("div", {
2653
+ }, /* @__PURE__ */ import_react13.default.createElement("div", {
2442
2654
  className: "flex flex-col justify-center items-center text-center"
2443
- }, /* @__PURE__ */ import_react12.default.createElement("img", {
2655
+ }, /* @__PURE__ */ import_react13.default.createElement("img", {
2444
2656
  src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/illustration_empty_negative_error.svg",
2445
2657
  alt: "render error",
2446
2658
  className: "mb-3 w-[100px]"
2447
- }), /* @__PURE__ */ import_react12.default.createElement("p", {
2659
+ }), /* @__PURE__ */ import_react13.default.createElement("p", {
2448
2660
  className: "text-l/[22px] text-[14px] text-[#1F2329] font-medium"
2449
2661
  }, "\u9875\u9762\u51FA\u9519\u4E86")));
2450
2662
  }, "ErrorRender");
2451
2663
  var ErrorRender_default = ErrorRender;
2452
2664
 
2453
2665
  // src/route-components/ActiveLink.tsx
2454
- var import_react13 = __toESM(require("react"), 1);
2666
+ var import_react14 = __toESM(require("react"), 1);
2455
2667
  var import_react_router_dom2 = require("react-router-dom");
2456
- var ActiveLink = /* @__PURE__ */ (0, import_react13.forwardRef)(({ to, onClick, className, style, children, ...rest }, ref) => {
2457
- const [currentHash, setCurrentHash] = (0, import_react13.useState)(() => typeof window !== "undefined" ? window.location.hash : "");
2668
+ var ActiveLink = /* @__PURE__ */ (0, import_react14.forwardRef)(({ to, onClick, className, style, children, ...rest }, ref) => {
2669
+ const [currentHash, setCurrentHash] = (0, import_react14.useState)(() => typeof window !== "undefined" ? window.location.hash : "");
2458
2670
  const isHashRoute = typeof to === "string" && to.startsWith("#");
2459
- (0, import_react13.useEffect)(() => {
2671
+ (0, import_react14.useEffect)(() => {
2460
2672
  if (!isHashRoute) return;
2461
2673
  const handleHashChange = /* @__PURE__ */ __name(() => {
2462
2674
  setCurrentHash(window.location.hash);
@@ -2468,7 +2680,7 @@ var ActiveLink = /* @__PURE__ */ (0, import_react13.forwardRef)(({ to, onClick,
2468
2680
  ]);
2469
2681
  const isActive = isHashRoute && currentHash === to;
2470
2682
  if (!isHashRoute) {
2471
- return /* @__PURE__ */ import_react13.default.createElement(import_react_router_dom2.NavLink, {
2683
+ return /* @__PURE__ */ import_react14.default.createElement(import_react_router_dom2.NavLink, {
2472
2684
  ref,
2473
2685
  to,
2474
2686
  onClick,
@@ -2509,7 +2721,7 @@ var ActiveLink = /* @__PURE__ */ (0, import_react13.forwardRef)(({ to, onClick,
2509
2721
  isPending: false,
2510
2722
  isTransitioning: false
2511
2723
  }) : children;
2512
- return /* @__PURE__ */ import_react13.default.createElement("a", {
2724
+ return /* @__PURE__ */ import_react14.default.createElement("a", {
2513
2725
  ref,
2514
2726
  href: to,
2515
2727
  onClick: handleHashClick,
@@ -2521,9 +2733,9 @@ var ActiveLink = /* @__PURE__ */ (0, import_react13.forwardRef)(({ to, onClick,
2521
2733
  ActiveLink.displayName = "ActiveLink";
2522
2734
 
2523
2735
  // src/route-components/NavLink.tsx
2524
- var React9 = __toESM(require("react"), 1);
2736
+ var React10 = __toESM(require("react"), 1);
2525
2737
  var import_react_router_dom3 = require("react-router-dom");
2526
- var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, style, ...props }, ref) => {
2738
+ var NavLink2 = /* @__PURE__ */ React10.forwardRef(({ to, children, className, style, ...props }, ref) => {
2527
2739
  const isHashLink = typeof to === "string" && to.startsWith("#");
2528
2740
  const location = (0, import_react_router_dom3.useLocation)();
2529
2741
  const navigate = (0, import_react_router_dom3.useNavigate)();
@@ -2547,7 +2759,7 @@ var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, sty
2547
2759
  const resolvedClassName = typeof className === "function" ? className(renderProps) : className;
2548
2760
  const resolvedStyle = typeof style === "function" ? style(renderProps) : style;
2549
2761
  const { caseSensitive, end, replace, state, preventScrollReset, relative, viewTransition, ...restProps } = props;
2550
- return /* @__PURE__ */ React9.createElement("a", {
2762
+ return /* @__PURE__ */ React10.createElement("a", {
2551
2763
  href: to,
2552
2764
  onClick: handleClick,
2553
2765
  ref,
@@ -2556,7 +2768,7 @@ var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, sty
2556
2768
  ...restProps
2557
2769
  }, typeof children === "function" ? children(renderProps) : children);
2558
2770
  }
2559
- return /* @__PURE__ */ React9.createElement(import_react_router_dom3.NavLink, {
2771
+ return /* @__PURE__ */ React10.createElement(import_react_router_dom3.NavLink, {
2560
2772
  to,
2561
2773
  ref,
2562
2774
  className,
@@ -2571,7 +2783,7 @@ var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, sty
2571
2783
  NavLink2.displayName = "NavLink";
2572
2784
 
2573
2785
  // src/route-components/UniversalLink.tsx
2574
- var import_react14 = __toESM(require("react"), 1);
2786
+ var import_react15 = __toESM(require("react"), 1);
2575
2787
  var import_react_router_dom4 = require("react-router-dom");
2576
2788
  function isInternalRoute(to) {
2577
2789
  return !to.startsWith("#") && !to.startsWith("http://") && !to.startsWith("https://") && !to.startsWith("//");
@@ -2581,15 +2793,15 @@ function isExternalLink(to) {
2581
2793
  return to.startsWith("http://") || to.startsWith("https://") || to.startsWith("//");
2582
2794
  }
2583
2795
  __name(isExternalLink, "isExternalLink");
2584
- var UniversalLink = /* @__PURE__ */ import_react14.default.forwardRef(/* @__PURE__ */ __name(function UniversalLink2({ to, ...props }, ref) {
2796
+ var UniversalLink = /* @__PURE__ */ import_react15.default.forwardRef(/* @__PURE__ */ __name(function UniversalLink2({ to, ...props }, ref) {
2585
2797
  if (isInternalRoute(to)) {
2586
- return /* @__PURE__ */ import_react14.default.createElement(import_react_router_dom4.Link, {
2798
+ return /* @__PURE__ */ import_react15.default.createElement(import_react_router_dom4.Link, {
2587
2799
  to,
2588
2800
  ref,
2589
2801
  ...props
2590
2802
  });
2591
2803
  }
2592
- return /* @__PURE__ */ import_react14.default.createElement("a", {
2804
+ return /* @__PURE__ */ import_react15.default.createElement("a", {
2593
2805
  href: to,
2594
2806
  ref,
2595
2807
  ...props,
@@ -2814,21 +3026,46 @@ function getAxiosForBackend() {
2814
3026
  __name(getAxiosForBackend, "getAxiosForBackend");
2815
3027
  var axiosForBackend = getAxiosForBackend();
2816
3028
 
3029
+ // src/utils/url.ts
3030
+ function splitWorkspaceUrl(fullUrl) {
3031
+ try {
3032
+ const url = new URL(fullUrl);
3033
+ const pathParts = url.pathname.split("/");
3034
+ const workspacesIndex = pathParts.findIndex((part) => part === "workspaces");
3035
+ if (workspacesIndex === -1) {
3036
+ throw new Error("Invalid workspace URL format");
3037
+ }
3038
+ const basePathParts = pathParts.slice(0, workspacesIndex);
3039
+ const workspace = pathParts[workspacesIndex + 1];
3040
+ return {
3041
+ baseUrl: `${url.origin}${basePathParts.join("/")}`,
3042
+ workspace
3043
+ };
3044
+ } catch (error) {
3045
+ console.error("Error splitting workspace URL:", error);
3046
+ }
3047
+ return {
3048
+ baseUrl: fullUrl,
3049
+ // 兜底给一个,不要给空字符串,不然 createClient 都直接挂了,页面会白屏,体感不太好
3050
+ workspace: "workspace"
3051
+ };
3052
+ }
3053
+ __name(splitWorkspaceUrl, "splitWorkspaceUrl");
3054
+
2817
3055
  // src/integrations/dataloom.ts
2818
3056
  var import_dataloom = require("@lark-apaas/dataloom");
2819
3057
  var import_auth_sdk3 = require("@lark-apaas/auth-sdk");
2820
- var createDataLoomClient = /* @__PURE__ */ __name(() => {
3058
+ var createDataLoomClient = /* @__PURE__ */ __name((url, pat) => {
3059
+ const { baseUrl } = url ? splitWorkspaceUrl(url) : {
3060
+ baseUrl: ""
3061
+ };
2821
3062
  const appId = getAppId() ?? "";
2822
- return (0, import_dataloom.createClient)({
3063
+ return (0, import_dataloom.createClient)(baseUrl, pat ?? "", {
2823
3064
  global: {
2824
3065
  enableDataloomLog: process.env.NODE_ENV !== "production",
2825
3066
  requestRateLimit: process.env.NODE_ENV !== "production" ? 100 : void 0,
2826
3067
  brandName: "miaoda",
2827
3068
  appId,
2828
- // 同源网关下不会触发预检;CSRF token 仅用于 POST/PUT/DELETE 防护。
2829
- headers: {
2830
- "X-Suda-Csrf-Token": getCsrfToken() ?? ""
2831
- },
2832
3069
  accountServices: {
2833
3070
  user: import_auth_sdk3.authClient.user,
2834
3071
  session: import_auth_sdk3.authClient.session
@@ -2845,8 +3082,10 @@ function getDataloom() {
2845
3082
  if (pendingPromise3) {
2846
3083
  return pendingPromise3;
2847
3084
  }
2848
- pendingPromise3 = getInitialInfo().then(() => {
2849
- dataloom = createDataLoomClient();
3085
+ pendingPromise3 = getInitialInfo().then((info) => {
3086
+ const DATALOOM_CLIENT_URL = info?.app_runtime_extra?.url;
3087
+ const DATALOOM_PAT = info?.app_runtime_extra?.token;
3088
+ dataloom = createDataLoomClient(DATALOOM_CLIENT_URL, DATALOOM_PAT);
2850
3089
  return dataloom;
2851
3090
  }).finally(() => {
2852
3091
  pendingPromise3 = null;