Skip to content

Commit

Permalink
modules for send events at RD Station generic,
Browse files Browse the repository at this point in the history
batch of events, ecommerce events,
communication events and functions to
adjust the expect properties and when needed
the expect input (body) of the requet
  • Loading branch information
AndyDaSilva52 committed Aug 22, 2020
1 parent a62cb57 commit 1c1e6c0
Show file tree
Hide file tree
Showing 61 changed files with 1,002 additions and 1,087 deletions.
Binary file removed apps/rd-station-252023.v1.zip
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "rd-station-2520232",
"label": "RD Station - API Key",
"label": "RD Station - API Key (Not Tested / Not Used in Any Module)",
"type": "basic"
}
32 changes: 19 additions & 13 deletions apps/rd-station-252023/functions/getExpectContact/code.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
function getExpectContact(fields, type) {
function getExpectContact(fields, type, origin) {

function getExpect(input, typ) {
function getExpect(input, typ, ori) {
var results = []

if (typ == 'interface') {results.push({"name": "uuid","label": "UUID","type": "text"})}

if (typ == 'expect') {}
if (typ == 'expect' || typ == 'expect-with-email') {}

input
//.filter(f => {return true})
.sort(function (a, b) { return a.uuid < b.uuid ? -1 : a.uuid > b.uuid ? 1 : 0 })
.sort(function(a,b) { if (a.label.default > b.label.default) { return 1 } if (a.label.default < b.label.default) { return -1 } return 0 })
//.sort(function (a, b) { return a.custom_field = false ? 1 : b.custom_field == false ? 1 : 0 })
.forEach(f => {
const data = { name: f.api_identifier, label: f.label.default, type: 'text'}
switch (f.data_type) {
Expand All @@ -27,16 +29,13 @@ function getExpectContact(fields, type) {
case 'TEXT_INPUT': {
break
}
case 'EMAIL_INPUT': {
data.type = 'email'
case 'EMAIL_INPUT': { data.type = 'email'
break
}
case 'PHONE_INPUT': {
data.type = 'text'
case 'PHONE_INPUT': { data.type = 'text'
break
}
case 'URL_INPUT': {
data.type = 'url'
case 'URL_INPUT': { data.type = 'url'
break
}
case 'RADIO_BUTTON': {
Expand Down Expand Up @@ -83,7 +82,14 @@ function getExpectContact(fields, type) {
}
case 'INTEGER': {
// presentation_type: 'NUMBER_INPUT'
data.type = 'number'
switch (ori) {
/** /platform/contacts Expect the value to be integer (outside double quotes)
/platform/events Expect the value inside double quotes (string) */
case 'contacts': data.type = 'integer'
break
case 'events': data.type = 'text'
break
}
}
}
results.push(data)
Expand All @@ -95,9 +101,9 @@ function getExpectContact(fields, type) {
{"name": "status","label": "Status","type": "text","help": "Can be empty when `Category` is `data_processing` or pay attention to the fact that when `Category` is `data_processing` the only accepted value for `Status` is `granted`."}]}
}
)
if (typ == 'expect') { results = results.filter(function(el) {return (el.name !== 'email')}) }
if (typ == 'expect') { results = results.filter(function(el) {return (el.name !== 'email') }) }
return results
}

if (Array.isArray(fields) && fields.length) { return getExpect(fields, type) } else { return {} }
if (Array.isArray(fields) && fields.length) { return getExpect(fields, type, origin) } else { return {} }
}
Loading

0 comments on commit 1c1e6c0

Please sign in to comment.