"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const insider_properties_1 = require("../insider-properties");
const insider_helpers_1 = require("../insider-helpers");
const action = {
    title: 'Cart Viewed Event',
    description: 'Record Cart Viewed Event to Insider',
    defaultSubscription: 'type = "track" and event = "Cart Viewed"',
    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 },
        timestamp: { ...insider_properties_1.timestamp },
        parameters: { ...insider_properties_1.cart_event_parameters },
        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, 'cart_page_view')
        });
    },
    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, 'cart_page_view')
        });
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map