UNPKG

@aurigma/ui-framework

Version:

A platform which allows building print product personalization editors based on Aurigma's Customer's Canvas.

1 lines 3.65 kB
(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[36],{942:function(e,t,r){r.r(t),r.d(t,"AuWidgetMockup3DViewer",function(){return c}),r.d(t,"widget",function(){return c});var n,i,h=r(0),o=r(889),t=r(2),a=r(737),b=r(1),s=r(736),u=r(545),g=function(e,t,r,i){this.preloader=!0,this.axesHelperEnabled=!1,this.orbitsControlEnabled=!0,this.container=e,this.onLoadCallback=i,this.backgroundColor=t.backgroundColor||u.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:n.default,this.items=t.items.map(function(e,t){e=Object.assign({},e);return e.model=r[t],e})},c=((r=n=n||{}).default="default",r.blender="blender",i=a.a,Object(h.d)(l,i),l.prototype._createProductApiClientConfig=function(){var e=new o.a;return e.apiUrl=this.backOfficeUrl,e.setAuthorizationToken(this.token),e},Object.defineProperty(l.prototype,"ownerId",{get:function(){var e;return null==(e=this.auWizard.driver.user)?void 0:e.id},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"backOfficeUrl",{get:function(){return b.a.removeTrailingSlash(this.auWizard.driver.backOffice.backOfficeUrl)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"designAtomsApiUrl",{get:function(){return b.a.removeTrailingSlash(this.auWizard.driver.backOffice.designAtomsApiUrl)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"tenantId",{get:function(){return this.auWizard.driver.backOffice.tenantId},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"token",{get:function(){return this.auWizard.driver.backOffice.token},enumerable:!1,configurable:!0}),l.prototype.updateParams=function(f){var m;return Object(h.b)(this,void 0,void 0,function(){var t,r,i,n,o,a,s,u,c,l,d,p=this;return Object(h.e)(this,function(e){switch(e.label){case 0:if(b.a.isEmptyArray(f.items))return[2];if(t=f.items.some(function(e){return 0===e.images.filter(function(e){return e}).length}),r=f.items.some(function(e){return b.a.isEmptyString(e.model)}),t||r)return[2];this.origamiViewer=null,this.speed=null!=(m=f.animationSpeed)?m:this.speed,this._preloaderLockingSum=0,this.showPreloader(!0),t=this.querySelectorShadow("#divContainer"),r=function(){p.showPreloader(!1),p.SetAnimationSpeed(p.speed),p.PlayAnimation(),setTimeout(function(){p.image=p.origamiViewer.renderer.domElement.toDataURL(),p.emitChange({image:p.image})},1500)},i=[],e.label=1;case 1:e.trys.push([1,6,7,8]),n=Object(h.k)(f.items),o=n.next(),e.label=2;case 2:return o.done?[3,5]:(u=o.value,s=(a=i).push,[4,this._getTextModel(u)]);case 3:s.apply(a,[e.sent()]),e.label=4;case 4:return o=n.next(),[3,2];case 5:return[3,8];case 6:return u=e.sent(),l={error:u},[3,8];case 7:try{o&&!o.done&&(d=n.return)&&d.call(n)}finally{if(l)throw l.error}return[7];case 8:return c=new g(t,f,i,r),this.origamiViewer=new window.Aurigma.Origami.Viewer(c,!0),setTimeout(function(){return p.applyInterfaceParams(f)},250),[2]}})})},l.prototype._getTextModel=function(t){return Object(h.b)(this,void 0,void 0,function(){return Object(h.e)(this,function(e){switch(e.label){case 0:return[4,this._DAMockupsApi.getGeometryFile(t.model,t.isPrivateMockup?this.ownerId:null,this.tenantId)];case 1:return[4,e.sent().data.text()];case 2:return[2,e.sent()]}})})},Object(h.c)([Object(t.a)("au-widget-mockup-3d-viewer",s),Object(h.g)("design:paramtypes",[])],l));function l(){var e=i.call(this)||this;return e._DAMockupsApiClientConfig=e._createProductApiClientConfig(),e._DAMockupsApi=new o.b(e._DAMockupsApiClientConfig,e.designAtomsApiUrl),e}}}]);