@commercengine/storefront-sdk 0.3.4 → 0.3.5
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/lib/cart.d.ts +15 -1
- package/dist/lib/cart.js +22 -0
- package/dist/lib/shipping.d.ts +3 -3
- package/dist/lib/shipping.js +1 -1
- package/dist/types/storefront-api-types.d.ts +10 -7
- package/dist/types/storefront.d.ts +563 -209
- package/package.json +1 -1
package/dist/lib/cart.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StorefrontAPIClient } from "./client";
|
|
2
|
-
import type { AddToWishlistBody, AddToWishlistContent, AddToWishlistPathParams, ApiResult, ApplyCouponBody, ApplyCouponContent, ApplyCouponPathParams, CreateCartContent, CreateCartAddressBody, CreateCartAddressContent, CreateCartAddressPathParams, CreateCartBody, DeleteCartPathParams, DeleteCartResponse, DeleteFromWishlistBody, DeleteFromWishlistContent, DeleteFromWishlistPathParams, DeleteUserCartPathParams, DeleteUserCartResponse, GetCartContent, GetCartPathParams, GetUserCartContent, GetUserCartPathParams, GetWishlistContent, GetWishlistPathParams, RedeemCreditBalanceBody, RedeemCreditBalanceContent, RedeemCreditBalancePathParams, RedeemGiftCardBody, RedeemGiftCardContent, RedeemGiftCardPathParams, RedeemLoyaltyPointsBody, RedeemLoyaltyPointsContent, RedeemLoyaltyPointsPathParams, RemoveCouponContent, RemoveCouponPathParams, RemoveCreditBalanceContent, RemoveCreditBalancePathParams, RemoveGiftCardContent, RemoveGiftCardPathParams, RemoveLoyaltyPointsContent, RemoveLoyaltyPointsPathParams, UpdateCartBody, UpdateCartContent, UpdateCartPathParams, UpdateShippingMethodBody, UpdateShippingMethodContent, UpdateShippingMethodPathParams } from "../types/storefront-api-types";
|
|
2
|
+
import type { AddToWishlistBody, AddToWishlistContent, AddToWishlistPathParams, ApiResult, ApplyCouponBody, ApplyCouponContent, ApplyCouponPathParams, CreateCartContent, CreateCartAddressBody, CreateCartAddressContent, CreateCartAddressPathParams, CreateCartBody, DeleteCartPathParams, DeleteCartResponse, DeleteFromWishlistBody, DeleteFromWishlistContent, DeleteFromWishlistPathParams, DeleteUserCartPathParams, DeleteUserCartResponse, GetCartContent, GetCartPathParams, GetUserCartContent, GetUserCartPathParams, GetWishlistContent, GetWishlistPathParams, RedeemCreditBalanceBody, RedeemCreditBalanceContent, RedeemCreditBalancePathParams, RedeemGiftCardBody, RedeemGiftCardContent, RedeemGiftCardPathParams, RedeemLoyaltyPointsBody, RedeemLoyaltyPointsContent, RedeemLoyaltyPointsPathParams, RemoveCouponContent, RemoveCouponPathParams, RemoveCreditBalanceContent, RemoveCreditBalancePathParams, RemoveGiftCardContent, RemoveGiftCardPathParams, RemoveLoyaltyPointsContent, RemoveLoyaltyPointsPathParams, UpdateCartBody, UpdateCartContent, UpdateCartPathParams, UpdateShippingMethodBody, UpdateShippingMethodContent, UpdateShippingMethodPathParams, ListCouponsContent, ListPromotionsContent, ListCouponsHeaderParams, ListPromotionsHeaderParams } from "../types/storefront-api-types";
|
|
3
3
|
/**
|
|
4
4
|
* Client for interacting with cart endpoints
|
|
5
5
|
*/
|
|
@@ -146,4 +146,18 @@ export declare class CartClient extends StorefrontAPIClient {
|
|
|
146
146
|
* @returns Promise with updated wishlist
|
|
147
147
|
*/
|
|
148
148
|
removeFromWishlist(userId: DeleteFromWishlistPathParams, body: DeleteFromWishlistBody): Promise<ApiResult<DeleteFromWishlistContent>>;
|
|
149
|
+
/**
|
|
150
|
+
* Get all available coupons
|
|
151
|
+
*
|
|
152
|
+
* @param customerGroupId - The ID of the customer group
|
|
153
|
+
* @returns Promise with all available coupons
|
|
154
|
+
*/
|
|
155
|
+
getAvailableCoupons(headers: ListCouponsHeaderParams): Promise<ApiResult<ListCouponsContent>>;
|
|
156
|
+
/**
|
|
157
|
+
* Get all available promotions
|
|
158
|
+
*
|
|
159
|
+
* @param customerGroupId - The ID of the customer group
|
|
160
|
+
* @returns Promise with all available promotions
|
|
161
|
+
*/
|
|
162
|
+
getAvailablePromotions(headers: ListPromotionsHeaderParams): Promise<ApiResult<ListPromotionsContent>>;
|
|
149
163
|
}
|
package/dist/lib/cart.js
CHANGED
|
@@ -271,4 +271,26 @@ export class CartClient extends StorefrontAPIClient {
|
|
|
271
271
|
body: body,
|
|
272
272
|
}));
|
|
273
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* Get all available coupons
|
|
276
|
+
*
|
|
277
|
+
* @param customerGroupId - The ID of the customer group
|
|
278
|
+
* @returns Promise with all available coupons
|
|
279
|
+
*/
|
|
280
|
+
async getAvailableCoupons(headers) {
|
|
281
|
+
return this.executeRequest(() => this.client.GET("/carts/available-coupons", {
|
|
282
|
+
headers: headers,
|
|
283
|
+
}));
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Get all available promotions
|
|
287
|
+
*
|
|
288
|
+
* @param customerGroupId - The ID of the customer group
|
|
289
|
+
* @returns Promise with all available promotions
|
|
290
|
+
*/
|
|
291
|
+
async getAvailablePromotions(headers) {
|
|
292
|
+
return this.executeRequest(() => this.client.GET("/carts/available-promotions", {
|
|
293
|
+
headers: headers,
|
|
294
|
+
}));
|
|
295
|
+
}
|
|
274
296
|
}
|
package/dist/lib/shipping.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApiResult,
|
|
1
|
+
import type { ApiResult, CheckPincodeServiceabilityContent, CheckPincodeServiceabilityPathParams, GetShippingMethodsBody, GetShippingMethodsContent } from "../types/storefront-api-types";
|
|
2
2
|
import { StorefrontAPIClient } from "./client";
|
|
3
3
|
/**
|
|
4
4
|
* Client for interacting with shipping endpoints
|
|
@@ -10,12 +10,12 @@ export declare class ShippingClient extends StorefrontAPIClient {
|
|
|
10
10
|
* @param body - Shipping methods body
|
|
11
11
|
* @returns Promise with shipping options
|
|
12
12
|
*/
|
|
13
|
-
getShippingMethods(body:
|
|
13
|
+
getShippingMethods(body: GetShippingMethodsBody): Promise<ApiResult<GetShippingMethodsContent>>;
|
|
14
14
|
/**
|
|
15
15
|
* Check pincode deliverability
|
|
16
16
|
*
|
|
17
17
|
* @param pathParams - Path parameters
|
|
18
18
|
* @returns Promise with pincode deliverability result
|
|
19
19
|
*/
|
|
20
|
-
checkPincodeDeliverability(pathParams:
|
|
20
|
+
checkPincodeDeliverability(pathParams: CheckPincodeServiceabilityPathParams): Promise<ApiResult<CheckPincodeServiceabilityContent>>;
|
|
21
21
|
}
|
package/dist/lib/shipping.js
CHANGED
|
@@ -21,7 +21,7 @@ export class ShippingClient extends StorefrontAPIClient {
|
|
|
21
21
|
* @returns Promise with pincode deliverability result
|
|
22
22
|
*/
|
|
23
23
|
async checkPincodeDeliverability(pathParams) {
|
|
24
|
-
return this.executeRequest(() => this.client.GET("/
|
|
24
|
+
return this.executeRequest(() => this.client.GET("/shipping/serviceability/{pincode}", {
|
|
25
25
|
params: {
|
|
26
26
|
path: pathParams,
|
|
27
27
|
},
|
|
@@ -105,10 +105,12 @@ export type RedeemGiftCardBody = NonNullable<paths['/carts/{id}/gift-card']['pos
|
|
|
105
105
|
export type RemoveGiftCardResponse = paths['/carts/{id}/gift-card']['delete']['responses'][200]['content']['application/json'];
|
|
106
106
|
export type RemoveGiftCardContent = RemoveGiftCardResponse['content'];
|
|
107
107
|
export type RemoveGiftCardPathParams = paths['/carts/{id}/gift-card']['delete']['parameters']['path'];
|
|
108
|
-
export type ListCouponsResponse = paths['/
|
|
108
|
+
export type ListCouponsResponse = paths['/carts/available-coupons']['get']['responses'][200]['content']['application/json'];
|
|
109
109
|
export type ListCouponsContent = ListCouponsResponse['content'];
|
|
110
|
-
export type
|
|
110
|
+
export type ListCouponsHeaderParams = paths['/carts/available-coupons']['get']['parameters']['header'];
|
|
111
|
+
export type ListPromotionsResponse = paths['/carts/available-promotions']['get']['responses'][200]['content']['application/json'];
|
|
111
112
|
export type ListPromotionsContent = ListPromotionsResponse['content'];
|
|
113
|
+
export type ListPromotionsHeaderParams = paths['/carts/available-promotions']['get']['parameters']['header'];
|
|
112
114
|
export type GetWishlistResponse = paths['/wishlist/{user_id}']['get']['responses'][200]['content']['application/json'];
|
|
113
115
|
export type GetWishlistContent = GetWishlistResponse['content'];
|
|
114
116
|
export type GetWishlistPathParams = paths['/wishlist/{user_id}']['get']['parameters']['path'];
|
|
@@ -212,11 +214,12 @@ export type RetryOrderPaymentResponse = paths['/orders/{order_number}/retry-paym
|
|
|
212
214
|
export type RetryOrderPaymentContent = RetryOrderPaymentResponse['content'];
|
|
213
215
|
export type RetryOrderPaymentPathParams = paths['/orders/{order_number}/retry-payment']['post']['parameters']['path'];
|
|
214
216
|
export type RetryOrderPaymentBody = NonNullable<paths['/orders/{order_number}/retry-payment']['post']['requestBody']>['content']['application/json'];
|
|
215
|
-
export type
|
|
216
|
-
export type
|
|
217
|
-
export type
|
|
218
|
-
export type
|
|
219
|
-
export type
|
|
217
|
+
export type GetShippingMethodsResponse = paths['/shipping/shipping-methods']['post']['responses'][200]['content']['application/json'];
|
|
218
|
+
export type GetShippingMethodsContent = GetShippingMethodsResponse['content'];
|
|
219
|
+
export type GetShippingMethodsBody = NonNullable<paths['/shipping/shipping-methods']['post']['requestBody']>['content']['application/json'];
|
|
220
|
+
export type CheckPincodeServiceabilityResponse = paths['/shipping/serviceability/{pincode}']['get']['responses'][200]['content']['application/json'];
|
|
221
|
+
export type CheckPincodeServiceabilityContent = CheckPincodeServiceabilityResponse['content'];
|
|
222
|
+
export type CheckPincodeServiceabilityPathParams = paths['/shipping/serviceability/{pincode}']['get']['parameters']['path'];
|
|
220
223
|
export type GetAnonymousTokenResponse = paths['/auth/anonymous']['post']['responses'][200]['content']['application/json'];
|
|
221
224
|
export type GetAnonymousTokenContent = GetAnonymousTokenResponse['content'];
|
|
222
225
|
export type LoginWithPhoneResponse = paths['/auth/login/phone']['post']['responses'][200]['content']['application/json'];
|