1/*! For license information please see manageBillingComponent-27b89316549959af8a07.bundle.js.LICENSE.txt */ 2"use strict";(self.webpackChunkcodecombat=self.webpackChunkcodecombat||[]).push([[5400],{720276:(t,e,r)=>{var n=r(86856);t.exports={createPaymentCustomerPortal:function(){return n("/db/payments/customer-portal",{method:"POST"})}}},567888:(t,e,r)=>{var n=r(86856);t.exports={fetchByRecipient:function(t,e){return null==e&&(e={}),null==e.data&&(e.data={}),e.data.recipient=t,n("/db/payment",e)}}},687713:(t,e,r)=>{var n=r(619755);function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}Object.defineProperty(e,"X",{value:!0}),e.Z=void 0;var o=r(720276),a=c(r(567888)),s=c(r(867576));function c(t){return t&&t.__esModule?t:{default:t}}function u(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return l(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function f(){f=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var i=e&&e.prototype instanceof g?e:g,a=Object.create(i.prototype),s=new j(n||[]);return o(a,"_invoke",{value:M(t,r,s)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=p;var d="suspendedStart",y="executing",m="completed",v={};function g(){}function b(){}function _(){}var w={};l(w,s,(function(){return this}));var x=Object.getPrototypeOf,L=x&&x(x($([])));L&&L!==r&&n.call(L,s)&&(w=L);var k=_.prototype=g.prototype=Object.create(w);function C(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function r(o,a,s,c){var u=h(t[o],t,a);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==i(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,s,c)}),(function(t){r("throw",t,s,c)})):e.resolve(f).then((function(t){l.value=t,s(l)}),(function(t){return r("throw",t,s,c)}))}c(u.arg)}var a;o(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return a=a?a.then(i,i):i()}})}function M(e,r,n){var i=d;return function(o,a){if(i===y)throw Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:t,done:!0}}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var c=P(s,n);if(c){if(c===v)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===d)throw i=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=y;var u=h(e,r,n);if("normal"===u.type){if(i=n.done?m:"suspendedYield",u.arg===v)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(i=m,n.method="throw",n.arg=u.arg)}}}function P(e,r){var n=r.method,i=e.iterator[n];if(i===t)return r.delegate=null,"throw"===n&&e.iterator.return&&
vendor: 4,433 bytes, line 2
2(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var o=h(i,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var a=o.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function $(e){if(e||""===e){var r=e[s];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(i(e)+" is not iterable")}return b.prototype=_,o(k,"constructor",{value:_,configurable:!0}),o(_,"constructor",{value:b,configurable:!0}),b.displayName=l(_,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,l(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},C(E.prototype),l(E.prototype,c,(function(){return this})),e.AsyncIterator=E,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new E(p(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},C(k),l(k,u,"Generator"),l(k,s,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=$,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function i(n,i){return s.type="throw",s.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;O(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:$(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function p(t,e,r,n,i,o,a){try{var s=t[o](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,i)}function h(t){return function(){var e=this,r=arguments;
2return new Promise((function(n,i){var o=t.apply(e,r);function a(t){p(o,n,i,a,s,"next",t)}function s(t){p(o,n,i,a,s,"throw",t)}a(void 0)}))}}var d=window.moment;e.Z={name:"ManageBillingView",data:function(){return{errMsg:null,customerPortalUrl:null,moment:d,paymentModels:[],paymentDescription:{},prepaidMap:{}}},created:function(){var t=this;return h(f().mark((function e(){return f().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(me&&me.get("email")){e.next=4;break}t.errMsg="You must be logged-in to manage billing info",e.next=14;break;case 4:if(!me.isStudent()){e.next=8;break}t.errMsg="Students dont have access to billing",e.next=14;break;case 8:if(me.get("emailVerified")){e.next=12;break}t.errMsg=n.i18n.t("payments.email_not_verified"),e.next=14;break;case 12:return e.next=14,t.fetchCustomerPortalUrl();case 14:return e.next=16,t.loadPaymentHistory();case 16:case"end":return e.stop()}}),e)})))()},methods:{onManageBilling:function(t){t.preventDefault(),window.location.href=this.customerPortalUrl},fetchCustomerPortalUrl:function(){var t=this;return h(f().mark((function e(){var r,i,a;return f().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,o.createPaymentCustomerPortal)();case 3:i=e.sent,e.next=10;break;case 6:return e.prev=6,e.t0=e.catch(0),t.errMsg=e.t0.message||"Internal Error, try again in sometime",e.abrupt("return");case 10:(null==(a=null===(r=i)||void 0===r?void 0:r.data)?void 0:a.stripeCustomerIdPresent)?t.customerPortalUrl=a.url:t.errMsg=n.i18n.t("payments.stripe_no_data");case 13:case"end":return e.stop()}}),e,null,[[0,6]])})))()},loadPaymentHistory:function(){var t=this;return h(f().mark((function e(){var r,n,i,o,c,l;return f().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.paymentDescription={},e.next=3,s.default.getByCreator(me.id,{data:{allTypes:!0}});case 3:return r=e.sent,t.prepaidMap=_.zipObject(_.map(r,(function(t){return t.id})),r),e.next=7,a.default.fetchByRecipient(me.id);case 7:n=e.sent,t.paymentModels=n,i=u(n);try{for(i.s();!(o=i.n()).done;)c=o.value,l=c.description,"online-classes"===c.productID?t.paymentDescription[c._id]=l.slice(0,22):t.paymentDescription[c._id]=l}catch(t){i.e(t)}finally{i.f()}case 11:case"end":return e.stop()}}),e)})))()},paymentI18n:function(t){var e=t.prepaidID,r=t.productID,i=t.service;if(!e||!this.prepaidMap[e]){if("custom"===r)return t.description;if(r)return/lifetime_subscription$/.test(r)?n.i18n.t("subscribe.lifetime"):/year_subscription$/.test(r)?n.i18n.t("subscribe.year_subscription"):/basic_subscription$/.test(r)?n.i18n.t("subscribe.stripe_description"):/online-classes$/.test(r)?n.i18n.t("subscribe.online_classes"):n.i18n.t("account.gems");if(me.get("stripe")&&null!=me.get("stripe").free){var o=new Date(t.created);return"boolean"==typeof me.get("stripe").free&&o>new Date(2017,0,1)?me.get("stripe").customerID||t.gems>=18e3?n.i18n.t("subscribe.lifetime"):n.i18n.t("subscribe.free_subscription"):t.gems>=18e3?n.i18n.t("subscribe.year_subscription"):n.i18n.t("subscribe.stripe_description")}return i.toLowerCase(),n.i18n.t("subscribe.stripe_description")}switch(this.prepaidMap[e].get("type")){case"subscription":case"terminal_subscription":return n.i18n.t("subscribe.stripe_description");case"course":return n.i18n.t("special_offer.course_prefix");case"starter_license":return n.i18n.t("special_offer.student_starter_license");default:return""}},getCreationDate:function(t){return new Date(1e3*parseInt(t._id.slice(0,8),16))}}}},877204:(t,e)=>{e.xk=e.sY=void 0,e.sY=function(){var t=this,e=t._self._c;return e("div",{staticClass:"container-fluid",attrs:{id:"manage-billing-view"}},[e("div",{staticClass:"container"},[e("div",{staticClass:"text-center"},[e("h2",{staticClass:"billing-portal"},[t._v(t._s(t.$t("payments.billing_portal")))]),e("div",{staticClass:"form-group manage-billing-section"},[e("button",{staticClass:"btn btn-success btn-lg purchase-btn",class:t.errMsg?"disabled":"",attrs:{type:"submit"},on:{click:t.onManageBilling}},[t._v(t._s(t.$t("payments.manage_stripe")))]),e("div",{staticClass:"extra-data"},[e("p",{staticClass:"extra-p"},[t._v("*"+t._s(t.$t("payments.manage_billing_info")))])]),e("div",{staticClass:"error-info"},[t.errMsg?e("p",{staticClass:"error"},[t._v(t._s(t.errMsg))]):t._e()])]),e("div",{staticClass:"history"},[e("h2",{staticClass:"billing-portal"},[t._v(t._s(t.$t("account.payments_history")))]),t.paymentModels.length>0?e("table",{staticClass:"table table-striped"},[e("tr",[e("th",[t._v(t._s(t.$t("account.purchased")))]),e("th",[t._v(t._s(t.$t("account.paid_on")))]),e("th",[t._v(t._s(t.$t("account.price")))]),e("th",[t._v(t._s(t.$t("account.gems")))]),e("th",[t._v(t._s(t.$t("general.description")))])]),t._l(t.paymentModels,(function(r){return e("tr",{key:r._id},[e("td",[t._v(t._s(t.paymentI18n(r)))]),e("td",[t._v(t._s(t.moment(t.getCreationDate(r)).format("l")))]),e("td",[t._v(t._s("$"+((r.amount||0)/100).toFixed(2)))]),e("td",[t._v(t._s(r.gems||"n/a"))]),e("td",[t._v(t._s(t.paymentDescription[r._id]||""))])])}))],2):e("div",[e("p",[t._v(t._s(t.$t("account.no_payments_found")))])])])])])])},e.xk=[]},817774:(t,e,r)=>{r.r(e),r.d(e,{__esModule:()=>i.X,default:()=>a});var n=r(877204),i=r(687713);const o=i.Z,a=(0,r(551900).Z)(o,n.sY,n.xk,!1,null,"076d60e3",null).exports}}]);
3//# sourceMappingURL=manageBillingComponent-27b89316549959af8a07.bundle.js.map
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.