"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("./utils");
const action = {
    title: 'Track Event',
    description: 'Send an event to Sprig.',
    fields: {
        eventName: {
            description: 'The event to be sent to Sprig.',
            label: 'Event Name',
            required: true,
            type: 'string',
            default: {
                '@path': '$.event'
            }
        },
        timestamp: {
            description: 'The timestamp of the event.',
            label: 'Event Timestamp',
            required: true,
            type: 'string',
            default: {
                '@path': '$.timestamp'
            }
        },
        userId: {
            description: 'The userId of the identified user.',
            label: 'User ID',
            required: true,
            type: 'string',
            default: {
                '@path': '$.userId'
            }
        }
    },
    perform: (request, data) => {
        return request('https://api.sprig.com/v2/users', {
            method: 'POST',
            headers: {
                Authorization: `Bearer ${data.settings.apiKey}`
            },
            json: (0, utils_1.payloadTransform)(data.payload)
        });
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map