Skip to content

Technical Documentation

bmmsantos edited this page Sep 6, 2023 · 88 revisions

Before any new PR is done, a test case should run following the steps described below:

  1. Rename src/ to _src/
  2. $ npm run init
  3. Delete the new src/ and rename _src/ to src/
  4. $ npm run build
  5. Check configurations of cdc-accelerator.preferences-center.com/ in build/ including the imported JS files in the webSdk.js file and the PreferencesCenter-Landing.js screen-set
  6. $ npm start
  7. Check if features look okay in the preview and without errors in the console
  8. $ npm run deploy
  9. Validate if configurations on /build were correctly sent to CDC

Development environment preparation

To start using Customer Data Cloud accelerator please do the following actions:

  1. Clone this github repository to a local folder
  2. Create a project with your preferred IDE (e.g. VSCode)
  3. Install all project dependencies using the command npm install. It is assumed that you already have node and npm installed, if not please do it first
  4. Define project configuration:

Open or create the file .env and define the value of the properties USER_KEY and SECRET_KEY. These are the credentials used to access Cloud Data Customer console. Open or create the file cdc-initializer.json and define the sites' info that you want to work with. See configuration chapter for details.

  1. Execute the command npm run update-sap-cdc-toolkit to update the code of a dependency used to interact with Customer Data Cloud. This command will add the folder cdc-initializer/sap-cdc-toolkit inside the project with the dependency source code.

At this point you are ready to start working on the Customer Data Cloud accelerator project or on a Customer Data Cloud's customer project.

Working on a project

Customer Data Cloud accelerator offers some operations to be used by the user when working on a project, these are described next:

init

This operation will get the data from the site(s) configured on file cdc-initializer.json. It creates a src folder and one to many subfolders named with the site domain. Inside the subfolders, is also created a folder, for each feature, that will have files containing feature related data. This feature will only work if the src folder do not exists, otherwise it will show an error, saying that data already exists and to use the reset operation to start from scratch These files in src folder are the ones to work with by the user.

reset

This operation will recursively delete the src folder and execute the init operation.

build

This operation will process the files, for each site and each feature, that exist on src folder and bundles them, in a way to be prepared to be sent to the Cloud Data Customer console. These processed files are stored in the build folder containing the same folder structure as the src folder

deploy

This operation will run the build command and then process the files, for each site and each feature, that exist on build folder and send its data to the Cloud Data Customer console, using its REST API.

start

This operation will start a local development server. This server will execute the content of the cdc-initializer/preview folder to render the content of the build folder. This will allow local development manual testing before deploying the data to the Customer Data Cloud's console

test

This operation will execute the unit tests implemented for each feature implemented on Customer Data Cloud accelerator

Architecture

Features

Schema

This feature allows a user to change a site's schema related data.

init

During this operation the schema related data is obtained from a site and stored on different files on folder src/<site-domain>/Schema. The files are called data.json, which contains the data schema related data; profile.json, which contains the profile schema related data; and subscriber.json, which contains the subscriber schema related data. The following image shows the schema related data on Customer Data Cloud console: // TODO: insert image

build

During this operation the schema files are simply copied from the src folder to the build folder maintaining the folder structure. There is no need to perform any transformation on the files

deploy

During this operation the schema files are read and its content sent to Customer Data Cloud console using its REST API.

Clone this wiki locally