Skip to content

Commit

Permalink
feat: onboard cordial destination (#1558)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauravudia authored Jul 22, 2024
1 parent 339a898 commit e9f2b33
Show file tree
Hide file tree
Showing 4 changed files with 266 additions and 0 deletions.
56 changes: 56 additions & 0 deletions src/configurations/destinations/cordial/db-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "CORDIAL",
"displayName": "Cordial",
"config": {
"cdkV2Enabled": true,
"transformAtV1": "router",
"saveDestinationResponse": true,
"supportedSourceTypes": [
"android",
"ios",
"web",
"unity",
"amp",
"cloud",
"warehouse",
"reactnative",
"flutter",
"cordova",
"shopify"
],
"supportedConnectionModes": {
"web": ["cloud"],
"android": ["cloud"],
"ios": ["cloud"],
"unity": ["cloud"],
"amp": ["cloud"],
"cloud": ["cloud"],
"warehouse": ["cloud"],
"reactnative": ["cloud"],
"flutter": ["cloud"],
"cordova": ["cloud"],
"shopify": ["cloud"]
},
"supportedMessageTypes": {
"cloud": ["identify", "track"]
},
"destConfig": {
"defaultConfig": ["apiKey", "apiBaseUrl", "oneTrustCookieCategories"],
"android": ["connectionMode"],
"ios": ["connectionMode"],
"web": ["connectionMode"],
"unity": ["connectionMode"],
"amp": ["connectionMode"],
"cloud": ["connectionMode"],
"warehouse": ["connectionMode"],
"reactnative": ["connectionMode"],
"flutter": ["connectionMode"],
"cordova": ["connectionMode"],
"shopify": ["connectionMode"]
},
"secretKeys": ["apiKey"]
},
"options": {
"isBeta": true
}
}
78 changes: 78 additions & 0 deletions src/configurations/destinations/cordial/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"configSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"required": ["apiKey", "apiBaseUrl"],
"type": "object",
"properties": {
"apiKey": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$"
},
"apiBaseUrl": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|(?!.*\\.ngrok\\.io)^(?:http(s)?:\\/\\/)?[\\w.-]+(?:\\.[\\w\\.-]+)+[\\w\\-\\._~:/?#[\\]@!\\$&'\\(\\)\\*\\+,;=.]+$|^$"
},
"oneTrustCookieCategories": {
"type": "array",
"items": {
"type": "object",
"properties": {
"oneTrustCookieCategory": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
}
}
}
},
"connectionMode": {
"type": "object",
"properties": {
"android": {
"type": "string",
"enum": ["cloud"]
},
"ios": {
"type": "string",
"enum": ["cloud"]
},
"web": {
"type": "string",
"enum": ["cloud"]
},
"unity": {
"type": "string",
"enum": ["cloud"]
},
"amp": {
"type": "string",
"enum": ["cloud"]
},
"reactnative": {
"type": "string",
"enum": ["cloud"]
},
"flutter": {
"type": "string",
"enum": ["cloud"]
},
"cordova": {
"type": "string",
"enum": ["cloud"]
},
"shopify": {
"type": "string",
"enum": ["cloud"]
},
"cloud": {
"type": "string",
"enum": ["cloud"]
},
"warehouse": {
"type": "string",
"enum": ["cloud"]
}
}
}
}
}
}
106 changes: 106 additions & 0 deletions src/configurations/destinations/cordial/ui-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"uiConfig": {
"baseTemplate": [
{
"title": "Initial setup",
"note": "Review how this destination is set up",
"sections": [
{
"groups": [
{
"title": "Connection settings",
"icon": "settings",
"fields": [
{
"type": "textInput",
"label": "API Key",
"note": [
"To create a new API Key, navigate to Settings > API Keys. ",
{
"text": "Learn more here",
"link": "https://support.cordial.com/hc/en-us/articles/115005365087-API-keys"
}
],
"configKey": "apiKey",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$",
"regexErrorMessage": "Invalid API Key",
"placeholder": "e.g. 753723xxx"
},
{
"type": "textInput",
"label": "API Base URL",
"note": "You can find out which one your account uses by navigating to your Cordial dashboard and checking the website URL.",
"configKey": "apiBaseUrl",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|(?!.*\\.ngrok\\.io)^(?:http(s)?:\\/\\/)?[\\w.-]+(?:\\.[\\w\\.-]+)+[\\w\\-\\._~:/?#[\\]@!\\$&'\\(\\)\\*\\+,;=.]+$|^$",
"regexErrorMessage": "Invalid API Base URl",
"placeholder": "e.g. https://usw2.admin.cordial.io"
}
]
}
]
},
{
"groups": [
{
"title": "Connection mode",
"note": [
"Update how you want to route events from your source to destination. ",
{
"text": "Get help deciding",
"link": "https://www.rudderstack.com/docs/destinations/rudderstack-connection-modes/"
}
],
"icon": "sliders",
"fields": []
}
]
}
]
},
{
"title": "Configuration settings",
"note": "Manage the settings for your destination",
"sections": [
{
"title": "Other settings",
"note": "Configure advanced RudderStack features here",
"icon": "otherSettings",
"groups": [
{
"title": "OneTrust cookie consent settings",
"note": [
"Enter your OneTrust category names if you have them configured. ",
{
"text": "Learn more ",
"link": "https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-javascript-sdk/onetrust-consent-manager/"
},
"about RudderStack's OneTrust Consent Manager feature."
],
"fields": [
{
"type": "tagInput",
"label": "Cookie category name",
"note": "Input your OneTrust category names by pressing 'Enter' after each entry",
"configKey": "oneTrustCookieCategories",
"tagKey": "oneTrustCookieCategory",
"placeholder": "e.g: Credit card visit",
"default": [
{
"oneTrustCookieCategory": ""
}
]
}
]
}
]
}
]
}
],
"sdkTemplate": {
"title": "SDK settings",
"note": "not visible in the ui",
"fields": []
}
}
}
26 changes: 26 additions & 0 deletions test/data/validation/destinations/cordial.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
"config": {
"apiBaseUrl": "https://abc.example.com",
"apiKey": "test-accessKey",
"oneTrustCookieCategories": [
{
"oneTrustCookieCategory": "Marketing"
}
]
},
"result": true
},
{
"config": {
"apiBaseUrl": "https://abc.example.com",
"oneTrustCookieCategories": [
{
"oneTrustCookieCategory": "Marketing"
}
]
},
"result": false,
"err": [" must have required property 'apiKey'"]
}
]

0 comments on commit e9f2b33

Please sign in to comment.