@lark-apaas/client-toolkit-lite 1.1.10-alpha.0 → 1.1.10-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.
- package/dist/index.cjs +225 -78
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +213 -66
- package/dist/index.js.map +1 -1
- package/package.json +2 -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
|
|
@@ -2059,8 +2059,151 @@ var Safety = /* @__PURE__ */ __name(() => {
|
|
|
2059
2059
|
}, "Safety");
|
|
2060
2060
|
var safety_default = Safety;
|
|
2061
2061
|
|
|
2062
|
-
// src/components/
|
|
2062
|
+
// src/components/AppContainer/Watermark.tsx
|
|
2063
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);
|
|
2064
2207
|
var import_react_query = require("@tanstack/react-query");
|
|
2065
2208
|
var defaultQueryClient = null;
|
|
2066
2209
|
var getDefaultQueryClient = /* @__PURE__ */ __name(() => {
|
|
@@ -2081,20 +2224,20 @@ var getDefaultQueryClient = /* @__PURE__ */ __name(() => {
|
|
|
2081
2224
|
}, "getDefaultQueryClient");
|
|
2082
2225
|
var QueryProvider = /* @__PURE__ */ __name(({ children, client }) => {
|
|
2083
2226
|
const qc = client ?? getDefaultQueryClient();
|
|
2084
|
-
return /* @__PURE__ */
|
|
2227
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_react_query.QueryClientProvider, {
|
|
2085
2228
|
client: qc
|
|
2086
2229
|
}, children);
|
|
2087
2230
|
}, "QueryProvider");
|
|
2088
2231
|
var QueryProvider_default = QueryProvider;
|
|
2089
2232
|
|
|
2090
2233
|
// src/components/AppContainer/IframeBridge.tsx
|
|
2091
|
-
var
|
|
2234
|
+
var import_react9 = require("react");
|
|
2092
2235
|
var import_react_router_dom = require("react-router-dom");
|
|
2093
2236
|
|
|
2094
2237
|
// src/hooks/useUpdatingRef.ts
|
|
2095
|
-
var
|
|
2238
|
+
var import_react8 = require("react");
|
|
2096
2239
|
function useUpdatingRef(value) {
|
|
2097
|
-
const ref = (0,
|
|
2240
|
+
const ref = (0, import_react8.useRef)(value);
|
|
2098
2241
|
ref.current = value;
|
|
2099
2242
|
return ref;
|
|
2100
2243
|
}
|
|
@@ -2115,20 +2258,20 @@ function IframeBridge() {
|
|
|
2115
2258
|
const location = (0, import_react_router_dom.useLocation)();
|
|
2116
2259
|
const navigate = (0, import_react_router_dom.useNavigate)();
|
|
2117
2260
|
const navigateRef = useUpdatingRef(navigate);
|
|
2118
|
-
const isActive = (0,
|
|
2119
|
-
const historyBack = (0,
|
|
2261
|
+
const isActive = (0, import_react9.useRef)(false);
|
|
2262
|
+
const historyBack = (0, import_react9.useCallback)((_payload) => {
|
|
2120
2263
|
navigateRef.current(-1);
|
|
2121
2264
|
isActive.current = true;
|
|
2122
2265
|
}, [
|
|
2123
2266
|
navigateRef
|
|
2124
2267
|
]);
|
|
2125
|
-
const historyForward = (0,
|
|
2268
|
+
const historyForward = (0, import_react9.useCallback)((_payload) => {
|
|
2126
2269
|
navigateRef.current(1);
|
|
2127
2270
|
isActive.current = true;
|
|
2128
2271
|
}, [
|
|
2129
2272
|
navigateRef
|
|
2130
2273
|
]);
|
|
2131
|
-
const operatorMessage = (0,
|
|
2274
|
+
const operatorMessage = (0, import_react9.useMemo)(() => ({
|
|
2132
2275
|
["RouteBack"]: historyBack,
|
|
2133
2276
|
["RouteForward"]: historyForward,
|
|
2134
2277
|
["RouteChange"]: navigateRef.current
|
|
@@ -2137,7 +2280,7 @@ function IframeBridge() {
|
|
|
2137
2280
|
historyForward,
|
|
2138
2281
|
navigateRef
|
|
2139
2282
|
]);
|
|
2140
|
-
(0,
|
|
2283
|
+
(0, import_react9.useEffect)(() => {
|
|
2141
2284
|
if (isActive.current) {
|
|
2142
2285
|
isActive.current = false;
|
|
2143
2286
|
return;
|
|
@@ -2149,7 +2292,7 @@ function IframeBridge() {
|
|
|
2149
2292
|
}, [
|
|
2150
2293
|
location
|
|
2151
2294
|
]);
|
|
2152
|
-
const handleMessage = (0,
|
|
2295
|
+
const handleMessage = (0, import_react9.useCallback)((event) => {
|
|
2153
2296
|
const data = event.data ?? {};
|
|
2154
2297
|
if (typeof data.type === "string" && isRouteMessageType(data.type)) {
|
|
2155
2298
|
operatorMessage[data.type](data.data);
|
|
@@ -2157,7 +2300,7 @@ function IframeBridge() {
|
|
|
2157
2300
|
}, [
|
|
2158
2301
|
operatorMessage
|
|
2159
2302
|
]);
|
|
2160
|
-
(0,
|
|
2303
|
+
(0, import_react9.useEffect)(() => {
|
|
2161
2304
|
window.addEventListener("message", handleMessage);
|
|
2162
2305
|
return () => {
|
|
2163
2306
|
window.removeEventListener("message", handleMessage);
|
|
@@ -2165,7 +2308,7 @@ function IframeBridge() {
|
|
|
2165
2308
|
}, [
|
|
2166
2309
|
handleMessage
|
|
2167
2310
|
]);
|
|
2168
|
-
return /* @__PURE__ */ (0,
|
|
2311
|
+
return /* @__PURE__ */ (0, import_react9.createElement)("div", {
|
|
2169
2312
|
style: {
|
|
2170
2313
|
display: "none"
|
|
2171
2314
|
}
|
|
@@ -2193,29 +2336,6 @@ var isIOS = /* @__PURE__ */ __name(() => {
|
|
|
2193
2336
|
return false;
|
|
2194
2337
|
}, "isIOS");
|
|
2195
2338
|
|
|
2196
|
-
// src/utils/getEnv.ts
|
|
2197
|
-
function getEnv() {
|
|
2198
|
-
switch (globalThis.ENVIRONMENT) {
|
|
2199
|
-
case "staging":
|
|
2200
|
-
return "BOE";
|
|
2201
|
-
case "gray":
|
|
2202
|
-
return "PRE";
|
|
2203
|
-
case "online":
|
|
2204
|
-
return "ONLINE";
|
|
2205
|
-
default:
|
|
2206
|
-
break;
|
|
2207
|
-
}
|
|
2208
|
-
const { origin } = window.location;
|
|
2209
|
-
if (origin.includes("feishuapp.cn") || origin.includes("miaoda.feishuapp.net") || origin.includes("aiforce.cloud") || origin.includes("aiforce.run")) {
|
|
2210
|
-
return "ONLINE";
|
|
2211
|
-
} 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")) {
|
|
2212
|
-
return "PRE";
|
|
2213
|
-
} else {
|
|
2214
|
-
return "BOE";
|
|
2215
|
-
}
|
|
2216
|
-
}
|
|
2217
|
-
__name(getEnv, "getEnv");
|
|
2218
|
-
|
|
2219
2339
|
// src/components/AppContainer/utils/getLarkUser.ts
|
|
2220
2340
|
async function getLarkUserInfo() {
|
|
2221
2341
|
const appId = getAppId();
|
|
@@ -2293,7 +2413,7 @@ var TrackKey = /* @__PURE__ */ (function(TrackKey2) {
|
|
|
2293
2413
|
// src/components/AppContainer/index.tsx
|
|
2294
2414
|
var AppContainer = /* @__PURE__ */ __name(({ children }) => {
|
|
2295
2415
|
useAppInfo();
|
|
2296
|
-
(0,
|
|
2416
|
+
(0, import_react10.useEffect)(() => {
|
|
2297
2417
|
if (process.env.NODE_ENV === "production") {
|
|
2298
2418
|
reportTeaEvent({
|
|
2299
2419
|
trackKey: TrackKey.VIEW,
|
|
@@ -2305,14 +2425,14 @@ var AppContainer = /* @__PURE__ */ __name(({ children }) => {
|
|
|
2305
2425
|
});
|
|
2306
2426
|
}
|
|
2307
2427
|
}, []);
|
|
2308
|
-
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(Watermark_default, null), /* @__PURE__ */ import_react10.default.createElement(QueryProvider_default, null, children));
|
|
2309
2429
|
}, "AppContainer");
|
|
2310
2430
|
var AppContainer_default = AppContainer;
|
|
2311
2431
|
|
|
2312
2432
|
// src/components/Welcome/index.tsx
|
|
2313
|
-
var
|
|
2433
|
+
var import_react11 = __toESM(require("react"), 1);
|
|
2314
2434
|
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__ */
|
|
2435
|
+
return /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
2316
2436
|
style: {
|
|
2317
2437
|
display: "flex",
|
|
2318
2438
|
flexDirection: "column",
|
|
@@ -2323,7 +2443,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
|
|
|
2323
2443
|
padding: "0 24px",
|
|
2324
2444
|
textAlign: "center"
|
|
2325
2445
|
}
|
|
2326
|
-
}, /* @__PURE__ */
|
|
2446
|
+
}, /* @__PURE__ */ import_react11.default.createElement("img", {
|
|
2327
2447
|
style: {
|
|
2328
2448
|
borderRadius: 6,
|
|
2329
2449
|
marginBottom: 24
|
|
@@ -2332,7 +2452,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
|
|
|
2332
2452
|
height: "200",
|
|
2333
2453
|
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miao/welcome.svg",
|
|
2334
2454
|
alt: "Welcome"
|
|
2335
|
-
}), /* @__PURE__ */
|
|
2455
|
+
}), /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
2336
2456
|
style: {
|
|
2337
2457
|
fontSize: 16,
|
|
2338
2458
|
fontWeight: 500,
|
|
@@ -2340,7 +2460,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
|
|
|
2340
2460
|
marginBottom: 4,
|
|
2341
2461
|
color: "#1f2329"
|
|
2342
2462
|
}
|
|
2343
|
-
}, title), /* @__PURE__ */
|
|
2463
|
+
}, title), /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
2344
2464
|
style: {
|
|
2345
2465
|
fontSize: 16,
|
|
2346
2466
|
lineHeight: "24px",
|
|
@@ -2352,9 +2472,9 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
|
|
|
2352
2472
|
var Welcome_default = Welcome;
|
|
2353
2473
|
|
|
2354
2474
|
// src/components/PagePlaceholder/index.tsx
|
|
2355
|
-
var
|
|
2475
|
+
var import_react12 = __toESM(require("react"), 1);
|
|
2356
2476
|
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__ */
|
|
2477
|
+
return /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2358
2478
|
style: {
|
|
2359
2479
|
display: "flex",
|
|
2360
2480
|
flexDirection: "column",
|
|
@@ -2365,7 +2485,7 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
|
|
|
2365
2485
|
height: "calc(100vh - 64px)",
|
|
2366
2486
|
textAlign: "center"
|
|
2367
2487
|
}
|
|
2368
|
-
}, /* @__PURE__ */
|
|
2488
|
+
}, /* @__PURE__ */ import_react12.default.createElement("img", {
|
|
2369
2489
|
style: {
|
|
2370
2490
|
borderRadius: "6px",
|
|
2371
2491
|
marginBottom: "24px"
|
|
@@ -2374,14 +2494,14 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
|
|
|
2374
2494
|
height: "200",
|
|
2375
2495
|
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miao/welcome.svg",
|
|
2376
2496
|
alt: "Welcome"
|
|
2377
|
-
}), /* @__PURE__ */
|
|
2497
|
+
}), /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2378
2498
|
style: {
|
|
2379
2499
|
fontSize: "16px",
|
|
2380
2500
|
fontWeight: 500,
|
|
2381
2501
|
marginBottom: "4px",
|
|
2382
2502
|
lineHeight: "24px"
|
|
2383
2503
|
}
|
|
2384
|
-
}, title), /* @__PURE__ */
|
|
2504
|
+
}, title), /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2385
2505
|
style: {
|
|
2386
2506
|
color: "#6b7280",
|
|
2387
2507
|
fontSize: "16px",
|
|
@@ -2397,10 +2517,10 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
|
|
|
2397
2517
|
var PagePlaceholder_default = PagePlaceholder;
|
|
2398
2518
|
|
|
2399
2519
|
// src/components/ErrorRender/index.tsx
|
|
2400
|
-
var
|
|
2520
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
2401
2521
|
var ErrorRender = /* @__PURE__ */ __name((props) => {
|
|
2402
2522
|
const { error, resetErrorBoundary } = props;
|
|
2403
|
-
(0,
|
|
2523
|
+
(0, import_react13.useEffect)(() => {
|
|
2404
2524
|
if (error) {
|
|
2405
2525
|
submitPostMessage({
|
|
2406
2526
|
type: "RenderError",
|
|
@@ -2421,7 +2541,7 @@ var ErrorRender = /* @__PURE__ */ __name((props) => {
|
|
|
2421
2541
|
}, [
|
|
2422
2542
|
error
|
|
2423
2543
|
]);
|
|
2424
|
-
(0,
|
|
2544
|
+
(0, import_react13.useEffect)(() => {
|
|
2425
2545
|
if (!resetErrorBoundary) return;
|
|
2426
2546
|
const hmr = getHmrApi();
|
|
2427
2547
|
if (!hmr) return;
|
|
@@ -2436,27 +2556,27 @@ var ErrorRender = /* @__PURE__ */ __name((props) => {
|
|
|
2436
2556
|
}, [
|
|
2437
2557
|
resetErrorBoundary
|
|
2438
2558
|
]);
|
|
2439
|
-
return /* @__PURE__ */
|
|
2559
|
+
return /* @__PURE__ */ import_react13.default.createElement("div", {
|
|
2440
2560
|
className: "min-h-screen flex items-center justify-center bg-white"
|
|
2441
|
-
}, /* @__PURE__ */
|
|
2561
|
+
}, /* @__PURE__ */ import_react13.default.createElement("div", {
|
|
2442
2562
|
className: "flex flex-col justify-center items-center text-center"
|
|
2443
|
-
}, /* @__PURE__ */
|
|
2563
|
+
}, /* @__PURE__ */ import_react13.default.createElement("img", {
|
|
2444
2564
|
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/illustration_empty_negative_error.svg",
|
|
2445
2565
|
alt: "render error",
|
|
2446
2566
|
className: "mb-3 w-[100px]"
|
|
2447
|
-
}), /* @__PURE__ */
|
|
2567
|
+
}), /* @__PURE__ */ import_react13.default.createElement("p", {
|
|
2448
2568
|
className: "text-l/[22px] text-[14px] text-[#1F2329] font-medium"
|
|
2449
2569
|
}, "\u9875\u9762\u51FA\u9519\u4E86")));
|
|
2450
2570
|
}, "ErrorRender");
|
|
2451
2571
|
var ErrorRender_default = ErrorRender;
|
|
2452
2572
|
|
|
2453
2573
|
// src/route-components/ActiveLink.tsx
|
|
2454
|
-
var
|
|
2574
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
2455
2575
|
var import_react_router_dom2 = require("react-router-dom");
|
|
2456
|
-
var ActiveLink = /* @__PURE__ */ (0,
|
|
2457
|
-
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 : "");
|
|
2458
2578
|
const isHashRoute = typeof to === "string" && to.startsWith("#");
|
|
2459
|
-
(0,
|
|
2579
|
+
(0, import_react14.useEffect)(() => {
|
|
2460
2580
|
if (!isHashRoute) return;
|
|
2461
2581
|
const handleHashChange = /* @__PURE__ */ __name(() => {
|
|
2462
2582
|
setCurrentHash(window.location.hash);
|
|
@@ -2468,7 +2588,7 @@ var ActiveLink = /* @__PURE__ */ (0, import_react13.forwardRef)(({ to, onClick,
|
|
|
2468
2588
|
]);
|
|
2469
2589
|
const isActive = isHashRoute && currentHash === to;
|
|
2470
2590
|
if (!isHashRoute) {
|
|
2471
|
-
return /* @__PURE__ */
|
|
2591
|
+
return /* @__PURE__ */ import_react14.default.createElement(import_react_router_dom2.NavLink, {
|
|
2472
2592
|
ref,
|
|
2473
2593
|
to,
|
|
2474
2594
|
onClick,
|
|
@@ -2509,7 +2629,7 @@ var ActiveLink = /* @__PURE__ */ (0, import_react13.forwardRef)(({ to, onClick,
|
|
|
2509
2629
|
isPending: false,
|
|
2510
2630
|
isTransitioning: false
|
|
2511
2631
|
}) : children;
|
|
2512
|
-
return /* @__PURE__ */
|
|
2632
|
+
return /* @__PURE__ */ import_react14.default.createElement("a", {
|
|
2513
2633
|
ref,
|
|
2514
2634
|
href: to,
|
|
2515
2635
|
onClick: handleHashClick,
|
|
@@ -2521,9 +2641,9 @@ var ActiveLink = /* @__PURE__ */ (0, import_react13.forwardRef)(({ to, onClick,
|
|
|
2521
2641
|
ActiveLink.displayName = "ActiveLink";
|
|
2522
2642
|
|
|
2523
2643
|
// src/route-components/NavLink.tsx
|
|
2524
|
-
var
|
|
2644
|
+
var React10 = __toESM(require("react"), 1);
|
|
2525
2645
|
var import_react_router_dom3 = require("react-router-dom");
|
|
2526
|
-
var NavLink2 = /* @__PURE__ */
|
|
2646
|
+
var NavLink2 = /* @__PURE__ */ React10.forwardRef(({ to, children, className, style, ...props }, ref) => {
|
|
2527
2647
|
const isHashLink = typeof to === "string" && to.startsWith("#");
|
|
2528
2648
|
const location = (0, import_react_router_dom3.useLocation)();
|
|
2529
2649
|
const navigate = (0, import_react_router_dom3.useNavigate)();
|
|
@@ -2547,7 +2667,7 @@ var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, sty
|
|
|
2547
2667
|
const resolvedClassName = typeof className === "function" ? className(renderProps) : className;
|
|
2548
2668
|
const resolvedStyle = typeof style === "function" ? style(renderProps) : style;
|
|
2549
2669
|
const { caseSensitive, end, replace, state, preventScrollReset, relative, viewTransition, ...restProps } = props;
|
|
2550
|
-
return /* @__PURE__ */
|
|
2670
|
+
return /* @__PURE__ */ React10.createElement("a", {
|
|
2551
2671
|
href: to,
|
|
2552
2672
|
onClick: handleClick,
|
|
2553
2673
|
ref,
|
|
@@ -2556,7 +2676,7 @@ var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, sty
|
|
|
2556
2676
|
...restProps
|
|
2557
2677
|
}, typeof children === "function" ? children(renderProps) : children);
|
|
2558
2678
|
}
|
|
2559
|
-
return /* @__PURE__ */
|
|
2679
|
+
return /* @__PURE__ */ React10.createElement(import_react_router_dom3.NavLink, {
|
|
2560
2680
|
to,
|
|
2561
2681
|
ref,
|
|
2562
2682
|
className,
|
|
@@ -2571,7 +2691,7 @@ var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, sty
|
|
|
2571
2691
|
NavLink2.displayName = "NavLink";
|
|
2572
2692
|
|
|
2573
2693
|
// src/route-components/UniversalLink.tsx
|
|
2574
|
-
var
|
|
2694
|
+
var import_react15 = __toESM(require("react"), 1);
|
|
2575
2695
|
var import_react_router_dom4 = require("react-router-dom");
|
|
2576
2696
|
function isInternalRoute(to) {
|
|
2577
2697
|
return !to.startsWith("#") && !to.startsWith("http://") && !to.startsWith("https://") && !to.startsWith("//");
|
|
@@ -2581,15 +2701,15 @@ function isExternalLink(to) {
|
|
|
2581
2701
|
return to.startsWith("http://") || to.startsWith("https://") || to.startsWith("//");
|
|
2582
2702
|
}
|
|
2583
2703
|
__name(isExternalLink, "isExternalLink");
|
|
2584
|
-
var UniversalLink = /* @__PURE__ */
|
|
2704
|
+
var UniversalLink = /* @__PURE__ */ import_react15.default.forwardRef(/* @__PURE__ */ __name(function UniversalLink2({ to, ...props }, ref) {
|
|
2585
2705
|
if (isInternalRoute(to)) {
|
|
2586
|
-
return /* @__PURE__ */
|
|
2706
|
+
return /* @__PURE__ */ import_react15.default.createElement(import_react_router_dom4.Link, {
|
|
2587
2707
|
to,
|
|
2588
2708
|
ref,
|
|
2589
2709
|
...props
|
|
2590
2710
|
});
|
|
2591
2711
|
}
|
|
2592
|
-
return /* @__PURE__ */
|
|
2712
|
+
return /* @__PURE__ */ import_react15.default.createElement("a", {
|
|
2593
2713
|
href: to,
|
|
2594
2714
|
ref,
|
|
2595
2715
|
...props,
|
|
@@ -2814,21 +2934,46 @@ function getAxiosForBackend() {
|
|
|
2814
2934
|
__name(getAxiosForBackend, "getAxiosForBackend");
|
|
2815
2935
|
var axiosForBackend = getAxiosForBackend();
|
|
2816
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
|
+
|
|
2817
2963
|
// src/integrations/dataloom.ts
|
|
2818
2964
|
var import_dataloom = require("@lark-apaas/dataloom");
|
|
2819
2965
|
var import_auth_sdk3 = require("@lark-apaas/auth-sdk");
|
|
2820
|
-
var createDataLoomClient = /* @__PURE__ */ __name(() => {
|
|
2966
|
+
var createDataLoomClient = /* @__PURE__ */ __name((url, pat) => {
|
|
2967
|
+
const { baseUrl } = url ? splitWorkspaceUrl(url) : {
|
|
2968
|
+
baseUrl: ""
|
|
2969
|
+
};
|
|
2821
2970
|
const appId = getAppId() ?? "";
|
|
2822
|
-
return (0, import_dataloom.createClient)({
|
|
2971
|
+
return (0, import_dataloom.createClient)(baseUrl, pat ?? "", {
|
|
2823
2972
|
global: {
|
|
2824
2973
|
enableDataloomLog: process.env.NODE_ENV !== "production",
|
|
2825
2974
|
requestRateLimit: process.env.NODE_ENV !== "production" ? 100 : void 0,
|
|
2826
2975
|
brandName: "miaoda",
|
|
2827
2976
|
appId,
|
|
2828
|
-
// 同源网关下不会触发预检;CSRF token 仅用于 POST/PUT/DELETE 防护。
|
|
2829
|
-
headers: {
|
|
2830
|
-
"X-Suda-Csrf-Token": getCsrfToken() ?? ""
|
|
2831
|
-
},
|
|
2832
2977
|
accountServices: {
|
|
2833
2978
|
user: import_auth_sdk3.authClient.user,
|
|
2834
2979
|
session: import_auth_sdk3.authClient.session
|
|
@@ -2845,8 +2990,10 @@ function getDataloom() {
|
|
|
2845
2990
|
if (pendingPromise3) {
|
|
2846
2991
|
return pendingPromise3;
|
|
2847
2992
|
}
|
|
2848
|
-
pendingPromise3 = getInitialInfo().then(() => {
|
|
2849
|
-
|
|
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);
|
|
2850
2997
|
return dataloom;
|
|
2851
2998
|
}).finally(() => {
|
|
2852
2999
|
pendingPromise3 = null;
|