"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const actions_core_1 = require("@segment/actions-core");
const sendEvent_1 = __importDefault(require("./sendEvent"));
const destination = {
    name: 'Epsilon (Actions)',
    slug: 'actions-epsilon',
    mode: 'cloud',
    description: 'Sync analytics events and user profile details to Epsilon',
    authentication: {
        scheme: 'basic',
        fields: {
            dtm_cid: {
                label: 'Company ID',
                description: 'Your Company ID. Contact Epsilon support for assistance.',
                type: 'string',
                required: true
            },
            dtm_cmagic: {
                label: 'Company Magic',
                description: 'Company Magic. Contact Epsilon support for assistance.',
                type: 'string',
                required: true
            }
        }
    },
    extendRequest(_) {
        return {
            headers: {
                'Content-Type': 'application/json'
            }
        };
    },
    actions: {
        sendEvent: sendEvent_1.default
    },
    presets: [
        {
            name: 'First App Open/App Download',
            subscribe: 'event = "Application Installed"',
            partnerAction: 'sendEvent',
            mapping: {
                ...(0, actions_core_1.defaultValues)(sendEvent_1.default.fields),
                dtm_event: 'firstOpen',
            },
            type: 'automatic'
        },
        {
            name: 'App Open',
            subscribe: 'event = "Application Opened"',
            partnerAction: 'sendEvent',
            mapping: {
                ...(0, actions_core_1.defaultValues)(sendEvent_1.default.fields),
                dtm_event: 'appOpen',
            },
            type: 'automatic'
        },
        {
            name: 'Sign in/Create Account',
            subscribe: 'event = "Signed In"',
            partnerAction: 'sendEvent',
            mapping: {
                ...(0, actions_core_1.defaultValues)(sendEvent_1.default.fields),
                dtm_event: 'signIn',
            },
            type: 'automatic'
        },
        {
            name: 'Add to Saved List',
            subscribe: 'event = "Product Added To Wishlist"',
            partnerAction: 'sendEvent',
            mapping: {
                ...(0, actions_core_1.defaultValues)(sendEvent_1.default.fields),
                dtm_event: 'addSavedList',
            },
            type: 'automatic'
        },
        {
            name: 'Add to Cart',
            subscribe: 'event = "Product Added"',
            partnerAction: 'sendEvent',
            mapping: {
                ...(0, actions_core_1.defaultValues)(sendEvent_1.default.fields),
                dtm_event: 'cart',
            },
            type: 'automatic'
        },
        {
            name: 'Transaction Complete',
            subscribe: 'event = "Order Completed"',
            partnerAction: 'sendEvent',
            mapping: {
                ...(0, actions_core_1.defaultValues)(sendEvent_1.default.fields),
                dtm_event: 'conversion',
            },
            type: 'automatic'
        }
    ]
};
exports.default = destination;
//# sourceMappingURL=index.js.map