UNPKG

@aurigma/ui-framework

Version:

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

1 lines 2.36 kB
(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[31],{908:function(t,e,n){n.r(e),n.d(e,"AuWidgetHelp",function(){return r}),n.d(e,"widget",function(){return r});var i,s=n(0),o=n(17),e=n(2),n=n(160),r=(i=n.a,Object(s.d)(a,i),a.prototype.connectedCallback=function(){return Object(s.b)(this,void 0,void 0,function(){var e=this;return Object(s.e)(this,function(t){switch(t.label){case 0:return i.prototype.connectedCallback.call(this),this.stepSubscription=this.observe(o.a.STEP_CHANGED).subscribe(function(t){return e._stepChangeCallback(t)}),[4,this._getHelpButton()];case 1:return t.sent(),[2]}})})},a.prototype._stepChangeCallback=function(e){return Object(s.b)(this,void 0,void 0,function(){return Object(s.e)(this,function(t){return this.currentStep=e.data.step,this._handleParams(),[2]})})},a.prototype.updateParams=function(t){this._handleParams()},a.prototype._handleParams=function(){var t;this.params&&this.currentStep&&(this.params.steps?(t=this.params.steps[this.currentStep.index]||this.params.steps[this.currentStep.title])?(this.helpButton.style.display="inline-flex",this._applyConfig(t)):this.helpButton.style.display="none":this.params.base&&(this.helpButton.style.display="inline-flex",this._applyConfig(this.params.base)))},a.prototype._applyConfig=function(e){var t=this;this.helpButton.onclick=function(){return Object(s.b)(t,void 0,void 0,function(){return Object(s.e)(this,function(t){switch(t.label){case 0:switch(e.type){case"modal":return[3,1];case"page":return[3,3]}return[3,4];case 1:return[4,this.auWizard.showModal(e.content)];case 2:return t.sent(),[3,5];case 3:return this._openTab(e.content),[3,5];case 4:console.warn("Type ".concat(e.type," is not supported.")),t.label=5;case 5:return[2]}})})}},a.prototype._openTab=function(t){window.open(t,"_blank")},a.prototype._getHelpButton=function(){return Object(s.b)(this,void 0,void 0,function(){var e;return Object(s.e)(this,function(t){switch(t.label){case 0:return[4,(e=this).publishData({selector:"paper-button#helpTopBtn"},o.a.GET_ELEMENT_FROM_AU_WIZARD)];case 1:return e.helpButton=t.sent(),[2]}})})},a.prototype.disconnectedCallback=function(){i.prototype.disconnectedCallback.call(this),this.stepSubscription.unsubscribe()},Object(s.c)([Object(e.a)("au-widget-help")],a));function a(){return null!==i&&i.apply(this,arguments)||this}}}]);