@abtnode/blocklet-services 1.16.39-beta-20250213-085550-20ef6d4f → 1.16.39-beta-20250215-130252-43410928
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/index.js +4 -0
- package/api/libs/connect/session.js +5 -3
- package/api/services/did-space/index.js +15 -0
- package/api/validators/login.js +2 -2
- package/dist/assets/Add-TglZpKpw.js +1 -0
- package/dist/assets/ArrowDropDown-DCM27ed6.js +1 -0
- package/dist/assets/CheckCircle-CH8SYy4d.js +1 -0
- package/dist/assets/ChevronLeft-B7m8AFzR.js +1 -0
- package/dist/assets/ChevronRight-DeRklga5.js +1 -0
- package/dist/assets/DeleteOutline-DZA1YKE4.js +1 -0
- package/dist/assets/Done-CVdTMvGH.js +1 -0
- package/dist/assets/Download-DECMRaRC.js +1 -0
- package/dist/assets/Error-B61ZB0Rr.js +1 -0
- package/dist/assets/{Google-CSRPwRzS.js → Google-D_UbrpMW.js} +1 -1
- package/dist/assets/InfoOutlined-QBw5AmWP.js +1 -0
- package/dist/assets/Launch-Cpp3LVnV.js +1 -0
- package/dist/assets/LaunchOutlined-WdAKKV2H.js +1 -0
- package/dist/assets/Loop-CbPhaPlF.js +1 -0
- package/dist/assets/MoreHoriz-BsTY94ce.js +1 -0
- package/dist/assets/PlayArrow-BgVzxA9Q.js +1 -0
- package/dist/assets/ViewList-DBUe2NSG.js +1 -0
- package/dist/assets/{access-control-DdkKjkTj.js → access-control-DeqFMOm5.js} +1 -1
- package/dist/assets/{actions-DDpgZ17S.js → actions-DP_Rm54e.js} +1 -1
- package/dist/assets/{add-component-core-CF05FURP.js → add-component-core-BnP0_g-C.js} +17 -17
- package/dist/assets/{add-resource-u9CnYHQ7.js → add-resource-B26HHRU4.js} +1 -1
- package/dist/assets/{addon-BCk9L1CD.js → addon-DH34oI6i.js} +1 -1
- package/dist/assets/{analytics-sm8oL_To.js → analytics-DPn53GmC.js} +1 -1
- package/dist/assets/audit-logs-C1oUmr2S.js +35 -0
- package/dist/assets/{base32-LsxuOFGQ.js → base32-CwwDjweV.js} +1 -1
- package/dist/assets/branding-DFfBkuOI.js +40 -0
- package/dist/assets/bundle-avatar-Cv2R2iWI.js +1 -0
- package/dist/assets/button-4qfNeG4u.js +1 -0
- package/dist/assets/{click-to-copy-BLRxskBB.js → click-to-copy-886R1sA9.js} +1 -1
- package/dist/assets/{complete-DY43z8bC.js → complete-Cz6Vt9yr.js} +4 -4
- package/dist/assets/{component-C3wYVoFz.js → component-BOGOOyWw.js} +2 -2
- package/dist/assets/config-BBRmjpUL.js +1 -0
- package/dist/assets/{config--1vdfQxl.js → config-CE9eJ5Ce.js} +2 -2
- package/dist/assets/{config-navigation-xcMpeduS.js → config-navigation-ZGyHDU_V.js} +6 -6
- package/dist/assets/config-space-Bgt2MtPU.js +1 -0
- package/dist/assets/{confirm-DfsY08eB.js → confirm-f60NfF3X.js} +1 -1
- package/dist/assets/{connect-5VLKxKh7.js → connect-B2VVyCQY.js} +1 -1
- package/dist/assets/connect-D9S16wyT.js +1 -0
- package/dist/assets/{connect-to-B_2lM0_9.js → connect-to-BSmtnPV9.js} +1 -1
- package/dist/assets/{dashboard-DQnfagMU.js → dashboard-BoV1-CrH.js} +7 -7
- package/dist/assets/{did-address-CsW_VsB3.js → did-address-CgDvtQbT.js} +1 -1
- package/dist/assets/domain-DLGsAByD.js +9 -0
- package/dist/assets/domain-list-BLV11Y6_.js +15 -0
- package/dist/assets/{email-D3sOIREb.js → email-Fgr58FLV.js} +2 -2
- package/dist/assets/{exchange-passport-CS0Md1xZ.js → exchange-passport-CcsLEfpo.js} +1 -1
- package/dist/assets/form-text-input-CbMAGh7u.js +11 -0
- package/dist/assets/{fuel-CEtlY46W.js → fuel-B8r20ueU.js} +1 -1
- package/dist/assets/{fullpage-Ce9Y2TSP.js → fullpage-DLk_Ap1u.js} +1 -1
- package/dist/assets/{get-safe-url-BVbIl2hB.js → get-safe-url-BzE2b8Zw.js} +1 -1
- package/dist/assets/{get-safe-url-SccGjxz4.js → get-safe-url-C2hTfmjV.js} +1 -1
- package/dist/assets/{home-BI67JVLT.js → home-B30MMEWW.js} +1 -1
- package/dist/assets/{iframe-De6QHL_6.js → iframe-DvysnY8O.js} +1 -1
- package/dist/assets/index-4zAH1uuX.js +5 -0
- package/dist/assets/{index-BdfWmlqh.js → index-B4_ve2gt.js} +1 -1
- package/dist/assets/{index-C9lMjZBr.js → index-B6CyLMos.js} +7 -7
- package/dist/assets/{index-CxW3Q7hC.js → index-BkZLaapf.js} +3 -3
- package/dist/assets/{index-DUVrFM9m.js → index-C-yw0A3M.js} +1 -1
- package/dist/assets/{index-Dq1yoqB-.js → index-CM-Ew9KZ.js} +1 -1
- package/dist/assets/{index-o2FFW-yx.js → index-DFM7u7wl.js} +1 -1
- package/dist/assets/{index-R7D5qhDv.js → index-EDdyNc1F.js} +1 -1
- package/dist/assets/{index-D-6G7He6.js → index-EIsfexf1.js} +1 -1
- package/dist/assets/index-RoF9rzF3.js +77 -0
- package/dist/assets/index-U8kTDDEm.js +228 -0
- package/dist/assets/{index-DsrVmpPp.js → index-V7v6XM-s.js} +1 -1
- package/dist/assets/{index-NTlhnYZO.js → index-j5s7Rpz_.js} +1 -1
- package/dist/assets/{index-DVfi3VUs.js → index-r2Lf0YIw.js} +29 -29
- package/dist/assets/{index-BoVroYzD.js → index-uSZNIR4c.js} +33 -33
- package/dist/assets/{invitation-DWG-KySA.js → invitation-ZW3n52Yc.js} +6 -6
- package/dist/assets/{invite-Lcgs0Fhi.js → invite-B8cpjqrT.js} +1 -1
- package/dist/assets/{issue-passport-pkmrmS7N.js → issue-passport-DrbTLcdD.js} +1 -1
- package/dist/assets/item-BVrq9ZQD.js +2 -0
- package/dist/assets/{layout-CF6TreKX.js → layout-Dw2Qx7hs.js} +1 -1
- package/dist/assets/{list-D3MtvbeT.js → list-BwH5q_Zc.js} +5 -5
- package/dist/assets/{list-header-DxG3xooH.js → list-header-BBHpD8dC.js} +1 -1
- package/dist/assets/{localization-BOHiIJhm.js → localization-Ciwo-y3M.js} +1 -1
- package/dist/assets/{log-ZG0PJXpX.js → log-Ba7iTEJj.js} +1 -1
- package/dist/assets/login-BewdlPwi.js +1 -0
- package/dist/assets/{login-oauth-callback-VhHKXVPh.js → login-oauth-callback-D_bP2yYx.js} +1 -1
- package/dist/assets/{logo-uploader-DZitXtFf.js → logo-uploader-CneV6CnS.js} +3 -3
- package/dist/assets/{lost-passport-C9bxtr1Q.js → lost-passport-CNuZ281r.js} +3 -3
- package/dist/assets/{open-window-YQ4vV2tF.js → open-window-Q0PVNWdu.js} +1 -1
- package/dist/assets/{overview-GoLeUZDo.js → overview-giDiT6rf.js} +1 -1
- package/dist/assets/{page-header-DZTCF7io.js → page-header-BDwGXuEW.js} +1 -1
- package/dist/assets/{permission-BQ0E8FmL.js → permission-Cqed8iP-.js} +1 -1
- package/dist/assets/{preferences-CjipuYyV.js → preferences-CBm0eML7.js} +1 -1
- package/dist/assets/{publish-resource-Czivui9b.js → publish-resource-CQLawfAh.js} +1 -1
- package/dist/assets/{react-beautiful-dnd.esm-B0xxfe7i.js → react-beautiful-dnd.esm-BTWrOgJp.js} +1 -1
- package/dist/assets/{relative-time-Bkhqzrgv.js → relative-time-Bt6RtG4o.js} +1 -1
- package/dist/assets/sdk-B4wNFenI.js +1 -0
- package/dist/assets/session-BKdZFtFw.js +1 -0
- package/dist/assets/{setup-6BkYc-NJ.js → setup-BdFkCCIb.js} +4 -4
- package/dist/assets/{start-C6UPvOLP.js → start-Cy0MNYb6.js} +1 -1
- package/dist/assets/{step-actions-BmiH863e.js → step-actions-CPEQpBG3.js} +1 -1
- package/dist/assets/studio-BzK2t7MU.js +6 -0
- package/dist/assets/{switch-control-1mrS2A0x.js → switch-control-BSKk9hbF.js} +1 -1
- package/dist/assets/traffic-BQRcq8gg.js +37 -0
- package/dist/assets/{transfer-bCXNyiiH.js → transfer-DhNfOwE1.js} +2 -2
- package/dist/assets/{unsubscribe-DruGK6Ne.js → unsubscribe-C0PztwA5.js} +1 -1
- package/dist/assets/{useLocalStorage-DYSzZAco.js → useLocalStorage-Bx8dJwZw.js} +1 -1
- package/dist/assets/user-center-BshF32Jc.js +71 -0
- package/dist/assets/util-BPubgk5p.js +1 -0
- package/dist/assets/util-CWVLbRLp.js +1 -0
- package/dist/assets/vendor-arcblock-HzAExiTd.js +3512 -0
- package/dist/assets/{wrap-locale-CLuwhKrO.js → wrap-locale-DrPh3OVK.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/service-worker.js +1 -1
- package/package.json +29 -29
- package/dist/assets/Add-CuIZWfjH.js +0 -1
- package/dist/assets/ArrowDropDown-Cv3eCDY6.js +0 -1
- package/dist/assets/CheckCircle-D-unagro.js +0 -1
- package/dist/assets/ChevronLeft-Gy0Fh2PP.js +0 -1
- package/dist/assets/ChevronRight-DSecMzs8.js +0 -1
- package/dist/assets/DeleteOutline-CnjMnu1G.js +0 -1
- package/dist/assets/Done-C8ZSABDp.js +0 -1
- package/dist/assets/Download-BpCGsakQ.js +0 -1
- package/dist/assets/Error-CIVKKbPu.js +0 -1
- package/dist/assets/InfoOutlined-C8xfkBe6.js +0 -1
- package/dist/assets/Launch-BfiIdCmh.js +0 -1
- package/dist/assets/LaunchOutlined-DmwI20ey.js +0 -1
- package/dist/assets/Loop-Dlnais4C.js +0 -1
- package/dist/assets/MoreHoriz-DbMNKpjF.js +0 -1
- package/dist/assets/PlayArrow-CZfWYrXK.js +0 -1
- package/dist/assets/ViewList-CV3Yxakp.js +0 -1
- package/dist/assets/audit-logs-Cre3WUIo.js +0 -18
- package/dist/assets/branding-BTgKt5ES.js +0 -40
- package/dist/assets/bundle-avatar-7g1gtR_Q.js +0 -1
- package/dist/assets/button-DlYlZH8h.js +0 -1
- package/dist/assets/config-5CfgPrCe.js +0 -1
- package/dist/assets/config-space-C59Z4PGK.js +0 -1
- package/dist/assets/connect-hKwHeTo3.js +0 -1
- package/dist/assets/domain-PLy6pooV.js +0 -9
- package/dist/assets/domain-list-Bc7A7RER.js +0 -15
- package/dist/assets/form-text-input-AT4HfkHl.js +0 -11
- package/dist/assets/index-B9Bc9vnG.js +0 -77
- package/dist/assets/index-C9UnRN7C.js +0 -228
- package/dist/assets/index-p0322yKe.js +0 -5
- package/dist/assets/item-B6N6t3kF.js +0 -2
- package/dist/assets/login-BbaHO4Ca.js +0 -1
- package/dist/assets/sdk-CBf7wJy0.js +0 -1
- package/dist/assets/session-DKWhsUi1.js +0 -1
- package/dist/assets/studio-BdNJR01R.js +0 -6
- package/dist/assets/traffic-CoKCU9bb.js +0 -37
- package/dist/assets/user-center-B33739jv.js +0 -71
- package/dist/assets/util-BTCA4Hee.js +0 -1
- package/dist/assets/util-BblN2lT9.js +0 -1
- package/dist/assets/vendor-arcblock-DE69EmW_.js +0 -3512
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,a3 as _,a4 as X,a2 as J}from"./vendor-mui-core-xF5F4eT7.js";import{r as h,k as Y,u as q,L as Q}from"./vendor-react-D-afvo_7.js";import{e as Z,G as ee,F as ne,X as se,b as te,H as E,C as oe,R as re,W as ae,Y as I,j as ce}from"./vendor-arcblock-DE69EmW_.js";import{d as ie,u as M,k as le,o as de}from"./vendor-hooks-BKxTDk_P.js";import{u as fe}from"./use-passport-id-B-b-_oYF.js";import{F as pe}from"./fullpage-Ce9Y2TSP.js";import{c as ue,F as me,G as ge,a4 as he,a5 as we}from"./vendor-utils-5TjOM6td.js";import{g as F}from"./get-safe-url-BVbIl2hB.js";import{u as ke}from"./index-DVfi3VUs.js";const xe="/.well-known/service/static/assets/login-bg-BMPVKR1k.svg",O="authorization_response",ve=ae(),_e="blocklet:onLogin",w=new BroadcastChannel(_e);async function Ie(d){const p=new URL("__blocklet__.js",d);return p.searchParams.set("type","json"),await(await fetch(p.href)).json()}function be(){var b;const d=h.useRef(null),{getPassportId:p}=fe(),{session:C,connectApi:R}=ke(),{t:a,locale:A}=Z(),N=Y(),[l]=q(),{encrypt:B}=ee(),[U,T]=h.useState(null),j=ne();let c={};try{c=JSON.parse(decodeURIComponent(se(l.get("params"))))}catch(s){console.error("parse connect params failed",s)}const u=!ue(l.get("popup")),{action:m="login",passkeyBehavior:H="both",extraParams:f={},messages:W,...k}=c;h.useEffect(()=>{f.inviter&&window.localStorage.setItem("inviter",f.inviter)},[f.inviter]);const i=l.get("redirect"),y=l.get("opener"),x=l.get("_ek_");f.passportId=p(),m==="login"&&me(k.forceConnected)&&(k.forceConnected=!1);const v=s=>x?B(JSON.stringify(s),x):s,P=h.useMemo(()=>i||!window.opener?"redirect":"popup",[i]),L=async s=>{const e=await ve.federated.getTrustedDomains();if(!y){e.forEach(n=>{window.opener.postMessage(s,he(n)),window.opener.postMessage(s,we(n))});return}const o=new URL(y);if(!e.includes(o.hostname))throw T(a("login.invalidOpenerUrl")),new Error("Invalid login caller");window.opener.postMessage(s,o.origin)},D=({encrypted:s=!0,...e},o,n)=>{s&&(e.sessionToken&&(e.sessionToken=o(e.sessionToken)),e.refreshToken&&(e.refreshToken=o(e.refreshToken)),e.visitorId&&(e.visitorId=o(e.visitorId))),e.visitorId&&localStorage.setItem("__visitor_id",e.visitorId);const V={type:O,response:e,options:n};({redirect:()=>{setTimeout(()=>{if(i){const g=decodeURIComponent(i);let r;I(g)?r=new URL(g):r=new URL(g,window.location.origin),x&&r.searchParams.set("encrypted",!0),e.sessionToken&&r.searchParams.set("sessionToken",v(e.sessionToken)),e.refreshToken&&r.searchParams.set("refreshToken",v(e.refreshToken)),e.visitorId&&r.searchParams.set("visitorId",v(e.visitorId)),n!=null&&n.connected_did&&r.searchParams.set("connected_did",n.connected_did),n!=null&&n.connected_pk&&r.searchParams.set("connected_pk",n.connected_pk),n!=null&&n.connected_app&&r.searchParams.set("connected_app",n.connected_app),n!=null&&n.connected_wallet_os&&r.searchParams.set("connected_wallet_os",n.connected_wallet_os),n!=null&&n.saveConnect&&r.searchParams.set("saveConnect",n.saveConnect),w.postMessage({...ge(e,["sessionToken","refreshToken","visitorId"])}),I(g)?window.location.replace(F(r.href,{allowDomains:null})):N(`${r.pathname}${r.search}`,{replace:!0})}else window.location.replace(window.env.pathPrefix||"/")},50)},popup:async()=>{await L(V),setTimeout(()=>{window.open("about:blank","_self"),window.close()},2e3)}})[P]()},$=s=>{const e={type:O,error:s.message,errorDescription:s.message};({redirect:()=>{ce.error(s.message)},popup:()=>{L(e)}})[P]()},z=ie(()=>{if(m!=="login")return null;const s=window.blocklet.trustedFactories||[];return t.jsx(_,{textAlign:"center",fontSize:14,children:s.length>0&&t.jsx(X,{title:a("exchangePassport.tooltip",{collections:s.map(e=>e.factoryAddress)}),placement:"top-end",enterTouchDelay:0,children:t.jsx(Q,{to:`${te.WELLKNOWN_SERVICE_PATH_PREFIX}/exchange-passport?redirect=${encodeURIComponent(i||"/")}`,style:{color:"#4598FA"},children:a("exchangePassport.title")},"exchange-passport")})})},[m]),K=M(async()=>{if(!i)return!0;let s;try{s=new URL(i)}catch{return!1}let e;try{e=new URL(c==null?void 0:c.baseUrl)}catch{try{e=new URL(c==null?void 0:c.prefix)}catch(o){console.error("baseUrl and prefix are both invalid",o)}}if(e){let o=[];if(e.origin===window.location.origin)o=window.blocklet.domainAliases||[];else{const n=await Ie(e.origin);o=(n==null?void 0:n.domainAliases)||[]}if(!o.includes(s.hostname))return T(a("login.invalidRedirectUrl")),!1}return!0}),S=M(()=>{const s=decodeURIComponent(i);let e;I(s)?e=new URL(s):e=new URL(s,window.location.origin),window.location.replace(F(e.href,{allowDomains:null}))});le(async()=>{await K()&&(d.current||u||j.arcSphere)&&(window.temporaryDIDConnectOnSuccess=(e,o)=>{D(e,o,{saveConnect:!0})},setTimeout(()=>{R.open({locale:A,action:m,passkeyBehavior:H,extraParams:f,...k,containerEl:u?void 0:d.current,className:"connect",popup:u||!1,messages:W||{title:a("login.connect.title"),scan:a("login.connect.scan"),confirm:a("login.connect.confirm"),success:a("login.connect.success")},extraContent:z,useSocket:!0,onSuccess:D,onError:$})})),w.addEventListener("message",S)}),de(()=>{delete window.temporaryDIDConnectOnSuccess,w.removeEventListener("message",S),w.close()});const G=l.has("popup");return C.loading?t.jsxs(t.Fragment,{children:[t.jsx(E,{children:t.jsx("title",{children:"DID Connect"})}),t.jsx(oe,{children:G?null:t.jsx(J,{})})]}):t.jsxs(t.Fragment,{children:[t.jsx(E,{children:t.jsx("title",{children:"DID Connect"})}),u||j.arcSphere?t.jsx(_,{sx:{position:"fixed",top:0,bottom:0,left:0,right:0,backgroundColor:"#0F1114",backgroundImage:`url("${xe}")`,backgroundSize:"contain",backgroundPosition:"center"}}):t.jsx(pe,{did:(b=window.blocklet)==null?void 0:b.appPid,children:U?t.jsx(re,{status:403,description:U}):t.jsx(_,{sx:{width:"560px",maxWidth:"100%",height:"100%"},ref:d})})]})}export{be as default};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{a1 as b,j as t,a3 as i,T as j,I as _,C as w,E as y,aa as A}from"./vendor-mui-core-xF5F4eT7.js";import{I as W,o as L,f as R,ag as H,d as S}from"./index-DVfi3VUs.js";import{D as z,a as O,B as $,A as q}from"./domain-list-Bc7A7RER.js";import{$ as N,a1 as F,aW as K}from"./vendor-arcblock-DE69EmW_.js";import{P as M}from"./page-header-DZTCF7io.js";import{r}from"./vendor-react-D-afvo_7.js";import{_ as U}from"./useSetState-Crt4S51m.js";import{S as l}from"./button-DlYlZH8h.js";import{S as Y}from"./layout-CF6TreKX.js";import{S as G}from"./step-actions-BmiH863e.js";import"./vendor-utils-5TjOM6td.js";import"./vendor-hooks-BKxTDk_P.js";import"./Add-CuIZWfjH.js";import"./base32-LsxuOFGQ.js";import"./LockIcon-D-W4Rph6.js";import"./CheckCircle-D-unagro.js";import"./util-BTCA4Hee.js";import"./permission-BQ0E8FmL.js";import"./session-DKWhsUi1.js";import"./useAsyncRetry-Bmo6a1Zp.js";import"./useAsync-Ua5iss51.js";import"./confirm-DfsY08eB.js";import"./format-error-C0Ke3VXF.js";import"./InfoOutlined-C8xfkBe6.js";import"./api-K65cLqol.js";import"./index-BdfWmlqh.js";import"./actions-DDpgZ17S.js";import"./MoreHoriz-DbMNKpjF.js";import"./content-layout-cWwRTmIc.js";var p={},J=b;Object.defineProperty(p,"__esModule",{value:!0});var g=p.default=void 0,Q=J(N()),V=t;g=p.default=(0,Q.default)((0,V.jsx)("path",{d:"M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2m6 9.8a.9.9 0 0 1-.1.5l-2.1 4.9a1.34 1.34 0 0 1-1.3.8H9a2 2 0 0 1-2-2v-5a1.28 1.28 0 0 1 .4-1L12 5l.69.69a1.08 1.08 0 0 1 .3.7v.2L12.41 10H17a1 1 0 0 1 1 1z"}),"Recommend");function c({onNext:s,onPrevious:v}){var h,D;const{t:o}=r.useContext(F),{info:C}=W(),[k,u]=r.useState(!1),{blocklet:a}=L(),[x,I]=r.useState(""),[d,P]=r.useState(!1),T=(((a==null?void 0:a.site)||{}).domainAliases||[]).map(e=>R.replaceSlotToIp(e.value,x)),[n,m]=U({domain:"",invalidDNSDomain:null,type:"",addDomainState:{text:""}}),f=(D=(h=a.environments)==null?void 0:h.find(e=>e.key==="BLOCKLET_APP_PK"))==null?void 0:D.value,B=T.find(e=>H.isDidDomain(e));return r.useEffect(()=>{S.get(`/dns-resolve?hostname=${window.location.hostname}`).then(({data:e})=>{I(e.address||"")}).catch(e=>{console.error(e.message)})},[]),t.jsxs(X,{children:[t.jsx("div",{className:"header",children:t.jsx(M,{title:o("setup.domain.title"),subTitle:o("setup.domain.subTitle"),onClickBack:v})}),t.jsxs(i,{className:"form",sx:{display:"flex",flexDirection:"column",gap:3,overflowY:"auto"},children:[t.jsxs(i,{children:[t.jsxs(i,{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem",children:[t.jsx(i,{display:"inline",children:o("setup.domain.skipStart")}),t.jsx(l,{variant:"text",size:"small",disabled:!!n.addDomainState.text,onClick:()=>s(),style:{paddingTop:0},children:t.jsx("span",{style:{textDecoration:"underline"},children:o("setup.domain.skip")})}),t.jsx(i,{display:"inline",children:o("setup.domain.skipEnd")})]}),t.jsx(i,{sx:{marginTop:"12px"},children:t.jsx(O,{listOnly:!0,inSetup:!0})})]}),t.jsxs(i,{sx:{display:"flex",flexDirection:"column",gap:2},children:[C.nftDomainUrl&&t.jsxs(t.Fragment,{children:[t.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1},children:[t.jsx(g,{color:"primary"}),t.jsx(j,{fontWeight:"fontWeightBold",children:o("setup.domain.buyDIDDomainTitle")})]}),t.jsxs(i,{children:[t.jsx($,{appPk:f,appId:a.appPid,siteId:a.site.id,teamDid:a.meta.did,title:o("common.buy"),inBlockletSetup:!0}),t.jsx(j,{sx:{marginTop:1},children:o("setup.domain.buyDIDDomainTips")})]})]}),t.jsxs(i,{children:[t.jsxs(i,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",overflow:"hidden",cursor:"pointer"},onClick:()=>P(!d),children:[t.jsx(i,{fontWeight:"fontWeightBold",fontSize:"1.125rem",children:o("setup.domain.addTitle")}),t.jsx(_,{sx:{transform:d?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.3s"},children:t.jsx(K,{})})]}),t.jsx(w,{in:d,timeout:"auto",unmountOnExit:!0,children:t.jsx(q,{autoFocus:!1,appPk:f,appId:a.appPid,siteId:a.site.id,teamDid:a.meta.did,cnameDomain:B,currentIp:x,inBlockletSetup:!0,shouldCheckDomain:!0,resolveDomain:e=>S.get(`/dns-resolve?hostname=${e}`),onInputDomain:e=>{m({domain:e.domain,type:e.type}),u(e.error)},onStateChange:e=>m({addDomainState:e}),onSuccess:e=>{const E={domain:e.domain,type:e.type,nftDid:e.nftDid,chainHost:e.chainHost};m(E),s()},onError:u})})]})]})]}),t.jsx(G,{mt:8,disabled:!!n.addDomainState.text,blocklet:a,onStartNow:()=>s("complete"),children:n.domain?t.jsx(l,{variant:"contained",loading:!!n.addDomainState.text,disabled:k||!!n.addDomainState.text||!n.domain,onClick:()=>s(),children:n.addDomainState.text||o("setup.next")}):t.jsx(l,{variant:"contained",disabled:!!n.addDomainState.text,onClick:()=>s(),children:o("setup.skip")})})]})}function bt(s){return t.jsx(z,{children:t.jsx(c,{...s})})}c.propTypes={onNext:y.func,onPrevious:y.func};c.defaultProps={onNext:()=>{},onPrevious:()=>{}};const X=A(Y)`
|
|
2
|
-
height: 100%;
|
|
3
|
-
overflow-y: hidden;
|
|
4
|
-
.form {
|
|
5
|
-
width: 100%;
|
|
6
|
-
height: 100%;
|
|
7
|
-
word-break: break-all;
|
|
8
|
-
}
|
|
9
|
-
`;export{bt as default};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import{$ as ae,aH as $e,z as mt,f as Me,L as pt,e as E,a6 as ft,j as O,a_ as ht,av as Be,a$ as xt,C as Pe,Z as gt,a2 as V,a9 as ze,aW as Dt,au as yt}from"./vendor-arcblock-DE69EmW_.js";import{a1 as le,j as e,bX as Ue,a3 as p,a2 as z,T as q,ad as ce,e as G,t as de,aj as Ne,E as s,a4 as B,M as jt,al as Oe,bm as vt,bn as bt,am as wt,ao as Ct,aa as St,I as Rt}from"./vendor-mui-core-xF5F4eT7.js";import{x as Z,w as At,y as It,H as ue,C as Pt,n as Ee,b as Et}from"./vendor-utils-5TjOM6td.js";import{r as A,g as Tt}from"./vendor-react-D-afvo_7.js";import{d as kt}from"./Add-CuIZWfjH.js";import{b as Lt}from"./base32-LsxuOFGQ.js";import{ah as _t,ai as We,y as F,B as He,h as Te,aj as Ve,T as qt,ak as Ft,ag as Ze,b as $t,H as ke,al as Mt,M as Bt,J as zt,am as Ut,an as Nt,f as Le}from"./index-DVfi3VUs.js";import{d as Ot}from"./LockIcon-D-W4Rph6.js";import{s as Wt,n as Ht,u as H,o as Vt,w as Zt}from"./vendor-hooks-BKxTDk_P.js";import{d as Gt}from"./CheckCircle-D-unagro.js";import{d as Kt,p as _e}from"./util-BTCA4Hee.js";import{_ as K}from"./useSetState-Crt4S51m.js";import{w as Ge}from"./permission-BQ0E8FmL.js";import{_ as Qt,D as qe}from"./useAsyncRetry-Bmo6a1Zp.js";import{C as Q}from"./confirm-DfsY08eB.js";import{d as Xt}from"./InfoOutlined-C8xfkBe6.js";import{_ as Yt}from"./useAsync-Ua5iss51.js";import"./api-K65cLqol.js";import{I as Jt}from"./index-BdfWmlqh.js";import{A as en}from"./actions-DDpgZ17S.js";var me={},tn=le;Object.defineProperty(me,"__esModule",{value:!0});var Ke=me.default=void 0,nn=tn(ae()),sn=e;Ke=me.default=(0,nn.default)((0,sn.jsx)("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}),"ExpandLess");const on=$e({});on.interceptors.request.use(n=>{const t=window.blocklet?window.blocklet.prefix:"/";return n.baseURL=t||"",n.url=Z("/api",String(n.url)),n.timeout=2e5,n.params=n.params||{},new URLSearchParams(n.url.split("?")[1]).has("locale")||(n.params.locale=mt()),n},n=>Promise.reject(n));const Qe=(...n)=>$e(...n),rn=(n,t)=>t?n?[n,...Array.isArray(t)?t:[t]]:t:n,an=(n,{width:t=600,height:i=700,name:o="did-domain:popup"}={})=>{const a=window.screenX+(window.innerWidth-t)/2,r=window.screenY+(window.innerHeight-i)/2,l=[`left=${a}`,`top=${r}`,`width=${t}`,`height=${i}`,"resizable=no","scrollbars=yes","status=yes","popup=yes"],c=window.open("",o,l.join(","));if(c===null)throw new Error("Failed to open popup");return c.location.href=At(n,{opener:window.location.origin}),c},ln="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p",Xe=async n=>{var d;if(!n||!(n!=null&&n.trim()))return null;const t=Qe(),i=new URL(n);i.pathname="__blocklet__.js",i.searchParams.set("type","json");const{data:o}=await t.get(i.toString()),a=(d=o==null?void 0:o.componentMountPoints)==null?void 0:d.find(h=>h.did===ln),r=new URL(n);r.pathname=a==null?void 0:a.mountPoint;const l=r.toString(),c=Z(l,"/api");return{base:l,api:c}},cn=Me({buy:{button:{title:"Buy DID Domain"},status:{inProgress:"Please wait while we are processing your request, the domain will be automatically resolved to the current app after the purchase...",success:"Purchase completed!"},error:{failedToCreateSession:"Failed to create session"}}}),dn=Me({buy:{button:{title:"购买 DID 域名"},status:{inProgress:"请稍等,我们正在处理您的请求,购买域名后会自动解析到当前的应用...",success:"购买完成!"},error:{failedToCreateSession:"创建会话失败"}}}),un={zh:dn,en:cn},mn=async({didDomainURL:n,delegatee:t,delegateePk:i})=>{const o=await Xe(n);if(!o)return null;const a=Qe({baseURL:o.api}),{data:r}=await a.post("/payment/session",{delegatee:t,delegateePk:i});return{sessionId:r.sessionId,baseURL:o.base}};function Ye({delegatee:n,delegateePk:t,didDomainURL:i,locale:o,title:a,onSuccess:r,...l}){const{t:c}=E(),[d,h]=Wt({currentState:1}),f=A.useRef(null),g=Ht(async()=>{const x=await mn({didDomainURL:i,delegatee:n,delegateePk:t});return x},{debounceWait:500,debounceLeading:!0,debounceTrailing:!1,debounceMaxWait:3e3,refreshDeps:[],onError(x){console.error(x)}}),C=H(x=>{var m,S,I,v;x.data.type==="didDomain.success"&&(r==null||r({nftDid:(m=x.data)==null?void 0:m.nftDid,domain:(S=x.data)==null?void 0:S.domain,chainHost:(I=x.data)==null?void 0:I.chainHost}),(v=f.current)==null||v.close(),f.current=null,h({currentState:4}),setTimeout(()=>{h({currentState:8})},2e3))});Vt(()=>{var x;try{window.removeEventListener("message",C),(x=f.current)==null||x.close(),f.current=null}catch(m){console.warn("Failed to close popup",m)}});const D=H(()=>{h({currentState:1})}),j=H(()=>{if(h({currentState:2}),!g.data){console.error("Failed to create session");return}T({sessionId:g.data.sessionId,baseURL:g.data.baseURL})}),T=H(({sessionId:x,baseURL:m})=>{window.addEventListener("message",C);const S=new URL(m);S.searchParams.set("sessionId",x),S.searchParams.set("locale",o),f.current=an(S.toString());const I=setInterval(()=>{var v;(v=f.current)!=null&&v.closed&&(clearInterval(I),D())},1e3);return()=>clearInterval(I)});return e.jsxs(e.Fragment,{children:[e.jsx(Ue,{loading:g.loading,onClick:j,variant:"contained",startIcon:e.jsx(Kt,{}),...l,children:a||c("buy.button.title")}),e.jsxs(ft,{fullWidth:!0,maxWidth:"xs",open:d.currentState>1&&d.currentState<8,onClose:D,children:[!g.error&&e.jsxs(p,{sx:{display:"flex",alignItems:"center",flexDirection:"column",gap:2},children:[d.currentState===2&&e.jsx(z,{size:50}),d.currentState===4&&e.jsx(Gt,{sx:{color:"primary.main",fontSize:"5rem"}}),d.currentState===2&&e.jsx(q,{children:c("buy.status.inProgress")}),d.currentState===4&&e.jsx(q,{children:c("buy.status.success")})]}),g.error&&e.jsx(ce,{severity:"error",children:c("buy.error.failedToCreateSession")})]})]})}const Je={onSuccess:()=>{},title:""};Ye.defaultProps=Je;function et(n){return e.jsx(pt,{locale:n.locale,translations:un,children:e.jsx(Ye,{...n})})}et.defaultProps=Je;function tt({nftDid:n,didDomainURL:t,locale:i,sx:o}){const{t:a}=E(),[r,l]=K({safeIframeRef:null,popoverAnchorEl:null}),c=A.useRef(null),d=G(),h=de(d.breakpoints.down("md")),f=j=>{l({popoverAnchorEl:j.currentTarget})},g=()=>{l({popoverAnchorEl:null})},C=Zt(async()=>{const j=await Xe(t);return j?j.base:null});if(!C.value)return null;if(C.loading)return e.jsx(z,{});const D=Z(C.value,`/embed/domain?nft-did=${n}&locale=${i}`);return e.jsxs(e.Fragment,{children:[e.jsx(p,{component:"img",src:Z(t,"/.well-known/service/blocklet/logo"),alt:"logo",width:16,height:16,onClick:f,sx:rn({cursor:"pointer"},o)}),e.jsx(Ne,{id:"popover-info",open:!!r.popoverAnchorEl,anchorEl:r.popoverAnchorEl,onClose:g,anchorOrigin:{vertical:"bottom",horizontal:"right"},children:e.jsx("iframe",{ref:c,title:a("common.subscription"),width:h?"320px":"400px",height:h?"600px":"680px",style:{border:0},src:D})})]})}tt.defaultProps={sx:{}};const pn=n=>["waiting","creating","renewaling"].includes(n);function pe(n){var w,R;const{t}=E(),[i,o]=A.useState(!1),{inService:a}=F(),[r,l]=A.useState(null),{siteId:c,domain:d,onAdd:h,children:f,did:g}=n,[C,D]=A.useState(!1),{api:j,ws:{useSubscription:T}}=F(),{mode:x,actions:{refreshDomainStatus:m}}=He(),S=Qt(async()=>{const{cert:b}=await j.findCertificateByDomain({input:{domain:d,did:g}});return b}),I=(b,U)=>{b.domain===d&&(D(!1),o(!1),a&&x!=="setup"&&(U==="success"?O.success(t("setup.domain.genCertSuccess",{domain:b.domain})):U==="error"&&O.error(t("setup.domain.genCertFailed",{domain:b.domain,message:b.message}))))};if(A.useEffect(()=>{var b;S.loading||D(pn((b=S.value)==null?void 0:b.status))},[S.loading,(w=S.value)==null?void 0:w.status]),T(Te.BlockletEvents.certError,b=>I(b,"error")),T(Te.BlockletEvents.certIssued,b=>{S.retry(),m(b.domain),I(b,"success")}),S.loading||((R=S.value)==null?void 0:R.status)==="normal")return"";const v=()=>{o(!1),l(null)},k=async()=>{o(!0);try{await j.issueLetsEncryptCert({input:{siteId:c,domain:d,did:g,inBlockletSetup:x==="setup"}}),h(),D(!0)}catch(b){console.error(b),D(!1)}finally{o(!1),l(null)}},u={title:t("router.cert.genLetsEncryptCert.title"),description:e.jsxs("div",{children:[e.jsx(ce,{severity:"success",children:t("router.cert.genLetsEncryptCert.dnsTip")}),t("router.cert.genLetsEncryptCert.description")]}),confirm:t("common.confirm"),onConfirm:k,onCancel:v},L=b=>{b.stopPropagation(),l(u)};return e.jsxs(e.Fragment,{children:[C?e.jsx(B,{title:t("router.cert.issuing"),children:e.jsx(z,{size:12})}):f({loading:i,open:L}),r&&e.jsx(Q,{color:"primary",title:r.title,description:r.description,confirm:r.confirm,params:r.params,onConfirm:r.onConfirm,onCancel:r.onCancel})]})}pe.propTypes={domain:s.string.isRequired,did:s.string.isRequired,siteId:s.string.isRequired,onAdd:s.func,children:s.any};pe.defaultProps={onAdd:()=>{},children:null};function fe(n){const{domain:t,domainStatus:i,...o}=n;return _t(t)||!We(t)||It(i)||i!=null&&i.isHttps?"":e.jsx(pe,{domain:t,...o})}fe.propTypes={domain:s.string.isRequired,domainStatus:s.shape({isHttps:s.bool}).isRequired,did:s.string.isRequired,onAdd:s.func,children:s.any};fe.defaultProps={onAdd:()=>{},children:null};var he={},fn=le;Object.defineProperty(he,"__esModule",{value:!0});var nt=he.default=void 0,hn=fn(ae()),xn=e;nt=he.default=(0,hn.default)((0,xn.jsx)("path",{d:"M17 20.41 18.41 19 15 15.59 13.59 17zM7.5 8H11v5.59L5.59 19 7 20.41l6-6V8h3.5L12 3.5z"}),"CallMerge");const st=A.createContext({}),{Provider:gn,Consumer:ts}=st;function Dn({children:n}){const[t,i]=K({domain:"",error:null}),{locale:o}=E(),a={error:t.error,domain:t.domain,setError:r=>{i({error:r})},setDomain:r=>{const l=ue(r),c=Ve(l,o);i({domain:l,error:c})}};return e.jsx(gn,{value:{value:a},children:n})}function yn(){const{value:n}=A.useContext(st);return n}const{joinURL:Fe}=qt,jn=Ft,ot="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p",vn=async n=>{var c;if(!n||!(n!=null&&n.trim()))return null;const t=new URL(n);t.pathname="__blocklet__.js",t.searchParams.set("type","json");const{data:i}=await jn.get(t.toString()),o=(c=i==null?void 0:i.componentMountPoints)==null?void 0:c.find(d=>d.did===ot),a=new URL(n);a.pathname=o==null?void 0:o.mountPoint;const r=a.toString(),l=Fe(r,"/api");return{base:r,api:l,domain:Fe(l,"/domains")}};var bn={DID_DOMAIN_SERVICE_DID:ot,getDidDomainServiceURL:vn},X={exports:{}};const wn=ht,Cn=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class it extends Error{constructor(t){super(),t instanceof Error?(this.originalError=t,{message:t}=t):(this.originalError=new Error(t),this.originalError.stack=this.stack),this.name="AbortError",this.message=t}}const Sn=(n,t,i)=>{const o=i.retries-(t-1);return n.attemptNumber=t,n.retriesLeft=o,n},Rn=n=>Cn.includes(n),rt=(n,t)=>new Promise((i,o)=>{t={onFailedAttempt:()=>{},retries:10,...t};const a=wn.operation(t);a.attempt(async r=>{try{i(await n(r))}catch(l){if(!(l instanceof Error)){o(new TypeError(`Non-error was thrown: "${l}". You should only throw errors.`));return}if(l instanceof it)a.stop(),o(l.originalError);else if(l instanceof TypeError&&!Rn(l.message))a.stop(),o(l);else{Sn(l,r,t);try{await t.onFailedAttempt(l)}catch(c){o(c);return}a.retry(l)||o(a.mainError())}}})});X.exports=rt;X.exports.default=rt;X.exports.AbortError=it;var An=X.exports;const In=Tt(An);function xe({domain:n,resolvedTarget:t,...i}){const{t:o,locale:a}=E();return e.jsxs(p,{sx:{backgroundColor:"rgb(236, 251, 253)",borderColor:"rgb(236, 251, 253)",borderRadius:"8px",padding:"12px"},...i,children:[e.jsxs(p,{display:"flex",children:[o("router.domain.setup.tipStart"),n&&e.jsx(p,{mx:.5,color:"primary.main",fontWeight:"fontWeightBold",children:n}),o("router.domain.setup.tipEnd"),":"]}),e.jsxs(p,{sx:{"&>div":{mb:0},marginTop:"8px"},children:[e.jsx(se,{label:o("router.domain.setup.recordType"),value:"CNAME",locale:a}),e.jsx(se,{label:o("router.domain.setup.recordValue"),value:t,locale:a})]})]})}xe.propTypes={domain:s.string,resolvedTarget:s.string.isRequired};xe.defaultProps={domain:""};function se({locale:n,label:t,value:i}){const o=de(r=>r.breakpoints.down("md")),a=G();return e.jsx(Jt,{name:t,nameWidth:120,children:e.jsxs(p,{sx:{display:"flex",alignItems:"center",lineHeight:1},children:[e.jsx(q,{component:"span",color:"primary.main",overflow:"auto",sx:o?{maxWidth:"95%",wordWrap:"break-word"}:{wordWrap:"break-word"},children:i}),e.jsx(Be,{content:i,locale:n,style:{marginLeft:"4px",color:a.palette.text.secondary}})]})})}se.propTypes={locale:s.string.isRequired,label:s.string.isRequired,value:s.string.isRequired};function ge({siteId:n,teamDid:t,cnameDomain:i,defaultCustomDomain:o,onInputDomain:a,appId:r,appPk:l,onSuccess:c,onError:d,disabled:h,autoFocus:f,inBlockletSetup:g,shouldCheckDomain:C,onStateChange:D,currentIp:j,resolveDomain:T,...x}){const{t:m,locale:S}=E(),{api:I,info:v}=F(),k=yn(),u=G(),L=xt({key:"sm"}),[w,R]=K({submittingDomain:!1,domain:o,error:null,type:v!=null&&v.nftDomainUrl?"nftDomain":"inputDomain",showNFTDomainAuth:!1,showDnsTip:!1}),b=Yt(()=>bn.getDidDomainServiceURL(v==null?void 0:v.nftDomainUrl));if(v!=null&&v.nftDomainUrl&&b.loading)return e.jsx(p,{...x,children:e.jsx(Pe,{relative:"parent",children:e.jsx(z,{})})});if(b.error)return e.jsx(p,{...x,children:e.jsx(Pe,{relative:"parent",children:b.error.message})});const U=b.value,lt=()=>{R({invalidDNSDomain:null})},ee=async y=>{D(m("setup.domain.addingDomain")),await I.addDomainAlias({input:{id:n,domainAlias:y,teamDid:t,inBlockletSetup:!0}}),R({submittingDomain:!1}),c({domain:y,type:"inputDomain"})},Se=async({domain:y,type:P,nftDid:N,chainHost:_})=>{try{if(!C){if(P==="inputDomain"){await ee(y);return}c({domain:y,type:P,nftDid:N,chainHost:_});return}D({text:m("setup.domain.checkingResolvable")});let $=30;const te=3e3,ut=$*1e3/te,Ae=setInterval(()=>{if($<=0){clearInterval(Ae);return}D({text:`${m("setup.domain.checkingResolvable")} (${$--}s)`})},1e3),Ie=await In(async()=>{const{data:M}=await T(y);if(!M.address)throw new Error("Cannot resolve domain");return M.address},{retries:ut,minTimeout:te,maxTimeout:te,onFailedAttempt:console.error}).catch(console.error);if(clearInterval(Ae),!Ie){const M=m("setup.domain.cannotResolve",{domain:y});if(P==="nftDomain"){O.error(M),c({domain:y,type:"nftDomain"});return}D({text:""}),R({invalidDNSDomain:{domain:y,error:M},domain:y,type:P,submittingDomain:!1});return}if(Ie!==j){const M=m("setup.domain.resolvedAddressError",{domain:y,curDomain:window.location.hostname});if(P==="nftDomain"){O.error(M),c({domain:y,type:"nftDomain"});return}D({text:""}),R({invalidDNSDomain:{domain:y,error:M},domain:y,type:P,submittingDomain:!1});return}if(P==="nftDomain"){c({domain:y,type:"nftDomain"});return}await ee(y)}catch($){O.error($.message),D({text:""}),R({submittingDomain:!1})}},ct=async({domain:y,nftDid:P,chainHost:N})=>{try{const _=_e(y);R({submittingDomain:!0}),await I.addDomainAlias({input:{id:n,type:"nft-domain",domainAlias:_,nftDid:P,chainHost:N,teamDid:t,inBlockletSetup:g}});const $="nftDomain";R({showNFTDomainAuth:!1,type:$}),await Se({domain:_,type:$,nftDid:P,chainHost:N})}catch(_){O.error(_.message)}finally{R({showNFTDomainAuth:!1,submittingDomain:!1})}},dt=async()=>{try{R({submittingDomain:!0});const y=_e(w.domain);if(v.nftDomainUrl&&U&&(await I.isDidDomain({input:{domain:y}})).value===!0){R({showNFTDomainAuth:!0});return}await Se({domain:y,type:w.type})}catch(y){R({submittingDomain:!1}),k.setError(y.message)}},Re=k.error||w.error;return e.jsx(p,{...x,children:e.jsxs(p,{sx:{display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:"1em"},children:[e.jsxs(p,{sx:{display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx(q,{sx:{color:u.palette.text.primary},children:m("router.domainAlias.add.tips")}),e.jsx(jt,{sx:{display:"block",marginTop:"8px"},label:m("router.domainAlias.add.domainDescription"),helperText:w.type==="inputDomain"&&Re||m("router.domainAlias.add.helperText"),inputProps:{"data-cy":"domain-name-input"},fullWidth:!0,disabled:h,value:w.domain,size:"small",variant:"outlined",error:!!Re&&w.type==="inputDomain",onChange:y=>{var _;const P=ue((_=y.target)==null?void 0:_.value);k.setDomain(P);const N=Ve(P,S);R({domain:P,error:N,type:"inputDomain"}),a({domain:P,error:N,type:"inputDomain"})},autoFocus:f,onBlur:()=>{k.domain||(R({error:null}),k.setError(null))}}),e.jsx(p,{sx:{width:"100%",display:"flex",justifyContent:"flex-end"},children:e.jsx(Ue,{"data-cy":"confirm-add-domain",fullWidth:L,variant:"contained",loading:w.submittingDomain,onClick:dt,children:m("common.add")})}),e.jsxs(p,{sx:{cursor:"pointer",fontSize:"14px",display:"flex",alignItems:"center",gap:"4px",lineHeight:1,color:u.palette.primary.main},onClick:()=>R({showDnsTip:!w.showDnsTip}),children:[e.jsx(Xt,{fontSize:"1em"}),m("router.domainAlias.showTipHint")]}),w.showDnsTip&&e.jsx(xe,{domain:w.domain,resolvedTarget:i,style:{marginTop:"4px"}})]}),w.invalidDNSDomain&&e.jsx(Q,{title:m("common.reminder"),description:m("setup.domain.invalidDNSReminder",{error:w.invalidDNSDomain.error}),color:"primary",confirm:m("setup.domain.continueAdd"),onConfirm:()=>ee(w.invalidDNSDomain.domain,w.type),onCancel:lt}),U&&e.jsx(gt,{open:w.showNFTDomainAuth,popup:!0,useSocket:!1,forceConnected:!1,action:"authorize",baseUrl:U.api,checkFn:Pt.create({baseURL:U.api}).get,extraParams:{delegatee:r,delegateePk:l,domain:w.domain},onSuccess:ct,onClose:()=>R({showNFTDomainAuth:!1,submittingDomain:!1}),checkTimeout:60*5e3,showDownload:!1,messages:{title:m("router.domainAlias.addDomainNFT.connect.title"),scan:m("router.domainAlias.addDomainNFT.connect.scan"),confirm:m("router.domainAlias.addDomainNFT.connect.confirm"),success:m("router.domainAlias.addDomainNFT.connect.success")}})]})})}ge.propTypes={siteId:s.string.isRequired,currentIp:s.string,teamDid:s.string.isRequired,cnameDomain:s.string.isRequired,defaultCustomDomain:s.string,onInputDomain:s.func,onSuccess:s.func,appId:s.string,appPk:s.string,disabled:s.bool,autoFocus:s.bool,inBlockletSetup:s.bool,shouldCheckDomain:s.bool,onStateChange:s.func,resolveDomain:s.func,onError:s.func};ge.defaultProps={defaultCustomDomain:"",currentIp:"",onInputDomain:Ee,onSuccess:Ee,appId:"",appPk:"",disabled:!1,autoFocus:!0,inBlockletSetup:!1,shouldCheckDomain:!1,onStateChange:()=>{},resolveDomain:()=>{},onError:()=>{}};function De({id:n,children:t,title:i,teamDid:o,systemDomains:a,appId:r,appPk:l}){const{t:c}=E(),[d,h]=K({loading:!1,confirmSetting:null}),f=a.find(j=>Ze.isDidDomain(j)),g=()=>{h({loading:!1,confirmSetting:null})},C={title:i||c("router.domainAlias.add.title"),description:function(T,x,m){return e.jsx(ge,{siteId:n,teamDid:o,cnameDomain:f,onSuccess:()=>h({confirmSetting:null}),onInputDomain:({domain:S,type:I,error:v})=>{x({...T,domain:S,type:I,__disableConfirm:!!v}),m(v)},appId:r,appPk:l})},confirm:c("common.confirm"),cancel:c("common.cancel"),params:{domain:"",__disableConfirm:!0},onCancel:g},D=j=>{j.stopPropagation(),h({confirmSetting:C})};return e.jsxs(e.Fragment,{children:[typeof t=="function"?t({loading:d.loading,open:D}):e.jsxs(Oe,{onClick:D,className:"rule-action","data-cy":"action-add-domain-alias",children:[d.loading?e.jsx(z,{size:16}):e.jsx(nt,{style:{fontSize:18,marginRight:5}}),c("router.domainAlias.add.title")]}),d.confirmSetting&&e.jsx(Q,{title:d.confirmSetting.title,description:d.confirmSetting.description,confirm:d.confirmSetting.confirm,cancel:d.confirmSetting.cancel,params:d.confirmSetting.params,onCancel:d.confirmSetting.onCancel,showConfirm:!1,showCancel:!0,displayError:!1,color:"primary",loading:d.loading,maxWidth:"sm"})]})}De.propTypes={id:s.string.isRequired,children:s.any,title:s.string,teamDid:s.string,systemDomains:s.arrayOf(s.string).isRequired,appId:s.string,appPk:s.string.isRequired};De.defaultProps={children:null,title:"",teamDid:"",appId:null};function Pn(n){return e.jsx(Dn,{children:e.jsx(De,{...n})})}function ye({appId:n,appPk:t,siteId:i,inBlockletSetup:o,teamDid:a,sx:r,...l}){const{api:c,info:d}=F(),{locale:h,t:f}=E(),g=async({domain:C,nftDid:D,chainHost:j})=>{await c.addDomainAlias({input:{id:i,type:"nft-domain",domainAlias:C,nftDid:D,chainHost:j,teamDid:a,inBlockletSetup:o}})};return e.jsx(et,{delegatee:n,delegateePk:t,didDomainURL:d.nftDomainUrl,onSuccess:g,locale:h,variant:"outlined",sx:r,title:f("router.domainAlias.addDomainNFT.buy"),...l})}ye.propTypes={appId:s.string.isRequired,appPk:s.string.isRequired,siteId:s.string.isRequired,inBlockletSetup:s.bool.isRequired,teamDid:s.string.isRequired,sx:s.object};ye.defaultProps={sx:{}};function je(n){const{t}=E(),[i,o]=A.useState(!1),[a,r]=A.useState(null),{id:l,domain:c,children:d,teamDid:h}=n,{api:f}=F(),g=()=>{o(!1),r(null)},C=async()=>{o(!0);try{await f.deleteDomainAlias({input:{id:l,domainAlias:c,teamDid:h}}),await $t(2e3)}catch(T){O.error(T.message)}finally{r(null),o(!1)}},D={title:t("router.domainAlias.delete.title"),description:t("router.domainAlias.delete.description"),confirm:t("common.confirm"),onConfirm:C,onCancel:g},j=T=>{T.stopPropagation(),r(D)};return e.jsxs(e.Fragment,{children:[typeof d=="function"?d({loading:i,open:j}):e.jsxs(V,{edge:"end",onClick:j,size:"small",className:"rule-action",color:"error","data-cy":"action-delete-domain-alias",children:[i?e.jsx(z,{size:16}):e.jsx(ze,{style:{fontSize:16}}),t("router.domainAlias.delete.title")]}),a&&e.jsx(Q,{title:a.title,description:a.description,confirm:a.confirm,params:a.params,onConfirm:a.onConfirm,onCancel:a.onCancel})]})}je.propTypes={id:s.string.isRequired,domain:s.string.isRequired,children:s.any,teamDid:s.string};je.defaultProps={children:null,teamDid:""};function ve({site:n,domain:t,blocklet:i}){const{t:o}=E(),a=t.value===window.location.hostname;return e.jsx(en,{"data-cy":"domain-actions",size:"large",actions:[({close:r})=>{var l;return e.jsx(je,{id:n.id,domain:t.value,teamDid:(l=i==null?void 0:i.meta)==null?void 0:l.did,children:({open:c})=>e.jsx(B,{title:a?o("blocklet.router.currentDomainTip"):"",children:e.jsx("span",{children:e.jsxs(Oe,{disabled:t.isProtected||a,dense:!0,onClick:d=>{r(),c(d)},"data-cy":"action-toggle-block",children:[e.jsx(vt,{style:{minWidth:24,marginRight:8},children:e.jsx(ze,{})}),e.jsx(bt,{primary:o("common.delete")})]},"remove")})})})}]})}ve.propTypes={site:s.object.isRequired,domain:s.object.isRequired,blocklet:s.object.isRequired};ve.defaultProps={};var be={},En=le;Object.defineProperty(be,"__esModule",{value:!0});var we=be.default=void 0,Tn=En(ae()),kn=e;we=be.default=(0,Tn.default)((0,kn.jsx)("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1z"}),"Https");const Y=s.shape({href:s.string,accessibility:s.shape({loading:s.bool,accessible:s.bool}),domainStatus:s.shape({isHttps:s.bool,matchedCert:s.object}),dns:s.shape({resolved:s.bool,ip:s.string})});function Ce({certificate:n}){const[t,i]=A.useState(null),o=F(),{t:a,locale:r}=E(),l=h=>{i(h.currentTarget)},c=()=>{i(null)},d=!!t;return e.jsxs(e.Fragment,{children:[e.jsx(we,{"aria-owns":d?"mouse-over-popover":void 0,onMouseEnter:l,onMouseLeave:c,style:{color:"#44cdc6",fontSize:20,cursor:"pointer"}}),e.jsx(Ne,{id:"mouse-over-popover",style:{pointerEvents:"none"},open:d,anchorEl:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:c,disableRestoreFocus:!0,children:e.jsx(wt,{children:e.jsxs(Ct,{style:{display:"flex"},children:[e.jsx("div",{children:e.jsx("img",{src:`${o.imgPrefix}/https-certificate-icon.png`,alt:"certificate icon",style:{maxHeight:"100%",maxWidth:"100%"}})}),e.jsxs(q,{component:"div",style:{marginLeft:"16px"},children:[e.jsx(q,{component:"div",style:{fontWeight:"bold"},children:n.domain}),e.jsx(q,{component:"div",children:`${a("common.issuer")}: ${Et(n,"issuer.commonName","")}`}),e.jsx(q,{component:"div",children:`${a("router.cert.issuedOn")}: ${ke(n.validFrom,r)}`}),e.jsx(q,{component:"div",children:`${a("router.cert.expiryOn")}: ${ke(n.validTo,r)}`})]})]})})})]})}Ce.propTypes={certificate:s.object};Ce.defaultProps={certificate:{}};function W({domain:n,filters:t}){const{t:i}=E(),{value:o,domainStatus:a}=n;if(!We(o))return null;let r=null,l=null;const{isHttps:c,matchedCert:d}=a;if(!Mt(o)){const{dns:{resolved:f,ip:g}={}}=a;f||g==="127.0.0.1"?r=e.jsx(B,{title:i("router.domain.verify.ok"),children:e.jsx(qe,{color:"success"})}):r=e.jsx(B,{title:i("router.domain.verify.notResolved"),children:e.jsx(qe,{color:"error"})})}c?l=e.jsx(Ce,{certificate:d}):l=e.jsx(B,{title:i("router.domain.https.bad"),children:e.jsx(we,{style:{color:"#D0021B",fontSize:20,cursor:"pointer"}})});const h=t.map(f=>f==="domain"?r:f==="http"?l:null);return A.createElement(A.Fragment,null,...h)}W.propTypes={domain:Y.isRequired,filters:s.array};W.defaultProps={filters:["domain","http"]};const Ln=Ge(J,"mutate_blocklets"),_n=Ge(J,"",Bt);function at(n){const{inService:t}=F(),{blocklet:i,loadingRuntimeInfo:o}=He();let a=Ln;return t&&(a=_n),e.jsx(a,{...n,blocklet:i,inService:t,loadingRuntimeInfo:o})}at.propTypes={listOnly:s.bool};at.defaultProps={listOnly:!1};function J({hasPermission:n,blocklet:t,loadingRuntimeInfo:i,inService:o,listOnly:a}){var S,I,v,k;const{t:r}=E(),{info:l}=F(),[c,d]=A.useState(!1),h=de(u=>u.breakpoints.down("md")),f=A.useMemo(()=>{let u=n;return zt(t)&&(u=u&&o),u},[n,o,t]),{site:g}=t,C=A.useMemo(()=>{var u;return Ut((u=t.site)==null?void 0:u.domainAliases)},[(S=t.site)==null?void 0:S.domainAliases]),D=[],j=[],T=Lt.encode(t.appPid),x=(v=(I=t.environments)==null?void 0:I.find(u=>u.key==="BLOCKLET_APP_PK"))==null?void 0:v.value,m=Nt(C);return C.forEach(u=>{const L=u.value||"";Ze.isDidDomain(L)&&!L.startsWith(T)?j.push(u):D.push(u)}),e.jsxs(e.Fragment,{children:[!a&&e.jsxs(e.Fragment,{children:[e.jsxs(p,{className:"title first",display:"flex",justifyContent:"space-between",alignItems:"center",children:[e.jsx(p,{children:r("common.domain")}),f&&e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Pn,{id:g.id,title:r("router.domain.add.title"),teamDid:(k=t.meta)==null?void 0:k.did,appId:t.appPid,appPk:x,systemDomains:m==null?void 0:m.map(u=>u.value),children:({open:u})=>e.jsxs(V,{style:{marginLeft:16},variant:"contained",color:"primary","data-cy":"add-domain-alias",onClick:u,disabled:Le.isInProgress(t.status),children:[e.jsx(kt,{style:{fontSize:"1.3em",marginRight:4}}),r("common.add")]})}),l.nftDomainUrl&&e.jsx(ye,{variant:"outlined",appId:t.appPid,appPk:x,siteId:g.id,inBlockletSetup:!1,teamDid:t.meta.did})]})]}),Le.isAccessible(t.status)===!1&&e.jsx(p,{mt:1.5,mb:1.5,children:e.jsx(ce,{severity:"warning",children:r("blocklet.router.noRunning")})})]}),e.jsx(p,{sx:{display:"flex",flexDirection:"column",gap:1},children:(c?C:D).map(u=>{var w,R;const L=u.value;return e.jsxs(A.Fragment,{children:[h&&e.jsxs(p,{display:"flex",flexDirection:"column",children:[e.jsx(p,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:e.jsx(oe,{domain:u,target:"_blank",children:u.value})}),e.jsxs(p,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:1},children:[e.jsx(W,{domain:u,filters:["domain"]},`${u.value}-domain`),e.jsx(re,{siteId:(w=t.site)==null?void 0:w.id,domain:u,blocklet:t,hasMutatePermission:f})]}),e.jsx(p,{sx:{button:{padding:0}},children:e.jsx(ie,{hasMutatePermission:f,site:g,domain:u,blocklet:t})})]})]},L),!h&&e.jsxs(p,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(p,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(W,{domain:u,filters:["domain"]},`${u.value}-domain`),e.jsx(p,{sx:{ml:2,mr:.5},children:e.jsx(oe,{domain:u,target:"_blank",children:u.value})}),e.jsx(re,{siteId:(R=t.site)==null?void 0:R.id,domain:u,blocklet:t,hasMutatePermission:f})]}),e.jsx(p,{sx:{button:{padding:0}},children:e.jsx(ie,{hasMutatePermission:f,site:g,domain:u,blocklet:t})})]},L)]},L)})}),j.length>0&&e.jsx("div",{style:{marginLeft:"20px",marginTop:"12px"},children:e.jsx(V,{endIcon:c?e.jsx(Ke,{}):e.jsx(Dt,{}),onClick:()=>d(!c),children:r(c?"common.collapseAll":"blocklet.router.showAllDomains")})}),!C.length&&(i?e.jsx(z,{size:16}):e.jsx(yt,{children:r("common.empty")}))]})}J.propTypes={hasPermission:s.bool,blocklet:s.object.isRequired,loadingRuntimeInfo:s.bool,inService:s.bool.isRequired,listOnly:s.bool};J.defaultProps={hasPermission:!1,loadingRuntimeInfo:!1,listOnly:!1};function oe({domain:n,children:t,...i}){const{t:o,locale:a}=E(),{href:r,accessibility:l,value:c}=n,d=A.useCallback(()=>e.jsx(Be,{content:ue(c),locale:a,style:{marginLeft:"4px",color:"#999",fontSize:"0.8em",verticalAlign:"bottom"}}),[c,a]);return!l||l.loading?e.jsxs(ne,{...i,children:[t,d(),e.jsx(B,{title:o("blocklet.router.checkUrlAccessible"),placement:"top-end",children:e.jsx("span",{className:"status",children:e.jsx(z,{size:12})})})]}):l.accessible?e.jsxs(ne,{...i,children:[e.jsx(p,{component:"a",href:r,target:"_blank",rel:"noopener noreferrer",children:t}),d()]}):e.jsxs(ne,{...i,children:[e.jsx(B,{title:o("blocklet.router.urlInaccessible"),placement:"top-end",children:e.jsx("span",{children:t})}),d()]})}oe.propTypes={domain:Y.isRequired,children:s.any.isRequired};const ne=St.span`
|
|
2
|
-
&,
|
|
3
|
-
& > * {
|
|
4
|
-
color: #222;
|
|
5
|
-
font-size: 18px;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
& > * {
|
|
9
|
-
word-break: break-all;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.status {
|
|
13
|
-
margin-left: 8px;
|
|
14
|
-
}
|
|
15
|
-
`;function ie({hasMutatePermission:n,site:t,domain:i,blocklet:o}){const a=G(),{t:r}=E();return n&&!i.isProtected?e.jsx(ve,{site:t,domain:i,blocklet:o}):e.jsx(B,{title:r("blocklet.router.domainLockTooltip"),placement:"top",children:e.jsx(Rt,{disabled:!0,size:"large",style:{pointerEvents:"auto",paddingTop:0,paddingBottom:0},children:e.jsx(Ot,{style:{fill:a.palette.text.disabled}})})})}ie.propTypes={hasMutatePermission:s.bool.isRequired,site:s.object.isRequired,domain:Y.isRequired,blocklet:s.object.isRequired};function re({siteId:n,domain:t,blocklet:i,hasMutatePermission:o}){const{info:a}=F(),{t:r,locale:l}=E();return e.jsxs(p,{sx:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:1},children:[t.type==="nft-domain"&&e.jsx(tt,{locale:l,nftDid:t.nftDid,didDomainURL:a.nftDomainUrl}),e.jsx(W,{domain:t,filters:["http"]},`${t.value}-http`),o&&e.jsx(fe,{siteId:n,domain:t.value,domainStatus:t.domainStatus,did:i.meta.did,children:({open:c})=>e.jsx(V,{sx:{padding:0},size:"small",onClick:d=>c(d),children:r("router.cert.genLetsEncryptCert.title")})})]})}re.propTypes={siteId:s.string.isRequired,domain:Y.isRequired,blocklet:s.object.isRequired,hasMutatePermission:s.bool.isRequired};export{ge as A,ye as B,Dn as D,at as a};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{a1 as X,j as e,E as t,I as k,bq as A,x as U,P as V,v as W,$ as G,ar as H,al as J,bS as Q,M as Y,a3 as u,a2 as Z}from"./vendor-mui-core-xF5F4eT7.js";import{$ as ee,a1 as te,ae as se}from"./vendor-arcblock-DE69EmW_.js";import{b as P,r as i}from"./vendor-react-D-afvo_7.js";import{d as ae}from"./Done-C8ZSABDp.js";import{F as le,R as ne}from"./logo-uploader-DZitXtFf.js";import{d as re}from"./EditIcon-BOr0kf6I.js";import{d as ie}from"./ArrowDropDown-Cv3eCDY6.js";var R={},oe=X;Object.defineProperty(R,"__esModule",{value:!0});var ce=R.default=void 0,ue=oe(ee()),de=e;ce=R.default=(0,ue.default)((0,de.jsx)("path",{d:"M19.43 12.98c.04-.32.07-.64.07-.98 0-.34-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.09-.16-.26-.25-.44-.25-.06 0-.12.01-.17.03l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.06-.02-.12-.03-.18-.03-.17 0-.34.09-.43.25l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98 0 .33.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.09.16.26.25.44.25.06 0 .12-.01.17-.03l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.06.02.12.03.18.03.17 0 .34-.09.43-.25l2-3.46c.12-.22.07-.49-.12-.64zm-1.98-1.71c.04.31.05.52.05.73 0 .21-.02.43-.05.73l-.14 1.13.89.7 1.08.84-.7 1.21-1.27-.51-1.04-.42-.9.68c-.43.32-.84.56-1.25.73l-1.06.43-.16 1.13-.2 1.35h-1.4l-.19-1.35-.16-1.13-1.06-.43c-.43-.18-.83-.41-1.23-.71l-.91-.7-1.06.43-1.27.51-.7-1.21 1.08-.84.89-.7-.14-1.13c-.03-.31-.05-.54-.05-.74s.02-.43.05-.73l.14-1.13-.89-.7-1.08-.84.7-1.21 1.27.51 1.04.42.9-.68c.43-.32.84-.56 1.25-.73l1.06-.43.16-1.13.2-1.35h1.39l.19 1.35.16 1.13 1.06.43c.43.18.83.41 1.23.71l.91.7 1.06-.43 1.27-.51.7 1.21-1.07.85-.89.7zM12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4m0 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2"}),"SettingsOutlined");function I({triggers:l,onEnterEdit:a,disabled:m}){const n=P.useRef(null),[p,o]=P.useState(!1),b=s=>{o(!1),s()},C=()=>{o(s=>!s)},d=s=>{n.current&&n.current.contains(s.target)||o(!1)};return l.length===0?e.jsx(k,{"data-cy":"schema-form-item-edit",onClick:a,disabled:m,size:"large",children:e.jsx(re,{})}):e.jsxs(e.Fragment,{children:[e.jsx(A,{variant:"outlined",ref:n,"aria-label":"split button",children:e.jsx(U,{size:"large","aria-controls":p?"split-button-menu":void 0,"aria-expanded":p?"true":void 0,sx:{paddingLeft:"12px",paddingRight:"12px"},onClick:C,children:e.jsx(ie,{})})}),e.jsx(V,{sx:{zIndex:9999},open:p,anchorEl:n.current,role:void 0,placement:"bottom-end",children:e.jsx(W,{children:e.jsx(G,{onClickAway:d,children:e.jsx(H,{id:"split-button-menu",autoFocusItem:!0,children:l.map(s=>e.jsx(J,{onClick:()=>b(s.handler),children:s.title},s.key))})})})})]})}I.propTypes={triggers:t.arrayOf(t.shape({key:t.string.isRequired,title:t.string.isRequired,handler:t.func.isRequired})),onEnterEdit:t.func.isRequired,disabled:t.bool.isRequired};I.defaultProps={triggers:[]};const T=(l,a,m)=>l===null&&a&&m?"******":l?a?"******":l:"",fe=Q`
|
|
2
|
-
0%, 100% {
|
|
3
|
-
transform: scale(1) translateX(0);
|
|
4
|
-
}
|
|
5
|
-
50% {
|
|
6
|
-
transform: scale(1.05) translateX(-3px);
|
|
7
|
-
}
|
|
8
|
-
25%, 75% {
|
|
9
|
-
transform: scale(1.1) translateX(3px);
|
|
10
|
-
}
|
|
11
|
-
`;function w({label:l,disabled:a,required:m,initialValue:n,onChange:p,placeholder:o,style:b,onSubmit:C,secure:d,triggers:s,formatterBeforeSubmit:_,...N}){const[q,g]=i.useState(!1),[h,v]=i.useState(!1),{t:L}=i.useContext(te),[y,$]=i.useState(d&&n==="__encrypted__"?null:n),[c,x]=i.useState(y),[f,j]=i.useState(!1),[B,E]=i.useState(!1),F=async()=>{v(!0);try{if(await C(c)===!1)x(y);else{let S=c;typeof _=="function"&&(S=_(c)),x(S),$(S),j(!1)}}catch{x(y)}finally{v(!1),g(!1)}},M=r=>{j(r!==c),x(r),p(r)},O=r=>{r.key==="Enter"&&F()},z=i.useCallback(()=>{E(!0),setTimeout(()=>{E(!1)},500)},[]),D=i.useCallback(()=>{f&&z(),!f&&!a&&!h&&(g(!1),j(!1))},[f,a,h,z]),K=q?e.jsx(Y,{style:{flex:1},fullWidth:!0,value:c,onChange:r=>{M(r.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:o,onKeyDown:O,onBlur:D,disabled:a,type:d?"password":"text",...N}):e.jsx(u,{px:1,"data-cy":"schema-form-item-edit",className:"form-item-input slot",style:{whiteSpace:"pre-wrap",cursor:"text"},onClick:()=>{a||g(!0)},children:T(c,d,n)?T(c,d,n):e.jsx("span",{className:"placeholder",children:L("common.requiredInputPlaceholder",{name:o||l})})});return e.jsx(le,{className:"form",style:b,children:e.jsxs(u,{className:"form-item",children:[e.jsxs(u,{className:"form-item-label",children:[l,m&&e.jsx(ne,{})]}),e.jsxs(u,{className:"form-item-body",style:{alignItems:"flex-start"},children:[e.jsx(u,{className:"form-item-input",children:K}),e.jsx(u,{className:"form-item-action",style:{marginLeft:s.length?12:0},children:q?e.jsxs(e.Fragment,{children:[f?e.jsx(k,{"data-cy":"schema-form-item-confirm",onClick:F,disabled:a||h||!f,sx:{animation:B?`${fe} 0.5s linear`:"none"},style:{paddingRight:4},size:"large",children:h?e.jsx(Z,{size:24}):e.jsx(ae,{})}):null,e.jsx(k,{"data-cy":"schema-form-item-cancel",onClick:()=>{x(y),g(!1),j(!1)},style:{paddingLeft:f?4:8},disabled:a||h,size:"large",children:e.jsx(se,{})})]}):e.jsx(u,{children:s.length?e.jsx(I,{triggers:s,disabled:a}):null})})]})]})})}w.propTypes={style:t.object,onSubmit:t.func,onChange:t.func,label:t.string,initialValue:t.string,placeholder:t.string,required:t.bool,disabled:t.bool,secure:t.bool,triggers:t.array,formatterBeforeSubmit:t.func};w.defaultProps={style:{},onSubmit:()=>{},onChange:()=>{},label:"",initialValue:"",placeholder:"",required:!1,disabled:!1,secure:!1,triggers:[],formatterBeforeSubmit:null};export{w as F,ce as d};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import{r as g}from"./vendor-react-D-afvo_7.js";import{j as e,a1 as Re,E as y,a4 as qe,T as K,a3 as C,aa as ce,a2 as pe,ah as Me,aj as De,x as Ne,R as Ue,bH as Te,bI as $e,aP as Ve,al as Se,V as He,cn as Ge,cm as Je,aN as Qe,bL as Xe,A as Ae}from"./vendor-mui-core-xF5F4eT7.js";import{b as ee,z as Ye,A as Ze,ap as ie}from"./vendor-utils-5TjOM6td.js";import{j as J,b as $,$ as Ie,aD as U,e as te,a6 as et,am as tt,B as ke,bj as st,aV as nt,bA as at}from"./vendor-arcblock-DE69EmW_.js";import{y as it,F as z,m as ot,H as ye}from"./index-DVfi3VUs.js";import{d as G,a as rt}from"./vendor-hooks-BKxTDk_P.js";import{b as he}from"./dashboard-DQnfagMU.js";import{p as lt}from"./util-BblN2lT9.js";import{W as Ee}from"./did-address-CsW_VsB3.js";import{S as Z}from"./shorten-label-J69eHfMN.js";import{I as je}from"./index-BdfWmlqh.js";import{c as ve}from"./index-DoZ2YM4T.js";import{S as ct,a as dt}from"./list-D3MtvbeT.js";import{R as Le}from"./relative-time-Bkhqzrgv.js";import{D as ut,g as pt}from"./traffic-CoKCU9bb.js";import{B as Oe}from"./bundle-avatar-7g1gtR_Q.js";import{B as ft}from"./index-DUVrFM9m.js";import"./useLocalStorage-DYSzZAco.js";import"./confirm-DfsY08eB.js";import"./format-error-C0Ke3VXF.js";import"./PlayArrow-CZfWYrXK.js";import"./get-safe-url-SccGjxz4.js";import"./session-DKWhsUi1.js";import"./useAsyncRetry-Bmo6a1Zp.js";import"./useAsync-Ua5iss51.js";import"./InfoOutlined-C8xfkBe6.js";import"./useSetState-Crt4S51m.js";import"./index-CHFvfli7.js";import"./iframe-De6QHL_6.js";import"./LaunchOutlined-DmwI20ey.js";import"./ChevronLeft-Gy0Fh2PP.js";import"./ChevronRight-DSecMzs8.js";import"./index-C-D-nCB1.js";import"./vendor-mui-x-CSUdon8K.js";const Pe=g.createContext({}),{Provider:mt,Consumer:Ss}=Pe;function ht({children:t,blocklet:i=""}){const{api:a,inService:f}=it(),[h,u]=g.useState([]),[c,j]=g.useState({total:0,pageSize:20,pageCount:0,page:1}),[T,R]=g.useState(!1),I=G(()=>{var v;return(v=i.meta)==null?void 0:v.did},[i]),[W,q]=g.useState([]),X=async({page:v=1,pageSize:k=20,...m}={})=>{if(!(T||!I))try{R(!0);const A={paging:{page:v,pageSize:k},...m,userName:m.searchText||"",teamDid:I,dateRange:m.dateRange?[z(m.dateRange[0]).toISOString(),z(m.dateRange[1]).toISOString()]:void 0},{dids:_,...E}=A;let F="";_.includes("system")&&(F="system");const M=_.filter(O=>O!=="system"),H=await a.getNotificationSendLog({input:{...E,source:F,componentDids:M}}),Y=H.list.map(O=>({...O,receiverUser:{...O.receiverUser,avatar:lt(O.receiverUser.avatar,I,f)}}));u(Y),j(H.paging),R(!1)}catch(A){J.error(A.message),R(!1)}},L=async()=>{const v=await a.getNotificationComponents({input:{teamDid:I}});q(v.componentDids)},V=g.useCallback(v=>{const k=i.children.find(m=>{var A;return((A=m.meta)==null?void 0:A.did)===v});if(k)return k.ancestors=[i],k},[i]),B=async({notificationReceiverIds:v,channels:k,...m})=>{await a.resendNotification({input:{teamDid:I,notificationReceiverIds:v,channels:k.map(A=>A==="wallet"?$.NOTIFICATION_SEND_CHANNEL.WALLET:A==="pushKit"?$.NOTIFICATION_SEND_CHANNEL.PUSH:A),...m}})},x=g.useCallback(async v=>(await a.getUser({input:{teamDid:I,user:{did:v}}})).user,[a,I]);g.useEffect(()=>{I&&L()},[I]);const N={loading:T,fetch:X,data:h,paging:c,blocklet:i,getComponent:V,resendNotification:B,getUser:x,componentDids:W};return e.jsx(mt,{value:{notificationRecords:N},children:t})}function Fe(){const{notificationRecords:t}=g.useContext(Pe);return t}var xe={},gt=Re;Object.defineProperty(xe,"__esModule",{value:!0});var ze=xe.default=void 0,xt=gt(Ie()),bt=e;ze=xe.default=(0,xt.default)((0,bt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var be={},St=Re;Object.defineProperty(be,"__esModule",{value:!0});var Be=be.default=void 0,yt=St(Ie()),jt=e;Be=be.default=(0,yt.default)((0,jt.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");const vt=(t,i,a="")=>{if(!a||!i)return"";switch(a){case $.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:i});case $.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:i});case $.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:i});case $.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return a}};function le(t,i,a={}){const{status:f,updatedAt:h,reason:u="",channel:c="wallet"}=a,j=h?t("notification.sendStatus.sentTime",{date:ot(h,i)}):"",T=vt(t,c,u);return f===$.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:j,reason:T}:f===$.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:j}:{status:"pending",title:t("notification.sendStatus.pending"),reason:T,sentTime:j}}const we={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},ge=["wallet","pushKit","email"],wt=(t,i)=>{var h,u;const{settings:a}=t,f=ee(i,"extra.notifications.email",!0);return{available:(u=(h=a==null?void 0:a.notification)==null?void 0:h.email)==null?void 0:u.enabled,enabled:f}},Ct=(t,i)=>{var h,u;const{settings:a}=t,f=ee(i,"extra.notifications.push",!0);return{available:(u=(h=a==null?void 0:a.notification)==null?void 0:h.pushKit)==null?void 0:u.enabled,enabled:f}},Rt=t=>({enabled:ee(t,"extra.notifications.wallet",!0)}),Dt=t=>({enabled:ee(t,"extra.webhooks",[]).length>0}),Ce=(t=3e3)=>new Promise(i=>{setTimeout(()=>{i()},t)}),Nt=(t,i)=>i==="wallet"||i==="webhook"?[{channel:i,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:i}),fail:t("notification.sendStatus.reason.disabled",{channel:i})}]:i==="pushKit"||i==="email"?[{channel:i,type:"available",pass:t("notification.sendStatus.reason.available",{channel:i}),fail:t("notification.sendStatus.reason.unavailable",{channel:i})},{channel:i,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:i}),fail:t("notification.sendStatus.reason.disabled",{channel:i})}]:[],Tt=t=>{const i={},a=z().startOf("day");ge.forEach(u=>{const c=`${u}SendRecord`,T=ee(t,c,[]).filter(R=>z(R.sendAt).isSame(a,"day")).length;i[u]=T});const f=ee(t,"webhook",{}),h=Object.keys(f??{})??[];return h.length>0&&h.forEach(u=>{const j=(f[u]??[]).filter(T=>z(T.sendAt).isSame(a,"day")).length;i[u]=j}),i};function Q({config:t,enableTooltip:i=!0,showTitle:a=!1}){const{status:f,title:h="",sentTime:u="",reason:c=""}=t,j=[h,c].filter(Boolean).join(", ");return e.jsx(qe,{title:i?e.jsxs(e.Fragment,{children:[e.jsx(K,{color:"inherit",sx:{fontSize:12},children:j}),e.jsx("span",{children:u})]}):null,arrow:!0,placement:"top",children:e.jsxs(C,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:1},children:[e.jsxs(C,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(C,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:we[f],style:{opacity:.15}}),e.jsx(C,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:we[f]})]}),a?e.jsx(K,{color:"inherit",sx:{fontSize:12},children:h}):null]})})}Q.propTypes={config:y.object.isRequired,enableTooltip:y.bool,showTitle:y.bool};Q.defaultProps={enableTooltip:!0,showTitle:!1};_e.propTypes={notification:y.object.isRequired,onCancel:y.func,blocklet:y.object.isRequired,resendChannel:y.string,refresh:y.func,tab:y.string};function _e({notification:t,onCancel:i=()=>{},blocklet:a,resendChannel:f="",refresh:h=()=>{},tab:u="info"}){const{t:c,locale:j}=te(),{getComponent:T,resendNotification:R,getUser:I}=Fe(),[W,q]=g.useState([]),[X,L]=g.useState([]),[V,B]=g.useState(null),[x,N]=g.useState(null),v=g.useRef({}),k=G(()=>T(t.componentDid)||a,[a,t.componentDid]),m=G(()=>{var s;return(s=t==null?void 0:t.receivers)==null?void 0:s[0]},[t.receivers]),A=G(()=>m==null?void 0:m.receiver,[m]),_=G(()=>m==null?void 0:m.receiverUser,[m]),E=rt({tab:u||"info"}),F=G(()=>Tt(m),[m]),M=g.useCallback(async s=>{const{receiver:l}=m??{};if(!l)return!1;const p=await I(l);return p?s==="wallet"?Rt(p):s==="email"?wt(a,p):s==="pushKit"?Ct(a,p):s==="webhook"?Dt(p):!0:!1},[m,I,a]);g.useEffect(()=>{if(!m)q([]);else{const s=ge.map(p=>{const S=m[`${p}SendStatus`],w=m[`${p}SendAt`],P=m[`${p}SendFailedReason`],We=le(c,j,{status:S,updatedAt:w,reason:P,channel:p});return{type:p==="pushKit"?"Push Kit":p,extra:We}});q(s);const l=(m==null?void 0:m.webhook)||{};L(Object.entries(l))}},[m,j,c]);const H=g.useCallback(async(s,l="")=>{const{id:p}=m??{};if(p)try{await R({notificationReceiverIds:[p],channels:[s],...s==="webhook"&&l?{webhookUrls:[l]}:{}}),J.success("Message has been sent!"),s!=="webhook"&&(await Ce(1e3),B(null))}catch(S){console.error("handleResend error",{error:S}),J.error(S.response?S.response.statusText:S.message)}},[R,m]),Y=async(s,l)=>{if(l==null||l.stopPropagation(),F[s.type]>=4){J.warning(c("notification.resendLimit"));return}if(l&&B(l==null?void 0:l.currentTarget),N({channel:s.type}),!(!s||s.checking)){q(S=>S.map(w=>s.type===w.type?{...w,checking:!0}:w));try{const S=await M(s.type);await Ce(),N({channel:s.type,result:S}),(typeof S=="boolean"&&S||Ye(S)&&Object.values(S).every(w=>!!w))&&(await H(s.type),h()),q(w=>w.map(P=>s.type===P.type?{...P,checking:!1}:P))}catch(S){console.error("handleResend error",{error:S})}}},O=async(s,l=null)=>{if(l==null||l.stopPropagation(),F[s]>=4){J.warning(c("notification.resendLimit"));return}L(S=>S.map(w=>s===w[0]?[...w.slice(0,2),!0]:w));try{await H("webhook",s),L(S=>S.map(w=>s===w[0]?[...w.slice(0,2),!0]:w)),h()}catch(S){console.error("handleResend error",{error:S})}};g.useEffect(()=>{f&&(E.tab="status",setTimeout(()=>{const s=v.current[f];s&&(ge.includes(f)?(B(s),Y({type:f})):O(f))},500))},[f]);const de=()=>{B(null)},ue=g.useCallback(s=>Nt(c,s),[c]),se=!!V,o=se?"check-resend-popover":void 0;function n(){return[{name:c("notification.from"),value:e.jsx(ct,{size:32,blocklet:k,showName:!0,hideDot:!0})},{name:c("notification.to"),value:e.jsx(C,{children:_?e.jsxs(C,{"data-cy":`member-name-${_.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(ke,{src:`${_.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:A,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Z,{children:_.fullName})]},A):e.jsx(Ee,{size:14,responsive:!1,compact:!0,copyable:!1,did:A})})},{name:c("notification.notificationTitle"),value:e.jsx(Z,{maxLength:50,children:t.title})},{name:c("notification.body"),value:e.jsx(dt,{notification:t,rows:0})},{name:c("notification.createdAt"),value:e.jsx(Le,{value:t.createdAt,locale:j,shouldUpdate:!0})}].map(l=>e.jsx(je,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:l.name,children:l.value},l.name))}const r={info:{label:c("common.basicInfo"),value:"info",component:n},status:{label:c("notification.status"),value:"status"}},d=Object.values(r).map(({label:s,value:l})=>({label:s,value:l})),b=r[E.tab]||r.info,D=s=>{E.tab=s};return e.jsx(et,{title:c("notification.notificationDetails"),onClose:()=>{E.tab="info",B(null),i()},open:!0,PaperProps:{style:{maxWidth:832,maxHeight:"80vh"}},sx:{"& .MuiDialogContent-root":{paddingTop:0}},fullWidth:!0,actionsPosition:"left",children:e.jsxs(At,{children:[e.jsx(C,{mx:3,className:"tabs",children:e.jsx(tt,{tabs:d,current:E.tab,onChange:D,scrollButtons:"auto"})}),e.jsx("div",{className:"body",children:E.tab==="info"?e.jsx(b.component,{}):e.jsxs(C,{children:[W.map(s=>e.jsx(je,{valueComponent:"div",nameWidth:120,name:s.type,children:e.jsxs(C,{className:"channel-item",display:"flex",alignItems:"center",sx:{gap:"4px",fontSize:14},children:[e.jsx(C,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(Q,{config:s.extra,showTitle:!0})}),s.extra.status!=="success"&&e.jsxs(K,{ref:l=>{v.current[s.type]=l},component:"span",display:"flex",alignItems:"center",sx:{color:U.primary.main,fontSize:14},className:ve("resend-btn",{disabled:s.checking||F[s.type]>=4}),onClick:l=>Y(s,l),children:[s.checking?e.jsx(pe,{size:12,sx:{color:U.primary.main}}):e.jsx(he,{}),e.jsx("span",{style:{marginLeft:4},children:c("notification.resend")})]})]})},s.type)),e.jsx(Me,{textAlign:"left",sx:{mt:1,mb:1},children:"Webhook"}),e.jsx(C,{className:"notification-resend-section",display:"flex",flexDirection:"column",gap:1,style:{paddingLeft:0},children:X.map(([s,l,p])=>{const S=l[0],w=le(c,j,{...S,updatedAt:S.sendAt,reason:S.failedReason,channel:"webhook"});return e.jsxs(C,{className:"channel-item",display:"flex",alignItems:"center",sx:{gap:"4px",fontSize:12},children:[e.jsx(Z,{maxLength:30,children:s}),e.jsx(C,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(Q,{config:w,showTitle:!0})}),w.status!=="success"&&e.jsxs(K,{ref:P=>{v.current[s]=P},component:"span",sx:{color:U.primary.main},className:ve("resend-btn",{disabled:p||F[s]>=4}),onClick:P=>O(s,P),children:[p?e.jsx(pe,{size:12,sx:{color:U.primary.main}}):e.jsx(he,{}),e.jsx("span",{style:{marginLeft:4},children:c("notification.resend")})]})]},s)})})]})}),e.jsx(De,{id:o,open:se,anchorEl:V,onClose:de,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(It,{children:[e.jsxs(K,{variant:"body1",component:"div",className:"check-title",children:[x==null?void 0:x.channel," Checking"]}),e.jsx(C,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:ue(x==null?void 0:x.channel).map(s=>{var w,P;const{type:l,pass:p,fail:S}=s;return!(x!=null&&x.result)||(w=x==null?void 0:x.result)!=null&&w[l]?e.jsxs(K,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(P=x==null?void 0:x.result)!=null&&P[l]?U.success.main:"inherit"},children:[x!=null&&x.result?e.jsx(Be,{}):e.jsx(pe,{size:12,sx:{color:U.primary.main}}),e.jsx("span",{children:p})]},l):e.jsxs(K,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:U.error.main},children:[e.jsx(ze,{}),e.jsx("span",{children:S})]},l)})})]})})]})})}const At=ce.div`
|
|
2
|
-
& > .notification-row {
|
|
3
|
-
padding: 0;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.tabs {
|
|
7
|
-
margin: 0;
|
|
8
|
-
}
|
|
9
|
-
.body {
|
|
10
|
-
margin-top: 24px;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.channel-item {
|
|
14
|
-
display: flex;
|
|
15
|
-
padding: 4px;
|
|
16
|
-
justify-content: flex-start;
|
|
17
|
-
align-items: center;
|
|
18
|
-
gap: 8px;
|
|
19
|
-
> p {
|
|
20
|
-
font-size: 15px;
|
|
21
|
-
}
|
|
22
|
-
.resend-btn {
|
|
23
|
-
svg {
|
|
24
|
-
font-size: 16px;
|
|
25
|
-
}
|
|
26
|
-
display: flex;
|
|
27
|
-
align-items: center;
|
|
28
|
-
font-size: 12px;
|
|
29
|
-
cursor: pointer;
|
|
30
|
-
&.disabled {
|
|
31
|
-
cursor: not-allowed;
|
|
32
|
-
color: ${U.text.disabled};
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
`,It=ce.div`
|
|
37
|
-
padding: 8px 16px;
|
|
38
|
-
.check-title {
|
|
39
|
-
font-weight: 500;
|
|
40
|
-
margin-bottom: 8px;
|
|
41
|
-
&::first-letter {
|
|
42
|
-
text-transform: uppercase;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
.check-item {
|
|
46
|
-
svg {
|
|
47
|
-
font-size: 16px;
|
|
48
|
-
}
|
|
49
|
-
font-size: 12px;
|
|
50
|
-
}
|
|
51
|
-
`;Ke.propTypes={value:y.array.isRequired,onChange:y.func};function Ke({value:t,onChange:i}){const{locale:a}=te(),f=z().toDate(),[h,u]=g.useState(null),c=g.useCallback(R=>{u(h?null:R.currentTarget)},[h]),j=!!h,T=g.useCallback(R=>{if(!R.startDate||!R.endDate){J.error("Please select a date range");return}if(z(R.startDate).isAfter(R.endDate)||!z(R.startDate).isValid()||!z(R.endDate).isValid()){J.error("Invalid date range");return}i([R.startDate,R.endDate]),u(null)},[i]);return e.jsxs("div",{children:[e.jsx(K,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Ne,{onClick:c,variant:"outlined",size:"small",color:"inherit",children:[ye(t[0],a)," - ",ye(t[1],a)]})}),e.jsx(De,{open:j,anchorEl:h,onClose:()=>{u(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(ut,{open:!0,maxDate:f,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:c,definedRanges:pt(f),onChange:T})})]})}ae.propTypes={blocklet:y.object,label:y.string};ae.defaultProps={blocklet:null,label:""};const kt=ce.div`
|
|
52
|
-
display: flex;
|
|
53
|
-
justify-items: flex-start;
|
|
54
|
-
align-items: center;
|
|
55
|
-
gap: 8px;
|
|
56
|
-
.name {
|
|
57
|
-
display: block;
|
|
58
|
-
max-width: 260px;
|
|
59
|
-
white-space: nowrap;
|
|
60
|
-
overflow: hidden;
|
|
61
|
-
text-overflow: ellipsis;
|
|
62
|
-
}
|
|
63
|
-
`;function ae({blocklet:t,label:i}){var a;return e.jsx(kt,{children:t?e.jsxs(e.Fragment,{children:[e.jsx(Oe,{size:24,blocklet:t,ancestors:t.ancestors}),e.jsx("span",{className:"name",children:t.title||((a=t.meta)==null?void 0:a.title)})]}):e.jsx("span",{className:"name",children:i})})}const Et=["receiver","data","createdAt","walletSendStatus","pushKitSendStatus","emailSendStatus"],Lt=()=>Ue({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"}}}}}}}),fe=(t,i,a)=>(t[a].splice(i,1),t),me=(t,i)=>i.length?!i.includes(t):!1;function Ot({label:t,onDelete:i,index:a}){return e.jsx(Ae,{label:t,variant:"outlined",...a===1?{onDelete:i}:{}})}function Pt(t){var f;const{t:i}=te();return!((f=t==null?void 0:t.filterList)!=null&&f.filter(h=>h.length).length)?null:e.jsxs(C,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:i("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(at.TableFilterList,{...t,ItemComponent:Ot})})]})}ne.propTypes={status:y.number.isRequired,updatedAt:y.string.isRequired,reason:y.string,channel:y.string,onResend:y.func};function ne({status:t,updatedAt:i,reason:a="",channel:f="wallet",onResend:h}){const{t:u,locale:c}=te(),j=le(u,c,{status:t,updatedAt:i,reason:a,channel:f});return e.jsxs(C,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(Q,{config:j,showTitle:!0}),j.status!=="success"&&e.jsx(Ne,{className:"resend-btn",size:"small",startIcon:e.jsx(he,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2rpx"}},onClick:h,children:u("notification.resend")})]})}oe.propTypes={filterList:y.array.isRequired,onChange:y.func.isRequired,index:y.number.isRequired,column:y.object.isRequired,statusFilterValues:y.array.isRequired,label:y.string.isRequired};function oe({filterList:t,onChange:i,index:a,column:f,statusFilterValues:h,label:u}){return e.jsxs(Te,{className:"filter-container",children:[e.jsx(Ge,{component:"legend",children:u}),e.jsx(Je,{row:!0,children:h.map(c=>{const j={status:c.status};return e.jsx(Qe,{control:e.jsx(Xe,{checked:t[a].indexOf(c.value)>-1,onChange:T=>{T.target.checked?t[a].push(c.value):t[a]=t[a].filter(R=>R!==c.value),i(t[a],a,f)},name:c.value}),label:e.jsxs("span",{style:{display:"flex",alignItems:"center"},children:[e.jsx(Q,{enableTooltip:!1,config:j}),c.label]})},c.value)})})]})}re.propTypes={list:y.array.isRequired,label:y.string.isRequired,onDelete:y.func.isRequired};function re({list:t,label:i,onDelete:a}){const{t:f,locale:h}=te();return e.jsxs(C,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(K,{children:[i,": "]}),t.map(u=>{const c=le(f,h,{status:u});return e.jsx(Ae,{size:"small",label:e.jsxs(C,{display:"flex",alignItems:"center",sx:{gap:"4rpx"},children:[e.jsx(Q,{config:c,enableTooltip:!1}),e.jsx("span",{children:c.title})]}),onDelete:j=>a(j,u)},u)})]})}function Ft(){var se;const{t,locale:i}=te(),{data:a,paging:f,loading:h,blocklet:u,fetch:c,getComponent:j,componentDids:T}=Fe(),R=g.useRef(null),[I,W]=g.useState(null),[q,X]=g.useState(""),[L,V]=g.useState(Et),B=`notification-records-${(se=u.meta)==null?void 0:se.did}`,x=st(B),[N,v]=g.useState({searchText:x.searchText||"",pageSize:x.rowsPerPage||10,page:x.page?x.page+1:1,dids:x.dids||[],walletSendStatus:x.walletSendStatus||[],pushKitSendStatus:x.pushKitSendStatus||[],emailSendStatus:x.emailSendStatus||[],dateRange:x.dateRange||[z().subtract(1,"month").startOf("day").toDate(),z().endOf("day").toDate()]}),k=G(()=>{if(!u.children||!u.children.length)return[];const o=[];return u.children.forEach(n=>{var d;const r=n.did||((d=n.meta)==null?void 0:d.did);T.includes(r)&&(n.ancestors=[u],o.push(n))}),o},[T,u]),m=g.useCallback(o=>{const{notification:n}=o,r=Ze(o,"notification");return r.read=!0,n.receivers=[r],n},[]),A=g.useCallback(o=>{const n=m(o);W(n)},[m]);g.useEffect(()=>{c(N)},[N]),g.useEffect(()=>{W(o=>{if(!o)return null;const n=a.find(r=>r.notification.id===o.id);return n?A(n):o})},[a,A]);const _=({page:o,rowsPerPage:n,searchText:r,filterList:d})=>{const[,b=[],D=[],s=[],l=[]]=d;N.pageSize!==n?v(p=>({...p,pageSize:n,page:1})):N.page!==o+1?v(p=>({...p,page:o+1})):N.searchText!==r?v(p=>({...p,searchText:r,page:1})):ie(N.walletSendStatus,D)?ie(N.pushKitSendStatus,s)?ie(N.emailSendStatus,l)?ie(N.dids,b)||v(p=>({...p,dids:b,page:1})):v(p=>({...p,emailSendStatus:l,page:1})):v(p=>({...p,pushKitSendStatus:s,page:1})):v(p=>({...p,walletSendStatus:D,page:1}))},E=[{label:t("notification.sendStatus.pending"),value:0,status:"pending"},{label:t("notification.sendStatus.success"),value:1,status:"success"},{label:t("notification.sendStatus.failed"),value:2,status:"failed"}],F=(o,n,r,d)=>{o.stopPropagation();const b=r.filter(D=>D!==n);v(D=>({...D,[d]:b,page:1}))},M=(o,n,r)=>{o.stopPropagation();const d=m(n);W(d),X(r)},H=()=>{W(null),X("")},Y=g.useCallback(()=>{c(N)},[c,N]),O=[{label:t("notification.receiver"),name:"receiver",width:200,options:{filter:!1,display:L.includes("receiver"),customBodyRenderLite:o=>{const{receiverUser:n,receiver:r}=a[o];return n?e.jsxs(C,{"data-cy":`member-name-${n.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(ke,{src:`${n.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:r,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Z,{children:n.fullName})]},r):e.jsx(Ee,{size:14,responsive:!1,compact:!0,copyable:!1,did:r})}}},{label:t("notification.notificationPreview"),name:"data",width:300,options:{filter:!0,filterType:"custom",customFilterListOptions:{render:o=>o.map((n,r)=>{var b;if(n==="system")return e.jsx("span",{children:t("notification.system")},`system-${r}`);const d=k.find(D=>{var l;return(D.did||((l=D.meta)==null?void 0:l.did))===n});return e.jsx(ae,{blocklet:d,label:(d==null?void 0:d.title)||((b=d==null?void 0:d.meta)==null?void 0:b.title)},n)}),update:(o,n,r)=>(o[r].splice(n,1),o)},filterOptions:{names:k,logic:(o,n)=>n.length?!n.includes(o):!1,display:(o,n,r,d)=>e.jsxs(Te,{style:{width:"380px"},children:[e.jsx($e,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs(Ve,{multiple:!0,value:o[r],renderValue:b=>e.jsx(C,{display:"flex",gap:1,alignItems:"center",style:{overflow:"hidden",textOverflow:"ellipsis"},children:b.map(D=>{var l;if(D==="system")return e.jsx("span",{children:t("notification.system")},D);const s=k.find(p=>{var w;return(p.did||((w=p.meta)==null?void 0:w.did))===D});return e.jsx(ae,{blocklet:s,label:(s==null?void 0:s.title)||((l=s==null?void 0:s.meta)==null?void 0:l.title)},D)})}),onChange:b=>{o[r]=b.target.value,n(o[r],r,d)},children:[e.jsx(Se,{value:"system",children:t("notification.system")}),k.map(b=>{var s,l;const D=b.did||((s=b.meta)==null?void 0:s.did);return e.jsx(Se,{value:D,children:e.jsx(ae,{blocklet:b,label:b.title||((l=b.meta)==null?void 0:l.title)})},D)})]})]})},display:L.includes("data"),customBodyRenderLite:o=>{const n=a[o],{notification:r}=n,d=j(r.componentDid);return e.jsxs(C,{display:"flex",alignItems:"center",gap:1,onClick:b=>{b.stopPropagation(),A(n)},children:[d?e.jsx(Oe,{size:32,blocklet:d,ancestors:d.ancestors??[]}):e.jsx(ft,{blocklet:u,size:32}),e.jsx(Z,{maxLength:50,children:r.title})]})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{display:L.includes("walletSendStatus"),setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:N.walletSendStatus??[],customFilterListOptions:{render:o=>e.jsx(re,{list:o,label:"Wallet",onDelete:(n,r)=>{n.stopPropagation(),F(n,r,O[2].options.filterList,"walletSendStatus")}}),update:fe},filterOptions:{names:E,fullWidth:!0,logic:me,display:(o,n,r,d)=>e.jsx(oe,{label:"Wallet",filterList:o,onChange:n,index:r,column:d,statusFilterValues:E})},customBodyRenderLite:o=>{const{walletSendStatus:n,walletSendAt:r,walletSendFailedReason:d}=a[o];return e.jsx(ne,{status:n,updatedAt:r,reason:d,channel:"wallet",onResend:b=>M(b,a[o],"wallet")})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{display:L.includes("pushKitSendStatus"),setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:o=>{const{pushKitSendStatus:n,pushKitSendAt:r,pushKitSendFailedReason:d}=a[o];return e.jsx(ne,{status:n,updatedAt:r,reason:d,channel:"pushkit",onResend:b=>M(b,a[o],"pushKit")})},filter:!0,filterType:"custom",filterList:N.pushKitSendStatus??[],customFilterListOptions:{render:o=>e.jsx(re,{list:o,label:"Push Kit",onDelete:(n,r)=>{n.stopPropagation(),F(n,r,O[3].options.filterList,"pushKitSendStatus")}}),update:fe},filterOptions:{names:E,fullWidth:!0,logic:me,display:(o,n,r,d)=>e.jsx(oe,{label:"Push Kit",filterList:o,onChange:n,index:r,column:d,statusFilterValues:E})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),display:L.includes("emailSendStatus"),customBodyRenderLite:o=>{const{emailSendStatus:n,emailSendAt:r,emailSendFailedReason:d}=a[o];return e.jsx(ne,{status:n,updatedAt:r,reason:d,channel:"email",onResend:b=>M(b,a[o],"email")})},filter:!0,filterType:"custom",filterList:N.emailSendStatus??[],customFilterListOptions:{render:o=>e.jsx(re,{list:o,label:"Email",onDelete:(n,r)=>{n.stopPropagation(),F(n,r,O[4].options.filterList,"emailSendStatus")}}),update:fe},filterOptions:{names:E,fullWidth:!0,logic:me,display:(o,n,r,d)=>e.jsx(oe,{label:"Email",filterList:o,onChange:n,index:r,column:d,statusFilterValues:E})}}},{label:"Webhook",name:"webhook",width:200,options:{display:L.includes("webhook"),filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:o=>{const{webhook:n}=a[o];if(!n)return null;const r=Object.entries(n)[0];if(!r)return null;const[d,b]=r,D=b[0];return e.jsx(C,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(C,{className:"webhook-item",fontSize:12,children:[e.jsx(Z,{maxLength:30,children:d},d),e.jsx(ne,{status:D.status,updatedAt:D.sendAt,reason:D.failedReason,channel:"webhook",onResend:s=>M(s,a[o],d)})]},d)})}}},{label:t("common.createdAt"),name:"createdAt",width:200,options:{filter:!1,display:L.includes("createdAt"),customBodyRenderLite:o=>{const{createdAt:n}=a[o];return e.jsx(Le,{value:n,locale:i,shouldUpdate:!0})}}}],de=o=>{v(n=>({...n,dateRange:o,page:1}))},ue=[e.jsx(Ke,{value:N.dateRange,onChange:de})];return e.jsxs(C,{ref:R,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(zt,{children:e.jsx(He,{theme:Lt(),children:e.jsx(nt,{className:"main-data",verticalKeyWidth:100,loading:h,locale:i,columns:O,data:a,durable:B,onChange:_,options:{sort:!1,download:!1,print:!1,expandableRowsOnClick:!0,searchPlaceholder:t("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:f.page-1,rowsPerPage:f.pageSize,count:f.total,...x,searchText:N.searchText,onViewColumnsChange:(o,n)=>{V(n==="add"?r=>[...r,o]:r=>r.filter(d=>d!==o))}},customButtons:ue,components:{TableFilterList:Pt}})})}),I&&e.jsx(_e,{refresh:Y,onCancel:H,notification:I,blocklet:u,resendChannel:q})]})}const zt=ce.div`
|
|
64
|
-
td.MuiTableCell-footer {
|
|
65
|
-
border: none !important;
|
|
66
|
-
}
|
|
67
|
-
.sent-status-cell {
|
|
68
|
-
.resend-btn {
|
|
69
|
-
display: none;
|
|
70
|
-
}
|
|
71
|
-
&:hover {
|
|
72
|
-
.resend-btn {
|
|
73
|
-
display: flex;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
`;Bt.propTypes={blocklet:y.object.isRequired};function Bt({blocklet:t={}}){return e.jsx(ht,{blocklet:t,children:e.jsx(Ft,{})})}export{Bt as default,Lt as getMuiTheme};
|