@aurigma/ui-framework
Version:
A platform which allows building print product personalization editors based on Aurigma's Customer's Canvas.
1 lines • 3.76 kB
JavaScript
(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[36],{942:function(e,t,r){"use strict";r.r(t),r.d(t,"AuWidgetMockup3DViewer",(function(){return p})),r.d(t,"widget",(function(){return p}));var i,n=r(0),o=r(889),a=r(2),s=r(737),u=r(1),c=r(736),l=r(545),d=function(e,t,r,n){this.preloader=!0,this.axesHelperEnabled=!1,this.orbitsControlEnabled=!0,this.container=e,this.onLoadCallback=n,this.backgroundColor=t.backgroundColor||l.a,this.orbitsControl=t.orbitsControl,this.distance=t.distance,this.camera=t.cameraButtons,this.pauseAtEnd=t.pauseAtEnd,this.preloader=t.preloader,this.modelType=null!=t.modelType?t.modelType:i.default,this.items=t.items.map((function(e,t){var i=Object.assign({},e);return i.model=r[t],i}))};!function(e){e.default="default",e.blender="blender"}(i||(i={}));var p=function(e){function t(){var t=e.call(this)||this;return t._DAMockupsApiClientConfig=t._createProductApiClientConfig(),t._DAMockupsApi=new o.b(t._DAMockupsApiClientConfig,t.designAtomsApiUrl),t}return Object(n.d)(t,e),t.prototype._createProductApiClientConfig=function(){var e=new o.a;return e.apiUrl=this.backOfficeUrl,e.setAuthorizationToken(this.token),e},Object.defineProperty(t.prototype,"ownerId",{get:function(){var e;return null===(e=this.auWizard.driver.user)||void 0===e?void 0:e.id},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"backOfficeUrl",{get:function(){return u.a.removeTrailingSlash(this.auWizard.driver.backOffice.backOfficeUrl)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"designAtomsApiUrl",{get:function(){return u.a.removeTrailingSlash(this.auWizard.driver.backOffice.designAtomsApiUrl)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tenantId",{get:function(){return this.auWizard.driver.backOffice.tenantId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"token",{get:function(){return this.auWizard.driver.backOffice.token},enumerable:!1,configurable:!0}),t.prototype.updateParams=function(e){var t;return Object(n.b)(this,void 0,void 0,(function(){var r,i,o,a,s,c,l,p,f,m,h,b,g,y,v=this;return Object(n.e)(this,(function(w){switch(w.label){case 0:if(u.a.isEmptyArray(e.items))return[2];if(r=e.items.some((function(e){return 0===e.images.filter((function(e){return e})).length})),i=e.items.some((function(e){return u.a.isEmptyString(e.model)})),r||i)return[2];this.origamiViewer=null,this.speed=null!==(t=e.animationSpeed)&&void 0!==t?t:this.speed,this._preloaderLockingSum=0,this.showPreloader(!0),o=this.querySelectorShadow("#divContainer"),a=function(){v.showPreloader(!1),v.SetAnimationSpeed(v.speed),v.PlayAnimation(),setTimeout((function(){v.image=v.origamiViewer.renderer.domElement.toDataURL(),v.emitChange({image:v.image})}),1500)},s=[],w.label=1;case 1:w.trys.push([1,6,7,8]),c=Object(n.k)(e.items),l=c.next(),w.label=2;case 2:return l.done?[3,5]:(p=l.value,m=(f=s).push,[4,this._getTextModel(p)]);case 3:m.apply(f,[w.sent()]),w.label=4;case 4:return l=c.next(),[3,2];case 5:return[3,8];case 6:return h=w.sent(),g={error:h},[3,8];case 7:try{l&&!l.done&&(y=c.return)&&y.call(c)}finally{if(g)throw g.error}return[7];case 8:return b=new d(o,e,s,a),this.origamiViewer=new window.Aurigma.Origami.Viewer(b,!0),setTimeout((function(){return v.applyInterfaceParams(e)}),250),[2]}}))}))},t.prototype._getTextModel=function(e){return Object(n.b)(this,void 0,void 0,(function(){return Object(n.e)(this,(function(t){switch(t.label){case 0:return[4,this._DAMockupsApi.getGeometryFile(e.model,e.isPrivateMockup?this.ownerId:null,this.tenantId)];case 1:return[4,t.sent().data.text()];case 2:return[2,t.sent()]}}))}))},Object(n.c)([Object(a.a)("au-widget-mockup-3d-viewer",c),Object(n.g)("design:paramtypes",[])],t)}(s.a)}}]);