"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const common_fields_1 = require("../common-fields");
const utils_1 = require("../utils");
const action = {
    title: 'Track',
    description: 'Track a user action in Accoil',
    defaultSubscription: 'type = "track"',
    fields: {
        event: {
            type: 'string',
            required: true,
            description: 'The event name',
            label: 'Event Name',
            default: { '@path': '$.event' }
        },
        userId: {
            type: 'string',
            description: 'The ID associated with the user',
            label: 'User ID',
            required: true,
            default: { '@path': '$.userId' }
        },
        timestamp: common_fields_1.commonFields.timestamp
    },
    perform: (request, { payload, settings }) => {
        return request((0, utils_1.endpointUrl)(settings.api_key), {
            method: 'post',
            json: {
                type: 'track',
                event: payload.event,
                userId: payload.userId,
                timestamp: payload.timestamp
            }
        });
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map