import{O as c}from"./chunk-3NJAM5KX.js";import{n as a,q as m}from"./chunk-TKVDP62Z.js";import{J as s,ga as p,na as n,qa as o}from"./chunk-GJDGQISV.js";var g=class i{constructor(t,e){this.httpService=t;this.toastr=e}_ignoreWarning=!1;_importResponse;get ignoreWarning(){return this._ignoreWarning}get importResponse(){return this._importResponse}generateFormData(t,e){let r=new FormData;return e&&r.append("Data",e),r.append("File",t),r}onSubmitForm(t,e){return this.httpService.postFormData(`/api/${t}`,e).pipe(p(r=>{this._importResponse=r,this.importResponseHandling(r)}),s(r=>(this._importResponse=r.error,this._ignoreWarning=!1,r)))}import(t){return this.httpService.post(c.ImportProduct,t)}previewImport(t,e){return this.httpService.postFormData(t,e)}importResponseHandling(t){t.Issues?(this.toastr.warning(t.Message,"Warning!"),this._ignoreWarning=!0):(this.toastr.success(t.Message,"Success"),this.importResponse.Issues=[],this._ignoreWarning=!1)}static \u0275fac=function(e){return new(e||i)(o(m),o(a))};static \u0275prov=n({token:i,factory:i.\u0275fac,providedIn:"root"})};export{g as a};
