"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const forwardIdentifyEvent_1 = __importDefault(require("./forwardIdentifyEvent"));
const forwardGroupEvent_1 = __importDefault(require("./forwardGroupEvent"));
const forwardTrackEvent_1 = __importDefault(require("./forwardTrackEvent"));
const presets_1 = require("./presets");
const destination = {
    name: 'Outfunnel',
    slug: 'outfunnel',
    mode: 'cloud',
    authentication: {
        scheme: 'custom',
        fields: {
            userId: {
                label: 'Outfunnel User Id',
                description: 'Outfunnel User ID. This is found under Account',
                type: 'string',
                required: true
            },
            apiToken: {
                label: 'API Token',
                description: 'Outfunnel API Token. This is found under Account',
                type: 'password',
                required: true
            }
        },
        testAuthentication: async (request) => {
            try {
                return await request('https://api-pls.outfunnel.com/v1/user');
            }
            catch (error) {
                throw new Error('Test authentication failed');
            }
        }
    },
    extendRequest({ settings }) {
        return {
            searchParams: {
                api_token: settings.apiToken
            }
        };
    },
    actions: {
        forwardTrackEvent: forwardTrackEvent_1.default,
        forwardIdentifyEvent: forwardIdentifyEvent_1.default,
        forwardGroupEvent: forwardGroupEvent_1.default
    },
    presets: presets_1.presets
};
exports.default = destination;
//# sourceMappingURL=index.js.map