"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sendRequest = void 0;
const prepareJSON = (payload) => ({
    type: 'track',
    messageId: payload.messageId,
    event: payload.event,
    userId: payload.userId,
    groupId: payload.groupId,
    properties: payload.properties,
    timestamp: payload.timestamp,
    context: payload.context
});
const sendRequest = async (request, settings, payload) => {
    return request(`${settings.apiEndpoint}/v1/batch`, {
        method: 'post',
        json: { batch: payload.map(prepareJSON) }
    });
};
exports.sendRequest = sendRequest;
//# sourceMappingURL=utils.js.map