text: define("bundles/certificate/components/CertificatePreviewContainer",["require","exports","module","react-with-addons","bundles/certificate/promises/course","bundles/catalogP/models/course","./CertificatePreview"],function(require,exports,module){"use strict";function _defaults(e,n){for(var s=Object.getOwnPropertyNames(n),t=0;t<s.length;t++){var r=s[t],o=Object.getOwnPropertyDescriptor(n,r);o&&o.configurable&&void 0===e[r]&&Object.defineProperty(e,r,o)}return e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):_defaults(t,e))}var t=function(){function defineProperties(o,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(o,e.key,e)}}return function(e,t,r){return t&&defineProperties(e.prototype,t),r&&defineProperties(e,r),e}}(),o=function get(s,a,c){var r=!0;e:for(;r;){var t=s,i=a,u=c;r=!1,null===t&&(t=Function.prototype);var e=Object.getOwnPropertyDescriptor(t,i);if(void 0===e){var o=Object.getPrototypeOf(t);if(null===o)return void 0;s=o,a=i,c=u,r=!0,e=o=void 0;continue e}if("value"in e)return e.value;var n=e.get;if(void 0===n)return void 0;return n.call(u)}},e=require("react-with-addons"),n=require("bundles/certificate/promises/course"),s=require("bundles/catalogP/models/course"),r=require("./CertificatePreview"),i=function(i){function CertificatePreviewContainer(e,r){_classCallCheck(this,CertificatePreviewContainer),o(Object.getPrototypeOf(CertificatePreviewContainer.prototype),"constructor",this).call(this,e,r);var t=e.course;t&&t.hasValidCertLogo()?this.state={course:e.course}:this.state={course:null}}return _inherits(CertificatePreviewContainer,i),t(CertificatePreviewContainer,null,[{key:"propTypes",value:{course:e.PropTypes.instanceOf(s),courseSlug:e.PropTypes.string,courseType:e.PropTypes.oneOf(["v1.session","v2.ondemand"]),userName:e.PropTypes.string,width:e.PropTypes.number,className:e.PropTypes.string},enumerable:!0},{key:"defaultProps",value:{course:null,width:450,userName:"Jane Learner"},enumerable:!0}]),t(CertificatePreviewContainer,[{key:"componentWillMount",value:function componentWillMount(){var t=this.props,e=t.course,r=t.courseSlug,o=t.courseType;!e&&r&&o?this.getCourse(r,o):e&&!e.hasValidCertLogo()&&this.getCourse(e.get("slug"),e.get("courseType"))}},{key:"getCourse",value:function getCourse(e,t){n(e,t).then(function(e){this.setState({course:e})}.bind(this)).done()}},{key:"render",value:function render(){var o=this.props,s=o.userName,n=o.width,t=this.state.course;return t?e.createElement(r,{partnerLogo:t.getCertLogo(),courseName:t.get("name"),userName:s,width:n,className:this.props.className}):e.createElement(r,{width:n,className:this.props.className})}}]),CertificatePreviewContainer}(e.Component);module.exports=i});