"use strict";(this.webpackChunk_msteams_react_web_client=this.webpackChunk_msteams_react_web_client||[]).push([[504965],{442888:(e,t,o)=>{o.r(t),o.d(t,{TeamsCopilotService:()=>C});var r=o(401368),a=o(135449),s=o(134185);const i="saveCalendarData",l=({coreSettings:e,authenticationService:t,loggerFactory:o})=>{const s=o.newLogger("teamsCopilotServiceEndpoints","services-io-collab-object"),{teamsCopilotServiceEndpoint:i,teamsCopilotServiceResource:l}=e.get(r.w.TeamsCopilotService);return{baseUrlPromise:()=>p(i||"",s),serviceName:a.p.TeamsCopilotService,authResource:e=>t.authorizeRequest(e,l||""),models:{addCopilotResources:c(),saveCalendarData:n(),saveCalendarDataV2:d(),sendConfigurationData:g()}}},c=()=>Promise.resolve({constructRequest:(e,t,o,r)=>({url:u(),body:JSON.stringify(t),method:"POST",headers:h(e,o,r),apiName:"addCopilotResources",correlationId:e}),allowedResponses:[s.bw.HTTP_2XX],transformResponse:async e=>v(e)}),n=()=>Promise.resolve({constructRequest:(e,t,o,r)=>({url:m(),body:JSON.stringify(t),method:"POST",headers:h(e,o,r),apiName:i,correlationId:e}),allowedResponses:[s.bw.HTTP_2XX],transformResponse:async e=>v(e)}),d=()=>Promise.resolve({constructRequest:(e,t,o,r)=>({url:m(),body:JSON.stringify({callId:t.callId,calendarEvent:JSON.parse(t.calendarEvent)}),method:"POST",headers:h(e,o,r),apiName:i,correlationId:e}),allowedResponses:[s.bw.HTTP_2XX],transformResponse:async e=>v(e)}),g=()=>Promise.resolve({constructRequest:(e,t,o,r)=>({url:t.requestUrl,body:t.tcsEndpointUrl,method:"POST",apiName:"sendConfigurationData",headers:h(e,o,r),correlationId:e}),allowedResponses:[s.bw.HTTP_2XX],transformResponse:async e=>v(e)}),h=(e,t,o)=>({"content-type":"application/json;charset=UTF-8","x-ms-correlation-id":e,"x-ms-caller-name":t||"","x-ringoverride":o?.get(r.w.Metadata).ring?.id||""}),p=async(e,t)=>(t.infoToTelemetry?.(`TCS set with baseUrl: ${e}/`,"teams_copilot_service_get_base_url",void 0,!0),`${e}/`),u=()=>"saveagendadata",m=()=>"savecalendardata",v=async e=>({statusCode:e.status,body:await(e.body?.text())});class C{constructor(e,t,o){this.coreSettings=e,this.loggerFactory=t,this.logger=this.loggerFactory.newLogger("TeamsCopilotService","services-io-collab-object"),this._transport=o.createApi(l)}async addCopilotResources(e,t,o){try{const r=await this._transport.addCopilotResources(e,t,o,this.coreSettings);return this.logger.log(`Successfully added resource to Teams Copilot Service $callId: ${t.callId} correlationId: ${e}`),r}catch(e){throw this.logErrorHelper(`Add resources to teams copilot service failed with errorCode: ${e.errorCode},`,"teams_copiilot_service_save_agenda_data"),e}}async saveCalendarData(e,t,o){try{this.logger.log(`Attempting to saveCalendarData for callId: ${t.callId}`);const r=await this._transport.saveCalendarData(e,t,o,this.coreSettings);return this.logger.log(`Successfully added resource to Teams Copilot Service $callId: ${t.callId} correlationId: ${e}`),r}catch(e){throw this.logErrorHelper(`Add resources to teams copilot service failed with errorCode: ${e.errorCode},`,"teams_copiilot_service_save_calendar_data"),e}}async saveCalendarDataV2(e,t,o){try{this.logger.log(`Attempting to saveCalendarData for callId: ${t.callId}`);const r=await this._transport.saveCalendarDataV2(e,t,o,this.coreSettings);return this.logger.log(`Successfully added resource to Teams Copilot Service $callId: ${t.callId} correlationId: ${e}`),r}catch(o){throw this.logger.error(`Ran into error while saving calendar data for callId: ${t.callId} correlationId: ${e}`),o}}async sendConfigurationData(e,t,o){try{this.logger.log("Attempting to invoke sendConfigurationData");const r=await this._transport.sendConfigurationData(e,t,o,this.coreSettings);return this.logger.log(`Successfully sent configuration data to Teams Copilot bot correlationId: ${e}. callId: ${t.callId}`),r}catch(o){throw this.logger.error(`Ran into error  while sending configuration data to Teams Copilot bot correlationId: ${e}.callId: ${t.callId}. errorcode: ${o.code} errormessage: ${o.message}`),o}}logErrorHelper(e,t){this.logger.errorToTelemetry?this.logger.errorToTelemetry(e,t,void 0,!0):this.logger.error(e)}}}}]);
//# sourceMappingURL=https://local.teams.office.com/sourcemaps/hashed-assets/services-teams-copilot-2c75f56384322d8a.js.map