!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common/http"),require("@angular/common")):"function"==typeof define&&define.amd?define("@mubarak/mart-lib",["exports","@angular/core","@angular/common/http","@angular/common"],e):e((t.mubarak=t.mubarak||{},t.mubarak["mart-lib"]={}),t.ng.core,t.ng.common.http,t.ng.common)}(this,function(t,r,o,n){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function e(t,e){function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function d(t){var e="function"==typeof Symbol&&t[Symbol.iterator],r=0;return e?e.call(t):{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}var p=function(){function t(t,e){this.baseUrl=t,this.httpClient=e,this.BASE_URL=t}return t.prototype.post=function(t,e,r){return this.httpClient.post(this.BASE_URL+t,e,{headers:r})},t.prototype.put=function(t,e,r){return this.httpClient.put(this.BASE_URL+t,e,{headers:r})},t.prototype.getById=function(t,e,r){var n=this.BASE_URL+t;return e&&(n=n+"/"+e),this.httpClient.get(n,{headers:r})},t.prototype.getAll=function(t,e){return this.httpClient.get(""+(this.BASE_URL+t),{headers:e})},t.prototype.getByParams=function(t,e,r){return this.httpClient.get(this.BASE_URL+t+"?"+a.toQueryString(e),{headers:r})},t.prototype["delete"]=function(t,e,r){var n=this.BASE_URL+t;return e&&(n=n+"/"+e),this.httpClient["delete"](n,{headers:r})},t}(),a=function(){function t(){}return t.toQueryString=function(t){var r="";return null==t?r:(t.forEach(function(t,e){r=r.concat(e+"="+t+"&")}),r.substring(0,r.length-1))},t}(),u=function(n){function t(t,e){var r=n.call(this,t.baseUrl,e)||this;return r.moduleConfig=t,r.http=e,r}return e(t,n),t.prototype.getCategories=function(t,e,r){return t=null==t?"/api/v1/category":t,t=null!=e?t+"?name="+e:t,this.getAll(t,r)},t.prototype.getCategoryById=function(t,e,r){return void 0===t&&(t=null),t=null==t?"/api/v1/category":t,this.getById(t,e,r)},t.prototype.insert=function(t,e,r,n){void 0===t&&(t=null),t=null==t?"/api/v1/category":t,e.description=null==e.description?"":e.description,e.name=null==e.name?"":e.name;var o=new FormData;return o.append("name",e.name),o.append("description",e.description),o.append("searchField",e.searchField.toString()),r&&o.append("files",r,r.name),this.post(t,o,n)},t.prototype.update=function(t,e,r,n){void 0===t&&(t=null),t=null==t?"/api/v1/category":t,e.description=null==e.description?"":e.description,e.name=null==e.name?"":e.name;var o=new FormData;return o.append("id",e.id.toString()),o.append("name",e.name),o.append("description",e.description),o.append("searchField",e.searchField.toString()),r&&o.append("files",r,r.name),this.put(t,o,n)},t.decorators=[{type:r.Injectable}],t.ctorParameters=function(){return[{type:undefined,decorators:[{type:r.Inject,args:[v]}]},{type:o.HttpClient}]},t}(p),s=function(n){function t(t,e){var r=n.call(this,t.baseUrl,e)||this;return r.config=t,r.http=e,r}return e(t,n),t.prototype.getAddressByUser=function(t,e){var r=null==t?"/api/v1/address":t;return this.getAll(r,e)},t.prototype.insert=function(t,e,r){void 0===t&&(t=null);var n=null==t?"/api/v1/address":t;return this.post(n,e,r)},t.prototype.deleteAddress=function(t,e,r){return void 0===t&&(t=null),t=null==t?"/api/v1/address":t,this["delete"](t,e,r)},t.prototype.getArea=function(t,e){return void 0===t&&(t=null),t=null==t?"/api/v1/address/area":t,this.getAll(t,e)},t.decorators=[{type:r.Injectable}],t.ctorParameters=function(){return[{type:undefined,decorators:[{type:r.Inject,args:[v]}]},{type:o.HttpClient}]},t}(p),l=function(n){function t(t,e){var r=n.call(this,t.baseUrl,e)||this;return r.config=t,r.http=e,r}return e(t,n),t.prototype.login=function(t,e,r){return void 0===t&&(t=null),t=null==t?"/api/v1/token":t,this.post(t,e,r)},t.prototype.facebookLogin=function(t,e,r){return void 0===t&&(t=null),t=null==t?"/api/v1/facebook":t,this.post(t,e,r)},t.prototype.signupUser=function(t,e,r){return void 0===t&&(t=null),t=null==t?"/api/v1/registration":t,this.post(t,e,r)},t.prototype.addSupplier=function(t,e,r){return void 0===t&&(t=null),t=null==t?"/api/v1/supplier":t,this.post(t,e,r)},t.prototype.updateSupplier=function(t,e,r){return void 0===t&&(t=null),t=null==t?"/api/v1/supplier":t,this.put(t,e,r)},t.prototype.getSupplierById=function(t,e,r){return void 0===t&&(t=null),t=null==t?"/api/v1/supplier":t,this.getById(t,e,r)},t.prototype.supplierList=function(t,e){return void 0===t&&(t=null),t=null==t?"/api/v1/supplier":t,this.getAll(t,e)},t.prototype.supplierStatusList=function(t,e){return void 0===t&&(t=null),t=null==t?"/api/v1/supplier/status":t,this.getAll(t,e)},t.prototype.userListing=function(t,e){var r="/api/v1/user?pageIndex="+(t.pageIndex?t.pageIndex:"")+"&pageSize="+(t.pageSize?t.pageSize:"");return this.getAll(r)},t.prototype.roleListing=function(t,e){return void 0===t&&(t=null),t=null==t?"/api/v1/user/roles":t,this.getAll(t,e)},t.prototype.assignRoleToUser=function(t,e,r){return void 0===t&&(t=null),t=null==t?"/api/v1/user/assign-roles":t,this.http.post(this.config.baseUrl+t,e,{headers:r})},t.prototype.getUserById=function(t,e,r){return void 0===t&&(t=null),t=null==t?"/api/v1/user/assign-roles":t,this.getById(t,e,r)},t.prototype.getDrivers=function(t,e){return void 0===t&&(t=null),t=null==t?"/api/v1/user/driver":t,this.getAll(t,e)},t.prototype.assignUserToSupplier=function(t,e,r){var n="/api/v1/supplier/"+e+"/assign-user/"+t;return this.getAll(n,r)},t.prototype.deleteUserFromSupplier=function(t,e,r){var n="/api/v1/supplier/"+e+"/delete-user/"+t;return this["delete"](n,null,r)},t.prototype.updateStatusToVerified=function(t,e,r){return void 0===t&&(t=null),t=null==t?"/api/v1/login/status":t,this.post(t,e,r)},t.prototype.generateTacCode=function(t,e){var r="/api/v1/login/tac/"+t;return this.getAll(r,e)},t.prototype.updateUserPassword=function(t,e,r){return void 0===t&&(t=null),t=null==t?"/api/v1/login/update-pwd":t,this.post(t,e,r)},t.prototype.getFacebookUser=function(t,e,r){var n="/api/v1/facebook/user/"+e+"?fb_access_token="+t;return this.getAll(n,r)},t.decorators=[{type:r.Injectable}],t.ctorParameters=function(){return[{type:undefined,decorators:[{type:r.Inject,args:[v]}]},{type:o.HttpClient}]},t}(p),c=function(n){function t(t,e){var r=n.call(this,t.baseUrl,e)||this;return r.config=t,r.http=e,r}return e(t,n),t.prototype.getImageSliders=function(){return this.getAll("/api/v1/config/slider-images")},t.prototype.insertImageSlider=function(t,e,r,n){void 0===t&&(t=null),t=null==t?"/api/v1/config/slider-images":t;var o=new FormData;return o.append("title",e.title),o.append("files",r,r.name),this.post(t,o,n)},t.prototype.deleteImageSlider=function(t,e){return void 0===t&&(t=null),t=null==t?"/api/v1/config/slider-images":t,this["delete"](t,e)},t.prototype.getCartLimit=function(t){return void 0===t&&(t=null),t=null==t?"/api/v1/config/cart-limit":t,this.getAll(t)},t.prototype.updateCartAmount=function(t,e){var r="/api/v1/config/cart-limit?amount="+t;return this.put(r,null,e)},t.prototype.getDeliveryCharges=function(){return this.getAll("/api/v1/config/delivery-charges")},t.prototype.updateDeliveryCharges=function(t,e){var r="/api/v1/config/delivery-charges?amount="+t;return this.put(r,null,e)},t.prototype.getSegmentList=function(){return this.getAll("/api/v1/config/push/segments")},t.prototype.sendPushNotification=function(t,e,r){return void 0===t&&(t=null),t=null==t?"/api/v1/config/push":t,this.post(t,e,r)},t.decorators=[{type:r.Injectable}],t.ctorParameters=function(){return[{type:undefined,decorators:[{type:r.Inject,args:[v]}]},{type:o.HttpClient}]},t}(p),g=function(n){function t(t,e){var r=n.call(this,t.baseUrl,e)||this;return r.config=t,r.http=e,r}return e(t,n),t.prototype.insertOrder=function(t,e){return this.post("/api/v1/order",t,e)},t.prototype.getByCriteria=function(t,e){var r="/api/v1/order";return r=r+"?referenceNo="+(t.referenceNo?t.referenceNo:""),t.mobileNumber&&(r=r+"&mobileNumber="+t.mobileNumber),t.orderDate&&(r=r+"&orderDate="+t.orderDate),t.orderId&&(r=r+"&orderId="+t.orderId),t.orderStatus&&(r=r+"&orderStatus="+t.orderStatus),t.username&&(r=r+"&username="+t.username),r=r+"&pageIndex="+(t.pageIndex?t.pageIndex:"")+"&pageSize="+(t.pageSize?t.pageSize:""),this.getAll(r,e)},t.prototype.getDriverOrders=function(t,e,r){var n="/api/v1/order/driver/"+t;return e&&(n=n+"?pageIndex="+e),r&&(n=n+"?pageSize="+r),this.getAll(n)},t.prototype.getOrderStatus=function(){return this.getAll("/api/v1/order/order-status")},t.prototype.getSupplierOrderStatus=function(){return this.getAll("/api/v1/order/supp/order-status")},t.prototype.getSupplierOrderByCriteria=function(t,e){var r="/api/v1/order/supp";return r=r+"?referenceNo="+(t.referenceNo?t.referenceNo:""),t.statusId&&(r=r+"&statusId="+t.statusId),t.orderDate&&(r=r+"&orderDate="+t.orderDate),r=r+"&pageIndex="+(t.pageIndex?t.pageIndex:"")+"&pageSize="+(t.pageSize?t.pageSize:""),this.getAll(r,e)},t.prototype.getSupplierOrderById=function(t,e){return this.getById("/api/v1/order/supp",t,e)},t.prototype.assignOrder=function(t,e){return this.post("/api/v1/order/assign-order",t,e)},t.prototype.updateOrderStatus=function(t,e){return this.put("/api/v1/order/order-status",t,e)},t.prototype.updateSuppOrderStatus=function(t,e){return this.put("/api/v1/order/supp/order-status",t,e)},t.prototype.getOrderById=function(t,e){return this.getById("/api/v1/order",t,e)},t.decorators=[{type:r.Injectable}],t.ctorParameters=function(){return[{type:undefined,decorators:[{type:r.Inject,args:[v]}]},{type:o.HttpClient}]},t}(p),f=function(n){function t(t,e){var r=n.call(this,t.baseUrl,e)||this;return r.config=t,r.http=e,r}return e(t,n),t.prototype.getByCriteria=function(t,e){var r="/api/v1/product";return r=r+"?categoryId="+(t.categoryId?t.categoryId:""),t.fromPrice&&(r=r+"&fromPrice="+t.fromPrice),t.id&&(r=r+"&id="+t.id),t.productName&&(r=r+"&productName="+t.productName),t.subCategoryId&&(r=r+"&subCategoryId="+t.subCategoryId),t.toPrice&&(r=r+"&toPrice="+t.toPrice),r=r+"&pageIndex="+(t.pageIndex?t.pageIndex:"")+"&pageSize="+(t.pageSize?t.pageSize:""),this.getAll(r,e)},t.prototype.getProductById=function(t,e){return this.getById("/api/v1/product",t,e)},t.prototype.getProductsByName=function(t,e){var r="/api/v1/product/"+t;return this.getAll(r,e)},t.prototype.addProduct=function(t,e,r){t.description=null==t.description?"":t.description,t.name=null==t.name?"":t.name,t.subTitle=null==t.subTitle?"":t.subTitle;var n,o,i=new FormData;if(i.append("categoryId",t.categoryId.toString()),i.append("subCategoryId",t.subCategoryId.toString()),i.append("name",t.name),i.append("description",t.description),i.append("productUnitId",t.productUnitId.toString()),i.append("quantity",t.quantityPerUnit.toString()),i.append("unitPrice",t.unitPrice.toString()),i.append("subTitle",t.subTitle),i.append("searchField",t.searchField),e&&0<e.length)try{for(var p=d(e),a=p.next();!a.done;a=p.next()){var u=a.value;i.append("files",u,u.name)}}catch(s){n={error:s}}finally{try{a&&!a.done&&(o=p["return"])&&o.call(p)}finally{if(n)throw n.error}}return this.post("/api/v1/product",i,r)},t.prototype.updateProduct=function(t,e,r){t.description=null==t.description?"":t.description,t.name=null==t.name?"":t.name,t.subTitle=null==t.subTitle?"":t.subTitle;var n,o,i=new FormData;if(i.append("id",t.id.toString()),i.append("categoryId",t.categoryId.toString()),i.append("subCategoryId",t.subCategoryId.toString()),i.append("name",t.name),i.append("description",t.description),i.append("productUnitId",t.productUnitId.toString()),i.append("quantity",t.quantityPerUnit.toString()),i.append("unitPrice",t.unitPrice.toString()),i.append("productStatusId",t.productStatusId.toString()),i.append("subTitle",t.subTitle),i.append("searchField",t.searchField),e&&0<e.length)try{for(var p=d(e),a=p.next();!a.done;a=p.next()){var u=a.value;i.append("files",u,u.name)}}catch(s){n={error:s}}finally{try{a&&!a.done&&(o=p["return"])&&o.call(p)}finally{if(n)throw n.error}}return this.put("/api/v1/product",i,r)},t.prototype.getProductUnits=function(t){return this.getAll("/api/v1/product/units",t)},t.prototype.getProductUnitById=function(t){return this.getById("/api/v1/product/units",t)},t.prototype.insertProductUnit=function(t){return this.post("/api/v1/product/units",t)},t.prototype.updateProductUnit=function(t){return this.put("/api/v1/product/units",t)},t.prototype.getProductStatus=function(t){return this.getAll("/api/v1/product/units/status",t)},t.decorators=[{type:r.Injectable}],t.ctorParameters=function(){return[{type:undefined,decorators:[{type:r.Inject,args:[v]}]},{type:o.HttpClient}]},t}(p),y=function(n){function t(t,e){var r=n.call(this,t.baseUrl,e)||this;return r.config=t,r.http=e,r}return e(t,n),t.prototype.getByCriteria=function(t,e){var r="/api/v1/promotion";return r=r+"?code="+(t.code?t.code:""),t.endDateFrom&&(r=r+"&endDateFrom="+t.endDateFrom),t.endDateTo&&(r=r+"&endDateTo="+t.endDateTo),t.id&&(r=r+"&id="+t.id),t.startDateFrom&&(r=r+"&startDateFrom="+t.startDateFrom),t.startDateTo&&(r=r+"&startDateTo="+t.startDateTo),t.statusId&&(r=r+"&statusId="+t.statusId),r=r+"&pageIndex="+(t.pageIndex?t.pageIndex:"")+"&pageSize="+(t.pageSize?t.pageSize:""),this.getAll(r,e)},t.prototype.getByCode=function(t,e){var r="/api/v1/promotion/"+t;return this.getAll(r,e)},t.prototype.insert=function(t,e){return this.post("/api/v1/promotion",t,e)},t.prototype.update=function(t,e){return this.put("/api/v1/promotion",t,e)},t.decorators=[{type:r.Injectable}],t.ctorParameters=function(){return[{type:undefined,decorators:[{type:r.Inject,args:[v]}]},{type:o.HttpClient}]},t}(p),h=function(n){function t(t,e){var r=n.call(this,t.baseUrl,e)||this;return r.config=t,r.http=e,r}return e(t,n),t.prototype.getSubCategories=function(t,e){var r="/api/v1/sub-category";return r=r+"?categoryId="+(t.categoryId?t.categoryId:""),t.name&&(r=r+"&name="+t.name),this.getAll(r,e)},t.prototype.getSubCategoryById=function(t,e){return this.getById("/api/v1/sub-category",t,e)},t.prototype.insert=function(t,e,r){t.description=null==t.description?"":t.description,t.name=null==t.name?"":t.name,t.searchField=null==t.searchField?"":t.searchField;var n=new FormData;return n.append("name",t.name),n.append("categoryId",t.categoryId.toString()),n.append("description",t.description),n.append("searchField",t.searchField.toString()),e&&n.append("files",e,e.name),this.post("/api/v1/sub-category",n,r)},t.prototype.update=function(t,e,r){t.description=null==t.description?"":t.description,t.name=null==t.name?"":t.name,t.searchField=null==t.searchField?"":t.searchField;var n=new FormData;return n.append("name",t.name),n.append("id",t.id.toString()),n.append("categoryId",t.categoryId.toString()),n.append("description",t.description),n.append("searchField",t.searchField.toString()),e&&n.append("files",e,e.name),this.put("/api/v1/sub-category",n,r)},t.decorators=[{type:r.Injectable}],t.ctorParameters=function(){return[{type:undefined,decorators:[{type:r.Inject,args:[v]}]},{type:o.HttpClient}]},t}(p),v=new r.InjectionToken("moduleConfig"),I=function(){function e(){}return e.forRoot=function(t){return{ngModule:e,providers:[{provide:v,useValue:t},u,s,l,c,g,f,y,h]}},e.decorators=[{type:r.NgModule,args:[{declarations:[],imports:[n.CommonModule,o.HttpClientModule]}]}],e}(),m=function(){function t(){}return t.prototype.decodeToken=function(t){var e=t.split(".");if(3!==e.length)throw new Error("JWT must have 3 parts");var r=this.urlBase64Decode(e[1]);if(!r)throw new Error("Cannot decode the token");return JSON.parse(r)},t.prototype.urlBase64Decode=function(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("Illegal base64url string!")}return this.b64DecodeUnicode(e)},t.prototype.b64decode=function(t){var e="";if((t=String(t).replace(/=+$/,"")).length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var r=0,n=void 0,o=void 0,i=0;o=t.charAt(i++);~o&&(n=r%4?64*n+o:o,r++%4)?e+=String.fromCharCode(255&n>>(-2*r&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return e},t.prototype.b64DecodeUnicode=function(t){return decodeURIComponent(Array.prototype.map.call(this.b64decode(t),function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)}).join(""))},t}();t.AbdaliCommonModule=I,t.ApiConstants={SUCCESS:"SUCCESS",SERVER_ERROR:"SERVER_ERROR",INVALID_API_REQUEST:"INVALID_API_REQUEST",VALIDATION_ERROR:"VALIDATION_ERROR",INV_PERM:"INV_PERM",UNAUTH_REQUEST:"UNAUTH_REQUEST",INVALID_CATEGORY:"INVALID_CATEGORY",INVALID_PRODUCT:"INVALID_PRODUCT",DUPLICATE_USERNAME:"DUPLICATE_USERNAME",DUPLICATE_EMAIL:"DUPLICATE_EMAIL",INVALID_LOGIN:"INVALID_LOGIN",INVALID_PASSWORD:"INVALID_PASSWORD",INACTIVE_USER:"INACTIVE_USER",INV_SUPP_CODE:"INV_SUPP_CODE",INVALID_PROMOTION:"INVALID_PROMOTION"},t.JwtHelper=m,t.CategoryService=u,t.AddressService=s,t.AuthService=l,t.ConfigService=c,t.OrderService=g,t.ProductService=f,t.PromotionService=y,t.SubCategoryService=h,t.ɵa=v,t.ɵb=p,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=mubarak-mart-lib.umd.min.js.map