"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const createOrUpdateContact_1 = __importDefault(require("./createOrUpdateContact"));
const sendEvent_1 = __importDefault(require("./sendEvent"));
const destination = {
    name: 'Loops (Actions)',
    slug: 'actions-loops',
    mode: 'cloud',
    extendRequest: ({ settings }) => {
        return {
            headers: { Authorization: `Bearer ${settings.apiKey}`, 'Content-Type': 'application/json' }
        };
    },
    authentication: {
        scheme: 'custom',
        fields: {
            apiKey: {
                label: 'API Key',
                description: 'Your Loops API Key',
                type: 'password',
                required: true
            }
        },
        testAuthentication: (request) => {
            return request('https://app.loops.so/api/v1/api-key', { method: 'GET' });
        }
    },
    actions: {
        createOrUpdateContact: createOrUpdateContact_1.default,
        sendEvent: sendEvent_1.default
    },
    onDelete: async (request, { payload }) => {
        return request('https://app.loops.so/api/v1/contacts/delete', {
            method: 'POST',
            json: {
                userId: [payload.userId]
            }
        });
    }
};
exports.default = destination;
//# sourceMappingURL=index.js.map