{"version":3,"sources":["webpack:///./src/components/RemoveTeammate.vue?4553","webpack:///./src/components/RemoveTeammate.vue","webpack:///./src/components/RemoveTeammate.vue?3e8e","webpack:///./src/components/RemoveTeammate.vue?ac6f"],"names":["render","_vm","this","_h","$createElement","_c","_self","staticClass","attrs","_v","_s","selectedUser","email","loading","billedUsers","on","removeSeat","removeUser","staticRenderFns","Vue","extend","props","type","Object","default","data","freeUsers","newPlan","newUsers","mounted","init","computed","mapGetters","getLimit","invitations","user","users","currentPlan","$store","getters","plan","invitationCount","filter","x","role_id","includes","length","userCount","userLimit","methods","getPlanUsers","oldUsers","Promise","all","dispatch","id","then","response","$emit","title","text","icon","color","closeable","width","$vuetify","breakpoint","mdAndUp","component","VBtn","VCol","VContainer","VRow"],"mappings":"wHAAA,IAAIA,EAAS,WAAa,IAAIC,EAAIC,KAASC,EAAGF,EAAIG,eAAmBC,EAAGJ,EAAIK,MAAMD,IAAIF,EAAG,OAAOE,EAAG,cAAc,CAACE,YAAY,OAAOC,MAAM,CAAC,eAAe,KAAK,CAACH,EAAG,QAAQ,CAACG,MAAM,CAAC,aAAa,GAAG,MAAQ,SAAS,QAAU,WAAW,CAACH,EAAG,QAAQ,CAACG,MAAM,CAAC,KAAO,OAAO,CAACH,EAAG,QAAQ,CAACE,YAAY,QAAQ,CAACN,EAAIQ,GAAG,oCAAoCR,EAAIS,GAAGT,EAAIU,aAAaC,OAAO,6GAA6GP,EAAG,QAAQ,CAACG,MAAM,CAAC,QAAU,UAAU,CAACH,EAAG,QAAQ,CAACE,YAAY,YAAYC,MAAM,CAAC,MAAQ,UAAU,QAAUP,EAAIY,QAAQ,SAAWZ,EAAIa,YAAc,GAAKb,EAAIY,SAASE,GAAG,CAAC,MAAQd,EAAIe,aAAa,CAACf,EAAIQ,GAAG,yCAAyC,GAAGJ,EAAG,QAAQ,CAACA,EAAG,IAAI,CAACJ,EAAIQ,GAAG,uEAAuEJ,EAAG,QAAQ,CAACG,MAAM,CAAC,QAAU,UAAU,C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AY,EAAKA,UAGjBC,EAAY,EAAKA,UAGvBI,QAAQC,IAAI,CACR,EAAKf,OAAOgB,SAAS,0BAA2B,EAAKxC,YAAc,GACnE,EAAKwB,OAAOgB,SAAS,cAAe,EAAK3C,aAAa4C,MACvDC,MAAK,SAACC,GACL,EAAK5C,SAAU,EAGf,EAAK6C,MAAM,UAGX,EAAKpB,OAAOgB,SAAS,aAAc,CAC/BhC,KAAM,UACNqC,MAAO,mBACPC,KAAM,uBAAF,OACA,EAAKjD,aAAaC,MADlB,+IAGAmC,EAAY,EAHZ,YAIAC,EAAY,EAJZ,2BAKAA,EAAYD,EALZ,+CAOJc,KAAM,uBACNC,MAAO,UACPC,WAAW,EACXC,MAAO,EAAKC,SAASC,WAAWC,QAAU,QAAU,aAlChD,8CAsCVlD,WAxDD,WAwDW,yKAEZ,EAAKJ,SAAU,EAGTkC,EAAY,EAAKA,UAGjBC,EAAY,EAAKA,UARX,SAWW,EAAKV,OAAOgB,SAC/B,cACA,EAAK3C,aAAa4C,IAbV,UAWNE,EAXM,OAgBZ,EAAK5C,SAAU,EAGV4C,EAnBO,iDAsBZ,EAAKC,MAAM,UAGX,EAAKpB,OAAOgB,SAAS,aAAc,CAC/BhC,KAAM,UACNqC,MAAO,mBACPC,KAAM,uBAAF,OACA,EAAKjD,aAAaC,MADlB,+DAGAmC,EAAY,EAHZ,YAIAC,EAJA,2BAKAA,GAAaD,EAAY,GALzB,+CAOJc,KAAM,uBACNC,MAAO,UACPC,WAAW,EACXC,MAAO,EAAKC,SAASC,WAAWC,QAAU,QAAU,UAtC5C,kDCpJiX,I,iFCOrYC,EAAY,eACd,EACApE,EACAkB,GACA,EACA,KACA,KACA,MAIa,aAAAkD,EAAiB,QAQhC,IAAkBA,EAAW,CAACC,OAAA,KAAKC,OAAA,KAAKC,aAAA,KAAWC,OAAA","file":"js/remove-teammate.fb404ee4.js","sourcesContent":["var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('v-container',{staticClass:\"mx-3\",attrs:{\"grid-list-md\":\"\"}},[_c('v-row',{attrs:{\"no-gutters\":\"\",\"align\":\"center\",\"justify\":\"center\"}},[_c('v-col',{attrs:{\"cols\":\"12\"}},[_c('v-row',{staticClass:\"mr-2\"},[_vm._v(\" Are you sure you wish to remove \"+_vm._s(_vm.selectedUser.email)+\" teammate from your MessageDesk workspace? Once removed, this user will lose all access to MessageDesk \")]),_c('v-row',{attrs:{\"justify\":\"start\"}},[_c('v-btn',{staticClass:\"mt-5 mb-1\",attrs:{\"color\":\"primary\",\"loading\":_vm.loading,\"disabled\":_vm.billedUsers < 1 || _vm.loading},on:{\"click\":_vm.removeSeat}},[_vm._v(\" Remove User and Remove Paid Seat \")])],1),_c('v-row',[_c('i',[_vm._v(\"Best if you do NOT plan on replacing the user in your workspace\")])]),_c('v-row',{attrs:{\"justify\":\"start\"}},[_c('v-btn',{staticClass:\"mt-5 mb-1\",attrs:{\"color\":\"primary\",\"loading\":_vm.loading,\"disabled\":_vm.loading},on:{\"click\":_vm.removeUser}},[_vm._v(\" Remove User \")])],1),_c('v-row',[_c('i',[_vm._v(\"Best if you plan on inviting a new user to take their place\")])])],1)],1)],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport Vue, { PropType } from 'vue'\nimport Invitation from '@/types/Invitation.interface'\nimport { mapGetters } from 'vuex'\nimport { Plan } from '@/types/Subscription.interface'\nimport User from '@/types/User.interface'\nexport default Vue.extend({\n props: {\n // Decides if this is for the auth or not, defaults to being for auth\n selectedUser: {\n type: Object as PropType,\n default: null\n }\n },\n data() {\n return {\n loading: null,\n freeUsers: null,\n newPlan: null,\n newUsers: null\n }\n },\n mounted() {\n this.init()\n },\n computed: {\n ...mapGetters({\n getLimit: 'getLimit',\n invitations: 'teammatesInvitations',\n user: 'user',\n users: 'teammatesUsers'\n }),\n billedUsers(): number {\n // Return the number of selected users subtracted from the free users for their plan\n return this.newUsers - this.freeUsers\n },\n currentPlan() {\n // Resolve the current pricing plan out of the subscription\n return this.$store.getters.plan\n },\n invitationCount(): number {\n // If no invitations, return 0\n if (!this.invitations) return 0\n\n // Else count the total that aren't snapdesk/messagedesk/support\n return this.invitations.filter(\n (x: Invitation) =>\n x.role_id !== 5 &&\n !x.email.includes('@snapdesk.app') &&\n !x.email.includes('@messagedesk.com')\n ).length\n },\n userCount(): number {\n return this.$store.getters.userCount\n },\n userLimit(): number {\n // Grab our total number of users from our stripe plan\n return this.$store.getters.getLimit('user')\n }\n },\n methods: {\n getPlanUsers(plan: Plan): number {\n // Get the number of free users the subscription allows (including addons)\n const userLimit = this.getLimit('user', true, plan) //seats + plan\n\n // Save the old user count\n this.oldUsers = userLimit\n\n // Get the free users for the plan (not including addons)\n this.freeUsers = this.getLimit('user', false, plan) // Plan\n\n // Return the user limit\n return userLimit\n },\n init(): void {\n // Set the new free user count for the selected plan\n this.newUsers = this.getPlanUsers(this.newPlan)\n },\n async removeSeat(): Promise {\n // Start loading phase for buttons\n this.loading = true\n\n // Saving userCount for pop up\n const userCount = this.userCount\n\n // Saving userLimit for pop up\n const userLimit = this.userLimit\n\n // Wrap two API calls in Promise.all to get faster responses\n Promise.all([\n this.$store.dispatch('subscriptionChangeUsers', this.billedUsers - 1),\n this.$store.dispatch('usersDelete', this.selectedUser.id)\n ]).then((response) => {\n this.loading = false\n\n // Close dialog\n this.$emit('submit')\n\n // Open success dialog\n this.$store.dispatch('dialogOpen', {\n type: 'MESSAGE',\n title: 'Teammate Removed',\n text: `Teammate with email ${\n this.selectedUser.email\n } has been removed successfully.\\n\\nThe monthly fee for this user ($10) has also been removed from your account.\\n\\nYour Team is now ${\n userCount - 1\n }/${userLimit - 1} full. You have ${\n userLimit - userCount\n } open seats remaining on your subscription.`,\n icon: 'bi-check-circle-fill',\n color: 'primary',\n closeable: true,\n width: this.$vuetify.breakpoint.mdAndUp ? '600px' : '400px'\n })\n })\n },\n async removeUser(): Promise {\n // Start loading for buttons\n this.loading = true\n\n // Saving userCount for pop up\n const userCount = this.userCount\n\n // Saving userLimit for pop up\n const userLimit = this.userLimit\n\n // Else, send the delete request to the API\n const response = await this.$store.dispatch(\n 'usersDelete',\n this.selectedUser.id\n )\n\n this.loading = false\n\n // If the request failed, do nothing\n if (!response) return\n\n // Close current dialog\n this.$emit('submit')\n\n // Open success dialog\n this.$store.dispatch('dialogOpen', {\n type: 'MESSAGE',\n title: 'Teammate Removed',\n text: `Teammate with email ${\n this.selectedUser.email\n } has been removed successfully.\\n\\nYour Team is now ${\n userCount - 1\n }/${userLimit} full. You have ${\n userLimit - (userCount - 1)\n } open seats remaining on your subscription.`,\n icon: 'bi-check-circle-fill',\n color: 'primary',\n closeable: true,\n width: this.$vuetify.breakpoint.mdAndUp ? '600px' : '400px'\n })\n }\n }\n})\n","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/ts-loader/index.js??ref--13-3!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./RemoveTeammate.vue?vue&type=script&lang=ts&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/ts-loader/index.js??ref--13-3!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./RemoveTeammate.vue?vue&type=script&lang=ts&\"","import { render, staticRenderFns } from \"./RemoveTeammate.vue?vue&type=template&id=4ed4a0e5&\"\nimport script from \"./RemoveTeammate.vue?vue&type=script&lang=ts&\"\nexport * from \"./RemoveTeammate.vue?vue&type=script&lang=ts&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports\n\n/* vuetify-loader */\nimport installComponents from \"!../../node_modules/vuetify-loader/lib/runtime/installComponents.js\"\nimport { VBtn } from 'vuetify/lib/components/VBtn';\nimport { VCol } from 'vuetify/lib/components/VGrid';\nimport { VContainer } from 'vuetify/lib/components/VGrid';\nimport { VRow } from 'vuetify/lib/components/VGrid';\ninstallComponents(component, {VBtn,VCol,VContainer,VRow})\n"],"sourceRoot":""}