"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const insider_helpers_1 = require("../insider-helpers");
const insider_properties_1 = require("../insider-properties");
const action = {
    title: 'Track Event',
    description: 'Record custom event to Insider',
    defaultSubscription: 'type = "track"',
    fields: {
        email_as_identifier: { ...insider_properties_1.email_as_identifier },
        phone_number_as_identifier: { ...insider_properties_1.phone_number_as_identifier },
        append_arrays: { ...insider_properties_1.append_arrays },
        uuid: { ...insider_properties_1.uuid },
        segment_anonymous_id: { ...insider_properties_1.segment_anonymous_id },
        custom_identifiers: { ...insider_properties_1.custom_identifiers },
        event_name: { ...insider_properties_1.event_name },
        timestamp: { ...insider_properties_1.timestamp },
        parameters: { ...(0, insider_properties_1.getEventParameteres)([]) },
        products: { ...insider_properties_1.products },
        attributes: { ...insider_properties_1.user_attributes }
    },
    perform: (request, data) => {
        return request(`${insider_helpers_1.API_BASE}${insider_helpers_1.UPSERT_ENDPOINT}`, {
            method: 'post',
            json: (0, insider_helpers_1.sendTrackEvent)(data.payload, data.payload.event_name.toString().toLowerCase().trim().split(' ').join('_').toString())
        });
    },
    performBatch: (request, data) => {
        return request(`${insider_helpers_1.API_BASE}${insider_helpers_1.UPSERT_ENDPOINT}`, {
            method: 'post',
            json: (0, insider_helpers_1.sendBulkTrackEvents)(data.payload)
        });
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map