Integration of new generation UI Spartacus and customer data cloud of SAP commerce cloud


SAP Customer Data Cloud Integration)

Spartacus version 3.2 is available.

SAP customer data cloud allows you to enable custom registration and login, as well as manage user profiles and consents.

Required system configuration:

  • SAP commerce cloud 2011 and SAP commerce cloud integration expansion pack 2108
  • SAP commerce cloud 2005 and SAP commerce cloud integration expansion pack
  • SAP commerce cloud 1905 and the latest version of Commerce cloud expansion pack

To enable SAP customer data cloud integration in Spartacus, you need to configure the commerce cloud back end and Spartacus front end.

Configuration required in the background of Commerce cloud

Enable the sap customer data cloud extension for B2C. Build and update the system so that new features provided by the sap customer data cloud integration extension are available. This step also creates sample CMS data for the electronics spacontentcatalog content catalog.

You can view the sap customer data cloud login page through the < Spartacus site URL > / CDC / login URL. This allows you to access both the customer data cloud page and the default login page.

Update mobile_ Android OAuth client (created in step 1) to support custom authorization grant types and remove refresh_ Token grant type. The following IMPEX can be used to update authorization types:

INSERT_UPDATE OAuthClientDetails ; clientId[unique = true] ; resourceIds ; scope ; authorizedGrantTypes ; authorities ; clientSecret ; registeredRedirectUri ; mobile_android ; hybris ; basic ; authorization_code,password,client_credentials,custom ; ROLE_CLIENT ; secret ; http://localhost:9001/authorizationserver/oauth2_callback

Refreshing tokens is not supported. This ensures that the token from the commerce cloud and the sap customer data cloud login session maintain the same duration.

Define the sap customer data cloud site configuration and link it to electronics spa

Configuration of SAP Spartacus

Install the sap customer data cloud integration library by running the following command from the root directory of the storefront application.

ng add @spartacus/cdc

When you run this command, schematics creates a module for CDC integration that contains all the necessary imports and configurations.

To install the CDC integration library using schematics, your application structure needs to match the Spartacus reference application structure. For more information, seeReference application structure)。

Alternatively, you can manually create a module and import it into your application, as shown in the following example:

import { NgModule } from '@angular/core'; import { CdcConfig, CdcRootModule, CDC_FEATURE } from '@spartacus/cdc/root'; import { provideConfig } from '@spartacus/core'; @NgModule({ declarations: [], imports: [CdcRootModule], providers: [ provideConfig({ featureModules: { [CDC_FEATURE]: { module: () =>  import('@spartacus/cdc').then((m) =>  m.CdcModule), }, }, }), provideConfig(<CdcConfig>{ cdc: [ { baseSite: 'electronics-spa', javascriptUrl: '<paste-link-to-cdc-script>', sessionExpiration: 3600, }, ], }), ], }) export  class  CdcFeatureModule {}

The above code requires manual adjustment of the configuration:

provideConfig(<CdcConfig>{ [CDC_FEATURE]: [ { baseSite: 'electronics-spa', javascriptUrl: 'https://cdns.<data-center><Site-API-Key>', sessionExpiration: 3600, }, ], }),

The following is a summary of the options available in the CDC configuration:

  • Basesite refers to the CMS site to which the customer data cloud site configuration should be applied. The same content should also be configured in SAP commerce cloud backoffice.
  • JavaScript URL specifies the URL of the web SDK to load. This is built using the value of the site API key and the data center that created the customer data cloud site. For example, https://cdns. <data-center>. gigya. com/JS/gigya. js? apikey=<Site-API-Key>
  • Sessionexpiration is the session expiration time (in seconds) that defines the sap customer data cloud session. This should match the session expiration time of OAuth client to ensure that the customer data cloud session and SAP commerce cloud token exist at the same time.

Recommended Today

Application field of blockchain – Internet of things and logistics (II)

id:BSN_2021Official account: BSN Institute Distributed storage, encryption algorithm and consensus mechanism. Blockchain technology with these typical technical characteristics has been favored by many industries since its birth and contains great potential. Among these industries, the Internet of things and logistics are more mature areas for the application of blockchain technology. Blockchain can be naturally combined […]