@abtnode/blocklet-services 1.16.37-beta-20250107-235521-f1778ec0 → 1.16.37-beta-20250108-010153-e4bcd256
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/Add-WwBlcqNF.js +1 -0
- package/dist/assets/{ArrowDropDown-BPjEGMbu.js → ArrowDropDown-B6VSNrNX.js} +1 -1
- package/dist/assets/{CheckCircle-B4plT5R4.js → CheckCircle-n23HoB1l.js} +1 -1
- package/dist/assets/{ChevronLeft-B9PQ366h.js → ChevronLeft-DV-sPxhr.js} +1 -1
- package/dist/assets/{ChevronRight-D6hU6q5w.js → ChevronRight-UF0hSKpL.js} +1 -1
- package/dist/assets/{DeleteOutline-CW6vHyu2.js → DeleteOutline-1Utxk_IX.js} +1 -1
- package/dist/assets/{Done-CbA_lc17.js → Done-BbnQSLvu.js} +1 -1
- package/dist/assets/{Download-D114STME.js → Download-DRJvwpLt.js} +1 -1
- package/dist/assets/{Error-CspIR8wP.js → Error-CL8m4Xu6.js} +1 -1
- package/dist/assets/{Google-Bzqa7SGD.js → Google-CSKRQW0F.js} +1 -1
- package/dist/assets/{InfoOutlined-CQX14YIV.js → InfoOutlined-7hC78o3_.js} +1 -1
- package/dist/assets/{Launch-C1MUjdbY.js → Launch-D9iyATKb.js} +1 -1
- package/dist/assets/{LaunchOutlined-CeuwA75K.js → LaunchOutlined-D37WOXmf.js} +1 -1
- package/dist/assets/{Loop-CRiiMs26.js → Loop-Clmz6DRv.js} +1 -1
- package/dist/assets/{MoreHoriz-CyRd8YYN.js → MoreHoriz-CtnQ7uqf.js} +1 -1
- package/dist/assets/{PlayArrow-CpIW2rO1.js → PlayArrow-IJdeSlbo.js} +1 -1
- package/dist/assets/{ViewList-VFshTvAg.js → ViewList-B-HVv7GT.js} +1 -1
- package/dist/assets/_createAggregator-BgG70oKG.js +1 -0
- package/dist/assets/{access-control-CaDZstFX.js → access-control-BP0rhxZ_.js} +1 -1
- package/dist/assets/{actions-BQfRapcY.js → actions-DsY16tuf.js} +1 -1
- package/dist/assets/{add-component-core-B6O0kJAO.js → add-component-core-C8hvHJq0.js} +4 -4
- package/dist/assets/{add-resource-DVAwgArl.js → add-resource-DZFTdNIy.js} +1 -1
- package/dist/assets/{addon-B934EFnq.js → addon-DUnQ9eC0.js} +1 -1
- package/dist/assets/{analytics-DxPeznyU.js → analytics-Cym7YiQM.js} +3 -3
- package/dist/assets/{audit-logs-Cw_LCWlO.js → audit-logs-DtJdynVz.js} +2 -2
- package/dist/assets/base32-DZ5GWnEl.js +1 -0
- package/dist/assets/{branding-CVf-84lW.js → branding-DEKXfpdd.js} +2 -2
- package/dist/assets/{bundle-avatar-CZnIDw9E.js → bundle-avatar-CtN88KlG.js} +1 -1
- package/dist/assets/button-CPeDg26t.js +1 -0
- package/dist/assets/{click-to-copy-DPKm1p6d.js → click-to-copy-D-rDpTU1.js} +1 -1
- package/dist/assets/{complete-Bf8ALY2S.js → complete-DfhluUOU.js} +1 -1
- package/dist/assets/{component-ChxoGFx9.js → component-DET9TWBv.js} +1 -1
- package/dist/assets/{config-BUjuVbbC.js → config-Bh1NLHps.js} +1 -1
- package/dist/assets/{config-D3mUi5yh.js → config-Dx3rVqe3.js} +2 -2
- package/dist/assets/{config-navigation-Bjlh79gM.js → config-navigation-Cn0fwBBG.js} +3 -3
- package/dist/assets/{config-space-B_9C2jTG.js → config-space-CT9a0s7Q.js} +1 -1
- package/dist/assets/{confirm-CVFWPron.js → confirm-DhCXP8vW.js} +1 -1
- package/dist/assets/connect-CA2-olTo.js +5 -0
- package/dist/assets/connect-GHQ2pLWc.js +1 -0
- package/dist/assets/connect-to-kYFiSkqc.js +1 -0
- package/dist/assets/{dashboard-Dff3slpj.js → dashboard-B3UhGh-u.js} +7 -7
- package/dist/assets/{did-address-DqD0tKOY.js → did-address-B-umhomj.js} +1 -1
- package/dist/assets/domain-DzFcoe7i.js +9 -0
- package/dist/assets/{domain-list-jO4zHESZ.js → domain-list-C9eJrdcx.js} +2 -2
- package/dist/assets/email-BEr-8TYu.js +18 -0
- package/dist/assets/{exchange-passport-BMjrpZst.js → exchange-passport-DGUT_ZCy.js} +1 -1
- package/dist/assets/{form-text-input-ClGC4JKP.js → form-text-input-E0Z0s35O.js} +2 -2
- package/dist/assets/{fuel-2t6oVtfW.js → fuel-alylOU0b.js} +1 -1
- package/dist/assets/{fullpage-BiUo6gQd.js → fullpage-DZPI7F_L.js} +1 -1
- package/dist/assets/{get-safe-url-BtfNFuK0.js → get-safe-url-ByH0hntp.js} +1 -1
- package/dist/assets/{get-safe-url-CV9wUymi.js → get-safe-url-yHkHYeNB.js} +1 -1
- package/dist/assets/{home-BpXMOH1X.js → home-DG81Vlwd.js} +1 -1
- package/dist/assets/{iframe-03f6PMsP.js → iframe-BB-pL0gd.js} +1 -1
- package/dist/assets/{index-C89HTHWf.js → index-B-0OFwWF.js} +1 -1
- package/dist/assets/{index-DOWnRwIi.js → index-B8B9jSby.js} +7 -7
- package/dist/assets/{index-BvpWi6M_.js → index-BaA1-UNL.js} +1 -1
- package/dist/assets/{index-D3rhPCZn.js → index-CU_Y2Ics.js} +41 -41
- package/dist/assets/{index-XlyOkzy1.js → index-CYh2QqLk.js} +1 -1
- package/dist/assets/{index-1yj7N3BD.js → index-CxWy6IEg.js} +1 -1
- package/dist/assets/{index-BgE0mEyw.js → index-DHmJ4NAw.js} +8 -8
- package/dist/assets/{index-DQR2LIPC.js → index-DNd_40WG.js} +2 -2
- package/dist/assets/{index-kGLQpRJK.js → index-DjDooCTg.js} +14 -14
- package/dist/assets/{index-DPyw3Xwp.js → index-Dk8-Ibsd.js} +1 -1
- package/dist/assets/{index-CTEk7-E8.js → index-SrY9WLdy.js} +1 -1
- package/dist/assets/{index-BqtzbaK6.js → index-e4kRKwa5.js} +1 -1
- package/dist/assets/index-jViTGvBx.js +5 -0
- package/dist/assets/{index-ChdU5l0G.js → index-tDqjC_e2.js} +38 -38
- package/dist/assets/{invitation-C8ZNSJG7.js → invitation-BNOVM03D.js} +7 -7
- package/dist/assets/invite-CDXZxcmB.js +5 -0
- package/dist/assets/{issue-passport-CIaz_hk6.js → issue-passport-1v1d15DW.js} +1 -1
- package/dist/assets/{item-wwVikGMU.js → item-DoetJFaA.js} +1 -1
- package/dist/assets/{layout-DBXEc_NJ.js → layout-PlCf3Rtw.js} +1 -1
- package/dist/assets/{list-header-BA3DiTcf.js → list-header-DdT6PG1D.js} +1 -1
- package/dist/assets/localization-Cm0dNj2B.js +1 -0
- package/dist/assets/{log-Dc1jxENK.js → log-B5iPDWZ_.js} +1 -1
- package/dist/assets/login-DvM79Mfd.js +1 -0
- package/dist/assets/{login-oauth-callback-nhEQq-XX.js → login-oauth-callback-CO19RzCL.js} +1 -1
- package/dist/assets/{logo-uploader-yBugHtcG.js → logo-uploader-CNnYMPxh.js} +3 -3
- package/dist/assets/{lost-passport-DAsg20NY.js → lost-passport-DsG6aS5u.js} +2 -2
- package/dist/assets/{open-window-CVrMznBr.js → open-window-Km_9DMrz.js} +1 -1
- package/dist/assets/{overview-Dc2oVKWy.js → overview-Dc_26DuW.js} +1 -1
- package/dist/assets/{page-header-Htib6ejn.js → page-header-B3m4UCOV.js} +1 -1
- package/dist/assets/{permission-Bz0PVI3J.js → permission-C7OYX2OJ.js} +1 -1
- package/dist/assets/{preferences-BVtsOmzg.js → preferences-Ci4dS6YC.js} +1 -1
- package/dist/assets/publish-resource-BumbS1yx.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-BPPmOpgZ.js → react-beautiful-dnd.esm-D6d5Zfr8.js} +4 -4
- package/dist/assets/{relative-time-D13g3uDZ.js → relative-time-BHAJs1ji.js} +1 -1
- package/dist/assets/sdk-0UwYHc-i.js +1 -0
- package/dist/assets/session-UImnJahL.js +1 -0
- package/dist/assets/{setup-B2Eq0dKO.js → setup-LHpIYQbe.js} +3 -3
- package/dist/assets/{start-DcyUXnHe.js → start-DxAs4dHz.js} +1 -1
- package/dist/assets/{step-actions-BdC024Vn.js → step-actions-FdD-71wr.js} +1 -1
- package/dist/assets/{studio-BSlFbK1F.js → studio-g2uaz9WG.js} +1 -1
- package/dist/assets/{switch-control-DOeNAipI.js → switch-control-BMO1MVhi.js} +1 -1
- package/dist/assets/{toUpper-CPtwa1LG.js → toUpper-DUImrX4s.js} +1 -1
- package/dist/assets/{transfer-l-kgY192.js → transfer-Bq5kjW_S.js} +1 -1
- package/dist/assets/{unsubscribe-Bn1ZPibc.js → unsubscribe-DUmfJRPR.js} +1 -1
- package/dist/assets/{useAsync-Barwm_ml.js → useAsync-BfmmMB4I.js} +1 -1
- package/dist/assets/{useAsyncRetry-Ct0h3JKq.js → useAsyncRetry-m5oMMmVh.js} +1 -1
- package/dist/assets/{useLocalStorage-Bkgi6BS3.js → useLocalStorage-ganqTrK6.js} +1 -1
- package/dist/assets/user-center-CYnDNkIf.js +202 -0
- package/dist/assets/{util-Cd3QOWLR.js → util-CmcVraD_.js} +1 -1
- package/dist/assets/{vendor-arcblock-oreSqNjg.js → vendor-arcblock-Dn16DH88.js} +209 -206
- package/dist/assets/{vendor-hooks-DHHsWSqV.js → vendor-hooks-DzETutIU.js} +1 -1
- package/dist/assets/{wrap-locale-Dajt8i2A.js → wrap-locale-DTO386nY.js} +1 -1
- package/dist/index.html +3 -3
- package/dist/service-worker.js +1 -1
- package/package.json +39 -39
- package/dist/assets/Add-XINWD-cR.js +0 -1
- package/dist/assets/_createAggregator-sgAa2ai2.js +0 -1
- package/dist/assets/base32-CdGlYCm2.js +0 -1
- package/dist/assets/button-DSj-WxvW.js +0 -1
- package/dist/assets/connect-Bw02nhZ6.js +0 -5
- package/dist/assets/connect-to-DL42-aQK.js +0 -1
- package/dist/assets/connect-whKFDq3K.js +0 -1
- package/dist/assets/domain-CI3XUHBW.js +0 -9
- package/dist/assets/email-DZG9lqBd.js +0 -18
- package/dist/assets/index-qpaXqEVJ.js +0 -5
- package/dist/assets/invite-wHYq3NmE.js +0 -5
- package/dist/assets/localization-DHa_wuSk.js +0 -1
- package/dist/assets/login-BSMkjZ2F.js +0 -1
- package/dist/assets/publish-resource-6mtBRA7-.js +0 -1
- package/dist/assets/sdk-BU36VFtK.js +0 -1
- package/dist/assets/session-6sDuFWud.js +0 -1
- package/dist/assets/user-center-tko9eOwU.js +0 -202
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ah as ae,bf as $e,N as ut,f as Me,L as mt,g as k,ak as W,ap as pt,v as ft,z as O,aW as le,bL as ht,bM as Be,bN as xt,C as Pe,af as gt,bq as Ee,as as ze,b5 as Dt,bH as yt,aQ as jt}from"./vendor-arcblock-oreSqNjg.js";import{a1 as ce,j as e,a3 as p,a2 as z,T as _,ad as de,e as Q,t as ue,aj as Ne,E as s,a4 as B,M as vt,bW as bt,al as Ue,bp as Ct,bq as wt,am as St,ao as Rt,aa as At,I as It}from"./vendor-mui-core-COxJgW9_.js";import{r as A,g as Pt}from"./vendor-react-D-afvo_7.js";import{d as Et}from"./Add-XINWD-cR.js";import{b as kt}from"./base32-CdGlYCm2.js";import{ah as Tt,ai as Oe,y as F,B as We,h as ke,aj as He,M as Lt,ak as qt,ag as Ve,b as _t,G as Te,al as Ft,am as $t,I as Mt,an as Bt,ao as zt,f as Le}from"./index-ChdU5l0G.js";import{d as Nt}from"./LockIcon-BIlUQ2kd.js";import{I as Ut,u as V,D as Ot,B as Wt,L as Ht}from"./vendor-hooks-DHHsWSqV.js";import{d as Vt}from"./CheckCircle-B4plT5R4.js";import{d as Gt,p as qe}from"./util-Cd3QOWLR.js";import{j as G,w as Qt,a as Kt}from"./vendor-utils-CV7RLr7b.js";import{_ as K}from"./useSetState-Crt4S51m.js";import{w as Ge}from"./permission-Bz0PVI3J.js";import{_ as Yt,D as _e}from"./useAsyncRetry-Ct0h3JKq.js";import{C as Y}from"./confirm-CVFWPron.js";import{d as Zt}from"./InfoOutlined-CQX14YIV.js";import{_ as Xt}from"./useAsync-Barwm_ml.js";import"./api-C7qcY4XU.js";import{I as Jt}from"./index-DPyw3Xwp.js";import{A as en}from"./actions-BQfRapcY.js";var me={},tn=ce;Object.defineProperty(me,"__esModule",{value:!0});var Qe=me.default=void 0,nn=tn(ae()),sn=e;Qe=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=G("/api",String(n.url)),n.timeout=2e5,n.params=n.params||{},new URLSearchParams(n.url.split("?")[1]).has("locale")||(n.params.locale=ut()),n},n=>Promise.reject(n));const Ke=(...n)=>$e(...n),rn=(n,t)=>t?n?[n,...Array.isArray(t)?t:[t]]:t:n,an=(n,{width:t=600,height:o=700,name:i="did-domain:popup"}={})=>{const a=window.screenX+(window.innerWidth-t)/2,r=window.screenY+(window.innerHeight-o)/2,l=[`left=${a}`,`top=${r}`,`width=${t}`,`height=${o}`,"resizable=no","scrollbars=yes","status=yes","popup=yes"],c=window.open("",i,l.join(","));if(c===null)throw new Error("Failed to open popup");return c.location.href=Qt(n,{opener:window.location.origin}),c},ln="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p",Ye=async n=>{var d;if(!n||!(n!=null&&n.trim()))return null;const t=Ke(),o=new URL(n);o.pathname="__blocklet__.js",o.searchParams.set("type","json");const{data:i}=await t.get(o.toString()),a=(d=i==null?void 0:i.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=G(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};function Ze({delegatee:n,delegateePk:t,didDomainURL:o,locale:i,title:a,onSuccess:r,...l}){const{t:c}=k(),[d,h]=Ut({currentState:1}),f=A.useRef(null),C=V(x=>{var m,v,I,j;x.data.type==="didDomain.success"&&(r==null||r({nftDid:(m=x.data)==null?void 0:m.nftDid,domain:(v=x.data)==null?void 0:v.domain,chainHost:(I=x.data)==null?void 0:I.chainHost}),(j=f.current)==null||j.close(),f.current=null,h({currentState:4}),setTimeout(()=>{h({currentState:8})},2e3))});Ot(()=>{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 S=V(()=>{h({currentState:1})}),g=V(()=>{h({currentState:2}),P.run()}),y=V(({sessionId:x,baseURL:m})=>{window.addEventListener("message",C);const v=new URL(m);v.searchParams.set("sessionId",x),v.searchParams.set("locale",i),f.current=an(v.toString());const I=setInterval(()=>{var j;(j=f.current)!=null&&j.closed&&(clearInterval(I),S())},1e3);return()=>clearInterval(I)}),P=Wt(async()=>{const x=await Ye(o);if(!x)return null;const m=Ke({baseURL:x.api}),{data:v}=await m.post("/payment/session",{delegatee:n,delegateePk:t});return y({sessionId:v.sessionId,baseURL:x.base})},{manual:!0,debounceWait:500,debounceLeading:!0,debounceTrailing:!1,debounceMaxWait:3e3,refreshDeps:[],onError(x){console.error(x)}});return e.jsxs(e.Fragment,{children:[e.jsx(W,{onClick:g,variant:"contained",startIcon:e.jsx(Gt,{}),...l,children:a||c("buy.button.title")}),e.jsxs(pt,{fullWidth:!0,maxWidth:"xs",open:d.currentState>1&&d.currentState<8,onClose:S,children:[!P.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(Vt,{sx:{color:"primary.main",fontSize:"5rem"}}),d.currentState===2&&e.jsx(_,{children:c("buy.status.inProgress")}),d.currentState===4&&e.jsx(_,{children:c("buy.status.success")})]}),P.error&&e.jsx(de,{severity:"error",children:c("buy.error.failedToCreateSession")})]})]})}const Xe={onSuccess:()=>{},title:""};Ze.defaultProps=Xe;function Je(n){return e.jsx(mt,{locale:n.locale,translations:un,children:e.jsx(Ze,{...n})})}Je.defaultProps=Xe;function et({nftDid:n,didDomainURL:t,locale:o,sx:i}){const{t:a}=k(),[r,l]=K({safeIframeRef:null,popoverAnchorEl:null}),c=A.useRef(null),d=Q(),h=ue(d.breakpoints.down("md")),f=y=>{l({popoverAnchorEl:y.currentTarget})},C=()=>{l({popoverAnchorEl:null})},S=Ht(async()=>{const y=await Ye(t);return y?y.base:null});if(!S.value)return null;if(S.loading)return e.jsx(z,{});const g=G(S.value,`/embed/domain?nft-did=${n}&locale=${o}`);return e.jsxs(e.Fragment,{children:[e.jsx(p,{component:"img",src:G(t,"/.well-known/service/blocklet/logo"),alt:"logo",width:16,height:16,onClick:f,sx:rn({cursor:"pointer"},i)}),e.jsx(Ne,{id:"popover-info",open:!!r.popoverAnchorEl,anchorEl:r.popoverAnchorEl,onClose:C,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:g})})]})}et.defaultProps={sx:{}};const mn=n=>["waiting","creating","renewaling"].includes(n);function pe(n){var w,R;const{t}=k(),[o,i]=A.useState(!1),{inService:a}=F(),[r,l]=A.useState(null),{siteId:c,domain:d,onAdd:h,children:f,did:C}=n,[S,g]=A.useState(!1),{api:y,ws:{useSubscription:P}}=F(),{mode:x,actions:{refreshDomainStatus:m}}=We(),v=Yt(async()=>{const{cert:b}=await y.findCertificateByDomain({input:{domain:d,did:C}});return b}),I=(b,N)=>{b.domain===d&&(g(!1),i(!1),a&&x!=="setup"&&(N==="success"?O.success(t("setup.domain.genCertSuccess",{domain:b.domain})):N==="error"&&O.error(t("setup.domain.genCertFailed",{domain:b.domain,message:b.message}))))};if(A.useEffect(()=>{var b;v.loading||g(mn((b=v.value)==null?void 0:b.status))},[v.loading,(w=v.value)==null?void 0:w.status]),P(ke.BlockletEvents.certError,b=>I(b,"error")),P(ke.BlockletEvents.certIssued,b=>{v.retry(),m(b.domain),I(b,"success")}),v.loading||((R=v.value)==null?void 0:R.status)==="normal")return"";const j=()=>{i(!1),l(null)},T=async()=>{i(!0);try{await y.issueLetsEncryptCert({input:{siteId:c,domain:d,did:C,inBlockletSetup:x==="setup"}}),h(),g(!0)}catch(b){console.error(b),g(!1)}finally{i(!1),l(null)}},u={title:t("router.cert.genLetsEncryptCert.title"),description:e.jsxs("div",{children:[e.jsx(de,{severity:"success",children:t("router.cert.genLetsEncryptCert.dnsTip")}),t("router.cert.genLetsEncryptCert.description")]}),confirm:t("common.confirm"),onConfirm:T,onCancel:j},L=b=>{b.stopPropagation(),l(u)};return e.jsxs(e.Fragment,{children:[S?e.jsx(B,{title:t("router.cert.issuing"),children:e.jsx(z,{size:12})}):f({loading:o,open:L}),r&&e.jsx(Y,{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:o,...i}=n;return Tt(t)||!Oe(t)||ft(o)||o!=null&&o.isHttps?"":e.jsx(pe,{domain:t,...i})}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={},pn=ce;Object.defineProperty(he,"__esModule",{value:!0});var tt=he.default=void 0,fn=pn(ae()),hn=e;tt=he.default=(0,fn.default)((0,hn.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 nt=A.createContext({}),{Provider:xn,Consumer:es}=nt;function gn({children:n}){const[t,o]=K({domain:"",error:null}),{locale:i}=k(),a={error:t.error,domain:t.domain,setError:r=>{o({error:r})},setDomain:r=>{const l=le(r),c=He(l,i);o({domain:l,error:c})}};return e.jsx(xn,{value:{value:a},children:n})}function Dn(){const{value:n}=A.useContext(nt);return n}const{joinURL:Fe}=Lt,yn=qt,st="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p",jn=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:o}=await yn.get(t.toString()),i=(c=o==null?void 0:o.componentMountPoints)==null?void 0:c.find(d=>d.did===st),a=new URL(n);a.pathname=i==null?void 0:i.mountPoint;const r=a.toString(),l=Fe(r,"/api");return{base:r,api:l,domain:Fe(l,"/domains")}};var vn={DID_DOMAIN_SERVICE_DID:st,getDidDomainServiceURL:jn},Z={exports:{}};const bn=ht,Cn=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class ot 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 wn=(n,t,o)=>{const i=o.retries-(t-1);return n.attemptNumber=t,n.retriesLeft=i,n},Sn=n=>Cn.includes(n),it=(n,t)=>new Promise((o,i)=>{t={onFailedAttempt:()=>{},retries:10,...t};const a=bn.operation(t);a.attempt(async r=>{try{o(await n(r))}catch(l){if(!(l instanceof Error)){i(new TypeError(`Non-error was thrown: "${l}". You should only throw errors.`));return}if(l instanceof ot)a.stop(),i(l.originalError);else if(l instanceof TypeError&&!Sn(l.message))a.stop(),i(l);else{wn(l,r,t);try{await t.onFailedAttempt(l)}catch(c){i(c);return}a.retry(l)||i(a.mainError())}}})});Z.exports=it;Z.exports.default=it;Z.exports.AbortError=ot;var Rn=Z.exports;const An=Pt(Rn);function xe({domain:n,resolvedTarget:t,...o}){const{t:i,locale:a}=k();return e.jsxs(p,{sx:{backgroundColor:"rgb(236, 251, 253)",borderColor:"rgb(236, 251, 253)",borderRadius:"8px",padding:"12px"},...o,children:[e.jsxs(p,{display:"flex",children:[i("router.domain.setup.tipStart"),n&&e.jsx(p,{mx:.5,color:"primary.main",fontWeight:"fontWeightBold",children:n}),i("router.domain.setup.tipEnd"),":"]}),e.jsxs(p,{sx:{"&>div":{mb:0},marginTop:"8px"},children:[e.jsx(se,{label:i("router.domain.setup.recordType"),value:"CNAME",locale:a}),e.jsx(se,{label:i("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:o}){const i=ue(r=>r.breakpoints.down("md")),a=Q();return e.jsx(Jt,{name:t,nameWidth:120,children:e.jsxs(p,{sx:{display:"flex",alignItems:"center",lineHeight:1},children:[e.jsx(_,{component:"span",color:"primary.main",overflow:"auto",sx:i?{maxWidth:"95%",wordWrap:"break-word"}:{wordWrap:"break-word"},children:o}),e.jsx(Be,{content:o,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:o,defaultCustomDomain:i,onInputDomain:a,appId:r,appPk:l,onSuccess:c,onError:d,disabled:h,autoFocus:f,inBlockletSetup:C,shouldCheckDomain:S,onStateChange:g,currentIp:y,resolveDomain:P,...x}){const{t:m,locale:v}=k(),{api:I,info:j}=F(),T=Dn(),u=Q(),L=xt({key:"sm"}),[w,R]=K({submittingDomain:!1,domain:i,error:null,type:j!=null&&j.nftDomainUrl?"nftDomain":"inputDomain",showNFTDomainAuth:!1,showDnsTip:!1}),b=Xt(()=>vn.getDidDomainServiceURL(j==null?void 0:j.nftDomainUrl));if(j!=null&&j.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 N=b.value,at=()=>{R({invalidDNSDomain:null})},ee=async D=>{g(m("setup.domain.addingDomain")),await I.addDomainAlias({input:{id:n,domainAlias:D,teamDid:t,inBlockletSetup:!0}}),R({submittingDomain:!1}),c({domain:D,type:"inputDomain"})},Se=async({domain:D,type:E,nftDid:U,chainHost:q})=>{try{if(!S){if(E==="inputDomain"){await ee(D);return}c({domain:D,type:E,nftDid:U,chainHost:q});return}g({text:m("setup.domain.checkingResolvable")});let $=30;const te=3e3,dt=$*1e3/te,Ae=setInterval(()=>{if($<=0){clearInterval(Ae);return}g({text:`${m("setup.domain.checkingResolvable")} (${$--}s)`})},1e3),Ie=await An(async()=>{const{data:M}=await P(D);if(!M.address)throw new Error("Cannot resolve domain");return M.address},{retries:dt,minTimeout:te,maxTimeout:te,onFailedAttempt:console.error}).catch(console.error);if(clearInterval(Ae),!Ie){const M=m("setup.domain.cannotResolve",{domain:D});if(E==="nftDomain"){O.error(M),c({domain:D,type:"nftDomain"});return}g({text:""}),R({invalidDNSDomain:{domain:D,error:M},domain:D,type:E,submittingDomain:!1});return}if(Ie!==y){const M=m("setup.domain.resolvedAddressError",{domain:D,curDomain:window.location.hostname});if(E==="nftDomain"){O.error(M),c({domain:D,type:"nftDomain"});return}g({text:""}),R({invalidDNSDomain:{domain:D,error:M},domain:D,type:E,submittingDomain:!1});return}if(E==="nftDomain"){c({domain:D,type:"nftDomain"});return}await ee(D)}catch($){O.error($.message),g({text:""}),R({submittingDomain:!1})}},lt=async({domain:D,nftDid:E,chainHost:U})=>{try{const q=qe(D);R({submittingDomain:!0}),await I.addDomainAlias({input:{id:n,type:"nft-domain",domainAlias:q,nftDid:E,chainHost:U,teamDid:t,inBlockletSetup:C}});const $="nftDomain";R({showNFTDomainAuth:!1,type:$}),await Se({domain:q,type:$,nftDid:E,chainHost:U})}catch(q){O.error(q.message)}finally{R({showNFTDomainAuth:!1,submittingDomain:!1})}},ct=async()=>{try{R({submittingDomain:!0});const D=qe(w.domain);if(j.nftDomainUrl&&N&&(await I.isDidDomain({input:{domain:D}})).value===!0){R({showNFTDomainAuth:!0});return}await Se({domain:D,type:w.type})}catch(D){R({submittingDomain:!1}),T.setError(D.message)}},Re=T.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(_,{sx:{color:u.palette.text.primary},children:m("router.domainAlias.add.tips")}),e.jsx(vt,{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:D=>{var q;const E=le((q=D.target)==null?void 0:q.value);T.setDomain(E);const U=He(E,v);R({domain:E,error:U,type:"inputDomain"}),a({domain:E,error:U,type:"inputDomain"})},autoFocus:f,onBlur:()=>{T.domain||(R({error:null}),T.setError(null))}}),e.jsx(p,{sx:{width:"100%",display:"flex",justifyContent:"flex-end"},children:e.jsx(bt,{"data-cy":"confirm-add-domain",fullWidth:L,variant:"contained",loading:w.submittingDomain,onClick:ct,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(Zt,{fontSize:"1em"}),m("router.domainAlias.showTipHint")]}),w.showDnsTip&&e.jsx(xe,{domain:w.domain,resolvedTarget:o,style:{marginTop:"4px"}})]}),w.invalidDNSDomain&&e.jsx(Y,{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:at}),N&&e.jsx(gt,{open:w.showNFTDomainAuth,popup:!0,useSocket:!1,forceConnected:!1,action:"authorize",baseUrl:N.api,checkFn:Kt.create({baseURL:N.api}).get,extraParams:{delegatee:r,delegateePk:l,domain:w.domain},onSuccess:lt,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:o,teamDid:i,systemDomains:a,appId:r,appPk:l}){const{t:c}=k(),[d,h]=K({loading:!1,confirmSetting:null}),f=a.find(y=>Ve.isDidDomain(y)),C=()=>{h({loading:!1,confirmSetting:null})},S={title:o||c("router.domainAlias.add.title"),description:function(P,x,m){return e.jsx(ge,{siteId:n,teamDid:i,cnameDomain:f,onSuccess:()=>h({confirmSetting:null}),onInputDomain:({domain:v,type:I,error:j})=>{x({...P,domain:v,type:I,__disableConfirm:!!j}),m(j)},appId:r,appPk:l})},confirm:c("common.confirm"),cancel:c("common.cancel"),params:{domain:"",__disableConfirm:!0},onCancel:C},g=y=>{y.stopPropagation(),h({confirmSetting:S})};return e.jsxs(e.Fragment,{children:[typeof t=="function"?t({loading:d.loading,open:g}):e.jsxs(Ue,{onClick:g,className:"rule-action","data-cy":"action-add-domain-alias",children:[d.loading?e.jsx(z,{size:16}):e.jsx(tt,{style:{fontSize:18,marginRight:5}}),c("router.domainAlias.add.title")]}),d.confirmSetting&&e.jsx(Y,{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 In(n){return e.jsx(gn,{children:e.jsx(De,{...n})})}function ye({appId:n,appPk:t,siteId:o,inBlockletSetup:i,teamDid:a,sx:r,...l}){const{api:c,info:d}=F(),{locale:h,t:f}=k(),C=async({domain:S,nftDid:g,chainHost:y})=>{await c.addDomainAlias({input:{id:o,type:"nft-domain",domainAlias:S,nftDid:g,chainHost:y,teamDid:a,inBlockletSetup:i}})};return e.jsx(Je,{delegatee:n,delegateePk:t,didDomainURL:d.nftDomainUrl,onSuccess:C,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}=k(),[o,i]=A.useState(!1),[a,r]=A.useState(null),{id:l,domain:c,children:d,teamDid:h}=n,{api:f}=F(),C=()=>{i(!1),r(null)},S=async()=>{i(!0);try{await f.deleteDomainAlias({input:{id:l,domainAlias:c,teamDid:h}}),await _t(2e3)}catch(P){O.error(P.message)}finally{r(null),i(!1)}},g={title:t("router.domainAlias.delete.title"),description:t("router.domainAlias.delete.description"),confirm:t("common.confirm"),onConfirm:S,onCancel:C},y=P=>{P.stopPropagation(),r(g)};return e.jsxs(e.Fragment,{children:[typeof d=="function"?d({loading:o,open:y}):e.jsxs(W,{edge:"end",onClick:y,size:"small",className:"rule-action",color:"error","data-cy":"action-delete-domain-alias",children:[o?e.jsx(z,{size:16}):e.jsx(ze,{style:{fontSize:16}}),t("router.domainAlias.delete.title")]}),a&&e.jsx(Y,{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:o}){const{t:i}=k(),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=o==null?void 0:o.meta)==null?void 0:l.did,children:({open:c})=>e.jsx(B,{title:a?i("blocklet.router.currentDomainTip"):"",children:e.jsx("span",{children:e.jsxs(Ue,{disabled:t.isProtected||a,dense:!0,onClick:d=>{r(),c(d)},"data-cy":"action-toggle-block",children:[e.jsx(Ct,{style:{minWidth:24,marginRight:8},children:e.jsx(ze,{})}),e.jsx(wt,{primary:i("common.delete")})]},"remove")})})})}]})}ve.propTypes={site:s.object.isRequired,domain:s.object.isRequired,blocklet:s.object.isRequired};ve.defaultProps={};var be={},Pn=ce;Object.defineProperty(be,"__esModule",{value:!0});var Ce=be.default=void 0,En=Pn(ae()),kn=e;Ce=be.default=(0,En.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 X=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 we({certificate:n}){const[t,o]=A.useState(null),i=F(),{t:a,locale:r}=k(),l=h=>{o(h.currentTarget)},c=()=>{o(null)},d=!!t;return e.jsxs(e.Fragment,{children:[e.jsx(Ce,{"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(St,{children:e.jsxs(Rt,{style:{display:"flex"},children:[e.jsx("div",{children:e.jsx("img",{src:`${i.imgPrefix}/https-certificate-icon.png`,alt:"certificate icon",style:{maxHeight:"100%",maxWidth:"100%"}})}),e.jsxs(_,{component:"div",style:{marginLeft:"16px"},children:[e.jsx(_,{component:"div",style:{fontWeight:"bold"},children:n.domain}),e.jsx(_,{component:"div",children:`${a("common.issuer")}: ${Dt(n,"issuer.commonName","")}`}),e.jsx(_,{component:"div",children:`${a("router.cert.issuedOn")}: ${Te(n.validFrom,r)}`}),e.jsx(_,{component:"div",children:`${a("router.cert.expiryOn")}: ${Te(n.validTo,r)}`})]})]})})})]})}we.propTypes={certificate:s.object};we.defaultProps={certificate:{}};function H({domain:n,filters:t}){const{t:o}=k(),{value:i,domainStatus:a}=n;if(!Oe(i))return null;let r=null,l=null;const{isHttps:c,matchedCert:d}=a;if(!Ft(i)){const{dns:{resolved:f,ip:C}={}}=a;f||C==="127.0.0.1"?r=e.jsx(B,{title:o("router.domain.verify.ok"),children:e.jsx(_e,{color:"success"})}):r=e.jsx(B,{title:o("router.domain.verify.notResolved"),children:e.jsx(_e,{color:"error"})})}c?l=e.jsx(we,{certificate:d}):l=e.jsx(B,{title:o("router.domain.https.bad"),children:e.jsx(Ce,{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)}H.propTypes={domain:X.isRequired,filters:s.array};H.defaultProps={filters:["domain","http"]};const Tn=Ge(J,"mutate_blocklets"),Ln=Ge(J,"",$t);function rt(n){const{inService:t}=F(),{blocklet:o,loadingRuntimeInfo:i}=We();let a=Tn;return t&&(a=Ln),e.jsx(a,{...n,blocklet:o,inService:t,loadingRuntimeInfo:i})}rt.propTypes={listOnly:s.bool};rt.defaultProps={listOnly:!1};function J({hasPermission:n,blocklet:t,loadingRuntimeInfo:o,inService:i,listOnly:a}){var v,I,j,T;const{t:r}=k(),{info:l}=F(),[c,d]=A.useState(!1),h=ue(u=>u.breakpoints.down("md")),f=A.useMemo(()=>{let u=n;return Mt(t)&&(u=u&&i),u},[n,i,t]),{site:C}=t,S=A.useMemo(()=>{var u;return Bt((u=t.site)==null?void 0:u.domainAliases)},[(v=t.site)==null?void 0:v.domainAliases]),g=[],y=[],P=kt.encode(t.appPid),x=(j=(I=t.environments)==null?void 0:I.find(u=>u.key==="BLOCKLET_APP_PK"))==null?void 0:j.value,m=zt(S);return S.forEach(u=>{const L=u.value||"";Ve.isDidDomain(L)&&!L.startsWith(P)?y.push(u):g.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(In,{id:C.id,title:r("router.domain.add.title"),teamDid:(T=t.meta)==null?void 0:T.did,appId:t.appPid,appPk:x,systemDomains:m==null?void 0:m.map(u=>u.value),children:({open:u})=>e.jsxs(W,{style:{marginLeft:16},variant:"contained",color:"primary","data-cy":"add-domain-alias",onClick:u,disabled:Le.isInProgress(t.status),children:[e.jsx(Et,{style:{fontSize:"1.3em",marginRight:4}}),r("common.add")]})}),l.nftDomainUrl&&e.jsx(ye,{variant:"outlined",appId:t.appPid,appPk:x,siteId:C.id,inBlockletSetup:!1,teamDid:t.meta.did})]})]}),Le.isAccessible(t.status)===!1&&e.jsx(p,{mt:1.5,mb:1.5,children:e.jsx(de,{severity:"warning",children:r("blocklet.router.noRunning")})})]}),e.jsx(p,{sx:{display:"flex",flexDirection:"column",gap:1},children:(c?S:g).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(H,{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:C,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(H,{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:C,domain:u,blocklet:t})})]},L)]},L)})}),y.length>0&&e.jsx("div",{style:{marginLeft:"20px",marginTop:"12px"},children:e.jsx(W,{endIcon:c?e.jsx(Qe,{}):e.jsx(yt,{}),onClick:()=>d(!c),children:r(c?"common.collapseAll":"blocklet.router.showAllDomains")})}),!S.length&&(o?e.jsx(z,{size:16}):e.jsx(jt,{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,...o}){const{t:i,locale:a}=k(),{href:r,accessibility:l,value:c}=n,d=A.useCallback(()=>e.jsx(Be,{content:le(c),locale:a,style:{marginLeft:"4px",color:"#999",fontSize:"0.8em",verticalAlign:"bottom"}}),[c,a]);return!l||l.loading?e.jsxs(ne,{...o,children:[t,d(),e.jsx(B,{title:i("blocklet.router.checkUrlAccessible"),placement:"top-end",children:e.jsx("span",{className:"status",children:e.jsx(z,{size:12})})})]}):l.accessible?e.jsxs(ne,{...o,children:[e.jsx(p,{component:"a",href:r,target:"_blank",rel:"noopener noreferrer",children:t}),d()]}):e.jsxs(ne,{...o,children:[e.jsx(B,{title:i("blocklet.router.urlInaccessible"),placement:"top-end",children:e.jsx("span",{children:t})}),d()]})}oe.propTypes={domain:X.isRequired,children:s.any.isRequired};const ne=At.span`
|
|
1
|
+
import{ad as ae,ba as $e,N as ut,f as Be,L as mt,g as k,ag as W,al as pt,v as ft,z as O,aS as le,bF as ht,bG as Me,bH as xt,C as Pe,ab as gt,bl as Ee,ao as ze,b0 as Dt,bB as yt,aM as jt}from"./vendor-arcblock-Dn16DH88.js";import{a1 as ce,j as e,a3 as p,a2 as z,T as q,ad as de,e as K,t as ue,aj as Ue,E as s,a4 as M,M as vt,bW as bt,al as Ne,bp as Ct,bq as wt,am as St,ao as Rt,aa as At,I as It}from"./vendor-mui-core-COxJgW9_.js";import{r as A,g as Pt}from"./vendor-react-D-afvo_7.js";import{d as Et}from"./Add-WwBlcqNF.js";import{b as kt}from"./base32-DZ5GWnEl.js";import{ag as Tt,ah as Oe,y as F,B as We,h as ke,ai as He,M as Lt,aj as _t,af as Ve,b as qt,G as Te,ak as Ft,al as $t,I as Bt,am as Mt,an as zt,f as Le}from"./index-tDqjC_e2.js";import{d as Ut}from"./LockIcon-BIlUQ2kd.js";import{I as Nt,u as V,D as Ot,B as Wt,L as Ht}from"./vendor-hooks-DzETutIU.js";import{d as Vt}from"./CheckCircle-n23HoB1l.js";import{d as Gt,p as _e}from"./util-CmcVraD_.js";import{j as G,w as Kt,a as Qt}from"./vendor-utils-CV7RLr7b.js";import{_ as Q}from"./useSetState-Crt4S51m.js";import{w as Ge}from"./permission-C7OYX2OJ.js";import{_ as Yt,D as qe}from"./useAsyncRetry-m5oMMmVh.js";import{C as Y}from"./confirm-DhCXP8vW.js";import{d as Zt}from"./InfoOutlined-7hC78o3_.js";import{_ as Xt}from"./useAsync-BfmmMB4I.js";import"./api-C7qcY4XU.js";import{I as Jt}from"./index-Dk8-Ibsd.js";import{A as en}from"./actions-DsY16tuf.js";var me={},tn=ce;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=G("/api",String(n.url)),n.timeout=2e5,n.params=n.params||{},new URLSearchParams(n.url.split("?")[1]).has("locale")||(n.params.locale=ut()),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:o=700,name:i="did-domain:popup"}={})=>{const a=window.screenX+(window.innerWidth-t)/2,r=window.screenY+(window.innerHeight-o)/2,l=[`left=${a}`,`top=${r}`,`width=${t}`,`height=${o}`,"resizable=no","scrollbars=yes","status=yes","popup=yes"],c=window.open("",i,l.join(","));if(c===null)throw new Error("Failed to open popup");return c.location.href=Kt(n,{opener:window.location.origin}),c},ln="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p",Ye=async n=>{var d;if(!n||!(n!=null&&n.trim()))return null;const t=Qe(),o=new URL(n);o.pathname="__blocklet__.js",o.searchParams.set("type","json");const{data:i}=await t.get(o.toString()),a=(d=i==null?void 0:i.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=G(l,"/api");return{base:l,api:c}},cn=Be({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=Be({buy:{button:{title:"购买 DID 域名"},status:{inProgress:"请稍等,我们正在处理您的请求,购买域名后会自动解析到当前的应用...",success:"购买完成!"},error:{failedToCreateSession:"创建会话失败"}}}),un={zh:dn,en:cn};function Ze({delegatee:n,delegateePk:t,didDomainURL:o,locale:i,title:a,onSuccess:r,...l}){const{t:c}=k(),[d,h]=Nt({currentState:1}),f=A.useRef(null),C=V(x=>{var m,v,I,j;x.data.type==="didDomain.success"&&(r==null||r({nftDid:(m=x.data)==null?void 0:m.nftDid,domain:(v=x.data)==null?void 0:v.domain,chainHost:(I=x.data)==null?void 0:I.chainHost}),(j=f.current)==null||j.close(),f.current=null,h({currentState:4}),setTimeout(()=>{h({currentState:8})},2e3))});Ot(()=>{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 S=V(()=>{h({currentState:1})}),g=V(()=>{h({currentState:2}),P.run()}),y=V(({sessionId:x,baseURL:m})=>{window.addEventListener("message",C);const v=new URL(m);v.searchParams.set("sessionId",x),v.searchParams.set("locale",i),f.current=an(v.toString());const I=setInterval(()=>{var j;(j=f.current)!=null&&j.closed&&(clearInterval(I),S())},1e3);return()=>clearInterval(I)}),P=Wt(async()=>{const x=await Ye(o);if(!x)return null;const m=Qe({baseURL:x.api}),{data:v}=await m.post("/payment/session",{delegatee:n,delegateePk:t});return y({sessionId:v.sessionId,baseURL:x.base})},{manual:!0,debounceWait:500,debounceLeading:!0,debounceTrailing:!1,debounceMaxWait:3e3,refreshDeps:[],onError(x){console.error(x)}});return e.jsxs(e.Fragment,{children:[e.jsx(W,{onClick:g,variant:"contained",startIcon:e.jsx(Gt,{}),...l,children:a||c("buy.button.title")}),e.jsxs(pt,{fullWidth:!0,maxWidth:"xs",open:d.currentState>1&&d.currentState<8,onClose:S,children:[!P.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(Vt,{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")})]}),P.error&&e.jsx(de,{severity:"error",children:c("buy.error.failedToCreateSession")})]})]})}const Xe={onSuccess:()=>{},title:""};Ze.defaultProps=Xe;function Je(n){return e.jsx(mt,{locale:n.locale,translations:un,children:e.jsx(Ze,{...n})})}Je.defaultProps=Xe;function et({nftDid:n,didDomainURL:t,locale:o,sx:i}){const{t:a}=k(),[r,l]=Q({safeIframeRef:null,popoverAnchorEl:null}),c=A.useRef(null),d=K(),h=ue(d.breakpoints.down("md")),f=y=>{l({popoverAnchorEl:y.currentTarget})},C=()=>{l({popoverAnchorEl:null})},S=Ht(async()=>{const y=await Ye(t);return y?y.base:null});if(!S.value)return null;if(S.loading)return e.jsx(z,{});const g=G(S.value,`/embed/domain?nft-did=${n}&locale=${o}`);return e.jsxs(e.Fragment,{children:[e.jsx(p,{component:"img",src:G(t,"/.well-known/service/blocklet/logo"),alt:"logo",width:16,height:16,onClick:f,sx:rn({cursor:"pointer"},i)}),e.jsx(Ue,{id:"popover-info",open:!!r.popoverAnchorEl,anchorEl:r.popoverAnchorEl,onClose:C,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:g})})]})}et.defaultProps={sx:{}};const mn=n=>["waiting","creating","renewaling"].includes(n);function pe(n){var w,R;const{t}=k(),[o,i]=A.useState(!1),{inService:a}=F(),[r,l]=A.useState(null),{siteId:c,domain:d,onAdd:h,children:f,did:C}=n,[S,g]=A.useState(!1),{api:y,ws:{useSubscription:P}}=F(),{mode:x,actions:{refreshDomainStatus:m}}=We(),v=Yt(async()=>{const{cert:b}=await y.findCertificateByDomain({input:{domain:d,did:C}});return b}),I=(b,U)=>{b.domain===d&&(g(!1),i(!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;v.loading||g(mn((b=v.value)==null?void 0:b.status))},[v.loading,(w=v.value)==null?void 0:w.status]),P(ke.BlockletEvents.certError,b=>I(b,"error")),P(ke.BlockletEvents.certIssued,b=>{v.retry(),m(b.domain),I(b,"success")}),v.loading||((R=v.value)==null?void 0:R.status)==="normal")return"";const j=()=>{i(!1),l(null)},T=async()=>{i(!0);try{await y.issueLetsEncryptCert({input:{siteId:c,domain:d,did:C,inBlockletSetup:x==="setup"}}),h(),g(!0)}catch(b){console.error(b),g(!1)}finally{i(!1),l(null)}},u={title:t("router.cert.genLetsEncryptCert.title"),description:e.jsxs("div",{children:[e.jsx(de,{severity:"success",children:t("router.cert.genLetsEncryptCert.dnsTip")}),t("router.cert.genLetsEncryptCert.description")]}),confirm:t("common.confirm"),onConfirm:T,onCancel:j},L=b=>{b.stopPropagation(),l(u)};return e.jsxs(e.Fragment,{children:[S?e.jsx(M,{title:t("router.cert.issuing"),children:e.jsx(z,{size:12})}):f({loading:o,open:L}),r&&e.jsx(Y,{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:o,...i}=n;return Tt(t)||!Oe(t)||ft(o)||o!=null&&o.isHttps?"":e.jsx(pe,{domain:t,...i})}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={},pn=ce;Object.defineProperty(he,"__esModule",{value:!0});var tt=he.default=void 0,fn=pn(ae()),hn=e;tt=he.default=(0,fn.default)((0,hn.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 nt=A.createContext({}),{Provider:xn,Consumer:es}=nt;function gn({children:n}){const[t,o]=Q({domain:"",error:null}),{locale:i}=k(),a={error:t.error,domain:t.domain,setError:r=>{o({error:r})},setDomain:r=>{const l=le(r),c=He(l,i);o({domain:l,error:c})}};return e.jsx(xn,{value:{value:a},children:n})}function Dn(){const{value:n}=A.useContext(nt);return n}const{joinURL:Fe}=Lt,yn=_t,st="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p",jn=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:o}=await yn.get(t.toString()),i=(c=o==null?void 0:o.componentMountPoints)==null?void 0:c.find(d=>d.did===st),a=new URL(n);a.pathname=i==null?void 0:i.mountPoint;const r=a.toString(),l=Fe(r,"/api");return{base:r,api:l,domain:Fe(l,"/domains")}};var vn={DID_DOMAIN_SERVICE_DID:st,getDidDomainServiceURL:jn},Z={exports:{}};const bn=ht,Cn=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class ot 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 wn=(n,t,o)=>{const i=o.retries-(t-1);return n.attemptNumber=t,n.retriesLeft=i,n},Sn=n=>Cn.includes(n),it=(n,t)=>new Promise((o,i)=>{t={onFailedAttempt:()=>{},retries:10,...t};const a=bn.operation(t);a.attempt(async r=>{try{o(await n(r))}catch(l){if(!(l instanceof Error)){i(new TypeError(`Non-error was thrown: "${l}". You should only throw errors.`));return}if(l instanceof ot)a.stop(),i(l.originalError);else if(l instanceof TypeError&&!Sn(l.message))a.stop(),i(l);else{wn(l,r,t);try{await t.onFailedAttempt(l)}catch(c){i(c);return}a.retry(l)||i(a.mainError())}}})});Z.exports=it;Z.exports.default=it;Z.exports.AbortError=ot;var Rn=Z.exports;const An=Pt(Rn);function xe({domain:n,resolvedTarget:t,...o}){const{t:i,locale:a}=k();return e.jsxs(p,{sx:{backgroundColor:"rgb(236, 251, 253)",borderColor:"rgb(236, 251, 253)",borderRadius:"8px",padding:"12px"},...o,children:[e.jsxs(p,{display:"flex",children:[i("router.domain.setup.tipStart"),n&&e.jsx(p,{mx:.5,color:"primary.main",fontWeight:"fontWeightBold",children:n}),i("router.domain.setup.tipEnd"),":"]}),e.jsxs(p,{sx:{"&>div":{mb:0},marginTop:"8px"},children:[e.jsx(se,{label:i("router.domain.setup.recordType"),value:"CNAME",locale:a}),e.jsx(se,{label:i("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:o}){const i=ue(r=>r.breakpoints.down("md")),a=K();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:i?{maxWidth:"95%",wordWrap:"break-word"}:{wordWrap:"break-word"},children:o}),e.jsx(Me,{content:o,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:o,defaultCustomDomain:i,onInputDomain:a,appId:r,appPk:l,onSuccess:c,onError:d,disabled:h,autoFocus:f,inBlockletSetup:C,shouldCheckDomain:S,onStateChange:g,currentIp:y,resolveDomain:P,...x}){const{t:m,locale:v}=k(),{api:I,info:j}=F(),T=Dn(),u=K(),L=xt({key:"sm"}),[w,R]=Q({submittingDomain:!1,domain:i,error:null,type:j!=null&&j.nftDomainUrl?"nftDomain":"inputDomain",showNFTDomainAuth:!1,showDnsTip:!1}),b=Xt(()=>vn.getDidDomainServiceURL(j==null?void 0:j.nftDomainUrl));if(j!=null&&j.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,at=()=>{R({invalidDNSDomain:null})},ee=async D=>{g(m("setup.domain.addingDomain")),await I.addDomainAlias({input:{id:n,domainAlias:D,teamDid:t,inBlockletSetup:!0}}),R({submittingDomain:!1}),c({domain:D,type:"inputDomain"})},Se=async({domain:D,type:E,nftDid:N,chainHost:_})=>{try{if(!S){if(E==="inputDomain"){await ee(D);return}c({domain:D,type:E,nftDid:N,chainHost:_});return}g({text:m("setup.domain.checkingResolvable")});let $=30;const te=3e3,dt=$*1e3/te,Ae=setInterval(()=>{if($<=0){clearInterval(Ae);return}g({text:`${m("setup.domain.checkingResolvable")} (${$--}s)`})},1e3),Ie=await An(async()=>{const{data:B}=await P(D);if(!B.address)throw new Error("Cannot resolve domain");return B.address},{retries:dt,minTimeout:te,maxTimeout:te,onFailedAttempt:console.error}).catch(console.error);if(clearInterval(Ae),!Ie){const B=m("setup.domain.cannotResolve",{domain:D});if(E==="nftDomain"){O.error(B),c({domain:D,type:"nftDomain"});return}g({text:""}),R({invalidDNSDomain:{domain:D,error:B},domain:D,type:E,submittingDomain:!1});return}if(Ie!==y){const B=m("setup.domain.resolvedAddressError",{domain:D,curDomain:window.location.hostname});if(E==="nftDomain"){O.error(B),c({domain:D,type:"nftDomain"});return}g({text:""}),R({invalidDNSDomain:{domain:D,error:B},domain:D,type:E,submittingDomain:!1});return}if(E==="nftDomain"){c({domain:D,type:"nftDomain"});return}await ee(D)}catch($){O.error($.message),g({text:""}),R({submittingDomain:!1})}},lt=async({domain:D,nftDid:E,chainHost:N})=>{try{const _=_e(D);R({submittingDomain:!0}),await I.addDomainAlias({input:{id:n,type:"nft-domain",domainAlias:_,nftDid:E,chainHost:N,teamDid:t,inBlockletSetup:C}});const $="nftDomain";R({showNFTDomainAuth:!1,type:$}),await Se({domain:_,type:$,nftDid:E,chainHost:N})}catch(_){O.error(_.message)}finally{R({showNFTDomainAuth:!1,submittingDomain:!1})}},ct=async()=>{try{R({submittingDomain:!0});const D=_e(w.domain);if(j.nftDomainUrl&&U&&(await I.isDidDomain({input:{domain:D}})).value===!0){R({showNFTDomainAuth:!0});return}await Se({domain:D,type:w.type})}catch(D){R({submittingDomain:!1}),T.setError(D.message)}},Re=T.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(vt,{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:D=>{var _;const E=le((_=D.target)==null?void 0:_.value);T.setDomain(E);const N=He(E,v);R({domain:E,error:N,type:"inputDomain"}),a({domain:E,error:N,type:"inputDomain"})},autoFocus:f,onBlur:()=>{T.domain||(R({error:null}),T.setError(null))}}),e.jsx(p,{sx:{width:"100%",display:"flex",justifyContent:"flex-end"},children:e.jsx(bt,{"data-cy":"confirm-add-domain",fullWidth:L,variant:"contained",loading:w.submittingDomain,onClick:ct,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(Zt,{fontSize:"1em"}),m("router.domainAlias.showTipHint")]}),w.showDnsTip&&e.jsx(xe,{domain:w.domain,resolvedTarget:o,style:{marginTop:"4px"}})]}),w.invalidDNSDomain&&e.jsx(Y,{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:at}),U&&e.jsx(gt,{open:w.showNFTDomainAuth,popup:!0,useSocket:!1,forceConnected:!1,action:"authorize",baseUrl:U.api,checkFn:Qt.create({baseURL:U.api}).get,extraParams:{delegatee:r,delegateePk:l,domain:w.domain},onSuccess:lt,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:o,teamDid:i,systemDomains:a,appId:r,appPk:l}){const{t:c}=k(),[d,h]=Q({loading:!1,confirmSetting:null}),f=a.find(y=>Ve.isDidDomain(y)),C=()=>{h({loading:!1,confirmSetting:null})},S={title:o||c("router.domainAlias.add.title"),description:function(P,x,m){return e.jsx(ge,{siteId:n,teamDid:i,cnameDomain:f,onSuccess:()=>h({confirmSetting:null}),onInputDomain:({domain:v,type:I,error:j})=>{x({...P,domain:v,type:I,__disableConfirm:!!j}),m(j)},appId:r,appPk:l})},confirm:c("common.confirm"),cancel:c("common.cancel"),params:{domain:"",__disableConfirm:!0},onCancel:C},g=y=>{y.stopPropagation(),h({confirmSetting:S})};return e.jsxs(e.Fragment,{children:[typeof t=="function"?t({loading:d.loading,open:g}):e.jsxs(Ne,{onClick:g,className:"rule-action","data-cy":"action-add-domain-alias",children:[d.loading?e.jsx(z,{size:16}):e.jsx(tt,{style:{fontSize:18,marginRight:5}}),c("router.domainAlias.add.title")]}),d.confirmSetting&&e.jsx(Y,{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 In(n){return e.jsx(gn,{children:e.jsx(De,{...n})})}function ye({appId:n,appPk:t,siteId:o,inBlockletSetup:i,teamDid:a,sx:r,...l}){const{api:c,info:d}=F(),{locale:h,t:f}=k(),C=async({domain:S,nftDid:g,chainHost:y})=>{await c.addDomainAlias({input:{id:o,type:"nft-domain",domainAlias:S,nftDid:g,chainHost:y,teamDid:a,inBlockletSetup:i}})};return e.jsx(Je,{delegatee:n,delegateePk:t,didDomainURL:d.nftDomainUrl,onSuccess:C,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}=k(),[o,i]=A.useState(!1),[a,r]=A.useState(null),{id:l,domain:c,children:d,teamDid:h}=n,{api:f}=F(),C=()=>{i(!1),r(null)},S=async()=>{i(!0);try{await f.deleteDomainAlias({input:{id:l,domainAlias:c,teamDid:h}}),await qt(2e3)}catch(P){O.error(P.message)}finally{r(null),i(!1)}},g={title:t("router.domainAlias.delete.title"),description:t("router.domainAlias.delete.description"),confirm:t("common.confirm"),onConfirm:S,onCancel:C},y=P=>{P.stopPropagation(),r(g)};return e.jsxs(e.Fragment,{children:[typeof d=="function"?d({loading:o,open:y}):e.jsxs(W,{edge:"end",onClick:y,size:"small",className:"rule-action",color:"error","data-cy":"action-delete-domain-alias",children:[o?e.jsx(z,{size:16}):e.jsx(ze,{style:{fontSize:16}}),t("router.domainAlias.delete.title")]}),a&&e.jsx(Y,{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:o}){const{t:i}=k(),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=o==null?void 0:o.meta)==null?void 0:l.did,children:({open:c})=>e.jsx(M,{title:a?i("blocklet.router.currentDomainTip"):"",children:e.jsx("span",{children:e.jsxs(Ne,{disabled:t.isProtected||a,dense:!0,onClick:d=>{r(),c(d)},"data-cy":"action-toggle-block",children:[e.jsx(Ct,{style:{minWidth:24,marginRight:8},children:e.jsx(ze,{})}),e.jsx(wt,{primary:i("common.delete")})]},"remove")})})})}]})}ve.propTypes={site:s.object.isRequired,domain:s.object.isRequired,blocklet:s.object.isRequired};ve.defaultProps={};var be={},Pn=ce;Object.defineProperty(be,"__esModule",{value:!0});var Ce=be.default=void 0,En=Pn(ae()),kn=e;Ce=be.default=(0,En.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 X=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 we({certificate:n}){const[t,o]=A.useState(null),i=F(),{t:a,locale:r}=k(),l=h=>{o(h.currentTarget)},c=()=>{o(null)},d=!!t;return e.jsxs(e.Fragment,{children:[e.jsx(Ce,{"aria-owns":d?"mouse-over-popover":void 0,onMouseEnter:l,onMouseLeave:c,style:{color:"#44cdc6",fontSize:20,cursor:"pointer"}}),e.jsx(Ue,{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(St,{children:e.jsxs(Rt,{style:{display:"flex"},children:[e.jsx("div",{children:e.jsx("img",{src:`${i.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")}: ${Dt(n,"issuer.commonName","")}`}),e.jsx(q,{component:"div",children:`${a("router.cert.issuedOn")}: ${Te(n.validFrom,r)}`}),e.jsx(q,{component:"div",children:`${a("router.cert.expiryOn")}: ${Te(n.validTo,r)}`})]})]})})})]})}we.propTypes={certificate:s.object};we.defaultProps={certificate:{}};function H({domain:n,filters:t}){const{t:o}=k(),{value:i,domainStatus:a}=n;if(!Oe(i))return null;let r=null,l=null;const{isHttps:c,matchedCert:d}=a;if(!Ft(i)){const{dns:{resolved:f,ip:C}={}}=a;f||C==="127.0.0.1"?r=e.jsx(M,{title:o("router.domain.verify.ok"),children:e.jsx(qe,{color:"success"})}):r=e.jsx(M,{title:o("router.domain.verify.notResolved"),children:e.jsx(qe,{color:"error"})})}c?l=e.jsx(we,{certificate:d}):l=e.jsx(M,{title:o("router.domain.https.bad"),children:e.jsx(Ce,{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)}H.propTypes={domain:X.isRequired,filters:s.array};H.defaultProps={filters:["domain","http"]};const Tn=Ge(J,"mutate_blocklets"),Ln=Ge(J,"",$t);function rt(n){const{inService:t}=F(),{blocklet:o,loadingRuntimeInfo:i}=We();let a=Tn;return t&&(a=Ln),e.jsx(a,{...n,blocklet:o,inService:t,loadingRuntimeInfo:i})}rt.propTypes={listOnly:s.bool};rt.defaultProps={listOnly:!1};function J({hasPermission:n,blocklet:t,loadingRuntimeInfo:o,inService:i,listOnly:a}){var v,I,j,T;const{t:r}=k(),{info:l}=F(),[c,d]=A.useState(!1),h=ue(u=>u.breakpoints.down("md")),f=A.useMemo(()=>{let u=n;return Bt(t)&&(u=u&&i),u},[n,i,t]),{site:C}=t,S=A.useMemo(()=>{var u;return Mt((u=t.site)==null?void 0:u.domainAliases)},[(v=t.site)==null?void 0:v.domainAliases]),g=[],y=[],P=kt.encode(t.appPid),x=(j=(I=t.environments)==null?void 0:I.find(u=>u.key==="BLOCKLET_APP_PK"))==null?void 0:j.value,m=zt(S);return S.forEach(u=>{const L=u.value||"";Ve.isDidDomain(L)&&!L.startsWith(P)?y.push(u):g.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(In,{id:C.id,title:r("router.domain.add.title"),teamDid:(T=t.meta)==null?void 0:T.did,appId:t.appPid,appPk:x,systemDomains:m==null?void 0:m.map(u=>u.value),children:({open:u})=>e.jsxs(W,{style:{marginLeft:16},variant:"contained",color:"primary","data-cy":"add-domain-alias",onClick:u,disabled:Le.isInProgress(t.status),children:[e.jsx(Et,{style:{fontSize:"1.3em",marginRight:4}}),r("common.add")]})}),l.nftDomainUrl&&e.jsx(ye,{variant:"outlined",appId:t.appPid,appPk:x,siteId:C.id,inBlockletSetup:!1,teamDid:t.meta.did})]})]}),Le.isAccessible(t.status)===!1&&e.jsx(p,{mt:1.5,mb:1.5,children:e.jsx(de,{severity:"warning",children:r("blocklet.router.noRunning")})})]}),e.jsx(p,{sx:{display:"flex",flexDirection:"column",gap:1},children:(c?S:g).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(H,{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:C,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(H,{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:C,domain:u,blocklet:t})})]},L)]},L)})}),y.length>0&&e.jsx("div",{style:{marginLeft:"20px",marginTop:"12px"},children:e.jsx(W,{endIcon:c?e.jsx(Ke,{}):e.jsx(yt,{}),onClick:()=>d(!c),children:r(c?"common.collapseAll":"blocklet.router.showAllDomains")})}),!S.length&&(o?e.jsx(z,{size:16}):e.jsx(jt,{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,...o}){const{t:i,locale:a}=k(),{href:r,accessibility:l,value:c}=n,d=A.useCallback(()=>e.jsx(Me,{content:le(c),locale:a,style:{marginLeft:"4px",color:"#999",fontSize:"0.8em",verticalAlign:"bottom"}}),[c,a]);return!l||l.loading?e.jsxs(ne,{...o,children:[t,d(),e.jsx(M,{title:i("blocklet.router.checkUrlAccessible"),placement:"top-end",children:e.jsx("span",{className:"status",children:e.jsx(z,{size:12})})})]}):l.accessible?e.jsxs(ne,{...o,children:[e.jsx(p,{component:"a",href:r,target:"_blank",rel:"noopener noreferrer",children:t}),d()]}):e.jsxs(ne,{...o,children:[e.jsx(M,{title:i("blocklet.router.urlInaccessible"),placement:"top-end",children:e.jsx("span",{children:t})}),d()]})}oe.propTypes={domain:X.isRequired,children:s.any.isRequired};const ne=At.span`
|
|
2
2
|
&,
|
|
3
3
|
& > * {
|
|
4
4
|
color: #222;
|
|
@@ -12,4 +12,4 @@ import{ah as ae,bf as $e,N as ut,f as Me,L as mt,g as k,ak as W,ap as pt,v as ft
|
|
|
12
12
|
.status {
|
|
13
13
|
margin-left: 8px;
|
|
14
14
|
}
|
|
15
|
-
`;function ie({hasMutatePermission:n,site:t,domain:o,blocklet:i}){const a=
|
|
15
|
+
`;function ie({hasMutatePermission:n,site:t,domain:o,blocklet:i}){const a=K(),{t:r}=k();return n&&!o.isProtected?e.jsx(ve,{site:t,domain:o,blocklet:i}):e.jsx(M,{title:r("blocklet.router.domainLockTooltip"),placement:"top",children:e.jsx(It,{disabled:!0,size:"large",style:{pointerEvents:"auto",paddingTop:0,paddingBottom:0},children:e.jsx(Ut,{style:{fill:a.palette.text.disabled}})})})}ie.propTypes={hasMutatePermission:s.bool.isRequired,site:s.object.isRequired,domain:X.isRequired,blocklet:s.object.isRequired};function re({siteId:n,domain:t,blocklet:o,hasMutatePermission:i}){const{info:a}=F(),{t:r,locale:l}=k();return e.jsxs(p,{sx:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:1},children:[t.type==="nft-domain"&&e.jsx(et,{locale:l,nftDid:t.nftDid,didDomainURL:a.nftDomainUrl}),e.jsx(H,{domain:t,filters:["http"]},`${t.value}-http`),i&&e.jsx(fe,{siteId:n,domain:t.value,domainStatus:t.domainStatus,did:o.meta.did,children:({open:c})=>e.jsx(W,{sx:{padding:0},size:"small",onClick:d=>c(d),children:r("router.cert.genLetsEncryptCert.title")})})]})}re.propTypes={siteId:s.string.isRequired,domain:X.isRequired,blocklet:s.object.isRequired,hasMutatePermission:s.bool.isRequired};export{ge as A,ye as B,gn as D,rt as a};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DVYdq7IA.js","assets/vendor-react-D-afvo_7.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as ee,_ as b,d as $}from"./index-tDqjC_e2.js";import{a1 as te,j as e,ac as g,T as w,x as P,aQ as se,a3 as F,M,a2 as ne,aa as ie}from"./vendor-mui-core-COxJgW9_.js";import{r,u as re}from"./vendor-react-D-afvo_7.js";import{d as p,ad as ae,g as oe,W as ce,z as C,aS as h,P as le,U as ue,S as de,D as fe}from"./vendor-arcblock-Dn16DH88.js";import{i as me}from"./isEmail-BWNRBSAy.js";import{F as pe}from"./fullpage-DZPI7F_L.js";import"./vendor-hooks-DzETutIU.js";import{f as S}from"./format-error-C0Ke3VXF.js";import{d as ge}from"./CheckCircle-n23HoB1l.js";import{g as R}from"./get-safe-url-yHkHYeNB.js";import"./vendor-utils-CV7RLr7b.js";var N;(N=window.env)!=null&&N.groupPathPrefix;p.ROLES.ADMIN,p.ROLES.OWNER;const y=()=>{const{searchParams:o}=new URL(window.location.href);return o.get("fromWallet")==="1"};var T={},he=te;Object.defineProperty(T,"__esModule",{value:!0});var H=T.default=void 0,ye=he(ae()),xe=e;H=T.default=(0,ye.default)((0,xe.jsx)("path",{d:"M12 19c0-3.87 3.13-7 7-7 1.08 0 2.09.25 3 .68V6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h8.08c-.05-.33-.08-.66-.08-1M4 6l8 5 8-5v2l-8 5-8-5zm13.34 16-3.54-3.54 1.41-1.41 2.12 2.12 4.24-4.24L23 16.34z"}),"MarkEmailRead");const Ee=ie.form`
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
gap: 24px;
|
|
8
|
+
width: 100%;
|
|
9
|
+
|
|
10
|
+
input[type='number']::-webkit-inner-spin-button,
|
|
11
|
+
input[type='number']::-webkit-outer-spin-button {
|
|
12
|
+
-webkit-appearance: none;
|
|
13
|
+
margin: 0;
|
|
14
|
+
}
|
|
15
|
+
div.Mui-focused input {
|
|
16
|
+
caret-color: ${o=>o.theme.palette.primary.main};
|
|
17
|
+
}
|
|
18
|
+
`,ve=o=>{try{if(!o)return null;const a=fe.fromBase64(o).toString();return me(a)?a:null}catch{return null}};function Re(){var B,W;const o=r.useRef(null),{session:a,connectApi:I}=ee(),{t:s,locale:d}=oe(),[x,L]=r.useState(((B=a.user)==null?void 0:B.email)||""),[c,A]=r.useState(""),[E,_]=r.useState(!1),[U,q]=r.useState(!1),[u,G]=r.useState(!1),[Y,K]=r.useState(!1),[v,Q]=r.useState(!1),{wallet:f}=ce(),[l]=re(),O=l.get("inviter")||localStorage.getItem("inviter"),m=l.get("updateKyc")==="1";r.useEffect(()=>{const n=l.get("subject"),t=ve(n);t&&L(t)},[]),r.useEffect(()=>{var n;(n=a.user)!=null&&n.emailVerified&&m&&(K(!0),setTimeout(()=>{if(f&&y()){b(()=>import("./index-DVYdq7IA.js").then(t=>t.i),__vite__mapDeps([0,1])).then(t=>{t.call("arcClosePage")});return}window.location.href=R(l.get("redirect")||"/")},1e3))},[a.user,m,f,l]);const J=r.useCallback(async n=>{var t;n.preventDefault(),_(!0);try{await $.post(`/kyc/email/send?locale=${d}`,{email:x}),G(!0),C.success(s("login.issueKyc.codeSentSuccess"))}catch(i){C.error(S(i)),(t=document.getElementById("email-input"))==null||t.focus()}finally{_(!1)}},[x,d,s]),k=r.useCallback(async n=>{var t;n&&n.preventDefault(),_(!0);try{await $.post(`/kyc/email/verify?locale=${d}`,{code:c}),K(!0),I.open({locale:d,action:"issue-kyc",extraParams:{code:c,updateKyc:l.get("updateKyc")||"0",inviter:O||""},containerEl:o.current,className:"connect",popup:!1,saveConnect:!1,forceConnected:!0,messages:{title:s("login.issueKyc.claim"),scan:s("login.issueKyc.scan"),confirm:s("login.issueKyc.confirm"),success:s("login.issueKyc.success")},useSocket:!0,onSuccess:()=>{Q(!0),I.close(),m?(a.refresh({showProgress:!1,forceRefreshToken:!0}),setTimeout(()=>{if(f&&y()){b(()=>import("./index-DVYdq7IA.js").then(i=>i.i),__vite__mapDeps([0,1])).then(i=>{i.call("arcClosePage")});return}window.location.href=R(l.get("redirect")||"/")},1e3)):f&&y()&&b(()=>import("./index-DVYdq7IA.js").then(i=>i.i),__vite__mapDeps([0,1])).then(i=>{i.call("arcClosePage")})},onError:i=>{C.error(S(i))}})}catch(i){K(!1),C.error(S(i)),(t=document.getElementById(`code-input-${h(c).length-1}`))==null||t.focus()}finally{_(!1)}},[c,d,l,m,f,O]);r.useEffect(()=>{u&&h(c).length===p.VERIFY_CODE_LENGTH&&k()},[c,k,u]);const X=r.useCallback(()=>{q(!0),I.open({locale:d,action:"update-kyc",containerEl:o.current,className:"connect",popup:!1,saveConnect:!1,forceConnected:!0,messages:{title:s("login.updateKyc.title"),scan:s("login.updateKyc.scan"),confirm:s("login.updateKyc.confirm"),success:s("login.updateKyc.success")},useSocket:!0,onSuccess:()=>{a.refresh({showProgress:!1,forceRefreshToken:!0}),setTimeout(()=>{if(f&&y()){b(()=>import("./index-DVYdq7IA.js").then(n=>n.i),__vite__mapDeps([0,1])).then(n=>{n.call("arcClosePage")});return}window.location.href=R(l.get("redirect")||"/")},2e3)},onError:n=>{C.error(S(n))}})},[d,l,f]),D=r.useCallback(n=>{if(!u)return;n.preventDefault();const t=h(n.clipboardData.getData("text/plain").slice(0,p.VERIFY_CODE_LENGTH));if(!/^\d+$/.test(t))return;A(t.padEnd(p.VERIFY_CODE_LENGTH," "));const i=document.getElementById(`code-input-${t.length}`);i&&i.focus()},[u]);r.useEffect(()=>(document.addEventListener("paste",D),()=>{document.removeEventListener("paste",D)}),[D]);const V=y()?s("login.issueKyc.issueTitle"):s("login.issueKyc.verifyTitle"),Z=y()?s("login.issueKyc.issueAction"):s("login.issueKyc.verifyAction");return e.jsxs(pe,{did:(W=window.blocklet)==null?void 0:W.appPid,children:[e.jsx(le,{children:e.jsx("title",{children:V})}),e.jsxs(g,{direction:"column",justifyContent:"center",alignItems:"center",sx:{width:"560px",px:2,boxSizing:"border-box",maxWidth:"100%",height:"100%"},children:[e.jsxs(g,{spacing:1,justifyContent:"center",alignItems:"center",sx:{mb:3},children:[v?e.jsx(ge,{sx:{fontSize:72},color:"success"}):e.jsx(H,{sx:{fontSize:72},color:"primary"}),e.jsx(w,{variant:"h5",sx:{textAlign:"center"},children:V}),!v&&e.jsx(w,{variant:"body2",color:"text.secondary",sx:{textAlign:"center"},children:s("login.issueKyc.pageDescription")}),v&&e.jsx(w,{variant:"body1",sx:{textAlign:"center"},children:s("login.issueKyc.success")}),v&&e.jsx(P,{variant:"contained",color:"primary",component:se,href:"/",size:"large",children:s("login.issueKyc.backToHome")}),!v&&a.user&&e.jsxs(g,{direction:"column",justifyContent:"center",alignItems:"center",children:[e.jsx(w,{variant:"body2",color:"info.main",sx:{textAlign:"center",mt:1},children:s("login.issueKyc.issueTarget",{action:Z})}),e.jsxs(g,{direction:"row",justifyContent:"center",alignItems:"center",spacing:1,sx:{width:"100%",maxWidth:360},children:[e.jsx(ue,{did:a.user.did,responsive:!0,copyable:!0,showQrcode:!1}),e.jsx(de,{locale:d,session:a,showRole:!0,showManageBlocklet:!1})]})]})]}),e.jsx(F,{ref:o,sx:{width:"100%"},children:!Y&&!U&&e.jsxs(Ee,{onSubmit:u?k:J,children:[!u&&e.jsx(M,{type:"email",id:"email-input",placeholder:s("login.issueKyc.emailPlaceholder"),sx:{width:"100%",maxWidth:360},value:x,onChange:n=>L(n.target.value),disabled:E,required:!0}),u&&e.jsxs(g,{direction:"column",justifyContent:"center",alignItems:"center",spacing:2,children:[e.jsx(w,{variant:"body2",textAlign:"center",children:s("login.issueKyc.codeSentMessage",{email:x})}),e.jsx(F,{sx:{width:"100%",maxWidth:360,display:"flex",justifyContent:"space-between"},children:[...Array(p.VERIFY_CODE_LENGTH)].map((n,t)=>e.jsx(M,{value:h(c[t])||"",type:"number",inputProps:{maxLength:1,style:{textAlign:"center",fontSize:"1.5rem"},autoComplete:"off"},sx:{width:"14%"},onChange:i=>{var z;const j=c.split("");j[t]=i.target.value,A(j.join("")),i.target.value&&t<5&&((z=document.getElementById(`code-input-${t+1}`))==null||z.focus())},onKeyDown:i=>{var j;i.key==="Backspace"&&!h(c[t])&&t>0&&((j=document.getElementById(`code-input-${t-1}`))==null||j.focus())},disabled:E,required:!0,id:`code-input-${t}`,autoComplete:"off"},`code-input-${t}`))})]}),e.jsxs(g,{direction:"row",justifyContent:m?"space-between":"center",alignItems:"center",spacing:2,sx:{width:"100%",maxWidth:360},children:[m&&e.jsx(P,{variant:"text",disabled:E,onClick:X,size:"large",children:s("login.updateKyc.button")}),e.jsx(P,{type:"submit",size:"large",variant:"contained",disabled:E||!x||u&&h(c).length!==p.VERIFY_CODE_LENGTH,sx:{width:m?"auto":"100%"},children:E?e.jsx(ne,{size:24}):s(u?"login.issueKyc.verifyButton":"login.issueKyc.sendCodeButton")})]})]})})]})]})}export{Re as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,a2 as C,a3 as T}from"./vendor-mui-core-COxJgW9_.js";import{r as k,k as W}from"./vendor-react-D-afvo_7.js";import{g as j,C as S,
|
|
1
|
+
import{j as e,a2 as C,a3 as T}from"./vendor-mui-core-COxJgW9_.js";import{r as k,k as W}from"./vendor-react-D-afvo_7.js";import{g as j,C as S,ab as I,z as h,d as R,ac as U}from"./vendor-arcblock-Dn16DH88.js";import{F as b}from"./fullpage-DZPI7F_L.js";import{w as v}from"./wrap-locale-DTO386nY.js";import{g as L}from"./get-safe-url-ByH0hntp.js";import{S as F,s as N,a as _}from"./index-tDqjC_e2.js";import"./vendor-utils-CV7RLr7b.js";import"./vendor-hooks-DzETutIU.js";function D({SessionContext:t,webWalletUrl:n,onSuccess:s}){var d,g;const{api:a,session:i}=k.useContext(t),{t:o,locale:f}=j(),u=W(),{searchParams:l}=new URL(window.location.href),p=l.get("redirect"),w=async(r,E)=>{s(r,E),await i.refresh(),h.success(o("exchangePassport.success")),setTimeout(()=>{if(p){const c=decodeURIComponent(p);c.startsWith(R.WELLKNOWN_SERVICE_PATH_PREFIX)?u(c,{replace:!0}):window.location.href=L(c)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},P=r=>{h.error(r.message)},m={},x=l.get("componentId");return x&&(m.componentId=x),i.loading?e.jsx(S,{children:e.jsx(C,{})}):e.jsx(b,{did:((d=window==null?void 0:window.blocklet)==null?void 0:d.appPid)||((g=window==null?void 0:window.env)==null?void 0:g.appPid),children:e.jsx(T,{sx:{width:"560px",maxWidth:"100%",height:"100%"},children:e.jsx(I,{className:"connect",action:"exchange-passport",checkFn:a.get,checkTimeout:10*60*1e3,webWalletUrl:n,onSuccess:w,onError:P,locale:f,messages:{title:o("exchangePassport.dialog.title"),scan:o("exchangePassport.dialog.scan"),confirm:o("exchangePassport.dialog.confirm"),success:o("exchangePassport.dialog.success")},extraParams:m,extraContent:null})})})}const z=v(D);function y(){const t=U(),n=(s,a)=>{s.sessionToken&&(N(a(s.sessionToken)),_(a(s.refreshToken)))};return e.jsx(z,{SessionContext:F,webWalletUrl:t,onSuccess:n})}export{y as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a1 as X,j as e,E as t,I as S,aR as A,x as U,P as V,v as W,$ as G,ar as H,al as J,bR as Q,M as Y,a3 as u,a2 as Z}from"./vendor-mui-core-COxJgW9_.js";import{
|
|
1
|
+
import{a1 as X,j as e,E as t,I as S,aR as A,x as U,P as V,v as W,$ as G,ar as H,al as J,bR as Q,M as Y,a3 as u,a2 as Z}from"./vendor-mui-core-COxJgW9_.js";import{ad as ee,af as te,bc as se}from"./vendor-arcblock-Dn16DH88.js";import{b as P,r as i}from"./vendor-react-D-afvo_7.js";import{d as ae}from"./Done-BbnQSLvu.js";import{F as le,R as ne}from"./logo-uploader-CNnYMPxh.js";import{d as re}from"./EditIcon-DDucSncy.js";import{d as ie}from"./ArrowDropDown-B6VSNrNX.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(S,{"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
2
|
0%, 100% {
|
|
3
3
|
transform: scale(1) translateX(0);
|
|
4
4
|
}
|
|
@@ -8,4 +8,4 @@ import{a1 as X,j as e,E as t,I as S,aR as A,x as U,P as V,v as W,$ as G,ar as H,
|
|
|
8
8
|
25%, 75% {
|
|
9
9
|
transform: scale(1.1) translateX(3px);
|
|
10
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[v,g]=i.useState(!1),[h,q]=i.useState(!1),{t:L}=i.useContext(te),[
|
|
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[v,g]=i.useState(!1),[h,q]=i.useState(!1),{t:L}=i.useContext(te),[y,B]=i.useState(d&&n==="__encrypted__"?null:n),[c,x]=i.useState(y),[f,j]=i.useState(!1),[M,E]=i.useState(!1),F=async()=>{q(!0);try{if(await C(c)===!1)x(y);else{let k=c;typeof _=="function"&&(k=_(c)),x(k),B(k),j(!1)}}catch{x(y)}finally{q(!1),g(!1)}},O=r=>{j(r!==c),x(r),p(r)},$=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=v?e.jsx(Y,{style:{flex:1},fullWidth:!0,value:c,onChange:r=>{O(r.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:o,onKeyDown:$,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:v?e.jsxs(e.Fragment,{children:[f?e.jsx(S,{"data-cy":"schema-form-item-confirm",onClick:F,disabled:a||h||!f,sx:{animation:M?`${fe} 0.5s linear`:"none"},style:{paddingRight:4},size:"large",children:h?e.jsx(Z,{size:24}):e.jsx(ae,{})}):null,e.jsx(S,{"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,4 +1,4 @@
|
|
|
1
|
-
import{j as e,a3 as t,a2 as P,aQ as W,E as d,aa as B}from"./vendor-mui-core-COxJgW9_.js";import{r as l}from"./vendor-react-D-afvo_7.js";import{j as v}from"./vendor-utils-CV7RLr7b.js";import{d as E}from"./Launch-
|
|
1
|
+
import{j as e,a3 as t,a2 as P,aQ as W,E as d,aa as B}from"./vendor-mui-core-COxJgW9_.js";import{r as l}from"./vendor-react-D-afvo_7.js";import{j as v}from"./vendor-utils-CV7RLr7b.js";import{d as E}from"./Launch-D9iyATKb.js";import{af as I,ab as L}from"./vendor-arcblock-Dn16DH88.js";import{W as $}from"./did-address-B-umhomj.js";import{P as D}from"./page-header-B3m4UCOV.js";import{o as T,u as z}from"./index-tDqjC_e2.js";import{S as A}from"./layout-PlCf3Rtw.js";import{S as F}from"./step-actions-FdD-71wr.js";import{S as m}from"./button-CPeDg26t.js";import"./vendor-hooks-DzETutIU.js";import"./content-layout-C8ThavEP.js";function u({onNext:n,onPrevious:f}){const{locale:x,t:s}=l.useContext(I),{blocklet:a,gas:c,tokenInfo:h,actions:j}=T(),{api:y}=z(),[g,o]=l.useState(!1),{need:p="",current:b="",owe:r=99999,deficiency:k,symbol:C="",endpoint:i}=c||{},{origin:S="/"}=i?new URL(i):{};l.useEffect(()=>{const N=setInterval(()=>{j.refreshFuel()},2e3);return()=>{clearInterval(N)}},[]);const w=()=>{o(!1)};return c?e.jsxs(R,{children:[e.jsx("div",{className:"header",children:e.jsx(D,{title:s("setup.fuel.title"),onClickBack:f})}),e.jsxs(t,{className:"qr-body",children:[e.jsxs(t,{mb:6,className:"tip",children:[s("setup.fuel.tipStart").replace("slot",""),e.jsx("span",{className:"amount",children:`${p} ${C}`}),s("setup.fuel.tipEnd")]}),e.jsx(t,{fontSize:16,fontWeight:"fontWeightBold",mb:.5,children:s("setup.fuel.addressTitle")}),e.jsxs(t,{display:"flex",alignItems:"center",children:[e.jsx($,{className:"address",did:a.appDid}),e.jsx(W,{style:{lineHeight:1},target:"_blank",href:v(S,"/explorer/accounts/",a.appDid),underline:"hover",children:e.jsx(E,{className:"icon-launch"})})]}),e.jsx(t,{my:2,children:e.jsx(m,{color:"primary",onClick:()=>o(!0),disabled:!r,children:s("setup.fuel.fuelApp")})}),e.jsx(L,{popup:!0,open:g,action:"fuel",checkFn:y.get,checkTimeout:10*60*1e3,onSuccess:w,onClose:()=>o(!1),locale:x,messages:{title:s("setup.connect.title"),scan:s("setup.connect.scan"),confirm:s("setup.connect.confirm"),success:s("setup.connect.success")},extraParams:{amount:k,...h,endpoint:i}}),e.jsxs(t,{display:"flex",color:"text.secondary",children:[e.jsxs(t,{display:"flex",children:[e.jsxs(t,{children:[s("setup.fuel.need"),":"]}),e.jsx(t,{ml:.5,color:"primary.main",fontWeight:"fontWeightBold",children:p})]}),e.jsxs(t,{display:"flex",ml:3,children:[e.jsxs(t,{children:[s("setup.fuel.current"),":"]}),e.jsx(t,{ml:.5,color:r>0?"error.main":"primary.main",fontWeight:"fontWeightBold",children:b})]})]})]}),e.jsx(F,{mt:8,children:e.jsx(m,{disabled:r>0,onClick:()=>n(),children:s("setup.next")})})]}):e.jsx(t,{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",children:e.jsx(P,{})})}u.propTypes={onNext:d.func,onPrevious:d.func};u.defaultProps={onNext:()=>{},onPrevious:()=>{}};const R=B(A)`
|
|
2
2
|
.qr-body {
|
|
3
3
|
width: 580px;
|
|
4
4
|
${n=>n.theme.breakpoints.down("md")} {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,T as x,aQ as h,a3 as o,E as r}from"./vendor-mui-core-COxJgW9_.js";import{
|
|
1
|
+
import{j as e,T as x,aQ as h,a3 as o,E as r}from"./vendor-mui-core-COxJgW9_.js";import{aT as j,Q as v,aH as a}from"./vendor-arcblock-Dn16DH88.js";function w({linkProps:t,...d}){return e.jsxs(x,{...d,children:["Powered by"," ",e.jsx(h,{href:"https://www.arcblock.io",target:"_blank",underline:"hover",...t,children:"ArcBlock"}),"'s"," ",e.jsx(h,{href:"https://www.blocklet.io",target:"_blank",underline:"hover",...t,children:"Blocklet Technology"}),", the decentralized web engine."]})}const y="/.well-known/service/static/assets/login-bg-Cbfh9Uc2.png";function k({did:t,children:d,title:l,description:c,logo:n,logoSize:g,appUrl:i}){var b,f,p,m;if(!t)return d;let s;try{s=j(t)}catch{console.warn("Invalid did:",t)}const u=(globalThis==null?void 0:globalThis.blocklet)||(globalThis==null?void 0:globalThis.env)||{};return l===void 0&&(l=u.appName),c===void 0&&(c=u.appDescription),n===void 0&&(n=((b=globalThis==null?void 0:globalThis.blocklet)==null?void 0:b.appLogoRect)||((f=globalThis==null?void 0:globalThis.blocklet)==null?void 0:f.appLogo)||""),typeof n=="string"&&(n?n=e.jsx(o,{sx:{height:g,maxHeight:g,maxWidth:"50%",objectFit:"contain"},component:"img",src:n,alt:`${l}'s logo`}):n=e.jsx(v,{size:g,did:t,src:n,variant:"rounded"})),typeof i=="string"&&(i=((p=globalThis==null?void 0:globalThis.blocklet)==null?void 0:p.appUrl)||"",!i&&(globalThis!=null&&globalThis.env)&&(i=(m=globalThis==null?void 0:globalThis.env)==null?void 0:m.baseUrl)),e.jsxs(o,{sx:{width:"100vw",height:"100vh",overflowX:"auto",display:"flex",backgroundColor:a.backgroundsBgSubtile},children:[e.jsxs(o,{sx:{position:"relative",fontSize:0,flex:30,display:{xs:"none",lg:"flex"},minWidth:"400px",backgroundColor:a.surfaceBgSubtitle},children:[e.jsx(o,{sx:{position:"absolute",top:0,bottom:0,left:0,right:0,background:s?`linear-gradient(0deg, ${s} 0%, ${s} 100%), url(${y}), lightgray 50% / cover no-repeat`:`url(${y}), lightgray 50% / cover no-repeat`,backgroundPosition:"center",backgroundSize:"cover",backgroundBlendMode:s?"soft-light, normal":"unset",mask:"linear-gradient(172deg, rgba(0, 0, 0, 0.0) 24.62%, rgba(0, 0, 0, 0.80) 44.47%, #000 100%)"}}),e.jsxs(o,{sx:{display:"flex",flexDirection:"column",position:"absolute",top:0,left:0,width:"100%",p:3},children:[i?e.jsx(o,{children:e.jsx(h,{href:i,underline:"none",color:"inherit",children:n})}):n,l&&e.jsx(x,{variant:"h5",sx:{mt:3,mb:1,p:0,mx:0,fontWeight:"bold"},children:i?e.jsx(h,{href:i,underline:"none",color:"inherit",children:l}):l}),c&&e.jsx(x,{variant:"body2",sx:{m:0,p:0,color:a.foregroundsFgSubtile,fontSize:"12px",lineHeight:"20px"},children:c})]}),e.jsx(w,{linkProps:{underline:"always",color:a.textSubtitle},sx:{zIndex:10,position:"absolute",bottom:40,left:20,right:20,textAlign:"center",fontSize:"12px",color:a.textSubtitle}})]}),e.jsx(o,{sx:{display:"flex",justifyContent:"center",alignItems:"center",flex:70,maxWidth:{xs:"100%",md:"90%"},margin:"auto",height:"auto"},children:d})]})}k.propTypes={did:r.string.isRequired,children:r.any.isRequired,title:r.any,description:r.any,logo:r.any,logoSize:r.number,appUrl:r.string};k.defaultProps={title:void 0,description:void 0,logo:void 0,logoSize:40,appUrl:""};export{k as F};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aR as t,z as o}from"./vendor-arcblock-Dn16DH88.js";function i(...e){try{return t(...e)}catch(r){throw o.error("Invalid redirect url"),console.error("Invalid redirect url",r),r}}export{i as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aR as t,z as o}from"./vendor-arcblock-Dn16DH88.js";function i(...e){try{return t(...e)}catch(r){throw o.error("Invalid redirect url"),console.error("Invalid redirect url",r),r}}export{i as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as o,ac as n}from"./vendor-mui-core-COxJgW9_.js";import{L as r}from"./vendor-react-D-afvo_7.js";import{
|
|
1
|
+
import{j as o,ac as n}from"./vendor-mui-core-COxJgW9_.js";import{L as r}from"./vendor-react-D-afvo_7.js";import{ag as i,d as t}from"./vendor-arcblock-Dn16DH88.js";import{S as e}from"./studio-g2uaz9WG.js";import"./vendor-utils-CV7RLr7b.js";import"./vendor-hooks-DzETutIU.js";function p(){return o.jsx(e,{children:o.jsxs(n,{direction:"row",m:4,spacing:2,children:[o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/preferences`,size:"large",color:"primary",variant:"outlined",children:"Preference Builder"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/branding`,size:"large",color:"primary",variant:"outlined",children:"Branding Images"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/localization`,size:"large",color:"primary",variant:"outlined",children:"Localization"})]})})}export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as x}from"./vendor-react-D-afvo_7.js";import{
|
|
1
|
+
import{b as x}from"./vendor-react-D-afvo_7.js";import{aX as E}from"./vendor-arcblock-Dn16DH88.js";const L=({url:r,allowFullScreen:o,position:a,display:i,height:u,width:c,overflow:f,styles:y,onLoad:p,onMouseOver:m,onMouseOut:b,scrolling:w,id:d,frameBorder:n,ariaHidden:O,sandbox:s,allow:j,className:g,title:h,ariaLabel:k,ariaLabelledby:I,name:P,target:v,loading:A,importance:F,referrerpolicy:M,allowpaymentrequest:S,src:$,key:q})=>{const t=E({src:$||r,target:v||null,style:{position:a||null,display:i||"initial",overflow:f||null},scrolling:w||null,allowpaymentrequest:S||null,importance:F||null,sandbox:s&&[...s].join(" ")||null,loading:A||null,styles:y||null,name:P||null,className:g||null,allowFullScreen:"allowFullScreen",referrerpolicy:M||null,title:h||null,allow:j||null,id:d||null,"aria-labelledby":I||null,"aria-hidden":O||null,"aria-label":k||null,width:c||null,height:u||null,onLoad:p||null,onMouseOver:m||null,onMouseOut:b||null,key:q||"iframe"});let l=Object.create(null);for(let e of Object.keys(t))t[e]!=null&&(l[e]=t[e]);for(let e of Object.keys(l.style))l.style[e]==null&&delete l.style[e];if(l.styles)for(let e of Object.keys(l.styles))l.styles.hasOwnProperty(e)&&(l.style[e]=l.styles[e]),Object.keys(l.styles).pop()==e&&delete l.styles;if(o)if("allow"in l){const e=l.allow.replace("fullscreen","");l.allow=`fullscreen ${e.trim()}`.trim()}else l.allow="fullscreen";return n>=0&&(l.style.hasOwnProperty("border")||(l.style.border=n)),x.createElement("iframe",Object.assign({},l))},X=L;export{X as I};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as M,g as nr,a as pe,u as To}from"./vendor-react-D-afvo_7.js";import{a1 as U,j as e,E as D,aa as mt,P as Oo,bZ as tn,bL as So,M as K,a3 as P,A as ca,I as ue,a2 as Ke,bM as ua,T as pt,aN as J,bJ as dt,aS as wo,ad as Io,ah as Kt,bN as Ve,aO as Pe,bE as Z,x as de,ac as Le,b_ as ko,e as ht,Z as da,a4 as se,K as qo,b$ as Lo,c0 as Do,c1 as Ao,c2 as me,bS as Re,c3 as fa,c4 as kr,c5 as qr,c6 as Mo,c7 as pa,c8 as Eo,c9 as Bo,aw as qe,ca as $o,cb as Wo,cc as No,cd as Ho,ce as Fo,cf as zo,cg as Uo,ch as Vo,ci as Ko,cj as Go,ck as Yo,cl as tr,am as Zo,C as Jo,ao as Xo,bx as ma,by as ha}from"./vendor-mui-core-COxJgW9_.js";import{I as Qo}from"./iframe-
|
|
1
|
+
import{r as M,g as nr,a as pe,u as To}from"./vendor-react-D-afvo_7.js";import{a1 as U,j as e,E as D,aa as mt,P as Oo,bZ as tn,bL as So,M as K,a3 as P,A as ca,I as ue,a2 as Ke,bM as ua,T as pt,aN as J,bJ as dt,aS as wo,ad as Io,ah as Kt,bN as Ve,aO as Pe,bE as Z,x as de,ac as Le,b_ as ko,e as ht,Z as da,a4 as se,K as qo,b$ as Lo,c0 as Do,c1 as Ao,c2 as me,bS as Re,c3 as fa,c4 as kr,c5 as qr,c6 as Mo,c7 as pa,c8 as Eo,c9 as Bo,aw as qe,ca as $o,cb as Wo,cc as No,cd as Ho,ce as Fo,cf as zo,cg as Uo,ch as Vo,ci as Ko,cj as Go,ck as Yo,cl as tr,am as Zo,C as Jo,ao as Xo,bx as ma,by as ha}from"./vendor-mui-core-COxJgW9_.js";import{I as Qo}from"./iframe-BB-pL0gd.js";import{w as ei,j as Gt,x as ti}from"./vendor-utils-CV7RLr7b.js";import{ad as gt,bc as rn,g as ie,ag as re,z as F,d as ee,ab as ga,aU as ri,al as Ge,af as Te,c0 as vt,bA as Ee,aM as va,aG as Lr,c6 as ni,c7 as ai,aH as Xt,b2 as ne,c8 as oi,c9 as ii,ca as si,cb as li,cc as ci,$ as nn,y as ft,ao as an,bE as ui,as as di,at as fi,cd as pi,ce as mi,ay as hi,bl as fe,cf as Rr,v as gi,cg as vi,ch as xi,bz as ar,aa as yi,w as rr,ci as on,c3 as xa,Y as Me,bd as ya,cj as Tr,bB as sn}from"./vendor-arcblock-Dn16DH88.js";import{k as je,u as k,o as Be,m as bi,B as Yt,y as ba}from"./vendor-hooks-DzETutIU.js";import{A as ja,d as ln}from"./config-Bh1NLHps.js";import{F as _a,d as ji}from"./form-text-input-E0Z0s35O.js";import{d as cn}from"./ChevronRight-UF0hSKpL.js";import{y as oe,B as ce,au as _i,f as Ca,av as Ci,m as Pi,h as ae,al as Ri,L as Ti,U as Oi}from"./index-tDqjC_e2.js";import{B as Si}from"./bundle-avatar-CtN88KlG.js";import{u as wi,B as Ii}from"./index-CYh2QqLk.js";import{d as ki}from"./Loop-Clmz6DRv.js";import{d as qi}from"./Done-BbnQSLvu.js";import{F as Li,R as Di,L as _t}from"./logo-uploader-CNnYMPxh.js";import{w as Pa,P as Ai}from"./permission-C7OYX2OJ.js";import{C as Dr}from"./confirm-DhCXP8vW.js";import{f as Ar}from"./format-error-C0Ke3VXF.js";import{_ as Mi}from"./useSetState-Crt4S51m.js";import{u as Ei}from"./session-UImnJahL.js";import{C as Bi}from"./click-to-copy-D-rDpTU1.js";import{u as Mr,a as $i}from"./dashboard-B3UhGh-u.js";import{u as Ie,C as H,a as un,S as ur}from"./simple-select-BMYrmYam.js";import{a as Ra,b as Wi,c as Ni,m as Hi,i as dn}from"./isEmail-BWNRBSAy.js";import{S as or}from"./switch-control-BMO1MVhi.js";import{K as Fi}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{d as fn}from"./Add-WwBlcqNF.js";import{I as zi}from"./index-Dk8-Ibsd.js";import{b as Ui}from"./base32-DZ5GWnEl.js";import"./EditIcon-DDucSncy.js";import"./ArrowDropDown-B6VSNrNX.js";import"./index-DoZ2YM4T.js";import"./useLocalStorage-ganqTrK6.js";import"./PlayArrow-IJdeSlbo.js";import"./get-safe-url-ByH0hntp.js";import"./useAsyncRetry-m5oMMmVh.js";import"./useAsync-BfmmMB4I.js";var Er={},Vi=U;Object.defineProperty(Er,"__esModule",{value:!0});var Ta=Er.default=void 0,Ki=Vi(gt()),Gi=e;Ta=Er.default=(0,Ki.default)((0,Gi.jsx)("path",{d:"M3 18c0 .55.45 1 1 1h5v-2H4c-.55 0-1 .45-1 1M3 6c0 .55.45 1 1 1h9V5H4c-.55 0-1 .45-1 1m10 14v-1h7c.55 0 1-.45 1-1s-.45-1-1-1h-7v-1c0-.55-.45-1-1-1s-1 .45-1 1v4c0 .55.45 1 1 1s1-.45 1-1M7 10v1H4c-.55 0-1 .45-1 1s.45 1 1 1h3v1c0 .55.45 1 1 1s1-.45 1-1v-4c0-.55-.45-1-1-1s-1 .45-1 1m14 2c0-.55-.45-1-1-1h-9v2h9c.55 0 1-.45 1-1m-5-3c.55 0 1-.45 1-1V7h3c.55 0 1-.45 1-1s-.45-1-1-1h-3V4c0-.55-.45-1-1-1s-1 .45-1 1v4c0 .55.45 1 1 1"}),"TuneRounded");var Br={},Yi=U;Object.defineProperty(Br,"__esModule",{value:!0});var Oa=Br.default=void 0,Zi=Yi(gt()),Ji=e;Oa=Br.default=(0,Zi.default)((0,Ji.jsx)("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3"}),"Key");var $r={},Xi=U;Object.defineProperty($r,"__esModule",{value:!0});var Sa=$r.default=void 0,Qi=Xi(gt()),es=e;Sa=$r.default=(0,Qi.default)((0,es.jsx)("path",{d:"M11 7 9.6 8.4l2.6 2.6H2v2h10.2l-2.6 2.6L11 17l5-5zm9 12h-8v2h8c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-8v2h8z"}),"Login");var Wr={},ts=U;Object.defineProperty(Wr,"__esModule",{value:!0});var wa=Wr.default=void 0,rs=ts(gt()),ns=e;wa=Wr.default=(0,rs.default)((0,ns.jsx)("path",{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2m6-6v-5c0-3.07-1.63-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.64 5.36 6 7.92 6 11v5l-2 2v1h16v-1zm-2 1H8v-6c0-2.48 1.51-4.5 4-4.5s4 2.02 4 4.5z"}),"NotificationsNone");const as={width:24,height:24,body:'<path fill="currentColor" d="M4.975 15q-.425 0-.7-.288T4 14q0-.425.288-.713T5 13h14.025q.425 0 .7.288T20 14q0 .425-.288.713T19 15H4.975Zm0 4q-.425 0-.7-.288T4 18q0-.425.288-.713T5 17h14.025q.425 0 .7.288T20 18q0 .425-.288.713T19 19H4.975Zm0-8q-.425 0-.7-.288T4 10q0-.425.288-.713T5 9h14.025q.425 0 .7.288T20 10q0 .425-.288.713T19 11H4.975Zm0-4q-.425 0-.7-.288T4 6q0-.425.288-.713T5 5h14.025q.425 0 .7.288T20 6q0 .425-.288.713T19 7H4.975Z"/>'},os=as;function Nr({label:t,disabled:l,required:r,initialValue:o,onChange:c,style:i,onSubmit:m,triggers:n,options:a,formatterBeforeSubmit:s,helperText:d,placeholder:C,renderImage:y,renderLabel:j,filterKeys:O,noEmpty:S,...I}){const[T,u]=M.useState(!1),[p,v]=M.useState(!1),[f,b]=M.useState(""),_=M.useRef(null),[x,g]=M.useState(o),[h,R]=M.useState(x),q=M.useMemo(()=>{if(!a)return{};const L={};return a.forEach(W=>{L[W.code]=W}),L},[a]),E=()=>{if(!a)return[];if(!f)return a.map(W=>W.code);const L=new RegExp(f.toLowerCase());return a.filter(W=>{var z;for(let G=0;G<O.length;G++){const $=O[G];if(L.test((z=W[$])==null?void 0:z.toLowerCase()))return!0}return!1}).map(W=>W.code)},N=async()=>{v(!0);try{await m(typeof s=="function"?s(h):h)===!1?R(x):S&&!h.length?(R(o),g(o)):(R(h),g(h))}catch{R(x)}finally{v(!1),u(!1)}},A=(L,W)=>{if(!Array.isArray(W)){R([]),c([]);return}const z=W.filter(G=>q[G]);if(!z.length){R([]),c([]);return}R(z),c(z)},w=L=>{L.stopPropagation(),u(!0),setTimeout(()=>{if(_.current){const W=_.current.querySelector("input");W&&W.focus()}},500)},B=T?e.jsx(So,{ref:_,options:a,value:h,onChange:A,inputValue:f,onInputChange:(L,W)=>{b(W)},PopperComponent:ss,fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",filterOptions:E,getOptionLabel:L=>{var W;return(W=q[L])==null?void 0:W.name},renderInput:L=>e.jsx(K,{...L,label:"",placeholder:C}),renderOption:(L,W)=>{var G;const z=h.indexOf(W)!==-1;return M.createElement(is,{component:"li",...L,key:W},y(q[W]||{}),e.jsx(P,{sx:{"& > img":{mr:2,flexShrink:0}},style:{flex:1,fontWeight:z?"700":"normal"},children:j(W,q[W])||((G=q[W])==null?void 0:G.name)}),e.jsx(P,{component:rn,sx:{opacity:.5,width:18,height:18},style:{visibility:z?"visible":"hidden"}}))},...I}):e.jsx(P,{px:1,className:"form-item-input slot",onClick:w,style:{whiteSpace:"pre-wrap",cursor:"text"},children:h.filter(L=>a.some(W=>W.code===L)).map(L=>e.jsx(ca,{label:a.find(W=>W.code===L).name,style:{marginRight:8},size:"small"},L))});return e.jsx(Li,{className:"form",style:i,children:e.jsxs(P,{className:"form-item",children:[e.jsxs(P,{className:"form-item-label",children:[t,r&&e.jsx(Di,{})]}),e.jsxs(P,{className:"form-item-body",children:[e.jsx(P,{className:"form-item-input",children:B}),e.jsx(P,{className:"form-item-action",children:T?e.jsxs(e.Fragment,{children:[e.jsx(ue,{"data-cy":"schema-form-item-confirm",onClick:N,disabled:l||p,size:"large",children:p?e.jsx(Ke,{size:24}):e.jsx(qi,{})}),e.jsx(ue,{"data-cy":"schema-form-item-cancel",onClick:()=>{R(x),u(!1)},disabled:l||p,size:"large",children:e.jsx(rn,{})})]}):null})]}),T&&d&&e.jsx(ua,{children:d})]})})}Nr.propTypes={style:D.object,onSubmit:D.func,onChange:D.func,label:D.string,initialValue:D.string,required:D.bool,disabled:D.bool,triggers:D.array,options:D.array,helperText:D.string,formatterBeforeSubmit:D.func,placeholder:D.string,renderImage:D.func,filterKeys:D.arrayOf(D.string),noEmpty:D.bool,renderLabel:D.func};Nr.defaultProps={style:{},onSubmit:()=>{},onChange:()=>{},label:"",initialValue:"",required:!1,disabled:!1,triggers:[],options:[],helperText:"",formatterBeforeSubmit:t=>t.join(","),placeholder:"",filterKeys:["name"],renderImage:()=>null,renderLabel:(t,l)=>"",noEmpty:!1};const is=mt.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
justify-content: space-between;
|
|
4
4
|
align-items: center;
|