@elasticpath/js-sdk 28.0.1 → 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 +55 -5
- package/dist/index.d.ts +35 -12
- package/dist/index.esm.js +55 -5
- package/dist/index.js +55 -5
- package/package.json +1 -1
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.
|
|
533
|
+
var version = "28.1.1";
|
|
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", "
|
|
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) {
|
|
@@ -1504,8 +1541,21 @@ var CartEndpoint = /*#__PURE__*/function (_BaseExtend) {
|
|
|
1504
1541
|
key: "AddPromotion",
|
|
1505
1542
|
value: function AddPromotion(code) {
|
|
1506
1543
|
var token = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1507
|
-
var
|
|
1508
|
-
|
|
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);
|
|
1554
|
+
}
|
|
1555
|
+
}, {
|
|
1556
|
+
key: "RemovePromotion",
|
|
1557
|
+
value: function RemovePromotion(promoCode) {
|
|
1558
|
+
return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/discounts/").concat(promoCode), 'DELETE');
|
|
1509
1559
|
}
|
|
1510
1560
|
}, {
|
|
1511
1561
|
key: "BulkAdd",
|
|
@@ -1587,7 +1637,7 @@ var CartEndpoint = /*#__PURE__*/function (_BaseExtend) {
|
|
|
1587
1637
|
var id = _ref.id,
|
|
1588
1638
|
quantity = _ref.quantity,
|
|
1589
1639
|
type = _ref.type,
|
|
1590
|
-
rest = _objectWithoutProperties(_ref,
|
|
1640
|
+
rest = _objectWithoutProperties(_ref, _excluded2);
|
|
1591
1641
|
return buildCartItemData(id, quantity, type, rest);
|
|
1592
1642
|
});
|
|
1593
1643
|
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 {
|
|
@@ -4713,15 +4720,6 @@ interface CartEndpoint
|
|
|
4713
4720
|
ShippingGroup: CartShippingGroupBase
|
|
4714
4721
|
): Promise<ShippingGroupResponse>
|
|
4715
4722
|
|
|
4716
|
-
/**
|
|
4717
|
-
* Add Promotion to Cart
|
|
4718
|
-
* Description: You can use the Promotions API to apply discounts to your cart as a special cart item type.
|
|
4719
|
-
* DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/carts-and-orders/carts/add-promotion-to-cart.html
|
|
4720
|
-
* @param code the promotion code.
|
|
4721
|
-
* @param token a customer token to apply customer specific promotions.
|
|
4722
|
-
*/
|
|
4723
|
-
AddPromotion(code: string, token?: string): Promise<CartItemsResponse>
|
|
4724
|
-
|
|
4725
4723
|
/**
|
|
4726
4724
|
* Get a Cart by reference
|
|
4727
4725
|
* DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/carts-and-checkout/carts/get-a-cart.html
|
|
@@ -4756,6 +4754,21 @@ interface CartEndpoint
|
|
|
4756
4754
|
additionalHeaders?: CartAdditionalHeaders
|
|
4757
4755
|
): Promise<CartItemsResponse>
|
|
4758
4756
|
|
|
4757
|
+
/**
|
|
4758
|
+
* Add Multiple Products to Cart
|
|
4759
|
+
* Description: Add multiple products to cart in a single request. Each product can be identified by either ID or SKU.
|
|
4760
|
+
* @param products Array of products to add, each with either an id or sku field
|
|
4761
|
+
* @param options Optional bulk add options
|
|
4762
|
+
* @param token Optional customer token
|
|
4763
|
+
* @param additionalHeaders Optional additional headers
|
|
4764
|
+
*/
|
|
4765
|
+
AddProducts(
|
|
4766
|
+
products: AddProductsItem[],
|
|
4767
|
+
options?: BulkAddOptions,
|
|
4768
|
+
token?: string,
|
|
4769
|
+
additionalHeaders?: CartAdditionalHeaders
|
|
4770
|
+
): Promise<CartItemsResponse>
|
|
4771
|
+
|
|
4759
4772
|
RemoveAllItems(): Promise<CartItemsResponse>
|
|
4760
4773
|
|
|
4761
4774
|
/**
|
|
@@ -4786,8 +4799,18 @@ interface CartEndpoint
|
|
|
4786
4799
|
* Description: You can use the Promotions API to apply discounts to your cart as a special cart item type.
|
|
4787
4800
|
* DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/carts-and-orders/carts/add-promotion-to-cart.html
|
|
4788
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.
|
|
4804
|
+
*/
|
|
4805
|
+
AddPromotion(code: string, token?: string, currency?: string): Promise<CartItemsResponse>
|
|
4806
|
+
|
|
4807
|
+
/**
|
|
4808
|
+
* Remove promotion from Cart
|
|
4809
|
+
* Description: Removes a manually applied promotion code from a cart. Does not work if the promotion is applied automatically.
|
|
4810
|
+
* DOCS: https://developer.elasticpath.com/docs/api/carts/delete-a-promotion-via-promotion-code
|
|
4811
|
+
* @param promoCode the promotion code to remove.
|
|
4789
4812
|
*/
|
|
4790
|
-
|
|
4813
|
+
RemovePromotion(promoCode: string): Promise<{}>
|
|
4791
4814
|
|
|
4792
4815
|
/**
|
|
4793
4816
|
* Bulk Update Items to Cart
|
|
@@ -9202,4 +9225,4 @@ declare namespace elasticpath {
|
|
|
9202
9225
|
}
|
|
9203
9226
|
}
|
|
9204
9227
|
|
|
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 };
|
|
9228
|
+
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.
|
|
522
|
+
var version = "28.1.1";
|
|
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", "
|
|
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) {
|
|
@@ -1493,8 +1530,21 @@ var CartEndpoint = /*#__PURE__*/function (_BaseExtend) {
|
|
|
1493
1530
|
key: "AddPromotion",
|
|
1494
1531
|
value: function AddPromotion(code) {
|
|
1495
1532
|
var token = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1496
|
-
var
|
|
1497
|
-
|
|
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);
|
|
1543
|
+
}
|
|
1544
|
+
}, {
|
|
1545
|
+
key: "RemovePromotion",
|
|
1546
|
+
value: function RemovePromotion(promoCode) {
|
|
1547
|
+
return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/discounts/").concat(promoCode), 'DELETE');
|
|
1498
1548
|
}
|
|
1499
1549
|
}, {
|
|
1500
1550
|
key: "BulkAdd",
|
|
@@ -1576,7 +1626,7 @@ var CartEndpoint = /*#__PURE__*/function (_BaseExtend) {
|
|
|
1576
1626
|
var id = _ref.id,
|
|
1577
1627
|
quantity = _ref.quantity,
|
|
1578
1628
|
type = _ref.type,
|
|
1579
|
-
rest = _objectWithoutProperties(_ref,
|
|
1629
|
+
rest = _objectWithoutProperties(_ref, _excluded2);
|
|
1580
1630
|
return buildCartItemData(id, quantity, type, rest);
|
|
1581
1631
|
});
|
|
1582
1632
|
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.
|
|
1088
|
+
var version = "28.1.1";
|
|
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", "
|
|
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) {
|
|
@@ -2661,8 +2698,21 @@
|
|
|
2661
2698
|
key: "AddPromotion",
|
|
2662
2699
|
value: function AddPromotion(code) {
|
|
2663
2700
|
var token = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2664
|
-
var
|
|
2665
|
-
|
|
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);
|
|
2711
|
+
}
|
|
2712
|
+
}, {
|
|
2713
|
+
key: "RemovePromotion",
|
|
2714
|
+
value: function RemovePromotion(promoCode) {
|
|
2715
|
+
return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/discounts/").concat(promoCode), 'DELETE');
|
|
2666
2716
|
}
|
|
2667
2717
|
}, {
|
|
2668
2718
|
key: "BulkAdd",
|
|
@@ -2744,7 +2794,7 @@
|
|
|
2744
2794
|
var id = _ref.id,
|
|
2745
2795
|
quantity = _ref.quantity,
|
|
2746
2796
|
type = _ref.type,
|
|
2747
|
-
rest = _objectWithoutProperties(_ref,
|
|
2797
|
+
rest = _objectWithoutProperties(_ref, _excluded2);
|
|
2748
2798
|
return buildCartItemData(id, quantity, type, rest);
|
|
2749
2799
|
});
|
|
2750
2800
|
return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'PUT', body);
|
package/package.json
CHANGED