Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import destination from '../index'

describe('customerio presets', () => {
it('includes the generic automatic lifecycle presets', () => {
const automaticPresetNames = destination.presets
?.filter((preset) => preset.type === 'automatic')
.map((preset) => preset.name)

expect(automaticPresetNames).toEqual(
expect.arrayContaining([
'Delete Device',
'Delete Relationship',
'Delete Person',
'Delete Object',
'Merge People',
'Suppress Person',
'Unsuppress Person'
])
)
})

it('includes Device Created or Updated in the create/update device subscriptions', () => {
const preset = destination.presets?.find((candidate) => candidate.name === 'Create or Update Device')

expect(preset?.subscribe).toContain('Device Created or Updated')
expect(destination.actions.createUpdateDevice.defaultSubscription).toContain('Device Created or Updated')
})

it('excludes reserved device and object events from the generic track event surface', () => {
const preset = destination.presets?.find((candidate) => candidate.name === 'Track Event')

expect(preset?.subscribe).toContain('event != "Device Created or Updated"')
expect(preset?.subscribe).toContain('event != "Device Deleted"')
expect(destination.actions.trackEvent.defaultSubscription).toContain('event != "Device Created or Updated"')
expect(destination.actions.trackEvent.defaultSubscription).toContain('event != "Device Deleted"')
expect(destination.actions.trackEvent.defaultSubscription).toContain('event != "Object Deleted"')
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { eventProperties } from '../customerio-properties'
const action: ActionDefinition<Settings, Payload> = {
title: 'Create or Update Device',
description: `Create or update a person's device.`,
defaultSubscription: 'type = "track" and event = "Application Installed"',
defaultSubscription:
'event = "Application Installed" or event = "Application Opened" or event = "Device Created or Updated"',
fields: {
person_id: {
label: 'Person ID',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,52 @@ const destination: DestinationDefinition<Settings> = {
},
{
name: 'Create or Update Device',
subscribe: 'event = "Application Installed" or event = "Application Opened"',
subscribe: `
event = "Application Installed"
or event = "Application Opened"
or event = "Device Created or Updated"
`,
partnerAction: 'createUpdateDevice',
mapping: defaultValues(createUpdateDevice.fields),
type: 'automatic'
},
{
name: 'Delete Device',
subscribe: 'event = "Application Uninstalled" or event = "Device Deleted"',
partnerAction: 'deleteDevice',
mapping: defaultValues(deleteDevice.fields),
type: 'automatic'
},
{
name: 'Delete Relationship',
subscribe: 'event = "Relationship Deleted"',
partnerAction: 'deleteRelationship',
mapping: defaultValues(deleteRelationship.fields),
type: 'automatic'
},
{
name: 'Delete Person',
subscribe: 'event = "User Deleted"',
partnerAction: 'deletePerson',
mapping: defaultValues(deletePerson.fields),
type: 'automatic'
},
{
name: 'Delete Object',
subscribe: 'event = "Object Deleted"',
partnerAction: 'deleteObject',
mapping: defaultValues(deleteObject.fields),
type: 'automatic'
},
{
name: 'Track Event',
subscribe: `
type = "track"
and event != "Application Installed"
and event != "Application Opened"
and event != "Application Uninstalled"
and event != "Device Created or Updated"
and event != "Device Deleted"
and event != "Relationship Deleted"
and event != "User Deleted"
and event != "User Suppressed"
Expand Down Expand Up @@ -130,6 +167,27 @@ const destination: DestinationDefinition<Settings> = {
mapping: defaultValues(createUpdateObject.fields),
type: 'automatic'
},
{
name: 'Merge People',
subscribe: 'type = "alias"',
partnerAction: 'mergePeople',
mapping: defaultValues(mergePeople.fields),
type: 'automatic'
},
{
name: 'Suppress Person',
subscribe: 'event = "User Suppressed"',
partnerAction: 'suppressPerson',
mapping: defaultValues(suppressPerson.fields),
type: 'automatic'
},
{
name: 'Unsuppress Person',
subscribe: 'event = "User Unsuppressed"',
partnerAction: 'unsuppressPerson',
mapping: defaultValues(unsuppressPerson.fields),
type: 'automatic'
},
{
name: 'Report Delivery Event',
subscribe: 'event = "Report Delivery Event"',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ const action: ActionDefinition<Settings, Payload> = {
description: 'Track an event for a known or anonymous person.',
defaultSubscription: `
type = "track"
and event != "Application Installed"
and event != "Application Opened"
and event != "Application Uninstalled"
and event != "Device Created or Updated"
and event != "Device Deleted"
and event != "Relationship Deleted"
and event != "User Deleted"
and event != "User Suppressed"
and event != "User Unsuppressed"
and event != "Group Deleted"
and event != "Object Deleted"
and event != "Report Delivery Event"
`,
fields: {
Expand Down