@lark-apaas/client-toolkit 1.2.86 → 1.2.87-alpha.20261201140650
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/README.en-US.md +105 -0
- package/README.md +30 -1
- package/lib/apis/components/UniversalLink.js +2 -1
- package/lib/apis/constants/img-resources/avatar.d.ts +11 -11
- package/lib/apis/constants/img-resources/avatar.js +12 -11
- package/lib/apis/constants/img-resources/banner.d.ts +24 -24
- package/lib/apis/constants/img-resources/banner.js +25 -24
- package/lib/apis/constants/img-resources/cover.d.ts +36 -36
- package/lib/apis/constants/img-resources/cover.js +37 -36
- package/lib/apis/dataloom.d.ts +0 -2
- package/lib/apis/dataloom.js +1 -2
- package/lib/apis/utils/createI18nForRuntime.d.ts +6 -0
- package/lib/apis/utils/createI18nForRuntime.js +2 -0
- package/lib/apis/utils/getLarkJssdkConfig.d.ts +2 -0
- package/lib/apis/utils/getLarkJssdkConfig.js +2 -0
- package/lib/apis/utils/getLocale.d.ts +3 -0
- package/lib/apis/utils/getLocale.js +2 -0
- package/lib/components/AppContainer/Watermark.js +44 -42
- package/lib/components/AppContainer/__test__/Watermark.test.js +36 -7
- package/lib/components/AppContainer/doubao-watermark-asset.d.ts +3 -3
- package/lib/components/AppContainer/doubao-watermark-asset.js +6 -5
- package/lib/components/AppContainer/index.js +16 -2
- package/lib/components/AppContainer/utils/tea.js +5 -2
- package/lib/components/ErrorRender/index.js +2 -1
- package/lib/components/NotFoundRender/index.js +4 -3
- package/lib/components/PagePlaceholder/index.js +2 -1
- package/lib/components/User/UserProfile/UserProfileUI.js +5 -3
- package/lib/components/User/UserProfile/utils.d.ts +2 -1
- package/lib/components/User/UserProfile/utils.js +12 -8
- package/lib/components/User/UserSelectUI/Dropdown.js +3 -2
- package/lib/components/User/UserSelectUI/MultipleSelectionTags.js +4 -1
- package/lib/components/User/UserWithAvatar.js +2 -1
- package/lib/components/theme/constants.js +19 -11
- package/lib/hooks/useCurrentUserProfile.js +8 -2
- package/lib/hooks/useLogout.js +3 -2
- package/lib/index.d.ts +0 -2
- package/lib/index.js +1 -2
- package/lib/integrations/services/UserProfileService.d.ts +1 -1
- package/lib/integrations/services/UserProfileService.js +2 -2
- package/lib/locales/__test__/messages.test.js +9 -7
- package/lib/locales/index.d.ts +12 -5
- package/lib/locales/index.js +11 -7
- package/lib/locales/messages.json +262 -0
- package/lib/utils/axiosConfig.js +22 -19
- package/lib/utils/copyToClipboard.js +2 -1
- package/lib/utils/getAxiosForBackend.js +2 -1
- package/lib/utils/getParentOrigin.d.ts +1 -0
- package/lib/utils/getParentOrigin.js +7 -14
- package/lib/utils/i18nText.d.ts +5 -0
- package/lib/utils/i18nText.js +8 -0
- package/lib/utils/larkJssdk.d.ts +13 -0
- package/lib/utils/larkJssdk.js +11 -0
- package/lib/utils/locale.d.ts +2 -3
- package/lib/utils/locale.js +2 -38
- package/lib/utils/postMessage.d.ts +5 -1
- package/lib/utils/postMessage.js +2 -20
- package/package.json +8 -5
- package/lib/integrations/__test__/base-storage.test.d.ts +0 -1
- package/lib/integrations/__test__/base-storage.test.js +0 -74
- package/lib/locales/messages.d.ts +0 -12
- package/lib/locales/messages.js +0 -104
|
@@ -2,45 +2,43 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { getWatermarkVariant, readWatermarkCreatedVia } from "./watermark-variant.js";
|
|
3
3
|
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
import { Content, Portal, Root, Trigger } from "@radix-ui/react-popover";
|
|
5
|
-
import {
|
|
5
|
+
import { getRuntimeLocale, readSettings } from "@lark-apaas/miaoda-common-settings";
|
|
6
|
+
import { DOUBAO_LOGO_SRC, MIAODA_LOGO_SRC, getDoubaoBrandImage } from "./doubao-watermark-asset.js";
|
|
6
7
|
import { getAppId } from "../../utils/getAppId.js";
|
|
7
|
-
import {
|
|
8
|
+
import { t } from "../../locales/index.js";
|
|
8
9
|
import { getInitialInfo } from "../../utils/getInitialInfo.js";
|
|
9
10
|
import { useIsMobile } from "../../hooks/index.js";
|
|
10
11
|
const VARIANT = getWatermarkVariant(process.env.MIAODA_APP_SOURCE, readWatermarkCreatedVia());
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
brandText: '
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
brandText: '
|
|
19
|
-
logoSrc: MIAODA_LOGO_SRC
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
const getDoubaoName = ()=>readSettings('doubaoConf.name')[getRuntimeLocale()];
|
|
13
|
+
const getVariantConfig = (variant)=>'doubao' === variant ? {
|
|
14
|
+
brandText: t('watermark.brand.doubao', {
|
|
15
|
+
name: getDoubaoName()
|
|
16
|
+
}),
|
|
17
|
+
logoSrc: DOUBAO_LOGO_SRC
|
|
18
|
+
} : {
|
|
19
|
+
brandText: t('watermark.brand.spark'),
|
|
20
|
+
logoSrc: MIAODA_LOGO_SRC
|
|
21
|
+
};
|
|
22
|
+
const openLink = (url)=>{
|
|
23
|
+
if (!url) return;
|
|
24
|
+
window.open(url, '_blank', 'noopener,noreferrer');
|
|
22
25
|
};
|
|
23
|
-
const REPORT_ENABLED = true;
|
|
24
26
|
const FONT_FAMILY = "'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif";
|
|
25
27
|
const PILL_SHADOW = '0px 8px 32px rgba(0,0,0,0.08), 0px 4px 16px rgba(0,0,0,0.04), 0px 2px 4px rgba(0,0,0,0.02)';
|
|
26
28
|
const CARD_SHADOW = '0px 4px 16px rgba(0,0,0,0.03), 0px 4px 10px rgba(0,0,0,0.03), 0px 2px 4px rgba(0,0,0,0.02)';
|
|
27
|
-
const REPORT_DOMAIN = {
|
|
28
|
-
BOE: 'tns.feishu-boe.cn',
|
|
29
|
-
PRE: 'tns.feishu-pre.cn',
|
|
30
|
-
ONLINE: 'tns.feishu.cn'
|
|
31
|
-
};
|
|
32
29
|
const openReport = ()=>{
|
|
33
30
|
const appId = getAppId();
|
|
34
|
-
|
|
31
|
+
const reportOrigin = readSettings('domainConf.tnsReportUrl');
|
|
32
|
+
if (!appId || !reportOrigin) return;
|
|
35
33
|
const params = JSON.stringify({
|
|
36
34
|
scene: 'miaoda_app_report',
|
|
37
35
|
entity_id: appId,
|
|
38
36
|
entity_type: 'miaoda_app',
|
|
39
37
|
extra: ''
|
|
40
38
|
});
|
|
41
|
-
const
|
|
42
|
-
const url =
|
|
43
|
-
|
|
39
|
+
const lang = getRuntimeLocale();
|
|
40
|
+
const url = `${reportOrigin}/cust/lark_report/?type=common¶ms=${encodeURIComponent(params)}&lang=${lang}`;
|
|
41
|
+
openLink(url);
|
|
44
42
|
};
|
|
45
43
|
const FeedbackIcon = ()=>/*#__PURE__*/ jsxs("svg", {
|
|
46
44
|
width: 16,
|
|
@@ -232,7 +230,7 @@ const Pill = ({ platform, brandText, logoSrc, variant, onClose, showClose = fals
|
|
|
232
230
|
size: 16
|
|
233
231
|
}),
|
|
234
232
|
isDoubao ? /*#__PURE__*/ jsx("img", {
|
|
235
|
-
src:
|
|
233
|
+
src: getDoubaoBrandImage(),
|
|
236
234
|
alt: brandText,
|
|
237
235
|
draggable: false,
|
|
238
236
|
style: {
|
|
@@ -253,7 +251,7 @@ const Pill = ({ platform, brandText, logoSrc, variant, onClose, showClose = fals
|
|
|
253
251
|
}),
|
|
254
252
|
isDesktop && onClose && showClose && /*#__PURE__*/ jsx("span", {
|
|
255
253
|
role: "button",
|
|
256
|
-
"aria-label":
|
|
254
|
+
"aria-label": t('watermark.button.close'),
|
|
257
255
|
onClick: (e)=>{
|
|
258
256
|
e.stopPropagation();
|
|
259
257
|
onClose();
|
|
@@ -351,7 +349,7 @@ const MenuCard = ({ items, extraItems, fontSize, minWidth, itemGap = 0, style })
|
|
|
351
349
|
}),
|
|
352
350
|
extraItems && extraItems.length > 0 && /*#__PURE__*/ jsxs(Fragment, {
|
|
353
351
|
children: [
|
|
354
|
-
/*#__PURE__*/ jsx("div", {
|
|
352
|
+
items.length > 0 && /*#__PURE__*/ jsx("div", {
|
|
355
353
|
style: {
|
|
356
354
|
height: 1,
|
|
357
355
|
background: 'rgba(0,0,0,0.08)',
|
|
@@ -376,22 +374,23 @@ const MenuCard = ({ items, extraItems, fontSize, minWidth, itemGap = 0, style })
|
|
|
376
374
|
});
|
|
377
375
|
const MobileWatermark = ({ onDontShow })=>{
|
|
378
376
|
const [open, setOpen] = useState(false);
|
|
379
|
-
const config =
|
|
377
|
+
const config = getVariantConfig(VARIANT);
|
|
378
|
+
const landingUrl = readSettings('domainConf.landingUrl');
|
|
380
379
|
const items = [];
|
|
381
|
-
if ('miaoda' === VARIANT) items.push({
|
|
380
|
+
if ('miaoda' === VARIANT && landingUrl) items.push({
|
|
382
381
|
icon: 'efficiency',
|
|
383
|
-
label: '
|
|
384
|
-
onClick: ()=>
|
|
382
|
+
label: t('watermark.menu.learnSpark'),
|
|
383
|
+
onClick: ()=>openLink(landingUrl)
|
|
385
384
|
});
|
|
386
|
-
if (
|
|
385
|
+
if (readSettings('domainConf.tnsReportUrl')) items.push({
|
|
387
386
|
icon: 'doubao' === VARIANT ? 'report' : 'feedback',
|
|
388
|
-
label: '
|
|
387
|
+
label: t('watermark.menu.report'),
|
|
389
388
|
onClick: openReport
|
|
390
389
|
});
|
|
391
390
|
const extraItems = [
|
|
392
391
|
{
|
|
393
392
|
icon: 'close',
|
|
394
|
-
label: '
|
|
393
|
+
label: t('watermark.menu.dontShowAgain'),
|
|
395
394
|
onClick: ()=>{
|
|
396
395
|
setOpen(false);
|
|
397
396
|
onDontShow();
|
|
@@ -455,7 +454,7 @@ const Watermark_Watermark = ()=>{
|
|
|
455
454
|
const [open, setOpen] = useState(false);
|
|
456
455
|
const timer = useRef(null);
|
|
457
456
|
const isMobile = useIsMobile();
|
|
458
|
-
const config =
|
|
457
|
+
const config = getVariantConfig(VARIANT);
|
|
459
458
|
useEffect(()=>{
|
|
460
459
|
getInitialInfo().then((info)=>{
|
|
461
460
|
const badge = info?.app_info?.show_badge;
|
|
@@ -485,20 +484,23 @@ const Watermark_Watermark = ()=>{
|
|
|
485
484
|
const leave = ()=>{
|
|
486
485
|
timer.current = setTimeout(()=>setOpen(false), 100);
|
|
487
486
|
};
|
|
487
|
+
const landingUrl = readSettings('domainConf.landingUrl');
|
|
488
488
|
const desktopItems = [];
|
|
489
489
|
if ('doubao' === VARIANT) desktopItems.push({
|
|
490
490
|
icon: 'download',
|
|
491
|
-
label: '
|
|
492
|
-
|
|
491
|
+
label: t('watermark.menu.downloadDoubao', {
|
|
492
|
+
name: getDoubaoName()
|
|
493
|
+
}),
|
|
494
|
+
onClick: ()=>openLink(readSettings('doubaoConf.downloadUrl'))
|
|
493
495
|
});
|
|
494
|
-
else desktopItems.push({
|
|
496
|
+
else if (landingUrl) desktopItems.push({
|
|
495
497
|
icon: 'efficiency',
|
|
496
|
-
label: '
|
|
497
|
-
onClick: ()=>
|
|
498
|
+
label: t('watermark.menu.learnSpark'),
|
|
499
|
+
onClick: ()=>openLink(landingUrl)
|
|
498
500
|
});
|
|
499
|
-
if (
|
|
501
|
+
if (readSettings('domainConf.tnsReportUrl')) desktopItems.push({
|
|
500
502
|
icon: 'doubao' === VARIANT ? 'report' : 'feedback',
|
|
501
|
-
label: '
|
|
503
|
+
label: t('watermark.menu.report'),
|
|
502
504
|
onClick: openReport
|
|
503
505
|
});
|
|
504
506
|
return /*#__PURE__*/ jsxs("div", {
|
|
@@ -516,7 +518,7 @@ const Watermark_Watermark = ()=>{
|
|
|
516
518
|
gap: 8
|
|
517
519
|
},
|
|
518
520
|
children: [
|
|
519
|
-
open && /*#__PURE__*/ jsx(MenuCard, {
|
|
521
|
+
open && desktopItems.length > 0 && /*#__PURE__*/ jsx(MenuCard, {
|
|
520
522
|
items: desktopItems,
|
|
521
523
|
fontSize: 14,
|
|
522
524
|
minWidth: 160,
|
|
@@ -1,14 +1,29 @@
|
|
|
1
|
-
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
2
|
import react from "react";
|
|
3
3
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
4
|
+
import { render, waitFor } from "@testing-library/react";
|
|
4
5
|
import Watermark, { BrandLogo, CloseIcon, FeedbackIcon, MenuCard, Pill, openReport } from "../Watermark.js";
|
|
5
6
|
import { DOUBAO_LOGO_SRC, MIAODA_LOGO_SRC } from "../doubao-watermark-asset.js";
|
|
6
|
-
|
|
7
|
+
vi.mock('../../../utils/getInitialInfo', ()=>({
|
|
8
|
+
getInitialInfo: ()=>Promise.resolve({})
|
|
9
|
+
}));
|
|
10
|
+
const LOCALE_KEY = 'miaoda:preview-locale';
|
|
11
|
+
const html = async ()=>{
|
|
12
|
+
const { container, unmount } = render(/*#__PURE__*/ react.createElement(Watermark));
|
|
13
|
+
await waitFor(()=>expect(container.innerHTML).not.toBe(''));
|
|
14
|
+
const out = container.innerHTML;
|
|
15
|
+
unmount();
|
|
16
|
+
return out;
|
|
17
|
+
};
|
|
7
18
|
const setViewportWidth = (w)=>Object.defineProperty(window, 'innerWidth', {
|
|
8
19
|
value: w,
|
|
9
20
|
configurable: true
|
|
10
21
|
});
|
|
22
|
+
beforeEach(()=>{
|
|
23
|
+
window.localStorage.setItem(LOCALE_KEY, 'zh_CN');
|
|
24
|
+
});
|
|
11
25
|
afterEach(()=>{
|
|
26
|
+
window.localStorage.clear();
|
|
12
27
|
vi.unstubAllEnvs();
|
|
13
28
|
vi.restoreAllMocks();
|
|
14
29
|
delete globalThis.ENVIRONMENT;
|
|
@@ -16,17 +31,17 @@ afterEach(()=>{
|
|
|
16
31
|
setViewportWidth(1024);
|
|
17
32
|
});
|
|
18
33
|
describe('Watermark(水印·变体拆分后)', ()=>{
|
|
19
|
-
it('默认(非豆包来源)渲染妙搭变体药丸', ()=>{
|
|
20
|
-
const out = html();
|
|
34
|
+
it('默认(非豆包来源)渲染妙搭变体药丸', async ()=>{
|
|
35
|
+
const out = await html();
|
|
21
36
|
expect(out).toContain('data-custom-element="miaoda-watermark"');
|
|
22
37
|
expect(out).toContain('妙搭生成');
|
|
23
38
|
expect(out).toContain(MIAODA_LOGO_SRC);
|
|
24
39
|
expect(out).not.toContain('aria-label="关闭"');
|
|
25
40
|
expect(out).not.toContain('投诉与举报');
|
|
26
41
|
});
|
|
27
|
-
it('移动端视口(<768)时展示移动端药丸', ()=>{
|
|
42
|
+
it('移动端视口(<768)时展示移动端药丸', async ()=>{
|
|
28
43
|
setViewportWidth(375);
|
|
29
|
-
const out = html();
|
|
44
|
+
const out = await html();
|
|
30
45
|
expect(out).toContain('data-custom-element="miaoda-watermark-mobile"');
|
|
31
46
|
expect(out).toContain(MIAODA_LOGO_SRC);
|
|
32
47
|
expect(out).toContain('妙搭生成');
|
|
@@ -108,12 +123,26 @@ describe('Watermark(水印·变体拆分后)', ()=>{
|
|
|
108
123
|
openReport();
|
|
109
124
|
expect(openSpy).toHaveBeenCalledTimes(1);
|
|
110
125
|
const [url, target, features] = openSpy.mock.calls[0];
|
|
111
|
-
expect(String(url)).toContain('tns.feishu-boe.cn/cust/lark_report/');
|
|
126
|
+
expect(String(url)).toContain('https://tns.feishu-boe.cn/cust/lark_report/');
|
|
112
127
|
expect(String(url)).toContain(encodeURIComponent('miaoda_app_report'));
|
|
113
128
|
expect(String(url)).toContain('app_abc');
|
|
129
|
+
expect(String(url)).toMatch(/&lang=zh-CN$/);
|
|
114
130
|
expect(target).toBe('_blank');
|
|
115
131
|
expect(features).toBe('noopener,noreferrer');
|
|
116
132
|
});
|
|
133
|
+
it.each([
|
|
134
|
+
'en-US',
|
|
135
|
+
'ja-JP'
|
|
136
|
+
])('举报链接使用当前语言 %s', (locale)=>{
|
|
137
|
+
const openSpy = vi.spyOn(window, 'open').mockReturnValue(null);
|
|
138
|
+
window.localStorage.setItem(LOCALE_KEY, locale);
|
|
139
|
+
window.appId = 'app_abc';
|
|
140
|
+
globalThis.ENVIRONMENT = 'online';
|
|
141
|
+
openReport();
|
|
142
|
+
const [url] = openSpy.mock.calls[0];
|
|
143
|
+
expect(String(url)).toContain('https://tns.feishu.cn/cust/lark_report/');
|
|
144
|
+
expect(new URL(String(url)).searchParams.get('lang')).toBe(locale);
|
|
145
|
+
});
|
|
117
146
|
it('无 appId 时不跳转', ()=>{
|
|
118
147
|
const openSpy = vi.spyOn(window, 'open').mockReturnValue(null);
|
|
119
148
|
globalThis.ENVIRONMENT = 'online';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const DOUBAO_LOGO_SRC
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const MIAODA_LOGO_SRC
|
|
1
|
+
export declare const DOUBAO_LOGO_SRC: string;
|
|
2
|
+
export declare const getDoubaoBrandImage: () => string;
|
|
3
|
+
export declare const MIAODA_LOGO_SRC: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
1
|
+
import { getRuntimeLocale, getStaticUrl, readSettings } from "@lark-apaas/miaoda-common-settings";
|
|
2
|
+
const ASSET_DIR = 'LMfspH/ljhwZthlaukjlkulzlp';
|
|
3
|
+
const DOUBAO_LOGO_SRC = getStaticUrl(`${ASSET_DIR}/miaoda-ui/doubao.svg`);
|
|
4
|
+
const getDoubaoBrandImage = ()=>readSettings('doubaoConf.brandImage')[getRuntimeLocale()];
|
|
5
|
+
const MIAODA_LOGO_SRC = getStaticUrl(`${ASSET_DIR}/logo/miaodalogo.svg`);
|
|
6
|
+
export { DOUBAO_LOGO_SRC, MIAODA_LOGO_SRC, getDoubaoBrandImage };
|
|
@@ -3,6 +3,9 @@ import { useEffect, useMemo, useState } from "react";
|
|
|
3
3
|
import { ConfigProvider } from "antd";
|
|
4
4
|
import { MiaodaInspector } from "@lark-apaas/miaoda-inspector";
|
|
5
5
|
import zh_CN from "antd/locale/zh_CN";
|
|
6
|
+
import en_US from "antd/locale/en_US";
|
|
7
|
+
import ja_JP from "antd/locale/ja_JP";
|
|
8
|
+
import { getRuntimeLocale } from "@lark-apaas/miaoda-common-settings";
|
|
6
9
|
import IframeBridge from "./IframeBridge.js";
|
|
7
10
|
import { Toaster } from "./sonner.js";
|
|
8
11
|
import { PageHoc } from "./PageHoc.js";
|
|
@@ -15,6 +18,7 @@ import Watermark from "./Watermark.js";
|
|
|
15
18
|
import { isStandaloneBuild } from "./standalone.js";
|
|
16
19
|
import { getAppId } from "../../utils/getAppId.js";
|
|
17
20
|
import { isNewPathEnabled } from "../../utils/apiPath.js";
|
|
21
|
+
import { resolveParentOrigin } from "../../utils/postMessage.js";
|
|
18
22
|
import QueryProvider from "../QueryProvider/index.js";
|
|
19
23
|
import { AuthProvider } from "@lark-apaas/auth-sdk";
|
|
20
24
|
import "../../runtime/index.js";
|
|
@@ -45,6 +49,10 @@ const appFlags = process.env.APP_FLAGS || {};
|
|
|
45
49
|
const App = (props)=>{
|
|
46
50
|
const { enableAuth, disableToaster = false } = props;
|
|
47
51
|
useAppInfo();
|
|
52
|
+
useEffect(()=>{
|
|
53
|
+
const declared = document.documentElement.lang;
|
|
54
|
+
if (!declared || 'zh' === declared || 'en' === declared) document.documentElement.lang = getRuntimeLocale().split('-')[0];
|
|
55
|
+
}, []);
|
|
48
56
|
useEffect(()=>{
|
|
49
57
|
if (isMiaodaPreview) fetch(`${location.origin}/ai/api/feida_preview/csrf`).then(()=>{
|
|
50
58
|
setTimeout(()=>{
|
|
@@ -99,7 +107,9 @@ const App = (props)=>{
|
|
|
99
107
|
config: authConfig,
|
|
100
108
|
children: [
|
|
101
109
|
!disableToaster && true !== appFlags.customToaster && /*#__PURE__*/ jsx(Toaster, {}),
|
|
102
|
-
'production' !== process.env.NODE_ENV && /*#__PURE__*/ jsx(MiaodaInspector, {
|
|
110
|
+
'production' !== process.env.NODE_ENV && /*#__PURE__*/ jsx(MiaodaInspector, {
|
|
111
|
+
targetOrigin: resolveParentOrigin()
|
|
112
|
+
}),
|
|
103
113
|
'production' !== process.env.NODE_ENV && /*#__PURE__*/ jsx(IframeBridge, {}),
|
|
104
114
|
/*#__PURE__*/ jsx(PageHoc, {
|
|
105
115
|
children: props.children
|
|
@@ -205,7 +215,11 @@ const AppContainer_AppContainer = (props)=>{
|
|
|
205
215
|
}),
|
|
206
216
|
/*#__PURE__*/ jsx(QueryProvider, {
|
|
207
217
|
children: /*#__PURE__*/ jsx(ConfigProvider, {
|
|
208
|
-
locale:
|
|
218
|
+
locale: {
|
|
219
|
+
'zh-CN': zh_CN,
|
|
220
|
+
'en-US': en_US,
|
|
221
|
+
'ja-JP': ja_JP
|
|
222
|
+
}[getRuntimeLocale()],
|
|
209
223
|
theme: {
|
|
210
224
|
token: antdThemeToken,
|
|
211
225
|
components: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readSettings } from "@lark-apaas/miaoda-common-settings";
|
|
1
2
|
import blueimp_md5 from "blueimp-md5";
|
|
2
3
|
import sha1 from "crypto-js/sha1";
|
|
3
4
|
import { isMobile } from "../../../utils/deviceType.js";
|
|
@@ -15,9 +16,11 @@ async function createTracker() {
|
|
|
15
16
|
const { tenantID, userID } = data || {};
|
|
16
17
|
const userIDEncrypt = userID && '0' !== userID ? encryptTea(userID) : void 0;
|
|
17
18
|
const tenantIDEncrypt = tenantID && '0' !== tenantID ? encryptTea(tenantID) : void 0;
|
|
19
|
+
const tea = readSettings('apm.tea');
|
|
20
|
+
if (!tea) return;
|
|
18
21
|
window.collectEvent('init', {
|
|
19
|
-
app_id:
|
|
20
|
-
channel:
|
|
22
|
+
app_id: tea.appId,
|
|
23
|
+
channel: tea.channel,
|
|
21
24
|
disable_auto_pv: false,
|
|
22
25
|
enable_ab_test: false,
|
|
23
26
|
enable_debug: false,
|
|
@@ -4,6 +4,7 @@ import { logger } from "../../logger/index.js";
|
|
|
4
4
|
import { getHmrApi } from "../../utils/hmr-api.js";
|
|
5
5
|
import { submitPostMessage } from "../../utils/postMessage.js";
|
|
6
6
|
import { t } from "../../locales/index.js";
|
|
7
|
+
import { getStaticUrl } from "@lark-apaas/miaoda-common-settings";
|
|
7
8
|
const RenderError = (props)=>{
|
|
8
9
|
const { error, resetErrorBoundary } = props;
|
|
9
10
|
useEffect(()=>{
|
|
@@ -41,7 +42,7 @@ const RenderError = (props)=>{
|
|
|
41
42
|
className: "flex flex-col justify-center items-center text-center",
|
|
42
43
|
children: [
|
|
43
44
|
/*#__PURE__*/ jsx("img", {
|
|
44
|
-
src:
|
|
45
|
+
src: getStaticUrl('ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/illustration_empty_negative_error.svg'),
|
|
45
46
|
alt: "render error",
|
|
46
47
|
className: "mb-3 w-[100px]"
|
|
47
48
|
}),
|
|
@@ -2,7 +2,8 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useLocation } from "react-router-dom";
|
|
3
3
|
import { useEffect } from "react";
|
|
4
4
|
import { logger } from "../../logger/index.js";
|
|
5
|
-
import { t } from "../../locales/index.js";
|
|
5
|
+
import { t, tDev } from "../../locales/index.js";
|
|
6
|
+
import { getStaticUrl } from "@lark-apaas/miaoda-common-settings";
|
|
6
7
|
const NotFound = ()=>{
|
|
7
8
|
const location = useLocation();
|
|
8
9
|
useEffect(()=>{
|
|
@@ -14,7 +15,7 @@ const NotFound = ()=>{
|
|
|
14
15
|
})
|
|
15
16
|
],
|
|
16
17
|
meta: {
|
|
17
|
-
repairMessage:
|
|
18
|
+
repairMessage: tDev('notFound.logger.repairMessage', {
|
|
18
19
|
path: location.pathname
|
|
19
20
|
}),
|
|
20
21
|
noStacktrace: true,
|
|
@@ -29,7 +30,7 @@ const NotFound = ()=>{
|
|
|
29
30
|
className: "min-h-screen flex flex-col items-center justify-center bg-white gap-3",
|
|
30
31
|
children: [
|
|
31
32
|
/*#__PURE__*/ jsx("img", {
|
|
32
|
-
src: '
|
|
33
|
+
src: getStaticUrl('ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/illustration_empty_neutral_unfinished_gray.svg'),
|
|
33
34
|
alt: "Not Found",
|
|
34
35
|
className: "w-[100px]"
|
|
35
36
|
}),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { t } from "../../locales/index.js";
|
|
4
|
+
import { getStaticUrl } from "@lark-apaas/miaoda-common-settings";
|
|
4
5
|
const PagePlaceholder_PagePlaceholder = ({ title, description })=>{
|
|
5
6
|
const defaultTitle = t('pagePlaceholder.title');
|
|
6
7
|
const defaultDescription = t("pagePlaceholder.description");
|
|
@@ -11,7 +12,7 @@ const PagePlaceholder_PagePlaceholder = ({ title, description })=>{
|
|
|
11
12
|
className: "rounded-md mb-6",
|
|
12
13
|
width: "320",
|
|
13
14
|
height: "200",
|
|
14
|
-
src:
|
|
15
|
+
src: getStaticUrl('LMfspH/ljhwZthlaukjlkulzlp/miao/welcome.svg'),
|
|
15
16
|
alt: "Welcome"
|
|
16
17
|
}),
|
|
17
18
|
/*#__PURE__*/ jsx("div", {
|
|
@@ -4,9 +4,11 @@ import { clsxWithTw } from "../../../utils/utils.js";
|
|
|
4
4
|
import { getChatAppLink } from "./utils.js";
|
|
5
5
|
import { OverflowTooltipText } from "../../ui/overflow-tooltip-text.js";
|
|
6
6
|
import { t } from "../../../locales/index.js";
|
|
7
|
+
import { getStaticUrl } from "@lark-apaas/miaoda-common-settings";
|
|
7
8
|
function UserProfileUI({ user }) {
|
|
8
9
|
const [avatarError, setAvatarError] = useState(false);
|
|
9
10
|
const canShowAvatar = Boolean(user.avatar) && !avatarError;
|
|
11
|
+
const chatAppLink = user.feishu_open_id ? getChatAppLink(user.feishu_open_id) : void 0;
|
|
10
12
|
return /*#__PURE__*/ jsxs("div", {
|
|
11
13
|
className: "overflow-hidden rounded-[8px] border-0 bg-card text-card-foreground h-full",
|
|
12
14
|
children: [
|
|
@@ -16,7 +18,7 @@ function UserProfileUI({ user }) {
|
|
|
16
18
|
className: "h-[136px] w-full",
|
|
17
19
|
children: /*#__PURE__*/ jsx("img", {
|
|
18
20
|
alt: "cover",
|
|
19
|
-
src:
|
|
21
|
+
src: getStaticUrl('LMfspH/ljhwZthlaukjlkulzlp/miao/default-cover.png'),
|
|
20
22
|
className: "h-full w-full object-cover"
|
|
21
23
|
})
|
|
22
24
|
})
|
|
@@ -57,11 +59,11 @@ function UserProfileUI({ user }) {
|
|
|
57
59
|
})
|
|
58
60
|
]
|
|
59
61
|
}),
|
|
60
|
-
|
|
62
|
+
chatAppLink ? /*#__PURE__*/ jsx("div", {
|
|
61
63
|
className: "w-full mt-2",
|
|
62
64
|
children: /*#__PURE__*/ jsxs("a", {
|
|
63
65
|
className: "inline-flex h-[42px] w-full items-center justify-center gap-2 rounded-[10px] border border-transparent bg-muted text-sm font-medium text-foreground transition-colors focus-visible:outline-none hover:bg-foreground/10 active:bg-foreground/15",
|
|
64
|
-
href:
|
|
66
|
+
href: chatAppLink,
|
|
65
67
|
target: "_blank",
|
|
66
68
|
rel: "noopener noreferrer",
|
|
67
69
|
children: [
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UserProfile } from '../../../utils/getUserProfile';
|
|
2
2
|
import { User } from './type';
|
|
3
3
|
export declare const formatI18nProfile: (profile: UserProfile) => User;
|
|
4
|
-
|
|
4
|
+
/** 打开与该用户会话的客户端链接;配置里没有 applink 域名时返回 undefined,不展示「发消息」按钮 */
|
|
5
|
+
export declare const getChatAppLink: (openId: string) => string | undefined;
|
|
5
6
|
export declare const INVALID_USER: User;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import { getStaticUrl, readSettings } from "@lark-apaas/miaoda-common-settings";
|
|
2
|
+
import { pickI18nText } from "../../../utils/i18nText.js";
|
|
3
|
+
import { t } from "../../../locales/index.js";
|
|
1
4
|
const convertI18nTextToText = (i18nText)=>{
|
|
2
|
-
if (Array.isArray(i18nText) && i18nText.length > 0)
|
|
3
|
-
const chineseText = i18nText.find((value)=>2052 === value.language_code);
|
|
4
|
-
if (chineseText) return chineseText.text;
|
|
5
|
-
return i18nText[0].text;
|
|
6
|
-
}
|
|
5
|
+
if (Array.isArray(i18nText) && i18nText.length > 0) return pickI18nText(i18nText)?.text ?? '';
|
|
7
6
|
return '';
|
|
8
7
|
};
|
|
9
8
|
const formatI18nProfile = (profile)=>({
|
|
@@ -14,10 +13,15 @@ const formatI18nProfile = (profile)=>({
|
|
|
14
13
|
feishu_open_id: profile.feishuOpenID || '',
|
|
15
14
|
status: 1 === profile.status ? 'active' : 'inactive'
|
|
16
15
|
});
|
|
17
|
-
const getChatAppLink = (openId)
|
|
16
|
+
const getChatAppLink = (openId)=>{
|
|
17
|
+
const applinkDomain = readSettings('domainConf.applinkDomain');
|
|
18
|
+
return applinkDomain ? `${applinkDomain}/client/chat/open?openId=${openId}` : void 0;
|
|
19
|
+
};
|
|
18
20
|
const INVALID_USER = {
|
|
19
|
-
name
|
|
20
|
-
|
|
21
|
+
get name () {
|
|
22
|
+
return t('user.invalidUser');
|
|
23
|
+
},
|
|
24
|
+
avatar: getStaticUrl('LMfspH/ljhwZthlaukjlkulzlp/miao/no-person.svg'),
|
|
21
25
|
email: '',
|
|
22
26
|
department: '',
|
|
23
27
|
feishu_open_id: '',
|
|
@@ -4,6 +4,7 @@ import { Avatar, AvatarFallback, AvatarImage } from "../../ui/avatar.js";
|
|
|
4
4
|
import { clsxWithTw } from "../../../utils/utils.js";
|
|
5
5
|
import { Check } from "lucide-react";
|
|
6
6
|
import { Spinner } from "./Spinner.js";
|
|
7
|
+
import { t } from "../../../locales/index.js";
|
|
7
8
|
function Dropdown({ isOpen, fetching, searchResults, onSelect, isSelected, onOptionMouseDown }) {
|
|
8
9
|
if (!isOpen) return null;
|
|
9
10
|
return /*#__PURE__*/ jsx("div", {
|
|
@@ -17,10 +18,10 @@ function Dropdown({ isOpen, fetching, searchResults, onSelect, isSelected, onOpt
|
|
|
17
18
|
})
|
|
18
19
|
}) : 0 === searchResults.length ? /*#__PURE__*/ jsx("div", {
|
|
19
20
|
className: "px-2 py-[5px] text-[14px] leading-[22px] text-muted-foreground",
|
|
20
|
-
children:
|
|
21
|
+
children: t('userSelect.dropdown.noResults')
|
|
21
22
|
}) : searchResults.map((user)=>{
|
|
22
23
|
const selected = isSelected(user.user_id);
|
|
23
|
-
const displayName = user.name?.trim() || '
|
|
24
|
+
const displayName = user.name?.trim() || t('user.invalidUser');
|
|
24
25
|
return /*#__PURE__*/ jsxs("div", {
|
|
25
26
|
className: "relative flex cursor-pointer items-center gap-2 rounded-sm py-1 pl-3 pr-[7px] text-foreground transition-colors hover:bg-foreground/8",
|
|
26
27
|
onMouseDown: (event)=>{
|
|
@@ -5,6 +5,7 @@ import { Avatar, AvatarFallback, AvatarImage } from "../../ui/avatar.js";
|
|
|
5
5
|
import { Badge } from "../../ui/badge.js";
|
|
6
6
|
import { Button } from "../../ui/button.js";
|
|
7
7
|
import { X } from "lucide-react";
|
|
8
|
+
import { t } from "../../../locales/index.js";
|
|
8
9
|
function MultipleSelectionTags({ displayUsers, onRemove }) {
|
|
9
10
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
10
11
|
children: displayUsers?.map((user, index)=>/*#__PURE__*/ jsxs(Badge, {
|
|
@@ -35,7 +36,9 @@ function MultipleSelectionTags({ displayUsers, onRemove }) {
|
|
|
35
36
|
"data-select-interactive": "true",
|
|
36
37
|
className: "h-3 w-3 p-0 rounded-full opacity-60 hover:opacity-100 transition-all duration-200 cursor-pointer flex-shrink-0",
|
|
37
38
|
onClick: (e)=>onRemove(user.user_id, e),
|
|
38
|
-
title:
|
|
39
|
+
title: t('userSelect.tag.remove', {
|
|
40
|
+
name: user.name
|
|
41
|
+
}),
|
|
39
42
|
children: /*#__PURE__*/ jsx(X, {
|
|
40
43
|
size: 10,
|
|
41
44
|
strokeWidth: 3
|
|
@@ -3,6 +3,7 @@ import "react";
|
|
|
3
3
|
import { Avatar, AvatarFallback, AvatarImage } from "../ui/avatar.js";
|
|
4
4
|
import { OverflowTooltipText } from "../ui/overflow-tooltip-text.js";
|
|
5
5
|
import { clsxWithTw } from "../../utils/utils.js";
|
|
6
|
+
import { t } from "../../locales/index.js";
|
|
6
7
|
const avatarDimensionClassMap = {
|
|
7
8
|
small: 'h-4 w-4',
|
|
8
9
|
medium: 'h-5 w-5',
|
|
@@ -30,7 +31,7 @@ const textVariantMap = {
|
|
|
30
31
|
};
|
|
31
32
|
function UserWithAvatar({ data, size = 'medium', mode = 'tag', className, showLabel = true }) {
|
|
32
33
|
const { avatar, name } = data;
|
|
33
|
-
const displayName = name?.trim() || '
|
|
34
|
+
const displayName = name?.trim() || t('user.invalidUser');
|
|
34
35
|
const formatSize = [
|
|
35
36
|
'small',
|
|
36
37
|
'medium',
|