"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const actions_core_1 = require("@segment/actions-core");
const impression_1 = __importDefault(require("./impression"));
const impressionsList_1 = __importDefault(require("./impressionsList"));
const click_1 = __importDefault(require("./click"));
const purchase_1 = __importDefault(require("./purchase"));
const pageviews_1 = __importDefault(require("./pageviews"));
const destination = {
    name: 'Topsort',
    slug: 'actions-topsort',
    mode: 'cloud',
    description: 'Send events server-side to the Topsort Events API.',
    authentication: {
        scheme: 'custom',
        fields: {
            api_key: {
                label: 'API Key',
                description: 'Created under Settings > API Integration in the Topsort Manager Platform.',
                type: 'password',
                required: true
            },
            skipZeroPricePurchases: {
                label: 'Skip Zero Price Purchases',
                description: 'When enabled, purchase events with items that have zero or missing unit price will be filtered out.',
                type: 'boolean',
                required: false,
                default: false
            }
        }
    },
    presets: [
        {
            name: 'Impression',
            subscribe: 'type = "track" and event = "Product Viewed"',
            partnerAction: 'impression',
            mapping: (0, actions_core_1.defaultValues)(impression_1.default.fields),
            type: 'automatic'
        },
        {
            name: 'Click',
            subscribe: 'type = "track" and event = "Product Clicked"',
            partnerAction: 'click',
            mapping: (0, actions_core_1.defaultValues)(click_1.default.fields),
            type: 'automatic'
        },
        {
            name: 'Purchase',
            subscribe: 'type = "track" and event = "Order Completed"',
            partnerAction: 'purchase',
            mapping: (0, actions_core_1.defaultValues)(purchase_1.default.fields),
            type: 'automatic'
        },
        {
            name: 'Impressions List',
            subscribe: 'type = "track" and event = "Product List Viewed"',
            partnerAction: 'impressionsList',
            mapping: (0, actions_core_1.defaultValues)(impressionsList_1.default.fields),
            type: 'automatic'
        },
        {
            name: 'Banner Impression',
            subscribe: 'type = "track" and event = "Banner Impression"',
            partnerAction: 'impression',
            mapping: (0, actions_core_1.defaultValues)(impression_1.default.fields),
            type: 'automatic'
        },
        {
            name: 'Banner Click',
            subscribe: 'type = "track" and event = "Banner Click"',
            partnerAction: 'click',
            mapping: (0, actions_core_1.defaultValues)(click_1.default.fields),
            type: 'automatic'
        },
        {
            name: 'Page Views',
            subscribe: 'type = "page" or type = "screen"',
            partnerAction: 'pageviews',
            mapping: (0, actions_core_1.defaultValues)(pageviews_1.default.fields),
            type: 'automatic'
        }
    ],
    actions: {
        impression: impression_1.default,
        impressionsList: impressionsList_1.default,
        click: click_1.default,
        purchase: purchase_1.default,
        pageviews: pageviews_1.default
    }
};
exports.default = destination;
//# sourceMappingURL=index.js.map