PageSourceSearch

https://codecombat.com/javascripts/chunks/userSwitchAccount-53d1d774cd3831faf9eb.bundle.js

js codecombat.com collected 2026-10-01 08:43:56 UTC 16,262 bytes, 3 lines download raw bytes

vendor: 4,658 bytes, lines 1-2
1/*! For license information please see userSwitchAccount-53d1d774cd3831faf9eb.bundle.js.LICENSE.txt */
2"use strict";(self.webpackChunkcodecombat=self.webpackChunkcodecombat||[]).push([[5309],{124215:(t,e,r)=>{var n=r(619755);function o(t){return o="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},o(t)}Object.defineProperty(e,"X",{value:!0}),e.Z=void 0;var i=c(r(27976)),a=c(r(903575)),s=c(r(434883));function c(t){return t&&t.__esModule?t:{default:t}}function u(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function l(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?u(Object(r),!0).forEach((function(e){d(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function d(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=o(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e);if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==o(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function f(){f=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=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 d(t,e,r,n){var o=e&&e.prototype instanceof y?e:y,a=Object.create(o.prototype),s=new L(n||[]);return i(a,"_invoke",{value:O(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=d;var v="suspendedStart",p="executing",m="completed",_={};function y(){}function g(){}function w(){}var b={};l(b,s,(function(){return this}));var x=Object.getPrototypeOf,C=x&&x(x(I([])));C&&C!==r&&n.call(C,s)&&(b=C);var k=w.prototype=y.prototype=Object.create(b);function E(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function r(i,a,s,c){var u=h(t[i],t,a);if("throw"!==u.type){var l=u.arg,d=l.value;return d&&"object"==o(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){r("next",t,s,c)}),(function(t){r("throw",t,s,c)})):e.resolve(d).then((function(t){l.value=t,s(l)}),(function(t){return r("throw",t,s,c)}))}c(u.arg)}var a;i(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function O(e,r,n){var o=v;return function(i,a){if(o===p)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var c=P(s,n);if(c){if(c===_)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===v)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=p;var u=h(e,r,n);if("normal"===u.type){if(o=n.done?m:"suspendedYield",u.arg===_)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=m,n.method="throw",n.arg=u.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(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")),_;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,_;var a=i.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,_):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,_)}function U(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(U,this),this.reset(!0)}function I(e){if(e||""===e){var r=e[s];if(r)return r.call(e);
2if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(o(e)+" is not iterable")}return g.prototype=w,i(k,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:g,configurable:!0}),g.displayName=l(w,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},E(S.prototype),l(S.prototype,c,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(d(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(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=I,L.prototype={constructor:L,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(j),!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 o(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("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 o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,_):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),_},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),j(r),_}},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 o=n.arg;j(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),_}},e}function h(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function v(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){h(i,n,o,a,s,"next",t)}function s(t){h(i,n,o,a,s,"throw",t)}a(void 0)}))}}var p=r(760185);e.Z={name:"SwitchAccountView",components:{AddUserComponent:i.default,RelatedUserComponent:a.default},mixins:[s.default],data:function(){return{loading:!0,relatedUsers:null,relatedUsersData:null,isComplete:!1,inProgress:!1,showAddForm:!1,confirmEmailSentFor:"",errMsg:null}},created:function(){var t=this;return v(f().mark((function e(){var r;return f().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((r=me.get("related"))&&0!==r.length){e.next=4;break}return t.loading=!1,e.abrupt("return");case 4:return t.relatedUsers=r,e.next=7,t.fetchRelatedUsers();case 7:t.loading=!1;case 8:case"end":return e.stop()}}),e)})))()},methods:{onAddSwitchAccount:function(t){var e=this;return v(f().mark((function r(){return f().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e.inProgress=n.t("related_accounts.adding"),e.isComplete=!1,e.errMsg=null,r.prev=3,r.next=6,me.linkRelatedAccount(t);case 6:r.next=13;break;case 8:return r.prev=8,r.t0=r.catch(3),e.errMsg=(null===r.t0||void 0===r.t0?void 0:r.t0.msg)||(null===r.t0||void 0===r.t0?void 0:r.t0.message)||(null===r.t0||void 0===r.t0?void 0:r.t0.responseText)||r.t0||n.t("common.internal_error"),e.inProgress=!1,r.abrupt("return");case 13:return r.next=15,me.fetch({cache:!1});case 15:return e.relatedUsers=me.get("related"),r.next=18,e.fetchRelatedUsers();case 18:e.isComplete=n.t("related_accounts.added"),e.inProgress=!1,e.showAddForm=!1;case 21:case"end":return r.stop()}}),r,null,[[3,8]])})))()},showAddUserForm:function(){this.showAddForm=!0,this.isComplete=!1},fetchRelatedUsers:function(){var t=this;return v(f().mark((function e(){var r,n,o;return f().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==(n=null===(r=t.relatedUsers)||void 0===r?void 0:r.map((function(t){return p.getRelatedAccount({userId:t.userId})})))||!n.length){e.next=8;break}return e.next=4,Promise.all(n);case 4:o=e.sent,t.relatedUsersData=null==o?void 0:o.map((function(e,r){return l(l({},t.relatedUsers[r]),e.user)})),e.next=9;break;case 8:t.relatedUsersData=[];case 9:case"end":return e.stop()}}),e)})))()},onRemoveUser:function(t){var e=this;return v(f().mark((function r(){var o;return f().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o=t.userId,e.inProgress=n.t("related_accounts.removing"),e.isComplete=!1,r.next=5,me.removeRelatedAccount(o);case 5:return r.next=7,me.fetch({cache:!1});case 7:return e.relatedUsers=me.get("related"),r.next=10,e.fetchRelatedUsers();case 10:e.inProgress=!1;case 11:case"end":return r.stop()}}),r)})))()},onSendVerifyEmail:function(t){var e=this;return v(f().mark((function r(){var n,o;return f().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=t.userId,o=t.email,r.next=3,p.sendVerifyEmail({userId:n,email:o});case 3:e.confirmEmailSentFor=o;case 4:case"end":return r.stop()}}),r)})))()}}}},297172:(t,e,r)=>{Object.defineProperty(e,"X",{value:!0}),e.Z=void 0;var n,o=(n=r(191616))&&n.__esModule?n:{default:n};e.Z={name:"RelatedUserComponent",components:{IconCloseRed:o.default},props:{related:{type:Array,default:null},confirmEmailSentFor:{type:String,default:""}}
2,methods:{onSwitch:function(t){var e=t.identifier;this.$emit("switchUser",{identifier:e})},onRemoveUser:function(t){var e=t.userId;this.$emit("removeUser",{userId:e})},onSendVerifyEmail:function(t){var e=t.userId,r=t.email;this.$emit("sendVerifyEmail",{userId:e,email:r})},relatedUserInfo:function(t){var e=[];return t.broadName&&e.push(t.broadName),t.role?e.push(t.role):e.push("Individual"),0===e.length?"":"( ".concat(e.join(" - ")," )")},isInSwitchedAccount:function(){var t;return null===(t=window.serverSession)||void 0===t?void 0:t.switchingUserActualId}}}},813085:(t,e)=>{e.xk=e.sY=void 0,e.sY=function(){var t=this;return(0,t._self._c)("img",{attrs:{src:"/images/common/IconCloseRed.svg"},on:{click:function(e){return t.$emit("clicked")}}})},e.xk=[]},911964:(t,e)=>{e.xk=e.sY=void 0,e.sY=function(){var t=this,e=t._self._c;return e("div",[t.loading?e("div",{staticClass:"loading"},[t._v("\n    "+t._s(t.$t("common.loading"))+"\n  ")]):e("div",{staticClass:"switch"},[e("related-user-component",{staticClass:"center-cmpt container",attrs:{related:t.relatedUsersData,"confirm-email-sent-for":t.confirmEmailSentFor},on:{switchUser:function(e){return t.onSwitchUser(e)},removeUser:function(e){return t.onRemoveUser(e)},sendVerifyEmail:function(e){return t.onSendVerifyEmail(e)}}}),t._v(" "),e("div",{staticClass:"switch__head"},[e("button",{staticClass:"add-user__head__btn btn btn-moon",on:{click:t.showAddUserForm}},[t._v("\n        "+t._s(t.$t("related_accounts.add_related_user"))+"\n      ")])]),t._v(" "),t.showAddForm?e("div",{staticClass:"center-cmpt container"},[e("add-user-component",{on:{onAddSwitchAccount:function(e){return t.onAddSwitchAccount(e)}}})],1):t._e(),t._v(" "),t.inProgress?e("div",{staticClass:"switch__adding switch__progress"},[t._v("\n      "+t._s(t.inProgress)+"...\n    ")]):t._e(),t._v(" "),t.isComplete?e("div",{staticClass:"switch__added switch__progress"},[t._v("\n      "+t._s(t.isComplete)+"\n    ")]):t._e(),t._v(" "),t.errMsg?e("div",{staticClass:"switch__error switch__progress"},[t._v("\n      "+t._s(t.errMsg)+"\n    ")]):t._e()],1)])},e.xk=[]},433897:(t,e)=>{e.xk=e.sY=void 0,e.sY=function(){var t=this,e=t._self._c;return e("div",{staticClass:"related"},[e("div",{staticClass:"related__heading"},[e("h3",{staticClass:"related__heading__text"},[t._v("\n      "+t._s(t.$t("related_accounts.related_users"))+":\n    ")]),t._v(" "),e("p",{staticClass:"related__heading__subtext"},[t._v("\n      "+t._s(t.$t("related_accounts.subtitle"))+"\n    ")])]),t._v(" "),t.related&&0!==t.related.length?t._e():e("div",{staticClass:"related__none"},[e("p",{staticClass:"related__none__text"},[t._v("\n      "+t._s(t.$t("related_accounts.no_related_users"))+"\n    ")])]),t._v(" "),t.related&&t.related.length?e("div",{staticClass:"related__main"},t._l(t.related,(function(r){return e("div",{key:r.userId,staticClass:"related__main__user"},[e("div",{staticClass:"row related__user"},[e("div",{staticClass:"col-md-7"},[e("div",{staticClass:"related__user__text"},[t._v("\n            "+t._s(r.email)+" "),e("span",{staticClass:"related__user__text-help"},[t._v(t._s(t.relatedUserInfo(r)))])])]),t._v(" "),e("div",{staticClass:"col-md-3"},[r.verified?e("div",{staticClass:"related__user__verified"},[t._v("\n            "+t._s(t.$t("related_accounts.verified"))+"\n          ")]):e("div",{staticClass:"related__user__not__verified"},[e("button",{staticClass:"btn btn-warning",attrs:{disabled:t.confirmEmailSentFor===r.email},on:{click:function(){return t.onSendVerifyEmail({userId:r.userId,email:r.email})}}},[t._v("\n              "+t._s(t.confirmEmailSentFor===r.email?t.$t("common.sent"):t.$t("related_accounts.send_verify_email"))+"\n            ")])])]),t._v(" "),e("div",{staticClass:"col-md-2"},[e("div",{staticClass:"related__user__switch"},[e("button",{staticClass:"btn btn-success",attrs:{disabled:!r.verified||t.isInSwitchedAccount()},on:{click:function(){return t.onSwitch({identifier:r.email||r.name})}}},[t._v("\n              "+t._s(t.$t("related_accounts.switch"))+"\n            ")]),t._v(" "),e("span",{staticClass:"related__user__switch__close",on:{click:function(){return t.onRemoveUser({userId:r.userId})}}},[e("icon-close-red")],1)])])])])})),0):t._e()])},e.xk=[]},191616:(t,e,r)=>{r.r(e),r.d(e,{default:()=>o});var n=r(813085);const o=(0,r(551900).Z)({},n.sY,n.xk,!1,null,"b83f153a",null).exports},326478:(t,e,r)=>{r.r(e),r.d(e,{__esModule:()=>
2o.X,default:()=>a});var n=r(911964),o=r(124215);const i=o.Z,a=(0,r(551900).Z)(i,n.sY,n.xk,!1,null,"e5352b58",null).exports},903575:(t,e,r)=>{r.r(e),r.d(e,{__esModule:()=>o.X,default:()=>a});var n=r(433897),o=r(297172);const i=o.Z,a=(0,r(551900).Z)(i,n.sY,n.xk,!1,null,"0f67773c",null).exports}}]);
3//# sourceMappingURL=userSwitchAccount-53d1d774cd3831faf9eb.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.