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