@lark-apaas/client-toolkit 1.2.28-alpha.76 → 1.2.28-alpha.77

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.
@@ -12,10 +12,26 @@ const Component = ()=>{
12
12
  const [open, setOpen] = useState(false);
13
13
  const isMobile = useIsMobile();
14
14
  const timeoutRef = useRef(null);
15
- const platformData = window.__platform__ ?? {};
16
- const tenantName = platformData.tenantName ?? '';
17
- const isInternetVisible = platformData.isInternetVisible ?? false;
15
+ const platformData = window.__platform_data__ || window.__platform__ || {};
16
+ const appId = getAppId() || platformData.appId;
18
17
  const showBadge = false !== platformData.showBadge;
18
+ const [tenantName, setTenantName] = useState('');
19
+ const [isInternetVisible, setIsInternetVisible] = useState(false);
20
+ useEffect(()=>{
21
+ if (!showBadge || !visible) return;
22
+ fetch(`/spark/b/${appId}/tenant_info`).then((res)=>res.json()).then((data)=>{
23
+ if (data?.status_code === '0' || data?.code === 0) {
24
+ setTenantName(data?.data?.tenant_info?.name || '');
25
+ setIsInternetVisible(data?.data?.is_internet_visible || false);
26
+ }
27
+ }).catch((e)=>{
28
+ console.warn('Failed to fetch tenant info:', e);
29
+ });
30
+ }, [
31
+ appId,
32
+ showBadge,
33
+ visible
34
+ ]);
19
35
  useEffect(()=>{
20
36
  if (isMobile) {
21
37
  const link = document.createElement('link');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/client-toolkit",
3
- "version": "1.2.28-alpha.76",
3
+ "version": "1.2.28-alpha.77",
4
4
  "types": "./lib/index.d.ts",
5
5
  "main": "./lib/index.js",
6
6
  "files": [