The Vue Storefront Essentials Course is now available! Learn More
Change Log

Change Log

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)