@next-bricks/nav 1.18.1 → 1.18.3
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/dist/bricks.json +24 -24
- package/dist/chunks/{2133.b61baf6d.js → 2133.48a1e7d3.js} +2 -2
- package/dist/chunks/{2133.b61baf6d.js.map → 2133.48a1e7d3.js.map} +1 -1
- package/dist/chunks/{2248.4d4ba0c4.js → 2248.d579ad74.js} +2 -2
- package/dist/chunks/2248.d579ad74.js.map +1 -0
- package/dist/chunks/{2252.c6384bfa.js → 2252.72f7a507.js} +3 -3
- package/dist/chunks/{2252.c6384bfa.js.map → 2252.72f7a507.js.map} +1 -1
- package/dist/chunks/4185.3f812e9a.js +3 -0
- package/dist/chunks/4185.3f812e9a.js.map +1 -0
- package/dist/chunks/{4837.3de45a75.js → 4837.fc4cc042.js} +2 -2
- package/dist/chunks/{4837.3de45a75.js.map → 4837.fc4cc042.js.map} +1 -1
- package/dist/chunks/{6595.a094555b.js → 6595.9dea0534.js} +2 -2
- package/dist/chunks/{6595.a094555b.js.map → 6595.9dea0534.js.map} +1 -1
- package/dist/chunks/{7218.54273ee5.js → 7218.45a904e5.js} +2 -2
- package/dist/chunks/{7218.54273ee5.js.map → 7218.45a904e5.js.map} +1 -1
- package/dist/chunks/{8518.e5f62114.js → 8518.bf687bce.js} +2 -2
- package/dist/chunks/{8518.e5f62114.js.map → 8518.bf687bce.js.map} +1 -1
- package/dist/chunks/{9149.1577ab1e.js → 9149.44bca5d8.js} +2 -2
- package/dist/chunks/{9149.1577ab1e.js.map → 9149.44bca5d8.js.map} +1 -1
- package/dist/chunks/{easyops-navbar-alerts.c7394ca5.js → easyops-navbar-alerts.f707821b.js} +2 -2
- package/dist/chunks/{easyops-navbar-alerts.c7394ca5.js.map → easyops-navbar-alerts.f707821b.js.map} +1 -1
- package/dist/chunks/{eo-directory-tree.8fe2c82b.js → eo-directory-tree.eaa7e33f.js} +3 -3
- package/dist/chunks/{eo-directory-tree.8fe2c82b.js.map → eo-directory-tree.eaa7e33f.js.map} +1 -1
- package/dist/chunks/{eo-directory.9ccef6ae.js → eo-directory.e324f557.js} +3 -3
- package/dist/chunks/{eo-directory.9ccef6ae.js.map → eo-directory.e324f557.js.map} +1 -1
- package/dist/chunks/{eo-frame-breadcrumb.84094125.js → eo-frame-breadcrumb.5ba8a907.js} +2 -2
- package/dist/chunks/{eo-frame-breadcrumb.84094125.js.map → eo-frame-breadcrumb.5ba8a907.js.map} +1 -1
- package/dist/chunks/{eo-launchpad-button-v2.8514695c.js → eo-launchpad-button-v2.6f945782.js} +3 -3
- package/dist/chunks/{eo-launchpad-button-v2.8514695c.js.map → eo-launchpad-button-v2.6f945782.js.map} +1 -1
- package/dist/chunks/{eo-nav-menu.fcd39b48.js → eo-nav-menu.cfbfcfa0.js} +2 -2
- package/dist/chunks/{eo-nav-menu.fcd39b48.js.map → eo-nav-menu.cfbfcfa0.js.map} +1 -1
- package/dist/chunks/{eo-sidebar-menu-group.6cfc80fa.js → eo-sidebar-menu-group.f6594305.js} +3 -3
- package/dist/chunks/{eo-sidebar-menu-group.6cfc80fa.js.map → eo-sidebar-menu-group.f6594305.js.map} +1 -1
- package/dist/chunks/{eo-sidebar-menu-submenu.d049eded.js → eo-sidebar-menu-submenu.a5d00cb5.js} +3 -3
- package/dist/chunks/{eo-sidebar-menu-submenu.d049eded.js.map → eo-sidebar-menu-submenu.a5d00cb5.js.map} +1 -1
- package/dist/chunks/{eo-sidebar-menu.dd865a26.js → eo-sidebar-menu.89233ef9.js} +2 -2
- package/dist/chunks/{eo-sidebar-menu.dd865a26.js.map → eo-sidebar-menu.89233ef9.js.map} +1 -1
- package/dist/chunks/{eo-sidebar-sub-menu.dbeaffcf.js → eo-sidebar-sub-menu.ebac5ce4.js} +3 -3
- package/dist/chunks/{eo-sidebar-sub-menu.dbeaffcf.js.map → eo-sidebar-sub-menu.ebac5ce4.js.map} +1 -1
- package/dist/chunks/{eo-sidebar.8cf721fe.js → eo-sidebar.d72fde30.js} +3 -3
- package/dist/chunks/{eo-sidebar.8cf721fe.js.map → eo-sidebar.d72fde30.js.map} +1 -1
- package/dist/chunks/get-menu-config-options.7ee034f7.js +2 -0
- package/dist/chunks/get-menu-config-options.7ee034f7.js.map +1 -0
- package/dist/chunks/get-menu-config-tree.2e388834.js +2 -0
- package/dist/chunks/get-menu-config-tree.2e388834.js.map +1 -0
- package/dist/chunks/{launchpad-config.39e1639c.js → launchpad-config.addcb10e.js} +3 -3
- package/dist/chunks/{launchpad-config.39e1639c.js.map → launchpad-config.addcb10e.js.map} +1 -1
- package/dist/chunks/{main.894241b7.js → main.68333138.js} +2 -2
- package/dist/chunks/{main.894241b7.js.map → main.68333138.js.map} +1 -1
- package/dist/chunks/{nav-logo.098d84c2.js → nav-logo.fc091813.js} +2 -2
- package/dist/chunks/{nav-logo.098d84c2.js.map → nav-logo.fc091813.js.map} +1 -1
- package/dist/chunks/{poll-announce.398b6790.js → poll-announce.167eddd9.js} +3 -3
- package/dist/chunks/{poll-announce.398b6790.js.map → poll-announce.167eddd9.js.map} +1 -1
- package/dist/examples.json +3 -3
- package/dist/{index.bce02739.js → index.2680fbd6.js} +2 -2
- package/dist/{index.bce02739.js.map → index.2680fbd6.js.map} +1 -1
- package/dist/manifest.json +96 -96
- package/dist/types.json +34 -34
- package/package.json +2 -2
- package/dist/chunks/1491.97db62dc.js +0 -3
- package/dist/chunks/1491.97db62dc.js.map +0 -1
- package/dist/chunks/2248.4d4ba0c4.js.map +0 -1
- package/dist/chunks/get-menu-config-options.ee24c2f0.js +0 -2
- package/dist/chunks/get-menu-config-options.ee24c2f0.js.map +0 -1
- package/dist/chunks/get-menu-config-tree.b15d378f.js +0 -2
- package/dist/chunks/get-menu-config-tree.b15d378f.js.map +0 -1
- /package/dist/chunks/{2252.c6384bfa.js.LICENSE.txt → 2252.72f7a507.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{1491.97db62dc.js.LICENSE.txt → 4185.3f812e9a.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{eo-directory-tree.8fe2c82b.js.LICENSE.txt → eo-directory-tree.eaa7e33f.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{eo-directory.9ccef6ae.js.LICENSE.txt → eo-directory.e324f557.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{eo-launchpad-button-v2.8514695c.js.LICENSE.txt → eo-launchpad-button-v2.6f945782.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{eo-sidebar-menu-group.6cfc80fa.js.LICENSE.txt → eo-sidebar-menu-group.f6594305.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{eo-sidebar-menu-submenu.d049eded.js.LICENSE.txt → eo-sidebar-menu-submenu.a5d00cb5.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{eo-sidebar-sub-menu.dbeaffcf.js.LICENSE.txt → eo-sidebar-sub-menu.ebac5ce4.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{eo-sidebar.8cf721fe.js.LICENSE.txt → eo-sidebar.d72fde30.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{launchpad-config.39e1639c.js.LICENSE.txt → launchpad-config.addcb10e.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{poll-announce.398b6790.js.LICENSE.txt → poll-announce.167eddd9.js.LICENSE.txt} +0 -0
package/dist/bricks.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "bricks/nav",
|
|
3
3
|
"bricks": [
|
|
4
|
+
"nav.launchpad-config",
|
|
4
5
|
"nav.easyops-navbar-alerts",
|
|
5
6
|
"nav.app-bar-wrapper",
|
|
6
|
-
"nav.launchpad-config",
|
|
7
7
|
"nav.nav-logo",
|
|
8
8
|
"nav.poll-announce",
|
|
9
9
|
"nav.get-menu-config-options",
|
|
@@ -11,15 +11,15 @@
|
|
|
11
11
|
],
|
|
12
12
|
"elements": [
|
|
13
13
|
"eo-nav-menu",
|
|
14
|
+
"eo-launchpad-button-v2",
|
|
14
15
|
"eo-launchpad-button",
|
|
15
16
|
"eo-launchpad-quick-access",
|
|
16
|
-
"eo-launchpad-recent-visits",
|
|
17
17
|
"eo-search-launchpad",
|
|
18
|
-
"eo-launchpad-
|
|
18
|
+
"eo-launchpad-recent-visits",
|
|
19
19
|
"eo-app-bar-wrapper",
|
|
20
20
|
"eo-frame-breadcrumb",
|
|
21
|
-
"eo-sidebar-menu-group",
|
|
22
21
|
"eo-sidebar-menu-item",
|
|
22
|
+
"eo-sidebar-menu-group",
|
|
23
23
|
"eo-sidebar-menu-submenu",
|
|
24
24
|
"eo-sidebar-menu",
|
|
25
25
|
"eo-sidebar",
|
|
@@ -41,10 +41,23 @@
|
|
|
41
41
|
"eo-input",
|
|
42
42
|
"eo-tooltip"
|
|
43
43
|
],
|
|
44
|
+
"eo-launchpad-button-v2": [
|
|
45
|
+
"basic.lock-body-scroll",
|
|
46
|
+
"eo-icon",
|
|
47
|
+
"eo-link",
|
|
48
|
+
"basic.show-dialog",
|
|
49
|
+
"basic.show-notification"
|
|
50
|
+
],
|
|
44
51
|
"eo-launchpad-button": [
|
|
45
52
|
"eo-icon",
|
|
46
53
|
"eo-link"
|
|
47
54
|
],
|
|
55
|
+
"nav.launchpad-config": [
|
|
56
|
+
"eo-icon",
|
|
57
|
+
"eo-link",
|
|
58
|
+
"eo-dropdown-actions",
|
|
59
|
+
"basic.show-dialog"
|
|
60
|
+
],
|
|
48
61
|
"nav.easyops-navbar-alerts": [
|
|
49
62
|
"eo-icon",
|
|
50
63
|
"eo-link"
|
|
@@ -55,22 +68,15 @@
|
|
|
55
68
|
"basic.show-dialog",
|
|
56
69
|
"basic.show-notification"
|
|
57
70
|
],
|
|
58
|
-
"eo-launchpad-recent-visits": [
|
|
59
|
-
"eo-link",
|
|
60
|
-
"eo-icon",
|
|
61
|
-
"basic.show-dialog",
|
|
62
|
-
"basic.show-notification"
|
|
63
|
-
],
|
|
64
71
|
"eo-search-launchpad": [
|
|
65
72
|
"eo-icon",
|
|
66
73
|
"eo-link",
|
|
67
74
|
"basic.show-dialog",
|
|
68
75
|
"basic.show-notification"
|
|
69
76
|
],
|
|
70
|
-
"eo-launchpad-
|
|
71
|
-
"basic.lock-body-scroll",
|
|
72
|
-
"eo-icon",
|
|
77
|
+
"eo-launchpad-recent-visits": [
|
|
73
78
|
"eo-link",
|
|
79
|
+
"eo-icon",
|
|
74
80
|
"basic.show-dialog",
|
|
75
81
|
"basic.show-notification"
|
|
76
82
|
],
|
|
@@ -79,15 +85,15 @@
|
|
|
79
85
|
"eo-breadcrumb-item",
|
|
80
86
|
"eo-icon"
|
|
81
87
|
],
|
|
88
|
+
"eo-sidebar-menu-item": [
|
|
89
|
+
"eo-link",
|
|
90
|
+
"eo-icon"
|
|
91
|
+
],
|
|
82
92
|
"eo-sidebar-menu-group": [
|
|
83
93
|
"eo-sidebar-menu",
|
|
84
94
|
"eo-sidebar-menu-item",
|
|
85
95
|
"eo-sidebar-menu-submenu"
|
|
86
96
|
],
|
|
87
|
-
"eo-sidebar-menu-item": [
|
|
88
|
-
"eo-link",
|
|
89
|
-
"eo-icon"
|
|
90
|
-
],
|
|
91
97
|
"eo-sidebar-menu-submenu": [
|
|
92
98
|
"eo-icon",
|
|
93
99
|
"eo-sidebar-menu",
|
|
@@ -99,12 +105,6 @@
|
|
|
99
105
|
"eo-sidebar-menu-group",
|
|
100
106
|
"eo-sidebar-menu-submenu"
|
|
101
107
|
],
|
|
102
|
-
"nav.launchpad-config": [
|
|
103
|
-
"eo-icon",
|
|
104
|
-
"eo-link",
|
|
105
|
-
"eo-dropdown-actions",
|
|
106
|
-
"basic.show-dialog"
|
|
107
|
-
],
|
|
108
108
|
"eo-sidebar": [
|
|
109
109
|
"eo-tooltip",
|
|
110
110
|
"eo-icon",
|
|
@@ -145,5 +145,5 @@
|
|
|
145
145
|
"basic.show-notification"
|
|
146
146
|
]
|
|
147
147
|
},
|
|
148
|
-
"filePath": "bricks/nav/dist/index.
|
|
148
|
+
"filePath": "bricks/nav/dist/index.2680fbd6.js"
|
|
149
149
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_next_bricks_nav=globalThis.webpackChunk_next_bricks_nav||[]).push([[2133],{2133:(e,t,n)=>{n.d(t,{fm:()=>M,ir:()=>_,pU:()=>O,sZ:()=>T});var s=n(8769),r=n(
|
|
2
|
-
//# sourceMappingURL=2133.
|
|
1
|
+
"use strict";(globalThis.webpackChunk_next_bricks_nav=globalThis.webpackChunk_next_bricks_nav||[]).push([[2133],{2133:(e,t,n)=>{n.d(t,{fm:()=>M,ir:()=>_,pU:()=>O,sZ:()=>T});var s=n(8769),r=n(7353),i=n(7174),o=n(4612),a=n(4864),c=n(9393),p=n(3346),l=n(7296),u=n(2824),d=n(2887),m=n(8406);const f=10,h=10;var I,g=n(6659),y=n(1030);async function v(){return(await(0,l.K)({page:1,pageSize:f},{interceptorParams:{ignoreLoadingBar:!0},noAbortOnRouteChange:!0})).list}function w(e,t){return e.id.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.description&&e.description.toLowerCase().includes(t)?e:null}function k(e,t){return e.id.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.description&&e.description.toLowerCase().includes(t)?e:null}const b=`launchpad-recent-visits:${null===(I=i.auth.getAuth())||void 0===I?void 0:I.org}`,A=new o.G(localStorage);let F=[],C=new Map,S=new Map,B=!1,P=[],x=!1,E=[],L=!1;const _=new a.x((async()=>{({menuGroups:F,microAppsById:C,customLinksById:S}=await async function(){const e=await(0,p.i)({},{interceptorParams:{ignoreLoadingBar:!0},noAbortOnRouteChange:!0}),t=new Map;for(const n of e.storyboards){const e=n.app;e.localeName=(0,g.F)(e.locales,e.name),t.set(e.id,e)}const n=[],s=new Map;for(const r of e.desktops){const e=[];for(const n of r.items)switch(n.type){case"app":{const s=t.get(n.id);s&&e.push({...n,name:s.localeName,url:s.homepage,menuIcon:s.menuIcon});break}case"custom":e.push(n),s.set(n.id,n);break;case"dir":{const r=[];for(const e of n.items)if("app"===e.type){const n=t.get(e.id);n&&r.push({...e,name:n.localeName,url:n.homepage,menuIcon:n.menuIcon})}else"custom"===e.type&&(r.push(e),s.set(e.id,e));r.length>0&&e.push({...n,items:r});break}}e.length>0&&n.push({...r,items:e})}return{menuGroups:n,microAppsById:t,customLinksById:s}}()),B=!0})),M=new a.x((async()=>{P=await async function(){const e=await v(),t=[];for(const n of e)if("microApp"===n.type){const e=n.relatedApp;e.localeName=(0,g.F)(e.locales,e.name),t.push({favoriteId:n.instanceId,type:"app",name:e.localeName,id:e.appId,url:e.homepage,instanceId:e.instanceId,menuIcon:e.menuIcon})}else if("customItem"===n.type){const e=n.relatedCustomItem;t.push({favoriteId:n.instanceId,type:"custom",name:e.name,id:e.id,url:e.url,menuIcon:e.menuIcon})}else"link"===n.type&&t.push({favoriteId:n.instanceId,type:"link",name:n.name,url:n.link,menuIcon:n.icon});return t}(),x=!0})),O=new a.x((async()=>{E=await async function(){const e=(await(0,m.y)("MICRO_APP_CATEGORY@EASYOPS",{fields:["id","type","name","icon","order","platformApps.appId","platformApps.name","platformApps.homepage","platformApps.description","platformApps.menuIcon","platformApps.locales","platformApps._object_id","platformApps.@.order","platformItems.id","platformItems.name","platformItems.url","platformItems.description","platformItems.menuIcon","platformItems._object_id","platformItems.@.order"],page:1,page_size:300,query:{type:"platform"}})).list,t=null==e?void 0:e.map((e=>{const t=e.platformApps.map((e=>{var t;return{type:"app",name:(0,g.F)(e.locales,e.name),id:e.appId,url:e.homepage,menuIcon:e.menuIcon,description:e.description,instanceId:e.instanceId,order:null===(t=e["@"])||void 0===t?void 0:t.order}})),n=e.platformItems.map((e=>{var t;return{type:"custom",name:e.name,id:e.id,url:e.url,menuIcon:e.menuIcon,description:e.description,instanceId:e.instanceId,order:null===(t=e["@"])||void 0===t?void 0:t.order}})),s=(0,y.sortBy)([...t,...n],"order");return{instanceId:e.instanceId,id:e.id,name:e.name,icon:e.icon,order:e.order,items:s}}));return[{id:"#all",name:"全部",icon:{lib:"easyops",category:"second-menu",icon:"sprint-planning-second-menu"},items:[]},...(0,y.sortBy)(t,"order")]}(),L=!0})),N=e=>(0,c.Ds)({type:"error",message:(0,r.httpErrorToString)(e)});function T(e){const[t,n]=(0,s.useState)(F),[i,o]=(0,s.useState)(C),[a,p]=(0,s.useState)(S),[l,m]=(0,s.useState)(""),[I,g]=(0,s.useState)(!B),[y,T]=(0,s.useState)(!x),[R,j]=(0,s.useState)(!L),[q,z]=(0,s.useState)([]),[D,J]=(0,s.useState)([]),[V,Y]=(0,s.useState)(P),[$,H]=(0,s.useState)(E);(0,s.useEffect)((()=>{e&&!I&&(n(F),o(C),p(S))}),[e,I]),(0,s.useEffect)((()=>{e&&!y&&Y(P)}),[e,y]),(0,s.useEffect)((()=>{e&&!R&&H(E)}),[e,R]),(0,s.useEffect)((()=>{var t;e&&z(null!==(t=A.getItem(b))&&void 0!==t?t:[])}),[e]),(0,s.useEffect)((()=>{e&&(async()=>{try{await _.fetch(),g(!1)}catch(e){(0,r.handleHttpError)(e)}})()}),[e]),(0,s.useEffect)((()=>{e&&(async()=>{try{await M.fetch(),T(!1)}catch(e){T(!1),N(e)}})()}),[e]),(0,s.useEffect)((()=>{var t;e&&null!==(t=(0,r.getRuntime)())&&void 0!==t&&t.getFeatureFlags()["launchpad-show-platform-category"]&&(async()=>{try{await O.fetch(),j(!1)}catch(e){j(!1),N(e)}})()}),[e]),(0,s.useEffect)((()=>{if(I)return;const e=q.map((e=>{if("app"===e.type){const t=i.get(e.id);return t?{type:"app",name:t.localeName,id:t.id,url:t.homepage,instanceId:t.instanceId,menuIcon:t.menuIcon}:null}return a.get(e.id)})).filter(Boolean);J(e)}),[a,I,i,q]);const K=(0,s.useCallback)((e=>{var t;let{type:n,id:s}=e;const r=null!==(t=A.getItem(b))&&void 0!==t?t:[],i=r.findIndex((e=>e.type===n&&e.id===s));i>-1&&r.splice(i,1),r.unshift({type:n,id:s}),r.length>h&&r.pop(),A.setItem(b,r)}),[]),Q=(0,s.useCallback)((e=>V.some((t=>G(e,t)))),[V]),U=(0,s.useCallback)((e=>{const t=V.findIndex((t=>"link"===e.type?t.favoriteId===e.favoriteId:G(e,t)));let n;if(t>-1){const e=V[t];n=V.slice(0,t).concat(V.slice(t+1)),async function(e){return e.favoriteId?(0,d.r)(e.favoriteId):v().then((t=>{var n;const s=null===(n=t.find((t=>{var n,s;return"app"===e.type?"microApp"===t.type&&(null===(n=t.relatedApp)||void 0===n?void 0:n.appId)===e.id:"custom"===e.type&&(null===(s=t.relatedCustomItem)||void 0===s?void 0:s.id)===e.id})))||void 0===n?void 0:n.instanceId;if(s)return(0,d.r)(s);console.error("Menu item to unstar not found:",e)}))}(e).catch(N)}else{if(V.length>=f)return void(0,c.ui)({type:"warn",title:"收藏数量已达上限",content:`当前收藏链接数量已达上限(${f}个),请删除部分收藏后再添加。`});const t={...e};n=V.concat(t),async function(e){return(0,u.k)({type:"app"===e.type?"microApp":"customItem",relatedInstanceId:e.instanceId},{interceptorParams:{ignoreLoadingBar:!0}})}(e).then((e=>{e&&(t.favoriteId=e.instanceId)}),N)}Y(n),P=n}),[V]),Z=(0,s.useMemo)((()=>function(e,t){if(!t)return e;const n=t.toLowerCase();return e.map((e=>({...e,items:e.items.map((e=>{switch(e.type){case"app":return w(e,n);case"custom":return k(e,n);case"dir":{const t=e.items.map((e=>"app"===e.type?w(e,n):"custom"===e.type?k(e,n):null)).filter(Boolean);return t.length>0?{...e,items:t}:null}}})).filter(Boolean)}))).filter((e=>e.items.length>0))}(t,l)),[t,l]),W=(0,s.useMemo)((()=>function(e,t){if(!t)return e;const n=t.toLowerCase();return e.map((e=>({...e,items:e.items.map((e=>{switch(e.type){case"app":return w(e,n);case"custom":return k(e,n)}})).filter(Boolean)})))}($,l)),[$,l]);return{loading:I,q:l,setQ:m,menuGroups:Z,loadingFavorites:y,loadingPlatformCategories:R,favorites:V,recentVisits:D,pushRecentVisit:K,isStarred:Q,toggleStar:U,platformCategories:W}}function G(e,t){return e.instanceId&&t.instanceId?t.instanceId===e.instanceId:t.type===e.type&&t.id===e.id}},9393:(e,t,n)=>{n.d(t,{Bj:()=>i,Ds:()=>c,EM:()=>o,ui:()=>a});var s=n(9476),r=n(532);const i=(0,s.wrapBrick)("eo-icon"),o=(0,s.wrapBrick)("eo-link"),a=(0,r.unwrapProvider)("basic.show-dialog"),c=(0,r.unwrapProvider)("basic.show-notification")},4864:(e,t,n)=>{n.d(t,{x:()=>r});var s=n(4586);class r{constructor(e){(0,s.A)(this,"preFetchId",null),(0,s.A)(this,"preFetchScheduled",!1),(0,s.A)(this,"firstFetchPromise",null),(0,s.A)(this,"isFetching",!1),(0,s.A)(this,"task",void 0),this.task=e}schedulePrefetch(){if(!this.preFetchScheduled){this.preFetchScheduled=!0;const e=async()=>{this.preFetchId=null,this.fetch()};"function"==typeof window.requestIdleCallback?this.preFetchId=window.requestIdleCallback(e):this.preFetchId=setTimeout(e)}}fetch(e){let t;return this.preFetchId&&("function"==typeof window.cancelIdleCallback?cancelIdleCallback(this.preFetchId):clearTimeout(this.preFetchId),this.preFetchId=null),this.isFetching&&!e||(this.isFetching=!0,t=this.task(),t.catch((e=>{console.error(e),this.firstFetchPromise=null})).finally((()=>{this.isFetching=!1})),this.firstFetchPromise||(this.firstFetchPromise=t),!e)?this.firstFetchPromise:t}}},6659:(e,t,n)=>{n.d(t,{F:()=>r});var s=n(1590);function r(e,t){var n;if(!e)return t;const r=Object.fromEntries(Object.entries(e).filter((e=>{let[t,n]=e;return n.name})).map((e=>{let[t,n]=e;return[t,n.name]})));return null!==(n=(0,s.i18nText)(r))&&void 0!==n?n:t}},4612:(e,t,n)=>{n.d(t,{G:()=>s});class s{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"brick-next-";this.storage=e,this.prefix=t}setItem(e,t){this.storage.setItem(this.prefix+e,JSON.stringify(t))}getItem(e){return JSON.parse(this.storage.getItem(this.prefix+e))}removeItem(e){return this.storage.removeItem(this.prefix+e)}clear(){return this.storage.cl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AAA,OAAKqE,EAAU9L,IAAI,IAC7CkE,KAAI6H,IAAA,IAAEC,EAAMF,GAAUC,EAAA,MAAK,CAACC,EAAMF,EAAU9L,KAAK,KAEtD,OAAyB,QAAzBwL,GAAOS,EAAAA,EAAAA,UAASR,UAAS,IAAAD,EAAAA,EAAIxL,CAC/B,C,kCChBO,MAAMS,EACX6J,WAAAA,CACU9J,GAER,IADQ0L,EAAcC,UAAAtJ,OAAA,QAAAuJ,IAAAD,UAAA,GAAAA,UAAA,GAAG,cAAa,KAD9B3L,QAAAA,EAAgB,KAChB0L,OAAAA,CACP,CAEHjE,OAAAA,CAAiBjI,EAAcqM,GAC7B5B,KAAKjK,QAAQyH,QAAQwC,KAAKyB,OAASlM,EAAMsM,KAAKC,UAAUF,GAC1D,CAEA1F,OAAAA,CAAiB3G,GACf,OAAOsM,KAAKE,MAAM/B,KAAKjK,QAAQmG,QAAQ8D,KAAKyB,OAASlM,GACvD,CAEAyM,UAAAA,CAAWzM,GACT,OAAOyK,KAAKjK,QAAQiM,WAAWhC,KAAKyB,OAASlM,EAC/C,CAEA0M,KAAAA,GACE,OAAOjC,KAAKjK,QAAQkM,OACtB,E","sources":["webpack:///./src/launchpad-button-v2/constants.ts","webpack:///./src/launchpad-button-v2/api.ts","webpack:///./src/launchpad-button-v2/search.ts","webpack:///./src/launchpad-button-v2/useLaunchpadInfo.ts","webpack:///./src/launchpad-button-v2/wrapped-bricks.ts","webpack:///./src/shared/DeferredService.ts","webpack:///./src/shared/getLocaleName.ts","webpack:///../../src/JsonStorage.ts"],"sourcesContent":["export const FAVORITES_LIMIT = 10;\nexport const RECENT_VISITS_LIMIT = 10;\n","import type { Storyboard } from \"@next-core/types\";\nimport { LaunchpadApi_getLaunchpadInfo } from \"@next-api-sdk/micro-app-standalone-sdk\";\nimport {\n LaunchpadApi_createCollectionV2,\n LaunchpadApi_deleteCollectionV2,\n LaunchpadApi_listCollectionV2,\n} from \"@next-api-sdk/user-service-sdk\";\nimport { InstanceApi_postSearchV3 } from \"@next-api-sdk/cmdb-sdk\";\nimport type {\n FavMenuItem,\n MenuGroupData,\n MenuItemData,\n MenuItemDataApp,\n MenuItemDataCustom,\n MenuItemDataDir,\n MenuItemDataNormal,\n MicroAppWithInstanceId,\n PlatformCategoryItem,\n} from \"./interfaces\";\nimport { FAVORITES_LIMIT } from \"./constants\";\nimport { getAppLocaleName } from \"../shared/getLocaleName\";\nimport { sortBy } from \"lodash\";\n\nexport async function fetchLaunchpadInfo() {\n const launchpadInfo = await LaunchpadApi_getLaunchpadInfo(\n {},\n {\n interceptorParams: { ignoreLoadingBar: true },\n noAbortOnRouteChange: true,\n }\n );\n\n const microAppsById = new Map<string, MicroAppWithInstanceId>();\n for (const storyboard of launchpadInfo.storyboards as Storyboard[]) {\n const app = storyboard.app as unknown as MicroAppWithInstanceId;\n app.localeName = getAppLocaleName(app.locales, app.name);\n microAppsById.set(app.id, app);\n }\n\n const menuGroups: MenuGroupData[] = [];\n const customLinksById = new Map<string, MenuItemDataCustom>();\n\n for (const group of launchpadInfo.desktops as unknown as MenuGroupData[]) {\n const items: MenuItemData[] = [];\n for (const item of group.items) {\n switch (item.type) {\n case \"app\": {\n const app = microAppsById.get(item.id);\n if (app) {\n items.push({\n ...item,\n name: app.localeName,\n url: app.homepage,\n menuIcon: app.menuIcon,\n } as MenuItemDataApp);\n }\n break;\n }\n case \"custom\":\n items.push(item);\n customLinksById.set(item.id, item);\n break;\n case \"dir\": {\n const subItems: MenuItemDataNormal[] = [];\n for (const subItem of item.items) {\n if (subItem.type === \"app\") {\n const app = microAppsById.get(subItem.id);\n if (app) {\n subItems.push({\n ...subItem,\n name: app.localeName,\n url: app.homepage,\n menuIcon: app.menuIcon,\n } as MenuItemDataApp);\n }\n } else if (subItem.type === \"custom\") {\n subItems.push(subItem as MenuItemDataCustom);\n customLinksById.set(subItem.id, subItem);\n }\n }\n if (subItems.length > 0) {\n items.push({\n ...item,\n items: subItems,\n } as MenuItemDataDir);\n }\n break;\n }\n }\n }\n if (items.length > 0) {\n menuGroups.push({ ...group, items });\n }\n }\n\n return { menuGroups, microAppsById, customLinksById };\n}\n\nasync function fetchRawFavorites() {\n return (\n await LaunchpadApi_listCollectionV2(\n { page: 1, pageSize: FAVORITES_LIMIT },\n {\n interceptorParams: { ignoreLoadingBar: true },\n noAbortOnRouteChange: true,\n }\n )\n ).list;\n}\n\nexport async function fetchFavorites() {\n const list = await fetchRawFavorites();\n const stored: FavMenuItem[] = [];\n for (const fav of list) {\n if (fav.type === \"microApp\") {\n const app = fav.relatedApp as Omit<MicroAppWithInstanceId, \"id\"> & {\n appId: string;\n };\n app.localeName = getAppLocaleName(app.locales, app.name);\n stored.push({\n favoriteId: fav.instanceId,\n type: \"app\",\n name: app.localeName,\n id: app.appId,\n url: app.homepage,\n instanceId: app.instanceId,\n menuIcon: app.menuIcon,\n } as FavMenuItem);\n } else if (fav.type === \"customItem\") {\n const customItem = fav.relatedCustomItem!;\n stored.push({\n favoriteId: fav.instanceId,\n type: \"custom\",\n name: customItem.name,\n id: customItem.id,\n url: customItem.url,\n menuIcon: customItem.menuIcon,\n } as FavMenuItem);\n } else if (fav.type === \"link\") {\n stored.push({\n favoriteId: fav.instanceId,\n type: \"link\",\n name: fav.name,\n // id: fav.id,\n url: fav.link,\n menuIcon: fav.icon,\n } as FavMenuItem);\n }\n }\n return stored;\n}\n\nexport async function favorite(\n item: MenuItemDataNormal\n): Promise<{ instanceId?: string }> {\n return LaunchpadApi_createCollectionV2(\n {\n type: item.type === \"app\" ? \"microApp\" : \"customItem\",\n relatedInstanceId: item.instanceId,\n },\n {\n interceptorParams: { ignoreLoadingBar: true },\n }\n );\n}\n\nexport async function undoFavorite(item: FavMenuItem) {\n if (item.favoriteId) {\n return LaunchpadApi_deleteCollectionV2(item.favoriteId);\n }\n\n return fetchRawFavorites().then((list) => {\n const foundId = list.find((fav) =>\n item.type === \"app\"\n ? fav.type === \"microApp\" && fav.relatedApp?.appId === item.id\n : item.type === \"custom\" && fav.relatedCustomItem?.id === item.id\n )?.instanceId;\n\n if (foundId) {\n return LaunchpadApi_deleteCollectionV2(foundId);\n }\n // eslint-disable-next-line no-console\n console.error(\"Menu item to unstar not found:\", item);\n });\n}\n\nexport async function fetchPlatformCategories(): Promise<\n PlatformCategoryItem[]\n> {\n const categories = (\n await InstanceApi_postSearchV3(\"MICRO_APP_CATEGORY@EASYOPS\", {\n fields: [\n \"id\",\n \"type\",\n \"name\",\n \"icon\",\n \"order\",\n \"platformApps.appId\",\n \"platformApps.name\",\n \"platformApps.homepage\",\n \"platformApps.description\",\n \"platformApps.menuIcon\",\n \"platformApps.locales\",\n \"platformApps._object_id\",\n \"platformApps.@.order\",\n \"platformItems.id\",\n \"platformItems.name\",\n \"platformItems.url\",\n \"platformItems.description\",\n \"platformItems.menuIcon\",\n \"platformItems._object_id\",\n \"platformItems.@.order\",\n ],\n page: 1,\n page_size: 300,\n query: {\n type: \"platform\",\n },\n })\n ).list;\n\n const _categories = categories?.map((category) => {\n const apps = category.platformApps.map((app: Record<string, any>) => {\n return {\n type: \"app\",\n name: getAppLocaleName(app.locales, app.name),\n id: app.appId,\n url: app.homepage,\n menuIcon: app.menuIcon,\n description: app.description,\n instanceId: app.instanceId,\n order: app[\"@\"]?.order,\n };\n }) as MenuItemDataApp[];\n const customItems = category.platformItems.map(\n (item: Record<string, any>) => {\n return {\n type: \"custom\",\n name: item.name,\n id: item.id,\n url: item.url,\n menuIcon: item.menuIcon,\n description: item.description,\n instanceId: item.instanceId,\n order: item[\"@\"]?.order,\n };\n }\n ) as MenuItemDataCustom[];\n\n const items = sortBy([...apps, ...customItems], \"order\");\n return {\n instanceId: category.instanceId,\n id: category.id,\n name: category.name,\n icon: category.icon,\n order: category.order,\n items,\n } as PlatformCategoryItem;\n });\n\n return [\n {\n id: \"#all\",\n name: \"全部\",\n icon: {\n lib: \"easyops\",\n category: \"second-menu\",\n icon: \"sprint-planning-second-menu\",\n },\n items: [],\n },\n ...sortBy(_categories, \"order\"),\n ];\n}\n","import type {\n MenuGroupData,\n MenuItemData,\n MenuItemDataApp,\n MenuItemDataCustom,\n MenuItemDataNormal,\n PlatformCategoryItem,\n} from \"./interfaces\";\n\nexport function search(\n allMenuGroups: MenuGroupData[],\n q: string\n): MenuGroupData[] {\n if (!q) {\n return allMenuGroups;\n }\n const lowerQ = q.toLowerCase();\n const groups: MenuGroupData[] = allMenuGroups\n .map((group) => ({\n ...group,\n items: group.items\n .map((item) => {\n switch (item.type) {\n case \"app\":\n return matchMenuItemApp(item, lowerQ);\n case \"custom\":\n return matchMenuItemCustom(item, lowerQ);\n case \"dir\": {\n const filteredSubItems = item.items\n .map((sub) =>\n sub.type === \"app\"\n ? matchMenuItemApp(sub, lowerQ)\n : sub.type === \"custom\"\n ? matchMenuItemCustom(sub, lowerQ)\n : null\n )\n .filter(Boolean) as MenuItemData[];\n return filteredSubItems.length > 0\n ? {\n ...item,\n items: filteredSubItems,\n }\n : null;\n }\n }\n })\n // Ignore not matched items\n .filter(Boolean) as MenuItemData[],\n }))\n // ignore empty desktops\n .filter((group) => group.items.length > 0);\n return groups;\n}\n\nexport function searchCategories(\n categories: PlatformCategoryItem[],\n q: string\n): PlatformCategoryItem[] {\n if (!q) {\n return categories;\n }\n\n const lowerQ = q.toLowerCase();\n const _categories = categories.map((category) => ({\n ...category,\n items: category.items\n .map((item) => {\n switch (item.type) {\n case \"app\":\n return matchMenuItemApp(item, lowerQ);\n case \"custom\":\n return matchMenuItemCustom(item, lowerQ);\n }\n })\n // Ignore not matched items\n .filter(Boolean) as MenuItemDataNormal[],\n }));\n return _categories;\n}\n\nfunction matchMenuItemApp(item: MenuItemDataApp, lowerQ: string) {\n return item.id.toLowerCase().includes(lowerQ) ||\n item.name.toLowerCase().includes(lowerQ) ||\n (item.description && item.description.toLowerCase().includes(lowerQ))\n ? item\n : null;\n}\n\nfunction matchMenuItemCustom(item: MenuItemDataCustom, lowerQ: string) {\n return item.id.toLowerCase().includes(lowerQ) ||\n item.name.toLowerCase().includes(lowerQ) ||\n (item.description && item.description.toLowerCase().includes(lowerQ))\n ? item\n : null;\n}\n","import { useCallback, useEffect, useMemo, useState } from \"react\";\nimport {\n getRuntime,\n handleHttpError,\n httpErrorToString,\n} from \"@next-core/runtime\";\nimport { auth } from \"@next-core/easyops-runtime\";\nimport { JsonStorage } from \"@next-shared/general/JsonStorage\";\nimport { DeferredService } from \"../shared/DeferredService\";\nimport { showDialog, showNotification } from \"./wrapped-bricks\";\nimport type {\n FavMenuItem,\n MenuGroupData,\n MenuItemDataCustom,\n MenuItemDataLink,\n MenuItemDataNormal,\n MicroAppWithInstanceId,\n PlatformCategoryItem,\n StoredMenuItem,\n} from \"./interfaces\";\nimport {\n favorite,\n fetchFavorites,\n fetchLaunchpadInfo,\n fetchPlatformCategories,\n undoFavorite,\n} from \"./api\";\nimport { search, searchCategories } from \"./search\";\nimport { FAVORITES_LIMIT, RECENT_VISITS_LIMIT } from \"./constants\";\n\nconst storageKey = `launchpad-recent-visits:${(\n auth.getAuth() as Record<string, string>\n)?.org}`;\nconst storage = new JsonStorage(localStorage);\n\nlet candidateDesktops: MenuGroupData[] = [];\nlet candidateMicroAppsById = new Map<string, MicroAppWithInstanceId>();\nlet candidateCustomLinksById = new Map<string, MenuItemDataCustom>();\nlet preLoaded = false;\n\nlet candidateFavorites: FavMenuItem[] = [];\nlet preLoadedFavorites = false;\n\nlet candidatePlatformCategories: PlatformCategoryItem[] = [];\nlet preLoadedPlatformCategories = false;\n\nexport const deferredLaunchpadInfo = new DeferredService(async () => {\n ({\n menuGroups: candidateDesktops,\n microAppsById: candidateMicroAppsById,\n customLinksById: candidateCustomLinksById,\n } = await fetchLaunchpadInfo());\n preLoaded = true;\n});\n\nexport const deferredFavorites = new DeferredService(async () => {\n candidateFavorites = await fetchFavorites();\n preLoadedFavorites = true;\n});\n\nexport const deferredPlatformCategories = new DeferredService(async () => {\n candidatePlatformCategories = await fetchPlatformCategories();\n preLoadedPlatformCategories = true;\n});\n\nconst showErrorAsNotification = (error: unknown) =>\n showNotification({\n type: \"error\",\n message: httpErrorToString(error),\n });\n\n/**\n * - 页面初始化时预加载 launchpad 信息。\n * - 每次打开 launchpad 都发起请求,但该请求的数据只在下次打开 launchpad 时使用。\n * 即每次打开 launchpad 使用的都是上一次获取的数据,以便达到两个效果:\n * - 每次打开 launchpad 都能立即显示菜单列表;\n * - 同时当用户在 launchpad 上操作时,不会出现数据突然更新(新数据请求完成)。\n */\nexport function useLaunchpadInfo(active?: boolean) {\n const [desktops, setDesktops] = useState(candidateDesktops);\n const [microAppsById, setMicroAppsById] = useState(candidateMicroAppsById);\n const [customLinksById, setCustomLinksById] = useState(\n candidateCustomLinksById\n );\n\n const [q, setQ] = useState(\"\");\n\n const [loading, setLoading] = useState(!preLoaded);\n const [loadingFavorites, setLoadingFavorites] = useState(!preLoadedFavorites);\n const [loadingPlatformCategories, setLoadingPlatformCategories] = useState(\n !preLoadedPlatformCategories\n );\n\n const [storedRecentVisits, setStoredRecentVisits] = useState<\n StoredMenuItem[]\n >([]);\n\n const [recentVisits, setRecentVisits] = useState<MenuItemDataNormal[]>([]);\n\n const [favorites, setFavorites] = useState<FavMenuItem[]>(candidateFavorites);\n const [platformCategories, setPlatformCategories] = useState<\n PlatformCategoryItem[]\n >(candidatePlatformCategories);\n\n useEffect(() => {\n // 仅当首次加载完成或重新打开 launchpad 时更新一次数据。\n if (active && !loading) {\n setDesktops(candidateDesktops);\n setMicroAppsById(candidateMicroAppsById);\n setCustomLinksById(candidateCustomLinksById);\n }\n }, [active, loading]);\n\n useEffect(() => {\n if (active && !loadingFavorites) {\n setFavorites(candidateFavorites);\n }\n }, [active, loadingFavorites]);\n\n useEffect(() => {\n if (active && !loadingPlatformCategories) {\n setPlatformCategories(candidatePlatformCategories);\n }\n }, [active, loadingPlatformCategories]);\n\n useEffect(() => {\n if (active) {\n setStoredRecentVisits(storage.getItem(storageKey) ?? []);\n }\n }, [active]);\n\n useEffect(() => {\n if (active) {\n const startFetchLaunchpadInfo = async (): Promise<void> => {\n try {\n await deferredLaunchpadInfo.fetch();\n setLoading(false);\n } catch (error) {\n handleHttpError(error);\n }\n };\n startFetchLaunchpadInfo();\n }\n }, [active]);\n\n useEffect(() => {\n if (active) {\n const startFetchFavorites = async (): Promise<void> => {\n try {\n await deferredFavorites.fetch();\n setLoadingFavorites(false);\n } catch (error) {\n setLoadingFavorites(false);\n showErrorAsNotification(error);\n }\n };\n startFetchFavorites();\n }\n }, [active]);\n\n useEffect(() => {\n if (\n active &&\n getRuntime()?.getFeatureFlags()[\"launchpad-show-platform-category\"]\n ) {\n const startFetchPlatformCategories = async (): Promise<void> => {\n try {\n await deferredPlatformCategories.fetch();\n setLoadingPlatformCategories(false);\n } catch (error) {\n setLoadingPlatformCategories(false);\n showErrorAsNotification(error);\n }\n };\n startFetchPlatformCategories();\n }\n }, [active]);\n\n useEffect(() => {\n if (loading) {\n return;\n }\n const visits = storedRecentVisits\n .map((item) => {\n // Remembered recent visits maybe no longer existed in launchpad\n if (item.type === \"app\") {\n const app = microAppsById.get(item.id);\n return app\n ? {\n type: \"app\",\n name: app.localeName,\n id: app.id,\n url: app.homepage,\n instanceId: app.instanceId,\n menuIcon: app.menuIcon,\n }\n : null;\n }\n return customLinksById.get(item.id);\n })\n .filter(Boolean) as MenuItemDataNormal[];\n setRecentVisits(visits);\n }, [customLinksById, loading, microAppsById, storedRecentVisits]);\n\n const pushRecentVisit = useCallback(({ type, id }: StoredMenuItem) => {\n const visits: StoredMenuItem[] = storage.getItem(storageKey) ?? [];\n const index = visits.findIndex(\n (visit) => visit.type === type && visit.id === id\n );\n if (index > -1) {\n visits.splice(index, 1);\n }\n visits.unshift({ type, id });\n if (visits.length > RECENT_VISITS_LIMIT) {\n visits.pop();\n }\n // setStoredRecentVisits(visits);\n storage.setItem(storageKey, visits);\n }, []);\n\n const isStarred = useCallback(\n (item: MenuItemDataNormal) =>\n favorites.some((fav) => matchFavorite(item, fav)),\n [favorites]\n );\n\n const toggleStar = useCallback(\n (item: MenuItemDataNormal | MenuItemDataLink) => {\n const index = favorites.findIndex((fav) =>\n item.type === \"link\"\n ? fav.favoriteId === item.favoriteId\n : matchFavorite(item, fav)\n );\n let newFavorites: FavMenuItem[];\n if (index > -1) {\n const removed = favorites[index];\n newFavorites = favorites\n .slice(0, index)\n .concat(favorites.slice(index + 1));\n undoFavorite(removed).catch(showErrorAsNotification);\n } else {\n if (favorites.length >= FAVORITES_LIMIT) {\n showDialog({\n type: \"warn\",\n title: \"收藏数量已达上限\",\n content: `当前收藏链接数量已达上限(${FAVORITES_LIMIT}个),请删除部分收藏后再添加。`,\n });\n return;\n }\n // Assert: no link item\n const fav: FavMenuItem = { ...(item as MenuItemDataNormal) };\n newFavorites = favorites.concat(fav);\n favorite(item as MenuItemDataNormal).then((result) => {\n if (result) {\n fav.favoriteId = result.instanceId;\n }\n }, showErrorAsNotification);\n }\n setFavorites(newFavorites);\n candidateFavorites = newFavorites;\n },\n [favorites]\n );\n\n const menuGroups: MenuGroupData[] = useMemo(\n () => search(desktops, q),\n [desktops, q]\n );\n\n const filteredPlatformCategories: PlatformCategoryItem[] = useMemo(\n () => searchCategories(platformCategories, q),\n [platformCategories, q]\n );\n\n return {\n loading,\n q,\n setQ,\n menuGroups,\n loadingFavorites,\n loadingPlatformCategories,\n favorites,\n recentVisits,\n pushRecentVisit,\n isStarred,\n toggleStar,\n platformCategories: filteredPlatformCategories,\n };\n}\n\nexport function matchFavorite(item: MenuItemDataNormal, fav: FavMenuItem) {\n return item.instanceId && fav.instanceId\n ? fav.instanceId === item.instanceId\n : fav.type === item.type && fav.id === item.id;\n}\n","import { wrapBrick } from \"@next-core/react-element\";\nimport { unwrapProvider } from \"@next-core/utils/general\";\nimport type {\n GeneralIcon,\n GeneralIconProps,\n} from \"@next-bricks/icons/general-icon\";\nimport type { Link, LinkProps } from \"@next-bricks/basic/link\";\nimport type { showDialog as _showDialog } from \"@next-bricks/basic/data-providers/show-dialog/show-dialog\";\nimport type { showNotification as _showNotification } from \"@next-bricks/basic/data-providers/show-notification/show-notification\";\n\nexport const WrappedIcon = wrapBrick<GeneralIcon, GeneralIconProps>(\"eo-icon\");\nexport const WrappedLink = wrapBrick<Link, LinkProps>(\"eo-link\");\n\n// Use `unwrapProvider` to get the original function of a provider\nexport const showDialog =\n unwrapProvider<typeof _showDialog>(\"basic.show-dialog\");\n\nexport const showNotification = unwrapProvider<typeof _showNotification>(\n \"basic.show-notification\"\n);\n","export class DeferredService {\n private preFetchId: number | null = null;\n private preFetchScheduled = false;\n private firstFetchPromise: Promise<unknown> | null = null;\n private isFetching = false;\n private readonly task: () => Promise<unknown>;\n\n constructor(task: () => Promise<unknown>) {\n this.task = task;\n }\n\n schedulePrefetch(): void {\n if (!this.preFetchScheduled) {\n this.preFetchScheduled = true;\n const preFetchLaunchpadInfo = async (): Promise<void> => {\n this.preFetchId = null;\n this.fetch();\n };\n // istanbul ignore if\n if (typeof window.requestIdleCallback === \"function\") {\n this.preFetchId = window.requestIdleCallback(preFetchLaunchpadInfo);\n } else {\n this.preFetchId = setTimeout(\n preFetchLaunchpadInfo\n ) as unknown as number;\n }\n }\n }\n\n fetch(eager?: boolean): Promise<unknown> {\n if (this.preFetchId) {\n // istanbul ignore if\n if (typeof window.cancelIdleCallback === \"function\") {\n cancelIdleCallback(this.preFetchId);\n } else {\n clearTimeout(this.preFetchId);\n }\n this.preFetchId = null;\n }\n\n let promise: Promise<unknown>;\n if (!this.isFetching || eager) {\n this.isFetching = true;\n promise = this.task();\n promise\n .catch((error) => {\n // eslint-disable-next-line no-console\n console.error(error);\n this.firstFetchPromise = null;\n })\n .finally(() => {\n this.isFetching = false;\n });\n if (!this.firstFetchPromise) {\n this.firstFetchPromise = promise;\n }\n if (eager) {\n return promise;\n }\n }\n return this.firstFetchPromise!;\n }\n}\n","import { i18nText } from \"@next-core/i18n\";\nimport type { AppLocales, I18nData } from \"@next-core/types\";\n\nexport function getAppLocaleName(\n locales: AppLocales | undefined,\n name: string\n) {\n if (!locales) {\n return name;\n }\n const i18nData = Object.fromEntries(\n Object.entries(locales)\n .filter(([_lang, resources]) => resources.name)\n .map(([lang, resources]) => [lang, resources.name])\n ) as I18nData;\n return i18nText(i18nData) ?? name;\n}\n","export class JsonStorage {\n constructor(\n private storage: Storage,\n private prefix: string = \"brick-next-\"\n ) {}\n\n setItem<T = any>(name: string, value: T): void {\n this.storage.setItem(this.prefix + name, JSON.stringify(value));\n }\n\n getItem<T = any>(name: string): T {\n return JSON.parse(this.storage.getItem(this.prefix + name) as string) as T;\n }\n\n removeItem(name: string): void {\n return this.storage.removeItem(this.prefix + name);\n }\n\n clear(): void {\n return this.storage.clear();\n }\n}\n"],"names":["FAVORITES_LIMIT","RECENT_VISITS_LIMIT","async","fetchRawFavorites","LaunchpadApi_listCollectionV2","page","pageSize","interceptorParams","ignoreLoadingBar","noAbortOnRouteChange","list","matchMenuItemApp","item","lowerQ","id","toLowerCase","includes","name","description","matchMenuItemCustom","storageKey","_auth$getAuth","auth","getAuth","org","storage","JsonStorage","localStorage","candidateDesktops","candidateMicroAppsById","Map","candidateCustomLinksById","preLoaded","candidateFavorites","preLoadedFavorites","candidatePlatformCategories","preLoadedPlatformCategories","deferredLaunchpadInfo","DeferredService","menuGroups","microAppsById","customLinksById","launchpadInfo","LaunchpadApi_getLaunchpadInfo","storyboard","storyboards","app","localeName","getAppLocaleName","locales","set","group","desktops","items","type","get","push","url","homepage","menuIcon","subItems","subItem","length","fetchLaunchpadInfo","deferredFavorites","stored","fav","relatedApp","favoriteId","instanceId","appId","customItem","relatedCustomItem","link","icon","fetchFavorites","deferredPlatformCategories","categories","InstanceApi_postSearchV3","fields","page_size","query","_categories","map","category","apps","platformApps","_app$","order","customItems","platformItems","_item$","sortBy","lib","fetchPlatformCategories","showErrorAsNotification","error","showNotification","message","httpErrorToString","useLaunchpadInfo","active","setDesktops","useState","setMicroAppsById","setCustomLinksById","q","setQ","loading","setLoading","loadingFavorites","setLoadingFavorites","loadingPlatformCategories","setLoadingPlatformCategories","storedRecentVisits","setStoredRecentVisits","recentVisits","setRecentVisits","favorites","setFavorites","platformCategories","setPlatformCategories","useEffect","_storage$getItem","getItem","fetch","handleHttpError","startFetchLaunchpadInfo","startFetchFavorites","_getRuntime","getRuntime","getFeatureFlags","startFetchPlatformCategories","visits","filter","Boolean","pushRecentVisit","useCallback","_ref","_storage$getItem2","index","findIndex","visit","splice","unshift","pop","setItem","isStarred","some","matchFavorite","toggleStar","newFavorites","removed","slice","concat","LaunchpadApi_deleteCollectionV2","then","_list$find","foundId","find","_fav$relatedApp","_fav$relatedCustomIte","console","undoFavorite","catch","showDialog","title","content","LaunchpadApi_createCollectionV2","relatedInstanceId","favorite","result","useMemo","allMenuGroups","filteredSubItems","sub","search","filteredPlatformCategories","searchCategories","WrappedIcon","wrapBrick","WrappedLink","unwrapProvider","constructor","task","_defineProperty","this","schedulePrefetch","preFetchScheduled","preFetchLaunchpadInfo","preFetchId","window","requestIdleCallback","setTimeout","eager","promise","cancelIdleCallback","clearTimeout","isFetching","firstFetchPromise","finally","_i18nText","i18nData","Object","fromEntries","entries","_lang","resources","_ref2","lang","i18nText","prefix","arguments","undefined","value","JSON","stringify","parse","removeItem","clear"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"chunks/2133.48a1e7d3.js","mappings":"+RAAO,MAAMA,EAAkB,GAClBC,EAAsB,G,0BCiGnCC,eAAeC,IACb,aACQC,EAAAA,EAAAA,GACJ,CAAEC,KAAM,EAAGC,SAAUN,GACrB,CACEO,kBAAmB,CAAEC,kBAAkB,GACvCC,sBAAsB,KAG1BC,IACJ,CC5BA,SAASC,EAAiBC,EAAuBC,GAC/C,OAAOD,EAAKE,GAAGC,cAAcC,SAASH,IACpCD,EAAKK,KAAKF,cAAcC,SAASH,IAChCD,EAAKM,aAAeN,EAAKM,YAAYH,cAAcC,SAASH,GAC3DD,EACA,IACN,CAEA,SAASO,EAAoBP,EAA0BC,GACrD,OAAOD,EAAKE,GAAGC,cAAcC,SAASH,IACpCD,EAAKK,K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KyB,OAASlM,GACvD,CAEAyM,UAAAA,CAAWzM,GACT,OAAOyK,KAAKjK,QAAQiM,WAAWhC,KAAKyB,OAASlM,EAC/C,CAEA0M,KAAAA,GACE,OAAOjC,KAAKjK,QAAQkM,OACtB,E","sources":["webpack:///./src/launchpad-button-v2/constants.ts","webpack:///./src/launchpad-button-v2/api.ts","webpack:///./src/launchpad-button-v2/search.ts","webpack:///./src/launchpad-button-v2/useLaunchpadInfo.ts","webpack:///./src/launchpad-button-v2/wrapped-bricks.ts","webpack:///./src/shared/DeferredService.ts","webpack:///./src/shared/getLocaleName.ts","webpack:///../../src/JsonStorage.ts"],"sourcesContent":["export const FAVORITES_LIMIT = 10;\nexport const RECENT_VISITS_LIMIT = 10;\n","import type { Storyboard } from \"@next-core/types\";\nimport { LaunchpadApi_getLaunchpadInfo } from \"@next-api-sdk/micro-app-standalone-sdk\";\nimport {\n LaunchpadApi_createCollectionV2,\n LaunchpadApi_deleteCollectionV2,\n LaunchpadApi_listCollectionV2,\n} from \"@next-api-sdk/user-service-sdk\";\nimport { InstanceApi_postSearchV3 } from \"@next-api-sdk/cmdb-sdk\";\nimport type {\n FavMenuItem,\n MenuGroupData,\n MenuItemData,\n MenuItemDataApp,\n MenuItemDataCustom,\n MenuItemDataDir,\n MenuItemDataNormal,\n MicroAppWithInstanceId,\n PlatformCategoryItem,\n} from \"./interfaces\";\nimport { FAVORITES_LIMIT } from \"./constants\";\nimport { getAppLocaleName } from \"../shared/getLocaleName\";\nimport { sortBy } from \"lodash\";\n\nexport async function fetchLaunchpadInfo() {\n const launchpadInfo = await LaunchpadApi_getLaunchpadInfo(\n {},\n {\n interceptorParams: { ignoreLoadingBar: true },\n noAbortOnRouteChange: true,\n }\n );\n\n const microAppsById = new Map<string, MicroAppWithInstanceId>();\n for (const storyboard of launchpadInfo.storyboards as Storyboard[]) {\n const app = storyboard.app as unknown as MicroAppWithInstanceId;\n app.localeName = getAppLocaleName(app.locales, app.name);\n microAppsById.set(app.id, app);\n }\n\n const menuGroups: MenuGroupData[] = [];\n const customLinksById = new Map<string, MenuItemDataCustom>();\n\n for (const group of launchpadInfo.desktops as unknown as MenuGroupData[]) {\n const items: MenuItemData[] = [];\n for (const item of group.items) {\n switch (item.type) {\n case \"app\": {\n const app = microAppsById.get(item.id);\n if (app) {\n items.push({\n ...item,\n name: app.localeName,\n url: app.homepage,\n menuIcon: app.menuIcon,\n } as MenuItemDataApp);\n }\n break;\n }\n case \"custom\":\n items.push(item);\n customLinksById.set(item.id, item);\n break;\n case \"dir\": {\n const subItems: MenuItemDataNormal[] = [];\n for (const subItem of item.items) {\n if (subItem.type === \"app\") {\n const app = microAppsById.get(subItem.id);\n if (app) {\n subItems.push({\n ...subItem,\n name: app.localeName,\n url: app.homepage,\n menuIcon: app.menuIcon,\n } as MenuItemDataApp);\n }\n } else if (subItem.type === \"custom\") {\n subItems.push(subItem as MenuItemDataCustom);\n customLinksById.set(subItem.id, subItem);\n }\n }\n if (subItems.length > 0) {\n items.push({\n ...item,\n items: subItems,\n } as MenuItemDataDir);\n }\n break;\n }\n }\n }\n if (items.length > 0) {\n menuGroups.push({ ...group, items });\n }\n }\n\n return { menuGroups, microAppsById, customLinksById };\n}\n\nasync function fetchRawFavorites() {\n return (\n await LaunchpadApi_listCollectionV2(\n { page: 1, pageSize: FAVORITES_LIMIT },\n {\n interceptorParams: { ignoreLoadingBar: true },\n noAbortOnRouteChange: true,\n }\n )\n ).list;\n}\n\nexport async function fetchFavorites() {\n const list = await fetchRawFavorites();\n const stored: FavMenuItem[] = [];\n for (const fav of list) {\n if (fav.type === \"microApp\") {\n const app = fav.relatedApp as Omit<MicroAppWithInstanceId, \"id\"> & {\n appId: string;\n };\n app.localeName = getAppLocaleName(app.locales, app.name);\n stored.push({\n favoriteId: fav.instanceId,\n type: \"app\",\n name: app.localeName,\n id: app.appId,\n url: app.homepage,\n instanceId: app.instanceId,\n menuIcon: app.menuIcon,\n } as FavMenuItem);\n } else if (fav.type === \"customItem\") {\n const customItem = fav.relatedCustomItem!;\n stored.push({\n favoriteId: fav.instanceId,\n type: \"custom\",\n name: customItem.name,\n id: customItem.id,\n url: customItem.url,\n menuIcon: customItem.menuIcon,\n } as FavMenuItem);\n } else if (fav.type === \"link\") {\n stored.push({\n favoriteId: fav.instanceId,\n type: \"link\",\n name: fav.name,\n // id: fav.id,\n url: fav.link,\n menuIcon: fav.icon,\n } as FavMenuItem);\n }\n }\n return stored;\n}\n\nexport async function favorite(\n item: MenuItemDataNormal\n): Promise<{ instanceId?: string }> {\n return LaunchpadApi_createCollectionV2(\n {\n type: item.type === \"app\" ? \"microApp\" : \"customItem\",\n relatedInstanceId: item.instanceId,\n },\n {\n interceptorParams: { ignoreLoadingBar: true },\n }\n );\n}\n\nexport async function undoFavorite(item: FavMenuItem) {\n if (item.favoriteId) {\n return LaunchpadApi_deleteCollectionV2(item.favoriteId);\n }\n\n return fetchRawFavorites().then((list) => {\n const foundId = list.find((fav) =>\n item.type === \"app\"\n ? fav.type === \"microApp\" && fav.relatedApp?.appId === item.id\n : item.type === \"custom\" && fav.relatedCustomItem?.id === item.id\n )?.instanceId;\n\n if (foundId) {\n return LaunchpadApi_deleteCollectionV2(foundId);\n }\n // eslint-disable-next-line no-console\n console.error(\"Menu item to unstar not found:\", item);\n });\n}\n\nexport async function fetchPlatformCategories(): Promise<\n PlatformCategoryItem[]\n> {\n const categories = (\n await InstanceApi_postSearchV3(\"MICRO_APP_CATEGORY@EASYOPS\", {\n fields: [\n \"id\",\n \"type\",\n \"name\",\n \"icon\",\n \"order\",\n \"platformApps.appId\",\n \"platformApps.name\",\n \"platformApps.homepage\",\n \"platformApps.description\",\n \"platformApps.menuIcon\",\n \"platformApps.locales\",\n \"platformApps._object_id\",\n \"platformApps.@.order\",\n \"platformItems.id\",\n \"platformItems.name\",\n \"platformItems.url\",\n \"platformItems.description\",\n \"platformItems.menuIcon\",\n \"platformItems._object_id\",\n \"platformItems.@.order\",\n ],\n page: 1,\n page_size: 300,\n query: {\n type: \"platform\",\n },\n })\n ).list;\n\n const _categories = categories?.map((category) => {\n const apps = category.platformApps.map((app: Record<string, any>) => {\n return {\n type: \"app\",\n name: getAppLocaleName(app.locales, app.name),\n id: app.appId,\n url: app.homepage,\n menuIcon: app.menuIcon,\n description: app.description,\n instanceId: app.instanceId,\n order: app[\"@\"]?.order,\n };\n }) as MenuItemDataApp[];\n const customItems = category.platformItems.map(\n (item: Record<string, any>) => {\n return {\n type: \"custom\",\n name: item.name,\n id: item.id,\n url: item.url,\n menuIcon: item.menuIcon,\n description: item.description,\n instanceId: item.instanceId,\n order: item[\"@\"]?.order,\n };\n }\n ) as MenuItemDataCustom[];\n\n const items = sortBy([...apps, ...customItems], \"order\");\n return {\n instanceId: category.instanceId,\n id: category.id,\n name: category.name,\n icon: category.icon,\n order: category.order,\n items,\n } as PlatformCategoryItem;\n });\n\n return [\n {\n id: \"#all\",\n name: \"全部\",\n icon: {\n lib: \"easyops\",\n category: \"second-menu\",\n icon: \"sprint-planning-second-menu\",\n },\n items: [],\n },\n ...sortBy(_categories, \"order\"),\n ];\n}\n","import type {\n MenuGroupData,\n MenuItemData,\n MenuItemDataApp,\n MenuItemDataCustom,\n MenuItemDataNormal,\n PlatformCategoryItem,\n} from \"./interfaces\";\n\nexport function search(\n allMenuGroups: MenuGroupData[],\n q: string\n): MenuGroupData[] {\n if (!q) {\n return allMenuGroups;\n }\n const lowerQ = q.toLowerCase();\n const groups: MenuGroupData[] = allMenuGroups\n .map((group) => ({\n ...group,\n items: group.items\n .map((item) => {\n switch (item.type) {\n case \"app\":\n return matchMenuItemApp(item, lowerQ);\n case \"custom\":\n return matchMenuItemCustom(item, lowerQ);\n case \"dir\": {\n const filteredSubItems = item.items\n .map((sub) =>\n sub.type === \"app\"\n ? matchMenuItemApp(sub, lowerQ)\n : sub.type === \"custom\"\n ? matchMenuItemCustom(sub, lowerQ)\n : null\n )\n .filter(Boolean) as MenuItemData[];\n return filteredSubItems.length > 0\n ? {\n ...item,\n items: filteredSubItems,\n }\n : null;\n }\n }\n })\n // Ignore not matched items\n .filter(Boolean) as MenuItemData[],\n }))\n // ignore empty desktops\n .filter((group) => group.items.length > 0);\n return groups;\n}\n\nexport function searchCategories(\n categories: PlatformCategoryItem[],\n q: string\n): PlatformCategoryItem[] {\n if (!q) {\n return categories;\n }\n\n const lowerQ = q.toLowerCase();\n const _categories = categories.map((category) => ({\n ...category,\n items: category.items\n .map((item) => {\n switch (item.type) {\n case \"app\":\n return matchMenuItemApp(item, lowerQ);\n case \"custom\":\n return matchMenuItemCustom(item, lowerQ);\n }\n })\n // Ignore not matched items\n .filter(Boolean) as MenuItemDataNormal[],\n }));\n return _categories;\n}\n\nfunction matchMenuItemApp(item: MenuItemDataApp, lowerQ: string) {\n return item.id.toLowerCase().includes(lowerQ) ||\n item.name.toLowerCase().includes(lowerQ) ||\n (item.description && item.description.toLowerCase().includes(lowerQ))\n ? item\n : null;\n}\n\nfunction matchMenuItemCustom(item: MenuItemDataCustom, lowerQ: string) {\n return item.id.toLowerCase().includes(lowerQ) ||\n item.name.toLowerCase().includes(lowerQ) ||\n (item.description && item.description.toLowerCase().includes(lowerQ))\n ? item\n : null;\n}\n","import { useCallback, useEffect, useMemo, useState } from \"react\";\nimport {\n getRuntime,\n handleHttpError,\n httpErrorToString,\n} from \"@next-core/runtime\";\nimport { auth } from \"@next-core/easyops-runtime\";\nimport { JsonStorage } from \"@next-shared/general/JsonStorage\";\nimport { DeferredService } from \"../shared/DeferredService\";\nimport { showDialog, showNotification } from \"./wrapped-bricks\";\nimport type {\n FavMenuItem,\n MenuGroupData,\n MenuItemDataCustom,\n MenuItemDataLink,\n MenuItemDataNormal,\n MicroAppWithInstanceId,\n PlatformCategoryItem,\n StoredMenuItem,\n} from \"./interfaces\";\nimport {\n favorite,\n fetchFavorites,\n fetchLaunchpadInfo,\n fetchPlatformCategories,\n undoFavorite,\n} from \"./api\";\nimport { search, searchCategories } from \"./search\";\nimport { FAVORITES_LIMIT, RECENT_VISITS_LIMIT } from \"./constants\";\n\nconst storageKey = `launchpad-recent-visits:${(\n auth.getAuth() as Record<string, string>\n)?.org}`;\nconst storage = new JsonStorage(localStorage);\n\nlet candidateDesktops: MenuGroupData[] = [];\nlet candidateMicroAppsById = new Map<string, MicroAppWithInstanceId>();\nlet candidateCustomLinksById = new Map<string, MenuItemDataCustom>();\nlet preLoaded = false;\n\nlet candidateFavorites: FavMenuItem[] = [];\nlet preLoadedFavorites = false;\n\nlet candidatePlatformCategories: PlatformCategoryItem[] = [];\nlet preLoadedPlatformCategories = false;\n\nexport const deferredLaunchpadInfo = new DeferredService(async () => {\n ({\n menuGroups: candidateDesktops,\n microAppsById: candidateMicroAppsById,\n customLinksById: candidateCustomLinksById,\n } = await fetchLaunchpadInfo());\n preLoaded = true;\n});\n\nexport const deferredFavorites = new DeferredService(async () => {\n candidateFavorites = await fetchFavorites();\n preLoadedFavorites = true;\n});\n\nexport const deferredPlatformCategories = new DeferredService(async () => {\n candidatePlatformCategories = await fetchPlatformCategories();\n preLoadedPlatformCategories = true;\n});\n\nconst showErrorAsNotification = (error: unknown) =>\n showNotification({\n type: \"error\",\n message: httpErrorToString(error),\n });\n\n/**\n * - 页面初始化时预加载 launchpad 信息。\n * - 每次打开 launchpad 都发起请求,但该请求的数据只在下次打开 launchpad 时使用。\n * 即每次打开 launchpad 使用的都是上一次获取的数据,以便达到两个效果:\n * - 每次打开 launchpad 都能立即显示菜单列表;\n * - 同时当用户在 launchpad 上操作时,不会出现数据突然更新(新数据请求完成)。\n */\nexport function useLaunchpadInfo(active?: boolean) {\n const [desktops, setDesktops] = useState(candidateDesktops);\n const [microAppsById, setMicroAppsById] = useState(candidateMicroAppsById);\n const [customLinksById, setCustomLinksById] = useState(\n candidateCustomLinksById\n );\n\n const [q, setQ] = useState(\"\");\n\n const [loading, setLoading] = useState(!preLoaded);\n const [loadingFavorites, setLoadingFavorites] = useState(!preLoadedFavorites);\n const [loadingPlatformCategories, setLoadingPlatformCategories] = useState(\n !preLoadedPlatformCategories\n );\n\n const [storedRecentVisits, setStoredRecentVisits] = useState<\n StoredMenuItem[]\n >([]);\n\n const [recentVisits, setRecentVisits] = useState<MenuItemDataNormal[]>([]);\n\n const [favorites, setFavorites] = useState<FavMenuItem[]>(candidateFavorites);\n const [platformCategories, setPlatformCategories] = useState<\n PlatformCategoryItem[]\n >(candidatePlatformCategories);\n\n useEffect(() => {\n // 仅当首次加载完成或重新打开 launchpad 时更新一次数据。\n if (active && !loading) {\n setDesktops(candidateDesktops);\n setMicroAppsById(candidateMicroAppsById);\n setCustomLinksById(candidateCustomLinksById);\n }\n }, [active, loading]);\n\n useEffect(() => {\n if (active && !loadingFavorites) {\n setFavorites(candidateFavorites);\n }\n }, [active, loadingFavorites]);\n\n useEffect(() => {\n if (active && !loadingPlatformCategories) {\n setPlatformCategories(candidatePlatformCategories);\n }\n }, [active, loadingPlatformCategories]);\n\n useEffect(() => {\n if (active) {\n setStoredRecentVisits(storage.getItem(storageKey) ?? []);\n }\n }, [active]);\n\n useEffect(() => {\n if (active) {\n const startFetchLaunchpadInfo = async (): Promise<void> => {\n try {\n await deferredLaunchpadInfo.fetch();\n setLoading(false);\n } catch (error) {\n handleHttpError(error);\n }\n };\n startFetchLaunchpadInfo();\n }\n }, [active]);\n\n useEffect(() => {\n if (active) {\n const startFetchFavorites = async (): Promise<void> => {\n try {\n await deferredFavorites.fetch();\n setLoadingFavorites(false);\n } catch (error) {\n setLoadingFavorites(false);\n showErrorAsNotification(error);\n }\n };\n startFetchFavorites();\n }\n }, [active]);\n\n useEffect(() => {\n if (\n active &&\n getRuntime()?.getFeatureFlags()[\"launchpad-show-platform-category\"]\n ) {\n const startFetchPlatformCategories = async (): Promise<void> => {\n try {\n await deferredPlatformCategories.fetch();\n setLoadingPlatformCategories(false);\n } catch (error) {\n setLoadingPlatformCategories(false);\n showErrorAsNotification(error);\n }\n };\n startFetchPlatformCategories();\n }\n }, [active]);\n\n useEffect(() => {\n if (loading) {\n return;\n }\n const visits = storedRecentVisits\n .map((item) => {\n // Remembered recent visits maybe no longer existed in launchpad\n if (item.type === \"app\") {\n const app = microAppsById.get(item.id);\n return app\n ? {\n type: \"app\",\n name: app.localeName,\n id: app.id,\n url: app.homepage,\n instanceId: app.instanceId,\n menuIcon: app.menuIcon,\n }\n : null;\n }\n return customLinksById.get(item.id);\n })\n .filter(Boolean) as MenuItemDataNormal[];\n setRecentVisits(visits);\n }, [customLinksById, loading, microAppsById, storedRecentVisits]);\n\n const pushRecentVisit = useCallback(({ type, id }: StoredMenuItem) => {\n const visits: StoredMenuItem[] = storage.getItem(storageKey) ?? [];\n const index = visits.findIndex(\n (visit) => visit.type === type && visit.id === id\n );\n if (index > -1) {\n visits.splice(index, 1);\n }\n visits.unshift({ type, id });\n if (visits.length > RECENT_VISITS_LIMIT) {\n visits.pop();\n }\n // setStoredRecentVisits(visits);\n storage.setItem(storageKey, visits);\n }, []);\n\n const isStarred = useCallback(\n (item: MenuItemDataNormal) =>\n favorites.some((fav) => matchFavorite(item, fav)),\n [favorites]\n );\n\n const toggleStar = useCallback(\n (item: MenuItemDataNormal | MenuItemDataLink) => {\n const index = favorites.findIndex((fav) =>\n item.type === \"link\"\n ? fav.favoriteId === item.favoriteId\n : matchFavorite(item, fav)\n );\n let newFavorites: FavMenuItem[];\n if (index > -1) {\n const removed = favorites[index];\n newFavorites = favorites\n .slice(0, index)\n .concat(favorites.slice(index + 1));\n undoFavorite(removed).catch(showErrorAsNotification);\n } else {\n if (favorites.length >= FAVORITES_LIMIT) {\n showDialog({\n type: \"warn\",\n title: \"收藏数量已达上限\",\n content: `当前收藏链接数量已达上限(${FAVORITES_LIMIT}个),请删除部分收藏后再添加。`,\n });\n return;\n }\n // Assert: no link item\n const fav: FavMenuItem = { ...(item as MenuItemDataNormal) };\n newFavorites = favorites.concat(fav);\n favorite(item as MenuItemDataNormal).then((result) => {\n if (result) {\n fav.favoriteId = result.instanceId;\n }\n }, showErrorAsNotification);\n }\n setFavorites(newFavorites);\n candidateFavorites = newFavorites;\n },\n [favorites]\n );\n\n const menuGroups: MenuGroupData[] = useMemo(\n () => search(desktops, q),\n [desktops, q]\n );\n\n const filteredPlatformCategories: PlatformCategoryItem[] = useMemo(\n () => searchCategories(platformCategories, q),\n [platformCategories, q]\n );\n\n return {\n loading,\n q,\n setQ,\n menuGroups,\n loadingFavorites,\n loadingPlatformCategories,\n favorites,\n recentVisits,\n pushRecentVisit,\n isStarred,\n toggleStar,\n platformCategories: filteredPlatformCategories,\n };\n}\n\nexport function matchFavorite(item: MenuItemDataNormal, fav: FavMenuItem) {\n return item.instanceId && fav.instanceId\n ? fav.instanceId === item.instanceId\n : fav.type === item.type && fav.id === item.id;\n}\n","import { wrapBrick } from \"@next-core/react-element\";\nimport { unwrapProvider } from \"@next-core/utils/general\";\nimport type {\n GeneralIcon,\n GeneralIconProps,\n} from \"@next-bricks/icons/general-icon\";\nimport type { Link, LinkProps } from \"@next-bricks/basic/link\";\nimport type { showDialog as _showDialog } from \"@next-bricks/basic/data-providers/show-dialog/show-dialog\";\nimport type { showNotification as _showNotification } from \"@next-bricks/basic/data-providers/show-notification/show-notification\";\n\nexport const WrappedIcon = wrapBrick<GeneralIcon, GeneralIconProps>(\"eo-icon\");\nexport const WrappedLink = wrapBrick<Link, LinkProps>(\"eo-link\");\n\n// Use `unwrapProvider` to get the original function of a provider\nexport const showDialog =\n unwrapProvider<typeof _showDialog>(\"basic.show-dialog\");\n\nexport const showNotification = unwrapProvider<typeof _showNotification>(\n \"basic.show-notification\"\n);\n","export class DeferredService {\n private preFetchId: number | null = null;\n private preFetchScheduled = false;\n private firstFetchPromise: Promise<unknown> | null = null;\n private isFetching = false;\n private readonly task: () => Promise<unknown>;\n\n constructor(task: () => Promise<unknown>) {\n this.task = task;\n }\n\n schedulePrefetch(): void {\n if (!this.preFetchScheduled) {\n this.preFetchScheduled = true;\n const preFetchLaunchpadInfo = async (): Promise<void> => {\n this.preFetchId = null;\n this.fetch();\n };\n // istanbul ignore if\n if (typeof window.requestIdleCallback === \"function\") {\n this.preFetchId = window.requestIdleCallback(preFetchLaunchpadInfo);\n } else {\n this.preFetchId = setTimeout(\n preFetchLaunchpadInfo\n ) as unknown as number;\n }\n }\n }\n\n fetch(eager?: boolean): Promise<unknown> {\n if (this.preFetchId) {\n // istanbul ignore if\n if (typeof window.cancelIdleCallback === \"function\") {\n cancelIdleCallback(this.preFetchId);\n } else {\n clearTimeout(this.preFetchId);\n }\n this.preFetchId = null;\n }\n\n let promise: Promise<unknown>;\n if (!this.isFetching || eager) {\n this.isFetching = true;\n promise = this.task();\n promise\n .catch((error) => {\n // eslint-disable-next-line no-console\n console.error(error);\n this.firstFetchPromise = null;\n })\n .finally(() => {\n this.isFetching = false;\n });\n if (!this.firstFetchPromise) {\n this.firstFetchPromise = promise;\n }\n if (eager) {\n return promise;\n }\n }\n return this.firstFetchPromise!;\n }\n}\n","import { i18nText } from \"@next-core/i18n\";\nimport type { AppLocales, I18nData } from \"@next-core/types\";\n\nexport function getAppLocaleName(\n locales: AppLocales | undefined,\n name: string\n) {\n if (!locales) {\n return name;\n }\n const i18nData = Object.fromEntries(\n Object.entries(locales)\n .filter(([_lang, resources]) => resources.name)\n .map(([lang, resources]) => [lang, resources.name])\n ) as I18nData;\n return i18nText(i18nData) ?? name;\n}\n","export class JsonStorage {\n constructor(\n private storage: Storage,\n private prefix: string = \"brick-next-\"\n ) {}\n\n setItem<T = any>(name: string, value: T): void {\n this.storage.setItem(this.prefix + name, JSON.stringify(value));\n }\n\n getItem<T = any>(name: string): T {\n return JSON.parse(this.storage.getItem(this.prefix + name) as string) as T;\n }\n\n removeItem(name: string): void {\n return this.storage.removeItem(this.prefix + name);\n }\n\n clear(): void {\n return this.storage.clear();\n }\n}\n"],"names":["FAVORITES_LIMIT","RECENT_VISITS_LIMIT","async","fetchRawFavorites","LaunchpadApi_listCollectionV2","page","pageSize","interceptorParams","ignoreLoadingBar","noAbortOnRouteChange","list","matchMenuItemApp","item","lowerQ","id","toLowerCase","includes","name","description","matchMenuItemCustom","storageKey","_auth$getAuth","auth","getAuth","org","storage","JsonStorage","localStorage","candidateDesktops","candidateMicroAppsById","Map","candidateCustomLinksById","preLoaded","candidateFavorites","preLoadedFavorites","candidatePlatformCategories","preLoadedPlatformCategories","deferredLaunchpadInfo","DeferredService","menuGroups","microAppsById","customLinksById","launchpadInfo","LaunchpadApi_getLaunchpadInfo","storyboard","storyboards","app","localeName","getAppLocaleName","locales","set","group","desktops","items","type","get","push","url","homepage","menuIcon","subItems","subItem","length","fetchLaunchpadInfo","deferredFavorites","stored","fav","relatedApp","favoriteId","instanceId","appId","customItem","relatedCustomItem","link","icon","fetchFavorites","deferredPlatformCategories","categories","InstanceApi_postSearchV3","fields","page_size","query","_categories","map","category","apps","platformApps","_app$","order","customItems","platformItems","_item$","sortBy","lib","fetchPlatformCategories","showErrorAsNotification","error","showNotification","message","httpErrorToString","useLaunchpadInfo","active","setDesktops","useState","setMicroAppsById","setCustomLinksById","q","setQ","loading","setLoading","loadingFavorites","setLoadingFavorites","loadingPlatformCategories","setLoadingPlatformCategories","storedRecentVisits","setStoredRecentVisits","recentVisits","setRecentVisits","favorites","setFavorites","platformCategories","setPlatformCategories","useEffect","_storage$getItem","getItem","fetch","handleHttpError","startFetchLaunchpadInfo","startFetchFavorites","_getRuntime","getRuntime","getFeatureFlags","startFetchPlatformCategories","visits","filter","Boolean","pushRecentVisit","useCallback","_ref","_storage$getItem2","index","findIndex","visit","splice","unshift","pop","setItem","isStarred","some","matchFavorite","toggleStar","newFavorites","removed","slice","concat","LaunchpadApi_deleteCollectionV2","then","_list$find","foundId","find","_fav$relatedApp","_fav$relatedCustomIte","console","undoFavorite","catch","showDialog","title","content","LaunchpadApi_createCollectionV2","relatedInstanceId","favorite","result","useMemo","allMenuGroups","filteredSubItems","sub","search","filteredPlatformCategories","searchCategories","WrappedIcon","wrapBrick","WrappedLink","unwrapProvider","constructor","task","_defineProperty","this","schedulePrefetch","preFetchScheduled","preFetchLaunchpadInfo","preFetchId","window","requestIdleCallback","setTimeout","eager","promise","cancelIdleCallback","clearTimeout","isFetching","firstFetchPromise","finally","_i18nText","i18nData","Object","fromEntries","entries","_lang","resources","_ref2","lang","i18nText","prefix","arguments","undefined","value","JSON","stringify","parse","removeItem","clear"],"sourceRoot":""}
|