"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.API_URL = void 0;
exports.formatTimestampAsUnixSeconds = formatTimestampAsUnixSeconds;
const sendEmailEvent_1 = __importDefault(require("./sendEmailEvent"));
const sendWebEvent_1 = __importDefault(require("./sendWebEvent"));
const sendTransactionEvent_1 = __importDefault(require("./sendTransactionEvent"));
const sendCustomEvent_1 = __importDefault(require("./sendCustomEvent"));
const dayjs_1 = __importDefault(require("../../lib/dayjs"));
exports.API_URL = 'https://api.converscience.com/events';
function formatTimestampAsUnixSeconds(ISOTimestamp) {
    return dayjs_1.default.utc(ISOTimestamp).unix();
}
const destination = {
    name: 'Actable Predictive',
    slug: 'actions-actable-predictive',
    mode: 'cloud',
    authentication: {
        scheme: 'custom',
        fields: {
            client_id: {
                label: 'Client ID',
                description: 'Your Actable-supplied Client ID.',
                type: 'string',
                required: true
            },
            client_secret: {
                label: 'Client Secret',
                description: 'Your Actable-supplied Client Secret.',
                type: 'password',
                required: true
            }
        },
        testAuthentication: (request) => {
            return request(exports.API_URL, {
                method: 'post',
                json: { data: [{ stream_key: 'auth' }] }
            });
        }
    },
    extendRequest({ settings }) {
        return {
            headers: { Authorization: Buffer.from(settings.client_id + ':' + settings.client_secret).toString('base64') }
        };
    },
    actions: {
        sendEmailEvent: sendEmailEvent_1.default,
        sendWebEvent: sendWebEvent_1.default,
        sendTransactionEvent: sendTransactionEvent_1.default,
        sendCustomEvent: sendCustomEvent_1.default
    }
};
exports.default = destination;
//# sourceMappingURL=index.js.map