@lark-apaas/client-toolkit 1.2.73-alpha.20260924071509 → 1.2.73-beta.0
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/lib/components/AppContainer/Watermark.d.ts +5 -1
- package/lib/components/AppContainer/Watermark.js +84 -12
- package/lib/components/AppContainer/__test__/Watermark.test.js +2 -2
- package/lib/components/AppContainer/doubao-watermark-asset.d.ts +1 -0
- package/lib/components/AppContainer/doubao-watermark-asset.js +2 -1
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
type WatermarkVariant = 'doubao' | 'miaoda';
|
|
2
3
|
export declare const openReport: () => void;
|
|
3
4
|
export declare const FeedbackIcon: React.FC;
|
|
4
5
|
export declare const CloseIcon: React.FC<{
|
|
@@ -6,7 +7,9 @@ export declare const CloseIcon: React.FC<{
|
|
|
6
7
|
}>;
|
|
7
8
|
export declare const DownloadIcon: React.FC;
|
|
8
9
|
export declare const EfficiencyIcon: React.FC;
|
|
9
|
-
|
|
10
|
+
export declare const ReportIcon: React.FC;
|
|
11
|
+
export declare const DoubaoCloseIcon: React.FC;
|
|
12
|
+
type IconType = 'feedback' | 'close' | 'download' | 'efficiency' | 'report';
|
|
10
13
|
export declare const BrandLogo: React.FC<{
|
|
11
14
|
src: string;
|
|
12
15
|
size: number;
|
|
@@ -15,6 +18,7 @@ export declare const Pill: React.FC<{
|
|
|
15
18
|
platform: 'desktop' | 'mobile';
|
|
16
19
|
brandText: string;
|
|
17
20
|
logoSrc: string;
|
|
21
|
+
variant?: WatermarkVariant;
|
|
18
22
|
onClose?: () => void;
|
|
19
23
|
showClose?: boolean;
|
|
20
24
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
3
|
import { Content, Portal, Root, Trigger } from "@radix-ui/react-popover";
|
|
4
|
-
import { DOUBAO_LOGO_SRC, MIAODA_LOGO_SRC } from "./doubao-watermark-asset.js";
|
|
4
|
+
import { DOUBAO_BRAND_TEXT_SRC, DOUBAO_LOGO_SRC, MIAODA_LOGO_SRC } from "./doubao-watermark-asset.js";
|
|
5
5
|
import { getAppId } from "../../utils/getAppId.js";
|
|
6
6
|
import { getEnv } from "../../utils/getParentOrigin.js";
|
|
7
7
|
import { getInitialInfo } from "../../utils/getInitialInfo.js";
|
|
@@ -10,7 +10,7 @@ const DOUBAO_SOURCE = '5';
|
|
|
10
10
|
const VARIANT = String(process.env.MIAODA_APP_SOURCE) === DOUBAO_SOURCE ? 'doubao' : 'miaoda';
|
|
11
11
|
const VARIANT_CONFIG = {
|
|
12
12
|
doubao: {
|
|
13
|
-
brandText: '
|
|
13
|
+
brandText: '豆包工作 AI 生成',
|
|
14
14
|
logoSrc: DOUBAO_LOGO_SRC,
|
|
15
15
|
downloadUrl: 'https://ugapk.com/FCtLH'
|
|
16
16
|
},
|
|
@@ -130,8 +130,56 @@ const EfficiencyIcon = ()=>/*#__PURE__*/ jsxs("svg", {
|
|
|
130
130
|
})
|
|
131
131
|
]
|
|
132
132
|
});
|
|
133
|
+
const ReportIcon = ()=>/*#__PURE__*/ jsxs("svg", {
|
|
134
|
+
width: 16,
|
|
135
|
+
height: 16,
|
|
136
|
+
viewBox: "0 0 16 16",
|
|
137
|
+
fill: "none",
|
|
138
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
139
|
+
style: {
|
|
140
|
+
display: 'block',
|
|
141
|
+
flexShrink: 0
|
|
142
|
+
},
|
|
143
|
+
children: [
|
|
144
|
+
/*#__PURE__*/ jsx("path", {
|
|
145
|
+
d: "M7.13397 2.5C7.51887 1.83333 8.48113 1.83333 8.86603 2.5L14.0622 11.5C14.4471 12.1667 13.966 13 13.1962 13H2.80385C2.03405 13 1.55292 12.1667 1.93782 11.5L7.13397 2.5Z",
|
|
146
|
+
stroke: "currentColor",
|
|
147
|
+
strokeWidth: 1.2,
|
|
148
|
+
fill: "none"
|
|
149
|
+
}),
|
|
150
|
+
/*#__PURE__*/ jsx("path", {
|
|
151
|
+
d: "M8 6.16667V8.83333",
|
|
152
|
+
stroke: "currentColor",
|
|
153
|
+
strokeWidth: 1.2,
|
|
154
|
+
strokeLinecap: "round"
|
|
155
|
+
}),
|
|
156
|
+
/*#__PURE__*/ jsx("circle", {
|
|
157
|
+
cx: 8,
|
|
158
|
+
cy: 10.6667,
|
|
159
|
+
r: 0.6667,
|
|
160
|
+
fill: "currentColor"
|
|
161
|
+
})
|
|
162
|
+
]
|
|
163
|
+
});
|
|
164
|
+
const DoubaoCloseIcon = ()=>/*#__PURE__*/ jsx("svg", {
|
|
165
|
+
width: 12,
|
|
166
|
+
height: 12,
|
|
167
|
+
viewBox: "0 0 12 12",
|
|
168
|
+
fill: "none",
|
|
169
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
170
|
+
style: {
|
|
171
|
+
display: 'block',
|
|
172
|
+
flexShrink: 0
|
|
173
|
+
},
|
|
174
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
175
|
+
d: "M9.91685 2.08234C10.2097 2.37519 10.2096 2.8501 9.91685 3.143L7.06253 5.99732L9.91858 8.85337C10.2114 9.14627 10.2115 9.62115 9.91858 9.91403C9.62568 10.2068 9.15076 10.2068 8.85792 9.91403L6.00187 7.05798L3.14444 9.91541C2.85155 10.2083 2.37667 10.2083 2.08378 9.91541C1.791 9.62251 1.79093 9.14761 2.08378 8.85475L4.94121 5.99732L2.08551 3.14162C1.79267 2.84878 1.79278 2.37387 2.08551 2.08096C2.3784 1.78807 2.85327 1.78807 3.14617 2.08096L6.00187 4.93666L8.85619 2.08234C9.14906 1.78961 9.62399 1.7896 9.91685 2.08234Z",
|
|
176
|
+
fill: "white",
|
|
177
|
+
fillOpacity: 0.3
|
|
178
|
+
})
|
|
179
|
+
});
|
|
133
180
|
const IconMap = {
|
|
134
181
|
feedback: FeedbackIcon,
|
|
182
|
+
report: ReportIcon,
|
|
135
183
|
close: ()=>/*#__PURE__*/ jsx(CloseIcon, {
|
|
136
184
|
size: 16
|
|
137
185
|
}),
|
|
@@ -153,10 +201,20 @@ const BrandLogo = ({ src, size })=>/*#__PURE__*/ jsx("img", {
|
|
|
153
201
|
display: 'block'
|
|
154
202
|
}
|
|
155
203
|
});
|
|
156
|
-
const Pill = ({ platform, brandText, logoSrc, onClose, showClose = false })=>{
|
|
204
|
+
const Pill = ({ platform, brandText, logoSrc, variant, onClose, showClose = false })=>{
|
|
157
205
|
const isDesktop = 'desktop' === platform;
|
|
206
|
+
const isDoubao = 'doubao' === variant;
|
|
158
207
|
return /*#__PURE__*/ jsxs("div", {
|
|
159
|
-
style: {
|
|
208
|
+
style: isDoubao ? {
|
|
209
|
+
boxSizing: 'border-box',
|
|
210
|
+
display: 'inline-flex',
|
|
211
|
+
alignItems: 'center',
|
|
212
|
+
gap: 3.4,
|
|
213
|
+
padding: isDesktop ? '5px 10px 5px 7px' : '6px 12px 6px 8px',
|
|
214
|
+
background: 'rgba(77,77,77,0.7)',
|
|
215
|
+
borderRadius: 8.5,
|
|
216
|
+
cursor: 'pointer'
|
|
217
|
+
} : {
|
|
160
218
|
boxSizing: 'border-box',
|
|
161
219
|
display: 'inline-flex',
|
|
162
220
|
alignItems: 'center',
|
|
@@ -171,9 +229,19 @@ const Pill = ({ platform, brandText, logoSrc, onClose, showClose = false })=>{
|
|
|
171
229
|
children: [
|
|
172
230
|
/*#__PURE__*/ jsx(BrandLogo, {
|
|
173
231
|
src: logoSrc,
|
|
174
|
-
size: 16
|
|
232
|
+
size: isDoubao ? 17 : 16
|
|
175
233
|
}),
|
|
176
|
-
/*#__PURE__*/ jsx("
|
|
234
|
+
isDoubao ? /*#__PURE__*/ jsx("img", {
|
|
235
|
+
src: DOUBAO_BRAND_TEXT_SRC,
|
|
236
|
+
alt: brandText,
|
|
237
|
+
draggable: false,
|
|
238
|
+
style: {
|
|
239
|
+
height: isDesktop ? 12 : 14,
|
|
240
|
+
width: 'auto',
|
|
241
|
+
display: 'block',
|
|
242
|
+
flexShrink: 0
|
|
243
|
+
}
|
|
244
|
+
}) : /*#__PURE__*/ jsx("span", {
|
|
177
245
|
style: {
|
|
178
246
|
fontFamily: FONT_FAMILY,
|
|
179
247
|
fontSize: isDesktop ? 12 : 14,
|
|
@@ -195,9 +263,11 @@ const Pill = ({ platform, brandText, logoSrc, onClose, showClose = false })=>{
|
|
|
195
263
|
alignItems: 'center',
|
|
196
264
|
cursor: 'pointer',
|
|
197
265
|
flexShrink: 0,
|
|
198
|
-
|
|
266
|
+
...isDoubao ? {} : {
|
|
267
|
+
color: 'rgba(255,255,255,0.5)'
|
|
268
|
+
}
|
|
199
269
|
},
|
|
200
|
-
children: /*#__PURE__*/ jsx(CloseIcon, {
|
|
270
|
+
children: isDoubao ? /*#__PURE__*/ jsx(DoubaoCloseIcon, {}) : /*#__PURE__*/ jsx(CloseIcon, {
|
|
201
271
|
size: 10
|
|
202
272
|
})
|
|
203
273
|
})
|
|
@@ -314,7 +384,7 @@ const MobileWatermark = ({ onDontShow })=>{
|
|
|
314
384
|
onClick: ()=>window.open(VARIANT_CONFIG.miaoda.landingUrl, '_blank', 'noopener,noreferrer')
|
|
315
385
|
});
|
|
316
386
|
if (REPORT_ENABLED) items.push({
|
|
317
|
-
icon: 'feedback',
|
|
387
|
+
icon: 'doubao' === VARIANT ? 'report' : 'feedback',
|
|
318
388
|
label: '投诉与举报',
|
|
319
389
|
onClick: openReport
|
|
320
390
|
});
|
|
@@ -346,7 +416,8 @@ const MobileWatermark = ({ onDontShow })=>{
|
|
|
346
416
|
children: /*#__PURE__*/ jsx(Pill, {
|
|
347
417
|
platform: "mobile",
|
|
348
418
|
brandText: config.brandText,
|
|
349
|
-
logoSrc: config.logoSrc
|
|
419
|
+
logoSrc: config.logoSrc,
|
|
420
|
+
variant: VARIANT
|
|
350
421
|
})
|
|
351
422
|
})
|
|
352
423
|
}),
|
|
@@ -426,7 +497,7 @@ const Watermark_Watermark = ()=>{
|
|
|
426
497
|
onClick: ()=>window.open(VARIANT_CONFIG.miaoda.landingUrl, '_blank', 'noopener,noreferrer')
|
|
427
498
|
});
|
|
428
499
|
if (REPORT_ENABLED) desktopItems.push({
|
|
429
|
-
icon: 'feedback',
|
|
500
|
+
icon: 'doubao' === VARIANT ? 'report' : 'feedback',
|
|
430
501
|
label: '投诉与举报',
|
|
431
502
|
onClick: openReport
|
|
432
503
|
});
|
|
@@ -455,6 +526,7 @@ const Watermark_Watermark = ()=>{
|
|
|
455
526
|
platform: "desktop",
|
|
456
527
|
brandText: config.brandText,
|
|
457
528
|
logoSrc: config.logoSrc,
|
|
529
|
+
variant: VARIANT,
|
|
458
530
|
onClose: handleClose,
|
|
459
531
|
showClose: open
|
|
460
532
|
})
|
|
@@ -462,4 +534,4 @@ const Watermark_Watermark = ()=>{
|
|
|
462
534
|
});
|
|
463
535
|
};
|
|
464
536
|
const Watermark = Watermark_Watermark;
|
|
465
|
-
export { BrandLogo, CloseIcon, DownloadIcon, EfficiencyIcon, FeedbackIcon, MenuCard, MenuRow, Pill, Watermark as default, openReport };
|
|
537
|
+
export { BrandLogo, CloseIcon, DoubaoCloseIcon, DownloadIcon, EfficiencyIcon, FeedbackIcon, MenuCard, MenuRow, Pill, ReportIcon, Watermark as default, openReport };
|
|
@@ -55,10 +55,10 @@ describe('Watermark(水印·变体拆分后)', ()=>{
|
|
|
55
55
|
it('Pill 移动态:logo + 品牌文案,无关闭叉', ()=>{
|
|
56
56
|
const out = renderToStaticMarkup(/*#__PURE__*/ react.createElement(Pill, {
|
|
57
57
|
platform: 'mobile',
|
|
58
|
-
brandText: '
|
|
58
|
+
brandText: '豆包工作 AI 生成',
|
|
59
59
|
logoSrc: DOUBAO_LOGO_SRC
|
|
60
60
|
}));
|
|
61
|
-
expect(out).toContain('
|
|
61
|
+
expect(out).toContain('豆包工作 AI 生成');
|
|
62
62
|
expect(out).not.toContain('aria-label="关闭"');
|
|
63
63
|
});
|
|
64
64
|
it('MenuCard:items + extraItems 分隔线', ()=>{
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const DOUBAO_LOGO_SRC = "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miaoda-ui/doubao.svg";
|
|
2
|
+
export declare const DOUBAO_BRAND_TEXT_SRC = "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miaoda-ui/Union.png";
|
|
2
3
|
export declare const MIAODA_LOGO_SRC = "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodalogo.svg";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const CDN = 'https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp';
|
|
2
2
|
const DOUBAO_LOGO_SRC = `${CDN}/miaoda-ui/doubao.svg`;
|
|
3
|
+
const DOUBAO_BRAND_TEXT_SRC = `${CDN}/miaoda-ui/Union.png`;
|
|
3
4
|
const MIAODA_LOGO_SRC = `${CDN}/logo/miaodalogo.svg`;
|
|
4
|
-
export { DOUBAO_LOGO_SRC, MIAODA_LOGO_SRC };
|
|
5
|
+
export { DOUBAO_BRAND_TEXT_SRC, DOUBAO_LOGO_SRC, MIAODA_LOGO_SRC };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/client-toolkit",
|
|
3
|
-
"version": "1.2.73-
|
|
3
|
+
"version": "1.2.73-beta.0",
|
|
4
4
|
"types": "./lib/index.d.ts",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"@lark-apaas/client-capability": "^0.1.7",
|
|
105
105
|
"@lark-apaas/dataloom": "^0.1.5",
|
|
106
106
|
"@lark-apaas/internal-slardar": "^0.0.3",
|
|
107
|
-
"@lark-apaas/miaoda-inspector": "1.0.
|
|
107
|
+
"@lark-apaas/miaoda-inspector": "^1.0.24",
|
|
108
108
|
"@lark-apaas/observable-web": "^1.0.6",
|
|
109
109
|
"@radix-ui/react-avatar": "^1.1.10",
|
|
110
110
|
"@radix-ui/react-popover": "^1.1.15",
|