@lark-apaas/client-toolkit-lite 1.1.15-alpha.1 → 1.1.15-alpha.11
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 +91 -78
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -3
- package/dist/index.d.ts +0 -3
- package/dist/index.js +91 -78
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -281,19 +281,18 @@ function getLegacyParentOrigin() {
|
|
|
281
281
|
return "https://miaoda.feishu-boe.cn";
|
|
282
282
|
}
|
|
283
283
|
__name(getLegacyParentOrigin, "getLegacyParentOrigin");
|
|
284
|
-
var MIAODA_PARENT_ORIGIN_RE = /^https:\/\/(miaoda|force)\.feishu(-pre|-boe|-staging)?\.cn$/;
|
|
285
284
|
function resolveParentOrigin() {
|
|
286
|
-
const paramOrigin = getParentOriginFromParams();
|
|
287
|
-
if (paramOrigin) return paramOrigin;
|
|
288
285
|
try {
|
|
289
286
|
if (document.referrer) {
|
|
290
287
|
const referrerOrigin = new URL(document.referrer).origin;
|
|
291
|
-
if (
|
|
288
|
+
if (referrerOrigin.startsWith("http://localhost") || referrerOrigin.startsWith("http://127.0.0.1")) {
|
|
292
289
|
return referrerOrigin;
|
|
293
290
|
}
|
|
294
291
|
}
|
|
295
292
|
} catch {
|
|
296
293
|
}
|
|
294
|
+
const paramOrigin = getParentOriginFromParams();
|
|
295
|
+
if (paramOrigin) return paramOrigin;
|
|
297
296
|
return process.env?.FORCE_FRAMEWORK_DOMAIN_MAIN ?? getLegacyParentOrigin();
|
|
298
297
|
}
|
|
299
298
|
__name(resolveParentOrigin, "resolveParentOrigin");
|
|
@@ -301,10 +300,7 @@ function submitPostMessage(message, targetOrigin) {
|
|
|
301
300
|
try {
|
|
302
301
|
const parentOrigin = resolveParentOrigin();
|
|
303
302
|
const origin = targetOrigin ?? parentOrigin;
|
|
304
|
-
if (!origin)
|
|
305
|
-
console.error("postMessage skipped: cannot resolve parent origin");
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
303
|
+
if (!origin) return;
|
|
308
304
|
window.parent.postMessage(message, origin);
|
|
309
305
|
} catch (e) {
|
|
310
306
|
console.error("postMessage error", e);
|
|
@@ -1186,6 +1182,29 @@ function getAppId() {
|
|
|
1186
1182
|
}
|
|
1187
1183
|
__name(getAppId, "getAppId");
|
|
1188
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
|
+
|
|
1189
1208
|
// src/utils/getInitialInfo.ts
|
|
1190
1209
|
async function getAppPublished() {
|
|
1191
1210
|
try {
|
|
@@ -1516,6 +1535,10 @@ var messages = {
|
|
|
1516
1535
|
zh: "\u4E86\u89E3\u66F4\u591A",
|
|
1517
1536
|
en: "Learn more"
|
|
1518
1537
|
},
|
|
1538
|
+
"safety.report": {
|
|
1539
|
+
zh: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
|
|
1540
|
+
en: "Report"
|
|
1541
|
+
},
|
|
1519
1542
|
"safety.cover.pc": {
|
|
1520
1543
|
zh: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodacover.png",
|
|
1521
1544
|
en: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodacover-weben.png"
|
|
@@ -1617,7 +1640,23 @@ var getCoverUrl = /* @__PURE__ */ __name(() => t("safety.cover.pc"), "getCoverUr
|
|
|
1617
1640
|
var getCoverMobileUrl = /* @__PURE__ */ __name(() => t("safety.cover.mobile"), "getCoverMobileUrl");
|
|
1618
1641
|
var ICON_COMPANY_URL = "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/icon/icon_company_outlined.svg";
|
|
1619
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";
|
|
1620
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");
|
|
1621
1660
|
var badgeBase = {
|
|
1622
1661
|
...resetBase,
|
|
1623
1662
|
position: "fixed",
|
|
@@ -1962,7 +2001,24 @@ var Safety = /* @__PURE__ */ __name(() => {
|
|
|
1962
2001
|
style: infoIconMobile
|
|
1963
2002
|
}), /* @__PURE__ */ import_react5.default.createElement("p", {
|
|
1964
2003
|
style: sheetInfoText
|
|
1965
|
-
}, 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", {
|
|
1966
2022
|
style: mobileBtnRow
|
|
1967
2023
|
}, /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
1968
2024
|
style: mobileBtnOutline,
|
|
@@ -2044,7 +2100,24 @@ var Safety = /* @__PURE__ */ __name(() => {
|
|
|
2044
2100
|
style: infoIcon
|
|
2045
2101
|
}), /* @__PURE__ */ import_react5.default.createElement("p", {
|
|
2046
2102
|
style: infoText
|
|
2047
|
-
}, 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", {
|
|
2048
2121
|
style: btnRow
|
|
2049
2122
|
}, /* @__PURE__ */ import_react5.default.createElement(HoverButton, {
|
|
2050
2123
|
style: btnBase,
|
|
@@ -2074,7 +2147,7 @@ var DOUBAO_PILL_MOBILE_PNG = `${CDN}/Frame%202147223991%20(3).png`;
|
|
|
2074
2147
|
|
|
2075
2148
|
// src/components/AppContainer/Watermark.tsx
|
|
2076
2149
|
var DOUBAO_SOURCE = "5";
|
|
2077
|
-
var REPORT_ENABLED =
|
|
2150
|
+
var REPORT_ENABLED = true;
|
|
2078
2151
|
var BRAND_TEXT = "\u8C46\u5305 AI \u751F\u6210";
|
|
2079
2152
|
var POWERED_BY_TEXT = "\u7531\u98DE\u4E66\u5999\u642D\u63D0\u4F9B\u652F\u6301";
|
|
2080
2153
|
var FONT_FAMILY2 = "'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif";
|
|
@@ -2151,7 +2224,7 @@ var Avatar = /* @__PURE__ */ __name(({ size }) => /* @__PURE__ */ import_react6.
|
|
|
2151
2224
|
display: "block"
|
|
2152
2225
|
}
|
|
2153
2226
|
}), "Avatar");
|
|
2154
|
-
var Pill = /* @__PURE__ */ __name(({ variant, onClose }) => {
|
|
2227
|
+
var Pill = /* @__PURE__ */ __name(({ variant, onClose, showClose = false }) => {
|
|
2155
2228
|
const isDesktop = variant === "desktop";
|
|
2156
2229
|
return /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
2157
2230
|
style: {
|
|
@@ -2176,7 +2249,7 @@ var Pill = /* @__PURE__ */ __name(({ variant, onClose }) => {
|
|
|
2176
2249
|
color: "rgba(255,255,255,0.85)",
|
|
2177
2250
|
whiteSpace: "nowrap"
|
|
2178
2251
|
}
|
|
2179
|
-
}, BRAND_TEXT), isDesktop && onClose && /* @__PURE__ */ import_react6.default.createElement("span", {
|
|
2252
|
+
}, BRAND_TEXT), isDesktop && onClose && showClose && /* @__PURE__ */ import_react6.default.createElement("span", {
|
|
2180
2253
|
role: "button",
|
|
2181
2254
|
"aria-label": "\u5173\u95ED",
|
|
2182
2255
|
onClick: /* @__PURE__ */ __name((e) => {
|
|
@@ -2383,7 +2456,8 @@ var Watermark = /* @__PURE__ */ __name(() => {
|
|
|
2383
2456
|
minWidth: 144
|
|
2384
2457
|
}), /* @__PURE__ */ import_react6.default.createElement(Pill, {
|
|
2385
2458
|
variant: "desktop",
|
|
2386
|
-
onClose: /* @__PURE__ */ __name(() => setClosed(true), "onClose")
|
|
2459
|
+
onClose: /* @__PURE__ */ __name(() => setClosed(true), "onClose"),
|
|
2460
|
+
showClose: open
|
|
2387
2461
|
}));
|
|
2388
2462
|
}, "Watermark");
|
|
2389
2463
|
var Watermark_default = Watermark;
|
|
@@ -2522,29 +2596,6 @@ var isIOS = /* @__PURE__ */ __name(() => {
|
|
|
2522
2596
|
return false;
|
|
2523
2597
|
}, "isIOS");
|
|
2524
2598
|
|
|
2525
|
-
// src/utils/getEnv.ts
|
|
2526
|
-
function getEnv() {
|
|
2527
|
-
switch (globalThis.ENVIRONMENT) {
|
|
2528
|
-
case "staging":
|
|
2529
|
-
return "BOE";
|
|
2530
|
-
case "gray":
|
|
2531
|
-
return "PRE";
|
|
2532
|
-
case "online":
|
|
2533
|
-
return "ONLINE";
|
|
2534
|
-
default:
|
|
2535
|
-
break;
|
|
2536
|
-
}
|
|
2537
|
-
const { origin } = window.location;
|
|
2538
|
-
if (origin.includes("feishuapp.cn") || origin.includes("miaoda.feishuapp.net") || origin.includes("aiforce.cloud") || origin.includes("aiforce.run")) {
|
|
2539
|
-
return "ONLINE";
|
|
2540
|
-
} 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")) {
|
|
2541
|
-
return "PRE";
|
|
2542
|
-
} else {
|
|
2543
|
-
return "BOE";
|
|
2544
|
-
}
|
|
2545
|
-
}
|
|
2546
|
-
__name(getEnv, "getEnv");
|
|
2547
|
-
|
|
2548
2599
|
// src/components/AppContainer/utils/getLarkUser.ts
|
|
2549
2600
|
async function getLarkUserInfo() {
|
|
2550
2601
|
const appId = getAppId();
|
|
@@ -2910,57 +2961,19 @@ function isExternalLink(to) {
|
|
|
2910
2961
|
return to.startsWith("http://") || to.startsWith("https://") || to.startsWith("//");
|
|
2911
2962
|
}
|
|
2912
2963
|
__name(isExternalLink, "isExternalLink");
|
|
2913
|
-
var
|
|
2914
|
-
function isIframeUnderMiaoda() {
|
|
2915
|
-
if (typeof window === "undefined") return false;
|
|
2916
|
-
if (window.parent === window) return false;
|
|
2917
|
-
try {
|
|
2918
|
-
if (!document.referrer) return false;
|
|
2919
|
-
const refOrigin = new URL(document.referrer).origin;
|
|
2920
|
-
return MIAODA_PARENT_ORIGIN_RE2.test(refOrigin);
|
|
2921
|
-
} catch {
|
|
2922
|
-
return false;
|
|
2923
|
-
}
|
|
2924
|
-
}
|
|
2925
|
-
__name(isIframeUnderMiaoda, "isIframeUnderMiaoda");
|
|
2926
|
-
var UniversalLink = /* @__PURE__ */ import_react15.default.forwardRef(/* @__PURE__ */ __name(function UniversalLink2({ to, onClick, ...props }, ref) {
|
|
2927
|
-
const isExternal = isExternalLink(to);
|
|
2928
|
-
const preview = (isPreview() || isIframeUnderMiaoda()) && isExternal;
|
|
2929
|
-
if (preview) {
|
|
2930
|
-
const handlePreviewClick = /* @__PURE__ */ __name((e) => {
|
|
2931
|
-
e.preventDefault();
|
|
2932
|
-
onClick?.(e);
|
|
2933
|
-
submitPostMessage({
|
|
2934
|
-
type: "OpenLink",
|
|
2935
|
-
data: {
|
|
2936
|
-
href: to,
|
|
2937
|
-
external: true
|
|
2938
|
-
}
|
|
2939
|
-
});
|
|
2940
|
-
}, "handlePreviewClick");
|
|
2941
|
-
return /* @__PURE__ */ import_react15.default.createElement("a", {
|
|
2942
|
-
href: to,
|
|
2943
|
-
ref,
|
|
2944
|
-
...props,
|
|
2945
|
-
onClick: handlePreviewClick,
|
|
2946
|
-
target: props.target ?? "_blank",
|
|
2947
|
-
rel: props.rel ?? "noopener noreferrer"
|
|
2948
|
-
});
|
|
2949
|
-
}
|
|
2964
|
+
var UniversalLink = /* @__PURE__ */ import_react15.default.forwardRef(/* @__PURE__ */ __name(function UniversalLink2({ to, ...props }, ref) {
|
|
2950
2965
|
if (isInternalRoute(to)) {
|
|
2951
2966
|
return /* @__PURE__ */ import_react15.default.createElement(import_react_router_dom4.Link, {
|
|
2952
2967
|
to,
|
|
2953
2968
|
ref,
|
|
2954
|
-
...props
|
|
2955
|
-
onClick
|
|
2969
|
+
...props
|
|
2956
2970
|
});
|
|
2957
2971
|
}
|
|
2958
2972
|
return /* @__PURE__ */ import_react15.default.createElement("a", {
|
|
2959
2973
|
href: to,
|
|
2960
2974
|
ref,
|
|
2961
2975
|
...props,
|
|
2962
|
-
|
|
2963
|
-
...isExternal && {
|
|
2976
|
+
...isExternalLink(to) && {
|
|
2964
2977
|
target: props.target ?? "_blank",
|
|
2965
2978
|
rel: props.rel ?? "noopener noreferrer"
|
|
2966
2979
|
}
|