UNPKG

@aurigma/ui-framework

Version:

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

1 lines 2.41 kB
(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[45],{871:function(e,t){e.exports='<style>\n :host {\n width: 100%;\n height: 100%;\n }\n</style>\n\n<iframe id="frameID" width="100%" height="100%" style="border: none;"></iframe>'},913:function(e,t,i){"use strict";i.r(t),i.d(t,"AuWidgetPreviewMockupSlider",(function(){return c})),i.d(t,"widget",(function(){return c}));var r=i(0),n=i(1),s=i(2),a=i(160),d=i(871);let c=class extends a.c{async exportWidgetData(e){return{previewResourceUrl:this.previewResourceUrl}}async restoreWidgetFromData(e,t){this.previewResourceUrl=null==e?void 0:e.previewResourceUrl,this.emitChange()}updateParams(e){this._initIFrame(e.productId,e.productVersionId,e.productVariantId,e.stateId,e.previewSize.width,e.previewSize.height)}async createPreviewResource(){return this.previewResourceUrl=await this._element.createPreviewResource(),this.emitChange(),this.previewResourceUrl}async _initIFrame(e,t,i,r,n,s){const a=this.querySelectorShadow("#frameID"),d=a.contentWindow||a,c=a.contentDocument||d.document;if(0===c.head.innerHTML.length){const e=await this.getScriptContent(),t=c.createRange();t.selectNode(c.head);const i=t.createContextualFragment(e);c.head.appendChild(i)}0!==c.body.innerHTML.length&&(c.body.innerHTML=""),this._element=c.createElement("au-preview-mockup-slider"),this._element.token=this.auWizard.driver.backOffice.token,this._element.assetStorageUrl=this.auWizard.driver.backOffice.assetStorageUrl,this._element.backOfficeUrl=this.auWizard.driver.backOffice.backOfficeUrl,this._element.designAtomsApiUrl=this.auWizard.driver.backOffice.designAtomsApiUrl,Number(e)&&(this._element.productId=Number(e)),Number(t)&&(this._element.productVersionId=Number(t)),Number(i)&&(this._element.productVariantId=Number(i)),this._element.tenantId=this.auWizard.driver.backOffice.tenantId,this._element.userId=this.auWizard.driver.user.id,this._element.stateId=r,Number(n)&&(this._element.previewWidth=Number(n)),Number(s)&&(this._element.previewHeight=Number(s)),c.body.appendChild(this._element)}async getScriptContent(){return n.a.loadHtml(n.a.getPatchedUrl("static/preview-mockup-slider/previewMockupSlider.html?t="+Date.now()))}};Object(r.a)([Object(s.c)(),Object(r.b)("design:type",String)],c.prototype,"previewResourceUrl",void 0),c=Object(r.a)([Object(s.a)("au-widget-preview-mockup-slider",d)],c)}}]);