A development environment for SAP Customer Data Cloud that enables the use of modern tools, such as JavaScript and source control.
npm install @sap_oss/sap-customer-data-cloud-acceleratorThe SAP Customer Data Cloud accelerator is local development environment for SAP Customer Data Cloud.
It enables the use of all modern tools, including modern JavaScript and real source control. It provides code separation, enabling unit tests and quality checks.
To get started it is necessary to have git and node.js installed on the local machine.
Execute the following commands:
``shCreate a new project
npm init
$3
Edit the file
.env in the project directory and add your credentials:`sh
USER_KEY="ex: XXXXXXXX"
SECRET_KEY="ex: XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
`Edit the file
cdc-accelerator.json in the project directory and add the source site or sites you want to get the initial configuration from and sites to deploy to:`sh
{
"source": [
{ "apiKey": "XXXXXXXXXX" },
{ "apiKey": "YYYYYYYYYY" }
],
"deploy": [
{ "apiKey": "XXXXXXXXXX" },
{ "apiKey": "YYYYYYYYYY" }
]
}
`$3
#### 3.1 Get initial configuration from the source API Key(s)
`sh
npm run init
``sh
npm run start
`Navigate to to see the preview.
The preview mode is a feature that allows the user to see and test the changes in the local environment, without the need to
deploy the data to the SAP CDC console.`
npm run test
`Runs any existing
jest tests in the project.`sh
npm run deploy
`Congratulations! You have successfully initialized and deployed a SAP Customer Data Cloud accelerator project.
$3
#### Replace existing files with the code from the origin API Key(s)
It's similar to
init, but replaces the contents of src/.`sh
npm run reset
`#### Get help about using the cli
This command will show all possible commands and options that the user can do.
`sh
npx cdc help
`Example output:
`sh
Usage: npx cdc [options] [command]A development environment for SAP Customer Data Cloud that enables the use of modern tools, such as JavaScript and source control.
Options:
-V, --version output the version number
-h, --help display help for command
Commands:
start Launch local server for testing using the preview functionality
setup Setup a new project after this dependency is installed
init [options] Reads the data from the SAP CDC console of the sites configured
reset [options] Deletes the local folder and reads the data from the SAP CDC console of the sites configured
build [options] Processes the local data and prepares it to be deployed to the SAP CDC console
deploy [options] Deploys the local data to the SAP CDC console on the sites configured
help [command] display help for command
`Configuration
$3
The Customer Data Cloud Accelerator allows reading, working locally and deploying data from the following features:
- E-mail Templates:
EmailTemplates
- Permission Groups: PermissionGroups
- Policies: Policies
- Schema: Schema
- SMS Templates: SmsTemplates
- Web ScreenSets: WebScreenSets
- Web SDK: WebSdk $3
On the
cdc-accelerator.json file, there are two mandatory properties that the user has to fill, the source and deploy.
They both will have an array of objects that will contain the apiKeys that are related to the sites that we want to use in the project and optionally it will have the features, for example:`sh
{
"source":[
{
"apiKey":"1_QWERTYUIOPASDFGHJKLZXCVBNM",
"features": ["Schema","PermissionGroups","WebSdk"]
}
]
}
`$3
`sh
{
"source":[
{
"apiKey":"1_QWERTYUIOPASDFGHJKLZXCVBNM",
"features": []
}
]
}
`$3
Using the feature-specific command lets the user run a specific feature instead of running all of them when doing an operation (init, reset, build, deploy).
To use them, simply write on the terminal
`sh
npm run -- -f
`For example:
`sh
npm run init -- -f Schema
`In this example the user is only going to run the feature Schema when running the operation init, the feature name can be replaced by any other feature (Email Templates, WebScreenSet, PermissionGroup, WebSdk...).
To show all the possible commands, the user can write simply
Preview
The preview mode is a feature that allows the user to see and test the changes in the local environment, without the need to
deploy the data to the customer data cloud console.$3
The filter is applied on the "src/index.html" file, that will filter the screens that the user will choose to see by using the apiKeys that are configured on the configuration file
cdc-accelerator.json, for example:`sh
[{
apiKey: '1_2ABCDEFGHI345',
screens: [{ screenSetID: 'PreferencesCenter-ProfileUpdate', screenID: 'gigya-update-profile-screen' }],
emails: [ { emailID: 'codeVerification', languages: ['en'] } ]
}]
`$3
`sh
[{
apiKey: '1_2ABCDEFGHI345',
screens: [
{ screenSetID: 'PreferencesCenter-ProfileUpdate', screenID: 'gigya-update-profile-screen' },
{ screenSetID: 'PreferencesCenter-Landing', screenID: 'gigya-login-screen' },
],
emails: []
},
{
apiKey: '1_3AS9DJAKSLA12',
emails: [{ emailID: 'doubleOptIn', languages: ['ar', 'en', 'pt-br'] }]
}]
`$3
`sh
[{
apiKey: '*',
emails: [{ emailID: 'doubleOptIn', languages: ['ar', 'en', 'pt-br'] } ]
}]
`$3
Using the different options of the preview will enable the user to control what he wants to see or filter.
-
: Retrieves the settings available on the source or deploy inside the cdc-accelerator.json.-
: Uses the local webSdk.js code that is inside the build/ directory.-
: Uses the local screensets.js code that is inside the build/ directory.-
: Defines what was configured above, including specific apiKeys and screens/email.-
: Defines the language of the screen-sets, which can be changed according to user preference.`sh
preview
({
origin: 'source',
useLocalWebSdk: true,
useLocalScreenSets: true,
filter,
lang: 'en',
})
``This project is open to feature requests/suggestions, bug reports etc. via GitHub issues. Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our Contribution Guidelines.
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone. By participating in this project, you agree to abide by its Code of Conduct at all times.
Copyright 2023 SAP SE or an SAP affiliate company and sap-customer-data-cloud-accelerator contributors. Please see our LICENSE for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available via the REUSE tool.