@elasticpath/js-sdk 24.0.0 → 24.2.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 = "24.0.0";
533
+ var version = "24.2.0";
534
534
 
535
535
  var LocalStorageFactory = /*#__PURE__*/function () {
536
536
  function LocalStorageFactory() {
@@ -779,10 +779,10 @@ function formatFilterString(type, filter) {
779
779
  var queryString = "".concat(key, ",").concat(value);
780
780
  if (Array.isArray(value)) {
781
781
  queryString = "".concat(key, ",").concat(value.join(','));
782
- } else if (_typeof(value) === 'object') {
782
+ } else if (_typeof(value) === 'object' && value !== null) {
783
783
  queryString = Object.keys(value).map(function (attr) {
784
784
  return "".concat(key, ".").concat(attr, ",").concat(value[attr]);
785
- });
785
+ }).join(':');
786
786
  }
787
787
  return "".concat(type, "(").concat(queryString, ")");
788
788
  });
@@ -793,6 +793,14 @@ function formatQueryString(key, value) {
793
793
  return "page".concat(value);
794
794
  }
795
795
  if (key === 'filter') {
796
+ if (value.or && Array.isArray(value.or)) {
797
+ var orQueries = value.or.map(function (filterGroup) {
798
+ return Object.keys(filterGroup).map(function (filterType) {
799
+ return formatFilterString(filterType, filterGroup[filterType]);
800
+ }).join(':');
801
+ });
802
+ return "".concat(key, "=(").concat(orQueries.join('|'), ")");
803
+ }
796
804
  var filterValues = Object.keys(value).map(function (filter) {
797
805
  return formatFilterString(filter, value[filter]);
798
806
  });
@@ -4791,6 +4799,103 @@ var MultiLocationInventories = /*#__PURE__*/function () {
4791
4799
  this.filter = filter;
4792
4800
  return this;
4793
4801
  }
4802
+
4803
+ // Transactions endpoints
4804
+ }, {
4805
+ key: "IncrementStock",
4806
+ value: function IncrementStock(productId, quantity) {
4807
+ var location = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
4808
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions"), 'POST', {
4809
+ attributes: _objectSpread2({
4810
+ type: 'stock-transaction',
4811
+ action: 'increment',
4812
+ quantity: quantity,
4813
+ product_id: productId
4814
+ }, location && {
4815
+ location: location
4816
+ })
4817
+ });
4818
+ }
4819
+ }, {
4820
+ key: "DecrementStock",
4821
+ value: function DecrementStock(productId, quantity) {
4822
+ var location = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
4823
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions"), 'POST', {
4824
+ attributes: _objectSpread2({
4825
+ type: 'stock-transaction',
4826
+ action: 'decrement',
4827
+ quantity: quantity,
4828
+ product_id: productId
4829
+ }, location && {
4830
+ location: location
4831
+ })
4832
+ });
4833
+ }
4834
+ }, {
4835
+ key: "AllocateStock",
4836
+ value: function AllocateStock(productId, quantity) {
4837
+ var location = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
4838
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions"), 'POST', {
4839
+ attributes: _objectSpread2({
4840
+ type: 'stock-transaction',
4841
+ action: 'allocate',
4842
+ quantity: quantity,
4843
+ product_id: productId
4844
+ }, location && {
4845
+ location: location
4846
+ })
4847
+ });
4848
+ }
4849
+ }, {
4850
+ key: "DeallocateStock",
4851
+ value: function DeallocateStock(productId, quantity) {
4852
+ var location = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
4853
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions"), 'POST', {
4854
+ attributes: _objectSpread2({
4855
+ type: 'stock-transaction',
4856
+ action: 'deallocate',
4857
+ quantity: quantity,
4858
+ product_id: productId
4859
+ }, location && {
4860
+ location: location
4861
+ })
4862
+ });
4863
+ }
4864
+ }, {
4865
+ key: "SetStock",
4866
+ value: function SetStock(productId, quantity) {
4867
+ var location = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
4868
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions"), 'POST', {
4869
+ attributes: _objectSpread2({
4870
+ type: 'stock-transaction',
4871
+ action: 'set',
4872
+ quantity: quantity,
4873
+ product_id: productId
4874
+ }, location && {
4875
+ location: location
4876
+ })
4877
+ });
4878
+ }
4879
+ }, {
4880
+ key: "GetTransactions",
4881
+ value: function GetTransactions(productId) {
4882
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions"), 'GET');
4883
+ }
4884
+ }, {
4885
+ key: "GetTransaction",
4886
+ value: function GetTransaction(productId, transactionId) {
4887
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions/").concat(transactionId), 'GET');
4888
+ }
4889
+ }, {
4890
+ key: "GetMultipleStock",
4891
+ value: function GetMultipleStock(productIds) {
4892
+ var body = productIds.map(function (id) {
4893
+ return {
4894
+ id: id
4895
+ };
4896
+ });
4897
+ return this.request.send("".concat(this.endpoint, "/multiple"), 'POST', body);
4898
+ }
4794
4899
  }]);
