@abtnode/blocklet-services 1.16.49-beta-20250828-094758-93e69d1f → 1.16.49-beta-20250829-075052-2563fcb3
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/api/cache.js +2 -6
- package/api/index.js +15 -16
- package/api/routes/blocklet.js +2 -0
- package/api/util/attach-shared-utils.js +1 -1
- package/dist/assets/{AdapterDayjs-B7ApPoXD.js → AdapterDayjs-CsjxEemY.js} +1 -1
- package/dist/assets/{Google-DfN9Rvbc.js → Google-a7LsY6gB.js} +1 -1
- package/dist/assets/{access-control-sVJ3CDsk.js → access-control-BflK_JY_.js} +1 -1
- package/dist/assets/{actions-DAS8NTxZ.js → actions-BEg2ZR9n.js} +1 -1
- package/dist/assets/{add-component-core-C-lS-f2s.js → add-component-core-Qw040b1L.js} +7 -7
- package/dist/assets/add-resource-CeL9CGw6.js +1 -0
- package/dist/assets/{addon-BbUmhDrg.js → addon-LHky73fl.js} +2 -2
- package/dist/assets/{advanced-yos-VoDO.js → advanced-Cb7kjy9p.js} +2 -2
- package/dist/assets/{aigne-BFaiITB3.js → aigne-DyYvTUt7.js} +1 -1
- package/dist/assets/api-D0WTSMt7.js +1 -0
- package/dist/assets/{appearance-CVPCj_g7.js → appearance-DnSAzT5z.js} +1 -1
- package/dist/assets/{arrow-down.svg-D4RAc36g.js → arrow-down.svg-BiYMv82Y.js} +1 -1
- package/dist/assets/{audit-logs-DB3qhQg4.js → audit-logs-BT6QlPWw.js} +2 -2
- package/dist/assets/authorize-BpAEdQbB.js +1 -0
- package/dist/assets/{base-chart-VPtnEoZA.js → base-chart-BX5qTIVB.js} +1 -1
- package/dist/assets/base32-BM0EGG_G.js +1 -0
- package/dist/assets/bind-account-0FusXwpG.js +1 -0
- package/dist/assets/{branding-4PyVgsm-.js → branding-BFbTimgS.js} +2 -2
- package/dist/assets/{branding-BRbN1Bkg.js → branding-BlPEgtEP.js} +5 -5
- package/dist/assets/branding-BwLq7zvy.js +1 -0
- package/dist/assets/{bundle-avatar-DQcnLf3o.js → bundle-avatar-BW3kxeeK.js} +1 -1
- package/dist/assets/button-BXmlC7LN.js +1 -0
- package/dist/assets/{click-to-copy-C6lmeRAF.js → click-to-copy-Dex2pQN3.js} +1 -1
- package/dist/assets/{cloneDeep-DqaMBldf.js → cloneDeep-MYrdBNTW.js} +1 -1
- package/dist/assets/{collapse-8NywKzkD.js → collapse-BeOhBsBA.js} +1 -1
- package/dist/assets/{complete-EQPcfiZv.js → complete-pEetXGz2.js} +2 -2
- package/dist/assets/{component-BhUI-d0d.js → component-Bgo6eiyE.js} +3 -3
- package/dist/assets/{config-Le6WeCol.js → config-B_hp0NmN.js} +4 -4
- package/dist/assets/{config-DJJS3dIe.js → config-DUgUooD7.js} +1 -1
- package/dist/assets/{config-OBLXnYuT.js → config-_-EQ0Epw.js} +2 -2
- package/dist/assets/{config-navigation-avFj7dYF.js → config-navigation-sV4EbIjT.js} +9 -9
- package/dist/assets/{config-space-BbpgeOnW.js → config-space-XgrkTVb_.js} +1 -1
- package/dist/assets/confirm-CQUC-h9X.js +7 -0
- package/dist/assets/{connect-OCT-OS7Y.js → connect-BcuVDRIg.js} +1 -1
- package/dist/assets/{connect-H6B42tsr.js → connect-Bo7X4WRA.js} +1 -1
- package/dist/assets/connect-to-BOwPSqv_.js +1 -0
- package/dist/assets/{content-layout-C8_nylvn.js → content-layout-D0HgAWIj.js} +1 -1
- package/dist/assets/createClass-BM_-4dO_.js +1 -0
- package/dist/assets/{dashboard-BvIj00oy.js → dashboard-DVufxMME.js} +3 -3
- package/dist/assets/{delete-confirm-o1zts8U4.js → delete-confirm-FEUxkG43.js} +1 -1
- package/dist/assets/{did-address-jhnZEWZT.js → did-address-BsD0Ja6f.js} +1 -1
- package/dist/assets/{domain-BtX17din.js → domain-BI8RdK7S.js} +1 -1
- package/dist/assets/{domain-action-card-qxxmLU3c.js → domain-action-card-CyD3YPhU.js} +2 -2
- package/dist/assets/domains-BaakWyOu.js +1 -0
- package/dist/assets/{email-AcFKXEOo.js → email-WV1LA3l2.js} +3 -3
- package/dist/assets/{empty-spinner-8MrwYy6o.js → empty-spinner-yPLwfnik.js} +1 -1
- package/dist/assets/engine-DqjrYbXf.js +1 -0
- package/dist/assets/{exchange-passport-Bq0t5R-b.js → exchange-passport-DnShCQU6.js} +1 -1
- package/dist/assets/{form-D8WxwcUb.js → form-CCBOl2QK.js} +2 -2
- package/dist/assets/{form-text-input-My8a96Qh.js → form-text-input-DiBXmKHH.js} +1 -1
- package/dist/assets/{form-wrapper-CyRbKpkJ.js → form-wrapper-O5HR5g9j.js} +1 -1
- package/dist/assets/{fuel-BmHBUS5K.js → fuel-3tynLMF6.js} +1 -1
- package/dist/assets/gen-access-key-CO4-WBwG.js +1 -0
- package/dist/assets/gen-simple-access-key-BLU1CQqE.js +1 -0
- package/dist/assets/get-safe-url-C1cM9KQQ.js +1 -0
- package/dist/assets/{home-BFQjMOv3.js → home-CVhKAX1W.js} +1 -1
- package/dist/assets/iframe-D4EArqkC.js +1 -0
- package/dist/assets/index-4AgxfqNl.js +1 -0
- package/dist/assets/{index-BPi7kqxm.js → index-B6yvt28b.js} +1 -1
- package/dist/assets/{index-DzFhCctN.js → index-BFjzQ59j.js} +2 -2
- package/dist/assets/{index-CNHQRHA5.js → index-BJUlLPmz.js} +1 -1
- package/dist/assets/{index-R9xEgWqx.js → index-BKGX_rib.js} +1 -1
- package/dist/assets/index-BKgMC01o.js +55 -0
- package/dist/assets/{index-FcG9efoK.js → index-BZl53MLv.js} +1 -1
- package/dist/assets/{index-Djqtu3nK.js → index-BaBstino.js} +8 -8
- package/dist/assets/{index-CrBAth7d.js → index-BcqwvXCM.js} +4 -4
- package/dist/assets/index-BzBCYs57.js +271 -0
- package/dist/assets/index-BzSejp52.js +113 -0
- package/dist/assets/{index-B5xugf-_.js → index-C9gLts8j.js} +1 -1
- package/dist/assets/{index-Ch35mI2K.js → index-CEomSqzf.js} +1 -1
- package/dist/assets/index-CH24MDrX.js +1 -0
- package/dist/assets/{index-CRLXC3_Y.js → index-CNDQB5ss.js} +2 -2
- package/dist/assets/index-CQnNYj8j.js +62 -0
- package/dist/assets/{index-BAz4_gi3.js → index-Cgd5ilob.js} +5 -5
- package/dist/assets/{index-C43c4laP.js → index-CnSSStmX.js} +1 -1
- package/dist/assets/{index-CGLt1oNo.js → index-D5hnouQx.js} +1 -1
- package/dist/assets/{index-B19K9uJe.js → index-DK5WDEEB.js} +5 -5
- package/dist/assets/{index-M1n8940k.js → index-DTtqYivl.js} +14 -14
- package/dist/assets/index-DlGDk6f1.js +1 -0
- package/dist/assets/index-Dl_mo6VP.js +7 -0
- package/dist/assets/{index-EyZ2cODm.js → index-Dmx5B0nd.js} +1 -1
- package/dist/assets/{index-CUQ2UhNw.js → index-Dn5r8b31.js} +12 -12
- package/dist/assets/{index-I2pdu38s.js → index-Dplza4RE.js} +5 -5
- package/dist/assets/{index-DTsM42Id.js → index-GKGJR9QG.js} +1 -1
- package/dist/assets/index-MzaNcHRo.js +1025 -0
- package/dist/assets/index-VC2a5OwI.js +29 -0
- package/dist/assets/{index-DZ2X8gFe.js → index-nD2momWN.js} +1 -1
- package/dist/assets/{index-DpkWkxvh.js → index-x4EbwKKT.js} +1 -1
- package/dist/assets/{invitation-CcLaY9mC.js → invitation-BiwN2VrD.js} +3 -3
- package/dist/assets/{invite-DJCMRtEr.js → invite-sG9nrx1v.js} +1 -1
- package/dist/assets/{isURL-DFvT0vCW.js → isURL-CUg0M0vI.js} +2 -2
- package/dist/assets/{issue-passport-CkIJRolL.js → issue-passport-B6dZ_6Cz.js} +1 -1
- package/dist/assets/{item-C2hII4fE.js → item-Ce1sOOzq.js} +1 -1
- package/dist/assets/{landing-page-Co2xmYHL.js → landing-page-B51Yq79L.js} +1 -1
- package/dist/assets/{launch-result-message-CYwb6iA9.js → launch-result-message-DsDtH4O2.js} +1 -1
- package/dist/assets/{layout-C3tvXFgk.js → layout-BqA0nwyI.js} +1 -1
- package/dist/assets/list-DDPm3xxE.js +2 -0
- package/dist/assets/list-DrfXTBKV.js +103 -0
- package/dist/assets/{list-header-DdgW2mjM.js → list-header-zq8j7UNX.js} +1 -1
- package/dist/assets/localization-yFQNsuN6.js +1 -0
- package/dist/assets/{log-B9lGtGiW.js → log-CZVtlyyy.js} +1 -1
- package/dist/assets/logger-Bc_B4ezh.js +1 -0
- package/dist/assets/login-CEifKwb3.js +1 -0
- package/dist/assets/{login-oauth-callback-X95PJ2qp.js → login-oauth-callback-CZEaxrWW.js} +1 -1
- package/dist/assets/{logo-uploader-8ln-60_3.js → logo-uploader-DRdS0jgO.js} +2 -2
- package/dist/assets/{lost-passport-DKWbWBzi.js → lost-passport-CYIc-KaX.js} +2 -2
- package/dist/assets/{observability-4ZKd3ESd.js → observability-DjWNOFAW.js} +1 -1
- package/dist/assets/{omit-BM-5z5qE.js → omit-BtX_IVuT.js} +1 -1
- package/dist/assets/{open-window-DzVl2k4x.js → open-window-CS9iPYFz.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-BPVLaNw4.js → over-due-invoice-payment-Ds6p85Jz.js} +1 -1
- package/dist/assets/{overview-DSyEFumj.js → overview-CHSartaV.js} +2 -2
- package/dist/assets/{page-header-CyNE6Ofr.js → page-header-BBG13dwv.js} +1 -1
- package/dist/assets/passport-item-DJbWiXVs.js +1 -0
- package/dist/assets/{permission-CwauIzov.js → permission-DUZq76k-.js} +1 -1
- package/dist/assets/{playground-DeasY3DH.js → playground-l0kCaheU.js} +1 -1
- package/dist/assets/preferences-By_IlOup.js +1 -0
- package/dist/assets/profile-embed-CCG9G7wc.js +1 -0
- package/dist/assets/publish-resource-s02z2MdL.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-tMcQD2yf.js → react-beautiful-dnd.esm-fd7f1edT.js} +1 -1
- package/dist/assets/{react-stripe.esm-CvJuW6o6.js → react-stripe.esm-dYmFOSpC.js} +1 -1
- package/dist/assets/{required-McYgDRcp.js → required-DVwsbGXM.js} +1 -1
- package/dist/assets/runtime-DbB-M2o6.js +1 -0
- package/dist/assets/{sanitize-NVxeYIWy.js → sanitize-CQihkQWa.js} +1 -1
- package/dist/assets/sdk-Ol9MhIA2.js +1 -0
- package/dist/assets/{section-DSgkHUgY.js → section-DLZZkYEF.js} +1 -1
- package/dist/assets/{security-BbgwNqVc.js → security-OOMvokDG.js} +3 -3
- package/dist/assets/session-DGSuFVuR.js +1 -0
- package/dist/assets/{setup-CwuOKBim.js → setup-FIguiM7u.js} +1 -1
- package/dist/assets/{shorten-label-CphpNRtN.js → shorten-label-DULtT2aw.js} +1 -1
- package/dist/assets/{simple-select-B6PbGWwo.js → simple-select-z4kANmJU.js} +1 -1
- package/dist/assets/{spaces-D0iulZZE.js → spaces-DS5mDb6g.js} +1 -1
- package/dist/assets/{start-DuZ3YiJZ.js → start-BPPbKY2q.js} +1 -1
- package/dist/assets/{starting-progress-D9vpVI4j.js → starting-progress-D36m0Jur.js} +1 -1
- package/dist/assets/status-DXtPmlwi.js +1 -0
- package/dist/assets/{step-actions-9LK_rPuF.js → step-actions-BCMkiBJt.js} +1 -1
- package/dist/assets/{studio-BtJ8IG1e.js → studio-BaKQrp69.js} +1 -1
- package/dist/assets/{switch-control-_r5tnNLs.js → switch-control-Bg_4ck4-.js} +1 -1
- package/dist/assets/{table-tips-DaCM8P_z.js → table-tips-OHHAUf8b.js} +1 -1
- package/dist/assets/team-BmLR1DD5.js +146 -0
- package/dist/assets/traffic-BM5HlXo3.js +1 -0
- package/dist/assets/{transfer-Bzsb7K-h.js → transfer-BkpY83Tu.js} +1 -1
- package/dist/assets/{unsubscribe-DLiekCH0.js → unsubscribe-DqQrZxDL.js} +1 -1
- package/dist/assets/{use-app-logo-1g85gLSt.js → use-app-logo-BZP6g7du.js} +1 -1
- package/dist/assets/{use-mobile-BTugf2DR.js → use-mobile-BhjEPXJE.js} +1 -1
- package/dist/assets/{use-mobile-BjYFyM2N.js → use-mobile-Cw5yCFNi.js} +1 -1
- package/dist/assets/{use-server-logo-B7LbKzj5.js → use-server-logo-D9Pt2agw.js} +1 -1
- package/dist/assets/{use-window-close-SfvxIQ67.js → use-window-close-pLTUeUwV.js} +1 -1
- package/dist/assets/{useAsync-B3JLhOUX.js → useAsync-BPJmKcmr.js} +1 -1
- package/dist/assets/{useAsync-BzDh8_wv.js → useAsync-CFjPtTuV.js} +1 -1
- package/dist/assets/{useAsyncRetry-XOTAwnFJ.js → useAsyncRetry-CmiuEIXq.js} +1 -1
- package/dist/assets/useLocalStorage-Cgk_vZIQ.js +1 -0
- package/dist/assets/user-center-DsKLVInJ.js +126 -0
- package/dist/assets/user-follower-BBKilW4B.js +32 -0
- package/dist/assets/user-sessions-BiY051eM.js +1 -0
- package/dist/assets/{util-jhRcmTca.js → util-BY4Jjo2q.js} +1 -1
- package/dist/assets/{util-PKueOfaS.js → util-DiR6CGkl.js} +1 -1
- package/dist/assets/{vendor-arcblock-Q5ECWsoh.js → vendor-arcblock-Basg90AF.js} +138 -139
- package/dist/assets/{vendor-hooks-CLY4g97Q.js → vendor-hooks-XYaYmqUz.js} +1 -1
- package/dist/assets/{vendor-mui-core-BkVXEDpj.js → vendor-mui-core-D1KE_LWA.js} +1 -1
- package/dist/assets/{vendor-mui-x-DiiSwpci.js → vendor-mui-x-35VYXdLE.js} +1 -1
- package/dist/assets/vendor-utils-D9t34RpH.js +213 -0
- package/dist/assets/{vendor-ux-lckoR4gs.js → vendor-ux-JJc9HQAK.js} +44 -44
- package/dist/assets/{wait-connect-CZc79arT.js → wait-connect-BDvg0APV.js} +1 -1
- package/dist/assets/{wizard-BJB_eh3v.js → wizard-C18vdEjN.js} +1 -1
- package/dist/assets/{wizard-components-DLjvO_g6.js → wizard-components-D34u1nDC.js} +3 -3
- package/dist/assets/{wrap-locale-DSvJTIUK.js → wrap-locale-DHRmq-M6.js} +1 -1
- package/dist/assets/{zh-D7F3wDQu.js → zh-CIBse7Eg.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/service-worker.js +1 -1
- package/package.json +35 -35
- package/dist/assets/add-resource-BO5CaS7z.js +0 -1
- package/dist/assets/api-IUmhrtIY.js +0 -1
- package/dist/assets/authorize-B9eAVgLd.js +0 -1
- package/dist/assets/base32-BfYXZjht.js +0 -1
- package/dist/assets/bind-account-CZsXV4Ww.js +0 -1
- package/dist/assets/branding-4AKasu0p.js +0 -1
- package/dist/assets/button-CxhwEH5Q.js +0 -1
- package/dist/assets/confirm-dtnPbiJU.js +0 -7
- package/dist/assets/connect-to-rTDj0z18.js +0 -1
- package/dist/assets/createClass-tr3IJmK6.js +0 -1
- package/dist/assets/domains-DxA8mkxh.js +0 -1
- package/dist/assets/engine-Dn2eu8pq.js +0 -1
- package/dist/assets/gen-access-key-lWNMSsTk.js +0 -1
- package/dist/assets/gen-simple-access-key-BDUwC53R.js +0 -1
- package/dist/assets/get-safe-url-BQ6d4MgK.js +0 -1
- package/dist/assets/hdkey-DSMaex4r.js +0 -62
- package/dist/assets/iframe-Rfnl7VOX.js +0 -1
- package/dist/assets/index-B6vMF9Hk.js +0 -271
- package/dist/assets/index-BWTQhZ4U.js +0 -1027
- package/dist/assets/index-C-ScWNDm.js +0 -1
- package/dist/assets/index-CKzo9Uef.js +0 -1
- package/dist/assets/index-CuvhlXtp.js +0 -30
- package/dist/assets/index-D1unLlb1.js +0 -113
- package/dist/assets/index-D8KcYxzV.js +0 -7
- package/dist/assets/index-DWUa0yxY.js +0 -1
- package/dist/assets/index-ooq0mqFx.js +0 -55
- package/dist/assets/list-BPUjG_QR.js +0 -4
- package/dist/assets/list-CfoGe8c8.js +0 -103
- package/dist/assets/localization-D43nyvZk.js +0 -1
- package/dist/assets/logger-4k8NsA4u.js +0 -1
- package/dist/assets/login-CzFKzWTR.js +0 -1
- package/dist/assets/passport-item-DCZlw8VZ.js +0 -1
- package/dist/assets/preferences-CnB-T7sM.js +0 -1
- package/dist/assets/profile-embed-Cje1NBan.js +0 -1
- package/dist/assets/publish-resource-CfsKbVhC.js +0 -1
- package/dist/assets/runtime-C1a1bdul.js +0 -1
- package/dist/assets/sdk-BVLD2Hdt.js +0 -1
- package/dist/assets/session-U-hEcJ3m.js +0 -1
- package/dist/assets/status-cH_88o_O.js +0 -1
- package/dist/assets/team-BqbXtbtA.js +0 -146
- package/dist/assets/traffic-B01d9dTv.js +0 -1
- package/dist/assets/useLocalStorage-DH_lecPn.js +0 -1
- package/dist/assets/user-center-Bp-3sWFi.js +0 -126
- package/dist/assets/user-follower-CkIxC3f3.js +0 -32
- package/dist/assets/user-sessions-Cbiat2FW.js +0 -1
- package/dist/assets/vendor-utils-DtY42AM-.js +0 -213
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import{g as Wt,r as v}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as y,z as Z,b6 as me,be as Ke,y as V,am as ut,d1 as Bt,bm as Kt,at as ae,b1 as mt,W as h,T as ee,U as Ge,d2 as pt,b5 as qe,a5 as Me,Q as Fe,d3 as Je,aN as Ue,a6 as ft,D as ht,d4 as qt,ad as xt,d5 as Mt,d6 as Ut,c1 as st,n as Ht,x as $t,bb as Vt,M as it,cz as Gt,I as Jt,d7 as Yt}from"./vendor-mui-core-BkVXEDpj.js";import{A as gt,J as Xt,C as Zt,e as le,F as Qt,a4 as je}from"./vendor-utils-DtY42AM-.js";import{T as te,H as M,D as ce,G as en,L as bt,al as tn,aK as nn,y as jt,$ as vt,ac as yt,aL as Oe,F as St,a6 as sn,ai as an}from"./vendor-ux-lckoR4gs.js";import{aF as rn,Z as Ye,a8 as Ct,aZ as Rt,M as _e,c as _,ap as Q,p as on,aO as at}from"./index-BWTQhZ4U.js";import{g as ye,b as $,a as se}from"./vendor-hooks-CLY4g97Q.js";import{u as wt,C as Y}from"./index.esm-JPZAjt0x.js";import{i as He}from"./isURL-DFvT0vCW.js";import{S as X}from"./section-DSgkHUgY.js";import{A as ln,a as cn,b as dn}from"./collapse-8NywKzkD.js";import{S as Se}from"./shorten-label-CphpNRtN.js";import{v as Tt}from"./index-DZ2X8gFe.js";import{R as Nt,A as un,S as mn,a as pn,B as fn}from"./list-CfoGe8c8.js";import{j as hn,c as xn,N as gn}from"./team-BqbXtbtA.js";import{W as bn}from"./did-address-jhnZEWZT.js";import{p as It}from"./util-jhRcmTca.js";import{D as jn,g as vn}from"./traffic-B01d9dTv.js";import{B as Et}from"./bundle-avatar-DQcnLf3o.js";import{u as yn}from"./use-mobile-BTugf2DR.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-Q5ECWsoh.js";import"./required-McYgDRcp.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-FcG9efoK.js";import"./session-U-hEcJ3m.js";import"./use-app-logo-1g85gLSt.js";import"./base32-BfYXZjht.js";import"./useAsyncRetry-XOTAwnFJ.js";import"./useAsync-B3JLhOUX.js";import"./iframe-Rfnl7VOX.js";import"./index-CKzo9Uef.js";import"./index-DBs9Ljax.js";import"./base-chart-VPtnEoZA.js";import"./index-EyZ2cODm.js";import"./vendor-mui-x-DiiSwpci.js";import"./AdapterDayjs-B7ApPoXD.js";var Te={exports:{}},Ne={exports:{}},Ie={exports:{}},rt;function Sn(){return rt||(rt=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=t;function t(r){return r==null}n.exports=s.default,n.exports.default=s.default}(Ie,Ie.exports)),Ie.exports}var ot;function Cn(){return ot||(ot=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=u;var t=o(rn()),r=o(Sn());function o(p){return p&&p.__esModule?p:{default:p}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,b=/^[-+]?[0-9]+$/;function u(p,i){(0,t.default)(p),i=i||{};var N=i.allow_leading_zeroes===!1?l:b,I=!i.hasOwnProperty("min")||(0,r.default)(i.min)||p>=i.min,S=!i.hasOwnProperty("max")||(0,r.default)(i.max)||p<=i.max,j=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||p<i.lt,E=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||p>i.gt;return N.test(p)&&I&&S&&j&&E}n.exports=s.default,n.exports.default=s.default}(Ne,Ne.exports)),Ne.exports}var lt;function Rn(){return lt||(lt=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=o;var t=r(Cn());function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,t.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=s.default,n.exports.default=s.default}(Te,Te.exports)),Te.exports}var wn=Rn();const Tn=Wt(wn),ze={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Nn(){const{api:n}=Ye(),{blocklet:s}=Ct(),{t}=te(),{confirmApi:r,confirmHolder:o}=Rt(),l=s?.meta?.did,b=Object.assign({...ze},s?.settings?.notification?.email||{}),{handleSubmit:u,control:p,formState:i,watch:N,reset:I}=wt({defaultValues:gt(b,Object.keys(ze))}),S=ye({testReceiver:"",testReceiverError:""}),j=N("enabled"),E=$(async(a,T,k=!0)=>{try{const{blocklet:D}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),re=Object.assign({...ze},D?.settings?.notification?.email||{});I(re),k&&M.success(t("oauth.saveSuccess"))}catch(D){if(k)M.error(D.message||t("oauth.saveFailed"));else throw D}}),G=$(async(a,T,k)=>{try{i.isDirty&&await E(a,T,!1),await n.sendEmail({input:{did:l,receiver:k,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),M.success(t("notification.email.testSuccess"))}catch(D){M.error(D.message||t("notification.email.testfailed"))}}),z=$((a,T)=>{S.testReceiver="",S.testReceiverError="",r.open({title:t("notification.email.testSendEmail"),content:()=>e.jsx(y,{sx:{width:"300px"},children:e.jsx(Z,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.email.inputTestReceiver"),value:S.testReceiver,onChange:k=>{S.testReceiver=k.target.value},error:!!S.testReceiverError,helperText:S.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(k){const D=S.testReceiver?.trim();if(!D){S.testReceiverError=t("notification.email.receiverRequired");return}if(!_e(D)){S.testReceiverError=t("notification.email.receiverInvalid");return}S.testReceiverError="",await G(a,T,D),k()}})}),F=$(a=>{const T=a?.trim();return T?_e(T)?!0:t("notification.email.fromInvalid"):t("notification.email.fromRequired")}),B=$(a=>{const T=a?.trim();return T?He(T,{require_host:!1,protocols:[]})?!0:t("notification.email.hostInvalid"):t("notification.email.hostRequired")}),R=$(a=>a?Tn(a)?!0:t("notification.email.portInvalid"):t("notification.email.portRequired")),K=$(a=>a?.trim()?!0:t("notification.email.userRequired")),q=$(a=>a?.trim()?!0:t("notification.email.passwordRequired")),f=$(a=>a?.trim()&&!He(a,{protocols:["http","https"],require_protocol:!0})?t("notification.email.linkInvalid"):!0),w=$(a=>a?.trim()&&!_e(a)?t("notification.email.emailInvalid"):!0),C=$(()=>!0);return e.jsxs(y,{children:[e.jsxs(In,{component:"form",onSubmit:u(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(X,{title:t("notification.email.enable"),my:2.5,children:e.jsx(Y,{name:"enabled",control:p,render:({field:a})=>e.jsx(me,{control:e.jsx(Ke,{checked:a.value,...a})})})}),e.jsx(X,{title:t("notification.email.from"),children:e.jsx(Y,{name:"from",control:p,rules:{validate:j?F:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",required:!0,label:t("notification.email.from"),error:!!i.errors[a.name],helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.host"),children:e.jsx(Y,{name:"host",control:p,rules:{validate:j?B:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:t("notification.email.host"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.port"),children:e.jsx(Y,{name:"port",control:p,rules:{validate:j?R:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:t("notification.email.port"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.user"),children:e.jsx(Y,{name:"user",control:p,rules:{validate:j?K:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:t("notification.email.user"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.password"),children:e.jsx(Y,{name:"password",control:p,rules:{validate:j?q:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:t("notification.email.password"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.secure"),children:e.jsx(Y,{name:"secure",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(me,{control:e.jsx(Ke,{checked:a.value,...a,disabled:!j})})})})}),e.jsxs(ln,{children:[e.jsxs(cn,{expandIcon:e.jsx(Kt,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[t("notification.email.signature"),e.jsx(ut,{title:t("notification.email.signatureTooltip"),children:e.jsx(Bt,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(dn,{children:[e.jsx(X,{title:t("notification.email.companyName"),children:e.jsx(Y,{name:"companyName",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyName"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.companyLink"),children:e.jsx(Y,{name:"companyLink",control:p,rules:{validate:j?f:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyLink"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.companyAddress"),children:e.jsx(Y,{name:"companyAddress",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyAddress"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.supportEmail"),children:e.jsx(Y,{name:"supportEmail",control:p,rules:{validate:j?w:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:t("notification.email.supportEmail"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})})]})]}),e.jsxs(y,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(ce,{variant:"outlined",color:"warning",onClick:u(z),disabled:!j,children:t("oauth.runTest")}),e.jsx(ce,{type:"submit",variant:"contained",disabled:!i.isDirty,children:t("oauth.save")})]})]}),o]})}const In=ae(mt)``,We={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function En(){const{api:n}=Ye(),{blocklet:s}=Ct(),{t}=te(),{confirmApi:r,confirmHolder:o}=Rt(),l=s?.meta?.did,b=Object.assign({...We},s?.settings?.notification?.pushKit||{}),{handleSubmit:u,control:p,formState:i,watch:N,reset:I}=wt({defaultValues:gt(b,Object.keys(We))}),S=ye({testReceiver:"",testReceiverError:""}),j=N("enabled"),E=$(async(R,K,q=!0)=>{try{const{blocklet:f}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:R})}}),w=Object.assign({...We},f?.settings?.notification?.pushKit||{});I(w),q&&M.success(t("oauth.saveSuccess"))}catch(f){if(q)M.error(f.message||t("oauth.saveFailed"));else throw f}}),G=$(async(R,K)=>{try{i.isDirty&&await E(R,K,!1);const q=(s?.configs||[]).find(C=>C.key==="BLOCKLET_APP_URL")?.value,f=Xt(Zt(q,_.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:s?.meta?.version,t:new Date(s?.updatedAt||0).getTime()}),w={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:s?.appDid,fullName:s?.meta?.title,avatar:f}}}};await n.sendPush({input:{did:l,receiver:S.testReceiver,notification:JSON.stringify(w)}}),M.success(t("notification.pushKit.testSuccess"))}catch(q){M.error(q.message||t("notification.pushKit.testfailed"))}}),z=$((R,K)=>{S.testReceiverError="",r.open({title:t("notification.pushKit.testSend"),content:()=>e.jsx(y,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(Z,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.pushKit.inputTestReceiver"),value:S.testReceiver,onChange:q=>{S.testReceiver=q.target.value},error:!!S.testReceiverError,helperText:S.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(q){if(!S.testReceiver?.trim()){S.testReceiverError=t("notification.pushKit.receiverRequired");return}S.testReceiverError="",await G(R,K),q()}})}),F=$(R=>{const K=R?.trim();return K?He(K)?!0:t("notification.pushKit.endpointInvalid"):t("notification.pushKit.endpointRequired")}),B=$(()=>!0);return e.jsxs(y,{children:[e.jsxs(An,{component:"form",onSubmit:u(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(X,{title:t("notification.pushKit.enable"),my:2.5,children:e.jsx(Y,{name:"enabled",control:p,render:({field:R})=>e.jsx(me,{control:e.jsx(Ke,{checked:R.value,...R})})})}),e.jsx(X,{title:t("notification.pushKit.endpoint"),children:e.jsx(Y,{name:"endpoint",control:p,rules:{validate:j?F:B},render:({field:R})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...R,size:"small",required:!0,label:t("notification.pushKit.endpoint"),error:!!i.errors[R.name],helperText:i.errors[R.name]?.message||" ",disabled:!j})})})}),e.jsxs(X,{title:t("notification.pushKit.customOptions"),children:[e.jsx(Y,{name:"did",control:p,render:({field:R})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...R,size:"small",label:t("notification.pushKit.did"),error:!!i.errors[R.name],helperText:i.errors[R.name]?.message||" ",disabled:!j})})}),e.jsx(Y,{name:"pushPath",control:p,render:({field:R})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...R,size:"small",label:t("notification.pushKit.pushPath"),error:!!i.errors[R.name],helperText:i.errors[R.name]?.message||" ",disabled:!j})})})]}),e.jsxs(y,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(ce,{variant:"outlined",color:"warning",onClick:u(z),disabled:!j,children:t("oauth.runTest")}),e.jsx(ce,{type:"submit",variant:"contained",disabled:!i.isDirty,children:t("oauth.save")})]})]}),o]})}const An=ae(mt)``,ct=[{label:e.jsx(y,{sx:{textAlign:"center",width:"100%"},children:"Email"}),value:"email"},{label:e.jsx(y,{sx:{textAlign:"center",width:"100%"},children:"Push Kit"}),value:"pushKit"}];function On(){const[n,s]=v.useState(ct[0].value),{locale:t}=v.useContext(en),r=se(()=>({email:e.jsx(Nn,{}),pushKit:e.jsx(En,{})}),[t]),o=v.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(y,{children:[e.jsx(bt,{tabs:ct,current:n,onChange:s}),e.jsx(y,{style:o,children:r[n]})]})}const At=v.createContext({}),{Provider:kn,Consumer:Ws}=At;function Dn({children:n,blocklet:s=""}){const{api:t,inService:r,ws:{useSubscription:o}}=Ye(),[l,b]=v.useState([]),[u,p]=v.useState({total:0,pageSize:20,pageCount:0,page:1}),i=se(()=>s.meta?.did,[s]),[N,I]=v.useState([]),[S,j]=v.useState({}),E=se(()=>l.length?new Set(l.map(f=>f.id)):new Set,[l]),G=async({page:f=1,pageSize:w=20,...C}={})=>{if(!i)return[];try{const a={paging:{page:f,pageSize:w},...C,teamDid:i,dateRange:C.dateRange?[Q(C.dateRange[0]).toISOString(),Q(C.dateRange[1]).toISOString()]:void 0},{dids:T,...k}=a;let D="";T&&T.includes("system")&&(D="system");const re=T?T.filter(pe=>pe!=="system"):[],ue={...k,source:D,componentDids:re},oe=await t.getNotificationSendLog({input:ue});return j(ue),b(oe.list),p(oe.paging),oe.list}catch(a){return M.error(a.message),[]}},z=async()=>{const f=await t.getNotificationComponents({input:{teamDid:i}});I(f.componentDids)},F=v.useCallback(f=>{const w=s.children.find(C=>C.meta?.did===f);if(w)return w.ancestors=[s],w},[s]),B=async({notificationId:f,receivers:w,channels:C,...a})=>{await t.resendNotification({input:{teamDid:i,notificationId:f,receivers:w,channels:C.map(T=>T==="wallet"?_.NOTIFICATION_SEND_CHANNEL.WALLET:T==="pushKit"?_.NOTIFICATION_SEND_CHANNEL.PUSH:T),...a}})},R=v.useCallback(async f=>(await t.getUser({input:{teamDid:i,user:{did:f}}})).user,[t,i]),K=v.useCallback(async({page:f=1,pageSize:w=20,...C}={})=>{try{const a={paging:{page:f,pageSize:w},...C,userName:C.searchText||"",teamDid:i,dateRange:C.dateRange?[Q(C.dateRange[0]).toISOString(),Q(C.dateRange[1]).toISOString()]:void 0};return await t.getReceivers({input:a})}catch(a){throw M.error(a.message),a}},[t,i]);v.useEffect(()=>{i&&z()},[i]),o(_.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,f=>{E.has(f.notificationId)&&G(S)},[E,S]),o(_.EVENTS.NOTIFICATION_BLOCKLET_CREATE,f=>{E.has(f.id)||G(S)},[E,S]);const q={fetch:G,data:l,paging:u,blocklet:s,getComponent:F,resendNotification:B,getUser:R,componentDids:N,getReceivers:K,inService:r,teamDid:i};return e.jsx(kn,{value:{notificationRecords:q},children:n})}function Xe(){const{notificationRecords:n}=v.useContext(At);return n}Ce.propTypes={severity:h.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ln={info:"primary",success:"success",error:"error",warning:"warning"};function Ce({severity:n="info"}){return e.jsx(tn,{type:Ln[n],children:n})}const Pn=(n,s,t="")=>{if(!t||!s)return"";switch(t){case _.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return t}};function Ot(n,s,t={}){const{status:r,updatedAt:o,reason:l="",channel:b="wallet"}=t,u=o?n("notification.sendStatus.sentTime",{date:on(o,s)}):"",p=Pn(n,b,l);return r===_.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:u,reason:p}:r===_.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:n("notification.sendStatus.pending"),reason:p,sentTime:u}}const $e={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ve=["wallet","pushKit","email"],dt=["info","success","error","warning"],kt=n=>{const{settings:s}=n;return s?.notification?.email?.enabled},Dt=n=>{const{settings:s}=n;return s?.notification?.pushKit?.enabled},Fn=(n,s)=>{const t=le(s,"extra.notifications.email",!0);return{available:kt(n),enabled:t}},_n=(n,s)=>{const t=le(s,"extra.notifications.push",!0);return{available:Dt(n),enabled:t}},zn=n=>({enabled:le(n,"extra.notifications.wallet",!0)}),Wn=n=>({enabled:le(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(s=>{setTimeout(()=>{s()},n*1e3)}),Bn=(n,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:s}),fail:n("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:n("notification.sendStatus.reason.available",{channel:s}),fail:n("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:s}),fail:n("notification.sendStatus.reason.disabled",{channel:s})}]:[],Ae=(n=[])=>{const s=Q().startOf("day");return n.filter(t=>Q(t.sendAt).isSame(s,"day")).length},Kn=(n,s="")=>{if(s&&Ve.includes(s)){const l=`${s}SendRecord`,b=le(n,l,[]);return Ae(b)}const t=le(n,"webhook",{}),r=Object.keys(t??{})??[];if(s&&r.includes(s)){const l=t[s]??[];return Ae(l)}const o={};return Ve.forEach(l=>{const b=`${l}SendRecord`,u=le(n,b,[]),p=Ae(u);o[l]=p}),r.length>0&&r.forEach(l=>{const b=t[l]??[],u=Ae(b);o[l]=u}),o},ke=(n,s,t)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[t].splice(s,1),n},De=(n,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(n):!1},qn=n=>{switch(n){case _.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case _.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case _.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case _.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},Lt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function de({config:n,enableTooltip:s=!0,showTitle:t=!1,children:r=null}){const{status:o,title:l="",sentTime:b="",reason:u=""}=n,p=[l,u].filter(Boolean).join(", ");return e.jsx(ut,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:p}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(y,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(y,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(y,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:$e[o]}}),e.jsx(y,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:$e[o]}})]}),e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:t?l:r})]})})}de.propTypes={config:h.object.isRequired,enableTooltip:h.bool,showTitle:h.bool,children:h.node};Le.propTypes={list:h.array.isRequired,label:h.string.isRequired,onDelete:h.func};function Le({list:n,label:s,onDelete:t=()=>{}}){const{t:r,locale:o}=te();return e.jsxs(y,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(ee,{children:[s,": "]}),n.map(l=>{const b=Ot(r,o,{status:l});return e.jsx(Ge,{size:"small",label:e.jsx(y,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(de,{config:b,enableTooltip:!1,children:b.title})}),onDelete:u=>t(u,l)},l)})]})}Ze.propTypes={filterList:h.array.isRequired,onChange:h.func.isRequired,index:h.number.isRequired,column:h.object.isRequired,filterValues:h.array.isRequired,label:h.string.isRequired,renderLabel:h.func.isRequired};function Ze({filterList:n,onChange:s,index:t,column:r,filterValues:o,label:l,renderLabel:b}){return e.jsxs(V,{className:"filter-container",children:[e.jsx(pt,{component:"legend",children:l}),e.jsx(qe,{row:!0,children:o.map(u=>e.jsx(me,{control:e.jsx(Me,{checked:n[t].indexOf(u.value??u)>-1,onChange:p=>{const i=[...n];p.target.checked?i[t]=[...i[t],u.value??u]:i[t]=i[t].filter(N=>N!==(u.value??u)),s(i[t],t,r)},name:u.value??u}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(u)})},u.value??u))})]})}function Be(n){return e.jsx(Ze,{...n,renderLabel:s=>e.jsx(de,{enableTooltip:!1,config:{status:s.status},children:s.label})})}xe.propTypes={status:h.number.isRequired,updatedAt:h.string.isRequired,reason:h.string,channel:h.string,onResend:h.func};function xe({status:n,updatedAt:s,reason:t="",channel:r="wallet",onResend:o}){const{t:l,locale:b}=te(),u=Ot(l,b,{status:n,updatedAt:s,reason:t,channel:r});return e.jsxs(y,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(de,{config:u,showTitle:!0}),u.status!=="success"&&e.jsx(Fe,{className:"resend-btn",size:"small",startIcon:e.jsx(Je,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}Qe.propTypes={value:h.array.isRequired,onChange:h.func};function Qe({value:n,onChange:s}){const{locale:t}=te(),r=Q().toDate(),[o,l]=v.useState(null),b=v.useCallback(i=>{l(o?null:i.currentTarget)},[o]),u=!!o,p=v.useCallback(i=>{if(!i.startDate||!i.endDate){M.error("Please select a date range");return}if(Q(i.startDate).isAfter(i.endDate)||!Q(i.startDate).isValid()||!Q(i.endDate).isValid()){M.error("Invalid date range");return}s([i.startDate,i.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(ee,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Fe,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[at(n[0],t)," - ",at(n[1],t)]})}),e.jsx(Ue,{open:u,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(jn,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:b,definedRanges:vn(r),onChange:p})})]})}et.propTypes={itemComponent:h.elementType.isRequired};function et({itemComponent:n,...s}){const{t}=te();return!s?.filterList?.filter(o=>o.length).length?null:e.jsxs(y,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:t("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(nn.TableFilterList,{...s,ItemComponent:n})})]})}function tt({label:n,onDelete:s,canDelete:t=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let l=!0;return t&&typeof t=="function"&&(l=t({label:n,...r})),e.jsx(Ge,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}tt.propTypes={label:h.string.isRequired,onDelete:h.func,canDelete:h.func};const Mn=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];Pt.propTypes={loading:h.bool,onCancel:h.func,onConfirm:h.func};function Pt({loading:n=!1,onCancel:s=()=>{},onConfirm:t=()=>{}}){const{t:r}=te(),[o,l]=v.useState(Mn),[b,u]=v.useState(!0),p=(N,I)=>{I.checked=N.target.checked;const S=o.map(j=>({...j,checked:j.value===I.value?I.checked:j.checked}));l(S)},i=N=>{N.stopPropagation(),t({channels:o.filter(I=>I.checked).map(I=>I.value),isResendFailedOnly:b})};return e.jsxs(y,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ee,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(y,{className:"choose-channel",children:e.jsxs(V,{component:"fieldset",variant:"standard",children:[e.jsx(pt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(qe,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(N=>e.jsx(me,{control:e.jsx(Me,{checked:N.checked,onChange:I=>p(I,N),name:N.value}),label:N.label},N.value))})]})}),e.jsx(y,{className:"resend-config-footer",children:e.jsx(qe,{children:e.jsx(me,{control:e.jsx(Me,{checked:b,onChange:N=>u(N.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(y,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Fe,{onClick:N=>{N.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Fe,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(ft,{size:16}),r("common.confirm")]})]})]})}Ft.propTypes={notificationId:h.string.isRequired,handleResend:h.func,resending:h.bool};function Ft({notificationId:n,handleResend:s,resending:t=!1}){const{t:r,locale:o}=te(),l=ht(),b=v.useMemo(()=>jt(l,Lt()),[l]),{getReceivers:u,inService:p,teamDid:i,getUser:N,blocklet:I}=Xe(),[S,j]=v.useState(!1),[E,G]=v.useState([]),z=ye({anchorEl:null,position:null}),F=ye({anchorEl:null,position:null}),[B,R]=v.useState(null),[K,q]=v.useState({total:0,pageSize:10,pageCount:0,page:1}),[f,w]=v.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[Q().subtract(1,"month").startOf("day").toDate(),Q().endOf("day").toDate()]}),[C,a]=v.useState([]),T=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],k=async()=>{if(!S&&n)try{j(!0);const c=await u({notificationId:n,...f}),d=c.list.map(m=>({...m,receiverUser:{...m.receiverUser,avatar:It(m.receiverUser.avatar,i,p)}}));G(d),q(c.paging),j(!1)}catch(c){M.error(c.message),j(!1)}};v.useEffect(()=>{k()},[f]);const D=c=>{c.stopPropagation();const d=c.currentTarget;F.anchorEl=d;const m=d.getBoundingClientRect();F.position={top:m.top+window.scrollY,left:m.left+window.scrollX}},re=c=>c.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(ce,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Je,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:D,children:r("notification.resend")})}):null,ue={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:K.page-1,rowsPerPage:K.pageSize,count:K.total,searchText:f.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:C,onRowSelectionChange:(c,d)=>{a(d.map(m=>m.dataIndex))},customToolbarSelect:re},oe=({page:c,rowsPerPage:d,searchText:m,filterList:O})=>{const[,U=[],ne=[],J=[]]=O;f.pageSize!==d?w(H=>({...H,pageSize:d,page:1})):f.page!==c+1?w(H=>({...H,page:c+1})):f.searchText!==m?w(H=>({...H,searchText:m,page:1})):je(U,f.walletSendStatus)?je(ne,f.pushKitSendStatus)?je(J,f.emailSendStatus)||w(H=>({...H,emailSendStatus:J,page:1})):w(H=>({...H,pushKitSendStatus:ne,page:1})):w(H=>({...H,walletSendStatus:U,page:1}))},pe=v.useCallback(async(c,d)=>{if(!d)return!1;const m=await N(d);return m?c==="wallet"?zn(m):c==="email"?Fn(I,m):c==="pushKit"?_n(I,m):c==="webhook"?Wn(m):!0:!1},[N,I]),Re=v.useCallback(c=>Bn(r,c),[r]),fe=()=>{z.anchorEl=null,z.position=null,R(null)},he=()=>{F.anchorEl=null,F.position=null},g=async(c,d,m=!0,O="")=>{if(!(!d.length||!c.length))try{s(c,d,m,O),F.anchorEl||(await Ee(.5),fe())}catch(U){console.error("handleResend error",{error:U})}},x=async({channels:c,isResendFailedOnly:d})=>{const m=C.map(O=>E[O].receiver);await g(c,m,d),await Ee(.5),he(),a([])},A=async(c,d=[],m=!0)=>{try{await g(["webhook"],[c.receiver],m,d)}catch(O){M.error(O.response?O.response.statusText:O.message)}},L=async(c,d,m,O=[],U=!0)=>{if(c.stopPropagation(),Kn(d,m)>=4){M.warning(r("notification.resendLimit"));return}if(!Ve.includes(m)){await A(d,O,U);return}if(c){const J=c.currentTarget,H=J.getBoundingClientRect();z.anchorEl=J,z.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}R({channel:m});try{const J=await pe(m,d.receiver);await Ee(1),R({channel:m,result:J}),(typeof J=="boolean"&&J||Qt(J)&&Object.values(J).every(H=>!!H))&&(await s([m],[d.receiver],U),F.anchorEl||(await Ee(.5),fe()))}catch(J){M.error(J.message)}},W=c=>{w(d=>({...d,dateRange:c,page:1}))},P=(c,d,m,O)=>{c.stopPropagation();const U=m.filter(ne=>ne!==d);w(ne=>({...ne,[O]:U,page:1}))},ie=se(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:c=>{const{receiverUser:d,receiver:m}=E[c];return d?e.jsxs(y,{"data-cy":`member-name-${d.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(vt,{src:`${d.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:m,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Se,{children:d.fullName})]},m):e.jsx(bn,{size:14,responsive:!1,compact:!0,copyable:!1,did:m})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:f.walletSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Wallet",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[1].options.filterList,"walletSendStatus")}}),update:ke},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,O)=>e.jsx(Be,{label:"Wallet",filterList:c,onChange:d,index:m,column:O,filterValues:T})},customBodyRenderLite:c=>{const{walletSendStatus:d,walletSendAt:m,walletSendFailedReason:O}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:O,channel:"wallet",onResend:U=>L(U,E[c],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{pushKitSendStatus:d,pushKitSendAt:m,pushKitSendFailedReason:O}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:O,channel:"pushkit",onResend:U=>L(U,E[c],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:f.pushKitSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Push Kit",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[2].options.filterList,"pushKitSendStatus")}}),update:ke},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,O)=>e.jsx(Be,{label:"Push Kit",filterList:c,onChange:d,index:m,column:O,filterValues:T})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{emailSendStatus:d,emailSendAt:m,emailSendFailedReason:O}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:O,channel:"email",onResend:U=>L(U,E[c],"email",[],!1)})},filter:!0,filterType:"custom",filterList:f.emailSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Email",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[3].options.filterList,"emailSendStatus")}}),update:ke},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,O)=>e.jsx(Be,{label:"Email",filterList:c,onChange:d,index:m,column:O,filterValues:T})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{webhook:d}=E[c];if(!d)return null;const m=Object.entries(d)[0];if(!m)return null;const[O,U]=m,ne=U[0];return e.jsx(y,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(y,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(Se,{maxLength:30,children:O},O),e.jsx(xe,{status:ne.status,updatedAt:ne.sendAt,reason:ne.failedReason,channel:"webhook",onResend:J=>L(J,E[c],"webhook",[O],!1)})]},O)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:c=>{const{createdAt:d}=E[c];return e.jsx(Nt,{value:d,locale:o,shouldUpdate:!0})}}}],[E,o,f,r]),we=[e.jsx(Qe,{value:f.dateRange,onChange:W},"date-picker"),e.jsx(ce,{variant:"contained",size:"small",color:"primary",loading:S,startIcon:e.jsx(qt,{}),onClick:()=>k(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(y,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(Hn,{children:e.jsxs(xt,{theme:b,children:[e.jsx(yt,{className:"receivers-table",locale:o,loading:S,columns:ie,data:E,onChange:oe,options:ue,customButtons:we,components:{TableFilterList:c=>e.jsx(et,{...c,itemComponent:d=>e.jsx(tt,{...d,canDelete:()=>!1})})}}),z.anchorEl&&e.jsx(Ue,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:fe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs($n,{children:[e.jsxs(ee,{variant:"body1",component:"div",className:"check-title",children:[B?.channel," Checking"]}),e.jsx(y,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:Re(B?.channel).map(c=>{const{type:d,pass:m,fail:O}=c;return!B?.result||B?.result?.[d]?e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:B?.result?.[d]?Oe.success.main:"inherit"},children:[B?.result?e.jsx(Mt,{}):e.jsx(ft,{size:12,sx:{color:Oe.primary.main}}),e.jsx("span",{children:m})]},d):e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:Oe.error.main},children:[e.jsx(Ut,{}),e.jsx("span",{children:O})]},d)})})]})}),F.anchorEl&&e.jsx(Ue,{open:!!F.anchorEl,anchorReference:"anchorPosition",anchorPosition:F.position,onClose:he,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Pt,{loading:t,onCancel:he,onConfirm:x})})]})})})}const Un=v.memo(Ft),Hn=ae.div`
|
|
2
|
-
td.MuiTableCell-footer {
|
|
3
|
-
border: none !important;
|
|
4
|
-
}
|
|
5
|
-
.sent-status-cell {
|
|
6
|
-
.resend-btn {
|
|
7
|
-
display: none;
|
|
8
|
-
}
|
|
9
|
-
&:hover {
|
|
10
|
-
.resend-btn {
|
|
11
|
-
display: flex;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
`,$n=ae.div`
|
|
16
|
-
padding: 8px 16px;
|
|
17
|
-
.check-title {
|
|
18
|
-
font-weight: 500;
|
|
19
|
-
margin-bottom: 8px;
|
|
20
|
-
&::first-letter {
|
|
21
|
-
text-transform: uppercase;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
.check-item {
|
|
25
|
-
svg {
|
|
26
|
-
font-size: 16px;
|
|
27
|
-
}
|
|
28
|
-
font-size: 12px;
|
|
29
|
-
}
|
|
30
|
-
`,ve=n=>n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}K`:n;function Vn(n){const{wallet:s,push:t,email:r,webhook:o}=n;return[{name:"Wallet",value:e.jsx(ge,{item:s})},{name:"Push",value:e.jsx(ge,{item:t})},{name:"Email",value:e.jsx(ge,{item:r})},...o.total>0?[{name:"Webhook",value:e.jsx(ge,{item:o,isWebhook:!0})}]:[]]}function Gn(n,s,t){const{wallet:r,push:o,email:l,webhook:b}=n;return[{name:"Wallet",value:e.jsx(be,{loading:t,channel:_.NOTIFICATION_SEND_CHANNEL.WALLET,item:r,onResend:s})},{name:"Push",value:e.jsx(be,{loading:t,channel:_.NOTIFICATION_SEND_CHANNEL.PUSH,item:o,onResend:s})},{name:"Email",value:e.jsx(be,{loading:t,channel:_.NOTIFICATION_SEND_CHANNEL.EMAIL,item:l,onResend:s})},...b.total>0?[{name:"Webhook",value:e.jsx(be,{loading:t,channel:_.NOTIFICATION_SEND_CHANNEL.WEBHOOK,item:b,isWebhook:!0,onResend:s})}]:[]]}nt.propTypes={statistics:h.object.isRequired,onResend:h.func,mode:h.oneOf(["simple","detail"]),resending:h.bool};ge.propTypes={item:h.object.isRequired,isWebhook:h.bool};function ge({item:n,isWebhook:s=!1}){const{t}=te(),r=s?n.success.length:n.success,o=n.total,l=r===o?"success":"failed";return e.jsx(y,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2},children:e.jsx(y,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsxs(de,{config:{status:l},enableTooltip:!1,children:[ve(r)," / ",ve(o)," ",t("notification.sendStatus.success")]})})})}be.propTypes={item:h.object.isRequired,isWebhook:h.bool,channel:h.string,onResend:h.func,loading:h.bool};function be({channel:n=_.NOTIFICATION_SEND_CHANNEL.WALLET,item:s,isWebhook:t=!1,onResend:r=()=>{},loading:o=!1}){const{t:l}=te(),{success:b,failed:u,pending:p}=s,i=qn(n),N=t?b.length:b,I=t?u.length:u,S=t?p.length:p,j=async F=>{F.stopPropagation();const B=t?[...new Set([...b,...u].map(R=>R))]:[];await r([n],[],!0,B)},E=N+I,G=E>0?N/E*100:0,z=E>0?I/E*100:0;return e.jsxs(Jn,{successRatio:G,failedRatio:z,children:[e.jsxs(ee,{variant:"h6",children:[i," (",s.total,")"]}),e.jsxs(ee,{variant:"body1",sx:{mb:2},children:[e.jsx("span",{style:{color:$e.success,fontWeight:600,fontSize:24},children:ve(N)}),e.jsx("small",{style:{paddingLeft:4},children:l("notification.sendStatus.success")})]}),e.jsxs(y,{className:"unsent-area",children:[e.jsxs(y,{children:[e.jsxs(de,{config:{status:"failed"},enableTooltip:!1,children:[ve(I)," ",l("notification.sendStatus.failed")]}),e.jsxs(de,{config:{status:"pending"},enableTooltip:!1,children:[ve(S)," ",l("notification.sendStatus.pending")]})]}),I>0&&e.jsx(y,{className:"resend-btn",children:e.jsx(ce,{size:"small",color:"primary",loading:o,variant:"contained",startIcon:e.jsx(Je,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:j,children:l("notification.resend")})})]})]})}function nt({statistics:n,mode:s="simple",onResend:t=()=>{},resending:r=!1}){const o=se(()=>s==="simple"?Vn(n):Gn(n,t,r),[n,s]);return s==="simple"?e.jsx("div",{children:o.map(l=>e.jsx(Tt,{style:{alignItems:"flex-start",marginBottom:s==="simple"?0:16},valueComponent:"div",nameWidth:100,name:l.name,children:l.value},l.name))}):e.jsx(st,{container:!0,spacing:2,children:o.map(l=>e.jsx(st,{size:{md:4,sm:6,xs:12},children:l.value},l.name))})}const Jn=ae(y)`
|
|
31
|
-
display: flex;
|
|
32
|
-
flex-direction: column;
|
|
33
|
-
align-items: flex-start;
|
|
34
|
-
padding: 16px;
|
|
35
|
-
border-radius: 8px;
|
|
36
|
-
background: ${({successRatio:n,failedRatio:s,theme:t})=>n===0&&s===0?t.palette.grey[300]:`linear-gradient(to right, ${Ht(t.palette.success.light,.4)} ${n}%, ${t.palette.grey[100]} ${n}%)`};
|
|
37
|
-
transition: 'background 0.5s ease';
|
|
38
|
-
cursor: pointer;
|
|
39
|
-
.unsent-area {
|
|
40
|
-
width: 100%;
|
|
41
|
-
position: relative;
|
|
42
|
-
.resend-btn {
|
|
43
|
-
position: absolute;
|
|
44
|
-
right: 0;
|
|
45
|
-
bottom: 0;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
`;_t.propTypes={notification:h.object.isRequired,onCancel:h.func,blocklet:h.object.isRequired,tab:h.string};function _t({notification:n,onCancel:s=()=>{},blocklet:t,tab:r="info"}){const{t:o,locale:l}=te(),{getComponent:b,resendNotification:u}=Xe(),[p,i]=v.useState(!1),N=se(()=>b(n.componentDid)||t,[t,n.componentDid]),I=ye({tab:r||"info"}),S=v.useCallback(async(f,w,C=!0,a=[])=>{if(!f.length||!n.id)return;const T=w.length>0?w:n?.receivers?.map(D=>D.receiver);if(!T.length)return;let k=[...f];if(k.includes(_.NOTIFICATION_SEND_CHANNEL.PUSH)&&!Dt(t)&&(M.warning(o("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),k=k.filter(D=>D!==_.NOTIFICATION_SEND_CHANNEL.PUSH)),k.includes(_.NOTIFICATION_SEND_CHANNEL.EMAIL)&&!kt(t)&&(M.warning(o("notification.sendStatus.reason.unavailable",{channel:"Email"})),k=k.filter(D=>D!==_.NOTIFICATION_SEND_CHANNEL.EMAIL)),!!k.length)try{i(!0),await u({notificationId:n.id,receivers:T,channels:k,resendFailedOnly:C,...k.includes("webhook")&&a.length?{webhookUrls:a}:{}}),M.success("Message has been sent!")}catch(D){console.error("handleResend error",{error:D}),M.error(D.response?D.response.statusText:D.message)}finally{i(!1)}},[t,n.id,n?.receivers,u,o]),j=se(()=>hn(n),[n]),E=se(()=>xn(n),[n]),G=se(()=>j?n?.actorInfo:[],[n]),z=se(()=>t?.did||t?.meta?.did||"",[t]);function F(){return[{name:o("notification.from"),value:j&&E?e.jsx(un,{actors:G,teamDid:z,size:32,showName:!0}):e.jsx(mn,{size:32,blocklet:N,showName:!0,hideDot:!0})},{name:o("notification.notificationTitle"),value:e.jsx(Se,{maxLength:50,children:n.title})},{name:o("notification.body"),value:j?e.jsx(pn,{notification:n,blocklet:t}):e.jsx(gn,{notification:n,rows:0})},{name:o("notification.severity"),value:e.jsx(Ce,{severity:n.severity})},{name:o("notification.createdAt"),value:e.jsx(sn,{value:n.createdAt,locale:l,shouldUpdate:!0,type:"all"})}].map(w=>e.jsx(Tt,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:w.name,children:w.value},w.name))}const B={info:{label:o("common.basicInfo"),value:"info",component:F},receivers:{label:o("notification.receiver"),value:"receivers"},statistics:{label:o("notification.statistics"),value:"statistics"}},R=Object.values(B).map(({label:f,value:w})=>({label:f,value:w})),K=B[I.tab]||B.info,q=f=>{I.tab=f};return e.jsx(St,{title:o("notification.notificationDetails"),fullWidth:!0,maxWidth:"lg",onClose:()=>{I.tab="info",s()},open:!0,actionsPosition:"left",sx:{".ux-dialog_header":{paddingBottom:0},".MuiDialogContent-root":{paddingTop:0}},children:e.jsxs(Xn,{children:[e.jsx(y,{className:"tabs",sx:{mx:3},children:e.jsx(bt,{tabs:R,current:I.tab,onChange:q,scrollButtons:"auto"})}),e.jsxs("div",{className:"body",children:[I.tab==="receivers"&&e.jsx(Un,{notificationId:n.id,resending:p,handleResend:S}),I.tab==="statistics"&&e.jsx(nt,{statistics:n.statistics,mode:"detail",resending:p,onResend:S}),I.tab==="info"&&e.jsx(K.component,{})]})]})})}const Yn=v.memo(_t),Xn=ae.div`
|
|
49
|
-
& > .notification-row {
|
|
50
|
-
padding: 0;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.tabs {
|
|
54
|
-
margin: 0;
|
|
55
|
-
}
|
|
56
|
-
.body {
|
|
57
|
-
margin-top: 16px;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.channel-item {
|
|
61
|
-
display: flex;
|
|
62
|
-
padding: 4px;
|
|
63
|
-
justify-content: flex-start;
|
|
64
|
-
align-items: center;
|
|
65
|
-
gap: 8px;
|
|
66
|
-
> p {
|
|
67
|
-
font-size: 15px;
|
|
68
|
-
}
|
|
69
|
-
.resend-btn {
|
|
70
|
-
svg {
|
|
71
|
-
font-size: 16px;
|
|
72
|
-
}
|
|
73
|
-
display: flex;
|
|
74
|
-
align-items: center;
|
|
75
|
-
font-size: 12px;
|
|
76
|
-
cursor: pointer;
|
|
77
|
-
&.disabled {
|
|
78
|
-
cursor: not-allowed;
|
|
79
|
-
color: ${Oe.text.disabled};
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
`;Pe.propTypes={blocklet:h.object,label:h.string};const Zn=ae.div`
|
|
84
|
-
display: flex;
|
|
85
|
-
justify-items: flex-start;
|
|
86
|
-
align-items: center;
|
|
87
|
-
gap: 8px;
|
|
88
|
-
.name {
|
|
89
|
-
display: block;
|
|
90
|
-
max-width: 260px;
|
|
91
|
-
white-space: nowrap;
|
|
92
|
-
overflow: hidden;
|
|
93
|
-
text-overflow: ellipsis;
|
|
94
|
-
}
|
|
95
|
-
`;function Pe({blocklet:n=null,label:s=""}){return e.jsx(Zn,{children:n?e.jsxs(e.Fragment,{children:[e.jsx(Et,{size:24,blocklet:n,ancestors:n.ancestors}),e.jsx("span",{className:"name",children:n.title||n.meta?.title})]}):e.jsx("span",{className:"name",children:s})})}zt.propTypes={list:h.array.isRequired,label:h.string.isRequired,onDelete:h.func};function zt({list:n,label:s,onDelete:t=()=>{}}){return e.jsxs(y,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(ee,{children:[s,": "]}),n.map(r=>e.jsx(Ge,{size:"small",label:e.jsx(y,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(Ce,{severity:r})}),onDelete:o=>t(o,r)},r))]})}function Qn(n){return e.jsx(Ze,{...n,renderLabel:s=>e.jsx(Ce,{severity:s})})}function es({customTableButtons:n}){const{t:s,locale:t}=te(),r=ht(),o=v.useMemo(()=>jt(r,Lt()),[r]),[l,b]=v.useState(!1),{data:u,paging:p,blocklet:i,fetch:N,getComponent:I,componentDids:S,inService:j,teamDid:E}=Xe(),G=v.useRef(null),[z,F]=v.useState(null),[B,R]=v.useState("info"),K=yn(),[q,f]=v.useState(!1),w=`notification-records-${i.meta?.did}`,C=an(w),[a,T]=v.useState({pageSize:C.rowsPerPage||10,page:C.page?C.page+1:1,dids:C.dids||[],dateRange:C.dateRange||[Q().subtract(1,"month").startOf("day").toDate(),Q().endOf("day").toDate()]}),k=se(()=>{if(!i.children||!i.children.length)return[];const g=[];return i.children.forEach(x=>{const A=x.did||x.meta?.did;S.includes(A)&&(x.ancestors=[i],g.push(x))}),g},[S,i]),D=async g=>{try{b(!0),await N(g),b(!1)}finally{b(!1)}};v.useEffect(()=>{D(a)},[a]),v.useEffect(()=>{const g=u.find(x=>x.id===z?.id);z&&g&&F({...g})},[u]);const re=(g,x,A,L)=>{g.stopPropagation();const W=A.filter(P=>P!==x);T(P=>({...P,[L]:W,page:1}))},ue=({page:g,rowsPerPage:x,filterList:A})=>{const[L=[],,,,W=[]]=A;a.pageSize!==x?T(P=>({...P,pageSize:x,page:1})):a.page!==g+1?T(P=>({...P,page:g+1})):je(a.dids,L)?je(a.severities,W)||T(P=>({...P,severities:W,page:1})):T(P=>({...P,dids:L,page:1}))},oe=v.useCallback(()=>{F(null),R("info")},[]),pe=v.useCallback(()=>{N(a)},[N,a]),Re=[{label:s("notification.from"),name:"sender",width:400,options:{filter:!0,filterType:"custom",customFilterListOptions:{render:g=>g.map((x,A)=>{if(x==="system")return e.jsx("span",{children:s("notification.system")},`system-${A}`);const L=k.find(W=>(W.did||W.meta?.did)===x);return e.jsx(Pe,{blocklet:L,label:L?.title||L?.meta?.title},x)}),update:(g,x,A)=>(g[A].splice(x,1),g)},filterOptions:{names:k,logic:(g,x)=>x.length?!x.includes(g):!1,display:(g,x,A,L)=>e.jsxs(V,{style:{width:"380px"},children:[e.jsx($t,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs(Vt,{multiple:!0,value:g[A],renderValue:W=>e.jsx(y,{style:{overflow:"hidden",textOverflow:"ellipsis"},sx:{display:"flex",gap:1,alignItems:"center"},children:W.map(P=>{if(P==="system")return e.jsx("span",{children:s("notification.system")},P);const ie=k.find(we=>(we.did||we.meta?.did)===P);return e.jsx(Pe,{blocklet:ie,label:ie?.title||ie?.meta?.title},P)})}),onChange:W=>{g[A]=W.target.value,x(g[A],A,L)},children:[e.jsx(it,{value:"system",children:s("notification.system")}),k.map(W=>{const P=W.did||W.meta?.did;return e.jsx(it,{value:P,children:e.jsx(Pe,{blocklet:W,label:W.title||W.meta?.title})},P)})]})]})},customBodyRenderLite:g=>{const x=u[g],A=I(x.componentDid);return e.jsxs(y,{sx:{display:"flex",alignItems:"center",gap:1},children:[A?e.jsx(Et,{size:32,blocklet:A,ancestors:A.ancestors??[]}):e.jsx(fn,{blocklet:i,size:32}),e.jsx(Se,{maxLength:50,children:A?.meta?.title||i?.meta?.title})]})}}},{label:s("notification.receiver"),name:"receivers",width:300,options:{filter:!1,customBodyRenderLite:g=>{const x=u[g],{receivers:A}=x;return e.jsx(Gt,{total:A.length,renderSurplus:L=>L<100?e.jsxs("span",{children:["+",L]}):e.jsx("span",{children:"99+"}),max:3,sx:{justifyContent:"flex-end",height:"32px",".MuiAvatar-root":{width:"32px",height:"32px",fontSize:"12px",border:0,zIndex:2}},onClick:L=>{L.stopPropagation(),F(x),R("receivers")},children:A.map(L=>{const{receiverUser:W}=L,P=It(W.avatar,E,j);return e.jsx(vt,{alt:W.fullName,src:`${P}?imageFilter=resize&w=48&h=48`,size:32,did:L.receiver,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}},L.receiver)})})}}},{label:s("notification.statistics"),name:"statistics",width:400,options:{filter:!1,customBodyRenderLite:g=>{const x=u[g];return e.jsx(y,{onClick:A=>{A.stopPropagation(),F(x),R("statistics")},children:e.jsx(nt,{statistics:x.statistics})})}}},{label:s("notification.notificationPreview"),name:"data",options:{filter:!1,customBodyRenderLite:g=>{const x=u[g];return e.jsx(Se,{maxLength:50,children:x.title})}}},{label:s("notification.severity"),name:"severity",width:200,options:{setCellProps:()=>({className:"severity-cell"}),customBodyRenderLite:g=>{const x=u[g];return e.jsx(Ce,{severity:x.severity})},filter:!0,filterType:"custom",filterList:a.severities??[],customFilterListOptions:{render:g=>e.jsx(zt,{list:g,label:s("notification.severity"),onDelete:(x,A)=>{x.stopPropagation(),re(x,A,Re[4].options.filterList,"severities")}}),update:ke},filterOptions:{names:dt,fullWidth:!0,logic:De,display:(g,x,A,L)=>e.jsx(Qn,{label:s("notification.severity"),filterList:g,onChange:x,index:A,column:L,filterValues:dt})}}},{label:s("common.createdAt"),name:"createdAt",width:300,options:{filter:!1,customBodyRenderLite:g=>{const{createdAt:x}=u[g];return e.jsx(Nt,{value:x,locale:t,shouldUpdate:!0})}}}],fe=g=>{T(x=>({...x,dateRange:g,page:1}))},he=[e.jsxs(y,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[e.jsx(Jt,{onClick:()=>f(!0),sx:{p:K?0:void 0},children:e.jsx(Yt,{})},"settings"),K?e.jsx(ee,{children:s("common.setting")}):null]}),...n||[]];return e.jsxs(y,{ref:G,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(ts,{children:e.jsx(xt,{theme:o,children:e.jsx(yt,{className:"main-table",verticalKeyWidth:100,loading:l,locale:t,columns:Re,data:u,durable:w,onChange:ue,options:{sort:!1,download:!1,print:!1,search:!1,expandableRowsOnClick:!0,page:p.page-1,rowsPerPage:p.pageSize,count:p.total,...C,onRowClick:(g,{dataIndex:x})=>{F(u[x])}},customPreButtons:[e.jsx(Qe,{value:a.dateRange,onChange:fe})],customButtons:he,components:{TableFilterList:g=>e.jsx(et,{...g,itemComponent:x=>e.jsx(tt,{...x,canDelete:A=>A?.columnNames?.[A?.index||0]?.name==="sender"})})}})})}),z&&e.jsx(Yn,{refresh:pe,onCancel:oe,notification:z,blocklet:i,tab:B}),e.jsx(St,{title:`${s("common.notification")} ${s("common.setting")}`,fullWidth:!0,maxWidth:"md",open:q,onClose:()=>f(!1),PaperProps:{style:{minHeight:"500px"}},children:e.jsx(y,{sx:{mt:"-16px",overflowY:"hidden"},children:e.jsx(On,{})})})]})}const ts=ae.div`
|
|
96
|
-
td.MuiTableCell-footer {
|
|
97
|
-
border: none !important;
|
|
98
|
-
}
|
|
99
|
-
.sent-status-cell {
|
|
100
|
-
.resend-btn {
|
|
101
|
-
display: none;
|
|
102
|
-
}
|
|
103
|
-
&:hover {
|
|
104
|
-
.resend-btn {
|
|
105
|
-
display: flex;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.custom-toobar-btns {
|
|
111
|
-
gap: 4px;
|
|
112
|
-
}
|
|
113
|
-
`;ns.propTypes={blocklet:h.object.isRequired,customTableButtons:h.array};function ns({blocklet:n={},customTableButtons:s=[]}){return e.jsx(Dn,{blocklet:n,children:e.jsx(es,{customTableButtons:s})})}export{ns as default};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{T as M,H as q,ab as N,N as Y,O as ve,ac as Ce,ai as Se}from"./vendor-ux-lckoR4gs.js";import{o as Te,k as le,v as Ie}from"./vendor-hooks-CLY4g97Q.js";import{r as E,a as ae}from"./vendor-react-Dvs43sk9.js";import{j as e,Y as Re,bB as We,$ as ze,ak as p,z as se,T as C,a6 as F,aX as te,R as De,Q as H,b6 as ne,am as A,bd as _,a5 as J,V as Z,S as G,b4 as Oe,U as L,I as B,cm as $e,bf as Ae,a7 as Pe,F as qe,W as t,b1 as R,a3 as ce,c1 as ee,cn as Le,aO as Me,aP as Be,co as Fe,cp as He,cq as Ne,s as oe,aU as Ue,aj as _e,J as Ke,cr as Ve,aZ as Ye,cl as Je,c9 as Qe,ck as Xe}from"./vendor-mui-core-BkVXEDpj.js";import{B as de,o as pe,l as ue}from"./index-FcG9efoK.js";import{Z as K,c as xe,ap as Ze,a8 as Ge,b8 as Q}from"./index-BWTQhZ4U.js";import{u as V}from"./team-BqbXtbtA.js";import{u as et}from"./use-mobile-BTugf2DR.js";import{u as tt,C as X}from"./index.esm-JPZAjt0x.js";import{C as he,a as me,J as ot}from"./vendor-utils-DtY42AM-.js";import{C as st}from"./confirm-dtnPbiJU.js";import{A as nt}from"./actions-DAS8NTxZ.js";import{T as ie}from"./table-tips-DaCM8P_z.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-Q5ECWsoh.js";import"./session-U-hEcJ3m.js";import"./isURL-DFvT0vCW.js";import"./use-app-logo-1g85gLSt.js";import"./index-DBs9Ljax.js";const it=i=>{const[u,c]=E.useState(null),[b,r]=E.useState(!0),[w,x]=E.useState(null),j=window.blocklet?.appUrl,l=E.useMemo(()=>{const g={};return u&&(u.sources.forEach(y=>{g[y.did]={source:y,events:[],count:0}}),u.events.forEach(y=>{g[y.source]&&(g[y.source].events.push(y),g[y.source].count+=1)})),g},[u]),f=async()=>{try{if(r(!0),!j)return;const y=await(await fetch(he(j,xe.WELLKNOWN_SERVICE_PATH_PREFIX,"/openevent.json"))).json();c(y),x(null)}catch(g){x(g instanceof Error?g:new Error(String(g)))}finally{r(!1)}};return E.useEffect(()=>{f()},[j]),{openEvent:u,setOpenEvent:c,eventsBySource:l,loading:b,error:w,loadData:f}};function ge({eventsBySource:i,selectedEvents:u,setSelectedEvents:c,error:b=null}){const{t:r}=M(),[w,x]=E.useState({}),j=E.useMemo(()=>{const n={};return Object.entries(i).forEach(([a,{events:m}])=>{const v=m.filter(S=>u[`${S.type}-${S.source}`]).length;n[a]=v}),n},[i,u]),l=E.useMemo(()=>Object.values(j).reduce((n,a)=>n+a,0),[j]),f=E.useMemo(()=>Object.values(i).reduce((n,{events:a})=>n+a.length,0),[i]),g=(n,a)=>{a.stopPropagation(),x({...w,[n]:!w[n]})},y=n=>{const a=`${n.type}-${n.source}`;c(m=>({...m,[a]:!m[a]}))},z=(n,a)=>{const m={};n.forEach(v=>{const S=`${v.type}-${v.source}`;m[S]=!a}),c(v=>({...v,...m}))},T=n=>{const a={};Object.values(i).forEach(({events:m})=>{m.forEach(v=>{const S=`${v.type}-${v.source}`;a[S]=n.target.checked})}),c(a)};return e.jsxs(p,{sx:{width:"100%"},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ne,{control:e.jsx(J,{onChange:T,checked:l>0&&l===f}),label:e.jsxs(p,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[r("webhookEndpoint.selectAllEvents"),e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:e.jsx(A,{title:r("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(_,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),l>0&&e.jsx(C,{variant:"body2",color:"primary",sx:{ml:"auto"},children:r("webhookEndpoint.selectedEventsCount",{count:l})})]}),e.jsx(p,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(Z,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(i).map(([n,{source:a,events:m,count:v}],S)=>{const D=j[n]>0,I=j[n]===m.length&&m.length>0,O=w[n];return e.jsxs(ae.Fragment,{children:[e.jsx(G,{sx:{borderBottom:({palette:o})=>S<Object.keys(i).length-1?`1px solid ${o.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(p,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:o=>{o.target.closest(".MuiFormControlLabel-root")||g(n,o)},children:[e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:m.length>0&&e.jsx(ne,{control:e.jsx(J,{checked:I,indeterminate:D&&!I,onChange:o=>{o.stopPropagation(),z(m,I)}}),label:e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[a.logo&&e.jsx(Oe,{src:a.logo,sx:{width:24,height:24}}),e.jsx(p,{children:a.title||n}),D&&e.jsx(L,{label:r("webhookEndpoint.selectedCount",{count:j[n]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:o=>`${o.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(p,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(C,{variant:"body2",sx:{color:"text.secondary",mr:1},children:r("webhookEndpoint.eventsCount",{count:v})}),m.length>0&&e.jsx(B,{size:"small",edge:"end",children:O?e.jsx($e,{}):e.jsx(Ae,{})})]})]})}),m.length>0&&e.jsx(Pe,{in:O,timeout:"auto",unmountOnExit:!0,children:e.jsx(Z,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:m.map(o=>{const d=`${o.type}-${o.source}`,s=!!u[d];return e.jsx(G,{dense:!0,sx:{py:.75},onClick:()=>y(o),children:e.jsxs(p,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(J,{checked:s,sx:{mr:1}}),e.jsxs(p,{children:[e.jsx(C,{variant:"body1",sx:{cursor:"pointer",color:"text.primary"},children:o.type}),e.jsx(C,{variant:"caption",sx:{color:"text.secondary",display:"block",cursor:"pointer"},children:o.description})]})]})},d)})})})]},n)})})}),b&&e.jsx(qe,{error:!0,sx:{mt:1},children:b})]})}ge.propTypes={eventsBySource:t.objectOf(t.shape({source:t.shape({did:t.string.isRequired,title:t.string,description:t.string,version:t.string,logo:t.string}).isRequired,events:t.arrayOf(t.shape({type:t.string.isRequired,description:t.string.isRequired,source:t.string.isRequired})).isRequired,count:t.number.isRequired})).isRequired,selectedEvents:t.objectOf(t.bool).isRequired,setSelectedEvents:t.func.isRequired,error:t.string};function fe({id:i=null,url:u="",description:c="",enabledEvents:b=[],onSubmit:r,onClose:w=()=>{}}){const{t:x}=M(),[j,l]=E.useState({}),{teamDid:f}=V(),{api:g}=K(),{loading:y,error:z,eventsBySource:T}=it(),{control:n,handleSubmit:a,formState:{errors:m},reset:v,setValue:S,trigger:D}=tt({defaultValues:{url:"",description:""}});E.useEffect(()=>{const o=Object.values(j).some(d=>d);S("selectedEvents",o?"valid":""),D("selectedEvents")},[j,S,D]);const I=()=>{l({}),v(),w()},O=async o=>{const d=Object.keys(j).filter(h=>j[h]),s={url:o.url,description:o.description,enabledEvents:d.map(h=>{const[k,W]=h.split("-");return!k||!W?null:{type:k,source:W}}).filter(Boolean)};try{if(i){const h=await g.updateWebhookEndpoint({input:{teamDid:f,id:i,data:s}});q.success(`${x("webhookEndpoint.updateWebhook")} ${x("webhookEndpoint.success")}`),r(h)}else{const h=await g.createWebhookEndpoint({input:{teamDid:f,input:s}});q.success(`${x("webhookEndpoint.createWebhook")} ${x("webhookEndpoint.success")}`),r(h)}}catch(h){q.error(h?.message)}I()};return E.useEffect(()=>{v({url:u,description:c}),l(b.reduce((o,d)=>(o[`${d.type}-${d.source}`]=!0,o),{}))},[v,l,u,c,b]),e.jsx(Re,{open:!0,onClose:I,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:a(O),children:[e.jsx(We,{children:x(i?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(ze,{children:e.jsxs(p,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(X,{name:"url",control:n,rules:{required:x("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:x("webhookEndpoint.validation.urlInvalid")}},render:({field:o})=>e.jsx(se,{...o,label:x("webhookEndpoint.url.label"),fullWidth:!0,error:!!m.url,helperText:m.url?.message})}),e.jsx(X,{name:"description",control:n,rules:{required:x("webhookEndpoint.validation.descriptionRequired")},render:({field:o})=>e.jsx(se,{...o,label:x("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!m.description,helperText:m.description?.message})}),e.jsx(X,{name:"selectedEvents",control:n,rules:{required:x("webhookEndpoint.validation.eventRequired")},render:({field:o})=>e.jsx("input",{type:"hidden",...o})}),!y&&T&&Object.keys(T).length>0&&e.jsx(ge,{eventsBySource:T,selectedEvents:j,setSelectedEvents:l,error:m.selectedEvents?.message}),!y&&(!T||Object.keys(T).length===0)&&e.jsx(C,{sx:{color:"text.secondary"},children:x("webhookEndpoint.noAvailableEvents")}),y&&e.jsx(p,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(F,{size:20})}),z&&e.jsx(te,{severity:"error",children:x("webhookEndpoint.loadingError",{message:z?.message})})]})}),e.jsxs(De,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:I,children:x("common.cancel")}),e.jsx(H,{type:"submit",variant:"contained",color:"primary",children:x(i?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}fe.propTypes={onSubmit:t.func.isRequired,id:t.string,url:t.string,description:t.string,enabledEvents:t.arrayOf(t.shape({type:t.string.isRequired,source:t.string.isRequired})),onClose:t.func};function be(i){switch(i){case"enabled":return"success";case"disabled":default:return"default"}}const rt=(i="en")=>i==="tw"?"zh":i;function U(i,u="YYYY-MM-DD HH:mm:ss",c="en"){return i?Ze(i).locale(rt(c)).format(u):"-"}function lt(i){return typeof i=="number"?!1:me(i)}function at(i){return i>=200&&i<300}function $({value:i,label:u,tip:c="",divider:b=!1}){const r=lt(i);return e.jsxs(e.Fragment,{children:[e.jsxs(R,{direction:"column",alignItems:"flex-start",children:[e.jsxs(C,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[u,!!c&&e.jsx(A,{title:c,children:e.jsx(_,{fontSize:"small"})})]}),e.jsx(C,{component:"div",variant:"body1",color:r?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:r?"-":i})]}),b&&e.jsx(ce,{orientation:"vertical",flexItem:!0})]})}$.propTypes={label:t.oneOfType([t.string,t.node]).isRequired,value:t.oneOfType([t.string,t.node]).isRequired,tip:t.oneOfType([t.string,t.node]),divider:t.bool};function je({title:i,children:u=null,mb:c=1.5,mt:b=1.5}){return e.jsxs(R,{className:"section-header",direction:"row",sx:{justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,mb:c,mt:b,pb:1},children:[e.jsx(C,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:i}),u]})}je.propTypes={title:t.oneOfType([t.string,t.node]).isRequired,children:t.node,mb:t.number,mt:t.number};const ct={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/>'},dt=i=>{const u={};return i.forEach(c=>{const b=new Date(c.createdAt).toLocaleDateString();u[b]||(u[b]=[]),u[b]?.push(c)}),u};function ye({eventId:i="",webhookEndpointId:u="",event:c=null}){const{api:b,ws:{useSubscription:r}}=K(),{t:w}=M(),{teamDid:x}=V(),{blocklet:j}=Ge(),{data:l,loadMore:f,loadingMore:g,loading:y,mutate:z}=Te(s=>{const k=s?Math.ceil(s.list.length/15)+1:1;return b.getWebhookAttempts({input:{teamDid:x,input:{eventId:i,webhookId:u},paging:{page:k,pageSize:15}}})},{reloadDeps:[i,u]}),T=l?.list||[],[n,a]=E.useState(null),[m,v]=E.useState(!1),S=dt(T);if(E.useEffect(()=>{!n&&l?.list.length&&a(l.list[0])},[l?.list.length,n]),r(xe.EVENTS.WEBHOOK_ATTEMPT,s=>{z(h=>{if(h.list.find(W=>W.id===s.id)){const W=h.list.map(P=>P.id===s.id?{...P,...s}:P);return{...h,list:W}}return s.endpoint=h.list[0]?.endpoint,s.event=h.list[0]?.event,{...h,list:[s,...h.list]}})},[]),y)return e.jsx(F,{});const D=l&&l.list.length<l.paging.total,I=async()=>{n&&(v(!0),await b.retryWebhookAttempt({input:{teamDid:x,eventId:n.event.id,webhookId:u,attemptId:n.id}}).finally(()=>{setTimeout(()=>{v(!1)},1e3)}))},O=s=>{if(s.responseBody&&s.responseBody?.sessionId&&s.responseBody?.projectId&&s.responseBody?.agentId){const h=j?.site?.domainAliases[0]?.value,k=(j.children||[]).find(P=>P?.meta?.name==="ai-studio"),W=ot(he(`https://${h}`,k?.mountPoint||"","projects",s.responseBody.projectId,"logs/main"),{sessionId:s.responseBody.sessionId,agentId:s.responseBody.agentId});return e.jsx(B,{sx:{fontSize:20},onClick:()=>window.open(W,"_blank"),children:e.jsx(p,{component:N,icon:Q})})}return null},o=s=>s.status==="pending"?e.jsx(Fe,{color:"warning"}):at(s.responseStatus)?e.jsx(He,{color:"success"}):e.jsx(Ne,{color:"error"}),d=n?.triggeredFrom&&(l?.list||[]).find(s=>s.id===n.triggeredFrom);return e.jsxs(pt,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(ee,{size:{xs:12,md:4},sx:{height:1},children:me(Object.keys(S))?e.jsx(C,{sx:{color:"text.secondary"},children:w("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(Z,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(S).map(([s,h])=>e.jsxs(ae.Fragment,{children:[e.jsx(Le,{sx:{p:0},children:s}),h.map(k=>e.jsxs(G,{sx:{cursor:"pointer",px:1},onClick:()=>a(k),selected:n&&n?.id===k?.id,secondaryAction:e.jsx(C,{sx:{color:"text.secondary"},children:U(k.createdAt,"HH:mm:ss")}),children:[e.jsx(Me,{sx:{minWidth:0,mr:1.5},children:o(k)}),e.jsx(Be,{primary:e.jsx(C,{sx:{color:"text.primary"},children:k.event.type})})]},k.id))]},s))}),D&&e.jsx(p,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:1},children:e.jsx(H,{variant:"text",type:"button",color:"inherit",onClick:f,disabled:g,sx:{color:s=>s.palette.text.disabled},children:w(g?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(ee,{size:{xs:12,md:8},sx:{height:1},children:[n&&e.jsxs(R,{direction:"column",spacing:2,sx:{height:1,overflow:"auto",pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"h4",children:w(`common.${n.status}`)}),e.jsx(p,{children:O(n)})]}),e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[d&&e.jsx(A,{placement:"left",title:e.jsxs(R,{onClick:()=>a(d),sx:{gap:1,cursor:"pointer",".did-address-text":{color:"common.white"}},children:[e.jsx(de,{showDid:!0,did:n.triggeredBy,cardType:ue.Detailed,infoType:pe.Minimal,sx:{border:0,padding:0,minWidth:0,".MuiTypography-root":{color:"common.white",fontWeight:400}}}),e.jsx(ce,{}),e.jsxs(p,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(C,{variant:"body2",sx:{color:"primary.main"},children:w("webhookEndpoint.triggeredFrom")}),e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"body2",children:n.id}),e.jsx(B,{onClick:()=>a(d),children:e.jsx(p,{component:N,icon:Q,sx:{fontSize:16,color:"common.white"}})})]})]})]}),slotProps:{tooltip:{sx:{maxWidth:400}}},children:e.jsx(B,{onClick:()=>a(d),children:e.jsx(p,{component:N,icon:Q,sx:{fontSize:16}})})}),e.jsxs(H,{variant:"outlined",color:"primary",size:"small",onClick:I,disabled:m,children:[e.jsx(p,{component:N,icon:ct,sx:{fontSize:16,animation:m?"spin 1s linear infinite":"none",mr:.5}}),w("notification.resend")]})]})]}),e.jsxs(p,{children:[e.jsxs(C,{variant:"h6",children:[w("webhookEndpoint.response")," (",n.responseStatus,")"]}),e.jsx(Y,{language:"json",children:JSON.stringify(n.responseBody,null,2)})]}),e.jsxs(p,{children:[e.jsx(R,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(C,{variant:"h6",children:w("webhookEndpoint.request")})}),e.jsx(Y,{language:"json",sx:{margin:0},children:JSON.stringify(n.event,null,2)})]})]}),l?.list.length===0&&c&&e.jsxs(p,{children:[e.jsx(R,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(C,{variant:"h6",children:w("webhookEndpoint.eventData")})}),e.jsx(Y,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}ye.propTypes={eventId:t.string,webhookEndpointId:t.string,event:t.shape({type:t.string,data:t.object,request:t.object,requestInfo:t.object})};const pt=oe(ee)`
|
|
2
|
-
@keyframes spin {
|
|
3
|
-
to {
|
|
4
|
-
transform: rotate(360deg);
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
`;function we({id:i,onClose:u}){const{t:c}=M(),{api:b}=K(),{teamDid:r}=V(),{loading:w,error:x,data:j}=le(()=>b.getWebhookEndpoint({input:{teamDid:r,id:i}})),l=j?.data;return x?e.jsx(te,{severity:"error",children:x.message}):w||!l?e.jsx(p,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:1,width:1},children:e.jsx(F,{})}):e.jsxs(ut,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(p,{children:[e.jsxs(R,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center"},children:[e.jsx(R,{sx:{flex:1,width:0},children:e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"h5",sx:{fontWeight:600,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:l.description}),e.jsx(A,{title:l.url,children:e.jsx(_,{sx:{fontSize:"16px",marginTop:"2px"}})})]})}),e.jsx(R,{direction:"row",sx:{alignItems:"center"},children:e.jsx(B,{edge:"end",color:"inherit",onClick:u,children:e.jsx(_e,{})})})]}),e.jsx(p,{sx:{mt:2},children:e.jsxs(R,{className:"section-body",direction:{xs:"column",md:"row"},spacing:{xs:1,md:3},sx:{justifyContent:"flex-start",flexWrap:"wrap",pt:2,mt:2,borderTop:"1px solid #eee"},children:[e.jsx($,{label:c("common.status"),value:e.jsx(L,{size:"small",variant:"filled",label:l.status,color:be(l.status),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}}),divider:!0}),e.jsx($,{label:c("webhookEndpoint.listen"),value:e.jsx(A,{arrow:!0,title:e.jsx("ul",{style:{padding:0,margin:0},children:l.enabledEvents.map(f=>e.jsx("li",{style:{fontSize:"0.7875rem"},children:f?.type},f))}),children:e.jsx(L,{size:"small",variant:"filled",label:c("webhookEndpoint.eventsCount",{count:l.enabledEvents.length}),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx($,{label:c("webhookEndpoint.version"),value:l.apiVersion,divider:!0}),e.jsx($,{label:c("common.createdAt"),value:U(l.createdAt),divider:!0}),e.jsx($,{label:c("common.updatedAt"),value:U(l.updatedAt),divider:!0}),e.jsx($,{label:c("common.createdBy"),value:e.jsx(A,{arrow:!0,title:l.createUser?.did,children:e.jsx(L,{size:"small",variant:"filled",label:l.createUser?.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx($,{label:c("common.updatedBy"),value:e.jsx(A,{arrow:!0,title:l.updateUser?.did,children:e.jsx(L,{size:"small",variant:"filled",label:l.updateUser?.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})})})]})})]}),e.jsxs(R,{className:"section",sx:{flex:1,height:0,overflow:"hidden"},children:[e.jsx(je,{title:c("webhookEndpoint.attempts"),mb:0,mt:4}),e.jsx(R,{sx:{height:0,flex:1,overflow:"hidden"},children:e.jsx(ye,{webhookEndpointId:l.id})})]})]})}we.propTypes={id:t.string.isRequired,onClose:t.func.isRequired};const ut=oe(R)``;function ke({open:i,onClose:u,id:c}){return e.jsx(Ue,{anchor:"right",open:i,onClose:u,slotProps:{paper:{sx:{width:"90vw",maxWidth:"1200px"}}},children:e.jsx(p,{sx:{height:"100vh",p:3},children:e.jsx(we,{id:c,onClose:u})})})}ke.propTypes={open:t.bool.isRequired,onClose:t.func.isRequired,id:t.string.isRequired};function re(){return null}function Ee({options:i={},columns:u=[],toolbar:c=!0,footer:b=!0,hasRowLink:r=!1,emptyNodeText:w="",durable:x="",durableKeys:j=[],data:l=[],loading:f=!1,...g}){const{locale:y}=M(),z=Ke(a=>a.breakpoints.down("md")),T={print:!1,download:!1,filter:!1,selectableRows:"none",rowsPerPage:z?5:10,rowsPerPageOptions:[5,10,20,50,100],searchDebounceTime:300,tableBodyHeight:"100%",loading:!0},n={};return c||(n.TableToolbar=re),b||(n.TableFooter=re),e.jsx(xt,{locale:y,options:{...T,...i},columns:(u||[]).map(a=>(a.options=a.options||{},a.options.filter=a.options.filter||!1,a.options.sort=a.options.sort||!1,a)),emptyNode:e.jsx(ve,{children:w}),...g,durable:x,durableKeys:j,data:l,loading:f,components:n,hasRowLink:r,isMobile:z})}Ee.propTypes={options:t.object,columns:t.array,toolbar:t.bool,footer:t.bool,hasRowLink:t.bool,emptyNodeText:t.node,durable:t.string,durableKeys:t.array,data:t.array,loading:t.bool,onChange:t.func,title:t.node,components:t.object};const xt=oe(Ce)``,ht=E.memo(Ee);function $t(){const{teamDid:i}=V(),u=et(),c=`webhook-endpoints-${i}`,b=Se(c),{t:r,locale:w}=M(),{api:x}=K(),[j,l]=E.useState(""),[f,g]=E.useState({webhookDetail:{open:!1,id:null},createEdit:{open:!1,id:null,url:"",description:"",enabledEvents:[]},deleteConfirm:null}),[y,z]=Ie(c,{defaultValue:{pageSize:b.rowsPerPage||20,page:b.page?b.page+1:1}}),{loading:T,error:n,data:a,refresh:m}=le(()=>x.getWebhookEndpoints({input:{teamDid:i,paging:{page:y.page,pageSize:y.pageSize}}}));E.useEffect(()=>{m()},[y,m]);const v=E.useCallback(async(o,d)=>{try{await x.updateWebhookEndpoint({input:{teamDid:i,id:o.id,data:{status:d?"disabled":"enabled"}}}),m(),q.success(`${r(d?"webhookEndpoint.disable":"webhookEndpoint.enable")}${r("webhookEndpoint.success")}`)}catch(s){q.error(s?.message)}},[x,i,m,r]),S=E.useCallback(async o=>{try{await x.deleteWebhookEndpoint({input:{teamDid:i,id:o}}),m(),g(d=>({...d,deleteConfirm:null})),q.success(`${r("common.delete")}${r("webhookEndpoint.success")}`)}catch(d){q.error(d?.message)}},[x,i,m,r]),D=(o,d)=>{let s=o.page+1;const h=o.searchText||"";if(h!==j){l(h);return}if(d==="changePage"||d==="changeRowsPerPage"){d!=="changePage"&&(s=1);const k={page:s,pageSize:o.rowsPerPage};l(""),z(k)}};if(n)return e.jsx(te,{severity:"error",children:n.message});if(T||!a)return e.jsx(p,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:1,height:500},children:e.jsx(F,{})});const I=(a?.list||[]).filter(o=>{if(!j)return!0;const d=j.toLowerCase();return o.description.toLowerCase().includes(d)||o.url.toLowerCase().includes(d)}),O=[{label:"URL",name:"url",options:{customBodyRenderLite:(o,d)=>{const s=I[d];return e.jsxs(p,{sx:{display:"flex",alignItems:"center",cursor:"pointer",gap:.5},children:[e.jsx(C,{variant:"body2",children:s.description}),e.jsx(p,{sx:{display:"flex"},onClick:h=>{h.stopPropagation()},children:e.jsx(A,{title:s.url,children:e.jsx(_,{sx:{fontSize:"15px",marginTop:"1px"}})})})]})}}},{label:"Events",name:"events",options:{customBodyRenderLite:(o,d)=>{const s=I[d];return e.jsx(p,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:s.enabledEvents.map(h=>e.jsx(L,{size:"small",variant:"filled",label:h.type,sx:{borderRadius:"4px",textTransform:"capitalize"}},`${s.source}-${h.type}`))})}}},{label:r("common.status"),name:"status",options:{customBodyRenderLite:(o,d)=>{const s=I[d];return e.jsx(L,{size:"small",variant:"filled",label:r(`webhookEndpoint.${s?.status}`),color:be(s?.status),sx:{borderRadius:"4px",textTransform:"capitalize"}},`status-${s.status}`)}}},{label:r("common.createdAt"),name:"createdAt",minWidth:200,options:{customBodyRender:o=>U(o)}},{label:r("common.createdBy"),name:"createUser",width:100,options:{customBodyRender:o=>o?e.jsx(de,{showDid:!0,did:o?.did,cardType:ue.Detailed,infoType:pe.Minimal,sx:{border:0,padding:0}}):"-"}},{label:r("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite:(o,d)=>{const s=I[d],h=s?.status==="enabled";return e.jsx(nt,{actions:[{icon:h?e.jsx(Ve,{}):e.jsx(Ye,{}),text:r(h?"webhookEndpoint.disable":"webhookEndpoint.enable"),onClick:k=>{k.stopPropagation(),v(s,h)}},{icon:e.jsx(Je,{}),text:r("common.edit"),onClick:k=>{k.stopPropagation(),g(W=>({...W,createEdit:{open:!0,id:s.id,url:s.url,description:s.description,enabledEvents:s.enabledEvents}}))}},{icon:e.jsx(Qe,{}),text:r("common.delete"),onClick:k=>{k.stopPropagation(),g(W=>({...W,deleteConfirm:{title:r("webhookEndpoint.deleteWebhook.title"),description:r("webhookEndpoint.deleteWebhook.description"),confirm:r("common.confirm"),cancel:r("common.cancel"),onConfirm:()=>S(s.id),onCancel:()=>g(P=>({...P,deleteConfirm:null}))}}))}}]})}}}];return e.jsxs(p,{sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[u?e.jsx(ie,{title:r("webhookEndpoint.listTitle"),tooltipTitle:r("webhookEndpoint.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${w}/webhook`}):null,e.jsx(ht,{durable:c,durableKeys:["page","rowsPerPage"],data:I,columns:O,options:{count:a.count,page:y.page-1,rowsPerPage:y.pageSize,viewColumns:!1,onRowClick:(o,{dataIndex:d})=>{const s=a.list[d];g(h=>({...h,webhookDetail:{open:!0,id:s.id}}))}},loading:T,onChange:D,emptyNodeText:e.jsx(R,{sx:{gap:1},children:r("webhookEndpoint.noWebhooksAdded")}),title:u?null:e.jsx(ie,{title:r("webhookEndpoint.listTitle"),tooltipTitle:r("webhookEndpoint.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${w}/webhook`}),customButtons:[e.jsxs(H,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary",onClick:()=>g(o=>({...o,createEdit:{...o.createEdit,open:!0}})),className:"rule-action",children:[T?e.jsx(F,{size:16}):e.jsx(Xe,{style:{fontSize:16}}),r("common.create")]},"add")]}),f.webhookDetail.open&&e.jsx(ke,{open:!0,onClose:()=>g(o=>({...o,webhookDetail:{open:!1,id:null}})),id:f.webhookDetail.id}),f.createEdit.open&&e.jsx(fe,{onSubmit:m,...f.createEdit,onClose:()=>g(o=>({...o,createEdit:{id:null,url:"",description:"",enabledEvents:[],open:!1}}))}),f.deleteConfirm&&e.jsx(st,{title:f.deleteConfirm.title,description:f.deleteConfirm.description,confirm:f.deleteConfirm.confirm,cancel:f.deleteConfirm.cancel,params:f.deleteConfirm.params,onConfirm:f.deleteConfirm.onConfirm,onCancel:f.deleteConfirm.onCancel})]})}export{$t as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,at as r}from"./vendor-mui-core-BkVXEDpj.js";import{r as s}from"./vendor-react-Dvs43sk9.js";import{G as a}from"./vendor-ux-lckoR4gs.js";import{t as n}from"./index-BWTQhZ4U.js";import"./vendor-utils-DtY42AM-.js";import"./vendor-hooks-CLY4g97Q.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-Q5ECWsoh.js";function l(){const{t:o}=s.useContext(a);return t.jsx(i,{style:{paddingTop:"25vh"},children:t.jsx(n,{status:"404",description:o("noMatch.desc"),style:{backgroundColor:"transparent"}})})}const i=r.main``;export{l as default};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import{T as ee,H as B,ab as X,ao as Ee,ap as Ue,aq as We,ar as Ve,G as K,aj as je,F as ke,N as Me,D as z,as as _e,ac as Ne,O as $e,L as Ie}from"./vendor-ux-lckoR4gs.js";import{b as u,a as H,g as ae,c as He}from"./vendor-hooks-CLY4g97Q.js";import{r as D}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as i,b6 as R,am as ce,y as O,z as F,Q as V,T as Y,I as le,a3 as oe,W as E,b1 as W,c9 as qe,ck as Le,c8 as Ze,at as Fe,D as ye,ah as Oe,cD as Be,a6 as be,cE as Je,a$ as Ke}from"./vendor-mui-core-BkVXEDpj.js";import{Z as N,a8 as M,X as G,bh as se,c as ve,b9 as Ge,aZ as Ye,Y as Qe}from"./index-BWTQhZ4U.js";import{A as J,Q as Xe,b as de,Z as et,n as Q,$ as tt,C as nt,a as st}from"./vendor-utils-DtY42AM-.js";import{u as te,C as k,a as De}from"./index.esm-JPZAjt0x.js";import{S as ie}from"./switch-control-_r5tnNLs.js";import{S as y}from"./section-DSgkHUgY.js";import{d as ot}from"./keyboard-arrow-down-rounded-8U0_i9QO.js";import{u as at}from"./index-CGLt1oNo.js";import{v as it}from"./index-DZ2X8gFe.js";import{r as rt}from"./base32-BfYXZjht.js";import{u as lt}from"./use-mobile-BTugf2DR.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-Q5ECWsoh.js";import"./required-McYgDRcp.js";const we={width:24,height:24,body:'<path fill="currentColor" d="M5 4v16V4v5v-5Zm3 10h2.675q.275-.575.638-1.075t.812-.925H8q-.425 0-.713.288T7 13q0 .425.288.713T8 14Zm0 4h2.075Q10 17.5 10 17t.075-1H8q-.425 0-.713.288T7 17q0 .425.288.713T8 18Zm-3 4q-.825 0-1.413-.588T3 20V4q0-.825.588-1.413T5 2h7.175q.4 0 .763.15t.637.425l4.85 4.85q.275.275.425.638t.15.762V10.3q-.475-.15-.975-.225T17 10V9h-4q-.425 0-.713-.288T12 8V4H5v16h5.675q.275.575.638 1.075t.812.925H5Zm12-10q2.075 0 3.538 1.463T22 17q0 2.075-1.463 3.538T17 22q-2.075 0-3.538-1.463T12 17q0-2.075 1.463-3.538T17 12Zm0 8q.275 0 .463-.188t.187-.462q0-.275-.187-.463T17 18.7q-.275 0-.463.188t-.187.462q0 .275.188.463T17 20Zm0-6q-.475 0-.875.238t-.65.637q-.1.15-.025.313t.25.237q.15.075.3 0t.275-.2q.125-.175.313-.275t.412-.1q.325 0 .563.213t.237.537q0 .275-.15.463t-.35.387q-.15.15-.313.3t-.287.35q-.075.15-.113.313t-.037.337q0 .225.125.413t.325.187q.2 0 .325-.15t.125-.35q0-.275.15-.488t.35-.412q.3-.275.525-.613t.225-.737q0-.675-.5-1.138T17 14Z"/>'},ue={enabled:!1,domain:"",clientId:"",clientSecret:""};function ct(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...ue},c?.settings?.oauth?.auth0||{}),{handleSubmit:x,control:a,formState:p,watch:d,reset:f}=te({defaultValues:J(r,Object.keys(ue))}),l=d("enabled"),j=u(async s=>{try{const{blocklet:I}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({auth0:s})}}),L=Object.assign({...ue},I?.settings?.oauth?.auth0||{});f(L),B.success(t("oauth.saveSuccess"))}catch(I){B.error(I.message||t("oauth.saveFailed"))}}),v=u(s=>s?.trim()?!0:t("oauth.auth0.domainDescription")),S=u(s=>s?.trim()?!0:t("oauth.auth0.clientIdDescription")),g=u(s=>s?.trim()?!0:t("oauth.auth0.clientSecretDescription")),w=u(()=>!0),h=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-auth0":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-auth0",[n]);return e.jsx(i,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.auth0.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(i,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:h,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,children:e.jsx(k,{name:"enabled",control:a,render:({field:s})=>e.jsx(R,{control:e.jsx(ie,{sx:{ml:1},checked:s.value,...s})})})}),e.jsx(y,{title:t("oauth.auth0.domain"),children:e.jsx(k,{name:"domain",control:a,rules:{validate:l?v:w},render:({field:s})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.auth0.domain"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.auth0.clientId"),children:e.jsx(k,{name:"clientId",control:a,rules:{validate:l?S:w},render:({field:s})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.auth0.clientId"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.auth0.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:a,rules:{validate:l?g:w},render:({field:s})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",type:"password",label:t("oauth.auth0.clientSecret"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const he={enabled:!1,clientId:"",clientSecret:""};function dt(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...he},c?.settings?.oauth?.github||{}),{handleSubmit:x,control:a,formState:p,watch:d,reset:f}=te({defaultValues:J(r,Object.keys(he))}),l=d("enabled"),j=u(async h=>{try{const{blocklet:s}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({github:h})}}),I=Object.assign({...he},s?.settings?.oauth?.github||{});f(I),B.success(t("oauth.saveSuccess"))}catch(s){B.error(s.message||t("oauth.saveFailed"))}}),v=u(h=>h?.trim()?!0:t("oauth.github.clientIdDescription")),S=u(h=>h?.trim()?!0:t("oauth.github.clientSecretDescription")),g=u(()=>!0),w=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-github":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-github",[n]);return e.jsx(i,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.github.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(i,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:w,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(k,{name:"enabled",control:a,sx:{alignItems:"center"},render:({field:h})=>e.jsx(R,{control:e.jsx(ie,{sx:{ml:1},size:"small",checked:h.value,...h})})})}),e.jsx(y,{title:t("oauth.github.clientId"),children:e.jsx(k,{name:"clientId",control:a,rules:{validate:l?v:g},render:({field:h})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",label:t("oauth.github.clientId"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.github.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:a,rules:{validate:l?S:g},render:({field:h})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",type:"password",label:t("oauth.github.clientSecret"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const me={enabled:!1,clientId:"",clientSecret:""};function ut(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...me},c?.settings?.oauth?.google||{}),{handleSubmit:x,control:a,formState:p,watch:d,reset:f}=te({defaultValues:J(r,Object.keys(me))}),l=d("enabled"),j=u(async h=>{try{const{blocklet:s}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({google:h})}}),I=Object.assign({...me},s?.settings?.oauth?.google||{});f(I),B.success(t("oauth.saveSuccess"))}catch(s){B.error(s.message||t("oauth.saveFailed"))}}),v=u(h=>h?.trim()?!0:t("oauth.google.clientIdDescription")),S=u(h=>h?.trim()?!0:t("oauth.google.clientSecretDescription")),g=u(()=>!0),w=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-google":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-google",[n]);return e.jsx(i,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.google.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(i,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:w,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,children:e.jsx(k,{name:"enabled",control:a,render:({field:h})=>e.jsx(R,{control:e.jsx(ie,{sx:{ml:1},checked:h.value,...h})})})}),e.jsx(y,{title:t("oauth.google.clientId"),children:e.jsx(k,{name:"clientId",control:a,rules:{validate:l?v:g},render:({field:h})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",label:t("oauth.google.clientId"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.google.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:a,rules:{validate:l?S:g},render:({field:h})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",type:"password",label:t("oauth.google.clientSecret"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const pe={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function ht(){const{api:b}=N(),{blocklet:c}=M(),{t}=ee(),n=c?.meta?.did,o=Object.assign({...pe},c?.settings?.oauth?.apple||{}),{handleSubmit:r,control:x,formState:a,watch:p,reset:d}=te({defaultValues:J(o,Object.keys(pe))}),f=p("enabled"),l=u(async s=>{try{const{blocklet:I}=await b.configOAuth({input:{did:n,oauth:JSON.stringify({apple:s})}}),L=Object.assign({...pe},I?.settings?.oauth?.apple||{});d(L),B.success(t("oauth.saveSuccess"))}catch(I){B.error(I.message||t("oauth.saveFailed"))}}),j=u(s=>s?.trim()?!0:t("oauth.apple.teamIdDescription")),v=u(s=>s?.trim()?!0:t("oauth.apple.serviceIdDescription")),S=u(s=>s?.trim()?!0:t("oauth.apple.keyIdDescription")),g=u(s=>s?.trim()?!0:t("oauth.apple.authKeyDescription")),w=u(s=>s?.trim()?!0:t("oauth.apple.bundleIdDescription")),h=u(()=>!0);return e.jsx(i,{children:e.jsxs("form",{onSubmit:r(l),disabled:!0,children:[e.jsx(y,{title:t("oauth.apple.enable"),mb:2.5,children:e.jsx(k,{name:"enabled",control:x,render:({field:s})=>e.jsx(R,{control:e.jsx(ie,{sx:{ml:1},checked:s.value,...s})})})}),e.jsx(y,{title:t("oauth.apple.teamId"),children:e.jsx(k,{name:"teamId",control:x,rules:{validate:f?j:h},render:({field:s})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.teamId"),error:!!a.errors[s.name],helperText:a.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.bundleId"),children:e.jsx(k,{name:"bundleId",control:x,rules:{validate:f?w:h},render:({field:s})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.bundleId"),error:!!a.errors[s.name],helperText:a.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.serviceId"),children:e.jsx(k,{name:"serviceId",control:x,rules:{validate:f?v:h},render:({field:s})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.serviceId"),error:!!a.errors[s.name],helperText:a.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.keyId"),children:e.jsx(k,{name:"keyId",control:x,rules:{validate:f?S:h},render:({field:s})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.keyId"),error:!!a.errors[s.name],helperText:a.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.authKey"),children:e.jsx(k,{name:"authKey",control:x,rules:{validate:f?g:h},render:({field:s})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",type:"password",label:t("oauth.apple.authKey"),multiline:!0,rows:4,error:!!a.errors[s.name],helperText:a.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:r(l),disabled:!a.isDirty,children:t("oauth.save")})]})})}const xe={enabled:!1,clientId:"",clientSecret:""};function mt(){const{api:b}=N(),{blocklet:c}=M(),{t}=ee(),n=c?.meta?.did,o=Object.assign({...xe},c?.settings?.oauth?.twitter||{}),{handleSubmit:r,control:x,formState:a,watch:p,reset:d}=te({defaultValues:J(o,Object.keys(xe))}),f=p("enabled"),l=u(async g=>{try{const{blocklet:w}=await b.configOAuth({input:{did:n,oauth:JSON.stringify({twitter:g})}}),h=Object.assign({...xe},w?.settings?.oauth?.twitter||{});d(h),B.success(t("oauth.saveSuccess"))}catch(w){B.error(w.message||t("oauth.saveFailed"))}}),j=u(g=>g?.trim()?!0:t("oauth.twitter.clientIdDescription")),v=u(g=>g?.trim()?!0:t("oauth.twitter.clientSecretDescription")),S=u(()=>!0);return e.jsx(i,{children:e.jsxs("form",{onSubmit:r(l),disabled:!0,children:[e.jsx(y,{title:e.jsx(i,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:t("oauth.twitter.enable")})}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(k,{name:"enabled",control:x,sx:{alignItems:"center"},render:({field:g})=>e.jsx(R,{control:e.jsx(ie,{sx:{ml:1},size:"small",checked:g.value,...g})})})}),e.jsx(y,{title:t("oauth.twitter.clientId"),children:e.jsx(k,{name:"clientId",control:x,rules:{validate:f?j:S},render:({field:g})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...g,size:"small",label:t("oauth.twitter.clientId"),error:!!a.errors[g.name],helperText:a.errors[g.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.twitter.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:x,rules:{validate:f?v:S},render:({field:g})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...g,size:"small",type:"password",label:t("oauth.twitter.clientSecret"),error:!!a.errors[g.name],helperText:a.errors[g.name]?.message||" ",disabled:!f})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:r(l),disabled:!a.isDirty,children:t("oauth.save")})]})})}const pt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function Re({id:b,title:c,children:t,index:n,onMove:o,defaultExpand:r=!1,onEnd:x,icon:a=null}){const[p,d]=D.useState(r),f=D.useRef(null),l=D.useRef(null),[{handlerId:j},v]=Ee({accept:"dragItem",collect(s){return{handlerId:s.getHandlerId()}},hover(s,I){if(!f.current)return;const L=s.index,m=n;if(L===m)return;const A=f.current?.getBoundingClientRect(),_=l.current?.getBoundingClientRect(),re=(_.bottom-_.top)/2,$=I.getClientOffset().y-A.top;L<m&&$<re||L>m&&$>re||(o(L,m),s.index=m)}}),[{isDragging:S},g]=Ue({item:{index:n,type:"dragItem"},collect:s=>({isDragging:s.isDragging()}),end:x});g(l),v(f);const w=S?.5:1,h=u(s=>{s.preventDefault(),s.stopPropagation(),d(!p)});return e.jsxs(i,{ref:f,children:[e.jsxs(i,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:l,"data-handler-id":j,children:[e.jsxs(i,{sx:{py:2,px:1,opacity:w,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:h,children:[e.jsx(i,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(X,{fontSize:20,icon:pt})}),e.jsx(i,{sx:{display:"flex",alignItems:"center",flexShrink:0,mr:.5,transform:"translateY(-1px)"},children:a}),e.jsx(Y,{sx:{flex:1},children:c}),e.jsx(le,{size:"small",sx:{pointerEvents:"auto",transform:p?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(X,{icon:ot,style:{transform:"scale(1.5)"}})})]}),e.jsx(oe,{})]}),e.jsx(i,{sx:{pl:4,py:2.5,display:p?"block":"none"},children:t})]})}Re.propTypes={title:E.string.isRequired,id:E.string.isRequired,children:E.node.isRequired,index:E.number.isRequired,onMove:E.func.isRequired,onEnd:E.func.isRequired,defaultExpand:E.bool,icon:E.any};const xt=[{name:"github",title:G.PROVIDER_NAME.github,icon:e.jsx(se,{provider:"github",sx:{width:20,height:20}}),component:e.jsx(dt,{})},{name:"google",title:G.PROVIDER_NAME.google,icon:e.jsx(se,{provider:"google",sx:{width:20,height:20}}),component:e.jsx(ut,{})},{name:"apple",title:G.PROVIDER_NAME.apple,icon:e.jsx(se,{provider:"apple",sx:{width:20,height:20}}),component:e.jsx(ht,{})},{name:"twitter",title:G.PROVIDER_NAME.twitter,icon:e.jsx(se,{provider:"twitter",sx:{width:20,height:20}}),component:e.jsx(mt,{})},{name:"auth0",title:G.PROVIDER_NAME.auth0,icon:e.jsx(se,{provider:"auth0",sx:{width:20,height:20}}),component:e.jsx(ct,{})}],ft=["github","google","apple","twitter","auth0"];function gt(){const{api:b}=N(),{blocklet:c}=M(),t=c?.meta?.did,n=c?.settings?.oauth||{},o=Object.keys(n).sort((l,j)=>n[l]?.order!==void 0&&n[j]?.order!==void 0?n[l].order-n[j].order:n[l]?.order!==void 0?-1:1);for(const l of ft)o.includes(l)||o.push(l);const r=ae(o.reduce((l,j,v)=>Object.assign(l,{[j]:v}),{})),x=H(()=>{const l=[...xt];return l.sort((j,v)=>r[j.name]-r[v.name]),l.map(j=>({...j,enabled:n[j.name]?.enabled??!1}))},[r.auth0,r.github,r.google]),a={};typeof window<"u"&&(a.context=window);const p=u(async l=>{const j={};Object.keys(l).forEach(v=>{j[v]={order:l[v]}}),await b.configOAuth({input:{did:t,oauth:JSON.stringify(j)}})}),d=u((l,j)=>{const v=x[l],S=x[j];r[v.name]=j,r[S.name]=l}),f=u(async()=>{await p(r)});return e.jsx(i,{sx:{".section-left":{width:"180px"}},children:e.jsx(We,{backend:Ve,...a,children:x.map((l,j)=>e.jsx(Re,{index:j,id:l.name,title:l.title,icon:l.icon,onMove:d,onEnd:f,defaultExpand:l.enabled,children:l.component},l.name))})})}const Z={ttl:ve.SESSION_TTL,cacheTtl:ve.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]},enableBlacklist:!1};function U(b){return e.jsx(at,{...b,sx:{transform:"scale(0.75)"}})}function fe(b,c=!1){const t=c?b.ttl*86400:b.ttl/86400;return{...b,ttl:t}}function jt(){const{api:b}=N(),{blocklet:c}=M(),t=c?.meta?.did,n=Xe({},Z,c?.settings?.session||{});de(n.ttl)&&(n.ttl=Z.ttl),de(n.cacheTtl)&&(n.cacheTtl=Z.cacheTtl),n.phone||(n.phone=Z.phone),n.email||(n.email=Z.email),de(n.enableBlacklist)&&(n.enableBlacklist=Z.enableBlacklist);const{handleSubmit:o,control:r,formState:x,reset:a,watch:p}=te({defaultValues:J(fe(n),["ttl","cacheTtl","email","phone","enableBlacklist"])}),{t:d}=ee(),f=p("email.enabled"),l=p("phone.enabled"),j=p("email.enableDomainBlackList"),v=p("email.enableDomainWhiteList"),{fields:S,append:g,remove:w}=De({control:r,name:"email.domainBlackList"}),{fields:h,append:s,remove:I}=De({control:r,name:"email.domainWhiteList"}),L=u(async m=>{try{const{blocklet:A}=await b.updateAppSessionConfig({input:{did:t,config:et(fe(m,!0),["phone"])}}),_=Object.assign({},Z,J(A?.settings?.session||{},["ttl","cacheTtl","email","phone","enableBlacklist"]));a(fe(_)),B.success(d("common.configSuccess"))}catch(A){B.error(A.message)}});return e.jsx(bt,{onSubmit:o(L),children:e.jsxs(W,{direction:"column",sx:{gap:6},children:[e.jsxs(i,{children:[e.jsxs(i,{children:[e.jsx(Y,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.profile")}),e.jsx(i,{component:oe,sx:{my:3}})]}),e.jsxs(W,{sx:{gap:2},children:[e.jsx(y,{title:d("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(U,{disabled:!0,checked:!0})})}),e.jsx(y,{title:d("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(U,{disabled:!0,checked:!0})})}),e.jsx(y,{title:d("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enabled",control:r,render:({field:m})=>e.jsx(U,{...m,checked:m.value})})})}),f&&e.jsxs(W,{direction:"column",sx:{ml:2,gap:.5},children:[e.jsx(y,{title:d("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.requireVerified",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.requireUnique",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.trustOauthProviders",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enableDomainBlackList",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),j&&e.jsxs(i,{children:[S.map((m,A)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(k,{name:`email.domainBlackList.${A}`,control:r,render:_=>e.jsx(F,{..._.field,size:"small",fullWidth:!0})}),e.jsx(le,{onClick:()=>w(A),children:e.jsx(qe,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(Le,{}),onClick:()=>g(""),children:d("blocklet.config.session.addDomain")})]}),e.jsx(y,{title:d("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enableDomainWhiteList",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),v&&e.jsxs(i,{children:[h.map((m,A)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(k,{name:`email.domainWhiteList.${A}`,control:r,render:_=>e.jsx(F,{..._.field,size:"small",fullWidth:!0})}),e.jsx(le,{onClick:()=>I(A),children:e.jsx(qe,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(Le,{}),onClick:()=>s(""),children:d("blocklet.config.session.addDomain")})]})]}),e.jsxs(i,{sx:{display:"none"},children:[e.jsx(y,{title:d("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.enabled",control:r,disabled:!0,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),l&&e.jsxs(W,{direction:"column",sx:{ml:2,mt:1},children:[e.jsx(y,{title:d("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.requireVerified",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.requireUnique",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(i,{children:[e.jsx(Y,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.period")}),e.jsx(i,{component:oe,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(k,{name:"ttl",control:r,rules:{min:1,max:30},render:({field:m})=>e.jsx(O,{fullWidth:!0,sx:{mb:2},children:e.jsx(y,{title:d("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{width:"100%",maxWidth:500,px:2},children:e.jsx(Ze,{...m,defaultValue:7,step:1,marks:[{value:1,label:d("blocklet.config.session.day",{day:1})},{value:7,label:d("blocklet.config.session.days",{day:7})},{value:14,label:d("blocklet.config.session.days",{day:14})},{value:21,label:d("blocklet.config.session.days",{day:21})},{value:30,label:d("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsxs(i,{children:[e.jsx(Y,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.experimentalSettings")}),e.jsx(i,{component:oe,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(y,{title:d("blocklet.config.session.enableBlacklist"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"enableBlacklist",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})})})]}),e.jsx(i,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!x.isDirty,children:d("oauth.save")})})]})})}const bt=Fe.form`
|
|
2
|
-
max-width: 1536px;
|
|
3
|
-
|
|
4
|
-
.advanced-config {
|
|
5
|
-
border: 0;
|
|
6
|
-
padding: 0;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.config-form {
|
|
10
|
-
flex-grow: 1;
|
|
11
|
-
overflow-y: auto;
|
|
12
|
-
will-change: transform;
|
|
13
|
-
|
|
14
|
-
&:first-child {
|
|
15
|
-
margin: 0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
${b=>b.theme.breakpoints.down("md")} {
|
|
19
|
-
width: 100%;
|
|
20
|
-
flex-shrink: 0;
|
|
21
|
-
padding: 0 24px;
|
|
22
|
-
transform: translate(0, 0);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.config-item {
|
|
27
|
-
display: flex;
|
|
28
|
-
align-items: center;
|
|
29
|
-
justify-content: space-between;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.config-desc {
|
|
33
|
-
font-weight: normal;
|
|
34
|
-
font-size: 12px;
|
|
35
|
-
color: #666;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.form-item {
|
|
39
|
-
margin-top: 0;
|
|
40
|
-
}
|
|
41
|
-
`,vt={width:24,height:24,body:'<path fill="currentColor" d="M6 12.05q0 1.125.425 2.188T7.75 16.2l.25.25V15q0-.425.288-.713T9 14q.425 0 .713.288T10 15v4q0 .425-.288.713T9 20H5q-.425 0-.713-.288T4 19q0-.425.288-.713T5 18h1.75l-.4-.35q-1.3-1.15-1.825-2.625T4 12.05Q4 9.7 5.2 7.787T8.425 4.85q.35-.2.738-.025t.512.575q.125.375-.013.75t-.487.575q-1.45.8-2.313 2.213T6 12.05Zm12-.1q0-1.125-.425-2.187T16.25 7.8L16 7.55V9q0 .425-.288.713T15 10q-.425 0-.713-.288T14 9V5q0-.425.288-.713T15 4h4q.425 0 .713.288T20 5q0 .425-.288.713T19 6h-1.75l.4.35q1.225 1.225 1.788 2.663T20 11.95q0 2.35-1.2 4.263t-3.225 2.937q-.35.2-.737.025t-.513-.575q-.125-.375.013-.75t.487-.575q1.45-.8 2.313-2.212T18 11.95Z"/>'};var ge,Ce;function kt(){if(Ce)return ge;Ce=1;const{DEFAULT_IP_DOMAIN_SUFFIX:b,SLOT_FOR_IP_DNS_SITE:c,DEFAULT_DID_DOMAIN:t}=Ge(),{encode:n}=rt();return ge={getIpDnsDomainForBlocklet:x=>`${n(x.meta.did)}-${c}.${b}`,getDidDomainForBlocklet:({did:x,didDomain:a=t})=>`${n(x)}.${a}`},ge}var yt=kt();function Ae({ref:b=null}){const{t:c}=D.useContext(K),{blocklet:t}=M(),{api:n}=N(),o=ae({loadingReject:!1,loadingApprove:!1,mode:"view",show:!1,data:{},callback:Q}),x=ye()?.transitions?.duration?.leavingScreen||300,a=u(()=>{o.mode="view",o.data={},o.callback=Q}),p=u(()=>{o.show=!1,setTimeout(()=>{a()},x)}),d=u(g=>{o.mode="view",o.show=!0,o.data=g}),f=u((g,w=Q)=>{o.mode="approve",o.show=!0,o.data=g,o.callback=w});D.useImperativeHandle(b,()=>({open:d,close:p,approve:f}),[d,p,f]);const l=H(()=>{if(!o.show)return[];o.data.migratedFrom=[o.data.appId,o.data.appPid];const g=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return o.data.isMaster!==!1&&tt(g,"appliedAt","status"),g.map(w=>{const h=c(`federated.info.${w}`);let s=o.data[w];if(w==="appName"&&o.data.isMaster&&(s=e.jsxs(i,{children:[e.jsx(Oe,{component:Be}),s]})),["appId","appPid","serverId"].includes(w)&&(s=e.jsx(je,{children:s})),["appUrl"].includes(w)&&(s=e.jsx(i,{component:"a",href:s,target:"_blank",children:s})),["appLogo"].includes(w)){const I=nt(`https://${yt.getDidDomainForBlocklet({did:o.data.appPid})}`,ve.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo");try{const L=new URL(I);L.searchParams.set("imageFilter","resize"),L.searchParams.set("w","80"),L.searchParams.set("h","80"),s=e.jsx("img",{src:L.href,width:"60",height:"60",alt:o.data.appName})}catch{s=e.jsx("img",{src:I,width:"60",height:"60",alt:o.data.appName})}}return w==="status"&&(s=s&&c(`federated.status.${s}`)),w==="migratedFrom"&&(s=(o.data.migratedFrom||[]).filter(m=>![o.data.appId,o.data.appPid].includes(m)).map(m=>e.jsx(je,{children:m}))),st(s)&&(s="-"),{name:h,value:s}})},[o.data]),j=o.mode==="approve",v=u(async()=>{try{o.loadingReject=!0,await n.auditFederatedLogin({input:{memberPid:o.data.appPid,did:t.appPid,status:"rejected"}}),p(),o?.callback(!1)}finally{o.loadingReject=!1}}),S=u(async()=>{try{o.loadingApprove=!0,await n.auditFederatedLogin({input:{memberPid:o.data.appPid,did:t.appPid,status:"approved"}}),p(),o?.callback(!0)}finally{o.loadingApprove=!1}});return e.jsx(ke,{open:o.show,title:c(j?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:p,actions:j?e.jsxs(e.Fragment,{children:[e.jsxs(V,{color:"error",variant:"contained",onClick:v,disabled:o.loadingReject,children:[o.loadingReject?e.jsx(be,{size:16,color:"grey"}):null,c("common.reject")]}),e.jsxs(V,{variant:"contained",onClick:S,disabled:o.loadingApprove,children:[o.loadingApprove?e.jsx(be,{size:16,color:"grey"}):null,c("common.approve")]})]}):e.jsx(V,{variant:"outlined",onClick:p,children:c("common.close")}),children:l.map(g=>e.jsx(it,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:g.name,children:g.value},g.name))})}Ae.propTypes={ref:E.any};function Se({ref:b=null}){const t=ye()?.transitions?.duration?.leavingScreen||300,{t:n}=D.useContext(K),o=ae({show:!1,data:{link:""}}),r=u(()=>{o.data.link=""}),x=u(()=>{o.show=!1,setTimeout(()=>{r()},t)}),a=u(({link:d})=>{o.show=!0,o.data.link=d});D.useImperativeHandle(b,()=>({open:a,close:x}),[a,x]);const p=u(()=>{He(o.data.link),x()});return e.jsxs(ke,{open:o.show,title:n("federated.joinFederatedLogin"),onClose:x,PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(z,{color:"primary",autoFocus:!0,variant:"contained",onClick:p,children:n("common.copyAndClose")}),children:[e.jsx(i,{sx:{mb:1},children:n("federated.inviteJoinFederatedLoginDescription")}),e.jsx(i,{sx:{"& .copy-button":{display:"none !important"}},children:e.jsx(Me,{language:"shell",style:{marginBottom:0},children:o.data.link})})]})}Se.propTypes={ref:E.any};function Pe({mode:b="member"}){const c=D.useRef(null),t=D.useRef(null),{t:n,locale:o}=D.useContext(K),{blocklet:r,actions:{refreshBlocklet:x}}=M(),{confirmApi:a,confirmHolder:p}=Ye(),{api:d}=N(),f=r.settings.federated?.sites||[],l=r.settings.federated?.config||{},j=l.isMaster!==!1,v=f.find(T=>T.appPid===r.appPid),S=ae({loadingSync:!1}),g=u(T=>{t.current?.open(T)}),w=u(T=>{t.current?.approve(T,x)}),h=u(T=>{a.open({title:n("federated.removeFederatedLogin"),content:n("federated.removeFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(C){await d.quitFederatedLogin({input:{did:r.appPid,targetDid:T.appPid}}),C()}})}),s=u(T=>{a.open({title:n("federated.disableFederatedLogin"),content:n("federated.disableFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(C){await d.auditFederatedLogin({input:{memberPid:T.appPid,did:r.appPid,status:"revoked"}}),C()}})}),I=u(T=>{a.open({title:n("federated.enableFederatedLogin"),content:n("federated.enableFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),async onConfirm(C){await d.auditFederatedLogin({input:{memberPid:T.appPid,did:r.appPid,status:"approved"}}),C()}})}),L=H(()=>{const T=[{label:n("common.name"),name:"appName",options:{customBodyRenderLite:C=>{const q=f[C],ne=q.isMaster!==!1;return e.jsx(i,{sx:{display:"inline-block"},children:e.jsxs(i,{component:"a",href:q.appUrl,target:"_blank",onClick:P=>{P.stopPropagation()},sx:{display:"flex",alignItems:"center"},children:[ne&&e.jsx(Oe,{component:Be,style:{marginRight:"4px"}}),q.appName]})})}}},{label:n("common.did"),name:"appId",options:{customBodyRenderLite:C=>{const q=f[C];return e.jsx(je,{children:q.appId})}}},{label:n("common.status"),name:"status",options:{customBodyRenderLite:C=>{const q=f[C],ne=q.isMaster!==!1;return e.jsx(i,{children:ne?"-":n(`federated.status.${q.status}`)})}}}];return j&&T.push({label:n("common.actions"),name:"actions",options:{customBodyRenderLite:C=>{const q=f[C],ne=q.isMaster!==!1;return e.jsx(i,{sx:{display:"flex",gap:1},children:ne?e.jsxs(e.Fragment,{children:[q.status==="rejected"&&e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:P=>{P.stopPropagation()},children:n("federated.status.rejected")}),q.status==="revoked"&&e.jsx(z,{variant:"contained",color:"secondary",size:"small",onClick:P=>{P.stopPropagation()},children:n("federated.status.revoked")})]}):e.jsxs(e.Fragment,{children:[e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:P=>{P.stopPropagation(),h(q)},children:n("federated.quitMember")},"quiteSite"),q.status==="pending"&&e.jsx(z,{variant:"contained",color:"primary",size:"small",onClick:P=>{P.stopPropagation(),w(q)},children:n("federated.status.pending")},"auditSite"),q.status==="approved"&&e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:P=>{P.stopPropagation(),s(q)},style:{whiteSpace:"nowrap"},children:n("federated.revoke")},"revokeSite"),q.status==="revoked"&&e.jsx(z,{variant:"contained",color:"warning",size:"small",onClick:P=>{P.stopPropagation(),I(q)},style:{whiteSpace:"nowrap"},children:n("federated.approve")},"approveSite")]})})}}}),T},[l.appId,f,j,n]),m=H(()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(T,{dataIndex:C}){const q=f[C];g(q)}}),[]),A=u(()=>{const T=r.environments.find(C=>C.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL);T?.value?c.current?.open({link:T.value}):B.error(n("federated.failedToGetFederatedLoginLink"))},[r.site?.domainAliases?.[0]?.href]),_=u(()=>{a.open({title:n("federated.quitFederatedLogin"),content:n("federated.quitFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(T){await d.quitFederatedLogin({input:{did:r.appPid}}),T()}})}),re=u(()=>{a.open({title:n("federated.disbandFederatedLogin"),content:n("federated.disbandFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(T){await d.disbandFederatedLogin({input:{did:r.appPid}}),T()}})}),Te=u(async()=>{try{S.loadingSync=!0,await Promise.all([await d.syncFederatedConfig({input:{did:r.appPid}}),_e(500)]),B.success(n("common.succeeded"))}finally{S.loadingSync=!1}}),$=[];return v.status!=="pending"&&$.push(e.jsx(ce,{title:n("federated.syncConfig"),children:e.jsx(le,{size:"small",onClick:Te,disabled:S.loadingSync,sx:[{"@keyframes spin":{from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}},S.loadingSync?{animation:"spin 1s linear infinite"}:{}],children:e.jsx(X,{icon:vt,style:{fontSize:24}})},"syncConfig")})),b==="master"?($.push(e.jsx(z,{size:"small",variant:"contained",onClick:A,sx:{ml:1},children:n("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),$.push(e.jsx(z,{color:"error",size:"small",variant:"contained",onClick:re,sx:{ml:1},children:n("federated.disbandFederatedLogin")},"disbandFederatedLogin"))):$.push(e.jsx(z,{size:"small",variant:"contained",color:"error",onClick:_,sx:{ml:1},children:n("federated.quitFederatedLogin")},"quitFederatedLogin")),e.jsxs(e.Fragment,{children:[e.jsx(Ne,{className:"main-table",locale:o,data:f,columns:L,customButtons:$,title:e.jsx(i,{className:"table-toolbar-left",children:n("oauth.federated")}),options:m}),p,e.jsx(Se,{ref:c}),e.jsx(Ae,{ref:t})]})}Pe.propTypes={mode:E.oneOf(["member","master"])};function ze({ref:b=null}){const{t:c}=D.useContext(K),{api:t}=N(),{blocklet:n}=M(),o=n?.appPid,x=ye()?.transitions?.duration?.leavingScreen||300,a=ae({loading:!1,show:!1,appUrl:"",appUrlError:"",callback:Q}),p=u(()=>{a.appUrl="",a.appUrlError="",a.callback=Q}),d=u(()=>{a.show=!1,setTimeout(()=>{p()},x)}),f=u((v=Q)=>{a.show=!0,a.callback=v});D.useImperativeHandle(b,()=>({open:f,close:d}),[f,d]);const l=u(v=>{if(!v)throw new Error(c("federated.federatedJoinAppUrlRequired"));if(!Qe(v))throw new Error(c("federated.federatedJoinAppUrlInvalid"))}),j=u(async()=>{try{l(a.appUrl),a.loading=!0;const v=await t.joinFederatedLogin({input:{did:o,appUrl:a.appUrl}});a.show=!1,d(),a?.callback(v)}catch(v){a.appUrlError=v.message}finally{a.loading=!1}});return e.jsxs(ke,{open:a.show,title:c("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:e.jsxs(z,{color:"primary",autoFocus:!0,variant:"contained",onClick:j,disabled:a.loading,children:[a.loading?e.jsx(be,{size:16,sx:{mr:1},color:"grey"}):null,c("common.confirm")]}),children:[e.jsx(i,{sx:{mb:1},children:c("federated.joinFederatedLoginDescription")}),e.jsx(F,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:c("federated.federatedJoinAppUrl"),label:c("federated.federatedJoinAppUrl"),value:a.appUrl,error:!!a.appUrlError,helperText:a.appUrlError||"eg: https://www.arcblock.io",onChange:v=>{a.appUrl=v.target.value}})]})}ze.propTypes={ref:E.any};function wt(){const{t:b}=D.useContext(K);return e.jsxs(W,{direction:"row",spacing:2,sx:{alignItems:"flex-start",p:2},children:[e.jsx(Je,{fontSize:"large",color:"primary"}),e.jsxs(i,{children:[e.jsx(Y,{variant:"h6",gutterBottom:!0,children:b("federated.title")}),e.jsx(Y,{variant:"body2",sx:{color:"text.secondary"},children:b("federated.description")}),e.jsx(Ke,{href:"https://www.arcblock.io/blog/zh/did-connect-federated-login-support",underline:"hover",variant:"body2",color:"primary",target:"_blank",sx:{display:"inline-flex",alignItems:"center",mt:1},children:b("federated.link")})]})]})}function St(){const b=D.useRef(null),c=D.useRef(null),{t}=D.useContext(K),{blocklet:n,actions:{refreshBlocklet:o}}=M(),r=u(()=>{const a=n.site?.domainAliases?.[0]?.href;if(a)try{const p=new URL(a);b.current?.open({link:p.origin})}catch{B.error(t("federated.failedToGetFederatedLoginLink"))}},[n.site?.domainAliases?.[0]?.href]),x=u(()=>{c.current?.open(()=>{o()})});if(n.settings.federated?.sites.length>0){const a=n.settings.federated?.config.isMaster!==!1;return e.jsx(Pe,{mode:a?"master":"member"})}return e.jsxs(e.Fragment,{children:[e.jsx(i,{sx:{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px"},children:e.jsxs(i,{sx:{maxWidth:400,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsx(wt,{}),e.jsx(oe,{sx:{width:1}}),e.jsxs(W,{sx:{width:1,p:2,gap:1.5},children:[e.jsx(z,{variant:"contained",onClick:r,sx:{width:1},children:t("federated.inviteJoinFederatedLogin")}),e.jsx(z,{variant:"outlined",onClick:x,sx:{width:1},children:t("federated.joinFederatedLogin")})]})]})}),e.jsx(Se,{ref:b}),e.jsx(ze,{ref:c})]})}function Tt({orientation:b="horizontal"}){const{t:c}=D.useContext(K),t=lt({key:"lg"}),n=[{label:e.jsx(i,{sx:{textAlign:"center",width:"100%"},children:c("oauth.commonSettings")}),value:"settings"},{label:e.jsx(i,{sx:{textAlign:"center",width:"100%"},children:c("oauth.federated")}),value:"federated"},{label:e.jsx(i,{sx:{textAlign:"center",width:"100%"},children:c("oauth.oauth")}),value:"oauth"},{label:e.jsx(i,{sx:{textAlign:"center",width:"100%"},children:c("oauth.moreLogin")}),value:"more"}],[o,r]=D.useState(n[0].value),x=H(()=>({oauth:e.jsx(gt,{}),federated:e.jsx(St,{}),more:e.jsx($e,{children:c("oauth.comingSoon")}),settings:e.jsx(jt,{})}),[c]);return b==="vertical"?e.jsx(It,{children:e.jsxs(W,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(i,{sx:{minWidth:"240px",flexShrink:0},children:e.jsx(Ie,{tabs:n,current:o,orientation:t?"horizontal":"vertical",onChange:r,sx:{borderRight:t?0:1,height:"100%",borderColor:"divider"}})}),e.jsx(i,{sx:{flexGrow:1,minWidth:0},children:e.jsx(i,{sx:{maxWidth:"1200px"},children:x[o]})})]})}):e.jsxs(i,{children:[e.jsx(Ie,{tabs:n,current:o,onChange:r}),e.jsx(i,{sx:{marginTop:"10px"},children:x[o]})]})}Tt.propTypes={orientation:E.oneOf(["horizontal","vertical"])};const It=Fe.div`
|
|
42
|
-
.MuiTab-root {
|
|
43
|
-
text-align: left;
|
|
44
|
-
align-items: flex-start;
|
|
45
|
-
font-weight: normal;
|
|
46
|
-
|
|
47
|
-
div {
|
|
48
|
-
text-align: left;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.Mui-selected {
|
|
53
|
-
font-weight: bold;
|
|
54
|
-
}
|
|
55
|
-
`;export{Tt as default};
|