forked from novasamatech/subquery-staking
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
autosave-f75a79d0db404ba1.min.js.br
7 lines (5 loc) · 11.8 KB
/
autosave-f75a79d0db404ba1.min.js.br
1
2
3
4
5
6
7
"use strict";
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="56548980-f0e5-5cde-8921-77bdcccc160d")}catch(e){}}();
(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([[5817],{282688:(e,a,t)=>{t.d(a,{AX:()=>E,Ay:()=>u,DA:()=>v,DD:()=>s,Fz:()=>g,IC:()=>x,MV:()=>m,Ns:()=>y,O2:()=>d,QW:()=>T,Vw:()=>N,Vz:()=>c,dd:()=>r,eX:()=>o,fH:()=>p,hL:()=>f,ho:()=>i,jO:()=>h,ns:()=>A,r_:()=>_,rf:()=>n,yl:()=>l});let l="autosave_modal--modal--Egqg3",s="autosave_modal--title--Q-T-o",n="autosave_modal--body--pv4yP",o="autosave_modal--fileRows--JQWy9",i="autosave_modal--fileRow--vBNLB",r="autosave_modal--userRows--fG3Qq",c="autosave_modal--onlyFileRow--yr2jI autosave_modal--fileRow--vBNLB autosave_modal--body--pv4yP",m="autosave_modal--onlyFileRowText--NGT-7",d="autosave_modal--userTitle--lEP2M ellipsis--ellipsis--Tjyfa text--fontPos11--2LvXf text--_fontBase--QdLsd",u="autosave_modal--fileMetadata--JIecy",v="autosave_modal--fileTitle--L9HsU ellipsis--ellipsis--Tjyfa",f="autosave_modal--fileLastUpdatedAt--ZL15q ellipsis--ellipsis--Tjyfa text--fontPos11--2LvXf text--_fontBase--QdLsd",E="autosave_modal--logOutButtons--961-N",_="autosave_modal--logOutDiscard--MvTW-",g="autosave_modal--logOutDone--cjhVr autosave_modal--flexRowEnd--UaYDp",y="autosave_modal--doneAndSync---UvWx autosave_modal--flexRowEnd--UaYDp",h="autosave_modal--expiryAndDone--ck-oP",N="autosave_modal--done--F-hm3",p="autosave_modal--expiryWrapper--1Ee1U",x="autosave_modal--expiry--E2Ybr",T="autosave_modal--warningIcon--T1wLu",A="autosave_modal--openToSync--KQUfj"},537401:(e,a,t)=>{t.r(a),t.d(a,{AutosaveLearnMoreModal:()=>d});var l=t(411855),s=t(188507),n=t(218017),o=t(304913),i=t(402791),r=t(705715),c=t(905618),m=t(282688);function d({userInOrg:e}){let a=(0,s.wA)();return l.createElement(c.aF,{className:m.yl},l.createElement(n.s_,{dispatch:a}),l.createElement("div",{className:m.DD},l.createElement(i.Tx,{id:"autosave.learn_more.title"})),l.createElement("div",{className:m.rf},l.createElement(i.Tx,{id:"autosave.learn_more.body_save_pending_changes"})),l.createElement("div",{className:m.rf},l.createElement(i.Tx,{id:"autosave.learn_more.body_use_version_history"})),l.createElement("div",{className:m.Fz},l.createElement(o.nR,{onClick:()=>{a(r.Ce())},className:m.Vw},l.createElement(i.Tx,{id:"autosave.learn_more.done_button"}))))}},936292:(e,a,t)=>{t.r(a),t.d(a,{AutosaveLogOutModal:()=>H,HasAutosaveChangesModal:()=>K});var l=t(411855),s=t(188507),n=t(677469),o=t.n(n),i=t(921436),r=t(897138),c=t(42821),m=t(703473),d=t(294608),u=t(785341),v=t(143551),f=t(218017),E=t(304913),_=t(794993),g=t(487644),y=t(39606),h=t(402791),N=t(965528),p=t(705715),x=t(256859),T=t(609443),A=t(165904),w=t(629388),D=t(596263),C=t(21122),F=t(487383),k=t(731939),b=t(148959),O=t(428748),L=t(404968),M=t(157892),R=t(905618),S=t(282688),U=t(247866);function B(e){return e.user?l.createElement("div",{className:S.O2},l.createElement("p",null,e.user.community_profile_handle||e.user.email)):null}async function j(e,a){let t=!1,l=null;try{let{data:s}=await L.S.getFiles({includePerms:!0,fileKey:a.fileKey,args:{headers:{"X-Figma-User-ID":e}}});(l=s.meta)&&(l.deleted_at||!l.can_edit_canvas)&&(t=!0)}catch(e){404===e.status?t=!0:(0,u.Lo)("Autosave","Failed to retrieve information about autosave file")}return{userID:e,shouldDeleteFile:t,unsyncedFile:a,figFile:l}}let I=(e,a)=>(0,r.s)(()=>{let t=new URL((0,F.r1)(e,!0));t.searchParams.append("fuid",a),m.Ay.redirect(t.toString(),"_blank")}),V=(e,a)=>(0,r.s)(()=>e(N.NA({file:a,openNewFileIn:O.ai.NEW_TAB,source:b.U.AUTOSAVE_MODAL})));function P(e,a,t){return(0,A.y8)(a)?{fileName:a.file.name,onClick:I(a.file,t.id),thumbnail:l.createElement(M.H,{file:a.file,listView:"slightly-larger"})}:{fileName:a.name,onClick:V(e,a),thumbnail:l.createElement(y.A,{listView:"slightly-larger"})}}function W(e){let{fileName:a,onClick:t,thumbnail:n}=P((0,s.wA)(),e.fileState,e.user);return l.createElement("div",{className:S.ho,key:e.fileState.fileKey},n,l.createElement("div",{className:S.Ay},l.createElement("div",{className:S.DA},a),l.createElement("div",{className:S.hL},l.createElement(h.Tx,{id:"tile.file_tile.edited_time",time:l.createElement(_.h1,{date:e.fileState.lastUpdatedAt})}))),l.createElement(E.nR,{className:S.ns,onClick:t},l.createElement(h.Tx,{id:"autosave.has_changes.open_to_sync"})))}function z(e){return l.createElement("div",{className:S.dd},Object.keys(e.files).map(a=>l.createElement("div",{key:a,className:S.eX},l.createElement(B,{user:e.users.filter(e=>(null==e?void 0:e.id)===a)[0]}),l.createElement("div",null,Object.values(e.files[a]).map(t=>l.createElement(W,{fileState:t,user:e.users.filter(e=>(null==e?void 0:e.id)===a)[0],key:t.fileKey}))))))}function G(e,a,t,s,n,i){let r;let c=i||(()=>{e(p.Ce())}),m=X(t),d=1===o()(Object.values(a)).length,u=null,v=null,_=null,y=null,N=null;if(d){u=o()(Object.values(a))[0];let t=Object.keys(a).filter(e=>a[e].length>0)[0],n=P(e,u,v=s.filter(e=>(null==e?void 0:e.id)===t)[0]);_=n.fileName,y=n.onClick,N=n.thumbnail,r=l.createElement("div",null,l.createElement(B,{user:v}),l.createElement("div",{className:S.Vz},N,l.createElement("div",{className:S.MV},l.createElement(h.Tx,{id:"autosave.has_changes.unsaved_changes_to_file",fileName:l.createElement("span",{className:S.DD},_)}))))}else r=l.createElement("div",null,l.createElement("div",{className:S.rf},l.createElement(h.Tx,{id:"autosave.has_changes.unsynced_changes_offline"})),l.createElement(z,{files:a,users:s}));return l.createElement(R.aF,{className:S.yl,size:500,tintedModalBackground:!0},l.createElement(f.s_,{dispatch:e}),l.createElement("div",{className:S.DD},l.createElement(h.Tx,{id:"autosave.has_changes.sync_offline_changes"})),r,m||n||d?l.createElement("div",{className:S.jO},m&&l.createElement("div",{className:S.fH},l.createElement(g.B,{svg:U.A,className:S.QW}),l.createElement("div",{className:S.IC},m)),l.createElement("div",{className:S.Ns},n?l.createElement(E.nR,{onClick:c},l.createElement(h.Tx,{id:"autosave.has_changes.dismiss.later"})):null,d&&y&&l.createElement(E.$$,{onClick:y},l.createElement(h.Tx,{id:"autosave.has_changes.open_to_sync"})))):null)}function K(){let e=(0,s.wA)(),a=function(){let e=(0,D.ud)(),{modalShown:a,autosave:t}=(0,d.R)(e=>({modalShown:e.modalShown,autosave:e.autosave})),s=(0,k.usePermissionsState)();return l.useMemo(()=>a?[...(0,x._S)((0,x.vn)((0,x.QM)(t.unclaimedFilesWithChangesInIDB,s),e),e),...t.unclaimedFilesCreatedOffline]:[],[a,t.unclaimedFilesWithChangesInIDB,t.unclaimedFilesCreatedOffline,e,s])}(),t=(0,s.d4)(e=>e.autosave.nextGarbageCollectionTimestamp),n=(0,C.iZ)(),o=null==n?void 0:n.id;return o&&n?G(e,{[o]:a},t,[n],!0):null}function Q(e){let a=(0,s.wA)(),[t,n]=l.useState(!1),[o,i]=l.useState(!1),r=async()=>{try{for(let a of e.users){let e=null==a?void 0:a.id;e&&await (0,x.go)((0,T.cu)(e))}}finally{i(!0)}},m=()=>{n(!0)};if(o)return l.createElement(R.aF,{className:S.yl,size:384,tintedModalBackground:!0},l.createElement(f.s_,{dispatch:a}),l.createElement("div",{className:S.DD},l.createElement(h.Tx,{id:"autosave.logout.offline_changes"})),l.createElement("div",{className:S.rf},l.createElement(h.Tx,{id:"autosave.logout.offline_changes_discarded"})),l.createElement("div",{className:S.Vw},l.createElement(E.nR,{onClick:e.onLogOut},l.createElement(h.Tx,{id:"autosave.logout.log_out"}))));if(0===Object.values(e.files).length&&e.loaded)return l.createElement(R.aF,{className:S.yl,size:384,tintedModalBackground:!0},l.createElement(f.s_,{dispatch:a}),l.createElement("div",{className:S.DD},l.createElement(h.Tx,{id:"autosave.logout.offline_changes"})),l.createElement("div",{className:S.rf},l.createElement(h.Tx,{id:"autosave.logout.offline_changes_synced"})),l.createElement("div",{className:S.Vw},l.createElement(E.nR,{onClick:e.onLogOut},l.createElement(h.Tx,{id:"autosave.logout.log_out"}))));if(t)return G(a,e.files,e.nextGarbageCollectionTimestamp,e.users,!1,()=>{n(!1)});{let t;let s=c.eD?(0,h.t)("autosave.logout.log_out_text.desktop"):(0,h.t)("autosave.logout.log_out_text.web");return t=c.eD?l.createElement("div",{className:S.AX},l.createElement("div",{className:S.r_},l.createElement(E.s6,{onClick:r},l.createElement(h.Tx,{id:"autosave.logout.discard_and_logout"}))),l.createElement("div",{className:S.Fz},l.createElement(E.nR,{onClick:()=>{a(p.Lo())}},l.createElement(h.Tx,{id:"autosave.logout.cancel"})),l.createElement(E.nR,{onClick:m},l.createElement(h.Tx,{id:"autosave.logout.show_changes"})))):l.createElement("div",{className:S.AX},l.createElement("div",{className:S.r_},l.createElement(E.s6,{onClick:r},l.createElement(h.Tx,{id:"autosave.logout.discard"}))),l.createElement("div",{className:S.Fz},l.createElement(E.nR,{onClick:e.onLogOut},l.createElement(h.Tx,{id:"autosave.logout.log_out"})),l.createElement(E.$$,{onClick:m},l.createElement(h.Tx,{id:"autosave.logout.sync_changes"})))),l.createElement(R.aF,{className:S.yl,size:424,tintedModalBackground:!0},l.createElement(f.s_,{dispatch:a}),l.createElement("div",{className:S.DD},l.createElement(h.Tx,{id:"autosave.has_changes.sync_offline_changes"})),l.createElement("div",{className:S.rf},s),t)}}function H(e){let{multiUserUnsyncedFiles:a,multiUserGarbageCollectionTimestamp:t,loaded:n,autosaveFilesToDelete:o}=function(e){let a=(0,s.wA)(),[t,n]=l.useState({multiUserGarbageCollectionTimestamp:0,multiUserUnsyncedFiles:{},loaded:!1,autosaveFilesToDelete:[]});return l.useEffect(()=>{let a=async()=>{try{let a=await (0,x.ZW)((0,i.WI)(e.map(e=>null==e?void 0:e.id))),t={},l=[],s=[];for(let[e,l]of Object.entries(a)){for(let a of l.unsyncedFiles)s.push(j(e,a));for(let a of l.newFiles)e in t||(t[e]=[]),t[e].push(a)}for(let e of(await Promise.all(s))){let a=e.userID;e.shouldDeleteFile?l.push({userID:a,fileKey:e.unsyncedFile.fileKey}):e.figFile&&(a in t||(t[a]=[]),t[a].push({type:"autosave-file",fileKey:e.figFile.key,lastUpdatedAt:e.unsyncedFile.lastUpdatedAt,file:e.figFile}))}let o=Math.min(...Object.values(a).map(e=>e.nextGarbageCollectionTimestamp));n({multiUserGarbageCollectionTimestamp:o,multiUserUnsyncedFiles:t,loaded:!0,autosaveFilesToDelete:l})}catch(e){e instanceof Error?((0,u.x1)("Autosave","Failed to call autosave callback",{name:e.name,message:e.message}),(0,u.$D)(v.e.SCENEGRAPH_AND_SYNC,e)):(0,u.$D)(v.e.SCENEGRAPH_AND_SYNC,Error("Failed to call autosave callback"))}};return w.hp.register(w.a,a),a(),function(){w.hp.unregister(w.a,a)}},[a,e]),t}(e.users);return(0,C.TA)()?l.createElement(Q,{loaded:n,nextGarbageCollectionTimestamp:t,files:a,onLogOut:()=>{for(let e of o)(0,x.go)((0,T.Zt)(e.userID,e.fileKey)).catch(e=>{(0,u.$D)(v.e.UNOWNED,Error("Failed to delete autosave data for sessions"))});e.onLogOut()},users:e.users}):null}K.displayName="HasAutosaveChangesModal";let X=e=>{let a=Math.floor(((0,x.bD)()-(Date.now()-e))/864e5);return a>5?null:a<1?l.createElement(h.Tx,{id:"autosave.has_changes.expiry_text_shortly"}):l.createElement(h.Tx,{id:"autosave.has_changes.expiry_text_days",days:a})};H.displayName="AutosaveLogOutModal"},985395:(e,a,t)=>{t.r(a),t.d(a,{AutosaveNewFileAlreadyOpenModal:()=>u});var l=t(411855),s=t(188507),n=t(169614),o=t(304913),i=t(959875),r=t(402791),c=t(705715),m=t(905618),d=t(282688);function u(e){let a=(0,s.wA)();return(0,l.useEffect)(()=>(0,n.sx)("New Autosave File Already Open Modal Shown")),l.createElement(m.aF,{size:360,tintedModalBackground:!0},l.createElement("div",{className:d.DD},l.createElement(r.Tx,{id:"autosave.file_already_open_modal.title"})),l.createElement("div",{className:d.rf},l.createElement(r.Tx,{id:"autosave.file_already_open_modal.body",fileName:l.createElement("span",{className:i.cx.fontSemiBold.$},e.file.name)})),l.createElement("div",{className:d.Vw},l.createElement(o.nR,{onClick:()=>a(c.Ce())},l.createElement(r.Tx,{id:"general.ok"}))))}u.displayName="AutosaveNewFileAlreadyOpenModal"}}]);
//# debugId=56548980-f0e5-5cde-8921-77bdcccc160d
//# sourceMappingURL=https://admin.figma.com/admin/webpack-artifacts/9562e6d217a006a86a5f824863c2f98093e36276/autosave-f75a79d0db404ba1.min.js.map