@commercengine/storefront-sdk 0.3.2 → 0.3.4
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/client.js
CHANGED
|
@@ -223,7 +223,11 @@ export class StorefrontAPIClient {
|
|
|
223
223
|
if (error) {
|
|
224
224
|
return { data: null, error };
|
|
225
225
|
}
|
|
226
|
-
//
|
|
226
|
+
// If response has content, return it directly
|
|
227
|
+
if (data && data.content !== undefined) {
|
|
228
|
+
return { data: data.content, error: null };
|
|
229
|
+
}
|
|
230
|
+
// If no content, return the response object (with message, success, etc.)
|
|
227
231
|
return { data: data, error: null };
|
|
228
232
|
}
|
|
229
233
|
catch (err) {
|
package/dist/lib/shipping.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApiResult, ShippingMethodsBody, ShippingMethodsContent } from "../types/storefront-api-types";
|
|
1
|
+
import type { ApiResult, CheckDeliveryAvailabilityPathParams, CheckDeliveryAvailabilityResponse, ShippingMethodsBody, ShippingMethodsContent } from "../types/storefront-api-types";
|
|
2
2
|
import { StorefrontAPIClient } from "./client";
|
|
3
3
|
/**
|
|
4
4
|
* Client for interacting with shipping endpoints
|
|
@@ -11,4 +11,11 @@ export declare class ShippingClient extends StorefrontAPIClient {
|
|
|
11
11
|
* @returns Promise with shipping options
|
|
12
12
|
*/
|
|
13
13
|
getShippingMethods(body: ShippingMethodsBody): Promise<ApiResult<ShippingMethodsContent>>;
|
|
14
|
+
/**
|
|
15
|
+
* Check pincode deliverability
|
|
16
|
+
*
|
|
17
|
+
* @param pathParams - Path parameters
|
|
18
|
+
* @returns Promise with pincode deliverability result
|
|
19
|
+
*/
|
|
20
|
+
checkPincodeDeliverability(pathParams: CheckDeliveryAvailabilityPathParams): Promise<ApiResult<CheckDeliveryAvailabilityResponse>>;
|
|
14
21
|
}
|
package/dist/lib/shipping.js
CHANGED
|
@@ -14,4 +14,17 @@ export class ShippingClient extends StorefrontAPIClient {
|
|
|
14
14
|
body: body,
|
|
15
15
|
}));
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Check pincode deliverability
|
|
19
|
+
*
|
|
20
|
+
* @param pathParams - Path parameters
|
|
21
|
+
* @returns Promise with pincode deliverability result
|
|
22
|
+
*/
|
|
23
|
+
async checkPincodeDeliverability(pathParams) {
|
|
24
|
+
return this.executeRequest(() => this.client.GET("/shipment/pincode-serviceability/{pincode}", {
|
|
25
|
+
params: {
|
|
26
|
+
path: pathParams,
|
|
27
|
+
},
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
17
30
|
}
|