Comparing version 0.0.78 to 0.0.79
@@ -1,2 +0,2 @@ | ||
function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var e=t(require("axios")),n=t(require("querystringify")),r=require("dotenv");function i(){return(i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function s(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var o=function(){function t(t){if(this.API_ACCESS=t.api_access,this.basePath=t.api_url,this.authPath=t.auth_url,this.mediaPath=t.media_url,this.instance_id=t.instance_id,"string"!=typeof this.API_ACCESS)throw new Error("You should define TAYEH_API_ACCESS in your environment variables.")}var n=t.prototype;return n.set_token=function(t){this.API_ACCESS=t},n.set_user=function(t){this.USER_ACCESS=t},n.delete=function(t,n){try{var r=this.basePath+t,s=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(e.delete(r,s))}catch(t){return Promise.reject(t)}},n.user_delete=function(t,n){try{var r=this.basePath+t,s=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(e.delete(r,s))}catch(t){return Promise.reject(t)}},n.get=function(t,n){try{var r=this.basePath+t,s=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(e.get(r,s))}catch(t){return Promise.reject(t)}},n.user_get=function(t,n){try{var r=this.basePath+t,s=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(e.get(r,s))}catch(t){return Promise.reject(t)}},n.post=function(t,n,r){void 0===n&&(n={});try{var s=this.basePath+t,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(e.post(s,n,o))}catch(t){return Promise.reject(t)}},n.user_post=function(t,n,r){void 0===n&&(n={});try{var s=this.basePath+t,o=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(e.post(s,n,o))}catch(t){return Promise.reject(t)}},n.post_media=function(t,n,r){void 0===n&&(n={});try{var s=this.mediaPath+t,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(e.post(s,n,o))}catch(t){return Promise.reject(t)}},n.put=function(t,n,r){void 0===n&&(n={});try{var s=this.basePath+t,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(e.put(s,n,o))}catch(t){return Promise.reject(t)}},n.user_put=function(t,n,r){void 0===n&&(n={});try{var s=this.basePath+t,o=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(e.put(s,n,o))}catch(t){return Promise.reject(t)}},n.post_auth=function(t,n,r){void 0===n&&(n={});try{var s=this.authPath+t,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(e.post(s,n,o))}catch(t){return Promise.reject(t)}},t}(),u=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var n=e.prototype;return n.getMedia=function(t){return this.get("media/get/"+t)},n.uploadMedia=function(t){return this.post_media("image",t)},e}(o),c=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getProducts=function(t){var e="instance/"+this.instance_id+"/products";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.createProduct=function(t){return this.user_put("instance/"+this.instance_id+"/product",t)},r.deleteProduct=function(t){return this.user_delete("instance/"+this.instance_id+"/product/"+t)},r.updateProduct=function(t){return this.user_post("instance/"+this.instance_id+"/product/update",t)},r.createProductPrice=function(t){return this.user_put("instance/"+this.instance_id+"/product/price",t)},r.updateProductPrice=function(t){return this.user_post("instance/"+this.instance_id+"/product/price",t)},r.updateProductPrices=function(t){return this.user_post("instance/"+this.instance_id+"/product/prices",t)},r.getProductPrices=function(t){return this.user_get("instance/"+this.instance_id+"/product/"+t+"/price-filter")},r.addProductMedia=function(t,e){return this.user_post("instance/"+this.instance_id+"/product/"+t+"/media",e)},r.deleteProductMedia=function(t,e){return this.user_delete("instance/"+this.instance_id+"/product/"+t+"/media/"+e)},r.getInstanceInvoices=function(t){var e="instance/"+this.instance_id+"/invoices";return t&&(e+=n.stringify(t,"?")),this.user_get(e)},r.getInstanceInvoice=function(t){return this.user_get("instance/"+this.instance_id+"/invoice/"+t)},r.deleteInstanceInvoice=function(t){return this.delete("instance/"+this.instance_id+"/invoice/"+t)},r.getInstanceCustomers=function(t){var e="instance/"+this.instance_id+"/customers";return t&&(e+=n.stringify(t,"?")),this.user_get(e)},r.getInstanceCustomer=function(t){return this.user_get("instance/"+this.instance_id+"/customer/"+t)},r.deleteInstanceCustomer=function(t){return this.user_delete("instance/"+this.instance_id+"/customer/"+t)},r.createInstanceCustomer=function(t){return this.user_put("instance/"+this.instance_id+"/customer",t)},r.updateInstanceCustomer=function(t,e){return this.user_post("instance/"+this.instance_id+"/customer/"+t,e)},r.acceptInstanceCustomer=function(t){return this.user_post("instance/"+this.instance_id+"/customer/"+t+"/accept")},r.getCategories=function(t){var e="instance/"+this.instance_id+"/categories";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.createCategory=function(t){return this.user_put("instance/"+this.instance_id+"/category",t)},r.updateCategory=function(t){return this.user_post("instance/"+this.instance_id+"/category",t)},r.deleteCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/category/"+t)},r.createCategoryFilterGroup=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter-group",e)},r.createCategoryFilter=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter",e)},r.createBrand=function(t){return this.user_put("instance/"+this.instance_id+"/brand",t)},r.updateBrand=function(t){return this.user_post("instance/"+this.instance_id+"/brand",t)},r.deleteBrand=function(t){return this.user_delete("instance/"+this.instance_id+"/brand/"+t)},r.getBrands=function(){return this.get("instance/"+this.instance_id+"/brands")},r.createBannerCategory=function(t){return this.user_put("instance/"+this.instance_id+"/banner-category",t)},r.getBannerCategories=function(){return this.user_get("instance/"+this.instance_id+"/banner-categories")},r.deleteBannerCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/banner-category/"+t)},r.getBanners=function(t){var e="instance/"+this.instance_id+"/banners";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.createBanner=function(t){return this.user_put("instance/"+this.instance_id+"/banner",t)},r.deleteBanner=function(t){return this.user_delete("instance/"+this.instance_id+"/banner/"+t)},r.updateBanner=function(t){return this.user_post("instance/"+this.instance_id+"/banner/update",t)},r.getSearchFilters=function(t){var e="instance/"+this.instance_id+"/search-filters";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.sendInviteSms=function(t){return this.post("instance/"+this.instance_id+"/invite-sms",t)},r.getTopKeywords=function(t){var e="instance/"+this.instance_id+"/top-search-keywords";return t&&(e+=n.stringify(t,"?")),this.post(e,t)},e}(o),a=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var n=e.prototype;return n.userLogin=function(t,e){return this.post_auth("user/instance/"+this.instance_id+"/login",{username:t,password:e})},n.getUserMe=function(){return this.user_get("user/me")},e}(o),h=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getPassword=function(t){return this.post_auth("customer/send-mobile-verification",{mobile:t,instance:this.instance_id})},r.customerVerify=function(t,e){return this.post_auth("customer/verify-mobile",{mobile:t,verification_code:e,instance:this.instance_id})},r.getVerification=function(t){return this.post_auth("customer/send-email-verification",{email:t,instance:this.instance_id})},r.emailVerify=function(t,e){return this.post_auth("customer/verify-email",{email:t,verification_code:e,instance:this.instance_id})},r.customerLogin=function(t,e){return this.post_auth("customer/login",{username:t,password:e,instance:this.instance_id})},r.customerRegister=function(t){return this.post_auth("customer/register",t)},r.getCustomerMe=function(){return this.get("customer/me")},r.getCustomer=function(){return this.get("customer")},r.updateCustomer=function(t){return this.post("customer",t)},r.addProductToCart=function(t){return this.put("customer/cart",t)},r.toggleProductFavorite=function(t){return this.post("customer/favorite-product",t)},r.getCustomerCart=function(){return this.get("customer/cart")},r.updateCartItem=function(t){return this.post("customer/cart",t)},r.deleteCartItem=function(t){return this.delete("customer/cart/"+t)},r.getNotifications=function(t){var e="customer/notifications";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.getFavorites=function(t){var e="customer/favorite-products";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.getProductsHistory=function(t){var e="customer/products-history";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.getAddresses=function(){return this.get("customer/addresses")},r.createAddress=function(t){return this.put("customer/address",t)},r.updateAddress=function(t){return this.post("customer/address",t)},r.deleteAddress=function(t){return this.delete("customer/address/"+t)},r.setCartDelivery=function(t){return this.post("customer/cart/delivery",{address:t})},r.setAvatar=function(t){return this.post("customer/avatar",{avatar_id:t})},r.getInvoicesHistory=function(t){var e="customer/cart/history";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.getInvoice=function(t){return this.get("customer/invoice/"+t)},r.getCustomerCredit=function(){return this.get("customer/credit")},e}(o),d=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var n=e.prototype;return n.sendSms=function(t){return this.post("crm/"+this.instance_id+"/send/normal",t)},n.sendTypedSms=function(t,e){return this.post("crm/"+this.instance_id+"/send/typed/"+t,e)},e}(o),p=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getProduct=function(t){return this.get("product/"+t)},r.getProductFeatures=function(t){return this.get("product/"+t+"/features")},r.getSimilarProducts=function(t){return this.get("product/"+t+"/similar-products")},r.getProductChoices=function(t){return this.get("product/"+t+"/choices")},r.getProductReviews=function(t,e){var r="product/"+t+"/reviews";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getRatingOptions=function(t){return this.get("product/"+t+"/rating-options")},r.sendNewReview=function(t,e){return this.put("product/"+t+"/review",e)},r.reportReview=function(t,e){return this.post("product/"+t+"/review/"+e+"/report")},r.getProductRemaining=function(t,e){var r="product/"+t+"/remaining";return e&&(r+=n.stringify(e,"?")),this.get(r)},e}(o),f=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getCountries=function(t){var e="countries";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.getIranProvinces=function(t){var e="countries/103/states";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.getStateCities=function(t,e){var r="countries/103/states/"+t+"/cities";return e&&(r+=n.stringify(e,"?")),this.get(r)},e}(o);r.config();var g,_=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(o);g=_,[c,a,u,h,d,p,f].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){Object.defineProperty(g.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})}),module.exports=_; | ||
function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var e=t(require("axios")),n=t(require("querystringify")),r=require("dotenv");function i(){return(i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function s(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var o=function(){function t(t){if(this.API_ACCESS=t.api_access,this.basePath=t.api_url,this.authPath=t.auth_url,this.mediaPath=t.media_url,this.instance_id=t.instance_id,"string"!=typeof this.API_ACCESS)throw new Error("You should define TAYEH_API_ACCESS in your environment variables.")}var n=t.prototype;return n.set_token=function(t){this.API_ACCESS=t},n.set_user=function(t){this.USER_ACCESS=t},n.delete=function(t,n){try{var r=this.basePath+t,s=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(e.delete(r,s))}catch(t){return Promise.reject(t)}},n.user_delete=function(t,n){try{var r=this.basePath+t,s=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(e.delete(r,s))}catch(t){return Promise.reject(t)}},n.get=function(t,n){try{var r=this.basePath+t,s=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(e.get(r,s))}catch(t){return Promise.reject(t)}},n.user_get=function(t,n){try{var r=this.basePath+t,s=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(e.get(r,s))}catch(t){return Promise.reject(t)}},n.post=function(t,n,r){void 0===n&&(n={});try{var s=this.basePath+t,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(e.post(s,n,o))}catch(t){return Promise.reject(t)}},n.user_post=function(t,n,r){void 0===n&&(n={});try{var s=this.basePath+t,o=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(e.post(s,n,o))}catch(t){return Promise.reject(t)}},n.post_media=function(t,n,r){void 0===n&&(n={});try{var s=this.mediaPath+t,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(e.post(s,n,o))}catch(t){return Promise.reject(t)}},n.put=function(t,n,r){void 0===n&&(n={});try{var s=this.basePath+t,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(e.put(s,n,o))}catch(t){return Promise.reject(t)}},n.user_put=function(t,n,r){void 0===n&&(n={});try{var s=this.basePath+t,o=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(e.put(s,n,o))}catch(t){return Promise.reject(t)}},n.post_auth=function(t,n,r){void 0===n&&(n={});try{var s=this.authPath+t,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(e.post(s,n,o))}catch(t){return Promise.reject(t)}},t}(),u=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var n=e.prototype;return n.getMedia=function(t){return this.get("media/get/"+t)},n.uploadMedia=function(t){return this.post_media("image",t)},e}(o),c=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getProducts=function(t){var e="instance/"+this.instance_id+"/products";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.createProduct=function(t){return this.user_put("instance/"+this.instance_id+"/product",t)},r.deleteProduct=function(t){return this.user_delete("instance/"+this.instance_id+"/product/"+t)},r.updateProduct=function(t){return this.user_post("instance/"+this.instance_id+"/product/update",t)},r.createProductPrice=function(t){return this.user_put("instance/"+this.instance_id+"/product/price",t)},r.updateProductPrice=function(t){return this.user_post("instance/"+this.instance_id+"/product/price",t)},r.updateProductPrices=function(t){return this.user_post("instance/"+this.instance_id+"/product/prices",t)},r.getProductPrices=function(t){return this.user_get("instance/"+this.instance_id+"/product/"+t+"/price-filter")},r.addProductMedia=function(t,e){return this.user_post("instance/"+this.instance_id+"/product/"+t+"/media",e)},r.deleteProductMedia=function(t,e){return this.user_delete("instance/"+this.instance_id+"/product/"+t+"/media/"+e)},r.getInstanceInvoices=function(t){var e="instance/"+this.instance_id+"/invoices";return t&&(e+=n.stringify(t,"?")),this.user_get(e)},r.getInstanceInvoice=function(t){return this.user_get("instance/"+this.instance_id+"/invoice/"+t)},r.deleteInstanceInvoice=function(t){return this.delete("instance/"+this.instance_id+"/invoice/"+t)},r.getInstanceCustomers=function(t){var e="instance/"+this.instance_id+"/customers";return t&&(e+=n.stringify(t,"?")),this.user_get(e)},r.getInstanceCustomer=function(t){return this.user_get("instance/"+this.instance_id+"/customer/"+t)},r.deleteInstanceCustomer=function(t){return this.user_delete("instance/"+this.instance_id+"/customer/"+t)},r.createInstanceCustomer=function(t){return this.user_put("instance/"+this.instance_id+"/customer",t)},r.updateInstanceCustomer=function(t,e){return this.user_post("instance/"+this.instance_id+"/customer/"+t,e)},r.acceptInstanceCustomer=function(t){return this.user_post("instance/"+this.instance_id+"/customer/"+t+"/accept")},r.getCategories=function(t){var e="instance/"+this.instance_id+"/categories";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.createCategory=function(t){return this.user_put("instance/"+this.instance_id+"/category",t)},r.updateCategory=function(t){return this.user_post("instance/"+this.instance_id+"/category",t)},r.deleteCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/category/"+t)},r.createCategoryFilterGroup=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter-group",e)},r.createCategoryFilter=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter",e)},r.getCategoryFeatures=function(t){return this.user_get("instance/"+this.instance_id+"/category/"+t+"/filter-group")},r.createBrand=function(t){return this.user_put("instance/"+this.instance_id+"/brand",t)},r.updateBrand=function(t){return this.user_post("instance/"+this.instance_id+"/brand",t)},r.deleteBrand=function(t){return this.user_delete("instance/"+this.instance_id+"/brand/"+t)},r.getBrands=function(){return this.get("instance/"+this.instance_id+"/brands")},r.createBannerCategory=function(t){return this.user_put("instance/"+this.instance_id+"/banner-category",t)},r.getBannerCategories=function(){return this.user_get("instance/"+this.instance_id+"/banner-categories")},r.deleteBannerCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/banner-category/"+t)},r.getBanners=function(t){var e="instance/"+this.instance_id+"/banners";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.createBanner=function(t){return this.user_put("instance/"+this.instance_id+"/banner",t)},r.deleteBanner=function(t){return this.user_delete("instance/"+this.instance_id+"/banner/"+t)},r.updateBanner=function(t){return this.user_post("instance/"+this.instance_id+"/banner/update",t)},r.getSearchFilters=function(t){var e="instance/"+this.instance_id+"/search-filters";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.sendInviteSms=function(t){return this.post("instance/"+this.instance_id+"/invite-sms",t)},r.getTopKeywords=function(t){var e="instance/"+this.instance_id+"/top-search-keywords";return t&&(e+=n.stringify(t,"?")),this.post(e,t)},e}(o),a=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var n=e.prototype;return n.userLogin=function(t,e){return this.post_auth("user/instance/"+this.instance_id+"/login",{username:t,password:e})},n.getUserMe=function(){return this.user_get("user/me")},e}(o),h=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getPassword=function(t){return this.post_auth("customer/send-mobile-verification",{mobile:t,instance:this.instance_id})},r.customerVerify=function(t,e){return this.post_auth("customer/verify-mobile",{mobile:t,verification_code:e,instance:this.instance_id})},r.getVerification=function(t){return this.post_auth("customer/send-email-verification",{email:t,instance:this.instance_id})},r.emailVerify=function(t,e){return this.post_auth("customer/verify-email",{email:t,verification_code:e,instance:this.instance_id})},r.customerLogin=function(t,e){return this.post_auth("customer/login",{username:t,password:e,instance:this.instance_id})},r.customerRegister=function(t){return this.post_auth("customer/register",t)},r.getCustomerMe=function(){return this.get("customer/me")},r.getCustomer=function(){return this.get("customer")},r.updateCustomer=function(t){return this.post("customer",t)},r.addProductToCart=function(t){return this.put("customer/cart",t)},r.toggleProductFavorite=function(t){return this.post("customer/favorite-product",t)},r.getCustomerCart=function(){return this.get("customer/cart")},r.updateCartItem=function(t){return this.post("customer/cart",t)},r.deleteCartItem=function(t){return this.delete("customer/cart/"+t)},r.getNotifications=function(t){var e="customer/notifications";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.getFavorites=function(t){var e="customer/favorite-products";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.getProductsHistory=function(t){var e="customer/products-history";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.getAddresses=function(){return this.get("customer/addresses")},r.createAddress=function(t){return this.put("customer/address",t)},r.updateAddress=function(t){return this.post("customer/address",t)},r.deleteAddress=function(t){return this.delete("customer/address/"+t)},r.setCartDelivery=function(t){return this.post("customer/cart/delivery",{address:t})},r.setAvatar=function(t){return this.post("customer/avatar",{avatar_id:t})},r.getInvoicesHistory=function(t){var e="customer/cart/history";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.getInvoice=function(t){return this.get("customer/invoice/"+t)},r.getCustomerCredit=function(){return this.get("customer/credit")},e}(o),d=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var n=e.prototype;return n.sendSms=function(t){return this.post("crm/"+this.instance_id+"/send/normal",t)},n.sendTypedSms=function(t,e){return this.post("crm/"+this.instance_id+"/send/typed/"+t,e)},e}(o),p=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getProduct=function(t){return this.get("product/"+t)},r.getProductFeatures=function(t){return this.get("product/"+t+"/features")},r.getSimilarProducts=function(t){return this.get("product/"+t+"/similar-products")},r.getProductChoices=function(t){return this.get("product/"+t+"/choices")},r.getProductReviews=function(t,e){var r="product/"+t+"/reviews";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getRatingOptions=function(t){return this.get("product/"+t+"/rating-options")},r.sendNewReview=function(t,e){return this.put("product/"+t+"/review",e)},r.reportReview=function(t,e){return this.post("product/"+t+"/review/"+e+"/report")},r.getProductRemaining=function(t,e){var r="product/"+t+"/remaining";return e&&(r+=n.stringify(e,"?")),this.get(r)},e}(o),f=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getCountries=function(t){var e="countries";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.getIranProvinces=function(t){var e="countries/103/states";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.getStateCities=function(t,e){var r="countries/103/states/"+t+"/cities";return e&&(r+=n.stringify(e,"?")),this.get(r)},e}(o);r.config();var g,_=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(o);g=_,[c,a,u,h,d,p,f].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){Object.defineProperty(g.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})}),module.exports=_; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import t from"axios";import e from"querystringify";import{config as s}from"dotenv";class r{constructor(t){if(this.API_ACCESS=t.api_access,this.basePath=t.api_url,this.authPath=t.auth_url,this.mediaPath=t.media_url,this.instance_id=t.instance_id,"string"!=typeof this.API_ACCESS)throw new Error("You should define TAYEH_API_ACCESS in your environment variables.")}set_token(t){this.API_ACCESS=t}set_user(t){this.USER_ACCESS=t}async delete(e,s){const r=this.basePath+e,i={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...s};return await t.delete(r,i)}async user_delete(e,s){const r=this.basePath+e,i={headers:{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"},...s};return await t.delete(r,i)}async get(e,s){const r=this.basePath+e,i={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...s};return await t.get(r,i)}async user_get(e,s){const r=this.basePath+e,i={headers:{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"},...s};return await t.get(r,i)}async post(e,s={},r){const i=this.basePath+e,n={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...r};return await t.post(i,s,n)}async user_post(e,s={},r){const i=this.basePath+e,n={headers:{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"},...r};return await t.post(i,s,n)}async post_media(e,s={},r){const i=this.mediaPath+e,n={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...r};return await t.post(i,s,n)}async put(e,s={},r){const i=this.basePath+e,n={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...r};return await t.put(i,s,n)}async user_put(e,s={},r){const i=this.basePath+e,n={headers:{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"},...r};return await t.put(i,s,n)}async post_auth(e,s={},r){const i=this.authPath+e,n={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...r};return await t.post(i,s,n)}}s();class i extends r{}var n;n=i,[class extends r{getProducts(t){let s=`instance/${this.instance_id}/products`;return t&&(s+=e.stringify(t,"?")),this.get(s)}createProduct(t){return this.user_put(`instance/${this.instance_id}/product`,t)}deleteProduct(t){return this.user_delete(`instance/${this.instance_id}/product/${t}`)}updateProduct(t){return this.user_post(`instance/${this.instance_id}/product/update`,t)}createProductPrice(t){return this.user_put(`instance/${this.instance_id}/product/price`,t)}updateProductPrice(t){return this.user_post(`instance/${this.instance_id}/product/price`,t)}updateProductPrices(t){return this.user_post(`instance/${this.instance_id}/product/prices`,t)}getProductPrices(t){return this.user_get(`instance/${this.instance_id}/product/${t}/price-filter`)}addProductMedia(t,e){return this.user_post(`instance/${this.instance_id}/product/${t}/media`,e)}deleteProductMedia(t,e){return this.user_delete(`instance/${this.instance_id}/product/${t}/media/${e}`)}getInstanceInvoices(t){let s=`instance/${this.instance_id}/invoices`;return t&&(s+=e.stringify(t,"?")),this.user_get(s)}getInstanceInvoice(t){return this.user_get(`instance/${this.instance_id}/invoice/${t}`)}deleteInstanceInvoice(t){return this.delete(`instance/${this.instance_id}/invoice/${t}`)}getInstanceCustomers(t){let s=`instance/${this.instance_id}/customers`;return t&&(s+=e.stringify(t,"?")),this.user_get(s)}getInstanceCustomer(t){return this.user_get(`instance/${this.instance_id}/customer/${t}`)}deleteInstanceCustomer(t){return this.user_delete(`instance/${this.instance_id}/customer/${t}`)}createInstanceCustomer(t){return this.user_put(`instance/${this.instance_id}/customer`,t)}updateInstanceCustomer(t,e){return this.user_post(`instance/${this.instance_id}/customer/${t}`,e)}acceptInstanceCustomer(t){return this.user_post(`instance/${this.instance_id}/customer/${t}/accept`)}getCategories(t){let s=`instance/${this.instance_id}/categories`;return t&&(s+=e.stringify(t,"?")),this.get(s)}createCategory(t){return this.user_put(`instance/${this.instance_id}/category`,t)}updateCategory(t){return this.user_post(`instance/${this.instance_id}/category`,t)}deleteCategory(t){return this.user_delete(`instance/${this.instance_id}/category/${t}`)}createCategoryFilterGroup(t,e){return this.user_put(`instance/${this.instance_id}/category/${t}/filter-group`,e)}createCategoryFilter(t,e){return this.user_put(`instance/${this.instance_id}/category/${t}/filter`,e)}createBrand(t){return this.user_put(`instance/${this.instance_id}/brand`,t)}updateBrand(t){return this.user_post(`instance/${this.instance_id}/brand`,t)}deleteBrand(t){return this.user_delete(`instance/${this.instance_id}/brand/${t}`)}getBrands(){return this.get(`instance/${this.instance_id}/brands`)}createBannerCategory(t){return this.user_put(`instance/${this.instance_id}/banner-category`,t)}getBannerCategories(){return this.user_get(`instance/${this.instance_id}/banner-categories`)}deleteBannerCategory(t){return this.user_delete(`instance/${this.instance_id}/banner-category/${t}`)}getBanners(t){let s=`instance/${this.instance_id}/banners`;return t&&(s+=e.stringify(t,"?")),this.get(s)}createBanner(t){return this.user_put(`instance/${this.instance_id}/banner`,t)}deleteBanner(t){return this.user_delete(`instance/${this.instance_id}/banner/${t}`)}updateBanner(t){return this.user_post(`instance/${this.instance_id}/banner/update`,t)}getSearchFilters(t){let s=`instance/${this.instance_id}/search-filters`;return t&&(s+=e.stringify(t,"?")),this.get(s)}sendInviteSms(t){return this.post(`instance/${this.instance_id}/invite-sms`,t)}getTopKeywords(t){let s=`instance/${this.instance_id}/top-search-keywords`;return t&&(s+=e.stringify(t,"?")),this.post(s,t)}},class extends r{userLogin(t,e){return this.post_auth(`user/instance/${this.instance_id}/login`,{username:t,password:e})}getUserMe(){return this.user_get("user/me")}},class extends r{getMedia(t){return this.get("media/get/"+t)}uploadMedia(t){return this.post_media("image",t)}},class extends r{getPassword(t){return this.post_auth("customer/send-mobile-verification",{mobile:t,instance:this.instance_id})}customerVerify(t,e){return this.post_auth("customer/verify-mobile",{mobile:t,verification_code:e,instance:this.instance_id})}getVerification(t){return this.post_auth("customer/send-email-verification",{email:t,instance:this.instance_id})}emailVerify(t,e){return this.post_auth("customer/verify-email",{email:t,verification_code:e,instance:this.instance_id})}customerLogin(t,e){return this.post_auth("customer/login",{username:t,password:e,instance:this.instance_id})}customerRegister(t){return this.post_auth("customer/register",t)}getCustomerMe(){return this.get("customer/me")}getCustomer(){return this.get("customer")}updateCustomer(t){return this.post("customer",t)}addProductToCart(t){return this.put("customer/cart",t)}toggleProductFavorite(t){return this.post("customer/favorite-product",t)}getCustomerCart(){return this.get("customer/cart")}updateCartItem(t){return this.post("customer/cart",t)}deleteCartItem(t){return this.delete("customer/cart/"+t)}getNotifications(t){let s="customer/notifications";return t&&(s+=e.stringify(t,"?")),this.get(s)}getFavorites(t){let s="customer/favorite-products";return t&&(s+=e.stringify(t,"?")),this.get(s)}getProductsHistory(t){let s="customer/products-history";return t&&(s+=e.stringify(t,"?")),this.get(s)}getAddresses(){return this.get("customer/addresses")}createAddress(t){return this.put("customer/address",t)}updateAddress(t){return this.post("customer/address",t)}deleteAddress(t){return this.delete("customer/address/"+t)}setCartDelivery(t){return this.post("customer/cart/delivery",{address:t})}setAvatar(t){return this.post("customer/avatar",{avatar_id:t})}getInvoicesHistory(t){let s="customer/cart/history";return t&&(s+=e.stringify(t,"?")),this.get(s)}getInvoice(t){return this.get("customer/invoice/"+t)}getCustomerCredit(){return this.get("customer/credit")}},class extends r{sendSms(t){return this.post(`crm/${this.instance_id}/send/normal`,t)}sendTypedSms(t,e){return this.post(`crm/${this.instance_id}/send/typed/${t}`,e)}},class extends r{getProduct(t){return this.get("product/"+t)}getProductFeatures(t){return this.get(`product/${t}/features`)}getSimilarProducts(t){return this.get(`product/${t}/similar-products`)}getProductChoices(t){return this.get(`product/${t}/choices`)}getProductReviews(t,s){let r=`product/${t}/reviews`;return s&&(r+=e.stringify(s,"?")),this.get(r)}getRatingOptions(t){return this.get(`product/${t}/rating-options`)}sendNewReview(t,e){return this.put(`product/${t}/review`,e)}reportReview(t,e){return this.post(`product/${t}/review/${e}/report`)}getProductRemaining(t,s){let r=`product/${t}/remaining`;return s&&(r+=e.stringify(s,"?")),this.get(r)}},class extends r{getCountries(t){let s="countries";return t&&(s+=e.stringify(t,"?")),this.get(s)}getIranProvinces(t){let s="countries/103/states";return t&&(s+=e.stringify(t,"?")),this.get(s)}getStateCities(t,s){let r=`countries/103/states/${t}/cities`;return s&&(r+=e.stringify(s,"?")),this.get(r)}}].forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(e=>{Object.defineProperty(n.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})});export default i; | ||
import t from"axios";import e from"querystringify";import{config as s}from"dotenv";class r{constructor(t){if(this.API_ACCESS=t.api_access,this.basePath=t.api_url,this.authPath=t.auth_url,this.mediaPath=t.media_url,this.instance_id=t.instance_id,"string"!=typeof this.API_ACCESS)throw new Error("You should define TAYEH_API_ACCESS in your environment variables.")}set_token(t){this.API_ACCESS=t}set_user(t){this.USER_ACCESS=t}async delete(e,s){const r=this.basePath+e,i={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...s};return await t.delete(r,i)}async user_delete(e,s){const r=this.basePath+e,i={headers:{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"},...s};return await t.delete(r,i)}async get(e,s){const r=this.basePath+e,i={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...s};return await t.get(r,i)}async user_get(e,s){const r=this.basePath+e,i={headers:{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"},...s};return await t.get(r,i)}async post(e,s={},r){const i=this.basePath+e,n={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...r};return await t.post(i,s,n)}async user_post(e,s={},r){const i=this.basePath+e,n={headers:{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"},...r};return await t.post(i,s,n)}async post_media(e,s={},r){const i=this.mediaPath+e,n={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...r};return await t.post(i,s,n)}async put(e,s={},r){const i=this.basePath+e,n={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...r};return await t.put(i,s,n)}async user_put(e,s={},r){const i=this.basePath+e,n={headers:{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"},...r};return await t.put(i,s,n)}async post_auth(e,s={},r){const i=this.authPath+e,n={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...r};return await t.post(i,s,n)}}s();class i extends r{}var n;n=i,[class extends r{getProducts(t){let s=`instance/${this.instance_id}/products`;return t&&(s+=e.stringify(t,"?")),this.get(s)}createProduct(t){return this.user_put(`instance/${this.instance_id}/product`,t)}deleteProduct(t){return this.user_delete(`instance/${this.instance_id}/product/${t}`)}updateProduct(t){return this.user_post(`instance/${this.instance_id}/product/update`,t)}createProductPrice(t){return this.user_put(`instance/${this.instance_id}/product/price`,t)}updateProductPrice(t){return this.user_post(`instance/${this.instance_id}/product/price`,t)}updateProductPrices(t){return this.user_post(`instance/${this.instance_id}/product/prices`,t)}getProductPrices(t){return this.user_get(`instance/${this.instance_id}/product/${t}/price-filter`)}addProductMedia(t,e){return this.user_post(`instance/${this.instance_id}/product/${t}/media`,e)}deleteProductMedia(t,e){return this.user_delete(`instance/${this.instance_id}/product/${t}/media/${e}`)}getInstanceInvoices(t){let s=`instance/${this.instance_id}/invoices`;return t&&(s+=e.stringify(t,"?")),this.user_get(s)}getInstanceInvoice(t){return this.user_get(`instance/${this.instance_id}/invoice/${t}`)}deleteInstanceInvoice(t){return this.delete(`instance/${this.instance_id}/invoice/${t}`)}getInstanceCustomers(t){let s=`instance/${this.instance_id}/customers`;return t&&(s+=e.stringify(t,"?")),this.user_get(s)}getInstanceCustomer(t){return this.user_get(`instance/${this.instance_id}/customer/${t}`)}deleteInstanceCustomer(t){return this.user_delete(`instance/${this.instance_id}/customer/${t}`)}createInstanceCustomer(t){return this.user_put(`instance/${this.instance_id}/customer`,t)}updateInstanceCustomer(t,e){return this.user_post(`instance/${this.instance_id}/customer/${t}`,e)}acceptInstanceCustomer(t){return this.user_post(`instance/${this.instance_id}/customer/${t}/accept`)}getCategories(t){let s=`instance/${this.instance_id}/categories`;return t&&(s+=e.stringify(t,"?")),this.get(s)}createCategory(t){return this.user_put(`instance/${this.instance_id}/category`,t)}updateCategory(t){return this.user_post(`instance/${this.instance_id}/category`,t)}deleteCategory(t){return this.user_delete(`instance/${this.instance_id}/category/${t}`)}createCategoryFilterGroup(t,e){return this.user_put(`instance/${this.instance_id}/category/${t}/filter-group`,e)}createCategoryFilter(t,e){return this.user_put(`instance/${this.instance_id}/category/${t}/filter`,e)}getCategoryFeatures(t){return this.user_get(`instance/${this.instance_id}/category/${t}/filter-group`)}createBrand(t){return this.user_put(`instance/${this.instance_id}/brand`,t)}updateBrand(t){return this.user_post(`instance/${this.instance_id}/brand`,t)}deleteBrand(t){return this.user_delete(`instance/${this.instance_id}/brand/${t}`)}getBrands(){return this.get(`instance/${this.instance_id}/brands`)}createBannerCategory(t){return this.user_put(`instance/${this.instance_id}/banner-category`,t)}getBannerCategories(){return this.user_get(`instance/${this.instance_id}/banner-categories`)}deleteBannerCategory(t){return this.user_delete(`instance/${this.instance_id}/banner-category/${t}`)}getBanners(t){let s=`instance/${this.instance_id}/banners`;return t&&(s+=e.stringify(t,"?")),this.get(s)}createBanner(t){return this.user_put(`instance/${this.instance_id}/banner`,t)}deleteBanner(t){return this.user_delete(`instance/${this.instance_id}/banner/${t}`)}updateBanner(t){return this.user_post(`instance/${this.instance_id}/banner/update`,t)}getSearchFilters(t){let s=`instance/${this.instance_id}/search-filters`;return t&&(s+=e.stringify(t,"?")),this.get(s)}sendInviteSms(t){return this.post(`instance/${this.instance_id}/invite-sms`,t)}getTopKeywords(t){let s=`instance/${this.instance_id}/top-search-keywords`;return t&&(s+=e.stringify(t,"?")),this.post(s,t)}},class extends r{userLogin(t,e){return this.post_auth(`user/instance/${this.instance_id}/login`,{username:t,password:e})}getUserMe(){return this.user_get("user/me")}},class extends r{getMedia(t){return this.get("media/get/"+t)}uploadMedia(t){return this.post_media("image",t)}},class extends r{getPassword(t){return this.post_auth("customer/send-mobile-verification",{mobile:t,instance:this.instance_id})}customerVerify(t,e){return this.post_auth("customer/verify-mobile",{mobile:t,verification_code:e,instance:this.instance_id})}getVerification(t){return this.post_auth("customer/send-email-verification",{email:t,instance:this.instance_id})}emailVerify(t,e){return this.post_auth("customer/verify-email",{email:t,verification_code:e,instance:this.instance_id})}customerLogin(t,e){return this.post_auth("customer/login",{username:t,password:e,instance:this.instance_id})}customerRegister(t){return this.post_auth("customer/register",t)}getCustomerMe(){return this.get("customer/me")}getCustomer(){return this.get("customer")}updateCustomer(t){return this.post("customer",t)}addProductToCart(t){return this.put("customer/cart",t)}toggleProductFavorite(t){return this.post("customer/favorite-product",t)}getCustomerCart(){return this.get("customer/cart")}updateCartItem(t){return this.post("customer/cart",t)}deleteCartItem(t){return this.delete("customer/cart/"+t)}getNotifications(t){let s="customer/notifications";return t&&(s+=e.stringify(t,"?")),this.get(s)}getFavorites(t){let s="customer/favorite-products";return t&&(s+=e.stringify(t,"?")),this.get(s)}getProductsHistory(t){let s="customer/products-history";return t&&(s+=e.stringify(t,"?")),this.get(s)}getAddresses(){return this.get("customer/addresses")}createAddress(t){return this.put("customer/address",t)}updateAddress(t){return this.post("customer/address",t)}deleteAddress(t){return this.delete("customer/address/"+t)}setCartDelivery(t){return this.post("customer/cart/delivery",{address:t})}setAvatar(t){return this.post("customer/avatar",{avatar_id:t})}getInvoicesHistory(t){let s="customer/cart/history";return t&&(s+=e.stringify(t,"?")),this.get(s)}getInvoice(t){return this.get("customer/invoice/"+t)}getCustomerCredit(){return this.get("customer/credit")}},class extends r{sendSms(t){return this.post(`crm/${this.instance_id}/send/normal`,t)}sendTypedSms(t,e){return this.post(`crm/${this.instance_id}/send/typed/${t}`,e)}},class extends r{getProduct(t){return this.get("product/"+t)}getProductFeatures(t){return this.get(`product/${t}/features`)}getSimilarProducts(t){return this.get(`product/${t}/similar-products`)}getProductChoices(t){return this.get(`product/${t}/choices`)}getProductReviews(t,s){let r=`product/${t}/reviews`;return s&&(r+=e.stringify(s,"?")),this.get(r)}getRatingOptions(t){return this.get(`product/${t}/rating-options`)}sendNewReview(t,e){return this.put(`product/${t}/review`,e)}reportReview(t,e){return this.post(`product/${t}/review/${e}/report`)}getProductRemaining(t,s){let r=`product/${t}/remaining`;return s&&(r+=e.stringify(s,"?")),this.get(r)}},class extends r{getCountries(t){let s="countries";return t&&(s+=e.stringify(t,"?")),this.get(s)}getIranProvinces(t){let s="countries/103/states";return t&&(s+=e.stringify(t,"?")),this.get(s)}getStateCities(t,s){let r=`countries/103/states/${t}/cities`;return s&&(r+=e.stringify(s,"?")),this.get(r)}}].forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(e=>{Object.defineProperty(n.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})});export default i; | ||
//# sourceMappingURL=index.modern.js.map |
@@ -1,2 +0,2 @@ | ||
import t from"axios";import e from"querystringify";import{config as n}from"dotenv";function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var s=function(){function e(t){if(this.API_ACCESS=t.api_access,this.basePath=t.api_url,this.authPath=t.auth_url,this.mediaPath=t.media_url,this.instance_id=t.instance_id,"string"!=typeof this.API_ACCESS)throw new Error("You should define TAYEH_API_ACCESS in your environment variables.")}var n=e.prototype;return n.set_token=function(t){this.API_ACCESS=t},n.set_user=function(t){this.USER_ACCESS=t},n.delete=function(e,n){try{var i=this.basePath+e,s=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.delete(i,s))}catch(t){return Promise.reject(t)}},n.user_delete=function(e,n){try{var i=this.basePath+e,s=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.delete(i,s))}catch(t){return Promise.reject(t)}},n.get=function(e,n){try{var i=this.basePath+e,s=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.get(i,s))}catch(t){return Promise.reject(t)}},n.user_get=function(e,n){try{var i=this.basePath+e,s=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.get(i,s))}catch(t){return Promise.reject(t)}},n.post=function(e,n,i){void 0===n&&(n={});try{var s=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.user_post=function(e,n,i){void 0===n&&(n={});try{var s=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.post_media=function(e,n,i){void 0===n&&(n={});try{var s=this.mediaPath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.put=function(e,n,i){void 0===n&&(n={});try{var s=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.put(s,n,o))}catch(t){return Promise.reject(t)}},n.user_put=function(e,n,i){void 0===n&&(n={});try{var s=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.put(s,n,o))}catch(t){return Promise.reject(t)}},n.post_auth=function(e,n,i){void 0===n&&(n={});try{var s=this.authPath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},e}(),o=function(t){function e(){return t.apply(this,arguments)||this}i(e,t);var n=e.prototype;return n.getMedia=function(t){return this.get("media/get/"+t)},n.uploadMedia=function(t){return this.post_media("image",t)},e}(s),u=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var r=n.prototype;return r.getProducts=function(t){var n="instance/"+this.instance_id+"/products";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.createProduct=function(t){return this.user_put("instance/"+this.instance_id+"/product",t)},r.deleteProduct=function(t){return this.user_delete("instance/"+this.instance_id+"/product/"+t)},r.updateProduct=function(t){return this.user_post("instance/"+this.instance_id+"/product/update",t)},r.createProductPrice=function(t){return this.user_put("instance/"+this.instance_id+"/product/price",t)},r.updateProductPrice=function(t){return this.user_post("instance/"+this.instance_id+"/product/price",t)},r.updateProductPrices=function(t){return this.user_post("instance/"+this.instance_id+"/product/prices",t)},r.getProductPrices=function(t){return this.user_get("instance/"+this.instance_id+"/product/"+t+"/price-filter")},r.addProductMedia=function(t,e){return this.user_post("instance/"+this.instance_id+"/product/"+t+"/media",e)},r.deleteProductMedia=function(t,e){return this.user_delete("instance/"+this.instance_id+"/product/"+t+"/media/"+e)},r.getInstanceInvoices=function(t){var n="instance/"+this.instance_id+"/invoices";return t&&(n+=e.stringify(t,"?")),this.user_get(n)},r.getInstanceInvoice=function(t){return this.user_get("instance/"+this.instance_id+"/invoice/"+t)},r.deleteInstanceInvoice=function(t){return this.delete("instance/"+this.instance_id+"/invoice/"+t)},r.getInstanceCustomers=function(t){var n="instance/"+this.instance_id+"/customers";return t&&(n+=e.stringify(t,"?")),this.user_get(n)},r.getInstanceCustomer=function(t){return this.user_get("instance/"+this.instance_id+"/customer/"+t)},r.deleteInstanceCustomer=function(t){return this.user_delete("instance/"+this.instance_id+"/customer/"+t)},r.createInstanceCustomer=function(t){return this.user_put("instance/"+this.instance_id+"/customer",t)},r.updateInstanceCustomer=function(t,e){return this.user_post("instance/"+this.instance_id+"/customer/"+t,e)},r.acceptInstanceCustomer=function(t){return this.user_post("instance/"+this.instance_id+"/customer/"+t+"/accept")},r.getCategories=function(t){var n="instance/"+this.instance_id+"/categories";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.createCategory=function(t){return this.user_put("instance/"+this.instance_id+"/category",t)},r.updateCategory=function(t){return this.user_post("instance/"+this.instance_id+"/category",t)},r.deleteCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/category/"+t)},r.createCategoryFilterGroup=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter-group",e)},r.createCategoryFilter=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter",e)},r.createBrand=function(t){return this.user_put("instance/"+this.instance_id+"/brand",t)},r.updateBrand=function(t){return this.user_post("instance/"+this.instance_id+"/brand",t)},r.deleteBrand=function(t){return this.user_delete("instance/"+this.instance_id+"/brand/"+t)},r.getBrands=function(){return this.get("instance/"+this.instance_id+"/brands")},r.createBannerCategory=function(t){return this.user_put("instance/"+this.instance_id+"/banner-category",t)},r.getBannerCategories=function(){return this.user_get("instance/"+this.instance_id+"/banner-categories")},r.deleteBannerCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/banner-category/"+t)},r.getBanners=function(t){var n="instance/"+this.instance_id+"/banners";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.createBanner=function(t){return this.user_put("instance/"+this.instance_id+"/banner",t)},r.deleteBanner=function(t){return this.user_delete("instance/"+this.instance_id+"/banner/"+t)},r.updateBanner=function(t){return this.user_post("instance/"+this.instance_id+"/banner/update",t)},r.getSearchFilters=function(t){var n="instance/"+this.instance_id+"/search-filters";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.sendInviteSms=function(t){return this.post("instance/"+this.instance_id+"/invite-sms",t)},r.getTopKeywords=function(t){var n="instance/"+this.instance_id+"/top-search-keywords";return t&&(n+=e.stringify(t,"?")),this.post(n,t)},n}(s),c=function(t){function e(){return t.apply(this,arguments)||this}i(e,t);var n=e.prototype;return n.userLogin=function(t,e){return this.post_auth("user/instance/"+this.instance_id+"/login",{username:t,password:e})},n.getUserMe=function(){return this.user_get("user/me")},e}(s),a=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var r=n.prototype;return r.getPassword=function(t){return this.post_auth("customer/send-mobile-verification",{mobile:t,instance:this.instance_id})},r.customerVerify=function(t,e){return this.post_auth("customer/verify-mobile",{mobile:t,verification_code:e,instance:this.instance_id})},r.getVerification=function(t){return this.post_auth("customer/send-email-verification",{email:t,instance:this.instance_id})},r.emailVerify=function(t,e){return this.post_auth("customer/verify-email",{email:t,verification_code:e,instance:this.instance_id})},r.customerLogin=function(t,e){return this.post_auth("customer/login",{username:t,password:e,instance:this.instance_id})},r.customerRegister=function(t){return this.post_auth("customer/register",t)},r.getCustomerMe=function(){return this.get("customer/me")},r.getCustomer=function(){return this.get("customer")},r.updateCustomer=function(t){return this.post("customer",t)},r.addProductToCart=function(t){return this.put("customer/cart",t)},r.toggleProductFavorite=function(t){return this.post("customer/favorite-product",t)},r.getCustomerCart=function(){return this.get("customer/cart")},r.updateCartItem=function(t){return this.post("customer/cart",t)},r.deleteCartItem=function(t){return this.delete("customer/cart/"+t)},r.getNotifications=function(t){var n="customer/notifications";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getFavorites=function(t){var n="customer/favorite-products";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getProductsHistory=function(t){var n="customer/products-history";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getAddresses=function(){return this.get("customer/addresses")},r.createAddress=function(t){return this.put("customer/address",t)},r.updateAddress=function(t){return this.post("customer/address",t)},r.deleteAddress=function(t){return this.delete("customer/address/"+t)},r.setCartDelivery=function(t){return this.post("customer/cart/delivery",{address:t})},r.setAvatar=function(t){return this.post("customer/avatar",{avatar_id:t})},r.getInvoicesHistory=function(t){var n="customer/cart/history";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getInvoice=function(t){return this.get("customer/invoice/"+t)},r.getCustomerCredit=function(){return this.get("customer/credit")},n}(s),h=function(t){function e(){return t.apply(this,arguments)||this}i(e,t);var n=e.prototype;return n.sendSms=function(t){return this.post("crm/"+this.instance_id+"/send/normal",t)},n.sendTypedSms=function(t,e){return this.post("crm/"+this.instance_id+"/send/typed/"+t,e)},e}(s),d=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var r=n.prototype;return r.getProduct=function(t){return this.get("product/"+t)},r.getProductFeatures=function(t){return this.get("product/"+t+"/features")},r.getSimilarProducts=function(t){return this.get("product/"+t+"/similar-products")},r.getProductChoices=function(t){return this.get("product/"+t+"/choices")},r.getProductReviews=function(t,n){var r="product/"+t+"/reviews";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.getRatingOptions=function(t){return this.get("product/"+t+"/rating-options")},r.sendNewReview=function(t,e){return this.put("product/"+t+"/review",e)},r.reportReview=function(t,e){return this.post("product/"+t+"/review/"+e+"/report")},r.getProductRemaining=function(t,n){var r="product/"+t+"/remaining";return n&&(r+=e.stringify(n,"?")),this.get(r)},n}(s),p=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var r=n.prototype;return r.getCountries=function(t){var n="countries";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getIranProvinces=function(t){var n="countries/103/states";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getStateCities=function(t,n){var r="countries/103/states/"+t+"/cities";return n&&(r+=e.stringify(n,"?")),this.get(r)},n}(s);n();var f,g=function(t){function e(){return t.apply(this,arguments)||this}return i(e,t),e}(s);f=g,[u,c,o,a,h,d,p].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){Object.defineProperty(f.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})});export default g; | ||
import t from"axios";import e from"querystringify";import{config as n}from"dotenv";function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var s=function(){function e(t){if(this.API_ACCESS=t.api_access,this.basePath=t.api_url,this.authPath=t.auth_url,this.mediaPath=t.media_url,this.instance_id=t.instance_id,"string"!=typeof this.API_ACCESS)throw new Error("You should define TAYEH_API_ACCESS in your environment variables.")}var n=e.prototype;return n.set_token=function(t){this.API_ACCESS=t},n.set_user=function(t){this.USER_ACCESS=t},n.delete=function(e,n){try{var i=this.basePath+e,s=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.delete(i,s))}catch(t){return Promise.reject(t)}},n.user_delete=function(e,n){try{var i=this.basePath+e,s=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.delete(i,s))}catch(t){return Promise.reject(t)}},n.get=function(e,n){try{var i=this.basePath+e,s=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.get(i,s))}catch(t){return Promise.reject(t)}},n.user_get=function(e,n){try{var i=this.basePath+e,s=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.get(i,s))}catch(t){return Promise.reject(t)}},n.post=function(e,n,i){void 0===n&&(n={});try{var s=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.user_post=function(e,n,i){void 0===n&&(n={});try{var s=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.post_media=function(e,n,i){void 0===n&&(n={});try{var s=this.mediaPath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.put=function(e,n,i){void 0===n&&(n={});try{var s=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.put(s,n,o))}catch(t){return Promise.reject(t)}},n.user_put=function(e,n,i){void 0===n&&(n={});try{var s=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.put(s,n,o))}catch(t){return Promise.reject(t)}},n.post_auth=function(e,n,i){void 0===n&&(n={});try{var s=this.authPath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},e}(),o=function(t){function e(){return t.apply(this,arguments)||this}i(e,t);var n=e.prototype;return n.getMedia=function(t){return this.get("media/get/"+t)},n.uploadMedia=function(t){return this.post_media("image",t)},e}(s),u=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var r=n.prototype;return r.getProducts=function(t){var n="instance/"+this.instance_id+"/products";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.createProduct=function(t){return this.user_put("instance/"+this.instance_id+"/product",t)},r.deleteProduct=function(t){return this.user_delete("instance/"+this.instance_id+"/product/"+t)},r.updateProduct=function(t){return this.user_post("instance/"+this.instance_id+"/product/update",t)},r.createProductPrice=function(t){return this.user_put("instance/"+this.instance_id+"/product/price",t)},r.updateProductPrice=function(t){return this.user_post("instance/"+this.instance_id+"/product/price",t)},r.updateProductPrices=function(t){return this.user_post("instance/"+this.instance_id+"/product/prices",t)},r.getProductPrices=function(t){return this.user_get("instance/"+this.instance_id+"/product/"+t+"/price-filter")},r.addProductMedia=function(t,e){return this.user_post("instance/"+this.instance_id+"/product/"+t+"/media",e)},r.deleteProductMedia=function(t,e){return this.user_delete("instance/"+this.instance_id+"/product/"+t+"/media/"+e)},r.getInstanceInvoices=function(t){var n="instance/"+this.instance_id+"/invoices";return t&&(n+=e.stringify(t,"?")),this.user_get(n)},r.getInstanceInvoice=function(t){return this.user_get("instance/"+this.instance_id+"/invoice/"+t)},r.deleteInstanceInvoice=function(t){return this.delete("instance/"+this.instance_id+"/invoice/"+t)},r.getInstanceCustomers=function(t){var n="instance/"+this.instance_id+"/customers";return t&&(n+=e.stringify(t,"?")),this.user_get(n)},r.getInstanceCustomer=function(t){return this.user_get("instance/"+this.instance_id+"/customer/"+t)},r.deleteInstanceCustomer=function(t){return this.user_delete("instance/"+this.instance_id+"/customer/"+t)},r.createInstanceCustomer=function(t){return this.user_put("instance/"+this.instance_id+"/customer",t)},r.updateInstanceCustomer=function(t,e){return this.user_post("instance/"+this.instance_id+"/customer/"+t,e)},r.acceptInstanceCustomer=function(t){return this.user_post("instance/"+this.instance_id+"/customer/"+t+"/accept")},r.getCategories=function(t){var n="instance/"+this.instance_id+"/categories";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.createCategory=function(t){return this.user_put("instance/"+this.instance_id+"/category",t)},r.updateCategory=function(t){return this.user_post("instance/"+this.instance_id+"/category",t)},r.deleteCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/category/"+t)},r.createCategoryFilterGroup=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter-group",e)},r.createCategoryFilter=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter",e)},r.getCategoryFeatures=function(t){return this.user_get("instance/"+this.instance_id+"/category/"+t+"/filter-group")},r.createBrand=function(t){return this.user_put("instance/"+this.instance_id+"/brand",t)},r.updateBrand=function(t){return this.user_post("instance/"+this.instance_id+"/brand",t)},r.deleteBrand=function(t){return this.user_delete("instance/"+this.instance_id+"/brand/"+t)},r.getBrands=function(){return this.get("instance/"+this.instance_id+"/brands")},r.createBannerCategory=function(t){return this.user_put("instance/"+this.instance_id+"/banner-category",t)},r.getBannerCategories=function(){return this.user_get("instance/"+this.instance_id+"/banner-categories")},r.deleteBannerCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/banner-category/"+t)},r.getBanners=function(t){var n="instance/"+this.instance_id+"/banners";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.createBanner=function(t){return this.user_put("instance/"+this.instance_id+"/banner",t)},r.deleteBanner=function(t){return this.user_delete("instance/"+this.instance_id+"/banner/"+t)},r.updateBanner=function(t){return this.user_post("instance/"+this.instance_id+"/banner/update",t)},r.getSearchFilters=function(t){var n="instance/"+this.instance_id+"/search-filters";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.sendInviteSms=function(t){return this.post("instance/"+this.instance_id+"/invite-sms",t)},r.getTopKeywords=function(t){var n="instance/"+this.instance_id+"/top-search-keywords";return t&&(n+=e.stringify(t,"?")),this.post(n,t)},n}(s),c=function(t){function e(){return t.apply(this,arguments)||this}i(e,t);var n=e.prototype;return n.userLogin=function(t,e){return this.post_auth("user/instance/"+this.instance_id+"/login",{username:t,password:e})},n.getUserMe=function(){return this.user_get("user/me")},e}(s),a=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var r=n.prototype;return r.getPassword=function(t){return this.post_auth("customer/send-mobile-verification",{mobile:t,instance:this.instance_id})},r.customerVerify=function(t,e){return this.post_auth("customer/verify-mobile",{mobile:t,verification_code:e,instance:this.instance_id})},r.getVerification=function(t){return this.post_auth("customer/send-email-verification",{email:t,instance:this.instance_id})},r.emailVerify=function(t,e){return this.post_auth("customer/verify-email",{email:t,verification_code:e,instance:this.instance_id})},r.customerLogin=function(t,e){return this.post_auth("customer/login",{username:t,password:e,instance:this.instance_id})},r.customerRegister=function(t){return this.post_auth("customer/register",t)},r.getCustomerMe=function(){return this.get("customer/me")},r.getCustomer=function(){return this.get("customer")},r.updateCustomer=function(t){return this.post("customer",t)},r.addProductToCart=function(t){return this.put("customer/cart",t)},r.toggleProductFavorite=function(t){return this.post("customer/favorite-product",t)},r.getCustomerCart=function(){return this.get("customer/cart")},r.updateCartItem=function(t){return this.post("customer/cart",t)},r.deleteCartItem=function(t){return this.delete("customer/cart/"+t)},r.getNotifications=function(t){var n="customer/notifications";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getFavorites=function(t){var n="customer/favorite-products";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getProductsHistory=function(t){var n="customer/products-history";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getAddresses=function(){return this.get("customer/addresses")},r.createAddress=function(t){return this.put("customer/address",t)},r.updateAddress=function(t){return this.post("customer/address",t)},r.deleteAddress=function(t){return this.delete("customer/address/"+t)},r.setCartDelivery=function(t){return this.post("customer/cart/delivery",{address:t})},r.setAvatar=function(t){return this.post("customer/avatar",{avatar_id:t})},r.getInvoicesHistory=function(t){var n="customer/cart/history";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getInvoice=function(t){return this.get("customer/invoice/"+t)},r.getCustomerCredit=function(){return this.get("customer/credit")},n}(s),h=function(t){function e(){return t.apply(this,arguments)||this}i(e,t);var n=e.prototype;return n.sendSms=function(t){return this.post("crm/"+this.instance_id+"/send/normal",t)},n.sendTypedSms=function(t,e){return this.post("crm/"+this.instance_id+"/send/typed/"+t,e)},e}(s),d=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var r=n.prototype;return r.getProduct=function(t){return this.get("product/"+t)},r.getProductFeatures=function(t){return this.get("product/"+t+"/features")},r.getSimilarProducts=function(t){return this.get("product/"+t+"/similar-products")},r.getProductChoices=function(t){return this.get("product/"+t+"/choices")},r.getProductReviews=function(t,n){var r="product/"+t+"/reviews";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.getRatingOptions=function(t){return this.get("product/"+t+"/rating-options")},r.sendNewReview=function(t,e){return this.put("product/"+t+"/review",e)},r.reportReview=function(t,e){return this.post("product/"+t+"/review/"+e+"/report")},r.getProductRemaining=function(t,n){var r="product/"+t+"/remaining";return n&&(r+=e.stringify(n,"?")),this.get(r)},n}(s),p=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var r=n.prototype;return r.getCountries=function(t){var n="countries";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getIranProvinces=function(t){var n="countries/103/states";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getStateCities=function(t,n){var r="countries/103/states/"+t+"/cities";return n&&(r+=e.stringify(n,"?")),this.get(r)},n}(s);n();var f,g=function(t){function e(){return t.apply(this,arguments)||this}return i(e,t),e}(s);f=g,[u,c,o,a,h,d,p].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){Object.defineProperty(f.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})});export default g; | ||
//# sourceMappingURL=index.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("axios"),require("querystringify"),require("dotenv")):"function"==typeof define&&define.amd?define(["axios","querystringify","dotenv"],e):(t=t||self).tayehJs=e(t.axios,t.querystringify,t.dotenv)}(this,function(t,e,n){function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var s=function(){function e(t){if(this.API_ACCESS=t.api_access,this.basePath=t.api_url,this.authPath=t.auth_url,this.mediaPath=t.media_url,this.instance_id=t.instance_id,"string"!=typeof this.API_ACCESS)throw new Error("You should define TAYEH_API_ACCESS in your environment variables.")}var n=e.prototype;return n.set_token=function(t){this.API_ACCESS=t},n.set_user=function(t){this.USER_ACCESS=t},n.delete=function(e,n){try{var i=this.basePath+e,s=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.delete(i,s))}catch(t){return Promise.reject(t)}},n.user_delete=function(e,n){try{var i=this.basePath+e,s=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.delete(i,s))}catch(t){return Promise.reject(t)}},n.get=function(e,n){try{var i=this.basePath+e,s=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.get(i,s))}catch(t){return Promise.reject(t)}},n.user_get=function(e,n){try{var i=this.basePath+e,s=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.get(i,s))}catch(t){return Promise.reject(t)}},n.post=function(e,n,i){void 0===n&&(n={});try{var s=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.user_post=function(e,n,i){void 0===n&&(n={});try{var s=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.post_media=function(e,n,i){void 0===n&&(n={});try{var s=this.mediaPath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.put=function(e,n,i){void 0===n&&(n={});try{var s=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.put(s,n,o))}catch(t){return Promise.reject(t)}},n.user_put=function(e,n,i){void 0===n&&(n={});try{var s=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.put(s,n,o))}catch(t){return Promise.reject(t)}},n.post_auth=function(e,n,i){void 0===n&&(n={});try{var s=this.authPath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},e}(),o=function(t){function e(){return t.apply(this,arguments)||this}i(e,t);var n=e.prototype;return n.getMedia=function(t){return this.get("media/get/"+t)},n.uploadMedia=function(t){return this.post_media("image",t)},e}(s),u=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var r=n.prototype;return r.getProducts=function(t){var n="instance/"+this.instance_id+"/products";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.createProduct=function(t){return this.user_put("instance/"+this.instance_id+"/product",t)},r.deleteProduct=function(t){return this.user_delete("instance/"+this.instance_id+"/product/"+t)},r.updateProduct=function(t){return this.user_post("instance/"+this.instance_id+"/product/update",t)},r.createProductPrice=function(t){return this.user_put("instance/"+this.instance_id+"/product/price",t)},r.updateProductPrice=function(t){return this.user_post("instance/"+this.instance_id+"/product/price",t)},r.updateProductPrices=function(t){return this.user_post("instance/"+this.instance_id+"/product/prices",t)},r.getProductPrices=function(t){return this.user_get("instance/"+this.instance_id+"/product/"+t+"/price-filter")},r.addProductMedia=function(t,e){return this.user_post("instance/"+this.instance_id+"/product/"+t+"/media",e)},r.deleteProductMedia=function(t,e){return this.user_delete("instance/"+this.instance_id+"/product/"+t+"/media/"+e)},r.getInstanceInvoices=function(t){var n="instance/"+this.instance_id+"/invoices";return t&&(n+=e.stringify(t,"?")),this.user_get(n)},r.getInstanceInvoice=function(t){return this.user_get("instance/"+this.instance_id+"/invoice/"+t)},r.deleteInstanceInvoice=function(t){return this.delete("instance/"+this.instance_id+"/invoice/"+t)},r.getInstanceCustomers=function(t){var n="instance/"+this.instance_id+"/customers";return t&&(n+=e.stringify(t,"?")),this.user_get(n)},r.getInstanceCustomer=function(t){return this.user_get("instance/"+this.instance_id+"/customer/"+t)},r.deleteInstanceCustomer=function(t){return this.user_delete("instance/"+this.instance_id+"/customer/"+t)},r.createInstanceCustomer=function(t){return this.user_put("instance/"+this.instance_id+"/customer",t)},r.updateInstanceCustomer=function(t,e){return this.user_post("instance/"+this.instance_id+"/customer/"+t,e)},r.acceptInstanceCustomer=function(t){return this.user_post("instance/"+this.instance_id+"/customer/"+t+"/accept")},r.getCategories=function(t){var n="instance/"+this.instance_id+"/categories";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.createCategory=function(t){return this.user_put("instance/"+this.instance_id+"/category",t)},r.updateCategory=function(t){return this.user_post("instance/"+this.instance_id+"/category",t)},r.deleteCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/category/"+t)},r.createCategoryFilterGroup=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter-group",e)},r.createCategoryFilter=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter",e)},r.createBrand=function(t){return this.user_put("instance/"+this.instance_id+"/brand",t)},r.updateBrand=function(t){return this.user_post("instance/"+this.instance_id+"/brand",t)},r.deleteBrand=function(t){return this.user_delete("instance/"+this.instance_id+"/brand/"+t)},r.getBrands=function(){return this.get("instance/"+this.instance_id+"/brands")},r.createBannerCategory=function(t){return this.user_put("instance/"+this.instance_id+"/banner-category",t)},r.getBannerCategories=function(){return this.user_get("instance/"+this.instance_id+"/banner-categories")},r.deleteBannerCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/banner-category/"+t)},r.getBanners=function(t){var n="instance/"+this.instance_id+"/banners";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.createBanner=function(t){return this.user_put("instance/"+this.instance_id+"/banner",t)},r.deleteBanner=function(t){return this.user_delete("instance/"+this.instance_id+"/banner/"+t)},r.updateBanner=function(t){return this.user_post("instance/"+this.instance_id+"/banner/update",t)},r.getSearchFilters=function(t){var n="instance/"+this.instance_id+"/search-filters";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.sendInviteSms=function(t){return this.post("instance/"+this.instance_id+"/invite-sms",t)},r.getTopKeywords=function(t){var n="instance/"+this.instance_id+"/top-search-keywords";return t&&(n+=e.stringify(t,"?")),this.post(n,t)},n}(s),c=function(t){function e(){return t.apply(this,arguments)||this}i(e,t);var n=e.prototype;return n.userLogin=function(t,e){return this.post_auth("user/instance/"+this.instance_id+"/login",{username:t,password:e})},n.getUserMe=function(){return this.user_get("user/me")},e}(s),a=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var r=n.prototype;return r.getPassword=function(t){return this.post_auth("customer/send-mobile-verification",{mobile:t,instance:this.instance_id})},r.customerVerify=function(t,e){return this.post_auth("customer/verify-mobile",{mobile:t,verification_code:e,instance:this.instance_id})},r.getVerification=function(t){return this.post_auth("customer/send-email-verification",{email:t,instance:this.instance_id})},r.emailVerify=function(t,e){return this.post_auth("customer/verify-email",{email:t,verification_code:e,instance:this.instance_id})},r.customerLogin=function(t,e){return this.post_auth("customer/login",{username:t,password:e,instance:this.instance_id})},r.customerRegister=function(t){return this.post_auth("customer/register",t)},r.getCustomerMe=function(){return this.get("customer/me")},r.getCustomer=function(){return this.get("customer")},r.updateCustomer=function(t){return this.post("customer",t)},r.addProductToCart=function(t){return this.put("customer/cart",t)},r.toggleProductFavorite=function(t){return this.post("customer/favorite-product",t)},r.getCustomerCart=function(){return this.get("customer/cart")},r.updateCartItem=function(t){return this.post("customer/cart",t)},r.deleteCartItem=function(t){return this.delete("customer/cart/"+t)},r.getNotifications=function(t){var n="customer/notifications";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getFavorites=function(t){var n="customer/favorite-products";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getProductsHistory=function(t){var n="customer/products-history";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getAddresses=function(){return this.get("customer/addresses")},r.createAddress=function(t){return this.put("customer/address",t)},r.updateAddress=function(t){return this.post("customer/address",t)},r.deleteAddress=function(t){return this.delete("customer/address/"+t)},r.setCartDelivery=function(t){return this.post("customer/cart/delivery",{address:t})},r.setAvatar=function(t){return this.post("customer/avatar",{avatar_id:t})},r.getInvoicesHistory=function(t){var n="customer/cart/history";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getInvoice=function(t){return this.get("customer/invoice/"+t)},r.getCustomerCredit=function(){return this.get("customer/credit")},n}(s),h=function(t){function e(){return t.apply(this,arguments)||this}i(e,t);var n=e.prototype;return n.sendSms=function(t){return this.post("crm/"+this.instance_id+"/send/normal",t)},n.sendTypedSms=function(t,e){return this.post("crm/"+this.instance_id+"/send/typed/"+t,e)},e}(s),d=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var r=n.prototype;return r.getProduct=function(t){return this.get("product/"+t)},r.getProductFeatures=function(t){return this.get("product/"+t+"/features")},r.getSimilarProducts=function(t){return this.get("product/"+t+"/similar-products")},r.getProductChoices=function(t){return this.get("product/"+t+"/choices")},r.getProductReviews=function(t,n){var r="product/"+t+"/reviews";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.getRatingOptions=function(t){return this.get("product/"+t+"/rating-options")},r.sendNewReview=function(t,e){return this.put("product/"+t+"/review",e)},r.reportReview=function(t,e){return this.post("product/"+t+"/review/"+e+"/report")},r.getProductRemaining=function(t,n){var r="product/"+t+"/remaining";return n&&(r+=e.stringify(n,"?")),this.get(r)},n}(s),p=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var r=n.prototype;return r.getCountries=function(t){var n="countries";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getIranProvinces=function(t){var n="countries/103/states";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getStateCities=function(t,n){var r="countries/103/states/"+t+"/cities";return n&&(r+=e.stringify(n,"?")),this.get(r)},n}(s);n.config();var f,g=function(t){function e(){return t.apply(this,arguments)||this}return i(e,t),e}(s);return f=g,[u,c,o,a,h,d,p].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){Object.defineProperty(f.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})}),g}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("axios"),require("querystringify"),require("dotenv")):"function"==typeof define&&define.amd?define(["axios","querystringify","dotenv"],e):(t=t||self).tayehJs=e(t.axios,t.querystringify,t.dotenv)}(this,function(t,e,n){function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var s=function(){function e(t){if(this.API_ACCESS=t.api_access,this.basePath=t.api_url,this.authPath=t.auth_url,this.mediaPath=t.media_url,this.instance_id=t.instance_id,"string"!=typeof this.API_ACCESS)throw new Error("You should define TAYEH_API_ACCESS in your environment variables.")}var n=e.prototype;return n.set_token=function(t){this.API_ACCESS=t},n.set_user=function(t){this.USER_ACCESS=t},n.delete=function(e,n){try{var i=this.basePath+e,s=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.delete(i,s))}catch(t){return Promise.reject(t)}},n.user_delete=function(e,n){try{var i=this.basePath+e,s=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.delete(i,s))}catch(t){return Promise.reject(t)}},n.get=function(e,n){try{var i=this.basePath+e,s=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.get(i,s))}catch(t){return Promise.reject(t)}},n.user_get=function(e,n){try{var i=this.basePath+e,s=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.get(i,s))}catch(t){return Promise.reject(t)}},n.post=function(e,n,i){void 0===n&&(n={});try{var s=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.user_post=function(e,n,i){void 0===n&&(n={});try{var s=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.post_media=function(e,n,i){void 0===n&&(n={});try{var s=this.mediaPath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.put=function(e,n,i){void 0===n&&(n={});try{var s=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.put(s,n,o))}catch(t){return Promise.reject(t)}},n.user_put=function(e,n,i){void 0===n&&(n={});try{var s=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.put(s,n,o))}catch(t){return Promise.reject(t)}},n.post_auth=function(e,n,i){void 0===n&&(n={});try{var s=this.authPath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},e}(),o=function(t){function e(){return t.apply(this,arguments)||this}i(e,t);var n=e.prototype;return n.getMedia=function(t){return this.get("media/get/"+t)},n.uploadMedia=function(t){return this.post_media("image",t)},e}(s),u=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var r=n.prototype;return r.getProducts=function(t){var n="instance/"+this.instance_id+"/products";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.createProduct=function(t){return this.user_put("instance/"+this.instance_id+"/product",t)},r.deleteProduct=function(t){return this.user_delete("instance/"+this.instance_id+"/product/"+t)},r.updateProduct=function(t){return this.user_post("instance/"+this.instance_id+"/product/update",t)},r.createProductPrice=function(t){return this.user_put("instance/"+this.instance_id+"/product/price",t)},r.updateProductPrice=function(t){return this.user_post("instance/"+this.instance_id+"/product/price",t)},r.updateProductPrices=function(t){return this.user_post("instance/"+this.instance_id+"/product/prices",t)},r.getProductPrices=function(t){return this.user_get("instance/"+this.instance_id+"/product/"+t+"/price-filter")},r.addProductMedia=function(t,e){return this.user_post("instance/"+this.instance_id+"/product/"+t+"/media",e)},r.deleteProductMedia=function(t,e){return this.user_delete("instance/"+this.instance_id+"/product/"+t+"/media/"+e)},r.getInstanceInvoices=function(t){var n="instance/"+this.instance_id+"/invoices";return t&&(n+=e.stringify(t,"?")),this.user_get(n)},r.getInstanceInvoice=function(t){return this.user_get("instance/"+this.instance_id+"/invoice/"+t)},r.deleteInstanceInvoice=function(t){return this.delete("instance/"+this.instance_id+"/invoice/"+t)},r.getInstanceCustomers=function(t){var n="instance/"+this.instance_id+"/customers";return t&&(n+=e.stringify(t,"?")),this.user_get(n)},r.getInstanceCustomer=function(t){return this.user_get("instance/"+this.instance_id+"/customer/"+t)},r.deleteInstanceCustomer=function(t){return this.user_delete("instance/"+this.instance_id+"/customer/"+t)},r.createInstanceCustomer=function(t){return this.user_put("instance/"+this.instance_id+"/customer",t)},r.updateInstanceCustomer=function(t,e){return this.user_post("instance/"+this.instance_id+"/customer/"+t,e)},r.acceptInstanceCustomer=function(t){return this.user_post("instance/"+this.instance_id+"/customer/"+t+"/accept")},r.getCategories=function(t){var n="instance/"+this.instance_id+"/categories";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.createCategory=function(t){return this.user_put("instance/"+this.instance_id+"/category",t)},r.updateCategory=function(t){return this.user_post("instance/"+this.instance_id+"/category",t)},r.deleteCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/category/"+t)},r.createCategoryFilterGroup=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter-group",e)},r.createCategoryFilter=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter",e)},r.getCategoryFeatures=function(t){return this.user_get("instance/"+this.instance_id+"/category/"+t+"/filter-group")},r.createBrand=function(t){return this.user_put("instance/"+this.instance_id+"/brand",t)},r.updateBrand=function(t){return this.user_post("instance/"+this.instance_id+"/brand",t)},r.deleteBrand=function(t){return this.user_delete("instance/"+this.instance_id+"/brand/"+t)},r.getBrands=function(){return this.get("instance/"+this.instance_id+"/brands")},r.createBannerCategory=function(t){return this.user_put("instance/"+this.instance_id+"/banner-category",t)},r.getBannerCategories=function(){return this.user_get("instance/"+this.instance_id+"/banner-categories")},r.deleteBannerCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/banner-category/"+t)},r.getBanners=function(t){var n="instance/"+this.instance_id+"/banners";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.createBanner=function(t){return this.user_put("instance/"+this.instance_id+"/banner",t)},r.deleteBanner=function(t){return this.user_delete("instance/"+this.instance_id+"/banner/"+t)},r.updateBanner=function(t){return this.user_post("instance/"+this.instance_id+"/banner/update",t)},r.getSearchFilters=function(t){var n="instance/"+this.instance_id+"/search-filters";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.sendInviteSms=function(t){return this.post("instance/"+this.instance_id+"/invite-sms",t)},r.getTopKeywords=function(t){var n="instance/"+this.instance_id+"/top-search-keywords";return t&&(n+=e.stringify(t,"?")),this.post(n,t)},n}(s),c=function(t){function e(){return t.apply(this,arguments)||this}i(e,t);var n=e.prototype;return n.userLogin=function(t,e){return this.post_auth("user/instance/"+this.instance_id+"/login",{username:t,password:e})},n.getUserMe=function(){return this.user_get("user/me")},e}(s),a=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var r=n.prototype;return r.getPassword=function(t){return this.post_auth("customer/send-mobile-verification",{mobile:t,instance:this.instance_id})},r.customerVerify=function(t,e){return this.post_auth("customer/verify-mobile",{mobile:t,verification_code:e,instance:this.instance_id})},r.getVerification=function(t){return this.post_auth("customer/send-email-verification",{email:t,instance:this.instance_id})},r.emailVerify=function(t,e){return this.post_auth("customer/verify-email",{email:t,verification_code:e,instance:this.instance_id})},r.customerLogin=function(t,e){return this.post_auth("customer/login",{username:t,password:e,instance:this.instance_id})},r.customerRegister=function(t){return this.post_auth("customer/register",t)},r.getCustomerMe=function(){return this.get("customer/me")},r.getCustomer=function(){return this.get("customer")},r.updateCustomer=function(t){return this.post("customer",t)},r.addProductToCart=function(t){return this.put("customer/cart",t)},r.toggleProductFavorite=function(t){return this.post("customer/favorite-product",t)},r.getCustomerCart=function(){return this.get("customer/cart")},r.updateCartItem=function(t){return this.post("customer/cart",t)},r.deleteCartItem=function(t){return this.delete("customer/cart/"+t)},r.getNotifications=function(t){var n="customer/notifications";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getFavorites=function(t){var n="customer/favorite-products";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getProductsHistory=function(t){var n="customer/products-history";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getAddresses=function(){return this.get("customer/addresses")},r.createAddress=function(t){return this.put("customer/address",t)},r.updateAddress=function(t){return this.post("customer/address",t)},r.deleteAddress=function(t){return this.delete("customer/address/"+t)},r.setCartDelivery=function(t){return this.post("customer/cart/delivery",{address:t})},r.setAvatar=function(t){return this.post("customer/avatar",{avatar_id:t})},r.getInvoicesHistory=function(t){var n="customer/cart/history";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getInvoice=function(t){return this.get("customer/invoice/"+t)},r.getCustomerCredit=function(){return this.get("customer/credit")},n}(s),h=function(t){function e(){return t.apply(this,arguments)||this}i(e,t);var n=e.prototype;return n.sendSms=function(t){return this.post("crm/"+this.instance_id+"/send/normal",t)},n.sendTypedSms=function(t,e){return this.post("crm/"+this.instance_id+"/send/typed/"+t,e)},e}(s),d=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var r=n.prototype;return r.getProduct=function(t){return this.get("product/"+t)},r.getProductFeatures=function(t){return this.get("product/"+t+"/features")},r.getSimilarProducts=function(t){return this.get("product/"+t+"/similar-products")},r.getProductChoices=function(t){return this.get("product/"+t+"/choices")},r.getProductReviews=function(t,n){var r="product/"+t+"/reviews";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.getRatingOptions=function(t){return this.get("product/"+t+"/rating-options")},r.sendNewReview=function(t,e){return this.put("product/"+t+"/review",e)},r.reportReview=function(t,e){return this.post("product/"+t+"/review/"+e+"/report")},r.getProductRemaining=function(t,n){var r="product/"+t+"/remaining";return n&&(r+=e.stringify(n,"?")),this.get(r)},n}(s),p=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var r=n.prototype;return r.getCountries=function(t){var n="countries";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getIranProvinces=function(t){var n="countries/103/states";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getStateCities=function(t,n){var r="countries/103/states/"+t+"/cities";return n&&(r+=e.stringify(n,"?")),this.get(r)},n}(s);n.config();var f,g=function(t){function e(){return t.apply(this,arguments)||this}return i(e,t),e}(s);return f=g,[u,c,o,a,h,d,p].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){Object.defineProperty(f.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})}),g}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "tayeh.js", | ||
"version": "0.0.78", | ||
"version": "0.0.79", | ||
"description": "tayeh shop-api client", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
56709
219