1(self.webpackChunkcodecombat=self.webpackChunkcodecombat||[]).push([[6862],{678541:(e,t,s)=>{"use strict";var r=s(975434),a={description:"Third parties who can make API calls, usually on behalf of a user.",type:"object",properties:{creator:{type:"object",description:"Id of user who created this APIClient"},secret:{type:"string",description:"hashed version of a secret key that is required for API calls"},features:{type:"object",description:"Feature flags applied to associated users",additionalProperties:s(662319).FeatureAuthoritySchema},permissions:{type:"object",description:"permissions assigned to the API client",properties:{manageLicensesViaUI:{type:"boolean",default:!1},manageLicensesViaAPI:{type:"boolean",default:!0},revokeLicensesViaUI:{type:"boolean",default:!1},revokeLicensesViaAPI:{type:"boolean",default:!1},manageSubscriptionViaAPI:{type:"boolean",default:!1},revokeSubscriptionViaAPI:{type:"boolean",default:!1}}},minimumLicenseDays:{type:"integer",default:365},licenseDaysGranted:{type:"integer",description:"The APIClient can grant licenses to its users for this number of days",default:0},autoClanOwner:r.objectId({description:"owner (user) of APIClient auto clan"}),accessPermissions:r.array({description:"list users who have the access permission to the api-client-auto-clan"},{type:"object",properties:{target:r.objectId(),access:{type:"string",enum:["read","write"]}}},{info:{type:"object",properties:{name:{type:"string",description:"library or client name"},startDate:{type:"date",description:"startDate of when we started giving out licenses to client/library"},endDate:{type:"date",description:"renewalDate of client"},imagePath:{type:"string",description:"path of library/client logo in /images${imagePath} location"}}}})}};r.extendBasicProperties(a,"Client"),r.extendNamedProperties(a),e.exports=a},638625:(e,t,s)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var s=0;s<t.length;s++){var r=t[s];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,n(r.key),r)}}function n(e){var t=function(e,t){if("object"!=r(e)||!e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var a=s.call(e,t);if("object"!=r(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==r(t)?t:t+""}function o(e,t,s){return t=c(t),function(e,t){if(t&&("object"==r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,s||[],c(e).constructor):t.apply(e,s))}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(l=function(){return!!e})()}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function u(e,t){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},u(e,t)}var d,p=s(708399),m=s(848304),f=s(919720).default;e.exports=((d=function(e){function t(){return a(this,t),o(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}(t,e),s=t,r=[{key:"initClass",value:function(){this.prototype.id="licensor-view",this.prototype.template=m,this.prototype.VueComponent=f}}],null&&i(s.prototype,null),r&&i(s,r),Object.defineProperty(s,"prototype",{writable:!1}),s;var s,r}(p)).initClass(),d)},708399:(e,t,s)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var s=0;s<t.length;s++){var r=t[s];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,n(r.key),r)}}function n(e){var t=function(e,t){if("object"!=r(e)||!e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var a=s.call(e,t);if("object"!=r(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==r(t)?t:t+""}function o(e,t,s){return t=d(t),function(e,t){if(t&&("object"==r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,s||[],d(e).constructor):t.apply(e,s))}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(l=function(){return!!e})()}function c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,s){var r=u(e,t);if(r){var a=Object.getOwnPropertyDescriptor(r,t);return a.get?a.get.call(arguments.length<3?e:s):a.value}},c.apply(null,arguments)}function u(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}
1function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}var m,f=s(976911),h=s(196363),v={commit:_.noop,dispatch:_.noop};e.exports=((m=function(e){function t(){return a(this,t),o(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(t,e),s=t,r=[{key:"afterRender",value:function(){if(this.vueComponent)this.$el.find("#site-content-area").replaceWith(this.vueComponent.$el);else{if(this.vuexModule){if(!_.isFunction(this.vuexModule))throw new Error("@vuexModule should be a function");h.registerModule("page",this.vuexModule())}this.vueComponent=new this.VueComponent({el:this.$el.find("#site-content-area")[0],propsData:this.propsData,store:h}),window.rootComponent=this.vueComponent}return c(d(t.prototype),"afterRender",this).apply(this,arguments)}},{key:"destroy",value:function(){return this.vuexModule&&h.unregisterModule("page"),this.vueComponent.$destroy(),this.vueComponent.$store=v,c(d(t.prototype),"destroy",this).call(this)}}],n=[{key:"initClass",value:function(){this.prototype.VueComponent=null,this.prototype.vuexModule=null,this.prototype.propsData=null}}],r&&i(s.prototype,r),n&&i(s,n),Object.defineProperty(s,"prototype",{writable:!1}),s;var s,r,n}(f)).initClass(),m)},49268:(e,t)=>{"use strict";t.xk=t.sY=void 0,t.sY=function(){var e=this,t=e._self._c;return e.$store.getters["me/isAdmin"]||e.$store.getters["me/isLicensor"]?t("div",{staticClass:"licensor container"},[t("form",{staticClass:"form",attrs:{id:"prepaid-form"}},[t("h3",[e._v("Create New License")]),t("div",{staticClass:"row"},[t("div",{staticClass:"col-sm-6"},[e._m(0),e._m(1),t("div",{staticClass:"form-group"},[t("label",{attrs:{for:"startDate"}},[e._v("Start Date")]),t("input",{staticClass:"form-control",attrs:{type:"date",name:"startDate",id:"startDate"},domProps:{value:e.timestampStart}})]),t("div",{staticClass:"form-group"},[t("label",{attrs:{for:"endDate"}},[e._v("End Date")]),t("input",{staticClass:"form-control",attrs:{type:"date",name:"endDate",id:"endDate"},domProps:{value:e.timestampEnd}}),"Asia/Shanghai"==e.timeZone?t("h4",{staticClass:"small"},[e._v("*All licenses granted after Oct 29, 2018 start at 12am CT on the start date and end at 11:59pm CT on the end date listed. All licenses that were granted before that date start and end at 3pm CT on the date listed.")]):t("h4",{staticClass:"small"},[e._v("*All licenses granted after July 9, 2018 start at 12am PT on the start date and end at 11:59pm PT on the end date listed. All licenses that were granted before that date start and end at 5pm PT on the date listed.")])]),t("div",{staticClass:"form-group"},[t("div",[e.createLicenseIsLoading?t("label"):e._e(),e.createLicenseIsLoading?t("span",[e._v(e._s(e.createLicenseProgress.done)+" / "+e._s(e.createLicenseProgress.total)+" emails processed")]):e._e()]),t("button",{staticClass:"btn btn-primary form-control",class:{disabled:!!e.createLicenseIsLoading},attrs:{name:"addLicense",id:"addLicense"},on:{click:function(t){return t.preventDefault(),e.onCreateLicense.apply(null,arguments)}}},[e._v("Add Licenses")])])])])]),t("form",{staticClass:"form",attrs:{id:"prepaid-show-form"}},[t("h3",[e._v("Show Licenses")]),t("div",{staticClass:"row"},[t("div",{staticClass:"col-sm-6"},[e._m(2),t("div",{staticClass:"form-group"},[t("button",{staticClass:"btn btn-primary form-control",attrs:{name:"showLicense",id:"showLicense"},on:{click:function(t){return t.preventDefault(),e.onShowLicense.apply(null,arguments)}}},[e._v("Show Licenses")])])])]),e.prepaids.length>0?t("table",{staticClass:"table table-condensed",attrs:{id:"prepaid-table"}},[t("tr",[t("th",{staticClass:"border"},[e._v("ID")]),t("th",{staticClass:"border"},[e._v("Creator")]),t("th",{staticClass:"border"},[e._v("Type")]),"Asia/Shanghai"==e.timeZone?t("th",{staticClass:"border"}
1,[e._v("Start (CT)")]):t("th",{staticClass:"border"},[e._v("Start (PT)")]),"Asia/Shanghai"==e.timeZone?t("th",{staticClass:"border"},[e._v("End (CT)")]):t("th",{staticClass:"border"},[e._v("End (PT)")]),t("th",{staticClass:"border"},[e._v("Used")])]),e._l(e.prepaids,(function(s){return t("tr",[t("td",{staticClass:"border"},[e._v(e._s(s._id))]),t("td",{staticClass:"border"},[e._v(e._s(s.creator))]),t("td",{staticClass:"border"},[e._v(e._s(s.type))]),t("td",{staticClass:"border"},[e._v(e._s(s.startDate))]),t("td",{staticClass:"border"},[e._v(e._s(s.endDate))]),t("td",{staticClass:"border"},[e._v(e._s(s.used)+" / "+e._s(s.maxRedeemers||0))])])}))],2):e._e()]),t("form",{staticClass:"form",attrs:{id:"client-form"}},[t("h3",[e._v("Create/Edit API Client")]),t("div",{staticClass:"row"},[t("div",{staticClass:"col-sm-4"},[e._m(3),t("div",{staticClass:"form-group"},[t("label",{attrs:{for:"licenseDaysGranted"}},[e._v("licenseDaysGranted")]),t("input",{staticClass:"form-control",attrs:{type:"number",name:"licenseDaysGranted",id:"licenseDaysGranted"},domProps:{value:e.defaultClientVal.licenseDaysGranted.default}})]),t("div",{staticClass:"form-group"},[t("label",{attrs:{for:"minimumLicenseDays"}},[e._v("minimumLicenseDays")]),t("input",{staticClass:"form-control",attrs:{type:"number",name:"minimumLicenseDays",id:"minimumLicenseDays"},domProps:{value:e.defaultClientVal.minimumLicenseDays.default}})])]),t("div",{staticClass:"col-sm-4"},[t("div",{staticClass:"form-group"},[t("label",{attrs:{for:"manageLicensesViaUI"}},[e._v("manageLicensesViaUI")]),t("select",{staticClass:"form-control",attrs:{name:"manageLicensesViaUI",id:"manageLicensesViaUI"}},[t("option",{domProps:{value:e.defaultClientVal.permissions.properties.manageLicensesViaUI.default}},[e._v(e._s(e.defaultClientVal.permissions.properties.manageLicensesViaUI.default))]),t("option",{domProps:{value:!e.defaultClientVal.permissions.properties.manageLicensesViaUI.default}},[e._v(e._s(!e.defaultClientVal.permissions.properties.manageLicensesViaUI.default))])])]),t("div",{staticClass:"form-group"},[t("label",{attrs:{for:"manageLicensesViaAPI"}},[e._v("manageLicensesViaAPI")]),t("select",{staticClass:"form-control",attrs:{name:"manageLicensesViaAPI",id:"manageLicensesViaAPI"}},[t("option",{domProps:{value:e.defaultClientVal.permissions.properties.manageLicensesViaAPI.default}},[e._v(e._s(e.defaultClientVal.permissions.properties.manageLicensesViaAPI.default))]),t("option",{domProps:{value:!e.defaultClientVal.permissions.properties.manageLicensesViaAPI.default}},[e._v(e._s(!e.defaultClientVal.permissions.properties.manageLicensesViaAPI.default))])])]),t("div",{staticClass:"form-group"},[t("label",{attrs:{for:"revokeLicensesViaUI"}},[e._v("revokeLicensesViaUI")]),t("select",{staticClass:"form-control",attrs:{name:"revokeLicensesViaUI",id:"revokeLicensesViaUI"}},[t("option",{domProps:{value:e.defaultClientVal.permissions.properties.revokeLicensesViaUI.default}},[e._v(e._s(e.defaultClientVal.permissions.properties.revokeLicensesViaUI.default))]),t("option",{domProps:{value:!e.defaultClientVal.permissions.properties.revokeLicensesViaUI.default}},[e._v(e._s(!e.defaultClientVal.permissions.properties.revokeLicensesViaUI.default))])])])]),t("div",{staticClass:"col-sm-4"},[t("div",{staticClass:"form-group"},[t("label",{attrs:{for:"revokeLicensesViaAPI"}},[e._v("revokeLicensesViaAPI")]),t("select",{staticClass:"form-control",attrs:{name:"revokeLicensesViaAPI",id:"revokeLicensesViaAPI"}},[t("option",{domProps:{value:e.defaultClientVal.permissions.properties.revokeLicensesViaAPI.default}},[e._v(e._s(e.defaultClientVal.permissions.properties.revokeLicensesViaAPI.default))]),t("option",{domProps:{value:!e.defaultClientVal.permissions.properties.revokeLicensesViaAPI.default}},[e._v(e._s(!e.defaultClientVal.permissions.properties.revokeLicensesViaAPI.default))])])]),t("div",{staticClass:"form-group"},[t("label",{attrs:{for:"manageSubscriptionViaAPI"}},[e._v("manageSubscriptionViaAPI")]),t("select",{staticClass:"form-control",attrs:{name:"manageSubscriptionViaAPI",id:"manageSubscriptionViaAPI"}},[t("option",{domProps:{value:e.defaultClientVal.permissions.properties.manageSubscriptionViaAPI.default}},[e._v(e._s(e.defaultClientVal.permissions.properties.manageSubscriptionViaAPI.default))]),t("option",{domProps:{value:!e.defaultClientVal.permissions.properties.manageSubscriptionViaAPI.default}},[e._v(e._s(!e.defaultClientVal.permissions.properties.manageSubscriptionViaAPI.default))])])]),t("div",{staticClass:"form-group"},[t("label",{attrs:{for:"revokeSubscriptionViaAPI"}},[e._v("revokeSubscriptionViaAPI")]),t("select",{staticClass:"form-control",attrs:{name:"revokeSubscriptionViaAPI",id:"revokeSubscriptionViaAPI"}},[t("option",{domProps:{value:e.defaultClientVal.permissions.properties.revokeSubscriptionViaAPI.default}},[e._v(e._s(e.defaultClientVal.permissions.properties.revokeSubscriptionViaAPI.default))]),t("option",{domProps:{value:!e.defaultClientVal.permissions.properties.revokeSubscriptionViaAPI.default}},[e._v(e._s(!e.defaultClientVal.permissions.properties.revokeSubscriptionViaAPI.default))])])])])]),t("div",{staticClass:"form-group"},[t("div",{staticClass:"row"},[t("div",{staticClass:"col-xs-4"},[t("button",{staticClass:"btn btn-primary form-control",attrs:{name:"createClient",id:"createClient"},on:{click:function(t){return t.preventDefault(),e.onCreateApiClient.apply(null,arguments)}}},[e._v("Create API Client")]),t("h4",{staticClass:"small"},[e._v("*It will create a new API client and generate its secret")])]),t("div",{staticClass:"col-xs-4"},[t("button",{staticClass:"btn btn-primary form-control",attrs:{name:"editClient",id:"editClient"},on:{click:function(t){return t.preventDefault(),e.onEditApiClient.apply(null,arguments)}}},[e._v("Edit API Client")])])])])]),t("form",{staticClass:"form",attrs:{id:"client-features-form"}},[t("h3",[e._v("Toggle API Client Feature Flags")]),t("div",{staticClass:"form-group"},e._l(e.ownedClients,(function(s){return t("table",{staticClass:"table table-condensed",attrs:{id:"features-table"}},[e._m(4,!0),e._l(s.features,(function(r){return t("tr",{staticClass:"border"},[t("td",{staticClass:"center"},[e._v(e._s(s.name))]),t("td",{staticClass:"center"},[t("input",{directives:[{name:"model",rawName:"v-model",value:r.enabled,expression:"feature.enabled"}],attrs:{type:"checkbox",name:s._id+r.name},domProps:{checked:Array.isArray(r.enabled)?e._i(r.enabled,null)>-1:r.enabled},on:{change:function(t){var s=r.enabled,a=t.target,i=!!a.checked;if(Array.isArray(s)){var n=e._i(s,null);a.checked?n<0&&e.$set(r,"enabled",s.concat([null])):n>-1&&e.$set(r,"enabled",s.slice(0,n).concat(s.slice(n+1)))}else e.$set(r,"enabled",i)}}})]),t("td",{staticClass:"center"},[e._v(e._s(r.name))]),t("td",{staticClass:"center"},[e._v(e._s(r.type))])])}))],2)})),0),t("div",{staticClass:"form-group"},[t("button",{staticClass:"btn btn-primary form-control",attrs:{name:"updateClientFeatures",id:"updateClientFeatures"},on:{click:function(t){return t.preventDefault(),e.onUpdateApiClientFeatures.apply(null,arguments)}}},[e._v("Update Client Feature Flags")]),t("h4",{staticClass:"small"},[e._v("*Users created by this API Client will have this feature flag applied on their browser refresh or login")])])]),t("form",{staticClass:"form",attrs:{id:"client-show-form"}},[t("h3",[e._v("Show API Client")]),t("div",{staticClass:"row"},[t("div",{staticClass:"col-sm-4"},[e._m(5),t("div",{staticClass:"form-group"},[t("button",{staticClass:"btn btn-primary",attrs:{name:"showClient",id:"showClient"},on:{click:function(t){return t.preventDefault(),e.onShowApiClient.apply(null,arguments)}}},[e._v("Show API Client")]),t("button",{staticClass:"btn btn-primary",attrs:{name:"showAllClient",id:"showAllClient"},on:{click:function(t){return t.preventDefault(),e.onShowAllApiClient.apply(null,arguments)}}},[e._v("Show All API Clients")])])])]),1==e.clients.length?t("table",{staticClass:"table table-condensed",attrs:{id:"client-table"}},[e._m(6),e._l(e.clients,(function(s){return t("tr",[t("td",{staticClass:"border"},[e._v(e._s(s._id))]),t("td",{staticClass:"border"},[e._v(e._s(s.slug))]),t("td",{staticClass:"border"},[e._v(e._s(s.name))]),t("td",{staticClass:"border"},[e._v(e._s(s.licenseDaysGranted))]),t("td",{staticClass:"border"},[e._v(e._s(s.minimumLicenseDays))]),t("td",{staticClass:"border"},[e._v(e._s(s.licenseDaysUsed))]),t("td",{staticClass:"border"},[e._v(e._s(s.licenseDaysRemaining))]),t("td",{staticClass:"border"},[e._v(e._s(s.activeLicenses))])])}))],2):e._e(),1==e.clients.length&&e.clients[0].licenseDaysByMonth?t("table",{staticClass:"table table-condensed"},[t("tr",[t("th",{staticClass:"border"},[e._v("Month")]),t("th",{staticClass:"border"},[e._v("License days used by "+e._s(e.clients[0].name))]),t("th",{staticClass:"border"},[e._v("Users with active licenses")])]),e._l(e.clients[0].licenseDaysByMonth,(function(s,r){return t("tr",[t("td",{staticClass:"border"},[e._v(e._s(r))]),t("td",{staticClass:"border"},[e._v(e._s(s.daysUsed))]),t("td",{staticClass:"border"},[e._v(e._s(s.noOfRedeemers))])])}))],2):e._e(),1==e.clients.length&&e.clients[0].licenseDaysByMonthAndTeacher?t("table",{staticClass:"table table-condensed"},[e._m(7),e._l(e.clients[0].licenseDaysByMonthAndTeacher,(function(s){return t("tr",[t("td",{staticClass:"border"},[e._v(e._s(s.month))]),t("td",{staticClass:"border"},[e._v(e._s(s.teacher))]),t("td",{staticClass:"border"},[e._v(e._s(s.licenseDaysUsed))]),t("td",{staticClass:"border"},[e._v(e._s(s.activeLicenses))])])}))],2):e._e(),e._l(e.clients,(function(s){return 1==e.clients.length?t("label",{staticClass:"border"}
1,[e._v("Client permissions:"+e._s(" ")),e._l(s.permissions,(function(s,r){return t("h4",{staticClass:"small"},[e._v(e._s(r)+": "+e._s(s))])}))],2):e._e()})),e._l(e.clients,(function(s){return 1==e.clients.length?t("label",{staticClass:"border"},[e._v("Client secret:"+e._s(" ")),t("h4",{staticClass:"small"},[e._v(e._s(s.secret))])]):e._e()})),e.clients.length>1?t("table",{staticClass:"table table-condensed",attrs:{id:"client-table"}},[e._m(8),e._l(e.clients,(function(s){return t("tr",[t("td",{staticClass:"border"},[e._v(e._s(s._id))]),t("td",{staticClass:"border"},[e._v(e._s(s.name))])])}))],2):e._e()],2),t("div",{staticClass:"form",attrs:{id:"oauth-form"}},[t("h3",[e._v("Create/Edit OAuth Provider")]),e._m(9),t("div",{staticClass:"form-group"},[t("button",{staticClass:"btn btn-primary",attrs:{name:"createProvider",id:"createProvider"},on:{click:function(t){return t.preventDefault(),e.onCreateOauth.apply(null,arguments)}}},[e._v("Create Provider")]),t("button",{staticClass:"btn btn-primary",attrs:{name:"editProvider",id:"editProvider"},on:{click:function(t){return t.preventDefault(),e.onEditOauth.apply(null,arguments)}}},[e._v("Edit Provider")]),t("h4",{staticClass:"small"},[e._v("*Edit will not remove any values that you leave blank here, it will only update if you populate any field")])])]),t("form",{staticClass:"form",attrs:{id:"oauth-show-form"}},[t("h3",[e._v("Show OAuthProvider")]),t("div",{staticClass:"row"},[t("div",{staticClass:"col-sm-4"},[e._m(10),t("div",{staticClass:"form-group"},[t("button",{staticClass:"btn btn-primary",attrs:{name:"showProvider",id:"showProvider"},on:{click:function(t){return t.preventDefault(),e.onShowOauth.apply(null,arguments)}}},[e._v("Show Provider")]),t("button",{staticClass:"btn btn-primary",attrs:{name:"showAllProvider",id:"showAllProvider"},on:{click:function(t){return t.preventDefault(),e.onShowAllOauth.apply(null,arguments)}}},[e._v("Show All Providers")])])])]),e._l(e.oauthProvider,(function(s){return 1==e.oauthProvider.length?t("table",{staticClass:"table table-condensed",attrs:{id:"o-auth-table"}},[t("tr",e._l(s,(function(s,r){return t("th",{staticClass:"border"},[e._v(e._s(r))])})),0),t("tr",e._l(s,(function(s,r){return t("td",{staticClass:"border"},[e._v(e._s(s))])})),0)]):e._e()})),e.oauthProvider.length>1?t("table",{staticClass:"table table-condensed",attrs:{id:"o-auth-table"}},[e._m(11),e._l(e.oauthProvider,(function(s){return t("tr",[t("td",{staticClass:"border"},[e._v(e._s(s.name))])])}))],2):e._e()],2)]):t("div",{staticClass:"licensor container"},[t("h4",[e._v("You must be logged in as a licensor or admin to view this page.")])])},t.xk=[function(){var e=this,t=e._self._c;return t("div",{staticClass:"form-group"},[t("label",{attrs:{for:"email"}},[e._v("Teacher email")]),t("em",{staticClass:"small"},[e._v(" (or comma separated list of emails)")]),t("input",{staticClass:"form-control",attrs:{type:"text",id:"email",name:"email",placeholder:"[email protected] [email protected]"}})])},function(){var e=this._self._c;return e("div",{staticClass:"form-group"},[e("label",{attrs:{for:"maxRedeemers"}},[this._v("Number of Licenses")]),e("input",{staticClass:"form-control",attrs:{type:"number",min:"1",name:"maxRedeemers",id:"maxRedeemers"}})])},function(){var e=this._self._c;return e("div",{staticClass:"form-group"},[e("label",{attrs:{for:"getEmail"}},[this._v("Teacher Email")]),e("input",{staticClass:"form-control",attrs:{type:"email",name:"getEmail",id:"getEmail",placeholder:"[email protected]"}})])},function(){var e=this._self._c;return e("div",{staticClass:"form-group"},[e("label",{attrs:{for:"clientName"}},[this._v("Client name")]),e("input",{staticClass:"form-control",attrs:{type:"text",name:"clientName",id:"clientName",placeholder:"Acme Dev"}})])},function(){var e=this,t=e._self._c;return t("tr",{staticClass:"border"},[t("th",[e._v("API Client")]),t("th",[e._v("Enabled")]),t("th",[e._v("Name")]),t("th",[e._v("Type")])])},function(){var e=this._self._c;return e("div",{staticClass:"form-group"},[e("label",{attrs:{for:"clientNameShow"}},[this._v("Client Name")]),e("input",{staticClass:"form-control",attrs:{type:"text",name:"clientNameShow",id:"clientNameShow"}})])},function(){var e=this,t=e._self._c;return t("tr",[t("th",{staticClass:"border"},[e._v("ID")]),t("th",{staticClass:"border"},[e._v("Slug")]),t("th",{staticClass:"border"},[e._v("Name")]),t("th",{staticClass:"border"},[e._v("License days granted to client")]),t("th",{staticClass:"border"},[e._v("minimumLicenseDays")]),t("th",{staticClass:"border"},[e._v("License days used by client")]),t("th",{staticClass:"border"},[e._v("License days remaining")]),t("th",{staticClass:"border"},[e._v("Users having active licenses")])])},function(){var e=this,t=e._self._c;return t("tr",[t("th",{staticClass:"border"},[e._v("Month")]),t("th",{staticClass:"border"},[e._v("Teacher or classroom name")]),t("th",{staticClass:"border"},[e._v("License days used")]),t("th",{staticClass:"border"},[e._v("Users with active licenses")])])},function(){var e=this,t=e._self._c;return t("tr",[t("th",{staticClass:"border"},[e._v("ID")]),t("th",{staticClass:"border"},[e._v("Name")])])},function(){var e=this,t=e._self._c;return t("div",{staticClass:"row"},[t("div",{staticClass:"col-sm-6"},[t("h4",[e._v("Required")]),t("div",{staticClass:"form-group"},[t("label",{attrs:{for:"oauthname"}},[e._v("Provider Name")]),t("input",{staticClass:"form-control",attrs:{type:"text",name:"oauthName",id:"oauthName",placeholder:"Acme Dev"}})]),t("div",{staticClass:"form-group"},[t("label",{attrs:{for:"lookupUrlTemplate"}},[e._v("Lookup URL Template")]),t("input",{staticClass:"form-control",attrs:{type:"text",name:"lookupUrlTemplate",id:"lookupUrlTemplate",placeholder:"https://api.acme.com/v1/auth/coco/userinfo/?token=<%= accessToken %>"}})]),t("div",{staticClass:"form-group"},[t("label",{attrs:{for:"tokenUrl"}},[e._v("Token URL")]),t("input",{staticClass:"form-control",attrs:{type:"text",name:"tokenUrl",id:"tokenUrl",placeholder:"https://api.acme.com/v1/auth/coco/token/"}})])]),t("div",{staticClass:"col-sm-6"},[t("h4",[e._v("Optional")]),t("div",{staticClass:"form-group"},[t("label",{attrs:{for:"lookupIdProperty"}},[e._v("Lookup Id Property")]),t("input",{staticClass:"form-control",attrs:{type:"text",name:"lookupIdProperty",id:"lookupIdProperty"}})]),t("div",{staticClass:"form-group"},[t("label",{attrs:{for:"tokenMethod"}},[e._v("Token Method")]),t("select",{staticClass:"form-control",attrs:{name:"tokenMethod",id:"tokenMethod"}},[t("option",{attrs:{value:""}},[e._v("None")]),t("option",{attrs:{value:"get"}},[e._v("GET")]),t("option",{attrs:{value:"post"}},[e._v("POST")])])]),t("div",{staticClass:"form-group"},[t("label",{attrs:{for:"tokenAuthUser"}},[e._v("Token Auth User")]),t("em",{staticClass:"small"},[e._v(" (our client ID to access token url)")]),t("input",{staticClass:"form-control",attrs:{type:"text",name:"tokenAuthUser",id:"tokenAuthUser"}})]),t("div",{staticClass:"form-group"},[t("label",{attrs:{for:"tokenAuthPass"}},[e._v("Token Auth Password")]),t("em",{staticClass:"small"},[e._v(" (our client password to access token url)")]),t("input",{staticClass:"form-control",attrs:{type:"text",name:"tokenAuthPass",id:"tokenAuthPass"}})]),t("div",{staticClass:"form-group"},[t("label",{attrs:{for:"strictSSL"}},[e._v("Strict SSL")]),t("em",{staticClass:"small"},[e._v(' (usually false for dev, optionally true for prod; "None" is false)')]),t("select",{staticClass:"form-control",attrs:{name:"strictSSL",id:"strictSSL"}},[t("option",{attrs:{value:""}},[e._v("None")]),t("option",{attrs:{value:"true"}},[e._v("True")]),t("option",{attrs:{value:"false"}},[e._v("False")])])]),t("div",{staticClass:"form-group"},[t("label",{attrs:{for:"redirectAfterLogin"}},[e._v("Redirect URL After Login")]),t("input",{staticClass:"form-control",attrs:{type:"text",name:"redirectAfterLogin",i
1d:"redirectAfterLogin"}})])])])},function(){var e=this._self._c;return e("div",{staticClass:"form-group"},[e("label",{attrs:{for:"oauthNameShow"}},[this._v("Provider Name")]),e("input",{staticClass:"form-control",attrs:{type:"text",name:"oauthNameShow",id:"oauthNameShow"}})])},function(){var e=this._self._c;return e("tr",[e("th",{staticClass:"border"},[this._v("Name")])])}]},175749:(e,t,s)=>{var r,a,i,n,o,l,c,u,d=s(619755);i=s(588333),r=s(694879),n=s(439980),o=s(299498).getQueryVariable,a=s(678541),l=(u=s(420629)).mapActions,u.mapState,c=u.mapGetters,e.exports=Vue.extend({data:function(){return{prepaids:[],clients:[],currentClientFeatures:{},ownedClients:[],oauthProvider:[],defaultClientVal:a.properties,timeZone:"America/Los_Angeles",createLicenseProgress:{done:0,total:0}}},created:function(){var e;if(me.isAdmin()||me.isLicensor())return("undefined"!=typeof features&&null!==features?features.chinaInfra:void 0)&&(this.timeZone="Asia/Shanghai"),r.apiClients.getAll().then((e=this,function(t){return e.ownedClients=t,d.ajax({type:"GET",url:"/db/feature",success:function(t){var s,r,a,i,n,l,c,u,d,p,m,f,h,v;for(v=o("showGlobalToggles",!1),h=[],i=n=0,d=e.ownedClients.length;0<=d?n<d:n>d;i=0<=d?++n:--n){for(null==(r=e.ownedClients[i]).features&&(r.features={}),null==(s=e.currentClientFeatures)[u=r._id]&&(s[u]={}),l=0,c=t.length;l<c;l++)a=t[l],v||"global"!==a.type?(r.features[a._id]=_.assign(_.cloneDeep(a),null!=(p=r.features[a._id])?p:{}),e.currentClientFeatures[r._id][a._id]=null!=(m=null!=(f=r.features[a._id])?f.enabled:void 0)&&m):delete r.features[a._id];h.push(Vue.set(e.ownedClients,i,r))}return h},error:function(e){return noty({text:"Failed to find fetch features",type:"error"}),console.error(e)}})}))},methods:Object.assign({},l({fetchLicenseStats:"apiClient/fetchLicenseStats"}),{runValidation:function(e,t){var s,r;if(n.clearFormAlerts(e),s=n.formToObject(e[0]),(r=tv4.validateMultiple(s,{required:t})).valid)return s;n.applyErrorsToForm(e,r.errors)},onCreateLicense:i.wrap((function*(){var e,t,s,a,i,o,l,c,u,p,m;if(s=d("#prepaid-form"),p=["email","maxRedeemers","startDate","endDate"],t=this.runValidation(s,p))if(t.maxRedeemers>0){if(t.endDate>t.startDate){for(i=t.email.split(",").map((function(e){return e.trim()})),this.createLicenseProgress.total=i.length,this.createLicenseProgress.done=0,l=[],c=0,u=i.length;c<u;c++)if(a=i[c],this.createLicenseProgress.done+=1,n.validateEmail(a))try{m=yield r.users.getByEmail({email:a}),(e=t).maxRedeemers=parseInt(t.maxRedeemers),e.endDate=e.endDate+" 23:59",e.startDate=moment.timezone.tz(e.startDate,this.timeZone).toISOString(),e.endDate=moment.timezone.tz(e.endDate,this.timeZone).toISOString(),_.extend(e,{type:"course",creator:m._id,properties:{licensorAdded:me.id}}),yield r.prepaids.post(e),noty({text:"License created for "+a,timeout:2e3,type:"success"})}catch(e){o=e,console.log(o),l.push(a+" - "+((null!=o?o.message:void 0)||"unknown error. Check console."))}else l.push(a+" - invalid email");return l.length?n.setErrorToProperty(s,"addLicense","Error<br />"+l.join("<br />")):void 0}n.setErrorToProperty(s,"endDate","End Date should be greater than Start Date")}else n.setErrorToProperty(s,"maxRedeemers","No of licenses should be greater than 0")})),onShowLicense:i.wrap((function*(){var e,t,s,a,i,o,l,c,u,p,m;if(t=d("#prepaid-show-form"),u=["getEmail"],e=this.runValidation(t,u))if(n.validateEmail(e.getEmail))try{if(s=e.getEmail,m=yield r.users.getByEmail({email:s}),this.prepaids=yield r.prepaids.getByCreator(m._id,{data:{allTypes:!0}}),!(this.prepaids.length>0))return void n.setErrorToProperty(t,"showLicense","No licenses found for this user");for(c=this.prepaids,p=[],i=0,o=c.length;i<o;i++)(l=c[i]).startDate=moment.timezone(l.startDate).tz(this.timeZone).format("l"),l.endDate=moment.timezone(l.endDate).tz(this.timeZone).format("l"),p.push(Vue.set(l,"used",(l.redeemers||[]).length));return p}catch(e){a=e,console.log(a),n.setErrorToProperty(t,"showLicense","Something went wrong")}else n.setErrorToProperty(t,"getEmail","Please enter a valid email address")})),onCreateApiClient:i.wrap((function*(){var e,t,s,a,i,o;if(a=d("#client-form"),o=["clientName","licenseDaysGranted","minimumLicenseDays","manageLicensesViaUI","manageLicensesViaAPI","revokeLicensesViaUI","revokeLicensesViaAPI","manageSubscriptionViaAPI","revokeSubscriptionViaAPI"],s=this.runValidation(a,o))if(s.minimumLicenseDays<1)n.setErrorToProperty(a,"minimumLicenseDays","minimumLicenseDays should be greater than 0");else if(s.licenseDaysGranted<0)n.setErrorToProperty(a,"licenseDaysGranted","licenseDaysGranted should be greater than or equal to 0");else try{return t={name:s.clientName,licenseDaysGranted:parseInt(s.licenseDaysGranted),minimumLicenseDays:parseInt(s.minimumLicenseDays),permissions:{manageLicensesViaUI:"true"===s.manageLicensesViaUI,manageLicensesViaAPI:"true"===s.manageLicensesViaAPI,revokeLicensesViaUI:"true"===s.revokeLicensesViaUI,revokeLicensesViaAPI:"true"===s.revokeLicensesViaAPI,manageSubscriptionViaAPI:"true"===s.manageSubscriptionViaAPI,revokeSubscriptionViaAPI:"true"===s.revokeSubscriptionViaAPI}},e=yield r.apiClients.post(t),yield r.apiClients.createSecret({clientID:e._id}),yield r.apiClients.createAutoClanOwner({clientID:e._id}),noty({text:"Client created",timeout:3e3,type:"success"})}catch(e){i=e,console.log(i),n.setErrorToProperty(a,"createClient","Something went wrong")}})),onUpdateApiClientFeatures:i.wrap((function*(){var e,t,s,a,i,o,l,c,u,p,m,f,h,v,y,b,C;for(s=d("#client-features-form"),C=[],l=0,u=(f=this.ownedClients).length;l<u;l++)for(o in h=(e=f[l]).features)i=h[o],C.push(e._id+i.name);if(t=this.runValidation(s,C))try{for(v=this.ownedClients,c=0,p=v.length;c<p;c++)for(o in y=(e=v[c]).features)i=y[o],m="on"===(null!=(b=t[e._id+i.name])?b[0]:void 0),this.currentClientFeatures[e._id][o]!==m&&(yield r.apiClients.updateFeature
1({clientID:e._id,featureID:i._id},{enabled:m}),this.currentClientFeatures[e._id][o]=m);return noty({text:"Feature flags updated",timeout:3e3,type:"success"})}catch(e){return a=e,console.log(a),n.setErrorToProperty(s,"updateClientFeatures","Something went wrong")}})),onEditApiClient:i.wrap((function*(){var e,t,s,a,i,o;if(a=d("#client-form"),o=["clientName","licenseDaysGranted","minimumLicenseDays","manageLicensesViaUI","manageLicensesViaAPI","revokeLicensesViaUI","revokeLicensesViaAPI","manageSubscriptionViaAPI","revokeSubscriptionViaAPI"],s=this.runValidation(a,o))if(s.minimumLicenseDays<1)n.setErrorToProperty(a,"minimumLicenseDays","minimumLicenseDays should be greater than 0");else if(s.licenseDaysGranted<0)n.setErrorToProperty(a,"licenseDaysGranted","licenseDaysGranted should be greater than or equal to 0");else try{return(e=yield r.apiClients.getByName(s.clientName)).length>0?((t={name:s.clientName,licenseDaysGranted:parseInt(s.licenseDaysGranted),minimumLicenseDays:parseInt(s.minimumLicenseDays),permissions:{manageLicensesViaUI:"true"===s.manageLicensesViaUI,manageLicensesViaAPI:"true"===s.manageLicensesViaAPI,revokeLicensesViaUI:"true"===s.revokeLicensesViaUI,revokeLicensesViaAPI:"true"===s.revokeLicensesViaAPI,manageSubscriptionViaAPI:"true"===s.manageSubscriptionViaAPI,revokeSubscriptionViaAPI:"true"===s.revokeSubscriptionViaAPI}}).id=e[0]._id,e=yield r.apiClients.editClient(t),noty({text:"API Client updated",timeout:3e3,type:"success"})):void n.setErrorToProperty(a,"editClient","API client not found")}catch(e){i=e,console.log(i),n.setErrorToProperty(a,"editClient","Something went wrong")}})),onShowApiClient:i.wrap((function*(){var e,t,s,a,i,o,l,c,u,p,m,f,h,v;if(a=d("#client-show-form"),p=["clientNameShow"],s=this.runValidation(a,p))try{if(this.clients=yield r.apiClients.getByName(s.clientNameShow),!(this.clients.length>0))return void n.setErrorToProperty(a,"showClient","No API Client found");for(u=this.clients,m=[],o=0,l=u.length;o<l;o++){for(c in t=u[o],yield this.fetchLicenseStats({clientId:t._id}),h=this.getLicenseStats,Vue.set(t,"licenseDaysUsed",h.licenseDaysUsed),Vue.set(t,"activeLicenses",h.activeLicenses),Vue.set(t,"licenseDaysRemaining",h.licenseDaysRemaining),Vue.set(t,"licenseDaysByMonth",h.licenseDaysByMonth),e=[],h.licenseDaysByMonth)for(v in h.licenseDaysByMonth[c].teachers)f=h.licenseDaysByMonth[c].teachers[v],e.push({month:c,teacher:v,licenseDaysUsed:f.daysUsed,activeLicenses:f.noOfRedeemers});m.push(Vue.set(t,"licenseDaysByMonthAndTeacher",e))}return m}catch(e){i=e,console.log(i),n.setErrorToProperty(a,"showClient","Something went wrong")}})),onShowAllApiClient:i.wrap((function*(){var e,t;e=d("#client-show-form");try{this.clients=yield r.apiClients.getAll(),this.clients.length>0||n.setErrorToProperty(e,"showAllClient","No API CLient found")}catch(s){t=s,console.log(t),n.setErrorToProperty(e,"showAllClient","Something went wrong")}})),onCreateOauth:i.wrap((function*(){var e,t,s,a,i;if(s=d("#oauth-form"),i=["oauthName","lookupUrlTemplate","tokenUrl"],t=this.runValidation(s,i))try{return(e=_.pick(t,"lookupUrlTemplate","tokenUrl","tokenMethod","lookupIdProperty","redirectAfterLogin")).name=t.oauthName,e.tokenAuth={user:t.tokenAuthUser,pass:t.tokenAuthPass},t.strictSSL&&(e.strictSSL="true"===t.strictSSL),yield r.oauth.post(e),noty({text:"OAuth Provider created",timeout:3e3,type:"success"})}catch(e){a=e,console.log(a),n.setErrorToProperty(s,"createProvider","Something went wrong")}})),onEditOauth:i.wrap((function*(){var e,t,s,a,i,o;if(s=d("#oauth-form"),o=["oauthName"],t=this.runValidation(s,o))try{return(i=yield r.oauth.getByName(t.oauthName)).length>0?(e=_.pick(t,"lookupUrlTemplate","tokenUrl","tokenMethod","lookupIdProperty","redirectAfterLogin"),t.strictSSL&&(e.strictSSL="true"===t.strictSSL),e.tokenAuth={user:t.tokenAuthUser,pass:t.tokenAuthPass},e.id=i[0]._id,i=yield r.oauth.editProvider(e),noty({text:"OAuth Provider updated",timeout:3e3,type:"success"})):void n.setErrorToProperty(s,"editProvider","OAuth Provider not found")}catch(e){a=e,console.log(a),n.setErrorToProperty(s,"editProvider","Something went wrong")}})),onShowOauth:i.wrap((function*(){var e,t,s,a;if(t=d("#oauth-show-form"),a=["oauthNameShow"],e=this.runValidation(t,a))try{this.oauthProvider=yield r.oauth.getByName(e.oauthNameShow),this.oauthProvider.length>0||n.setErrorToProperty(t,"showProvider","No OAuth Provider found")}catch(e){s=e,console.log(s),n.setErrorToProperty(t,"showProvider","Something went wrong")}})),onShowAllOauth:i.wrap((function*(){var e,t;e=d("#oauth-show-form");try{this.oauthProvider=yield r.oauth.getAll(),this.oauthProvider.length>0||n.setErrorToProperty(e,"showAllProvider","No OAuth Provider found")}catch(s){t=s,console.log(t),n.setErrorToProperty(e,"showAllProvider","Something went wrong")}}))}),computed:Object.assign({},c({getLicenseStats:"apiClient/getLicenseStats"}),{timestampStart:function(){return moment.timezone().tz(this.timeZone).format("YYYY-MM-DD")},timestampEnd:function(){return moment.timezone().tz(this.timeZone).add(1,"year").format("YYYY-MM-DD")},createLicenseIsLoading:function(){return this.createLicenseProgress.done!==this.createLicenseProgress.total}})})},452912:()=>{},848304:(e,t,s)=>{s(477055),e.exports=function(e){return""+'<div class="style-flat"><nav id="main-nav">\x3c!-- Will be replaced by Navigation.vue in RootView--\x3e</nav><div id="site-content-area"><p>If this is showing, you dun goofed</p></div><footer id="site-footer">\x3c!-- Will be replaced by Footer.vue in RootView--\x3e</footer></div>'}},919720:(e,t,s)=>{"use strict";s.d(t,{default:()=>n});var r=s(49268),a=s(175749);const i=s.n(a)();s(994177);const n=(0,s(551900).Z)(i,r.sY,r.xk,!1,null,"f84e3b34",null).exports},994177:(e,t,s)=>{var r=s(452912);r.__esModule&&(r=r.default),"string"==typeof r&&(r=[[e.id,r,""]]),r.locals&&(e.exports=r.locals),(0,s(745346).Z)("71279604",r,!0,{})}}]); 2//# sourceMappingURL=LicensorView-a321c02840d98c7c0e94.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.