@elasticpath/js-sdk 28.1.0 → 29.0.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.1.0";
533
+ var version = "29.0.0";
534
534
 
535
535
  var LocalStorageFactory = /*#__PURE__*/function () {
536
536
  function LocalStorageFactory() {
@@ -1541,8 +1541,16 @@ var CartEndpoint = /*#__PURE__*/function (_BaseExtend) {
1541
1541
  key: "AddPromotion",
1542
1542
  value: function AddPromotion(code) {
1543
1543
  var token = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1544
- var body = buildCartItemData(code, null, 'promotion_item');
1545
- return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', body, token);
1544
+ var currency = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
1545
+ var additionalHeaders = currency ? {
1546
+ 'X-MOLTIN-CURRENCY': currency
1547
+ } : {};
1548
+ return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', {
1549
+ data: {
1550
+ type: 'promotion_item',
1551
+ code: code
1552
+ }
1553
+ }, token, null, null, null, additionalHeaders);
1546
1554
  }
1547
1555
  }, {
1548
1556
  key: "RemovePromotion",
@@ -4111,6 +4119,32 @@ var MetricsEndpoint = /*#__PURE__*/function (_BaseExtend) {
4111
4119
  var formattedString = formatQueryParams(query);
4112
4120
  return this.request.send("".concat(this.endpoint, "/orders/value?").concat(formattedString), 'GET');
4113
4121
  }
4122
+
4123
+ // V2 Metrics Endpoints
4124
+ }, {
4125
+ key: "GetOrderMetricsSummary",
4126
+ value: function GetOrderMetricsSummary(query) {
4127
+ var formattedString = formatQueryParams(query);
4128
+ return this.request.send("".concat(this.endpoint, "/orders/summary?").concat(formattedString), 'GET');
4129
+ }
4130
+ }, {
4131
+ key: "GetOrderCountTimeSeries",
4132
+ value: function GetOrderCountTimeSeries(query) {
4133
+ var formattedString = formatQueryParams(query);
4134
+ return this.request.send("".concat(this.endpoint, "/orders/timeseries/count?").concat(formattedString), 'GET');
4135
+ }
4136
+ }, {
4137
+ key: "GetOrderDiscountTimeSeries",
4138
+ value: function GetOrderDiscountTimeSeries(query) {
4139
+ var formattedString = formatQueryParams(query);
4140
+ return this.request.send("".concat(this.endpoint, "/orders/timeseries/discount?").concat(formattedString), 'GET');
4141
+ }
4142
+ }, {
4143
+ key: "GetOrderValueTimeSeries",
4144
+ value: function GetOrderValueTimeSeries(query) {
4145
+ var formattedString = formatQueryParams(query);
4146
+ return this.request.send("".concat(this.endpoint, "/orders/timeseries/value?").concat(formattedString), 'GET');
4147
+ }
4114
4148
  }]);
4115
4149
  return MetricsEndpoint;
4116
4150
  }(BaseExtend);
package/dist/index.d.ts CHANGED
@@ -4720,15 +4720,6 @@ interface CartEndpoint
4720
4720
  ShippingGroup: CartShippingGroupBase
4721
4721
  ): Promise<ShippingGroupResponse>
4722
4722
 
4723
- /**
4724
- * Add Promotion to Cart
4725
- * Description: You can use the Promotions API to apply discounts to your cart as a special cart item type.
4726
- * DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/carts-and-orders/carts/add-promotion-to-cart.html
4727
- * @param code the promotion code.
4728
- * @param token a customer token to apply customer specific promotions.
4729
- */
4730
- AddPromotion(code: string, token?: string): Promise<CartItemsResponse>
4731
-
4732
4723
  /**
4733
4724
  * Get a Cart by reference
4734
4725
  * DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/carts-and-checkout/carts/get-a-cart.html
@@ -4808,8 +4799,10 @@ interface CartEndpoint
4808
4799
  * Description: You can use the Promotions API to apply discounts to your cart as a special cart item type.
4809
4800
  * DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/carts-and-orders/carts/add-promotion-to-cart.html
4810
4801
  * @param code the promotion code.
4802
+ * @param token a customer token to apply customer specific promotions.
4803
+ * @param currency the currency to apply the promotion in.
4811
4804
  */
4812
- AddPromotion(code: string): Promise<CartItemsResponse>
4805
+ AddPromotion(code: string, token?: string, currency?: string): Promise<CartItemsResponse>
4813
4806
 
4814
4807
  /**
4815
4808
  * Remove promotion from Cart
@@ -7337,10 +7330,61 @@ interface MetricsQuery {
7337
7330
  interval: string
7338
7331
  }
7339
7332
 
7333
+ // V2 Metrics Types
7334
+ interface MetricsFilter {
7335
+ contains?: Record<string, string>
7336
+ }
7337
+
7338
+ interface MetricsV2Query {
7339
+ start_date: string
7340
+ end_date: string
7341
+ currency: string
7342
+ interval?: '1hr' | '1d'
7343
+ filter?: MetricsFilter
7344
+ }
7345
+
7346
+ interface OrderMetricsSummary {
7347
+ count: number
7348
+ total_value: number
7349
+ total_discount: number
7350
+ }
7351
+
7352
+ interface OrderCountTimeSeries {
7353
+ start_date: string
7354
+ count: number
7355
+ }
7356
+
7357
+ interface OrderDiscountTimeSeries {
7358
+ start_date: string
7359
+ discount: number
7360
+ }
7361
+
7362
+ interface OrderValueTimeSeries {
7363
+ start_date: string
7364
+ value: number
7365
+ }
7366
+
7340
7367
  interface MetricsEndpoint {
7341
7368
  TotalOrders(query: MetricsQuery): Promise<ResourcePage<MetricsBase>>
7342
7369
 
7343
7370
  TotalValue(query: MetricsQuery): Promise<ResourcePage<MetricsBase>>
7371
+
7372
+ // V2 Metrics Endpoints
7373
+ GetOrderMetricsSummary(
7374
+ query: MetricsV2Query
7375
+ ): Promise<{ data: OrderMetricsSummary }>
7376
+
7377
+ GetOrderCountTimeSeries(
7378
+ query: MetricsV2Query
7379
+ ): Promise<{ data: OrderCountTimeSeries[] }>
7380
+
7381
+ GetOrderDiscountTimeSeries(
7382
+ query: MetricsV2Query
7383
+ ): Promise<{ data: OrderDiscountTimeSeries[] }>
7384
+
7385
+ GetOrderValueTimeSeries(
7386
+ query: MetricsV2Query
7387
+ ): Promise<{ data: OrderValueTimeSeries[] }>
7344
7388
  }
7345
7389
 
7346
7390
  interface PersonalDataRecord extends Identifiable {
@@ -9232,4 +9276,4 @@ declare namespace elasticpath {
9232
9276
  }
9233
9277
  }
9234
9278
 
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 };
9279
+ 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, MetricsFilter, MetricsQuery, MetricsV2Query, 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, OrderCountTimeSeries, OrderDiscountTimeSeries, OrderFilter, OrderInclude, OrderIncluded, OrderItem, OrderItemBase, OrderMetricsSummary, OrderResponse, OrderShippingAddress, OrderSort, OrderSortAscend, OrderSortDescend, OrderValueTimeSeries, 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.1.0";
522
+ var version = "29.0.0";
523
523
 
524
524
  var LocalStorageFactory = /*#__PURE__*/function () {
525
525
  function LocalStorageFactory() {
@@ -1530,8 +1530,16 @@ var CartEndpoint = /*#__PURE__*/function (_BaseExtend) {
1530
1530
  key: "AddPromotion",
1531
1531
  value: function AddPromotion(code) {
1532
1532
  var token = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1533
- var body = buildCartItemData(code, null, 'promotion_item');
1534
- return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', body, token);
1533
+ var currency = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
1534
+ var additionalHeaders = currency ? {
1535
+ 'X-MOLTIN-CURRENCY': currency
1536
+ } : {};
1537
+ return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', {
1538
+ data: {
1539
+ type: 'promotion_item',
1540
+ code: code
1541
+ }
1542
+ }, token, null, null, null, additionalHeaders);
1535
1543
  }
1536
1544
  }, {
1537
1545
  key: "RemovePromotion",
@@ -4100,6 +4108,32 @@ var MetricsEndpoint = /*#__PURE__*/function (_BaseExtend) {
4100
4108
  var formattedString = formatQueryParams(query);
4101
4109
  return this.request.send("".concat(this.endpoint, "/orders/value?").concat(formattedString), 'GET');
4102
4110
  }
4111
+
4112
+ // V2 Metrics Endpoints
4113
+ }, {
4114
+ key: "GetOrderMetricsSummary",
4115
+ value: function GetOrderMetricsSummary(query) {
4116
+ var formattedString = formatQueryParams(query);
4117
+ return this.request.send("".concat(this.endpoint, "/orders/summary?").concat(formattedString), 'GET');
4118
+ }
4119
+ }, {
4120
+ key: "GetOrderCountTimeSeries",
4121
+ value: function GetOrderCountTimeSeries(query) {
4122
+ var formattedString = formatQueryParams(query);
4123
+ return this.request.send("".concat(this.endpoint, "/orders/timeseries/count?").concat(formattedString), 'GET');
4124
+ }
4125
+ }, {
4126
+ key: "GetOrderDiscountTimeSeries",
4127
+ value: function GetOrderDiscountTimeSeries(query) {
4128
+ var formattedString = formatQueryParams(query);
4129
+ return this.request.send("".concat(this.endpoint, "/orders/timeseries/discount?").concat(formattedString), 'GET');
4130
+ }
4131
+ }, {
4132
+ key: "GetOrderValueTimeSeries",
4133
+ value: function GetOrderValueTimeSeries(query) {
4134
+ var formattedString = formatQueryParams(query);
4135
+ return this.request.send("".concat(this.endpoint, "/orders/timeseries/value?").concat(formattedString), 'GET');
4136
+ }
4103
4137
  }]);
4104
4138
  return MetricsEndpoint;
4105
4139
  }(BaseExtend);
package/dist/index.js CHANGED
@@ -1085,7 +1085,7 @@
1085
1085
  globalThis.Response = browserPonyfill.exports.Response;
1086
1086
  }
1087
1087
 
1088
- var version = "28.1.0";
1088
+ var version = "29.0.0";
1089
1089
 
1090
1090
  var LocalStorageFactory = /*#__PURE__*/function () {
1091
1091
  function LocalStorageFactory() {
@@ -2698,8 +2698,16 @@
2698
2698
  key: "AddPromotion",
2699
2699
  value: function AddPromotion(code) {
2700
2700
  var token = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
2701
- var body = buildCartItemData(code, null, 'promotion_item');
2702
- return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', body, token);
2701
+ var currency = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
2702
+ var additionalHeaders = currency ? {
2703
+ 'X-MOLTIN-CURRENCY': currency
2704
+ } : {};
2705
+ return this.request.send("".concat(this.endpoint, "/").concat(this.cartId, "/items"), 'POST', {
2706
+ data: {
2707
+ type: 'promotion_item',
2708
+ code: code
2709
+ }
2710
+ }, token, null, null, null, additionalHeaders);
2703
2711
  }
2704
2712
  }, {
2705
2713
  key: "RemovePromotion",
@@ -5272,6 +5280,32 @@
5272
5280
  var formattedString = formatQueryParams(query);
5273
5281
  return this.request.send("".concat(this.endpoint, "/orders/value?").concat(formattedString), 'GET');
5274
5282
  }
5283
+
5284
+ // V2 Metrics Endpoints
5285
+ }, {
5286
+ key: "GetOrderMetricsSummary",
5287
+ value: function GetOrderMetricsSummary(query) {
5288
+ var formattedString = formatQueryParams(query);
5289
+ return this.request.send("".concat(this.endpoint, "/orders/summary?").concat(formattedString), 'GET');
5290
+ }
5291
+ }, {
5292
+ key: "GetOrderCountTimeSeries",
5293
+ value: function GetOrderCountTimeSeries(query) {
5294
+ var formattedString = formatQueryParams(query);
5295
+ return this.request.send("".concat(this.endpoint, "/orders/timeseries/count?").concat(formattedString), 'GET');
5296
+ }
5297
+ }, {
5298
+ key: "GetOrderDiscountTimeSeries",
5299
+ value: function GetOrderDiscountTimeSeries(query) {
5300
+ var formattedString = formatQueryParams(query);
5301
+ return this.request.send("".concat(this.endpoint, "/orders/timeseries/discount?").concat(formattedString), 'GET');
5302
+ }
5303
+ }, {
5304
+ key: "GetOrderValueTimeSeries",
5305
+ value: function GetOrderValueTimeSeries(query) {
5306
+ var formattedString = formatQueryParams(query);
5307
+ return this.request.send("".concat(this.endpoint, "/orders/timeseries/value?").concat(formattedString), 'GET');
5308
+ }
5275
5309
  }]);
5276
5310
  return MetricsEndpoint;
5277
5311
  }(BaseExtend);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elasticpath/js-sdk",
3
3
  "description": "SDK for the Elastic Path eCommerce API",
4
- "version": "28.1.0",
4
+ "version": "29.0.0",
5
5
  "homepage": "https://github.com/elasticpath/js-sdk",
6
6
  "author": "Elastic Path (https://elasticpath.com/)",
7
7
  "files": [