@zenky/storefront-api 0.0.42 → 0.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts
CHANGED
|
@@ -1043,8 +1043,8 @@ export interface CloudpaymentsPaymentMeta {
|
|
|
1043
1043
|
charge_type: CloudpaymentsChargeType;
|
|
1044
1044
|
charged_as: CloudpaymentsChargeType | null;
|
|
1045
1045
|
}
|
|
1046
|
-
export interface
|
|
1047
|
-
redirect_url: string;
|
|
1046
|
+
export interface OnlinePaymentRedirect {
|
|
1047
|
+
redirect_url: string | null;
|
|
1048
1048
|
}
|
|
1049
1049
|
export interface OrderPaymentTransaction {
|
|
1050
1050
|
id: string;
|
|
@@ -1059,7 +1059,7 @@ export interface OrderPaymentTransaction {
|
|
|
1059
1059
|
cancelled_at: string | null;
|
|
1060
1060
|
refunded_at: string | null;
|
|
1061
1061
|
refund_failed_at: string | null;
|
|
1062
|
-
transaction_meta: CashPaymentMeta | CloudpaymentsPaymentMeta |
|
|
1062
|
+
transaction_meta: CashPaymentMeta | CloudpaymentsPaymentMeta | null;
|
|
1063
1063
|
}
|
|
1064
1064
|
export interface CloudpaymentsTransactionReceipt {
|
|
1065
1065
|
items: {
|
|
@@ -1323,6 +1323,9 @@ export interface OrderPromocode {
|
|
|
1323
1323
|
promocode: string;
|
|
1324
1324
|
message: string;
|
|
1325
1325
|
}
|
|
1326
|
+
export interface OnlinePaymentRedirectRequest {
|
|
1327
|
+
current_url?: string;
|
|
1328
|
+
}
|
|
1326
1329
|
export declare class OrdersResource extends AbstractResource {
|
|
1327
1330
|
protected getOrderUrl(storeId: string, credentials: OrderCredentials, path: string, request?: any): string;
|
|
1328
1331
|
protected getApiToken(credentials: OrderCredentials): undefined | string;
|
|
@@ -1350,6 +1353,7 @@ export declare class OrdersResource extends AbstractResource {
|
|
|
1350
1353
|
dispatchPromotionsChecker(storeId: string, credentials: OrderCredentials): Promise<boolean>;
|
|
1351
1354
|
getOrderPromotionRewards(storeId: string, credentials: OrderCredentials): Promise<OrderPromotionReward>;
|
|
1352
1355
|
getCloudpaymentsReceipt(storeId: string, credentials: OrderCredentials, transactionId: string): Promise<CloudpaymentsTransactionReceipt>;
|
|
1356
|
+
getOnlinePaymentRedirect(storeId: string, credentials: OrderCredentials, transactionId: string, request?: OnlinePaymentRedirectRequest): Promise<OnlinePaymentRedirect | null>;
|
|
1353
1357
|
}
|
|
1354
1358
|
declare class AddressesResource extends AbstractResource {
|
|
1355
1359
|
getAddressSuggestions(storeId: string, request: AddressSuggestionsRequest): Promise<AddressSuggestions>;
|
|
@@ -347,6 +347,12 @@ class $ extends d {
|
|
|
347
347
|
await this.client.request("GET", n, void 0, this.getApiToken(e))
|
|
348
348
|
);
|
|
349
349
|
}
|
|
350
|
+
async getOnlinePaymentRedirect(t, e, s, n) {
|
|
351
|
+
const i = this.getOrderUrl(t, e, `/payments/${s}/redirect`, n);
|
|
352
|
+
return this.getResponse(
|
|
353
|
+
await this.client.request("GET", i, void 0, this.getApiToken(e))
|
|
354
|
+
);
|
|
355
|
+
}
|
|
350
356
|
}
|
|
351
357
|
class D extends d {
|
|
352
358
|
async getAddressSuggestions(t, e) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(i,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(i=typeof globalThis<"u"?globalThis:i||self,p(i.zenkyStorefrontApi={}))})(this,function(i){"use strict";var ke=Object.defineProperty;var Oe=(i,p,h)=>p in i?ke(i,p,{enumerable:!0,configurable:!0,writable:!0,value:h}):i[p]=h;var c=(i,p,h)=>(Oe(i,typeof p!="symbol"?p+"":p,h),h);var p=(s=>(s.DADATA="dadata",s))(p||{});class h{constructor(t){this.client=t}getStoreUrl(t,e,r={}){return this.client.getStoreUrl(t,e,r)}getPaginatedResponse(t){if(!t||!Array.isArray(t.data)||!t.meta||!t.meta.pagination)throw new Error("getPaginatedResponse(): Invalid response.");const e=t.data,r=t.meta.pagination;return{items:e,pagination:r}}getResponse(t){if(!t||!t.data)throw new Error("getResponse(): Invalid response.");return t.data}}class U extends h{async getArticleCategories(t){const e=this.getStoreUrl(t,"/articles/categories");return this.getPaginatedResponse(await this.client.request("GET",e))}async getArticleCategory(t,e){const r=this.getStoreUrl(t,`/articles/categories/${e}`);return this.getResponse(await this.client.request("GET",r))}async getArticles(t,e){const r=this.getStoreUrl(t,"/articles",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getArticle(t,e,r){const n=this.getStoreUrl(t,`/articles/${e}`,r);return this.getResponse(await this.client.request("GET",n))}}class S extends h{async getRemoteCatalog(t,e){const r=this.getStoreUrl(t,"/catalog",e);return this.getResponse(await this.client.request("GET",r))}async getCatalogFromRemoteUrl(t,e){const r=await this.getRemoteCatalog(t,e);return this.getResponse(await this.client.request("GET",r.url))}}class T extends h{async getCategories(t,e){const r=this.getStoreUrl(t,"/categories",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getCategoriesTree(t,e){const r=this.getStoreUrl(t,"/categories/tree",e);return this.getResponse(await this.client.request("GET",r))}async getCategory(t,e,r){const n=this.getStoreUrl(t,`/categories/${e}`,r);return this.getResponse(await this.client.request("GET",n))}async getFeaturesGroups(t,e){const r=this.getStoreUrl(t,`/categories/${e}/features/groups`);return this.getResponse(await this.client.request("GET",r))}async getFeatures(t,e){const r=this.getStoreUrl(t,`/categories/${e}/features`);return this.getResponse(await this.client.request("GET",r))}}class O extends Error{constructor(e,r){super(e);c(this,"err");this.err=r}}class q{static async build(t){const e=await t.json();switch(t.status){case 401:return new O((e==null?void 0:e.message)??"Unauthenticated.",null);default:return new O(e==null?void 0:e.message,(e==null?void 0:e.error)||null)}}}class R{constructor(t,e,r,n,a,o,l){c(this,"baseUrl");c(this,"baseAuthUrl");c(this,"token");c(this,"client");c(this,"timezone");c(this,"fetchFunction");c(this,"fetchOptions");this.baseUrl=t,this.baseAuthUrl=e,this.token=r,this.client=n,this.timezone=a,this.fetchFunction=typeof o=="function"?o:fetch,this.fetchOptions=typeof l<"u"?l:{}}static build(t,e){return new R((t==null?void 0:t.baseUrl)||"https://storefront.zenky.io/v1",(t==null?void 0:t.baseAuthUrl)||"https://auth.zenky.io/",(t==null?void 0:t.token)||null,(t==null?void 0:t.client)||"web",(t==null?void 0:t.timezone)||"UTC",e,t==null?void 0:t.fetchOptions)}setToken(t){return this.token=t,this}getBaseAuthUrl(){return this.baseAuthUrl}getStoreUrl(t,e,r={}){return this.getUrl(`/store/${t}${e}`,r)}getUrl(t,e={}){if(!Object.keys(e).length)return t;const r=[];Object.keys(e).forEach(a=>{e[a]===void 0||e[a]===null||r.push(`${a}=${e[a]}`)});const n=t.includes("?")?"&":"?";return`${t}${n}${r.join("&")}`}async request(t,e,r,n){const a=!e.startsWith("/"),o={Accept:"application/json","X-Zenky-Client":this.client,"X-Timezone":this.timezone};n?o.Authorization=`Bearer ${n}`:this.token&&(o.Authorization=`Bearer ${this.token}`);const l={method:t,mode:"cors",...this.fetchOptions};r&&(o["Content-Type"]="application/json",l.body=JSON.stringify(r)),l.headers=a?{Accept:"application/json"}:o;const g=a?e:`${this.baseUrl}${e}`,u=await this.fetchFunction.call(null,g,l);if(u.ok)return u.status===204?!0:u.json();throw await q.build(u)}}class A extends h{async getStore(t){const e=this.client.getUrl(`/store/${t}`);return this.getResponse(await this.client.request("GET",e))}async getStoreByBundleId(t){const e=this.client.getUrl(`/store/by-bundle/${t}`);return this.getResponse(await this.client.request("GET",e))}}class b extends h{async getCollections(t,e){const r=this.getStoreUrl(t,"/collections",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getCollection(t,e){const r=this.getStoreUrl(t,`/collections/${e}`);return this.getResponse(await this.client.request("GET",r))}}class C extends h{async getOffers(t,e){const r=this.getStoreUrl(t,"/offers",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getOffer(t,e,r){const n=this.getStoreUrl(t,`/offers/${e}`,r);return this.getResponse(await this.client.request("GET",n))}}class _ extends h{async createFeedback(t,e){const r=this.getStoreUrl(t,"/feedback",e);return this.getResponse(await this.client.request("POST",r))}async createCallback(t,e){const r=this.getStoreUrl(t,"/callback",e);return await this.client.request("POST",r),!0}}class N extends h{async getProducts(t,e){const r=this.getStoreUrl(t,"/products",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getProduct(t,e,r){const n=this.getStoreUrl(t,`/products/${e}`,r);return this.getResponse(await this.client.request("GET",n))}async getProductVariantPrice(t,e,r,n){const a=this.getStoreUrl(t,`/products/${e}/variants/${r}/price`);return this.getResponse(await this.client.request("POST",a,n))}}class G extends h{getOrderUrl(t,e,r,n){const a=typeof e=="string"?e:e.id,o=typeof e=="string"?void 0:e.token;return this.getStoreUrl(t,`/orders/${a}${r}${o?"?token="+o:""}`,n)}getApiToken(t){if(!(typeof t=="string"||typeof t.api_token>"u"))return t.api_token}async getOrders(t,e,r){const n=this.getStoreUrl(t,"/orders",e);return this.getPaginatedResponse(await this.client.request("GET",n,void 0,r))}async createOrder(t,e,r){const n=this.getStoreUrl(t,"/orders");return this.getResponse(await this.client.request("POST",n,e,r))}async getOrder(t,e,r){const n=this.getOrderUrl(t,e,"",r);return this.getResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}async getOrderSettings(t,e){const r=this.getOrderUrl(t,e,"/settings");return this.getResponse(await this.client.request("GET",r,void 0,this.getApiToken(e)))}async addProductVariantToOrder(t,e,r){const n=this.getOrderUrl(t,e,"/products");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async removeProductVariantFromOrder(t,e,r){const n=this.getOrderUrl(t,e,"/products/remove");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async checkProducts(t,e){const r=this.getOrderUrl(t,e,"/products/check");return this.getResponse(await this.client.request("POST",r,void 0,this.getApiToken(e)))}async getOrderCheckoutUrl(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/url");return this.getResponse(await this.client.request("POST",n,{redirect_url:r},this.getApiToken(e))).url}async setOrderCustomer(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/customer");return await this.client.request("POST",n,r,this.getApiToken(e)),!0}async setOrderDeliveryMethod(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/delivery");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async setOrderPayments(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/payments");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async getOrderPromocode(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/promocode");return this.getResponse(await this.client.request("GET",n,r,this.getApiToken(e)))}async setOrderPromocode(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/promocode");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async removeOrderPromocode(t,e){const r=this.getOrderUrl(t,e,"/checkout/promocode");return await this.client.request("DELETE",r,null,this.getApiToken(e)),!0}async getOrderBonusesPreview(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/payments/bonuses",{amount:r});return this.getResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}async getOrderTotal(t,e){const r=this.getOrderUrl(t,e,"/checkout/total");return this.getResponse(await this.client.request("GET",r,void 0,this.getApiToken(e)))}async checkoutOrder(t,e,r){const n=this.getOrderUrl(t,e,"/checkout");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async confirmOrder(t,e,r){const n=this.getOrderUrl(t,e,"/confirm");return await this.client.request("POST",n,r,this.getApiToken(e)),!0}async resendOrderConfirmationCode(t,e){const r=this.getOrderUrl(t,e,"/confirm/resend");return await this.client.request("POST",r,void 0,this.getApiToken(e)),!0}async getOrderBonusesTransactions(t,e,r){const n=this.getOrderUrl(t,e,"/loyalty/transactions",r);return this.getPaginatedResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}async getOrderCashbackTransaction(t,e){const r=this.getOrderUrl(t,e,"/loyalty/transactions/cashback");return this.getResponse(await this.client.request("GET",r,void 0,this.getApiToken(e)))}async dispatchPromotionsChecker(t,e){const r=this.getOrderUrl(t,e,"/loyalty/promotions/check");return this.getResponse(await this.client.request("POST",r,void 0,this.getApiToken(e))).dispatched}async getOrderPromotionRewards(t,e){const r=this.getOrderUrl(t,e,"/loyalty/promotions/rewards");return this.getResponse(await this.client.request("GET",r,void 0,this.getApiToken(e)))}async getCloudpaymentsReceipt(t,e,r){const n=this.getOrderUrl(t,e,`/payments/${r}/receipt`);return this.getResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}}class le extends h{async getAddressSuggestions(t,e){const r=this.getStoreUrl(t,"/suggestions/address");return this.getResponse(await this.client.request("POST",r,e))}}class ce extends h{async getProfile(t,e,r){const n=this.getStoreUrl(t,"/me",e);return this.getResponse(await this.client.request("GET",n,null,r))}async updateProfile(t,e,r){const n=this.getStoreUrl(t,"/me");return this.getResponse(await this.client.request("PUT",n,e,r))}async removeProfile(t,e,r){const n=this.getStoreUrl(t,"/me");return await this.client.request("DELETE",n,e,r),!0}async getSettings(t,e){const r=this.getStoreUrl(t,"/me/settings");return this.getResponse(await this.client.request("GET",r,null,e))}async updateSettings(t,e,r){const n=this.getStoreUrl(t,"/me/settings");return this.getResponse(await this.client.request("PUT",n,e,r))}async getAddresses(t,e,r){const n=this.getStoreUrl(t,"/me/addresses",e);return this.getPaginatedResponse(await this.client.request("GET",n,null,r))}async createAddress(t,e,r){const n=this.getStoreUrl(t,"/me/addresses");return this.getResponse(await this.client.request("POST",n,e,r))}async updateAddress(t,e,r,n){const a=this.getStoreUrl(t,`/me/addresses/${e}`);return this.getResponse(await this.client.request("PUT",a,r,n))}async deleteAddress(t,e,r){const n=this.getStoreUrl(t,`/me/addresses/${e}`);return await this.client.request("DELETE",n,null,r),!0}async getPaymentMethods(t,e,r){const n=this.getStoreUrl(t,"/me/payment-methods",e);return this.getPaginatedResponse(await this.client.request("GET",n,null,r))}async deletePaymentMethod(t,e,r){const n=this.getStoreUrl(t,`/me/payment-methods/${e}`);return await this.client.request("DELETE",n,null,r),!0}async getBonusesTransactions(t,e,r){const n=this.getStoreUrl(t,"/me/loyalty/transactions",e);return this.getPaginatedResponse(await this.client.request("GET",n,null,r))}async getBonusesBalance(t,e){const r=this.getStoreUrl(t,"/me/loyalty/balance");return this.getResponse(await this.client.request("GET",r,null,e))}async revokeToken(t,e){const r=this.getStoreUrl(t,"/me/logout");return await this.client.request("POST",r,null,e),!0}}/**
|
|
1
|
+
(function(i,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(i=typeof globalThis<"u"?globalThis:i||self,p(i.zenkyStorefrontApi={}))})(this,function(i){"use strict";var ke=Object.defineProperty;var Oe=(i,p,h)=>p in i?ke(i,p,{enumerable:!0,configurable:!0,writable:!0,value:h}):i[p]=h;var c=(i,p,h)=>(Oe(i,typeof p!="symbol"?p+"":p,h),h);var p=(s=>(s.DADATA="dadata",s))(p||{});class h{constructor(t){this.client=t}getStoreUrl(t,e,r={}){return this.client.getStoreUrl(t,e,r)}getPaginatedResponse(t){if(!t||!Array.isArray(t.data)||!t.meta||!t.meta.pagination)throw new Error("getPaginatedResponse(): Invalid response.");const e=t.data,r=t.meta.pagination;return{items:e,pagination:r}}getResponse(t){if(!t||!t.data)throw new Error("getResponse(): Invalid response.");return t.data}}class U extends h{async getArticleCategories(t){const e=this.getStoreUrl(t,"/articles/categories");return this.getPaginatedResponse(await this.client.request("GET",e))}async getArticleCategory(t,e){const r=this.getStoreUrl(t,`/articles/categories/${e}`);return this.getResponse(await this.client.request("GET",r))}async getArticles(t,e){const r=this.getStoreUrl(t,"/articles",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getArticle(t,e,r){const n=this.getStoreUrl(t,`/articles/${e}`,r);return this.getResponse(await this.client.request("GET",n))}}class S extends h{async getRemoteCatalog(t,e){const r=this.getStoreUrl(t,"/catalog",e);return this.getResponse(await this.client.request("GET",r))}async getCatalogFromRemoteUrl(t,e){const r=await this.getRemoteCatalog(t,e);return this.getResponse(await this.client.request("GET",r.url))}}class T extends h{async getCategories(t,e){const r=this.getStoreUrl(t,"/categories",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getCategoriesTree(t,e){const r=this.getStoreUrl(t,"/categories/tree",e);return this.getResponse(await this.client.request("GET",r))}async getCategory(t,e,r){const n=this.getStoreUrl(t,`/categories/${e}`,r);return this.getResponse(await this.client.request("GET",n))}async getFeaturesGroups(t,e){const r=this.getStoreUrl(t,`/categories/${e}/features/groups`);return this.getResponse(await this.client.request("GET",r))}async getFeatures(t,e){const r=this.getStoreUrl(t,`/categories/${e}/features`);return this.getResponse(await this.client.request("GET",r))}}class O extends Error{constructor(e,r){super(e);c(this,"err");this.err=r}}class q{static async build(t){const e=await t.json();switch(t.status){case 401:return new O((e==null?void 0:e.message)??"Unauthenticated.",null);default:return new O(e==null?void 0:e.message,(e==null?void 0:e.error)||null)}}}class R{constructor(t,e,r,n,a,o,l){c(this,"baseUrl");c(this,"baseAuthUrl");c(this,"token");c(this,"client");c(this,"timezone");c(this,"fetchFunction");c(this,"fetchOptions");this.baseUrl=t,this.baseAuthUrl=e,this.token=r,this.client=n,this.timezone=a,this.fetchFunction=typeof o=="function"?o:fetch,this.fetchOptions=typeof l<"u"?l:{}}static build(t,e){return new R((t==null?void 0:t.baseUrl)||"https://storefront.zenky.io/v1",(t==null?void 0:t.baseAuthUrl)||"https://auth.zenky.io/",(t==null?void 0:t.token)||null,(t==null?void 0:t.client)||"web",(t==null?void 0:t.timezone)||"UTC",e,t==null?void 0:t.fetchOptions)}setToken(t){return this.token=t,this}getBaseAuthUrl(){return this.baseAuthUrl}getStoreUrl(t,e,r={}){return this.getUrl(`/store/${t}${e}`,r)}getUrl(t,e={}){if(!Object.keys(e).length)return t;const r=[];Object.keys(e).forEach(a=>{e[a]===void 0||e[a]===null||r.push(`${a}=${e[a]}`)});const n=t.includes("?")?"&":"?";return`${t}${n}${r.join("&")}`}async request(t,e,r,n){const a=!e.startsWith("/"),o={Accept:"application/json","X-Zenky-Client":this.client,"X-Timezone":this.timezone};n?o.Authorization=`Bearer ${n}`:this.token&&(o.Authorization=`Bearer ${this.token}`);const l={method:t,mode:"cors",...this.fetchOptions};r&&(o["Content-Type"]="application/json",l.body=JSON.stringify(r)),l.headers=a?{Accept:"application/json"}:o;const g=a?e:`${this.baseUrl}${e}`,u=await this.fetchFunction.call(null,g,l);if(u.ok)return u.status===204?!0:u.json();throw await q.build(u)}}class A extends h{async getStore(t){const e=this.client.getUrl(`/store/${t}`);return this.getResponse(await this.client.request("GET",e))}async getStoreByBundleId(t){const e=this.client.getUrl(`/store/by-bundle/${t}`);return this.getResponse(await this.client.request("GET",e))}}class b extends h{async getCollections(t,e){const r=this.getStoreUrl(t,"/collections",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getCollection(t,e){const r=this.getStoreUrl(t,`/collections/${e}`);return this.getResponse(await this.client.request("GET",r))}}class C extends h{async getOffers(t,e){const r=this.getStoreUrl(t,"/offers",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getOffer(t,e,r){const n=this.getStoreUrl(t,`/offers/${e}`,r);return this.getResponse(await this.client.request("GET",n))}}class _ extends h{async createFeedback(t,e){const r=this.getStoreUrl(t,"/feedback",e);return this.getResponse(await this.client.request("POST",r))}async createCallback(t,e){const r=this.getStoreUrl(t,"/callback",e);return await this.client.request("POST",r),!0}}class N extends h{async getProducts(t,e){const r=this.getStoreUrl(t,"/products",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getProduct(t,e,r){const n=this.getStoreUrl(t,`/products/${e}`,r);return this.getResponse(await this.client.request("GET",n))}async getProductVariantPrice(t,e,r,n){const a=this.getStoreUrl(t,`/products/${e}/variants/${r}/price`);return this.getResponse(await this.client.request("POST",a,n))}}class G extends h{getOrderUrl(t,e,r,n){const a=typeof e=="string"?e:e.id,o=typeof e=="string"?void 0:e.token;return this.getStoreUrl(t,`/orders/${a}${r}${o?"?token="+o:""}`,n)}getApiToken(t){if(!(typeof t=="string"||typeof t.api_token>"u"))return t.api_token}async getOrders(t,e,r){const n=this.getStoreUrl(t,"/orders",e);return this.getPaginatedResponse(await this.client.request("GET",n,void 0,r))}async createOrder(t,e,r){const n=this.getStoreUrl(t,"/orders");return this.getResponse(await this.client.request("POST",n,e,r))}async getOrder(t,e,r){const n=this.getOrderUrl(t,e,"",r);return this.getResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}async getOrderSettings(t,e){const r=this.getOrderUrl(t,e,"/settings");return this.getResponse(await this.client.request("GET",r,void 0,this.getApiToken(e)))}async addProductVariantToOrder(t,e,r){const n=this.getOrderUrl(t,e,"/products");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async removeProductVariantFromOrder(t,e,r){const n=this.getOrderUrl(t,e,"/products/remove");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async checkProducts(t,e){const r=this.getOrderUrl(t,e,"/products/check");return this.getResponse(await this.client.request("POST",r,void 0,this.getApiToken(e)))}async getOrderCheckoutUrl(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/url");return this.getResponse(await this.client.request("POST",n,{redirect_url:r},this.getApiToken(e))).url}async setOrderCustomer(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/customer");return await this.client.request("POST",n,r,this.getApiToken(e)),!0}async setOrderDeliveryMethod(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/delivery");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async setOrderPayments(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/payments");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async getOrderPromocode(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/promocode");return this.getResponse(await this.client.request("GET",n,r,this.getApiToken(e)))}async setOrderPromocode(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/promocode");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async removeOrderPromocode(t,e){const r=this.getOrderUrl(t,e,"/checkout/promocode");return await this.client.request("DELETE",r,null,this.getApiToken(e)),!0}async getOrderBonusesPreview(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/payments/bonuses",{amount:r});return this.getResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}async getOrderTotal(t,e){const r=this.getOrderUrl(t,e,"/checkout/total");return this.getResponse(await this.client.request("GET",r,void 0,this.getApiToken(e)))}async checkoutOrder(t,e,r){const n=this.getOrderUrl(t,e,"/checkout");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async confirmOrder(t,e,r){const n=this.getOrderUrl(t,e,"/confirm");return await this.client.request("POST",n,r,this.getApiToken(e)),!0}async resendOrderConfirmationCode(t,e){const r=this.getOrderUrl(t,e,"/confirm/resend");return await this.client.request("POST",r,void 0,this.getApiToken(e)),!0}async getOrderBonusesTransactions(t,e,r){const n=this.getOrderUrl(t,e,"/loyalty/transactions",r);return this.getPaginatedResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}async getOrderCashbackTransaction(t,e){const r=this.getOrderUrl(t,e,"/loyalty/transactions/cashback");return this.getResponse(await this.client.request("GET",r,void 0,this.getApiToken(e)))}async dispatchPromotionsChecker(t,e){const r=this.getOrderUrl(t,e,"/loyalty/promotions/check");return this.getResponse(await this.client.request("POST",r,void 0,this.getApiToken(e))).dispatched}async getOrderPromotionRewards(t,e){const r=this.getOrderUrl(t,e,"/loyalty/promotions/rewards");return this.getResponse(await this.client.request("GET",r,void 0,this.getApiToken(e)))}async getCloudpaymentsReceipt(t,e,r){const n=this.getOrderUrl(t,e,`/payments/${r}/receipt`);return this.getResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}async getOnlinePaymentRedirect(t,e,r,n){const a=this.getOrderUrl(t,e,`/payments/${r}/redirect`,n);return this.getResponse(await this.client.request("GET",a,void 0,this.getApiToken(e)))}}class le extends h{async getAddressSuggestions(t,e){const r=this.getStoreUrl(t,"/suggestions/address");return this.getResponse(await this.client.request("POST",r,e))}}class ce extends h{async getProfile(t,e,r){const n=this.getStoreUrl(t,"/me",e);return this.getResponse(await this.client.request("GET",n,null,r))}async updateProfile(t,e,r){const n=this.getStoreUrl(t,"/me");return this.getResponse(await this.client.request("PUT",n,e,r))}async removeProfile(t,e,r){const n=this.getStoreUrl(t,"/me");return await this.client.request("DELETE",n,e,r),!0}async getSettings(t,e){const r=this.getStoreUrl(t,"/me/settings");return this.getResponse(await this.client.request("GET",r,null,e))}async updateSettings(t,e,r){const n=this.getStoreUrl(t,"/me/settings");return this.getResponse(await this.client.request("PUT",n,e,r))}async getAddresses(t,e,r){const n=this.getStoreUrl(t,"/me/addresses",e);return this.getPaginatedResponse(await this.client.request("GET",n,null,r))}async createAddress(t,e,r){const n=this.getStoreUrl(t,"/me/addresses");return this.getResponse(await this.client.request("POST",n,e,r))}async updateAddress(t,e,r,n){const a=this.getStoreUrl(t,`/me/addresses/${e}`);return this.getResponse(await this.client.request("PUT",a,r,n))}async deleteAddress(t,e,r){const n=this.getStoreUrl(t,`/me/addresses/${e}`);return await this.client.request("DELETE",n,null,r),!0}async getPaymentMethods(t,e,r){const n=this.getStoreUrl(t,"/me/payment-methods",e);return this.getPaginatedResponse(await this.client.request("GET",n,null,r))}async deletePaymentMethod(t,e,r){const n=this.getStoreUrl(t,`/me/payment-methods/${e}`);return await this.client.request("DELETE",n,null,r),!0}async getBonusesTransactions(t,e,r){const n=this.getStoreUrl(t,"/me/loyalty/transactions",e);return this.getPaginatedResponse(await this.client.request("GET",n,null,r))}async getBonusesBalance(t,e){const r=this.getStoreUrl(t,"/me/loyalty/balance");return this.getResponse(await this.client.request("GET",r,null,e))}async revokeToken(t,e){const r=this.getStoreUrl(t,"/me/logout");return await this.client.request("POST",r,null,e),!0}}/**
|
|
2
2
|
postmate - A powerful, simple, promise-based postMessage library
|
|
3
3
|
@version v1.5.2
|
|
4
4
|
@link https://github.com/dollarshaveclub/postmate
|