@lark-apaas/client-toolkit 1.2.9-beta.42 → 1.2.9-beta.43

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.
@@ -7,6 +7,7 @@ import { isNewPathEnabled } from "../../utils/apiPath.js";
7
7
  import { useIsMobile } from "../../hooks/index.js";
8
8
  import { X } from "lucide-react";
9
9
  import { Sheet, SheetContent, SheetTrigger } from "../ui/drawer.js";
10
+ import { t } from "../../locales/index.js";
10
11
  const Component = ()=>{
11
12
  const HasClosedKey = `miaoda-creatByMiaoda-has-closed-${getAppId()}`;
12
13
  const [visible, setVisible] = useState(!window.localStorage?.getItem(HasClosedKey));
@@ -46,7 +47,7 @@ const Component = ()=>{
46
47
  const link = document.createElement('link');
47
48
  link.rel = 'preload';
48
49
  link.as = 'image';
49
- link.href = 'https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodacover-mobile.png';
50
+ link.href = t('safety.cover.mobile');
50
51
  document.head.appendChild(link);
51
52
  }
52
53
  }, [
@@ -74,7 +75,7 @@ const Component = ()=>{
74
75
  }),
75
76
  /*#__PURE__*/ jsx("p", {
76
77
  className: "shrink-0 min-w-[28px] m-0! text-[#EBEBEB]",
77
- children: "妙搭"
78
+ children: t('safety.badge.label')
78
79
  })
79
80
  ]
80
81
  })
@@ -90,7 +91,7 @@ const Component = ()=>{
90
91
  onClick: ()=>setOpen(false)
91
92
  }),
92
93
  /*#__PURE__*/ jsx("img", {
93
- src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodacover-mobile.png",
94
+ src: t('safety.cover.mobile'),
94
95
  alt: "",
95
96
  className: "w-full h-full",
96
97
  onClick: ()=>{
@@ -110,12 +111,11 @@ const Component = ()=>{
110
111
  src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/icon/icon_company_outlined.svg",
111
112
  className: "shrink-0 w-[14px] h-[14px]"
112
113
  }),
113
- /*#__PURE__*/ jsxs("p", {
114
+ /*#__PURE__*/ jsx("p", {
114
115
  className: "shrink-0 min-w-[96px] m-0! text-[#646A73] text-sm",
115
- children: [
116
- userinfo?.name,
117
- "运营"
118
- ]
116
+ children: t('safety.tenant.operated', {
117
+ name: userinfo?.name ?? ''
118
+ })
119
119
  })
120
120
  ]
121
121
  }),
@@ -128,7 +128,7 @@ const Component = ()=>{
128
128
  }),
129
129
  /*#__PURE__*/ jsx("p", {
130
130
  className: "shrink-0 min-w-[163px] m-0! text-[#646A73] text-sm",
131
- children: "包含 AI 生成内容,请注意甄别"
131
+ children: t('safety.ai.disclaimer')
132
132
  })
133
133
  ]
134
134
  })
@@ -146,14 +146,14 @@ const Component = ()=>{
146
146
  setTimeout(()=>setVisible(false), 200);
147
147
  window.localStorage?.setItem(HasClosedKey, 'true');
148
148
  },
149
- children: "不再展示"
149
+ children: t('safety.button.dontShowAgain')
150
150
  }),
151
151
  /*#__PURE__*/ jsx("div", {
152
152
  className: "flex-1 flex rounded-[99px] items-center justify-center border-[0.5px] border-black bg-black text-white cursor-pointer text-lg py-[12px]",
153
153
  onClick: ()=>{
154
154
  window.open('https://miaoda.feishu.cn/landing', '_blank');
155
155
  },
156
- children: "了解更多"
156
+ children: t('safety.button.learnMore')
157
157
  })
158
158
  ]
159
159
  })
@@ -186,7 +186,7 @@ const Component = ()=>{
186
186
  }),
187
187
  /*#__PURE__*/ jsx("p", {
188
188
  className: "shrink-0 min-w-[60px] m-0! text-[#EBEBEB]",
189
- children: "由妙搭搭建"
189
+ children: t('safety.badge.builtWith')
190
190
  })
191
191
  ]
192
192
  })
@@ -210,7 +210,7 @@ const Component = ()=>{
210
210
  className: "flex flex-col bg-[#1A1A1A]",
211
211
  children: [
212
212
  /*#__PURE__*/ jsx("img", {
213
- src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodacover.png",
213
+ src: t('safety.cover.pc'),
214
214
  alt: "",
215
215
  className: "w-[286px] h-[128px] cursor-pointer",
216
216
  onClick: ()=>{
@@ -230,12 +230,11 @@ const Component = ()=>{
230
230
  src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/icon/icon_company_outlined.svg",
231
231
  className: "shrink-0 w-[12px] h-[12px]"
232
232
  }),
233
- /*#__PURE__*/ jsxs("p", {
233
+ /*#__PURE__*/ jsx("p", {
234
234
  className: "shrink-0 min-w-[96px] m-0! text-[#a6a6a6]",
235
- children: [
236
- userinfo?.name,
237
- "运营"
238
- ]
235
+ children: t('safety.tenant.operated', {
236
+ name: userinfo?.name ?? ''
237
+ })
239
238
  })
240
239
  ]
241
240
  }),
@@ -248,7 +247,7 @@ const Component = ()=>{
248
247
  }),
249
248
  /*#__PURE__*/ jsx("p", {
250
249
  className: "shrink-0 min-w-[163px] m-0! text-[#a6a6a6]",
251
- children: "包含 AI 生成内容,请注意甄别"
250
+ children: t('safety.ai.disclaimer')
252
251
  })
253
252
  ]
254
253
  })
@@ -266,7 +265,7 @@ const Component = ()=>{
266
265
  setVisible(false);
267
266
  window.localStorage?.setItem(HasClosedKey, 'true');
268
267
  },
269
- children: "不再展示"
268
+ children: t('safety.button.dontShowAgain')
270
269
  }),
271
270
  /*#__PURE__*/ jsx("div", {
272
271
  className: "flex-1 flex rounded-[8px] items-center justify-center h-[34px] border-[0.5px] border-solid border-[#ffffff1c] hover:border-[#ffffff33] bg-[#ffffff08] hover:bg-[#ffffff14] cursor-pointer text-[#ebebeb]",
@@ -274,7 +273,7 @@ const Component = ()=>{
274
273
  onClick: ()=>{
275
274
  window.open('https://miaoda.feishu.cn/landing', '_blank');
276
275
  },
277
- children: "了解更多"
276
+ children: t('safety.button.learnMore')
278
277
  })
279
278
  ]
280
279
  })
