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

@tayeh/web-client

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tayeh/web-client - npm Package Compare versions

Comparing version 1.1.2-alpha to 1.1.3-alpha

2

dist/index.js

@@ -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(){if(this.API_KEY=process.env.TAYEH_API_KEY,this.API_SECRET=process.env.TAYEH_API_SECRET,this.basePath=process.env.TAYEH_BASE_URL,this.authPath=process.env.TAYEH_AUTH_URL,this.mediaPath=process.env.TAYEH_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.");this.get_token()}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}},!0)).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.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,r){void 0===r&&(r=!1);try{var i=this.basePath+t,o={"Content-type":"application/json"};r||(o.Authorization="Bearer "+this.API_ACCESS);var a=s({headers:s({},o)},n);return Promise.resolve(e.get(i,a))}catch(t){return Promise.reject(t)}},n.get_auth=function(t,n,r){void 0===r&&(r=!1);try{var i=this.authPath+t,o={"Content-type":"application/json"};r||(o.Authorization="Bearer "+this.API_ACCESS);var a=s({headers:s({},o)},n);return Promise.resolve(e.get(i,a))}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)},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,this.authPath=process.env.TAYEH_AUTH_URL,this.mediaPath=process.env.TAYEH_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.");this.get_token()}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}},!0)).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.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,r){void 0===r&&(r=!1);try{var i=this.basePath+t,o={"Content-type":"application/json"};r||(o.Authorization="Bearer "+this.API_ACCESS);var a=s({headers:s({},o)},n);return Promise.resolve(e.get(i,a))}catch(t){return Promise.reject(t)}},n.get_auth=function(t,n,r){void 0===r&&(r=!1);try{var i=this.authPath+t,o={"Content-type":"application/json"};r||(o.Authorization="Bearer "+this.API_ACCESS);var a=s({headers:s({},o)},n);return Promise.resolve(e.get(i,a))}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)},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;
//# 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(){if(this.API_KEY=process.env.TAYEH_API_KEY,this.API_SECRET=process.env.TAYEH_API_SECRET,this.basePath=process.env.TAYEH_BASE_URL,this.authPath=process.env.TAYEH_AUTH_URL,this.mediaPath=process.env.TAYEH_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.");this.get_token()}async get_token(){try{const{access_token:t}=(await this.get_auth("api/token",{auth:{username:this.API_KEY,password:this.API_SECRET}},!0)).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 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,n=!1){const r=this.basePath+e,a={"Content-type":"application/json"};n||(a.Authorization="Bearer "+this.API_ACCESS);const i={headers:{...a},...s};return await t.get(r,i)}async get_auth(e,s,n=!1){const r=this.authPath+e,a={"Content-type":"application/json"};n||(a.Authorization="Bearer "+this.API_ACCESS);const i={headers:{...a},...s};return await t.get(r,i)}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)}},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 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,this.authPath=process.env.TAYEH_AUTH_URL,this.mediaPath=process.env.TAYEH_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.");this.get_token()}async get_token(){try{const{access_token:t}=(await this.get_auth("api/token",{auth:{username:this.API_KEY,password:this.API_SECRET}},!0)).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 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,n=!1){const r=this.basePath+e,a={"Content-type":"application/json"};n||(a.Authorization="Bearer "+this.API_ACCESS);const i={headers:{...a},...s};return await t.get(r,i)}async get_auth(e,s,n=!1){const r=this.authPath+e,a={"Content-type":"application/json"};n||(a.Authorization="Bearer "+this.API_ACCESS);const i={headers:{...a},...s};return await t.get(r,i)}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)}},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;
//# 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(){if(this.API_KEY=process.env.TAYEH_API_KEY,this.API_SECRET=process.env.TAYEH_API_SECRET,this.basePath=process.env.TAYEH_BASE_URL,this.authPath=process.env.TAYEH_AUTH_URL,this.mediaPath=process.env.TAYEH_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.");this.get_token()}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}},!0)).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.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,s){void 0===s&&(s=!1);try{var i=this.basePath+e,o={"Content-type":"application/json"};s||(o.Authorization="Bearer "+this.API_ACCESS);var a=r({headers:r({},o)},n);return Promise.resolve(t.get(i,a))}catch(t){return Promise.reject(t)}},n.get_auth=function(e,n,s){void 0===s&&(s=!1);try{var i=this.authPath+e,o={"Content-type":"application/json"};s||(o.Authorization="Bearer "+this.API_ACCESS);var a=r({headers:r({},o)},n);return Promise.resolve(t.get(i,a))}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)},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,this.authPath=process.env.TAYEH_AUTH_URL,this.mediaPath=process.env.TAYEH_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.");this.get_token()}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}},!0)).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.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,s){void 0===s&&(s=!1);try{var i=this.basePath+e,o={"Content-type":"application/json"};s||(o.Authorization="Bearer "+this.API_ACCESS);var a=r({headers:r({},o)},n);return Promise.resolve(t.get(i,a))}catch(t){return Promise.reject(t)}},n.get_auth=function(e,n,s){void 0===s&&(s=!1);try{var i=this.authPath+e,o={"Content-type":"application/json"};s||(o.Authorization="Bearer "+this.API_ACCESS);var a=r({headers:r({},o)},n);return Promise.resolve(t.get(i,a))}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)},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;
//# 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(){if(this.API_KEY=process.env.TAYEH_API_KEY,this.API_SECRET=process.env.TAYEH_API_SECRET,this.basePath=process.env.TAYEH_BASE_URL,this.authPath=process.env.TAYEH_AUTH_URL,this.mediaPath=process.env.TAYEH_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.");this.get_token()}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}},!0)).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.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,s){void 0===s&&(s=!1);try{var i=this.basePath+e,o={"Content-type":"application/json"};s||(o.Authorization="Bearer "+this.API_ACCESS);var a=r({headers:r({},o)},n);return Promise.resolve(t.get(i,a))}catch(t){return Promise.reject(t)}},n.get_auth=function(e,n,s){void 0===s&&(s=!1);try{var i=this.authPath+e,o={"Content-type":"application/json"};s||(o.Authorization="Bearer "+this.API_ACCESS);var a=r({headers:r({},o)},n);return Promise.resolve(t.get(i,a))}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)},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,this.authPath=process.env.TAYEH_AUTH_URL,this.mediaPath=process.env.TAYEH_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.");this.get_token()}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}},!0)).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.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,s){void 0===s&&(s=!1);try{var i=this.basePath+e,o={"Content-type":"application/json"};s||(o.Authorization="Bearer "+this.API_ACCESS);var a=r({headers:r({},o)},n);return Promise.resolve(t.get(i,a))}catch(t){return Promise.reject(t)}},n.get_auth=function(e,n,s){void 0===s&&(s=!1);try{var i=this.authPath+e,o={"Content-type":"application/json"};s||(o.Authorization="Bearer "+this.API_ACCESS);var a=r({headers:r({},o)},n);return Promise.resolve(t.get(i,a))}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)},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});
//# sourceMappingURL=index.umd.js.map
{
"name": "@tayeh/web-client",
"version": "1.1.2-alpha",
"version": "1.1.3-alpha",
"description": "tayeh shop-api client",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc