@abtnode/blocklet-services 1.16.53-beta-20251011-095147-8bd212c5 → 1.16.53-beta-20251013-075536-64fcb94b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/index.js +8 -17
- package/api/util/federated.js +10 -5
- package/dist/assets/{access-control-C2aF8l7f.js → access-control-CUUGBegg.js} +1 -1
- package/dist/assets/{add-component-core-DaSlPT-f.js → add-component-core-D8CsaWtE.js} +1 -1
- package/dist/assets/{add-resource-BbsAiWlt.js → add-resource-DRYWyzFg.js} +1 -1
- package/dist/assets/{addon-FUH-lSq2.js → addon-DhicELT4.js} +1 -1
- package/dist/assets/{advanced-C5U4taie.js → advanced-D4kyySFu.js} +1 -1
- package/dist/assets/{aigne-eGqt4yLH.js → aigne--ydEFgxM.js} +1 -1
- package/dist/assets/{appearance-COFOsk8H.js → appearance-DiUMtWiZ.js} +1 -1
- package/dist/assets/{arrow-down.svg-BIpNdtOh.js → arrow-down.svg-DgXRF8DP.js} +1 -1
- package/dist/assets/{audit-logs-mrNr9NEV.js → audit-logs-zMqI7X3o.js} +1 -1
- package/dist/assets/{authorize-DNMdsHLY.js → authorize-Dr-5dOao.js} +1 -1
- package/dist/assets/{bind-account-DHM0aKm4.js → bind-account-DA7_VhlG.js} +1 -1
- package/dist/assets/{branding-DCFBnIuE.js → branding-BqZaDEQy.js} +1 -1
- package/dist/assets/{branding-C8c4AQBL.js → branding-Bwa2_l30.js} +1 -1
- package/dist/assets/{branding-Ds21HJPv.js → branding-CDF8I7CS.js} +1 -1
- package/dist/assets/{bundle-avatar-YluGbYkj.js → bundle-avatar-D5n6XSFF.js} +1 -1
- package/dist/assets/{complete-ci8dXkdd.js → complete-CJN6MZr9.js} +1 -1
- package/dist/assets/{component-CktAV437.js → component-BkgYdhLW.js} +2 -2
- package/dist/assets/{config-hlI_P1F8.js → config-BKWRBZkN.js} +1 -1
- package/dist/assets/config-C6P5yz_l.js +53 -0
- package/dist/assets/{config-BDvrfPci.js → config-NzhCDrRK.js} +1 -1
- package/dist/assets/{config-navigation-D8-g7qAt.js → config-navigation-CpkTSVgC.js} +2 -2
- package/dist/assets/{config-space-BLuDOEKJ.js → config-space-D742OP6B.js} +1 -1
- package/dist/assets/{confirm-Cs-v9Ueu.js → confirm-D1n-RK65.js} +1 -1
- package/dist/assets/{connect-Do64lcqi.js → connect-Cp5779ib.js} +1 -1
- package/dist/assets/{connect-DZzHQL_N.js → connect-DCldlgle.js} +1 -1
- package/dist/assets/{connect-to-D-Tb_fXt.js → connect-to-CzzpDiUC.js} +1 -1
- package/dist/assets/{dashboard-DcdBCHRL.js → dashboard-COW8XxoK.js} +2 -2
- package/dist/assets/{delete-confirm-D-H3beUW.js → delete-confirm-DDcjKsY2.js} +1 -1
- package/dist/assets/{domain-D1iCGb9_.js → domain-DR_J7IrS.js} +1 -1
- package/dist/assets/{domain-action-card-dl9BP1dq.js → domain-action-card-CuN-BTun.js} +1 -1
- package/dist/assets/{domains-VJkxJvLu.js → domains-BwpVswVc.js} +1 -1
- package/dist/assets/{email-CXQwvoco.js → email-Da8K28dJ.js} +1 -1
- package/dist/assets/engine-CynZsYEr.js +1 -0
- package/dist/assets/{exchange-passport-By4W6XDH.js → exchange-passport-Bic3wuCk.js} +1 -1
- package/dist/assets/{form-B_F_xaXO.js → form-BO9zQEEu.js} +1 -1
- package/dist/assets/{fuel-CW2Evrsd.js → fuel-QHX754Te.js} +1 -1
- package/dist/assets/{gen-access-key-DlPCMbg5.js → gen-access-key-1fCgd-vd.js} +1 -1
- package/dist/assets/{gen-simple-access-key-DGvoYxjH.js → gen-simple-access-key-DrYDMNDo.js} +1 -1
- package/dist/assets/{get-safe-url-rD2TSrmk.js → get-safe-url-BrBIp6RF.js} +1 -1
- package/dist/assets/{home-B4ti5g0W.js → home-CR7v9FTO.js} +1 -1
- package/dist/assets/{iframe-BI7fZAER.js → iframe-CKOcsJB-.js} +1 -1
- package/dist/assets/{index-DbJX8mTu.js → index--2eh3YdI.js} +1 -1
- package/dist/assets/{index-D-SgeZ2f.js → index-6KFpxb0K.js} +1 -1
- package/dist/assets/{index-Bxd2Cj9Z.js → index-9WUHnAoz.js} +1 -1
- package/dist/assets/{index-CwiCg7Wy.js → index-BAigP45p.js} +1 -1
- package/dist/assets/{index-B3Wj0Nic.js → index-BAm_yZT8.js} +1 -1
- package/dist/assets/{index-DeRDwip-.js → index-BFBoLr1Z.js} +1 -1
- package/dist/assets/{index-DHsKHttK.js → index-BH9BMLP2.js} +1 -1
- package/dist/assets/{index-Ha4kS6kt.js → index-BOst2c_c.js} +1 -1
- package/dist/assets/{index-OE1287Me.js → index-BSTi6sO4.js} +1 -1
- package/dist/assets/{index-4foCOGch.js → index-BZUEA_VO.js} +1 -1
- package/dist/assets/{index-B5MKa5ov.js → index-C5sng-9P.js} +2 -2
- package/dist/assets/{index-D46_FTfy.js → index-CGC3omja.js} +1 -1
- package/dist/assets/{index-Bdipd-mG.js → index-ChdZfn2Z.js} +1 -1
- package/dist/assets/{index-DgBkBy0d.js → index-DYxM5dQ0.js} +1 -1
- package/dist/assets/{index-B8GEVW-7.js → index-De6RU5uv.js} +1 -1
- package/dist/assets/{index-kK-2wGsh.js → index-Difo-vx2.js} +1 -1
- package/dist/assets/{index-kYJKn2jR.js → index-Dt8akALo.js} +3 -3
- package/dist/assets/{index-CM-I96vs.js → index-DuO31sai.js} +1 -1
- package/dist/assets/{index-Ffd9R2jw.js → index-DyNpNTLA.js} +1 -1
- package/dist/assets/{index-CWPu1V9G.js → index-F6BB6AaL.js} +1 -1
- package/dist/assets/{index-8x51s8zo.js → index-Oj4fYD5K.js} +3 -3
- package/dist/assets/{index-CE80LF06.js → index-OuTt2geA.js} +1 -1
- package/dist/assets/{index-DeRE90O3.js → index-Y3X8f7Z4.js} +1 -1
- package/dist/assets/{index-Dy82BFhx.js → index-dAVnNC1I.js} +1 -1
- package/dist/assets/{index-Bm6372dL.js → index-pDY1qDDT.js} +1 -1
- package/dist/assets/{index-BmZkZYAT.js → index-rX_gKff6.js} +1 -1
- package/dist/assets/{invitation-uW2SRspc.js → invitation-BKbYsXkF.js} +1 -1
- package/dist/assets/{invitations-BKP1NV2c.js → invitations-B-nYRbwb.js} +1 -1
- package/dist/assets/{invite-Cyj0TX33.js → invite-wTyupZG1.js} +1 -1
- package/dist/assets/{isURL-DOKl6zP6.js → isURL-B2kErAOg.js} +1 -1
- package/dist/assets/{issue-passport-jS72R6Y9.js → issue-passport-BrDZjXex.js} +1 -1
- package/dist/assets/{item-6E9xBb8C.js → item-BFG9doj4.js} +1 -1
- package/dist/assets/{landing-page-CfBuAqix.js → landing-page-CQU5LiHu.js} +1 -1
- package/dist/assets/{layout-Yt1Ps3ty.js → layout-BByAfem8.js} +1 -1
- package/dist/assets/{list-CbJU6aON.js → list-4bMHptVO.js} +1 -1
- package/dist/assets/{list-CWTC1dNA.js → list-aRu0R0L1.js} +1 -1
- package/dist/assets/{localization-BWvCdRh6.js → localization-J2gA-h7I.js} +1 -1
- package/dist/assets/{log-D8J_RKs2.js → log-BgOBDKaO.js} +1 -1
- package/dist/assets/{login-DqfZ0aMJ.js → login-DFrvIKm0.js} +1 -1
- package/dist/assets/{login-oauth-callback-BHyWL0cZ.js → login-oauth-callback-D81WLOfu.js} +1 -1
- package/dist/assets/{logo-uploader-CN181syA.js → logo-uploader-BSLuQUWG.js} +1 -1
- package/dist/assets/{lost-passport-BQSFuIDg.js → lost-passport-CN1lCjAR.js} +1 -1
- package/dist/assets/{open-window-CVPA9xdu.js → open-window-DFdTfBab.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-gqfc7YHA.js → over-due-invoice-payment-BHBjNHAK.js} +1 -1
- package/dist/assets/{overview-BfjhNxe0.js → overview-BNptGAD0.js} +1 -1
- package/dist/assets/{passport-C9JudxNO.js → passport-Di66zEMV.js} +1 -1
- package/dist/assets/{passport-item-VF3cWzrN.js → passport-item-cu1WVC_B.js} +1 -1
- package/dist/assets/{permission-B4abezk1.js → permission-ya4qYiIS.js} +1 -1
- package/dist/assets/{preferences-C_XdWNfF.js → preferences-BPkyQMDe.js} +1 -1
- package/dist/assets/{profile-embed-QqF7FA6v.js → profile-embed-DEkmxYPv.js} +1 -1
- package/dist/assets/{publish-resource-H7eMW32y.js → publish-resource-q3_KT0uW.js} +1 -1
- package/dist/assets/{runtime-8vm1QUk_.js → runtime-zSSdjk9Q.js} +1 -1
- package/dist/assets/sdk-DlI_Utmi.js +1 -0
- package/dist/assets/{security-Dw-d-MTv.js → security-BlvbBEUe.js} +1 -1
- package/dist/assets/{session-C838MSz1.js → session-Y3RU3I2O.js} +1 -1
- package/dist/assets/{setup-DegA44sL.js → setup-BZH_pYLe.js} +1 -1
- package/dist/assets/{spaces-M_qE7wW_.js → spaces-BwBxBfty.js} +1 -1
- package/dist/assets/{start-BVg7NHO7.js → start-DZ1T1oW8.js} +1 -1
- package/dist/assets/{starting-progress-Bc97wy6x.js → starting-progress-HuVVYFsR.js} +1 -1
- package/dist/assets/{status-QhfaNvgn.js → status-BR0A9vPy.js} +1 -1
- package/dist/assets/{step-actions-DTwta5X_.js → step-actions-D4zI4sWZ.js} +1 -1
- package/dist/assets/{studio-BKBKyaGG.js → studio-UxYOr-dB.js} +1 -1
- package/dist/assets/{team-BxHvUIQ6.js → team-s6q3vfNx.js} +1 -1
- package/dist/assets/{traffic-bm4qFOVU.js → traffic-CwvEJLQW.js} +1 -1
- package/dist/assets/{transfer-BrMoTS5Z.js → transfer-DBlISG7m.js} +1 -1
- package/dist/assets/{unsubscribe-B27dQ-V0.js → unsubscribe-BW7dIXXb.js} +1 -1
- package/dist/assets/{use-app-logo-ezyDWOV9.js → use-app-logo-BjReZUm7.js} +1 -1
- package/dist/assets/{user-center-uDx2x7Sm.js → user-center-D18_bCCh.js} +2 -2
- package/dist/assets/{user-follower-CxhX_9BD.js → user-follower-McTCB9YD.js} +1 -1
- package/dist/assets/{user-sessions-B3zzrErP.js → user-sessions-DYtBKHTy.js} +1 -1
- package/dist/assets/{util-B8m2D-S9.js → util-DDkRAi85.js} +1 -1
- package/dist/assets/{util-k7U_iSB6.js → util-V3sRgqXp.js} +1 -1
- package/dist/assets/{wait-connect-DhEi-ni_.js → wait-connect-C4xkzmAl.js} +1 -1
- package/dist/assets/{wizard-obzJ3sCB.js → wizard-5C6_E9yj.js} +1 -1
- package/dist/assets/{wizard-components-BZT4jikM.js → wizard-components-Cu-kCEHh.js} +1 -1
- package/dist/assets/{wrap-locale-CaI-lUtp.js → wrap-locale-DcfUdcYR.js} +1 -1
- package/dist/assets/{zh-dnVpNwG1.js → zh-Ckmy3lEn.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +23 -23
- package/dist/assets/config-BE0FYeHo.js +0 -53
- package/dist/assets/engine-OnFdHI4e.js +0 -1
- package/dist/assets/sdk-DRBI7AWf.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{T as M,H as q,P as N,q as Y,k as ve,j as Ce,a0 as Se}from"./vendor-ux-B9VfuZTg.js";import{o as Te,k as le,t as Ie}from"./vendor-hooks-BlA8TRnZ.js";import{r as E,a as ae}from"./vendor-react-Dvs43sk9.js";import{j as e,Y as Re,bC as We,$ as ze,ak as p,z as se,T as C,a6 as F,aX as te,R as De,Q as H,b6 as ne,am as $,bf as _,a5 as J,V as G,S as Z,b4 as Oe,U as L,I as B,ci as Pe,bh as $e,a7 as Ae,F as qe,W as t,b1 as R,a3 as ce,c2 as ee,cj as Le,aO as Me,aP as Be,ck as Fe,cl as He,cm as Ne,s as oe,aU as Ue,aj as _e,J as Ke,cn as Ve,aZ as Ye,cc as Je,bb as Qe,cb as Xe}from"./vendor-mui-core-DRxbhqaK.js";import{B as de,o as pe,l as ue}from"./index-DeRDwip-.js";import{X as K,c as xe,_ as Ge,a9 as Ze,b5 as Q}from"./index-kYJKn2jR.js";import{u as V}from"./team-BxHvUIQ6.js";import{u as et}from"./use-mobile-BQQpAf3i.js";import{u as tt,C as X}from"./index.esm-JPZAjt0x.js";import{C as he,a as me,J as ot}from"./vendor-utils-CUDP56Ff.js";import{C as st}from"./confirm-Cs-v9Ueu.js";import{A as nt}from"./actions-B4VXcSRp.js";import{T as ie}from"./table-tips-rCE1XKlc.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DeeG8u0h.js";import"./session-C838MSz1.js";import"./isURL-DOKl6zP6.js";import"./use-app-logo-ezyDWOV9.js";import"./index-DBs9Ljax.js";const it=i=>{const[u,c]=E.useState(null),[f,r]=E.useState(!0),[w,x]=E.useState(null),j=window.blocklet?.appUrl,l=E.useMemo(()=>{const g={};return u&&(u.sources.forEach(y=>{g[y.did]={source:y,events:[],count:0}}),u.events.forEach(y=>{g[y.source]&&(g[y.source].events.push(y),g[y.source].count+=1)})),g},[u]),b=async()=>{try{if(r(!0),!j)return;const y=await(await fetch(he(j,xe.WELLKNOWN_SERVICE_PATH_PREFIX,"/openevent.json"))).json();c(y),x(null)}catch(g){x(g instanceof Error?g:new Error(String(g)))}finally{r(!1)}};return E.useEffect(()=>{b()},[j]),{openEvent:u,setOpenEvent:c,eventsBySource:l,loading:f,error:w,loadData:b}};function ge({eventsBySource:i,selectedEvents:u,setSelectedEvents:c,error:f=null}){const{t:r}=M(),[w,x]=E.useState({}),j=E.useMemo(()=>{const n={};return Object.entries(i).forEach(([a,{events:m}])=>{const v=m.filter(S=>u[`${S.type}-${S.source}`]).length;n[a]=v}),n},[i,u]),l=E.useMemo(()=>Object.values(j).reduce((n,a)=>n+a,0),[j]),b=E.useMemo(()=>Object.values(i).reduce((n,{events:a})=>n+a.length,0),[i]),g=(n,a)=>{a.stopPropagation(),x({...w,[n]:!w[n]})},y=n=>{const a=`${n.type}-${n.source}`;c(m=>({...m,[a]:!m[a]}))},z=(n,a)=>{const m={};n.forEach(v=>{const S=`${v.type}-${v.source}`;m[S]=!a}),c(v=>({...v,...m}))},T=n=>{const a={};Object.values(i).forEach(({events:m})=>{m.forEach(v=>{const S=`${v.type}-${v.source}`;a[S]=n.target.checked})}),c(a)};return e.jsxs(p,{sx:{width:"100%"},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ne,{control:e.jsx(J,{onChange:T,checked:l>0&&l===b}),label:e.jsxs(p,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[r("webhookEndpoint.selectAllEvents"),e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:e.jsx($,{title:r("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(_,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),l>0&&e.jsx(C,{variant:"body2",color:"primary",sx:{ml:"auto"},children:r("webhookEndpoint.selectedEventsCount",{count:l})})]}),e.jsx(p,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(G,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(i).map(([n,{source:a,events:m,count:v}],S)=>{const D=j[n]>0,I=j[n]===m.length&&m.length>0,O=w[n];return e.jsxs(ae.Fragment,{children:[e.jsx(Z,{sx:{borderBottom:({palette:o})=>S<Object.keys(i).length-1?`1px solid ${o.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(p,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:o=>{o.target.closest(".MuiFormControlLabel-root")||g(n,o)},children:[e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:m.length>0&&e.jsx(ne,{control:e.jsx(J,{checked:I,indeterminate:D&&!I,onChange:o=>{o.stopPropagation(),z(m,I)}}),label:e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[a.logo&&e.jsx(Oe,{src:a.logo,sx:{width:24,height:24}}),e.jsx(p,{children:a.title||n}),D&&e.jsx(L,{label:r("webhookEndpoint.selectedCount",{count:j[n]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:o=>`${o.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(p,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(C,{variant:"body2",sx:{color:"text.secondary",mr:1},children:r("webhookEndpoint.eventsCount",{count:v})}),m.length>0&&e.jsx(B,{size:"small",edge:"end",children:O?e.jsx(Pe,{}):e.jsx($e,{})})]})]})}),m.length>0&&e.jsx(Ae,{in:O,timeout:"auto",unmountOnExit:!0,children:e.jsx(G,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:m.map(o=>{const d=`${o.type}-${o.source}`,s=!!u[d];return e.jsx(Z,{dense:!0,sx:{py:.75},onClick:()=>y(o),children:e.jsxs(p,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(J,{checked:s,sx:{mr:1}}),e.jsxs(p,{children:[e.jsx(C,{variant:"body1",sx:{cursor:"pointer",color:"text.primary"},children:o.type}),e.jsx(C,{variant:"caption",sx:{color:"text.secondary",display:"block",cursor:"pointer"},children:o.description})]})]})},d)})})})]},n)})})}),f&&e.jsx(qe,{error:!0,sx:{mt:1},children:f})]})}ge.propTypes={eventsBySource:t.objectOf(t.shape({source:t.shape({did:t.string.isRequired,title:t.string,description:t.string,version:t.string,logo:t.string}).isRequired,events:t.arrayOf(t.shape({type:t.string.isRequired,description:t.string.isRequired,source:t.string.isRequired})).isRequired,count:t.number.isRequired})).isRequired,selectedEvents:t.objectOf(t.bool).isRequired,setSelectedEvents:t.func.isRequired,error:t.string};function be({id:i=null,url:u="",description:c="",enabledEvents:f=[],onSubmit:r,onClose:w=()=>{}}){const{t:x}=M(),[j,l]=E.useState({}),{teamDid:b}=V(),{api:g}=K(),{loading:y,error:z,eventsBySource:T}=it(),{control:n,handleSubmit:a,formState:{errors:m},reset:v,setValue:S,trigger:D}=tt({defaultValues:{url:"",description:""}});E.useEffect(()=>{const o=Object.values(j).some(d=>d);S("selectedEvents",o?"valid":""),D("selectedEvents")},[j,S,D]);const I=()=>{l({}),v(),w()},O=async o=>{const d=Object.keys(j).filter(h=>j[h]),s={url:o.url,description:o.description,enabledEvents:d.map(h=>{const[k,W]=h.split("-");return!k||!W?null:{type:k,source:W}}).filter(Boolean)};try{if(i){const h=await g.updateWebhookEndpoint({input:{teamDid:b,id:i,data:s}});q.success(`${x("webhookEndpoint.updateWebhook")} ${x("webhookEndpoint.success")}`),r(h)}else{const h=await g.createWebhookEndpoint({input:{teamDid:b,input:s}});q.success(`${x("webhookEndpoint.createWebhook")} ${x("webhookEndpoint.success")}`),r(h)}}catch(h){q.error(h?.message)}I()};return E.useEffect(()=>{v({url:u,description:c}),l(f.reduce((o,d)=>(o[`${d.type}-${d.source}`]=!0,o),{}))},[v,l,u,c,f]),e.jsx(Re,{open:!0,onClose:I,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:a(O),children:[e.jsx(We,{children:x(i?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(ze,{children:e.jsxs(p,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(X,{name:"url",control:n,rules:{required:x("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:x("webhookEndpoint.validation.urlInvalid")}},render:({field:o})=>e.jsx(se,{...o,label:x("webhookEndpoint.url.label"),fullWidth:!0,error:!!m.url,helperText:m.url?.message})}),e.jsx(X,{name:"description",control:n,rules:{required:x("webhookEndpoint.validation.descriptionRequired")},render:({field:o})=>e.jsx(se,{...o,label:x("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!m.description,helperText:m.description?.message})}),e.jsx(X,{name:"selectedEvents",control:n,rules:{required:x("webhookEndpoint.validation.eventRequired")},render:({field:o})=>e.jsx("input",{type:"hidden",...o})}),!y&&T&&Object.keys(T).length>0&&e.jsx(ge,{eventsBySource:T,selectedEvents:j,setSelectedEvents:l,error:m.selectedEvents?.message}),!y&&(!T||Object.keys(T).length===0)&&e.jsx(C,{sx:{color:"text.secondary"},children:x("webhookEndpoint.noAvailableEvents")}),y&&e.jsx(p,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(F,{size:20})}),z&&e.jsx(te,{severity:"error",children:x("webhookEndpoint.loadingError",{message:z?.message})})]})}),e.jsxs(De,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:I,children:x("common.cancel")}),e.jsx(H,{type:"submit",variant:"contained",color:"primary",children:x(i?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}be.propTypes={onSubmit:t.func.isRequired,id:t.string,url:t.string,description:t.string,enabledEvents:t.arrayOf(t.shape({type:t.string.isRequired,source:t.string.isRequired})),onClose:t.func};function fe(i){switch(i){case"enabled":return"success";case"disabled":default:return"default"}}const rt=(i="en")=>i==="tw"?"zh":i;function U(i,u="YYYY-MM-DD HH:mm:ss",c="en"){return i?Ge(i).locale(rt(c)).format(u):"-"}function lt(i){return typeof i=="number"?!1:me(i)}function at(i){return i>=200&&i<300}function P({value:i,label:u,tip:c="",divider:f=!1}){const r=lt(i);return e.jsxs(e.Fragment,{children:[e.jsxs(R,{direction:"column",alignItems:"flex-start",children:[e.jsxs(C,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[u,!!c&&e.jsx($,{title:c,children:e.jsx(_,{fontSize:"small"})})]}),e.jsx(C,{component:"div",variant:"body1",color:r?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:r?"-":i})]}),f&&e.jsx(ce,{orientation:"vertical",flexItem:!0})]})}P.propTypes={label:t.oneOfType([t.string,t.node]).isRequired,value:t.oneOfType([t.string,t.node]).isRequired,tip:t.oneOfType([t.string,t.node]),divider:t.bool};function je({title:i,children:u=null,mb:c=1.5,mt:f=1.5}){return e.jsxs(R,{className:"section-header",direction:"row",sx:{justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,mb:c,mt:f,pb:1},children:[e.jsx(C,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:i}),u]})}je.propTypes={title:t.oneOfType([t.string,t.node]).isRequired,children:t.node,mb:t.number,mt:t.number};const ct={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/>'},dt=i=>{const u={};return i.forEach(c=>{const f=new Date(c.createdAt).toLocaleDateString();u[f]||(u[f]=[]),u[f]?.push(c)}),u};function ye({eventId:i="",webhookEndpointId:u="",event:c=null}){const{api:f,ws:{useSubscription:r}}=K(),{t:w}=M(),{teamDid:x}=V(),{blocklet:j}=Ze(),{data:l,loadMore:b,loadingMore:g,loading:y,mutate:z}=Te(s=>{const k=s?Math.ceil(s.list.length/15)+1:1;return f.getWebhookAttempts({input:{teamDid:x,input:{eventId:i,webhookId:u},paging:{page:k,pageSize:15}}})},{reloadDeps:[i,u]}),T=l?.list||[],[n,a]=E.useState(null),[m,v]=E.useState(!1),S=dt(T);if(E.useEffect(()=>{!n&&l?.list.length&&a(l.list[0])},[l?.list.length,n]),r(xe.EVENTS.WEBHOOK_ATTEMPT,s=>{z(h=>{if(h.list.find(W=>W.id===s.id)){const W=h.list.map(A=>A.id===s.id?{...A,...s}:A);return{...h,list:W}}return s.endpoint=h.list[0]?.endpoint,s.event=h.list[0]?.event,{...h,list:[s,...h.list]}})},[]),y)return e.jsx(F,{});const D=l&&l.list.length<l.paging.total,I=async()=>{n&&(v(!0),await f.retryWebhookAttempt({input:{teamDid:x,eventId:n.event.id,webhookId:u,attemptId:n.id}}).finally(()=>{setTimeout(()=>{v(!1)},1e3)}))},O=s=>{if(s.responseBody&&s.responseBody?.sessionId&&s.responseBody?.projectId&&s.responseBody?.agentId){const h=j?.site?.domainAliases[0]?.value,k=(j.children||[]).find(A=>A?.meta?.name==="ai-studio"),W=ot(he(`https://${h}`,k?.mountPoint||"","projects",s.responseBody.projectId,"logs/main"),{sessionId:s.responseBody.sessionId,agentId:s.responseBody.agentId});return e.jsx(B,{sx:{fontSize:20},onClick:()=>window.open(W,"_blank"),children:e.jsx(p,{component:N,icon:Q})})}return null},o=s=>s.status==="pending"?e.jsx(Fe,{color:"warning"}):at(s.responseStatus)?e.jsx(He,{color:"success"}):e.jsx(Ne,{color:"error"}),d=n?.triggeredFrom&&(l?.list||[]).find(s=>s.id===n.triggeredFrom);return e.jsxs(pt,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(ee,{size:{xs:12,md:4},sx:{height:1},children:me(Object.keys(S))?e.jsx(C,{sx:{color:"text.secondary"},children:w("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(G,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(S).map(([s,h])=>e.jsxs(ae.Fragment,{children:[e.jsx(Le,{sx:{p:0},children:s}),h.map(k=>e.jsxs(Z,{sx:{cursor:"pointer",px:1},onClick:()=>a(k),selected:n&&n?.id===k?.id,secondaryAction:e.jsx(C,{sx:{color:"text.secondary"},children:U(k.createdAt,"HH:mm:ss")}),children:[e.jsx(Me,{sx:{minWidth:0,mr:1.5},children:o(k)}),e.jsx(Be,{primary:e.jsx(C,{sx:{color:"text.primary"},children:k.event.type})})]},k.id))]},s))}),D&&e.jsx(p,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:1},children:e.jsx(H,{variant:"text",type:"button",color:"inherit",onClick:b,disabled:g,sx:{color:s=>s.palette.text.disabled},children:w(g?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(ee,{size:{xs:12,md:8},sx:{height:1},children:[n&&e.jsxs(R,{direction:"column",spacing:2,sx:{height:1,overflow:"auto",pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"h4",children:w(`common.${n.status}`)}),e.jsx(p,{children:O(n)})]}),e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[d&&e.jsx($,{placement:"left",title:e.jsxs(R,{onClick:()=>a(d),sx:{gap:1,cursor:"pointer",".did-address-text":{color:"common.white"}},children:[e.jsx(de,{showDid:!0,did:n.triggeredBy,cardType:ue.Detailed,infoType:pe.Minimal,sx:{border:0,padding:0,minWidth:0,".MuiTypography-root":{color:"common.white",fontWeight:400}}}),e.jsx(ce,{}),e.jsxs(p,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(C,{variant:"body2",sx:{color:"primary.main"},children:w("webhookEndpoint.triggeredFrom")}),e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"body2",children:n.id}),e.jsx(B,{onClick:()=>a(d),children:e.jsx(p,{component:N,icon:Q,sx:{fontSize:16,color:"common.white"}})})]})]})]}),slotProps:{tooltip:{sx:{maxWidth:400}}},children:e.jsx(B,{onClick:()=>a(d),children:e.jsx(p,{component:N,icon:Q,sx:{fontSize:16}})})}),e.jsxs(H,{variant:"outlined",color:"primary",size:"small",onClick:I,disabled:m,children:[e.jsx(p,{component:N,icon:ct,sx:{fontSize:16,animation:m?"spin 1s linear infinite":"none",mr:.5}}),w("notification.resend")]})]})]}),e.jsxs(p,{children:[e.jsxs(C,{variant:"h6",children:[w("webhookEndpoint.response")," (",n.responseStatus,")"]}),e.jsx(Y,{language:"json",children:JSON.stringify(n.responseBody,null,2)})]}),e.jsxs(p,{children:[e.jsx(R,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(C,{variant:"h6",children:w("webhookEndpoint.request")})}),e.jsx(Y,{language:"json",sx:{margin:0},children:JSON.stringify(n.event,null,2)})]})]}),l?.list.length===0&&c&&e.jsxs(p,{children:[e.jsx(R,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(C,{variant:"h6",children:w("webhookEndpoint.eventData")})}),e.jsx(Y,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}ye.propTypes={eventId:t.string,webhookEndpointId:t.string,event:t.shape({type:t.string,data:t.object,request:t.object,requestInfo:t.object})};const pt=oe(ee)`
|
|
1
|
+
import{T as M,H as q,P as N,q as Y,k as ve,j as Ce,a0 as Se}from"./vendor-ux-B9VfuZTg.js";import{o as Te,k as le,t as Ie}from"./vendor-hooks-BlA8TRnZ.js";import{r as E,a as ae}from"./vendor-react-Dvs43sk9.js";import{j as e,Y as Re,bC as We,$ as ze,ak as p,z as se,T as C,a6 as F,aX as te,R as De,Q as H,b6 as ne,am as $,bf as _,a5 as J,V as G,S as Z,b4 as Oe,U as L,I as B,ci as Pe,bh as $e,a7 as Ae,F as qe,W as t,b1 as R,a3 as ce,c2 as ee,cj as Le,aO as Me,aP as Be,ck as Fe,cl as He,cm as Ne,s as oe,aU as Ue,aj as _e,J as Ke,cn as Ve,aZ as Ye,cc as Je,bb as Qe,cb as Xe}from"./vendor-mui-core-DRxbhqaK.js";import{B as de,o as pe,l as ue}from"./index-BFBoLr1Z.js";import{X as K,c as xe,_ as Ge,a9 as Ze,b5 as Q}from"./index-Dt8akALo.js";import{u as V}from"./team-s6q3vfNx.js";import{u as et}from"./use-mobile-BQQpAf3i.js";import{u as tt,C as X}from"./index.esm-JPZAjt0x.js";import{C as he,a as me,J as ot}from"./vendor-utils-CUDP56Ff.js";import{C as st}from"./confirm-D1n-RK65.js";import{A as nt}from"./actions-B4VXcSRp.js";import{T as ie}from"./table-tips-rCE1XKlc.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DeeG8u0h.js";import"./session-Y3RU3I2O.js";import"./isURL-B2kErAOg.js";import"./use-app-logo-BjReZUm7.js";import"./index-DBs9Ljax.js";const it=i=>{const[u,c]=E.useState(null),[f,r]=E.useState(!0),[w,x]=E.useState(null),j=window.blocklet?.appUrl,l=E.useMemo(()=>{const g={};return u&&(u.sources.forEach(y=>{g[y.did]={source:y,events:[],count:0}}),u.events.forEach(y=>{g[y.source]&&(g[y.source].events.push(y),g[y.source].count+=1)})),g},[u]),b=async()=>{try{if(r(!0),!j)return;const y=await(await fetch(he(j,xe.WELLKNOWN_SERVICE_PATH_PREFIX,"/openevent.json"))).json();c(y),x(null)}catch(g){x(g instanceof Error?g:new Error(String(g)))}finally{r(!1)}};return E.useEffect(()=>{b()},[j]),{openEvent:u,setOpenEvent:c,eventsBySource:l,loading:f,error:w,loadData:b}};function ge({eventsBySource:i,selectedEvents:u,setSelectedEvents:c,error:f=null}){const{t:r}=M(),[w,x]=E.useState({}),j=E.useMemo(()=>{const n={};return Object.entries(i).forEach(([a,{events:m}])=>{const v=m.filter(S=>u[`${S.type}-${S.source}`]).length;n[a]=v}),n},[i,u]),l=E.useMemo(()=>Object.values(j).reduce((n,a)=>n+a,0),[j]),b=E.useMemo(()=>Object.values(i).reduce((n,{events:a})=>n+a.length,0),[i]),g=(n,a)=>{a.stopPropagation(),x({...w,[n]:!w[n]})},y=n=>{const a=`${n.type}-${n.source}`;c(m=>({...m,[a]:!m[a]}))},z=(n,a)=>{const m={};n.forEach(v=>{const S=`${v.type}-${v.source}`;m[S]=!a}),c(v=>({...v,...m}))},T=n=>{const a={};Object.values(i).forEach(({events:m})=>{m.forEach(v=>{const S=`${v.type}-${v.source}`;a[S]=n.target.checked})}),c(a)};return e.jsxs(p,{sx:{width:"100%"},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ne,{control:e.jsx(J,{onChange:T,checked:l>0&&l===b}),label:e.jsxs(p,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[r("webhookEndpoint.selectAllEvents"),e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:e.jsx($,{title:r("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(_,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),l>0&&e.jsx(C,{variant:"body2",color:"primary",sx:{ml:"auto"},children:r("webhookEndpoint.selectedEventsCount",{count:l})})]}),e.jsx(p,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(G,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(i).map(([n,{source:a,events:m,count:v}],S)=>{const D=j[n]>0,I=j[n]===m.length&&m.length>0,O=w[n];return e.jsxs(ae.Fragment,{children:[e.jsx(Z,{sx:{borderBottom:({palette:o})=>S<Object.keys(i).length-1?`1px solid ${o.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(p,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:o=>{o.target.closest(".MuiFormControlLabel-root")||g(n,o)},children:[e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:m.length>0&&e.jsx(ne,{control:e.jsx(J,{checked:I,indeterminate:D&&!I,onChange:o=>{o.stopPropagation(),z(m,I)}}),label:e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[a.logo&&e.jsx(Oe,{src:a.logo,sx:{width:24,height:24}}),e.jsx(p,{children:a.title||n}),D&&e.jsx(L,{label:r("webhookEndpoint.selectedCount",{count:j[n]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:o=>`${o.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(p,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(C,{variant:"body2",sx:{color:"text.secondary",mr:1},children:r("webhookEndpoint.eventsCount",{count:v})}),m.length>0&&e.jsx(B,{size:"small",edge:"end",children:O?e.jsx(Pe,{}):e.jsx($e,{})})]})]})}),m.length>0&&e.jsx(Ae,{in:O,timeout:"auto",unmountOnExit:!0,children:e.jsx(G,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:m.map(o=>{const d=`${o.type}-${o.source}`,s=!!u[d];return e.jsx(Z,{dense:!0,sx:{py:.75},onClick:()=>y(o),children:e.jsxs(p,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(J,{checked:s,sx:{mr:1}}),e.jsxs(p,{children:[e.jsx(C,{variant:"body1",sx:{cursor:"pointer",color:"text.primary"},children:o.type}),e.jsx(C,{variant:"caption",sx:{color:"text.secondary",display:"block",cursor:"pointer"},children:o.description})]})]})},d)})})})]},n)})})}),f&&e.jsx(qe,{error:!0,sx:{mt:1},children:f})]})}ge.propTypes={eventsBySource:t.objectOf(t.shape({source:t.shape({did:t.string.isRequired,title:t.string,description:t.string,version:t.string,logo:t.string}).isRequired,events:t.arrayOf(t.shape({type:t.string.isRequired,description:t.string.isRequired,source:t.string.isRequired})).isRequired,count:t.number.isRequired})).isRequired,selectedEvents:t.objectOf(t.bool).isRequired,setSelectedEvents:t.func.isRequired,error:t.string};function be({id:i=null,url:u="",description:c="",enabledEvents:f=[],onSubmit:r,onClose:w=()=>{}}){const{t:x}=M(),[j,l]=E.useState({}),{teamDid:b}=V(),{api:g}=K(),{loading:y,error:z,eventsBySource:T}=it(),{control:n,handleSubmit:a,formState:{errors:m},reset:v,setValue:S,trigger:D}=tt({defaultValues:{url:"",description:""}});E.useEffect(()=>{const o=Object.values(j).some(d=>d);S("selectedEvents",o?"valid":""),D("selectedEvents")},[j,S,D]);const I=()=>{l({}),v(),w()},O=async o=>{const d=Object.keys(j).filter(h=>j[h]),s={url:o.url,description:o.description,enabledEvents:d.map(h=>{const[k,W]=h.split("-");return!k||!W?null:{type:k,source:W}}).filter(Boolean)};try{if(i){const h=await g.updateWebhookEndpoint({input:{teamDid:b,id:i,data:s}});q.success(`${x("webhookEndpoint.updateWebhook")} ${x("webhookEndpoint.success")}`),r(h)}else{const h=await g.createWebhookEndpoint({input:{teamDid:b,input:s}});q.success(`${x("webhookEndpoint.createWebhook")} ${x("webhookEndpoint.success")}`),r(h)}}catch(h){q.error(h?.message)}I()};return E.useEffect(()=>{v({url:u,description:c}),l(f.reduce((o,d)=>(o[`${d.type}-${d.source}`]=!0,o),{}))},[v,l,u,c,f]),e.jsx(Re,{open:!0,onClose:I,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:a(O),children:[e.jsx(We,{children:x(i?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(ze,{children:e.jsxs(p,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(X,{name:"url",control:n,rules:{required:x("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:x("webhookEndpoint.validation.urlInvalid")}},render:({field:o})=>e.jsx(se,{...o,label:x("webhookEndpoint.url.label"),fullWidth:!0,error:!!m.url,helperText:m.url?.message})}),e.jsx(X,{name:"description",control:n,rules:{required:x("webhookEndpoint.validation.descriptionRequired")},render:({field:o})=>e.jsx(se,{...o,label:x("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!m.description,helperText:m.description?.message})}),e.jsx(X,{name:"selectedEvents",control:n,rules:{required:x("webhookEndpoint.validation.eventRequired")},render:({field:o})=>e.jsx("input",{type:"hidden",...o})}),!y&&T&&Object.keys(T).length>0&&e.jsx(ge,{eventsBySource:T,selectedEvents:j,setSelectedEvents:l,error:m.selectedEvents?.message}),!y&&(!T||Object.keys(T).length===0)&&e.jsx(C,{sx:{color:"text.secondary"},children:x("webhookEndpoint.noAvailableEvents")}),y&&e.jsx(p,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(F,{size:20})}),z&&e.jsx(te,{severity:"error",children:x("webhookEndpoint.loadingError",{message:z?.message})})]})}),e.jsxs(De,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:I,children:x("common.cancel")}),e.jsx(H,{type:"submit",variant:"contained",color:"primary",children:x(i?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}be.propTypes={onSubmit:t.func.isRequired,id:t.string,url:t.string,description:t.string,enabledEvents:t.arrayOf(t.shape({type:t.string.isRequired,source:t.string.isRequired})),onClose:t.func};function fe(i){switch(i){case"enabled":return"success";case"disabled":default:return"default"}}const rt=(i="en")=>i==="tw"?"zh":i;function U(i,u="YYYY-MM-DD HH:mm:ss",c="en"){return i?Ge(i).locale(rt(c)).format(u):"-"}function lt(i){return typeof i=="number"?!1:me(i)}function at(i){return i>=200&&i<300}function P({value:i,label:u,tip:c="",divider:f=!1}){const r=lt(i);return e.jsxs(e.Fragment,{children:[e.jsxs(R,{direction:"column",alignItems:"flex-start",children:[e.jsxs(C,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[u,!!c&&e.jsx($,{title:c,children:e.jsx(_,{fontSize:"small"})})]}),e.jsx(C,{component:"div",variant:"body1",color:r?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:r?"-":i})]}),f&&e.jsx(ce,{orientation:"vertical",flexItem:!0})]})}P.propTypes={label:t.oneOfType([t.string,t.node]).isRequired,value:t.oneOfType([t.string,t.node]).isRequired,tip:t.oneOfType([t.string,t.node]),divider:t.bool};function je({title:i,children:u=null,mb:c=1.5,mt:f=1.5}){return e.jsxs(R,{className:"section-header",direction:"row",sx:{justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,mb:c,mt:f,pb:1},children:[e.jsx(C,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:i}),u]})}je.propTypes={title:t.oneOfType([t.string,t.node]).isRequired,children:t.node,mb:t.number,mt:t.number};const ct={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/>'},dt=i=>{const u={};return i.forEach(c=>{const f=new Date(c.createdAt).toLocaleDateString();u[f]||(u[f]=[]),u[f]?.push(c)}),u};function ye({eventId:i="",webhookEndpointId:u="",event:c=null}){const{api:f,ws:{useSubscription:r}}=K(),{t:w}=M(),{teamDid:x}=V(),{blocklet:j}=Ze(),{data:l,loadMore:b,loadingMore:g,loading:y,mutate:z}=Te(s=>{const k=s?Math.ceil(s.list.length/15)+1:1;return f.getWebhookAttempts({input:{teamDid:x,input:{eventId:i,webhookId:u},paging:{page:k,pageSize:15}}})},{reloadDeps:[i,u]}),T=l?.list||[],[n,a]=E.useState(null),[m,v]=E.useState(!1),S=dt(T);if(E.useEffect(()=>{!n&&l?.list.length&&a(l.list[0])},[l?.list.length,n]),r(xe.EVENTS.WEBHOOK_ATTEMPT,s=>{z(h=>{if(h.list.find(W=>W.id===s.id)){const W=h.list.map(A=>A.id===s.id?{...A,...s}:A);return{...h,list:W}}return s.endpoint=h.list[0]?.endpoint,s.event=h.list[0]?.event,{...h,list:[s,...h.list]}})},[]),y)return e.jsx(F,{});const D=l&&l.list.length<l.paging.total,I=async()=>{n&&(v(!0),await f.retryWebhookAttempt({input:{teamDid:x,eventId:n.event.id,webhookId:u,attemptId:n.id}}).finally(()=>{setTimeout(()=>{v(!1)},1e3)}))},O=s=>{if(s.responseBody&&s.responseBody?.sessionId&&s.responseBody?.projectId&&s.responseBody?.agentId){const h=j?.site?.domainAliases[0]?.value,k=(j.children||[]).find(A=>A?.meta?.name==="ai-studio"),W=ot(he(`https://${h}`,k?.mountPoint||"","projects",s.responseBody.projectId,"logs/main"),{sessionId:s.responseBody.sessionId,agentId:s.responseBody.agentId});return e.jsx(B,{sx:{fontSize:20},onClick:()=>window.open(W,"_blank"),children:e.jsx(p,{component:N,icon:Q})})}return null},o=s=>s.status==="pending"?e.jsx(Fe,{color:"warning"}):at(s.responseStatus)?e.jsx(He,{color:"success"}):e.jsx(Ne,{color:"error"}),d=n?.triggeredFrom&&(l?.list||[]).find(s=>s.id===n.triggeredFrom);return e.jsxs(pt,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(ee,{size:{xs:12,md:4},sx:{height:1},children:me(Object.keys(S))?e.jsx(C,{sx:{color:"text.secondary"},children:w("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(G,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(S).map(([s,h])=>e.jsxs(ae.Fragment,{children:[e.jsx(Le,{sx:{p:0},children:s}),h.map(k=>e.jsxs(Z,{sx:{cursor:"pointer",px:1},onClick:()=>a(k),selected:n&&n?.id===k?.id,secondaryAction:e.jsx(C,{sx:{color:"text.secondary"},children:U(k.createdAt,"HH:mm:ss")}),children:[e.jsx(Me,{sx:{minWidth:0,mr:1.5},children:o(k)}),e.jsx(Be,{primary:e.jsx(C,{sx:{color:"text.primary"},children:k.event.type})})]},k.id))]},s))}),D&&e.jsx(p,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:1},children:e.jsx(H,{variant:"text",type:"button",color:"inherit",onClick:b,disabled:g,sx:{color:s=>s.palette.text.disabled},children:w(g?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(ee,{size:{xs:12,md:8},sx:{height:1},children:[n&&e.jsxs(R,{direction:"column",spacing:2,sx:{height:1,overflow:"auto",pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"h4",children:w(`common.${n.status}`)}),e.jsx(p,{children:O(n)})]}),e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[d&&e.jsx($,{placement:"left",title:e.jsxs(R,{onClick:()=>a(d),sx:{gap:1,cursor:"pointer",".did-address-text":{color:"common.white"}},children:[e.jsx(de,{showDid:!0,did:n.triggeredBy,cardType:ue.Detailed,infoType:pe.Minimal,sx:{border:0,padding:0,minWidth:0,".MuiTypography-root":{color:"common.white",fontWeight:400}}}),e.jsx(ce,{}),e.jsxs(p,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(C,{variant:"body2",sx:{color:"primary.main"},children:w("webhookEndpoint.triggeredFrom")}),e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"body2",children:n.id}),e.jsx(B,{onClick:()=>a(d),children:e.jsx(p,{component:N,icon:Q,sx:{fontSize:16,color:"common.white"}})})]})]})]}),slotProps:{tooltip:{sx:{maxWidth:400}}},children:e.jsx(B,{onClick:()=>a(d),children:e.jsx(p,{component:N,icon:Q,sx:{fontSize:16}})})}),e.jsxs(H,{variant:"outlined",color:"primary",size:"small",onClick:I,disabled:m,children:[e.jsx(p,{component:N,icon:ct,sx:{fontSize:16,animation:m?"spin 1s linear infinite":"none",mr:.5}}),w("notification.resend")]})]})]}),e.jsxs(p,{children:[e.jsxs(C,{variant:"h6",children:[w("webhookEndpoint.response")," (",n.responseStatus,")"]}),e.jsx(Y,{language:"json",children:JSON.stringify(n.responseBody,null,2)})]}),e.jsxs(p,{children:[e.jsx(R,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(C,{variant:"h6",children:w("webhookEndpoint.request")})}),e.jsx(Y,{language:"json",sx:{margin:0},children:JSON.stringify(n.event,null,2)})]})]}),l?.list.length===0&&c&&e.jsxs(p,{children:[e.jsx(R,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(C,{variant:"h6",children:w("webhookEndpoint.eventData")})}),e.jsx(Y,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}ye.propTypes={eventId:t.string,webhookEndpointId:t.string,event:t.shape({type:t.string,data:t.object,request:t.object,requestInfo:t.object})};const pt=oe(ee)`
|
|
2
2
|
@keyframes spin {
|
|
3
3
|
to {
|
|
4
4
|
transform: rotate(360deg);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as u}from"./vendor-react-Dvs43sk9.js";import{W as o,j as e,ak as j,aN as L,z as A,at as K,bn as B,I as P,a6 as W,bF as M,aj as X,bG as G}from"./vendor-mui-core-DRxbhqaK.js";import{C as H}from"./Google-E3u2a9g7.js";import{c as U}from"./vendor-ux-B9VfuZTg.js";import{c as Y}from"./create-passport-svg-n0J1kwzH.js";import{A as $}from"./vendor-arcblock-DeeG8u0h.js";import{e as J}from"./index-
|
|
1
|
+
import{r as u}from"./vendor-react-Dvs43sk9.js";import{W as o,j as e,ak as j,aN as L,z as A,at as K,bn as B,I as P,a6 as W,bF as M,aj as X,bG as G}from"./vendor-mui-core-DRxbhqaK.js";import{C as H}from"./Google-E3u2a9g7.js";import{c as U}from"./vendor-ux-B9VfuZTg.js";import{c as Y}from"./create-passport-svg-n0J1kwzH.js";import{A as $}from"./vendor-arcblock-DeeG8u0h.js";import{e as J}from"./index-Dt8akALo.js";import{R as Q}from"./required-BT8zXV8U.js";import{F as Z}from"./form-wrapper-Dt1iJZge.js";import{L as v}from"./logo-uploader-BSLuQUWG.js";import{A as ee,a as ne,b as te}from"./collapse-DJGzUM1Q.js";const S={description:o.string,editing:o.bool,onChange:o.func,required:o.bool,value:o.any,componentProps:o.object,render:o.func,renderFormItem:o.func};function T({editing:n,value:s,onChange:l}){const[i,c]=u.useState(!1),m=u.useRef(),f=u.useRef(s);u.useEffect(()=>{let a=null;return n&&(a=setTimeout(()=>{c(!0)},50)),()=>{clearTimeout(a)}},[n]);const h=a=>{f.current=a,l(a)},b=()=>{c(!1),l(f.current)},y=e.jsx(j,{className:"form-item-input slot",sx:{px:1},children:e.jsxs(j,{sx:{display:"flex",alignItems:"center"},children:[s,s!=="auto"&&e.jsx("div",{style:{marginLeft:4,backgroundColor:s,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),p=e.jsxs(j,{onKeyDown:b,sx:{display:"flex",flexGrow:1,alignItems:"center",height:"40px"},children:[e.jsx(j,{onClick:()=>c(!0),sx:{display:"flex",alignItems:"center"},children:e.jsx("div",{ref:m,style:{flexShrink:0,marginLeft:"8px",backgroundColor:s,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:s==="auto"?"default":"pointer"}})}),e.jsx(L,{open:i,anchorEl:m.current,onClose:()=>c(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:e.jsx(H,{color:s,onChange:a=>h(a.hex)})})]});return n?p:y}T.propTypes=S;function D({editing:n,description:s,value:l,onChange:i,componentProps:c={},...m}){const{placeholder:f}=c,h=u.useRef(l),{t:b}=u.useContext(U),y=a=>{a.key==="Enter"&&i(h.current,"confirm")},p=a=>{h.current=a,i(a)};return n?e.jsx(A,{style:{flex:1},fullWidth:!0,value:l,onChange:a=>{a.persist(),p(a.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:s||f,onKeyDown:y,...m}):e.jsx(j,{className:"form-item-input slot",sx:{px:1},children:l||e.jsx("span",{className:"placeholder",children:b("common.requiredInputPlaceholder",{name:s||f})})})}D.propTypes=S;function O({editing:n,value:s,onChange:l,componentProps:i,...c}){const{blocklet:m}=i,f=s==="auto"?$(m.appDid):s;return e.jsxs(j,{sx:{display:"flex",alignItems:"center"},children:[e.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:Y({title:"Owner",issuer:J.getDisplayName(m),issuerDid:m.appDid,ownerName:"Your Name",ownerDid:m.appDid,preferredColor:s||"auto"})}}),e.jsx(T,{...c,editing:n,value:n?f:s,onChange:l,componentProps:i})]})}O.propTypes={...S,componentProps:o.shape({blocklet:o.object.isRequired}).isRequired};const re=G`
|
|
2
2
|
0%, 100% {
|
|
3
3
|
transform: scale(1) translateX(0);
|
|
4
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,at as r}from"./vendor-mui-core-DRxbhqaK.js";import{r as s}from"./vendor-react-Dvs43sk9.js";import{c as a}from"./vendor-ux-B9VfuZTg.js";import{r as n}from"./index-
|
|
1
|
+
import{j as t,at as r}from"./vendor-mui-core-DRxbhqaK.js";import{r as s}from"./vendor-react-Dvs43sk9.js";import{c as a}from"./vendor-ux-B9VfuZTg.js";import{r as n}from"./index-Dt8akALo.js";import"./vendor-utils-CUDP56Ff.js";import"./vendor-hooks-BlA8TRnZ.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DeeG8u0h.js";function l(){const{t:o}=s.useContext(a);return t.jsx(i,{style:{paddingTop:"25vh"},children:t.jsx(n,{status:"404",description:o("noMatch.desc"),style:{backgroundColor:"transparent"}})})}const i=r.main``;export{l as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r}from"./vendor-react-Dvs43sk9.js";import{j as i,cd as N,at as g,W as t,ak as _,b0 as S,a6 as E,s as z}from"./vendor-mui-core-DRxbhqaK.js";import{g as Z,h as $,b as y,k as T}from"./vendor-hooks-BlA8TRnZ.js";import{_ as A,Q as D,c as q,aR as U,aS as L,aT as H,r as F}from"./index-
|
|
1
|
+
import{r}from"./vendor-react-Dvs43sk9.js";import{j as i,cd as N,at as g,W as t,ak as _,b0 as S,a6 as E,s as z}from"./vendor-mui-core-DRxbhqaK.js";import{g as Z,h as $,b as y,k as T}from"./vendor-hooks-BlA8TRnZ.js";import{_ as A,Q as D,c as q,aR as U,aS as L,aT as H,r as F}from"./index-Dt8akALo.js";import{c as O,b as W,n as B,T as w,$ as Y}from"./vendor-ux-B9VfuZTg.js";import{N as J}from"./index-BZUEA_VO.js";import{C as K}from"./vendor-utils-CUDP56Ff.js";import{u as Q}from"./use-passport-id-B-b-_oYF.js";import{u as X}from"./session-Y3RU3I2O.js";import{b as G}from"./sdk-DlI_Utmi.js";import{w as e2}from"./wrap-locale-DcfUdcYR.js";function b({invitation:e,createPassportSvg:o,passportColor:c="auto"}){const[d,n]=r.useState(!1),{t:p}=r.useContext(O),s=r.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),C=r.useMemo(()=>o({title:s,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||c,extra:e.passportExpireTime?{key:"Exp",value:A(e.passportExpireTime).format("YYYY-MM-DD HH:mm:ss")}:void 0}),[e,s]),m=r.useCallback(()=>{n(!0)},[]),a=r.useCallback(()=>{n(!1)},[]);return i.jsxs(i.Fragment,{children:[i.jsx(i2,{children:i.jsxs("div",{className:"invite-passport__card",onClick:m,children:[!!e.display&&i.jsx(J,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&i.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:C}})]})}),i.jsx(W,{open:d,title:p("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:a,children:e.role.permissions&&e.role.permissions.length>0?i.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(u=>i.jsx("li",{style:{listStyle:"circle"},children:u.description},u.name))}):i.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[i.jsx(N,{style:{width:"30px",height:"30px"}}),i.jsx("div",{children:p("invite.emptyPermission")})]})})]})}b.propTypes={invitation:t.object.isRequired,createPassportSvg:t.func.isRequired,passportColor:t.string};const i2=g.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
max-width: 350px;
|
|
4
4
|
margin: 30px auto;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r}from"./vendor-react-Dvs43sk9.js";import{j as o,a6 as b,am as D,ak as w,bb as L,at as H,W as x}from"./vendor-mui-core-DRxbhqaK.js";import{c as S,n as T,j as Y,k as z}from"./vendor-ux-B9VfuZTg.js";import{X as M,_ as N,B as P,$ as E,a0 as W}from"./index-
|
|
1
|
+
import{r}from"./vendor-react-Dvs43sk9.js";import{j as o,a6 as b,am as D,ak as w,bb as L,at as H,W as x}from"./vendor-mui-core-DRxbhqaK.js";import{c as S,n as T,j as Y,k as z}from"./vendor-ux-B9VfuZTg.js";import{X as M,_ as N,B as P,$ as E,a0 as W}from"./index-Dt8akALo.js";import{n as _}from"./vendor-utils-CUDP56Ff.js";import{u as A}from"./team-s6q3vfNx.js";import{C as K}from"./confirm-D1n-RK65.js";import{P as X}from"./permission-ya4qYiIS.js";import{C as $}from"./click-to-copy-CO6UIqva.js";function q({invitations:a=[],onRefresh:v=_}){const{api:C,inService:d}=M(),{t,locale:y}=r.useContext(S),{teamDid:g,invitations:f,refresh:h,endpoint:l,roles:j}=A(),[i,m]=r.useState(null),[k,c]=r.useState(!1),s=r.useMemo(()=>a.length>0?a:f,[a,f]),I=async({inviteId:e})=>{if(!k){c(!0);try{await C.deleteInvitation({input:{teamDid:g,inviteId:e}}),h(),v?.(),await E(800)}catch(n){console.error(n)}finally{c(!1),m(null)}}},R=()=>{c(!1),m(null)},p=e=>l?W({inviteId:e.inviteId,endpoint:l}):"",B=[{label:t("team.inviting.link"),name:"inviteId",options:{sort:!1,customBodyRenderLite:e=>{const n=s[e];return l?o.jsx($,{children:p(n)}):o.jsx(b,{size:16})}}},{label:t("common.role"),name:"role",widtn:70,options:{sort:!1,customBodyRender:e=>{const n=j.find(u=>u.name===e);return n?.title?o.jsx(D,{title:e,children:n.title}):e||"--"}}},{label:t("common.remark"),name:"remark",options:{sort:!1,customBodyRender:e=>e||"--"}},{label:t("team.inviting.inviter"),name:"inviter.fullName",options:{sort:!1,customBodyRender:(e,{rowIndex:n})=>s[n]?.inviter?.fullName}},{label:t("common.expires"),name:"expireDate",options:{sort:!1,customBodyRender:e=>o.jsx(w,{children:N(e).format("YYYY-MM-DD HH:mm")})}},{label:t("common.actions"),name:"",width:100,align:"center",options:{sort:!1,customBodyRenderLite:e=>{const n=s[e];return o.jsx(X,{permission:d?"":"mutate_team",role:d?P:[],children:o.jsxs(T,{onClick:()=>m({title:t("team.inviting.delete.title"),description:t("team.inviting.delete.description",{link:p(n)}),confirm:t("common.delConfirm"),cancel:t("common.cancel"),onConfirm:()=>I(n),onCancel:R}),size:"small",color:"error",variant:"text",children:[o.jsx(L,{style:{fontSize:"1.2em"}}),t("common.delete")]})})}}}];return o.jsxs(F,{children:[s.length?o.jsx(Y,{locale:y,data:[...s],columns:B,verticalKeyWidth:100,options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}}):o.jsx(z,{sx:{minHeight:200},children:t("common.empty")}),i&&o.jsx(K,{title:i.title,description:i.description,confirm:i.confirm,cancel:i.cancel,params:i.params,onConfirm:i.onConfirm,onCancel:i.onCancel})]})}q.propTypes={invitations:x.array,onRefresh:x.func};const F=H.div`
|
|
2
2
|
margin-top: -20px;
|
|
3
3
|
`;export{q as I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as i,ak as l}from"./vendor-mui-core-DRxbhqaK.js";import{i as x,r as w}from"./vendor-react-Dvs43sk9.js";import{b as g}from"./vendor-hooks-BlA8TRnZ.js";import{I as v}from"./invitation-
|
|
1
|
+
import{j as i,ak as l}from"./vendor-mui-core-DRxbhqaK.js";import{i as x,r as w}from"./vendor-react-Dvs43sk9.js";import{b as g}from"./vendor-hooks-BlA8TRnZ.js";import{I as v}from"./invitation-BKbYsXkF.js";import{K as u}from"./landing-page-CQU5LiHu.js";import{T as I,y as k}from"./vendor-ux-B9VfuZTg.js";import{a as S,d as T,s as E,b as j,c as P,H as R}from"./index-Dt8akALo.js";import{g as W}from"./get-safe-url-BrBIp6RF.js";import{c as b}from"./passport-Di66zEMV.js";import"./vendor-utils-CUDP56Ff.js";import"./index-BZUEA_VO.js";import"./use-passport-id-B-b-_oYF.js";import"./session-Y3RU3I2O.js";import"./sdk-DlI_Utmi.js";import"./wrap-locale-DcfUdcYR.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DeeG8u0h.js";import"./create-passport-svg-n0J1kwzH.js";function G(n){const c=x(),{searchParams:s}=new URL(window.location.href),{api:m,session:p}=S(),{t:d}=I(),r=s.get("inviteId"),a=s.get("redirect"),f=w.useCallback(async()=>{const{data:t}=await T.get("invitation",{params:{inviteId:r}});return t},[r]),h=g(async(t,o=e=>e)=>{t&&(E(o(t.sessionToken)),j(o(t.refreshToken)),t.visitorId&&k(o(t.visitorId))),await p.refresh(),setTimeout(()=>{if(a){const e=decodeURIComponent(a);e.startsWith(P.WELLKNOWN_SERVICE_PATH_PREFIX)?c(e,{replace:!0}):window.location.href=W(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(u,{did:window.blocklet?.appPid,children:[i.jsx(R,{children:i.jsxs("title",{children:[d("pageTitle.invite")," | ",window.blocklet?.appName]})}),i.jsx(l,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(v,{...n,getDataFn:f,checkFn:m.get,createPassportSvg:t=>b({...t}),onLoginSuccess:h,inService:!0})})]})}export{G as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as E}from"./vendor-react-Dvs43sk9.js";import{aD as F,aE as H,aF as P,aG as $,aH as N}from"./index-
|
|
1
|
+
import{g as E}from"./vendor-react-Dvs43sk9.js";import{aD as F,aE as H,aF as P,aG as $,aH as N}from"./index-Dt8akALo.js";var h={exports:{}},p={exports:{}},I;function Q(){return I||(I=1,function(c,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var v=function(d,y){return d.indexOf(y)!==-1};n.default=v,c.exports=n.default,c.exports.default=n.default}(p,p.exports)),p.exports}var A;function G(){return A||(A=1,function(c,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=M;var v=o(F()),g=o(P()),d=o(Q()),y=o(N()),w=o($()),S=o(H());function o(e){return e&&e.__esModule?e:{default:e}}function R(e,r){return U(e)||O(e,r)||L(e,r)||j()}function j(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function L(e,r){if(e){if(typeof e=="string")return b(e,r);var l={}.toString.call(e).slice(8,-1);return l==="Object"&&e.constructor&&(l=e.constructor.name),l==="Map"||l==="Set"?Array.from(e):l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l)?b(e,r):void 0}}function b(e,r){(r==null||r>e.length)&&(r=e.length);for(var l=0,u=Array(r);l<r;l++)u[l]=e[l];return u}function O(e,r){var l=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(l!=null){var u,a,_,s,i=[],t=!0,f=!1;try{if(_=(l=l.call(e)).next,r!==0)for(;!(t=(u=_.call(l)).done)&&(i.push(u.value),i.length!==r);t=!0);}catch(m){f=!0,a=m}finally{try{if(!t&&l.return!=null&&(s=l.return(),Object(s)!==s))return}finally{if(f)throw a}}return i}}function U(e){if(Array.isArray(e))return e}var k={protocols:["http","https","ftp"],require_tld:!0,require_protocol:!1,require_host:!0,require_port:!1,require_valid_protocol:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_protocol_relative_urls:!1,allow_fragments:!0,allow_query_components:!0,validate_length:!0,max_allowed_length:2084},D=/^\[([^\]]+)\](?::([0-9]+))?$/;function M(e,r){if((0,v.default)(e),!e||/[\s<>]/.test(e)||e.indexOf("mailto:")===0||(r=(0,S.default)(r,k),r.validate_length&&e.length>r.max_allowed_length)||!r.allow_fragments&&(0,d.default)(e,"#")||!r.allow_query_components&&((0,d.default)(e,"?")||(0,d.default)(e,"&")))return!1;var l,u,a,_,s,i,t,f;if(t=e.split("#"),e=t.shift(),t=e.split("?"),e=t.shift(),t=e.split("://"),t.length>1){if(l=t.shift().toLowerCase(),r.require_valid_protocol&&r.protocols.indexOf(l)===-1)return!1}else{if(r.require_protocol)return!1;if(e.slice(0,2)==="//"){if(!r.allow_protocol_relative_urls)return!1;t[0]=e.slice(2)}}if(e=t.join("://"),e==="")return!1;if(t=e.split("/"),e=t.shift(),e===""&&!r.require_host)return!0;if(t=e.split("@"),t.length>1){if(r.disallow_auth||t[0]===""||(u=t.shift(),u.indexOf(":")>=0&&u.split(":").length>2))return!1;var m=u.split(":"),x=R(m,2),T=x[0],C=x[1];if(T===""&&C==="")return!1}_=t.join("@"),i=null,f=null;var q=_.match(D);if(q?(a="",f=q[1],i=q[2]||null):(t=_.split(":"),a=t.shift(),t.length&&(i=t.join(":"))),i!==null&&i.length>0){if(s=parseInt(i,10),!/^[0-9]+$/.test(i)||s<=0||s>65535)return!1}else if(r.require_port)return!1;return r.host_whitelist?(0,g.default)(a,r.host_whitelist):a===""&&!r.require_host?!0:!(!(0,w.default)(a)&&!(0,y.default)(a,r)&&(!f||!(0,w.default)(f,6))||(a=a||f,r.host_blacklist&&(0,g.default)(a,r.host_blacklist)))}c.exports=n.default,c.exports.default=n.default}(h,h.exports)),h.exports}var W=G();const J=E(W);export{J as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s,a6 as w,ak as x}from"./vendor-mui-core-DRxbhqaK.js";import{g as v,k,b as p}from"./vendor-hooks-BlA8TRnZ.js";import{I as T}from"./invitation-
|
|
1
|
+
import{j as s,a6 as w,ak as x}from"./vendor-mui-core-DRxbhqaK.js";import{g as v,k,b as p}from"./vendor-hooks-BlA8TRnZ.js";import{I as T}from"./invitation-BKbYsXkF.js";import{K as I}from"./landing-page-CQU5LiHu.js";import{T as P,y as j}from"./vendor-ux-B9VfuZTg.js";import{a as R,s as S,b as E,c as N,H as W}from"./index-Dt8akALo.js";import{g as b}from"./get-safe-url-BrBIp6RF.js";import{c as C}from"./passport-Di66zEMV.js";import{i as F}from"./vendor-react-Dvs43sk9.js";import"./vendor-utils-CUDP56Ff.js";import"./index-BZUEA_VO.js";import"./use-passport-id-B-b-_oYF.js";import"./session-Y3RU3I2O.js";import"./sdk-DlI_Utmi.js";import"./wrap-locale-DcfUdcYR.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DeeG8u0h.js";import"./create-passport-svg-n0J1kwzH.js";function Y(m){const{searchParams:r}=new URL(window.location.href),{api:a,session:f}=R(),d=F(),{t:h}=P(),n=r.get("id"),c=r.get("redirect"),u=v({state:""}),o=k(async()=>{if(!n)return null;const{data:t}=await a.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),l=p(()=>{if(o.error)throw o.error;return o?.data}),g=p(async(t,i=e=>e)=>{t&&(t.sessionToken&&S(i(t.sessionToken)),t.refreshToken&&E(i(t.refreshToken)),t.visitorId&&j(i(t.visitorId)),await f.refresh()),setTimeout(()=>{if(c){const e=decodeURIComponent(c);e.startsWith(N.WELLKNOWN_SERVICE_PATH_PREFIX)?d(e,{replace:!0}):window.location.href=b(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return o.loading?s.jsx(w,{}):s.jsxs(I,{did:window.blocklet?.appPid,children:[s.jsx(W,{children:s.jsxs("title",{children:[h("pageTitle.issuePassport")," | ",window.blocklet?.appName]})}),s.jsx(x,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:s.jsx(T,{...m,action:"issue-passport",getDataFn:l,checkFn:a.get,createPassportSvg:C,onLoginSuccess:g,inService:!0,status:u.state})})]})}export{Y as default};
|