@tayeh/web-client
Advanced tools
Comparing version 1.1.6-alpha to 1.1.7-alpha
@@ -1,2 +0,2 @@ | ||
function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var e=t(require("axios")),n=t(require("querystringify")),r=require("dotenv");function 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 i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var o=function(){function t(t){if(void 0===t&&(t={}),this.API_KEY=process.env[t.API_KEY_VARIABLE||"TAYEH_API_KEY"],this.API_SECRET=process.env[t.API_SECRET_VARIABLE||"TAYEH_API_SECRET"],this.basePath=process.env.TAYEH_BASE_URL||"http://api.tayeh.ir/",this.authPath=process.env.TAYEH_AUTH_URL||"http://auth.tayeh.ir/",this.mediaPath=process.env.TAYEH_MEDIA_URL||"http://media.tayeh.ir/","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){var n=e.data.access_token;return t.API_ACCESS=n,console.log("string",n),!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.authPath+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_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}i(e,t);var n=e.prototype;return n.getMedia=function(t){return this.get("media/get/"+t)},n.uploadMedia=function(t){return this.post("media/upload",t)},e}(o),c=function(t){function e(){return t.apply(this,arguments)||this}i(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,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.getInstanceCategories=function(t,e){var r="instance/"+t+"/categories";return e&&(r+=n.stringify(e,"?")),this.get(r)},r.getInstanceBanners=function(t,e){var r="banner/"+t;return console.log(r),e&&(r+=n.stringify(e,"?")),this.get(r)},r.getProductComments=function(t,e){var r="product/"+t+"/comments";return console.log(r),e&&(r+=n.stringify(e,"?")),this.get(r)},r.getProductRating=function(t,e){var r="product/"+t+"/rating";return console.log(r),e&&(r+=n.stringify(e,"?")),this.get(r)},r.getSearchFilters=function(t,e){void 0===t&&(t=null);var r="category/"+t+"/search-filters";return console.log(r),e&&(r+=n.stringify(e,"?")),this.get(r)},r.getFilters=function(t,e){var r="instance/"+t+"/search/filters";return console.log(r),e&&(r+=n.stringify(e,"?")),this.get(r)},e}(o),u=function(t){function e(){return t.apply(this,arguments)||this}i(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}(o),h=function(t){function e(){return t.apply(this,arguments)||this}i(e,t);var n=e.prototype;return n.getPassword=function(t){return this.post_auth("customer/login",{username:t})},n.customerVerify=function(t,e){return this.post_auth("customer/verify",{username:t,password:e})},n.getCustomerMe=function(){return this.get("customer/me")},n.getCostomerAddresses=function(t){var e="customer/addresses/me";return console.log(e),this.get(e)},e}(o),p=function(t){function e(){return t.apply(this,arguments)||this}i(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}(o);r.config();var f,g=function(t){function e(){return t.apply(this,arguments)||this}return i(e,t),e}(o);f=g,[c,u,a,h,p].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){Object.defineProperty(f.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})}),module.exports=g; | ||
function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var e=t(require("axios")),n=t(require("querystringify")),r=require("dotenv");function 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 i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var o=function(){function t(t){if(void 0===t&&(t={}),this.API_KEY=process.env[t.API_KEY_VARIABLE||"TAYEH_API_KEY"],this.API_SECRET=process.env[t.API_SECRET_VARIABLE||"TAYEH_API_SECRET"],this.basePath=process.env.TAYEH_BASE_URL||"http://api.tayeh.ir/",this.authPath=process.env.TAYEH_AUTH_URL||"http://auth.tayeh.ir/",this.mediaPath=process.env.TAYEH_MEDIA_URL||"http://media.tayeh.ir/","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}(),u=function(t){function e(){return t.apply(this,arguments)||this}i(e,t);var n=e.prototype;return n.getMedia=function(t){return this.get("media/get/"+t)},n.uploadMedia=function(t){return this.post_media("image",t)},e}(o),c=function(t){function e(){return t.apply(this,arguments)||this}i(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}(o),a=function(t){function e(){return t.apply(this,arguments)||this}i(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}(o),h=function(t){function e(){return t.apply(this,arguments)||this}i(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}(o),p=function(t){function e(){return t.apply(this,arguments)||this}i(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}(o),f=function(t){function e(){return t.apply(this,arguments)||this}i(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}(o),d=function(t){function e(){return t.apply(this,arguments)||this}i(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}(o);r.config();var g,v=function(t){function e(){return t.apply(this,arguments)||this}return i(e,t),e}(o);g=v,[c,a,u,h,p,f,d].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){Object.defineProperty(g.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})}),module.exports=v; | ||
//# 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.API_KEY=process.env[t.API_KEY_VARIABLE||"TAYEH_API_KEY"],this.API_SECRET=process.env[t.API_SECRET_VARIABLE||"TAYEH_API_SECRET"],this.basePath=process.env.TAYEH_BASE_URL||"http://api.tayeh.ir/",this.authPath=process.env.TAYEH_AUTH_URL||"http://auth.tayeh.ir/",this.mediaPath=process.env.TAYEH_MEDIA_URL||"http://media.tayeh.ir/","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,console.log("string",t),!0}catch(t){throw new Error(t)}}set_token(t){this.API_ACCESS=t}async delete(e,s){const n=this.authPath+e,r={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...s};return await t.delete(n,r)}async get(e,s){const n=this.basePath+e,r={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...s};return await t.get(n,r)}async get_auth(e,s){const n=this.authPath+e,r={headers:{"Content-type":"application/json"},...s};return await t.get(n,r)}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)}async post_auth(e,s={},n){const r=this.authPath+e,a={headers:{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"},...n};return await t.post(r,s,a)}}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)}getInstanceCategories(t,s){let n=`instance/${t}/categories`;return s&&(n+=e.stringify(s,"?")),this.get(n)}getInstanceBanners(t,s){let n="banner/"+t;return console.log(n),s&&(n+=e.stringify(s,"?")),this.get(n)}getProductComments(t,s){let n=`product/${t}/comments`;return console.log(n),s&&(n+=e.stringify(s,"?")),this.get(n)}getProductRating(t,s){let n=`product/${t}/rating`;return console.log(n),s&&(n+=e.stringify(s,"?")),this.get(n)}getSearchFilters(t=null,s){let n=`category/${t}/search-filters`;return console.log(n),s&&(n+=e.stringify(s,"?")),this.get(n)}getFilters(t,s){let n=`instance/${t}/search/filters`;return console.log(n),s&&(n+=e.stringify(s,"?")),this.get(n)}},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{getPassword(t){return this.post_auth("customer/login",{username:t})}customerVerify(t,e){return this.post_auth("customer/verify",{username:t,password:e})}getCustomerMe(){return this.get("customer/me")}getCostomerAddresses(t){let e="customer/addresses/me";return console.log(e),this.get(e)}},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"querystringify";import{config as s}from"dotenv";class r{constructor(t={}){if(this.API_KEY=process.env[t.API_KEY_VARIABLE||"TAYEH_API_KEY"],this.API_SECRET=process.env[t.API_SECRET_VARIABLE||"TAYEH_API_SECRET"],this.basePath=process.env.TAYEH_BASE_URL||"http://api.tayeh.ir/",this.authPath=process.env.TAYEH_AUTH_URL||"http://auth.tayeh.ir/",this.mediaPath=process.env.TAYEH_MEDIA_URL||"http://media.tayeh.ir/","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)}}s();class n extends r{}var i;i=n,[class extends r{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 r="instance/page/"+t;return s&&(r+=e.stringify(s,"?")),this.get(r)}getProducts(t,s){let r=`instance/${t}/products`;return s&&(r+=e.stringify(s,"?")),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,s){let r=`instance/${t}/transactions/open`;return s&&(r+=e.stringify(s,"?")),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,s){let r=`instance/${t}/invoices`;return s&&(r+=e.stringify(s,"?")),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,s){let r=`instance/${t}/series`;return s&&(r+=e.stringify(s,"?")),this.get(r)}getInstanceTotal(t,s){let r=`instance/${t}/total/monthly`;return s&&(r+=e.stringify(s,"?")),this.get(r)}getInstanceRevenue(t,s){let r=`instance/${t}/revenue`;return s&&(r+=e.stringify(s,"?")),this.get(r)}getInstanceCustomers(t,s){let r=`instance/${t}/customers`;return s&&(r+=e.stringify(s,"?")),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,s){let r=`instance/${t}/users`;return s&&(r+=e.stringify(s,"?")),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,s){let r=`instance/${t}/addresses`;return s&&(r+=e.stringify(s,"?")),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,s){let r=`instance/${t}/categories`;return s&&(r+=e.stringify(s,"?")),this.get(r)}getBanners(t,s){let r=`instance/${t}/banners`;return s&&(r+=e.stringify(s,"?")),this.get(r)}getSearchFilters(t,s){let r=`instance/${t}/search-filters`;return s&&(r+=e.stringify(s,"?")),this.get(r)}sendInviteSms(t,e){return this.post(`instance/${t}/invite-sms`,e)}getTopKeywords(t,s){let r=`instance/${t}/top-search-keywords`;return s&&(r+=e.stringify(s,"?")),this.post(r,s)}},class extends r{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 r{getMedia(t){return this.get("media/get/"+t)}uploadMedia(t){return this.post_media("image",t)}},class extends r{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 s="customer/notifications";return t&&(s+=e.stringify(t,"?")),this.get(s)}getFavorites(t){let s="customer/favorite-products";return t&&(s+=e.stringify(t,"?")),this.get(s)}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 r{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 r{getProduct(t){return this.get("product/"+t)}getProductFeatures(t){return this.get(`product/${t}/features`)}getSimilarProducts(t){return this.get(`product/${t}/similar-products`)}getProductChoices(t){return this.get(`product/${t}/choices`)}getProductReviews(t,s){let r=`product/${t}/reviews`;return s&&(r+=e.stringify(s,"?")),this.get(r)}getRatingOptions(t){return this.get(`product/${t}/rating-options`)}sendNewReview(t,e){return this.put(`product/${t}/review`,e)}reportReview(t,e){return this.post(`product/${t}/review/${e}/report`)}},class extends r{getCountries(t){let s="countries";return t&&(s+=e.stringify(t,"?")),this.get(s)}getIranProvinces(t){let s="countries/IR/states";return t&&(s+=e.stringify(t,"?")),this.get(s)}getStateCities(t,s){let r=`countries/IR/states/${t}/cities`;return s&&(r+=e.stringify(s,"?")),this.get(r)}}].forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(e=>{Object.defineProperty(i.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 r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function s(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var i=function(){function e(t){if(void 0===t&&(t={}),this.API_KEY=process.env[t.API_KEY_VARIABLE||"TAYEH_API_KEY"],this.API_SECRET=process.env[t.API_SECRET_VARIABLE||"TAYEH_API_SECRET"],this.basePath=process.env.TAYEH_BASE_URL||"http://api.tayeh.ir/",this.authPath=process.env.TAYEH_AUTH_URL||"http://auth.tayeh.ir/",this.mediaPath=process.env.TAYEH_MEDIA_URL||"http://media.tayeh.ir/","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){var n=e.data.access_token;return t.API_ACCESS=n,console.log("string",n),!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 s=this.authPath+e,i=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.delete(s,i))}catch(t){return Promise.reject(t)}},n.get=function(e,n){try{var s=this.basePath+e,i=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.get(s,i))}catch(t){return Promise.reject(t)}},n.get_auth=function(e,n){try{var s=this.authPath+e,i=r({headers:r({},{"Content-type":"application/json"})},n);return Promise.resolve(t.get(s,i))}catch(t){return Promise.reject(t)}},n.post=function(e,n,s){void 0===n&&(n={});try{var i=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},s);return Promise.resolve(t.post(i,n,o))}catch(t){return Promise.reject(t)}},n.post_auth=function(e,n,s){void 0===n&&(n={});try{var i=this.authPath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},s);return Promise.resolve(t.post(i,n,o))}catch(t){return Promise.reject(t)}},e}(),o=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/upload",t)},e}(i),a=function(t){function n(){return t.apply(this,arguments)||this}s(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,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,n){var r="instance/"+t+"/transactions/open";return n&&(r+=e.stringify(n,"?")),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,n){var r="instance/"+t+"/invoices";return n&&(r+=e.stringify(n,"?")),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,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,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,n){var r="instance/"+t+"/users";return n&&(r+=e.stringify(n,"?")),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,n){var r="instance/"+t+"/addresses";return n&&(r+=e.stringify(n,"?")),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.getInstanceCategories=function(t,n){var r="instance/"+t+"/categories";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.getInstanceBanners=function(t,n){var r="banner/"+t;return console.log(r),n&&(r+=e.stringify(n,"?")),this.get(r)},r.getProductComments=function(t,n){var r="product/"+t+"/comments";return console.log(r),n&&(r+=e.stringify(n,"?")),this.get(r)},r.getProductRating=function(t,n){var r="product/"+t+"/rating";return console.log(r),n&&(r+=e.stringify(n,"?")),this.get(r)},r.getSearchFilters=function(t,n){void 0===t&&(t=null);var r="category/"+t+"/search-filters";return console.log(r),n&&(r+=e.stringify(n,"?")),this.get(r)},r.getFilters=function(t,n){var r="instance/"+t+"/search/filters";return console.log(r),n&&(r+=e.stringify(n,"?")),this.get(r)},n}(i),c=function(t){function n(){return t.apply(this,arguments)||this}s(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}(i),u=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var n=e.prototype;return n.getPassword=function(t){return this.post_auth("customer/login",{username:t})},n.customerVerify=function(t,e){return this.post_auth("customer/verify",{username:t,password:e})},n.getCustomerMe=function(){return this.get("customer/me")},n.getCostomerAddresses=function(t){var e="customer/addresses/me";return console.log(e),this.get(e)},e}(i),h=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}(i);n();var p,f=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(i);p=f,[a,c,o,u,h].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){Object.defineProperty(p.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})});export default f; | ||
import t from"axios";import e from"querystringify";import{config as n}from"dotenv";function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function s(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var i=function(){function e(t){if(void 0===t&&(t={}),this.API_KEY=process.env[t.API_KEY_VARIABLE||"TAYEH_API_KEY"],this.API_SECRET=process.env[t.API_SECRET_VARIABLE||"TAYEH_API_SECRET"],this.basePath=process.env.TAYEH_BASE_URL||"http://api.tayeh.ir/",this.authPath=process.env.TAYEH_AUTH_URL||"http://auth.tayeh.ir/",this.mediaPath=process.env.TAYEH_MEDIA_URL||"http://media.tayeh.ir/","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 s=this.basePath+e,i=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.delete(s,i))}catch(t){return Promise.reject(t)}},n.get=function(e,n){try{var s=this.basePath+e,i=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.get(s,i))}catch(t){return Promise.reject(t)}},n.get_auth=function(e,n){try{var s=this.authPath+e,i=r({headers:r({},{"Content-type":"application/json"})},n);return Promise.resolve(t.get(s,i))}catch(t){return Promise.reject(t)}},n.post=function(e,n,s){void 0===n&&(n={});try{var i=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},s);return Promise.resolve(t.post(i,n,o))}catch(t){return Promise.reject(t)}},n.post_media=function(e,n,s){void 0===n&&(n={});try{var i=this.mediaPath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},s);return Promise.resolve(t.post(i,n,o))}catch(t){return Promise.reject(t)}},n.put=function(e,n,s){void 0===n&&(n={});try{var i=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},s);return Promise.resolve(t.put(i,n,o))}catch(t){return Promise.reject(t)}},n.post_auth=function(e,n,s){void 0===n&&(n={});try{var i=this.authPath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},s);return Promise.resolve(t.post(i,n,o))}catch(t){return Promise.reject(t)}},e}(),o=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}(i),c=function(t){function n(){return t.apply(this,arguments)||this}s(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.getProducts=function(t,n){var r="instance/"+t+"/products";return n&&(r+=e.stringify(n,"?")),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,n){var r="instance/"+t+"/transactions/open";return n&&(r+=e.stringify(n,"?")),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,n){var r="instance/"+t+"/invoices";return n&&(r+=e.stringify(n,"?")),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,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,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,n){var r="instance/"+t+"/users";return n&&(r+=e.stringify(n,"?")),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,n){var r="instance/"+t+"/addresses";return n&&(r+=e.stringify(n,"?")),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,n){var r="instance/"+t+"/categories";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.getBanners=function(t,n){var r="instance/"+t+"/banners";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.getSearchFilters=function(t,n){var r="instance/"+t+"/search-filters";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.sendInviteSms=function(t,e){return this.post("instance/"+t+"/invite-sms",e)},r.getTopKeywords=function(t,n){var r="instance/"+t+"/top-search-keywords";return n&&(r+=e.stringify(n,"?")),this.post(r,n)},n}(i),u=function(t){function n(){return t.apply(this,arguments)||this}s(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}(i),a=function(t){function n(){return t.apply(this,arguments)||this}s(n,t);var r=n.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 n="customer/notifications";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getFavorites=function(t){var n="customer/favorite-products";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.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)},n}(i),h=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}(i),p=function(t){function n(){return t.apply(this,arguments)||this}s(n,t);var r=n.prototype;return r.getProduct=function(t){return this.get("product/"+t)},r.getProductFeatures=function(t){return this.get("product/"+t+"/features")},r.getSimilarProducts=function(t){return this.get("product/"+t+"/similar-products")},r.getProductChoices=function(t){return this.get("product/"+t+"/choices")},r.getProductReviews=function(t,n){var r="product/"+t+"/reviews";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.getRatingOptions=function(t){return this.get("product/"+t+"/rating-options")},r.sendNewReview=function(t,e){return this.put("product/"+t+"/review",e)},r.reportReview=function(t,e){return this.post("product/"+t+"/review/"+e+"/report")},n}(i),f=function(t){function n(){return t.apply(this,arguments)||this}s(n,t);var r=n.prototype;return r.getCountries=function(t){var n="countries";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getIranProvinces=function(t){var n="countries/IR/states";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getStateCities=function(t,n){var r="countries/IR/states/"+t+"/cities";return n&&(r+=e.stringify(n,"?")),this.get(r)},n}(i);n();var d,g=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(i);d=g,[c,u,o,a,h,p,f].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){Object.defineProperty(d.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})});export default g; | ||
//# sourceMappingURL=index.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("axios"),require("querystringify"),require("dotenv")):"function"==typeof define&&define.amd?define(["axios","querystringify","dotenv"],e):(t=t||self).webClient=e(t.axios,t.querystringify,t.dotenv)}(this,function(t,e,n){function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function 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;var i=function(){function e(t){if(void 0===t&&(t={}),this.API_KEY=process.env[t.API_KEY_VARIABLE||"TAYEH_API_KEY"],this.API_SECRET=process.env[t.API_SECRET_VARIABLE||"TAYEH_API_SECRET"],this.basePath=process.env.TAYEH_BASE_URL||"http://api.tayeh.ir/",this.authPath=process.env.TAYEH_AUTH_URL||"http://auth.tayeh.ir/",this.mediaPath=process.env.TAYEH_MEDIA_URL||"http://media.tayeh.ir/","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){var n=e.data.access_token;return t.API_ACCESS=n,console.log("string",n),!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 s=this.authPath+e,i=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.delete(s,i))}catch(t){return Promise.reject(t)}},n.get=function(e,n){try{var s=this.basePath+e,i=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.get(s,i))}catch(t){return Promise.reject(t)}},n.get_auth=function(e,n){try{var s=this.authPath+e,i=r({headers:r({},{"Content-type":"application/json"})},n);return Promise.resolve(t.get(s,i))}catch(t){return Promise.reject(t)}},n.post=function(e,n,s){void 0===n&&(n={});try{var i=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},s);return Promise.resolve(t.post(i,n,o))}catch(t){return Promise.reject(t)}},n.post_auth=function(e,n,s){void 0===n&&(n={});try{var i=this.authPath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},s);return Promise.resolve(t.post(i,n,o))}catch(t){return Promise.reject(t)}},e}(),o=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/upload",t)},e}(i),a=function(t){function n(){return t.apply(this,arguments)||this}s(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,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,n){var r="instance/"+t+"/transactions/open";return n&&(r+=e.stringify(n,"?")),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,n){var r="instance/"+t+"/invoices";return n&&(r+=e.stringify(n,"?")),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,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,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,n){var r="instance/"+t+"/users";return n&&(r+=e.stringify(n,"?")),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,n){var r="instance/"+t+"/addresses";return n&&(r+=e.stringify(n,"?")),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.getInstanceCategories=function(t,n){var r="instance/"+t+"/categories";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.getInstanceBanners=function(t,n){var r="banner/"+t;return console.log(r),n&&(r+=e.stringify(n,"?")),this.get(r)},r.getProductComments=function(t,n){var r="product/"+t+"/comments";return console.log(r),n&&(r+=e.stringify(n,"?")),this.get(r)},r.getProductRating=function(t,n){var r="product/"+t+"/rating";return console.log(r),n&&(r+=e.stringify(n,"?")),this.get(r)},r.getSearchFilters=function(t,n){void 0===t&&(t=null);var r="category/"+t+"/search-filters";return console.log(r),n&&(r+=e.stringify(n,"?")),this.get(r)},r.getFilters=function(t,n){var r="instance/"+t+"/search/filters";return console.log(r),n&&(r+=e.stringify(n,"?")),this.get(r)},n}(i),c=function(t){function n(){return t.apply(this,arguments)||this}s(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}(i),u=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var n=e.prototype;return n.getPassword=function(t){return this.post_auth("customer/login",{username:t})},n.customerVerify=function(t,e){return this.post_auth("customer/verify",{username:t,password:e})},n.getCustomerMe=function(){return this.get("customer/me")},n.getCostomerAddresses=function(t){var e="customer/addresses/me";return console.log(e),this.get(e)},e}(i),h=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}(i);n.config();var p,f=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(i);return p=f,[a,c,o,u,h].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){Object.defineProperty(p.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})}),f}); | ||
!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).webClient=e(t.axios,t.querystringify,t.dotenv)}(this,function(t,e,n){function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function 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;var i=function(){function e(t){if(void 0===t&&(t={}),this.API_KEY=process.env[t.API_KEY_VARIABLE||"TAYEH_API_KEY"],this.API_SECRET=process.env[t.API_SECRET_VARIABLE||"TAYEH_API_SECRET"],this.basePath=process.env.TAYEH_BASE_URL||"http://api.tayeh.ir/",this.authPath=process.env.TAYEH_AUTH_URL||"http://auth.tayeh.ir/",this.mediaPath=process.env.TAYEH_MEDIA_URL||"http://media.tayeh.ir/","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 s=this.basePath+e,i=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.delete(s,i))}catch(t){return Promise.reject(t)}},n.get=function(e,n){try{var s=this.basePath+e,i=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},n);return Promise.resolve(t.get(s,i))}catch(t){return Promise.reject(t)}},n.get_auth=function(e,n){try{var s=this.authPath+e,i=r({headers:r({},{"Content-type":"application/json"})},n);return Promise.resolve(t.get(s,i))}catch(t){return Promise.reject(t)}},n.post=function(e,n,s){void 0===n&&(n={});try{var i=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},s);return Promise.resolve(t.post(i,n,o))}catch(t){return Promise.reject(t)}},n.post_media=function(e,n,s){void 0===n&&(n={});try{var i=this.mediaPath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},s);return Promise.resolve(t.post(i,n,o))}catch(t){return Promise.reject(t)}},n.put=function(e,n,s){void 0===n&&(n={});try{var i=this.basePath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},s);return Promise.resolve(t.put(i,n,o))}catch(t){return Promise.reject(t)}},n.post_auth=function(e,n,s){void 0===n&&(n={});try{var i=this.authPath+e,o=r({headers:r({},{Authorization:"Bearer "+this.API_ACCESS,"Content-type":"application/json"})},s);return Promise.resolve(t.post(i,n,o))}catch(t){return Promise.reject(t)}},e}(),o=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}(i),u=function(t){function n(){return t.apply(this,arguments)||this}s(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.getProducts=function(t,n){var r="instance/"+t+"/products";return n&&(r+=e.stringify(n,"?")),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,n){var r="instance/"+t+"/transactions/open";return n&&(r+=e.stringify(n,"?")),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,n){var r="instance/"+t+"/invoices";return n&&(r+=e.stringify(n,"?")),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,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,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,n){var r="instance/"+t+"/users";return n&&(r+=e.stringify(n,"?")),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,n){var r="instance/"+t+"/addresses";return n&&(r+=e.stringify(n,"?")),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,n){var r="instance/"+t+"/categories";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.getBanners=function(t,n){var r="instance/"+t+"/banners";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.getSearchFilters=function(t,n){var r="instance/"+t+"/search-filters";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.sendInviteSms=function(t,e){return this.post("instance/"+t+"/invite-sms",e)},r.getTopKeywords=function(t,n){var r="instance/"+t+"/top-search-keywords";return n&&(r+=e.stringify(n,"?")),this.post(r,n)},n}(i),c=function(t){function n(){return t.apply(this,arguments)||this}s(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}(i),a=function(t){function n(){return t.apply(this,arguments)||this}s(n,t);var r=n.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 n="customer/notifications";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getFavorites=function(t){var n="customer/favorite-products";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.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)},n}(i),p=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}(i),h=function(t){function n(){return t.apply(this,arguments)||this}s(n,t);var r=n.prototype;return r.getProduct=function(t){return this.get("product/"+t)},r.getProductFeatures=function(t){return this.get("product/"+t+"/features")},r.getSimilarProducts=function(t){return this.get("product/"+t+"/similar-products")},r.getProductChoices=function(t){return this.get("product/"+t+"/choices")},r.getProductReviews=function(t,n){var r="product/"+t+"/reviews";return n&&(r+=e.stringify(n,"?")),this.get(r)},r.getRatingOptions=function(t){return this.get("product/"+t+"/rating-options")},r.sendNewReview=function(t,e){return this.put("product/"+t+"/review",e)},r.reportReview=function(t,e){return this.post("product/"+t+"/review/"+e+"/report")},n}(i),f=function(t){function n(){return t.apply(this,arguments)||this}s(n,t);var r=n.prototype;return r.getCountries=function(t){var n="countries";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getIranProvinces=function(t){var n="countries/IR/states";return t&&(n+=e.stringify(t,"?")),this.get(n)},r.getStateCities=function(t,n){var r="countries/IR/states/"+t+"/cities";return n&&(r+=e.stringify(n,"?")),this.get(r)},n}(i);n.config();var d,g=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(i);return d=g,[u,c,o,a,p,h,f].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){Object.defineProperty(d.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})}),g}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "@tayeh/web-client", | ||
"version": "1.1.6-alpha", | ||
"version": "1.1.7-alpha", | ||
"description": "tayeh shop-api client", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
50460
194