Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
26 changes: 15 additions & 11 deletions packages/destination-actions/src/destinations/braze/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import triggerCanvas from './triggerCanvas'
import { EVENT_NAMES } from './ecommerce/constants'
import upsertCatalogItem from './upsertCatalogItem'

import mergeUsers from './mergeUsers'

const destination: DestinationDefinition<Settings> = {
name: 'Braze Cloud Mode (Actions)',
slug: 'actions-braze-cloud',
Expand Down Expand Up @@ -96,12 +98,14 @@ const destination: DestinationDefinition<Settings> = {
triggerCampaign,
triggerCanvas,
ecommerce,
ecommerceSingleProduct
ecommerceSingleProduct,
mergeUsers
},
presets: [
{
name: 'Track Calls',
subscribe: 'type = "track" and event != "Order Completed" and event != "Checkout Started" and event != "Order Refunded" and event != "Order Cancelled" and event != "Product Viewed"',
subscribe:
'type = "track" and event != "Order Completed" and event != "Checkout Started" and event != "Order Refunded" and event != "Order Cancelled" and event != "Product Viewed"',
partnerAction: 'trackEvent',
mapping: defaultValues(trackEvent.fields),
type: 'automatic'
Expand All @@ -110,9 +114,9 @@ const destination: DestinationDefinition<Settings> = {
name: 'Order Placed (beta)',
subscribe: 'event = "Order Completed"',
partnerAction: 'ecommerce',
mapping: {
mapping: {
...defaultValues(ecommerce.fields),
name: EVENT_NAMES.ORDER_PLACED,
name: EVENT_NAMES.ORDER_PLACED,
metadata: {
order_status_url: { '@path': '$.properties.order_status_url' }
}
Expand All @@ -123,9 +127,9 @@ const destination: DestinationDefinition<Settings> = {
name: 'Checkout Started (beta)',
subscribe: 'event = "Checkout Started"',
partnerAction: 'ecommerce',
mapping: {
mapping: {
...defaultValues(ecommerce.fields),
name: EVENT_NAMES.CHECKOUT_STARTED,
name: EVENT_NAMES.CHECKOUT_STARTED,
metadata: {
checkout_url: { '@path': '$.properties.checkout_url' }
}
Expand All @@ -136,9 +140,9 @@ const destination: DestinationDefinition<Settings> = {
name: 'Order Refunded (beta)',
subscribe: 'event = "Order Refunded"',
partnerAction: 'ecommerce',
mapping: {
mapping: {
...defaultValues(ecommerce.fields),
name: EVENT_NAMES.ORDER_REFUNDED,
name: EVENT_NAMES.ORDER_REFUNDED,
metadata: {
order_status_url: { '@path': '$.properties.order_status_url' }
}
Expand All @@ -149,9 +153,9 @@ const destination: DestinationDefinition<Settings> = {
name: 'Order Cancelled (beta)',
subscribe: 'event = "Order Cancelled"',
partnerAction: 'ecommerce',
mapping: {
mapping: {
...defaultValues(ecommerce.fields),
name: EVENT_NAMES.ORDER_CANCELLED,
name: EVENT_NAMES.ORDER_CANCELLED,
metadata: {
order_status_url: { '@path': '$.properties.order_status_url' }
}
Expand All @@ -162,7 +166,7 @@ const destination: DestinationDefinition<Settings> = {
name: 'Product Viewed (beta)',
subscribe: 'event = "Product Viewed"',
partnerAction: 'ecommerceSingleProduct',
mapping: {
mapping: {
...defaultValues(ecommerceSingleProduct.fields),
name: EVENT_NAMES.PRODUCT_VIEWED
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Testing snapshot for Braze's mergeUsers destination action: all fields 1`] = `
Object {
"merge_updates": Array [
Object {
"identifier_to_keep": Object {
"braze_id": "8$QYsxcxpjIn)Y",
"email": "[email protected]",
"external_id": "8$QYsxcxpjIn)Y",
"phone": "8$QYsxcxpjIn)Y",
"user_alias": Object {
"alias_label": "segment",
"alias_name": "keep-alias",
},
},
"identifier_to_merge": Object {
"braze_id": "8$QYsxcxpjIn)Y",
"email": "[email protected]",
"external_id": "8$QYsxcxpjIn)Y",
"phone": "8$QYsxcxpjIn)Y",
"user_alias": Object {
"alias_label": "segment",
"alias_name": "merge-alias",
},
},
},
],
}
`;

exports[`Testing snapshot for Braze's mergeUsers destination action: required fields 1`] = `
Object {
"merge_updates": Array [
Object {
"identifier_to_keep": Object {
"external_id": "user-to-keep",
},
"identifier_to_merge": Object {
"external_id": "user-to-merge",
},
},
],
}
`;
Loading
Loading