@elasticpath/js-sdk 28.1.0 → 28.1.1

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.cjs.js CHANGED
@@ -530,7 +530,7 @@ if (!globalThis.fetch) {
530
530
  globalThis.Response = fetch$1.Response;
531
531
  }
532
532
 
533
- var version = "28.1.0";
533
+ var version = "28.1.1";
534
534
 
535
535
  var LocalStorageFactory = /*#__PURE__*/function () {
536
536
  function LocalStorageFactory() {
@@ -1541,8 +1541,16 @@ var CartEndpoint = /*#__PURE__*/function (_BaseExtend) {
1541
1541
  key: "AddPromotion",
1542
1542
  value: function AddPromotion(code) {
1543
1543
  var token = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1544
- var body = buildCartItemData(code, null, 'promotion_item');
1545
- return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', body, token);
1544
+ var currency = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
1545
+ var additionalHeaders = currency ? {
1546
+ 'X-MOLTIN-CURRENCY': currency
1547
+ } : {};
1548
+ return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', {
1549
+ data: {
1550
+ type: 'promotion_item',
1551
+ code: code
1552
+ }
1553
+ }, token, null, null, null, additionalHeaders);
1546
1554
  }
1547
1555
  }, {
1548
1556
  key: "RemovePromotion",
package/dist/index.d.ts CHANGED
@@ -4720,15 +4720,6 @@ interface CartEndpoint
4720
4720
  ShippingGroup: CartShippingGroupBase
4721
4721
  ): Promise<ShippingGroupResponse>
4722
4722
 
4723
- /**
4724
- * Add Promotion to Cart
4725
- * Description: You can use the Promotions API to apply discounts to your cart as a special cart item type.
4726
- * DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/carts-and-orders/carts/add-promotion-to-cart.html
4727
- * @param code the promotion code.
4728
- * @param token a customer token to apply customer specific promotions.
4729
- */
4730
- AddPromotion(code: string, token?: string): Promise<CartItemsResponse>
4731
-
4732
4723
  /**
4733
4724
  * Get a Cart by reference
4734
4725
  * DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/carts-and-checkout/carts/get-a-cart.html
@@ -4808,8 +4799,10 @@ interface CartEndpoint
4808
4799
  * Description: You can use the Promotions API to apply discounts to your cart as a special cart item type.
4809
4800
  * DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/carts-and-orders/carts/add-promotion-to-cart.html
4810
4801
  * @param code the promotion code.
4802
+ * @param token a customer token to apply customer specific promotions.
4803
+ * @param currency the currency to apply the promotion in.
4811
4804
  */
4812
- AddPromotion(code: string): Promise<CartItemsResponse>
4805
+ AddPromotion(code: string, token?: string, currency?: string): Promise<CartItemsResponse>
4813
4806
 
4814
4807
  /**
4815
4808
  * Remove promotion from Cart
package/dist/index.esm.js CHANGED
@@ -519,7 +519,7 @@ if (!globalThis.fetch) {
519
519
  globalThis.Response = Response;
520
520
  }
521
521
 
522
- var version = "28.1.0";
522
+ var version = "28.1.1";
523
523
 
524
524
  var LocalStorageFactory = /*#__PURE__*/function () {
525
525
  function LocalStorageFactory() {
@@ -1530,8 +1530,16 @@ var CartEndpoint = /*#__PURE__*/function (_BaseExtend) {
1530
1530
  key: "AddPromotion",
1531
1531
  value: function AddPromotion(code) {
1532
1532
  var token = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1533
- var body = buildCartItemData(code, null, 'promotion_item');
1534
- return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', body, token);
1533
+ var currency = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
1534
+ var additionalHeaders = currency ? {
1535
+ 'X-MOLTIN-CURRENCY': currency
1536
+ } : {};
1537
+ return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', {
1538
+ data: {
1539
+ type: 'promotion_item',
1540
+ code: code
1541
+ }
1542
+ }, token, null, null, null, additionalHeaders);
1535
1543
  }
1536
1544
  }, {
1537
1545
  key: "RemovePromotion",
package/dist/index.js CHANGED
@@ -1085,7 +1085,7 @@
1085
1085
  globalThis.Response = browserPonyfill.exports.Response;
1086
1086
  }
1087
1087
 
1088
- var version = "28.1.0";
1088
+ var version = "28.1.1";
1089
1089
 
1090
1090
  var LocalStorageFactory = /*#__PURE__*/function () {
1091
1091
  function LocalStorageFactory() {
@@ -2698,8 +2698,16 @@
2698
2698
  key: "AddPromotion",
2699
2699
  value: function AddPromotion(code) {
2700
2700
  var token = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
2701
- var body = buildCartItemData(code, null, 'promotion_item');
2702
- return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', body, token);
2701
+ var currency = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
2702
+ var additionalHeaders = currency ? {
2703
+ 'X-MOLTIN-CURRENCY': currency
2704
+ } : {};
2705
+ return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', {
2706
+ data: {
2707
+ type: 'promotion_item',
2708
+ code: code
2709
+ }
2710
+ }, token, null, null, null, additionalHeaders);
2703
2711
  }
2704
2712
  }, {
2705
2713
  key: "RemovePromotion",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elasticpath/js-sdk",
3
3
  "description": "SDK for the Elastic Path eCommerce API",
4
- "version": "28.1.0",
4
+ "version": "28.1.1",
5
5
  "homepage": "https://github.com/elasticpath/js-sdk",
6
6
  "author": "Elastic Path (https://elasticpath.com/)",
7
7
  "files": [