"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const identify_1 = __importDefault(require("./identify"));
const view_1 = __importDefault(require("./view"));
const lead_1 = __importDefault(require("./lead"));
const product_1 = __importDefault(require("./product"));
const addToCart_1 = __importDefault(require("./addToCart"));
const checkout_1 = __importDefault(require("./checkout"));
const code_1 = __importDefault(require("./code"));
const purchase_1 = __importDefault(require("./purchase"));
const install_1 = __importDefault(require("./install"));
const thirdPartyEvent_1 = __importDefault(require("./thirdPartyEvent"));
const destination = {
    name: 'Magellan AI (Actions)',
    slug: 'actions-magellan-ai',
    mode: 'cloud',
    authentication: {
        scheme: 'custom',
        fields: {
            pixelToken: {
                label: 'Pixel token',
                description: 'Unique identifier for the web pixel on whose behalf the event is being sent; 32 hex digits',
                type: 'string',
                required: true
            },
            apiToken: {
                label: 'API token',
                description: 'Required in order to pass GDPR deletion requests to Magellan AI',
                type: 'password',
                required: false
            }
        }
    },
    onDelete: async (request, { payload, settings }) => {
        if (!settings.apiToken)
            return;
        return request('https://api.magellan.ai/v2/gdpr/delete', {
            method: 'post',
            headers: { Authorization: `Bearer ${settings.apiToken}` },
            json: { ...payload, pixelToken: settings.pixelToken }
        });
    },
    actions: {
        identify: identify_1.default,
        view: view_1.default,
        lead: lead_1.default,
        product: product_1.default,
        addToCart: addToCart_1.default,
        checkout: checkout_1.default,
        code: code_1.default,
        purchase: purchase_1.default,
        install: install_1.default,
        thirdPartyEvent: thirdPartyEvent_1.default
    }
};
exports.default = destination;
//# sourceMappingURL=index.js.map