@commercengine/storefront-sdk 0.9.4 → 0.10.0
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 +552 -306
- package/dist/index.iife.js +1 -54
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +1 -54
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.iife.js
CHANGED
|
@@ -907,6 +907,7 @@ function extractUserInfoFromToken(token) {
|
|
|
907
907
|
customerId: payload.customer_id,
|
|
908
908
|
customerGroupId: payload.customer_group_id,
|
|
909
909
|
anonymousId: payload.anonymous_id,
|
|
910
|
+
channel: payload.channel,
|
|
910
911
|
tokenExpiry: /* @__PURE__ */ new Date(payload.exp * 1e3),
|
|
911
912
|
tokenIssuedAt: /* @__PURE__ */ new Date(payload.iat * 1e3)
|
|
912
913
|
};
|
|
@@ -2444,60 +2445,6 @@ var CartClient = class extends StorefrontAPIClient {
|
|
|
2444
2445
|
}));
|
|
2445
2446
|
}
|
|
2446
2447
|
/**
|
|
2447
|
-
* Redeem gift card
|
|
2448
|
-
*
|
|
2449
|
-
* @param cartId - The ID of the cart
|
|
2450
|
-
* @param body - The body of the request
|
|
2451
|
-
* @returns Promise with updated cart
|
|
2452
|
-
* @example
|
|
2453
|
-
* ```typescript
|
|
2454
|
-
* const { data, error } = await sdk.cart.redeemGiftCard(
|
|
2455
|
-
* { id: "01H9CART12345ABCDE" },
|
|
2456
|
-
* {
|
|
2457
|
-
* gift_card_code: "GIFT2024-ABCD-1234",
|
|
2458
|
-
* amount: 100.00
|
|
2459
|
-
* }
|
|
2460
|
-
* );
|
|
2461
|
-
*
|
|
2462
|
-
* if (error) {
|
|
2463
|
-
* console.error("Failed to redeem gift card:", error.message);
|
|
2464
|
-
* } else {
|
|
2465
|
-
* console.log("Gift card applied, new total:", data.cart.total_amount);
|
|
2466
|
-
* console.log("Gift card discount:", data.cart.gift_card_discount_amount);
|
|
2467
|
-
* }
|
|
2468
|
-
* ```
|
|
2469
|
-
*/
|
|
2470
|
-
async redeemGiftCard(cartId, body) {
|
|
2471
|
-
return this.executeRequest(() => this.client.POST("/carts/{id}/gift-card", {
|
|
2472
|
-
params: { path: cartId },
|
|
2473
|
-
body
|
|
2474
|
-
}));
|
|
2475
|
-
}
|
|
2476
|
-
/**
|
|
2477
|
-
* Remove gift card
|
|
2478
|
-
*
|
|
2479
|
-
* @param cartId - The ID of the cart
|
|
2480
|
-
* @returns Promise with updated cart
|
|
2481
|
-
* @example
|
|
2482
|
-
* ```typescript
|
|
2483
|
-
* const { data, error } = await sdk.cart.removeGiftCard({
|
|
2484
|
-
* id: "01H9CART12345ABCDE"
|
|
2485
|
-
* });
|
|
2486
|
-
*
|
|
2487
|
-
* if (error) {
|
|
2488
|
-
* console.error("Failed to remove gift card:", error.message);
|
|
2489
|
-
* } else {
|
|
2490
|
-
* console.log("Gift card removed, new total:", data.cart.total_amount);
|
|
2491
|
-
* }
|
|
2492
|
-
* ```
|
|
2493
|
-
*/
|
|
2494
|
-
async removeGiftCard(cartId) {
|
|
2495
|
-
return this.executeRequest(() => this.client.DELETE("/carts/{id}/gift-card", {
|
|
2496
|
-
params: { path: cartId },
|
|
2497
|
-
body: void 0
|
|
2498
|
-
}));
|
|
2499
|
-
}
|
|
2500
|
-
/**
|
|
2501
2448
|
* Get wishlist items
|
|
2502
2449
|
*
|
|
2503
2450
|
* @param userId - The ID of the user
|