4795
4900
  return MultiLocationInventories;
4796
4901
  }();
package/dist/index.d.ts CHANGED
@@ -8760,6 +8760,20 @@ interface MultiLocationInventoryFilter {
8760
8760
  }
8761
8761
  }
8762
8762
 
8763
+ interface MultiLocationInventoryResponse extends Identifiable {
8764
+ type: string
8765
+ attributes: {
8766
+ action: InventoryActionTypes
8767
+ product_id: string
8768
+ quantity: number
8769
+ }
8770
+ meta: {
8771
+ timestamps: {
8772
+ created_at: string
8773
+ }
8774
+ }
8775
+ }
8776
+
8763
8777
  /**
8764
8778
  * Multi Location Inventories Endpoint Interface
8765
8779
  */
@@ -8809,6 +8823,90 @@ interface MultiLocationInventoriesEndpoint {
8809
8823
  Offset(value: number): MultiLocationInventoriesEndpoint
8810
8824
 
8811
8825
  Filter(filter: MultiLocationInventoryFilter): MultiLocationInventoriesEndpoint
8826
+
8827
+ /**
8828
+ * Increment Stock
8829
+ * @param productId The ID for the product you're performing this action on.
8830
+ * @param quantity The amount of stock affected by this transaction.
8831
+ * @param location The slug of the location that the transaction should act on.
8832
+ */
8833
+ IncrementStock(
8834
+ productId: string,
8835
+ quantity: number,
8836
+ location?: string
8837
+ ): Promise<Resource<MultiLocationInventoryResponse>>
8838
+
8839
+ /**
8840
+ * Decrement Stock
8841
+ * @param productId The ID for the product you're performing this action on.
8842
+ * @param quantity The amount of stock affected by this transaction.
8843
+ * @param location The slug of the location that the transaction should act on.
8844
+ */
8845
+ DecrementStock(
8846
+ productId: string,
8847
+ quantity: number,
8848
+ location?: string
8849
+ ): Promise<Resource<MultiLocationInventoryResponse>>
8850
+
8851
+ /**
8852
+ * Allocate Stock
8853
+ * @param productId The ID for the product you're performing this action on.
8854
+ * @param quantity The amount of stock affected by this transaction.
8855
+ * @param location The slug of the location that the transaction should act on.
8856
+ */
8857
+ AllocateStock(
8858
+ productId: string,
8859
+ quantity: number,
8860
+ location?: string
8861
+ ): Promise<Resource<MultiLocationInventoryResponse>>
8862
+
8863
+ /**
8864
+ * Deallocate Stock
8865
+ * @param productId The ID for the product you're performing this action on.
8866
+ * @param quantity The amount of stock affected by this transaction.
8867
+ * @param location The slug of the location that the transaction should act on.
8868
+ */
8869
+ DeallocateStock(
8870
+ productId: string,
8871
+ quantity: number,
8872
+ location?: string
8873
+ ): Promise<Resource<MultiLocationInventoryResponse>>
8874
+
8875
+ /**
8876
+ * Set Stock
8877
+ * @param productId The ID for the product you're performing this action on.
8878
+ * @param quantity The amount of stock affected by this transaction.
8879
+ * @param location The slug of the location that the transaction should act on.
8880
+ */
8881
+ SetStock(
8882
+ productId: string,
8883
+ quantity: number,
8884
+ location?: string
8885
+ ): Promise<Resource<MultiLocationInventoryResponse>>
8886
+
8887
+ /**
8888
+ * Get Transactions
8889
+ * @param productId The ID for the product you're performing this action on.
8890
+ */
8891
+ GetTransactions(
8892
+ productId: string
8893
+ ): Promise<ResourceList<MultiLocationInventoryResponse>>
8894
+
8895
+ /**
8896
+ * Get Transaction
8897
+ * @param productId The ID for the product you're performing this action on.
8898
+ * @param transactionId The ID for the transaction created on the product.
8899
+ */
8900
+ GetTransaction(
8901
+ productId: string,
8902
+ transactionId: string
8903
+ ): Promise<Resource<MultiLocationInventoryResponse>>
8904
+
8905
+ /**
8906
+ * Get Stocks for Multiple Products
8907
+ * @param productIds The array of unique identifier of the products.
8908
+ */
8909
+ GetMultipleStock(productIds: string[]): Promise<ResourceList<StockResponse>>
8812
8910
  }
