@lark-apaas/client-toolkit 1.2.25 → 1.2.26

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.
@@ -14,17 +14,31 @@ const Component = ()=>{
14
14
  const isMobile = useIsMobile();
15
15
  const [userinfo, setUserinfo] = useState(null);
16
16
  const [isInternetVisible, setIsInternetVisible] = useState(false);
17
+ const [showBadge, setShowBadge] = useState(true);
18
+ const [badgeLoaded, setBadgeLoaded] = useState(false);
17
19
  const timeoutRef = useRef(null);
18
20
  useEffect(()=>{
19
21
  const appId = getAppId();
22
+ const csrfHeaders = {
23
+ 'X-Suda-Csrf-Token': getCsrfToken()
24
+ };
20
25
  const tenantInfoUrl = isNewPathEnabled() ? `/app/${appId}/__runtime__/api/v1/studio/tenant_info` : `/spark/b/${appId}/tenant_info`;
21
26
  fetch(tenantInfoUrl, {
22
- headers: {
23
- 'X-Suda-Csrf-Token': getCsrfToken()
24
- }
27
+ headers: csrfHeaders
25
28
  }).then((res)=>res.json()).then((data)=>{
26
29
  setUserinfo(data?.data?.tenant_info);
27
30
  setIsInternetVisible(data?.data?.is_internet_visible);
31
+ }).catch(()=>{});
32
+ const getPublishedUrl = isNewPathEnabled() ? `/app/${appId}/__runtime__/api/v1/studio/get_published` : `/spark/b/${appId}/get_published`;
33
+ fetch(getPublishedUrl, {
34
+ headers: csrfHeaders
35
+ }).then((res)=>res.json()).then((data)=>{
36
+ const badge = data?.data?.app_info?.show_badge;
37
+ setShowBadge(false !== badge);
38
+ }).catch(()=>{
39
+ setShowBadge(true);
40
+ }).finally(()=>{
41
+ setBadgeLoaded(true);
28
42
  });
29
43
  }, []);
30
44
  useEffect(()=>{
@@ -39,6 +53,8 @@ const Component = ()=>{
39
53
  isMobile
40
54
  ]);
41
55
  if ('production' !== process.env.NODE_ENV) return null;
56
+ if (!badgeLoaded) return null;
57
+ if (!showBadge) return null;
42
58
  if (!visible) return null;
43
59
  if (isMobile) return /*#__PURE__*/ jsxs(Sheet, {
44
60
  open: open,
@@ -47,7 +63,7 @@ const Component = ()=>{
47
63
  /*#__PURE__*/ jsx(SheetTrigger, {
48
64
  asChild: true,
49
65
  children: /*#__PURE__*/ jsxs("div", {
50
- className: "fixed right-[12px] bottom-[80px] inline-flex items-center gap-x-1 border-solid border-[#ffffff1a] border px-[10px] py-[6px] bg-[#1f2329e5] backdrop-blur-[5px] shadow-[0px_6px_12px_0px_#41444a0a,0px_8px_24px_8px_#41444a0a] rounded-md text-[#ebebeb)] font-['PingFang_SC'] text-xs leading-[20px] tracking-[0px] z-[10000000]",
66
+ className: "fixed right-[12px] bottom-[80px] inline-flex items-center gap-x-1 border-solid border-[#ffffff1a] border px-[10px] py-[6px] bg-[#1f2329e5] backdrop-blur-[5px] shadow-[0px_6px_12px_0px_#41444a0a,0px_8px_24px_8px_#41444a0a] rounded-[6px] text-[#ebebeb)] font-['PingFang_SC'] text-xs leading-[20px] tracking-[0px] z-[10000000]",
51
67
  onClick: ()=>{
52
68
  setOpen(true);
53
69
  },
@@ -242,7 +258,7 @@ const Component = ()=>{
242
258
  className: "w-full self-stretch shrink-0 flex items-start gap-x-[8px]",
243
259
  children: [
244
260
  /*#__PURE__*/ jsx("div", {
245
- className: "flex-1 flex rounded-lg 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]",
261
+ 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]",
246
262
  "data-custom-element": "safety-close",
247
263
  onClick: (e)=>{
248
264
  e.stopPropagation();
@@ -253,7 +269,7 @@ const Component = ()=>{
253
269
  children: "不再展示"
254
270
  }),
255
271
  /*#__PURE__*/ jsx("div", {
256
- className: "flex-1 flex rounded-lg 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]",
272
+ 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]",
257
273
  "data-custom-element": "safety-more",
258
274
  onClick: ()=>{
259
275
  window.open('https://miaoda.feishu.cn/landing', '_blank');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/client-toolkit",
3
- "version": "1.2.25",
3
+ "version": "1.2.26",
4
4
  "types": "./lib/index.d.ts",
5
5
  "main": "./lib/index.js",
6
6
  "files": [