!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b4eb27f0-ab51-400c-9873-ae36d2a21761",e._sentryDebugIdIdentifier="sentry-dbid-b4eb27f0-ab51-400c-9873-ae36d2a21761")}catch(e){}}(),(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-01f6bf75"],{"055f":function(e,t,a){"use strict";a("0de4")},"0de4":function(e,t,a){},"17b3":function(e,t,a){},5708:function(e,t,a){"use strict";var n=function(){var e=this,t=e._self._c;return t("v-card",{staticClass:"d-flex align-center pa-5 pt-3 flex-wrap justify-end",attrs:{elevation:"0",color:"secondary"}},[null!==e.totalItems?t("div",{staticClass:"mr-3 mt-2 body-2 font-weight-bold"},[e._v(" Total: "+e._s(e.totalItems)+" ")]):e._e(),t("div",{staticClass:"mr-3 mt-2 body-2"},[e._v(" "+e._s(e.$t("rows_per_page"))+" ")]),t("c-select",{staticClass:"select-max-width mt-2",attrs:{value:e.itemsPerPage,items:e.itemsPerPageValues,"item-text":"name","item-value":"value",height:"30px","background-color":e.$vuetify.theme.dark?"secondary":"white","hide-details":""},on:{change:function(t){return e.changeItemsPerPage(t)}}}),t("v-pagination",{staticClass:"mt-2 justify-end",attrs:{value:e.currentPage,length:e.pageCount,"total-visible":7},on:{input:function(t){return e.changeCurrentPage(t)}}})],1)},i=[],r=(a("2841"),a("ae7b")),s={name:"DataTableFooter",components:{CSelect:r["a"]},props:{itemsPerPage:{type:Number,default:15},pageCount:{type:Number,default:0},currentPage:{type:Number,default:1},totalItems:{type:Number,default:null}},computed:{itemsPerPageValues:function(){return[{name:"15",value:15},{name:"25",value:25},{name:"50",value:50},{name:this.$t("page_all"),value:-1}]}},methods:{changeCurrentPage:function(e){this.$emit("change-current-page",e)},changeItemsPerPage:function(e){this.$emit("change-items-per-page",e)}}},o=s,c=(a("a21b"),a("2877")),u=a("d15f"),l=a("6544"),d=a.n(l),h=a("b0af"),p=a("891e"),m=Object(c["a"])(o,n,i,!1,null,"5fa46e14",null);"function"===typeof u["default"]&&Object(u["default"])(m);t["a"]=m.exports;d()(m,{VCard:h["a"],VPagination:p["a"]})},"6a31":function(e,t,a){},"891e":function(e,t,a){"use strict";a("17b3");var n=a("9d26"),i=a("dc22"),r=a("a9ad"),s=a("de2c"),o=a("7560"),c=a("58df");t["a"]=Object(c["a"])(r["a"],Object(s["a"])({onVisible:["init"]}),o["a"]).extend({name:"v-pagination",directives:{Resize:i["a"]},props:{circle:Boolean,disabled:Boolean,length:{type:Number,default:0,validator:e=>e%1===0},nextIcon:{type:String,default:"$next"},prevIcon:{type:String,default:"$prev"},totalVisible:[Number,String],value:{type:Number,default:0},pageAriaLabel:{type:String,default:"$vuetify.pagination.ariaLabel.page"},currentPageAriaLabel:{type:String,default:"$vuetify.pagination.ariaLabel.currentPage"},previousAriaLabel:{type:String,default:"$vuetify.pagination.ariaLabel.previous"},nextAriaLabel:{type:String,default:"$vuetify.pagination.ariaLabel.next"},wrapperAriaLabel:{type:String,default:"$vuetify.pagination.ariaLabel.wrapper"}},data(){return{maxButtons:0,selected:null}},computed:{classes(){return{"v-pagination":!0,"v-pagination--circle":this.circle,"v-pagination--disabled":this.disabled,...this.themeClasses}},items(){const e=parseInt(this.totalVisible,10);if(0===e||isNaN(this.length)||this.length>Number.MAX_SAFE_INTEGER)return[];const t=Math.min(Math.max(0,e)||this.length,Math.max(0,this.maxButtons)||this.length,this.length);if(this.length<=t)return this.range(1,this.length);const a=t%2===0?1:0,n=Math.floor(t/2),i=this.length-n+1+a;if(this.value>n&&this.value<i){const e=1,t=this.length,i=this.value-n+2,r=this.value+n-2-a,s=i-1===e+1?2:"...",o=r+1===t-1?r+1:"...";return[1,s,...this.range(i,r),o,this.length]}if(this.value===n){const e=this.value+n-1-a;return[...this.range(1,e),"...",this.length]}if(this.value===i){const e=this.value-n+1;return[1,"...",...this.range(e,this.length)]}return[...this.range(1,n),"...",...this.range(i,this.length)]}},watch:{value(){this.init()}},beforeMount(){this.init()},methods:{init(){this.selected=null,this.onResize(),this.$nextTick(this.onResize),setTimeout(()=>this.selected=this.value,100)},onResize(){const e=this.$el&&this.$el.parentElement?this.$el.parentElement.clientWidth:window.innerWidth;this.maxButtons=Math.floor((e-96)/42)},next(e){e.preventDefault(),this.$emit("input",this.value+1),this.$emit("next")},previous(e){e.preventDefault(),this.$emit("input",this.value-1),this.$emit("previous")},range(e,t){const a=[];e=e>0?e:1;for(let n=e;n<=t;n++)a.push(n);return a},genIcon(e,t,a,i,r){return e("li",[e("button",{staticClass:"v-pagination__navigation",class:{"v-pagination__navigation--disabled":a},attrs:{disabled:a,type:"button","aria-label":r},on:a?{}:{click:i}},[e(n["a"],[t])])])},genItem(e,t){const a=t===this.value&&(this.color||"primary"),n=t===this.value,i=n?this.currentPageAriaLabel:this.pageAriaLabel;return e("button",this.setBackgroundColor(a,{staticClass:"v-pagination__item",class:{"v-pagination__item--active":t===this.value},attrs:{type:"button","aria-current":n,"aria-label":this.$vuetify.lang.t(i,t)},on:{click:()=>this.$emit("input",t)}}),[t.toString()])},genItems(e){return this.items.map((t,a)=>e("li",{key:a},[isNaN(Number(t))?e("span",{class:"v-pagination__more"},[t.toString()]):this.genItem(e,t)]))},genList(e,t){return e("ul",{directives:[{modifiers:{quiet:!0},name:"resize",value:this.onResize}],class:this.classes},t)}},render(e){const t=[this.genIcon(e,this.$vuetify.rtl?this.nextIcon:this.prevIcon,this.value<=1,this.previous,this.$vuetify.lang.t(this.previousAriaLabel)),this.genItems(e),this.genIcon(e,this.$vuetify.rtl?this.prevIcon:this.nextIcon,this.value>=this.length,this.next,this.$vuetify.lang.t(this.nextAriaLabel))];return e("nav",{attrs:{role:"navigation","aria-label":this.$vuetify.lang.t(this.wrapperAriaLabel)}},[this.genList(e,t)])}})},a21b:function(e,t,a){"use strict";a("6a31")},d15f:function(e,t,a){"use strict";var n=a("fd8c"),i=a.n(n);t["default"]=i.a},d4d4:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=()=>new Promise(e=>{window.Stripe&&e();const t=document.createElement("script");t.src="https://js.stripe.com/v3/",document.body.appendChild(t),t.onload=()=>{e()}}),i=({loadScriptUrl:e})=>new Promise(t=>{window.bitcart&&t();const a=document.createElement("script");a.src=e,document.body.appendChild(a),a.onload=()=>{t()}}),r=()=>new Promise(e=>{window.Shift4&&e();const t=document.createElement("script");t.src="https://dev.shift4.com/checkout.js",document.body.appendChild(t),t.onload=()=>{e()}});const s={formStrategy(e){const t=document.createElement("form");t.action=e.url,t.method=e.method,t.style="display: none;";let a=[];e.fields&&e.fields.constructor===Object&&(a=Object.entries(e.fields).map(([e,t])=>{const a=document.createElement("input");return a.type="text",a.name=e,a.value=t,a})),document.body.appendChild(t),a.forEach(e=>t.appendChild(e)),t.submit(),t.remove()},stripeCheckoutStrategy(e){n().then(()=>{const t=window.Stripe(e.public_key);t.redirectToCheckout({sessionId:e.checkout_session_id})})},bitcartStrategy(e){i({loadScriptUrl:e.script_url}).then(()=>{window.bitcart.showInvoice(e.invoice_id)})},redirectStrategy(e){window.location.assign(e.redirect_url)},QRCodeStrategy(e){return e.qr_code_url},messageStrategy(e){return e},async shift4ChargeStrategy(e){return await r(),new Promise((t,a)=>{const n=window.Shift4Checkout;n.key=e.public_key,n.success=function(e){t(e)},n.error=function(e){a(e)},n.open({checkoutRequest:e.signed_checkout_request,name:" ",description:"Shift4"})})}};function o(e){const t={form:"formStrategy",stripe_checkout:"stripeCheckoutStrategy",redirect:"redirectStrategy",qr_code:"QRCodeStrategy",message:"messageStrategy",shift4_charge:"shift4ChargeStrategy",bitcart:"bitcartStrategy"}[e];if(t)return s[t];console.log("NO PAYMENT METHOD STRATEGY FOUND",e)}},e3d7:function(e,t,a){"use strict";a.r(t);var n=function(){var e=this,t=e._self._c;return t("div",[t("account-statement-table"),e.adNetwork.settings.payments?t("payments-table",{staticClass:"mt-2"}):e._e()],1)},i=[],r=a("5530"),s=a("2f62"),o=(a("a9e3"),function(){var e=this,t=e._self._c;return t("div",[t("div",{staticClass:"finances__header-container"},[t("h3",{staticClass:"text-h6"},[e._v(" "+e._s(e.$t("finances.finances"))+" ")]),t("div",{staticClass:"datepicker"},[t("date-picker-select",{attrs:{"text-field-props":{backgroundColor:"secondary"},"with-presets":"",buttons:""},model:{value:e.period,callback:function(t){e.period=t},expression:"period"}})],1)]),t("v-card",{attrs:{elevation:"0"}},[t("v-card-title",{staticClass:"black"},[t("h3",{staticClass:"white--text"},[e._v(" "+e._s(e.$t("finances.account_statement"))+" ")])]),t("v-data-table",{attrs:{headers:e.statementsTableHeaders,items:e.statementsTable.items,loading:e.statementsTable.loading,"items-per-page":e.itemsPerPage,page:e.currentPage,"hide-default-footer":""},on:{"page-count":function(t){return e.getPageCount(t)}},scopedSlots:e._u([{key:"item.debit",fn:function(t){var a=t.item;return[e._v(" $ "+e._s(e.toFixedByDefault(Number(a.debit)))+" ")]}},{key:"item.credit",fn:function(t){var a=t.item;return[e._v(" $ "+e._s(e.toFixedByDefault(Number(a.credit)))+" ")]}},{key:"footer",fn:function(){return[t("data-table-footer",{attrs:{"items-per-page":e.itemsPerPage,"page-count":e.pageCount,"current-page":e.currentPage},on:{"change-items-per-page":function(t){return e.changeItemsPerPage(t)},"change-current-page":function(t){return e.changeCurrentPage(t)}}})]},proxy:!0}])})],1)],1)}),c=[],u=(a("d3b7"),a("5708")),l=a("e85c"),d=a("93b2"),h=a("b395"),p={name:"AccountStatementTable",components:{DataTableFooter:u["a"],DatePickerSelect:d["a"]},data:function(){return{statementsTable:{loading:!1,items:[]},periodInner:{start:"",end:""},itemsPerPage:15,pageCount:0,currentPage:1}},computed:{statementsTableHeaders:function(){return[{text:this.$t("finances.date"),value:"date"},{text:this.$t("finances.debit"),value:"debit"},{text:this.$t("finances.credit"),value:"credit"}]},period:{get:function(){return this.periodInner},set:function(e){this.periodInner=e,this.fetchStatements()}}},mounted:function(){this.fetchStatements()},methods:{fetchStatements:function(){var e=this;this.statementsTable.loading=!0,h["l"].list(this.period).then((function(t){e.statementsTable.items=t})).finally((function(){e.statementsTable.loading=!1}))},changeItemsPerPage:function(e){this.itemsPerPage=e},getPageCount:function(e){this.pageCount=e},changeCurrentPage:function(e){this.currentPage=e},toFixedByDefault:l["a"]}},m=p,g=(a("055f"),a("2877")),f=a("6544"),b=a.n(f),v=a("b0af"),y=a("99d9"),_=a("8fea"),w=Object(g["a"])(m,o,c,!1,null,"30927d07",null),P=w.exports;b()(w,{VCard:v["a"],VCardTitle:y["d"],VDataTable:_["a"]});var x=function(){var e=this,t=e._self._c;return t("v-card",{attrs:{elevation:"0"}},[t("v-card-title",{staticClass:"black"},[t("h3",{staticClass:"white--text"},[e._v(" "+e._s(e.$t("finances.payments"))+" ")])]),t("v-data-table",{attrs:{headers:e.paymentsTableHeaders,items:e.paymentItem,loading:e.isLoading,"items-per-page":e.itemsPerPage,page:e.currentPage,"hide-default-footer":""},on:{"page-count":function(t){return e.getPageCount(t)}},scopedSlots:e._u([{key:"item.isSubscription",fn:function(t){var a=t.item;return[e._v(" "+e._s(a.metadata.isSubscription?e.$t("main.yes"):e.$t("main.no"))+" ")]}},{key:"item.amount",fn:function(t){var a=t.item;return[e._v(" $ "+e._s(e.toFixedByDefault(a.amount))+" ")]}},{key:"item.invoiceDownloadUrl",fn:function(a){var n=a.item;return[n.isDownloadable?t("c-btn",{attrs:{color:"primary",small:"",label:"PDF",loading:e.documentIsLoading[n.id]},on:{click:function(t){return e.fetchDocument(n.id)}}}):e._e()]}},{key:"item.paidAt",fn:function(a){var n=a.item;return[n.paidAt?t("div",[e._v(" "+e._s(n.paidAt)+" ")]):t("div",[t("c-btn",{staticClass:"mr-2",attrs:{color:"primary",small:"",label:e.$t("finances.pay")},on:{click:function(t){return e.payInvoice(n)}}}),t("c-btn",{attrs:{color:"primary",small:"",loading:e.deleteIsLoading[n.id],label:e.$t("finances.delete")},on:{click:function(t){return e.deleteInvoice(n.id)}}})],1)]}},{key:"footer",fn:function(){return[t("data-table-footer",{attrs:{"items-per-page":e.itemsPerPage,"page-count":e.pageCount,"current-page":e.currentPage},on:{"change-items-per-page":function(t){return e.changeItemsPerPage(t)},"change-current-page":function(t){return e.changeCurrentPage(t)}}})]},proxy:!0}])})],1)},C=[],I=a("ade3"),k=a("c7eb"),S=a("1da1"),$=(a("4de4"),a("b0c0"),a("d81d"),a("7db0"),a("3c32")),O=a("d4d4"),j=a("4a2e"),L=a("9a46"),N=a("3039"),T=a("b713"),D={name:"PaymentsTable",components:{DataTableFooter:u["a"],CBtn:$["a"]},data:function(){return{isLoading:!1,deleteIsLoading:{},documentIsLoading:{},payments:[],itemsPerPage:15,pageCount:0,currentPage:1}},computed:Object(r["a"])(Object(r["a"])({},Object(s["d"])("settings",["adNetwork"])),{},{paymentsTableHeaders:function(){return[{text:this.$t("main.amount"),value:"amount"},{text:this.$t("finances.autopayment"),value:"isSubscription"},{text:this.$t("finances.payment_method"),value:"paymentMethodName"},{text:this.$t("finances.comment"),value:"number"},{text:this.$t("finances.created_at"),value:"createdAt"},{text:this.$t("finances.download"),value:"invoiceDownloadUrl",isShown:this.adNetworkHasSectionInvoiceDownloads},{text:this.$t("finances.paid_at"),value:"paidAt"}].filter((function(e){return!1!==e.isShown}))},adNetworkHasSectionInvoiceDownloads:function(){return this.adNetwork.guardSections.some((function(e){var t=e.name;return t===L["a"].INVOICE_DOWNLOADS}))},paymentItem:function(){var e=this;return this.payments.map((function(t){return Object(r["a"])(Object(r["a"])({},t),{},{paymentMethodName:e.paymentNameByLocale(t.paymentMethod).name})}))}}),mounted:function(){this.fetchPayments()},methods:{paymentNameByLocale:function(e){var t=this,a=null===e||void 0===e?void 0:e.translations.find((function(e){var a=e.locale;return a===t.$i18n.locale}));if(!a){var n=null===e||void 0===e?void 0:e.translations.find((function(e){var t=e.locale;return"en"===t}));return n||{}}return a},fetchPayments:function(){var e=this;return Object(S["a"])(Object(k["a"])().mark((function t(){return Object(k["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.isLoading=!0,t.prev=1,t.next=4,h["s"].list();case 4:e.payments=t.sent,t.next=10;break;case 7:t.prev=7,t.t0=t["catch"](1),Object(T["a"])(t.t0);case 10:e.isLoading=!1;case 11:case"end":return t.stop()}}),t,null,[[1,7]])})))()},changeItemsPerPage:function(e){this.itemsPerPage=e},getPageCount:function(e){this.pageCount=e},changeCurrentPage:function(e){this.currentPage=e},payInvoice:function(e){var t=this;return Object(S["a"])(Object(k["a"])().mark((function a(){var n;return Object(k["a"])().wrap((function(a){while(1)switch(a.prev=a.next){case 0:return Object(N["a"])({event:j["a"].INVOICE_PAY,event_category:j["b"].REVENUE}),n=e.paymentMethod.strategy,a.next=4,Object(O["a"])(n)(e.formParams);case 4:return a.next=6,t.fetchPayments();case 6:case"end":return a.stop()}}),a)})))()},deleteInvoice:function(e){var t=this;return Object(S["a"])(Object(k["a"])().mark((function a(){return Object(k["a"])().wrap((function(a){while(1)switch(a.prev=a.next){case 0:return t.deleteIsLoading=Object(r["a"])(Object(r["a"])({},t.deleteIsLoading),{},Object(I["a"])({},e,!0)),a.prev=1,a.next=4,h["o"].delete(e);case 4:return t.$showSuccessNotification(t.$t("finances.invoice_deleted")),a.next=7,t.fetchPayments();case 7:a.next=12;break;case 9:a.prev=9,a.t0=a["catch"](1),Object(T["a"])(a.t0);case 12:t.deleteIsLoading[e]=!1;case 13:case"end":return a.stop()}}),a,null,[[1,9]])})))()},fetchDocument:function(e){var t=this;return Object(S["a"])(Object(k["a"])().mark((function a(){return Object(k["a"])().wrap((function(a){while(1)switch(a.prev=a.next){case 0:return t.documentIsLoading=Object(r["a"])(Object(r["a"])({},t.documentIsLoading),{},Object(I["a"])({},e,!0)),a.prev=1,a.next=4,h["o"].document(e);case 4:a.next=9;break;case 6:a.prev=6,a.t0=a["catch"](1),Object(T["a"])(a.t0);case 9:t.documentIsLoading[e]=!1;case 10:case"end":return a.stop()}}),a,null,[[1,6]])})))()},toFixedByDefault:l["a"]}},A=D,E=Object(g["a"])(A,x,C,!1,null,null,null),V=E.exports;b()(E,{VCard:v["a"],VCardTitle:y["d"],VDataTable:_["a"]});var B={name:"Finances",components:{AccountStatementTable:P,PaymentsTable:V},computed:Object(r["a"])({},Object(s["d"])("settings",["adNetwork"]))},F=B,M=Object(g["a"])(F,n,i,!1,null,null,null);t["default"]=M.exports},fd8c:function(e,t){e.exports=function(e){e.options.__i18n=e.options.__i18n||[],e.options.__i18n.push('{"en":{"rows_per_page":"Rows, per page:","page_all":"All"},"ru":{"rows_per_page":"Строк на странице:","page_all":"Все"},"es":{"rows_per_page":"Filas, por página:","page_all":"Todos"},"de":{"rows_per_page":"Zeilen, pro Seite:","page_all":"Alle"},"jp":{"rows_per_page":"1ページあたりの行数：","page_all":"全て"}}'),delete e.options._Ctor}}}]);
//# sourceMappingURL=chunk-01f6bf75.59c633d2.js.map