@aurigma/ui-framework
Version:
A platform which allows building print product personalization editors based on Aurigma's Customer's Canvas.
1 lines • 2.6 kB
JavaScript
(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[36],{942:function(e,t,i){"use strict";i.r(t),i.d(t,"AuWidgetMockup3DViewer",(function(){return h})),i.d(t,"widget",(function(){return h}));var r,s=i(0),a=i(889),n=i(2),o=i(737),d=i(1),l=i(736),u=i(545);class c{constructor(e,t,i,s){this.preloader=!0,this.axesHelperEnabled=!1,this.orbitsControlEnabled=!0,this.container=e,this.onLoadCallback=s,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:r.default,this.items=t.items.map(((e,t)=>{const r=Object.assign({},e);return r.model=i[t],r}))}}!function(e){e.default="default",e.blender="blender"}(r||(r={}));let h=class extends o.a{constructor(){super(),this._DAMockupsApiClientConfig=this._createProductApiClientConfig(),this._DAMockupsApi=new a.b(this._DAMockupsApiClientConfig,this.designAtomsApiUrl)}_createProductApiClientConfig(){const e=new a.a;return e.apiUrl=this.backOfficeUrl,e.setAuthorizationToken(this.token),e}get ownerId(){var e;return null===(e=this.auWizard.driver.user)||void 0===e?void 0:e.id}get backOfficeUrl(){return d.a.removeTrailingSlash(this.auWizard.driver.backOffice.backOfficeUrl)}get designAtomsApiUrl(){return d.a.removeTrailingSlash(this.auWizard.driver.backOffice.designAtomsApiUrl)}get tenantId(){return this.auWizard.driver.backOffice.tenantId}get token(){return this.auWizard.driver.backOffice.token}async updateParams(e){var t;if(d.a.isEmptyArray(e.items))return;const i=e.items.some((e=>0===e.images.filter((e=>e)).length)),r=e.items.some((e=>d.a.isEmptyString(e.model)));if(i||r)return;this.origamiViewer=null,this.speed=null!==(t=e.animationSpeed)&&void 0!==t?t:this.speed,this._preloaderLockingSum=0,this.showPreloader(!0);const s=this.querySelectorShadow("#divContainer"),a=[];for(let o of e.items)a.push(await this._getTextModel(o));const n=new c(s,e,a,(()=>{this.showPreloader(!1),this.SetAnimationSpeed(this.speed),this.PlayAnimation(),setTimeout((()=>{this.image=this.origamiViewer.renderer.domElement.toDataURL(),this.emitChange({image:this.image})}),1500)}));this.origamiViewer=new window.Aurigma.Origami.Viewer(n,!0),setTimeout((()=>this.applyInterfaceParams(e)),250)}async _getTextModel(e){const t=await this._DAMockupsApi.getGeometryFile(e.model,e.isPrivateMockup?this.ownerId:null,this.tenantId);return await t.data.text()}};h=Object(s.a)([Object(n.a)("au-widget-mockup-3d-viewer",l),Object(s.b)("design:paramtypes",[])],h)}}]);