(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-790d3ad6","chunk-11e6cc2b","chunk-2d0baab8"],{2571:function(t,e,n){t.exports=n.p+"img/stripe.5930a97f.svg"},"37ca":function(t,e,n){"use strict";n.r(e);var i=n("8212"),a=n("4ca6"),s=n("ce87"),r=n("132d"),o=n("3a2f"),l=function(){var t=this,e=t._self._c;return e(o["a"],{attrs:{"open-delay":"100",bottom:""},scopedSlots:t._u([{key:"activator",fn:function({on:n,attrs:o}){return[e(a["a"],{attrs:{value:t.showBadge,color:"symbo-pink",dot:"","offset-x":"15","offset-y":"8"}},[e(s["a"],{scopedSlots:t._u([{key:"default",fn:function({hover:a}){return[e(i["a"],t._g(t._b({staticClass:"mr-2",attrs:{color:a?"grey lighten-2":"white",size:"30"},on:{click:function(e){return t.openHelpChat()}}},"v-avatar",o,!1),n),[e("span",{staticClass:"grey--text text--darken-2 text-h7"},[e(r["a"],{staticClass:"text--darken-2",attrs:{size:"22"}},[t._v(t._s(t.icon))])],1)])]}}],null,!0)})],1)]}}])},[t._v(" "+t._s(t.tooltip)+" ")])},c=[],d=n("1bcb"),u={name:"HelpIcon",data:()=>({tooltip:"Help docs and support",icon:"mdi-help-circle",showBadge:!1}),methods:{openHelpChat(){d["a"].$emit("open-help-chat")}},created(){d["a"].$on("unread-intercom-messages",t=>{this.showBadge=t>0})},beforeDestroy(){d["a"].$off("unread-intercom-messages")}},p=u,h=n("2877"),m=Object(h["a"])(p,l,c,!1,null,null,null);e["default"]=m.exports},"7c4c":function(t,e,n){"use strict";n.r(e);var i,a=n("8336"),s=n("132d"),r=n("2fa4"),o=function(){var t=this,e=t._self._c;return e("div",{style:`width: ${t.width}; min-width: ${t.minWidth}`},[""!=t.title?e("div",{staticClass:"d-flex pt-3 font-thiccboi font-weight-bold text-h6"},[t._v(" "+t._s(t.title)+" ")]):t._e(),e("div",{ref:"stripeCardElement",staticClass:"pt-2",attrs:{id:"stripe-card-element"}}),""!=t.terms?e("div",{staticClass:"d-flex pt-1 text-caption grey--text text--darken-1"},[t._v(" "+t._s(t.terms)+" ")]):t._e(),e("div",{staticClass:"d-flex justify-end mt-4"},[t.displaySafeCheckout?e("div",{staticClass:"d-flex align-center"},[e(s["a"],{staticClass:"green--text text--darken-1 pr-1"},[t._v("mdi-shield-lock")]),e("p",{staticClass:"text-semantic-neutral-text-default mb-0 ml-2.5 text-sm font-medium"},[t._v(" Guaranteed safe checkout ")]),t._m(0)],1):t._e(),e(r["a"]),t.hideCancelBtn?t._e():e(a["a"],{on:{click:function(e){return t.$emit("cancel")}}},[t._v(t._s(t.cancelButtonText))]),e(a["a"],{staticClass:"ml-2",attrs:{color:"primary",loading:t.saveMethodLoading},on:{click:function(e){return t.savePaymentMethod()}}},[t._v(" "+t._s(t.saveButtonText)+" ")]),t.showSaveAndAddSeats?e(a["a"],{staticClass:"ml-2",attrs:{color:"primary",loading:t.saveMethodLoading},on:{click:function(e){return t.savePaymentMethod(!0)}}},[t._v(" Start trial & add seats ")]):t._e()],1)])},l=[function(){var t=this,e=t._self._c;return e("div",{staticClass:"bg-semantic-neutral-bg-strong-active ml-4 rounded py-1 px-1.5"},[e("img",{attrs:{src:n("2571")}})])}],c="https://js.stripe.com/v3",d=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,u="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",p=function(){for(var t=document.querySelectorAll('script[src^="'.concat(c,'"]')),e=0;e<t.length;e++){var n=t[e];if(d.test(n.src))return n}return null},h=function(t){var e=t&&!t.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(c).concat(e);var i=document.head||document.body;if(!i)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return i.appendChild(n),n},m=function(t,e){t&&t._registerWrapper&&t._registerWrapper({name:"stripe-js",version:"2.4.0",startTime:e})},f=null,v=null,g=null,y=function(t){return function(){t(new Error("Failed to load Stripe.js"))}},b=function(t,e){return function(){window.Stripe?t(window.Stripe):e(new Error("Stripe.js not available"))}},_=function(t){return null!==f?f:(f=new Promise((function(e,n){if("undefined"!==typeof window&&"undefined"!==typeof document)if(window.Stripe&&t&&console.warn(u),window.Stripe)e(window.Stripe);else try{var i=p();if(i&&t)console.warn(u);else if(i){if(i&&null!==g&&null!==v){var a;i.removeEventListener("load",g),i.removeEventListener("error",v),null===(a=i.parentNode)||void 0===a||a.removeChild(i),i=h(t)}}else i=h(t);g=b(e,n),v=y(n),i.addEventListener("load",g),i.addEventListener("error",v)}catch(s){return void n(s)}else e(null)})),f["catch"]((function(t){return f=null,Promise.reject(t)})))},w=function(t,e,n){if(null===t)return null;var i=t.apply(void 0,e);return m(i,n),i},S=!1,C=function(){return i||(i=_(null)["catch"]((function(t){return i=null,Promise.reject(t)})),i)};Promise.resolve().then((function(){return C()}))["catch"]((function(t){S||console.warn(t)}));var x=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];S=!0;var i=Date.now();return C().then((function(t){return w(t,e,i)}))},k=n("a292"),M={props:{hideCancelBtn:{type:Boolean,default:!1},cancelButtonText:{type:String,default:"Cancel"},showSaveAndAddSeats:{type:Boolean,default:!1},saveButtonText:{type:String,default:"Save"},displaySafeCheckout:{type:Boolean,default:!1},terms:{type:String,default:""},title:{type:String,default:""},width:{type:String,default:"100%"},minWidth:{type:String}},data(){return{stripe:null,elements:null,clientSecret:null,saveMethodLoading:!1,options:{mode:"setup",currency:"usd",captureMethod:"automatic",setupFutureUsage:"off_session"},confirmParams:{}}},computed:{publishableKey(){return"pk_live_51IMItvCV2xCminlZ8cERtX7EAuPtMeFldohyCYbP26hlJ8LcxK8lx0W0MraaTwgUlHgNr9ZGfQCBoth2iqZpCKxH00pATf9Hwd"}},watch:{clientSecret(t){t&&!this.stripe&&this.loadStripeElement()}},methods:{async generatePaymentIntent(){const{stripe_client_secret:t}=await k["a"].getSubscriptionPaymentIntent();this.clientSecret=t},async loadStripeElement(){this.stripe=await x(this.publishableKey),this.elements=this.stripe.elements(this.options);const t=this.elements.create("payment",{layout:{type:"tabs"}});t.mount(this.$refs.stripeCardElement)},async savePaymentMethod(t){if(!this.stripe)return;this.saveMethodLoading=!0;const{error:e}=await this.elements.submit();e?this.handleError(e):this.stripe.confirmSetup({elements:this.elements,clientSecret:this.clientSecret,confirmParams:this.confirmParams,redirect:"if_required"}).then(e=>this.$emit("method-add-success",{saveAndAddSeats:t,paymentMethod:e.setupIntent.payment_method})).catch(t=>this.handleError(t)).finally(()=>this.saveMethodLoading=!1)},handleError(t){console.log("error",t),this.saveMethodLoading=!1,this.$emit("method-add-error",t.message)}},created(){this.generatePaymentIntent(),this.confirmParams.return_url=window.location.href}},P=M,j=n("2877"),O=Object(j["a"])(P,o,l,!1,null,null,null);e["default"]=O.exports},"8d13":function(t,e,n){t.exports=n.p+"img/Symbo_Icon_Primary.3c2fc0ff.svg"},"921b":function(t,e,n){"use strict";n.r(e);var i=n("8336"),a=n("b0af"),s=n("99d9"),r=n("169a"),o=n("132d"),l=n("adda"),c=n("490a"),d=n("2fa4"),u=n("3a2f"),p=function(){var t=this,e=t._self._c;return e(r["a"],{attrs:{value:t.isOpen,fullscreen:t.isOrgAdmin,persistent:"",width:"400"}},[t.isOrgAdmin?e(a["a"],{staticClass:"h-100 overflow-hidden"},[e(s["d"],{staticClass:"py-3 border-b-1 d-flex align-center"},[e(l["a"],{attrs:{src:n("8d13"),"max-height":"32","max-width":"32"}}),e("div",{staticClass:"ml-3 font-weight-bold"},[t._v("Resume subscription")]),e(d["a"]),e(u["a"],{attrs:{bottom:""},scopedSlots:t._u([{key:"activator",fn:function({on:n}){return[e(i["a"],t._g({staticClass:"mr-2",attrs:{icon:""},on:{click:t.userLogout}},n),[e(o["a"],[t._v("mdi-logout-variant")])],1)]}}],null,!1,188337129)},[t._v(" "+t._s(t.isHijackMode?"Exit Hijack":"Logout")+" ")]),e("help-icon")],1),e(s["c"],{staticClass:"w-100 d-flex justify-center pa-0",staticStyle:{height:"calc(100% - 57px)"}},[t.loadingUpdatedSubscription?e("div",{staticClass:"h-100 w-100 d-flex align-center justify-center"},[e(c["a"],{attrs:{indeterminate:"",color:"primary"}})],1):[e("div",{staticClass:"px-14 w-60",staticStyle:{"min-width":"calc(100% - 500px)"}},[e("payment-method-form",{attrs:{hideCancelBtn:"",displaySafeCheckout:"",terms:"Cancel anytime on your account page or by emailing/chatting support. Your\n    trial and subscription will automatically renew unless cancelled.",title:"Payment information",saveButtonText:"Resume subscription"},on:{"method-add-success":t.resumeSubscription,"method-add-error":t.onResumSubscriptionError}})],1),e(a["a"],{staticClass:"w-40 h-100 border-l-1 px-5",staticStyle:{"min-width":"450px"},attrs:{flat:""}},[e(s["d"],[t._v("Seats in your plan")]),e("div",{staticClass:"font-weight-medium grey--text text--darken-2 mt-n1 ml-4"},[t._v(" If you need to resume with a modified plan like updated billing interval or updated number of seats, "),e("span",{staticClass:"link",on:{click:function(e){return t.openIntercom()}}},[t._v(" reach out to support ")]),t._v(" for an immediate response. ")]),t._l(t.seatMapping,(function(n){return e(a["a"],{key:n.billing_plan_id,staticClass:"my-2",attrs:{outlined:""}},[e(s["d"],{staticClass:"d-flex align-center"},[t._v(" "+t._s(n.billing_plan_name)+" "),e("div",{staticClass:"text-caption ml-2"},[t._v(" ("+t._s(n.billing_interval)+"ly) ")]),e(d["a"]),e("div",[t._v(" $"+t._s(n.stripe_price_amount/100*n.seat_count)+" ")])],1),e(s["c"],[e("div",{staticClass:"d-flex align-center"},[e("div",{staticClass:"font-weight-medium mr-2"},[t._v("Seats:")]),e("div",[t._v(t._s(n.seat_count))])])])],1)})),t.seatMapping.length?e("div",{staticClass:"text-h5 d-flex justify-end mr-4"},[t._v(" Total: $"+t._s(t.grandTotal)+" ")]):t._e()],2)]],2)],1):t._e(),e(a["a"],{staticClass:"justify-center h-100 w-100",attrs:{height:"300",width:"400"}},[e(s["d"],[t._v("Subscription canceled")]),e(s["c"],[t._v(" Your org's Symbo subscription is canceled. Reach out to your admin to resume the subscription. "),e("br"),e("br"),t._v(" If you believe this is an error, "),e("span",{staticClass:"link",on:{click:function(e){return t.openIntercom("Hey. I am seeing a subscription canceled message. I checked with the admin and our org should be on a subscription. Could you please look into this?")}}},[t._v(" reach out to Symbo support. ")])])],1)],1)},h=[],m=(n("13d5"),n("14d9"),n("2f62")),f=n("37ca"),v=n("7c4c"),g=n("34fb"),y=n("a292"),b=n("1bcb"),_=n("e9f8"),w=n("e8ec"),S={components:{HelpIcon:f["default"],PaymentMethodForm:v["default"]},data:()=>({pipedriveAuthCode:null,fetchSeatMappingLoader:!1,seatMapping:[],loadingUpdatedSubscription:!1}),watch:{isOpen(t){var e;t&&(this.fetchSeatMapping(),"incomplete"===(null===(e=this.organization)||void 0===e?void 0:e.subscription_status)&&this.$store.commit("snackbar/setSnack",{snack:"There was an issue with your payment. Please try again or contact support.",snackType:"error"}))},channel:{handler(t){null!=t&&this.bindPusherObserver()},immediate:!0},organization:{handler(t){null!=t&&this.isOpen&&this.fetchSeatMapping()},immediate:!0}},computed:{...Object(m["c"])("user",["organization","user","isOrgAdmin","isHijackMode"]),...Object(m["c"])("billingPlans",["billingPlans"]),...Object(m["c"])("pusher",["channel"]),atLeast5MinsSinceLastUpdate(){var t,e;if(null===(t=this.organization)||void 0===t||!t.subscription_updated_at)return!0;const n=Object(_["o"])(),i=Object(_["o"])(null===(e=this.organization)||void 0===e?void 0:e.subscription_updated_at);return n.diff(i).as("minutes")>5},isOpen(){var t,e;return!(this.isOrgAdmin&&!this.seatMapping.length)&&(this.user&&("canceled"===(null===(t=this.organization)||void 0===t?void 0:t.subscription_status)&&this.atLeast5MinsSinceLastUpdate||"incomplete"===(null===(e=this.organization)||void 0===e?void 0:e.subscription_status)))},grandTotal(){return this.seatMapping.reduce((t,e)=>t+e.stripe_price_amount/100*e.seat_count,0)}},methods:{...Object(m["b"])("billingPlans",["fetchBillingPlans"]),onResumSubscriptionError(t){this.$store.commit("snackbar/setSnack",{snack:t||"There was an issue with your payment method. Please try again or contact support.",snackType:"error"})},userLogout(){Object(w["c"])()?(localStorage.removeItem(w["a"]),location.reload()):b["a"].$emit("log-user-out")},openIntercom(t){b["a"].$emit("open-help-chat",t||"Hi. I need to resume my subscription with updated seats.")},getBillingPlanObj(t){return this.billingPlans.find(e=>e.id===t)},async resumeSubscription(t){this.loadingUpdatedSubscription=!0,await y["a"].updateSubscription({resume:!0,stripe_payment_method:t.paymentMethod}).then(()=>{setTimeout(()=>{this.pipedriveAuthCode?this.$router.push("/connect-pipedrive?code="+this.pipedriveAuthCode):location.reload()},2500)}).catch(t=>{var e,n,i;this.$store.commit("snackbar/setSnack",{snack:(null===(e=t.response)||void 0===e||null===(n=e.data)||void 0===n||null===(i=n.error)||void 0===i?void 0:i.message)||"There was an issue with your payment method. Please try again or contact support.",snackType:"error"})})},fetchSeatMapping(){if(this.organization&&this.isOrgAdmin)return this.fetchSeatMappingLoader=!0,new Promise((t,e)=>{g["a"].getOrgSeatMapping(this.organization.id).then(e=>{this.seatMapping=e.seat_mapping,t()}).catch(t=>e(t)).finally(()=>this.fetchSeatMappingLoader=!1)})},bindPusherObserver(){this.channel.bind("organization:billing-plan-updated",()=>{console.log("organization:billing-plan-updated"),this.$store.dispatch("user/load")})}},created(){var t;this.fetchSeatMapping(),this.pipedriveAuthCode=null===(t=this.$route.query)||void 0===t?void 0:t.pipedriveAuthCode}},C=S,x=n("2877"),k=Object(x["a"])(C,p,h,!1,null,null,null);e["default"]=k.exports}}]);
//# sourceMappingURL=chunk-790d3ad6.ac0562d9.js.map