UNPKG

@aurigma/ui-framework

Version:

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

1 lines 3.35 kB
(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[51],{870:function(t,e){t.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(t,e,n){n.r(e),n.d(e,"AuWidgetVariantSelector",function(){return o}),n.d(e,"widget",function(){return o});var i,a=n(0),r=n(1),e=n(2),c=n(160),n=n(870),o=(i=c.c,Object(a.d)(s,i),s.prototype.exportWidgetData=function(t){return Object(a.b)(this,void 0,void 0,function(){return Object(a.e)(this,function(t){return[2,{selectedVariant:this.selectedVariant}]})})},s.prototype.restoreWidgetFromData=function(e,t){return Object(a.b)(this,void 0,void 0,function(){return Object(a.e)(this,function(t){return this.selectedVariant=e.selectedVariant,this.emitChange(),[2]})})},s.prototype.updateParams=function(t){t.onDoubleClick&&(this.onDoubleClick=r.a.functionWrapperConstructor(t.onDoubleClick)),this._initIFrame(t.productId,t.productVersionId,t.productFilterId)},s.prototype._initIFrame=function(r,c,o){return Object(a.b)(this,void 0,void 0,function(){var e,n,i=this;return Object(a.e)(this,function(t){switch(t.label){case 0:return e=this.querySelectorShadow("#frameID"),n=e.contentWindow||e,e=e.contentDocument||n.document,[4,this.getScriptContent()];case 1:return n=t.sent(),e.write(n),this._element=e.createElement("au-product-variant-selector"),this._element.apiUrl=this.auWizard.driver.backOffice.backOfficeUrl,this._element.token=this.auWizard.driver.backOffice.token,Number(r)&&(this._element.productId=Number(r)),Number(c)&&(this._element.productVersionId=Number(c)),Number(o)&&(this._element.productFilterId=Number(o)),this._element.addEventListener("variantSelected",function(t){i.selectedVariant=t.detail,i.emitChange()}),this._element.addEventListener("variantDoubleClicked",function(t){i.onDoubleClick&&i.onDoubleClick()}),e.write("<body></body"),e.body.appendChild(this._element),[2]}})})},s.prototype.getScriptContent=function(){return Object(a.b)(this,void 0,void 0,function(){var e,n,i=this;return Object(a.e)(this,function(t){switch(t.label){case 0:return e=function(){return Object(a.b)(i,void 0,void 0,function(){return Object(a.e)(this,function(t){switch(t.label){case 0:return[4,r.a.loadHtml(r.a.getPatchedUrl("static/variant-selector/variantSelector.html?t="+Date.now()))];case 1:return[2,t.sent()]}})})},[4,function(){return Object(a.b)(i,void 0,void 0,function(){var e,n;return Object(a.e)(this,function(t){switch(t.label){case 0:if(e="",!this.driver.backOffice||0===this.driver.backOffice.tenantId)return[3,4];n=r.a.ensureEndsWith(this.driver.backOffice.backOfficeUrl,"/")+"assets/variant-selector/dist/variantSelector.html?t="+Date.now(),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,r.a.loadHtml(n)];case 2:return e=t.sent(),[3,4];case 3:return t.sent(),console.warn("Failed to load VariantSelector scripts from backend ".concat(n)),[3,4];case 4:return[2,e]}})})}()];case 1:return""!==(n=t.sent())?[3,3]:[4,e()];case 2:n=t.sent(),t.label=3;case 3:return[2,n]}})})},Object(a.c)([Object(e.c)(),Object(a.g)("design:type",Object)],s.prototype,"selectedVariant",void 0),Object(a.c)([Object(e.a)("au-widget-variant-selector",n)],s));function s(){var t=null!==i&&i.apply(this,arguments)||this;return t.onDoubleClick=null,t}}}]);