@lark-apaas/client-toolkit-lite 1.1.15-alpha.10 → 1.1.15-alpha.12
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 +119 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +119 -33
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1182,6 +1182,29 @@ function getAppId() {
|
|
|
1182
1182
|
}
|
|
1183
1183
|
__name(getAppId, "getAppId");
|
|
1184
1184
|
|
|
1185
|
+
// src/utils/getEnv.ts
|
|
1186
|
+
function getEnv() {
|
|
1187
|
+
switch (globalThis.ENVIRONMENT) {
|
|
1188
|
+
case "staging":
|
|
1189
|
+
return "BOE";
|
|
1190
|
+
case "gray":
|
|
1191
|
+
return "PRE";
|
|
1192
|
+
case "online":
|
|
1193
|
+
return "ONLINE";
|
|
1194
|
+
default:
|
|
1195
|
+
break;
|
|
1196
|
+
}
|
|
1197
|
+
const { origin } = window.location;
|
|
1198
|
+
if (origin.includes("feishuapp.cn") || origin.includes("miaoda.feishuapp.net") || origin.includes("aiforce.cloud") || origin.includes("aiforce.run")) {
|
|
1199
|
+
return "ONLINE";
|
|
1200
|
+
} 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")) {
|
|
1201
|
+
return "PRE";
|
|
1202
|
+
} else {
|
|
1203
|
+
return "BOE";
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
__name(getEnv, "getEnv");
|
|
1207
|
+
|
|
1185
1208
|
// src/utils/getInitialInfo.ts
|
|
1186
1209
|
async function getAppPublished() {
|
|
1187
1210
|
try {
|
|
@@ -1512,6 +1535,10 @@ var messages = {
|
|
|
1512
1535
|
zh: "\u4E86\u89E3\u66F4\u591A",
|
|
1513
1536
|
en: "Learn more"
|
|
1514
1537
|
},
|
|
1538
|
+
"safety.report": {
|
|
1539
|
+
zh: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
|
|
1540
|
+
en: "Report"
|
|
1541
|
+
},
|
|
1515
1542
|
"safety.cover.pc": {
|
|
1516
1543
|
zh: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodacover.png",
|
|
1517
1544
|
en: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodacover-weben.png"
|
|
@@ -1613,7 +1640,23 @@ var getCoverUrl = /* @__PURE__ */ __name(() => t("safety.cover.pc"), "getCoverUr
|
|
|
1613
1640
|
var getCoverMobileUrl = /* @__PURE__ */ __name(() => t("safety.cover.mobile"), "getCoverMobileUrl");
|
|
1614
1641
|
var ICON_COMPANY_URL = "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/icon/icon_company_outlined.svg";
|
|
1615
1642
|
var ICON_AI_URL = "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/icon/icon_efficiency-ai_outlined.svg";
|
|
1643
|
+
var ICON_FEEDBACK_URL = "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miaoda-ui/icon_feedback_outlined.png";
|
|
1616
1644
|
var LANDING_URL = "https://miaoda.feishu.cn/landing";
|
|
1645
|
+
var REPORT_DOMAIN = {
|
|
1646
|
+
BOE: "tns.feishu-boe.cn",
|
|
1647
|
+
PRE: "tns.feishu-pre.cn",
|
|
1648
|
+
ONLINE: "tns.feishu.cn"
|
|
1649
|
+
};
|
|
1650
|
+
var openReport = /* @__PURE__ */ __name(() => {
|
|
1651
|
+
const params = JSON.stringify({
|
|
1652
|
+
scene: "miaoda_app_report",
|
|
1653
|
+
entity_id: getAppId() ?? "",
|
|
1654
|
+
entity_type: "miaoda_app",
|
|
1655
|
+
extra: ""
|
|
1656
|
+
});
|
|
1657
|
+
const url = `https://${REPORT_DOMAIN[getEnv()]}/cust/lark_report/?type=common¶ms=${encodeURIComponent(params)}&lang=zh-CN`;
|
|
1658
|
+
window.open(url, "_blank", "noopener,noreferrer");
|
|
1659
|
+
}, "openReport");
|
|
1617
1660
|
var badgeBase = {
|
|
1618
1661
|
...resetBase,
|
|
1619
1662
|
position: "fixed",
|
|
@@ -1958,7 +2001,24 @@ var Safety = /* @__PURE__ */ __name(() => {
|
|
|
1958
2001
|
style: infoIconMobile
|
|
1959
2002
|
}), /* @__PURE__ */ import_react5.default.createElement("p", {
|
|
1960
2003
|
style: sheetInfoText
|
|
1961
|
-
}, t("safety.ai.disclaimer")))
|
|
2004
|
+
}, t("safety.ai.disclaimer"))), /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
2005
|
+
style: {
|
|
2006
|
+
...infoRow,
|
|
2007
|
+
cursor: "pointer"
|
|
2008
|
+
},
|
|
2009
|
+
"data-custom-element": "safety-report",
|
|
2010
|
+
onClick: openReport
|
|
2011
|
+
}, /* @__PURE__ */ import_react5.default.createElement("img", {
|
|
2012
|
+
src: ICON_FEEDBACK_URL,
|
|
2013
|
+
style: infoIconMobile
|
|
2014
|
+
}), /* @__PURE__ */ import_react5.default.createElement("p", {
|
|
2015
|
+
style: {
|
|
2016
|
+
...sheetInfoText,
|
|
2017
|
+
cursor: "pointer",
|
|
2018
|
+
textDecoration: "underline",
|
|
2019
|
+
textUnderlineOffset: "2px"
|
|
2020
|
+
}
|
|
2021
|
+
}, t("safety.report")))), /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
1962
2022
|
style: mobileBtnRow
|
|
1963
2023
|
}, /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
1964
2024
|
style: mobileBtnOutline,
|
|
@@ -2040,7 +2100,24 @@ var Safety = /* @__PURE__ */ __name(() => {
|
|
|
2040
2100
|
style: infoIcon
|
|
2041
2101
|
}), /* @__PURE__ */ import_react5.default.createElement("p", {
|
|
2042
2102
|
style: infoText
|
|
2043
|
-
}, t("safety.ai.disclaimer")))
|
|
2103
|
+
}, t("safety.ai.disclaimer"))), /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
2104
|
+
style: {
|
|
2105
|
+
...infoRow,
|
|
2106
|
+
cursor: "pointer"
|
|
2107
|
+
},
|
|
2108
|
+
"data-custom-element": "safety-report",
|
|
2109
|
+
onClick: openReport
|
|
2110
|
+
}, /* @__PURE__ */ import_react5.default.createElement("img", {
|
|
2111
|
+
src: ICON_FEEDBACK_URL,
|
|
2112
|
+
style: infoIcon
|
|
2113
|
+
}), /* @__PURE__ */ import_react5.default.createElement("p", {
|
|
2114
|
+
style: {
|
|
2115
|
+
...infoText,
|
|
2116
|
+
cursor: "pointer",
|
|
2117
|
+
textDecoration: "underline",
|
|
2118
|
+
textUnderlineOffset: "2px"
|
|
2119
|
+
}
|
|
2120
|
+
}, t("safety.report")))), /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
2044
2121
|
style: btnRow
|
|
2045
2122
|
}, /* @__PURE__ */ import_react5.default.createElement(HoverButton, {
|
|
2046
2123
|
style: btnBase,
|
|
@@ -2070,7 +2147,7 @@ var DOUBAO_PILL_MOBILE_PNG = `${CDN}/Frame%202147223991%20(3).png`;
|
|
|
2070
2147
|
|
|
2071
2148
|
// src/components/AppContainer/Watermark.tsx
|
|
2072
2149
|
var DOUBAO_SOURCE = "5";
|
|
2073
|
-
var REPORT_ENABLED =
|
|
2150
|
+
var REPORT_ENABLED = true;
|
|
2074
2151
|
var BRAND_TEXT = "\u8C46\u5305 AI \u751F\u6210";
|
|
2075
2152
|
var POWERED_BY_TEXT = "\u7531\u98DE\u4E66\u5999\u642D\u63D0\u4F9B\u652F\u6301";
|
|
2076
2153
|
var FONT_FAMILY2 = "'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif";
|
|
@@ -2147,7 +2224,7 @@ var Avatar = /* @__PURE__ */ __name(({ size }) => /* @__PURE__ */ import_react6.
|
|
|
2147
2224
|
display: "block"
|
|
2148
2225
|
}
|
|
2149
2226
|
}), "Avatar");
|
|
2150
|
-
var Pill = /* @__PURE__ */ __name(({ variant, onClose }) => {
|
|
2227
|
+
var Pill = /* @__PURE__ */ __name(({ variant, onClose, showClose = false }) => {
|
|
2151
2228
|
const isDesktop = variant === "desktop";
|
|
2152
2229
|
return /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
2153
2230
|
style: {
|
|
@@ -2172,7 +2249,7 @@ var Pill = /* @__PURE__ */ __name(({ variant, onClose }) => {
|
|
|
2172
2249
|
color: "rgba(255,255,255,0.85)",
|
|
2173
2250
|
whiteSpace: "nowrap"
|
|
2174
2251
|
}
|
|
2175
|
-
}, BRAND_TEXT), isDesktop && onClose && /* @__PURE__ */ import_react6.default.createElement("span", {
|
|
2252
|
+
}, BRAND_TEXT), isDesktop && onClose && showClose && /* @__PURE__ */ import_react6.default.createElement("span", {
|
|
2176
2253
|
role: "button",
|
|
2177
2254
|
"aria-label": "\u5173\u95ED",
|
|
2178
2255
|
onClick: /* @__PURE__ */ __name((e) => {
|
|
@@ -2379,7 +2456,8 @@ var Watermark = /* @__PURE__ */ __name(() => {
|
|
|
2379
2456
|
minWidth: 144
|
|
2380
2457
|
}), /* @__PURE__ */ import_react6.default.createElement(Pill, {
|
|
2381
2458
|
variant: "desktop",
|
|
2382
|
-
onClose: /* @__PURE__ */ __name(() => setClosed(true), "onClose")
|
|
2459
|
+
onClose: /* @__PURE__ */ __name(() => setClosed(true), "onClose"),
|
|
2460
|
+
showClose: open
|
|
2383
2461
|
}));
|
|
2384
2462
|
}, "Watermark");
|
|
2385
2463
|
var Watermark_default = Watermark;
|
|
@@ -2518,29 +2596,6 @@ var isIOS = /* @__PURE__ */ __name(() => {
|
|
|
2518
2596
|
return false;
|
|
2519
2597
|
}, "isIOS");
|
|
2520
2598
|
|
|
2521
|
-
// src/utils/getEnv.ts
|
|
2522
|
-
function getEnv() {
|
|
2523
|
-
switch (globalThis.ENVIRONMENT) {
|
|
2524
|
-
case "staging":
|
|
2525
|
-
return "BOE";
|
|
2526
|
-
case "gray":
|
|
2527
|
-
return "PRE";
|
|
2528
|
-
case "online":
|
|
2529
|
-
return "ONLINE";
|
|
2530
|
-
default:
|
|
2531
|
-
break;
|
|
2532
|
-
}
|
|
2533
|
-
const { origin } = window.location;
|
|
2534
|
-
if (origin.includes("feishuapp.cn") || origin.includes("miaoda.feishuapp.net") || origin.includes("aiforce.cloud") || origin.includes("aiforce.run")) {
|
|
2535
|
-
return "ONLINE";
|
|
2536
|
-
} 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")) {
|
|
2537
|
-
return "PRE";
|
|
2538
|
-
} else {
|
|
2539
|
-
return "BOE";
|
|
2540
|
-
}
|
|
2541
|
-
}
|
|
2542
|
-
__name(getEnv, "getEnv");
|
|
2543
|
-
|
|
2544
2599
|
// src/components/AppContainer/utils/getLarkUser.ts
|
|
2545
2600
|
async function getLarkUserInfo() {
|
|
2546
2601
|
const appId = getAppId();
|
|
@@ -3139,12 +3194,41 @@ function getAxiosForBackend() {
|
|
|
3139
3194
|
__name(getAxiosForBackend, "getAxiosForBackend");
|
|
3140
3195
|
var axiosForBackend = getAxiosForBackend();
|
|
3141
3196
|
|
|
3197
|
+
// src/utils/url.ts
|
|
3198
|
+
function splitWorkspaceUrl(fullUrl) {
|
|
3199
|
+
try {
|
|
3200
|
+
const url = new URL(fullUrl);
|
|
3201
|
+
const pathParts = url.pathname.split("/");
|
|
3202
|
+
const workspacesIndex = pathParts.findIndex((part) => part === "workspaces");
|
|
3203
|
+
if (workspacesIndex === -1) {
|
|
3204
|
+
throw new Error("Invalid workspace URL format");
|
|
3205
|
+
}
|
|
3206
|
+
const basePathParts = pathParts.slice(0, workspacesIndex);
|
|
3207
|
+
const workspace = pathParts[workspacesIndex + 1];
|
|
3208
|
+
return {
|
|
3209
|
+
baseUrl: `${url.origin}${basePathParts.join("/")}`,
|
|
3210
|
+
workspace
|
|
3211
|
+
};
|
|
3212
|
+
} catch (error) {
|
|
3213
|
+
console.error("Error splitting workspace URL:", error);
|
|
3214
|
+
}
|
|
3215
|
+
return {
|
|
3216
|
+
baseUrl: fullUrl,
|
|
3217
|
+
// 兜底给一个,不要给空字符串,不然 createClient 都直接挂了,页面会白屏,体感不太好
|
|
3218
|
+
workspace: "workspace"
|
|
3219
|
+
};
|
|
3220
|
+
}
|
|
3221
|
+
__name(splitWorkspaceUrl, "splitWorkspaceUrl");
|
|
3222
|
+
|
|
3142
3223
|
// src/integrations/dataloom.ts
|
|
3143
3224
|
var import_dataloom = require("@lark-apaas/dataloom");
|
|
3144
3225
|
var import_auth_sdk3 = require("@lark-apaas/auth-sdk");
|
|
3145
|
-
var createDataLoomClient = /* @__PURE__ */ __name(() => {
|
|
3226
|
+
var createDataLoomClient = /* @__PURE__ */ __name((url, pat) => {
|
|
3227
|
+
const { baseUrl } = url ? splitWorkspaceUrl(url) : {
|
|
3228
|
+
baseUrl: ""
|
|
3229
|
+
};
|
|
3146
3230
|
const appId = getAppId() ?? "";
|
|
3147
|
-
return (0, import_dataloom.createClient)({
|
|
3231
|
+
return (0, import_dataloom.createClient)(baseUrl, pat ?? "", {
|
|
3148
3232
|
global: {
|
|
3149
3233
|
enableDataloomLog: process.env.NODE_ENV !== "production",
|
|
3150
3234
|
requestRateLimit: process.env.NODE_ENV !== "production" ? 100 : void 0,
|
|
@@ -3166,8 +3250,10 @@ function getDataloom() {
|
|
|
3166
3250
|
if (pendingPromise3) {
|
|
3167
3251
|
return pendingPromise3;
|
|
3168
3252
|
}
|
|
3169
|
-
pendingPromise3 = getInitialInfo().then(() => {
|
|
3170
|
-
|
|
3253
|
+
pendingPromise3 = getInitialInfo().then((info) => {
|
|
3254
|
+
const DATALOOM_CLIENT_URL = info?.app_runtime_extra?.url;
|
|
3255
|
+
const DATALOOM_PAT = info?.app_runtime_extra?.token;
|
|
3256
|
+
dataloom = createDataLoomClient(DATALOOM_CLIENT_URL, DATALOOM_PAT);
|
|
3171
3257
|
return dataloom;
|
|
3172
3258
|
}).finally(() => {
|
|
3173
3259
|
pendingPromise3 = null;
|