"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fields_1 = require("../fields");
const constants_1 = require("../constants");
const functions_1 = require("../functions");
const action = {
    title: 'Send Custom Events',
    description: 'Send custom Segment analytics events to Attentive.',
    defaultSubscription: 'type = "track" and event != "Product Viewed" and event != "Product Added" and event != "Order Completed" and event != "User Subscribed"',
    fields: {
        userIdentifiers: fields_1.userIdentifiers,
        occurredAt: fields_1.occurredAt,
        externalEventId: fields_1.externalEventId,
        type: fields_1.type,
        properties: fields_1.properties
    },
    perform: (request, { payload }) => {
        (0, functions_1.validate)(payload);
        return request(`${constants_1.API_URL}/${constants_1.API_VERSION}/events/custom`, {
            method: 'post',
            json: (0, functions_1.formatCustomEventJSON)(payload)
        });
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map