"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[800],{50800:(_,d,t)=>{t.r(d),t.d(d,{default:()=>D,useConfirmAccessMutation:()=>y,useGetActiveUserDashboardsQuery:()=>A,useGetActiveUsersQuery:()=>g,useRequestAccessMutation:()=>T});var u=t(17172),l=t(32264),n=t(82467),o=t(3169),c=t(8484),h=t(72686),p=t(19042);function r(a){return typeof a=="object"&&a!=null&&"error"in a}function E(a){return r(a)&&(0,u.NF)(a.error)}const v=h.Sm.injectEndpoints({endpoints:a=>({requestAccess:a.mutation({query:s=>({url:"/public/dashboards/share/request-access",method:"POST",data:s})}),confirmAccess:a.mutation({query:({magicLinkToken:s,accessToken:e})=>({url:`/public/dashboards/share/${s}`,method:"POST"}),async onQueryStarted({accessToken:s},{dispatch:e,queryFulfilled:i}){try{await i,e((0,n.dx)((0,o.tZ)((0,c.t)("public-dashboard.email-sharing.success-confirm-access","Access confirmed!")))),window.location.assign(l.$.appSubUrl+`public-dashboards/${s}`)}catch(m){if(E(m)){const{data:{messageId:b}}=m.error;b&&Object.values(p.b5).includes(b)&&window.location.assign(l.$.appSubUrl+`public-dashboards/${s}/request-access?error=${b}`)}}}}),addRecipient:a.mutation({query:({recipient:s,uid:e})=>({url:`/public-dashboards/${e}/share/recipients`,method:"POST",data:{recipient:s}}),async onQueryStarted(s,{dispatch:e,queryFulfilled:i}){await i,e((0,n.dx)((0,o.tZ)((0,c.t)("public-dashboard.email-sharing.success-send-recipient-invitation","The email invitation has been sent."))))},invalidatesTags:(s,e,{dashboardUid:i})=>[{type:"PublicDashboard",id:i}]}),deleteRecipient:a.mutation({query:({uid:s,recipientUid:e})=>({url:`/public-dashboards/${s}/share/recipients/${e}`,method:"DELETE"}),async onQueryStarted({recipientEmail:s},{dispatch:e,queryFulfilled:i}){await i,e((0,n.dx)((0,o.tZ)((0,c.t)("public-dashboard.email-sharing.success-revoke-access-title","Access Revoked"),(0,c.t)("public-dashboard.email-sharing.success-revoke-access-description","You have successfully revoked access for {{recipientEmail}}.",{recipientEmail:s}))))},invalidatesTags:(s,e,{dashboardUid:i})=>[{type:"PublicDashboard",id:i},"UsersWithActiveSessions","ActiveUserDashboards"]}),reshareAccessToRecipient:a.mutation({query:({uid:s,recipientUid:e})=>({url:`/public-dashboards/${s}/share/recipients/${e}`,method:"PATCH"}),async onQueryStarted(s,{dispatch:e,queryFulfilled:i}){await i,e((0,n.dx)((0,o.tZ)((0,c.t)("public-dashboard.email-sharing.success-resend-recipient-invitation","The email invitation has been resent."))))}}),getActiveUsers:a.query({query:()=>({url:"/public-dashboards/share/users?status=active"}),providesTags:["UsersWithActiveSessions"]}),getActiveUserDashboards:a.query({query:s=>({url:`/public-dashboards/share/users/${s}/dashboards?status=active`}),providesTags:(s,e,i)=>[{type:"ActiveUserDashboards",id:i}]}),revokeAllAccess:a.mutation({query:({email:s})=>({url:`/public-dashboards/share/users/${s}`,method:"DELETE"}),async onQueryStarted({email:s},{dispatch:e,queryFulfilled:i}){await i,e((0,n.dx)((0,o.tZ)((0,c.t)("public-dashboard.email-sharing.success-revoke-all-accesses-title","Access Revoked"),(0,c.t)("public-dashboard.email-sharing.success-revoke-all-accesses-description","{{email}}'s access to all public dashboards has been successfully removed.",{email:s}))))},invalidatesTags:["UsersWithActiveSessions"]})}),overrideExisting:!0}),{useRequestAccessMutation:T,useGetActiveUserDashboardsQuery:A,useGetActiveUsersQuery:g,useConfirmAccessMutation:y}=v,D=v},19042:(_,d,t)=>{t.d(d,{Z:()=>p,b5:()=>u});var u=(r=>(r.NOT_FOUND_MAGIC_LINK="publicdashboards.magicLinkNotFound",r.EXPIRED_MAGIC_LINK="publicdashboards.magicLinkExpired",r))(u||{}),l=(r=>(r.INTERNAL_SERVER_ERROR="publicdashboards.internalServerError",r.INVALID_SESSION="publicdashboards.invalidSession",r.EXPIRED_SESSION="publicdashboards.sessionExpired",r))(l||{});const n={title:"Request access",description:"You'll receive an email with a one-time link."},o="Something went wrong",c="To request access to the dashboard again, enter your email. You'll receive an email with a one-time link.",h={"publicdashboards.internalServerError":o,"publicdashboards.magicLinkNotFound":"This link has expired or already been used","publicdashboards.magicLinkExpired":"This magic link has expired","publicdashboards.invalidSession":"You no longer have access","publicdashboards.sessionExpired":"Your access has expired"},p=r=>r?{title:h[String(r)]||o,description:c}:n}}]);

//# sourceMappingURL=800.601b4de442828e777692.js.map