8813
8911
 
8814
8912
  interface BuiltInRolePolicy {
@@ -8998,4 +9096,4 @@ declare namespace elasticpath {
8998
9096
  }
8999
9097
  }
9000
9098
 
9001
- 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, 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, 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 };
9099
+ 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, 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 };
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 = "24.0.0";
522
+ var version = "24.2.0";
523
523
 
524
524
  var LocalStorageFactory = /*#__PURE__*/function () {
525
525
  function LocalStorageFactory() {
@@ -768,10 +768,10 @@ function formatFilterString(type, filter) {
768
768
  var queryString = "".concat(key, ",").concat(value);
769
769
  if (Array.isArray(value)) {
770
770
  queryString = "".concat(key, ",").concat(value.join(','));
771
- } else if (_typeof(value) === 'object') {
771
+ } else if (_typeof(value) === 'object' && value !== null) {
772
772
  queryString = Object.keys(value).map(function (attr) {
773
773
  return "".concat(key, ".").concat(attr, ",").concat(value[attr]);
774
- });
774
+ }).join(':');
775
775
  }
776
776
  return "".concat(type, "(").concat(queryString, ")");
777
777
  });
@@ -782,6 +782,14 @@ function formatQueryString(key, value) {
782
782
  return "page".concat(value);
783
783
  }
784
784
  if (key === 'filter') {
785
+ if (value.or && Array.isArray(value.or)) {
786
+ var orQueries = value.or.map(function (filterGroup) {
787
+ return Object.keys(filterGroup).map(function (filterType) {
788
+ return formatFilterString(filterType, filterGroup[filterType]);
789
+ }).join(':');
790
+ });
791
+ return "".concat(key, "=(").concat(orQueries.join('|'), ")");
792
+ }
785
793
  var filterValues = Object.keys(value).map(function (filter) {
786
794
  return formatFilterString(filter, value[filter]);
787
795
  });
@@ -4780,6 +4788,103 @@ var MultiLocationInventories = /*#__PURE__*/function () {
4780
4788
  this.filter = filter;
4781
4789
  return this;
4782
4790
  }
4791
+
4792
+ // Transactions endpoints
4793
+ }, {
4794
+ key: "IncrementStock",
4795
+ value: function IncrementStock(productId, quantity) {
4796
+ var location = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
4797
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions"), 'POST', {
4798
+ attributes: _objectSpread2({
4799
+ type: 'stock-transaction',
4800
+ action: 'increment',
4801
+ quantity: quantity,
4802
+ product_id: productId
4803
+ }, location && {
4804
+ location: location
4805
+ })
4806
+ });
4807
+ }
4808
+ }, {
4809
+ key: "DecrementStock",
4810
+ value: function DecrementStock(productId, quantity) {
4811
+ var location = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
4812
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions"), 'POST', {
4813
+ attributes: _objectSpread2({
4814
+ type: 'stock-transaction',
4815
+ action: 'decrement',
4816
+ quantity: quantity,
4817
+ product_id: productId
4818
+ }, location && {
4819
+ location: location
4820
+ })
4821
+ });
4822
+ }
4823
+ }, {
4824
+ key: "AllocateStock",
4825
+ value: function AllocateStock(productId, quantity) {
4826
+ var location = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
4827
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions"), 'POST', {
4828
+ attributes: _objectSpread2({
4829
+ type: 'stock-transaction',
4830
+ action: 'allocate',
4831
+ quantity: quantity,
4832
+ product_id: productId
4833
+ }, location && {
4834
+ location: location
4835
+ })
4836
+ });
4837
+ }
4838
+ }, {
4839
+ key: "DeallocateStock",
4840
+ value: function DeallocateStock(productId, quantity) {
4841
+ var location = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
4842
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions"), 'POST', {
4843
+ attributes: _objectSpread2({
4844
+ type: 'stock-transaction',
4845
+ action: 'deallocate',
4846
+ quantity: quantity,
4847
+ product_id: productId
4848
+ }, location && {
4849
+ location: location
4850
+ })
4851
+ });
4852
+ }
4853
+ }, {
4854
+ key: "SetStock",
4855
+ value: function SetStock(productId, quantity) {
4856
+ var location = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
4857
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions"), 'POST', {
4858
+ attributes: _objectSpread2({
4859
+ type: 'stock-transaction',
4860
+ action: 'set',
4861
+ quantity: quantity,
4862
+ product_id: productId
4863
+ }, location && {
4864
+ location: location
4865
+ })
4866
+ });
4867
+ }
4868
+ }, {
4869
+ key: "GetTransactions",
4870
+ value: function GetTransactions(productId) {
4871
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions"), 'GET');
4872
+ }
4873
+ }, {
4874
+ key: "GetTransaction",
4875
+ value: function GetTransaction(productId, transactionId) {
4876
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions/").concat(transactionId), 'GET');
4877
+ }
4878
+ }, {
4879
+ key: "GetMultipleStock",
4880
+ value: function GetMultipleStock(productIds) {
4881
+ var body = productIds.map(function (id) {
4882
+ return {
4883
+ id: id
4884
+ };
4885
+ });
4886
+ return this.request.send("".concat(this.endpoint, "/multiple"), 'POST', body);
4887
+ }
4783
4888
  }]);
4784
4889
  return MultiLocationInventories;
4785
4890
  }();
package/dist/index.js CHANGED
@@ -1085,7 +1085,7 @@
1085
1085
  globalThis.Response = browserPonyfill.exports.Response;
1086
1086
  }
1087
1087
 
1088
- var version = "24.0.0";
1088
+ var version = "24.2.0";
1089
1089
 
1090
1090
  var LocalStorageFactory = /*#__PURE__*/function () {
1091
1091
  function LocalStorageFactory() {
@@ -1936,10 +1936,10 @@
1936
1936
  var queryString = "".concat(key, ",").concat(value);
1937
1937
  if (Array.isArray(value)) {
1938
1938
  queryString = "".concat(key, ",").concat(value.join(','));
1939
- } else if (_typeof(value) === 'object') {
1939
+ } else if (_typeof(value) === 'object' && value !== null) {
1940
1940
  queryString = Object.keys(value).map(function (attr) {
1941
1941
  return "".concat(key, ".").concat(attr, ",").concat(value[attr]);
1942
- });
1942
+ }).join(':');
1943
1943
  }
1944
1944
  return "".concat(type, "(").concat(queryString, ")");
1945
1945
  });
@@ -1950,6 +1950,14 @@
1950
1950
  return "page".concat(value);
1951
1951
  }
