@aurigma/ui-framework
Version:
A platform which allows building print product personalization editors based on Aurigma's Customer's Canvas.
1 lines • 1.95 kB
JavaScript
(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[51],{870: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>\n'},912:function(e,t,i){"use strict";i.r(t),i.d(t,"AuWidgetVariantSelector",(function(){return s})),i.d(t,"widget",(function(){return s}));var n=i(0),r=i(1),a=i(2),o=i(160),c=i(870);let s=class extends o.c{constructor(){super(...arguments),this.onDoubleClick=null}async exportWidgetData(e){return{selectedVariant:this.selectedVariant}}async restoreWidgetFromData(e,t){this.selectedVariant=e.selectedVariant,this.emitChange()}updateParams(e){e.onDoubleClick&&(this.onDoubleClick=r.a.functionWrapperConstructor(e.onDoubleClick)),this._initIFrame(e.productId,e.productVersionId,e.productFilterId)}async _initIFrame(e,t,i){const n=this.querySelectorShadow("#frameID"),r=n.contentWindow||n,a=n.contentDocument||r.document,o=await this.getScriptContent();a.write(o),this._element=a.createElement("au-product-variant-selector"),this._element.apiUrl=this.auWizard.driver.backOffice.backOfficeUrl,this._element.token=this.auWizard.driver.backOffice.token,Number(e)&&(this._element.productId=Number(e)),Number(t)&&(this._element.productVersionId=Number(t)),Number(i)&&(this._element.productFilterId=Number(i)),this._element.addEventListener("variantSelected",(e=>{this.selectedVariant=e.detail,this.emitChange()})),this._element.addEventListener("variantDoubleClicked",(e=>{this.onDoubleClick&&this.onDoubleClick()})),a.write("<body></body"),a.body.appendChild(this._element)}async getScriptContent(){return r.a.loadHtml(r.a.getPatchedUrl("static/variant-selector/variantSelector.html?t="+Date.now()))}};Object(n.a)([Object(a.c)(),Object(n.b)("design:type",Object)],s.prototype,"selectedVariant",void 0),s=Object(n.a)([Object(a.a)("au-widget-variant-selector",c)],s)}}]);