Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tayeh.js

Package Overview
Dependencies
Maintainers
2
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tayeh.js - npm Package Compare versions

Comparing version 0.1.83 to 0.1.85

dist/connection/ConnectionOptions.d.ts

34

dist/base.d.ts

@@ -1,7 +0,3 @@

import { AxiosRequestConfig } from "axios";
declare type Config = {
API_KEY: string;
API_SECRET: string;
basePath?: string;
};
import { AxiosRequestConfig, AxiosResponse } from "axios";
import { ConnectionOptions } from "./connection/ConnectionOptions";
export declare type Pagination = {

@@ -12,11 +8,21 @@ page?: number;

export declare abstract class Base {
private API_KEY;
private API_SECRET;
private basePath;
private token;
constructor(config: Config);
protected get_token(API_KEY: any, API_SECRET: any): Promise<boolean>;
protected get<T>(endpoint: string, options?: AxiosRequestConfig): Promise<T>;
protected post<T>(endpoint: string, body: any, options?: AxiosRequestConfig): Promise<T>;
private authPath;
private mediaPath;
private API_ACCESS;
private USER_ACCESS;
instance_id: number;
constructor(options: ConnectionOptions);
set_token(access_token: any): void;
set_user(access_token: any): void;
protected delete<T>(endpoint: string, options?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
protected user_delete<T>(endpoint: string, options?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
protected get<T>(endpoint: string, options?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
protected user_get<T>(endpoint: string, options?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
protected post<T>(endpoint: string, body?: {}, options?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
protected user_post<T>(endpoint: string, body?: {}, options?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
protected post_media<T>(endpoint: string, body?: {}, options?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
protected put<T>(endpoint: string, body?: {}, options?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
protected user_put<T>(endpoint: string, body?: {}, options?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
protected post_auth<T>(endpoint: string, body?: {}, options?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
}
export {};

@@ -1,7 +0,13 @@

import { Shop } from './shop';
import { Base } from './base';
import { Media } from "./media";
import { Instance } from "./instance";
import { User } from "./user";
import { Customer } from "./customer";
import { Crm } from "./crm";
import { Product } from "./product";
import { Countries } from "./countries";
import { Base } from "./base";
declare class Tayeh extends Base {
}
interface Tayeh extends Shop {
interface Tayeh extends Instance, User, Media, Customer, Crm, Product, Countries {
}
export default Tayeh;

@@ -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")),i=require("dotenv");function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}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 i=this.basePath+t,s=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(e.delete(i,s))}catch(t){return Promise.reject(t)}},n.user_delete=function(t,n){try{var i=this.basePath+t,s=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(e.delete(i,s))}catch(t){return Promise.reject(t)}},n.get=function(t,n){try{var i=this.basePath+t,s=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(e.get(i,s))}catch(t){return Promise.reject(t)}},n.user_get=function(t,n){try{var i=this.basePath+t,s=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(e.get(i,s))}catch(t){return Promise.reject(t)}},n.post=function(t,n,i){void 0===n&&(n={});try{var s=this.basePath+t,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(e.post(s,n,o))}catch(t){return Promise.reject(t)}},n.user_post=function(t,n,i){void 0===n&&(n={});try{var s=this.basePath+t,o=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(e.post(s,n,o))}catch(t){return Promise.reject(t)}},n.post_media=function(t,n,i){void 0===n&&(n={});try{var s=this.mediaPath+t,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(e.post(s,n,o))}catch(t){return Promise.reject(t)}},n.put=function(t,n,i){void 0===n&&(n={});try{var s=this.basePath+t,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(e.put(s,n,o))}catch(t){return Promise.reject(t)}},n.user_put=function(t,n,i){void 0===n&&(n={});try{var s=this.basePath+t,o=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(e.put(s,n,o))}catch(t){return Promise.reject(t)}},n.post_auth=function(t,n,i){void 0===n&&(n={});try{var s=this.authPath+t,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);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 i=e.prototype;return i.getProducts=function(t){var e="instance/"+this.instance_id+"/products";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.createProduct=function(t){return this.user_put("instance/"+this.instance_id+"/product",t)},i.deleteProduct=function(t){return this.user_delete("instance/"+this.instance_id+"/product/"+t)},i.updateProduct=function(t){return this.user_post("instance/"+this.instance_id+"/product",t)},i.createProductPrice=function(t){return this.user_put("instance/"+this.instance_id+"/product/price",t)},i.updateProductPrice=function(t){return this.user_post("instance/"+this.instance_id+"/product/price",t)},i.updateProductPrices=function(t){return this.user_post("instance/"+this.instance_id+"/product/prices",t)},i.getProductPrices=function(t){return this.user_get("instance/"+this.instance_id+"/product/"+t+"/price-filter")},i.addProductMedia=function(t,e){return this.user_put("instance/"+this.instance_id+"/product/"+t+"/media",e)},i.deleteProductMedia=function(t,e){return this.user_delete("instance/"+this.instance_id+"/product/"+t+"/media/"+e)},i.setProductFeatures=function(t,e){return this.user_put("instance/"+this.instance_id+"/product/"+t+"/features",e)},i.setProductPriceFilter=function(t,e){return this.user_post("instance/"+this.instance_id+"/product/"+t+"/price-filter",e)},i.deleteOptionPrice=function(t,e){return this.user_delete("instance/"+this.instance_id+"/product/"+t+"/option/"+e+"/price")},i.getInstanceInvoices=function(t){var e="instance/"+this.instance_id+"/invoices";return t&&(e+=n.stringify(t,"?")),this.user_get(e)},i.getInstanceInvoice=function(t){return this.user_get("instance/"+this.instance_id+"/invoice/"+t)},i.deleteInstanceInvoice=function(t){return this.delete("instance/"+this.instance_id+"/invoice/"+t)},i.setDeliveryStatus=function(t,e){return this.user_post("instance/"+this.instance_id+"/invoice/"+t+"/delivery-status",e)},i.getInstanceCustomers=function(t){var e="instance/"+this.instance_id+"/customers";return t&&(e+=n.stringify(t,"?")),this.user_get(e)},i.getInstanceCustomer=function(t){return this.user_get("instance/"+this.instance_id+"/customer/"+t)},i.deleteInstanceCustomer=function(t){return this.user_delete("instance/"+this.instance_id+"/customer/"+t)},i.createInstanceCustomer=function(t){return this.user_put("instance/"+this.instance_id+"/customer",t)},i.updateInstanceCustomer=function(t,e){return this.user_post("instance/"+this.instance_id+"/customer/"+t,e)},i.acceptInstanceCustomer=function(t){return this.user_post("instance/"+this.instance_id+"/customer/"+t+"/accept")},i.getCategories=function(t){var e="instance/"+this.instance_id+"/categories";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.createCategory=function(t){return this.user_put("instance/"+this.instance_id+"/category",t)},i.updateCategory=function(t){return this.user_post("instance/"+this.instance_id+"/category",t)},i.deleteCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/category/"+t)},i.createCategoryFilterGroup=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter-group",e)},i.createCategoryFilter=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter",e)},i.getCategoryFeatures=function(t){return this.user_get("instance/"+this.instance_id+"/category/"+t+"/features")},i.deleteCategoryFilter=function(t,e){return this.user_delete("instance/"+this.instance_id+"/category/"+t+"/filter/"+e)},i.deleteFilterOption=function(t,e,n){return this.user_delete("instance/"+this.instance_id+"/category/"+t+"/filter/"+e+"/option/"+n)},i.setCategoryStatus=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/status",e)},i.createBrand=function(t){return this.user_put("instance/"+this.instance_id+"/brand",t)},i.updateBrand=function(t){return this.user_post("instance/"+this.instance_id+"/brand",t)},i.deleteBrand=function(t){return this.user_delete("instance/"+this.instance_id+"/brand/"+t)},i.getBrands=function(){return this.get("instance/"+this.instance_id+"/brands")},i.createBannerCategory=function(t){return this.user_put("instance/"+this.instance_id+"/banner-category",t)},i.getBannerCategories=function(){return this.user_get("instance/"+this.instance_id+"/banner-categories")},i.deleteBannerCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/banner-category/"+t)},i.getBanners=function(t){var e="instance/"+this.instance_id+"/banners";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.createBanner=function(t){return this.user_put("instance/"+this.instance_id+"/banner",t)},i.deleteBanner=function(t){return this.user_delete("instance/"+this.instance_id+"/banner/"+t)},i.updateBanner=function(t){return this.user_post("instance/"+this.instance_id+"/banner/update",t)},i.getInstanceDeliveryMethods=function(){return this.user_get("instance/"+this.instance_id+"/delivery-methods")},i.createInstanceDeliveryMethod=function(t){return this.user_put("instance/"+this.instance_id+"/delivery-method",t)},i.setDeliveryMethodStatus=function(t,e){return this.user_post("instance/"+this.instance_id+"/delivery-method/"+t,e)},i.createNotification=function(t){return this.user_put("instance/"+this.instance_id+"/notification",t)},i.getInstanceNotifications=function(t){var e="instance/"+this.instance_id+"/notifications";return t&&(e+=n.stringify(t,"?")),this.user_get(e)},i.getSearchFilters=function(t){var e="instance/"+this.instance_id+"/search-filters";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.sendInviteSms=function(t){return this.post("instance/"+this.instance_id+"/invite-sms",t)},i.getTopKeywords=function(t){var e="instance/"+this.instance_id+"/top-search-keywords";return t&&(e+=n.stringify(t,"?")),this.post(e,t)},i.updateRemainingWithChoices=function(t){return this.user_post("instance/"+this.instance_id+"/auto-remaining",t)},i.updateRemainingsWithChoices=function(t){return this.user_post("instance/"+this.instance_id+"/batch-auto-remaining",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 i=e.prototype;return i.getPassword=function(t){return this.post_auth("customer/send-mobile-verification",{mobile:t,instance:this.instance_id})},i.customerVerify=function(t,e){return this.post_auth("customer/verify-mobile",{mobile:t,verification_code:e,instance:this.instance_id})},i.getVerification=function(t){return this.post_auth("customer/send-email-verification",{email:t,instance:this.instance_id})},i.emailVerify=function(t,e){return this.post_auth("customer/verify-email",{email:t,verification_code:e,instance:this.instance_id})},i.customerLogin=function(t,e){return this.post_auth("customer/login",{username:t,password:e,instance:this.instance_id})},i.customerRegister=function(t){return this.post_auth("customer/register",t)},i.resetCustomerPassword=function(t){return this.post_auth("customer/reset-password",t)},i.getCustomerMe=function(){return this.get("customer/me")},i.getCustomer=function(){return this.get("customer")},i.updateCustomer=function(t){return this.post("customer",t)},i.addProductToCart=function(t){return this.put("customer/cart",t)},i.toggleProductFavorite=function(t){return this.post("customer/favorite-product",t)},i.getCustomerCart=function(t){var e="customer/cart";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.updateCartItem=function(t){return this.post("customer/cart",t)},i.deleteCartItem=function(t){return this.delete("customer/cart/"+t)},i.getNotifications=function(t){var e="customer/notifications";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.getCustomerNotification=function(t){return this.get("customer/notifications/"+t)},i.getFavorites=function(t){var e="customer/favorite-products";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.getProductsHistory=function(t){var e="customer/products-history";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.getAddresses=function(){return this.get("customer/addresses")},i.createAddress=function(t){return this.put("customer/address",t)},i.updateAddress=function(t){return this.post("customer/address",t)},i.deleteAddress=function(t){return this.delete("customer/address/"+t)},i.setCartDelivery=function(t,e,n){return this.post("customer/cart/delivery",{address:t,delivery_method:e,payment_method:n})},i.setAvatar=function(t){return this.post("customer/avatar",{avatar_id:t})},i.getInvoicesHistory=function(t){var e="customer/cart/history";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.getInvoice=function(t){return this.get("customer/invoice/"+t)},i.getCustomerCredit=function(){return this.get("customer/credit")},i.getCartPay=function(){return this.get("customer/cart/pay")},i.depositCustomerMoney=function(t){return this.put("customer/deposit",t)},i.getCartDeliveryMethods=function(){return this.get("customer/delivery-methods")},i.getLatestUnseenNotification=function(){return this.get("customer/notifications/last-unseen")},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 i=e.prototype;return i.getProduct=function(t){return this.get("product/"+t)},i.getProductFeatures=function(t){return this.get("product/"+t+"/features")},i.getSimilarProducts=function(t){return this.get("product/"+t+"/similar-products")},i.getProductChoices=function(t){return this.get("product/"+t+"/choices")},i.getProductReviews=function(t,e){var i="product/"+t+"/reviews";return e&&(i+=n.stringify(e,"?")),this.get(i)},i.getRatingOptions=function(t){return this.get("product/"+t+"/rating-options")},i.sendNewReview=function(t,e){return this.put("product/"+t+"/review",e)},i.reportReview=function(t,e){return this.post("product/"+t+"/review/"+e+"/report")},i.getProductRemaining=function(t,e){var i="product/"+t+"/remaining";return e&&(i+=n.stringify(e,"?")),this.get(i)},i.getPricableFilters=function(t){return this.user_get("product/"+t+"/price-filter")},e}(o),f=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.getCountries=function(t){var e="countries";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.getIranProvinces=function(t){var e="countries/103/states";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.getStateCities=function(t,e){var i="countries/103/states/"+t+"/cities";return e&&(i+=n.stringify(e,"?")),this.get(i)},e}(o);i.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")),i=require("dotenv");function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function s(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,(Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,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 i=this.basePath+t,s=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(e.delete(i,s))}catch(t){return Promise.reject(t)}},n.user_delete=function(t,n){try{var i=this.basePath+t,s=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(e.delete(i,s))}catch(t){return Promise.reject(t)}},n.get=function(t,n){try{var i=this.basePath+t,s=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(e.get(i,s))}catch(t){return Promise.reject(t)}},n.user_get=function(t,n){try{var i=this.basePath+t,s=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(e.get(i,s))}catch(t){return Promise.reject(t)}},n.post=function(t,n,i){void 0===n&&(n={});try{var s=this.basePath+t,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(e.post(s,n,o))}catch(t){return Promise.reject(t)}},n.user_post=function(t,n,i){void 0===n&&(n={});try{var s=this.basePath+t,o=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(e.post(s,n,o))}catch(t){return Promise.reject(t)}},n.post_media=function(t,n,i){void 0===n&&(n={});try{var s=this.mediaPath+t,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(e.post(s,n,o))}catch(t){return Promise.reject(t)}},n.put=function(t,n,i){void 0===n&&(n={});try{var s=this.basePath+t,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(e.put(s,n,o))}catch(t){return Promise.reject(t)}},n.user_put=function(t,n,i){void 0===n&&(n={});try{var s=this.basePath+t,o=r({headers:r({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},i);return Promise.resolve(e.put(s,n,o))}catch(t){return Promise.reject(t)}},n.post_auth=function(t,n,i){void 0===n&&(n={});try{var s=this.authPath+t,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},i);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 i=e.prototype;return i.getProducts=function(t){var e="instance/"+this.instance_id+"/products";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.createProduct=function(t){return this.user_put("instance/"+this.instance_id+"/product",t)},i.deleteProduct=function(t){return this.user_delete("instance/"+this.instance_id+"/product/"+t)},i.updateProduct=function(t){return this.user_post("instance/"+this.instance_id+"/product",t)},i.createProductPrice=function(t){return this.user_put("instance/"+this.instance_id+"/product/price",t)},i.updateProductPrice=function(t){return this.user_post("instance/"+this.instance_id+"/product/price",t)},i.updateProductPrices=function(t){return this.user_post("instance/"+this.instance_id+"/product/prices",t)},i.getProductPrices=function(t){return this.user_get("instance/"+this.instance_id+"/product/"+t+"/price-filter")},i.addProductMedia=function(t,e){return this.user_put("instance/"+this.instance_id+"/product/"+t+"/media",e)},i.deleteProductMedia=function(t,e){return this.user_delete("instance/"+this.instance_id+"/product/"+t+"/media/"+e)},i.setProductFeatures=function(t,e){return this.user_put("instance/"+this.instance_id+"/product/"+t+"/features",e)},i.setProductPriceFilter=function(t,e){return this.user_post("instance/"+this.instance_id+"/product/"+t+"/price-filter",e)},i.deleteOptionPrice=function(t,e){return this.user_delete("instance/"+this.instance_id+"/product/"+t+"/option/"+e+"/price")},i.getInstanceInvoices=function(t){var e="instance/"+this.instance_id+"/invoices";return t&&(e+=n.stringify(t,"?")),this.user_get(e)},i.getInstanceInvoice=function(t){return this.user_get("instance/"+this.instance_id+"/invoice/"+t)},i.deleteInstanceInvoice=function(t){return this.delete("instance/"+this.instance_id+"/invoice/"+t)},i.setDeliveryStatus=function(t,e){return this.user_post("instance/"+this.instance_id+"/invoice/"+t+"/delivery-status",e)},i.getInstanceCustomers=function(t){var e="instance/"+this.instance_id+"/customers";return t&&(e+=n.stringify(t,"?")),this.user_get(e)},i.getInstanceCustomer=function(t){return this.user_get("instance/"+this.instance_id+"/customer/"+t)},i.deleteInstanceCustomer=function(t){return this.user_delete("instance/"+this.instance_id+"/customer/"+t)},i.createInstanceCustomer=function(t){return this.user_put("instance/"+this.instance_id+"/customer",t)},i.updateInstanceCustomer=function(t,e){return this.user_post("instance/"+this.instance_id+"/customer/"+t,e)},i.acceptInstanceCustomer=function(t){return this.user_post("instance/"+this.instance_id+"/customer/"+t+"/accept")},i.getCategories=function(t){var e="instance/"+this.instance_id+"/categories";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.createCategory=function(t){return this.user_put("instance/"+this.instance_id+"/category",t)},i.updateCategory=function(t){return this.user_post("instance/"+this.instance_id+"/category",t)},i.deleteCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/category/"+t)},i.createCategoryFilterGroup=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter-group",e)},i.createCategoryFilter=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter",e)},i.getCategoryFeatures=function(t){return this.user_get("instance/"+this.instance_id+"/category/"+t+"/features")},i.deleteCategoryFilter=function(t,e){return this.user_delete("instance/"+this.instance_id+"/category/"+t+"/filter/"+e)},i.deleteFilterOption=function(t,e,n){return this.user_delete("instance/"+this.instance_id+"/category/"+t+"/filter/"+e+"/option/"+n)},i.setCategoryStatus=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/status",e)},i.createBrand=function(t){return this.user_put("instance/"+this.instance_id+"/brand",t)},i.updateBrand=function(t){return this.user_post("instance/"+this.instance_id+"/brand",t)},i.deleteBrand=function(t){return this.user_delete("instance/"+this.instance_id+"/brand/"+t)},i.getBrands=function(){return this.get("instance/"+this.instance_id+"/brands")},i.createBannerCategory=function(t){return this.user_put("instance/"+this.instance_id+"/banner-category",t)},i.getBannerCategories=function(){return this.user_get("instance/"+this.instance_id+"/banner-categories")},i.deleteBannerCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/banner-category/"+t)},i.getBanners=function(t){var e="instance/"+this.instance_id+"/banners";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.createBanner=function(t){return this.user_put("instance/"+this.instance_id+"/banner",t)},i.deleteBanner=function(t){return this.user_delete("instance/"+this.instance_id+"/banner/"+t)},i.updateBanner=function(t){return this.user_post("instance/"+this.instance_id+"/banner/update",t)},i.getInstanceDeliveryMethods=function(){return this.user_get("instance/"+this.instance_id+"/delivery-methods")},i.createInstanceDeliveryMethod=function(t){return this.user_put("instance/"+this.instance_id+"/delivery-method",t)},i.setDeliveryMethodStatus=function(t,e){return this.user_post("instance/"+this.instance_id+"/delivery-method/"+t,e)},i.createNotification=function(t){return this.user_put("instance/"+this.instance_id+"/notification",t)},i.getInstanceNotifications=function(t){var e="instance/"+this.instance_id+"/notifications";return t&&(e+=n.stringify(t,"?")),this.user_get(e)},i.getSearchFilters=function(t){var e="instance/"+this.instance_id+"/search-filters";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.sendInviteSms=function(t){return this.post("instance/"+this.instance_id+"/invite-sms",t)},i.getTopKeywords=function(t){var e="instance/"+this.instance_id+"/top-search-keywords";return t&&(e+=n.stringify(t,"?")),this.post(e,t)},i.updateRemainingWithChoices=function(t){return this.user_post("instance/"+this.instance_id+"/auto-remaining",t)},i.updateRemainingsWithChoices=function(t){return this.user_post("instance/"+this.instance_id+"/batch-auto-remaining",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 i=e.prototype;return i.getPassword=function(t){return this.post_auth("customer/send-mobile-verification",{mobile:t,instance:this.instance_id})},i.customerVerify=function(t,e){return this.post_auth("customer/verify-mobile",{mobile:t,verification_code:e,instance:this.instance_id})},i.getVerification=function(t){return this.post_auth("customer/send-email-verification",{email:t,instance:this.instance_id})},i.emailVerify=function(t,e){return this.post_auth("customer/verify-email",{email:t,verification_code:e,instance:this.instance_id})},i.customerLogin=function(t,e){return this.post_auth("customer/login",{username:t,password:e,instance:this.instance_id})},i.customerRegister=function(t){return this.post_auth("customer/register",t)},i.resetCustomerPassword=function(t){return this.post_auth("customer/reset-password",t)},i.getCustomerMe=function(){return this.get("customer/me")},i.getCustomer=function(){return this.get("customer")},i.updateCustomer=function(t){return this.post("customer",t)},i.addProductToCart=function(t){return this.put("customer/cart",t)},i.toggleProductFavorite=function(t){return this.post("customer/favorite-product",t)},i.getCustomerCart=function(t){var e="customer/cart";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.updateCartItem=function(t){return this.post("customer/cart",t)},i.deleteCartItem=function(t){return this.delete("customer/cart/"+t)},i.getNotifications=function(t){var e="customer/notifications";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.getCustomerNotification=function(t){return this.get("customer/notifications/"+t)},i.getFavorites=function(t){var e="customer/favorite-products";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.getProductsHistory=function(t){var e="customer/products-history";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.getAddresses=function(){return this.get("customer/addresses")},i.createAddress=function(t){return this.put("customer/address",t)},i.updateAddress=function(t){return this.post("customer/address",t)},i.deleteAddress=function(t){return this.delete("customer/address/"+t)},i.setCartDelivery=function(t,e,n){return this.post("customer/cart/delivery",{address:t,delivery_method:e,payment_method:n})},i.setAvatar=function(t){return this.post("customer/avatar",{avatar_id:t})},i.getInvoicesHistory=function(t){var e="customer/cart/history";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.getInvoice=function(t){return this.get("customer/invoice/"+t)},i.getCustomerCredit=function(){return this.get("customer/credit")},i.getCartPay=function(){return this.get("customer/cart/pay")},i.depositCustomerMoney=function(t){return this.put("customer/deposit",t)},i.getCartDeliveryMethods=function(){return this.get("customer/delivery-methods")},i.getLatestUnseenNotification=function(){return this.get("customer/notifications/last-unseen")},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 i=e.prototype;return i.getProduct=function(t){return this.get("product/"+t)},i.getProductFeatures=function(t){return this.get("product/"+t+"/features")},i.getSimilarProducts=function(t){return this.get("product/"+t+"/similar-products")},i.getProductChoices=function(t){return this.get("product/"+t+"/choices")},i.getProductReviews=function(t,e){var i="product/"+t+"/reviews";return e&&(i+=n.stringify(e,"?")),this.get(i)},i.getRatingOptions=function(t){return this.get("product/"+t+"/rating-options")},i.sendNewReview=function(t,e){return this.put("product/"+t+"/review",e)},i.reportReview=function(t,e){return this.post("product/"+t+"/review/"+e+"/report")},i.getProductRemaining=function(t,e){var i="product/"+t+"/remaining";return e&&(i+=n.stringify(e,"?")),this.get(i)},i.getPricableFilters=function(t){return this.user_get("product/"+t+"/price-filter")},e}(o),f=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.getCountries=function(t){var e="countries";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.getIranProvinces=function(t){var e="countries/103/states";return t&&(e+=n.stringify(t,"?")),this.get(e)},i.getStateCities=function(t,e){var i="countries/103/states/"+t+"/cities";return e&&(i+=n.stringify(e,"?")),this.get(i)},e}(o);i.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 i{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 i=this.basePath+e,r={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...s};return await t.delete(i,r)}async user_delete(e,s){const i=this.basePath+e,r={headers:{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"},...s};return await t.delete(i,r)}async get(e,s){const i=this.basePath+e,r={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...s};return await t.get(i,r)}async user_get(e,s){const i=this.basePath+e,r={headers:{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"},...s};return await t.get(i,r)}async post(e,s={},i){const r=this.basePath+e,n={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...i};return await t.post(r,s,n)}async user_post(e,s={},i){const r=this.basePath+e,n={headers:{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"},...i};return await t.post(r,s,n)}async post_media(e,s={},i){const r=this.mediaPath+e,n={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...i};return await t.post(r,s,n)}async put(e,s={},i){const r=this.basePath+e,n={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...i};return await t.put(r,s,n)}async user_put(e,s={},i){const r=this.basePath+e,n={headers:{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"},...i};return await t.put(r,s,n)}async post_auth(e,s={},i){const r=this.authPath+e,n={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...i};return await t.post(r,s,n)}}s();class r extends i{}var n;n=r,[class extends i{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`,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_put(`instance/${this.instance_id}/product/${t}/media`,e)}deleteProductMedia(t,e){return this.user_delete(`instance/${this.instance_id}/product/${t}/media/${e}`)}setProductFeatures(t,e){return this.user_put(`instance/${this.instance_id}/product/${t}/features`,e)}setProductPriceFilter(t,e){return this.user_post(`instance/${this.instance_id}/product/${t}/price-filter`,e)}deleteOptionPrice(t,e){return this.user_delete(`instance/${this.instance_id}/product/${t}/option/${e}/price`)}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}`)}setDeliveryStatus(t,e){return this.user_post(`instance/${this.instance_id}/invoice/${t}/delivery-status`,e)}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}/features`)}deleteCategoryFilter(t,e){return this.user_delete(`instance/${this.instance_id}/category/${t}/filter/${e}`)}deleteFilterOption(t,e,s){return this.user_delete(`instance/${this.instance_id}/category/${t}/filter/${e}/option/${s}`)}setCategoryStatus(t,e){return this.user_put(`instance/${this.instance_id}/category/${t}/status`,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)}getInstanceDeliveryMethods(){return this.user_get(`instance/${this.instance_id}/delivery-methods`)}createInstanceDeliveryMethod(t){return this.user_put(`instance/${this.instance_id}/delivery-method`,t)}setDeliveryMethodStatus(t,e){return this.user_post(`instance/${this.instance_id}/delivery-method/${t}`,e)}createNotification(t){return this.user_put(`instance/${this.instance_id}/notification`,t)}getInstanceNotifications(t){let s=`instance/${this.instance_id}/notifications`;return t&&(s+=e.stringify(t,"?")),this.user_get(s)}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)}updateRemainingWithChoices(t){return this.user_post(`instance/${this.instance_id}/auto-remaining`,t)}updateRemainingsWithChoices(t){return this.user_post(`instance/${this.instance_id}/batch-auto-remaining`,t)}},class extends i{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 i{getMedia(t){return this.get("media/get/"+t)}uploadMedia(t){return this.post_media("image",t)}},class extends i{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)}resetCustomerPassword(t){return this.post_auth("customer/reset-password",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(t){let s="customer/cart";return t&&(s+=e.stringify(t,"?")),this.get(s)}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)}getCustomerNotification(t){return this.get("customer/notifications/"+t)}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,e,s){return this.post("customer/cart/delivery",{address:t,delivery_method:e,payment_method:s})}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")}getCartPay(){return this.get("customer/cart/pay")}depositCustomerMoney(t){return this.put("customer/deposit",t)}getCartDeliveryMethods(){return this.get("customer/delivery-methods")}getLatestUnseenNotification(){return this.get("customer/notifications/last-unseen")}},class extends i{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 i{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 i=`product/${t}/reviews`;return s&&(i+=e.stringify(s,"?")),this.get(i)}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 i=`product/${t}/remaining`;return s&&(i+=e.stringify(s,"?")),this.get(i)}getPricableFilters(t){return this.user_get(`product/${t}/price-filter`)}},class extends i{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 i=`countries/103/states/${t}/cities`;return s&&(i+=e.stringify(s,"?")),this.get(i)}}].forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(e=>{Object.defineProperty(n.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})});export default r;
import t from"axios";import e from"querystringify";import{config as s}from"dotenv";function i(){return(i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(t[i]=s[i])}return t}).apply(this,arguments)}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,n=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},s);return await t.delete(r,n)}async user_delete(e,s){const r=this.basePath+e,n=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},s);return await t.delete(r,n)}async get(e,s){const r=this.basePath+e,n=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},s);return await t.get(r,n)}async user_get(e,s){const r=this.basePath+e,n=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},s);return await t.get(r,n)}async post(e,s={},r){const n=this.basePath+e,a=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return await t.post(n,s,a)}async user_post(e,s={},r){const n=this.basePath+e,a=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},r);return await t.post(n,s,a)}async post_media(e,s={},r){const n=this.mediaPath+e,a=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return await t.post(n,s,a)}async put(e,s={},r){const n=this.basePath+e,a=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return await t.put(n,s,a)}async user_put(e,s={},r){const n=this.basePath+e,a=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},r);return await t.put(n,s,a)}async post_auth(e,s={},r){const n=this.authPath+e,a=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return await t.post(n,s,a)}}s();class n extends r{}var a;a=n,[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`,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_put(`instance/${this.instance_id}/product/${t}/media`,e)}deleteProductMedia(t,e){return this.user_delete(`instance/${this.instance_id}/product/${t}/media/${e}`)}setProductFeatures(t,e){return this.user_put(`instance/${this.instance_id}/product/${t}/features`,e)}setProductPriceFilter(t,e){return this.user_post(`instance/${this.instance_id}/product/${t}/price-filter`,e)}deleteOptionPrice(t,e){return this.user_delete(`instance/${this.instance_id}/product/${t}/option/${e}/price`)}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}`)}setDeliveryStatus(t,e){return this.user_post(`instance/${this.instance_id}/invoice/${t}/delivery-status`,e)}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}/features`)}deleteCategoryFilter(t,e){return this.user_delete(`instance/${this.instance_id}/category/${t}/filter/${e}`)}deleteFilterOption(t,e,s){return this.user_delete(`instance/${this.instance_id}/category/${t}/filter/${e}/option/${s}`)}setCategoryStatus(t,e){return this.user_put(`instance/${this.instance_id}/category/${t}/status`,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)}getInstanceDeliveryMethods(){return this.user_get(`instance/${this.instance_id}/delivery-methods`)}createInstanceDeliveryMethod(t){return this.user_put(`instance/${this.instance_id}/delivery-method`,t)}setDeliveryMethodStatus(t,e){return this.user_post(`instance/${this.instance_id}/delivery-method/${t}`,e)}createNotification(t){return this.user_put(`instance/${this.instance_id}/notification`,t)}getInstanceNotifications(t){let s=`instance/${this.instance_id}/notifications`;return t&&(s+=e.stringify(t,"?")),this.user_get(s)}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)}updateRemainingWithChoices(t){return this.user_post(`instance/${this.instance_id}/auto-remaining`,t)}updateRemainingsWithChoices(t){return this.user_post(`instance/${this.instance_id}/batch-auto-remaining`,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)}resetCustomerPassword(t){return this.post_auth("customer/reset-password",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(t){let s="customer/cart";return t&&(s+=e.stringify(t,"?")),this.get(s)}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)}getCustomerNotification(t){return this.get("customer/notifications/"+t)}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,e,s){return this.post("customer/cart/delivery",{address:t,delivery_method:e,payment_method:s})}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")}getCartPay(){return this.get("customer/cart/pay")}depositCustomerMoney(t){return this.put("customer/deposit",t)}getCartDeliveryMethods(){return this.get("customer/delivery-methods")}getLatestUnseenNotification(){return this.get("customer/notifications/last-unseen")}},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 i=`product/${t}/reviews`;return s&&(i+=e.stringify(s,"?")),this.get(i)}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 i=`product/${t}/remaining`;return s&&(i+=e.stringify(s,"?")),this.get(i)}getPricableFilters(t){return this.user_get(`product/${t}/price-filter`)}},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 i=`countries/103/states/${t}/cities`;return s&&(i+=e.stringify(s,"?")),this.get(i)}}].forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(e=>{Object.defineProperty(a.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})});export default n;
//# sourceMappingURL=index.modern.js.map

@@ -1,2 +0,2 @@

import t from"axios";import e from"querystringify";import{config as n}from"dotenv";function i(){return(i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function r(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 r=this.basePath+e,s=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.delete(r,s))}catch(t){return Promise.reject(t)}},n.user_delete=function(e,n){try{var r=this.basePath+e,s=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.delete(r,s))}catch(t){return Promise.reject(t)}},n.get=function(e,n){try{var r=this.basePath+e,s=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.get(r,s))}catch(t){return Promise.reject(t)}},n.user_get=function(e,n){try{var r=this.basePath+e,s=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.get(r,s))}catch(t){return Promise.reject(t)}},n.post=function(e,n,r){void 0===n&&(n={});try{var s=this.basePath+e,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.user_post=function(e,n,r){void 0===n&&(n={});try{var s=this.basePath+e,o=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.post_media=function(e,n,r){void 0===n&&(n={});try{var s=this.mediaPath+e,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.put=function(e,n,r){void 0===n&&(n={});try{var s=this.basePath+e,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(t.put(s,n,o))}catch(t){return Promise.reject(t)}},n.user_put=function(e,n,r){void 0===n&&(n={});try{var s=this.basePath+e,o=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(t.put(s,n,o))}catch(t){return Promise.reject(t)}},n.post_auth=function(e,n,r){void 0===n&&(n={});try{var s=this.authPath+e,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);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}r(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}r(n,t);var i=n.prototype;return i.getProducts=function(t){var n="instance/"+this.instance_id+"/products";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.createProduct=function(t){return this.user_put("instance/"+this.instance_id+"/product",t)},i.deleteProduct=function(t){return this.user_delete("instance/"+this.instance_id+"/product/"+t)},i.updateProduct=function(t){return this.user_post("instance/"+this.instance_id+"/product",t)},i.createProductPrice=function(t){return this.user_put("instance/"+this.instance_id+"/product/price",t)},i.updateProductPrice=function(t){return this.user_post("instance/"+this.instance_id+"/product/price",t)},i.updateProductPrices=function(t){return this.user_post("instance/"+this.instance_id+"/product/prices",t)},i.getProductPrices=function(t){return this.user_get("instance/"+this.instance_id+"/product/"+t+"/price-filter")},i.addProductMedia=function(t,e){return this.user_put("instance/"+this.instance_id+"/product/"+t+"/media",e)},i.deleteProductMedia=function(t,e){return this.user_delete("instance/"+this.instance_id+"/product/"+t+"/media/"+e)},i.setProductFeatures=function(t,e){return this.user_put("instance/"+this.instance_id+"/product/"+t+"/features",e)},i.setProductPriceFilter=function(t,e){return this.user_post("instance/"+this.instance_id+"/product/"+t+"/price-filter",e)},i.deleteOptionPrice=function(t,e){return this.user_delete("instance/"+this.instance_id+"/product/"+t+"/option/"+e+"/price")},i.getInstanceInvoices=function(t){var n="instance/"+this.instance_id+"/invoices";return t&&(n+=e.stringify(t,"?")),this.user_get(n)},i.getInstanceInvoice=function(t){return this.user_get("instance/"+this.instance_id+"/invoice/"+t)},i.deleteInstanceInvoice=function(t){return this.delete("instance/"+this.instance_id+"/invoice/"+t)},i.setDeliveryStatus=function(t,e){return this.user_post("instance/"+this.instance_id+"/invoice/"+t+"/delivery-status",e)},i.getInstanceCustomers=function(t){var n="instance/"+this.instance_id+"/customers";return t&&(n+=e.stringify(t,"?")),this.user_get(n)},i.getInstanceCustomer=function(t){return this.user_get("instance/"+this.instance_id+"/customer/"+t)},i.deleteInstanceCustomer=function(t){return this.user_delete("instance/"+this.instance_id+"/customer/"+t)},i.createInstanceCustomer=function(t){return this.user_put("instance/"+this.instance_id+"/customer",t)},i.updateInstanceCustomer=function(t,e){return this.user_post("instance/"+this.instance_id+"/customer/"+t,e)},i.acceptInstanceCustomer=function(t){return this.user_post("instance/"+this.instance_id+"/customer/"+t+"/accept")},i.getCategories=function(t){var n="instance/"+this.instance_id+"/categories";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.createCategory=function(t){return this.user_put("instance/"+this.instance_id+"/category",t)},i.updateCategory=function(t){return this.user_post("instance/"+this.instance_id+"/category",t)},i.deleteCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/category/"+t)},i.createCategoryFilterGroup=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter-group",e)},i.createCategoryFilter=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter",e)},i.getCategoryFeatures=function(t){return this.user_get("instance/"+this.instance_id+"/category/"+t+"/features")},i.deleteCategoryFilter=function(t,e){return this.user_delete("instance/"+this.instance_id+"/category/"+t+"/filter/"+e)},i.deleteFilterOption=function(t,e,n){return this.user_delete("instance/"+this.instance_id+"/category/"+t+"/filter/"+e+"/option/"+n)},i.setCategoryStatus=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/status",e)},i.createBrand=function(t){return this.user_put("instance/"+this.instance_id+"/brand",t)},i.updateBrand=function(t){return this.user_post("instance/"+this.instance_id+"/brand",t)},i.deleteBrand=function(t){return this.user_delete("instance/"+this.instance_id+"/brand/"+t)},i.getBrands=function(){return this.get("instance/"+this.instance_id+"/brands")},i.createBannerCategory=function(t){return this.user_put("instance/"+this.instance_id+"/banner-category",t)},i.getBannerCategories=function(){return this.user_get("instance/"+this.instance_id+"/banner-categories")},i.deleteBannerCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/banner-category/"+t)},i.getBanners=function(t){var n="instance/"+this.instance_id+"/banners";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.createBanner=function(t){return this.user_put("instance/"+this.instance_id+"/banner",t)},i.deleteBanner=function(t){return this.user_delete("instance/"+this.instance_id+"/banner/"+t)},i.updateBanner=function(t){return this.user_post("instance/"+this.instance_id+"/banner/update",t)},i.getInstanceDeliveryMethods=function(){return this.user_get("instance/"+this.instance_id+"/delivery-methods")},i.createInstanceDeliveryMethod=function(t){return this.user_put("instance/"+this.instance_id+"/delivery-method",t)},i.setDeliveryMethodStatus=function(t,e){return this.user_post("instance/"+this.instance_id+"/delivery-method/"+t,e)},i.createNotification=function(t){return this.user_put("instance/"+this.instance_id+"/notification",t)},i.getInstanceNotifications=function(t){var n="instance/"+this.instance_id+"/notifications";return t&&(n+=e.stringify(t,"?")),this.user_get(n)},i.getSearchFilters=function(t){var n="instance/"+this.instance_id+"/search-filters";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.sendInviteSms=function(t){return this.post("instance/"+this.instance_id+"/invite-sms",t)},i.getTopKeywords=function(t){var n="instance/"+this.instance_id+"/top-search-keywords";return t&&(n+=e.stringify(t,"?")),this.post(n,t)},i.updateRemainingWithChoices=function(t){return this.user_post("instance/"+this.instance_id+"/auto-remaining",t)},i.updateRemainingsWithChoices=function(t){return this.user_post("instance/"+this.instance_id+"/batch-auto-remaining",t)},n}(s),c=function(t){function e(){return t.apply(this,arguments)||this}r(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}r(n,t);var i=n.prototype;return i.getPassword=function(t){return this.post_auth("customer/send-mobile-verification",{mobile:t,instance:this.instance_id})},i.customerVerify=function(t,e){return this.post_auth("customer/verify-mobile",{mobile:t,verification_code:e,instance:this.instance_id})},i.getVerification=function(t){return this.post_auth("customer/send-email-verification",{email:t,instance:this.instance_id})},i.emailVerify=function(t,e){return this.post_auth("customer/verify-email",{email:t,verification_code:e,instance:this.instance_id})},i.customerLogin=function(t,e){return this.post_auth("customer/login",{username:t,password:e,instance:this.instance_id})},i.customerRegister=function(t){return this.post_auth("customer/register",t)},i.resetCustomerPassword=function(t){return this.post_auth("customer/reset-password",t)},i.getCustomerMe=function(){return this.get("customer/me")},i.getCustomer=function(){return this.get("customer")},i.updateCustomer=function(t){return this.post("customer",t)},i.addProductToCart=function(t){return this.put("customer/cart",t)},i.toggleProductFavorite=function(t){return this.post("customer/favorite-product",t)},i.getCustomerCart=function(t){var n="customer/cart";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.updateCartItem=function(t){return this.post("customer/cart",t)},i.deleteCartItem=function(t){return this.delete("customer/cart/"+t)},i.getNotifications=function(t){var n="customer/notifications";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getCustomerNotification=function(t){return this.get("customer/notifications/"+t)},i.getFavorites=function(t){var n="customer/favorite-products";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getProductsHistory=function(t){var n="customer/products-history";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getAddresses=function(){return this.get("customer/addresses")},i.createAddress=function(t){return this.put("customer/address",t)},i.updateAddress=function(t){return this.post("customer/address",t)},i.deleteAddress=function(t){return this.delete("customer/address/"+t)},i.setCartDelivery=function(t,e,n){return this.post("customer/cart/delivery",{address:t,delivery_method:e,payment_method:n})},i.setAvatar=function(t){return this.post("customer/avatar",{avatar_id:t})},i.getInvoicesHistory=function(t){var n="customer/cart/history";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getInvoice=function(t){return this.get("customer/invoice/"+t)},i.getCustomerCredit=function(){return this.get("customer/credit")},i.getCartPay=function(){return this.get("customer/cart/pay")},i.depositCustomerMoney=function(t){return this.put("customer/deposit",t)},i.getCartDeliveryMethods=function(){return this.get("customer/delivery-methods")},i.getLatestUnseenNotification=function(){return this.get("customer/notifications/last-unseen")},n}(s),h=function(t){function e(){return t.apply(this,arguments)||this}r(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}r(n,t);var i=n.prototype;return i.getProduct=function(t){return this.get("product/"+t)},i.getProductFeatures=function(t){return this.get("product/"+t+"/features")},i.getSimilarProducts=function(t){return this.get("product/"+t+"/similar-products")},i.getProductChoices=function(t){return this.get("product/"+t+"/choices")},i.getProductReviews=function(t,n){var i="product/"+t+"/reviews";return n&&(i+=e.stringify(n,"?")),this.get(i)},i.getRatingOptions=function(t){return this.get("product/"+t+"/rating-options")},i.sendNewReview=function(t,e){return this.put("product/"+t+"/review",e)},i.reportReview=function(t,e){return this.post("product/"+t+"/review/"+e+"/report")},i.getProductRemaining=function(t,n){var i="product/"+t+"/remaining";return n&&(i+=e.stringify(n,"?")),this.get(i)},i.getPricableFilters=function(t){return this.user_get("product/"+t+"/price-filter")},n}(s),p=function(t){function n(){return t.apply(this,arguments)||this}r(n,t);var i=n.prototype;return i.getCountries=function(t){var n="countries";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getIranProvinces=function(t){var n="countries/103/states";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getStateCities=function(t,n){var i="countries/103/states/"+t+"/cities";return n&&(i+=e.stringify(n,"?")),this.get(i)},n}(s);n();var f,_=function(t){function e(){return t.apply(this,arguments)||this}return r(e,t),e}(s);f=_,[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 _;
import t from"axios";import e from"querystringify";import{config as n}from"dotenv";function i(){return(i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,(Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,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 r=this.basePath+e,s=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.delete(r,s))}catch(t){return Promise.reject(t)}},n.user_delete=function(e,n){try{var r=this.basePath+e,s=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.delete(r,s))}catch(t){return Promise.reject(t)}},n.get=function(e,n){try{var r=this.basePath+e,s=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.get(r,s))}catch(t){return Promise.reject(t)}},n.user_get=function(e,n){try{var r=this.basePath+e,s=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.get(r,s))}catch(t){return Promise.reject(t)}},n.post=function(e,n,r){void 0===n&&(n={});try{var s=this.basePath+e,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.user_post=function(e,n,r){void 0===n&&(n={});try{var s=this.basePath+e,o=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.post_media=function(e,n,r){void 0===n&&(n={});try{var s=this.mediaPath+e,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.put=function(e,n,r){void 0===n&&(n={});try{var s=this.basePath+e,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(t.put(s,n,o))}catch(t){return Promise.reject(t)}},n.user_put=function(e,n,r){void 0===n&&(n={});try{var s=this.basePath+e,o=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(t.put(s,n,o))}catch(t){return Promise.reject(t)}},n.post_auth=function(e,n,r){void 0===n&&(n={});try{var s=this.authPath+e,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);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}r(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}r(n,t);var i=n.prototype;return i.getProducts=function(t){var n="instance/"+this.instance_id+"/products";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.createProduct=function(t){return this.user_put("instance/"+this.instance_id+"/product",t)},i.deleteProduct=function(t){return this.user_delete("instance/"+this.instance_id+"/product/"+t)},i.updateProduct=function(t){return this.user_post("instance/"+this.instance_id+"/product",t)},i.createProductPrice=function(t){return this.user_put("instance/"+this.instance_id+"/product/price",t)},i.updateProductPrice=function(t){return this.user_post("instance/"+this.instance_id+"/product/price",t)},i.updateProductPrices=function(t){return this.user_post("instance/"+this.instance_id+"/product/prices",t)},i.getProductPrices=function(t){return this.user_get("instance/"+this.instance_id+"/product/"+t+"/price-filter")},i.addProductMedia=function(t,e){return this.user_put("instance/"+this.instance_id+"/product/"+t+"/media",e)},i.deleteProductMedia=function(t,e){return this.user_delete("instance/"+this.instance_id+"/product/"+t+"/media/"+e)},i.setProductFeatures=function(t,e){return this.user_put("instance/"+this.instance_id+"/product/"+t+"/features",e)},i.setProductPriceFilter=function(t,e){return this.user_post("instance/"+this.instance_id+"/product/"+t+"/price-filter",e)},i.deleteOptionPrice=function(t,e){return this.user_delete("instance/"+this.instance_id+"/product/"+t+"/option/"+e+"/price")},i.getInstanceInvoices=function(t){var n="instance/"+this.instance_id+"/invoices";return t&&(n+=e.stringify(t,"?")),this.user_get(n)},i.getInstanceInvoice=function(t){return this.user_get("instance/"+this.instance_id+"/invoice/"+t)},i.deleteInstanceInvoice=function(t){return this.delete("instance/"+this.instance_id+"/invoice/"+t)},i.setDeliveryStatus=function(t,e){return this.user_post("instance/"+this.instance_id+"/invoice/"+t+"/delivery-status",e)},i.getInstanceCustomers=function(t){var n="instance/"+this.instance_id+"/customers";return t&&(n+=e.stringify(t,"?")),this.user_get(n)},i.getInstanceCustomer=function(t){return this.user_get("instance/"+this.instance_id+"/customer/"+t)},i.deleteInstanceCustomer=function(t){return this.user_delete("instance/"+this.instance_id+"/customer/"+t)},i.createInstanceCustomer=function(t){return this.user_put("instance/"+this.instance_id+"/customer",t)},i.updateInstanceCustomer=function(t,e){return this.user_post("instance/"+this.instance_id+"/customer/"+t,e)},i.acceptInstanceCustomer=function(t){return this.user_post("instance/"+this.instance_id+"/customer/"+t+"/accept")},i.getCategories=function(t){var n="instance/"+this.instance_id+"/categories";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.createCategory=function(t){return this.user_put("instance/"+this.instance_id+"/category",t)},i.updateCategory=function(t){return this.user_post("instance/"+this.instance_id+"/category",t)},i.deleteCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/category/"+t)},i.createCategoryFilterGroup=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter-group",e)},i.createCategoryFilter=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter",e)},i.getCategoryFeatures=function(t){return this.user_get("instance/"+this.instance_id+"/category/"+t+"/features")},i.deleteCategoryFilter=function(t,e){return this.user_delete("instance/"+this.instance_id+"/category/"+t+"/filter/"+e)},i.deleteFilterOption=function(t,e,n){return this.user_delete("instance/"+this.instance_id+"/category/"+t+"/filter/"+e+"/option/"+n)},i.setCategoryStatus=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/status",e)},i.createBrand=function(t){return this.user_put("instance/"+this.instance_id+"/brand",t)},i.updateBrand=function(t){return this.user_post("instance/"+this.instance_id+"/brand",t)},i.deleteBrand=function(t){return this.user_delete("instance/"+this.instance_id+"/brand/"+t)},i.getBrands=function(){return this.get("instance/"+this.instance_id+"/brands")},i.createBannerCategory=function(t){return this.user_put("instance/"+this.instance_id+"/banner-category",t)},i.getBannerCategories=function(){return this.user_get("instance/"+this.instance_id+"/banner-categories")},i.deleteBannerCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/banner-category/"+t)},i.getBanners=function(t){var n="instance/"+this.instance_id+"/banners";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.createBanner=function(t){return this.user_put("instance/"+this.instance_id+"/banner",t)},i.deleteBanner=function(t){return this.user_delete("instance/"+this.instance_id+"/banner/"+t)},i.updateBanner=function(t){return this.user_post("instance/"+this.instance_id+"/banner/update",t)},i.getInstanceDeliveryMethods=function(){return this.user_get("instance/"+this.instance_id+"/delivery-methods")},i.createInstanceDeliveryMethod=function(t){return this.user_put("instance/"+this.instance_id+"/delivery-method",t)},i.setDeliveryMethodStatus=function(t,e){return this.user_post("instance/"+this.instance_id+"/delivery-method/"+t,e)},i.createNotification=function(t){return this.user_put("instance/"+this.instance_id+"/notification",t)},i.getInstanceNotifications=function(t){var n="instance/"+this.instance_id+"/notifications";return t&&(n+=e.stringify(t,"?")),this.user_get(n)},i.getSearchFilters=function(t){var n="instance/"+this.instance_id+"/search-filters";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.sendInviteSms=function(t){return this.post("instance/"+this.instance_id+"/invite-sms",t)},i.getTopKeywords=function(t){var n="instance/"+this.instance_id+"/top-search-keywords";return t&&(n+=e.stringify(t,"?")),this.post(n,t)},i.updateRemainingWithChoices=function(t){return this.user_post("instance/"+this.instance_id+"/auto-remaining",t)},i.updateRemainingsWithChoices=function(t){return this.user_post("instance/"+this.instance_id+"/batch-auto-remaining",t)},n}(s),c=function(t){function e(){return t.apply(this,arguments)||this}r(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}r(n,t);var i=n.prototype;return i.getPassword=function(t){return this.post_auth("customer/send-mobile-verification",{mobile:t,instance:this.instance_id})},i.customerVerify=function(t,e){return this.post_auth("customer/verify-mobile",{mobile:t,verification_code:e,instance:this.instance_id})},i.getVerification=function(t){return this.post_auth("customer/send-email-verification",{email:t,instance:this.instance_id})},i.emailVerify=function(t,e){return this.post_auth("customer/verify-email",{email:t,verification_code:e,instance:this.instance_id})},i.customerLogin=function(t,e){return this.post_auth("customer/login",{username:t,password:e,instance:this.instance_id})},i.customerRegister=function(t){return this.post_auth("customer/register",t)},i.resetCustomerPassword=function(t){return this.post_auth("customer/reset-password",t)},i.getCustomerMe=function(){return this.get("customer/me")},i.getCustomer=function(){return this.get("customer")},i.updateCustomer=function(t){return this.post("customer",t)},i.addProductToCart=function(t){return this.put("customer/cart",t)},i.toggleProductFavorite=function(t){return this.post("customer/favorite-product",t)},i.getCustomerCart=function(t){var n="customer/cart";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.updateCartItem=function(t){return this.post("customer/cart",t)},i.deleteCartItem=function(t){return this.delete("customer/cart/"+t)},i.getNotifications=function(t){var n="customer/notifications";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getCustomerNotification=function(t){return this.get("customer/notifications/"+t)},i.getFavorites=function(t){var n="customer/favorite-products";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getProductsHistory=function(t){var n="customer/products-history";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getAddresses=function(){return this.get("customer/addresses")},i.createAddress=function(t){return this.put("customer/address",t)},i.updateAddress=function(t){return this.post("customer/address",t)},i.deleteAddress=function(t){return this.delete("customer/address/"+t)},i.setCartDelivery=function(t,e,n){return this.post("customer/cart/delivery",{address:t,delivery_method:e,payment_method:n})},i.setAvatar=function(t){return this.post("customer/avatar",{avatar_id:t})},i.getInvoicesHistory=function(t){var n="customer/cart/history";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getInvoice=function(t){return this.get("customer/invoice/"+t)},i.getCustomerCredit=function(){return this.get("customer/credit")},i.getCartPay=function(){return this.get("customer/cart/pay")},i.depositCustomerMoney=function(t){return this.put("customer/deposit",t)},i.getCartDeliveryMethods=function(){return this.get("customer/delivery-methods")},i.getLatestUnseenNotification=function(){return this.get("customer/notifications/last-unseen")},n}(s),h=function(t){function e(){return t.apply(this,arguments)||this}r(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}r(n,t);var i=n.prototype;return i.getProduct=function(t){return this.get("product/"+t)},i.getProductFeatures=function(t){return this.get("product/"+t+"/features")},i.getSimilarProducts=function(t){return this.get("product/"+t+"/similar-products")},i.getProductChoices=function(t){return this.get("product/"+t+"/choices")},i.getProductReviews=function(t,n){var i="product/"+t+"/reviews";return n&&(i+=e.stringify(n,"?")),this.get(i)},i.getRatingOptions=function(t){return this.get("product/"+t+"/rating-options")},i.sendNewReview=function(t,e){return this.put("product/"+t+"/review",e)},i.reportReview=function(t,e){return this.post("product/"+t+"/review/"+e+"/report")},i.getProductRemaining=function(t,n){var i="product/"+t+"/remaining";return n&&(i+=e.stringify(n,"?")),this.get(i)},i.getPricableFilters=function(t){return this.user_get("product/"+t+"/price-filter")},n}(s),p=function(t){function n(){return t.apply(this,arguments)||this}r(n,t);var i=n.prototype;return i.getCountries=function(t){var n="countries";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getIranProvinces=function(t){var n="countries/103/states";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getStateCities=function(t,n){var i="countries/103/states/"+t+"/cities";return n&&(i+=e.stringify(n,"?")),this.get(i)},n}(s);n();var f,_=function(t){function e(){return t.apply(this,arguments)||this}return r(e,t),e}(s);f=_,[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 _;
//# 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 i(){return(i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function r(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 r=this.basePath+e,s=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.delete(r,s))}catch(t){return Promise.reject(t)}},n.user_delete=function(e,n){try{var r=this.basePath+e,s=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.delete(r,s))}catch(t){return Promise.reject(t)}},n.get=function(e,n){try{var r=this.basePath+e,s=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.get(r,s))}catch(t){return Promise.reject(t)}},n.user_get=function(e,n){try{var r=this.basePath+e,s=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.get(r,s))}catch(t){return Promise.reject(t)}},n.post=function(e,n,r){void 0===n&&(n={});try{var s=this.basePath+e,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.user_post=function(e,n,r){void 0===n&&(n={});try{var s=this.basePath+e,o=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.post_media=function(e,n,r){void 0===n&&(n={});try{var s=this.mediaPath+e,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.put=function(e,n,r){void 0===n&&(n={});try{var s=this.basePath+e,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(t.put(s,n,o))}catch(t){return Promise.reject(t)}},n.user_put=function(e,n,r){void 0===n&&(n={});try{var s=this.basePath+e,o=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(t.put(s,n,o))}catch(t){return Promise.reject(t)}},n.post_auth=function(e,n,r){void 0===n&&(n={});try{var s=this.authPath+e,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);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}r(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}r(n,t);var i=n.prototype;return i.getProducts=function(t){var n="instance/"+this.instance_id+"/products";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.createProduct=function(t){return this.user_put("instance/"+this.instance_id+"/product",t)},i.deleteProduct=function(t){return this.user_delete("instance/"+this.instance_id+"/product/"+t)},i.updateProduct=function(t){return this.user_post("instance/"+this.instance_id+"/product",t)},i.createProductPrice=function(t){return this.user_put("instance/"+this.instance_id+"/product/price",t)},i.updateProductPrice=function(t){return this.user_post("instance/"+this.instance_id+"/product/price",t)},i.updateProductPrices=function(t){return this.user_post("instance/"+this.instance_id+"/product/prices",t)},i.getProductPrices=function(t){return this.user_get("instance/"+this.instance_id+"/product/"+t+"/price-filter")},i.addProductMedia=function(t,e){return this.user_put("instance/"+this.instance_id+"/product/"+t+"/media",e)},i.deleteProductMedia=function(t,e){return this.user_delete("instance/"+this.instance_id+"/product/"+t+"/media/"+e)},i.setProductFeatures=function(t,e){return this.user_put("instance/"+this.instance_id+"/product/"+t+"/features",e)},i.setProductPriceFilter=function(t,e){return this.user_post("instance/"+this.instance_id+"/product/"+t+"/price-filter",e)},i.deleteOptionPrice=function(t,e){return this.user_delete("instance/"+this.instance_id+"/product/"+t+"/option/"+e+"/price")},i.getInstanceInvoices=function(t){var n="instance/"+this.instance_id+"/invoices";return t&&(n+=e.stringify(t,"?")),this.user_get(n)},i.getInstanceInvoice=function(t){return this.user_get("instance/"+this.instance_id+"/invoice/"+t)},i.deleteInstanceInvoice=function(t){return this.delete("instance/"+this.instance_id+"/invoice/"+t)},i.setDeliveryStatus=function(t,e){return this.user_post("instance/"+this.instance_id+"/invoice/"+t+"/delivery-status",e)},i.getInstanceCustomers=function(t){var n="instance/"+this.instance_id+"/customers";return t&&(n+=e.stringify(t,"?")),this.user_get(n)},i.getInstanceCustomer=function(t){return this.user_get("instance/"+this.instance_id+"/customer/"+t)},i.deleteInstanceCustomer=function(t){return this.user_delete("instance/"+this.instance_id+"/customer/"+t)},i.createInstanceCustomer=function(t){return this.user_put("instance/"+this.instance_id+"/customer",t)},i.updateInstanceCustomer=function(t,e){return this.user_post("instance/"+this.instance_id+"/customer/"+t,e)},i.acceptInstanceCustomer=function(t){return this.user_post("instance/"+this.instance_id+"/customer/"+t+"/accept")},i.getCategories=function(t){var n="instance/"+this.instance_id+"/categories";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.createCategory=function(t){return this.user_put("instance/"+this.instance_id+"/category",t)},i.updateCategory=function(t){return this.user_post("instance/"+this.instance_id+"/category",t)},i.deleteCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/category/"+t)},i.createCategoryFilterGroup=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter-group",e)},i.createCategoryFilter=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter",e)},i.getCategoryFeatures=function(t){return this.user_get("instance/"+this.instance_id+"/category/"+t+"/features")},i.deleteCategoryFilter=function(t,e){return this.user_delete("instance/"+this.instance_id+"/category/"+t+"/filter/"+e)},i.deleteFilterOption=function(t,e,n){return this.user_delete("instance/"+this.instance_id+"/category/"+t+"/filter/"+e+"/option/"+n)},i.setCategoryStatus=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/status",e)},i.createBrand=function(t){return this.user_put("instance/"+this.instance_id+"/brand",t)},i.updateBrand=function(t){return this.user_post("instance/"+this.instance_id+"/brand",t)},i.deleteBrand=function(t){return this.user_delete("instance/"+this.instance_id+"/brand/"+t)},i.getBrands=function(){return this.get("instance/"+this.instance_id+"/brands")},i.createBannerCategory=function(t){return this.user_put("instance/"+this.instance_id+"/banner-category",t)},i.getBannerCategories=function(){return this.user_get("instance/"+this.instance_id+"/banner-categories")},i.deleteBannerCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/banner-category/"+t)},i.getBanners=function(t){var n="instance/"+this.instance_id+"/banners";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.createBanner=function(t){return this.user_put("instance/"+this.instance_id+"/banner",t)},i.deleteBanner=function(t){return this.user_delete("instance/"+this.instance_id+"/banner/"+t)},i.updateBanner=function(t){return this.user_post("instance/"+this.instance_id+"/banner/update",t)},i.getInstanceDeliveryMethods=function(){return this.user_get("instance/"+this.instance_id+"/delivery-methods")},i.createInstanceDeliveryMethod=function(t){return this.user_put("instance/"+this.instance_id+"/delivery-method",t)},i.setDeliveryMethodStatus=function(t,e){return this.user_post("instance/"+this.instance_id+"/delivery-method/"+t,e)},i.createNotification=function(t){return this.user_put("instance/"+this.instance_id+"/notification",t)},i.getInstanceNotifications=function(t){var n="instance/"+this.instance_id+"/notifications";return t&&(n+=e.stringify(t,"?")),this.user_get(n)},i.getSearchFilters=function(t){var n="instance/"+this.instance_id+"/search-filters";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.sendInviteSms=function(t){return this.post("instance/"+this.instance_id+"/invite-sms",t)},i.getTopKeywords=function(t){var n="instance/"+this.instance_id+"/top-search-keywords";return t&&(n+=e.stringify(t,"?")),this.post(n,t)},i.updateRemainingWithChoices=function(t){return this.user_post("instance/"+this.instance_id+"/auto-remaining",t)},i.updateRemainingsWithChoices=function(t){return this.user_post("instance/"+this.instance_id+"/batch-auto-remaining",t)},n}(s),c=function(t){function e(){return t.apply(this,arguments)||this}r(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}r(n,t);var i=n.prototype;return i.getPassword=function(t){return this.post_auth("customer/send-mobile-verification",{mobile:t,instance:this.instance_id})},i.customerVerify=function(t,e){return this.post_auth("customer/verify-mobile",{mobile:t,verification_code:e,instance:this.instance_id})},i.getVerification=function(t){return this.post_auth("customer/send-email-verification",{email:t,instance:this.instance_id})},i.emailVerify=function(t,e){return this.post_auth("customer/verify-email",{email:t,verification_code:e,instance:this.instance_id})},i.customerLogin=function(t,e){return this.post_auth("customer/login",{username:t,password:e,instance:this.instance_id})},i.customerRegister=function(t){return this.post_auth("customer/register",t)},i.resetCustomerPassword=function(t){return this.post_auth("customer/reset-password",t)},i.getCustomerMe=function(){return this.get("customer/me")},i.getCustomer=function(){return this.get("customer")},i.updateCustomer=function(t){return this.post("customer",t)},i.addProductToCart=function(t){return this.put("customer/cart",t)},i.toggleProductFavorite=function(t){return this.post("customer/favorite-product",t)},i.getCustomerCart=function(t){var n="customer/cart";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.updateCartItem=function(t){return this.post("customer/cart",t)},i.deleteCartItem=function(t){return this.delete("customer/cart/"+t)},i.getNotifications=function(t){var n="customer/notifications";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getCustomerNotification=function(t){return this.get("customer/notifications/"+t)},i.getFavorites=function(t){var n="customer/favorite-products";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getProductsHistory=function(t){var n="customer/products-history";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getAddresses=function(){return this.get("customer/addresses")},i.createAddress=function(t){return this.put("customer/address",t)},i.updateAddress=function(t){return this.post("customer/address",t)},i.deleteAddress=function(t){return this.delete("customer/address/"+t)},i.setCartDelivery=function(t,e,n){return this.post("customer/cart/delivery",{address:t,delivery_method:e,payment_method:n})},i.setAvatar=function(t){return this.post("customer/avatar",{avatar_id:t})},i.getInvoicesHistory=function(t){var n="customer/cart/history";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getInvoice=function(t){return this.get("customer/invoice/"+t)},i.getCustomerCredit=function(){return this.get("customer/credit")},i.getCartPay=function(){return this.get("customer/cart/pay")},i.depositCustomerMoney=function(t){return this.put("customer/deposit",t)},i.getCartDeliveryMethods=function(){return this.get("customer/delivery-methods")},i.getLatestUnseenNotification=function(){return this.get("customer/notifications/last-unseen")},n}(s),h=function(t){function e(){return t.apply(this,arguments)||this}r(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}r(n,t);var i=n.prototype;return i.getProduct=function(t){return this.get("product/"+t)},i.getProductFeatures=function(t){return this.get("product/"+t+"/features")},i.getSimilarProducts=function(t){return this.get("product/"+t+"/similar-products")},i.getProductChoices=function(t){return this.get("product/"+t+"/choices")},i.getProductReviews=function(t,n){var i="product/"+t+"/reviews";return n&&(i+=e.stringify(n,"?")),this.get(i)},i.getRatingOptions=function(t){return this.get("product/"+t+"/rating-options")},i.sendNewReview=function(t,e){return this.put("product/"+t+"/review",e)},i.reportReview=function(t,e){return this.post("product/"+t+"/review/"+e+"/report")},i.getProductRemaining=function(t,n){var i="product/"+t+"/remaining";return n&&(i+=e.stringify(n,"?")),this.get(i)},i.getPricableFilters=function(t){return this.user_get("product/"+t+"/price-filter")},n}(s),p=function(t){function n(){return t.apply(this,arguments)||this}r(n,t);var i=n.prototype;return i.getCountries=function(t){var n="countries";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getIranProvinces=function(t){var n="countries/103/states";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getStateCities=function(t,n){var i="countries/103/states/"+t+"/cities";return n&&(i+=e.stringify(n,"?")),this.get(i)},n}(s);n.config();var f,g=function(t){function e(){return t.apply(this,arguments)||this}return r(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 i(){return(i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,(Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,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 r=this.basePath+e,s=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.delete(r,s))}catch(t){return Promise.reject(t)}},n.user_delete=function(e,n){try{var r=this.basePath+e,s=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.delete(r,s))}catch(t){return Promise.reject(t)}},n.get=function(e,n){try{var r=this.basePath+e,s=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.get(r,s))}catch(t){return Promise.reject(t)}},n.user_get=function(e,n){try{var r=this.basePath+e,s=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.get(r,s))}catch(t){return Promise.reject(t)}},n.post=function(e,n,r){void 0===n&&(n={});try{var s=this.basePath+e,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.user_post=function(e,n,r){void 0===n&&(n={});try{var s=this.basePath+e,o=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.post_media=function(e,n,r){void 0===n&&(n={});try{var s=this.mediaPath+e,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(t.post(s,n,o))}catch(t){return Promise.reject(t)}},n.put=function(e,n,r){void 0===n&&(n={});try{var s=this.basePath+e,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(t.put(s,n,o))}catch(t){return Promise.reject(t)}},n.user_put=function(e,n,r){void 0===n&&(n={});try{var s=this.basePath+e,o=i({headers:i({},{Authorization:"Bearer "+this.USER_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(t.put(s,n,o))}catch(t){return Promise.reject(t)}},n.post_auth=function(e,n,r){void 0===n&&(n={});try{var s=this.authPath+e,o=i({headers:i({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);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}r(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}r(n,t);var i=n.prototype;return i.getProducts=function(t){var n="instance/"+this.instance_id+"/products";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.createProduct=function(t){return this.user_put("instance/"+this.instance_id+"/product",t)},i.deleteProduct=function(t){return this.user_delete("instance/"+this.instance_id+"/product/"+t)},i.updateProduct=function(t){return this.user_post("instance/"+this.instance_id+"/product",t)},i.createProductPrice=function(t){return this.user_put("instance/"+this.instance_id+"/product/price",t)},i.updateProductPrice=function(t){return this.user_post("instance/"+this.instance_id+"/product/price",t)},i.updateProductPrices=function(t){return this.user_post("instance/"+this.instance_id+"/product/prices",t)},i.getProductPrices=function(t){return this.user_get("instance/"+this.instance_id+"/product/"+t+"/price-filter")},i.addProductMedia=function(t,e){return this.user_put("instance/"+this.instance_id+"/product/"+t+"/media",e)},i.deleteProductMedia=function(t,e){return this.user_delete("instance/"+this.instance_id+"/product/"+t+"/media/"+e)},i.setProductFeatures=function(t,e){return this.user_put("instance/"+this.instance_id+"/product/"+t+"/features",e)},i.setProductPriceFilter=function(t,e){return this.user_post("instance/"+this.instance_id+"/product/"+t+"/price-filter",e)},i.deleteOptionPrice=function(t,e){return this.user_delete("instance/"+this.instance_id+"/product/"+t+"/option/"+e+"/price")},i.getInstanceInvoices=function(t){var n="instance/"+this.instance_id+"/invoices";return t&&(n+=e.stringify(t,"?")),this.user_get(n)},i.getInstanceInvoice=function(t){return this.user_get("instance/"+this.instance_id+"/invoice/"+t)},i.deleteInstanceInvoice=function(t){return this.delete("instance/"+this.instance_id+"/invoice/"+t)},i.setDeliveryStatus=function(t,e){return this.user_post("instance/"+this.instance_id+"/invoice/"+t+"/delivery-status",e)},i.getInstanceCustomers=function(t){var n="instance/"+this.instance_id+"/customers";return t&&(n+=e.stringify(t,"?")),this.user_get(n)},i.getInstanceCustomer=function(t){return this.user_get("instance/"+this.instance_id+"/customer/"+t)},i.deleteInstanceCustomer=function(t){return this.user_delete("instance/"+this.instance_id+"/customer/"+t)},i.createInstanceCustomer=function(t){return this.user_put("instance/"+this.instance_id+"/customer",t)},i.updateInstanceCustomer=function(t,e){return this.user_post("instance/"+this.instance_id+"/customer/"+t,e)},i.acceptInstanceCustomer=function(t){return this.user_post("instance/"+this.instance_id+"/customer/"+t+"/accept")},i.getCategories=function(t){var n="instance/"+this.instance_id+"/categories";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.createCategory=function(t){return this.user_put("instance/"+this.instance_id+"/category",t)},i.updateCategory=function(t){return this.user_post("instance/"+this.instance_id+"/category",t)},i.deleteCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/category/"+t)},i.createCategoryFilterGroup=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter-group",e)},i.createCategoryFilter=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/filter",e)},i.getCategoryFeatures=function(t){return this.user_get("instance/"+this.instance_id+"/category/"+t+"/features")},i.deleteCategoryFilter=function(t,e){return this.user_delete("instance/"+this.instance_id+"/category/"+t+"/filter/"+e)},i.deleteFilterOption=function(t,e,n){return this.user_delete("instance/"+this.instance_id+"/category/"+t+"/filter/"+e+"/option/"+n)},i.setCategoryStatus=function(t,e){return this.user_put("instance/"+this.instance_id+"/category/"+t+"/status",e)},i.createBrand=function(t){return this.user_put("instance/"+this.instance_id+"/brand",t)},i.updateBrand=function(t){return this.user_post("instance/"+this.instance_id+"/brand",t)},i.deleteBrand=function(t){return this.user_delete("instance/"+this.instance_id+"/brand/"+t)},i.getBrands=function(){return this.get("instance/"+this.instance_id+"/brands")},i.createBannerCategory=function(t){return this.user_put("instance/"+this.instance_id+"/banner-category",t)},i.getBannerCategories=function(){return this.user_get("instance/"+this.instance_id+"/banner-categories")},i.deleteBannerCategory=function(t){return this.user_delete("instance/"+this.instance_id+"/banner-category/"+t)},i.getBanners=function(t){var n="instance/"+this.instance_id+"/banners";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.createBanner=function(t){return this.user_put("instance/"+this.instance_id+"/banner",t)},i.deleteBanner=function(t){return this.user_delete("instance/"+this.instance_id+"/banner/"+t)},i.updateBanner=function(t){return this.user_post("instance/"+this.instance_id+"/banner/update",t)},i.getInstanceDeliveryMethods=function(){return this.user_get("instance/"+this.instance_id+"/delivery-methods")},i.createInstanceDeliveryMethod=function(t){return this.user_put("instance/"+this.instance_id+"/delivery-method",t)},i.setDeliveryMethodStatus=function(t,e){return this.user_post("instance/"+this.instance_id+"/delivery-method/"+t,e)},i.createNotification=function(t){return this.user_put("instance/"+this.instance_id+"/notification",t)},i.getInstanceNotifications=function(t){var n="instance/"+this.instance_id+"/notifications";return t&&(n+=e.stringify(t,"?")),this.user_get(n)},i.getSearchFilters=function(t){var n="instance/"+this.instance_id+"/search-filters";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.sendInviteSms=function(t){return this.post("instance/"+this.instance_id+"/invite-sms",t)},i.getTopKeywords=function(t){var n="instance/"+this.instance_id+"/top-search-keywords";return t&&(n+=e.stringify(t,"?")),this.post(n,t)},i.updateRemainingWithChoices=function(t){return this.user_post("instance/"+this.instance_id+"/auto-remaining",t)},i.updateRemainingsWithChoices=function(t){return this.user_post("instance/"+this.instance_id+"/batch-auto-remaining",t)},n}(s),c=function(t){function e(){return t.apply(this,arguments)||this}r(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}r(n,t);var i=n.prototype;return i.getPassword=function(t){return this.post_auth("customer/send-mobile-verification",{mobile:t,instance:this.instance_id})},i.customerVerify=function(t,e){return this.post_auth("customer/verify-mobile",{mobile:t,verification_code:e,instance:this.instance_id})},i.getVerification=function(t){return this.post_auth("customer/send-email-verification",{email:t,instance:this.instance_id})},i.emailVerify=function(t,e){return this.post_auth("customer/verify-email",{email:t,verification_code:e,instance:this.instance_id})},i.customerLogin=function(t,e){return this.post_auth("customer/login",{username:t,password:e,instance:this.instance_id})},i.customerRegister=function(t){return this.post_auth("customer/register",t)},i.resetCustomerPassword=function(t){return this.post_auth("customer/reset-password",t)},i.getCustomerMe=function(){return this.get("customer/me")},i.getCustomer=function(){return this.get("customer")},i.updateCustomer=function(t){return this.post("customer",t)},i.addProductToCart=function(t){return this.put("customer/cart",t)},i.toggleProductFavorite=function(t){return this.post("customer/favorite-product",t)},i.getCustomerCart=function(t){var n="customer/cart";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.updateCartItem=function(t){return this.post("customer/cart",t)},i.deleteCartItem=function(t){return this.delete("customer/cart/"+t)},i.getNotifications=function(t){var n="customer/notifications";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getCustomerNotification=function(t){return this.get("customer/notifications/"+t)},i.getFavorites=function(t){var n="customer/favorite-products";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getProductsHistory=function(t){var n="customer/products-history";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getAddresses=function(){return this.get("customer/addresses")},i.createAddress=function(t){return this.put("customer/address",t)},i.updateAddress=function(t){return this.post("customer/address",t)},i.deleteAddress=function(t){return this.delete("customer/address/"+t)},i.setCartDelivery=function(t,e,n){return this.post("customer/cart/delivery",{address:t,delivery_method:e,payment_method:n})},i.setAvatar=function(t){return this.post("customer/avatar",{avatar_id:t})},i.getInvoicesHistory=function(t){var n="customer/cart/history";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getInvoice=function(t){return this.get("customer/invoice/"+t)},i.getCustomerCredit=function(){return this.get("customer/credit")},i.getCartPay=function(){return this.get("customer/cart/pay")},i.depositCustomerMoney=function(t){return this.put("customer/deposit",t)},i.getCartDeliveryMethods=function(){return this.get("customer/delivery-methods")},i.getLatestUnseenNotification=function(){return this.get("customer/notifications/last-unseen")},n}(s),h=function(t){function e(){return t.apply(this,arguments)||this}r(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}r(n,t);var i=n.prototype;return i.getProduct=function(t){return this.get("product/"+t)},i.getProductFeatures=function(t){return this.get("product/"+t+"/features")},i.getSimilarProducts=function(t){return this.get("product/"+t+"/similar-products")},i.getProductChoices=function(t){return this.get("product/"+t+"/choices")},i.getProductReviews=function(t,n){var i="product/"+t+"/reviews";return n&&(i+=e.stringify(n,"?")),this.get(i)},i.getRatingOptions=function(t){return this.get("product/"+t+"/rating-options")},i.sendNewReview=function(t,e){return this.put("product/"+t+"/review",e)},i.reportReview=function(t,e){return this.post("product/"+t+"/review/"+e+"/report")},i.getProductRemaining=function(t,n){var i="product/"+t+"/remaining";return n&&(i+=e.stringify(n,"?")),this.get(i)},i.getPricableFilters=function(t){return this.user_get("product/"+t+"/price-filter")},n}(s),p=function(t){function n(){return t.apply(this,arguments)||this}r(n,t);var i=n.prototype;return i.getCountries=function(t){var n="countries";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getIranProvinces=function(t){var n="countries/103/states";return t&&(n+=e.stringify(t,"?")),this.get(n)},i.getStateCities=function(t,n){var i="countries/103/states/"+t+"/cities";return n&&(i+=e.stringify(n,"?")),this.get(i)},n}(s);n.config();var f,g=function(t){function e(){return t.apply(this,arguments)||this}return r(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.1.83",
"version": "0.1.85",
"description": "tayeh shop-api client",

@@ -10,3 +10,2 @@ "main": "dist/index.js",

],
"types": "src/types.ts",
"module": "dist/index.module.js",

@@ -18,3 +17,3 @@ "unpkg": "dist/index.umd.js",

"dev": "microbundle watch",
"package": "npm run test && npm run build && cp ./package.json ./dist/package.json && cd ./dist/ && npm publish --publich"
"package": "npm run test && npm run build && npm publish --public"
},

@@ -55,3 +54,17 @@ "repository": {

"urix": "^0.1.0"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}

@@ -1,7 +0,8 @@

# Tayeh Web Client (version: 1.0.0-alpha.0):
@tayeh/web-client implementation in JS and TS
# Tayeh Client:
@tayeh.js implementation in JS and TS
- Easy to Use
- Compatible
- Comprehensive
- Comprehensive
## ![introduction](https://img.icons8.com/nolan/40/training.png) Introduction:

@@ -27,21 +28,25 @@ Hello. I hope you are well =))

Install the package from `npm` or `yarn`
We named it "@tayeh/web-client":
We named it "tayeh.js":
```
npm install @tayeh/web-client
npm install tayeh.js
# or
yarn add @tayeh/web-client
yarn add tayeh.js
```
and require it in your project:
```
const TayehClient = require('tayeh-client');
const TayehClient = require('tayeh.js');
// or
import TayehClient from 'tayeh-client';
import TayehClient from 'tayeh.js';
```
Then create an instance: (The values you received from the site apply here)
```
const tayeh = new TayehClient({API_KEY: 'API_KEY', API_SECRET: 'API_SECRET'});
const tayeh = new TayehClient({
name: "project name (can be everything)",
api_access: "your instance access key",
instance_id: "access key"
});
```
After creating an instance in the project and sending the input arguments, a custom `API _ACCESS` will be generated for you to use in the library's internal requests.
## ![speaker](https://img.icons8.com/nolan/40/speaker.png) Requests:
Library API requests are currently categorized into `User`, `Instance`, and `Media` classes.
Library API requests are currently categorized into `User`, `Instance`, `Customer`, `Product`, `Crm` and `Media` classes.
In this document, we try to provide you with a complete guide for using the functions of these libraries. Be sure to read this guide first.

@@ -52,3 +57,3 @@ Then it is enough to call the equivalent method from the created instance to achieve the desired result.

//Get an instance with an ID
tayeh.getInstance(2).then((data) => {
tayeh.getProducts().then((data) => {
//you have data. use it

@@ -60,48 +65,56 @@ })

|---------------------------|-----------------------------|-----------------------------|-----------------------------|-----------------------------
| getInstance |(instance_id: number)||
| createInstance |(params: NewInstance)||
| updateInstance |(params: UpdateInstance)||
||||
| getInstancePage |(page_number: number, params?: { text?: string; creator_id?: number })||
||||
| getInstanceProducts |(instance_id: number, params?: { page?: number; per_page?: number; search?: string })||
| createInstanceProduct |(instance_id: number, params: NewProduct)||
| deleteInstanceProduct |(instance_id: number, product_id: number)||
| updateInstanceProduct |(instance_id: number, params: UpdateProduct)||
||||
| getInstanceTransactions |(instance_id: number)||
| findInstanceTransactions |(instance_id: number, params?: { page?: number; per_page?: number; search?: string })||
| getProductTransactions |(instance_id: number, product_id: number)||
| deleteInstanceTransaction |(instance_id: number, transaction_id: number)||
| createInstanceTransaction |(instance_id: number, params: NewTransaction)||
| updateInstanceTransaction |(instance_id: number, params: UpdateTransaction)||
||||
| getInstanceInvoices |(instance_id: number, params?: { page?: number; per_page?: number; search?: string })||
| getInstanceInvoice |(instance_id: number, invoice_id: number)||
| deleteInstanceInvoice |(instance_id: number, invoice_id: number)||
| createInstanceInvoice |(instance_id: number, params: NewInvoice)||
| updateInstanceInvoice |(instance_id: number, params: UpdateInvoice)||
||||
| getInstanceSeries |(instance_id: number, params?: { page?: number; per_page?: number; type?: string; page_unit?: string; })||
||||
| getInstanceTotal |(instance_id: number, params?: { page?: number; per_page?: number; product_id?: number; })||
||||
| getInstanceRevenue |(instance_id: number, params?: { unit?: string; product_id?: number; start?: number; end?: number; })||
||||
| getInstanceCustomers |(instance_id: number, params?: { page?: number; per_page?: number; search?: string })||
| getInstanceCustomer |(instance_id: number, customer_id: number)||
| deleteInstanceCustomer |(instance_id: number, customer_id: number)||
| createInstanceCustomer |(instance_id: number, params: NewCustomer)||
| updateInstanceCustomer |(instance_id: number, params: UpdateCustomer)||
||||
| getInstanceUsers |(instance_id: number, params?: { page?: number; per_page?: number; search?: string })||
| getInstanceUser |(instance_id: number, user_id: number)||
| deleteInstanceUser |(instance_id: number, user_id: number)||
| createInstanceUser |(instance_id: number, params: NewUser)||
| updateInstanceUser |(instance_id: number, params: UpdateUser)||
||||
| getInstanceAddresses |(instance_id: number, params?: { page?: number; per_page?: number; search?: string })||
| deleteInstanceAddress |(instance_id: number, address_id: number)||
| createInstanceAddress |(instance_id: number, params: NewAddress)||
| updateInstanceAddress |(instance_id: number, params: UpdateAddress)||
|getProducts|(params?: ProductParams)||
|createProduct|(params: NewProduct)||
|deleteProduct|(product_id: string)||
|updateProduct|(params: UpdateProduct)||
|createProductPrice|(params: CreatePrice)||
|updateProductPrice|(params: UpdatePrice)||
|updateProductPrices|(params: UpdatePrices)||
|getProductPrices|(product_id: string)||
|addProductMedia|(product_id: string, params: ProductMedia)||
|deleteProductMedia|(product_id: string, media_id: string)||
|setProductFeatures|(product_id: string, body: SetFeatures)||
|setProductPriceFilter|(product_id: string, params: SetProPrices)||
|deleteOptionPrice|(product_id: string, option_id: string)||
|getInstanceInvoices|(params?: InvoicesParams)||
|getInstanceInvoice|(invoice_id: string)||
|deleteInstanceInvoice|(invoice_id: string)||
|setDeliveryStatus|(invoice_id: string, body: SetDeliveryStatus)||
|getInstanceCustomers|(params?: SearchParams)||
|getInstanceCustomer|(customer_id: string)||
|deleteInstanceCustomer|(customer_id: number)||
|createInstanceCustomer|(params: NewCustomer)||
|updateInstanceCustomer|(customer_id: string, params: UpdateCustomer)||
|acceptInstanceCustomer|(customer_id: string)||
|getCategories|(params?: CategoryParams)||
|createCategory|(params: NewCategory)||
|updateCategory|(params: EditCategory)||
|deleteCategory|(category_id: string)||
|createCategoryFilterGroup|(category_id: string, params: FilterGroup)||
|createCategoryFilter|(category_id: string, params: CategoryFilter)||
|getCategoryFeatures|(category_id: string)||
|deleteCategoryFilter|(category_id: string, filter_id: string)||
|deleteFilterOption|(category_id: string, filter_id: string, option_id: string)||
|setCategoryStatus|(category_id: string, body: CategoryStatus)||
|createBrand|(params: NewBrand)||
|updateBrand|(params: EditBrand)||
|deleteBrand|(brand_id: string)||
|getBrands|()||
|createBannerCategory|(body: NewBannerCat)||
|getBannerCategories|()||
|deleteBannerCategory|(category_id: string)||
|getBanners|(params?: BannerParams)||
|createBanner|(body: NewBanner)||
|deleteBanner|(banner_id: string)||
|updateBanner|(body: EditBanner)||
|getInstanceDeliveryMethods|()||
|createInstanceDeliveryMethod|(body: NewDeliveryMethod)||
|setDeliveryMethodStatus|(method_id: string, body: SetMethodStatus)||
|createNotification|(body: CreateNotif)||
|getInstanceNotifications|(params: Pagination)||
|getSearchFilters|(params?: SearchFilters)||
|sendInviteSms|(params: InviteParams)||
|getTopKeywords|(params: SearchFilters)||
|updateRemainingWithChoices|(body: AutoRemaining)||
|updateRemainingsWithChoices|(body: BatchRemaining)||
### User:

@@ -119,3 +132,48 @@ Method title|Input Arguments|Defaults & Limits|Descriptions|Sample output

| getMedia |(media_id: number)||
| uploadMedia |(params: NewMedia)||
| uploadMedia |(params: NewMedia)||
### Customer:
Method title|Input Arguments|Response (T) Wraped in Promise<AxiosResponse<`T`>>
|---------------------------|-----------------------------|-----------------------------
| getPassword|(mobile: string)| `AuthResponse`| true
| customerVerify|(mobile: string, code: string)| `AuthResponse`| true
| getVerification|(email: string)| `AuthResponse`| true
| emailVerify|(email: string, code: string)| `AuthResponse`| true
| customerLogin|(username: string, password: string)| `AuthResponse`| true
| customerRegister|(body: RegisterCustomer)| `AuthResponse`| true
| resetCustomerPassword|(body: CustomerResetPass)| `void`| true
| getCustomerMe|()| `GetCustomerProfileResposne`| true
| getCustomer|()| `GetCustomerProfileResposne`| true
| updateCustomer|(body: UpdateCustomer)| `SimpleErr`| true
| addProductToCart|(body: AddToCartBody)| `SimpleErr`| true
| toggleProductFavorite|(body: ToggleFavorite)| `SimpleErr`| true
| getCustomerCart|(params: Pagination)| `GetCustomerCartResponse`| true
| updateCartItem|(body: UpdateCartItem)| `any`| true
| deleteCartItem|(cart_item_id: string)| `SimpleErr`| true
| getNotifications|(params?: Pagination)| `{objects: GetCustomerNotificationResponse[];count: number;`}| true
| getCustomerNotification|(notification_id: string)| `GetCustomerNotificationResponse`| true
| getFavorites|(params: Pagination)| `any`| true
| getProductsHistory|(params: Pagination)| `[GetCustomerFavoriteProductResponse]`| true
| getAddresses|()| `GetCustomerAddressResponse[]`| true
| createAddress|(body: NewAddress)| `SimpleErr`| true
| updateAddress|(body: UpdateAddress)| `void`| true
| deleteAddress|(address_id: string)| `SimpleErr`| true
| setCartDelivery|(body: NewAddress, d_method_id?: string, methods?: PaymentMethod)| `SimpleErr`| true
| setAvatar|(avatar_id: string)| `SimpleErr`| true
| getInvoicesHistory|(params?: InvoiceHistory)| `[GetCustomerInvoiceResponse]`| true
| getInvoice|(invoice_id: string)| `GetCustomerInvoiceResponse`| true
| getCustomerCredit|()| `GetCustomerCreditResponse`| true
| getCartPay|()| `PayCustomerCartResponse`| true
| depositCustomerMoney|(body: DepositMoney)| `CustomerDepositResponse`| true
| getCartDeliveryMethods|()| `GetCustomerDeliveryMethodsResponse`| true
| getLatestUnseenNotification|()| `GetCustomerNotificationResponse[]`| true
### Country:
Method title|Input Arguments|Defaults & Limits|Descriptions|Sample output
|---------------------------|-----------------------------|-----------------------------|-----------------------------|-----------------------------
|getCountries|(params: SearchParams)||
|getIranProvinces|(params: Qsearch)||
|getStateCities|(state_id: string, params: Qsearch)||
## ![contribution](https://img.icons8.com/cotton/40/crowdfunding.png) Contribution:

@@ -122,0 +180,0 @@ Contributions are welcome. Please submit an issue if you see something broken or in need of improving.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc