Socket
Socket
Sign inDemoInstall

tayeh.js

Package Overview
Dependencies
15
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1 to 0.0.2

2

dist/index.js

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

function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var n=t(require("axios")),e=t(require("querystringify")),r=require("dotenv");function s(){return(s=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t}).apply(this,arguments)}function i(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}var o=function(){function t(t){if(this.basePath=process.env.BASE_URL,this.authPath=process.env.AUTH_URL,this.mediaPath=process.env.MEDIA_URL,this.API_KEY=t.API_KEY,this.API_SECRET=t.API_SECRET,"string"!=typeof this.API_KEY||"string"!=typeof this.API_SECRET)throw new Error("You should define API_KEY & API_SECRET.")}var e=t.prototype;return e.get_token=function(){try{var t=this;return Promise.resolve(function(n,e){try{var r=Promise.resolve(t.get("api/token",{auth:{username:t.API_KEY,password:t.API_SECRET}},!0)).then(function(n){return t.API_ACCESS=n.access_token,!0})}catch(t){return e(t)}return r&&r.then?r.then(void 0,e):r}(0,function(t){throw new Error(t)}))}catch(t){return Promise.reject(t)}},e.delete=function(t,e){try{var r=this.basePath+t,i=s({headers:s({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},e);return Promise.resolve(n.delete(r,i)).then(function(t){return t.data})}catch(t){return Promise.reject(t)}},e.get=function(t,e,r){void 0===r&&(r=!1);try{var i=this.basePath+t;console.log(i);var o={"Content-type":"application/json"};r||(o.Authorization="Bearer "+this.API_ACCESS);var c=s({headers:s({},o)},e);return Promise.resolve(n.get(i,c)).then(function(t){return t.data})}catch(t){return Promise.reject(t)}},e.post=function(t,e,r){void 0===e&&(e={});try{var i=this.basePath+t,o=s({headers:s({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(n.post(i,e,o)).then(function(t){return t.data})}catch(t){return Promise.reject(t)}},t}(),c=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var e=n.prototype;return e.getMedia=function(t){return this.get("media/get/"+t)},e.uploadMedia=function(t){return this.post("media/upload",t)},n}(o),a=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var r=n.prototype;return r.getInstance=function(t){return this.get("instance/"+t)},r.createInstance=function(t){return this.post("instance/instance",t)},r.updateInstance=function(t){return this.post("instance/instance/update",t)},r.getInstancePage=function(t,n){var r="instance/page/"+t;return n&&(r+=e.stringify(n,"?")),this.get(r)},r.getInstanceProducts=function(t,n){var r="instance/"+t+"/products";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.createInstanceProduct=function(t,n){return this.post("instance/"+t+"/product",n)},r.deleteInstanceProduct=function(t,n){return this.delete("instance/"+t+"/product/"+n)},r.updateInstanceProduct=function(t,n){return this.post("instance/"+t+"/product/update",n)},r.getInstanceTransactions=function(t){return this.get("instance/"+t+"/transactions")},r.findInstanceTransactions=function(t,n){var r="instance/"+t+"/transactions/open";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.getProductTransactions=function(t,n){return this.get("instance/"+t+"/transactions/product/"+n)},r.deleteInstanceTransaction=function(t,n){return this.delete("instance/"+t+"/transaction/"+n)},r.createInstanceTransaction=function(t,n){return this.post("instance/"+t+"/transaction",n)},r.updateInstanceTransaction=function(t,n){return this.post("instance/"+t+"/transaction/update",n)},r.getInstanceInvoices=function(t,n){var r="instance/"+t+"/invoices";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.getInstanceInvoice=function(t,n){return this.get("instance/"+t+"/invoice/"+n)},r.deleteInstanceInvoice=function(t,n){return this.delete("instance/"+t+"/invoice/"+n)},r.createInstanceInvoice=function(t,n){return this.post("instance/"+t+"/invoice",n)},r.updateInstanceInvoice=function(t,n){return this.post("instance/"+t+"/invoice/update",n)},r.getInstanceSeries=function(t,n){var r="instance/"+t+"/series";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.getInstanceTotal=function(t,n){var r="instance/"+t+"/total/monthly";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.getInstanceRevenue=function(t,n){var r="instance/"+t+"/revenue";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.getInstanceCustomers=function(t,n){var r="instance/"+t+"/customers";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.getInstanceCustomer=function(t,n){return this.get("instance/"+t+"/customer/"+n)},r.deleteInstanceCustomer=function(t,n){return this.delete("instance/"+t+"/customer/"+n)},r.createInstanceCustomer=function(t,n){return this.post("instance/"+t+"/customer",n)},r.updateInstanceCustomer=function(t,n){return this.post("instance/"+t+"/customer/update",n)},r.getInstanceUsers=function(t,n){var r="instance/"+t+"/users";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.getInstanceUser=function(t,n){return this.get("instance/"+t+"/user/"+n)},r.deleteInstanceUser=function(t,n){return this.delete("instance/"+t+"/user/"+n)},r.createInstanceUser=function(t,n){return this.post("instance/"+t+"/user",n)},r.updateInstanceUser=function(t,n){return this.post("instance/"+t+"/user/update",n)},r.getInstanceAddresses=function(t,n){var r="instance/"+t+"/addresses";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.deleteInstanceAddress=function(t,n){return this.delete("instance/"+t+"/address/"+n)},r.createInstanceAddress=function(t,n){return this.post("instance/"+t+"/address",n)},r.updateInstanceAddress=function(t,n){return this.post("instance/"+t+"/address/update",n)},n}(o),u=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var r=n.prototype;return r.getUserMe=function(){return this.get("user/me")},r.getInstancePrimary=function(){return this.get("user/instance/primary")},r.setInstancePrimary=function(t){var n="user/instance/primary";return n+=e.stringify(t,"?"),this.post(n)},r.getUserInstances=function(t){return t&&e.stringify(t,"?"),this.get("user/instances")},n}(o),p=function(t){function n(){return t.apply(this,arguments)||this}return i(n,t),n.prototype.getCustomerMe=function(t){return this.get("customer/"+t+"/me")},n}(o),h=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var e=n.prototype;return e.sendSms=function(t,n){return this.post("crm/"+t+"/send/normal",n)},e.sendTypedSms=function(t,n,e){return this.post("crm/"+t+"/send/typed/"+n,e)},n}(o);r.config();var f,d=function(t){function n(){return t.apply(this,arguments)||this}return i(n,t),n}(o);f=d,[a,u,c,p,h].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(n){Object.defineProperty(f.prototype,n,Object.getOwnPropertyDescriptor(t.prototype,n))})}),module.exports=d;
function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var e=t(require("axios")),n=t(require("app-root-path")),r=t(require("querystringify")),i=require("dotenv");function s(){return(s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function o(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var u=function(){function t(){}var e,r=t.prototype;return r.read=function(){try{return Promise.resolve(this.load()).then(function(t){if(!t)throw new Error("No connection options were found in any ty configuration files.");return t})}catch(t){return Promise.reject(t)}},r.plainRead=function(){return require(this.configPath)},r.load=function(){try{return Promise.resolve(require(this.configPath))}catch(t){return Promise.reject(t)}},(e=[{key:"configPath",get:function(){return this.baseDirectory+"/"+this.baseConfigName+".json"}},{key:"baseDirectory",get:function(){return n.path}},{key:"baseConfigName",get:function(){return"tyconfig"}}])&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(t.prototype,e),t}(),c=function(){function t(){var t=(new u).plainRead();if(this.API_KEY=t.api_key,this.API_SECRET=t.api_secret,this.basePath=t.api_url,this.authPath=t.auth_url,this.mediaPath=t.media_url,this.mediaPath=t.media_url,"string"!=typeof this.API_KEY||"string"!=typeof this.API_SECRET)throw new Error("You should define TAYEH_API_KEY & TAYEH_API_SECRET in your environment variables.")}var n=t.prototype;return n.get_token=function(){try{var t=this;return Promise.resolve(function(e,n){try{var r=Promise.resolve(t.get_auth("api/token",{auth:{username:t.API_KEY,password:t.API_SECRET}})).then(function(e){return t.API_ACCESS=e.data.access_token,!0})}catch(t){return n(t)}return r&&r.then?r.then(void 0,n):r}(0,function(t){throw new Error(t)}))}catch(t){return Promise.reject(t)}},n.set_token=function(t){this.API_ACCESS=t},n.delete=function(t,n){try{var r=this.basePath+t,i=s({headers:s({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(e.delete(r,i))}catch(t){return Promise.reject(t)}},n.get=function(t,n){try{var r=this.basePath+t,i=s({headers:s({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(e.get(r,i))}catch(t){return Promise.reject(t)}},n.get_auth=function(t,n){try{var r=this.authPath+t,i=s({headers:s({},{"Content-type":"application/json"})},n);return Promise.resolve(e.get(r,i))}catch(t){return Promise.reject(t)}},n.post=function(t,n,r){void 0===n&&(n={});try{var i=this.basePath+t,o=s({headers:s({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(e.post(i,n,o))}catch(t){return Promise.reject(t)}},n.post_media=function(t,n,r){void 0===n&&(n={});try{var i=this.mediaPath+t,o=s({headers:s({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(e.post(i,n,o))}catch(t){return Promise.reject(t)}},n.put=function(t,n,r){void 0===n&&(n={});try{var i=this.basePath+t,o=s({headers:s({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(e.put(i,n,o))}catch(t){return Promise.reject(t)}},n.post_auth=function(t,n,r){void 0===n&&(n={});try{var i=this.authPath+t,o=s({headers:s({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},r);return Promise.resolve(e.post(i,n,o))}catch(t){return Promise.reject(t)}},t}(),a=function(t){function e(){return t.apply(this,arguments)||this}o(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}(c),h=function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var n=e.prototype;return n.getInstance=function(t){return this.get("instance/"+t)},n.createInstance=function(t){return this.post("instance/instance",t)},n.updateInstance=function(t){return this.post("instance/instance/update",t)},n.getInstancePage=function(t,e){var n="instance/page/"+t;return e&&(n+=r.stringify(e,"?")),this.get(n)},n.getProducts=function(t,e){var n="instance/"+t+"/products";return e&&(n+=r.stringify(e,"?")),this.get(n)},n.createInstanceProduct=function(t,e){return this.post("instance/"+t+"/product",e)},n.deleteInstanceProduct=function(t,e){return this.delete("instance/"+t+"/product/"+e)},n.updateInstanceProduct=function(t,e){return this.post("instance/"+t+"/product/update",e)},n.getInstanceTransactions=function(t){return this.get("instance/"+t+"/transactions")},n.findInstanceTransactions=function(t,e){var n="instance/"+t+"/transactions/open";return e&&(n+=r.stringify(e,"?")),this.get(n)},n.getProductTransactions=function(t,e){return this.get("instance/"+t+"/transactions/product/"+e)},n.deleteInstanceTransaction=function(t,e){return this.delete("instance/"+t+"/transaction/"+e)},n.createInstanceTransaction=function(t,e){return this.post("instance/"+t+"/transaction",e)},n.updateInstanceTransaction=function(t,e){return this.post("instance/"+t+"/transaction/update",e)},n.getInstanceInvoices=function(t,e){var n="instance/"+t+"/invoices";return e&&(n+=r.stringify(e,"?")),this.get(n)},n.getInstanceInvoice=function(t,e){return this.get("instance/"+t+"/invoice/"+e)},n.deleteInstanceInvoice=function(t,e){return this.delete("instance/"+t+"/invoice/"+e)},n.createInstanceInvoice=function(t,e){return this.post("instance/"+t+"/invoice",e)},n.updateInstanceInvoice=function(t,e){return this.post("instance/"+t+"/invoice/update",e)},n.getInstanceSeries=function(t,e){var n="instance/"+t+"/series";return e&&(n+=r.stringify(e,"?")),this.get(n)},n.getInstanceTotal=function(t,e){var n="instance/"+t+"/total/monthly";return e&&(n+=r.stringify(e,"?")),this.get(n)},n.getInstanceRevenue=function(t,e){var n="instance/"+t+"/revenue";return e&&(n+=r.stringify(e,"?")),this.get(n)},n.getInstanceCustomers=function(t,e){var n="instance/"+t+"/customers";return e&&(n+=r.stringify(e,"?")),this.get(n)},n.getInstanceCustomer=function(t,e){return this.get("instance/"+t+"/customer/"+e)},n.deleteInstanceCustomer=function(t,e){return this.delete("instance/"+t+"/customer/"+e)},n.createInstanceCustomer=function(t,e){return this.post("instance/"+t+"/customer",e)},n.updateInstanceCustomer=function(t,e){return this.post("instance/"+t+"/customer/update",e)},n.getInstanceUsers=function(t,e){var n="instance/"+t+"/users";return e&&(n+=r.stringify(e,"?")),this.get(n)},n.getInstanceUser=function(t,e){return this.get("instance/"+t+"/user/"+e)},n.deleteInstanceUser=function(t,e){return this.delete("instance/"+t+"/user/"+e)},n.createInstanceUser=function(t,e){return this.post("instance/"+t+"/user",e)},n.updateInstanceUser=function(t,e){return this.post("instance/"+t+"/user/update",e)},n.getInstanceAddresses=function(t,e){var n="instance/"+t+"/addresses";return e&&(n+=r.stringify(e,"?")),this.get(n)},n.deleteInstanceAddress=function(t,e){return this.delete("instance/"+t+"/address/"+e)},n.createInstanceAddress=function(t,e){return this.post("instance/"+t+"/address",e)},n.updateInstanceAddress=function(t,e){return this.post("instance/"+t+"/address/update",e)},n.getCategories=function(t,e){var n="instance/"+t+"/categories";return e&&(n+=r.stringify(e,"?")),this.get(n)},n.getBanners=function(t,e){var n="instance/"+t+"/banners";return e&&(n+=r.stringify(e,"?")),this.get(n)},n.getSearchFilters=function(t,e){var n="instance/"+t+"/search-filters";return e&&(n+=r.stringify(e,"?")),this.get(n)},n.sendInviteSms=function(t,e){return this.post("instance/"+t+"/invite-sms",e)},n.getTopKeywords=function(t,e){var n="instance/"+t+"/top-search-keywords";return e&&(n+=r.stringify(e,"?")),this.post(n,e)},e}(c),p=function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var n=e.prototype;return n.getUserMe=function(){return this.get("user/me")},n.getInstancePrimary=function(){return this.get("user/instance/primary")},n.setInstancePrimary=function(t){var e="user/instance/primary";return e+=r.stringify(t,"?"),this.post(e)},n.getUserInstances=function(t){return t&&r.stringify(t,"?"),this.get("user/instances")},e}(c),f=function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var n=e.prototype;return n.getPassword=function(t,e){return this.post_auth("customer/login",{username:t,instance:e})},n.customerVerify=function(t,e,n){return this.post_auth("customer/verify",{username:t,password:e,instance:n})},n.getCustomerMe=function(){return this.get("customer/me")},n.getCustomer=function(){return this.get("customer")},n.updateCustomer=function(t){return this.post("customer",t)},n.addProductToCart=function(t){return this.put("customer/cart",t)},n.toggleProductFavorite=function(t){return this.post("customer/favorite-product",t)},n.getCustomerCart=function(){return this.get("customer/cart")},n.updateCartItem=function(t){return this.post("customer/cart",t)},n.deleteCartItem=function(t){return this.delete("customer/cart/"+t)},n.getNotifications=function(t){var e="customer/notifications";return t&&(e+=r.stringify(t,"?")),this.get(e)},n.getFavorites=function(t){var e="customer/favorite-products";return t&&(e+=r.stringify(t,"?")),this.get(e)},n.getAddresses=function(){return this.get("customer/addresses")},n.createAddress=function(t){return this.put("customer/address",t)},n.updateAddress=function(t){return this.post("customer/address",t)},n.deleteAddress=function(t){return this.delete("customer/address/"+t)},e}(c),d=function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var n=e.prototype;return n.sendSms=function(t,e){return this.post("crm/"+t+"/send/normal",e)},n.sendTypedSms=function(t,e,n){return this.post("crm/"+t+"/send/typed/"+e,n)},e}(c),g=function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var n=e.prototype;return n.getProduct=function(t){return this.get("product/"+t)},n.getProductFeatures=function(t){return this.get("product/"+t+"/features")},n.getSimilarProducts=function(t){return this.get("product/"+t+"/similar-products")},n.getProductChoices=function(t){return this.get("product/"+t+"/choices")},n.getProductReviews=function(t,e){var n="product/"+t+"/reviews";return e&&(n+=r.stringify(e,"?")),this.get(n)},n.getRatingOptions=function(t){return this.get("product/"+t+"/rating-options")},n.sendNewReview=function(t,e){return this.put("product/"+t+"/review",e)},n.reportReview=function(t,e){return this.post("product/"+t+"/review/"+e+"/report")},e}(c),y=function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var n=e.prototype;return n.getCountries=function(t){var e="countries";return t&&(e+=r.stringify(t,"?")),this.get(e)},n.getIranProvinces=function(t){var e="countries/IR/states";return t&&(e+=r.stringify(t,"?")),this.get(e)},n.getStateCities=function(t,e){var n="countries/IR/states/"+t+"/cities";return e&&(n+=r.stringify(e,"?")),this.get(n)},e}(c);i.config();var v,m=function(t){function e(){return t.apply(this,arguments)||this}return o(e,t),e}(c);v=m,[h,p,a,f,d,g,y].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){Object.defineProperty(v.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})}),module.exports=m;
//# sourceMappingURL=index.js.map

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

import t from"axios";import e from"querystringify";import{config as s}from"dotenv";class n{constructor(t){if(this.basePath=process.env.BASE_URL,this.authPath=process.env.AUTH_URL,this.mediaPath=process.env.MEDIA_URL,this.API_KEY=t.API_KEY,this.API_SECRET=t.API_SECRET,"string"!=typeof this.API_KEY||"string"!=typeof this.API_SECRET)throw new Error("You should define API_KEY & API_SECRET.")}async get_token(){try{const{access_token:t}=await this.get("api/token",{auth:{username:this.API_KEY,password:this.API_SECRET}},!0);return this.API_ACCESS=t,!0}catch(t){throw new Error(t)}}async delete(e,s){const n=this.basePath+e,r={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...s};return(await t.delete(n,r)).data}async get(e,s,n=!1){const r=this.basePath+e;console.log(r);const a={"Content-type":"application/json"};n||(a.Authorization="Bearer "+this.API_ACCESS);const i={headers:{...a},...s};return(await t.get(r,i)).data}async post(e,s={},n){const r=this.basePath+e,a={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...n};return(await t.post(r,s,a)).data}}s();class r extends n{}var a;a=r,[class extends n{getInstance(t){return this.get("instance/"+t)}createInstance(t){return this.post("instance/instance",t)}updateInstance(t){return this.post("instance/instance/update",t)}getInstancePage(t,s){let n="instance/page/"+t;return s&&(n+=e.stringify(s,"?")),this.get(n)}getInstanceProducts(t,s){let n=`instance/${t}/products`;return s&&(n+=e.stringify(s,"?")),this.get(n)}createInstanceProduct(t,e){return this.post(`instance/${t}/product`,e)}deleteInstanceProduct(t,e){return this.delete(`instance/${t}/product/${e}`)}updateInstanceProduct(t,e){return this.post(`instance/${t}/product/update`,e)}getInstanceTransactions(t){return this.get(`instance/${t}/transactions`)}findInstanceTransactions(t,s){let n=`instance/${t}/transactions/open`;return s&&(n+=e.stringify(s,"?")),this.get(n)}getProductTransactions(t,e){return this.get(`instance/${t}/transactions/product/${e}`)}deleteInstanceTransaction(t,e){return this.delete(`instance/${t}/transaction/${e}`)}createInstanceTransaction(t,e){return this.post(`instance/${t}/transaction`,e)}updateInstanceTransaction(t,e){return this.post(`instance/${t}/transaction/update`,e)}getInstanceInvoices(t,s){let n=`instance/${t}/invoices`;return s&&(n+=e.stringify(s,"?")),this.get(n)}getInstanceInvoice(t,e){return this.get(`instance/${t}/invoice/${e}`)}deleteInstanceInvoice(t,e){return this.delete(`instance/${t}/invoice/${e}`)}createInstanceInvoice(t,e){return this.post(`instance/${t}/invoice`,e)}updateInstanceInvoice(t,e){return this.post(`instance/${t}/invoice/update`,e)}getInstanceSeries(t,s){let n=`instance/${t}/series`;return s&&(n+=e.stringify(s,"?")),this.get(n)}getInstanceTotal(t,s){let n=`instance/${t}/total/monthly`;return s&&(n+=e.stringify(s,"?")),this.get(n)}getInstanceRevenue(t,s){let n=`instance/${t}/revenue`;return s&&(n+=e.stringify(s,"?")),this.get(n)}getInstanceCustomers(t,s){let n=`instance/${t}/customers`;return s&&(n+=e.stringify(s,"?")),this.get(n)}getInstanceCustomer(t,e){return this.get(`instance/${t}/customer/${e}`)}deleteInstanceCustomer(t,e){return this.delete(`instance/${t}/customer/${e}`)}createInstanceCustomer(t,e){return this.post(`instance/${t}/customer`,e)}updateInstanceCustomer(t,e){return this.post(`instance/${t}/customer/update`,e)}getInstanceUsers(t,s){let n=`instance/${t}/users`;return s&&(n+=e.stringify(s,"?")),this.get(n)}getInstanceUser(t,e){return this.get(`instance/${t}/user/${e}`)}deleteInstanceUser(t,e){return this.delete(`instance/${t}/user/${e}`)}createInstanceUser(t,e){return this.post(`instance/${t}/user`,e)}updateInstanceUser(t,e){return this.post(`instance/${t}/user/update`,e)}getInstanceAddresses(t,s){let n=`instance/${t}/addresses`;return s&&(n+=e.stringify(s,"?")),this.get(n)}deleteInstanceAddress(t,e){return this.delete(`instance/${t}/address/${e}`)}createInstanceAddress(t,e){return this.post(`instance/${t}/address`,e)}updateInstanceAddress(t,e){return this.post(`instance/${t}/address/update`,e)}},class extends n{getUserMe(){return this.get("user/me")}getInstancePrimary(){return this.get("user/instance/primary")}setInstancePrimary(t){let s="user/instance/primary";return s+=e.stringify(t,"?"),this.post(s)}getUserInstances(t){return t&&e.stringify(t,"?"),this.get("user/instances")}},class extends n{getMedia(t){return this.get("media/get/"+t)}uploadMedia(t){return this.post("media/upload",t)}},class extends n{getCustomerMe(t){return this.get(`customer/${t}/me`)}},class extends n{sendSms(t,e){return this.post(`crm/${t}/send/normal`,e)}sendTypedSms(t,e,s){return this.post(`crm/${t}/send/typed/${e}`,s)}}].forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(e=>{Object.defineProperty(a.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})});export default r;
import t from"axios";import e from"app-root-path";import s from"querystringify";import{config as r}from"dotenv";class n{async read(){const t=await this.load();if(!t)throw new Error("No connection options were found in any ty configuration files.");return t}plainRead(){return require(this.configPath)}async load(){return require(this.configPath)}get configPath(){return this.baseDirectory+"/"+this.baseConfigName+".json"}get baseDirectory(){return e.path}get baseConfigName(){return"tyconfig"}}class i{constructor(){const t=(new n).plainRead();if(this.API_KEY=t.api_key,this.API_SECRET=t.api_secret,this.basePath=t.api_url,this.authPath=t.auth_url,this.mediaPath=t.media_url,this.mediaPath=t.media_url,"string"!=typeof this.API_KEY||"string"!=typeof this.API_SECRET)throw new Error("You should define TAYEH_API_KEY & TAYEH_API_SECRET in your environment variables.")}async get_token(){try{const{access_token:t}=(await this.get_auth("api/token",{auth:{username:this.API_KEY,password:this.API_SECRET}})).data;return this.API_ACCESS=t,!0}catch(t){throw new Error(t)}}set_token(t){this.API_ACCESS=t}async delete(e,s){const r=this.basePath+e,n={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...s};return await t.delete(r,n)}async get(e,s){const r=this.basePath+e,n={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...s};return await t.get(r,n)}async get_auth(e,s){const r=this.authPath+e,n={headers:{"Content-type":"application/json"},...s};return await t.get(r,n)}async post(e,s={},r){const n=this.basePath+e,i={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...r};return await t.post(n,s,i)}async post_media(e,s={},r){const n=this.mediaPath+e,i={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...r};return await t.post(n,s,i)}async put(e,s={},r){const n=this.basePath+e,i={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...r};return await t.put(n,s,i)}async post_auth(e,s={},r){const n=this.authPath+e,i={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...r};return await t.post(n,s,i)}}r();class a extends i{}var o;o=a,[class extends i{getInstance(t){return this.get("instance/"+t)}createInstance(t){return this.post("instance/instance",t)}updateInstance(t){return this.post("instance/instance/update",t)}getInstancePage(t,e){let r="instance/page/"+t;return e&&(r+=s.stringify(e,"?")),this.get(r)}getProducts(t,e){let r=`instance/${t}/products`;return e&&(r+=s.stringify(e,"?")),this.get(r)}createInstanceProduct(t,e){return this.post(`instance/${t}/product`,e)}deleteInstanceProduct(t,e){return this.delete(`instance/${t}/product/${e}`)}updateInstanceProduct(t,e){return this.post(`instance/${t}/product/update`,e)}getInstanceTransactions(t){return this.get(`instance/${t}/transactions`)}findInstanceTransactions(t,e){let r=`instance/${t}/transactions/open`;return e&&(r+=s.stringify(e,"?")),this.get(r)}getProductTransactions(t,e){return this.get(`instance/${t}/transactions/product/${e}`)}deleteInstanceTransaction(t,e){return this.delete(`instance/${t}/transaction/${e}`)}createInstanceTransaction(t,e){return this.post(`instance/${t}/transaction`,e)}updateInstanceTransaction(t,e){return this.post(`instance/${t}/transaction/update`,e)}getInstanceInvoices(t,e){let r=`instance/${t}/invoices`;return e&&(r+=s.stringify(e,"?")),this.get(r)}getInstanceInvoice(t,e){return this.get(`instance/${t}/invoice/${e}`)}deleteInstanceInvoice(t,e){return this.delete(`instance/${t}/invoice/${e}`)}createInstanceInvoice(t,e){return this.post(`instance/${t}/invoice`,e)}updateInstanceInvoice(t,e){return this.post(`instance/${t}/invoice/update`,e)}getInstanceSeries(t,e){let r=`instance/${t}/series`;return e&&(r+=s.stringify(e,"?")),this.get(r)}getInstanceTotal(t,e){let r=`instance/${t}/total/monthly`;return e&&(r+=s.stringify(e,"?")),this.get(r)}getInstanceRevenue(t,e){let r=`instance/${t}/revenue`;return e&&(r+=s.stringify(e,"?")),this.get(r)}getInstanceCustomers(t,e){let r=`instance/${t}/customers`;return e&&(r+=s.stringify(e,"?")),this.get(r)}getInstanceCustomer(t,e){return this.get(`instance/${t}/customer/${e}`)}deleteInstanceCustomer(t,e){return this.delete(`instance/${t}/customer/${e}`)}createInstanceCustomer(t,e){return this.post(`instance/${t}/customer`,e)}updateInstanceCustomer(t,e){return this.post(`instance/${t}/customer/update`,e)}getInstanceUsers(t,e){let r=`instance/${t}/users`;return e&&(r+=s.stringify(e,"?")),this.get(r)}getInstanceUser(t,e){return this.get(`instance/${t}/user/${e}`)}deleteInstanceUser(t,e){return this.delete(`instance/${t}/user/${e}`)}createInstanceUser(t,e){return this.post(`instance/${t}/user`,e)}updateInstanceUser(t,e){return this.post(`instance/${t}/user/update`,e)}getInstanceAddresses(t,e){let r=`instance/${t}/addresses`;return e&&(r+=s.stringify(e,"?")),this.get(r)}deleteInstanceAddress(t,e){return this.delete(`instance/${t}/address/${e}`)}createInstanceAddress(t,e){return this.post(`instance/${t}/address`,e)}updateInstanceAddress(t,e){return this.post(`instance/${t}/address/update`,e)}getCategories(t,e){let r=`instance/${t}/categories`;return e&&(r+=s.stringify(e,"?")),this.get(r)}getBanners(t,e){let r=`instance/${t}/banners`;return e&&(r+=s.stringify(e,"?")),this.get(r)}getSearchFilters(t,e){let r=`instance/${t}/search-filters`;return e&&(r+=s.stringify(e,"?")),this.get(r)}sendInviteSms(t,e){return this.post(`instance/${t}/invite-sms`,e)}getTopKeywords(t,e){let r=`instance/${t}/top-search-keywords`;return e&&(r+=s.stringify(e,"?")),this.post(r,e)}},class extends i{getUserMe(){return this.get("user/me")}getInstancePrimary(){return this.get("user/instance/primary")}setInstancePrimary(t){let e="user/instance/primary";return e+=s.stringify(t,"?"),this.post(e)}getUserInstances(t){return t&&s.stringify(t,"?"),this.get("user/instances")}},class extends i{getMedia(t){return this.get("media/get/"+t)}uploadMedia(t){return this.post_media("image",t)}},class extends i{getPassword(t,e){return this.post_auth("customer/login",{username:t,instance:e})}customerVerify(t,e,s){return this.post_auth("customer/verify",{username:t,password:e,instance:s})}getCustomerMe(){return this.get("customer/me")}getCustomer(){return this.get("customer")}updateCustomer(t){return this.post("customer",t)}addProductToCart(t){return this.put("customer/cart",t)}toggleProductFavorite(t){return this.post("customer/favorite-product",t)}getCustomerCart(){return this.get("customer/cart")}updateCartItem(t){return this.post("customer/cart",t)}deleteCartItem(t){return this.delete("customer/cart/"+t)}getNotifications(t){let e="customer/notifications";return t&&(e+=s.stringify(t,"?")),this.get(e)}getFavorites(t){let e="customer/favorite-products";return t&&(e+=s.stringify(t,"?")),this.get(e)}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)}},class extends i{sendSms(t,e){return this.post(`crm/${t}/send/normal`,e)}sendTypedSms(t,e,s){return this.post(`crm/${t}/send/typed/${e}`,s)}},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,e){let r=`product/${t}/reviews`;return e&&(r+=s.stringify(e,"?")),this.get(r)}getRatingOptions(t){return this.get(`product/${t}/rating-options`)}sendNewReview(t,e){return this.put(`product/${t}/review`,e)}reportReview(t,e){return this.post(`product/${t}/review/${e}/report`)}},class extends i{getCountries(t){let e="countries";return t&&(e+=s.stringify(t,"?")),this.get(e)}getIranProvinces(t){let e="countries/IR/states";return t&&(e+=s.stringify(t,"?")),this.get(e)}getStateCities(t,e){let r=`countries/IR/states/${t}/cities`;return e&&(r+=s.stringify(e,"?")),this.get(r)}}].forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(e=>{Object.defineProperty(o.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})});export default a;
//# sourceMappingURL=index.modern.js.map

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

import t from"axios";import n from"querystringify";import{config as e}from"dotenv";function r(){return(r=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t}).apply(this,arguments)}function s(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}var i=function(){function n(t){if(this.basePath=process.env.BASE_URL,this.authPath=process.env.AUTH_URL,this.mediaPath=process.env.MEDIA_URL,this.API_KEY=t.API_KEY,this.API_SECRET=t.API_SECRET,"string"!=typeof this.API_KEY||"string"!=typeof this.API_SECRET)throw new Error("You should define API_KEY & API_SECRET.")}var e=n.prototype;return e.get_token=function(){try{var t=this;return Promise.resolve(function(n,e){try{var r=Promise.resolve(t.get("api/token",{auth:{username:t.API_KEY,password:t.API_SECRET}},!0)).then(function(n){return t.API_ACCESS=n.access_token,!0})}catch(t){return e(t)}return r&&r.then?r.then(void 0,e):r}(0,function(t){throw new Error(t)}))}catch(t){return Promise.reject(t)}},e.delete=function(n,e){try{var s=this.basePath+n,i=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},e);return Promise.resolve(t.delete(s,i)).then(function(t){return t.data})}catch(t){return Promise.reject(t)}},e.get=function(n,e,s){void 0===s&&(s=!1);try{var i=this.basePath+n;console.log(i);var o={"Content-type":"application/json"};s||(o.Authorization="Bearer "+this.API_ACCESS);var c=r({headers:r({},o)},e);return Promise.resolve(t.get(i,c)).then(function(t){return t.data})}catch(t){return Promise.reject(t)}},e.post=function(n,e,s){void 0===e&&(e={});try{var i=this.basePath+n,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},s);return Promise.resolve(t.post(i,e,o)).then(function(t){return t.data})}catch(t){return Promise.reject(t)}},n}(),o=function(t){function n(){return t.apply(this,arguments)||this}s(n,t);var e=n.prototype;return e.getMedia=function(t){return this.get("media/get/"+t)},e.uploadMedia=function(t){return this.post("media/upload",t)},n}(i),c=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getInstance=function(t){return this.get("instance/"+t)},r.createInstance=function(t){return this.post("instance/instance",t)},r.updateInstance=function(t){return this.post("instance/instance/update",t)},r.getInstancePage=function(t,e){var r="instance/page/"+t;return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceProducts=function(t,e){var r="instance/"+t+"/products";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.createInstanceProduct=function(t,n){return this.post("instance/"+t+"/product",n)},r.deleteInstanceProduct=function(t,n){return this.delete("instance/"+t+"/product/"+n)},r.updateInstanceProduct=function(t,n){return this.post("instance/"+t+"/product/update",n)},r.getInstanceTransactions=function(t){return this.get("instance/"+t+"/transactions")},r.findInstanceTransactions=function(t,e){var r="instance/"+t+"/transactions/open";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getProductTransactions=function(t,n){return this.get("instance/"+t+"/transactions/product/"+n)},r.deleteInstanceTransaction=function(t,n){return this.delete("instance/"+t+"/transaction/"+n)},r.createInstanceTransaction=function(t,n){return this.post("instance/"+t+"/transaction",n)},r.updateInstanceTransaction=function(t,n){return this.post("instance/"+t+"/transaction/update",n)},r.getInstanceInvoices=function(t,e){var r="instance/"+t+"/invoices";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceInvoice=function(t,n){return this.get("instance/"+t+"/invoice/"+n)},r.deleteInstanceInvoice=function(t,n){return this.delete("instance/"+t+"/invoice/"+n)},r.createInstanceInvoice=function(t,n){return this.post("instance/"+t+"/invoice",n)},r.updateInstanceInvoice=function(t,n){return this.post("instance/"+t+"/invoice/update",n)},r.getInstanceSeries=function(t,e){var r="instance/"+t+"/series";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceTotal=function(t,e){var r="instance/"+t+"/total/monthly";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceRevenue=function(t,e){var r="instance/"+t+"/revenue";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceCustomers=function(t,e){var r="instance/"+t+"/customers";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceCustomer=function(t,n){return this.get("instance/"+t+"/customer/"+n)},r.deleteInstanceCustomer=function(t,n){return this.delete("instance/"+t+"/customer/"+n)},r.createInstanceCustomer=function(t,n){return this.post("instance/"+t+"/customer",n)},r.updateInstanceCustomer=function(t,n){return this.post("instance/"+t+"/customer/update",n)},r.getInstanceUsers=function(t,e){var r="instance/"+t+"/users";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceUser=function(t,n){return this.get("instance/"+t+"/user/"+n)},r.deleteInstanceUser=function(t,n){return this.delete("instance/"+t+"/user/"+n)},r.createInstanceUser=function(t,n){return this.post("instance/"+t+"/user",n)},r.updateInstanceUser=function(t,n){return this.post("instance/"+t+"/user/update",n)},r.getInstanceAddresses=function(t,e){var r="instance/"+t+"/addresses";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.deleteInstanceAddress=function(t,n){return this.delete("instance/"+t+"/address/"+n)},r.createInstanceAddress=function(t,n){return this.post("instance/"+t+"/address",n)},r.updateInstanceAddress=function(t,n){return this.post("instance/"+t+"/address/update",n)},e}(i),a=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getUserMe=function(){return this.get("user/me")},r.getInstancePrimary=function(){return this.get("user/instance/primary")},r.setInstancePrimary=function(t){var e="user/instance/primary";return e+=n.stringify(t,"?"),this.post(e)},r.getUserInstances=function(t){return t&&n.stringify(t,"?"),this.get("user/instances")},e}(i),u=function(t){function n(){return t.apply(this,arguments)||this}return s(n,t),n.prototype.getCustomerMe=function(t){return this.get("customer/"+t+"/me")},n}(i),p=function(t){function n(){return t.apply(this,arguments)||this}s(n,t);var e=n.prototype;return e.sendSms=function(t,n){return this.post("crm/"+t+"/send/normal",n)},e.sendTypedSms=function(t,n,e){return this.post("crm/"+t+"/send/typed/"+n,e)},n}(i);e();var h,f=function(t){function n(){return t.apply(this,arguments)||this}return s(n,t),n}(i);h=f,[c,a,o,u,p].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(n){Object.defineProperty(h.prototype,n,Object.getOwnPropertyDescriptor(t.prototype,n))})});export default f;
import t from"axios";import e from"app-root-path";import n from"querystringify";import{config as r}from"dotenv";function i(){return(i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function s(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var o=function(){function t(){}var n,r=t.prototype;return r.read=function(){try{return Promise.resolve(this.load()).then(function(t){if(!t)throw new Error("No connection options were found in any ty configuration files.");return t})}catch(t){return Promise.reject(t)}},r.plainRead=function(){return require(this.configPath)},r.load=function(){try{return Promise.resolve(require(this.configPath))}catch(t){return Promise.reject(t)}},(n=[{key:"configPath",get:function(){return this.baseDirectory+"/"+this.baseConfigName+".json"}},{key:"baseDirectory",get:function(){return e.path}},{key:"baseConfigName",get:function(){return"tyconfig"}}])&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(t.prototype,n),t}(),u=function(){function e(){var t=(new o).plainRead();if(this.API_KEY=t.api_key,this.API_SECRET=t.api_secret,this.basePath=t.api_url,this.authPath=t.auth_url,this.mediaPath=t.media_url,this.mediaPath=t.media_url,"string"!=typeof this.API_KEY||"string"!=typeof this.API_SECRET)throw new Error("You should define TAYEH_API_KEY & TAYEH_API_SECRET in your environment variables.")}var n=e.prototype;return n.get_token=function(){try{var t=this;return Promise.resolve(function(e,n){try{var r=Promise.resolve(t.get_auth("api/token",{auth:{username:t.API_KEY,password:t.API_SECRET}})).then(function(e){return t.API_ACCESS=e.data.access_token,!0})}catch(t){return n(t)}return r&&r.then?r.then(void 0,n):r}(0,function(t){throw new Error(t)}))}catch(t){return Promise.reject(t)}},n.set_token=function(t){this.API_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.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.get_auth=function(e,n){try{var r=this.authPath+e,s=i({headers:i({},{"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.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.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}(),c=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}(u),a=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getInstance=function(t){return this.get("instance/"+t)},r.createInstance=function(t){return this.post("instance/instance",t)},r.updateInstance=function(t){return this.post("instance/instance/update",t)},r.getInstancePage=function(t,e){var r="instance/page/"+t;return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getProducts=function(t,e){var r="instance/"+t+"/products";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.createInstanceProduct=function(t,e){return this.post("instance/"+t+"/product",e)},r.deleteInstanceProduct=function(t,e){return this.delete("instance/"+t+"/product/"+e)},r.updateInstanceProduct=function(t,e){return this.post("instance/"+t+"/product/update",e)},r.getInstanceTransactions=function(t){return this.get("instance/"+t+"/transactions")},r.findInstanceTransactions=function(t,e){var r="instance/"+t+"/transactions/open";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getProductTransactions=function(t,e){return this.get("instance/"+t+"/transactions/product/"+e)},r.deleteInstanceTransaction=function(t,e){return this.delete("instance/"+t+"/transaction/"+e)},r.createInstanceTransaction=function(t,e){return this.post("instance/"+t+"/transaction",e)},r.updateInstanceTransaction=function(t,e){return this.post("instance/"+t+"/transaction/update",e)},r.getInstanceInvoices=function(t,e){var r="instance/"+t+"/invoices";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceInvoice=function(t,e){return this.get("instance/"+t+"/invoice/"+e)},r.deleteInstanceInvoice=function(t,e){return this.delete("instance/"+t+"/invoice/"+e)},r.createInstanceInvoice=function(t,e){return this.post("instance/"+t+"/invoice",e)},r.updateInstanceInvoice=function(t,e){return this.post("instance/"+t+"/invoice/update",e)},r.getInstanceSeries=function(t,e){var r="instance/"+t+"/series";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceTotal=function(t,e){var r="instance/"+t+"/total/monthly";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceRevenue=function(t,e){var r="instance/"+t+"/revenue";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceCustomers=function(t,e){var r="instance/"+t+"/customers";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceCustomer=function(t,e){return this.get("instance/"+t+"/customer/"+e)},r.deleteInstanceCustomer=function(t,e){return this.delete("instance/"+t+"/customer/"+e)},r.createInstanceCustomer=function(t,e){return this.post("instance/"+t+"/customer",e)},r.updateInstanceCustomer=function(t,e){return this.post("instance/"+t+"/customer/update",e)},r.getInstanceUsers=function(t,e){var r="instance/"+t+"/users";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceUser=function(t,e){return this.get("instance/"+t+"/user/"+e)},r.deleteInstanceUser=function(t,e){return this.delete("instance/"+t+"/user/"+e)},r.createInstanceUser=function(t,e){return this.post("instance/"+t+"/user",e)},r.updateInstanceUser=function(t,e){return this.post("instance/"+t+"/user/update",e)},r.getInstanceAddresses=function(t,e){var r="instance/"+t+"/addresses";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.deleteInstanceAddress=function(t,e){return this.delete("instance/"+t+"/address/"+e)},r.createInstanceAddress=function(t,e){return this.post("instance/"+t+"/address",e)},r.updateInstanceAddress=function(t,e){return this.post("instance/"+t+"/address/update",e)},r.getCategories=function(t,e){var r="instance/"+t+"/categories";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getBanners=function(t,e){var r="instance/"+t+"/banners";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getSearchFilters=function(t,e){var r="instance/"+t+"/search-filters";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.sendInviteSms=function(t,e){return this.post("instance/"+t+"/invite-sms",e)},r.getTopKeywords=function(t,e){var r="instance/"+t+"/top-search-keywords";return e&&(r+=n.stringify(e,"?")),this.post(r,e)},e}(u),h=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getUserMe=function(){return this.get("user/me")},r.getInstancePrimary=function(){return this.get("user/instance/primary")},r.setInstancePrimary=function(t){var e="user/instance/primary";return e+=n.stringify(t,"?"),this.post(e)},r.getUserInstances=function(t){return t&&n.stringify(t,"?"),this.get("user/instances")},e}(u),p=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getPassword=function(t,e){return this.post_auth("customer/login",{username:t,instance:e})},r.customerVerify=function(t,e,n){return this.post_auth("customer/verify",{username:t,password:e,instance:n})},r.getCustomerMe=function(){return this.get("customer/me")},r.getCustomer=function(){return this.get("customer")},r.updateCustomer=function(t){return this.post("customer",t)},r.addProductToCart=function(t){return this.put("customer/cart",t)},r.toggleProductFavorite=function(t){return this.post("customer/favorite-product",t)},r.getCustomerCart=function(){return this.get("customer/cart")},r.updateCartItem=function(t){return this.post("customer/cart",t)},r.deleteCartItem=function(t){return this.delete("customer/cart/"+t)},r.getNotifications=function(t){var e="customer/notifications";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.getFavorites=function(t){var e="customer/favorite-products";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.getAddresses=function(){return this.get("customer/addresses")},r.createAddress=function(t){return this.put("customer/address",t)},r.updateAddress=function(t){return this.post("customer/address",t)},r.deleteAddress=function(t){return this.delete("customer/address/"+t)},e}(u),f=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var n=e.prototype;return n.sendSms=function(t,e){return this.post("crm/"+t+"/send/normal",e)},n.sendTypedSms=function(t,e,n){return this.post("crm/"+t+"/send/typed/"+e,n)},e}(u),d=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getProduct=function(t){return this.get("product/"+t)},r.getProductFeatures=function(t){return this.get("product/"+t+"/features")},r.getSimilarProducts=function(t){return this.get("product/"+t+"/similar-products")},r.getProductChoices=function(t){return this.get("product/"+t+"/choices")},r.getProductReviews=function(t,e){var r="product/"+t+"/reviews";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getRatingOptions=function(t){return this.get("product/"+t+"/rating-options")},r.sendNewReview=function(t,e){return this.put("product/"+t+"/review",e)},r.reportReview=function(t,e){return this.post("product/"+t+"/review/"+e+"/report")},e}(u),g=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getCountries=function(t){var e="countries";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.getIranProvinces=function(t){var e="countries/IR/states";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.getStateCities=function(t,e){var r="countries/IR/states/"+t+"/cities";return e&&(r+=n.stringify(e,"?")),this.get(r)},e}(u);r();var y,m=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(u);y=m,[a,h,c,p,f,d,g].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){Object.defineProperty(y.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})});export default m;
//# sourceMappingURL=index.module.js.map

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

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("axios"),require("querystringify"),require("dotenv")):"function"==typeof define&&define.amd?define(["axios","querystringify","dotenv"],n):(t=t||self).webClient=n(t.axios,t.querystringify,t.dotenv)}(this,function(t,n,e){function r(){return(r=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t}).apply(this,arguments)}function s(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,n=n&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n;var i=function(){function n(t){if(this.basePath=process.env.BASE_URL,this.authPath=process.env.AUTH_URL,this.mediaPath=process.env.MEDIA_URL,this.API_KEY=t.API_KEY,this.API_SECRET=t.API_SECRET,"string"!=typeof this.API_KEY||"string"!=typeof this.API_SECRET)throw new Error("You should define API_KEY & API_SECRET.")}var e=n.prototype;return e.get_token=function(){try{var t=this;return Promise.resolve(function(n,e){try{var r=Promise.resolve(t.get("api/token",{auth:{username:t.API_KEY,password:t.API_SECRET}},!0)).then(function(n){return t.API_ACCESS=n.access_token,!0})}catch(t){return e(t)}return r&&r.then?r.then(void 0,e):r}(0,function(t){throw new Error(t)}))}catch(t){return Promise.reject(t)}},e.delete=function(n,e){try{var s=this.basePath+n,i=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},e);return Promise.resolve(t.delete(s,i)).then(function(t){return t.data})}catch(t){return Promise.reject(t)}},e.get=function(n,e,s){void 0===s&&(s=!1);try{var i=this.basePath+n;console.log(i);var o={"Content-type":"application/json"};s||(o.Authorization="Bearer "+this.API_ACCESS);var c=r({headers:r({},o)},e);return Promise.resolve(t.get(i,c)).then(function(t){return t.data})}catch(t){return Promise.reject(t)}},e.post=function(n,e,s){void 0===e&&(e={});try{var i=this.basePath+n,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},s);return Promise.resolve(t.post(i,e,o)).then(function(t){return t.data})}catch(t){return Promise.reject(t)}},n}(),o=function(t){function n(){return t.apply(this,arguments)||this}s(n,t);var e=n.prototype;return e.getMedia=function(t){return this.get("media/get/"+t)},e.uploadMedia=function(t){return this.post("media/upload",t)},n}(i),c=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getInstance=function(t){return this.get("instance/"+t)},r.createInstance=function(t){return this.post("instance/instance",t)},r.updateInstance=function(t){return this.post("instance/instance/update",t)},r.getInstancePage=function(t,e){var r="instance/page/"+t;return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceProducts=function(t,e){var r="instance/"+t+"/products";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.createInstanceProduct=function(t,n){return this.post("instance/"+t+"/product",n)},r.deleteInstanceProduct=function(t,n){return this.delete("instance/"+t+"/product/"+n)},r.updateInstanceProduct=function(t,n){return this.post("instance/"+t+"/product/update",n)},r.getInstanceTransactions=function(t){return this.get("instance/"+t+"/transactions")},r.findInstanceTransactions=function(t,e){var r="instance/"+t+"/transactions/open";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getProductTransactions=function(t,n){return this.get("instance/"+t+"/transactions/product/"+n)},r.deleteInstanceTransaction=function(t,n){return this.delete("instance/"+t+"/transaction/"+n)},r.createInstanceTransaction=function(t,n){return this.post("instance/"+t+"/transaction",n)},r.updateInstanceTransaction=function(t,n){return this.post("instance/"+t+"/transaction/update",n)},r.getInstanceInvoices=function(t,e){var r="instance/"+t+"/invoices";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceInvoice=function(t,n){return this.get("instance/"+t+"/invoice/"+n)},r.deleteInstanceInvoice=function(t,n){return this.delete("instance/"+t+"/invoice/"+n)},r.createInstanceInvoice=function(t,n){return this.post("instance/"+t+"/invoice",n)},r.updateInstanceInvoice=function(t,n){return this.post("instance/"+t+"/invoice/update",n)},r.getInstanceSeries=function(t,e){var r="instance/"+t+"/series";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceTotal=function(t,e){var r="instance/"+t+"/total/monthly";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceRevenue=function(t,e){var r="instance/"+t+"/revenue";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceCustomers=function(t,e){var r="instance/"+t+"/customers";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceCustomer=function(t,n){return this.get("instance/"+t+"/customer/"+n)},r.deleteInstanceCustomer=function(t,n){return this.delete("instance/"+t+"/customer/"+n)},r.createInstanceCustomer=function(t,n){return this.post("instance/"+t+"/customer",n)},r.updateInstanceCustomer=function(t,n){return this.post("instance/"+t+"/customer/update",n)},r.getInstanceUsers=function(t,e){var r="instance/"+t+"/users";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceUser=function(t,n){return this.get("instance/"+t+"/user/"+n)},r.deleteInstanceUser=function(t,n){return this.delete("instance/"+t+"/user/"+n)},r.createInstanceUser=function(t,n){return this.post("instance/"+t+"/user",n)},r.updateInstanceUser=function(t,n){return this.post("instance/"+t+"/user/update",n)},r.getInstanceAddresses=function(t,e){var r="instance/"+t+"/addresses";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.deleteInstanceAddress=function(t,n){return this.delete("instance/"+t+"/address/"+n)},r.createInstanceAddress=function(t,n){return this.post("instance/"+t+"/address",n)},r.updateInstanceAddress=function(t,n){return this.post("instance/"+t+"/address/update",n)},e}(i),a=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getUserMe=function(){return this.get("user/me")},r.getInstancePrimary=function(){return this.get("user/instance/primary")},r.setInstancePrimary=function(t){var e="user/instance/primary";return e+=n.stringify(t,"?"),this.post(e)},r.getUserInstances=function(t){return t&&n.stringify(t,"?"),this.get("user/instances")},e}(i),u=function(t){function n(){return t.apply(this,arguments)||this}return s(n,t),n.prototype.getCustomerMe=function(t){return this.get("customer/"+t+"/me")},n}(i),p=function(t){function n(){return t.apply(this,arguments)||this}s(n,t);var e=n.prototype;return e.sendSms=function(t,n){return this.post("crm/"+t+"/send/normal",n)},e.sendTypedSms=function(t,n,e){return this.post("crm/"+t+"/send/typed/"+n,e)},n}(i);e.config();var f,h=function(t){function n(){return t.apply(this,arguments)||this}return s(n,t),n}(i);return f=h,[c,a,o,u,p].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(n){Object.defineProperty(f.prototype,n,Object.getOwnPropertyDescriptor(t.prototype,n))})}),h});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("axios"),require("app-root-path"),require("querystringify"),require("dotenv")):"function"==typeof define&&define.amd?define(["axios","app-root-path","querystringify","dotenv"],e):(t=t||self).tayehJs=e(t.axios,t.appRootPath,t.querystringify,t.dotenv)}(this,function(t,e,n,r){function i(){return(i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function s(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e,n=n&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n;var o=function(){function t(){}var n,r=t.prototype;return r.read=function(){try{return Promise.resolve(this.load()).then(function(t){if(!t)throw new Error("No connection options were found in any ty configuration files.");return t})}catch(t){return Promise.reject(t)}},r.plainRead=function(){return require(this.configPath)},r.load=function(){try{return Promise.resolve(require(this.configPath))}catch(t){return Promise.reject(t)}},(n=[{key:"configPath",get:function(){return this.baseDirectory+"/"+this.baseConfigName+".json"}},{key:"baseDirectory",get:function(){return e.path}},{key:"baseConfigName",get:function(){return"tyconfig"}}])&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(t.prototype,n),t}(),u=function(){function e(){var t=(new o).plainRead();if(this.API_KEY=t.api_key,this.API_SECRET=t.api_secret,this.basePath=t.api_url,this.authPath=t.auth_url,this.mediaPath=t.media_url,this.mediaPath=t.media_url,"string"!=typeof this.API_KEY||"string"!=typeof this.API_SECRET)throw new Error("You should define TAYEH_API_KEY & TAYEH_API_SECRET in your environment variables.")}var n=e.prototype;return n.get_token=function(){try{var t=this;return Promise.resolve(function(e,n){try{var r=Promise.resolve(t.get_auth("api/token",{auth:{username:t.API_KEY,password:t.API_SECRET}})).then(function(e){return t.API_ACCESS=e.data.access_token,!0})}catch(t){return n(t)}return r&&r.then?r.then(void 0,n):r}(0,function(t){throw new Error(t)}))}catch(t){return Promise.reject(t)}},n.set_token=function(t){this.API_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.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.get_auth=function(e,n){try{var r=this.authPath+e,s=i({headers:i({},{"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.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.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}(),a=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}(u),c=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getInstance=function(t){return this.get("instance/"+t)},r.createInstance=function(t){return this.post("instance/instance",t)},r.updateInstance=function(t){return this.post("instance/instance/update",t)},r.getInstancePage=function(t,e){var r="instance/page/"+t;return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getProducts=function(t,e){var r="instance/"+t+"/products";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.createInstanceProduct=function(t,e){return this.post("instance/"+t+"/product",e)},r.deleteInstanceProduct=function(t,e){return this.delete("instance/"+t+"/product/"+e)},r.updateInstanceProduct=function(t,e){return this.post("instance/"+t+"/product/update",e)},r.getInstanceTransactions=function(t){return this.get("instance/"+t+"/transactions")},r.findInstanceTransactions=function(t,e){var r="instance/"+t+"/transactions/open";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getProductTransactions=function(t,e){return this.get("instance/"+t+"/transactions/product/"+e)},r.deleteInstanceTransaction=function(t,e){return this.delete("instance/"+t+"/transaction/"+e)},r.createInstanceTransaction=function(t,e){return this.post("instance/"+t+"/transaction",e)},r.updateInstanceTransaction=function(t,e){return this.post("instance/"+t+"/transaction/update",e)},r.getInstanceInvoices=function(t,e){var r="instance/"+t+"/invoices";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceInvoice=function(t,e){return this.get("instance/"+t+"/invoice/"+e)},r.deleteInstanceInvoice=function(t,e){return this.delete("instance/"+t+"/invoice/"+e)},r.createInstanceInvoice=function(t,e){return this.post("instance/"+t+"/invoice",e)},r.updateInstanceInvoice=function(t,e){return this.post("instance/"+t+"/invoice/update",e)},r.getInstanceSeries=function(t,e){var r="instance/"+t+"/series";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceTotal=function(t,e){var r="instance/"+t+"/total/monthly";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceRevenue=function(t,e){var r="instance/"+t+"/revenue";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceCustomers=function(t,e){var r="instance/"+t+"/customers";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceCustomer=function(t,e){return this.get("instance/"+t+"/customer/"+e)},r.deleteInstanceCustomer=function(t,e){return this.delete("instance/"+t+"/customer/"+e)},r.createInstanceCustomer=function(t,e){return this.post("instance/"+t+"/customer",e)},r.updateInstanceCustomer=function(t,e){return this.post("instance/"+t+"/customer/update",e)},r.getInstanceUsers=function(t,e){var r="instance/"+t+"/users";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceUser=function(t,e){return this.get("instance/"+t+"/user/"+e)},r.deleteInstanceUser=function(t,e){return this.delete("instance/"+t+"/user/"+e)},r.createInstanceUser=function(t,e){return this.post("instance/"+t+"/user",e)},r.updateInstanceUser=function(t,e){return this.post("instance/"+t+"/user/update",e)},r.getInstanceAddresses=function(t,e){var r="instance/"+t+"/addresses";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.deleteInstanceAddress=function(t,e){return this.delete("instance/"+t+"/address/"+e)},r.createInstanceAddress=function(t,e){return this.post("instance/"+t+"/address",e)},r.updateInstanceAddress=function(t,e){return this.post("instance/"+t+"/address/update",e)},r.getCategories=function(t,e){var r="instance/"+t+"/categories";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getBanners=function(t,e){var r="instance/"+t+"/banners";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getSearchFilters=function(t,e){var r="instance/"+t+"/search-filters";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.sendInviteSms=function(t,e){return this.post("instance/"+t+"/invite-sms",e)},r.getTopKeywords=function(t,e){var r="instance/"+t+"/top-search-keywords";return e&&(r+=n.stringify(e,"?")),this.post(r,e)},e}(u),p=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getUserMe=function(){return this.get("user/me")},r.getInstancePrimary=function(){return this.get("user/instance/primary")},r.setInstancePrimary=function(t){var e="user/instance/primary";return e+=n.stringify(t,"?"),this.post(e)},r.getUserInstances=function(t){return t&&n.stringify(t,"?"),this.get("user/instances")},e}(u),h=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getPassword=function(t,e){return this.post_auth("customer/login",{username:t,instance:e})},r.customerVerify=function(t,e,n){return this.post_auth("customer/verify",{username:t,password:e,instance:n})},r.getCustomerMe=function(){return this.get("customer/me")},r.getCustomer=function(){return this.get("customer")},r.updateCustomer=function(t){return this.post("customer",t)},r.addProductToCart=function(t){return this.put("customer/cart",t)},r.toggleProductFavorite=function(t){return this.post("customer/favorite-product",t)},r.getCustomerCart=function(){return this.get("customer/cart")},r.updateCartItem=function(t){return this.post("customer/cart",t)},r.deleteCartItem=function(t){return this.delete("customer/cart/"+t)},r.getNotifications=function(t){var e="customer/notifications";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.getFavorites=function(t){var e="customer/favorite-products";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.getAddresses=function(){return this.get("customer/addresses")},r.createAddress=function(t){return this.put("customer/address",t)},r.updateAddress=function(t){return this.post("customer/address",t)},r.deleteAddress=function(t){return this.delete("customer/address/"+t)},e}(u),f=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var n=e.prototype;return n.sendSms=function(t,e){return this.post("crm/"+t+"/send/normal",e)},n.sendTypedSms=function(t,e,n){return this.post("crm/"+t+"/send/typed/"+e,n)},e}(u),d=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getProduct=function(t){return this.get("product/"+t)},r.getProductFeatures=function(t){return this.get("product/"+t+"/features")},r.getSimilarProducts=function(t){return this.get("product/"+t+"/similar-products")},r.getProductChoices=function(t){return this.get("product/"+t+"/choices")},r.getProductReviews=function(t,e){var r="product/"+t+"/reviews";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getRatingOptions=function(t){return this.get("product/"+t+"/rating-options")},r.sendNewReview=function(t,e){return this.put("product/"+t+"/review",e)},r.reportReview=function(t,e){return this.post("product/"+t+"/review/"+e+"/report")},e}(u),g=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var r=e.prototype;return r.getCountries=function(t){var e="countries";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.getIranProvinces=function(t){var e="countries/IR/states";return t&&(e+=n.stringify(t,"?")),this.get(e)},r.getStateCities=function(t,e){var r="countries/IR/states/"+t+"/cities";return e&&(r+=n.stringify(e,"?")),this.get(r)},e}(u);r.config();var y,v=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(u);return y=v,[c,p,a,h,f,d,g].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){Object.defineProperty(y.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})}),v});
//# sourceMappingURL=index.umd.js.map
{
"name": "tayeh.js",
"version": "0.0.1",
"version": "0.0.2",
"description": "tayeh shop-api client",

@@ -47,3 +47,4 @@ "main": "dist/index.js",

"dependencies": {
"axios": "^0.20.0",
"app-root-path": "^3.0.0",
"axios": "^0.21.1",
"dotenv": "^8.2.0",

@@ -50,0 +51,0 @@ "isomorphic-unfetch": "^3.0.0",

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc