Vue Storefront is now Alokai! Learn More
Change Log

Change Log

6.0.1

Patch Changes

Update axios to ^0.28.0 to mitigate security vulnerability CVE-2023-45857

6.0.0

Major Changes

  • CHANGED Changed minimum Node version from 16 to 18. The condition that was forcing the Node version to be lower than 19 is also removed.

Patch Changes

  • Updated dependencies:
    • @vsf-enterprise/sap-commerce-assisted-service-module-webservices-sdk@2.0.0
    • @vsf-enterprise/sap-commerce-webservices-sdk@5.0.0
    • @vsf-enterprise/sapcc-types@3.0.0

5.2.0

Minor Changes

  • ADDED getProductsByIds method that allows fetching a list of products by their ids through Alokai-OCC extension.
// Fetching products by their IDs
const products = await sdk.commerce.getProductsByIds({
  ids: ["1992695", "4392695"],
});
// Fetching a product and selecting response fields
const products = await sdk.commerce.getProductsByIds({
  ids: ["1992695", "4392695"],
  fields: "BASIC",
});

Patch Changes

  • Updated dependencies:
    • @vsf-enterprise/sap-commerce-webservices-sdk@4.1.0
    • @vsf-enterprise/sapcc-types@2.4.0

5.1.2

Patch Changes

  • CHANGED The type of the options.req parameter of the internal getUserIdFromRequest utility function is now MiddlewareContext['req'] (from @vsf-enterprise/middleware package). Previously it was wrongly the global Request type from TypeScript's built-in lib.dom.d.ts

5.1.1

Patch Changes

  • 1e8c2700: CHANGED MiddlewareStoreConfig has been deprecated, it's not used in the codebase. It has been merged into MiddlewareApiConfig.
  • 1e8c2700: ADDED missing export of logger and helper types.

5.1.0

Minor Changes

  • 9c0b22f6: CHANGED Update axios library from ^0.27.2 to 1.6.8. This change is non-breaking and should not require any changes to your codebase. To read more about latest changes in axios library, please visit axios release notes.

5.0.1

Patch Changes

  • 05936095: CHANGED several API methods have been refactored to improve docs and API reference.

5.0.0

Major Changes

  • CHANGED Endpoints interface. Previously, each endpoint contained context param, which is internal and shouldn't be exposed in the final interface. Now, Endpoints interface properties don't contain context param. If you need to use context param, you should use ApiMethods type.
    - import { Endpoints } from '@vsf-enterprise/sapcc-api';
    + import { ApiMethods } from '@vsf-enterprise/sapcc-api';
    
    • REMOVED ContextualizedEndpoints type. Use Endpoints instead.
    - import { ContextualizedEndpoints } from '@vsf-enterprise/sapcc-api';
    + import { Endpoints } from '@vsf-enterprise/sapcc-api';
    

Minor Changes

  • ADDED aliases for SAPCC API Client method names, to make migration to middlewareModule as smooth as possible.

Patch Changes

  • ADDED ApiMethods type to replace previous Endpoints interface.
  • CHANGED SapccIntegrationContext from type to interface to allow declaration merging.

4.4.1

Patch Changes

  • ADDED Added missing export of AUTH_USER_ID_COOKIE_NAME constant.

4.4.0

Minor Changes

  • CHANGED Integration is now able to retreive user id from vsf-user-id cookie.

Patch Changes

  • Updated dependencies
    • @vsf-enterprise/sapcc-types@2.3.0

4.3.1

Patch Changes

  • FIXED Add missing endpoints types for Assisted Service Module methods to ContextualizedEndpoints. This is mostly for internal use of VSF Unified Storefront.
    import { type ContextualizedEndpoints } from "@vsf-enterprise/sapcc-api";
    

4.3.0

Minor Changes

  • 1203f53d: Add Assisted Service Module's "autoComplete" method from Customer Controller
  • f4e2787f: Add Assisted Service Module's "searchCustomer360" method from ASM Customer 360 Controller
  • 4e5bead6: Add Assisted Service Module's "getPageableCustomers" method from Customer Controller
  • 78ce68c9: Add Assisted Service Module's "customerLists" method from Customer Lists Controller
  • 904c3dd4: Add Assisted Service Module's "bindCart" method from Customer Controller
  • bdb12bec: Add Assisted Service Module's "createCustomer" method from Customer Controller
  • 65fac80f: Add new feature where methods that accept a "userId" parameter in SAP API can now receive an arbitrary userId through props, instead of always passing just "current" (same customer account that is tied to the token) or "anonymous".
  • 27246799: Add Assisted Service Module's "getCustomerListDetails" method from Customer Controller
  • ef72c3be: Add Assisted Service Module's "getPointOfServices" method from Agent Controller

Patch Changes

  • Updated dependencies 27246799
    • @vsf-enterprise/sapcc-types@2.2.0

4.2.1

Patch Changes

  • b7a58e8a: Fixed application token refreshing mechanism which broke after recent package update.

4.2.0

Minor Changes

  • 2bf7d1a9: Fixed an issue where middleware would not start when unable to fetch application token. This happened if SAPCC authorization server was unavailable. Now, the middleware will always start and retry credential retrieval every 30s. Retry interval for fetching application token can be adjusted through the tokenRetryIntervalInSeconds option in the integration configuration.

4.1.1

Patch Changes

  • 8f36a525: Add missing changeset types

4.1.0

Minor Changes

  • 16ba7f0f: ### Features
    • B2B Order Approvals
      • Add support for doMakeOrderApprovalDecision endpoint.
  • c357ff5f: ### Features
    • Add support for order cancellation.
  • 70efa8b5: ### Features
    • B2B Cost Center
      • Add support for getActiveCostCenters functionality.
  • 89d81496: ### Features
    • B2B Cost Center
      • Add support for getBudgetsForCostCenter functionality.
  • f7499224: ### Features
    • B2B Carts
      • Added support for replaceOrgCartPaymentType.
  • 6fce91b5: ### Features
    • B2B Cost Center
      • Add support for getCostCenter functionality.
  • 86fb4da1: ### Features
    • B2B Categories
      • Add support for getProductsByCategory.
  • a36342c1: ### Features
    • B2B Carts
      • Added support for getCurrentOrgCart.
  • a60df41e: ### Features
    • B2B Carts
      • Added support for replaceOrgCartEntries.
  • 2c90bfe7: ### Features
    • Add support for get B2b product action
  • 75b34438: ### Features
    • B2B Carts
      • Added support for replaceOrgCartDeliveryAddress.
  • efaa6771: Add support for get B2B User action
  • 8377b9ba: ### Features
    • B2B Cost Center
      • Add support for getCostCenter functionality.
  • dd958cdc: ### Features
    • B2B Carts
      • Added support for replaceOrgCartCostCenter.
  • 6a5b0735: ### Features
    • B2B Carts
      • Added support for doAddOrgCartEntries.
  • c498025c: ### Features
    • Add support for B2B User create action
  • 2e81f083: ### Features
    • B2B Order Approvals
      • Add support for getOrderApproval endpoint.
  • 3116f725: ### Features
    • B2B Order Approvals
      • Add support for getOrderApprovals endpoint.

Patch Changes

  • e84afb30: removing trailing slash from SAP API Base URL if present. As SAP Webservices sdk package already adds it so we had double slash in some situations
  • Updated dependencies 16ba7f0f
  • Updated dependencies c357ff5f
  • Updated dependencies 70efa8b5
  • Updated dependencies 89d81496
  • Updated dependencies f7499224
  • Updated dependencies 6fce91b5
  • Updated dependencies 86fb4da1
  • Updated dependencies a36342c1
  • Updated dependencies a60df41e
  • Updated dependencies 75b34438
  • Updated dependencies 8377b9ba
  • Updated dependencies dd958cdc
  • Updated dependencies 6a5b0735
  • Updated dependencies c498025c
  • Updated dependencies 2e81f083
  • Updated dependencies 3116f725
    • @vsf-enterprise/sapcc-types@2.1.0

4.0.0

Major Changes

  • 8858fa66: Adjust packages to SAP Comerce Cloud v2211.13, as defined by CX template

Patch Changes

  • Updated dependencies 8858fa66
    • @vsf-enterprise/sap-commerce-webservices-sdk@4.0.0
    • @vsf-enterprise/sapcc-types@2.0.0

3.7.0

Minor Changes

  • 3ec9e323: The createRequestOptions, createRequestOptionsWithJsonHeader and createRequestOptionsWithFormUrlEncoded helpers now allow customizing the type of attached authorization headers.

3.6.0

Minor Changes

  • d59b2fe1: Implemented updateUserLogin API method allowing to update customer's email address.

Patch Changes

  • Updated dependencies d59b2fe1
    • @vsf-enterprise/sapcc-types@1.2.0

3.5.0

Minor Changes

  • d59b2fe1: Implemented updateUserLogin API method allowing to update customer's email address.

Patch Changes

  • Updated dependencies d59b2fe1
    • @vsf-enterprise/sapcc-types@1.1.0

3.4.3

Patch Changes

  • affbbd8a: ### Features
    • Added additional validation to ensure the presence of client and interceptors in the configuration object during extension initialization.

    Fixed

    • Fixed a potential issue where the extension could throw an error if client or interceptors were missing from the configuration.

3.4.2

Patch Changes

  • 8fbc5a12: fixed handling of non-alphanumberical characters in filters

3.4.1

Patch Changes

  • 6e01ead6: Fixed handleExpiredToken function crashing in case of a missing response in the error object. Fixed ContextualizedEndpoints type returning never in Typescript "strict" mode.

3.4.0

Minor Changes

  • 142a2d38: Improved error handling in the logic responsible for fetching application token. Added a retry when SAPCC authorization server responds with a 500 error due to receiving several simultaneous requests.
  • 6713073e: ### Improved Logging Options for SAPCC API
    • Custom Logging: Now you can choose your preferred way of logging with SAPCC API. Replace the default logger with your own custom setup for a logging style that suits your workflow.
    • Disable Logging: Need a quieter operation? You can now turn off logging entirely through a simple configuration.

3.4.0-rc.0

Minor Changes

  • e1eb0c70: Improved error handling in the logic responsible for fetching an application token. Added a retry when SAPCC authorization server responds with a 500 error due to receiving several simultaneous requests.

3.3.0

Minor Changes

  • Bumped axios version to ^0.27.2 and @vue-storefront/middleware version to ^3.5.0 which introduces support for HTTP GET requests.

3.2.0

Minor Changes

  • update packages to be compatibile with node >= 16 < 19

Patch Changes

  • Added more exhaustive check for expired application token. "Access Denied" errors from SAP no longer trigger a refresh, only the "401 Unauthorized" errors with the WWW-Authenticate header containing invalid_token as error cause do. Added await for the initial application token fetching in the auth extension's extendApp callback (which can be async since version 3.4.1 of @vue-storefront/middleware.
  • Updated dependencies [3f1112d4]:
    • @vsf-enterprise/sap-commerce-webservices-sdk@3.1.0

3.1.0

Minor Changes

  • Updated middleware

3.0.1

Patch Changes

  • fix: update addVoucher on error to catch it should be error code 400

3.0.0

This is the stable release of the 3.0.0 version of the @vsf-enterprise/sapcc-api package. It contains the changes described in:

  • v3.0.0-c.0 (canary)
  • v3.0.0-c.1 (canary)
  • v3.0.0-c.2 (canary)

Summary of changes

  • The vast majority of type definitions have been moved from @vsf-enterprise/sapcc-api to a new @vsf-enterprise/sapcc-types library,
  • userId is now derived from the vsf-sap-token cookie automatically and does not require to be added to the methods manually.

v3.0.0-c.2 (canary)

In this release, we have moved the vast majority of type definitions from @vsf-enterprise/sapcc-api to a new @vsf-enterprise/sapcc-types library. To find out which types belong to the @vsf-enterprise/sapcc-types library now, we strongly encourage you to check out its API reference page.

Breaking change

If you are importing any types from @vsf-enterprise/sapcc-api which belong to @vsf-enterprise/sapcc-types now, make sure to update your project's imports accordingly. Failing to do so will yield compile-time errors.

- import { BaseProps } from '@vsf-enterprise/sapcc-api';
+ import { BaseProps } from '@vsf-enterprise/sapcc-types';

The @vsf-enterprise/sapcc-types library also re-exports all types provided by the @vsf-enterprise/sap-commerce-webservices-sdk library.

Not a breaking change

Importing @vsf-enterprise/sap-commerce-webservices-sdk types from @vsf-enterprise/sapcc-types is purely optional since the former still exports its type definitions as it did before. However, we do recommend updating the imports regardless.

- import { BaseProps } from '@vsf-enterprise/sapcc-api';
- import { Cart } from '@vsf-enterprise/sap-commerce-webservices-sdk';
+ import { BaseProps, Cart } from '@vsf-enterprise/sapcc-types';

v3.0.0-c.1 (canary)

In this version, we have focused on adding new methods to the @vsf-enterprise/sapcc-sdk package. As a result, we have made a few changes to the existing API methods in the @vsf-enterprise/sapcc-api package and composable methods in @vsf-enterprise/sapcc.

Refactored addGuestEmailToCart method

The method no longer accepts the userId parameter. It is derived from the vsf-sap-token cookie automatically. The property has been removed from the AddGuestEmailToCartProps interface.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
-   await $sapcc.api.addGuestEmailToCart({ cartId: '2323093', email: 'test@gmail.com', userId: 'anonymous' });
+   await $sapcc.api.addGuestEmailToCart({ cartId: '2323093', email: 'test@gmail.com' });
  });
}

Refactored createCartAddress method

The method no longer accepts the userId parameter. It is derived from the vsf-sap-token cookie automatically. The property has been removed from the CreateCartAddressProps interface.

Also, you don't have to use fields: 'FULL' while calling the method anymore. It returns the FULL set of response fields by default now.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
    await $sapcc.api.createCartAddress({
      cartId: '2323093',
-     userId: 'anonymous',
-     fields: 'FULL',
      address: {
        firstName: 'John',
        lastName: 'Doe',
        line1: 'Example 20',
        postalCode: '00-850',
        town: 'San Francisco',
        titleCode: 'mr'
      }
    });
  });
}

Refactored removeCartAddress method

The method no longer accepts the userId parameter. It is derived from the vsf-sap-token cookie automatically. The property has been removed from the RemoveCartAddressProps interface.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
-   await $sapcc.api.removeCartAddress({ cartId: '2323093', userId: 'anonymous' });
+   await $sapcc.api.removeCartAddress({ cartId: '2323093' });
  });
}

Refactored replaceCartAddress method

The method no longer accepts the userId parameter. It is derived from the vsf-sap-token cookie automatically. The property has been removed from the ReplaceCartAddressProps interface.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
-   await $sapcc.api.replaceCartAddress({ cartId: '2323093', addressId: '8796716400663', userId: 'anonymous' });
+   await $sapcc.api.replaceCartAddress({ cartId: '2323093', addressId: '8796716400663' });
  });
}

Refactored getCartDeliveryModes method

The method no longer accepts the userId parameter. It is derived from the vsf-sap-token cookie automatically. The property has been removed from the GetCartDeliveryModesProps interface.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
-   await $sapcc.api.getCartDeliveryModes({ cartId: '2323093', userId: 'anonymous' });
+   await $sapcc.api.getCartDeliveryModes({ cartId: '2323093' });
  });
}

Refactored replaceCartDeliveryModes method

The method no longer accepts the userId parameter. It is derived from the vsf-sap-token cookie automatically. The property has been removed from the replaceCartDeliveryModesProps interface.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
-   await $sapcc.api.replaceCartDeliveryModes({ cartId: '2323093', deliveryModeId: 'premium-gross', userId: 'anonymous' });
+   await $sapcc.api.replaceCartDeliveryModes({ cartId: '2323093', deliveryModeId: 'premium-gross' });
  });
}

Refactored createCartPaymentDetails method

The createCartPaymentDetailsProps interface has undergone big changes. First, we have removed the userId property from it (since the createCartPaymentDetails no longer needs it as it is now derived from the vsf-sap-token cookie automatically). Second, we have marked certain properties of the createCartPaymentDetailsProps.paymentdetails interface as required.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
-   await $sapcc.api.createCartPaymentDetails({ cartId: '2323093', paymentDetails: { cardNumber: '123' }, userId: 'anonymous' });
+   await $sapcc.api.createCartPaymentDetails({ cartId: '2323093', paymentDetails: { cardNumber: '123' }  });
  });
}

Last, the method now returns the PaymentDetails object (previously, it would return undefined).

After

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
    const {
      accountHolderName,
      cardNumber,
      cardType
    } = await $sapcc.api.createCartPaymentDetails({ cartId: '2323093', paymentDetails: { cardNumber: '123' }  });
  });
}

Refactored replaceCartPaymentDetails method

The method no longer accepts the userId parameter. It is derived from the vsf-sap-token cookie automatically. The property has been removed from the replaceCartPaymentDetailsProps interface.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
-   await $sapcc.api.replaceCartPaymentDetails({ cartId: '2323093', paymentDetailsId: '8796814737431', userId: 'anonymous' });
+   await $sapcc.api.replaceCartPaymentDetails({ cartId: '2323093', paymentDetailsId: '8796814737431' });
  });
}

Refactored addVoucherToCart method

The method no longer accepts the userId, lang or currency parameters. userId is derived from the vsf-sap-token cookie automatically. The properties have been removed from the AddVoucherToCartProps interface.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
-   await $sapcc.api.addVoucherToCart({ cartId: '2323093', voucherId: '8796814737431', userId: 'anonymous' });
+   await $sapcc.api.addVoucherToCart({ cartId: '2323093', voucherId: '8796814737431' });
  });
}

Refactored addVoucherAndGetNewCartVersion method

The method no longer accepts the userId parameter. It is derived from the vsf-sap-token cookie automatically. The property has been removed from the addVoucherAndGetNewCartVersionProps interface.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
-   await $sapcc.api.addVoucherAndGetNewCartVersion({ cartId: '2323093', voucherId: '8796814737431', userId: 'anonymous' });
+   await $sapcc.api.addVoucherAndGetNewCartVersion({ cartId: '2323093', voucherId: '8796814737431' });
  });
}

Refactored removeVoucherFromCart method

The method no longer accepts the userId, lang or currency parameters. userId is derived from the vsf-sap-token cookie automatically. Also, the interface describing this method's parameters has been changed from AddVoucherToCartPropsto removeVoucherFromCartProps.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
-   await $sapcc.api.removeVoucherFromCart({ cartId: '2323093', voucherId: '8796814737431', userId: 'anonymous' });
+   await $sapcc.api.removeVoucherFromCart({ cartId: '2323093', voucherId: '8796814737431' });
  });
}

Refactored placeOrder method

The method no longer accepts the userId parameter. It is derived from the vsf-sap-token cookie automatically. The property has been removed from the PlaceOrderProps interface.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
-   await $sapcc.api.placeorder({ cartId: '2323093', userId: 'anonymous' });
+   await $sapcc.api.placeorder({ cartId: '2323093' });
  });
}

Refactored getUserOrders method

The method no longer accepts the userId parameter. It is derived from the vsf-sap-token cookie automatically. The property has been removed from the getUserOrdersprops interface.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
-   await $sapcc.api.getUserOrders({ code: '2323093', userId: 'anonymous' });
+   await $sapcc.api.getUserOrders({ code: '2323093' });
  });
}

We have also refactored the useOrder().load() composable method. Now its parameters follow the same interface as the parameters of the getUserOrders API method - GetUserOrdersProps. The previous interface used by the method (LoadOrderProps provided by the @vsf-enterprise/sapcc package) is no longer available.

Refactored createUser method

This method now accepts the fields parameter allowing you to select response fields. Previously, it was always returning FULL fields. The same applies to the useUser().register() composable method which uses createUser under the hood.

Refactored getUser method

The parameter object passed to this method is now optional.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
-   await $sapcc.api.getUser({});
+   await $sapcc.api.getUser();
  });
}

Refactored OAuthUserAuthorization method

The method no longer accepts the isRememberMe parameter. The same applies to the useUser().login() composable method which uses OAuthUserAuthorization under the hood. The property has been removed from both the OAuthUserAuthenticationProps and LoginUserProps interfaces.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
-   await $sapcc.api.OAuthUserAuthorization({ username: 'test@gmail.com', password: 'test123!', isRememberMe: true });
+   await $sapcc.api.OAuthUserAuthorization({ username: 'test@gmail.com', password: 'test123!' });
  });
}

Refactored updateUser method

In the previous implementation, the method was making two calls to the SAP OCC API: the first one to update the customer profile and the second one to get the updated user object. From now on, it is only responsible for updating the customer profile and does not return anything. If you're looking for a method that does both these things (just like updateUser used to), take a look at the updateAndGetUser method.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
-   const updatedUser = await $sapcc.api.updateUser({ user: { firstName: 'John' }, fields: 'firstName,lastName' });
+   await $sapcc.api.updateUser({ user: { firstName: 'John' } });
  });
}

Added updateAndGetUser method

Brand new API method responsible for updating the customer profile and returning the updated user object. It has been created as a replacement for the old version of the updateUser method. It calls updateUser and getUser under the hood. It is now used in the useUser().update composable method instead of updateUser.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
    const updatedUser = await $sapcc.api.updateAndGetUser({ user: { firstName: 'John' }, fields: 'firstName,lastName' });
  });
}

Refactored changePassword method

The method no longer accepts the userId parameter. It has been removed from the ChangePasswordProps interface.

import { useVSFContext } from '@vue-storefront/core';

setup() {
  const { $sapcc } = useVSFContext();

  onMounted(async () => {
-   await $sapcc.api.changePassword({ old: 'old-password', new: 'new-password', userId: 'current' });
+   await $sapcc.api.changePassword({ old: 'old-password', new: 'new-password' });
  });
}

Refactored deleteAddress method

The parameters of this method are no longer described by the GetAddressProps interface. They now have a dedicated one called deleteAddressProps. It does not extend BaseProps since the deleteAddress method does not return any response.

Refactored getCarts method

The method no longer accepts the userId parameter. It is derived from the vsf-sap-token cookie automatically. The property has been removed from the GetAllCartsProps interface and the getCarts method can now be called without any parameters.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
-   await $sapcc.api.getCarts({ userId: 'current' });
+   await $sapcc.api.getCarts();
  });
}

Refactored getUserOrderHistory method

The method can now be called without any parameters.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
-   await $sapcc.api.getUserOrderHistory({});
+   await $sapcc.api.getUserOrderHistory();
  });
}

Also, you can use the new ORDER_STATUSES enum to check out possible values for the getUserOrderHistoryProps.statuses parameter.

import { useContext } from '@nuxtjs/composition-api';
import { ORDER_STATUSES } from '@vsf-enterprise/sapcc-api;

setup() {
  const { $sapcc } = useContext();
  const { CANCELLED, CHECKED_VALID } = ORDER_STATUSES;

  onMounted(async () => {
    await $sapcc.api.getUserOrderHistory({ statuses: `${CANCELLED},${CHECKED_VALID}` });
  });
}

Refactored getAllConsents method

The method no longer accepts the userId parameter. It is derived from the vsf-sap-token cookie automatically. Params expected by this method are now described by the BaseProps interface and are completely optional. The previous GetConsentTemplateListProps interface should not be used anymore.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
-   await $sapcc.api.getAllConsents({ userId: 'current' });
+   await $sapcc.api.getAllConsents();
  });
}

Refactored giveConsent method

The method no longer accepts the userId parameter. It is derived from the vsf-sap-token cookie automatically. It also no longer accepts fields, lang or currency parameters since the corresponding SAP OCC API endpoint does not support them. All these properties have been removed from the GiveConsentProps interface.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
    await $sapcc.api.giveConsent({
      consentTemplateId: 'MARKETING_NEWSLETTER',
      consentTemplateVersion: '0',
-     userId: 'current',
-     fields: 'BASIC',
-     lang: 'de',
-     currency: 'GBP',
    });
  });
}

Refactored removeConsent method

In the previous implementation, the method was making two calls to the SAP OCC API: the first one to remove the consent and the second one to get the removed consent object. From now on, it is only responsible for removing the consent and does not return anything. Also, it no longer accepts userId and consentTemplateId params. They have been removed from the RemoveConsentProps interface.

import { useContext } from '@nuxtjs/composition-api';

setup() {
  const { $sapcc } = useContext();

  onMounted(async () => {
-   const removedConsent = await $sapcc.api.removeConsent({ consentCode: 'code', consentTemplateId: 'id', userId: 'current' });
+   await $sapcc.api.removeConsent({ consentCode: 'code' });
  });
}

To compensate for the change, the useConsents().removeconsent method is now calling two API endpoints: removeConsent and getConsent.

Refactored getConsent method

The method no longer accepts the userId parameter. It is derived from the vsf-sap-token cookie automatically. The property has been removed from the GetConsentTemplateProps interface.

import { useVSFContext } from '@vue-storefront/core';

setup() {
  const { $sapcc } = useVSFContext();

  onMounted(async () => {
-   await $sapcc.api.getConsent({ consentTemplateId: 'MARKETING_NEWSLETTER', userId: 'current' });
+   await $sapcc.api.getConsent({ consentTemplateId: 'MARKETING_NEWSLETTER' });
  });
}

v3.0.0-c.0 (canary)

This is the canary version of SAP packages. The final version might look a little bit different.

In this version, we have focused on adding new methods to the @vsf-enterprise/sapcc-sdk package. As a result, we have made a few changes to the existing API methods in the @vsf-enterprise/sapcc-api package and composable methods in @vsf-enterprise/sapcc.

Refactored createCart method

The method no longer accepts the userId parameter. It is derived from the vsf-sap-token cookie automatically. The property has been removed from the CreateCartProps interface and the createCart endpoint can now be called without any params.

import { useVSFContext } from '@vue-storefront/core';

setup() {
  const { $sapcc } = useVSFContext();

  onMounted(async () => {
-   await $sapcc.api.createCart({ userId: 'anonymous' });
+   await $sapcc.api.createCart();
  });
}

Refactored getCart method

Until now, this method was capable of either:

  • getting an existing cart by cartId param,
  • creating a new cart in case cartId param has not been provided.

From now on, it will only be responsible for fetching existing carts and won't be creating new carts under the hood. We have also removed the following properties from the GetCartProps interface:

  • oldCartId,
  • toMergeCartGuid,
  • userId (it is derived from the vsf-sap-token cookie automatically now).
import { useVSFContext } from '@vue-storefront/core';

setup() {
  const { $sapcc } = useVSFContext();

  onMounted(async () => {
-   await $sapcc.api.getCart({ userId: 'anonymous', cartId: '2323093' });
+   await $sapcc.api.getCart({ cartId: '2323093' });
  });
}

Refactored deleteCart method

The method no longer accepts the userId parameter. It is derived from the vsf-sap-token cookie automatically. The property has also been removed from the DeleteCartProps interface.

import { useVSFContext } from '@vue-storefront/core';

setup() {
  const { $sapcc } = useVSFContext();

  onMounted(async () => {
-   await $sapcc.api.deleteCart({ userId: 'anonymous', cartId: '2323093' });
+   await $sapcc.api.deleteCart({ cartId: '2323093' });
  });
}

Refactored saveCart

We have decided to change the return value of these API methods. Until now, they have been returning the SavedCartData object extracted from the SaveCartResult. Unfortunately, it was confusing for developers trying to select their response fields. The return value implied selecting fields according to the SavedCartData interface, whereas SAP OCC API expected SaveCartResult fields instead.

import { useVSFContext } from '@vue-storefront/core';

setup() {
  const { $sapcc } = useVSFContext();

  onMounted(async () => {
    /** BAD */
    await $sapcc.api.saveCart({ fields: 'code,name,entries(FULL)' });

    /** GOOD, cart fields wrapped in savedCartData */
    await $sapcc.api.saveCart({ fields: 'savedCartData(code,name,entries(FULL))' });
  });
}

From now on, all three methods return the raw SaveCartResult response from SAP OCC API.

Refactored addToCart method