1952
1952
  if (key === 'filter') {
1953
+ if (value.or && Array.isArray(value.or)) {
1954
+ var orQueries = value.or.map(function (filterGroup) {
1955
+ return Object.keys(filterGroup).map(function (filterType) {
1956
+ return formatFilterString(filterType, filterGroup[filterType]);
1957
+ }).join(':');
1958
+ });
1959
+ return "".concat(key, "=(").concat(orQueries.join('|'), ")");
1960
+ }
1953
1961
  var filterValues = Object.keys(value).map(function (filter) {
1954
1962
  return formatFilterString(filter, value[filter]);
1955
1963
  });
@@ -5952,6 +5960,103 @@
5952
5960
  this.filter = filter;
5953
5961
  return this;
5954
5962
  }
5963
+
5964
+ // Transactions endpoints
5965
+ }, {
5966
+ key: "IncrementStock",
5967
+ value: function IncrementStock(productId, quantity) {
5968
+ var location = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
5969
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions"), 'POST', {
5970
+ attributes: _objectSpread2({
5971
+ type: 'stock-transaction',
5972
+ action: 'increment',
5973
+ quantity: quantity,
5974
+ product_id: productId
5975
+ }, location && {
5976
+ location: location
5977
+ })
5978
+ });
5979
+ }
5980
+ }, {
5981
+ key: "DecrementStock",
5982
+ value: function DecrementStock(productId, quantity) {
5983
+ var location = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
5984
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions"), 'POST', {
5985
+ attributes: _objectSpread2({
5986
+ type: 'stock-transaction',
5987
+ action: 'decrement',
5988
+ quantity: quantity,
5989
+ product_id: productId
5990
+ }, location && {
5991
+ location: location
5992
+ })
5993
+ });
5994
+ }
5995
+ }, {
5996
+ key: "AllocateStock",
5997
+ value: function AllocateStock(productId, quantity) {
5998
+ var location = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
5999
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions"), 'POST', {
6000
+ attributes: _objectSpread2({
6001
+ type: 'stock-transaction',
6002
+ action: 'allocate',
6003
+ quantity: quantity,
6004
+ product_id: productId
6005
+ }, location && {
6006
+ location: location
6007
+ })
6008
+ });
6009
+ }
6010
+ }, {
6011
+ key: "DeallocateStock",
6012
+ value: function DeallocateStock(productId, quantity) {
6013
+ var location = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
6014
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions"), 'POST', {
6015
+ attributes: _objectSpread2({
6016
+ type: 'stock-transaction',
6017
+ action: 'deallocate',
6018
+ quantity: quantity,
6019
+ product_id: productId
6020
+ }, location && {
6021
+ location: location
6022
+ })
6023
+ });
6024
+ }
6025
+ }, {
6026
+ key: "SetStock",
6027
+ value: function SetStock(productId, quantity) {
6028
+ var location = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
6029
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions"), 'POST', {
6030
+ attributes: _objectSpread2({
6031
+ type: 'stock-transaction',
6032
+ action: 'set',
6033
+ quantity: quantity,
6034
+ product_id: productId
6035
+ }, location && {
6036
+ location: location
6037
+ })
6038
+ });
6039
+ }
6040
+ }, {
6041
+ key: "GetTransactions",
6042
+ value: function GetTransactions(productId) {
6043
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions"), 'GET');
6044
+ }
6045
+ }, {
6046
+ key: "GetTransaction",
6047
+ value: function GetTransaction(productId, transactionId) {
6048
+ return this.request.send("".concat(this.endpoint, "/").concat(productId, "/transactions/").concat(transactionId), 'GET');
6049
+ }
6050
+ }, {
6051
+ key: "GetMultipleStock",
6052
+ value: function GetMultipleStock(productIds) {
6053
+ var body = productIds.map(function (id) {
6054
+ return {
6055
+ id: id
6056
+ };
6057
+ });
6058
+ return this.request.send("".concat(this.endpoint, "/multiple"), 'POST', body);
6059
+ }
5955
6060
  }]);
5956
6061
  return MultiLocationInventories;
5957
6062
  }();
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": "24.0.0",
4
+ "version": "24.2.0",
5
5
  "homepage": "https://github.com/elasticpath/js-sdk",
6
6
  "author": "Elastic Path (https://elasticpath.com/)",
7
7
  "files": [