UNPKG

@aurigma/ui-framework

Version:

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

1 lines 2.25 kB
(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[28],{914:function(e,t,c){"use strict";c.r(t),c.d(t,"AuWidgetFunctionTrigger",(function(){return r})),c.d(t,"widget",(function(){return r}));var a=c(0),i=c(2),n=(c(201),c(1)),s=c(37),o=c(160);let r=class extends o.a{constructor(){super(...arguments),this.enabled=!0,this._callbackPending=!1,this._lockList=[],this._finally=()=>Promise.resolve(),this._catch=()=>Promise.reject(),this._callback=()=>Promise.resolve()}_callbackPendingObserver(e){this._showPreloader(e)}updateParams(e){const t=s.Maybe.maybe(e);this.enabled=t.bind((e=>n.a.maybeGet((()=>e.enabled)))).valueOr(this.enabled),this._lockList=t.bind((e=>n.a.maybeGet((()=>e.lock)))).map((e=>n.a.ensureArray(e))).valueOr(this._lockList),this._finally=n.a.functionWrapperConstructor(e.finally),this._catch=n.a.functionWrapperConstructor(e.catch),this._callback=n.a.functionWrapperConstructor(e.callback)}async updateParamsAsync(e){if(await super.updateParamsAsync(e),!this.enabled)return Promise.resolve(null);this._callbackPending=!0;try{await this._callback(...e.arguments)}catch(t){console.error(t),this._catch()}finally{this._finally(),this._callbackPending=!1}}_showPreloader(e){this._lockList.forEach((t=>{const c="main"===t?this.auWizard:this.auWizard.scope.$[t]||this.jsonParamsFetcher.scope[t]||this.jsonParamsFetcher.scope.$[t];c&&c.showPreloader(e)}))}};Object(a.a)([Object(i.c)(),Object(a.b)("design:type",Boolean)],r.prototype,"enabled",void 0),Object(a.a)([Object(i.c)(),Object(a.b)("design:type",Boolean)],r.prototype,"_callbackPending",void 0),Object(a.a)([Object(i.c)(),Object(a.b)("design:type",Array)],r.prototype,"_lockList",void 0),Object(a.a)([Object(i.c)(),Object(a.b)("design:type",Function)],r.prototype,"_finally",void 0),Object(a.a)([Object(i.c)(),Object(a.b)("design:type",Function)],r.prototype,"_catch",void 0),Object(a.a)([Object(i.c)(),Object(a.b)("design:type",Function)],r.prototype,"_callback",void 0),Object(a.a)([Object(i.b)("_callbackPending"),Object(a.b)("design:type",Function),Object(a.b)("design:paramtypes",[Boolean]),Object(a.b)("design:returntype",void 0)],r.prototype,"_callbackPendingObserver",null),r=Object(a.a)([Object(i.a)("au-widget-function-trigger")],r)}}]);