1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-PifewLW3.css","assets/ui-vendor-B-kHA1jU.css","assets/app-shared-components-Dq4d84mH.css","assets/tab-navigation-BtI256XZ.css","assets/card-connection-DtFv9TnT.css","assets/integration-management-settings-BSShIF9D.css","assets/integration-management-mappings-752TZk78.css","assets/connection-slide-information-C9dOP84f.css"])))=>i.map(i=>d[i]); 2import{_ as s}from"./vite-preload-helper-D3tSqqZC.js";import l from"./tab-navigation-CKeCeIy0.js";import{j as h,a as r}from"./app-shared-components-B1XGZkSg.js";import{E as o}from"./app-core-DRGx_N2S.js";import{v as d}from"./e26-send-reminder-exclamation-CiGtMjU2.js";import{A as u}from"./vue-vendor-D2uZR6iP.js";import"./app-helpers-DljACJkm.js";import"./legacy-vendor-B2-6Z0ry.js";import"./utility-vendor-BTpr5n3p.js";import"./vendor-BUFu9pr8.js";import"./app-board-core-CB7D-0gM.js";import"./app-store-BefPi7VA.js";import"./ui-vendor-1abOEsDp.js";import"./app-marked-CwQnGa_G.js";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};i.SENTRY_RELEASE={id:"22139a6a3f3157273dab84737000bf4ba7278475"};var t=new i.Error().stack;t&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[t]="17758457-87b2-4a47-950e-a7ff188fcb36",i._sentryDebugIdIdentifier="sentry-dbid-17758457-87b2-4a47-950e-a7ff188fcb36")}catch{}})();const p=()=>s(()=>import("./app-shared-components-B1XGZkSg.js").then(i=>i.a9),__vite__mapDeps([0,1,2])),g=()=>s(()=>import("./tab-navigation-CKeCeIy0.js"),__vite__mapDeps([0,1,2,3])),m=()=>s(()=>import("./card-connection-DLBwA5ud.js"),__vite__mapDeps([4])),f=()=>s(()=>import("./app-shared-components-B1XGZkSg.js").then(i=>i.a2),__vite__mapDeps([0,1,2])),v=()=>s(()=>import("./app-shared-components-B1XGZkSg.js").then(i=>i.a0),__vite__mapDeps([0,1,2])),y=()=>s(()=>import("./n15-unsuscribe-list-svg--ea-ESEG.js"),[]),C=()=>s(()=>import("./i21-checkmark-circle-svg-Du0WOa3a.js"),[]),b=()=>s(()=>import("./integration-management-settings-v38tssho.js"),__vite__mapDeps([0,1,2,5])),_=()=>s(()=>import("./integration-management-mappings-DVqnvgrG.js"),__vite__mapDeps([6])),I=()=>s(()=>import("./connection-slide-information-D94i9wxf.js"),__vite__mapDeps([7])),w={components:{"app-switch":p,"tab-navigation":g,"card-connection":m,"app-input":f,"app-button":v,"n15-unsuscribe-list-svg":y,"i21-checkmark-circle-svg":C,"integration-management-settings":b,"connection-slide-information":I,"integration-management-mappings":_,"app-tour":h},data(){return{actionUrl:"https://help.glasshive.com/en/collections/6976296-connectwise-psa-integration",tourSteps:[{target:"#tab-nav-2",content:"Now that you have integrated your ConnectWise account with GlassHive, your next objective will be to map which data you would like to have synced.",title:"ConnectWise Integration",header:{title:"<div>ConnectWise Integration1<s3-close-svg /></div>"},params:{placement:"right",highlight:!0,enableScrolling:!1}},{target:"#mapping-cards-tour",content:"We recommend that you map out each category before you run a sync as some categories depend on it.",title:"ConnectWise Integration",params:{placement:"top",highlight:!0,enableScrolling:!1}},{target:"#tab-nav-3",content:"In the Settings you will find options for how you would like your data to sync and where do you want your data to sync from.",title:"ConnectWise Integration",params:{placement:"right",highlight:!0,enableScrolling:!1}},{target:"#nav-toogle-tour",content:"Should you want to, you could disable your integration by switching this button to off. Your mappings and settings will be saved, and any data that was previously synced will remain in our system.",title:"ConnectWise Integration",params:{placement:"right",highlight:!0,enableScrolling:!1}}],tourOptions:{useKeyboardNavigation:!0,enableScrolling:!1},callbacks:{onSkip:()=>{console.log("onSkip")},onFinish:()=>{console.log("onFinish")},onStop:()=>{console.log("onStop")},onStart:()=>{console.log("onStart")},onPreviousStep:()=>{console.log("onPreviousStep")},onNextStep:()=>{console.log("onNextStep")}},iconActive:null,isConnecting:!1,isConnectionSuccessful:null,hasCheckedConnection:!1,settingsGeneral:null,integrationId:null,isEnabled:!0,selectedNav:null,loginSite:"",companyName:"",publicApiKey:"",privateApiKey:"",isValid:!0,settingsChanged:!1,hashRoute:"",navItems:[{key:"tab-nav-1",label:"Connection",hash:""}],isLoading:!1}},computed:{routeBaseUrl(){return this.$store.getters.routeBaseUrl},clientId(){return this.$store.state.context.client.id},clientUserId(){return this.$store.state.user.id},isConnectWiseInformationValid(){return this.loginSite!==""&&this.companyName!==""&&this.publicApiKey!==""&&this.privateApiKey!==""},manageConnectionLink(){return this.routeBaseUrl+"/Integrations/ConnectWise/Manage/Connection"}},watch:{selectedNav:{handler:function(i,t){this.navigateTab(i,t)},deep:!0},loginSite(){this.resetConnectSubmissionState()},companyName(){this.resetConnectSubmissionState()},publicApiKey(){this.resetConnectSubmissionState()},privateApiKey(){this.resetConnectSubmissionState()}},created(){this.getData(),this.selectedNav=this.navItems[0],o.$on("toggle",this.toggleDisabledConnect)},mounted(){this.hashRoute=this.$route.hash.slice(1,this.$route.hash.length)},destroyed(){o.$off("toggle",this.toggleDisabledConnect)},methods:{navigateTab(i,t){t!=null&&t.key==="tab-nav-3"&&t.key!==i.key&&this.settingsChanged&&(this.selectedNav=t,o.$emit("show-unsaved-settings-popup",i))},changeTabConfirm(i){this.selectedNav=i},handleCollapse(){this.collapsed=!this.collapsed},resetConnectSubmissionState(){this.isConnecting||(this.isConnectionSuccessful||this.hasCheckedConnection)&&(this.isConnectionSuccessful=null,this.hasCheckedConnection=!1)},getData(){this.getIntegrationId().then(this.getIntegrationSettingsConfig).then(this.getConnectWiseConnectionStatus).catch(i=>{i&&this.$helpers.showFailNotification(i)})},getIntegrationId(){return this.isLoading=!0,new Promise((i,t)=>{this.$api.get(`/ms/cw-api/v1/credentials/${this.clientId}`).then(e=>{this.integrationId=e.data.Id?e.data.Id:null,this.loginSite=e.data.Url,this.companyName=e.data.CompanyId,this.publicApiKey=e.data.PublicKey,this.privateApiKey=e.data.PrivateKey,this.isConnectWiseInformationValid&&
2(this.isValid=!0),this.isEnabled||t(),i()}).catch(e=>{if(e.response.status===404||e.response.status===503){i();return}t(`An error occurred getting your ConnectWise integration. Please ensure your credentials are correct and up to date <strong><a href="${this.manageConnectionLink}">here</a><strong>.`)}).finally(()=>{this.isLoading=!1})})},getIntegrationSettingsConfig(){return new Promise((i,t)=>{this.integrationId?this.$api.get(`/ms/cw-api/v1/integrationsettings/${this.clientId}`).then(e=>{const n=e.data.data;if(this.isEnabled=n.IsActive,this.settingsGeneral={syncMode:n.SyncMode,syncType:n.SyncType,updatedByUserId:n.UpdatedByUserId},!this.isEnabled){const a=this.$moment(n.UpdatedAt);this.getUserInfoForOnOffModal(this.settingsGeneral.updatedByUserId,a)}i()}).catch(()=>{t("An error occurred getting your ConnectWise integration settings.")}).finally(()=>{this.isLoading=!1}):i()})},getConnectWiseConnectionStatus(){return new Promise((i,t)=>{this.integrationId?this.$api.post(`/ms/cw-api/v1/credentials/${this.clientId}/test`).then(()=>{this.iconActive="Connection",this.integrationId&&this.navItems.length<2&&(this.navItems.push({key:"tab-nav-2",label:"Mappings",hash:"Mappings"},{key:"tab-nav-3",label:"Settings",hash:"Settings"}),this.hashRoute&&(this.selectedNav=this.navItems.find(e=>e.hash===this.hashRoute)??this.navItems[0])),i()}).catch(()=>{this.iconActive="noConnection",this.isConnectionSuccessful=!1,this.hasCheckedConnection=!0,t(`An error occurred getting your ConnectWise connection status. Please ensure your credentials are correct and up to date <strong><a href="${this.manageConnectionLink}">here</a><strong>.`)}):(this.iconActive="noConnection",i())})},verifyDataToConnect(){if(!this.isConnectWiseInformationValid){this.isValid=!1;return}this.isConnecting=!0,this.verifyConnection(),setTimeout(()=>{this.connect()},3e3)},connect(){const i={Url:this.loginSite,CompanyId:this.companyName,PrivateKey:this.privateApiKey,PublicKey:this.publicApiKey},t=this.integrationId!==null;(t?this.$api.put(`/ms/cw-api/v1/credentials/${this.clientId}`,i):this.$api.post(`/ms/cw-api/v1/credentials/${this.clientId}`,i)).then(n=>(t||(this.integrationId=n.data?.Id??n.Id),this.isValid=!0,this.testConnection())).then(n=>{this.$modal.hide("verify-modal"),n&&(t||this.getIntegrationSettingsConfig().catch(()=>{}),this.successModal())}).catch(n=>{this.isConnecting=!1,this.isValid=!1,this.iconActive="noConnection",this.$modal.hide("verify-modal");let a="There was a server error while testing your ConnectWise integration.";n.response?.status===400?a=`${a} ${n.response.data.message}: ${n.response.data.data[0]?.error}`:a=`${a} Please ensure all fields contain correct information.`,this.$helpers.showFailNotification(a,{error:n})})},testConnection(){return this.hasCheckedConnection=!0,this.$api.post(`/ms/cw-api/v1/credentials/${this.clientId}/test`).then(()=>(this.isConnectionSuccessful=!0,this.iconActive="Connection",this.isConnecting=!1,this.navItems.length<2&&this.navItems.push({key:"tab-nav-2",label:"Mappings",hash:"Mappings"},{key:"tab-nav-3",label:"Settings",hash:"Settings"}),!0)).catch(i=>(this.isConnecting=!1,this.isConnectionSuccessful=!1,this.iconActive="noConnection",this.$helpers.showFailNotification("An error occurred while authenticating your account. Ensure the credentials are correct and have the proper permissions.",{error:i}),!1))},integrationOnOff(){this.$api.msPatch(`/ms/cw-api/v1/integrationsettings/${this.clientId}`,{IsActive:this.isEnabled,SyncMode:this.settingsGeneral.syncMode,SyncType:this.settingsGeneral.syncType}).then(()=>{this.isEnabled?(this.getData(),o.$emit("active-integration")):this.getUserInfoForOnOffModal(this.clientUserId)}).catch(i=>{this.isEnabled=!this.isEnabled,this.$helpers.showFailNotification("There was a server error while updating your ConnectWise integration.",{error:i})}).finally(()=>{this.isLoading=!1})},getUserInfoForOnOffModal(i,t=null){this.$api.get(`/service/Users?$filter=Id eq '${i}'&$select=Id,FirstName,LastName,Email,ProfileImageUrl&$count=true`).then(e=>{if(e.data.value.length){let n=e.data.value[0],a=t===null?this.$moment():t;const c={email:n.Email,userName:`${n.FirstName} ${n.LastName}`,profileImageUrl:n.ProfileImageUrl};this.activeOnOffModal(c,a)}}).catch(()=>{this.$helpers.showFailNotification("There was a server error while updating your ConnectWise integration.")})},toggleDisabledConnect(){this.isEnabled=!this.isEnabled,this.integrationOnOff()},activeOnOffModal(i,t){this.$modal.show(r,{topButton:!0,closeButton:!0,animation:"moon-sun",type:"alert-popup",title:"This Integration has been Disabled",isOutsideButton:!0,element:{name:"integration-enable-disable-popup",userName:i.userName,email:i.email,disabledDate:t,profileImageUrl:i.profileImageUrl,enabled:!1}},{name:"on-off-modal",height:this.$helpers.setPopupHeight(),width:this.$helpers.setPopupWidth(),clickToClose:!1})},verifyConnection(){this.$modal.show(r,{topButton:!0,title:"Verifying Credentials",content:"<p>Alrighty, we're going to go ahead and verify your credentials! <br/> This only take a few seconds...</p>",isOutsideButton:!0,closeButton:!1,element:{name:"loading-animation-popup"}},{name:"verify-modal",height:this.$helpers.setPopupHeight(),width:this.$helpers.setPopupWidth(),clickToClose:!1})},successModal(){const i={confirm:{label:"Show me the Tour",action:()=>this.showTour()},tertiary:{label:"No Thanks",action:()=>null}};this.$modal.show(r,{topButton:!0,title:"Success!",content:"<p>Sweet! You have successfully linked you ConnectWise with GlassHive. Would you like to take a tour of the integration</p>",isOutsideButton:!0,closeButton:!1,element:{name:"success-animation-popup"},actions:i},{height:this.$helpers.setPopupHeight(),width:this.$helpers.setPopupWidth(),clickToClose:!1})},showTour(){this.selectedNav=this.navItems[1],this.$tours.myTour&&this.$tours.myTour.start()},settingsUpdated(i){this.settingsChanged=i}}};var S=function(){var t=this,e=t._self._c;return e("div",{staticClass:"connectwise-manage-view"},[e("div",{class:["row"]},[e("div",{staticClass:"row header-container"},[e("div",{staticClass:"col-md-12 heading-column"},[e("div",{staticClass:"heading"},[e("h2",[t._v("ConnectWise Integration Management")]),!t.isLoading&&t.integrationId?e("div",{staticClass:"toggle"},[e("app-switch",{attrs:{id:"nav-toogle-tour",size:"large",value:t.isEnabled},on:{input:function(n){return t.toggleDisabledConnect()}}}
2)],1):t._e()])]),e("div",{staticClass:"col-md-12 heading-nav cw-nav-tab learn-more-nav-btn"},[e(l,{attrs:{options:t.navItems},scopedSlots:t._u([{key:"custom-icon",fn:function(){return[e("div",{staticClass:"icon-container"},[t.iconActive==="noConnection"?e("n15-unsuscribe-list-svg",{attrs:{color:"#EB7E0A"}}):t._e(),t.iconActive==="Connection"?e("i21-checkmark-circle-svg"):t._e()],1)]},proxy:!0}]),model:{value:t.selectedNav,callback:function(n){t.selectedNav=n},expression:"selectedNav"}}),e("div",{staticClass:"learn-more-btn"},[e("a",{staticClass:"transparent-btn btn",attrs:{href:t.actionUrl,target:"_blank"}},[t._v(" Learn More ")])])],1)]),t.selectedNav.label==="Connection"?e("div",{staticClass:"cw-connection-content"},[e("h3",[t._v("Connection")]),e("p",[t._v(" This is your connections status. On this page you'll be able to test your credentials. If you need help generating API Keys, check out the guide on the right-hand side of this page for assistance. "),e("br"),e("br"),e("span",[t._v(" Once you have successfully input your credentials you will see a green status marker "),e("i21-checkmark-circle-svg"),t._v(" next to the Connection Tab. Each time you come to this page we automatically check if your credentials are valid. A red exclamation point "),e("span",{staticClass:"fail-icon-container"},[e("img",{staticClass:"fail-icon",attrs:{src:d,alt:"fail"}})]),t._v(' will appear if we find an error, or if your integration has disconnected. If that happens, simply add your credentials again and click on "Connect".')],1)]),e("card-connection",{attrs:{title:"ConnectWise Information"}},[e("app-input",{attrs:{"is-valid":t.isValid,label:"Site Used For login",description:"(Do not include http:// or https://)"},model:{value:t.loginSite,callback:function(n){t.loginSite=n},expression:"loginSite"}}),e("app-input",{attrs:{"is-valid":t.isValid,label:"Company used for Login"},model:{value:t.companyName,callback:function(n){t.companyName=n},expression:"companyName"}}),e("app-input",{attrs:{"is-valid":t.isValid,label:"Public API Key"},model:{value:t.publicApiKey,callback:function(n){t.publicApiKey=n},expression:"publicApiKey"}}),e("app-input",{attrs:{type:"password","is-valid":t.isValid,label:"Private API Key"},model:{value:t.privateApiKey,callback:function(n){t.privateApiKey=n},expression:"privateApiKey"}}),e("div",{directives:[{name:"show",rawName:"v-show",value:!t.isValid,expression:"!isValid"}],staticClass:"red-accent"},[t._v(" *Please fill out all of the fields. ")]),e("div",{staticClass:"button-container"},[e("app-button",{attrs:{disabled:t.isConnecting||t.isConnectionSuccessful,loading:t.isConnecting},on:{click:t.verifyDataToConnect}},[!t.isConnectionSuccessful&&t.hasCheckedConnection?e("span",[t._v("Retry")]):t.isConnectionSuccessful?e("span",[t._v("Success")]):t.isConnecting?e("span",[t._v("Connecting")]):e("span",[t._v("Connect")])])],1)],1)],1):t._e(),t.selectedNav.label==="Mappings"?e("div",{attrs:{id:"mappings"}},[e("integration-management-mappings",{attrs:{"sync-mode":t.settingsGeneral?t.settingsGeneral.syncMode:"","sync-type":t.settingsGeneral?t.settingsGeneral.syncType:""}})],1):t._e(),t.selectedNav.label==="Settings"?e("div",{attrs:{id:"test"}},[e("integration-management-settings",{on:{"settings-updated":t.settingsUpdated,"confirm-leave":t.changeTabConfirm,"refresh-settings":t.getIntegrationSettingsConfig}})],1):t._e()]),t.selectedNav.label==="Connection"?e("connection-slide-information"):t._e(),e("app-tour",{attrs:{steps:t.tourSteps,options:t.tourOptions,callbacks:t.callbacks}})],1)},$=[],A=u(w,S,$,!1,null,null);const B=A.exports;export{B as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.