@lark-apaas/client-toolkit-lite 1.1.9 → 1.1.10-alpha.1
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 +262 -137
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +250 -125
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
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
|
|
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
|
|
@@ -1359,6 +1359,7 @@ var useAppInfo = /* @__PURE__ */ __name(() => {
|
|
|
1359
1359
|
|
|
1360
1360
|
// src/hooks/useCurrentUserProfile.tsx
|
|
1361
1361
|
var import_react2 = require("react");
|
|
1362
|
+
var import_auth_sdk = require("@lark-apaas/auth-sdk");
|
|
1362
1363
|
|
|
1363
1364
|
// src/integrations/getCurrentUserProfile.ts
|
|
1364
1365
|
function getCurrentUserProfile() {
|
|
@@ -1366,69 +1367,6 @@ function getCurrentUserProfile() {
|
|
|
1366
1367
|
}
|
|
1367
1368
|
__name(getCurrentUserProfile, "getCurrentUserProfile");
|
|
1368
1369
|
|
|
1369
|
-
// src/utils/url.ts
|
|
1370
|
-
function splitWorkspaceUrl(fullUrl) {
|
|
1371
|
-
try {
|
|
1372
|
-
const url = new URL(fullUrl);
|
|
1373
|
-
const pathParts = url.pathname.split("/");
|
|
1374
|
-
const workspacesIndex = pathParts.findIndex((part) => part === "workspaces");
|
|
1375
|
-
if (workspacesIndex === -1) {
|
|
1376
|
-
throw new Error("Invalid workspace URL format");
|
|
1377
|
-
}
|
|
1378
|
-
const basePathParts = pathParts.slice(0, workspacesIndex);
|
|
1379
|
-
const workspace = pathParts[workspacesIndex + 1];
|
|
1380
|
-
return {
|
|
1381
|
-
baseUrl: `${url.origin}${basePathParts.join("/")}`,
|
|
1382
|
-
workspace
|
|
1383
|
-
};
|
|
1384
|
-
} catch (error) {
|
|
1385
|
-
console.error("Error splitting workspace URL:", error);
|
|
1386
|
-
}
|
|
1387
|
-
return {
|
|
1388
|
-
baseUrl: fullUrl,
|
|
1389
|
-
// 兜底给一个,不要给空字符串,不然 createClient 都直接挂了,页面会白屏,体感不太好
|
|
1390
|
-
workspace: "workspace"
|
|
1391
|
-
};
|
|
1392
|
-
}
|
|
1393
|
-
__name(splitWorkspaceUrl, "splitWorkspaceUrl");
|
|
1394
|
-
|
|
1395
|
-
// src/integrations/dataloom.ts
|
|
1396
|
-
var import_dataloom = require("@lark-apaas/dataloom");
|
|
1397
|
-
var createDataLoomClient = /* @__PURE__ */ __name((url, pat) => {
|
|
1398
|
-
const { baseUrl } = url ? splitWorkspaceUrl(url) : {
|
|
1399
|
-
baseUrl: ""
|
|
1400
|
-
};
|
|
1401
|
-
const appId = getAppId() ?? "";
|
|
1402
|
-
return (0, import_dataloom.createClient)(baseUrl, pat ?? "", {
|
|
1403
|
-
global: {
|
|
1404
|
-
enableDataloomLog: process.env.NODE_ENV !== "production",
|
|
1405
|
-
requestRateLimit: process.env.NODE_ENV !== "production" ? 100 : void 0,
|
|
1406
|
-
brandName: "miaoda",
|
|
1407
|
-
appId
|
|
1408
|
-
}
|
|
1409
|
-
});
|
|
1410
|
-
}, "createDataLoomClient");
|
|
1411
|
-
var dataloom = null;
|
|
1412
|
-
var pendingPromise3 = null;
|
|
1413
|
-
function getDataloom() {
|
|
1414
|
-
if (dataloom) {
|
|
1415
|
-
return Promise.resolve(dataloom);
|
|
1416
|
-
}
|
|
1417
|
-
if (pendingPromise3) {
|
|
1418
|
-
return pendingPromise3;
|
|
1419
|
-
}
|
|
1420
|
-
pendingPromise3 = getInitialInfo().then((info) => {
|
|
1421
|
-
const DATALOOM_CLIENT_URL = info?.app_runtime_extra?.url;
|
|
1422
|
-
const DATALOOM_PAT = info?.app_runtime_extra?.token;
|
|
1423
|
-
dataloom = createDataLoomClient(DATALOOM_CLIENT_URL, DATALOOM_PAT);
|
|
1424
|
-
return dataloom;
|
|
1425
|
-
}).finally(() => {
|
|
1426
|
-
pendingPromise3 = null;
|
|
1427
|
-
});
|
|
1428
|
-
return pendingPromise3;
|
|
1429
|
-
}
|
|
1430
|
-
__name(getDataloom, "getDataloom");
|
|
1431
|
-
|
|
1432
1370
|
// src/hooks/useCurrentUserProfile.tsx
|
|
1433
1371
|
function getNameFromArray(nameArray) {
|
|
1434
1372
|
if (!nameArray || nameArray.length === 0) {
|
|
@@ -1453,8 +1391,7 @@ var useCurrentUserProfile = /* @__PURE__ */ __name(() => {
|
|
|
1453
1391
|
(0, import_react2.useEffect)(() => {
|
|
1454
1392
|
let cancelled = false;
|
|
1455
1393
|
const fetchAndSetUserInfo = /* @__PURE__ */ __name(async () => {
|
|
1456
|
-
const
|
|
1457
|
-
const result = await dataloom2?.service?.session?.getUserInfo();
|
|
1394
|
+
const result = await import_auth_sdk.authClient.session.getUserInfo();
|
|
1458
1395
|
if (cancelled) return;
|
|
1459
1396
|
const info = result?.data?.user_info;
|
|
1460
1397
|
const userName = getNameFromArray(info?.name);
|
|
@@ -1518,6 +1455,7 @@ __name(useIsMobile, "useIsMobile");
|
|
|
1518
1455
|
|
|
1519
1456
|
// src/hooks/useLogout.ts
|
|
1520
1457
|
var import_react4 = require("react");
|
|
1458
|
+
var import_auth_sdk2 = require("@lark-apaas/auth-sdk");
|
|
1521
1459
|
function useLogout() {
|
|
1522
1460
|
const [isLoading, setIsLoading] = (0, import_react4.useState)(false);
|
|
1523
1461
|
async function handlerLogout() {
|
|
@@ -1527,8 +1465,7 @@ function useLogout() {
|
|
|
1527
1465
|
}
|
|
1528
1466
|
setIsLoading(true);
|
|
1529
1467
|
try {
|
|
1530
|
-
|
|
1531
|
-
await dataloom2.service.session.signOut();
|
|
1468
|
+
await import_auth_sdk2.authClient.session.signOut();
|
|
1532
1469
|
} catch (error) {
|
|
1533
1470
|
console.error("\u767B\u51FA\u5931\u8D25", error);
|
|
1534
1471
|
} finally {
|
|
@@ -2122,8 +2059,151 @@ var Safety = /* @__PURE__ */ __name(() => {
|
|
|
2122
2059
|
}, "Safety");
|
|
2123
2060
|
var safety_default = Safety;
|
|
2124
2061
|
|
|
2125
|
-
// src/components/
|
|
2062
|
+
// src/components/AppContainer/Watermark.tsx
|
|
2126
2063
|
var import_react6 = __toESM(require("react"), 1);
|
|
2064
|
+
|
|
2065
|
+
// src/components/AppContainer/doubao-watermark-asset.ts
|
|
2066
|
+
var CDN = "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miaoda-ui";
|
|
2067
|
+
var DOUBAO_LOGO_SRC = `${CDN}/setting_voice.svg`;
|
|
2068
|
+
var DOUBAO_CLOSE_SRC = `${CDN}/icon_close_outlined.svg`;
|
|
2069
|
+
var DOUBAO_REPORT_SRC = `${CDN}/%5BDBX%5DDropdown.svg`;
|
|
2070
|
+
|
|
2071
|
+
// src/utils/getEnv.ts
|
|
2072
|
+
function getEnv() {
|
|
2073
|
+
switch (globalThis.ENVIRONMENT) {
|
|
2074
|
+
case "staging":
|
|
2075
|
+
return "BOE";
|
|
2076
|
+
case "gray":
|
|
2077
|
+
return "PRE";
|
|
2078
|
+
case "online":
|
|
2079
|
+
return "ONLINE";
|
|
2080
|
+
default:
|
|
2081
|
+
break;
|
|
2082
|
+
}
|
|
2083
|
+
const { origin } = window.location;
|
|
2084
|
+
if (origin.includes("feishuapp.cn") || origin.includes("miaoda.feishuapp.net") || origin.includes("aiforce.cloud") || origin.includes("aiforce.run")) {
|
|
2085
|
+
return "ONLINE";
|
|
2086
|
+
} else if (origin.includes("fsapp.kundou.cn") || origin.includes("miaoda-pre.feishuapp.net") || origin.includes("aiforce-pre.bytedance.net") || origin.includes("aiforce-pre-preview.bytedance.net") || origin.includes("aiforce-pre.cloud") || origin.includes("aiforce-pre.run")) {
|
|
2087
|
+
return "PRE";
|
|
2088
|
+
} else {
|
|
2089
|
+
return "BOE";
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
__name(getEnv, "getEnv");
|
|
2093
|
+
|
|
2094
|
+
// src/components/AppContainer/Watermark.tsx
|
|
2095
|
+
var DOUBAO_SOURCE = "5";
|
|
2096
|
+
var REPORT_ENABLED = false;
|
|
2097
|
+
var REPORT_DOMAIN = {
|
|
2098
|
+
BOE: "tns.feishu-boe.cn",
|
|
2099
|
+
PRE: "tns.feishu-pre.cn",
|
|
2100
|
+
ONLINE: "tns.feishu.cn"
|
|
2101
|
+
};
|
|
2102
|
+
var openDoubaoReport = /* @__PURE__ */ __name(() => {
|
|
2103
|
+
const params = JSON.stringify({
|
|
2104
|
+
scene: "miaoda_app_report",
|
|
2105
|
+
entity_id: getAppId() ?? "",
|
|
2106
|
+
entity_type: "miaoda_app",
|
|
2107
|
+
extra: ""
|
|
2108
|
+
});
|
|
2109
|
+
const url = `https://${REPORT_DOMAIN[getEnv()]}/cust/lark_report/?type=common¶ms=${encodeURIComponent(params)}&lang=zh-CN`;
|
|
2110
|
+
window.open(url, "_blank", "noopener,noreferrer");
|
|
2111
|
+
}, "openDoubaoReport");
|
|
2112
|
+
var Watermark = /* @__PURE__ */ __name(() => {
|
|
2113
|
+
const [closed, setClosed] = (0, import_react6.useState)(false);
|
|
2114
|
+
const [open, setOpen] = (0, import_react6.useState)(false);
|
|
2115
|
+
const timer = (0, import_react6.useRef)(null);
|
|
2116
|
+
if (String(process.env.MIAODA_APP_SOURCE) !== DOUBAO_SOURCE) return null;
|
|
2117
|
+
if (closed) return null;
|
|
2118
|
+
const enter = /* @__PURE__ */ __name(() => {
|
|
2119
|
+
if (timer.current) clearTimeout(timer.current);
|
|
2120
|
+
setOpen(true);
|
|
2121
|
+
}, "enter");
|
|
2122
|
+
const leave = /* @__PURE__ */ __name(() => {
|
|
2123
|
+
timer.current = setTimeout(() => setOpen(false), 100);
|
|
2124
|
+
}, "leave");
|
|
2125
|
+
return /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
2126
|
+
"data-custom-element": "doubao-watermark",
|
|
2127
|
+
onMouseEnter: enter,
|
|
2128
|
+
onMouseLeave: leave,
|
|
2129
|
+
style: {
|
|
2130
|
+
position: "fixed",
|
|
2131
|
+
right: 12,
|
|
2132
|
+
bottom: 12,
|
|
2133
|
+
zIndex: 9999,
|
|
2134
|
+
display: "flex",
|
|
2135
|
+
flexDirection: "column",
|
|
2136
|
+
alignItems: "flex-end"
|
|
2137
|
+
}
|
|
2138
|
+
}, REPORT_ENABLED && open && /* @__PURE__ */ import_react6.default.createElement("img", {
|
|
2139
|
+
src: DOUBAO_REPORT_SRC,
|
|
2140
|
+
width: 168,
|
|
2141
|
+
height: 78,
|
|
2142
|
+
alt: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
|
|
2143
|
+
onClick: openDoubaoReport,
|
|
2144
|
+
style: {
|
|
2145
|
+
display: "block",
|
|
2146
|
+
cursor: "pointer",
|
|
2147
|
+
marginBottom: -8,
|
|
2148
|
+
marginRight: -12
|
|
2149
|
+
}
|
|
2150
|
+
}), /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
2151
|
+
style: {
|
|
2152
|
+
boxSizing: "border-box",
|
|
2153
|
+
display: "inline-flex",
|
|
2154
|
+
alignItems: "center",
|
|
2155
|
+
gap: 4,
|
|
2156
|
+
padding: "6px 12px 6px 8px",
|
|
2157
|
+
background: "#363636",
|
|
2158
|
+
border: "0.5px solid rgba(255,255,255,0.1)",
|
|
2159
|
+
borderRadius: 100,
|
|
2160
|
+
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)"
|
|
2161
|
+
}
|
|
2162
|
+
}, /* @__PURE__ */ import_react6.default.createElement("img", {
|
|
2163
|
+
src: DOUBAO_LOGO_SRC,
|
|
2164
|
+
width: 16,
|
|
2165
|
+
height: 16,
|
|
2166
|
+
alt: "",
|
|
2167
|
+
style: {
|
|
2168
|
+
borderRadius: 100,
|
|
2169
|
+
flexShrink: 0,
|
|
2170
|
+
display: "block"
|
|
2171
|
+
}
|
|
2172
|
+
}), /* @__PURE__ */ import_react6.default.createElement("span", {
|
|
2173
|
+
style: {
|
|
2174
|
+
fontFamily: "'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif",
|
|
2175
|
+
fontSize: 12,
|
|
2176
|
+
lineHeight: "18px",
|
|
2177
|
+
color: "rgba(255,255,255,0.85)",
|
|
2178
|
+
whiteSpace: "nowrap"
|
|
2179
|
+
}
|
|
2180
|
+
}, "\u7531 \u8C46\u5305AI \u751F\u6210"), /* @__PURE__ */ import_react6.default.createElement("span", {
|
|
2181
|
+
role: "button",
|
|
2182
|
+
"aria-label": "\u5173\u95ED",
|
|
2183
|
+
onClick: /* @__PURE__ */ __name((e) => {
|
|
2184
|
+
e.stopPropagation();
|
|
2185
|
+
setClosed(true);
|
|
2186
|
+
}, "onClick"),
|
|
2187
|
+
style: {
|
|
2188
|
+
display: "inline-flex",
|
|
2189
|
+
alignItems: "center",
|
|
2190
|
+
cursor: "pointer",
|
|
2191
|
+
flexShrink: 0
|
|
2192
|
+
}
|
|
2193
|
+
}, /* @__PURE__ */ import_react6.default.createElement("img", {
|
|
2194
|
+
src: DOUBAO_CLOSE_SRC,
|
|
2195
|
+
width: 10,
|
|
2196
|
+
height: 10,
|
|
2197
|
+
alt: "",
|
|
2198
|
+
style: {
|
|
2199
|
+
display: "block"
|
|
2200
|
+
}
|
|
2201
|
+
}))));
|
|
2202
|
+
}, "Watermark");
|
|
2203
|
+
var Watermark_default = Watermark;
|
|
2204
|
+
|
|
2205
|
+
// src/components/QueryProvider/index.tsx
|
|
2206
|
+
var import_react7 = __toESM(require("react"), 1);
|
|
2127
2207
|
var import_react_query = require("@tanstack/react-query");
|
|
2128
2208
|
var defaultQueryClient = null;
|
|
2129
2209
|
var getDefaultQueryClient = /* @__PURE__ */ __name(() => {
|
|
@@ -2144,20 +2224,20 @@ var getDefaultQueryClient = /* @__PURE__ */ __name(() => {
|
|
|
2144
2224
|
}, "getDefaultQueryClient");
|
|
2145
2225
|
var QueryProvider = /* @__PURE__ */ __name(({ children, client }) => {
|
|
2146
2226
|
const qc = client ?? getDefaultQueryClient();
|
|
2147
|
-
return /* @__PURE__ */
|
|
2227
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_react_query.QueryClientProvider, {
|
|
2148
2228
|
client: qc
|
|
2149
2229
|
}, children);
|
|
2150
2230
|
}, "QueryProvider");
|
|
2151
2231
|
var QueryProvider_default = QueryProvider;
|
|
2152
2232
|
|
|
2153
2233
|
// src/components/AppContainer/IframeBridge.tsx
|
|
2154
|
-
var
|
|
2234
|
+
var import_react9 = require("react");
|
|
2155
2235
|
var import_react_router_dom = require("react-router-dom");
|
|
2156
2236
|
|
|
2157
2237
|
// src/hooks/useUpdatingRef.ts
|
|
2158
|
-
var
|
|
2238
|
+
var import_react8 = require("react");
|
|
2159
2239
|
function useUpdatingRef(value) {
|
|
2160
|
-
const ref = (0,
|
|
2240
|
+
const ref = (0, import_react8.useRef)(value);
|
|
2161
2241
|
ref.current = value;
|
|
2162
2242
|
return ref;
|
|
2163
2243
|
}
|
|
@@ -2178,20 +2258,20 @@ function IframeBridge() {
|
|
|
2178
2258
|
const location = (0, import_react_router_dom.useLocation)();
|
|
2179
2259
|
const navigate = (0, import_react_router_dom.useNavigate)();
|
|
2180
2260
|
const navigateRef = useUpdatingRef(navigate);
|
|
2181
|
-
const isActive = (0,
|
|
2182
|
-
const historyBack = (0,
|
|
2261
|
+
const isActive = (0, import_react9.useRef)(false);
|
|
2262
|
+
const historyBack = (0, import_react9.useCallback)((_payload) => {
|
|
2183
2263
|
navigateRef.current(-1);
|
|
2184
2264
|
isActive.current = true;
|
|
2185
2265
|
}, [
|
|
2186
2266
|
navigateRef
|
|
2187
2267
|
]);
|
|
2188
|
-
const historyForward = (0,
|
|
2268
|
+
const historyForward = (0, import_react9.useCallback)((_payload) => {
|
|
2189
2269
|
navigateRef.current(1);
|
|
2190
2270
|
isActive.current = true;
|
|
2191
2271
|
}, [
|
|
2192
2272
|
navigateRef
|
|
2193
2273
|
]);
|
|
2194
|
-
const operatorMessage = (0,
|
|
2274
|
+
const operatorMessage = (0, import_react9.useMemo)(() => ({
|
|
2195
2275
|
["RouteBack"]: historyBack,
|
|
2196
2276
|
["RouteForward"]: historyForward,
|
|
2197
2277
|
["RouteChange"]: navigateRef.current
|
|
@@ -2200,7 +2280,7 @@ function IframeBridge() {
|
|
|
2200
2280
|
historyForward,
|
|
2201
2281
|
navigateRef
|
|
2202
2282
|
]);
|
|
2203
|
-
(0,
|
|
2283
|
+
(0, import_react9.useEffect)(() => {
|
|
2204
2284
|
if (isActive.current) {
|
|
2205
2285
|
isActive.current = false;
|
|
2206
2286
|
return;
|
|
@@ -2212,7 +2292,7 @@ function IframeBridge() {
|
|
|
2212
2292
|
}, [
|
|
2213
2293
|
location
|
|
2214
2294
|
]);
|
|
2215
|
-
const handleMessage = (0,
|
|
2295
|
+
const handleMessage = (0, import_react9.useCallback)((event) => {
|
|
2216
2296
|
const data = event.data ?? {};
|
|
2217
2297
|
if (typeof data.type === "string" && isRouteMessageType(data.type)) {
|
|
2218
2298
|
operatorMessage[data.type](data.data);
|
|
@@ -2220,7 +2300,7 @@ function IframeBridge() {
|
|
|
2220
2300
|
}, [
|
|
2221
2301
|
operatorMessage
|
|
2222
2302
|
]);
|
|
2223
|
-
(0,
|
|
2303
|
+
(0, import_react9.useEffect)(() => {
|
|
2224
2304
|
window.addEventListener("message", handleMessage);
|
|
2225
2305
|
return () => {
|
|
2226
2306
|
window.removeEventListener("message", handleMessage);
|
|
@@ -2228,7 +2308,7 @@ function IframeBridge() {
|
|
|
2228
2308
|
}, [
|
|
2229
2309
|
handleMessage
|
|
2230
2310
|
]);
|
|
2231
|
-
return /* @__PURE__ */ (0,
|
|
2311
|
+
return /* @__PURE__ */ (0, import_react9.createElement)("div", {
|
|
2232
2312
|
style: {
|
|
2233
2313
|
display: "none"
|
|
2234
2314
|
}
|
|
@@ -2256,29 +2336,6 @@ var isIOS = /* @__PURE__ */ __name(() => {
|
|
|
2256
2336
|
return false;
|
|
2257
2337
|
}, "isIOS");
|
|
2258
2338
|
|
|
2259
|
-
// src/utils/getEnv.ts
|
|
2260
|
-
function getEnv() {
|
|
2261
|
-
switch (globalThis.ENVIRONMENT) {
|
|
2262
|
-
case "staging":
|
|
2263
|
-
return "BOE";
|
|
2264
|
-
case "gray":
|
|
2265
|
-
return "PRE";
|
|
2266
|
-
case "online":
|
|
2267
|
-
return "ONLINE";
|
|
2268
|
-
default:
|
|
2269
|
-
break;
|
|
2270
|
-
}
|
|
2271
|
-
const { origin } = window.location;
|
|
2272
|
-
if (origin.includes("feishuapp.cn") || origin.includes("miaoda.feishuapp.net") || origin.includes("aiforce.cloud") || origin.includes("aiforce.run")) {
|
|
2273
|
-
return "ONLINE";
|
|
2274
|
-
} else if (origin.includes("fsapp.kundou.cn") || origin.includes("miaoda-pre.feishuapp.net") || origin.includes("aiforce-pre.bytedance.net") || origin.includes("aiforce-pre-preview.bytedance.net") || origin.includes("aiforce-pre.cloud") || origin.includes("aiforce-pre.run")) {
|
|
2275
|
-
return "PRE";
|
|
2276
|
-
} else {
|
|
2277
|
-
return "BOE";
|
|
2278
|
-
}
|
|
2279
|
-
}
|
|
2280
|
-
__name(getEnv, "getEnv");
|
|
2281
|
-
|
|
2282
2339
|
// src/components/AppContainer/utils/getLarkUser.ts
|
|
2283
2340
|
async function getLarkUserInfo() {
|
|
2284
2341
|
const appId = getAppId();
|
|
@@ -2356,7 +2413,7 @@ var TrackKey = /* @__PURE__ */ (function(TrackKey2) {
|
|
|
2356
2413
|
// src/components/AppContainer/index.tsx
|
|
2357
2414
|
var AppContainer = /* @__PURE__ */ __name(({ children }) => {
|
|
2358
2415
|
useAppInfo();
|
|
2359
|
-
(0,
|
|
2416
|
+
(0, import_react10.useEffect)(() => {
|
|
2360
2417
|
if (process.env.NODE_ENV === "production") {
|
|
2361
2418
|
reportTeaEvent({
|
|
2362
2419
|
trackKey: TrackKey.VIEW,
|
|
@@ -2368,14 +2425,14 @@ var AppContainer = /* @__PURE__ */ __name(({ children }) => {
|
|
|
2368
2425
|
});
|
|
2369
2426
|
}
|
|
2370
2427
|
}, []);
|
|
2371
|
-
return /* @__PURE__ */
|
|
2428
|
+
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));
|
|
2372
2429
|
}, "AppContainer");
|
|
2373
2430
|
var AppContainer_default = AppContainer;
|
|
2374
2431
|
|
|
2375
2432
|
// src/components/Welcome/index.tsx
|
|
2376
|
-
var
|
|
2433
|
+
var import_react11 = __toESM(require("react"), 1);
|
|
2377
2434
|
var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1", description = "\u9875\u9762\u6682\u672A\u5F00\u53D1\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85..." }) => {
|
|
2378
|
-
return /* @__PURE__ */
|
|
2435
|
+
return /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
2379
2436
|
style: {
|
|
2380
2437
|
display: "flex",
|
|
2381
2438
|
flexDirection: "column",
|
|
@@ -2386,7 +2443,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
|
|
|
2386
2443
|
padding: "0 24px",
|
|
2387
2444
|
textAlign: "center"
|
|
2388
2445
|
}
|
|
2389
|
-
}, /* @__PURE__ */
|
|
2446
|
+
}, /* @__PURE__ */ import_react11.default.createElement("img", {
|
|
2390
2447
|
style: {
|
|
2391
2448
|
borderRadius: 6,
|
|
2392
2449
|
marginBottom: 24
|
|
@@ -2395,7 +2452,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
|
|
|
2395
2452
|
height: "200",
|
|
2396
2453
|
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miao/welcome.svg",
|
|
2397
2454
|
alt: "Welcome"
|
|
2398
|
-
}), /* @__PURE__ */
|
|
2455
|
+
}), /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
2399
2456
|
style: {
|
|
2400
2457
|
fontSize: 16,
|
|
2401
2458
|
fontWeight: 500,
|
|
@@ -2403,7 +2460,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
|
|
|
2403
2460
|
marginBottom: 4,
|
|
2404
2461
|
color: "#1f2329"
|
|
2405
2462
|
}
|
|
2406
|
-
}, title), /* @__PURE__ */
|
|
2463
|
+
}, title), /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
2407
2464
|
style: {
|
|
2408
2465
|
fontSize: 16,
|
|
2409
2466
|
lineHeight: "24px",
|
|
@@ -2415,9 +2472,9 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
|
|
|
2415
2472
|
var Welcome_default = Welcome;
|
|
2416
2473
|
|
|
2417
2474
|
// src/components/PagePlaceholder/index.tsx
|
|
2418
|
-
var
|
|
2475
|
+
var import_react12 = __toESM(require("react"), 1);
|
|
2419
2476
|
var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1", description = "\u9875\u9762\u6682\u672A\u5F00\u53D1\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85..." }) => {
|
|
2420
|
-
return /* @__PURE__ */
|
|
2477
|
+
return /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2421
2478
|
style: {
|
|
2422
2479
|
display: "flex",
|
|
2423
2480
|
flexDirection: "column",
|
|
@@ -2428,7 +2485,7 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
|
|
|
2428
2485
|
height: "calc(100vh - 64px)",
|
|
2429
2486
|
textAlign: "center"
|
|
2430
2487
|
}
|
|
2431
|
-
}, /* @__PURE__ */
|
|
2488
|
+
}, /* @__PURE__ */ import_react12.default.createElement("img", {
|
|
2432
2489
|
style: {
|
|
2433
2490
|
borderRadius: "6px",
|
|
2434
2491
|
marginBottom: "24px"
|
|
@@ -2437,14 +2494,14 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
|
|
|
2437
2494
|
height: "200",
|
|
2438
2495
|
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miao/welcome.svg",
|
|
2439
2496
|
alt: "Welcome"
|
|
2440
|
-
}), /* @__PURE__ */
|
|
2497
|
+
}), /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2441
2498
|
style: {
|
|
2442
2499
|
fontSize: "16px",
|
|
2443
2500
|
fontWeight: 500,
|
|
2444
2501
|
marginBottom: "4px",
|
|
2445
2502
|
lineHeight: "24px"
|
|
2446
2503
|
}
|
|
2447
|
-
}, title), /* @__PURE__ */
|
|
2504
|
+
}, title), /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2448
2505
|
style: {
|
|
2449
2506
|
color: "#6b7280",
|
|
2450
2507
|
fontSize: "16px",
|
|
@@ -2460,10 +2517,10 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
|
|
|
2460
2517
|
var PagePlaceholder_default = PagePlaceholder;
|
|
2461
2518
|
|
|
2462
2519
|
// src/components/ErrorRender/index.tsx
|
|
2463
|
-
var
|
|
2520
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
2464
2521
|
var ErrorRender = /* @__PURE__ */ __name((props) => {
|
|
2465
2522
|
const { error, resetErrorBoundary } = props;
|
|
2466
|
-
(0,
|
|
2523
|
+
(0, import_react13.useEffect)(() => {
|
|
2467
2524
|
if (error) {
|
|
2468
2525
|
submitPostMessage({
|
|
2469
2526
|
type: "RenderError",
|
|
@@ -2484,7 +2541,7 @@ var ErrorRender = /* @__PURE__ */ __name((props) => {
|
|
|
2484
2541
|
}, [
|
|
2485
2542
|
error
|
|
2486
2543
|
]);
|
|
2487
|
-
(0,
|
|
2544
|
+
(0, import_react13.useEffect)(() => {
|
|
2488
2545
|
if (!resetErrorBoundary) return;
|
|
2489
2546
|
const hmr = getHmrApi();
|
|
2490
2547
|
if (!hmr) return;
|
|
@@ -2499,27 +2556,27 @@ var ErrorRender = /* @__PURE__ */ __name((props) => {
|
|
|
2499
2556
|
}, [
|
|
2500
2557
|
resetErrorBoundary
|
|
2501
2558
|
]);
|
|
2502
|
-
return /* @__PURE__ */
|
|
2559
|
+
return /* @__PURE__ */ import_react13.default.createElement("div", {
|
|
2503
2560
|
className: "min-h-screen flex items-center justify-center bg-white"
|
|
2504
|
-
}, /* @__PURE__ */
|
|
2561
|
+
}, /* @__PURE__ */ import_react13.default.createElement("div", {
|
|
2505
2562
|
className: "flex flex-col justify-center items-center text-center"
|
|
2506
|
-
}, /* @__PURE__ */
|
|
2563
|
+
}, /* @__PURE__ */ import_react13.default.createElement("img", {
|
|
2507
2564
|
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/illustration_empty_negative_error.svg",
|
|
2508
2565
|
alt: "render error",
|
|
2509
2566
|
className: "mb-3 w-[100px]"
|
|
2510
|
-
}), /* @__PURE__ */
|
|
2567
|
+
}), /* @__PURE__ */ import_react13.default.createElement("p", {
|
|
2511
2568
|
className: "text-l/[22px] text-[14px] text-[#1F2329] font-medium"
|
|
2512
2569
|
}, "\u9875\u9762\u51FA\u9519\u4E86")));
|
|
2513
2570
|
}, "ErrorRender");
|
|
2514
2571
|
var ErrorRender_default = ErrorRender;
|
|
2515
2572
|
|
|
2516
2573
|
// src/route-components/ActiveLink.tsx
|
|
2517
|
-
var
|
|
2574
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
2518
2575
|
var import_react_router_dom2 = require("react-router-dom");
|
|
2519
|
-
var ActiveLink = /* @__PURE__ */ (0,
|
|
2520
|
-
const [currentHash, setCurrentHash] = (0,
|
|
2576
|
+
var ActiveLink = /* @__PURE__ */ (0, import_react14.forwardRef)(({ to, onClick, className, style, children, ...rest }, ref) => {
|
|
2577
|
+
const [currentHash, setCurrentHash] = (0, import_react14.useState)(() => typeof window !== "undefined" ? window.location.hash : "");
|
|
2521
2578
|
const isHashRoute = typeof to === "string" && to.startsWith("#");
|
|
2522
|
-
(0,
|
|
2579
|
+
(0, import_react14.useEffect)(() => {
|
|
2523
2580
|
if (!isHashRoute) return;
|
|
2524
2581
|
const handleHashChange = /* @__PURE__ */ __name(() => {
|
|
2525
2582
|
setCurrentHash(window.location.hash);
|
|
@@ -2531,7 +2588,7 @@ var ActiveLink = /* @__PURE__ */ (0, import_react13.forwardRef)(({ to, onClick,
|
|
|
2531
2588
|
]);
|
|
2532
2589
|
const isActive = isHashRoute && currentHash === to;
|
|
2533
2590
|
if (!isHashRoute) {
|
|
2534
|
-
return /* @__PURE__ */
|
|
2591
|
+
return /* @__PURE__ */ import_react14.default.createElement(import_react_router_dom2.NavLink, {
|
|
2535
2592
|
ref,
|
|
2536
2593
|
to,
|
|
2537
2594
|
onClick,
|
|
@@ -2572,7 +2629,7 @@ var ActiveLink = /* @__PURE__ */ (0, import_react13.forwardRef)(({ to, onClick,
|
|
|
2572
2629
|
isPending: false,
|
|
2573
2630
|
isTransitioning: false
|
|
2574
2631
|
}) : children;
|
|
2575
|
-
return /* @__PURE__ */
|
|
2632
|
+
return /* @__PURE__ */ import_react14.default.createElement("a", {
|
|
2576
2633
|
ref,
|
|
2577
2634
|
href: to,
|
|
2578
2635
|
onClick: handleHashClick,
|
|
@@ -2584,9 +2641,9 @@ var ActiveLink = /* @__PURE__ */ (0, import_react13.forwardRef)(({ to, onClick,
|
|
|
2584
2641
|
ActiveLink.displayName = "ActiveLink";
|
|
2585
2642
|
|
|
2586
2643
|
// src/route-components/NavLink.tsx
|
|
2587
|
-
var
|
|
2644
|
+
var React10 = __toESM(require("react"), 1);
|
|
2588
2645
|
var import_react_router_dom3 = require("react-router-dom");
|
|
2589
|
-
var NavLink2 = /* @__PURE__ */
|
|
2646
|
+
var NavLink2 = /* @__PURE__ */ React10.forwardRef(({ to, children, className, style, ...props }, ref) => {
|
|
2590
2647
|
const isHashLink = typeof to === "string" && to.startsWith("#");
|
|
2591
2648
|
const location = (0, import_react_router_dom3.useLocation)();
|
|
2592
2649
|
const navigate = (0, import_react_router_dom3.useNavigate)();
|
|
@@ -2610,7 +2667,7 @@ var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, sty
|
|
|
2610
2667
|
const resolvedClassName = typeof className === "function" ? className(renderProps) : className;
|
|
2611
2668
|
const resolvedStyle = typeof style === "function" ? style(renderProps) : style;
|
|
2612
2669
|
const { caseSensitive, end, replace, state, preventScrollReset, relative, viewTransition, ...restProps } = props;
|
|
2613
|
-
return /* @__PURE__ */
|
|
2670
|
+
return /* @__PURE__ */ React10.createElement("a", {
|
|
2614
2671
|
href: to,
|
|
2615
2672
|
onClick: handleClick,
|
|
2616
2673
|
ref,
|
|
@@ -2619,7 +2676,7 @@ var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, sty
|
|
|
2619
2676
|
...restProps
|
|
2620
2677
|
}, typeof children === "function" ? children(renderProps) : children);
|
|
2621
2678
|
}
|
|
2622
|
-
return /* @__PURE__ */
|
|
2679
|
+
return /* @__PURE__ */ React10.createElement(import_react_router_dom3.NavLink, {
|
|
2623
2680
|
to,
|
|
2624
2681
|
ref,
|
|
2625
2682
|
className,
|
|
@@ -2634,7 +2691,7 @@ var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, sty
|
|
|
2634
2691
|
NavLink2.displayName = "NavLink";
|
|
2635
2692
|
|
|
2636
2693
|
// src/route-components/UniversalLink.tsx
|
|
2637
|
-
var
|
|
2694
|
+
var import_react15 = __toESM(require("react"), 1);
|
|
2638
2695
|
var import_react_router_dom4 = require("react-router-dom");
|
|
2639
2696
|
function isInternalRoute(to) {
|
|
2640
2697
|
return !to.startsWith("#") && !to.startsWith("http://") && !to.startsWith("https://") && !to.startsWith("//");
|
|
@@ -2644,15 +2701,15 @@ function isExternalLink(to) {
|
|
|
2644
2701
|
return to.startsWith("http://") || to.startsWith("https://") || to.startsWith("//");
|
|
2645
2702
|
}
|
|
2646
2703
|
__name(isExternalLink, "isExternalLink");
|
|
2647
|
-
var UniversalLink = /* @__PURE__ */
|
|
2704
|
+
var UniversalLink = /* @__PURE__ */ import_react15.default.forwardRef(/* @__PURE__ */ __name(function UniversalLink2({ to, ...props }, ref) {
|
|
2648
2705
|
if (isInternalRoute(to)) {
|
|
2649
|
-
return /* @__PURE__ */
|
|
2706
|
+
return /* @__PURE__ */ import_react15.default.createElement(import_react_router_dom4.Link, {
|
|
2650
2707
|
to,
|
|
2651
2708
|
ref,
|
|
2652
2709
|
...props
|
|
2653
2710
|
});
|
|
2654
2711
|
}
|
|
2655
|
-
return /* @__PURE__ */
|
|
2712
|
+
return /* @__PURE__ */ import_react15.default.createElement("a", {
|
|
2656
2713
|
href: to,
|
|
2657
2714
|
ref,
|
|
2658
2715
|
...props,
|
|
@@ -2877,6 +2934,74 @@ function getAxiosForBackend() {
|
|
|
2877
2934
|
__name(getAxiosForBackend, "getAxiosForBackend");
|
|
2878
2935
|
var axiosForBackend = getAxiosForBackend();
|
|
2879
2936
|
|
|
2937
|
+
// src/utils/url.ts
|
|
2938
|
+
function splitWorkspaceUrl(fullUrl) {
|
|
2939
|
+
try {
|
|
2940
|
+
const url = new URL(fullUrl);
|
|
2941
|
+
const pathParts = url.pathname.split("/");
|
|
2942
|
+
const workspacesIndex = pathParts.findIndex((part) => part === "workspaces");
|
|
2943
|
+
if (workspacesIndex === -1) {
|
|
2944
|
+
throw new Error("Invalid workspace URL format");
|
|
2945
|
+
}
|
|
2946
|
+
const basePathParts = pathParts.slice(0, workspacesIndex);
|
|
2947
|
+
const workspace = pathParts[workspacesIndex + 1];
|
|
2948
|
+
return {
|
|
2949
|
+
baseUrl: `${url.origin}${basePathParts.join("/")}`,
|
|
2950
|
+
workspace
|
|
2951
|
+
};
|
|
2952
|
+
} catch (error) {
|
|
2953
|
+
console.error("Error splitting workspace URL:", error);
|
|
2954
|
+
}
|
|
2955
|
+
return {
|
|
2956
|
+
baseUrl: fullUrl,
|
|
2957
|
+
// 兜底给一个,不要给空字符串,不然 createClient 都直接挂了,页面会白屏,体感不太好
|
|
2958
|
+
workspace: "workspace"
|
|
2959
|
+
};
|
|
2960
|
+
}
|
|
2961
|
+
__name(splitWorkspaceUrl, "splitWorkspaceUrl");
|
|
2962
|
+
|
|
2963
|
+
// src/integrations/dataloom.ts
|
|
2964
|
+
var import_dataloom = require("@lark-apaas/dataloom");
|
|
2965
|
+
var import_auth_sdk3 = require("@lark-apaas/auth-sdk");
|
|
2966
|
+
var createDataLoomClient = /* @__PURE__ */ __name((url, pat) => {
|
|
2967
|
+
const { baseUrl } = url ? splitWorkspaceUrl(url) : {
|
|
2968
|
+
baseUrl: ""
|
|
2969
|
+
};
|
|
2970
|
+
const appId = getAppId() ?? "";
|
|
2971
|
+
return (0, import_dataloom.createClient)(baseUrl, pat ?? "", {
|
|
2972
|
+
global: {
|
|
2973
|
+
enableDataloomLog: process.env.NODE_ENV !== "production",
|
|
2974
|
+
requestRateLimit: process.env.NODE_ENV !== "production" ? 100 : void 0,
|
|
2975
|
+
brandName: "miaoda",
|
|
2976
|
+
appId,
|
|
2977
|
+
accountServices: {
|
|
2978
|
+
user: import_auth_sdk3.authClient.user,
|
|
2979
|
+
session: import_auth_sdk3.authClient.session
|
|
2980
|
+
}
|
|
2981
|
+
}
|
|
2982
|
+
});
|
|
2983
|
+
}, "createDataLoomClient");
|
|
2984
|
+
var dataloom = null;
|
|
2985
|
+
var pendingPromise3 = null;
|
|
2986
|
+
function getDataloom() {
|
|
2987
|
+
if (dataloom) {
|
|
2988
|
+
return Promise.resolve(dataloom);
|
|
2989
|
+
}
|
|
2990
|
+
if (pendingPromise3) {
|
|
2991
|
+
return pendingPromise3;
|
|
2992
|
+
}
|
|
2993
|
+
pendingPromise3 = getInitialInfo().then((info) => {
|
|
2994
|
+
const DATALOOM_CLIENT_URL = info?.app_runtime_extra?.url;
|
|
2995
|
+
const DATALOOM_PAT = info?.app_runtime_extra?.token;
|
|
2996
|
+
dataloom = createDataLoomClient(DATALOOM_CLIENT_URL, DATALOOM_PAT);
|
|
2997
|
+
return dataloom;
|
|
2998
|
+
}).finally(() => {
|
|
2999
|
+
pendingPromise3 = null;
|
|
3000
|
+
});
|
|
3001
|
+
return pendingPromise3;
|
|
3002
|
+
}
|
|
3003
|
+
__name(getDataloom, "getDataloom");
|
|
3004
|
+
|
|
2880
3005
|
// src/integrations/capabilityClient.ts
|
|
2881
3006
|
var import_client_capability = require("@lark-apaas/client-capability");
|
|
2882
3007
|
|