@@ -0,0 +1,15 @@
1
+ /**
2
+ * 获取当前语言环境下的翻译文案。
3
+ *
4
+ * 支持 `{key}` 形式的变量替换:
5
+ * ```ts
6
+ * t('safety.tenant.operated', { name: '字节' })
7
+ * // zh → "字节运营"
8
+ * // en → "Operated by 字节"
9
+ * ```
10
+ *
11
+ * 如果 key 不存在,fallback 到中文;中文也没有则返回 key 本身。
12
+ */
13
+ export declare function t(key: string, params?: Record<string, string>): string;
14
+ export { getLocale } from '../utils/locale';
15
+ export type { Locale } from '../utils/locale';
@@ -0,0 +1,10 @@
1
+ import messages from "./messages.js";
2
+ import { getLocale } from "../utils/locale.js";
3
+ function t(key, params) {
4
+ const locale = getLocale();
5
+ const entry = messages[key];
6
+ let text = entry?.[locale] ?? entry?.zh ?? key;
7
+ if (params) for (const [k, v] of Object.entries(params))text = text.replace(`{${k}}`, v);
8
+ return text;
9
+ }
10
+ export { getLocale, t };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 中英文文案源(统一管理)。
3
+ *
4
+ * 每条文案同时包含 zh 和 en,方便对照和维护。
5
+ * Key 规则:`{组件}.{区域}.{标识}`
6
+ * 文案来源:https://bytedance.larkoffice.com/wiki/BJCQwv9auiP9erkudMfcVIIGnRg
7
+ */
8
+ declare const messages: Record<string, {
9
+ zh: string;
10
+ en: string;
11
+ }>;
12
+ export default messages;
@@ -0,0 +1,36 @@
1
+ const messages_messages = {
2
+ 'safety.badge.label': {
3
+ zh: '妙搭',
4
+ en: 'Spark'
5
+ },
6
+ 'safety.badge.builtWith': {
7
+ zh: '由妙搭搭建',
8
+ en: 'Built with Spark'
9
+ },
10
+ 'safety.ai.disclaimer': {
11
+ zh: '包含 AI 生成内容,请注意甄别',
12
+ en: 'AI-generated content. Use with care.'
13
+ },
14
+ 'safety.tenant.operated': {
15
+ zh: '{name}运营',
16
+ en: 'Operated by {name}'
17
+ },
18
+ 'safety.button.dontShowAgain': {
19
+ zh: '不再展示',
20
+ en: "Don't show again"
21
+ },
22
+ 'safety.button.learnMore': {
23
+ zh: '了解更多',
24
+ en: 'Learn more'
25
+ },
26
+ 'safety.cover.pc': {
27
+ zh: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodacover.png',
28
+ en: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodacover-pcen.png'
29
+ },
30
+ 'safety.cover.mobile': {
31
+ zh: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodacover-mobile.png',
32
+ en: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodacover-weben.png'
33
+ }
34
+ };
35
+ const messages = messages_messages;
36
+ export { messages as default };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 统一的语言判断方法。
3
+ *
4
+ * 基于浏览器 Accept-Language(navigator.language)判断。
5
+ * 返回标准化的 locale code:'zh' | 'en'。
6
+ * 目前只区分中英文,未来需要更多语言时在此扩展。
7
+ */
8
+ export type Locale = 'zh' | 'en';
9
+ export declare function getLocale(): Locale;
@@ -0,0 +1,5 @@
1
+ function getLocale() {
2
+ const lang = navigator.language || 'zh';
3
+ return lang.startsWith('zh') ? 'zh' : 'en';
4
+ }
5
+ export { getLocale };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/client-toolkit",
3
- "version": "1.2.9-beta.42",
3
+ "version": "1.2.9-beta.43",
4
4
  "types": "./lib/index.d.ts",
5
5
  "main": "./lib/index.js",
6
6
  "files": [
@@ -99,12 +99,12 @@
99
99
  "@ant-design/colors": "^7.2.1",
100
100
  "@ant-design/cssinjs": "^1.24.0",
101
101
  "@data-loom/js": "0.4.13",
102
- "@lark-apaas/aily-web-sdk": "0.0.2-beta.12",
103
- "@lark-apaas/auth-sdk": "0.1.0-beta.6",
102
+ "@lark-apaas/aily-web-sdk": "^0.0.9",
103
+ "@lark-apaas/auth-sdk": "^0.1.4",
104
104
  "@lark-apaas/client-capability": "^0.1.6",
105
105
  "@lark-apaas/internal-slardar": "^0.0.3",
106
106
  "@lark-apaas/miaoda-inspector": "^1.0.23",
107
- "@lark-apaas/observable-web": "1.0.1-beta.7",
107
+ "@lark-apaas/observable-web": "^1.0.6",
108
108
  "@radix-ui/react-avatar": "^1.1.10",
109
109
  "@radix-ui/react-popover": "^1.1.15",
110
110
  "@radix-ui/react-slot": "^1.2.3",