@elasticpath/js-sdk 28.0.1 → 28.1.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.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.0.1";
533
+ var version = "28.1.0";
534
534
 
535
535
  var LocalStorageFactory = /*#__PURE__*/function () {
536
536
  function LocalStorageFactory() {
@@ -1374,14 +1374,21 @@ var BrandsEndpoint = /*#__PURE__*/function (_CRUDExtend) {
1374
1374
  return _createClass(BrandsEndpoint);
1375
1375
  }(CRUDExtend);
1376
1376
 
1377
- var _excluded = ["id", "quantity", "type"];
1377
+ var _excluded = ["id", "sku", "quantity"],
1378
+ _excluded2 = ["id", "quantity", "type"];
1378
1379
  var CartEndpoint = /*#__PURE__*/function (_BaseExtend) {
1379
1380
  _inherits(CartEndpoint, _BaseExtend);
1380
1381
  var _super = _createSuper(CartEndpoint);
1382
+ /**
1383
+ * @param {import('../factories/request').default} request - The RequestFactory instance
1384
+ * @param {string} id - The cart ID
1385
+ */
1381
1386
  function CartEndpoint(request, id) {
1382
1387
  var _this;
1383
1388
  _classCallCheck(this, CartEndpoint);
1384
1389
  _this = _super.apply(this, arguments);
1390
+
1391
+ /** @type {import('../factories/request').default} */
1385
1392
  _this.request = request;
1386
1393
  _this.cartId = id;
1387
1394
  _this.endpoint = 'carts';
@@ -1441,6 +1448,36 @@ var CartEndpoint = /*#__PURE__*/function (_BaseExtend) {
1441
1448
  var body = buildCartItemData(productId, quantity, 'cart_item', {}, isSku);
1442
1449
  return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', _objectSpread2(_objectSpread2({}, body), data), token, null, true, null, additionalHeaders);
1443
1450
  }
1451
+ }, {
1452
+ key: "AddProducts",
1453
+ value: function AddProducts(products, options) {
1454
+ var token = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
1455
+ var additionalHeaders = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1456
+ var items = products.map(function (product) {
1457
+ var id = product.id,
1458
+ sku = product.sku,
1459
+ _product$quantity = product.quantity,
1460
+ quantity = _product$quantity === void 0 ? 1 : _product$quantity,
1461
+ rest = _objectWithoutProperties(product, _excluded);
1462
+ var item = _objectSpread2({
1463
+ type: 'cart_item',
1464
+ quantity: quantity
1465
+ }, rest);
1466
+ if (id) {
1467
+ item.id = id;
1468
+ } else if (sku) {
1469
+ item.sku = sku;
1470
+ }
1471
+ return item;
1472
+ });
1473
+ var body = options ? {
1474
+ data: items,
1475
+ options: options
1476
+ } : {
1477
+ data: items
1478
+ };
1479
+ return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', body, token, null, false, null, additionalHeaders);
1480
+ }
1444
1481
  }, {
1445
1482
  key: "AddCustomItem",
1446
1483
  value: function AddCustomItem(body) {
@@ -1507,6 +1544,11 @@ var CartEndpoint = /*#__PURE__*/function (_BaseExtend) {
1507
1544
  var body = buildCartItemData(code, null, 'promotion_item');
1508
1545
  return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', body, token);
1509
1546
  }
1547
+ }, {
1548
+ key: "RemovePromotion",
1549
+ value: function RemovePromotion(promoCode) {
1550
+ return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/discounts/").concat(promoCode), 'DELETE');
1551
+ }
1510
1552
  }, {
1511
1553
  key: "BulkAdd",
1512
1554
  value: function BulkAdd(body, options) {
@@ -1587,7 +1629,7 @@ var CartEndpoint = /*#__PURE__*/function (_BaseExtend) {
1587
1629
  var id = _ref.id,
1588
1630
  quantity = _ref.quantity,
1589
1631
  type = _ref.type,
1590
- rest = _objectWithoutProperties(_ref, _excluded);
1632
+ rest = _objectWithoutProperties(_ref, _excluded2);
1591
1633
  return buildCartItemData(id, quantity, type, rest);
1592
1634
  });
1593
1635
  return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'PUT', body);
package/dist/index.d.ts CHANGED
@@ -4429,6 +4429,7 @@ interface Cart {
4429
4429
  links?: {}
4430
4430
  meta?: {
4431
4431
  display_price?: {
4432
+ discount?: FormattedPrice
4432
4433
  with_tax?: FormattedPrice
4433
4434
  without_tax?: FormattedPrice
4434
4435
  tax?: FormattedPrice
@@ -4536,6 +4537,11 @@ interface BulkAddOptions {
4536
4537
  add_all_or_nothing: boolean
4537
4538
  }
4538
4539
 
4540
+ type AddProductsItem = {
4541
+ quantity?: number
4542
+ [key: string]: any
4543
+ } & ({ id: string; sku?: never } | { sku: string; id?: never })
4544
+
4539
4545
  interface BulkCustomDiscountOptions {
4540
4546
  add_all_or_nothing: boolean
4541
4547
  }
@@ -4570,7 +4576,7 @@ interface CartTaxItemObject {
4570
4576
  }
4571
4577
  }
4572
4578
 
4573
- type CartInclude = 'items' | 'tax_items'
4579
+ type CartInclude = 'items' | 'tax_items' | 'promotions'
4574
4580
 
4575
4581
  interface CartQueryableResource<R, F, S>
4576
4582
  extends QueryableResource<Cart, F, S, CartInclude> {
@@ -4579,6 +4585,7 @@ interface CartQueryableResource<R, F, S>
4579
4585
 
4580
4586
  interface CartIncluded {
4581
4587
  items: CartItem[]
4588
+ promotions: Promotion[]
4582
4589
  }
4583
4590
 
4584
4591
  interface CartAdditionalHeaders {
@@ -4756,6 +4763,21 @@ interface CartEndpoint
4756
4763
  additionalHeaders?: CartAdditionalHeaders
4757
4764
  ): Promise<CartItemsResponse>
4758
4765
 
4766
+ /**
4767
+ * Add Multiple Products to Cart
4768
+ * Description: Add multiple products to cart in a single request. Each product can be identified by either ID or SKU.
4769
+ * @param products Array of products to add, each with either an id or sku field
4770
+ * @param options Optional bulk add options
4771
+ * @param token Optional customer token
4772
+ * @param additionalHeaders Optional additional headers
4773
+ */
4774
+ AddProducts(
4775
+ products: AddProductsItem[],
4776
+ options?: BulkAddOptions,
4777
+ token?: string,
4778
+ additionalHeaders?: CartAdditionalHeaders
4779
+ ): Promise<CartItemsResponse>
4780
+
4759
4781
  RemoveAllItems(): Promise<CartItemsResponse>
4760
4782
 
4761
4783
  /**
@@ -4789,6 +4811,14 @@ interface CartEndpoint
4789
4811
  */
4790
4812
  AddPromotion(code: string): Promise<CartItemsResponse>
4791
4813
 
4814
+ /**
4815
+ * Remove promotion from Cart
4816
+ * Description: Removes a manually applied promotion code from a cart. Does not work if the promotion is applied automatically.
4817
+ * DOCS: https://developer.elasticpath.com/docs/api/carts/delete-a-promotion-via-promotion-code
4818
+ * @param promoCode the promotion code to remove.
4819
+ */
4820
+ RemovePromotion(promoCode: string): Promise<{}>
4821
+
4792
4822
  /**
4793
4823
  * Bulk Update Items to Cart
4794
4824
  * Description: When you enable the bulk update feature, a shopper can update an array of items to their cart in one action, rather than updating each item one at a time.
@@ -9202,4 +9232,4 @@ declare namespace elasticpath {
9202
9232
  }
9203
9233
  }
9204
9234
 
9205
- export { Account, AccountAddress, AccountAddressBase, AccountAddressEdit, AccountAddressesEndpoint, AccountAssociationData, AccountAssociationResponse, AccountAuthenticationSettings, AccountAuthenticationSettingsBase, AccountAuthenticationSettingsEndpoint, AccountBase, AccountEndpoint, AccountFilter, AccountManagementAuthenticationTokenBody, AccountMember, AccountMemberBase, AccountMemberFilter, AccountMembersEndpoint, AccountMembership, AccountMembershipCreateBody, AccountMembershipOnAccountMember, AccountMembershipSettings, AccountMembershipSettingsBase, AccountMembershipSettingsEndpoint, AccountMembershipsEndpoint, AccountMembershipsFilter, AccountMembershipsInclude, AccountMembershipsIncludeAccounts, AccountMembershipsIncluded, AccountMembershipsIncludedAccounts, AccountMembershipsOnAccountMember, AccountMembershipsResponse, AccountTag, AccountTagBase, AccountTagFilter, AccountTagMeta, AccountTagsEndpoint, AccountTokenBase, AccountUpdateBody, Action, ActionCondition, ActionLimitation, Address, AddressBase, AdyenPayment, AndCondition, AnonymizeOrder, AnonymizeOrderResponse, ApplicationKey, ApplicationKeyBase, ApplicationKeyResponse, ApplicationKeysEndpoint, Attribute, Attributes, AttributesMeta, AuthenticateResponseBody, AuthenticationRealmEndpoint, AuthenticationSettings, AuthenticationSettingsBase, AuthenticationSettingsEndpoint, AuthorizeNetPayment, AuthorizePaymentMethod, BraintreePayment, Brand, BrandBase, BrandEndpoint, BrandFilter, BuildChildProductsJob, BuildRules, BuilderModifier, BuiltInRolePolicy, BulkAddOptions, BulkCustomDiscountOptions, BundleDiscountSchema, BundleGiftSchema, CapturePaymentMethod, CardConnectPayment, Cart, CartAdditionalHeaders, CartCustomDiscount, CartEndpoint, CartInclude, CartIncluded, CartItem, CartItemBase, CartItemObject, CartItemsResponse, CartSettings, CartShippingGroupBase, CartTaxItemObject, Catalog, CatalogBase, CatalogFilter, CatalogReleaseProductFilter, CatalogReleaseProductFilterAttributes, CatalogUpdateBody, CatalogsEndpoint, CatalogsNodesEndpoint, CatalogsProductVariation, CatalogsProductsEndpoint, CatalogsReleasesEndpoint, CatalogsRulesEndpoint, Category, CategoryBase, CategoryEndpoint, CategoryFilter, CheckoutCustomer, CheckoutCustomerObject, Collection, CollectionBase, CollectionEndpoint, CollectionFilter, Condition, Conditions, Config, ConfigOptions, ConfirmPaymentBody, ConfirmPaymentBodyWithOptions, ConfirmPaymentResponse, CreateCartObject, CreateChildrenSortOrderBody, CreateCustomRelationshipBody, CreateLocationBody, CrudQueryableResource, Currency, CurrencyAmount, CurrencyBase, CurrencyEndpoint, CurrencyPercentage, CustomApi, CustomApiBase, CustomApiField, CustomApiFieldBase, CustomApiRolePoliciesEndpoint, CustomApiRolePolicy, CustomApiRolePolicyBase, CustomApiRolePolicyRequestBody, CustomApisEndpoint, CustomAuthenticatorResponseBody, CustomDiscount, CustomDiscountResponse, CustomFieldValidation, CustomInputs, CustomInputsValidationRules, CustomRelationship, CustomRelationshipBase, CustomRelationshipBaseAttributes, CustomRelationshipEntry, CustomRelationshipsEndpoint, CustomRelationshipsFilter, CustomRelationshipsListResponse, Customer, CustomerAddress, CustomerAddressBase, CustomerAddressEdit, CustomerAddressesEndpoint, CustomerBase, CustomerFilter, CustomerInclude, CustomerToken, CustomersEndpoint, CyberSourcePayment, DataEntriesEndpoint, DataEntryRecord, DeletePromotionCodesBodyItem, DeleteRulePromotionCodes, DuplicateHierarchyBody, DuplicateHierarchyJob, ElasticPath, ElasticPathStripePayment, ErasureRequestRecord, ErasureRequestsEndpoint, Exclude$1 as Exclude, Extensions, Field, FieldBase, FieldsEndpoint, File, FileBase, FileEndpoint, FileFilter, FileHref, FixedDiscountSchema, Flow, FlowBase, FlowEndpoint, FlowFilter, FormattedPrice, Gateway, GatewayBase, GatewaysEndpoint, GeolocationDetails, GrantType, HierarchiesEndpoint, HierarchiesShopperCatalogEndpoint, Hierarchy, HierarchyBase, HierarchyFilter, HttpVerbs, Identifiable, Integration, IntegrationBase, IntegrationEndpoint, IntegrationFilter, IntegrationJob, IntegrationLog, IntegrationLogMeta, IntegrationLogsResponse, Inventory, InventoryActionTypes, InventoryBase, InventoryEndpoint, InventoryResourceType, InventoryResponse, InvoicingResult, ItemFixedDiscountSchema, ItemPercentDiscountSchema, ItemTaxObject, ItemTaxObjectResponse, Job, JobBase, JobEndpoint, LocalStorageFactory, Locales, Location, LocationAttributes, LocationBase, LocationCreateQuantity, LocationMeta, LocationQuantities, LocationUpdateQuantity, LocationsEndpoint, LogIntegration, ManualPayment, MatrixObject, MemoryStorageFactory, MerchantRealmMappings, MerchantRealmMappingsEndpoint, MergeCartOptions, MetricsBase, MetricsEndpoint, MetricsQuery, Modifier, ModifierResponse, ModifierType, ModifierTypeObj, MultiLocationInventoriesEndpoint, MultiLocationInventoryFilter, MultiLocationInventoryResponse, Node, NodeBase, NodeBaseResponse, NodeFilter, NodeProduct, NodeProductResponse, NodeRelationship, NodeRelationshipBase, NodeRelationshipParent, NodeRelationshipsEndpoint, NodesEndpoint, NodesResponse, NodesShopperCatalogEndpoint, NonAssociatedProductEntry, OidcProfileEndpoint, OnboardingLinkResponse, OneTimePasswordTokenRequestBody, OneTimePasswordTokenRequestEndpoint, Option, OptionResponse, Order, OrderAddressBase, OrderBase, OrderBillingAddress, OrderFilter, OrderInclude, OrderIncluded, OrderItem, OrderItemBase, OrderResponse, OrderShippingAddress, OrderSort, OrderSortAscend, OrderSortDescend, OrdersEndpoint, PCMVariation, PCMVariationBase, PCMVariationMetaOption, PCMVariationOption, PCMVariationOptionBase, PCMVariationsEndpoint, PartialPcmProductBase, PasswordProfile, PasswordProfileBody, PasswordProfileEndpoint, PasswordProfileListItem, PasswordProfileResponse, PayPalExpressCheckoutPayment, PaymentMethod, PaymentRequestBody, PcmCustomRelationshipEndpoint, PcmFileRelationship, PcmFileRelationshipEndpoint, PcmJob, PcmJobBase, PcmJobError, PcmJobsEndpoint, PcmMainImageRelationship, PcmMainImageRelationshipEndpoint, PcmProduct, PcmProductAttachmentBody, PcmProductAttachmentResponse, PcmProductBase, PcmProductEntry, PcmProductFilter, PcmProductInclude, PcmProductRelationships, PcmProductResponse, PcmProductUpdateBody, PcmProductsEndpoint, PcmProductsResponse, PcmTemplateRelationship, PcmTemplateRelationshipEndpoint, PcmVariationsRelationshipResource, PcmVariationsRelationships, PcmVariationsRelationshipsEndpoint, PercentDiscountSchema, PersonalDataEndpoint, PersonalDataRecord, Presentation, Price, PriceBook, PriceBookBase, PriceBookFilter, PriceBookPrice, PriceBookPriceBase, PriceBookPriceModifier, PriceBookPriceModifierBase, PriceBookPriceModifierEndpoint, PriceBookPricesCreateBody, PriceBookPricesEndpoint, PriceBookPricesUpdateBody, PriceBooksEndpoint, PriceBooksUpdateBody, PricesFilter, Product, ProductAssociationResponse, ProductBase, ProductComponentOption, ProductComponents, ProductFileRelationshipResource, ProductFilter, ProductResponse, ProductTemplateRelationshipResource, ProductsEndpoint, Profile, ProfileBase, ProfileCreateUpdateBody, ProfileListItem, ProfileResponse, ProfileResponseBody, Promotion, PromotionAttribute, PromotionAttributeValues, PromotionBase, PromotionCode, PromotionCodesJob, PromotionFilter, PromotionJob, PromotionMeta, PromotionSettings, PromotionsEndpoint, PurchasePaymentMethod, QueryableResource, Realm, RealmBase, RealmCreateBody, RealmUpdateBody, RefundPaymentMethod, Relationship, RelationshipToMany, RelationshipToOne, ReleaseBase, ReleaseBodyBase, ReleaseResponse, RequestFactory, Requirements, Resource, ResourceIncluded, ResourceList, ResourcePage, Rule, RuleBase, RuleFilter, RulePromotion, RulePromotionBase, RulePromotionCode, RulePromotionCodesJob, RulePromotionFilter, RulePromotionJob, RulePromotionMeta, RulePromotionsEndpoint, RuleUpdateBody, Settings, SettingsEndpoint, ShippingGroupBase, ShippingGroupResponse, ShippingIncluded, ShopperCatalogEndpoint, ShopperCatalogProductsEndpoint, ShopperCatalogReleaseBase, ShopperCatalogResource, ShopperCatalogResourceList, ShopperCatalogResourcePage, SimpleResourcePageResponse, StockAttributes, StockCreate, StockLocationsMap, StockResponse, StockUpdate, StorageFactory, StripeConnectPayment, StripeIntentsPayment, StripePayment, StripePaymentBase, StripePaymentOptionBase, Subscription, SubscriptionBase, SubscriptionCreate, SubscriptionDunningRules, SubscriptionDunningRulesBase, SubscriptionDunningRulesCreate, SubscriptionDunningRulesEndpoint, SubscriptionDunningRulesUpdate, SubscriptionFilter, SubscriptionInvoice, SubscriptionInvoiceBase, SubscriptionInvoiceFilter, SubscriptionInvoicePayment, SubscriptionInvoicePaymentBase, SubscriptionInvoicesEndpoint, SubscriptionJob, SubscriptionJobBase, SubscriptionJobCreate, SubscriptionJobsEndpoint, SubscriptionOffering, SubscriptionOfferingAttachPlanBody, SubscriptionOfferingAttachProductBody, SubscriptionOfferingAttachProrationPolicyBody, SubscriptionOfferingBase, SubscriptionOfferingBuildBody, SubscriptionOfferingBuildProduct, SubscriptionOfferingCreate, SubscriptionOfferingFilter, SubscriptionOfferingPlan, SubscriptionOfferingProduct, SubscriptionOfferingRelationships, SubscriptionOfferingUpdate, SubscriptionOfferingsEndpoint, SubscriptionPlan, SubscriptionPlanBase, SubscriptionPlanCreate, SubscriptionPlanUpdate, SubscriptionPlansEndpoint, SubscriptionProduct, SubscriptionProductBase, SubscriptionProductCreate, SubscriptionProductUpdate, SubscriptionProductsEndpoint, SubscriptionProrationPoliciesEndpoint, SubscriptionProrationPolicy, SubscriptionProrationPolicyBase, SubscriptionProrationPolicyCreate, SubscriptionProrationPolicyUpdate, SubscriptionSchedule, SubscriptionScheduleBase, SubscriptionScheduleCreate, SubscriptionScheduleUpdate, SubscriptionSchedulesEndpoint, SubscriptionSettings, SubscriptionSubscriber, SubscriptionSubscriberBase, SubscriptionSubscriberCreate, SubscriptionSubscriberUpdate, SubscriptionSubscribersEndpoint, SubscriptionUpdate, SubscriptionsEndpoint, SubscriptionsInclude, SubscriptionsIncluded, SubscriptionsStateAction, Subset, TargetCondition, Timestamps, Transaction, TransactionBase, TransactionEndpoint, TransactionsResponse, TtlSettings, UpdateCustomRelationshipBody, UpdateLocationBody, UpdateNodeBody, UpdateVariationBody, UpdateVariationOptionBody, UserAuthenticationInfo, UserAuthenticationInfoBody, UserAuthenticationInfoEndpoint, UserAuthenticationInfoFilter, UserAuthenticationInfoResponse, UserAuthenticationPasswordProfile, UserAuthenticationPasswordProfileBody, UserAuthenticationPasswordProfileEndpoint, UserAuthenticationPasswordProfileResponse, UserAuthenticationPasswordProfileUpdateBody, Validation, Variation, VariationBase, VariationsBuilderModifier, VariationsEndpoint, VariationsModifier, VariationsModifierResponse, VariationsModifierType, VariationsModifierTypeObj, XforAmountSchema, XforYSchema, createJob, elasticpath, gateway };
9235
+ export { Account, AccountAddress, AccountAddressBase, AccountAddressEdit, AccountAddressesEndpoint, AccountAssociationData, AccountAssociationResponse, AccountAuthenticationSettings, AccountAuthenticationSettingsBase, AccountAuthenticationSettingsEndpoint, AccountBase, AccountEndpoint, AccountFilter, AccountManagementAuthenticationTokenBody, AccountMember, AccountMemberBase, AccountMemberFilter, AccountMembersEndpoint, AccountMembership, AccountMembershipCreateBody, AccountMembershipOnAccountMember, AccountMembershipSettings, AccountMembershipSettingsBase, AccountMembershipSettingsEndpoint, AccountMembershipsEndpoint, AccountMembershipsFilter, AccountMembershipsInclude, AccountMembershipsIncludeAccounts, AccountMembershipsIncluded, AccountMembershipsIncludedAccounts, AccountMembershipsOnAccountMember, AccountMembershipsResponse, AccountTag, AccountTagBase, AccountTagFilter, AccountTagMeta, AccountTagsEndpoint, AccountTokenBase, AccountUpdateBody, Action, ActionCondition, ActionLimitation, AddProductsItem, Address, AddressBase, AdyenPayment, AndCondition, AnonymizeOrder, AnonymizeOrderResponse, ApplicationKey, ApplicationKeyBase, ApplicationKeyResponse, ApplicationKeysEndpoint, Attribute, Attributes, AttributesMeta, AuthenticateResponseBody, AuthenticationRealmEndpoint, AuthenticationSettings, AuthenticationSettingsBase, AuthenticationSettingsEndpoint, AuthorizeNetPayment, AuthorizePaymentMethod, BraintreePayment, Brand, BrandBase, BrandEndpoint, BrandFilter, BuildChildProductsJob, BuildRules, BuilderModifier, BuiltInRolePolicy, BulkAddOptions, BulkCustomDiscountOptions, BundleDiscountSchema, BundleGiftSchema, CapturePaymentMethod, CardConnectPayment, Cart, CartAdditionalHeaders, CartCustomDiscount, CartEndpoint, CartInclude, CartIncluded, CartItem, CartItemBase, CartItemObject, CartItemsResponse, CartSettings, CartShippingGroupBase, CartTaxItemObject, Catalog, CatalogBase, CatalogFilter, CatalogReleaseProductFilter, CatalogReleaseProductFilterAttributes, CatalogUpdateBody, CatalogsEndpoint, CatalogsNodesEndpoint, CatalogsProductVariation, CatalogsProductsEndpoint, CatalogsReleasesEndpoint, CatalogsRulesEndpoint, Category, CategoryBase, CategoryEndpoint, CategoryFilter, CheckoutCustomer, CheckoutCustomerObject, Collection, CollectionBase, CollectionEndpoint, CollectionFilter, Condition, Conditions, Config, ConfigOptions, ConfirmPaymentBody, ConfirmPaymentBodyWithOptions, ConfirmPaymentResponse, CreateCartObject, CreateChildrenSortOrderBody, CreateCustomRelationshipBody, CreateLocationBody, CrudQueryableResource, Currency, CurrencyAmount, CurrencyBase, CurrencyEndpoint, CurrencyPercentage, CustomApi, CustomApiBase, CustomApiField, CustomApiFieldBase, CustomApiRolePoliciesEndpoint, CustomApiRolePolicy, CustomApiRolePolicyBase, CustomApiRolePolicyRequestBody, CustomApisEndpoint, CustomAuthenticatorResponseBody, CustomDiscount, CustomDiscountResponse, CustomFieldValidation, CustomInputs, CustomInputsValidationRules, CustomRelationship, CustomRelationshipBase, CustomRelationshipBaseAttributes, CustomRelationshipEntry, CustomRelationshipsEndpoint, CustomRelationshipsFilter, CustomRelationshipsListResponse, Customer, CustomerAddress, CustomerAddressBase, CustomerAddressEdit, CustomerAddressesEndpoint, CustomerBase, CustomerFilter, CustomerInclude, CustomerToken, CustomersEndpoint, CyberSourcePayment, DataEntriesEndpoint, DataEntryRecord, DeletePromotionCodesBodyItem, DeleteRulePromotionCodes, DuplicateHierarchyBody, DuplicateHierarchyJob, ElasticPath, ElasticPathStripePayment, ErasureRequestRecord, ErasureRequestsEndpoint, Exclude$1 as Exclude, Extensions, Field, FieldBase, FieldsEndpoint, File, FileBase, FileEndpoint, FileFilter, FileHref, FixedDiscountSchema, Flow, FlowBase, FlowEndpoint, FlowFilter, FormattedPrice, Gateway, GatewayBase, GatewaysEndpoint, GeolocationDetails, GrantType, HierarchiesEndpoint, HierarchiesShopperCatalogEndpoint, Hierarchy, HierarchyBase, HierarchyFilter, HttpVerbs, Identifiable, Integration, IntegrationBase, IntegrationEndpoint, IntegrationFilter, IntegrationJob, IntegrationLog, IntegrationLogMeta, IntegrationLogsResponse, Inventory, InventoryActionTypes, InventoryBase, InventoryEndpoint, InventoryResourceType, InventoryResponse, InvoicingResult, ItemFixedDiscountSchema, ItemPercentDiscountSchema, ItemTaxObject, ItemTaxObjectResponse, Job, JobBase, JobEndpoint, LocalStorageFactory, Locales, Location, LocationAttributes, LocationBase, LocationCreateQuantity, LocationMeta, LocationQuantities, LocationUpdateQuantity, LocationsEndpoint, LogIntegration, ManualPayment, MatrixObject, MemoryStorageFactory, MerchantRealmMappings, MerchantRealmMappingsEndpoint, MergeCartOptions, MetricsBase, MetricsEndpoint, MetricsQuery, Modifier, ModifierResponse, ModifierType, ModifierTypeObj, MultiLocationInventoriesEndpoint, MultiLocationInventoryFilter, MultiLocationInventoryResponse, Node, NodeBase, NodeBaseResponse, NodeFilter, NodeProduct, NodeProductResponse, NodeRelationship, NodeRelationshipBase, NodeRelationshipParent, NodeRelationshipsEndpoint, NodesEndpoint, NodesResponse, NodesShopperCatalogEndpoint, NonAssociatedProductEntry, OidcProfileEndpoint, OnboardingLinkResponse, OneTimePasswordTokenRequestBody, OneTimePasswordTokenRequestEndpoint, Option, OptionResponse, Order, OrderAddressBase, OrderBase, OrderBillingAddress, OrderFilter, OrderInclude, OrderIncluded, OrderItem, OrderItemBase, OrderResponse, OrderShippingAddress, OrderSort, OrderSortAscend, OrderSortDescend, OrdersEndpoint, PCMVariation, PCMVariationBase, PCMVariationMetaOption, PCMVariationOption, PCMVariationOptionBase, PCMVariationsEndpoint, PartialPcmProductBase, PasswordProfile, PasswordProfileBody, PasswordProfileEndpoint, PasswordProfileListItem, PasswordProfileResponse, PayPalExpressCheckoutPayment, PaymentMethod, PaymentRequestBody, PcmCustomRelationshipEndpoint, PcmFileRelationship, PcmFileRelationshipEndpoint, PcmJob, PcmJobBase, PcmJobError, PcmJobsEndpoint, PcmMainImageRelationship, PcmMainImageRelationshipEndpoint, PcmProduct, PcmProductAttachmentBody, PcmProductAttachmentResponse, PcmProductBase, PcmProductEntry, PcmProductFilter, PcmProductInclude, PcmProductRelationships, PcmProductResponse, PcmProductUpdateBody, PcmProductsEndpoint, PcmProductsResponse, PcmTemplateRelationship, PcmTemplateRelationshipEndpoint, PcmVariationsRelationshipResource, PcmVariationsRelationships, PcmVariationsRelationshipsEndpoint, PercentDiscountSchema, PersonalDataEndpoint, PersonalDataRecord, Presentation, Price, PriceBook, PriceBookBase, PriceBookFilter, PriceBookPrice, PriceBookPriceBase, PriceBookPriceModifier, PriceBookPriceModifierBase, PriceBookPriceModifierEndpoint, PriceBookPricesCreateBody, PriceBookPricesEndpoint, PriceBookPricesUpdateBody, PriceBooksEndpoint, PriceBooksUpdateBody, PricesFilter, Product, ProductAssociationResponse, ProductBase, ProductComponentOption, ProductComponents, ProductFileRelationshipResource, ProductFilter, ProductResponse, ProductTemplateRelationshipResource, ProductsEndpoint, Profile, ProfileBase, ProfileCreateUpdateBody, ProfileListItem, ProfileResponse, ProfileResponseBody, Promotion, PromotionAttribute, PromotionAttributeValues, PromotionBase, PromotionCode, PromotionCodesJob, PromotionFilter, PromotionJob, PromotionMeta, PromotionSettings, PromotionsEndpoint, PurchasePaymentMethod, QueryableResource, Realm, RealmBase, RealmCreateBody, RealmUpdateBody, RefundPaymentMethod, Relationship, RelationshipToMany, RelationshipToOne, ReleaseBase, ReleaseBodyBase, ReleaseResponse, RequestFactory, Requirements, Resource, ResourceIncluded, ResourceList, ResourcePage, Rule, RuleBase, RuleFilter, RulePromotion, RulePromotionBase, RulePromotionCode, RulePromotionCodesJob, RulePromotionFilter, RulePromotionJob, RulePromotionMeta, RulePromotionsEndpoint, RuleUpdateBody, Settings, SettingsEndpoint, ShippingGroupBase, ShippingGroupResponse, ShippingIncluded, ShopperCatalogEndpoint, ShopperCatalogProductsEndpoint, ShopperCatalogReleaseBase, ShopperCatalogResource, ShopperCatalogResourceList, ShopperCatalogResourcePage, SimpleResourcePageResponse, StockAttributes, StockCreate, StockLocationsMap, StockResponse, StockUpdate, StorageFactory, StripeConnectPayment, StripeIntentsPayment, StripePayment, StripePaymentBase, StripePaymentOptionBase, Subscription, SubscriptionBase, SubscriptionCreate, SubscriptionDunningRules, SubscriptionDunningRulesBase, SubscriptionDunningRulesCreate, SubscriptionDunningRulesEndpoint, SubscriptionDunningRulesUpdate, SubscriptionFilter, SubscriptionInvoice, SubscriptionInvoiceBase, SubscriptionInvoiceFilter, SubscriptionInvoicePayment, SubscriptionInvoicePaymentBase, SubscriptionInvoicesEndpoint, SubscriptionJob, SubscriptionJobBase, SubscriptionJobCreate, SubscriptionJobsEndpoint, SubscriptionOffering, SubscriptionOfferingAttachPlanBody, SubscriptionOfferingAttachProductBody, SubscriptionOfferingAttachProrationPolicyBody, SubscriptionOfferingBase, SubscriptionOfferingBuildBody, SubscriptionOfferingBuildProduct, SubscriptionOfferingCreate, SubscriptionOfferingFilter, SubscriptionOfferingPlan, SubscriptionOfferingProduct, SubscriptionOfferingRelationships, SubscriptionOfferingUpdate, SubscriptionOfferingsEndpoint, SubscriptionPlan, SubscriptionPlanBase, SubscriptionPlanCreate, SubscriptionPlanUpdate, SubscriptionPlansEndpoint, SubscriptionProduct, SubscriptionProductBase, SubscriptionProductCreate, SubscriptionProductUpdate, SubscriptionProductsEndpoint, SubscriptionProrationPoliciesEndpoint, SubscriptionProrationPolicy, SubscriptionProrationPolicyBase, SubscriptionProrationPolicyCreate, SubscriptionProrationPolicyUpdate, SubscriptionSchedule, SubscriptionScheduleBase, SubscriptionScheduleCreate, SubscriptionScheduleUpdate, SubscriptionSchedulesEndpoint, SubscriptionSettings, SubscriptionSubscriber, SubscriptionSubscriberBase, SubscriptionSubscriberCreate, SubscriptionSubscriberUpdate, SubscriptionSubscribersEndpoint, SubscriptionUpdate, SubscriptionsEndpoint, SubscriptionsInclude, SubscriptionsIncluded, SubscriptionsStateAction, Subset, TargetCondition, Timestamps, Transaction, TransactionBase, TransactionEndpoint, TransactionsResponse, TtlSettings, UpdateCustomRelationshipBody, UpdateLocationBody, UpdateNodeBody, UpdateVariationBody, UpdateVariationOptionBody, UserAuthenticationInfo, UserAuthenticationInfoBody, UserAuthenticationInfoEndpoint, UserAuthenticationInfoFilter, UserAuthenticationInfoResponse, UserAuthenticationPasswordProfile, UserAuthenticationPasswordProfileBody, UserAuthenticationPasswordProfileEndpoint, UserAuthenticationPasswordProfileResponse, UserAuthenticationPasswordProfileUpdateBody, Validation, Variation, VariationBase, VariationsBuilderModifier, VariationsEndpoint, VariationsModifier, VariationsModifierResponse, VariationsModifierType, VariationsModifierTypeObj, XforAmountSchema, XforYSchema, createJob, elasticpath, gateway };
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.0.1";
522
+ var version = "28.1.0";
523
523
 
524
524
  var LocalStorageFactory = /*#__PURE__*/function () {
525
525
  function LocalStorageFactory() {
@@ -1363,14 +1363,21 @@ var BrandsEndpoint = /*#__PURE__*/function (_CRUDExtend) {
1363
1363
  return _createClass(BrandsEndpoint);
1364
1364
  }(CRUDExtend);
1365
1365
 
1366
- var _excluded = ["id", "quantity", "type"];
1366
+ var _excluded = ["id", "sku", "quantity"],
1367
+ _excluded2 = ["id", "quantity", "type"];
1367
1368
  var CartEndpoint = /*#__PURE__*/function (_BaseExtend) {
1368
1369
  _inherits(CartEndpoint, _BaseExtend);
1369
1370
  var _super = _createSuper(CartEndpoint);
1371
+ /**
1372
+ * @param {import('../factories/request').default} request - The RequestFactory instance
1373
+ * @param {string} id - The cart ID
1374
+ */
1370
1375
  function CartEndpoint(request, id) {
1371
1376
  var _this;
1372
1377
  _classCallCheck(this, CartEndpoint);
1373
1378
  _this = _super.apply(this, arguments);
1379
+
1380
+ /** @type {import('../factories/request').default} */
1374
1381
  _this.request = request;
1375
1382
  _this.cartId = id;
1376
1383
  _this.endpoint = 'carts';
@@ -1430,6 +1437,36 @@ var CartEndpoint = /*#__PURE__*/function (_BaseExtend) {
1430
1437
  var body = buildCartItemData(productId, quantity, 'cart_item', {}, isSku);
1431
1438
  return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', _objectSpread2(_objectSpread2({}, body), data), token, null, true, null, additionalHeaders);
1432
1439
  }
1440
+ }, {
1441
+ key: "AddProducts",
1442
+ value: function AddProducts(products, options) {
1443
+ var token = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
1444
+ var additionalHeaders = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1445
+ var items = products.map(function (product) {
1446
+ var id = product.id,
1447
+ sku = product.sku,
1448
+ _product$quantity = product.quantity,
1449
+ quantity = _product$quantity === void 0 ? 1 : _product$quantity,
1450
+ rest = _objectWithoutProperties(product, _excluded);
1451
+ var item = _objectSpread2({
1452
+ type: 'cart_item',
1453
+ quantity: quantity
1454
+ }, rest);
1455
+ if (id) {
1456
+ item.id = id;
1457
+ } else if (sku) {
1458
+ item.sku = sku;
1459
+ }
1460
+ return item;
1461
+ });
1462
+ var body = options ? {
1463
+ data: items,
1464
+ options: options
1465
+ } : {
1466
+ data: items
1467
+ };
1468
+ return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', body, token, null, false, null, additionalHeaders);
1469
+ }
1433
1470
  }, {
1434
1471
  key: "AddCustomItem",
1435
1472
  value: function AddCustomItem(body) {
@@ -1496,6 +1533,11 @@ var CartEndpoint = /*#__PURE__*/function (_BaseExtend) {
1496
1533
  var body = buildCartItemData(code, null, 'promotion_item');
1497
1534
  return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', body, token);
1498
1535
  }
1536
+ }, {
1537
+ key: "RemovePromotion",
1538
+ value: function RemovePromotion(promoCode) {
1539
+ return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/discounts/").concat(promoCode), 'DELETE');
1540
+ }
1499
1541
  }, {
1500
1542
  key: "BulkAdd",
1501
1543
  value: function BulkAdd(body, options) {
@@ -1576,7 +1618,7 @@ var CartEndpoint = /*#__PURE__*/function (_BaseExtend) {
1576
1618
  var id = _ref.id,
1577
1619
  quantity = _ref.quantity,
1578
1620
  type = _ref.type,
1579
- rest = _objectWithoutProperties(_ref, _excluded);
1621
+ rest = _objectWithoutProperties(_ref, _excluded2);
1580
1622
  return buildCartItemData(id, quantity, type, rest);
1581
1623
  });
1582
1624
  return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'PUT', body);
package/dist/index.js CHANGED
@@ -1085,7 +1085,7 @@
1085
1085
  globalThis.Response = browserPonyfill.exports.Response;
1086
1086
  }
1087
1087
 
1088
- var version = "28.0.1";
1088
+ var version = "28.1.0";
1089
1089
 
1090
1090
  var LocalStorageFactory = /*#__PURE__*/function () {
1091
1091
  function LocalStorageFactory() {
@@ -2531,14 +2531,21 @@
2531
2531
  return _createClass(BrandsEndpoint);
2532
2532
  }(CRUDExtend);
2533
2533
 
2534
- var _excluded = ["id", "quantity", "type"];
2534
+ var _excluded = ["id", "sku", "quantity"],
2535
+ _excluded2 = ["id", "quantity", "type"];
2535
2536
  var CartEndpoint = /*#__PURE__*/function (_BaseExtend) {
2536
2537
  _inherits(CartEndpoint, _BaseExtend);
2537
2538
  var _super = _createSuper(CartEndpoint);
2539
+ /**
2540
+ * @param {import('../factories/request').default} request - The RequestFactory instance
2541
+ * @param {string} id - The cart ID
2542
+ */
2538
2543
  function CartEndpoint(request, id) {
2539
2544
  var _this;
2540
2545
  _classCallCheck(this, CartEndpoint);
2541
2546
  _this = _super.apply(this, arguments);
2547
+
2548
+ /** @type {import('../factories/request').default} */
2542
2549
  _this.request = request;
2543
2550
  _this.cartId = id;
2544
2551
  _this.endpoint = 'carts';
@@ -2598,6 +2605,36 @@
2598
2605
  var body = buildCartItemData(productId, quantity, 'cart_item', {}, isSku);
2599
2606
  return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', _objectSpread2(_objectSpread2({}, body), data), token, null, true, null, additionalHeaders);
2600
2607
  }
2608
+ }, {
2609
+ key: "AddProducts",
2610
+ value: function AddProducts(products, options) {
2611
+ var token = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
2612
+ var additionalHeaders = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2613
+ var items = products.map(function (product) {
2614
+ var id = product.id,
2615
+ sku = product.sku,
2616
+ _product$quantity = product.quantity,
2617
+ quantity = _product$quantity === void 0 ? 1 : _product$quantity,
2618
+ rest = _objectWithoutProperties(product, _excluded);
2619
+ var item = _objectSpread2({
2620
+ type: 'cart_item',
2621
+ quantity: quantity
2622
+ }, rest);
2623
+ if (id) {
2624
+ item.id = id;
2625
+ } else if (sku) {
2626
+ item.sku = sku;
2627
+ }
2628
+ return item;
2629
+ });
2630
+ var body = options ? {
2631
+ data: items,
2632
+ options: options
2633
+ } : {
2634
+ data: items
2635
+ };
2636
+ return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', body, token, null, false, null, additionalHeaders);
2637
+ }
2601
2638
  }, {
2602
2639
  key: "AddCustomItem",
2603
2640
  value: function AddCustomItem(body) {
@@ -2664,6 +2701,11 @@
2664
2701
  var body = buildCartItemData(code, null, 'promotion_item');
2665
2702
  return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', body, token);
2666
2703
  }
2704
+ }, {
2705
+ key: "RemovePromotion",
2706
+ value: function RemovePromotion(promoCode) {
2707
+ return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/discounts/").concat(promoCode), 'DELETE');
2708
+ }
2667
2709
  }, {
2668
2710
  key: "BulkAdd",
2669
2711
  value: function BulkAdd(body, options) {
@@ -2744,7 +2786,7 @@
2744
2786
  var id = _ref.id,
2745
2787
  quantity = _ref.quantity,
2746
2788
  type = _ref.type,
2747
- rest = _objectWithoutProperties(_ref, _excluded);
2789
+ rest = _objectWithoutProperties(_ref, _excluded2);
2748
2790
  return buildCartItemData(id, quantity, type, rest);
2749
2791
  });
2750
2792
  return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'PUT', body);
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.0.1",
4
+ "version": "28.1.0",
5
5
  "homepage": "https://github.com/elasticpath/js-sdk",
6
6
  "author": "Elastic Path (https://elasticpath.com/)",
7
7
  "files": [