The method no longer accepts userId, productCode and quantity as root-level parameters. From now on, userId is derived from the vsf-sap-token cookie automatically whereas product code and quantity have to be passed through the entry property. The AddToCartProps interface has been updated accordingly.

import { useVSFContext } from '@vue-storefront/core';

setup() {
  const { $sapcc } = useVSFContext();

  onMounted(async () => {
-   await $sapcc.api.addToCart({
-     userId: 'anonymous',
-     cartId: '2323093',
-     productCode: '1234',
-     quantity: 1
-   });
+   await $sapcc.api.addToCart({
+     cartId: '2323093',
+     entry: {
+       product: { code: '1234' },
+       quantity: 1
+     }
+   });
  });
}

Also, the set of response fields returned by the method has been changed from BASIC to FULL. As a result, you don't have to use fields: 'FULL' while calling the addToCart() method directly:

import { useVSFContext } from '@vue-storefront/core';

setup() {
  const { $sapcc } = useVSFContext();

  onMounted(async () => {
-   await $sapcc.api.addToCart({
-     cartId: '2323093',
-     entry: {
-       product: { code: '1234' },
-       quantity: 1
-     },
-     fields: 'FULL'
-   });

+   await $sapcc.api.addToCart({
+     cartId: '2323093',
+     entry: {
+       product: { code: '1234' },
+       quantity: 1
+     }
+   });
  });
}

Refactored addCartEntry method

Since this method calls addToCart() under the hood, all changes described in the previous paragraph apply to it as well. Also, from now on, params of both these methods share the same interface - AddToCartProps. The old addCartEntryProps interface leveraged by the addCartEntry method has been removed.

Refactored deleteFromCart method

The method no longer accepts the userId parameter. It is derived from the vsf-sap-token cookie automatically. The property has also been removed from the DeleteFromCartProps interface.

import { useVSFContext } from '@vue-storefront/core';

setup() {
  const { $sapcc } = useVSFContext();

  onMounted(async () => {
-   await $sapcc.api.deleteFromCart({ userId: 'anonymous', cartId: '2323093', entryNumber: 0 });
+   await $sapcc.api.deleteFromCart({ cartId: '2323093', entryNumber: 0 });
  });
}

Refactored deleteFromCart and deleteCartEntry methods

The methods no longer accept the userId parameter. It is derived from the vsf-sap-token cookie automatically. The property has also been removed from the DeleteFromCartProps interface.

import { useVSFContext } from '@vue-storefront/core';

setup() {
  const { $sapcc } = useVSFContext();

  onMounted(async () => {
-   await $sapcc.api.deleteFromCart({ userId: 'anonymous', cartId: '2323093', entryNumber: 0 });
+   await $sapcc.api.deleteFromCart({ cartId: '2323093', entryNumber: 0 });

-   await $sapcc.api.deleteCartEntry({ userId: 'anonymous', cartId: '2323093', entryNumber: 0 });
+   await $sapcc.api.deleteCartEntry({ cartId: '2323093', entryNumber: 0 });
  });
}

Refactored updateCart and updateCartEntry methods

From now on, the params of both these methods share the same interface - UpdateCartProps. The interface itself has been updated and it no longer accepts the userId and quantity parameters:

Before

interface UpdateCartProps extends BaseProps {
  cartId: string;
  userId: string;
  entryNumber: number;
  quantity?: number;
  entry?: OrderEntry;
}

After

interface UpdateCartProps extends BaseProps {
  cartId: string;
  entryNumber: number;
  entry: OrderEntry;
}

userId is now derived from the vsf-sap-token cookie automatically and quantity latter has to be passed as a nested property of the now required entry parameter. The previous UpdateCartEntryProps interface used by the updateCartEntry has been removed.

Also, both methods return the FULL set of response fields by default now. You don't have to pass fields: 'FULL' to them explicitly.

import { useVSFContext } from '@vue-storefront/core';

setup() {
  const { $sapcc } = useVSFContext();

  onMounted(async () => {
-   await $sapcc.api.updateCart({ userId: 'anonymous', cartId: '2323093', entryNumber: 0, quantity: 1, fields: 'FULL' });
+   await $sapcc.api.updateCartEntry({ cartId: '2323093', entryNumber: 0, entry: { quantity: 1 } });

-   await $sapcc.api.deleteCartEntry({ userId: 'anonymous', cartId: '2323093', entryNumber: 0, quantity: 1, fields: 'FULL' });
+   await $sapcc.api.updateCartEntry({ cartId: '2323093', entryNumber: 0, entry: { quantity: 1 } });
  });
}

2.0.0

In his release, we have:

Core upgrade

In this release, we have upgraded our core packages (such as @vue-storefront/core) to their latest versions. We suggest doing the same in your project.

package.json

{
  "dependencies": {
-    "@vue-storefront/http-cache": "^2.5.4",
-    "@vue-storefront/middleware": "^2.5.4",
-    "@vue-storefront/nuxt": "^2.5.4",
+    "@vue-storefront/http-cache": "^2.7.5",
+    "@vue-storefront/middleware": "^2.7.5",
+    "@vue-storefront/nuxt": "^2.7.5",
  }
}

Reworked middleware.config.js file

In this release, we have introduced some breaking changes in the middleware.config.js file. We have:

  • removed the mediaHost property since it is only used inside the Nuxt application now,
  • removed the baseStore property since it is not needed anymore,
  • renamed baseStoreId to baseSiteId,
  • renamed currency to defaultCurrency and moved it into configuration.api object,
  • renamed lang to defaultLanguage and moved it into configuration.api object,
  • moved OAuthServer object outside of configuration.api and renamed it to OAuth,
  • moved clientId and clientSecret into configuration.OAuth,
  • renamed OAuthServer.host to OAuth.uri,
  • renamed OAuthServer.authenticationEndpoint to OAuth.tokenEndpoint,
  • renamed OAuthServer.authenticationTokenRevokeEndpoint to OAuth.tokenRevokeEndpoint.

