@aurigma/ui-framework
Version:
A platform which allows building print product personalization editors based on Aurigma's Customer's Canvas.
1 lines • 2.42 kB
JavaScript
(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[31],{908:function(t,e,n){"use strict";n.r(e),n.d(e,"AuWidgetHelp",(function(){return o})),n.d(e,"widget",(function(){return o}));var i=n(0),s=n(17),r=n(2),o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(i.d)(e,t),e.prototype.connectedCallback=function(){return Object(i.b)(this,void 0,void 0,(function(){var e=this;return Object(i.e)(this,(function(n){switch(n.label){case 0:return t.prototype.connectedCallback.call(this),this.stepSubscription=this.observe(s.a.STEP_CHANGED).subscribe((function(t){return e._stepChangeCallback(t)})),[4,this._getHelpButton()];case 1:return n.sent(),[2]}}))}))},e.prototype._stepChangeCallback=function(t){return Object(i.b)(this,void 0,void 0,(function(){return Object(i.e)(this,(function(e){return this.currentStep=t.data.step,this._handleParams(),[2]}))}))},e.prototype.updateParams=function(t){this._handleParams()},e.prototype._handleParams=function(){if(this.params&&this.currentStep)if(this.params.steps){var t=this.params.steps[this.currentStep.index]||this.params.steps[this.currentStep.title];t?(this.helpButton.style.display="inline-flex",this._applyConfig(t)):this.helpButton.style.display="none"}else this.params.base&&(this.helpButton.style.display="inline-flex",this._applyConfig(this.params.base))},e.prototype._applyConfig=function(t){var e=this;this.helpButton.onclick=function(){return Object(i.b)(e,void 0,void 0,(function(){return Object(i.e)(this,(function(e){switch(e.label){case 0:switch(t.type){case"modal":return[3,1];case"page":return[3,3]}return[3,4];case 1:return[4,this.auWizard.showModal(t.content)];case 2:return e.sent(),[3,5];case 3:return this._openTab(t.content),[3,5];case 4:console.warn("Type ".concat(t.type," is not supported.")),e.label=5;case 5:return[2]}}))}))}},e.prototype._openTab=function(t){window.open(t,"_blank")},e.prototype._getHelpButton=function(){return Object(i.b)(this,void 0,void 0,(function(){var t;return Object(i.e)(this,(function(e){switch(e.label){case 0:return t=this,[4,this.publishData({selector:"paper-button#helpTopBtn"},s.a.GET_ELEMENT_FROM_AU_WIZARD)];case 1:return t.helpButton=e.sent(),[2]}}))}))},e.prototype.disconnectedCallback=function(){t.prototype.disconnectedCallback.call(this),this.stepSubscription.unsubscribe()},Object(i.c)([Object(r.a)("au-widget-help")],e)}(n(160).a)}}]);