@abtnode/blocklet-services 1.16.46-beta-20250706-075512-de1b046b → 1.16.46-beta-20250709-071942-1f57b2b8
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/libs/image.js +10 -2
- package/api/routes/user.js +1 -2
- package/dist/assets/{AdapterDayjs-XSKQGIOn.js → AdapterDayjs-BeqEJUig.js} +1 -1
- package/dist/assets/{Google-DEJzh5qu.js → Google-C8DG_mDp.js} +3 -3
- package/dist/assets/{access-control-BCwE1yaW.js → access-control-X_NlM1AQ.js} +1 -1
- package/dist/assets/{actions-C2acYZqU.js → actions-DK8uxYzD.js} +1 -1
- package/dist/assets/{add-component-core-BFbARhO9.js → add-component-core-BNm8Sohm.js} +1 -1
- package/dist/assets/add-resource-DbjUjkxV.js +1 -0
- package/dist/assets/{addon-DTMrz0XJ.js → addon-BkZEzLfU.js} +1 -1
- package/dist/assets/{advanced-C6q3rX82.js → advanced-Bmq6xQB4.js} +1 -1
- package/dist/assets/api-CpYSt0CS.js +1 -0
- package/dist/assets/{appearance-Cb9WLLnL.js → appearance-CI7tP4v7.js} +1 -1
- package/dist/assets/{arrow-down.svg-ChoF_uzO.js → arrow-down.svg-DR5noAvr.js} +1 -1
- package/dist/assets/{audit-logs-tRP7Ir6c.js → audit-logs-Bbodpxwp.js} +1 -1
- package/dist/assets/{authorize-CKa1qwqR.js → authorize-osbNauSJ.js} +1 -1
- package/dist/assets/{base-chart-DN6icVvl.js → base-chart-BGpAbSkc.js} +1 -1
- package/dist/assets/{base32-BCg8oKIC.js → base32-vvndof6f.js} +1 -1
- package/dist/assets/branding-9qaGpptV.js +40 -0
- package/dist/assets/{branding-Cr2G9cD7.js → branding-QpFA5gHx.js} +6 -6
- package/dist/assets/{bundle-avatar-Xp52QSf2.js → bundle-avatar-D1U8n6sJ.js} +1 -1
- package/dist/assets/button-n_0p8lJU.js +1 -0
- package/dist/assets/{click-to-copy-CT3GMLFE.js → click-to-copy-B6s5Z4cq.js} +1 -1
- package/dist/assets/{cloneDeep-C4F9EbDd.js → cloneDeep-wCAABKRh.js} +1 -1
- package/dist/assets/{collapse-cchwlIcj.js → collapse-BWjaTK3Y.js} +1 -1
- package/dist/assets/{complete-R8Z3eD81.js → complete-B3LQtNHp.js} +1 -1
- package/dist/assets/{component-CMmOvKYP.js → component-CyoK1wFU.js} +3 -3
- package/dist/assets/{config-BV6XReOP.js → config-BgvCY9yW.js} +1 -1
- package/dist/assets/{config-Drzui8W3.js → config-Bl2vLfGW.js} +1 -1
- package/dist/assets/{config-navigation-lVp-1ugd.js → config-navigation-DcBcxC77.js} +3 -3
- package/dist/assets/{config-space-D9QgW6OB.js → config-space-D2PSYekl.js} +1 -1
- package/dist/assets/{confirm-CDf7UR9D.js → confirm-DAb9dboO.js} +1 -1
- package/dist/assets/{connect-Bnz0r5Wi.js → connect-Ca67d-kp.js} +1 -1
- package/dist/assets/{connect-Dy-g9TU9.js → connect-geHS1TpW.js} +1 -1
- package/dist/assets/{connect-to-sTkrNSP4.js → connect-to-2xYBexsb.js} +1 -1
- package/dist/assets/{content-layout-C0J5I0TX.js → content-layout-U_bmDcVP.js} +1 -1
- package/dist/assets/{createClass-CBJCc0i0.js → createClass-geNigj02.js} +1 -1
- package/dist/assets/{dashboard-D2WUGp4d.js → dashboard-DUhl5uLq.js} +3 -3
- package/dist/assets/{delete-confirm-Db5_a_ND.js → delete-confirm-DxvPCnQ2.js} +1 -1
- package/dist/assets/{did-address-6ebqvNNq.js → did-address-COwwd6H0.js} +1 -1
- package/dist/assets/{domain-D3NSNHzA.js → domain-DsyzZKaj.js} +1 -1
- package/dist/assets/{domain-action-card-XBKx5ZEq.js → domain-action-card-BHqkche3.js} +2 -2
- package/dist/assets/domains-JuDH24L8.js +1 -0
- package/dist/assets/{dot-DfSvSTo2.js → dot-DLj9aDwC.js} +1 -1
- package/dist/assets/{email-D9yKsyjd.js → email-ClGSUpWT.js} +1 -1
- package/dist/assets/{empty-spinner-DlvM3tDM.js → empty-spinner-Bi1Cb9b7.js} +1 -1
- package/dist/assets/engine-CR4ymPVp.js +1 -0
- package/dist/assets/{exchange-passport-Bi7Za8uz.js → exchange-passport-BUGi1VBV.js} +1 -1
- package/dist/assets/{form-Cv425yYf.js → form-zxAQYYnY.js} +1 -1
- package/dist/assets/{fuel-B8dyWYCs.js → fuel-BID4hifo.js} +1 -1
- package/dist/assets/{gen-access-key-CGYvJ1k7.js → gen-access-key-BTM6ukrq.js} +1 -1
- package/dist/assets/get-safe-url-BK7rZ--W.js +1 -0
- package/dist/assets/{home-DxujM2Op.js → home-B_RkpQaJ.js} +1 -1
- package/dist/assets/{iframe-BxB-nDw4.js → iframe-CubIsy36.js} +1 -1
- package/dist/assets/{index-If1MEgvU.js → index-45FYp8zC.js} +2 -2
- package/dist/assets/{index-CK4-I4Dt.js → index-AI8jHnw9.js} +5 -5
- package/dist/assets/{index-DIBGQQQm.js → index-BUEUadKA.js} +4 -4
- package/dist/assets/{index-B0xpDUsO.js → index-BVAv5IrJ.js} +6 -6
- package/dist/assets/{index-f_f4wJSK.js → index-BXjxtue_.js} +1 -1
- package/dist/assets/{index-Dy-MET-d.js → index-BiGUf0JP.js} +1 -1
- package/dist/assets/{index-DRLhEfAl.js → index-BsTbYUnM.js} +1 -1
- package/dist/assets/{index-DNQJZcPj.js → index-Bst-lasJ.js} +2 -2
- package/dist/assets/{index-CYFNAQl1.js → index-Bzd_F7Ms.js} +1 -1
- package/dist/assets/{index-BLIgZ0kx.js → index-C-yjHI_C.js} +6 -6
- package/dist/assets/{index-DuEs5obm.js → index-C0PfwuMR.js} +1 -1
- package/dist/assets/{index-C35qnTxV.js → index-C7l3rSL2.js} +1 -1
- package/dist/assets/{index-Cwk7U-s7.js → index-C9VaBr_O.js} +1 -1
- package/dist/assets/index-C_rFfbiq.js +1 -0
- package/dist/assets/{index-BpkAJRJ3.js → index-CpryIQED.js} +1 -1
- package/dist/assets/{index-fy1uK_IR.js → index-CrE4cEyN.js} +1 -1
- package/dist/assets/{index-BFT0qxie.js → index-Cs4ZeTTW.js} +1 -1
- package/dist/assets/{index-DjfjJ3Fo.js → index-CuOPtgTg.js} +1 -1
- package/dist/assets/{index-Iv2oisWn.js → index-D-Q3LAn6.js} +1 -1
- package/dist/assets/{index-GF3HOour.js → index-D3YocLxi.js} +1 -1
- package/dist/assets/{index-BfwIRDCT.js → index-Dcvh9y_X.js} +1 -1
- package/dist/assets/{index-CMkvpy46.js → index-Dk6JQKfz.js} +1 -1
- package/dist/assets/index-Ds6nmMCe.js +113 -0
- package/dist/assets/{index-COypY_9V.js → index-Dtcv_nT6.js} +12 -12
- package/dist/assets/{index-LLcbh8Mm.js → index-SJzJLNlA.js} +1 -1
- package/dist/assets/{index-PN2leRF6.js → index-TG8FK0pk.js} +3 -3
- package/dist/assets/{index-DbIUA2zH.js → index-Wo9AdN6Y.js} +1 -1
- package/dist/assets/{index-Cm7r5rvw.js → index-XuUrUf8b.js} +6 -6
- package/dist/assets/{index-JZtXFT6r.js → index-ZnnRM00W.js} +1 -1
- package/dist/assets/{index-Bu80qBT0.js → index-_X8imDSe.js} +12 -12
- package/dist/assets/{index-CWV__hd3.js → index-yMf5L8qr.js} +1 -1
- package/dist/assets/{invitation-B34gciAx.js → invitation-fbTXYMgC.js} +1 -1
- package/dist/assets/{invite-ByfXPpkh.js → invite-D1p1pcY6.js} +1 -1
- package/dist/assets/{issue-passport-CF7kjIha.js → issue-passport-b9pA_OcP.js} +1 -1
- package/dist/assets/{item-CT17goAk.js → item-c7_gTBTX.js} +1 -1
- package/dist/assets/{landing-page-8lE7kpfr.js → landing-page-CPsYV1SX.js} +1 -1
- package/dist/assets/{launch-result-message-B0akHCFQ.js → launch-result-message-CDvcIXJ3.js} +1 -1
- package/dist/assets/{layout-Df4ylgze.js → layout-DkHZoXcQ.js} +1 -1
- package/dist/assets/list-BOhlf5Oo.js +2 -0
- package/dist/assets/{list-header-BbJpGLxs.js → list-header-Bcr2R_3c.js} +1 -1
- package/dist/assets/{list-BqjxSFj_.js → list-kq8swRwp.js} +1 -1
- package/dist/assets/localization-CZzoT5xp.js +1 -0
- package/dist/assets/{log-B8snR1zU.js → log-CZOcHiO-.js} +1 -1
- package/dist/assets/logger-69zTMQoL.js +1 -0
- package/dist/assets/{login-LEjGUnmy.js → login-CMyDCkH6.js} +1 -1
- package/dist/assets/{login-oauth-callback-VnZviVo0.js → login-oauth-callback-BN9Asi_d.js} +1 -1
- package/dist/assets/{logo-uploader-C_Xk3axk.js → logo-uploader-BeGnMM3a.js} +5 -5
- package/dist/assets/{lost-passport-D6MwfL4M.js → lost-passport--Rxl4BIv.js} +1 -1
- package/dist/assets/{omit-LyexeK2n.js → omit-C6lXG4Q2.js} +1 -1
- package/dist/assets/{open-window-BVAimsZ8.js → open-window-DmgdhkjX.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-DjR5rU46.js → over-due-invoice-payment-azmcP3Sx.js} +1 -1
- package/dist/assets/{overview-Dr0GLBll.js → overview-Chm9UqJe.js} +1 -1
- package/dist/assets/{page-header-Dhv5B-BX.js → page-header-a5Qh5Tr1.js} +1 -1
- package/dist/assets/{passport-item-Cvgw81pu.js → passport-item-Byi-8gTO.js} +1 -1
- package/dist/assets/{permission-CKmU8Z_5.js → permission-tBQugdD0.js} +1 -1
- package/dist/assets/preferences-DI-hndOF.js +1 -0
- package/dist/assets/profile-embed-hoDmZwiP.js +1 -0
- package/dist/assets/publish-resource-CEjwTzjC.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-C53HbB7P.js → react-beautiful-dnd.esm-rTL6rgJs.js} +1 -1
- package/dist/assets/{react-stripe.esm-DdI1E_2N.js → react-stripe.esm-D_PEjY7V.js} +1 -1
- package/dist/assets/{runtime-Bjcp30CT.js → runtime-qJ1PldRM.js} +1 -1
- package/dist/assets/{sanitize-Be9_TGIg.js → sanitize-12ijS2UQ.js} +1 -1
- package/dist/assets/sdk-Dl0rUz88.js +1 -0
- package/dist/assets/{section-Be6GDkk8.js → section-76c1fWcb.js} +1 -1
- package/dist/assets/{security-DYUzNKac.js → security-m1Vf67My.js} +1 -1
- package/dist/assets/{session-Bj1hMOts.js → session-CFTmeC0_.js} +1 -1
- package/dist/assets/setup-w1nCUnw5.js +30 -0
- package/dist/assets/{shorten-label-Ba-bmb_4.js → shorten-label-CqCkrOW-.js} +1 -1
- package/dist/assets/{simple-select-CGk0N_bX.js → simple-select-BtDvaDm3.js} +1 -1
- package/dist/assets/{spaces-C1fb5NDx.js → spaces--oE74hBj.js} +1 -1
- package/dist/assets/{start-wlEhUSyq.js → start-DQqIgvdd.js} +1 -1
- package/dist/assets/{starting-progress-IzrgfSED.js → starting-progress-Bq_gQVhf.js} +1 -1
- package/dist/assets/{status-CwzJOHQ-.js → status-Bj5PpxMp.js} +1 -1
- package/dist/assets/{step-actions-DZNamIJE.js → step-actions-BZsA_oSN.js} +1 -1
- package/dist/assets/{studio-CMWQYNVG.js → studio-CRXYSEnV.js} +1 -1
- package/dist/assets/{switch-control-Z293FB2U.js → switch-control-Cd3QShYo.js} +1 -1
- package/dist/assets/{table-tips-GxhBg0e3.js → table-tips-CMqGfw3-.js} +1 -1
- package/dist/assets/{traffic-CbhaWm03.js → traffic-PJIhaYTG.js} +1 -1
- package/dist/assets/{transfer-B5jo0mhi.js → transfer-B9hKmCer.js} +1 -1
- package/dist/assets/{unsubscribe-CQgLMQmM.js → unsubscribe-By-fRglQ.js} +1 -1
- package/dist/assets/{use-blocklet-logo-BKc9E-_L.js → use-blocklet-logo-CudOf_wh.js} +1 -1
- package/dist/assets/{use-mobile-BmXUeM1i.js → use-mobile-BgklPLaO.js} +1 -1
- package/dist/assets/{use-mobile-DspJgIrG.js → use-mobile-BkNZycG6.js} +1 -1
- package/dist/assets/{use-server-logo-7qMC4vqP.js → use-server-logo-DZ_rNHFu.js} +1 -1
- package/dist/assets/{useAsync-COkfundQ.js → useAsync-CaAq0Gts.js} +1 -1
- package/dist/assets/{useAsync-fxvoN33w.js → useAsync-Ct43XAf7.js} +1 -1
- package/dist/assets/{useLocalStorage-DvM3QMYe.js → useLocalStorage-C30Mdv9U.js} +1 -1
- package/dist/assets/user-center-CxUqWFNC.js +126 -0
- package/dist/assets/{user-center-BAHrlllm.js → user-center-coYNhbvf.js} +3 -3
- package/dist/assets/{user-sessions-DVo9LBeI.js → user-sessions-C5THsvtE.js} +1 -1
- package/dist/assets/{util-fjAejugL.js → util-Ba52lfC5.js} +1 -1
- package/dist/assets/{util-C6EYY0RW.js → util-DakLk8kj.js} +1 -1
- package/dist/assets/{vendor-arcblock-D026EX-Z.js → vendor-arcblock-DKbvje4v.js} +1 -1
- package/dist/assets/{vendor-hooks-CFpNP5Ql.js → vendor-hooks-CwHgeAuk.js} +1 -1
- package/dist/assets/{vendor-mui-core-BWI0_sKe.js → vendor-mui-core-Bz-X9hX7.js} +1 -1
- package/dist/assets/{vendor-mui-x-Bwa_JtSa.js → vendor-mui-x-Cgnunrow.js} +1 -1
- package/dist/assets/{vendor-utils-Vke2d2wu.js → vendor-utils-CtD44yV-.js} +2 -2
- package/dist/assets/vendor-ux-BArADSzA.js +1568 -0
- package/dist/assets/{wrap-locale-CVw8KKu9.js → wrap-locale-ChQwQuJk.js} +1 -1
- package/dist/assets/{zh-BAK9QZ79.js → zh-Bg0MRqOX.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/service-worker.js +1 -1
- package/package.json +37 -37
- package/dist/assets/add-resource-DOrkE3yq.js +0 -1
- package/dist/assets/api-B7LEhzE2.js +0 -1
- package/dist/assets/branding-BfFZn4oO.js +0 -40
- package/dist/assets/button-V9BmeTRn.js +0 -1
- package/dist/assets/domains-DDnUseHb.js +0 -1
- package/dist/assets/engine-CqzMzhBR.js +0 -1
- package/dist/assets/get-safe-url-HSOeeYs_.js +0 -1
- package/dist/assets/index-BGsWoTbW.js +0 -113
- package/dist/assets/index-CeqM1ZpW.js +0 -1
- package/dist/assets/index-qmAWfCpk.js +0 -5
- package/dist/assets/list-yWg6vRtr.js +0 -2
- package/dist/assets/localization-CJcbV1c6.js +0 -1
- package/dist/assets/logger-BwL8cVCo.js +0 -1
- package/dist/assets/preferences-CojjhPk8.js +0 -1
- package/dist/assets/profile-embed-CzLWocm3.js +0 -1
- package/dist/assets/publish-resource-CCEV3Bm_.js +0 -1
- package/dist/assets/sdk-BI2up0A5.js +0 -1
- package/dist/assets/setup-D_EJHnh2.js +0 -30
- package/dist/assets/user-center-C8GAilfL.js +0 -81
- package/dist/assets/vendor-ux-DVPR2iDY.js +0 -1564
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import{g as Bt,r as v}from"./vendor-react-x2lQvn4m.js";import{j as e,ak as y,G as Z,b6 as me,bb as qe,E as V,am as ut,d3 as Wt,bi as qt,at as ae,b1 as mt,$ as h,T as ee,Y as Ye,d4 as pt,b5 as Ke,C as Me,V as Fe,d5 as Ge,aN as Ue,p as ft,J as ht,a8 as xt,d6 as Kt,ac as gt,d7 as Mt,d8 as Ut,bY as st,n as Ht,D as $t,bu as Vt,M as it,cB as Yt,I as Gt,d9 as Jt}from"./vendor-mui-core-BWI0_sKe.js";import{A as bt,J as Xt,C as Zt,c as le,F as Qt,a4 as je}from"./vendor-utils-Vke2d2wu.js";import{T as te,H as M,n as ce,b as en,j as jt,Z as tn,ar as nn,$ as vt,C as yt,as as ke,a as St,z as sn,L as an}from"./vendor-ux-DVPR2iDY.js";import{bj as rn,_ as Je,Y as Ct,aN as Rt,F as _e,c as _,ad as Q,p as on,aE as at}from"./index-B0xpDUsO.js";import{g as ye,a as $,f as se}from"./vendor-hooks-CFpNP5Ql.js";import{u as wt,C as J}from"./index.esm-BONQrRCU.js";import{o as He,j as ln,d as cn,N as dn}from"./use-blocklet-logo-BKc9E-_L.js";import{S as X}from"./section-Be6GDkk8.js";import{A as un,a as mn,b as pn}from"./collapse-cchwlIcj.js";import{S as Se}from"./shorten-label-Ba-bmb_4.js";import{v as Tt}from"./index-Dy-MET-d.js";import{R as Nt,A as fn,S as hn,a as xn,B as gn}from"./list-BqjxSFj_.js";import{W as bn}from"./did-address-6ebqvNNq.js";import{p as It}from"./util-C6EYY0RW.js";import{D as jn,g as vn}from"./traffic-CbhaWm03.js";import{B as Et}from"./bundle-avatar-Xp52QSf2.js";import{u as yn}from"./use-mobile-BmXUeM1i.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D026EX-Z.js";import"./session-Bj1hMOts.js";import"./server-logo-notext.svg-BqCXmsOm.js";import"./index-JZtXFT6r.js";import"./base32-BCg8oKIC.js";import"./dot-DfSvSTo2.js";import"./useAsync-fxvoN33w.js";import"./iframe-BxB-nDw4.js";import"./index-DRLhEfAl.js";import"./index-DBs9Ljax.js";import"./base-chart-DN6icVvl.js";import"./index-DbIUA2zH.js";import"./vendor-mui-x-Bwa_JtSa.js";import"./AdapterDayjs-XSKQGIOn.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=Bt(wn),ze={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Nn(){const{api:n}=Je(),{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:bt(b,Object.keys(ze))}),S=ye({testReceiver:"",testReceiverError:""}),j=N("enabled"),E=$(async(a,T,O=!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),O&&M.success(t("oauth.saveSuccess"))}catch(D){if(O)M.error(D.message||t("oauth.saveFailed"));else throw D}}),Y=$(async(a,T,O)=>{try{i.isDirty&&await E(a,T,!1),await n.sendEmail({input:{did:l,receiver:O,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:O=>{S.testReceiver=O.target.value},error:!!S.testReceiverError,helperText:S.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(O){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 Y(a,T,D),O()}})}),F=$(a=>{const T=a?.trim();return T?_e(T)?!0:t("notification.email.fromInvalid"):t("notification.email.fromRequired")}),W=$(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")),q=$(a=>a?.trim()?!0:t("notification.email.userRequired")),K=$(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(J,{name:"enabled",control:p,render:({field:a})=>e.jsx(me,{control:e.jsx(qe,{checked:a.value,...a})})})}),e.jsx(X,{title:t("notification.email.from"),children:e.jsx(J,{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(J,{name:"host",control:p,rules:{validate:j?W: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(J,{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(J,{name:"user",control:p,rules:{validate:j?q: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(J,{name:"password",control:p,rules:{validate:j?K: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(J,{name:"secure",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(me,{control:e.jsx(qe,{checked:a.value,...a,disabled:!j})})})})}),e.jsxs(un,{children:[e.jsxs(mn,{expandIcon:e.jsx(qt,{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(Wt,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(pn,{children:[e.jsx(X,{title:t("notification.email.companyName"),children:e.jsx(J,{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(J,{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(J,{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(J,{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)``,Be={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function En(){const{api:n}=Je(),{blocklet:s}=Ct(),{t}=te(),{confirmApi:r,confirmHolder:o}=Rt(),l=s?.meta?.did,b=Object.assign({...Be},s?.settings?.notification?.pushKit||{}),{handleSubmit:u,control:p,formState:i,watch:N,reset:I}=wt({defaultValues:bt(b,Object.keys(Be))}),S=ye({testReceiver:"",testReceiverError:""}),j=N("enabled"),E=$(async(R,q,K=!0)=>{try{const{blocklet:f}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:R})}}),w=Object.assign({...Be},f?.settings?.notification?.pushKit||{});I(w),K&&M.success(t("oauth.saveSuccess"))}catch(f){if(K)M.error(f.message||t("oauth.saveFailed"));else throw f}}),Y=$(async(R,q)=>{try{i.isDirty&&await E(R,q,!1);const K=(s?.configs||[]).find(C=>C.key==="BLOCKLET_APP_URL")?.value,f=Xt(Zt(K,_.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(K){M.error(K.message||t("notification.pushKit.testfailed"))}}),z=$((R,q)=>{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:K=>{S.testReceiver=K.target.value},error:!!S.testReceiverError,helperText:S.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(K){if(!S.testReceiver?.trim()){S.testReceiverError=t("notification.pushKit.receiverRequired");return}S.testReceiverError="",await Y(R,q),K()}})}),F=$(R=>{const q=R?.trim();return q?He(q)?!0:t("notification.pushKit.endpointInvalid"):t("notification.pushKit.endpointRequired")}),W=$(()=>!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(J,{name:"enabled",control:p,render:({field:R})=>e.jsx(me,{control:e.jsx(qe,{checked:R.value,...R})})})}),e.jsx(X,{title:t("notification.pushKit.endpoint"),children:e.jsx(J,{name:"endpoint",control:p,rules:{validate:j?F:W},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(J,{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(J,{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 kn(){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(jt,{tabs:ct,current:n,onChange:s}),e.jsx(y,{style:o,children:r[n]})]})}const At=v.createContext({}),{Provider:On,Consumer:Fs}=At;function Dn({children:n,blocklet:s=""}){const{api:t,inService:r,ws:{useSubscription:o}}=Je(),[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]),Y=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,...O}=a;let D="";T&&T.includes("system")&&(D="system");const re=T?T.filter(pe=>pe!=="system"):[],ue={...O,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]),W=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]),q=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)&&Y(S)},[E,S]),o(_.EVENTS.NOTIFICATION_BLOCKLET_CREATE,f=>{E.has(f.id)||Y(S)},[E,S]);const K={fetch:Y,data:l,paging:u,blocklet:s,getComponent:F,resendNotification:W,getUser:R,componentDids:N,getReceivers:q,inService:r,teamDid:i};return e.jsx(On,{value:{notificationRecords:K},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 kt(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"],Ot=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:Ot(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)}),Bn=n=>({enabled:le(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(s=>{setTimeout(()=>{s()},n*1e3)}),Wn=(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},qn=(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},Oe=(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},Kn=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=kt(r,o,{status:l});return e.jsx(Ye,{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(Ke,{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 We(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=kt(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(Ge,{}),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(Ye,{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(Ke,{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(Ke,{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(()=>xt(l,Lt()),[l]),{getReceivers:u,inService:p,teamDid:i,getUser:N,blocklet:I}=Xe(),[S,j]=v.useState(!1),[E,Y]=v.useState([]),z=ye({anchorEl:null,position:null}),F=ye({anchorEl:null,position:null}),[W,R]=v.useState(null),[q,K]=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"}],O=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)}}));Y(d),K(c.paging),j(!1)}catch(c){M.error(c.message),j(!1)}};v.useEffect(()=>{O()},[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(Ge,{}),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:q.page-1,rowsPerPage:q.pageSize,count:q.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:k})=>{const[,U=[],ne=[],G=[]]=k;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(G,f.emailSendStatus)||w(H=>({...H,emailSendStatus:G,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"?Bn(m):!0:!1},[N,I]),Re=v.useCallback(c=>Wn(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,k="")=>{if(!(!d.length||!c.length))try{s(c,d,m,k),F.anchorEl||(await Ee(.5),fe())}catch(U){console.error("handleResend error",{error:U})}},x=async({channels:c,isResendFailedOnly:d})=>{const m=C.map(k=>E[k].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(k){M.error(k.response?k.response.statusText:k.message)}},L=async(c,d,m,k=[],U=!0)=>{if(c.stopPropagation(),qn(d,m)>=4){M.warning(r("notification.resendLimit"));return}if(!Ve.includes(m)){await A(d,k,U);return}if(c){const G=c.currentTarget,H=G.getBoundingClientRect();z.anchorEl=G,z.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}R({channel:m});try{const G=await pe(m,d.receiver);await Ee(1),R({channel:m,result:G}),(typeof G=="boolean"&&G||Qt(G)&&Object.values(G).every(H=>!!H))&&(await s([m],[d.receiver],U),F.anchorEl||(await Ee(.5),fe()))}catch(G){M.error(G.message)}},B=c=>{w(d=>({...d,dateRange:c,page:1}))},P=(c,d,m,k)=>{c.stopPropagation();const U=m.filter(ne=>ne!==d);w(ne=>({...ne,[k]: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:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,k)=>e.jsx(We,{label:"Wallet",filterList:c,onChange:d,index:m,column:k,filterValues:T})},customBodyRenderLite:c=>{const{walletSendStatus:d,walletSendAt:m,walletSendFailedReason:k}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:k,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:k}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:k,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:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,k)=>e.jsx(We,{label:"Push Kit",filterList:c,onChange:d,index:m,column:k,filterValues:T})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{emailSendStatus:d,emailSendAt:m,emailSendFailedReason:k}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:k,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:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,k)=>e.jsx(We,{label:"Email",filterList:c,onChange:d,index:m,column:k,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[k,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:k},k),e.jsx(xe,{status:ne.status,updatedAt:ne.sendAt,reason:ne.failedReason,channel:"webhook",onResend:G=>L(G,E[c],"webhook",[k],!1)})]},k)})}}},{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:B},"date-picker"),e.jsx(ce,{variant:"contained",size:"small",color:"primary",loading:S,startIcon:e.jsx(Kt,{}),onClick:()=>O(),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(gt,{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:[W?.channel," Checking"]}),e.jsx(y,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:Re(W?.channel).map(c=>{const{type:d,pass:m,fail:k}=c;return!W?.result||W?.result?.[d]?e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:W?.result?.[d]?ke.success.main:"inherit"},children:[W?.result?e.jsx(Mt,{}):e.jsx(ft,{size:12,sx:{color:ke.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:ke.error.main},children:[e.jsx(Ut,{}),e.jsx("span",{children:k})]},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 Yn(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=Kn(n),N=t?b.length:b,I=t?u.length:u,S=t?p.length:p,j=async F=>{F.stopPropagation();const W=t?[...new Set([...b,...u].map(R=>R))]:[];await r([n],[],!0,W)},E=N+I,Y=E>0?N/E*100:0,z=E>0?I/E*100:0;return e.jsxs(Gn,{successRatio:Y,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(Ge,{}),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):Yn(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 Gn=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 O=[...f];if(O.includes(_.NOTIFICATION_SEND_CHANNEL.PUSH)&&!Dt(t)&&(M.warning(o("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),O=O.filter(D=>D!==_.NOTIFICATION_SEND_CHANNEL.PUSH)),O.includes(_.NOTIFICATION_SEND_CHANNEL.EMAIL)&&!Ot(t)&&(M.warning(o("notification.sendStatus.reason.unavailable",{channel:"Email"})),O=O.filter(D=>D!==_.NOTIFICATION_SEND_CHANNEL.EMAIL)),!!O.length)try{i(!0),await u({notificationId:n.id,receivers:T,channels:O,resendFailedOnly:C,...O.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(()=>ln(n),[n]),E=se(()=>cn(n),[n]),Y=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(fn,{actors:Y,teamDid:z,size:32,showName:!0}):e.jsx(hn,{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(xn,{notification:n,blocklet:t}):e.jsx(dn,{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 W={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(W).map(({label:f,value:w})=>({label:f,value:w})),q=W[I.tab]||W.info,K=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(jt,{tabs:R,current:I.tab,onChange:K,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(q.component,{})]})]})})}const Jn=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: ${ke.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(Ye,{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(()=>xt(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(),Y=v.useRef(null),[z,F]=v.useState(null),[W,R]=v.useState("info"),q=yn(),[K,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()]}),O=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 B=A.filter(P=>P!==x);T(P=>({...P,[L]:B,page:1}))},ue=({page:g,rowsPerPage:x,filterList:A})=>{const[L=[],,,,B=[]]=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,B)||T(P=>({...P,severities:B,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=O.find(B=>(B.did||B.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:O,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:B=>e.jsx(y,{style:{overflow:"hidden",textOverflow:"ellipsis"},sx:{display:"flex",gap:1,alignItems:"center"},children:B.map(P=>{if(P==="system")return e.jsx("span",{children:s("notification.system")},P);const ie=O.find(we=>(we.did||we.meta?.did)===P);return e.jsx(Pe,{blocklet:ie,label:ie?.title||ie?.meta?.title},P)})}),onChange:B=>{g[A]=B.target.value,x(g[A],A,L)},children:[e.jsx(it,{value:"system",children:s("notification.system")}),O.map(B=>{const P=B.did||B.meta?.did;return e.jsx(it,{value:P,children:e.jsx(Pe,{blocklet:B,label:B.title||B.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(gn,{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(Yt,{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:B}=L,P=It(B.avatar,E,j);return e.jsx(vt,{alt:B.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:Oe},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(Gt,{onClick:()=>f(!0),sx:{p:q?0:void 0},children:e.jsx(Jt,{})},"settings"),q?e.jsx(ee,{children:s("common.setting")}):null]}),...n||[]];return e.jsxs(y,{ref:Y,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(ts,{children:e.jsx(gt,{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(Jn,{refresh:pe,onCancel:oe,notification:z,blocklet:i,tab:W}),e.jsx(St,{title:`${s("common.notification")} ${s("common.setting")}`,fullWidth:!0,maxWidth:"md",open:K,onClose:()=>f(!1),PaperProps:{style:{minHeight:"500px"}},children:e.jsx(y,{sx:{mt:"-16px",overflowY:"hidden"},children:e.jsx(kn,{})})})]})}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 +0,0 @@
|
|
|
1
|
-
import{j as t,at as r}from"./vendor-mui-core-BWI0_sKe.js";import{r as s}from"./vendor-react-x2lQvn4m.js";import{b as a}from"./vendor-ux-DVPR2iDY.js";import{t as n}from"./index-B0xpDUsO.js";import"./vendor-utils-Vke2d2wu.js";import"./vendor-hooks-CFpNP5Ql.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D026EX-Z.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,5 +0,0 @@
|
|
|
1
|
-
import{g as c}from"./vendor-react-x2lQvn4m.js";var n={exports:{}};/*!
|
|
2
|
-
Copyright (c) 2018 Jed Watson.
|
|
3
|
-
Licensed under the MIT License (MIT), see
|
|
4
|
-
http://jedwatson.github.io/classnames
|
|
5
|
-
*/var a;function p(){return a||(a=1,function(o){(function(){var f={}.hasOwnProperty;function e(){for(var t="",r=0;r<arguments.length;r++){var s=arguments[r];s&&(t=i(t,u(s)))}return t}function u(t){if(typeof t=="string"||typeof t=="number")return t;if(typeof t!="object")return"";if(Array.isArray(t))return e.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var r="";for(var s in t)f.call(t,s)&&t[s]&&(r=i(r,s));return r}function i(t,r){return r?t?t+" "+r:t+r:t}o.exports?(e.default=e,o.exports=e):window.classNames=e})()}(n)),n.exports}var l=p();const x=c(l);export{x as c};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Bu80qBT0.js","assets/index-B0xpDUsO.js","assets/vendor-mui-core-BWI0_sKe.js","assets/vendor-react-x2lQvn4m.js","assets/vendor-ux-DVPR2iDY.js","assets/vendor-utils-Vke2d2wu.js","assets/vendor-hooks-CFpNP5Ql.js","assets/lottie-web-4koyQiv_.js","assets/vendor-ux-DYcPPYq2.css","assets/vendor-arcblock-D026EX-Z.js","assets/index-DrVXX4fX.css","assets/index-MGxe3V9B.js","assets/index-qmAWfCpk.js","assets/index-DRYJ0xIl.js","assets/index-B5LvOF-F.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as b,a as be}from"./vendor-react-x2lQvn4m.js";import{T as D,H,_ as ye,$ as re,z as V,C as Ce,B as ve}from"./vendor-ux-DVPR2iDY.js";import{j as e,a1 as M,bB as K,I as X,aj as G,a3 as Y,b1 as q,T as I,ak as c,G as w,F as v,b7 as Te,b5 as le,b6 as ne,C as oe,a7 as J,aX as se,W as ae,V as z,p as Q,$ as n,am as we,cf as ce,cg as Se,c9 as Ie}from"./vendor-mui-core-BWI0_sKe.js";import{g as Re,a as Ee,l as Ae}from"./index-JZtXFT6r.js";import{u as ke}from"./dot-DfSvSTo2.js";import{r as We}from"./index-CMkvpy46.js";import{_ as B,c as k,Y as Ne}from"./index-B0xpDUsO.js";import{u as $}from"./dashboard-D2WUGp4d.js";import{u as ue,C as S}from"./index.esm-BONQrRCU.js";import{o as Pe,b as qe,C as te}from"./vendor-utils-Vke2d2wu.js";import{T as Oe}from"./index-f_f4wJSK.js";import{E as Le}from"./empty-spinner-DlvM3tDM.js";import{C}from"./click-to-copy-CT3GMLFE.js";import{D as _e}from"./delete-confirm-Db5_a_ND.js";import{a as ze}from"./passport-item-Cvgw81pu.js";import{A as Fe}from"./actions-C2acYZqU.js";import{T as ie}from"./table-tips-GxhBg0e3.js";import{u as De}from"./use-mobile-BmXUeM1i.js";import"./vendor-hooks-CFpNP5Ql.js";import"./lottie-web-4koyQiv_.js";import"./useAsync-fxvoN33w.js";import"./vendor-arcblock-D026EX-Z.js";import"./useLocalStorage-DvM3QMYe.js";import"./index-DBs9Ljax.js";import"./confirm-CDf7UR9D.js";import"./get-safe-url-HSOeeYs_.js";import"./session-Bj1hMOts.js";import"./use-blocklet-logo-BKc9E-_L.js";import"./useSetState-BWrXo9eH.js";import"./index-Cm7r5rvw.js";import"./over-due-invoice-payment-DjR5rU46.js";import"./use-mobile-DspJgIrG.js";import"./arrow-down.svg-ChoF_uzO.js";import"./vendor-mui-x-Bwa_JtSa.js";import"./AdapterDayjs-XSKQGIOn.js";import"./did-address-6ebqvNNq.js";import"./util-C6EYY0RW.js";import"./base32-BCg8oKIC.js";var de=We();const Be={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function pe({onCreated:r,onClose:a}){const[i,h]=b.useState(!1),{t:l,locale:o}=D(),{api:f}=B(),{teamDid:d}=$(),{control:y,handleSubmit:g,formState:{errors:u},watch:W,setValue:m}=ue({defaultValues:Be,mode:"onChange"}),T=W("scope"),R=s=>{s!=="profile:read"&&m("scope",T.includes(s)?T.filter(x=>x!==s):[...T,s])},N=async s=>{h(!0);try{const x={...s,redirectUris:s.redirectUris,contacts:s.contacts?s.contacts.split(",").map(A=>A.trim()):[],scope:s.scope.join(" ")};await f.createOAuthClient({input:{teamDid:d,input:Pe(x,qe)}}),r(x)}catch(x){H.error(x.message||"Failed to create OAuth App")}finally{h(!1)}};return e.jsxs(M,{open:!0,onClose:a,maxWidth:"md",fullWidth:!0,children:[e.jsxs(K,{children:[l("oauth.client.register")," ",e.jsx(X,{onClick:a,sx:{position:"absolute",right:8,top:8},children:e.jsx(G,{})})]}),e.jsx(Y,{children:e.jsxs(q,{spacing:4,sx:{mt:2},children:[e.jsx(I,{variant:"h6",gutterBottom:!0,children:l("oauth.client.requiredInformation")}),e.jsx(c,{children:e.jsx(S,{name:"clientName",control:y,rules:{required:l("oauth.client.validate.clientName"),minLength:{value:3,message:l("oauth.client.validate.clientNameMinLength")}},render:({field:s})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...s,label:l("oauth.client.name"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.clientNamePlaceholder"),error:!!u.clientName,helperText:u.clientName?.message}),e.jsx(v,{children:l("oauth.client.helperText.clientName")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"clientUri",control:y,rules:{required:l("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:l("oauth.client.validate.clientUriInvalid")}},render:({field:s})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...s,label:l("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.clientUriPlaceholder"),error:!!u.clientUri,helperText:u.clientUri?.message}),e.jsx(v,{children:l("oauth.client.helperText.clientUri")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"redirectUris",control:y,rules:{required:l("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:l("oauth.client.validate.redirectUrisInvalid")}},render:({field:s})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...s,label:l("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.redirectUrisPlaceholder"),error:!!u.redirectUris,helperText:u.redirectUris?.message}),e.jsxs(c,{sx:{display:"flex",gap:"2px"},children:[e.jsx(v,{children:l("oauth.client.helperText.redirectUris")}),e.jsx(v,{children:l("oauth.client.helperText.read")}),e.jsx(v,{sx:{color:"info.main"},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${o}/oauth-service`,target:"_blank",rel:"noopener noreferrer",children:l("oauth.client.helperText.document")}),e.jsx(v,{children:l("oauth.client.helperText.more")})]})]})})}),e.jsxs(Te,{variant:"outlined",sx:{p:2,display:"none"},children:[e.jsx(I,{variant:"subtitle2",gutterBottom:!0,children:l("oauth.client.input.permissions")}),e.jsx(c,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(le,{children:Object.entries(k.OAUTH_SCOPES).map(([s,x])=>e.jsx(ne,{control:e.jsx(oe,{checked:T.includes(s),onChange:()=>R(s),disabled:s==="profile:read",color:"primary"}),label:e.jsx(c,{children:e.jsx(I,{variant:"body2",sx:{fontWeight:500},children:x})})},s))})})]}),e.jsx(J,{}),e.jsx(I,{variant:"h6",gutterBottom:!0,children:l("oauth.client.optionalInformation")}),e.jsx(q,{children:e.jsx(S,{name:"contacts",control:y,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:l("oauth.client.validate.contacts")}},render:({field:s})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...s,label:l("oauth.client.input.contacts"),fullWidth:!0,placeholder:l("oauth.client.input.contactsPlaceholder"),error:!!u.contacts,helperText:u.contacts?.message}),e.jsx(v,{children:l("oauth.client.helperText.contacts")})]})})}),e.jsxs(q,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:y,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:l("oauth.client.validate.tosUriInvalid")}},render:({field:s})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...s,label:l("oauth.client.input.tosUri"),fullWidth:!0,placeholder:l("oauth.client.input.tosUriPlaceholder"),error:!!u.tosUri,helperText:u.tosUri?.message}),e.jsx(v,{children:l("oauth.client.helperText.tosUri")})]})}),e.jsx(S,{name:"policyUri",control:y,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:l("oauth.client.validate.policyUriInvalid")}},render:({field:s})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...s,label:l("oauth.client.input.policyUri"),fullWidth:!0,placeholder:l("oauth.client.input.policyUriPlaceholder"),error:!!u.policyUri,helperText:u.policyUri?.message}),e.jsx(v,{children:l("oauth.client.helperText.policyUri")})]})})]}),u.error&&e.jsx(se,{severity:"error",children:u.error.message})]})}),e.jsxs(ae,{children:[e.jsx(z,{onClick:a,children:l("common.cancel")}),e.jsxs(z,{onClick:g(N),disabled:i,variant:"contained",color:"primary",children:[i?e.jsx(Q,{size:20,sx:{mr:1}}):null,l("oauth.client.registerButton")]})]})]})}pe.propTypes={onCreated:n.func.isRequired,onClose:n.func.isRequired};function Z({scope:r="",...a}){if(!r)return null;const i=r.split(" ").filter(Boolean);return e.jsx(q,{direction:"row",...a,sx:[{flexWrap:"wrap",gap:1},...Array.isArray(a.sx)?a.sx:[a.sx]],children:i.map(h=>e.jsx(be.Fragment,{children:e.jsx(we,{title:k.OAUTH_SCOPES[h],children:e.jsx(C,{children:h})})},h))})}Z.propTypes={scope:n.string};const ee=r=>{const{prefix:a}=B(),{blocklet:i}=Ne(),h=te(a,"/api/media/upload",i.appPid),l=b.useCallback(f=>f?f.startsWith("http")?f:`${te(a,"/api/media/upload",i.appPid)}/${f}`:"",[a,i.appPid]);return{clientLogoUrl:b.useMemo(()=>l(r),[r,l]),apiPath:h,getClientLogoUrl:l}},$e=b.lazy(()=>ye(()=>import("./index-Bu80qBT0.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])).then(r=>({default:r.Uploader})));function he({client:r,onUpdate:a,onClose:i}){const[h,l]=b.useState(!1),{t:o,locale:f}=D(),d=b.useRef(null),{api:y}=B(),{teamDid:g}=$(),{control:u,handleSubmit:W,formState:{errors:m},watch:T,setValue:R,getValues:N}=ue({defaultValues:{clientName:r.clientName||"",clientUri:r.clientUri||"",redirectUris:Array.isArray(r.redirectUris)?r.redirectUris.join(","):"",scope:r.scope?r.scope.split(" "):["profile:read"],contacts:Array.isArray(r.contacts)?r.contacts.join(","):"",tosUri:r.tosUri||"",policyUri:r.policyUri||"",logoUri:r.logoUri||"",clientSecretExpiresAt:r.clientSecretExpiresAt||null},mode:"onChange"}),s=T("scope"),x=T("logoUri"),{clientLogoUrl:A,apiPath:P}=ee(x),E=t=>{t!=="profile:read"&&R("scope",s.includes(t)?s.filter(p=>p!==t):[...s,t])},O=async t=>{const p={clientId:r.clientId,clientName:t.clientName.trim(),clientUri:t.clientUri,redirectUris:t.redirectUris.split(",").map(j=>j.trim()).filter(Boolean),contacts:t.contacts?t.contacts.split(",").map(j=>j.trim()):[],scope:t.scope.join(" "),tosUri:t.tosUri,policyUri:t.policyUri,logoUri:t.logoUri,clientSecretExpiresAt:t.clientSecretExpiresAt?parseInt(t.clientSecretExpiresAt/1e3,10):null};await y.updateOAuthClient({input:{teamDid:g,input:p}})},_=async t=>{l(!0);try{await O(t),a(),i()}catch(p){H.error(p.message||o("oauth.client.updateFailed"))}finally{l(!1)}};return e.jsxs(M,{open:!0,onClose:i,maxWidth:"md",fullWidth:!0,children:[e.jsxs(K,{children:[o("oauth.client.update")," ",e.jsx(X,{onClick:i,sx:{position:"absolute",right:8,top:8},children:e.jsx(G,{})})]}),e.jsx(Y,{children:e.jsxs(q,{spacing:3,sx:{mt:2},children:[e.jsxs(c,{sx:{mb:3},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:o("oauth.client.logo")}),e.jsxs(c,{children:[e.jsx(c,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:A?e.jsx(c,{children:e.jsx("img",{src:A,alt:"client-logo",style:{width:"100%",height:"100%"}})}):e.jsx(c,{onClick:()=>{d.current?.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:e.jsx(ce,{sx:{fontSize:40,color:"common.white"}})})}),e.jsx(z,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{d.current?.open()},children:o(A?"common.change":"common.upload")})]}),e.jsx(c,{sx:{display:"flex",alignItems:"center"},children:e.jsx(b.Suspense,{fallback:e.jsx(Le,{}),children:e.jsx($e,{ref:d,locale:f,popup:!0,onUploadFinish:t=>{R("logoUri",t.data.filename),O(N()).then(()=>{a()}).catch(p=>{H.error(p.message||o("oauth.client.updateFailed"))}).finally(()=>{d.current?.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:P,disableMediaKitPrefix:!0,disableAutoPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo")})})]}),e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500},children:o("oauth.client.requiredInformation")}),e.jsx(w,{label:"Client Id",fullWidth:!0,value:r.clientId,disabled:!0}),e.jsx(c,{children:e.jsx(S,{name:"clientName",control:u,rules:{required:o("oauth.client.validate.clientName"),minLength:{value:3,message:o("oauth.client.validate.clientNameMinLength")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:o("oauth.client.name"),required:!0,fullWidth:!0,error:!!m.clientName,helperText:m.clientName?.message}),e.jsx(v,{children:o("oauth.client.helperText.clientName")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"clientUri",control:u,rules:{required:o("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:o("oauth.client.validate.clientUriInvalid")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:o("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!m.clientUri,helperText:m.clientUri?.message}),e.jsx(v,{children:o("oauth.client.helperText.clientUri")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"redirectUris",control:u,rules:{required:o("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:o("oauth.client.validate.redirectUrisInvalid")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:o("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!m.redirectUris,helperText:m.redirectUris?.message}),e.jsx(v,{children:o("oauth.client.helperText.redirectUris")})]})})}),e.jsx(S,{name:"clientSecretExpiresAt",control:u,render:({field:t})=>e.jsx(Oe,{placeholder:o("oauth.client.input.expireTime"),value:t.value*1e3,onChange:p=>{t.onChange(p)}})}),e.jsxs(c,{sx:{display:"none"},children:[e.jsx(I,{variant:"subtitle2",sx:{mb:1},children:o("oauth.client.input.permissions")}),e.jsx(c,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(le,{children:Object.entries(k.OAUTH_SCOPES).map(([t,p])=>e.jsx(ne,{control:e.jsx(oe,{checked:s.includes(t),onChange:()=>E(t),disabled:t==="profile:read",color:"primary"}),label:e.jsx(c,{children:e.jsx(I,{variant:"body2",sx:{fontWeight:500},children:p})})},t))})})]}),e.jsx(J,{}),e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500},children:o("oauth.client.optionalInformation")}),e.jsx(c,{children:e.jsx(S,{name:"contacts",control:u,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:o("oauth.client.validate.contacts")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:o("oauth.client.input.contacts"),fullWidth:!0,error:!!m.contacts,helperText:m.contacts?.message}),e.jsx(v,{children:o("oauth.client.helperText.contacts")})]})})}),e.jsxs(q,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:u,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:o("oauth.client.validate.tosUriInvalid")}},render:({field:t})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{...t,label:o("oauth.client.input.tosUri"),fullWidth:!0,error:!!m.tosUri,helperText:m.tosUri?.message}),e.jsx(v,{children:o("oauth.client.helperText.tosUri")})]})}),e.jsx(S,{name:"policyUri",control:u,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:o("oauth.client.validate.policyUriInvalid")}},render:({field:t})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{...t,label:o("oauth.client.input.policyUri"),fullWidth:!0,error:!!m.policyUri,helperText:m.policyUri?.message}),e.jsx(v,{children:o("oauth.client.helperText.policyUri")})]})})]}),m.error&&e.jsx(se,{severity:"error",children:m.error.message})]})}),e.jsxs(ae,{children:[e.jsx(z,{onClick:i,children:o("common.cancel")}),e.jsx(z,{onClick:W(_),disabled:h,variant:"contained",color:"primary",children:h?e.jsx(Q,{size:16}):o("common.update")})]})]})}he.propTypes={client:n.shape({clientId:n.string.isRequired,clientName:n.string.isRequired,clientUri:n.string,redirectUris:n.arrayOf(n.string),scope:n.string,contacts:n.arrayOf(n.string),tosUri:n.string,policyUri:n.string,logoUri:n.string,clientSecretExpiresAt:n.number}).isRequired,onUpdate:n.func.isRequired,onClose:n.func.isRequired};function me({client:r,onUpdate:a,onClose:i}){return e.jsx(he,{client:r,onUpdate:h=>a(h),onClose:i})}me.propTypes={client:n.shape({clientId:n.string.isRequired,clientName:n.string.isRequired,clientUri:n.string,redirectUris:n.arrayOf(n.string),scope:n.string,contacts:n.arrayOf(n.string),tosUri:n.string,policyUri:n.string,logoUri:n.string,clientSecretExpiresAt:n.number}).isRequired,onUpdate:n.func.isRequired,onClose:n.func.isRequired};function xe({clientId:r,clientName:a,onDelete:i=()=>{},onClose:h=()=>{}}){const{t:l}=D(),{api:o}=B(),{teamDid:f}=$(),d=()=>{h()},y=async()=>{try{await o.deleteOAuthClient({input:{teamDid:f,clientId:r}}),i()}catch(u){H.error(u?.message)}finally{d()}},g={keyName:a,title:l("oauth.client.delete.title"),description:l("oauth.client.delete.description",{name:`<b>${a}</b>`}),confirmPlaceholder:l("oauth.client.delete.description",{name:a}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:y,onCancel:d};return e.jsx(_e,{keyName:g.keyName,title:g.title,description:g.description,confirmPlaceholder:g.confirmPlaceholder,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})}xe.propTypes={clientId:n.string.isRequired,clientName:n.string.isRequired,onDelete:n.func,onClose:n.func};function je({title:r,items:a}){return e.jsxs(c,{sx:{mb:3},children:[e.jsx(I,{variant:"h6",sx:{mb:1.5},children:r}),e.jsx(q,{spacing:1.5,children:a.map(({label:i,value:h})=>e.jsxs(c,{sx:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(I,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:i}),e.jsx(I,{sx:{wordBreak:"break-all"},children:h||"-"})]},i))})]})}je.propTypes={title:n.string.isRequired,items:n.arrayOf(n.shape({label:n.string.isRequired,value:n.any})).isRequired};function ge({client:r,onClose:a}){const{t:i,locale:h}=D(),{teamDid:l}=$(),{clientName:o,clientId:f,clientSecret:d,redirectUris:y,scope:g,clientUri:u,logoUri:W,contacts:m,tosUri:T,policyUri:R,jwksUri:N,jwks:s,softwareId:x,softwareVersion:A,clientIdIssuedAt:P,clientSecretExpiresAt:E,updatedAt:O,createUser:_}=r,{clientLogoUrl:t}=ee(W),p=L=>{try{const F=new URL(window.blocklet.appUrl);return F.pathname=L,F.toString()}catch{return"-"}},j=de.fromAppDid(f,l),U=[{title:i("common.baseInfo"),items:[{label:i("oauth.client.name"),value:o},{label:i("oauth.client.logoUri"),value:e.jsx(re,{variant:"rounded",shape:"square",src:t,did:j.address,size:64})},{label:i("oauth.client.clientUri"),value:u?e.jsx(C,{children:u}):"-"},{label:i("oauth.client.clientId"),value:e.jsx(C,{children:f})},{label:i("oauth.client.clientSecret"),value:e.jsx(C,{children:d})},{label:i("oauth.client.redirectUris"),value:e.jsx(C,{children:(y||[]).join(", ")})},{label:i("oauth.client.scope"),value:e.jsx(Z,{scope:g})},{label:i("oauth.client.createUser"),value:_?ze(_,!0):i("oauth.client.openRegistration")}]},{title:i("oauth.client.oauthEndpoints"),items:[{label:i("oauth.client.openidConfiguration"),value:e.jsx(C,{children:p("/.well-known/openid-configuration")})},{label:i("oauth.client.authorizationEndpoint"),value:e.jsx(C,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/authorize`)})},{label:i("oauth.client.tokenEndpoint"),value:e.jsx(C,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/token`)})},{label:i("oauth.client.userinfoEndpoint"),value:e.jsx(C,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/userinfo`)})},{label:i("oauth.client.jwksUri"),value:e.jsx(C,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/jwks`)})},{label:i("oauth.client.registrationEndpoint"),value:e.jsx(C,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/register`)})},{label:i("oauth.client.endSessionEndpoint"),value:e.jsx(C,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/logout`)})}]},{title:i("oauth.client.metaContact"),items:[{label:i("oauth.client.contacts"),value:m.length?e.jsx(C,{children:(m||[]).join(", ")}):"-"},{label:i("oauth.client.tosUri"),value:T?e.jsx(C,{children:T}):"-"},{label:i("oauth.client.policyUri"),value:R?e.jsx(C,{children:R}):"-"},{label:i("oauth.client.jwksUri"),value:N},{label:i("oauth.client.jwks"),value:s},{label:i("oauth.client.softwareId"),value:x},{label:i("oauth.client.softwareVersion"),value:A}]},{title:i("common.timeInfo"),items:[{label:i("oauth.client.clientIdIssuedAt"),value:P?e.jsx(V,{value:P*1e3,type:"all",locale:h}):"-"},{label:i("oauth.client.clientSecretExpiresAt"),value:E?e.jsx(V,{value:E*1e3,type:"all",locale:h}):"-"},{label:i("common.updatedAt"),value:O?e.jsx(V,{value:O,type:"all",locale:h}):"-"}]}].filter(Boolean);return e.jsxs(M,{open:!0,onClose:a,maxWidth:"lg",fullWidth:!0,children:[e.jsxs(K,{children:[i("oauth.client.oauthAppDetails"),e.jsx(X,{onClick:a,sx:{position:"absolute",right:8,top:8},children:e.jsx(G,{})})]}),e.jsx(Y,{children:e.jsx(c,{sx:{mt:1},children:U.map((L,F)=>e.jsxs(c,{children:[e.jsx(je,{title:L.title,items:L.items}),F!==U.length-1&&e.jsx(J,{sx:{my:2}})]},L.title))})})]})}ge.propTypes={client:n.object.isRequired,onClose:n.func.isRequired};function Ve(r){return e.jsx(V,{value:r*1e3})}function fe({selected:r=null,onClose:a}){return r?e.jsx(ge,{client:r,onClose:a}):null}fe.propTypes={selected:n.object,onClose:n.func.isRequired};function Ue({open:r,onCreated:a,onClose:i}){return r?e.jsx(pe,{onCreated:a,onClose:i}):null}Ue.propTypes={open:n.bool.isRequired,onCreated:n.func.isRequired,onClose:n.func.isRequired};function Et(){const[r,a]=b.useState({searchText:"",pageSize:10,page:1}),[i,h]=b.useState(null),[l,o]=b.useState(!1),f=b.useRef(null),{t:d,locale:y}=D(),{api:g}=B(),{teamDid:u}=$(),[W,m]=b.useState(null),[T,R]=b.useState(null),N=De(),{getClientLogoUrl:s}=ee(),x=ke(async()=>await g.getOAuthClients({input:{teamDid:u,paging:{page:r.page,pageSize:r.pageSize}}}),[r.page,r.pageSize]),{loading:A}=x,P=b.useMemo(()=>x.value?.list||[],[x.value?.list]),E=b.useMemo(()=>r.searchText?P.filter(t=>t.clientName.toLowerCase().includes(r.searchText.toLowerCase())||t.clientId.toLowerCase().includes(r.searchText.toLowerCase())||t.scope.toLowerCase().includes(r.searchText.toLowerCase())):P,[r.searchText,P]),O=b.useMemo(()=>[{label:d("oauth.client.name"),name:"clientName",options:{customBodyRender:(t,{rowIndex:p})=>{const j=E[p],U=s(j.logoUri),L=de.fromAppDid(j.clientId,u);return e.jsx(c,{sx:{display:"flex",alignItems:"center",gap:2},children:e.jsxs(c,{sx:{display:"flex",alignItems:"center",gap:2,cursor:"pointer"},children:[e.jsx(re,{variant:"rounded",shape:"square",did:L.address,src:U,size:48}),e.jsxs(q,{sx:{gap:.5},children:[e.jsx(c,{sx:{color:"text.primary"},children:j.clientName}),e.jsx(c,{sx:{color:"text.secondary"},children:j.clientUri})]})]})})}}},{label:d("oauth.client.clientId"),name:"clientId"},{label:d("oauth.client.scope"),name:"scope",options:{customBodyRender:t=>e.jsx(Z,{scope:t})}},{label:d("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:Ve}},{label:d("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:t=>t?e.jsx(Re,{showDid:!0,did:t,cardType:Ae.Detailed,infoType:Ee.Minimal,sx:{border:0,padding:0}}):d("oauth.client.openRegistration")}},{label:d("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(t,{rowIndex:p})=>{const j=E[p];return e.jsx(Fe,{actions:[{icon:e.jsx(Se,{}),text:d("common.edit"),onClick:U=>{U.stopPropagation(),m(j)}},{icon:e.jsx(Ie,{}),text:d("common.delete"),onClick:U=>{U.stopPropagation(),R(j)}}]})}}}],[E,d,s,u,m,R]),_=({page:t,rowsPerPage:p,searchText:j})=>{r.pageSize!==p?a(U=>({...U,searchText:"",pageSize:p,page:1})):r.page!==t+1?a(U=>({...U,searchText:"",page:t+1})):r.searchText!==j&&a(U=>({...U,searchText:j,page:1}))};return e.jsxs(c,{ref:f,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[N?e.jsx(ie,{title:d("oauth.client.listTitle"),tooltipTitle:d("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${y}/oauth-service`}):null,e.jsx(Ce,{data:E,columns:O,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:r.page-1,rowsPerPage:r.pageSize,count:E.length,searchDebounceTime:400,onRowClick(t,{dataIndex:p},j){if(f.current?.contains(j.target)){const U=E[p];h(U)}}},onChange:_,title:N?null:e.jsx(ie,{title:d("oauth.client.listTitle"),tooltipTitle:d("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${y}/oauth-service`}),customButtons:[e.jsxs(z,{variant:"contained",size:"small",onClick:()=>o(!0),children:[A?e.jsx(Q,{size:16}):e.jsx(ce,{style:{fontSize:16}}),d("common.create")]},"add")],loading:!1,emptyNode:e.jsx(ve,{children:d("oauth.client.empty")})}),e.jsx(fe,{selected:i,onClose:()=>h(null)}),e.jsx(Ue,{open:l,onCreated:()=>{o(!1),x.retry()},onClose:()=>o(!1)}),W&&e.jsx(me,{client:W,onUpdate:x.retry,onClose:()=>m(null)}),T&&e.jsx(xe,{...T,onDelete:x.retry,onClose:()=>R(null)})]})}export{Et as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./vendor-mui-core-BWI0_sKe.js";import"./vendor-react-x2lQvn4m.js";import{S as t}from"./studio-CMWQYNVG.js";import"./vendor-ux-DVPR2iDY.js";import"./vendor-utils-Vke2d2wu.js";import"./vendor-hooks-CFpNP5Ql.js";import"./lottie-web-4koyQiv_.js";import"./index-Cm7r5rvw.js";import"./index-B0xpDUsO.js";import"./vendor-arcblock-D026EX-Z.js";function f(){return o.jsx(t,{children:"Coming soon..."})}export{f as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,d as o}from"./vendor-ux-DVPR2iDY.js";const c=e("blocklet-services");o("blocklet-services");export{c as d};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./vendor-mui-core-BWI0_sKe.js";import{C as t}from"./vendor-utils-Vke2d2wu.js";import{I as s}from"./iframe-BxB-nDw4.js";import{c as e}from"./index-B0xpDUsO.js";import{S as m}from"./studio-CMWQYNVG.js";import"./vendor-react-x2lQvn4m.js";import"./vendor-ux-DVPR2iDY.js";import"./vendor-hooks-CFpNP5Ql.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D026EX-Z.js";import"./index-Cm7r5rvw.js";function L(){const r=new URLSearchParams;r.set("title","Preference Builder"),r.set("schemaKey",t(window.location.origin,e.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/studio/preferences"));const i=`${t(window.location.origin,e.WELLKNOWN_SERVICE_PATH_PREFIX,"/hosted/form-builder/")}?${r.toString()}`;return o.jsx(m,{children:o.jsx(s,{url:i,width:"100%",height:"100%",frameBorder:0,styles:{border:0}})})}export{L as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./vendor-mui-core-BWI0_sKe.js";import o from"./user-center-C8GAilfL.js";import{H as i}from"./index-B0xpDUsO.js";import{T as e}from"./vendor-ux-DVPR2iDY.js";import"./vendor-react-x2lQvn4m.js";import"./vendor-hooks-CFpNP5Ql.js";import"./vendor-utils-Vke2d2wu.js";import"./index-BLIgZ0kx.js";import"./arrow-down.svg-ChoF_uzO.js";import"./user-sessions-DVo9LBeI.js";import"./index-PN2leRF6.js";import"./index-DjfjJ3Fo.js";import"./github-icon-CH2zo-td.js";import"./vendor-arcblock-D026EX-Z.js";import"./index-If1MEgvU.js";import"./index-DRYJ0xIl.js";import"./index-BojVbZw0.js";import"./index-BpkAJRJ3.js";import"./lottie-web-4koyQiv_.js";function R(){const{t}=e();return r.jsxs(r.Fragment,{children:[r.jsx(i,{children:r.jsx("title",{children:t("pageTitle.userCenter")})}),r.jsx(o,{onlyProfile:!0,currentTab:"",disableAutoRedirect:!0})]})}export{R as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{O as n,j as i,ak as l}from"./vendor-mui-core-BWI0_sKe.js";import{j as d,r as c}from"./vendor-react-x2lQvn4m.js";import{T as u,a as h}from"./vendor-ux-DVPR2iDY.js";import g from"./index-COypY_9V.js";import"./vendor-utils-Vke2d2wu.js";import"./vendor-hooks-CFpNP5Ql.js";import"./lottie-web-4koyQiv_.js";import"./index-B0xpDUsO.js";import"./vendor-arcblock-D026EX-Z.js";import"./confirm-CDf7UR9D.js";import"./index-DBs9Ljax.js";import"./session-Bj1hMOts.js";import"./did-address-6ebqvNNq.js";import"./empty-spinner-DlvM3tDM.js";import"./bundle-avatar-Xp52QSf2.js";import"./shorten-label-Ba-bmb_4.js";import"./list-header-BbJpGLxs.js";import"./click-to-copy-CT3GMLFE.js";import"./question-mark-circle.svg-YsMacl4Q.js";import"./useSetState-BWrXo9eH.js";import"./index-qmAWfCpk.js";import"./engine-CqzMzhBR.js";import"./api-B7LEhzE2.js";import"./vendor-mui-x-Bwa_JtSa.js";import"./react-beautiful-dnd.esm-C53HbB7P.js";import"./raf-schd.esm-BZ5FB5HD.js";import"./item-CT17goAk.js";import"./delete-confirm-Db5_a_ND.js";import"./get-safe-url-HSOeeYs_.js";import"./index-DjfjJ3Fo.js";import"./index-BfwIRDCT.js";import"./index-CWV__hd3.js";const r=new URL(window.location.href),s=r.searchParams.get("mode")==="dialog",w=s?"":r.searchParams.get("padding")||"";function V(){const{t:p}=u(),{componentDid:o}=d(),a=n(t=>t.breakpoints.down("md")),m=t=>{t.stopPropagation(),window.parent.postMessage({event:"resourceDialog.close",componentDid:o},"*")};c.useEffect(()=>{window.parent.postMessage({event:"resourceDialog.loaded",componentDid:o},"*")},[o]);const e=i.jsx(g,{padding:w,initUrl:r});return s?i.jsx(h,{className:"studio-dialog",title:p("blocklet.publish.blockletStudio"),maxWidth:!1,fullWidth:!1,PaperProps:{style:a?{width:"100%",height:window.innerHeight}:{maxWidth:1350,minWidth:930,width:"80%"}},onClose:m,showCloseButton:!0,disableEscapeKeyDown:!0,open:!0,children:i.jsx(l,{sx:{height:"72vh",overflow:"auto",position:"relative"},children:e})}):e}export{V as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as o}from"./index-B0xpDUsO.js";const e=o();export{e as b};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/connect-Bnz0r5Wi.js","assets/vendor-mui-core-BWI0_sKe.js","assets/vendor-react-x2lQvn4m.js","assets/vendor-utils-Vke2d2wu.js","assets/useAsync-COkfundQ.js","assets/useAsync-fxvoN33w.js","assets/vendor-hooks-CFpNP5Ql.js","assets/index-B0xpDUsO.js","assets/vendor-ux-DVPR2iDY.js","assets/lottie-web-4koyQiv_.js","assets/vendor-ux-DYcPPYq2.css","assets/vendor-arcblock-D026EX-Z.js","assets/index-DrVXX4fX.css","assets/config-Drzui8W3.js","assets/index-Iv2oisWn.js","assets/Google-DEJzh5qu.js","assets/cloneDeep-C4F9EbDd.js","assets/logo-uploader-C_Xk3axk.js","assets/index-qmAWfCpk.js","assets/collapse-cchwlIcj.js","assets/page-header-Dhv5B-BX.js","assets/layout-Df4ylgze.js","assets/content-layout-C0J5I0TX.js","assets/step-actions-DZNamIJE.js","assets/use-mobile-DspJgIrG.js","assets/button-V9BmeTRn.js","assets/index-GF3HOour.js","assets/config-space-D9QgW6OB.js","assets/spaces-C1fb5NDx.js","assets/api-B7LEhzE2.js","assets/connect-to-sTkrNSP4.js","assets/index-If1MEgvU.js","assets/index-DRYJ0xIl.js","assets/index-BojVbZw0.js","assets/index-BpkAJRJ3.js","assets/index-DBs9Ljax.js","assets/domain-D3NSNHzA.js","assets/domain-action-card-XBKx5ZEq.js","assets/useSetState-BWrXo9eH.js","assets/permission-CKmU8Z_5.js","assets/session-Bj1hMOts.js","assets/dot-DfSvSTo2.js","assets/confirm-CDf7UR9D.js","assets/actions-C2acYZqU.js","assets/delete-confirm-Db5_a_ND.js","assets/click-to-copy-CT3GMLFE.js","assets/index-Dy-MET-d.js","assets/util-fjAejugL.js","assets/engine-CqzMzhBR.js","assets/access-control-BCwE1yaW.js","assets/config-BV6XReOP.js","assets/fuel-B8dyWYCs.js","assets/did-address-6ebqvNNq.js","assets/complete-R8Z3eD81.js","assets/launch-result-message-B0akHCFQ.js","assets/get-safe-url-HSOeeYs_.js","assets/starting-progress-IzrgfSED.js","assets/addon-DTMrz0XJ.js","assets/question-mark-circle.svg-YsMacl4Q.js","assets/use-server-logo-7qMC4vqP.js","assets/server-logo-notext.svg-BqCXmsOm.js","assets/use-mobile-BmXUeM1i.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{T as B,w as q,_ as m}from"./vendor-ux-DVPR2iDY.js";import{j as e,ah as J,at as O,J as X,aY as G,ak as $,p as Y,aT as ee}from"./vendor-mui-core-BWI0_sKe.js";import{r,u as te,i as se,l as ae,m as d,N as oe}from"./vendor-react-x2lQvn4m.js";import{B as ne,J as re,C as a,U as le,O as ie}from"./vendor-utils-Vke2d2wu.js";import{C as ce}from"./config-space-D9QgW6OB.js";import{H as pe}from"./addon-DTMrz0XJ.js";import{aj as ue,m as de,a as me,ai as C,ao as he,c as S,ap as fe,am as T,aq as _e,f as Le,S as xe,M as P}from"./index-B0xpDUsO.js";import{P as Ee,L as Ce}from"./vendor-arcblock-D026EX-Z.js";import{g as N}from"./get-safe-url-HSOeeYs_.js";import{o as ge}from"./vendor-hooks-CFpNP5Ql.js";import{u as ye}from"./use-server-logo-7qMC4vqP.js";const ve=s=>r.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},r.createElement("path",{d:"M4.00572 31C3.25866 31 2.53839 30.7217 1.98537 30.2194C1.43235 29.7171 1.08623 29.0269 1.01451 28.2833L1.00049 27.9948V5.95637C1.00052 5.2093 1.27881 4.48903 1.78109 3.93601C2.28336 3.38299 2.9736 3.03688 3.71722 2.96516L4.00572 2.95113H13.0214C13.7682 2.95112 14.4882 3.22913 15.0412 3.73099C15.5941 4.23285 15.9405 4.92261 16.0126 5.66586L16.0267 5.95637V6.46526L20.4123 1.91934C20.9292 1.38325 21.6267 1.05817 22.3696 1.00708C23.1125 0.956001 23.8479 1.18256 24.4333 1.64285L24.6657 1.84521L30.1893 7.30472C30.7197 7.82899 31.0362 8.53173 31.0773 9.27635C31.1184 10.021 30.8812 10.7543 30.4117 11.3337L30.2054 11.5661L25.5753 15.9738H26.0441C26.7909 15.9738 27.5109 16.2518 28.0639 16.7537C28.6168 17.2555 28.9631 17.9453 29.0353 18.6886L29.0494 18.9791V27.9948C29.0494 28.7415 28.7714 29.4615 28.2695 30.0145C27.7676 30.5675 27.0779 30.9138 26.3346 30.986L26.0441 31H4.00572ZM14.0232 17.9773H3.00398V27.9948C3.00388 28.1993 3.06641 28.399 3.18317 28.567C3.29993 28.735 3.46533 28.8632 3.65712 28.9344L3.82541 28.9805L4.00572 28.9965H14.0232V17.9773ZM26.0441 17.9773H16.0267V28.9965H26.0441C26.2786 28.9966 26.5056 28.9144 26.6858 28.7643C26.8659 28.6142 26.9876 28.4057 27.0298 28.1751L27.0459 27.9948V18.9791C27.0459 18.7446 26.9638 18.5175 26.8137 18.3374C26.6636 18.1573 26.4551 18.0355 26.2244 17.9933L26.0441 17.9773ZM16.0267 12.3876V15.9738H19.6129L16.0267 12.3876ZM13.0214 4.95462H4.00572C3.77126 4.95455 3.5442 5.03671 3.36409 5.18681C3.18397 5.3369 3.06221 5.54542 3.02001 5.77605L3.00398 5.95637V15.9738H14.0232V5.95637C14.0233 5.75179 13.9607 5.55209 13.844 5.38411C13.7272 5.21613 13.5618 5.08792 13.37 5.01673L13.2017 4.97065L13.0214 4.95462ZM23.2833 3.29774C23.1148 3.13081 22.8929 3.02865 22.6565 3.00922C22.4202 2.9898 22.1845 3.05436 21.9911 3.19155L21.8548 3.31176L16.6137 8.74723C16.4555 8.91127 16.358 9.12433 16.3373 9.35125C16.3165 9.57817 16.3737 9.80539 16.4995 9.99541L16.6257 10.1517L21.8668 15.3908C22.0273 15.5515 22.2377 15.653 22.4634 15.6785C22.6891 15.7039 22.9167 15.652 23.109 15.531L23.2653 15.4088L28.7909 10.1457C28.9556 9.97892 29.0567 9.7597 29.0764 9.52614C29.0962 9.29259 29.0334 9.0595 28.8991 8.86744L28.7809 8.7292L23.2833 3.29774Z"})),b="https://launcher.arcblock.io",Se=s=>{if(!s)return b;const{protocol:t,host:h}=le(ie(s));return`${t}//${h}`},Pe=s=>s?{"__did-connect__":ne.from(JSON.stringify({switchBehavior:"auto",forceConnected:s,showClose:!1}),"utf8").toString("base64")}:{};function we(s,t=b,h=""){const{t:f}=B(),g=Pe(h),{loading:p,value:u,error:l,retry:_}=ge(async()=>{if(s!=="serverless")return null;const y=Se(t),x=await ue(y),v=re(a(x,"/u/apps"),g);return{text:f("launchBlocklet.nav.myApps"),appText:f("launchBlocklet.nav.viewMyApps"),link:v,buttonProps:{sx:{fontSize:"1rem"}},icon:e.jsx(J,{component:ve,fontSize:"small",viewBox:"0 0 32 32"})}},[s,t,h,f]);return s!=="serverless"||u===null?{}:p?{loading:!0}:l?{error:l,retry:_}:u||{}}const w=O.span`
|
|
3
|
-
color: ${s=>s.theme.palette.error.main};
|
|
4
|
-
&::before {
|
|
5
|
-
content: '*';
|
|
6
|
-
}
|
|
7
|
-
`,je=r.lazy(()=>m(()=>import("./connect-Bnz0r5Wi.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),ke=r.lazy(()=>m(()=>import("./config-Drzui8W3.js"),__vite__mapDeps([13,1,2,3,8,6,9,10,14,15,16,7,11,12,17,18,19,20,21,22,23,24,25]))),Re=r.lazy(()=>m(()=>import("./index-GF3HOour.js"),__vite__mapDeps([26,1,2,8,3,6,9,10,20,7,11,12,27,28,29,30,31,32,33,34,35,23,24,21,22]))),Ae=r.lazy(()=>m(()=>import("./domain-D3NSNHzA.js"),__vite__mapDeps([36,1,2,7,8,3,6,9,10,11,12,37,38,39,40,41,5,42,35,43,44,45,4,46,47,48,20,25,21,22,23,24]))),Ie=r.lazy(()=>m(()=>import("./access-control-BCwE1yaW.js"),__vite__mapDeps([49,1,2,8,3,6,9,10,50,7,11,12,20,21,22,23,24,25]))),Te=r.lazy(()=>m(()=>import("./fuel-B8dyWYCs.js"),__vite__mapDeps([51,1,2,3,8,6,9,10,7,11,12,52,20,21,22,23,24,25]))),Ne=r.lazy(()=>m(()=>import("./complete-R8Z3eD81.js"),__vite__mapDeps([53,1,2,7,8,3,6,9,10,11,12,54,55,25,21,22,56,27,28,29,57,58,59,60,61])));function Be(){const s=X(),{t,locale:h}=B(),[f,g]=te(),p=se(),{meta:u,blocklet:l,actions:_,loading:y,launcherSession:x}=de(),v=localStorage.getItem("blocklet-server-url"),{session:j}=me(),U=ye({onClick:()=>{window.open(N(v,{allowDomains:null}))}}),V=C("fromLauncher"),H=C("launcherUrl"),M=C("launchType"),k=C("visitorId"),D=we(M,H,x?.userDid);k&&(q(k),f.delete("visitorId"),g(f)),r.useEffect(()=>{he(),j.user&&(_?.refreshMeta(),_?.refreshBlocklet({showError:!1}))},[j.user]),r.useEffect(()=>{_.refreshFuel({showError:!1})},[l?.meta?.did]);const n=`${S.WELLKNOWN_SERVICE_PATH_PREFIX}/setup`,z=c=>{const o=c?.capabilities?.didSpace;return o?o===P.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||o===P.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP?{key:"did-space",name:e.jsxs(e.Fragment,{children:[t("setup.steps.didSpace")," ",e.jsx(w,{})]}),path:a(n,"did-space")}:o===P.BLOCKLET_APP_SPACE_REQUIREMENT.OPTIONAL?{key:"did-space",name:e.jsx(e.Fragment,{children:t("setup.steps.didSpace")}),path:a(n,"did-space")}:(console.warn(`capabilities.didSpace cannot take the value ${o}`),null):null},i=[{key:"access",name:t("setup.steps.access"),path:a(n,"access")},{key:"domain",name:t("setup.domain.title"),path:a(n,"domain")},z(l),{key:"config",name:e.jsxs(e.Fragment,{children:[t("setup.steps.config")," ",fe(u)&&e.jsx(w,{})]}),path:a(n,"config")},u?.requirements?.fuels?.length?{key:"fuel",name:e.jsxs(e.Fragment,{children:[t("setup.steps.fuel")," ",e.jsx(w,{})]}),path:a(n,"fuel")}:null].filter(Boolean),E=i.findIndex(c=>`${T.replace(/\/$/,"")}${n}/${c.key}`===window.location.pathname),F=a(T,S.WELLKNOWN_SERVICE_PATH_PREFIX,`/blocklet/logo?v=${l?.updatedAt}`),W=async c=>{const{search:o}=new URL(window.location.href),Q=i[E];if(o.includes("from=empty")&&Q.key==="config"){window.open(N(`${a(S.WELLKNOWN_BLOCKLET_ADMIN_PATH,"/overview/components")}${o}`));return}if(!c)i[E+1]?p(`${a(n,i[E+1].key)}${o}`):p(`${a(n,"complete")}${o}`);else{const I=i.findIndex(Z=>Z.key===c);I>-1?p(`${a(n,i[I].key)}${o}`):p(`${a(n,"complete")}${o}`)}await _.refreshBlocklet()},K=()=>{p(-1)};function L(c,o){return e.jsxs(je,{children:[!l&&e.jsx($,{sx:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx(Y,{})}),l&&e.jsx(c,{blocklet:l,...o,onNext:W,onPrevious:K,buttonText:E===i.length-1?t("setup.startNow"):""})]})}const R=[{key:"install",name:t("launchBlocklet.steps.installApp"),path:a(n,"install")},{key:"setup",name:t("setup.steps.launchApp"),children:i}];let A=[{key:"agreement",name:t("launchBlocklet.introduction"),path:a(n,"agreement")},...R];return V&&(A=[{key:"purchase-space",name:t("launchBlocklet.steps.purchaseSpace")},{key:"prepare-space",name:t("launchBlocklet.steps.prepareSpace")},...R]),e.jsx(Ee,{steps:A,children:e.jsx(_e,{children:e.jsxs(ce,{children:[e.jsx(G,{styles:Oe}),e.jsx($e,{children:e.jsx(Ce,{locale:h,loading:y,blockletMeta:{...u,title:Le.getDisplayName({...l,meta:u})},navLogo:U,pcWidth:"80%",style:{height:"100%"},logoUrl:F,useOfSkeleton:!1,extraNav:D,headerEndAddons:e.jsx(pe,{SessionContext:xe,sessionManagerProps:{disableLogout:!0}}),theme:s,launchingText:t("setup.title"),children:e.jsxs(ae,{children:[e.jsx(d,{path:"access",element:L(Ie)}),e.jsx(d,{path:"domain",element:L(Ae)}),e.jsx(d,{path:"did-space",element:L(Re)}),e.jsx(d,{path:"config",element:L(ke)}),e.jsx(d,{path:"fuel",element:L(Te)}),e.jsx(d,{path:"complete",element:L(Ne,{launcherSession:x})}),e.jsx(d,{path:"*",element:e.jsx(oe,{to:`access${window.location.search}`,replace:!0})})]})})})]})})})}const Oe=ee`
|
|
8
|
-
html,
|
|
9
|
-
body,
|
|
10
|
-
#app,
|
|
11
|
-
#app > .wrapper {
|
|
12
|
-
height: 100%;
|
|
13
|
-
}
|
|
14
|
-
`,$e=O($)`
|
|
15
|
-
/* display: flex;
|
|
16
|
-
min-width: 0;
|
|
17
|
-
flex: 1 1 0; */
|
|
18
|
-
height: 100%;
|
|
19
|
-
|
|
20
|
-
& .layout-content {
|
|
21
|
-
min-width: 0;
|
|
22
|
-
flex: 1 1 0;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
& .ll-header {
|
|
26
|
-
@media (max-width: 960px) {
|
|
27
|
-
padding: 0 12px;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
`,Ze=Object.freeze(Object.defineProperty({__proto__:null,default:Be},Symbol.toStringTag,{value:"Module"}));export{Pe as a,Se as g,Ze as s};
|