You can review the new shape of the middleware.config.js file in the Configuration section.

If you have created any custom extensions in your project, review and update all logic depending on the configuration extracted from the context.

export const customExtension = {
  name: 'my-custom-extension',
  extendApp(context) {
-   const {
-     clientId,
-     clientSecret,
-     OAuthServer: {
-       host,
-       authenticationEndpoint,
-       authenticationTokenRevokeEndpoint
-     }
-   } = context.configuration.api;
+   const { clientId, clientSecret, uri, tokenEndpoint, tokenRevokeEndpoint } = context.configuration.OAuth;
  },
  extendApiMethods: {
    myCustomMethod: async (context) => {
-     const { config: { api: { baseStoreId } } } = context;
+     const { config: { api: { baseSiteId } } } = context;
    }
  }
};

Reworked application token refreshing mechanism

In this release, we have refactored the way our API Middleware refreshes the global application token. It used to be refreshed every x seconds (where x was equal to the value of the expires_in key found in the token object returned by SAP's authorization server). From now on, it will only be refreshed whenever some request using it yields a 401 (Unauthorized) error.

Important!

We have also changed the location of the ConcurrentCallbacksReducer helper. It can now be imported from the @vsf-enterprise/sapcc-api package instead of @vsf-enterprise/sapcc.

- import { ConcurrentCallbacksReducer } from '@vsf-enterprise/sapcc';
+ import { ConcurrentCallbacksReducer } from '@vsf-enterprise/sapcc-api';

const reduceConcurrentCallbacks = new ConcurrentCallbacksReducer().reduce;

Multistore support

In this release, we have introduced support for SAP Multistore (including both multi-currency and multi-locale setup). Read our new Multistore guide and the updated Configuration guide to learn how to implement it in your project.

This release introduces a new cookieOptions property in middleware.config.js. It allows for configuring options of the vsf-sap-token cookie coming from our API Middleware as a result of authentication and token refresh requests. Read the updated Configuration guide to find out more.

Changed the default response fields of getProductReferences

By default, the majority of our API Middleware endpoints send requests to SAP Commerce Cloud with fields set to FULL. The getProductReferences endpoint has been an exception to this rule. We have changed that in this release.

import { useProductReferences } from '@vsf-enterprise/sapcc';

setup() {
  const { search } = useProductReferences();

  onMounted(async () => {
-   await search({ productCode: '1', fields: 'FULL' });
+   await search({ productCode: '1' });
  });
}

The same thing applies to the getProductReferences endpoint called directly:

import { useVSFContext } from '@vue-storefront/core';

setup() {
  const { $sapcc } = useVSFContext();

  onMounted(async () => {
-   const references = await $sapcc.api.getProductReferences({ productCode: '1', fields: 'FULL' });
+   const references = await $sapcc.api.getProductReferences({ productCode: '1' });
  });
}

Updated ProductReferenceTypeEnum

Another change related to the getProductReferences endpoint is an update of the ProductReferenceTypeEnum. We have turned it from a numeric enum into a string enum.

import { useProductReferences } from '@vsf-enterprise/sapcc';
import { ProductReferenceTypeEnum } from '@vsf-enterprise/sapcc-api';

setup() {
  const { search } = useProductReferences();

  onMounted(async () => {
-   await search({ productCode: '1', type: ProductReferenceTypeEnum[0] });
+   await search({ productCode: '1', type: ProductReferenceTypeEnum.ACCESSORIES });
  });
}

Exported the GetCategoryProps interface from @vsf-enterprise/sapcc-api

The GetCategoryProps interface used by the getCategory endpoint can now be imported from the @vsf-enterprise/sapcc-api package:

import { GetCategoryProps } from '@vsf-enterprise/sapcc-api';

setup() {
  const props: GetCategoryProps = { id: 'collections' };
}

Allow calling getCatalogVersion API endpoint without props

From now on, you can call the getCatalogVersion endpoint without any props as they've become purely optional.

import { useVSFContext } from '@vue-storefront/core';

setup() {
  const { $sapcc } = useVSFContext();

  onMounted(async () => {
-   const catalogVersion = await $sapcc.api.getCatalogVersion({});
+   const catalogVersion = await $sapcc.api.getCatalogVersion();
  });
}

Allow modifying fields of all sub-requests of getProductSearchPageData

getProductSearchPageData endpoint returns all of the data you need to build a Product Listing Page. Under the hood, it composes responses returned by two other API methods: searchProduct and getCatalogVersion.

From now on, GetProductSearchPageDataProps allows you to pass arguments to both these methods separately to modify their behavior and - in turn - the response returned by the getProductSearchPageData endpoint. Refer to the interface definition to find out more about available properties.

Moved all logic behind building SAP product queries to the searchProduct endpoint

Until now, the logic behind build SAP product queries has been split between the searchProduct endpoint and the useProductSearch().search() method. In this release, we have moved all of that logic to the searchProduct endpoint. As a result, new properties have been added to the ProductSearchProps interface.

1.1.2 (2023-01-24)

Bug Fixes

  • try catch on auth extension (c9fa986)
  • in-1168: changing password enigmatic error messages (#340) (edd3d5e)
  • in-307: user cannot create a new account due to 400 error (#330) (6430202)
  • missing client secret (55602c5)

Features

1.1.1 (2022-11-29)

Bug Fixes

1.1.0 (2022-11-28)

Features

  • in-1396: add release notes to SAP version 1.1.0 - update (#356) (e24e3bd)

1.0.0 (2022-10-06)

Note: Version bump only for package @vsf-enterprise/sapcc-api

1.0.0-beta.7 (2022-09-02)

Note: Version bump only for package @vsf-enterprise/sapcc-api

1.0.0-beta.6 (2022-09-01)

Note: Version bump only for package @vsf-enterprise/sapcc-api

1.0.0-beta.4 (2022-08-31)

Bug Fixes

Features

Reverts

  • Revert "chore: fixing selected version of core packages" (f2131a9)

1.0.0-beta.3 (2022-06-07)

Bug Fixes

  • add tests for mockedPSP (#172) (5bd7c2a)
  • adding missing chain (#10) (cedd3ed)
  • adding missing files into package json (#115) (21193d1)
  • auth application token (#160) (edb0ed4)
  • changing alias of the lib (#13) (f6839f6)
  • customer does not seem fully authenticated after hard reload (#161) (7ac5a17)
  • overwrite userID passed from composables to api-client and After Login merge Cart (#68) (df17af3)
  • price is missing in product details page (#178) (9c3a604)
  • tests check workflow (#12) (e709460)

Features

Reverts

  • Revert "chore: fixing selected version of core packages" (f2131a9)

1.0.0-beta.2 (2022-02-14)

Bug Fixes

  • add tests for mockedPSP (#172) (5bd7c2a)
  • adding missing chain (#10) (cedd3ed)
  • adding missing files into package json (#115) (21193d1)
  • auth application token (#160) (edb0ed4)
  • changing alias of the lib (#13) (f6839f6)
  • customer does not seem fully authenticated after hard reload (#161) (7ac5a17)
  • overwrite userID passed from composables to api-client and After Login merge Cart (#68) (df17af3)
  • price is missing in product details page (#178) (9c3a604)
  • tests check workflow (#12) (e709460)

Features

Reverts

  • Revert "chore: fixing selected version of core packages" (f2131a9)

1.0.0-beta.1 (2022-02-09)

Bug Fixes

  • add tests for mockedPSP (#172) (5bd7c2a)
  • adding missing chain (#10) (cedd3ed)
  • adding missing files into package json (#115) (21193d1)
  • auth application token (#160) (edb0ed4)
  • changing alias of the lib (#13) (f6839f6)
  • customer does not seem fully authenticated after hard reload (#161) (7ac5a17)
  • overwrite userID passed from composables to api-client and After Login merge Cart (#68) (df17af3)
  • price is missing in product details page (#178) (9c3a604)
  • tests check workflow (#12) (e709460)

Features

Reverts

  • Revert "chore: fixing selected version of core packages" (f2131a9)

1.0.0-beta.0 (2022-02-09)

Bug Fixes

  • add tests for mockedPSP (#172) (5bd7c2a)
  • adding missing chain (#10) (cedd3ed)
  • adding missing files into package json (#115) (21193d1)
  • auth application token (#160) (edb0ed4)
  • changing alias of the lib (#13) (f6839f6)
  • customer does not seem fully authenticated after hard reload (#161) (7ac5a17)
  • overwrite userID passed from composables to api-client and After Login merge Cart (#68) (df17af3)
  • price is missing in product details page (#178) (9c3a604)
  • tests check workflow (#12) (e709460)

Features

Reverts

  • Revert "chore: fixing selected version of core packages" (f2131a9)

1.0.0-alpha.5 (2021-11-05)

Bug Fixes

  • adding missing chain (#10) (cedd3ed)
  • adding missing files into package json (#115) (21193d1)
  • changing alias of the lib (#13) (f6839f6)
  • overwrite userID passed from composables to api-client and After Login merge Cart (#68) (df17af3)
  • tests check workflow (#12) (e709460)

Features

Reverts

  • Revert "chore: fixing selected version of core packages" (f2131a9)

1.0.0-alpha.4 (2021-11-05)

Bug Fixes

  • adding missing chain (#10) (cedd3ed)
  • adding missing files into package json (#115) (21193d1)
  • changing alias of the lib (#13) (f6839f6)
  • overwrite userID passed from composables to api-client and After Login merge Cart (#68) (df17af3)
  • tests check workflow (#12) (e709460)

Features

Reverts

  • Revert "chore: fixing selected version of core packages" (f2131a9)

1.0.0-alpha.3 (2021-11-05)

Bug Fixes

  • adding missing chain (#10) (cedd3ed)
  • changing alias of the lib (#13) (f6839f6)
  • overwrite userID passed from composables to api-client and After Login merge Cart (#68) (df17af3)
  • tests check workflow (#12) (e709460)

Features

Reverts

  • Revert "chore: fixing selected version of core packages" (f2131a9)

1.0.0-alpha.2 (2021-11-05)

Bug Fixes

  • adding missing chain (#10) (cedd3ed)
  • changing alias of the lib (#13) (f6839f6)
  • overwrite userID passed from composables to api-client and After Login merge Cart (#68) (df17af3)
  • tests check workflow (#12) (e709460)

Features

Reverts

  • Revert "chore: fixing selected version of core packages" (f2131a9)

1.0.0-alpha.1 (2021-11-05)

Bug Fixes

  • adding missing chain (#10) (cedd3ed)
  • changing alias of the lib (#13) (f6839f6)
  • overwrite userID passed from composables to api-client and After Login merge Cart (#68) (df17af3)
  • tests check workflow (#12) (e709460)

Features

Reverts

  • Revert "chore: fixing selected version of core packages" (f2131a9)

1.0.0-alpha.0 (2021-11-05)

Bug Fixes

  • adding missing chain (#10) (cedd3ed)
  • changing alias of the lib (#13) (f6839f6)
  • overwrite userID passed from composables to api-client and After Login merge Cart (#68) (df17af3)
  • tests check workflow (#12) (e709460)

Features

Reverts

  • Revert "chore: fixing selected version of core packages" (f2131a9)