@lark-apaas/client-toolkit 1.2.66 → 1.2.67-alpha.20260825152454

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.
@@ -36,7 +36,7 @@ export declare const MenuCard: React.FC<{
36
36
  style?: React.CSSProperties;
37
37
  }>;
38
38
  /**
39
- * 豆包水印:仅当应用来源为豆包时,在视口右下角展示收起态药丸(头像 +「豆包AI」)。
39
+ * 豆包水印:在视口右下角展示收起态药丸(头像 +「豆包AI」)。
40
40
  *
41
41
  * 设计稿:Figma 1582:41560(桌面)/ 1582:41777(移动)。
42
42
  * - 药丸 / 卡片本体用代码画(投影走 CSS box-shadow、图标用无滤镜小 SVG),高分屏清晰。
@@ -44,6 +44,8 @@ export declare const MenuCard: React.FC<{
44
44
  * - 移动端 tap 徽标 → 上方弹卡片(投诉与举报 / 不再展示 / 由飞书妙搭提供支持)。
45
45
  * - 「投诉与举报」点击跳飞书风控举报中心(tns,域名随环境);后端链接未就绪时由 REPORT_ENABLED 整体隐藏。
46
46
  * - 不加 NODE_ENV 判断——预览态与运行态都要展示。
47
+ * - show_badge=false(后端 get_published 接口返回)时不展示。
48
+ * - 用户点击关闭后 localStorage 记忆,刷新不再展示。
47
49
  */
48
50
  declare const Watermark: React.FC;
49
51
  export default Watermark;
@@ -1,9 +1,10 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useRef, useState } from "react";
2
+ import { useEffect, useRef, useState } from "react";
3
3
  import { Content, Portal, Root, Trigger } from "@radix-ui/react-popover";
4
4
  import { DOUBAO_LOGO_SRC } from "./doubao-watermark-asset.js";
5
5
  import { getAppId } from "../../utils/getAppId.js";
6
6
  import { getEnv } from "../../utils/getParentOrigin.js";
7
+ import { getInitialInfo } from "../../utils/getInitialInfo.js";
7
8
  import { useIsMobile } from "../../hooks/index.js";
8
9
  const REPORT_ENABLED = true;
9
10
  const BRAND_TEXT = '豆包 AI 生成';
@@ -285,13 +286,41 @@ const MobileWatermark = ({ onDontShow })=>{
285
286
  });
286
287
  };
287
288
  const Watermark_Watermark = ()=>{
288
- const [closed, setClosed] = useState(false);
289
+ const appId = getAppId();
290
+ const storageKey = `miaoda-creatByMiaodo-has-closed-${appId}`;
291
+ const [closed, setClosed] = useState(()=>{
292
+ try {
293
+ return !!window.localStorage?.getItem(storageKey);
294
+ } catch {
295
+ return false;
296
+ }
297
+ });
298
+ const [showBadge, setShowBadge] = useState(true);
299
+ const [loaded, setLoaded] = useState(false);
289
300
  const [open, setOpen] = useState(false);
290
301
  const timer = useRef(null);
291
302
  const isMobile = useIsMobile();
303
+ useEffect(()=>{
304
+ getInitialInfo().then((info)=>{
305
+ const badge = info?.app_info?.show_badge;
306
+ setShowBadge(false !== badge);
307
+ }).catch(()=>{
308
+ setShowBadge(true);
309
+ }).finally(()=>{
310
+ setLoaded(true);
311
+ });
312
+ }, []);
313
+ if (!loaded) return null;
314
+ if (!showBadge) return null;
292
315
  if (closed) return null;
316
+ const handleClose = ()=>{
317
+ setClosed(true);
318
+ try {
319
+ window.localStorage?.setItem(storageKey, 'true');
320
+ } catch {}
321
+ };
293
322
  if (isMobile) return /*#__PURE__*/ jsx(MobileWatermark, {
294
- onDontShow: ()=>setClosed(true)
323
+ onDontShow: handleClose
295
324
  });
296
325
  const enter = ()=>{
297
326
  if (timer.current) clearTimeout(timer.current);
@@ -329,7 +358,7 @@ const Watermark_Watermark = ()=>{
329
358
  }),
330
359
  /*#__PURE__*/ jsx(Pill, {
331
360
  variant: "desktop",
332
- onClose: ()=>setClosed(true),
361
+ onClose: handleClose,
333
362
  showClose: open
334
363
  })
335
364
  ]
@@ -9,6 +9,8 @@ interface AppRuntimePublished {
9
9
  js_urls?: string[];
10
10
  app_avatar?: string;
11
11
  app_description?: string;
12
+ /** 是否展示豆包水印徽标;后端缺省视为 true */
13
+ show_badge?: boolean;
12
14
  }
13
15
  interface BucketConfig {
14
16
  default_bucket_id?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/client-toolkit",
3
- "version": "1.2.66",
3
+ "version": "1.2.67-alpha.20260825152454",
4
4
  "types": "./lib/index.d.ts",
5
5
  "main": "./lib/index.js",
6
6
  "files": [